From 05e84a1cab91ef3b13887dd03a7a7825a0e44121 Mon Sep 17 00:00:00 2001 From: James Jarvis Date: Tue, 26 Nov 2024 11:04:41 -0800 Subject: [PATCH 1/4] feat(auth): enable parallel otp runs (#14034) * enable e2e tests * reset tmp test updates --- .github/integ-config/integ-all.yml | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/integ-config/integ-all.yml b/.github/integ-config/integ-all.yml index 3c37683608b..b20a0cc45e1 100644 --- a/.github/integ-config/integ-all.yml +++ b/.github/integ-config/integ-all.yml @@ -890,7 +890,7 @@ tests: category: auth sample_name: [mfa] spec: mfa-req-email - browser: [chrome] + browser: *minimal_browser_list env: NEXT_PUBLIC_BACKEND_CONFIG: mfa-req-email - test_name: integ_next_mfa_req_phone @@ -899,7 +899,7 @@ tests: category: auth sample_name: [mfa] spec: mfa-req-phone - browser: [chrome] + browser: *minimal_browser_list env: NEXT_PUBLIC_BACKEND_CONFIG: mfa-req-phone - test_name: integ_next_mfa_opt_email @@ -908,7 +908,7 @@ tests: category: auth sample_name: [mfa] spec: mfa-opt-email - browser: [chrome] + browser: *minimal_browser_list env: NEXT_PUBLIC_BACKEND_CONFIG: mfa-opt-email - test_name: integ_next_mfa_opt_phone @@ -917,7 +917,7 @@ tests: category: auth sample_name: [mfa] spec: mfa-opt-phone - browser: [chrome] + browser: *minimal_browser_list env: NEXT_PUBLIC_BACKEND_CONFIG: mfa-opt-phone - test_name: integ_next_mfa_setup @@ -926,7 +926,7 @@ tests: category: auth sample_name: [mfa] spec: mfa-setup - browser: [chrome] + browser: *minimal_browser_list env: NEXT_PUBLIC_BACKEND_CONFIG: mfa-setup - test_name: integ_next_passwordless_auto_sign_in @@ -935,8 +935,7 @@ tests: category: auth sample_name: [mfa] spec: passwordless/auto-sign-in - # browser: *minimal_browser_list - browser: [chrome] + browser: *minimal_browser_list env: NEXT_PUBLIC_BACKEND_CONFIG: pwl-autosignin - test_name: integ_next_passwordless_first_factor_selection @@ -945,8 +944,7 @@ tests: category: auth sample_name: [mfa] spec: passwordless/first-factor-selection - # browser: *minimal_browser_list - browser: [chrome] + browser: *minimal_browser_list env: NEXT_PUBLIC_BACKEND_CONFIG: pwl-ffselect - test_name: integ_next_passwordless_preferred_challenge @@ -955,8 +953,7 @@ tests: category: auth sample_name: [mfa] spec: passwordless/preferred-challenge - # browser: *minimal_browser_list - browser: [chrome] + browser: *minimal_browser_list env: NEXT_PUBLIC_BACKEND_CONFIG: pwl-prefchal - test_name: integ_next_passwordless_sign_up @@ -965,8 +962,7 @@ tests: category: auth sample_name: [mfa] spec: passwordless/sign-up - # browser: *minimal_browser_list - browser: [chrome] + browser: *minimal_browser_list env: NEXT_PUBLIC_BACKEND_CONFIG: pwl-signup - test_name: integ_next_passwordless_misc @@ -975,8 +971,7 @@ tests: category: auth sample_name: [mfa] spec: passwordless/miscellaneous - # browser: *minimal_browser_list - browser: [chrome] + browser: *minimal_browser_list env: NEXT_PUBLIC_BACKEND_CONFIG: pwl-misc - test_name: integ_next_passwordless_webauthn From fb8dadbfb77aecd9fe07571d1ccbd0db3b5d0c94 Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Date: Mon, 2 Dec 2024 17:55:36 -0500 Subject: [PATCH 2/4] fix: amplify configure with auth userGroups (#14046) Co-authored-by: Ashwin Kumar --- packages/core/__tests__/parseAmplifyOutputs.test.ts | 2 ++ packages/core/src/singleton/AmplifyOutputs/types.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/__tests__/parseAmplifyOutputs.test.ts b/packages/core/__tests__/parseAmplifyOutputs.test.ts index 38a8fa141c4..9ae814334c1 100644 --- a/packages/core/__tests__/parseAmplifyOutputs.test.ts +++ b/packages/core/__tests__/parseAmplifyOutputs.test.ts @@ -133,6 +133,7 @@ describe('parseAmplifyOutputs tests', () => { unauthenticated_identities_enabled: true, mfa_configuration: 'OPTIONAL', mfa_methods: ['SMS'], + groups: [{ ADMIN: { precedence: 0 }, USER: { precedence: 0 } }], }, }; @@ -174,6 +175,7 @@ describe('parseAmplifyOutputs tests', () => { scopes: ['profile', '...'], }, }, + groups: [{ ADMIN: { precedence: 0 }, USER: { precedence: 0 } }], }, }, }); diff --git a/packages/core/src/singleton/AmplifyOutputs/types.ts b/packages/core/src/singleton/AmplifyOutputs/types.ts index a862d4e4efe..4146037a9ce 100644 --- a/packages/core/src/singleton/AmplifyOutputs/types.ts +++ b/packages/core/src/singleton/AmplifyOutputs/types.ts @@ -42,7 +42,7 @@ export interface AmplifyOutputsAuthProperties { unauthenticated_identities_enabled?: boolean; mfa_configuration?: string; mfa_methods?: string[]; - groups?: Record[]; + groups?: Partial>[]; } export interface AmplifyOutputsStorageBucketProperties { From c72e72ad038bb436287b984a98ad7eb992664be6 Mon Sep 17 00:00:00 2001 From: "Aaron S." <94858815+stocaaro@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:01:08 -0600 Subject: [PATCH 3/4] fix: Typescript errors (#14037) * fix: Typescript errors * Fix test errors --- packages/api-graphql/src/internals/v6.ts | 4 +++- packages/api-graphql/src/types/index.ts | 2 +- packages/datastore/src/types.ts | 12 ++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/api-graphql/src/internals/v6.ts b/packages/api-graphql/src/internals/v6.ts index c5d362908c8..553707be092 100644 --- a/packages/api-graphql/src/internals/v6.ts +++ b/packages/api-graphql/src/internals/v6.ts @@ -4,6 +4,7 @@ import { CustomHeaders } from '@aws-amplify/data-schema/runtime'; import { GraphQLAPI } from '../GraphQLAPI'; import { + GraphQLOptions, GraphQLOptionsV6, GraphQLResponseV6, V6Client, @@ -113,10 +114,11 @@ export function graphql< * Neither of these can actually be validated at runtime. Hence, we don't perform * any validation or type-guarding here. */ + const result = GraphQLAPI.graphql( // TODO: move V6Client back into this package? internals.amplify as any, - options, + options as GraphQLOptions, headers, ); diff --git a/packages/api-graphql/src/types/index.ts b/packages/api-graphql/src/types/index.ts index 0ecac34369a..d642fff3bd1 100644 --- a/packages/api-graphql/src/types/index.ts +++ b/packages/api-graphql/src/types/index.ts @@ -212,7 +212,7 @@ export type GraphQLOperation = Source | string; export interface GraphQLOptionsV6< FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string, -> { +> extends Record { query: TYPED_GQL_STRING | DocumentNode; variables?: GraphQLVariablesV6; authMode?: GraphQLAuthMode; diff --git a/packages/datastore/src/types.ts b/packages/datastore/src/types.ts index abc92322cc7..a36cad59ca1 100644 --- a/packages/datastore/src/types.ts +++ b/packages/datastore/src/types.ts @@ -506,6 +506,10 @@ export type TypeConstructorMap = Record< export declare const __identifierBrand__: unique symbol; export type IdentifierBrand = T & { [__identifierBrand__]: K }; +interface GenericIdentifier { + field: any; +} + // datastore generates a uuid for you export type ManagedIdentifier = IdentifierBrand< { field: F extends string ? F : never; type: T }, @@ -548,7 +552,9 @@ export type IdentifierFields< infer B > ? B[number] // B[number] - : MetadataOrDefault['identifier']['field']) & + : MetadataOrDefault['identifier'] extends GenericIdentifier + ? MetadataOrDefault['identifier']['field'] + : unknown) & string; export type IdentifierFieldsForInit< @@ -710,7 +716,9 @@ export type IdentifierFieldValue< ? MetadataOrDefault['identifier']['fields'] extends [any] ? T[MetadataOrDefault['identifier']['fields'][0]] : never - : T[MetadataOrDefault['identifier']['field']]; + : MetadataOrDefault['identifier'] extends GenericIdentifier + ? T[MetadataOrDefault['identifier']['field']] + : unknown; export type IdentifierFieldOrIdentifierObject< T extends PersistentModel, From 2283e4b424d9958935586ea609d3b7863848650e Mon Sep 17 00:00:00 2001 From: Hui Zhao <10602282+HuiSF@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:27:42 -0800 Subject: [PATCH 4/4] chore: update CODEOWNER (#14054) --- .github/CODEOWNERS | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a24f7b2ebbb..b6574c0fc16 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -15,24 +15,24 @@ # The following paths involve server-side use cases, token/user session management. # Changes made to these paths requires additional reviews and approvals. -/packages/auth @haverchuck @cshfang @HuiSF @pranavosu -/packages/aws-amplify/src/adapter-core @haverchuck @cshfang @HuiSF @pranavosu -/packages/core/src/adapterCore @haverchuck @cshfang @HuiSF @pranavosu -/packages/core/src/singleton @haverchuck @cshfang @HuiSF @pranavosu -/packages/core/src/utils/convert @haverchuck @cshfang @HuiSF @pranavosu -/packages/core/src/utils/WordArray.ts @haverchuck @cshfang @HuiSF @pranavosu -/packages/core/src/storage @haverchuck @cshfang @HuiSF @pranavosu -/packages/core/src/utils/generateRandomString.ts @haverchuck @cshfang @HuiSF @pranavosu -/packages/core/src/utils/globalHelpers @haverchuck @cshfang @HuiSF @pranavosu -/packages/core/src/utils/urlSafeDecode.ts @haverchuck @cshfang @HuiSF @pranavosu -/packages/core/src/awsClients/cognitoIdentity @haverchuck @cshfang @HuiSF @pranavosu -/packages/core/src/clients/internal @haverchuck @cshfang @HuiSF @pranavosu -/packages/core/src/Hub @haverchuck @cshfang @HuiSF @pranavosu -/packages/adapter-nextjs @haverchuck @cshfang @HuiSF @pranavosu -/packages/rtn-web-browser @haverchuck @cshfang @HuiSF @pranavosu -/packages/storage/src/providers/s3/apis/internal @haverchuck @cshfang @HuiSF @pranavosu -/packages/storage/src/providers/s3/apis/server @haverchuck @cshfang @HuiSF @pranavosu -/packages/api-rest/src/apis/server.ts @haverchuck @cshfang @HuiSF @pranavosu -/packages/api-rest/src/apis/common/internalPost.ts @haverchuck @cshfang @HuiSF @pranavosu -/packages/api-graphql/src/server @haverchuck @cshfang @HuiSF @pranavosu -/packages/api-graphql/src/internals/server @haverchuck @cshfang @HuiSF @pranavosu +/packages/auth @sktimalsina @cshfang @HuiSF @pranavosu +/packages/aws-amplify/src/adapter-core @sktimalsina @cshfang @HuiSF @pranavosu +/packages/core/src/adapterCore @sktimalsina @cshfang @HuiSF @pranavosu +/packages/core/src/singleton @sktimalsina @cshfang @HuiSF @pranavosu +/packages/core/src/utils/convert @sktimalsina @cshfang @HuiSF @pranavosu +/packages/core/src/utils/WordArray.ts @sktimalsina @cshfang @HuiSF @pranavosu +/packages/core/src/storage @sktimalsina @cshfang @HuiSF @pranavosu +/packages/core/src/utils/generateRandomString.ts @sktimalsina @cshfang @HuiSF @pranavosu +/packages/core/src/utils/globalHelpers @sktimalsina @cshfang @HuiSF @pranavosu +/packages/core/src/utils/urlSafeDecode.ts @sktimalsina @cshfang @HuiSF @pranavosu +/packages/core/src/awsClients/cognitoIdentity @sktimalsina @cshfang @HuiSF @pranavosu +/packages/core/src/clients/internal @sktimalsina @cshfang @HuiSF @pranavosu +/packages/core/src/Hub @sktimalsina @cshfang @HuiSF @pranavosu +/packages/adapter-nextjs @sktimalsina @cshfang @HuiSF @pranavosu +/packages/rtn-web-browser @sktimalsina @cshfang @HuiSF @pranavosu +/packages/storage/src/providers/s3/apis/internal @sktimalsina @cshfang @HuiSF @pranavosu +/packages/storage/src/providers/s3/apis/server @sktimalsina @cshfang @HuiSF @pranavosu +/packages/api-rest/src/apis/server.ts @sktimalsina @cshfang @HuiSF @pranavosu +/packages/api-rest/src/apis/common/internalPost.ts @sktimalsina @cshfang @HuiSF @pranavosu +/packages/api-graphql/src/server @sktimalsina @cshfang @HuiSF @pranavosu +/packages/api-graphql/src/internals/server @sktimalsina @cshfang @HuiSF @pranavosu