Skip to content

Commit

Permalink
testing'
Browse files Browse the repository at this point in the history
  • Loading branch information
austinhuminski committed Sep 18, 2019
1 parent 1d35ce6 commit 2b0e622
Show file tree
Hide file tree
Showing 52 changed files with 15,922 additions and 52 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,15 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

#amplify
amplify/\#current-cloud-backend
amplify/.config/local-*
amplify/mock-data
amplify/backend/amplify-meta.json
amplify/backend/awscloudformation
build/
dist/
node_modules/
aws-exports.js
awsconfiguration.json
14 changes: 14 additions & 0 deletions .graphqlconfig.yml
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
66 changes: 26 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Getting Setup
1. Download the repo
2. Change into the new directory
3. Install the dependencies: `npm install`





`npm install -g @aws-amplify/cli`

Inside repo directory:

`amplify init`



## Available Scripts

Expand All @@ -12,57 +27,28 @@ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br>
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.
## Install IOpipe via CLI
[https://github.com/iopipe/iopipe-cli](https://github.com/iopipe/iopipe-cli)

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!
`iopipe lambda install -f <Function Name> -t <token>`

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
```
Austins-MacBook-Pro:~ export IOPIPE_TOKEN=<IOPIPE_TOKEN>
Austins-MacBook-Pro:~ austinhuminski$ iopipe lambda install -f hackerNews-dev
### `npm run eject`
Install complete.
Austins-MacBook-Pro:~ austinhuminski$ iopipe lambda install -f trendingGitHubRepos-dev
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
Install complete.
```

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `npm run build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
17 changes: 17 additions & 0 deletions amplify/.config/project-config.json
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"
]
}
5 changes: 5 additions & 0 deletions amplify/backend/api/myheadlines/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"AppSyncApiName": "myheadlines",
"DynamoDBBillingMode": "PAY_PER_REQUEST",
"DynamoDBEnableServerSideEncryption": "false"
}
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. **
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. **
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. **
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. **
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. **
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$util.toJson($context.result)
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)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$util.toJson($context.result)
120 changes: 120 additions & 0 deletions amplify/backend/api/myheadlines/resolvers/Mutation.updateTodos.req.vtl
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)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$util.toJson($context.result)
Loading

0 comments on commit 2b0e622

Please sign in to comment.