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

Add global sandbox mode #8063

Closed

Conversation

danielleadams
Copy link
Contributor

@danielleadams danielleadams commented Aug 30, 2021

Description of changes

This adds the global sandbox mode for transformer v2. The transformer uses the presence of type AMPLIFY_GLOBAL @allow_public_data_access_with_api_key(env: string) in the GraphQL schema. The API must have an API_KEY associated with the API resource in order to use Global Sandbox Mode.

Includes:
  • Add type AMPLIFY_GLOBAL @allow_public_data_access_with_api_key to generated schemas on api add
  • Display warning message on amplify status
  • Add functionality for transformer to use global auth mode and API key status to write to templates
  • Prompt user to create a new API key on amplify push when key is expired or absent and sandbox mode is enabled

Description of how you validated changes

Unit tests were added to test the individual code functionality. Also, an e2e test was added to test generating the GraphQL schema with the directive and pushing resources. Additionally, functionality was testing locally in development environment.

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.

@codecov-commenter
Copy link

codecov-commenter commented Aug 31, 2021

Codecov Report

Merging #8063 (2817701) into master (7b5de7b) will increase coverage by 0.04%.
The diff coverage is 82.60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8063      +/-   ##
==========================================
+ Coverage   54.14%   54.18%   +0.04%     
==========================================
  Files         657      660       +3     
  Lines       37484    37558      +74     
  Branches     7696     7718      +22     
==========================================
+ Hits        20295    20351      +56     
- Misses      16349    16367      +18     
  Partials      840      840              
Impacted Files Coverage Δ
packages/amplify-cli-core/src/index.ts 100.00% <ø> (ø)
packages/amplify-cli/src/domain/amplify-toolkit.ts 2.35% <0.00%> (-0.04%) ⬇️
...el-transformer/src/__tests__/test-utils/helpers.ts 96.42% <ø> (ø)
...mation/service-walkthroughs/appSync-walkthrough.ts 18.41% <37.50%> (+0.61%) ⬆️
...tils/awscloudformation/cfn-api-artifact-handler.ts 85.71% <84.00%> (-0.58%) ⬇️
packages/amplify-cli/src/commands/status.ts 61.90% <91.66%> (-32.84%) ⬇️
...r-utils/awscloudformation/prompt-to-add-api-key.ts 100.00% <100.00%> (ø)
.../auth-config-to-app-sync-auth-type-bi-di-mapper.ts 100.00% <100.00%> (ø)
...ils/awscloudformation/utils/global-sandbox-mode.ts 100.00% <100.00%> (ø)
...c/extensions/amplify-helpers/get-api-key-config.ts 100.00% <100.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b5de7b...2817701. Read the comment docs.

@danielleadams danielleadams changed the title Enable sandbox mode Add global sandbox mode Aug 31, 2021
@lgtm-com

This comment has been minimized.

@danielleadams danielleadams marked this pull request as ready for review August 31, 2021 18:58
@danielleadams danielleadams requested a review from a team as a code owner August 31, 2021 18:58
@danielleadams danielleadams changed the base branch from master to auth-dir-v-next August 31, 2021 18:59
@danielleadams danielleadams changed the base branch from auth-dir-v-next to master August 31, 2021 19:00
@danielleadams danielleadams marked this pull request as draft September 1, 2021 19:01
@danielleadams danielleadams deleted the enable-sandbox-mode branch September 13, 2021 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants