Skip to content

Commit

Permalink
Merge branch 'main' into central-logger (#12960)
Browse files Browse the repository at this point in the history
* chore(auth): debounce refreshAuthTokens (#12845)

* chore: add debounce callback helper

* chore: add unit tests

* chore: debounce fetchAuthSession

* chore: fix unit test

* chore: fix bundle size limits

* chore: update debounce logic

* chore: update dedup logic

* chore: debounce refreshAuthTokens

* chore: fix bundle size

* chore: address feedback

* chore: fix unit test

* chore: address feedback

* chore: update yarn.lock

* chore: address feedbak

* fix(data): update DataStore to send correct Control Messages when starting (#12861)

* chore(release): Publish [ci skip]

 - @aws-amplify/adapter-nextjs@1.0.13
 - @aws-amplify/analytics@7.0.13
 - @aws-amplify/api@6.0.13
 - @aws-amplify/api-graphql@4.0.13
 - @aws-amplify/api-rest@4.0.13
 - @aws-amplify/auth@6.0.13
 - aws-amplify@6.0.13
 - @aws-amplify/core@6.0.13
 - @aws-amplify/datastore@5.0.13
 - @aws-amplify/datastore-storage-adapter@2.1.13
 - @aws-amplify/geo@3.0.13
 - @aws-amplify/interactions@6.0.13
 - @aws-amplify/notifications@2.0.13
 - @aws-amplify/predictions@6.0.13
 - @aws-amplify/pubsub@6.0.13
 - @aws-amplify/react-native@1.0.13
 - @aws-amplify/react-native-example@0.0.14
 - @aws-amplify/rtn-push-notification@1.2.13
 - @aws-amplify/rtn-web-browser@1.0.13
 - @aws-amplify/storage@6.0.13
 - tsc-compliance-test@0.1.13

* chore(release): update API docs [ci skip]

* chore: enable codecov (#12876)

* docs(auth,analytics): adding in-line docs for public apis (#12882)

* docs(auth,analytics): adding in-line docs for public apis

* fix: unblock the max length lint

* chore(react-native): use react-native 0.71.0 as the dev dep

* fix: Default branch resolution when running E2E tests (#12910)

* fix: Lambda auth config value (#12922)

* chore: renable caching the package list in GH actions

* chore: remove unused codecov package (has been deprecated)

* feat(api): expose HTTP response from API errors (#12835)

---------

Co-authored-by: Hui Zhao <10602282+HuiSF@users.noreply.github.com>
Co-authored-by: Jim Blanchard <jim.l.blanchard@gmail.com>

* chore: temporarily disable codecov GH action integration (#12928)

* ci: run flaky data e2es without retry (#12758)

* ci: run flaky data e2es without retry

* only run on chrome

* restore workflow

---------

Co-authored-by: Aaron S <94858815+stocaaro@users.noreply.github.com>

* fix(core): Amplify.configure dispatches Hub event with unparsed config object (#12930)

* chore(repo): use typescript 5.0.2 across workspace

* chore(repo): refactor tsconfig hierarchy

- move the base tsconfig into the root of the workspace
- unifying tsconfig tsconfig.build tsconfig.test and tsconfig.watch settings

* chore(repo): promote rollup dependencies into workspace

- remove unused build.js script

* chore(repo): add build:watch using rollup

* chore(repo): setup eslint

* chore(adapter-nextjs): migrate to eslint

* fix(repo): test-github-actions using js-yaml already removed API

* chore(repo): add Code Spell Checker to recommended extension list

* chore(repo): add formatOn actions to formattingToggle controlables

* fix: not appending notification configs

* chore(release): Publish [ci skip]

 - @aws-amplify/adapter-nextjs@1.0.14
 - @aws-amplify/analytics@7.0.14
 - @aws-amplify/api@6.0.14
 - @aws-amplify/api-graphql@4.0.14
 - @aws-amplify/api-rest@4.0.14
 - @aws-amplify/auth@6.0.14
 - aws-amplify@6.0.14
 - @aws-amplify/core@6.0.14
 - @aws-amplify/datastore@5.0.14
 - @aws-amplify/datastore-storage-adapter@2.1.14
 - @aws-amplify/geo@3.0.14
 - @aws-amplify/interactions@6.0.14
 - @aws-amplify/notifications@2.0.14
 - @aws-amplify/predictions@6.0.14
 - @aws-amplify/pubsub@6.0.14
 - @aws-amplify/react-native@1.0.14
 - @aws-amplify/react-native-example@0.0.15
 - @aws-amplify/rtn-push-notification@1.2.14
 - @aws-amplify/rtn-web-browser@1.0.14
 - @aws-amplify/storage@6.0.14
 - tsc-compliance-test@0.1.14

* Revert "chore(repo): use typescript 5.0.2 across workspace" (#12941)

* Revert "chore(repo): use typescript 5.0.2 across workspace"

This reverts commit e20782e.

* chore(api-graphql): temporarily install rollup to package

* fix(repo): rollup generated sourcemap has wrong src path (#12947)

* fix(datastore): Treat head as optional to avoid errors (#12936)

* fix(datastore): Treat head as optional to avoid errors

* Add testing and fix follow-on issue

* fix(api-graphql): wrong arguments for GET operation of a CPK model

* fix: Remove special e2e treatment for validated tests (#12946)

fix: Remove special integ treament for validated tests

* fix(datastore): Limit docs integ test to one browser to improve stability (#12937)

* fix(api-graphql): same results returned for queries on the same model with different selection set

- caused by the incomplete GraphQL documents caching

* Update branch to work with merged updates from main

---------

Co-authored-by: israx <70438514+israx@users.noreply.github.com>
Co-authored-by: David McAfee <mcafd@amazon.com>
Co-authored-by: Jim Blanchard <jim.l.blanchard@gmail.com>
Co-authored-by: aws-amplify-bot <aws@amazon.com>
Co-authored-by: Hui Zhao <10602282+HuiSF@users.noreply.github.com>
Co-authored-by: AllanZhengYP <zheallan@amazon.com>
Co-authored-by: Hui Zhao <zhohz@amazon.com>
Co-authored-by: Ivan Artemiev <29709626+iartemiev@users.noreply.github.com>
Co-authored-by: Aaron S <94858815+stocaaro@users.noreply.github.com>
Co-authored-by: ManojNB <manojnb95@gmail.com>
Co-authored-by: ManojNB <manojnb@amazon.com>
Co-authored-by: Francisco Rodriguez <frodriguez.cs@gmail.com>
  • Loading branch information
13 people committed Feb 5, 2024
1 parent ad9b9a2 commit 4840d0a
Show file tree
Hide file tree
Showing 703 changed files with 12,373 additions and 10,494 deletions.
190 changes: 190 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
/** @type {import("eslint").ESLint.ConfigData}*/
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
extends: [
'eslint:recommended',
'standard',
'plugin:import/errors',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/stylistic',
'plugin:@typescript-eslint/recommended',
"plugin:prettier/recommended",
],
plugins: [
'@stylistic',
'@typescript-eslint',
'unused-imports',
'import',
'jsdoc',
],
env: {
es6: true,
node: true,
},
ignorePatterns: [
'dist',
'node_modules',
'.eslintrc.*',
'rollup',
'rollup.config.*',
'setupTests.ts',
'jest.setup.*',
'jest.config.*',
// temporarily disable lint on __tests__
'__tests__',
// will enable lint by packages
// 'adapter-nextjs',
'analytics',
'api',
'api-graphql',
'auth',
'aws-amplify',
'core',
'datastore',
'datastore-storage-adapter',
'geo',
'interactions',
'notifications',
'predictions',
'pubsub',
'react-native',
'rtn-push-notification',
'rtn-web-browser',
'storage',
],
rules: {
camelcase: [
'error',
{
allow: [
'graphql_headers',
// exceptions for the legacy config
/^(aws_|amazon_)/,
'access_key',
'secret_key',
'session_token',
// exceptions for the auth package
'redirect_uri',
'response_type',
'client_id',
'identity_provider',
'code_challenge',
'code_challenge_method',
'grant_type',
'code_verifier',
'logout_uri',
'id_token',
'access_token',
'token_type',
'expires_in',
'error_description',
// exceptions for the notifications package
'campaign_id',
'delivery_type',
'treatment_id',
'campaign_activity_id',
],
},
],
'import/no-deprecated': 'warn',
'import/no-empty-named-blocks': 'error',
'import/no-mutable-exports': 'error',
'import/no-relative-packages': 'error',
'import/newline-after-import': 'error',
'import/order': ['error', { 'newlines-between': 'always' }],
'no-eval': 'error',
'no-param-reassign': 'error',
'no-shadow': 'off',
'no-use-before-define': 'off',
'no-useless-constructor': 'off',
'no-trailing-spaces': 'error',
'no-return-await': 'error',
'object-shorthand': 'error',
'prefer-destructuring': 'off',
'promise/catch-or-return': [
'error',
{ terminationMethod: ['then', 'catch', 'asCallback', 'finally'] },
],
'space-before-function-paren': 'off',
'sort-imports': ['error', { ignoreDeclarationSort: true }],
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'error',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
'valid-typeof': ['error', { requireStringLiterals: false }],
'@stylistic/comma-dangle': [
'error',
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'always-multiline',
enums: 'always-multiline',
generics: 'always-multiline',
tuples: 'always-multiline',
},
],
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
'@stylistic/indent': 'off',
'@stylistic/max-len': [
'error',
{
code: 120,
ignoreComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
},
],
'@stylistic/padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: '*', next: 'return' },
],
'@typescript-eslint/method-signature-style': ['error', 'method'],
'@typescript-eslint/no-confusing-void-expression': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false, variables: false, classes: false },
],
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/prefer-destructuring': [
'error',
{ object: true, array: false },
],
'@typescript-eslint/space-before-function-paren': [
'error',
{ anonymous: 'never', named: 'never', asyncArrow: 'always' },
],
'jsdoc/no-undefined-types': 1,
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: ['packages/*/tsconfig.json', 'tsconfig.json'],
},
},
'import/ignore': ['react-native'],
},
};
6 changes: 3 additions & 3 deletions .github/actions/setup-samples-staging/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ runs:
env:
BRANCH: ${{ github.ref_name }}
run: |
if git ls-remote origin $BRANCH | grep -q refs/heads/next/$BRANCH$; then
# Branch exists, checkout and echo success message
if git ls-remote --exit-code --heads origin refs/heads/$BRANCH; then
# Corresponding branch on sample repo exists, check it out
git fetch origin $BRANCH
git checkout $BRANCH
echo "Checked out branch: $BRANCH"
else
# Branch doesn't exist, echo error message
# Corresponding branch doesn't exist, default to main
echo "Branch '$BRANCH' does not exist"
fi
Expand Down
24 changes: 2 additions & 22 deletions .github/integ-config/integ-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ tests:
sample_name: v2/owner-and-group-different-models-default-v2
spec: owner-and-group-different-models-default
browser: *minimal_browser_list
timeout_minutes: 45
retry_count: 10
- test_name: integ_datastore_auth_v2-owner-and-group-same-model-default
desc: 'DataStore Auth CLI v2'
framework: react
Expand All @@ -158,8 +156,6 @@ tests:
sample_name: v2/dynamic-user-pool-groups-default-v2
spec: dynamic-user-pool-groups-default
browser: *minimal_browser_list
timeout_minutes: 45
retry_count: 10
- test_name: integ_datastore_auth_v2-dynamic-user-pool-groups-owner-based-default
desc: 'DataStore Auth CLI v2'
framework: react
Expand Down Expand Up @@ -349,8 +345,6 @@ tests:
sample_name: [v2/related-models]
spec: cpk-related-models
browser: *extended_browser_list
timeout_minutes: 45
retry_count: 10
- test_name: integ_react_datastore_selective_sync
desc: 'DataStore - Selective Sync'
framework: react
Expand All @@ -371,9 +365,7 @@ tests:
category: datastore
sample_name: [v2/amplify-docs-examples]
spec: amplify-docs-examples
browser: *minimal_browser_list
timeout_minutes: 45
retry_count: 10
browser: [chrome]
- test_name: integ_react_datastore_websocket_disruption
desc: 'DataStore - WebSocket Disruption'
framework: react
Expand All @@ -386,11 +378,9 @@ tests:
framework: javascript
category: datastore
sample_name: [basic-crud]
browser: *minimal_browser_list
browser: [chrome]
spec: vanilla-js-basic-crud
amplifyjs_dir: true
timeout_minutes: 45
retry_count: 10
- test_name: integ_next_datastore_13_basic
desc: 'DataStore - Nextjs 13 build with SWC - basic JS app'
framework: next
Expand All @@ -411,20 +401,14 @@ tests:
category: datastore
sample_name: [v2/basic-crud]
spec: vite-basic-crud
# TODO: run on firefox
browser: [chrome]
timeout_minutes: 45
retry_count: 10
- test_name: integ_rollup_datastore_basic_crud
desc: 'Rollup + DataStore - Basic CRUD'
framework: rollup
category: datastore
sample_name: [rollup-basic-crud]
spec: rollup-basic-crud
# TODO: run on firefox
browser: [chrome]
timeout_minutes: 45
retry_count: 10

# API
- test_name: integ_react_graphql_api
Expand Down Expand Up @@ -520,17 +504,13 @@ tests:
sample_name: [auth-rsc]
spec: auth-rsc
browser: [chrome]
timeout_minutes: 45
retry_count: 10
- test_name: integ_next_sign_in_with_oauth
desc: 'Sign-in with the OAuth flow'
framework: next
category: auth
sample_name: [sign-in-with-oauth]
spec: sign-in-with-oauth
browser: [chrome]
timeout_minutes: 45
retry_count: 10

# DISABLED Angular/Vue tests:
# TODO: delete tests or add custom ui logic to support them.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/callable-get-package-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Dump Package List
if: steps.cache-package-list.outputs.cache-hit != 'true'
run: |
echo "packages=$(yarn lerna ls | egrep -v "lerna|Done|yarn" | jq -R -s -c 'split("\n")[:-1]')" > package-list.json
echo "packages=$(yarn lerna ll | egrep -v "lerna|Done|yarn" | jq -R -s -c 'split("\n")[:-1] | map({name: split(" ")[0], path: split(" ")[-1]})')" > package-list.json
- name: Get Package List
id: get_package_list
run: |
Expand Down
25 changes: 23 additions & 2 deletions .github/workflows/callable-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
get-package-list:
uses: ./.github/workflows/callable-get-package-list.yml
unit_test:
name: Unit Test - ${{ matrix.package }}
name: Unit Test - ${{ matrix.package.name }}
runs-on: ubuntu-latest
needs: get-package-list
strategy:
Expand All @@ -23,5 +23,26 @@ jobs:
- name: Run tests
working-directory: ./amplify-js
env:
TEST_PACKAGE: ${{ matrix.package }}
TEST_PACKAGE: ${{ matrix.package.name }}
run: npx lerna exec --scope $TEST_PACKAGE yarn test
# disable temporarily
# - name: Check coverage report existence
# id: check-report
# env:
# PACKAGE_PATH: ${{ matrix.package.path }}
# run: |
# if [ -f ./amplify-js/$PACKAGE_PATH/coverage/coverage-final.json ]; then
# echo "SHOULD_UPLOAD_REPORT=true" >> $GITHUB_OUTPUT;
# fi
# - name: Get coverage report flag
# if: steps.check-report.outputs.SHOULD_UPLOAD_REPORT == 'true'
# env:
# PACKAGE_PATH: ${{ matrix.package.path }}
# id: split-path
# run: echo "REPORT_FLAG=${PACKAGE_PATH##*/}" >> $GITHUB_OUTPUT
# - name: Upload coverage report
# if: steps.check-report.outputs.SHOULD_UPLOAD_REPORT == 'true'
# uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
# with:
# files: ./amplify-js/${{ matrix.package.path }}/coverage/coverage-final.json
# flags: ${{ steps.split-path.outputs.REPORT_FLAG }}
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ docs
package.json
yarn.lock
package-lock.json
.eslintrc.js
www
.stencil
PULL_REQUEST_TEMPLATE.md
Expand Down
4 changes: 3 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"esbenp.prettier-vscode",
"tombonnike.vscode-status-bar-format-toggle"
"tombonnike.vscode-status-bar-format-toggle",
"dbaeumer.vscode-eslint",
"streetsidesoftware.code-spell-checker"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"type": "node",
"request": "launch",
// The debugger will only run tests for the package specified here:
"cwd": "${workspaceFolder}/packages/api-graphql",
"cwd": "${workspaceFolder}/packages/datastore",
"runtimeArgs": [
"--inspect-brk",
"${workspaceRoot}/node_modules/.bin/jest",
// Optionally specify a single test file to run/debug:
"AWSAppSyncRealTimeProvider.test.ts",
"connectivityHandling.test.ts",
"--runInBand",
"--testTimeout",
"600000", // 10 min timeout so jest doesn't error while we're stepping through code
Expand Down
13 changes: 7 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"editor.insertSpaces": false,
"editor.tabSize": 4,
"prettier.requireConfig": true,
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"formattingToggle.affects": [
"editor.codeActionsOnSave.source.fixAll.eslint",
"editor.formatOnPaste",
"editor.formatOnSave",
"editor.formatOnType"
]
}
2 changes: 1 addition & 1 deletion docs/api/assets/js/search.json

Large diffs are not rendered by default.

Loading

0 comments on commit 4840d0a

Please sign in to comment.