Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(amplify-category-auth): use EnabledMFAs to only configure TOTP #7779

Merged
merged 3 commits into from Jul 23, 2021

Conversation

ammarkarachi
Copy link
Contributor

@ammarkarachi ammarkarachi commented Jul 22, 2021

Description of changes

Added a way to only configure only TOTP. Configuring the user pool with any other attribute with 'phone_number' turn on SMS MFA

Issue #, if available

Description of how you validated changes

yarn e2e src/__tests__/auth_*

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@sachscode sachscode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look Good! Some minor changes requested to reduce complexity and improve readablity/debuggability

Copy link
Contributor

@johnpc johnpc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@ammarkarachi ammarkarachi merged commit c2102c5 into aws-amplify:master Jul 23, 2021
ammarkarachi added a commit that referenced this pull request Jul 23, 2021
ammarkarachi added a commit that referenced this pull request Jul 23, 2021
@github-actions
Copy link

👋 Hi, this pull request was referenced in the v5.2.0 release!

Check out the release notes here https://github.com/aws-amplify/amplify-cli/releases/tag/v5.2.0.

@github-actions github-actions bot added the referenced-in-release Issues referenced in a published release changelog label Jul 27, 2021
akshbhu pushed a commit to akshbhu/amplify-cli that referenced this pull request Aug 15, 2021
…ws-amplify#7779)

* feat(amplify-category-auth): use EnabledMFAs to only configure TOTP

* fix(amplify-category-auth): creation of SNS role only when phone no is configured

