From 2cad6f3c5559eb094ff046a632c949b3c085a544 Mon Sep 17 00:00:00 2001 From: Aaron S <94858815+stocaaro@users.noreply.github.com> Date: Mon, 16 Oct 2023 09:24:09 -0500 Subject: [PATCH 1/7] chore: v6 re-enable DataStore tests - batch 1 (#12301) * chore: Re-enable v2/owner-custom-field-default-v2 * chore: Turn on a bunch of v6 DataStore tests * fix: Integ test gaps * fix: Include missed test * Update integ-all.yml --- .github/integ-config/integ-all.yml | 126 ++++++++++++++--------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/.github/integ-config/integ-all.yml b/.github/integ-config/integ-all.yml index 3af0fd44f3f..5c41808506b 100644 --- a/.github/integ-config/integ-all.yml +++ b/.github/integ-config/integ-all.yml @@ -51,62 +51,62 @@ tests: # sample_name: owner-and-group-same-model-operations # spec: owner-and-group-same-model-operations # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-dynamic-user-pool-groups-default - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: dynamic-user-pool-groups-default - # spec: dynamic-user-pool-groups-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-dynamic-user-pool-groups-owner-based-default - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: dynamic-user-pool-groups-owner-based-default - # spec: dynamic-user-pool-groups-owner-based-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-private-auth-default - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: private-auth-default - # spec: private-auth-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-private-auth-iam - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: private-auth-iam - # spec: private-auth-iam - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-public-auth-default - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: public-auth-default - # spec: public-auth-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-public-auth-iam - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: public-auth-iam - # spec: public-auth-iam - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-owner-custom-claim-default - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: owner-custom-claim-default - # spec: owner-custom-claim-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-owner-custom-field-default - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: owner-custom-field-default - # spec: owner-custom-field-default - # browser: *minimal_browser_list + - test_name: integ_datastore_auth-dynamic-user-pool-groups-default + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: dynamic-user-pool-groups-default + spec: dynamic-user-pool-groups-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth-dynamic-user-pool-groups-owner-based-default + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: dynamic-user-pool-groups-owner-based-default + spec: dynamic-user-pool-groups-owner-based-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth-private-auth-default + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: private-auth-default + spec: private-auth-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth-private-auth-iam + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: private-auth-iam + spec: private-auth-iam + browser: *minimal_browser_list + - test_name: integ_datastore_auth-public-auth-default + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: public-auth-default + spec: public-auth-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth-public-auth-iam + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: public-auth-iam + spec: public-auth-iam + browser: *minimal_browser_list + - test_name: integ_datastore_auth-owner-custom-claim-default + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: owner-custom-claim-default + spec: owner-custom-claim-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth-owner-custom-field-default + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: owner-custom-field-default + spec: owner-custom-field-default + browser: *minimal_browser_list - test_name: integ_datastore_auth_v2-owner-based-default desc: 'DataStore Auth CLI v2' framework: react @@ -202,13 +202,13 @@ tests: # sample_name: v2/owner-custom-claim-default-v2 # spec: owner-custom-claim-default # browser: *minimal_browser_list - # - test_name: integ_datastore_auth_v2-owner-custom-field-default - # desc: 'DataStore Auth CLI v2' - # framework: react - # category: datastore - # sample_name: v2/owner-custom-field-default-v2 - # spec: owner-custom-field-default - # browser: *minimal_browser_list + - test_name: integ_datastore_auth_v2-owner-custom-field-default + desc: 'DataStore Auth CLI v2' + framework: react + category: datastore + sample_name: v2/owner-custom-field-default-v2 + spec: owner-custom-field-default + browser: *minimal_browser_list # - test_name: integ_react_datastore # desc: 'React DataStore' # framework: react From df08a5232370edcadcd62413b9973c7c25c5ee3c Mon Sep 17 00:00:00 2001 From: Aaron S <94858815+stocaaro@users.noreply.github.com> Date: Mon, 16 Oct 2023 09:35:18 -0500 Subject: [PATCH 2/7] chore: Reintroduce v2/public-auth-iam-v2 integ test (#12292) --- .github/integ-config/integ-all.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/integ-config/integ-all.yml b/.github/integ-config/integ-all.yml index 5c41808506b..60072882072 100644 --- a/.github/integ-config/integ-all.yml +++ b/.github/integ-config/integ-all.yml @@ -188,13 +188,13 @@ tests: # sample_name: v2/public-auth-default-v2 # spec: public-auth-default # browser: *minimal_browser_list - # - test_name: integ_datastore_auth_v2-public-auth-iam - # desc: 'DataStore Auth CLI v2' - # framework: react - # category: datastore - # sample_name: v2/public-auth-iam-v2 - # spec: public-auth-iam - # browser: *minimal_browser_list + - test_name: integ_datastore_auth_v2-public-auth-iam + desc: 'DataStore Auth CLI v2' + framework: react + category: datastore + sample_name: v2/public-auth-iam-v2 + spec: public-auth-iam + browser: *minimal_browser_list # - test_name: integ_datastore_auth_v2-owner-custom-claim-default # desc: 'DataStore Auth CLI v2' # framework: react From b047cd1d484d8ffe77a48e0ff19e9abbe85b0e73 Mon Sep 17 00:00:00 2001 From: Jim Blanchard Date: Mon, 16 Oct 2023 09:47:18 -0500 Subject: [PATCH 3/7] feat: Rename `endpoint` to `userPoolEndpoint` (#12276) --- .../cognito/utils/clients/CognitoIdentityProvider/base.ts | 2 +- packages/core/src/singleton/Auth/types.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/auth/src/providers/cognito/utils/clients/CognitoIdentityProvider/base.ts b/packages/auth/src/providers/cognito/utils/clients/CognitoIdentityProvider/base.ts index 1a06002762a..21a96c4d429 100644 --- a/packages/auth/src/providers/cognito/utils/clients/CognitoIdentityProvider/base.ts +++ b/packages/auth/src/providers/cognito/utils/clients/CognitoIdentityProvider/base.ts @@ -31,7 +31,7 @@ const SERVICE_NAME = 'cognito-idp'; */ const endpointResolver = ({ region }: EndpointResolverOptions) => { const authConfig = Amplify.getConfig().Auth?.Cognito; - const customURL = authConfig?.endpoint; + const customURL = authConfig?.userPoolEndpoint; const defaultURL = new AmplifyUrl( `https://${SERVICE_NAME}.${region}.${getDnsSuffix(region)}` ); diff --git a/packages/core/src/singleton/Auth/types.ts b/packages/core/src/singleton/Auth/types.ts index 13dbf435cd0..4da33321c5c 100644 --- a/packages/core/src/singleton/Auth/types.ts +++ b/packages/core/src/singleton/Auth/types.ts @@ -113,12 +113,12 @@ export type AuthIdentityPoolConfig = { Cognito: CognitoIdentityPoolConfig & { userPoolClientId?: never; userPoolId?: never; + userPoolEndpoint?: never; loginWith?: never; signUpVerificationMethod?: never; userAttributes?: never; mfa?: never; passwordFormat?: never; - endpoint?: never; }; }; @@ -137,6 +137,7 @@ export type AuthUserPoolConfig = { export type CognitoUserPoolConfig = { userPoolClientId: string; userPoolId: string; + userPoolEndpoint?: string; signUpVerificationMethod?: 'code' | 'link'; loginWith?: { oauth?: OAuthConfig; @@ -157,7 +158,6 @@ export type CognitoUserPoolConfig = { requireNumbers?: boolean; requireSpecialCharacters?: boolean; }; - endpoint?: string; }; export type OAuthConfig = { From ea5673eb17ee126059a0efc0c41be854f1ad5945 Mon Sep 17 00:00:00 2001 From: Aaron S <94858815+stocaaro@users.noreply.github.com> Date: Mon, 16 Oct 2023 10:01:35 -0500 Subject: [PATCH 4/7] chore: Re-enable v2/owner-custom-field-default-v2 (#12294) From 0dcb4e92425c41dc7ccd05740aa88e4c18cab988 Mon Sep 17 00:00:00 2001 From: Aaron S <94858815+stocaaro@users.noreply.github.com> Date: Mon, 16 Oct 2023 10:48:09 -0500 Subject: [PATCH 5/7] chore: Re-enable all integ tests (#12310) --- .github/integ-config/integ-all.yml | 926 +++++++++++------------ .github/workflows/callable-e2e-tests.yml | 56 +- 2 files changed, 491 insertions(+), 491 deletions(-) diff --git a/.github/integ-config/integ-all.yml b/.github/integ-config/integ-all.yml index 60072882072..de14f2f244b 100644 --- a/.github/integ-config/integ-all.yml +++ b/.github/integ-config/integ-all.yml @@ -9,48 +9,48 @@ extended_browser_list: &extended_browser_list tests: # DATASTORE - # - test_name: integ_datastore_auth-owner-based-default - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: owner-based-default - # spec: owner-based-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-static-user-pool-groups-default - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: static-user-pool-groups-default - # spec: static-user-pool-groups-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-static-user-pool-groups-operations - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: static-user-pool-groups-operations - # spec: static-user-pool-groups-operations - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-owner-and-group-different-models-default - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: owner-and-group-different-models-default - # spec: owner-and-group-different-models-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-owner-and-group-same-model-default - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: owner-and-group-same-model-default - # spec: owner-and-group-same-model-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth-owner-and-group-same-model-operations - # desc: 'DataStore Auth' - # framework: react - # category: datastore - # sample_name: owner-and-group-same-model-operations - # spec: owner-and-group-same-model-operations - # browser: *minimal_browser_list + - test_name: integ_datastore_auth-owner-based-default + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: owner-based-default + spec: owner-based-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth-static-user-pool-groups-default + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: static-user-pool-groups-default + spec: static-user-pool-groups-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth-static-user-pool-groups-operations + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: static-user-pool-groups-operations + spec: static-user-pool-groups-operations + browser: *minimal_browser_list + - test_name: integ_datastore_auth-owner-and-group-different-models-default + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: owner-and-group-different-models-default + spec: owner-and-group-different-models-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth-owner-and-group-same-model-default + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: owner-and-group-same-model-default + spec: owner-and-group-same-model-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth-owner-and-group-same-model-operations + desc: 'DataStore Auth' + framework: react + category: datastore + sample_name: owner-and-group-same-model-operations + spec: owner-and-group-same-model-operations + browser: *minimal_browser_list - test_name: integ_datastore_auth-dynamic-user-pool-groups-default desc: 'DataStore Auth' framework: react @@ -114,80 +114,80 @@ tests: sample_name: v2/owner-based-default-v2 spec: owner-based-default browser: *minimal_browser_list - # - test_name: integ_datastore_auth_v2-static-user-pool-groups-default - # desc: 'DataStore Auth CLI v2' - # framework: react - # category: datastore - # sample_name: v2/static-user-pool-groups-default-v2 - # spec: static-user-pool-groups-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth_v2-static-user-pool-groups-operations - # desc: 'DataStore Auth CLI v2' - # framework: react - # category: datastore - # sample_name: v2/static-user-pool-groups-operations-v2 - # spec: static-user-pool-groups-operations - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth_v2-owner-and-group-different-models-default - # desc: 'DataStore Auth CLI v2' - # framework: react - # category: datastore - # 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 - # category: datastore - # sample_name: v2/owner-and-group-same-model-default-v2 - # spec: owner-and-group-same-model-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth_v2-owner-and-group-same-model-operations - # desc: 'DataStore Auth CLI v2' - # framework: react - # category: datastore - # sample_name: v2/owner-and-group-same-model-operations-v2 - # spec: owner-and-group-same-model-operations - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth_v2-dynamic-user-pool-groups-default - # desc: 'DataStore Auth CLI v2' - # framework: react - # category: datastore - # 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 - # category: datastore - # sample_name: v2/dynamic-user-pool-groups-owner-based-default-v2 - # spec: dynamic-user-pool-groups-owner-based-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth_v2-private-auth-default - # desc: 'DataStore Auth CLI v2' - # framework: react - # category: datastore - # sample_name: v2/private-auth-default-v2 - # spec: private-auth-default - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth_v2-private-auth-iam - # desc: 'DataStore Auth CLI v2' - # framework: react - # category: datastore - # sample_name: v2/private-auth-iam-v2 - # spec: private-auth-iam - # browser: *minimal_browser_list - # - test_name: integ_datastore_auth_v2-public-auth-default - # desc: 'DataStore Auth CLI v2' - # framework: react - # category: datastore - # sample_name: v2/public-auth-default-v2 - # spec: public-auth-default - # browser: *minimal_browser_list + - test_name: integ_datastore_auth_v2-static-user-pool-groups-default + desc: 'DataStore Auth CLI v2' + framework: react + category: datastore + sample_name: v2/static-user-pool-groups-default-v2 + spec: static-user-pool-groups-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth_v2-static-user-pool-groups-operations + desc: 'DataStore Auth CLI v2' + framework: react + category: datastore + sample_name: v2/static-user-pool-groups-operations-v2 + spec: static-user-pool-groups-operations + browser: *minimal_browser_list + - test_name: integ_datastore_auth_v2-owner-and-group-different-models-default + desc: 'DataStore Auth CLI v2' + framework: react + category: datastore + 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 + category: datastore + sample_name: v2/owner-and-group-same-model-default-v2 + spec: owner-and-group-same-model-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth_v2-owner-and-group-same-model-operations + desc: 'DataStore Auth CLI v2' + framework: react + category: datastore + sample_name: v2/owner-and-group-same-model-operations-v2 + spec: owner-and-group-same-model-operations + browser: *minimal_browser_list + - test_name: integ_datastore_auth_v2-dynamic-user-pool-groups-default + desc: 'DataStore Auth CLI v2' + framework: react + category: datastore + 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 + category: datastore + sample_name: v2/dynamic-user-pool-groups-owner-based-default-v2 + spec: dynamic-user-pool-groups-owner-based-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth_v2-private-auth-default + desc: 'DataStore Auth CLI v2' + framework: react + category: datastore + sample_name: v2/private-auth-default-v2 + spec: private-auth-default + browser: *minimal_browser_list + - test_name: integ_datastore_auth_v2-private-auth-iam + desc: 'DataStore Auth CLI v2' + framework: react + category: datastore + sample_name: v2/private-auth-iam-v2 + spec: private-auth-iam + browser: *minimal_browser_list + - test_name: integ_datastore_auth_v2-public-auth-default + desc: 'DataStore Auth CLI v2' + framework: react + category: datastore + sample_name: v2/public-auth-default-v2 + spec: public-auth-default + browser: *minimal_browser_list - test_name: integ_datastore_auth_v2-public-auth-iam desc: 'DataStore Auth CLI v2' framework: react @@ -195,13 +195,13 @@ tests: sample_name: v2/public-auth-iam-v2 spec: public-auth-iam browser: *minimal_browser_list - # - test_name: integ_datastore_auth_v2-owner-custom-claim-default - # desc: 'DataStore Auth CLI v2' - # framework: react - # category: datastore - # sample_name: v2/owner-custom-claim-default-v2 - # spec: owner-custom-claim-default - # browser: *minimal_browser_list + - test_name: integ_datastore_auth_v2-owner-custom-claim-default + desc: 'DataStore Auth CLI v2' + framework: react + category: datastore + sample_name: v2/owner-custom-claim-default-v2 + spec: owner-custom-claim-default + browser: *minimal_browser_list - test_name: integ_datastore_auth_v2-owner-custom-field-default desc: 'DataStore Auth CLI v2' framework: react @@ -209,90 +209,90 @@ tests: sample_name: v2/owner-custom-field-default-v2 spec: owner-custom-field-default browser: *minimal_browser_list - # - test_name: integ_react_datastore - # desc: 'React DataStore' - # framework: react - # category: datastore - # sample_name: [many-to-many] - # spec: many-to-many - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_v2 - # desc: 'React DataStore CLI v2' - # framework: react - # category: datastore - # sample_name: [v2/many-to-many-v2] - # spec: many-to-many - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_multi_auth_one_rule - # desc: 'React DataStore Multi-Auth - One Rule' - # framework: react - # category: datastore - # sample_name: [multi-auth] - # spec: multi-auth-one-rule - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_multi_auth_one_rule_v2 - # desc: 'React DataStore Multi-Auth - One Rule CLI v2' - # framework: react - # category: datastore - # sample_name: [v2/multi-auth-v2] - # spec: multi-auth-one-rule - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_multi_auth_two_rules - # desc: 'React DataStore Multi-Auth - Two Rules' - # framework: react - # category: datastore - # sample_name: [multi-auth] - # spec: multi-auth-two-rules - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_multi_auth_two_rules_v2 - # desc: 'React DataStore Multi-Auth - Two Rules CLI v2' - # framework: react - # category: datastore - # sample_name: [v2/multi-auth-v2] - # spec: multi-auth-two-rules - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_multi_auth_three_plus_rules - # desc: 'React DataStore Multi-Auth - Three Plus Rules' - # framework: react - # category: datastore - # sample_name: [multi-auth] - # spec: multi-auth-three-plus-rules - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_multi_auth_three_plus_rules_v2 - # desc: 'React DataStore Multi-Auth - Three Plus Rules CLI v2' - # framework: react - # category: datastore - # sample_name: [v2/multi-auth-v2] - # spec: multi-auth-three-plus-rules - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_subs_disabled - # desc: 'DataStore - Subs Disabled' - # framework: react - # category: datastore - # sample_name: [subs-disabled] - # spec: subs-disabled - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_subs_disabled_v2 - # desc: 'DataStore - Subs Disabled CLI v2' - # framework: react - # category: datastore - # sample_name: [v2/subs-disabled-v2] - # spec: subs-disabled - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_consecutive_saves - # desc: 'DataStore - Subs Disabled' - # framework: react - # category: datastore - # sample_name: [consecutive-saves] - # spec: consecutive-saves - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_consecutive_saves_v2 - # desc: 'DataStore - Subs Disabled CLI v2' - # framework: react - # category: datastore - # sample_name: [v2/consecutive-saves-v2] - # spec: consecutive-saves - # browser: *minimal_browser_list + - test_name: integ_react_datastore + desc: 'React DataStore' + framework: react + category: datastore + sample_name: [many-to-many] + spec: many-to-many + browser: *minimal_browser_list + - test_name: integ_react_datastore_v2 + desc: 'React DataStore CLI v2' + framework: react + category: datastore + sample_name: [v2/many-to-many-v2] + spec: many-to-many + browser: *minimal_browser_list + - test_name: integ_react_datastore_multi_auth_one_rule + desc: 'React DataStore Multi-Auth - One Rule' + framework: react + category: datastore + sample_name: [multi-auth] + spec: multi-auth-one-rule + browser: *minimal_browser_list + - test_name: integ_react_datastore_multi_auth_one_rule_v2 + desc: 'React DataStore Multi-Auth - One Rule CLI v2' + framework: react + category: datastore + sample_name: [v2/multi-auth-v2] + spec: multi-auth-one-rule + browser: *minimal_browser_list + - test_name: integ_react_datastore_multi_auth_two_rules + desc: 'React DataStore Multi-Auth - Two Rules' + framework: react + category: datastore + sample_name: [multi-auth] + spec: multi-auth-two-rules + browser: *minimal_browser_list + - test_name: integ_react_datastore_multi_auth_two_rules_v2 + desc: 'React DataStore Multi-Auth - Two Rules CLI v2' + framework: react + category: datastore + sample_name: [v2/multi-auth-v2] + spec: multi-auth-two-rules + browser: *minimal_browser_list + - test_name: integ_react_datastore_multi_auth_three_plus_rules + desc: 'React DataStore Multi-Auth - Three Plus Rules' + framework: react + category: datastore + sample_name: [multi-auth] + spec: multi-auth-three-plus-rules + browser: *minimal_browser_list + - test_name: integ_react_datastore_multi_auth_three_plus_rules_v2 + desc: 'React DataStore Multi-Auth - Three Plus Rules CLI v2' + framework: react + category: datastore + sample_name: [v2/multi-auth-v2] + spec: multi-auth-three-plus-rules + browser: *minimal_browser_list + - test_name: integ_react_datastore_subs_disabled + desc: 'DataStore - Subs Disabled' + framework: react + category: datastore + sample_name: [subs-disabled] + spec: subs-disabled + browser: *minimal_browser_list + - test_name: integ_react_datastore_subs_disabled_v2 + desc: 'DataStore - Subs Disabled CLI v2' + framework: react + category: datastore + sample_name: [v2/subs-disabled-v2] + spec: subs-disabled + browser: *minimal_browser_list + - test_name: integ_react_datastore_consecutive_saves + desc: 'DataStore - Subs Disabled' + framework: react + category: datastore + sample_name: [consecutive-saves] + spec: consecutive-saves + browser: *minimal_browser_list + - test_name: integ_react_datastore_consecutive_saves_v2 + desc: 'DataStore - Subs Disabled CLI v2' + framework: react + category: datastore + sample_name: [v2/consecutive-saves-v2] + spec: consecutive-saves + browser: *minimal_browser_list # - test_name: integ_react_datastore_observe_query # desc: 'DataStore - Observe Query' # framework: react @@ -307,20 +307,20 @@ tests: # sample_name: [v2/observe-query-v2] # spec: observe-query # browser: *minimal_browser_list - # - test_name: integ_react_datastore_schema_drift - # desc: 'DataStore - Schema Drift' - # framework: react - # category: datastore - # sample_name: [schema-drift] - # spec: schema-drift - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_background_process_manager - # desc: 'DataStore - Background Process Manager' - # framework: react - # category: datastore - # sample_name: [v2/background-process-manager] - # spec: background-process-manager - # browser: *extended_browser_list + - test_name: integ_react_datastore_schema_drift + desc: 'DataStore - Schema Drift' + framework: react + category: datastore + sample_name: [schema-drift] + spec: schema-drift + browser: *minimal_browser_list + - test_name: integ_react_datastore_background_process_manager + desc: 'DataStore - Background Process Manager' + framework: react + category: datastore + sample_name: [v2/background-process-manager] + spec: background-process-manager + browser: *extended_browser_list # - test_name: integ_react_datastore_background_process_manager_webkit # desc: 'DataStore - Background Process Manager' # framework: react @@ -328,105 +328,105 @@ tests: # sample_name: [v2/background-process-manager] # spec: background-process-manager # browser: [webkit] - # - test_name: integ_react_datastore_cpk_related_models - # desc: 'DataStore - Custom Primary Key + Related Models' - # framework: react - # category: datastore - # 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 - # category: datastore - # sample_name: [selective-sync-v5] - # spec: selective-sync-v5 - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_nested_predicate - # desc: 'DataStore - Nested Predicate' - # framework: react - # category: datastore - # sample_name: [nested-predicate] - # spec: nested-predicate - # browser: *minimal_browser_list - # - test_name: integ_react_datastore_docs_examples - # desc: 'DataStore - Docs Examples' - # framework: react - # category: datastore - # sample_name: [v2/amplify-docs-examples] - # spec: amplify-docs-examples - # browser: *minimal_browser_list - # timeout_minutes: 45 - # retry_count: 10 - # - test_name: integ_react_datastore_websocket_disruption - # desc: 'DataStore - WebSocket Disruption' - # framework: react - # category: datastore - # sample_name: [websocket-disruption] - # spec: websocket-disruption - # browser: *minimal_browser_list - # - test_name: integ_vanilla_js_datastore_basic_crud - # desc: 'Vanilla JS + Webpack 4 + DataStore - Basic CRUD' - # framework: javascript - # category: datastore - # sample_name: [basic-crud] - # browser: *minimal_browser_list - # spec: vanilla-js-basic-crud - # amplifyjs_dir: true - # timeout_minutes: 45 - # retry_count: 10 - # - test_name: integ_next_datastore_owner_auth - # desc: 'next owner auth' - # framework: next - # category: datastore - # sample_name: [owner-based-default] - # spec: next-owner-based-default - # browser: *minimal_browser_list - # - test_name: integ_next_datastore_13_basic - # desc: 'DataStore - Nextjs 13 build with SWC - basic JS app' - # framework: next - # category: datastore - # sample_name: [next-13-basic] - # spec: nextjs-13-basic - # browser: *minimal_browser_list - # - test_name: integ_next_datastore_13_js - # desc: 'DataStore - Nextjs 13 build with SWC - JS app' - # framework: next - # category: datastore - # sample_name: [next-13-js] - # spec: nextjs-13 - # browser: *minimal_browser_list - # - test_name: integ_vite_datastore_basic_crud - # desc: 'Vite + DataStore - Basic CRUD' - # framework: vite - # 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 + - test_name: integ_react_datastore_cpk_related_models + desc: 'DataStore - Custom Primary Key + Related Models' + framework: react + category: datastore + 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 + category: datastore + sample_name: [selective-sync-v5] + spec: selective-sync-v5 + browser: *minimal_browser_list + - test_name: integ_react_datastore_nested_predicate + desc: 'DataStore - Nested Predicate' + framework: react + category: datastore + sample_name: [nested-predicate] + spec: nested-predicate + browser: *minimal_browser_list + - test_name: integ_react_datastore_docs_examples + desc: 'DataStore - Docs Examples' + framework: react + category: datastore + sample_name: [v2/amplify-docs-examples] + spec: amplify-docs-examples + browser: *minimal_browser_list + timeout_minutes: 45 + retry_count: 10 + - test_name: integ_react_datastore_websocket_disruption + desc: 'DataStore - WebSocket Disruption' + framework: react + category: datastore + sample_name: [websocket-disruption] + spec: websocket-disruption + browser: *minimal_browser_list + - test_name: integ_vanilla_js_datastore_basic_crud + desc: 'Vanilla JS + Webpack 4 + DataStore - Basic CRUD' + framework: javascript + category: datastore + sample_name: [basic-crud] + browser: *minimal_browser_list + spec: vanilla-js-basic-crud + amplifyjs_dir: true + timeout_minutes: 45 + retry_count: 10 + - test_name: integ_next_datastore_owner_auth + desc: 'next owner auth' + framework: next + category: datastore + sample_name: [owner-based-default] + spec: next-owner-based-default + browser: *minimal_browser_list + - test_name: integ_next_datastore_13_basic + desc: 'DataStore - Nextjs 13 build with SWC - basic JS app' + framework: next + category: datastore + sample_name: [next-13-basic] + spec: nextjs-13-basic + browser: *minimal_browser_list + - test_name: integ_next_datastore_13_js + desc: 'DataStore - Nextjs 13 build with SWC - JS app' + framework: next + category: datastore + sample_name: [next-13-js] + spec: nextjs-13 + browser: *minimal_browser_list + - test_name: integ_vite_datastore_basic_crud + desc: 'Vite + DataStore - Basic CRUD' + framework: vite + 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 - # desc: React GraphQL API - # framework: react - # category: api - # sample_name: [graphql] - # spec: graphql - # browser: *minimal_browser_list + - test_name: integ_react_graphql_api + desc: React GraphQL API + framework: react + category: api + sample_name: [graphql] + spec: graphql + browser: *minimal_browser_list # AUTH - test_name: integ_react_javascript_authentication @@ -437,13 +437,13 @@ tests: spec: functional-auth browser: *minimal_browser_list # TODO(v6) Migrate? - # - test_name: integ_react_auth_1_guest_to_authenticated_user - # desc: 'Guest to Authenticated User' - # framework: react - # category: auth - # sample_name: [guest-to-auth-user] - # spec: guest-to-auth-user - # browser: *minimal_browser_list + - test_name: integ_react_auth_1_guest_to_authenticated_user + desc: 'Guest to Authenticated User' + framework: react + category: auth + sample_name: [guest-to-auth-user] + spec: guest-to-auth-user + browser: *minimal_browser_list - test_name: integ_react_typescript_authentication desc: 'React Typescript Authentication' framework: react @@ -458,13 +458,13 @@ tests: sample_name: [credentials-auth] spec: credentials-auth browser: *minimal_browser_list - # - test_name: integ_react_auth_2_sign_in_after_sign_up - # desc: 'Sign In after Sign Up' - # framework: react - # category: auth - # sample_name: [auto-signin-after-signup] - # spec: auto-signin-after-signup - # browser: *minimal_browser_list + - test_name: integ_react_auth_2_sign_in_after_sign_up + desc: 'Sign In after Sign Up' + framework: react + category: auth + sample_name: [auto-signin-after-signup] + spec: auto-signin-after-signup + browser: *minimal_browser_list - test_name: integ_react_amazon_cognito_identity_js_cookie_storage desc: 'amazon-cognito-identity-js-cookie-storage' framework: react @@ -479,81 +479,81 @@ tests: sample_name: [amazon-cognito-identity-js] spec: amazon-cognito-identity-js browser: *minimal_browser_list - # - test_name: integ_react_device_tracking - # desc: 'cognito-device-tracking' - # framework: react - # category: auth - # sample_name: [device-tracking] - # spec: device-tracking - # browser: *minimal_browser_list - # - test_name: integ_react_delete_user - # desc: 'delete-user' - # framework: react - # category: auth - # sample_name: [delete-user] - # spec: delete-user - # browser: *minimal_browser_list - # - test_name: integ_angular_auth_angular_authenticator - # desc: 'Angular Authenticator' - # framework: angular - # category: auth - # sample_name: [amplify-authenticator] - # spec: ui-amplify-authenticator - # browser: *minimal_browser_list - # - test_name: integ_angular_auth_angular_custom_authenticator - # desc: 'Angular Custom Authenticator' - # framework: angular - # category: auth - # sample_name: [amplify-authenticator] - # spec: custom-authenticator - # browser: *minimal_browser_list - # - test_name: integ_javascript_auth - # desc: 'JavaScript Auth CDN' - # framework: javascript - # category: auth - # sample_name: [auth-cdn] - # spec: auth-cdn - # browser: *minimal_browser_list - # amplifyjs_dir: true - # - test_name: integ_vue_auth_legacy_vue_authenticator - # desc: 'Legacy Vue Authenticator' - # framework: vue - # category: auth - # sample_name: [amplify-authenticator-legacy] - # spec: authenticator - # browser: *minimal_browser_list - # - test_name: integ_vue_auth_vue_3_authenticator - # desc: 'Vue 3 Authenticator' - # framework: vue - # category: auth - # sample_name: [authenticator-vue3] - # spec: new-ui-authenticator - # browser: *minimal_browser_list + - test_name: integ_react_device_tracking + desc: 'cognito-device-tracking' + framework: react + category: auth + sample_name: [device-tracking] + spec: device-tracking + browser: *minimal_browser_list + - test_name: integ_react_delete_user + desc: 'delete-user' + framework: react + category: auth + sample_name: [delete-user] + spec: delete-user + browser: *minimal_browser_list + - test_name: integ_angular_auth_angular_authenticator + desc: 'Angular Authenticator' + framework: angular + category: auth + sample_name: [amplify-authenticator] + spec: ui-amplify-authenticator + browser: *minimal_browser_list + - test_name: integ_angular_auth_angular_custom_authenticator + desc: 'Angular Custom Authenticator' + framework: angular + category: auth + sample_name: [amplify-authenticator] + spec: custom-authenticator + browser: *minimal_browser_list + - test_name: integ_javascript_auth + desc: 'JavaScript Auth CDN' + framework: javascript + category: auth + sample_name: [auth-cdn] + spec: auth-cdn + browser: *minimal_browser_list + amplifyjs_dir: true + - test_name: integ_vue_auth_legacy_vue_authenticator + desc: 'Legacy Vue Authenticator' + framework: vue + category: auth + sample_name: [amplify-authenticator-legacy] + spec: authenticator + browser: *minimal_browser_list + - test_name: integ_vue_auth_vue_3_authenticator + desc: 'Vue 3 Authenticator' + framework: vue + category: auth + sample_name: [authenticator-vue3] + spec: new-ui-authenticator + browser: *minimal_browser_list # TODO(v6) Migrate once SSR updates available - # - test_name: integ_next_auth_authenticator_and_ssr_page - # desc: 'Authenticator and SSR page' - # framework: next - # category: auth - # sample_name: [auth-ssr] - # spec: auth-ssr - # browser: *minimal_browser_list + - test_name: integ_next_auth_authenticator_and_ssr_page + desc: 'Authenticator and SSR page' + framework: next + category: auth + sample_name: [auth-ssr] + spec: auth-ssr + browser: *minimal_browser_list # TODO(v6) Migrate once SSR updates available - # - test_name: integ_next_auth_authenticator_and_rsc_page - # desc: 'Authenticator and RSC page' - # framework: next - # category: auth - # sample_name: [auth-rsc] - # spec: auth-rsc - # browser: [chrome] - # timeout_minutes: 45 - # retry_count: 10 - # - test_name: integ_next_auth_nextjs_auth_custom_implementation_with_ssr - # desc: 'NextJS Auth Custom Implementation with SSR' - # framework: next - # category: auth - # sample_name: [custom-auth-ssr] - # spec: authenticator - # browser: *minimal_browser_list + - test_name: integ_next_auth_authenticator_and_rsc_page + desc: 'Authenticator and RSC page' + framework: next + category: auth + sample_name: [auth-rsc] + spec: auth-rsc + browser: [chrome] + timeout_minutes: 45 + retry_count: 10 + - test_name: integ_next_auth_nextjs_auth_custom_implementation_with_ssr + desc: 'NextJS Auth Custom Implementation with SSR' + framework: next + category: auth + sample_name: [custom-auth-ssr] + spec: authenticator + browser: *minimal_browser_list # ANALYTICS - test_name: integ_react_analytics_pinpoint @@ -602,22 +602,22 @@ tests: browser: *minimal_browser_list # GEO - # - test_name: integ_react_geo_display_map - # desc: 'Display Map' - # framework: react - # category: geo - # sample_name: [display-map] - # spec: display-map - # # Temp fix: - # browser: [chrome] - # - test_name: integ_react_geo_search_outside_map - # desc: 'Search Outside Map' - # framework: react - # category: geo - # sample_name: [search-outside-map] - # spec: search-outside-map - # # Temp fix: - # browser: [chrome] + - test_name: integ_react_geo_display_map + desc: 'Display Map' + framework: react + category: geo + sample_name: [display-map] + spec: display-map + # Temp fix: + browser: [chrome] + - test_name: integ_react_geo_search_outside_map + desc: 'Search Outside Map' + framework: react + category: geo + sample_name: [search-outside-map] + spec: search-outside-map + # Temp fix: + browser: [chrome] # - test_name: integ_javascript_geo_display_map # desc: 'Display Map' # framework: javascript @@ -636,48 +636,48 @@ tests: # amplifyjs_dir: true # INTERACTIONS - # - test_name: integ_react_interactions_react_interactions - # desc: 'React Interactions' - # framework: react - # category: interactions - # sample_name: [chatbot-component] - # spec: chatbot-component - # browser: *minimal_browser_list - # - test_name: integ_react_interactions_chatbot_v1 - # desc: 'Chatbot V1' - # framework: react - # category: interactions - # sample_name: [lex-test-component] - # spec: chatbot-v1 - # browser: *minimal_browser_list - # - test_name: integ_react_interactions_chatbot_v2 - # desc: 'Chatbot V2' - # framework: react - # category: interactions - # sample_name: [lex-test-component] - # spec: chatbot-v2 - # browser: *minimal_browser_list - # - test_name: integ_angular_interactions - # desc: 'Angular Interactions' - # framework: angular - # category: interactions - # sample_name: [chatbot-component] - # spec: chatbot-component - # browser: *minimal_browser_list - # - test_name: integ_vue_interactions_vue_2_interactions - # desc: 'Vue 2 Interactions' - # framework: vue - # category: interactions - # sample_name: [chatbot-component] - # spec: chatbot-component - # browser: [chrome] - # - test_name: integ_vue_interactionsvue_3_interactions - # desc: 'Vue 3 Interactions' - # framework: vue - # category: interactions - # sample_name: [chatbot-component-vue3] - # spec: chatbot-component - # browser: [chrome] + - test_name: integ_react_interactions_react_interactions + desc: 'React Interactions' + framework: react + category: interactions + sample_name: [chatbot-component] + spec: chatbot-component + browser: *minimal_browser_list + - test_name: integ_react_interactions_chatbot_v1 + desc: 'Chatbot V1' + framework: react + category: interactions + sample_name: [lex-test-component] + spec: chatbot-v1 + browser: *minimal_browser_list + - test_name: integ_react_interactions_chatbot_v2 + desc: 'Chatbot V2' + framework: react + category: interactions + sample_name: [lex-test-component] + spec: chatbot-v2 + browser: *minimal_browser_list + - test_name: integ_angular_interactions + desc: 'Angular Interactions' + framework: angular + category: interactions + sample_name: [chatbot-component] + spec: chatbot-component + browser: *minimal_browser_list + - test_name: integ_vue_interactions_vue_2_interactions + desc: 'Vue 2 Interactions' + framework: vue + category: interactions + sample_name: [chatbot-component] + spec: chatbot-component + browser: [chrome] + - test_name: integ_vue_interactionsvue_3_interactions + desc: 'Vue 3 Interactions' + framework: vue + category: interactions + sample_name: [chatbot-component-vue3] + spec: chatbot-component + browser: [chrome] # PREDICTIONS # - test_name: integ_react_predictions diff --git a/.github/workflows/callable-e2e-tests.yml b/.github/workflows/callable-e2e-tests.yml index c75c0e01d53..d03744b2b06 100644 --- a/.github/workflows/callable-e2e-tests.yml +++ b/.github/workflows/callable-e2e-tests.yml @@ -43,32 +43,32 @@ jobs: timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 35 }} retry_count: ${{ matrix.integ-config.retry_count || 3 }} - # e2e-test-runner-headless: - # name: E2E test runnner_headless - # needs: e2e-prep - # secrets: inherit - # strategy: - # matrix: - # integ-config: ${{ fromJson(needs.e2e-prep.outputs.integ-config-headless) }} - # fail-fast: false - # uses: ./.github/workflows/callable-e2e-test-headless.yml - # with: - # test_name: ${{ matrix.integ-config.test_name }} - # category: ${{ matrix.integ-config.category }} - # spec: ${{ matrix.integ-config.spec || '' }} - # timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 35 }} - # retry_count: ${{ matrix.integ-config.retry_count || 3 }} + e2e-test-runner-headless: + name: E2E test runnner_headless + needs: e2e-prep + secrets: inherit + strategy: + matrix: + integ-config: ${{ fromJson(needs.e2e-prep.outputs.integ-config-headless) }} + fail-fast: false + uses: ./.github/workflows/callable-e2e-test-headless.yml + with: + test_name: ${{ matrix.integ-config.test_name }} + category: ${{ matrix.integ-config.category }} + spec: ${{ matrix.integ-config.spec || '' }} + timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 35 }} + retry_count: ${{ matrix.integ-config.retry_count || 3 }} - # detox-e2e-test-runner: - # name: E2E test runner - # needs: e2e-prep - # strategy: - # matrix: - # integ-config: ${{ fromJson(needs.e2e-prep.outputs.detox-integ-config) }} - # fail-fast: false - # secrets: inherit - # uses: ./.github/workflows/callable-e2e-test-detox.yml - # with: - # test_name: ${{ matrix.integ-config.test_name }} - # working_directory: ${{ matrix.integ-config.working_directory }} - # timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 45 }} + detox-e2e-test-runner: + name: E2E test runner + needs: e2e-prep + strategy: + matrix: + integ-config: ${{ fromJson(needs.e2e-prep.outputs.detox-integ-config) }} + fail-fast: false + secrets: inherit + uses: ./.github/workflows/callable-e2e-test-detox.yml + with: + test_name: ${{ matrix.integ-config.test_name }} + working_directory: ${{ matrix.integ-config.working_directory }} + timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 45 }} From af08620596582d04a63053948ba3e8fb7777f7da Mon Sep 17 00:00:00 2001 From: ManojNB Date: Mon, 16 Oct 2023 09:51:09 -0700 Subject: [PATCH 6/7] chore(inapp): vend the required input/output types and fix RN (#12304) * chore: vend input oput types * chore: add message ui types --- packages/notifications/package.json | 4 ++- .../notifications/src/inAppMessaging/index.ts | 12 +++++++++ .../src/inAppMessaging/providers/index.ts | 25 ++++++++++++++++++- .../providers/pinpoint/index.ts | 15 +++++++++++ .../providers/pinpoint/types/index.ts | 11 ++++++++ .../src/inAppMessaging/types/index.ts | 3 +++ 6 files changed, 68 insertions(+), 2 deletions(-) diff --git a/packages/notifications/package.json b/packages/notifications/package.json index c80c4c0d306..2a1ceac042a 100644 --- a/packages/notifications/package.json +++ b/packages/notifications/package.json @@ -89,7 +89,9 @@ "files": [ "lib", "lib-esm", - "src" + "src", + "in-app-messaging", + "push-notifications" ], "dependencies": { "lodash": "^4.17.21" diff --git a/packages/notifications/src/inAppMessaging/index.ts b/packages/notifications/src/inAppMessaging/index.ts index abe3444fda6..02921504073 100644 --- a/packages/notifications/src/inAppMessaging/index.ts +++ b/packages/notifications/src/inAppMessaging/index.ts @@ -12,4 +12,16 @@ export { onMessageDismissed, onMessageActionTaken, notifyMessageInteraction, + IdentifyUserInput, + DispatchEventInput, + SetConflictHandlerInput, + OnMessageActionTakenInput, + OnMessageDismissedInput, + OnMessageDisplayedInput, + OnMessageReceivedInput, + NotifyMessageInteractionInput, + OnMessageReceivedOutput, + OnMessageActionTakenOutput, + OnMessageDismissedOutput, + OnMessageDisplayedOutput, } from './providers/pinpoint'; diff --git a/packages/notifications/src/inAppMessaging/providers/index.ts b/packages/notifications/src/inAppMessaging/providers/index.ts index 59277f4afb5..311d7f37b10 100644 --- a/packages/notifications/src/inAppMessaging/providers/index.ts +++ b/packages/notifications/src/inAppMessaging/providers/index.ts @@ -12,4 +12,27 @@ export { onMessageDismissed, onMessageActionTaken, notifyMessageInteraction, -} from './pinpoint/apis'; + IdentifyUserInput, + DispatchEventInput, + SetConflictHandlerInput, + OnMessageActionTakenInput, + OnMessageDismissedInput, + OnMessageDisplayedInput, + OnMessageReceivedInput, + NotifyMessageInteractionInput, + OnMessageReceivedOutput, + OnMessageActionTakenOutput, + OnMessageDismissedOutput, + OnMessageDisplayedOutput, +} from './pinpoint'; + +export { + InAppMessage, + InAppMessageAction, + InAppMessageContent, + InAppMessageLayout, + InAppMessageTextAlign, + InAppMessageButton, + InAppMessageImage, + InAppMessageStyle, +} from '../types'; diff --git a/packages/notifications/src/inAppMessaging/providers/pinpoint/index.ts b/packages/notifications/src/inAppMessaging/providers/pinpoint/index.ts index 789b8e1ae1c..4639ea93b01 100644 --- a/packages/notifications/src/inAppMessaging/providers/pinpoint/index.ts +++ b/packages/notifications/src/inAppMessaging/providers/pinpoint/index.ts @@ -13,3 +13,18 @@ export { onMessageActionTaken, notifyMessageInteraction, } from './apis'; + +export { + IdentifyUserInput, + DispatchEventInput, + SetConflictHandlerInput, + OnMessageActionTakenInput, + OnMessageDismissedInput, + OnMessageDisplayedInput, + OnMessageReceivedInput, + NotifyMessageInteractionInput, + OnMessageReceivedOutput, + OnMessageActionTakenOutput, + OnMessageDismissedOutput, + OnMessageDisplayedOutput, +} from './types'; diff --git a/packages/notifications/src/inAppMessaging/providers/pinpoint/types/index.ts b/packages/notifications/src/inAppMessaging/providers/pinpoint/types/index.ts index a0ddff96523..5cc0bbaa21d 100644 --- a/packages/notifications/src/inAppMessaging/providers/pinpoint/types/index.ts +++ b/packages/notifications/src/inAppMessaging/providers/pinpoint/types/index.ts @@ -6,7 +6,18 @@ export { IdentifyUserInput, DispatchEventInput, SetConflictHandlerInput, + OnMessageActionTakenInput, + OnMessageDismissedInput, + OnMessageDisplayedInput, + OnMessageReceivedInput, + NotifyMessageInteractionInput, } from './inputs'; +export { + OnMessageReceivedOutput, + OnMessageActionTakenOutput, + OnMessageDismissedOutput, + OnMessageDisplayedOutput, +} from './outputs'; export { IdentifyUserOptions } from './options'; export { PinpointMessageEvent, diff --git a/packages/notifications/src/inAppMessaging/types/index.ts b/packages/notifications/src/inAppMessaging/types/index.ts index 51a42ecab97..a5a10a612c0 100644 --- a/packages/notifications/src/inAppMessaging/types/index.ts +++ b/packages/notifications/src/inAppMessaging/types/index.ts @@ -11,4 +11,7 @@ export { InAppMessageContent, InAppMessageLayout, InAppMessageTextAlign, + InAppMessageButton, + InAppMessageImage, + InAppMessageStyle, } from './message'; From 8f3ba99af092a9b517ccf84d05947a4e328b3248 Mon Sep 17 00:00:00 2001 From: Jim Blanchard Date: Mon, 16 Oct 2023 12:15:19 -0500 Subject: [PATCH 7/7] feat: Integrated ServiceWorker with v6 (#12261) --- .../aws-amplify/__tests__/exports.test.ts | 1 + packages/aws-amplify/src/utils/index.ts | 2 +- packages/core/__tests__/ServiceWorker.test.ts | 3 +- packages/core/src/Amplify.ts | 106 ------------------ .../core/src/ServiceWorker/ServiceWorker.ts | 37 +++--- packages/core/src/ServiceWorker/index.ts | 12 -- packages/core/src/index.ts | 3 + packages/core/src/libraryUtils.ts | 3 - .../src/providers/pinpoint/types/pinpoint.ts | 1 + 9 files changed, 28 insertions(+), 140 deletions(-) delete mode 100644 packages/core/src/Amplify.ts diff --git a/packages/aws-amplify/__tests__/exports.test.ts b/packages/aws-amplify/__tests__/exports.test.ts index 74a35a59a5c..bdd1f277180 100644 --- a/packages/aws-amplify/__tests__/exports.test.ts +++ b/packages/aws-amplify/__tests__/exports.test.ts @@ -38,6 +38,7 @@ describe('aws-amplify Exports', () => { Array [ "Hub", "I18n", + "ServiceWorker", ] `); }); diff --git a/packages/aws-amplify/src/utils/index.ts b/packages/aws-amplify/src/utils/index.ts index 23dd12babe5..ca99f8c0852 100644 --- a/packages/aws-amplify/src/utils/index.ts +++ b/packages/aws-amplify/src/utils/index.ts @@ -4,4 +4,4 @@ /* This file maps exports from `aws-amplify/utils`. */ -export { Hub, I18n } from '@aws-amplify/core'; +export { Hub, I18n, ServiceWorker } from '@aws-amplify/core'; diff --git a/packages/core/__tests__/ServiceWorker.test.ts b/packages/core/__tests__/ServiceWorker.test.ts index ac2bac95836..4c6d172e297 100644 --- a/packages/core/__tests__/ServiceWorker.test.ts +++ b/packages/core/__tests__/ServiceWorker.test.ts @@ -1,4 +1,5 @@ -import { AmplifyError, ServiceWorker } from '../src/libraryUtils'; +import { AmplifyError } from '../src/libraryUtils'; +import { ServiceWorker } from '../src'; import { ServiceWorkerErrorCode } from '../src/ServiceWorker/errorHelpers'; describe('ServiceWorker test', () => { diff --git a/packages/core/src/Amplify.ts b/packages/core/src/Amplify.ts deleted file mode 100644 index ae7d0df2873..00000000000 --- a/packages/core/src/Amplify.ts +++ /dev/null @@ -1,106 +0,0 @@ -// @ts-nocheck -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -import { ConsoleLogger as LoggerClass } from './Logger'; - -const logger = new LoggerClass('Amplify'); - -export class AmplifyClass { - // Everything that is `register`ed is tracked here - private _components:any[] = []; - private _config = {}; - - // All modules (with `getModuleName()`) are stored here for dependency injection - private _modules = {}; - - // for backward compatibility to avoid breaking change - // if someone is using like Amplify.Auth - Auth = null; - Analytics = null; - API = null; - Credentials = null; - Storage = null; - I18n = null; - Cache = null; - PubSub = null; - Interactions = null; - Pushnotification = null; - UI = null; - XR = null; - Predictions = null; - DataStore = null; - Geo = null; - Notifications = null; - - Logger = LoggerClass; - ServiceWorker = null; - - // TODO: update "any" when types are determined - public get config(): any { - return Object.assign({}, this._config); - } - - register(comp:any) { - logger.debug('component registered in amplify', comp); - this._components.push(comp); - if (typeof comp.getModuleName === 'function') { - this._modules[comp.getModuleName()] = comp; - this[comp.getModuleName()] = comp; - } else { - logger.debug('no getModuleName method for component', comp); - } - - // Finally configure this new component(category) loaded - // With the new modularization changes in Amplify V3, all the Amplify - // component are not loaded/registered right away but when they are - // imported (and hence instantiated) in the client's app. This ensures - // that all new components imported get correctly configured with the - // configuration that Amplify.configure() was called with. - comp.configure(this._config); - } - - configure(config?) { - if (!config) return this._config; - - this._config = Object.assign(this._config, config); - logger.debug('amplify config', this._config); - - // Dependency Injection via property-setting. - // This avoids introducing a public method/interface/setter that's difficult to remove later. - // Plus, it reduces `if` statements within the `constructor` and `configure` of each module - Object.entries(this._modules).forEach(([Name, comp]:[any, any]) => { - // e.g. Auth.* - Object.keys(comp).forEach(property => { - // e.g. Auth["Credentials"] = this._modules["Credentials"] when set - if (this._modules[property]) { - comp[property] = this._modules[property]; - } - }); - }); - - this._components.map(comp => { - comp.configure(this._config); - }); - - return this._config; - } - - addPluggable(pluggable) { - if ( - pluggable && - pluggable['getCategory'] && - typeof pluggable['getCategory'] === 'function' - ) { - this._components.map(comp => { - if ( - comp['addPluggable'] && - typeof comp['addPluggable'] === 'function' - ) { - comp.addPluggable(pluggable); - } - }); - } - } -} - -export const Amplify = new AmplifyClass(); diff --git a/packages/core/src/ServiceWorker/ServiceWorker.ts b/packages/core/src/ServiceWorker/ServiceWorker.ts index aea393dd7c9..12cc7b5e4fc 100644 --- a/packages/core/src/ServiceWorker/ServiceWorker.ts +++ b/packages/core/src/ServiceWorker/ServiceWorker.ts @@ -3,9 +3,11 @@ import { ConsoleLogger as Logger } from '../Logger'; import { isBrowser } from '../utils'; -import { Amplify } from '../Amplify'; import { AmplifyError } from '../errors'; import { assert, ServiceWorkerErrorCode } from './errorHelpers'; +import { record } from '../providers/pinpoint'; +import { Amplify, fetchAuthSession } from '../singleton'; + /** * Provides a means to registering a service worker in the browser * and communicating with it via postMessage events. @@ -205,15 +207,25 @@ export class ServiceWorkerClass { * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/state **/ _setupListeners() { - this.serviceWorker.addEventListener('statechange', event => { + this.serviceWorker.addEventListener('statechange', async event => { const currentState = this.serviceWorker.state; this._logger.debug(`ServiceWorker statechange: ${currentState}`); - Amplify.Analytics; - if (isAmplifyWithAnalytics(Amplify)) { - (Amplify as AmplifyWithAnalytics).Analytics.record({ - name: 'ServiceWorker', - attributes: { - state: currentState, + + const { appId, region } = Amplify.getConfig().Analytics?.Pinpoint ?? {}; + const { credentials } = await fetchAuthSession(); + + if (appId && region && credentials) { + // Pinpoint is configured, record an event + record({ + appId, + region, + category: 'Core', + credentials, + event: { + name: 'ServiceWorker', + attributes: { + state: currentState, + }, }, }); } @@ -223,12 +235,3 @@ export class ServiceWorkerClass { }); } } - -type AmplifyWithAnalytics = { - Analytics: { - record: Function; - }; -}; -function isAmplifyWithAnalytics(amplify: any): amplify is AmplifyWithAnalytics { - return amplify.Analytics && typeof amplify.Analytics.record === 'function'; -} diff --git a/packages/core/src/ServiceWorker/index.ts b/packages/core/src/ServiceWorker/index.ts index 8d634bb0362..bd024c6f524 100644 --- a/packages/core/src/ServiceWorker/index.ts +++ b/packages/core/src/ServiceWorker/index.ts @@ -1,16 +1,4 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -/** - * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with - * the License. A copy of the License is located at - * - * http://aws.amazon.com/apache2.0/ - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ export { ServiceWorkerClass as ServiceWorker } from './ServiceWorker'; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 00a69d6442b..cd7ba5232b3 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -65,3 +65,6 @@ export { Cache } from './Cache'; // Internationalization utilities export { I18n } from './I18n'; + +// Service worker +export { ServiceWorker } from './ServiceWorker'; diff --git a/packages/core/src/libraryUtils.ts b/packages/core/src/libraryUtils.ts index 0be251bbb5d..596446ddc76 100644 --- a/packages/core/src/libraryUtils.ts +++ b/packages/core/src/libraryUtils.ts @@ -71,9 +71,6 @@ export { } from './Platform/types'; export { setCustomUserAgent } from './Platform/customUserAgent'; -// Service worker -export { ServiceWorker } from './ServiceWorker'; - // Other utilities & constants export { BackgroundProcessManager } from './BackgroundProcessManager'; export { Mutex } from './Mutex'; diff --git a/packages/core/src/providers/pinpoint/types/pinpoint.ts b/packages/core/src/providers/pinpoint/types/pinpoint.ts index 1deacfd9361..3a9c1018358 100644 --- a/packages/core/src/providers/pinpoint/types/pinpoint.ts +++ b/packages/core/src/providers/pinpoint/types/pinpoint.ts @@ -6,6 +6,7 @@ import { UserProfile } from '../../../types'; export type SupportedCategory = | 'Analytics' + | 'Core' | 'InAppMessaging' | 'PushNotification';