-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d35ce6
commit 2b0e622
Showing
52 changed files
with
15,922 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
projects: | ||
myheadlines: | ||
schemaPath: amplify/backend/api/myheadlines/build/schema.graphql | ||
includes: | ||
- src/graphql/**/*.js | ||
excludes: | ||
- ./amplify/** | ||
extensions: | ||
amplify: | ||
codeGenTarget: javascript | ||
generatedFileName: '' | ||
docsFilePath: src/graphql | ||
region: us-east-1 | ||
maxDepth: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"projectName": "myHeadlines", | ||
"version": "2.0", | ||
"frontend": "javascript", | ||
"javascript": { | ||
"framework": "react", | ||
"config": { | ||
"SourceDir": "src", | ||
"DistributionDir": "build", | ||
"BuildCommand": "npm run-script build", | ||
"StartCommand": "npm run-script start" | ||
} | ||
}, | ||
"providers": [ | ||
"awscloudformation" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"AppSyncApiName": "myheadlines", | ||
"DynamoDBBillingMode": "PAY_PER_REQUEST", | ||
"DynamoDBEnableServerSideEncryption": "false" | ||
} |
15 changes: 15 additions & 0 deletions
15
amplify/backend/api/myheadlines/pipelineFunctions/InvokeHackerNewsLambdaDataSource.req.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## [Start] Invoke AWS Lambda data source: HackerNewsLambdaDataSource. ** | ||
{ | ||
"version": "2018-05-29", | ||
"operation": "Invoke", | ||
"payload": { | ||
"typeName": "$ctx.stash.get("typeName")", | ||
"fieldName": "$ctx.stash.get("fieldName")", | ||
"arguments": $util.toJson($ctx.arguments), | ||
"identity": $util.toJson($ctx.identity), | ||
"source": $util.toJson($ctx.source), | ||
"request": $util.toJson($ctx.request), | ||
"prev": $util.toJson($ctx.prev) | ||
} | ||
} | ||
## [End] Invoke AWS Lambda data source: HackerNewsLambdaDataSource. ** |
6 changes: 6 additions & 0 deletions
6
amplify/backend/api/myheadlines/pipelineFunctions/InvokeHackerNewsLambdaDataSource.res.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## [Start] Handle error or return result. ** | ||
#if( $ctx.error ) | ||
$util.error($ctx.error.message, $ctx.error.type) | ||
#end | ||
$util.toJson($ctx.result) | ||
## [End] Handle error or return result. ** |
15 changes: 15 additions & 0 deletions
15
...ckend/api/myheadlines/pipelineFunctions/InvokeTrendingGitHubReposLambdaDataSource.req.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## [Start] Invoke AWS Lambda data source: TrendingGitHubReposLambdaDataSource. ** | ||
{ | ||
"version": "2018-05-29", | ||
"operation": "Invoke", | ||
"payload": { | ||
"typeName": "$ctx.stash.get("typeName")", | ||
"fieldName": "$ctx.stash.get("fieldName")", | ||
"arguments": $util.toJson($ctx.arguments), | ||
"identity": $util.toJson($ctx.identity), | ||
"source": $util.toJson($ctx.source), | ||
"request": $util.toJson($ctx.request), | ||
"prev": $util.toJson($ctx.prev) | ||
} | ||
} | ||
## [End] Invoke AWS Lambda data source: TrendingGitHubReposLambdaDataSource. ** |
6 changes: 6 additions & 0 deletions
6
...ckend/api/myheadlines/pipelineFunctions/InvokeTrendingGitHubReposLambdaDataSource.res.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## [Start] Handle error or return result. ** | ||
#if( $ctx.error ) | ||
$util.error($ctx.error.message, $ctx.error.type) | ||
#end | ||
$util.toJson($ctx.result) | ||
## [End] Handle error or return result. ** |
19 changes: 19 additions & 0 deletions
19
amplify/backend/api/myheadlines/resolvers/Mutation.createTodos.req.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## [Start] Prepare DynamoDB PutItem Request. ** | ||
$util.qr($context.args.input.put("createdAt", $util.defaultIfNull($ctx.args.input.createdAt, $util.time.nowISO8601()))) | ||
$util.qr($context.args.input.put("updatedAt", $util.defaultIfNull($ctx.args.input.updatedAt, $util.time.nowISO8601()))) | ||
$util.qr($context.args.input.put("__typename", "Todos")) | ||
{ | ||
"version": "2017-02-28", | ||
"operation": "PutItem", | ||
"key": #if( $modelObjectKey ) $util.toJson($modelObjectKey) #else { | ||
"id": $util.dynamodb.toDynamoDBJson($util.defaultIfNullOrBlank($ctx.args.input.id, $util.autoId())) | ||
} #end, | ||
"attributeValues": $util.dynamodb.toMapValuesJson($context.args.input), | ||
"condition": { | ||
"expression": "attribute_not_exists(#id)", | ||
"expressionNames": { | ||
"#id": "id" | ||
} | ||
} | ||
} | ||
## [End] Prepare DynamoDB PutItem Request. ** |
1 change: 1 addition & 0 deletions
1
amplify/backend/api/myheadlines/resolvers/Mutation.createTodos.res.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$util.toJson($context.result) |
49 changes: 49 additions & 0 deletions
49
amplify/backend/api/myheadlines/resolvers/Mutation.deleteTodos.req.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#if( $authCondition ) | ||
#set( $condition = $authCondition ) | ||
#if( $modelObjectKey ) | ||
#foreach( $entry in $modelObjectKey.entrySet() ) | ||
$util.qr($condition.put("expression", "$condition.expression AND attribute_exists(#keyCondition$velocityCount)")) | ||
$util.qr($condition.expressionNames.put("#keyCondition$velocityCount", "$entry.key")) | ||
#end | ||
#else | ||
$util.qr($condition.put("expression", "$condition.expression AND attribute_exists(#id)")) | ||
$util.qr($condition.expressionNames.put("#id", "id")) | ||
#end | ||
#else | ||
#if( $modelObjectKey ) | ||
#set( $condition = { | ||
"expression": "", | ||
"expressionNames": {} | ||
} ) | ||
#foreach( $entry in $modelObjectKey.entrySet() ) | ||
#if( $velocityCount == 1 ) | ||
$util.qr($condition.put("expression", "attribute_exists(#keyCondition$velocityCount)")) | ||
#else | ||
$util.qr($condition.put("expression", "$condition.expression AND attribute_exists(#keyCondition$velocityCount)")) | ||
#end | ||
$util.qr($condition.expressionNames.put("#keyCondition$velocityCount", "$entry.key")) | ||
#end | ||
#else | ||
#set( $condition = { | ||
"expression": "attribute_exists(#id)", | ||
"expressionNames": { | ||
"#id": "id" | ||
} | ||
} ) | ||
#end | ||
#end | ||
#if( $versionedCondition ) | ||
$util.qr($condition.put("expression", "($condition.expression) AND $versionedCondition.expression")) | ||
$util.qr($condition.expressionNames.putAll($versionedCondition.expressionNames)) | ||
#set( $expressionValues = $util.defaultIfNull($condition.expressionValues, {}) ) | ||
$util.qr($expressionValues.putAll($versionedCondition.expressionValues)) | ||
#set( $condition.expressionValues = $expressionValues ) | ||
#end | ||
{ | ||
"version": "2017-02-28", | ||
"operation": "DeleteItem", | ||
"key": #if( $modelObjectKey ) $util.toJson($modelObjectKey) #else { | ||
"id": $util.dynamodb.toDynamoDBJson($ctx.args.input.id) | ||
} #end, | ||
"condition": $util.toJson($condition) | ||
} |
1 change: 1 addition & 0 deletions
1
amplify/backend/api/myheadlines/resolvers/Mutation.deleteTodos.res.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$util.toJson($context.result) |
120 changes: 120 additions & 0 deletions
120
amplify/backend/api/myheadlines/resolvers/Mutation.updateTodos.req.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
#if( $authCondition && $authCondition.expression != "" ) | ||
#set( $condition = $authCondition ) | ||
#if( $modelObjectKey ) | ||
#foreach( $entry in $modelObjectKey.entrySet() ) | ||
$util.qr($condition.put("expression", "$condition.expression AND attribute_exists(#keyCondition$velocityCount)")) | ||
$util.qr($condition.expressionNames.put("#keyCondition$velocityCount", "$entry.key")) | ||
#end | ||
#else | ||
$util.qr($condition.put("expression", "$condition.expression AND attribute_exists(#id)")) | ||
$util.qr($condition.expressionNames.put("#id", "id")) | ||
#end | ||
#else | ||
#if( $modelObjectKey ) | ||
#set( $condition = { | ||
"expression": "", | ||
"expressionNames": {}, | ||
"expressionValues": {} | ||
} ) | ||
#foreach( $entry in $modelObjectKey.entrySet() ) | ||
#if( $velocityCount == 1 ) | ||
$util.qr($condition.put("expression", "attribute_exists(#keyCondition$velocityCount)")) | ||
#else | ||
$util.qr($condition.put("expression", "$condition.expression AND attribute_exists(#keyCondition$velocityCount)")) | ||
#end | ||
$util.qr($condition.expressionNames.put("#keyCondition$velocityCount", "$entry.key")) | ||
#end | ||
#else | ||
#set( $condition = { | ||
"expression": "attribute_exists(#id)", | ||
"expressionNames": { | ||
"#id": "id" | ||
}, | ||
"expressionValues": {} | ||
} ) | ||
#end | ||
#end | ||
## Automatically set the updatedAt timestamp. ** | ||
$util.qr($context.args.input.put("updatedAt", $util.defaultIfNull($ctx.args.input.updatedAt, $util.time.nowISO8601()))) | ||
$util.qr($context.args.input.put("__typename", "Todos")) | ||
## Update condition if type is @versioned ** | ||
#if( $versionedCondition ) | ||
$util.qr($condition.put("expression", "($condition.expression) AND $versionedCondition.expression")) | ||
$util.qr($condition.expressionNames.putAll($versionedCondition.expressionNames)) | ||
$util.qr($condition.expressionValues.putAll($versionedCondition.expressionValues)) | ||
#end | ||
#set( $expNames = {} ) | ||
#set( $expValues = {} ) | ||
#set( $expSet = {} ) | ||
#set( $expAdd = {} ) | ||
#set( $expRemove = [] ) | ||
#if( $modelObjectKey ) | ||
#set( $keyFields = [] ) | ||
#foreach( $entry in $modelObjectKey.entrySet() ) | ||
$util.qr($keyFields.add("$entry.key")) | ||
#end | ||
#else | ||
#set( $keyFields = ["id"] ) | ||
#end | ||
#foreach( $entry in $util.map.copyAndRemoveAllKeys($context.args.input, $keyFields).entrySet() ) | ||
#if( !$util.isNull($dynamodbNameOverrideMap) && $dynamodbNameOverrideMap.containsKey("$entry.key") ) | ||
#set( $entryKeyAttributeName = $dynamodbNameOverrideMap.get("$entry.key") ) | ||
#else | ||
#set( $entryKeyAttributeName = $entry.key ) | ||
#end | ||
#if( $util.isNull($entry.value) ) | ||
#set( $discard = $expRemove.add("#$entryKeyAttributeName") ) | ||
$util.qr($expNames.put("#$entryKeyAttributeName", "$entry.key")) | ||
#else | ||
$util.qr($expSet.put("#$entryKeyAttributeName", ":$entryKeyAttributeName")) | ||
$util.qr($expNames.put("#$entryKeyAttributeName", "$entry.key")) | ||
$util.qr($expValues.put(":$entryKeyAttributeName", $util.dynamodb.toDynamoDB($entry.value))) | ||
#end | ||
#end | ||
#set( $expression = "" ) | ||
#if( !$expSet.isEmpty() ) | ||
#set( $expression = "SET" ) | ||
#foreach( $entry in $expSet.entrySet() ) | ||
#set( $expression = "$expression $entry.key = $entry.value" ) | ||
#if( $foreach.hasNext() ) | ||
#set( $expression = "$expression," ) | ||
#end | ||
#end | ||
#end | ||
#if( !$expAdd.isEmpty() ) | ||
#set( $expression = "$expression ADD" ) | ||
#foreach( $entry in $expAdd.entrySet() ) | ||
#set( $expression = "$expression $entry.key $entry.value" ) | ||
#if( $foreach.hasNext() ) | ||
#set( $expression = "$expression," ) | ||
#end | ||
#end | ||
#end | ||
#if( !$expRemove.isEmpty() ) | ||
#set( $expression = "$expression REMOVE" ) | ||
#foreach( $entry in $expRemove ) | ||
#set( $expression = "$expression $entry" ) | ||
#if( $foreach.hasNext() ) | ||
#set( $expression = "$expression," ) | ||
#end | ||
#end | ||
#end | ||
#set( $update = {} ) | ||
$util.qr($update.put("expression", "$expression")) | ||
#if( !$expNames.isEmpty() ) | ||
$util.qr($update.put("expressionNames", $expNames)) | ||
#end | ||
#if( !$expValues.isEmpty() ) | ||
$util.qr($update.put("expressionValues", $expValues)) | ||
#end | ||
{ | ||
"version": "2017-02-28", | ||
"operation": "UpdateItem", | ||
"key": #if( $modelObjectKey ) $util.toJson($modelObjectKey) #else { | ||
"id": { | ||
"S": "$context.args.input.id" | ||
} | ||
} #end, | ||
"update": $util.toJson($update), | ||
"condition": $util.toJson($condition) | ||
} |
1 change: 1 addition & 0 deletions
1
amplify/backend/api/myheadlines/resolvers/Mutation.updateTodos.res.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$util.toJson($context.result) |
Oops, something went wrong.