* refactor(amplify-e2e-tests): address PR comments
akshbhu pushed a commit to akshbhu/amplify-cli that referenced this pull request Aug 15, 2021
ammarkarachi added a commit that referenced this pull request Aug 16, 2021
akshbhu added a commit that referenced this pull request Aug 20, 2021
* fix(amplify-category-auth): check for siwa Cognito idp params (#7678)

Need to check for siwa params because privateKey is not returned from Cognito, so it may not always
be available. Worst case the user will need to re-configure SIWA in a new environment for amplify
init.

Co-authored-by: David Lopez <lopezbnd@amazon.com>

* chore(release): Publish [ci skip]

 - amplify-app@3.0.3
 - amplify-appsync-simulator@1.27.2
 - amplify-category-api@2.31.14
 - amplify-category-auth@2.35.0
 - @aws-amplify/cli@5.1.1
 - amplify-console-integration-tests@1.8.0
 - amplify-container-hosting@1.3.14
 - amplify-e2e-core@1.23.0
 - amplify-e2e-tests@2.45.0
 - amplify-frontend-javascript@2.23.0
 - amplify-go-function-runtime-provider@1.8.6
 - @aws-amplify/graphql-function-transformer@0.3.5
 - @aws-amplify/graphql-http-transformer@0.4.1
 - @aws-amplify/graphql-model-transformer@0.4.4
 - @aws-amplify/graphql-predictions-transformer@0.2.0
 - @aws-amplify/graphql-searchable-transformer@0.3.0
 - @aws-amplify/graphql-transformer-core@0.7.0
 - @aws-amplify/graphql-transformer-interfaces@1.7.0
 - amplify-headless-interface@1.8.0
 - amplify-migration-tests@3.1.0
 - amplify-provider-awscloudformation@4.55.0
 - amplify-util-headless-input@1.5.1
 - amplify-util-mock@3.33.4

* fix(auth): standardize CloudFormation trigger templates, prevent errors at runtime (#7219)

* fix: add-to-group PostConfirmation Lambda should not throw

Co-authored-by: Colin Ihrig <colihrig@amazon.com>

* fix(amplify-cli): remove redundant prompt #6535 (#7098)

* fix: remove redundant prompt #6535

* fix(amplify-category-notifications): trim whitespace from fcm keys (#7456)

this commit prevents a copy/paste issue where an extra newline character comes along with an fcm
key.

fix #7440

* fix(amplify-provider-awscloudformation): rebase code and fixed yaml template load (#7518)

rebase code from latest updates and fixed yaml template load

* fix: check for undefined permissions when removing dependent permissions (#7594)

* fix: check for undefined permissions when removing dependent permissions

* fix(amplify-appsync-simulator): string functions not called on items … (#7636)

* fix(amplify-appsync-simulator): string functions not called on items of JavaArray<string> in the resolvers

* feat(amplify-appsync-simulator): added toJavaString that accepts a string and returns a JavaString

* feat(amplify-appsync-simulator): map.keySet returns an a JavaArray with elements of type JavaString

* feat(amplify-appsync-simulator): using this.mapper in map.keySet

* docs(cli): add 'future' to post-'amplify pull' success message for clarity (#7647)

change `Run 'amplify pull' to sync upstream changes.` -> `Run 'amplify pull' to sync future upstream
changes.` as desired in #5202

re #5202

Co-authored-by: Stuti Prasad <43947328+studpeps@users.noreply.github.com>

* Create: BatchSize and MaximumBatchingWindow parameters, V2 streaming lambda (#7651)

* fix: Move credential validation to the top function call

getProfileCredentials isn't always pulling from a file with an access key/secret key, so validation can error out in the case of source profiles. Moving this to the top function getProfiledAwsConfig and performing the validation on the AWS config instead means we can accommodate source profiles.

* Change: Make batch size parameterized on streaming

* Change: batch size and batching window duration are parameters

* Change: Decrease searchable streaming MaximumBatchingWindow to 1 second

Co-authored-by: Vandenberg <mvanden@88665a1e266e.ant.amazon.com>

* fix: show friendly error message when pull fails with EPERM (#7653)

* fix: show friendly error message when pull fails with EPERM
fix #7448

Co-authored-by: Colin Ihrig <cjihrig@gmail.com>

* fix(amplify-category-auth): \n made OS specific (#7663)

* style:removed extra whitespaces and standardized tabs in auth-templates

* fix(amplify-category-auth): fixed newline escape sequence to be os specific

fix #7662

* fix: add/update function when some LL are not yet migrated (#7674)

* fix: add/update function when some LL are not yet migrated

* ci: add support for automatic tagged release (#7691)

Do an automatic tagged NPM release when a branch name is prefixed with tagged-release/

* fix: #7441 - init from git prompts for credentials twice (#7682)

* chore: update yarn.lock file (#7644)

Co-authored-by: Colin Ihrig <colihrig@amazon.com>

* test(amplify-console-integration-tests): update the add environment fn ref pr#7098 (#7719)

* fix: checkout into existing env with new LL (#7687)

* fix: checkout into existing env with new LL

* test: update lambda function for auth schema tests, add optional types to LayerOptions, fix typos (#7728)

* fix(amplify-category-auth): added passrole policy to MFALambaRole (#7729)

Added policy with action iam:PassRole for MFALambdaRole

* chore(release): Publish [ci skip]

 - amplify-app@3.0.4
 - amplify-appsync-simulator@1.27.3
 - amplify-category-analytics@2.21.13
 - amplify-category-api@2.31.15
 - amplify-category-auth@2.35.1
 - amplify-category-function@2.33.1
 - amplify-category-hosting@2.7.13
 - amplify-category-notifications@2.19.4
 - amplify-category-predictions@2.9.4
 - amplify-category-storage@2.12.1
 - amplify-category-xr@2.8.13
 - amplify-cli-core@1.24.1
 - @aws-amplify/cli@5.1.2
 - amplify-console-hosting@1.9.4
 - amplify-console-integration-tests@1.8.1
 - amplify-container-hosting@1.3.15
 - amplify-dotnet-function-template-provider@1.5.13
 - amplify-dynamodb-simulator@1.19.4
 - amplify-e2e-core@1.23.1
 - amplify-e2e-tests@2.45.1
 - amplify-frontend-ios@2.20.6
 - amplify-frontend-javascript@2.23.1
 - amplify-go-function-runtime-provider@1.8.7
 - @aws-amplify/graphql-function-transformer@0.3.6
 - @aws-amplify/graphql-http-transformer@0.4.2
 - @aws-amplify/graphql-model-transformer@0.4.5
 - @aws-amplify/graphql-predictions-transformer@0.2.1
 - @aws-amplify/graphql-searchable-transformer@0.3.1
 - @aws-amplify/graphql-transformer-core@0.7.1
 - amplify-java-function-runtime-provider@1.8.6
 - amplify-migration-tests@3.1.1
 - amplify-nodejs-function-runtime-provider@1.6.3
 - amplify-nodejs-function-template-provider@1.6.13
 - amplify-provider-awscloudformation@4.55.1
 - amplify-python-function-runtime-provider@1.9.3
 - amplify-util-import@1.5.4
 - amplify-util-mock@3.33.5
 - graphql-auth-transformer@6.24.14
 - graphql-connection-transformer@4.21.14
 - graphql-dynamodb-transformer@6.22.14
 - graphql-elasticsearch-transformer@4.11.14
 - graphql-function-transformer@2.5.13
 - graphql-http-transformer@4.18.1
 - graphql-key-transformer@2.23.14
 - graphql-predictions-transformer@2.5.13
 - graphql-relational-schema-transformer@2.18.2
 - graphql-transformer-common@4.19.5
 - graphql-transformer-core@6.28.13
 - graphql-transformers-e2e-tests@6.24.4
 - graphql-versioned-transformer@4.17.14

* Fix typos in Cognito triggers (#7745)

* test(cli): add test for resource-status extensions (#7744)

* feat(cli): amplify folder deletes regardless of presence in the cloud (#7740)

`amplify delete` now deletes the local `amplify` folder even if the project has been deleted in the
cloud.

close #7631

* bug(amplify-cli):resource-test file location issue resolved (#7712)

* bug(amplify-cli):resource-test file location issue resolved

* Changed  to '' for standard practice

* style(amplify-cli): Moved path import to top of the file

* fix: upgrade node default runtime to 14 (#7700)

* fix: upgrade node runtime to 14

As we approach the EOL for node 12 security updates new
lambdas should be ideally be on node 14

* test: set nodejs14 as the detault

* Category graphql/searchable enum filter (#7683)

* feat(cli): searchable enum generates string filterinput

* feat(cli): searchable enum generates string filterinput

* remove unwanted imports

* remove unwanted imports

* set improvePluralization default value to true

* chore: upgrade yarn packages recommended by dependabot (#7670)

* ci: add support for e2e token rotation (#7665)

* ci: add support for e2e token rotation

Currently we use long-lived, manually generated access tokens to set up AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables allowing our tests to run. This is a bad practice - authorization tokens should be automatically rotated to minimize risk of the tokens landing in the wrong hands.

This PR sets up the Amplify CLI codebase to use temporary credentials during CI. Temporary STS credentials use an additional parameter, AWS_SESSION_TOKEN, to authorize the requests.

This has been tested in CI on my fork and all tests pass:

https://app.circleci.com/pipelines/github/johnpc/amplify-cli/144/workflows/fb12f075-d881-4c92-8cf7-f8647afb909e

The token rotator itself is a lambda that runs every hour:

https://github.com/johnpc/amplify-e2e-token-rotation-lambda

* chore: use ini lib instead of manually updating file

* chore: update injectSessionToken calls

* Feature/rds utils (#7650)

* fix(amplify-appsync-simulator): string functions not called on items of JavaArray<string> in the resolvers

* feat(amplify-appsync-simulator): add support for rdsUtils.toJsonString

* feat(amplify-appsync-simulator): added toJavaString that accepts a string and returns a JavaString

* feat(amplify-appsync-simulator): map.keySet returns an a JavaArray with elements of type JavaString

* feat(amplify-appsync-simulator): map.keySet returns an a JavaArray with elements of type JavaString

* feat(amplify-appsync-simulator): using this.mapper in map.keySet

* feat(amplify-appsync-simulator): cleanup

* Revert "chore: upgrade yarn packages recommended by dependabot (#7670)" (#7758)

This reverts commit 6d16146.

* feat: add @aws_lambda to GQL transformer pass through directive list (#7757)

Updated GraphQL transformer to pass through @aws_lambda directive to output schema

* fix: disable layer version removal if fn depends on pinned version (#7627)

* fix: disable layer version removal when lambda fn depends on pinned version

* test(amplify-category-function): update remove walkthrough unit tests

* test(amplify-category-function): update amplify-meta mock value

* fix: display all dependent lambda fn in message

* test: add e2e test to verify dependency check

* fix(cli): use more explicit amplify pragma in .gitignore (#7568)

* fix(cli): use more explicit amplify pragma in .gitignore

Previously, we used the #amplify pragma to show which block of .gitignore was managed by amplify.
This causes confusion for customers who think it is safe to add or remove lines this section of
their gitignore. The cli will blitz any changes to this section on amplify init or amplify pull. By
using a more explicit pragma, customers will realize they should not touch this section of the
gitignore.

fix #7250

* test(cli): add coverage of legacy case

* chore: address nits

* chore: s/removeAmplifyIgnore/rebuildAmplifyIgnore

* fix(graphql-searchable-transformer): fix for awstimestamp issues with elastic search (#7534)

* feat(graphql-searchable-transformer): fix _lastChangedAt type for version control

* feat(graphql-searchable-transformer): more generic fix for all epoch fields

* fix(graphql-searchable-transformer): prevent int cast from truncating decimals if they exist

* feat(graphql-searchable-transformer): changed fix to use is_integer()

* Revert "ci: add support for e2e token rotation (#7665)" (#7759)

This reverts commit 57c0a03.

Co-authored-by: Ammar <56042290+ammarkarachi@users.noreply.github.com>

* Revert "fix: upgrade node default runtime to 14 (#7700)" (#7763)

This reverts commit 47968cc.

* Revert "Revert "ci: add support for e2e token rotation (#7665)" (#7759)" (#7762)

This reverts commit aadc915.

* test(amplify-console-integration-tests): handle no session token

* feat(amplify-category-function): skip unnecessary prompt for 'amplify update function'

* feat(amplify-category-function): skip unnecessary prompt for 'amplify update function'

* test: remove additional prompt from e2e

* feat(amplify-category-auth): enable alternative signup/signin options (#7461)

* feat(amplify-category-auth): enable alternative signup/signin options

this commit mirrors the options presented to users when creating a cognito user pool in the aws
console. alternative sign in options allow developers to create a coginito user that can sign in
using their preferred username, phone number, or email address.

re #1546

* feat(amplify-category-auth): add autoVerifiedAttributes for aliasAttributes

* chore(amplify-headless-interface): update schema

* chore(amplify-category-auth): get aliasAttributes _instead_ of signInOptions

* chore: use constants instead of magic strings

* fix(cli): prevent re-prompt of info on `amplify pull` (#7730)

* fix(cli): prevent re-prompt of info on `amplify pull`

 When the developer runs `amplify pull` and chooses "no" when prompted: "Do you plan on modifying this backend?", the cli should not prompt for all the project configuration settings when `amplify pull` is called again to receive updates. Since the entire `amplify/` dir is removed when this option is selected, we lose project configuration context.
This change keeps the `amplify/` dir around, only deleting the backend directories, and maintains the state of the project configuration.

* chore: use more explicit names

* test: add integ test

* test: remove extra push

* fix(cli): make delete clean local project if already deleted in cloud (#7551)

this commit adds NotFoundException handling to the `amplify delete` operation. If cloud resources
are not found, then that part of the delete must already be done, so we should move on and continue
deletion.

fix #7515

* test(amplify-e2e-tests): remove unneeded deleteProject call (#7769)

* chore(amplify-category-auth): use constants instead of magic strings (#7770)

* chore: remove stalebot config (#7768)

* test(amplify-category-auth): use AttributeType enum in test (#7773)

* bug(amplify-cli):Solved Windows compatibility issue, made location pa… (#7710)

* bug(amplify-cli):Solved Windows compatibility issue, made location paths os-specific

* Removed resource-test updation

* bug(amplify-cli):added addSnapshotSerializer functionality

* Updating "" to '' for standardization

Co-authored-by: Colin Ihrig <cjihrig@gmail.com>

* Fixed indentation

* fix(amplify-cli):Moved function to seperate file

* bug(amplify-cli):Created an object for addSnapshotSerializer()

* Fixed spaces in path.join()

* bug(amplify-cli):test function added to snapshot-serializer

* Removed extra space in .json file

Co-authored-by: Colin Ihrig <cjihrig@gmail.com>

* fix(amplify-category-auth): add handling for undefined autoVerifiedAttributes (#7780)

* test(amplify-e2e-tests): assume function and layer lambdas are not being tested simultaneously (#7782)

* test(amplify-e2e-tests): add layerAndFunctionExist param to trigger capability selection (#7784)

* feat(amplify-category-auth): use EnabledMFAs to only configure TOTP (#7779)

* feat(amplify-category-auth): use EnabledMFAs to only configure TOTP

* fix(amplify-category-auth): creation of SNS role only when phone no is configured

* refactor(amplify-e2e-tests): address PR comments

* Revert "feat(amplify-category-auth): use EnabledMFAs to only configure TOTP (#7779)" (#7790)

This reverts commit c2102c5.

* build: fix typo in publish script (#7788)

* test: turn off e2e test coverage, enable and fix import test (#7776)

* chore(release): Publish [ci skip]

 - amplify-app@3.0.5
 - amplify-appsync-simulator@1.27.4
 - amplify-category-analytics@2.21.14
 - amplify-category-api@2.31.16
 - amplify-category-auth@2.36.0
 - amplify-category-function@2.34.0
 - amplify-category-hosting@2.7.14
 - amplify-category-predictions@2.9.5
 - amplify-category-storage@2.12.2
 - amplify-category-xr@2.8.14
 - amplify-cli-core@1.25.0
 - @aws-amplify/cli@5.2.0
 - amplify-console-hosting@1.9.5
 - amplify-console-integration-tests@1.8.2
 - amplify-container-hosting@1.3.16
 - amplify-dotnet-function-template-provider@1.5.14
 - amplify-dynamodb-simulator@1.19.5
 - amplify-e2e-core@1.24.0
 - amplify-e2e-tests@2.46.0
 - amplify-frontend-ios@2.20.7
 - amplify-frontend-javascript@2.23.2
 - amplify-go-function-runtime-provider@1.8.8
 - @aws-amplify/graphql-function-transformer@0.3.7
 - @aws-amplify/graphql-http-transformer@0.4.3
 - @aws-amplify/graphql-model-transformer@0.4.6
 - @aws-amplify/graphql-predictions-transformer@0.2.2
 - @aws-amplify/graphql-searchable-transformer@0.3.2
 - @aws-amplify/graphql-transformer-core@0.7.2
 - amplify-headless-interface@1.9.0
 - amplify-java-function-runtime-provider@1.8.7
 - amplify-migration-tests@3.1.2
 - amplify-nodejs-function-runtime-provider@1.6.4
 - amplify-nodejs-function-template-provider@1.6.14
 - amplify-provider-awscloudformation@4.55.2
 - amplify-python-function-runtime-provider@1.9.4
 - amplify-util-headless-input@1.5.2
 - amplify-util-import@1.5.5
 - amplify-util-mock@3.33.6
 - graphql-auth-transformer@6.24.15
 - graphql-connection-transformer@4.21.15
 - graphql-dynamodb-transformer@6.22.15
 - graphql-elasticsearch-transformer@4.11.15
 - graphql-function-transformer@2.5.14
 - graphql-http-transformer@4.18.2
 - graphql-key-transformer@2.23.15
 - graphql-predictions-transformer@2.5.14
 - graphql-relational-schema-transformer@2.18.3
 - graphql-transformer-common@4.19.6
 - graphql-transformer-core@6.29.0
 - graphql-transformers-e2e-tests@6.24.5
 - graphql-versioned-transformer@4.17.15

* feat: add @PrimaryKey directive to Transformer v2 (#7797)

* fix: lambda timeout should be an integer type (#7699)

* fix: #7696 - support production package install for function category (#7812)

* fix: move storage check in @predictions v2 (#7816)

@predictions requires that storage is configured. This commit
moves the check out of the before() phase, as that is invoked
even if @predictions is not used in the schema, leading to
unnecessary errors.

Co-authored-by: Colin Ihrig <colihrig@amazon.com>

* fix(amplify-cli-core): new-line escape sequence made os-specific (#7814)

* fix(amplify-graphql-types-generator): path-format to match snapshot (#7800)

* chore: fixed typo (#7786)

* feat: capability injection for the vNext GraphQL Transformer (#7735)

* fix: correct behavior of --yes on push when missing env var (#7826)

* chore(release): Publish [ci skip]

 - amplify-app@3.0.6
 - amplify-appsync-simulator@1.27.5
 - amplify-category-analytics@2.21.15
 - amplify-category-api@2.31.17
 - amplify-category-auth@2.36.1
 - amplify-category-function@2.34.1
 - amplify-category-hosting@2.7.15
 - amplify-category-interactions@2.6.3
 - amplify-category-predictions@2.9.6
 - amplify-category-storage@2.12.3
 - amplify-category-xr@2.8.15
 - amplify-cli-core@1.25.1
 - @aws-amplify/cli@5.2.1
 - amplify-console-hosting@1.9.6
 - amplify-console-integration-tests@1.8.3
 - amplify-container-hosting@1.3.17
 - amplify-dotnet-function-runtime-provider@1.6.2
 - amplify-dotnet-function-template-provider@1.5.15
 - amplify-dynamodb-simulator@1.19.6
 - amplify-e2e-core@1.24.1
 - amplify-e2e-tests@2.46.1
 - amplify-frontend-ios@2.20.8
 - amplify-frontend-javascript@2.23.3
 - amplify-function-plugin-interface@1.9.1
 - amplify-go-function-runtime-provider@1.8.9
 - amplify-go-function-template-provider@1.3.10
 - @aws-amplify/graphql-function-transformer@0.4.0
 - @aws-amplify/graphql-http-transformer@0.5.0
 - @aws-amplify/graphql-index-transformer@0.2.0
 - @aws-amplify/graphql-model-transformer@0.5.0
 - @aws-amplify/graphql-predictions-transformer@0.3.0
 - @aws-amplify/graphql-searchable-transformer@0.4.0
 - @aws-amplify/graphql-transformer-core@0.8.0
 - @aws-amplify/graphql-transformer-interfaces@1.8.0
 - amplify-graphql-types-generator@2.8.4
 - amplify-java-function-runtime-provider@1.8.8
 - amplify-java-function-template-provider@1.5.9
 - amplify-migration-tests@3.1.3
 - amplify-nodejs-function-runtime-provider@1.6.5
 - amplify-nodejs-function-template-provider@1.6.15
 - amplify-provider-awscloudformation@4.56.0
 - amplify-python-function-runtime-provider@1.9.5
 - amplify-python-function-template-provider@1.3.12
 - amplify-util-import@1.5.6
 - amplify-util-mock@3.33.7
 - graphql-auth-transformer@6.24.16
 - graphql-connection-transformer@4.21.16
 - graphql-dynamodb-transformer@6.22.16
 - graphql-elasticsearch-transformer@4.11.16
 - graphql-function-transformer@2.5.15
 - graphql-http-transformer@4.18.3
 - graphql-key-transformer@2.23.16
 - graphql-predictions-transformer@2.5.15
 - graphql-transformer-core@6.29.1
 - graphql-transformers-e2e-tests@6.24.6
 - graphql-versioned-transformer@4.17.16

* test: improve schema validation in tests (#7845)

This commit exposes the validateModelSchema() function from
the GraphQL Transformer core. This function is helpful
for validating the Transformer output schema's correctness.
This commit also applies the validation to @predictions v2
test suite.

Co-authored-by: Colin Ihrig <colihrig@amazon.com>

* fix: add DDB params to model v2 (#7827)

This commit updates @model in GraphQL Transformer v2 to create
the DynamoDB related CloudFormation parameters and conditions.

Co-authored-by: Colin Ihrig <colihrig@amazon.com>

* feat: make cognito userpool id optional for headless mode (#7820)

* chore: update lerna and chalk dependencies, remove unused chalk-pipe (#7823)

* feat(amplify-util-mock): support pseudo parameters in environment variables when running `amplify mock function` (#7804)

* fix(amplify-category-auth): add auth user selections to aws-exports/amplifyconfiguration files (#7807)

* fix(graphql-auth-transformer): extend isOptional subscription owner check (#7765)

* fix: misc @model v2 VTL cleanup (#7856)

@model v2 was generating incorrect VTL in a large number of cases.
This commit fixes many of the cases found while working on the
@Index directive. It also moves some repeated code blocks into
functions.

Co-authored-by: Colin Ihrig <colihrig@amazon.com>

* fix: use improved pluralization in graphql transformer v2 (#7817)

This commit updates GraphQL Transformer v2 to use the newly
improved pluralization rules by default.

Co-authored-by: Colin Ihrig <colihrig@amazon.com>

* fix: multi-env container hosting (#7009) (#7346)

* fix: #7009 - Bug Fix for Multi-Env Container Hosting

* Update packages/amplify-cli/src/initialize-env.ts

Co-authored-by: John Hockett <jhockett@users.noreply.github.com>

* fix: multi-Env container hosting - format fixed

* Update to use hosting key from TPI

* add domain and restrictAccess to the template

* fix lint errors

* fix lint errors

* add allowed values for restrictAccess

* added tests for container based testing

* update tests

Co-authored-by: John Hockett <jhockett@users.noreply.github.com>

* Category graphql/searchable aggregate functions (#7764)

* feat(graphql-searchable): Aggregate support

* added enum type for aggregate type

* updated aggregate types to lowercase

* correct lint fix

* remove unused comments

* remove unwanted comments

* updated test snapshots

* update tests to include aggregate

* created new function for v2 searchTemplate

* organize imports

* Update packages/amplify-graphql-searchable-transformer/src/definitions.ts

Co-authored-by: Colin Ihrig <cjihrig@gmail.com>

* added e2e tests for aggregates

* remove unused imports

* update error handling

Co-authored-by: Colin Ihrig <cjihrig@gmail.com>

* test(graphql-model-transformer): graphql model transformer tests (#7836)

* Add .circleci/config.yml

* test: ported @model v1 test suite to v2

* chore(graphql-model-transformer): removed improvePluralization check, V2 uses improvePluralization

* chore(graphql-model-transformer): added parse() to tests that generate a valid schema

* test(graphql-model-transformer): added validateModelSchema check to existing model v2 tests

* feat: create new amplify-prompts package to handle all terminal interactions (#7774)

* feat: working on prompts package

* feat: add list picker methods

* feat: autocomplete for all pick types

* feat: fancy types

* test: restructure interface a bit and scaffold unit tests

* test: adding a bunch of tests

* chore: mark deprecated methods / functions

* chore: adding some comments

* Update packages/amplify-prompts/src/__tests__/prompter.test.ts

Co-authored-by: John Hockett <jhockett@users.noreply.github.com>

* chore: rename multiselect => multiSelect

* feat: better support for --yes and support input list

* fix: use EOL as line ending

Co-authored-by: John Hockett <jhockett@users.noreply.github.com>

* test(amplify-e2e-tests): add force push e2e with no change to functions and api (#7847)

* fix(graphql-model-transformer): model input fields transform (#7857)

* Add .circleci/config.yml

* test: ported @model v1 test suite to v2

* chore(graphql-model-transformer): removed improvePluralization check, V2 uses improvePluralization

* chore(graphql-model-transformer): added parse() to tests that generate a valid schema

* test(graphql-model-transformer): added validateModelSchema check to existing model v2 tests

* fix(graphql-model-transformer): fixed @model transform input object fields type

Converted fields of input type objects to also be of input type. Small typo fixes.

* Add .circleci/config.yml

* Add .circleci/config.yml

* chore(graphql-model-transformer): removed test for deprecated @model feature flag

* chore(amplify-provider-awscloudformation): reduce log level (#7864)

since cfn-lint is deprecated, it does not always proper validate cloudformation. we've made validation errors non-blocking already in [#7132](#7132). This commit also addresses the log level so as not to confuse customers with a red error message.

#7831

* fix(amplify-category-function): Storage env vars not added to lambda function (#7785)

* fix(7718) Storage env vars not added to lambda function

* unit-tests

Co-authored-by: Sachin Panemangalore <sachinrp@amazon.com>

* chore: rename master -> main branch (#7811)

* fix(amplify-frontend-ios): amplify-xcode, add files to primary target (#7738)

* fix: improve size checks before packaging Lambda resources (#7756)

* fix: improve size checks before packaging Lambda resources

* refactor: move folderSize to utils function, add limit const

* refactor: call getFolderSize with array of paths

* refactor: remove unused path import

* fix: lint ignore (#7871)

* test: fix test line trim (#7872)

* test: force chalk colors in test in CCI (#7875)

* Revert "chore: rename master -> main branch (#7811)" (#7868)

This reverts commit 9c4cd82.

* test(amplify-e2e-tests): fix casing for api name (#7885)

* fix: fiux e2e tests by passing categoryName for the resource (#7886)

* fix(container-hosting): e2e test fix (#7889)

* Revert "fix(container-hosting): e2e test fix (#7889)" (#7894)

This reverts commit f9d7983.

* fix(container-hosting): ignore test cases (#7895)

* fix(container-hosting): ignore test cases

* used it.skip instead of comments

* used it.skip instead of comments

* chore(release): Publish [ci skip]

 - amplify-app@3.0.7
 - amplify-appsync-simulator@1.27.6
 - amplify-category-analytics@2.21.16
 - amplify-category-api@2.31.18
 - amplify-category-auth@2.36.2
 - amplify-category-function@2.34.2
 - amplify-category-hosting@2.7.16
 - amplify-category-predictions@2.9.7
 - amplify-category-storage@2.12.4
 - amplify-category-xr@2.8.16
 - amplify-cli-core@1.26.0
 - @aws-amplify/cli@5.3.0
 - amplify-codegen-appsync-model-plugin@1.22.4
 - amplify-console-hosting@1.9.7
 - amplify-console-integration-tests@1.8.4
 - amplify-container-hosting@1.3.18
 - amplify-dotnet-function-template-provider@1.5.16
 - amplify-dynamodb-simulator@1.19.7
 - amplify-e2e-core@1.24.2
 - amplify-e2e-tests@2.46.2
 - amplify-frontend-android@2.15.4
 - amplify-frontend-flutter@0.4.4
 - amplify-frontend-ios@2.20.9
 - amplify-frontend-javascript@2.23.4
 - amplify-go-function-runtime-provider@1.8.10
 - @aws-amplify/graphql-function-transformer@0.4.1
 - @aws-amplify/graphql-http-transformer@0.5.1
 - @aws-amplify/graphql-index-transformer@0.2.1
 - @aws-amplify/graphql-model-transformer@0.5.1
 - @aws-amplify/graphql-predictions-transformer@0.3.1
 - @aws-amplify/graphql-searchable-transformer@0.4.1
 - @aws-amplify/graphql-transformer-core@0.8.1
 - @aws-amplify/graphql-transformer-interfaces@1.8.1
 - amplify-headless-interface@1.10.0
 - amplify-java-function-runtime-provider@1.8.9
 - amplify-migration-tests@3.1.4
 - amplify-nodejs-function-runtime-provider@1.6.6
 - amplify-nodejs-function-template-provider@1.6.16
 - amplify-prompts@1.1.0
 - amplify-provider-awscloudformation@4.56.1
 - amplify-python-function-runtime-provider@1.9.6
 - amplify-util-headless-input@1.5.3
 - amplify-util-import@1.5.7
 - amplify-util-mock@3.34.0
 - graphql-auth-transformer@6.24.17
 - graphql-connection-transformer@4.21.17
 - graphql-dynamodb-transformer@6.22.17
 - graphql-elasticsearch-transformer@4.11.17
 - graphql-function-transformer@2.5.16
 - graphql-http-transformer@4.18.4
 - graphql-key-transformer@2.23.17
 - graphql-mapping-template@4.18.2
 - graphql-predictions-transformer@2.5.16
 - graphql-relational-schema-transformer@2.18.4
 - graphql-transformer-common@4.19.7
 - graphql-transformer-core@6.29.2
 - graphql-transformers-e2e-tests@6.24.7
 - graphql-versioned-transformer@4.17.17

* feat: add @Index directive (#7887)

* feat: add @Index directive

* fix(graphql-model-transformer): fixed input type field generation for enum types

* fix: update @searchable v2 snapshot

* fix: address lgtm bot messages

* fix: update deps after latest release

Co-authored-by: Colin Ihrig <colihrig@amazon.com>
Co-authored-by: lazpavel <85319655+lazpavel@users.noreply.github.com>

* Feature/amplify enhanced status (#7698)

* enhanced amplify status

* help and test

* show summary view on amplify push

* Fixed s3

* unit test for showStatusTable

* fixed ViewResourceTableParams

* Converted cloudformation file-path to use Glob

* cleanup and headers

* 1. removed custom yaml handling and used library code.
2. Used readCFNTemplate to load templates.
3. Cleaned up unused code

* addressed PR comments

* Added types to template, diff

* addressed more PR comments

* updated unit test coverage and fixed test errors

* fix multi-env diffs for new resources

* 1. category filters for summary.
2. removed spacing between categories in detail-view.
3. updated help for summary.
4. added case normalization for options

* updated help to indicate summary filters

* Update Readme.md

Added category filters for summary table

* fixed unit tests and merge errors

* Update Readme.md

fixed case

* Update packages/amplify-cli-core/src/cliViewAPI.ts

Co-authored-by: akshbhu <39866697+akshbhu@users.noreply.github.com>

* Update packages/amplify-cli/src/extensions/amplify-helpers/resource-status-view.ts

Co-authored-by: akshbhu <39866697+akshbhu@users.noreply.github.com>

* addressed CR comments

* lgtm:fix:removed unused variable

* unit-tests for cliViewAPI

* removed styling from help test

* unit-test for detailed cloudformation-diff for one resource

Co-authored-by: Sachin Panemangalore <sachinrp@amazon.com>
Co-authored-by: akshbhu <39866697+akshbhu@users.noreply.github.com>

* chore(amplify-category-auth): updated login mechanisms label (#7878)

* fix(graphql-model-transformer): fixed input type field generation for enum types (#7879)

* fix(graphql-model-transformer): added @model name reserved words validation (#7877)

* fix(graphql-model-transformer): added @model name reserved words validation

* fix(graphql-model-transformer): added @model name reserved words validation

* Update packages/amplify-graphql-model-transformer/src/__tests__/model-transformer.test.ts

Co-authored-by: Colin Ihrig <cjihrig@gmail.com>

Co-authored-by: Colin Ihrig <cjihrig@gmail.com>

* Rename elasticsearch to @searchable & opensearch in v2 transformer (#7775)

* refactor(graphql-searchable-transformer): change Elasticsearch refs to @searchable and OpenSearch

* refactor(graphql-transformer-core): change Elasticsearch refs to @searchable and OpenSearch

* refactor(graphql-transformer-interfaces): change Elasticsearch refs to @searchable and OpenSearch

* refactor(graphql-model-transformer): change Elasticsearch refs to @searchable and OpenSearch

* refactor(graphql-mapping-template): add OpenSearch template that extends from Elasticsearch

* refactor(graphql-mapping-template): create Searchable template and extend for Elasticsearch template

* refactor(graphql-searchable-transformer): use Searchable mapping template

* refactor(graphql-searchable-transformer): update additional refs to Elasticsearch in python script

* refactor(graphql-transformer-common): add OpenSearch to resource constants file

* refactor(graphql-searchable-transformer): swap out Elasticsearch constants with OpenSearch

* refactor(graphql-transformer-core): fix typo

* refactor(graphql-transformer-core): change AMAZON_OPENSEARCH back to AMAZON_ELASTICSEARCH

* refactor(graphql-searchable-transformer): change AMAZON_OPENSEARCH back to AMAZON_ELASTICSEARCH

* refactor(graphql-transformer-interfaces): change AMAZON_OPENSEARCH back to AMAZON_ELASTICSEARCH

* Update packages/amplify-graphql-searchable-transformer/streaming-lambda/python_streaming_function.py

Co-authored-by: Colin Ihrig <cjihrig@gmail.com>

* refactor(graphql-transformer-core): fix rebase

* refactor(graphql-searchable-transformer): change ES_ env vars to OPENSEARCH_

* refactor(graphql-transformer-core): rename elastic search to searchble in code comments

Co-authored-by: Colin Ihrig <cjihrig@gmail.com>

* build(deps): bump tar from 4.4.13 to 4.4.15 (#7867)

Bumps [tar](https://github.com/npm/node-tar) from 4.4.13 to 4.4.15.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v4.4.13...v4.4.15)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: add deprecated tag to context.print (#7911)

* chore: mark context print deprecated

* chore: remove test prompts from demo

* feat(amplify-go-function-runtime-provider): add support for go1.16, install deps before build (#7617)

* fix(amplify-category-function): fixed issue for removing function env variable (#7917)

cloudformation-template.json file has the env variable in camel case format, so env variable
deletion should look for camel case version of the variable name

fix #7777

* fix: added await to init invocation (#7919)

* test: fix e2e and unit test failures related to status changes (#7936)

* test: fix auth e2e expect text (#7944)

* chore: add aws-cdk dep in amplify-cli (#7951)

* chore: add uuid in amplify-cli deps (#7955)

* fix: specify default auth role name on import auth (#7921)

* feat: model transformer advanced subscriptions (#7927)

* test: fix flaky add auth test (#7969)

* fix(amplify-category-auth): fixed no parameter when hostedui is not present (#7914)

* chore: add missing dependency, fix cdk version (#7980)

* chore: revert awscdk to 1.118.0, upgrade pkg to latest (#7983)

* feat: amplify add override root command and skeleton generation (#7684)

* feat: amplify add override root command and skeleton generation

* feat: build and package overrides directory

* test: add unit tests

* fix: updates with PR comments

* test: fix unit tests

Co-authored-by: Ghosh <kaustavg@3c22fb229ff6.ant.amazon.com>

* chore: publish ext branch as a tag (#7689)



Co-authored-by: Ghosh <kaustavg@3c22fb229ff6.ant.amazon.com>

* test: cci publish for ext branch

* test: pubish ext branch to npm

* feat: add helper util package for overrides (#7726)

* feat: add helper util package for overrides

* fix: remove lib files

* fix: add overrides helper lib to gitignore

* fix: namespace overrides package

* fix: fix eslint errors in lib/ files

Co-authored-by: Ghosh <kaustavg@3c22fb229ff6.ant.amazon.com>

* chore(release): Publish [ci skip]

 - @aws-amplify/cli-overrides-helper@1.1.0-ext.0

* feat: Override functionality enabled for Root stack (#7702)

* feat: initial commit

* feat: root stack creation on init with cdk

* feat: enable for push

* feat: added build command for root stack override

* fix: authrole and Unauthrole Names

* feat: added synthesizer and address comments

* feat: added hash for root stack

* feat: deploy root stack to disk

* feat: updated amplifyMeta after root override

* feat: update curren-cloud-backend

* feat: refractor Root transform and added unit tests

* fix: removes Template from Cloudform

* feat: added build step in overrides

* fix: unit tests

Co-authored-by: David Lopez <letsbelopez@gmail.com>
Co-authored-by: David Lopez <lopezbnd@amazon.com>
Co-authored-by: aws-amplify-bot <aws@amazon.com>
Co-authored-by: C. Lewis <1657236+ctjlewis@users.noreply.github.com>
Co-authored-by: Colin Ihrig <colihrig@amazon.com>
Co-authored-by: Gita Alekhya Paul <54375111+gitaalekhyapaul@users.noreply.github.com>
Co-authored-by: John Corser <john@johncorser.com>
Co-authored-by: Rafael M. Koike <koiker@users.noreply.github.com>
Co-authored-by: Mohammed Ali Chherawalla <mohammed.ali.chherawalla@gmail.com>
Co-authored-by: Bentheburrito <33915719+Bentheburrito@users.noreply.github.com>
Co-authored-by: Stuti Prasad <43947328+studpeps@users.noreply.github.com>
Co-authored-by: Marc VandenBerg <marc.vandenberg1@gmail.com>
Co-authored-by: Vandenberg <mvanden@88665a1e266e.ant.amazon.com>
Co-authored-by: Yathi <511386+yuth@users.noreply.github.com>
Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
Co-authored-by: John Hockett <jhockett@users.noreply.github.com>
Co-authored-by: Attila Hajdrik <hajdrik@amazon.com>
Co-authored-by: Josue Ruiz <josurui@amazon.com>
Co-authored-by: Ammar <56042290+ammarkarachi@users.noreply.github.com>
Co-authored-by: Luke Seemann <luke.seemann@vokal.io>
Co-authored-by: MURAKAMI Masahiko <m-murakami@esm.co.jp>
Co-authored-by: Michael Brewer <michael.brewer@gyft.com>
Co-authored-by: Christopher Sundersingh <83315412+sundersc@users.noreply.github.com>
Co-authored-by: John Corser <johnpc@umich.edu>
Co-authored-by: jcbdev <james@jcbdevelopment.co.uk>
Co-authored-by: josef <josef.aidt@gmail.com>
Co-authored-by: Yoshiaki Togami <62130798+togami2864@users.noreply.github.com>
Co-authored-by: Edward Foyle <foyleef@amazon.com>
Co-authored-by: Sam Patzer <wizagesmax@gmail.com>
Co-authored-by: lazpavel <85319655+lazpavel@users.noreply.github.com>
Co-authored-by: Josue Ruiz <7465495+SwaySway@users.noreply.github.com>
Co-authored-by: Sachin Panemangalore <83682223+sachscode@users.noreply.github.com>
Co-authored-by: Sachin Panemangalore <sachinrp@amazon.com>
Co-authored-by: Diego Costantino <diegoco@amazon.com>
Co-authored-by: Danielle Adams <6271256+danielleadams@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jainam Shah <jainam.2000@yahoo.com>
Co-authored-by: Kaustav Ghosh <kaustav.ghosh19@gmail.com>
Co-authored-by: Ghosh <kaustavg@3c22fb229ff6.ant.amazon.com>
ammarkarachi added a commit that referenced this pull request Oct 25, 2021
ammarkarachi added a commit that referenced this pull request Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
referenced-in-release Issues referenced in a published release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants