@aws-amplify/core 6.0.2-unstable.ff85fa5.0 → 6.0.3-unstable.032ab8e.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Platform/version.js +1 -1
- package/dist/cjs/Platform/version.js.map +1 -1
- package/dist/cjs/parseAWSExports.js +16 -10
- package/dist/cjs/parseAWSExports.js.map +1 -1
- package/dist/cjs/singleton/API/types.js +6 -0
- package/dist/cjs/singleton/API/types.js.map +1 -1
- package/dist/cjs/singleton/Auth/types.js +0 -2
- package/dist/cjs/singleton/Auth/types.js.map +1 -1
- package/dist/esm/Platform/version.d.ts +1 -1
- package/dist/esm/Platform/version.mjs +1 -1
- package/dist/esm/Platform/version.mjs.map +1 -1
- package/dist/esm/libraryUtils.d.ts +1 -1
- package/dist/esm/parseAWSExports.mjs +16 -10
- package/dist/esm/parseAWSExports.mjs.map +1 -1
- package/dist/esm/singleton/API/types.d.ts +100 -3
- package/dist/esm/singleton/API/types.mjs +10 -0
- package/dist/esm/singleton/API/types.mjs.map +1 -1
- package/dist/esm/singleton/Analytics/types.d.ts +1 -4
- package/dist/esm/singleton/Auth/types.d.ts +3 -1
- package/dist/esm/singleton/Auth/utils/index.d.ts +6 -2
- package/dist/esm/singleton/Geo/types.d.ts +5 -3
- package/dist/esm/singleton/Interactions/types.d.ts +1 -3
- package/dist/esm/singleton/Notifications/types.d.ts +7 -3
- package/dist/esm/singleton/Predictions/types.d.ts +10 -4
- package/dist/esm/singleton/Storage/types.d.ts +4 -2
- package/dist/esm/singleton/types.d.ts +3 -0
- package/package.json +3 -3
- package/src/Platform/version.ts +1 -1
- package/src/libraryUtils.ts +11 -1
- package/src/parseAWSExports.ts +16 -9
- package/src/singleton/API/types.ts +125 -3
- package/src/singleton/Analytics/types.ts +1 -3
- package/src/singleton/Auth/types.ts +6 -2
- package/src/singleton/Auth/utils/index.ts +7 -5
- package/src/singleton/Geo/types.ts +7 -3
- package/src/singleton/Interactions/types.ts +2 -3
- package/src/singleton/Notifications/types.ts +11 -3
- package/src/singleton/Predictions/types.ts +16 -4
- package/src/singleton/Storage/types.ts +6 -2
- package/src/singleton/types.ts +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.0.
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.0.3-unstable.032ab8e.0+032ab8e';\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AACzB;AACA,OAAO,CAAC,OAAO,GAAG,kCAAkC;;"}
|
|
@@ -23,7 +23,7 @@ const authTypeMapping = {
|
|
|
23
23
|
* @returns A {@link ResourcesConfig} object.
|
|
24
24
|
*/
|
|
25
25
|
const parseAWSExports = (config = {}) => {
|
|
26
|
-
const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, aws_bots, aws_bots_config, aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration, aws_cognito_mfa_types, aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms, aws_cognito_signup_attributes, aws_cognito_social_providers, aws_cognito_username_attributes, aws_mandatory_sign_in, aws_mobile_analytics_app_id, aws_mobile_analytics_app_region, aws_user_files_s3_bucket, aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id, aws_user_pools_web_client_id, geo, oauth, predictions, aws_cloud_logic_custom, Notifications, } = config;
|
|
26
|
+
const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, aws_bots, aws_bots_config, aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration, aws_cognito_mfa_types, aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms, aws_cognito_signup_attributes, aws_cognito_social_providers, aws_cognito_username_attributes, aws_mandatory_sign_in, aws_mobile_analytics_app_id, aws_mobile_analytics_app_region, aws_user_files_s3_bucket, aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id, aws_user_pools_web_client_id, geo, oauth, predictions, aws_cloud_logic_custom, Notifications, modelIntrospection, } = config;
|
|
27
27
|
const amplifyConfig = {};
|
|
28
28
|
// Analytics
|
|
29
29
|
if (aws_mobile_analytics_app_id) {
|
|
@@ -37,22 +37,25 @@ const parseAWSExports = (config = {}) => {
|
|
|
37
37
|
// Notifications
|
|
38
38
|
const { InAppMessaging, Push } = Notifications ?? {};
|
|
39
39
|
if (InAppMessaging?.AWSPinpoint || Push?.AWSPinpoint) {
|
|
40
|
-
amplifyConfig.Notifications = {};
|
|
41
40
|
if (InAppMessaging?.AWSPinpoint) {
|
|
42
41
|
const { appId, region } = InAppMessaging.AWSPinpoint;
|
|
43
|
-
amplifyConfig.Notifications
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
amplifyConfig.Notifications = {
|
|
43
|
+
InAppMessaging: {
|
|
44
|
+
Pinpoint: {
|
|
45
|
+
appId,
|
|
46
|
+
region,
|
|
47
|
+
},
|
|
47
48
|
},
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
51
|
if (Push?.AWSPinpoint) {
|
|
51
52
|
const { appId, region } = Push.AWSPinpoint;
|
|
52
|
-
amplifyConfig.Notifications
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
amplifyConfig.Notifications = {
|
|
54
|
+
PushNotification: {
|
|
55
|
+
Pinpoint: {
|
|
56
|
+
appId,
|
|
57
|
+
region,
|
|
58
|
+
},
|
|
56
59
|
},
|
|
57
60
|
};
|
|
58
61
|
}
|
|
@@ -77,6 +80,9 @@ const parseAWSExports = (config = {}) => {
|
|
|
77
80
|
defaultAuthMode: defaultAuthMode ?? 'iam',
|
|
78
81
|
},
|
|
79
82
|
};
|
|
83
|
+
if (modelIntrospection) {
|
|
84
|
+
amplifyConfig.API.GraphQL.modelIntrospection = modelIntrospection;
|
|
85
|
+
}
|
|
80
86
|
}
|
|
81
87
|
// Auth
|
|
82
88
|
const mfaConfig = aws_cognito_mfa_configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseAWSExports.js","sources":["../../src/parseAWSExports.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseAWSExports = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst Logger_1 = require(\"./Logger\");\nconst logger = new Logger_1.ConsoleLogger('parseAWSExports');\nconst authTypeMapping = {\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n OPENID_CONNECT: 'oidc',\n NONE: 'none',\n LAMBDA: 'lambda',\n};\n/**\n * This utility converts the `aws-exports.js` file generated by the Amplify CLI into a {@link ResourcesConfig} object\n * consumable by Amplify.\n *\n * @param config A configuration object from `aws-exports.js`.\n *\n * @returns A {@link ResourcesConfig} object.\n */\nconst parseAWSExports = (config = {}) => {\n const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, aws_bots, aws_bots_config, aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration, aws_cognito_mfa_types, aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms, aws_cognito_signup_attributes, aws_cognito_social_providers, aws_cognito_username_attributes, aws_mandatory_sign_in, aws_mobile_analytics_app_id, aws_mobile_analytics_app_region, aws_user_files_s3_bucket, aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id, aws_user_pools_web_client_id, geo, oauth, predictions, aws_cloud_logic_custom, Notifications, } = config;\n const amplifyConfig = {};\n // Analytics\n if (aws_mobile_analytics_app_id) {\n amplifyConfig.Analytics = {\n Pinpoint: {\n appId: aws_mobile_analytics_app_id,\n region: aws_mobile_analytics_app_region,\n },\n };\n }\n // Notifications\n const { InAppMessaging, Push } = Notifications ?? {};\n if (InAppMessaging?.AWSPinpoint || Push?.AWSPinpoint) {\n amplifyConfig.Notifications = {};\n if (InAppMessaging?.AWSPinpoint) {\n const { appId, region } = InAppMessaging.AWSPinpoint;\n amplifyConfig.Notifications.InAppMessaging = {\n Pinpoint: {\n appId,\n region,\n },\n };\n }\n if (Push?.AWSPinpoint) {\n const { appId, region } = Push.AWSPinpoint;\n amplifyConfig.Notifications.PushNotification = {\n Pinpoint: {\n appId,\n region,\n },\n };\n }\n }\n // Interactions\n if (Array.isArray(aws_bots_config)) {\n amplifyConfig.Interactions = {\n LexV1: Object.fromEntries(aws_bots_config.map(bot => [bot.name, bot])),\n };\n }\n // API\n if (aws_appsync_graphqlEndpoint) {\n const defaultAuthMode = authTypeMapping[aws_appsync_authenticationType];\n if (!defaultAuthMode) {\n logger.debug(`Invalid authentication type ${aws_appsync_authenticationType}. Falling back to IAM.`);\n }\n amplifyConfig.API = {\n GraphQL: {\n endpoint: aws_appsync_graphqlEndpoint,\n apiKey: aws_appsync_apiKey,\n region: aws_appsync_region,\n defaultAuthMode: defaultAuthMode ?? 'iam',\n },\n };\n }\n // Auth\n const mfaConfig = aws_cognito_mfa_configuration\n ? {\n status: aws_cognito_mfa_configuration &&\n aws_cognito_mfa_configuration.toLowerCase(),\n totpEnabled: aws_cognito_mfa_types?.includes('TOTP') ?? false,\n smsEnabled: aws_cognito_mfa_types?.includes('SMS') ?? false,\n }\n : undefined;\n const passwordFormatConfig = aws_cognito_password_protection_settings\n ? {\n minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,\n requireLowercase: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_LOWERCASE') ?? false,\n requireUppercase: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_UPPERCASE') ?? false,\n requireNumbers: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_NUMBERS') ?? false,\n requireSpecialCharacters: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_SYMBOLS') ?? false,\n }\n : undefined;\n const mergedUserAttributes = Array.from(new Set([\n ...(aws_cognito_verification_mechanisms ?? []),\n ...(aws_cognito_signup_attributes ?? []),\n ]));\n const userAttributesConfig = mergedUserAttributes.map((s) => ({\n [s.toLowerCase()]: {\n required: true, // All user attributes generated by the CLI will be required\n },\n }));\n const loginWithEmailEnabled = aws_cognito_username_attributes?.includes('EMAIL') ?? false;\n const loginWithPhoneEnabled = aws_cognito_username_attributes?.includes('PHONE_NUMBER') ?? false;\n if (aws_cognito_identity_pool_id || aws_user_pools_id) {\n amplifyConfig.Auth = {\n Cognito: {\n identityPoolId: aws_cognito_identity_pool_id,\n allowGuestAccess: aws_mandatory_sign_in !== 'enable',\n signUpVerificationMethod: aws_cognito_sign_up_verification_method,\n userAttributes: userAttributesConfig,\n userPoolClientId: aws_user_pools_web_client_id,\n userPoolId: aws_user_pools_id,\n mfa: mfaConfig,\n passwordFormat: passwordFormatConfig,\n loginWith: {\n username: loginWithEmailEnabled || loginWithPhoneEnabled ? false : true,\n email: loginWithEmailEnabled,\n phone: loginWithPhoneEnabled,\n },\n },\n };\n }\n const hasOAuthConfig = oauth ? Object.keys(oauth).length > 0 : false;\n const hasSocialProviderConfig = aws_cognito_social_providers\n ? aws_cognito_social_providers.length > 0\n : false;\n if (amplifyConfig.Auth && hasOAuthConfig) {\n amplifyConfig.Auth.Cognito.loginWith = {\n ...amplifyConfig.Auth.Cognito.loginWith,\n oauth: {\n ...getOAuthConfig(oauth),\n ...(hasSocialProviderConfig && {\n providers: parseSocialProviders(aws_cognito_social_providers),\n }),\n },\n };\n }\n // Storage\n if (aws_user_files_s3_bucket) {\n amplifyConfig.Storage = {\n S3: {\n bucket: aws_user_files_s3_bucket,\n region: aws_user_files_s3_bucket_region,\n dangerouslyConnectToHttpEndpointForTesting: aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing,\n },\n };\n }\n // Geo\n if (geo) {\n const { amazon_location_service } = geo;\n amplifyConfig.Geo = amazon_location_service\n ? {\n LocationService: {\n ...amazon_location_service,\n searchIndices: amazon_location_service.search_indices,\n region: amazon_location_service.region,\n },\n }\n : { ...geo };\n }\n // REST API\n if (aws_cloud_logic_custom) {\n amplifyConfig.API = {\n ...amplifyConfig.API,\n REST: aws_cloud_logic_custom.reduce((acc, api) => {\n const { name, endpoint, region, service } = api;\n return {\n ...acc,\n [name]: {\n endpoint,\n ...(service ? { service } : undefined),\n ...(region ? { region } : undefined),\n },\n };\n }, {}),\n };\n }\n // Predictions\n if (predictions) {\n // map VoiceId from speechGenerator defaults to voiceId\n const { VoiceId: voiceId } = predictions?.convert?.speechGenerator?.defaults ?? {};\n amplifyConfig.Predictions = voiceId\n ? {\n ...predictions,\n convert: {\n ...predictions.convert,\n speechGenerator: {\n ...predictions.convert.speechGenerator,\n defaults: { voiceId },\n },\n },\n }\n : predictions;\n }\n return amplifyConfig;\n};\nexports.parseAWSExports = parseAWSExports;\nconst getRedirectUrl = (redirectStr) => redirectStr?.split(',') ?? [];\nconst getOAuthConfig = ({ domain, scope, redirectSignIn, redirectSignOut, responseType, }) => ({\n domain,\n scopes: scope,\n redirectSignIn: getRedirectUrl(redirectSignIn),\n redirectSignOut: getRedirectUrl(redirectSignOut),\n responseType,\n});\nconst parseSocialProviders = (aws_cognito_social_providers) => {\n return aws_cognito_social_providers.map((provider) => {\n const updatedProvider = provider.toLowerCase();\n return updatedProvider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AAe,GAAG,eAAe,CAAC;AAC1C,MAAM,cAAc,GAAG,CAAC,WAAW,KAAK,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;AACtE,MAAM,cAAc,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,GAAG,MAAM;AAC/F,IAAI,MAAM;AACV,IAAI,MAAM,EAAE,KAAK;AACjB,IAAI,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC;AAClD,IAAI,eAAe,EAAE,cAAc,CAAC,eAAe,CAAC;AACpD,IAAI,YAAY;AAChB,CAAC,CAAC,CAAC;AACH,MAAM,oBAAoB,GAAG,CAAC,4BAA4B,KAAK;AAC/D,IAAI,OAAO,4BAA4B,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK;AAC1D,QAAQ,MAAM,eAAe,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AACvD,QAAQ,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAClF,KAAK,CAAC,CAAC;AACP,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"parseAWSExports.js","sources":["../../src/parseAWSExports.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseAWSExports = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst Logger_1 = require(\"./Logger\");\nconst logger = new Logger_1.ConsoleLogger('parseAWSExports');\nconst authTypeMapping = {\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n OPENID_CONNECT: 'oidc',\n NONE: 'none',\n LAMBDA: 'lambda',\n};\n/**\n * This utility converts the `aws-exports.js` file generated by the Amplify CLI into a {@link ResourcesConfig} object\n * consumable by Amplify.\n *\n * @param config A configuration object from `aws-exports.js`.\n *\n * @returns A {@link ResourcesConfig} object.\n */\nconst parseAWSExports = (config = {}) => {\n const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, aws_bots, aws_bots_config, aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration, aws_cognito_mfa_types, aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms, aws_cognito_signup_attributes, aws_cognito_social_providers, aws_cognito_username_attributes, aws_mandatory_sign_in, aws_mobile_analytics_app_id, aws_mobile_analytics_app_region, aws_user_files_s3_bucket, aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id, aws_user_pools_web_client_id, geo, oauth, predictions, aws_cloud_logic_custom, Notifications, modelIntrospection, } = config;\n const amplifyConfig = {};\n // Analytics\n if (aws_mobile_analytics_app_id) {\n amplifyConfig.Analytics = {\n Pinpoint: {\n appId: aws_mobile_analytics_app_id,\n region: aws_mobile_analytics_app_region,\n },\n };\n }\n // Notifications\n const { InAppMessaging, Push } = Notifications ?? {};\n if (InAppMessaging?.AWSPinpoint || Push?.AWSPinpoint) {\n if (InAppMessaging?.AWSPinpoint) {\n const { appId, region } = InAppMessaging.AWSPinpoint;\n amplifyConfig.Notifications = {\n InAppMessaging: {\n Pinpoint: {\n appId,\n region,\n },\n },\n };\n }\n if (Push?.AWSPinpoint) {\n const { appId, region } = Push.AWSPinpoint;\n amplifyConfig.Notifications = {\n PushNotification: {\n Pinpoint: {\n appId,\n region,\n },\n },\n };\n }\n }\n // Interactions\n if (Array.isArray(aws_bots_config)) {\n amplifyConfig.Interactions = {\n LexV1: Object.fromEntries(aws_bots_config.map(bot => [bot.name, bot])),\n };\n }\n // API\n if (aws_appsync_graphqlEndpoint) {\n const defaultAuthMode = authTypeMapping[aws_appsync_authenticationType];\n if (!defaultAuthMode) {\n logger.debug(`Invalid authentication type ${aws_appsync_authenticationType}. Falling back to IAM.`);\n }\n amplifyConfig.API = {\n GraphQL: {\n endpoint: aws_appsync_graphqlEndpoint,\n apiKey: aws_appsync_apiKey,\n region: aws_appsync_region,\n defaultAuthMode: defaultAuthMode ?? 'iam',\n },\n };\n if (modelIntrospection) {\n amplifyConfig.API.GraphQL.modelIntrospection = modelIntrospection;\n }\n }\n // Auth\n const mfaConfig = aws_cognito_mfa_configuration\n ? {\n status: aws_cognito_mfa_configuration &&\n aws_cognito_mfa_configuration.toLowerCase(),\n totpEnabled: aws_cognito_mfa_types?.includes('TOTP') ?? false,\n smsEnabled: aws_cognito_mfa_types?.includes('SMS') ?? false,\n }\n : undefined;\n const passwordFormatConfig = aws_cognito_password_protection_settings\n ? {\n minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,\n requireLowercase: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_LOWERCASE') ?? false,\n requireUppercase: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_UPPERCASE') ?? false,\n requireNumbers: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_NUMBERS') ?? false,\n requireSpecialCharacters: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_SYMBOLS') ?? false,\n }\n : undefined;\n const mergedUserAttributes = Array.from(new Set([\n ...(aws_cognito_verification_mechanisms ?? []),\n ...(aws_cognito_signup_attributes ?? []),\n ]));\n const userAttributesConfig = mergedUserAttributes.map((s) => ({\n [s.toLowerCase()]: {\n required: true, // All user attributes generated by the CLI will be required\n },\n }));\n const loginWithEmailEnabled = aws_cognito_username_attributes?.includes('EMAIL') ?? false;\n const loginWithPhoneEnabled = aws_cognito_username_attributes?.includes('PHONE_NUMBER') ?? false;\n if (aws_cognito_identity_pool_id || aws_user_pools_id) {\n amplifyConfig.Auth = {\n Cognito: {\n identityPoolId: aws_cognito_identity_pool_id,\n allowGuestAccess: aws_mandatory_sign_in !== 'enable',\n signUpVerificationMethod: aws_cognito_sign_up_verification_method,\n userAttributes: userAttributesConfig,\n userPoolClientId: aws_user_pools_web_client_id,\n userPoolId: aws_user_pools_id,\n mfa: mfaConfig,\n passwordFormat: passwordFormatConfig,\n loginWith: {\n username: loginWithEmailEnabled || loginWithPhoneEnabled ? false : true,\n email: loginWithEmailEnabled,\n phone: loginWithPhoneEnabled,\n },\n },\n };\n }\n const hasOAuthConfig = oauth ? Object.keys(oauth).length > 0 : false;\n const hasSocialProviderConfig = aws_cognito_social_providers\n ? aws_cognito_social_providers.length > 0\n : false;\n if (amplifyConfig.Auth && hasOAuthConfig) {\n amplifyConfig.Auth.Cognito.loginWith = {\n ...amplifyConfig.Auth.Cognito.loginWith,\n oauth: {\n ...getOAuthConfig(oauth),\n ...(hasSocialProviderConfig && {\n providers: parseSocialProviders(aws_cognito_social_providers),\n }),\n },\n };\n }\n // Storage\n if (aws_user_files_s3_bucket) {\n amplifyConfig.Storage = {\n S3: {\n bucket: aws_user_files_s3_bucket,\n region: aws_user_files_s3_bucket_region,\n dangerouslyConnectToHttpEndpointForTesting: aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing,\n },\n };\n }\n // Geo\n if (geo) {\n const { amazon_location_service } = geo;\n amplifyConfig.Geo = amazon_location_service\n ? {\n LocationService: {\n ...amazon_location_service,\n searchIndices: amazon_location_service.search_indices,\n region: amazon_location_service.region,\n },\n }\n : { ...geo };\n }\n // REST API\n if (aws_cloud_logic_custom) {\n amplifyConfig.API = {\n ...amplifyConfig.API,\n REST: aws_cloud_logic_custom.reduce((acc, api) => {\n const { name, endpoint, region, service } = api;\n return {\n ...acc,\n [name]: {\n endpoint,\n ...(service ? { service } : undefined),\n ...(region ? { region } : undefined),\n },\n };\n }, {}),\n };\n }\n // Predictions\n if (predictions) {\n // map VoiceId from speechGenerator defaults to voiceId\n const { VoiceId: voiceId } = predictions?.convert?.speechGenerator?.defaults ?? {};\n amplifyConfig.Predictions = voiceId\n ? {\n ...predictions,\n convert: {\n ...predictions.convert,\n speechGenerator: {\n ...predictions.convert.speechGenerator,\n defaults: { voiceId },\n },\n },\n }\n : predictions;\n }\n return amplifyConfig;\n};\nexports.parseAWSExports = parseAWSExports;\nconst getRedirectUrl = (redirectStr) => redirectStr?.split(',') ?? [];\nconst getOAuthConfig = ({ domain, scope, redirectSignIn, redirectSignOut, responseType, }) => ({\n domain,\n scopes: scope,\n redirectSignIn: getRedirectUrl(redirectSignIn),\n redirectSignOut: getRedirectUrl(redirectSignOut),\n responseType,\n});\nconst parseSocialProviders = (aws_cognito_social_providers) => {\n return aws_cognito_social_providers.map((provider) => {\n const updatedProvider = provider.toLowerCase();\n return updatedProvider.charAt(0).toUpperCase() + updatedProvider.slice(1);\n });\n};\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,eAAe,GAAG,KAAK,CAAC,CAAC;AACjC;AACA;AACA,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACrC,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;AAC7D,MAAM,eAAe,GAAG;AACxB,IAAI,OAAO,EAAE,QAAQ;AACrB,IAAI,OAAO,EAAE,KAAK;AAClB,IAAI,yBAAyB,EAAE,UAAU;AACzC,IAAI,cAAc,EAAE,MAAM;AAC1B,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,QAAQ;AACpB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe,GAAG,CAAC,MAAM,GAAG,EAAE,KAAK;AACzC,IAAI,MAAM,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,QAAQ,EAAE,eAAe,EAAE,4BAA4B,EAAE,uCAAuC,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,wCAAwC,EAAE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CAAC,CAAC;AAClF,KAAK,CAAC,CAAC;AACP,CAAC;;"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CodeGenConnectionType = void 0;
|
|
5
|
+
(function (CodeGenConnectionType) {
|
|
6
|
+
CodeGenConnectionType["HAS_ONE"] = "HAS_ONE";
|
|
7
|
+
CodeGenConnectionType["BELONGS_TO"] = "BELONGS_TO";
|
|
8
|
+
CodeGenConnectionType["HAS_MANY"] = "HAS_MANY";
|
|
9
|
+
})(exports.CodeGenConnectionType || (exports.CodeGenConnectionType = {}));
|
|
4
10
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../src/singleton/API/types.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/singleton/API/types.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CodeGenConnectionType = void 0;\n/**\n * Field-level Relationship Definitions\n */\nvar CodeGenConnectionType;\n(function (CodeGenConnectionType) {\n CodeGenConnectionType[\"HAS_ONE\"] = \"HAS_ONE\";\n CodeGenConnectionType[\"BELONGS_TO\"] = \"BELONGS_TO\";\n CodeGenConnectionType[\"HAS_MANY\"] = \"HAS_MANY\";\n})(CodeGenConnectionType = exports.CodeGenConnectionType || (exports.CodeGenConnectionType = {}));\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,qBAAqB,GAAG,KAAK,CAAC,CAAC;AAKvC,CAAC,UAAU,qBAAqB,EAAE;AAClC,IAAI,qBAAqB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;AACjD,IAAI,qBAAqB,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AACvD,IAAI,qBAAqB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AACnD,CAAC,EAA0B,OAAO,CAAC,qBAAqB,KAAK,OAAO,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC;;"}
|
|
@@ -2,7 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
// From https://github.com/awslabs/aws-jwt-verify/blob/main/src/safe-json-parse.ts
|
|
6
|
-
// From https://github.com/awslabs/aws-jwt-verify/blob/main/src/jwt-model.ts
|
|
7
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
6
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../src/singleton/Auth/types.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/singleton/Auth/types.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.
|
|
1
|
+
export declare const version = "6.0.3-unstable.032ab8e.0+032ab8e";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.0.
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.0.3-unstable.032ab8e.0+032ab8e';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
|
|
@@ -6,7 +6,7 @@ export { amplifyUuid } from './utils/amplifyUuid';
|
|
|
6
6
|
export { AmplifyUrl, AmplifyUrlSearchParams } from './utils/amplifyUrl';
|
|
7
7
|
export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
|
|
8
8
|
export { isTokenExpired } from './singleton/Auth';
|
|
9
|
-
export {
|
|
9
|
+
export { AssociationBelongsTo, AssociationHasMany, AssociationHasOne, DocumentType, GraphQLAuthMode, ModelFieldType, ModelIntrospectionSchema, SchemaModel, SchemaModels, } from './singleton/API/types';
|
|
10
10
|
export { Signer } from './Signer';
|
|
11
11
|
export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, AuthStandardAttributeKey, AuthVerifiableAttributeKey, AWSCredentials, } from './singleton/Auth/types';
|
|
12
12
|
export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
|
|
@@ -20,7 +20,7 @@ const authTypeMapping = {
|
|
|
20
20
|
* @returns A {@link ResourcesConfig} object.
|
|
21
21
|
*/
|
|
22
22
|
const parseAWSExports = (config = {}) => {
|
|
23
|
-
const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, aws_bots, aws_bots_config, aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration, aws_cognito_mfa_types, aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms, aws_cognito_signup_attributes, aws_cognito_social_providers, aws_cognito_username_attributes, aws_mandatory_sign_in, aws_mobile_analytics_app_id, aws_mobile_analytics_app_region, aws_user_files_s3_bucket, aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id, aws_user_pools_web_client_id, geo, oauth, predictions, aws_cloud_logic_custom, Notifications, } = config;
|
|
23
|
+
const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, aws_bots, aws_bots_config, aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration, aws_cognito_mfa_types, aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms, aws_cognito_signup_attributes, aws_cognito_social_providers, aws_cognito_username_attributes, aws_mandatory_sign_in, aws_mobile_analytics_app_id, aws_mobile_analytics_app_region, aws_user_files_s3_bucket, aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id, aws_user_pools_web_client_id, geo, oauth, predictions, aws_cloud_logic_custom, Notifications, modelIntrospection, } = config;
|
|
24
24
|
const amplifyConfig = {};
|
|
25
25
|
// Analytics
|
|
26
26
|
if (aws_mobile_analytics_app_id) {
|
|
@@ -34,22 +34,25 @@ const parseAWSExports = (config = {}) => {
|
|
|
34
34
|
// Notifications
|
|
35
35
|
const { InAppMessaging, Push } = Notifications ?? {};
|
|
36
36
|
if (InAppMessaging?.AWSPinpoint || Push?.AWSPinpoint) {
|
|
37
|
-
amplifyConfig.Notifications = {};
|
|
38
37
|
if (InAppMessaging?.AWSPinpoint) {
|
|
39
38
|
const { appId, region } = InAppMessaging.AWSPinpoint;
|
|
40
|
-
amplifyConfig.Notifications
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
amplifyConfig.Notifications = {
|
|
40
|
+
InAppMessaging: {
|
|
41
|
+
Pinpoint: {
|
|
42
|
+
appId,
|
|
43
|
+
region,
|
|
44
|
+
},
|
|
44
45
|
},
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
48
|
if (Push?.AWSPinpoint) {
|
|
48
49
|
const { appId, region } = Push.AWSPinpoint;
|
|
49
|
-
amplifyConfig.Notifications
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
amplifyConfig.Notifications = {
|
|
51
|
+
PushNotification: {
|
|
52
|
+
Pinpoint: {
|
|
53
|
+
appId,
|
|
54
|
+
region,
|
|
55
|
+
},
|
|
53
56
|
},
|
|
54
57
|
};
|
|
55
58
|
}
|
|
@@ -74,6 +77,9 @@ const parseAWSExports = (config = {}) => {
|
|
|
74
77
|
defaultAuthMode: defaultAuthMode ?? 'iam',
|
|
75
78
|
},
|
|
76
79
|
};
|
|
80
|
+
if (modelIntrospection) {
|
|
81
|
+
amplifyConfig.API.GraphQL.modelIntrospection = modelIntrospection;
|
|
82
|
+
}
|
|
77
83
|
}
|
|
78
84
|
// Auth
|
|
79
85
|
const mfaConfig = aws_cognito_mfa_configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseAWSExports.mjs","sources":["../../src/parseAWSExports.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from './Logger';\nconst logger = new ConsoleLogger('parseAWSExports');\nconst authTypeMapping = {\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n OPENID_CONNECT: 'oidc',\n NONE: 'none',\n LAMBDA: 'lambda',\n};\n/**\n * This utility converts the `aws-exports.js` file generated by the Amplify CLI into a {@link ResourcesConfig} object\n * consumable by Amplify.\n *\n * @param config A configuration object from `aws-exports.js`.\n *\n * @returns A {@link ResourcesConfig} object.\n */\nexport const parseAWSExports = (config = {}) => {\n const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, aws_bots, aws_bots_config, aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration, aws_cognito_mfa_types, aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms, aws_cognito_signup_attributes, aws_cognito_social_providers, aws_cognito_username_attributes, aws_mandatory_sign_in, aws_mobile_analytics_app_id, aws_mobile_analytics_app_region, aws_user_files_s3_bucket, aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id, aws_user_pools_web_client_id, geo, oauth, predictions, aws_cloud_logic_custom, Notifications, } = config;\n const amplifyConfig = {};\n // Analytics\n if (aws_mobile_analytics_app_id) {\n amplifyConfig.Analytics = {\n Pinpoint: {\n appId: aws_mobile_analytics_app_id,\n region: aws_mobile_analytics_app_region,\n },\n };\n }\n // Notifications\n const { InAppMessaging, Push } = Notifications ?? {};\n if (InAppMessaging?.AWSPinpoint || Push?.AWSPinpoint) {\n amplifyConfig.Notifications = {};\n if (InAppMessaging?.AWSPinpoint) {\n const { appId, region } = InAppMessaging.AWSPinpoint;\n amplifyConfig.Notifications.InAppMessaging = {\n Pinpoint: {\n appId,\n region,\n },\n };\n }\n if (Push?.AWSPinpoint) {\n const { appId, region } = Push.AWSPinpoint;\n amplifyConfig.Notifications.PushNotification = {\n Pinpoint: {\n appId,\n region,\n },\n };\n }\n }\n // Interactions\n if (Array.isArray(aws_bots_config)) {\n amplifyConfig.Interactions = {\n LexV1: Object.fromEntries(aws_bots_config.map(bot => [bot.name, bot])),\n };\n }\n // API\n if (aws_appsync_graphqlEndpoint) {\n const defaultAuthMode = authTypeMapping[aws_appsync_authenticationType];\n if (!defaultAuthMode) {\n logger.debug(`Invalid authentication type ${aws_appsync_authenticationType}. Falling back to IAM.`);\n }\n amplifyConfig.API = {\n GraphQL: {\n endpoint: aws_appsync_graphqlEndpoint,\n apiKey: aws_appsync_apiKey,\n region: aws_appsync_region,\n defaultAuthMode: defaultAuthMode ?? 'iam',\n },\n };\n }\n // Auth\n const mfaConfig = aws_cognito_mfa_configuration\n ? {\n status: aws_cognito_mfa_configuration &&\n aws_cognito_mfa_configuration.toLowerCase(),\n totpEnabled: aws_cognito_mfa_types?.includes('TOTP') ?? false,\n smsEnabled: aws_cognito_mfa_types?.includes('SMS') ?? false,\n }\n : undefined;\n const passwordFormatConfig = aws_cognito_password_protection_settings\n ? {\n minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,\n requireLowercase: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_LOWERCASE') ?? false,\n requireUppercase: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_UPPERCASE') ?? false,\n requireNumbers: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_NUMBERS') ?? false,\n requireSpecialCharacters: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_SYMBOLS') ?? false,\n }\n : undefined;\n const mergedUserAttributes = Array.from(new Set([\n ...(aws_cognito_verification_mechanisms ?? []),\n ...(aws_cognito_signup_attributes ?? []),\n ]));\n const userAttributesConfig = mergedUserAttributes.map((s) => ({\n [s.toLowerCase()]: {\n required: true, // All user attributes generated by the CLI will be required\n },\n }));\n const loginWithEmailEnabled = aws_cognito_username_attributes?.includes('EMAIL') ?? false;\n const loginWithPhoneEnabled = aws_cognito_username_attributes?.includes('PHONE_NUMBER') ?? false;\n if (aws_cognito_identity_pool_id || aws_user_pools_id) {\n amplifyConfig.Auth = {\n Cognito: {\n identityPoolId: aws_cognito_identity_pool_id,\n allowGuestAccess: aws_mandatory_sign_in !== 'enable',\n signUpVerificationMethod: aws_cognito_sign_up_verification_method,\n userAttributes: userAttributesConfig,\n userPoolClientId: aws_user_pools_web_client_id,\n userPoolId: aws_user_pools_id,\n mfa: mfaConfig,\n passwordFormat: passwordFormatConfig,\n loginWith: {\n username: loginWithEmailEnabled || loginWithPhoneEnabled ? false : true,\n email: loginWithEmailEnabled,\n phone: loginWithPhoneEnabled,\n },\n },\n };\n }\n const hasOAuthConfig = oauth ? Object.keys(oauth).length > 0 : false;\n const hasSocialProviderConfig = aws_cognito_social_providers\n ? aws_cognito_social_providers.length > 0\n : false;\n if (amplifyConfig.Auth && hasOAuthConfig) {\n amplifyConfig.Auth.Cognito.loginWith = {\n ...amplifyConfig.Auth.Cognito.loginWith,\n oauth: {\n ...getOAuthConfig(oauth),\n ...(hasSocialProviderConfig && {\n providers: parseSocialProviders(aws_cognito_social_providers),\n }),\n },\n };\n }\n // Storage\n if (aws_user_files_s3_bucket) {\n amplifyConfig.Storage = {\n S3: {\n bucket: aws_user_files_s3_bucket,\n region: aws_user_files_s3_bucket_region,\n dangerouslyConnectToHttpEndpointForTesting: aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing,\n },\n };\n }\n // Geo\n if (geo) {\n const { amazon_location_service } = geo;\n amplifyConfig.Geo = amazon_location_service\n ? {\n LocationService: {\n ...amazon_location_service,\n searchIndices: amazon_location_service.search_indices,\n region: amazon_location_service.region,\n },\n }\n : { ...geo };\n }\n // REST API\n if (aws_cloud_logic_custom) {\n amplifyConfig.API = {\n ...amplifyConfig.API,\n REST: aws_cloud_logic_custom.reduce((acc, api) => {\n const { name, endpoint, region, service } = api;\n return {\n ...acc,\n [name]: {\n endpoint,\n ...(service ? { service } : undefined),\n ...(region ? { region } : undefined),\n },\n };\n }, {}),\n };\n }\n // Predictions\n if (predictions) {\n // map VoiceId from speechGenerator defaults to voiceId\n const { VoiceId: voiceId } = predictions?.convert?.speechGenerator?.defaults ?? {};\n amplifyConfig.Predictions = voiceId\n ? {\n ...predictions,\n convert: {\n ...predictions.convert,\n speechGenerator: {\n ...predictions.convert.speechGenerator,\n defaults: { voiceId },\n },\n },\n }\n : predictions;\n }\n return amplifyConfig;\n};\nconst getRedirectUrl = (redirectStr) => redirectStr?.split(',') ?? [];\nconst getOAuthConfig = ({ domain, scope, redirectSignIn, redirectSignOut, responseType, }) => ({\n domain,\n scopes: scope,\n redirectSignIn: getRedirectUrl(redirectSignIn),\n redirectSignOut: getRedirectUrl(redirectSignOut),\n responseType,\n});\nconst parseSocialProviders = (aws_cognito_social_providers) => {\n return aws_cognito_social_providers.map((provider) => {\n const updatedProvider = provider.toLowerCase();\n return updatedProvider.charAt(0).toUpperCase() + updatedProvider.slice(1);\n });\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,iBAAiB,CAAC,CAAC;AACpD,MAAM,eAAe,GAAG;AACxB,IAAI,OAAO,EAAE,QAAQ;AACrB,IAAI,OAAO,EAAE,KAAK;AAClB,IAAI,yBAAyB,EAAE,UAAU;AACzC,IAAI,cAAc,EAAE,MAAM;AAC1B,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,QAAQ;AACpB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,MAAM,GAAG,EAAE,KAAK;AAChD,IAAI,MAAM,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,QAAQ,EAAE,eAAe,EAAE,4BAA4B,EAAE,uCAAuC,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,wCAAwC,EAAE,mCAAmC,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,+BAA+B,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,kEAAkE,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,aAAa,GAAG,GAAG,MAAM,CAAC;AACtwB,IAAI,MAAM,aAAa,GAAG,EAAE,CAAC;AAC7B;AACA,IAAI,IAAI,2BAA2B,EAAE;AACrC,QAAQ,aAAa,CAAC,SAAS,GAAG;AAClC,YAAY,QAAQ,EAAE;AACtB,gBAAgB,KAAK,EAAE,2BAA2B;AAClD,gBAAgB,MAAM,EAAE,+BAA+B;AACvD,aAAa;AACb,SAAS,CAAC;AACV,KAAK;AACL;AACA,IAAI,MAAM,E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eAAe,EAAE,YAAY,GAAG,MAAM;AAC/F,IAAI,MAAM;AACV,IAAI,MAAM,EAAE,KAAK;AACjB,IAAI,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC;AAClD,IAAI,eAAe,EAAE,cAAc,CAAC,eAAe,CAAC;AACpD,IAAI,YAAY;AAChB,CAAC,CAAC,CAAC;AACH,MAAM,oBAAoB,GAAG,CAAC,4BAA4B,KAAK;AAC/D,IAAI,OAAO,4BAA4B,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK;AAC1D,QAAQ,MAAM,eAAe,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AACvD,QAAQ,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAClF,KAAK,CAAC,CAAC;AACP,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"parseAWSExports.mjs","sources":["../../src/parseAWSExports.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from './Logger';\nconst logger = new ConsoleLogger('parseAWSExports');\nconst authTypeMapping = {\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n OPENID_CONNECT: 'oidc',\n NONE: 'none',\n LAMBDA: 'lambda',\n};\n/**\n * This utility converts the `aws-exports.js` file generated by the Amplify CLI into a {@link ResourcesConfig} object\n * consumable by Amplify.\n *\n * @param config A configuration object from `aws-exports.js`.\n *\n * @returns A {@link ResourcesConfig} object.\n */\nexport const parseAWSExports = (config = {}) => {\n const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, aws_bots, aws_bots_config, aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration, aws_cognito_mfa_types, aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms, aws_cognito_signup_attributes, aws_cognito_social_providers, aws_cognito_username_attributes, aws_mandatory_sign_in, aws_mobile_analytics_app_id, aws_mobile_analytics_app_region, aws_user_files_s3_bucket, aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id, aws_user_pools_web_client_id, geo, oauth, predictions, aws_cloud_logic_custom, Notifications, modelIntrospection, } = config;\n const amplifyConfig = {};\n // Analytics\n if (aws_mobile_analytics_app_id) {\n amplifyConfig.Analytics = {\n Pinpoint: {\n appId: aws_mobile_analytics_app_id,\n region: aws_mobile_analytics_app_region,\n },\n };\n }\n // Notifications\n const { InAppMessaging, Push } = Notifications ?? {};\n if (InAppMessaging?.AWSPinpoint || Push?.AWSPinpoint) {\n if (InAppMessaging?.AWSPinpoint) {\n const { appId, region } = InAppMessaging.AWSPinpoint;\n amplifyConfig.Notifications = {\n InAppMessaging: {\n Pinpoint: {\n appId,\n region,\n },\n },\n };\n }\n if (Push?.AWSPinpoint) {\n const { appId, region } = Push.AWSPinpoint;\n amplifyConfig.Notifications = {\n PushNotification: {\n Pinpoint: {\n appId,\n region,\n },\n },\n };\n }\n }\n // Interactions\n if (Array.isArray(aws_bots_config)) {\n amplifyConfig.Interactions = {\n LexV1: Object.fromEntries(aws_bots_config.map(bot => [bot.name, bot])),\n };\n }\n // API\n if (aws_appsync_graphqlEndpoint) {\n const defaultAuthMode = authTypeMapping[aws_appsync_authenticationType];\n if (!defaultAuthMode) {\n logger.debug(`Invalid authentication type ${aws_appsync_authenticationType}. Falling back to IAM.`);\n }\n amplifyConfig.API = {\n GraphQL: {\n endpoint: aws_appsync_graphqlEndpoint,\n apiKey: aws_appsync_apiKey,\n region: aws_appsync_region,\n defaultAuthMode: defaultAuthMode ?? 'iam',\n },\n };\n if (modelIntrospection) {\n amplifyConfig.API.GraphQL.modelIntrospection = modelIntrospection;\n }\n }\n // Auth\n const mfaConfig = aws_cognito_mfa_configuration\n ? {\n status: aws_cognito_mfa_configuration &&\n aws_cognito_mfa_configuration.toLowerCase(),\n totpEnabled: aws_cognito_mfa_types?.includes('TOTP') ?? false,\n smsEnabled: aws_cognito_mfa_types?.includes('SMS') ?? false,\n }\n : undefined;\n const passwordFormatConfig = aws_cognito_password_protection_settings\n ? {\n minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,\n requireLowercase: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_LOWERCASE') ?? false,\n requireUppercase: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_UPPERCASE') ?? false,\n requireNumbers: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_NUMBERS') ?? false,\n requireSpecialCharacters: aws_cognito_password_protection_settings.passwordPolicyCharacters?.includes('REQUIRES_SYMBOLS') ?? false,\n }\n : undefined;\n const mergedUserAttributes = Array.from(new Set([\n ...(aws_cognito_verification_mechanisms ?? []),\n ...(aws_cognito_signup_attributes ?? []),\n ]));\n const userAttributesConfig = mergedUserAttributes.map((s) => ({\n [s.toLowerCase()]: {\n required: true, // All user attributes generated by the CLI will be required\n },\n }));\n const loginWithEmailEnabled = aws_cognito_username_attributes?.includes('EMAIL') ?? false;\n const loginWithPhoneEnabled = aws_cognito_username_attributes?.includes('PHONE_NUMBER') ?? false;\n if (aws_cognito_identity_pool_id || aws_user_pools_id) {\n amplifyConfig.Auth = {\n Cognito: {\n identityPoolId: aws_cognito_identity_pool_id,\n allowGuestAccess: aws_mandatory_sign_in !== 'enable',\n signUpVerificationMethod: aws_cognito_sign_up_verification_method,\n userAttributes: userAttributesConfig,\n userPoolClientId: aws_user_pools_web_client_id,\n userPoolId: aws_user_pools_id,\n mfa: mfaConfig,\n passwordFormat: passwordFormatConfig,\n loginWith: {\n username: loginWithEmailEnabled || loginWithPhoneEnabled ? false : true,\n email: loginWithEmailEnabled,\n phone: loginWithPhoneEnabled,\n },\n },\n };\n }\n const hasOAuthConfig = oauth ? Object.keys(oauth).length > 0 : false;\n const hasSocialProviderConfig = aws_cognito_social_providers\n ? aws_cognito_social_providers.length > 0\n : false;\n if (amplifyConfig.Auth && hasOAuthConfig) {\n amplifyConfig.Auth.Cognito.loginWith = {\n ...amplifyConfig.Auth.Cognito.loginWith,\n oauth: {\n ...getOAuthConfig(oauth),\n ...(hasSocialProviderConfig && {\n providers: parseSocialProviders(aws_cognito_social_providers),\n }),\n },\n };\n }\n // Storage\n if (aws_user_files_s3_bucket) {\n amplifyConfig.Storage = {\n S3: {\n bucket: aws_user_files_s3_bucket,\n region: aws_user_files_s3_bucket_region,\n dangerouslyConnectToHttpEndpointForTesting: aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing,\n },\n };\n }\n // Geo\n if (geo) {\n const { amazon_location_service } = geo;\n amplifyConfig.Geo = amazon_location_service\n ? {\n LocationService: {\n ...amazon_location_service,\n searchIndices: amazon_location_service.search_indices,\n region: amazon_location_service.region,\n },\n }\n : { ...geo };\n }\n // REST API\n if (aws_cloud_logic_custom) {\n amplifyConfig.API = {\n ...amplifyConfig.API,\n REST: aws_cloud_logic_custom.reduce((acc, api) => {\n const { name, endpoint, region, service } = api;\n return {\n ...acc,\n [name]: {\n endpoint,\n ...(service ? { service } : undefined),\n ...(region ? { region } : undefined),\n },\n };\n }, {}),\n };\n }\n // Predictions\n if (predictions) {\n // map VoiceId from speechGenerator defaults to voiceId\n const { VoiceId: voiceId } = predictions?.convert?.speechGenerator?.defaults ?? {};\n amplifyConfig.Predictions = voiceId\n ? {\n ...predictions,\n convert: {\n ...predictions.convert,\n speechGenerator: {\n ...predictions.convert.speechGenerator,\n defaults: { voiceId },\n },\n },\n }\n : predictions;\n }\n return amplifyConfig;\n};\nconst getRedirectUrl = (redirectStr) => redirectStr?.split(',') ?? [];\nconst getOAuthConfig = ({ domain, scope, redirectSignIn, redirectSignOut, responseType, }) => ({\n domain,\n scopes: scope,\n redirectSignIn: getRedirectUrl(redirectSignIn),\n redirectSignOut: getRedirectUrl(redirectSignOut),\n responseType,\n});\nconst parseSocialProviders = (aws_cognito_social_providers) => {\n return aws_cognito_social_providers.map((provider) => {\n const updatedProvider = provider.toLowerCase();\n return updatedProvider.charAt(0).toUpperCase() + updatedProvider.slice(1);\n });\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,iBAAiB,CAAC,CAAC;AACpD,MAAM,eAAe,GAAG;AACxB,IAAI,OAAO,EAAE,QAAQ;AACrB,IAAI,OAAO,EAAE,KAAK;AAClB,IAAI,yBAAyB,EAAE,UAAU;AACzC,IAAI,cAAc,EAAE,MAAM;AAC1B,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,QAAQ;AACpB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,MAAM,GAAG,EAAE,KAAK;AAChD,IAAI,MAAM,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,QAAQ,EAAE,eAAe,EAAE,4BAA4B,EAAE,uCAAuC,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,wCAAwC,EAAE,mCAAmC,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,+BAA+B,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,kEAAkE,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,aAAa,EAAE,kBAAkB,GAAG,GAAG,MAAM,CAAC;AAC1xB,IAAI,MAAM,aAAa,GAAG,EAAE,CAAC;AAC7B;AACA,IAAI,IAAI,2BAA2B,EAAE;AACrC,QAAQ,aAAa,CAAC,SAAS,GAAG;AAClC,YAAY,QAAQ,EAAE;AACtB,gBAAgB,KAAK,EAAE,2BAA2B;AAClD,gBAAgB,MAAM,EAAE,+BAA+B;AACvD,aAAa;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CAAC;AACzB,EAAE;AACF,MAAM,cAAc,GAAG,CAAC,WAAW,KAAK,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;AACtE,MAAM,cAAc,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,GAAG,MAAM;AAC/F,IAAI,MAAM;AACV,IAAI,MAAM,EAAE,KAAK;AACjB,IAAI,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC;AAClD,IAAI,eAAe,EAAE,cAAc,CAAC,eAAe,CAAC;AACpD,IAAI,YAAY;AAChB,CAAC,CAAC,CAAC;AACH,MAAM,oBAAoB,GAAG,CAAC,4BAA4B,KAAK;AAC/D,IAAI,OAAO,4BAA4B,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK;AAC1D,QAAQ,MAAM,eAAe,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AACvD,QAAQ,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAClF,KAAK,CAAC,CAAC;AACP,CAAC;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Headers } from '../../clients';
|
|
2
|
+
import { AtLeastOne } from '../types';
|
|
2
3
|
export type LibraryAPIOptions = {
|
|
3
4
|
GraphQL?: {
|
|
4
5
|
headers?: (options: {
|
|
@@ -39,6 +40,7 @@ type APIGraphQLConfig = {
|
|
|
39
40
|
* Default auth mode for all the API calls to given service.
|
|
40
41
|
*/
|
|
41
42
|
defaultAuthMode: GraphQLAuthMode;
|
|
43
|
+
modelIntrospection?: ModelIntrospectionSchema;
|
|
42
44
|
};
|
|
43
45
|
type APIRestConfig = {
|
|
44
46
|
/**
|
|
@@ -59,10 +61,13 @@ type APIRestConfig = {
|
|
|
59
61
|
*/
|
|
60
62
|
service?: string;
|
|
61
63
|
};
|
|
62
|
-
export type
|
|
63
|
-
REST
|
|
64
|
-
GraphQL?: APIGraphQLConfig;
|
|
64
|
+
export type RESTProviderConfig = {
|
|
65
|
+
REST: Record<string, APIRestConfig>;
|
|
65
66
|
};
|
|
67
|
+
export type GraphQLProviderConfig = {
|
|
68
|
+
GraphQL: APIGraphQLConfig;
|
|
69
|
+
};
|
|
70
|
+
export type APIConfig = AtLeastOne<RESTProviderConfig & GraphQLProviderConfig>;
|
|
66
71
|
export type GraphQLAuthMode = 'apiKey' | 'oidc' | 'userPool' | 'iam' | 'lambda' | 'none';
|
|
67
72
|
/**
|
|
68
73
|
* Type representing a plain JavaScript object that can be serialized to JSON.
|
|
@@ -70,4 +75,96 @@ export type GraphQLAuthMode = 'apiKey' | 'oidc' | 'userPool' | 'iam' | 'lambda'
|
|
|
70
75
|
export type DocumentType = null | boolean | number | string | DocumentType[] | {
|
|
71
76
|
[prop: string]: DocumentType;
|
|
72
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* Root model instrospection schema shape.
|
|
80
|
+
*
|
|
81
|
+
* Borrowed from: https://github.com/aws-amplify/samsara-cli/pull/377/commits/c08ea2c1a43f36aafe63b6d14d03f884e9c0c671#diff-21ae6faa2f22c15bb25ff9b272eaab7846c0650e2d267ab720546c19559583d0R4-R108
|
|
82
|
+
*/
|
|
83
|
+
export type ModelIntrospectionSchema = {
|
|
84
|
+
version: 1;
|
|
85
|
+
models: SchemaModels;
|
|
86
|
+
nonModels: SchemaNonModels;
|
|
87
|
+
enums: SchemaEnums;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Top-level Entities on a Schema
|
|
91
|
+
*/
|
|
92
|
+
export type SchemaModels = Record<string, SchemaModel>;
|
|
93
|
+
export type SchemaNonModels = Record<string, SchemaNonModel>;
|
|
94
|
+
export type SchemaEnums = Record<string, SchemaEnum>;
|
|
95
|
+
export type SchemaModel = {
|
|
96
|
+
name: string;
|
|
97
|
+
attributes?: ModelAttribute[];
|
|
98
|
+
fields: Fields;
|
|
99
|
+
pluralName: string;
|
|
100
|
+
syncable?: boolean;
|
|
101
|
+
primaryKeyInfo: PrimaryKeyInfo;
|
|
102
|
+
};
|
|
103
|
+
export type SchemaNonModel = {
|
|
104
|
+
name: string;
|
|
105
|
+
fields: Fields;
|
|
106
|
+
};
|
|
107
|
+
export type SchemaEnum = {
|
|
108
|
+
name: string;
|
|
109
|
+
values: string[];
|
|
110
|
+
};
|
|
111
|
+
export type ModelAttribute = {
|
|
112
|
+
type: string;
|
|
113
|
+
properties?: {
|
|
114
|
+
[key: string]: any;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Field Definition
|
|
119
|
+
*/
|
|
120
|
+
export type Fields = Record<string, Field>;
|
|
121
|
+
export type Field = {
|
|
122
|
+
name: string;
|
|
123
|
+
type: FieldType;
|
|
124
|
+
isArray: boolean;
|
|
125
|
+
isRequired: boolean;
|
|
126
|
+
isReadOnly?: boolean;
|
|
127
|
+
isArrayNullable?: boolean;
|
|
128
|
+
attributes?: FieldAttribute[];
|
|
129
|
+
association?: AssociationType;
|
|
130
|
+
};
|
|
131
|
+
export type ModelFieldType = {
|
|
132
|
+
model: string;
|
|
133
|
+
};
|
|
134
|
+
export type FieldType = 'ID' | 'String' | 'Int' | 'Float' | 'AWSDate' | 'AWSTime' | 'AWSDateTime' | 'AWSTimestamp' | 'AWSEmail' | 'AWSURL' | 'AWSIPAddress' | 'Boolean' | 'AWSJSON' | 'AWSPhone' | {
|
|
135
|
+
enum: string;
|
|
136
|
+
} | ModelFieldType | {
|
|
137
|
+
nonModel: string;
|
|
138
|
+
};
|
|
139
|
+
export type FieldAttribute = ModelAttribute;
|
|
140
|
+
/**
|
|
141
|
+
* Field-level Relationship Definitions
|
|
142
|
+
*/
|
|
143
|
+
export declare enum CodeGenConnectionType {
|
|
144
|
+
HAS_ONE = "HAS_ONE",
|
|
145
|
+
BELONGS_TO = "BELONGS_TO",
|
|
146
|
+
HAS_MANY = "HAS_MANY"
|
|
147
|
+
}
|
|
148
|
+
export type AssociationBaseType = {
|
|
149
|
+
connectionType: CodeGenConnectionType;
|
|
150
|
+
};
|
|
151
|
+
export type AssociationHasMany = AssociationBaseType & {
|
|
152
|
+
connectionType: CodeGenConnectionType.HAS_MANY;
|
|
153
|
+
associatedWith: string[];
|
|
154
|
+
};
|
|
155
|
+
export type AssociationHasOne = AssociationBaseType & {
|
|
156
|
+
connectionType: CodeGenConnectionType.HAS_ONE;
|
|
157
|
+
associatedWith: string[];
|
|
158
|
+
targetNames: string[];
|
|
159
|
+
};
|
|
160
|
+
export type AssociationBelongsTo = AssociationBaseType & {
|
|
161
|
+
connectionType: CodeGenConnectionType.BELONGS_TO;
|
|
162
|
+
targetNames: string[];
|
|
163
|
+
};
|
|
164
|
+
export type AssociationType = AssociationHasMany | AssociationHasOne | AssociationBelongsTo;
|
|
165
|
+
export type PrimaryKeyInfo = {
|
|
166
|
+
isCustomPrimaryKey: boolean;
|
|
167
|
+
primaryKeyFieldName: string;
|
|
168
|
+
sortKeyFieldNames: string[];
|
|
169
|
+
};
|
|
73
170
|
export {};
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field-level Relationship Definitions
|
|
3
|
+
*/
|
|
4
|
+
var CodeGenConnectionType;
|
|
5
|
+
(function (CodeGenConnectionType) {
|
|
6
|
+
CodeGenConnectionType["HAS_ONE"] = "HAS_ONE";
|
|
7
|
+
CodeGenConnectionType["BELONGS_TO"] = "BELONGS_TO";
|
|
8
|
+
CodeGenConnectionType["HAS_MANY"] = "HAS_MANY";
|
|
9
|
+
})(CodeGenConnectionType || (CodeGenConnectionType = {}));
|
|
1
10
|
|
|
11
|
+
export { CodeGenConnectionType };
|
|
2
12
|
//# sourceMappingURL=types.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.mjs","sources":["../../../../src/singleton/API/types.ts"],"sourcesContent":["/**\n * Field-level Relationship Definitions\n */\nexport var CodeGenConnectionType;\n(function (CodeGenConnectionType) {\n CodeGenConnectionType[\"HAS_ONE\"] = \"HAS_ONE\";\n CodeGenConnectionType[\"BELONGS_TO\"] = \"BELONGS_TO\";\n CodeGenConnectionType[\"HAS_MANY\"] = \"HAS_MANY\";\n})(CodeGenConnectionType || (CodeGenConnectionType = {}));\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACU,IAAC,sBAAsB;AACjC,CAAC,UAAU,qBAAqB,EAAE;AAClC,IAAI,qBAAqB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;AACjD,IAAI,qBAAqB,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AACvD,IAAI,qBAAqB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AACnD,CAAC,EAAE,qBAAqB,KAAK,qBAAqB,GAAG,EAAE,CAAC,CAAC;;;;"}
|
|
@@ -2,8 +2,5 @@ import { PinpointProviderConfig } from '../../providers/pinpoint/types';
|
|
|
2
2
|
import { KinesisProviderConfig } from '../../providers/kinesis/types';
|
|
3
3
|
import { KinesisFirehoseProviderConfig } from '../../providers/kinesis-firehose/types';
|
|
4
4
|
import { PersonalizeProviderConfig } from '../../providers/personalize/types';
|
|
5
|
-
|
|
6
|
-
[K in keyof T]: Pick<T, K>;
|
|
7
|
-
}> = Partial<T> & U[keyof U];
|
|
5
|
+
import { AtLeastOne } from '../types';
|
|
8
6
|
export type AnalyticsConfig = AtLeastOne<PinpointProviderConfig & KinesisProviderConfig & KinesisFirehoseProviderConfig & PersonalizeProviderConfig>;
|
|
9
|
-
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AtLeastOne } from '../types';
|
|
1
2
|
interface JwtPayloadStandardFields {
|
|
2
3
|
exp?: number;
|
|
3
4
|
iss?: string;
|
|
@@ -55,7 +56,8 @@ export type AuthVerifiableAttributeKey = 'email' | 'phone_number';
|
|
|
55
56
|
export type AuthConfigUserAttributes = Partial<Record<AuthStandardAttributeKey, {
|
|
56
57
|
required: boolean;
|
|
57
58
|
}>>;
|
|
58
|
-
export type AuthConfig =
|
|
59
|
+
export type AuthConfig = AtLeastOne<CognitoProviderConfig>;
|
|
60
|
+
export type CognitoProviderConfig = StrictUnion<AuthIdentityPoolConfig | AuthUserPoolConfig | AuthUserPoolAndIdentityPoolConfig>;
|
|
59
61
|
type UnionKeys<T> = T extends T ? keyof T : never;
|
|
60
62
|
type StrictUnionHelper<T, TAll> = T extends any ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>> : never;
|
|
61
63
|
export type StrictUnion<T> = StrictUnionHelper<T, T>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthConfig, JWT, CognitoUserPoolConfig, CognitoUserPoolAndIdentityPoolConfig, CognitoIdentityPoolConfig, StrictUnion, OAuthConfig } from '../types';
|
|
2
2
|
export declare function assertTokenProviderConfig(cognitoConfig?: StrictUnion<CognitoUserPoolConfig | CognitoUserPoolAndIdentityPoolConfig | CognitoIdentityPoolConfig>): asserts cognitoConfig is CognitoUserPoolAndIdentityPoolConfig | CognitoUserPoolConfig;
|
|
3
|
-
export declare function assertOAuthConfig(cognitoConfig?:
|
|
3
|
+
export declare function assertOAuthConfig(cognitoConfig?: AuthConfig['Cognito']): asserts cognitoConfig is AuthConfig['Cognito'] & {
|
|
4
|
+
loginWith: {
|
|
5
|
+
oauth: OAuthConfig;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
4
8
|
export declare function assertIdentityPoolIdConfig(cognitoConfig?: StrictUnion<CognitoUserPoolConfig | CognitoUserPoolAndIdentityPoolConfig | CognitoIdentityPoolConfig>): asserts cognitoConfig is CognitoIdentityPoolConfig;
|
|
5
9
|
export declare function decodeJWT(token: string): JWT;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { AtLeastOne } from '../types';
|
|
2
|
+
export type LocationServiceConfig = {
|
|
3
|
+
LocationService: {
|
|
3
4
|
region: string;
|
|
4
5
|
maps?: {
|
|
5
6
|
items: {};
|
|
@@ -14,4 +15,5 @@ export interface GeoConfig {
|
|
|
14
15
|
default: string;
|
|
15
16
|
};
|
|
16
17
|
};
|
|
17
|
-
}
|
|
18
|
+
};
|
|
19
|
+
export type GeoConfig = AtLeastOne<LocationServiceConfig>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AtLeastOne } from '../types';
|
|
1
2
|
interface LexV1BotConfig {
|
|
2
3
|
alias: string;
|
|
3
4
|
region: string;
|
|
@@ -14,8 +15,5 @@ type InteractionsLexV1Config = {
|
|
|
14
15
|
type InteractionsLexV2Config = {
|
|
15
16
|
LexV2: Record<string, LexV2BotConfig>;
|
|
16
17
|
};
|
|
17
|
-
type AtLeastOne<T, U = {
|
|
18
|
-
[K in keyof T]: Pick<T, K>;
|
|
19
|
-
}> = Partial<T> & U[keyof U];
|
|
20
18
|
export type InteractionsConfig = AtLeastOne<InteractionsLexV1Config & InteractionsLexV2Config>;
|
|
21
19
|
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { InAppMessagingConfig } from './InAppMessaging/types';
|
|
2
2
|
import { PushNotificationConfig } from './PushNotification/types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { AtLeastOne } from '../types';
|
|
4
|
+
export type InAppMessagingProviderConfig = {
|
|
5
|
+
InAppMessaging: InAppMessagingConfig;
|
|
6
6
|
};
|
|
7
|
+
export type PushNotificationProviderConfig = {
|
|
8
|
+
PushNotification: PushNotificationConfig;
|
|
9
|
+
};
|
|
10
|
+
export type NotificationsConfig = AtLeastOne<InAppMessagingProviderConfig & PushNotificationProviderConfig>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AtLeastOne } from '../types';
|
|
1
2
|
type SpeechGeneratorDefaults = {
|
|
2
3
|
voiceId?: string;
|
|
3
4
|
};
|
|
@@ -41,9 +42,14 @@ export type PredictionsProviderConfig<T> = {
|
|
|
41
42
|
proxy?: boolean;
|
|
42
43
|
defaults?: T;
|
|
43
44
|
};
|
|
44
|
-
export type
|
|
45
|
-
convert
|
|
46
|
-
identify?: IdentifyConfig;
|
|
47
|
-
interpret?: InterpretConfig;
|
|
45
|
+
export type PredictionsConvertConfig = {
|
|
46
|
+
convert: ConvertConfig;
|
|
48
47
|
};
|
|
48
|
+
export type PredictionsIdentifyConfig = {
|
|
49
|
+
identify: IdentifyConfig;
|
|
50
|
+
};
|
|
51
|
+
export type PredictionsInterpretConfig = {
|
|
52
|
+
interpret: InterpretConfig;
|
|
53
|
+
};
|
|
54
|
+
export type PredictionsConfig = AtLeastOne<PredictionsConvertConfig & PredictionsIdentifyConfig & PredictionsInterpretConfig>;
|
|
49
55
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { AtLeastOne } from '../types';
|
|
1
2
|
export type StorageAccessLevel = 'guest' | 'protected' | 'private';
|
|
2
|
-
export
|
|
3
|
+
export type S3ProviderConfig = {
|
|
3
4
|
S3: {
|
|
4
5
|
bucket?: string;
|
|
5
6
|
region?: string;
|
|
@@ -10,7 +11,8 @@ export interface StorageConfig {
|
|
|
10
11
|
*/
|
|
11
12
|
dangerouslyConnectToHttpEndpointForTesting?: string;
|
|
12
13
|
};
|
|
13
|
-
}
|
|
14
|
+
};
|
|
15
|
+
export type StorageConfig = AtLeastOne<S3ProviderConfig>;
|
|
14
16
|
type StoragePrefixResolver = (params: {
|
|
15
17
|
accessLevel: StorageAccessLevel;
|
|
16
18
|
targetIdentityId?: string;
|
|
@@ -12,6 +12,9 @@ export type LegacyConfig = {
|
|
|
12
12
|
*/
|
|
13
13
|
aws_project_region?: string;
|
|
14
14
|
};
|
|
15
|
+
export type AtLeastOne<T, U = {
|
|
16
|
+
[K in keyof T]: Pick<T, K>;
|
|
17
|
+
}> = Partial<T> & U[keyof U];
|
|
15
18
|
export type ResourcesConfig = {
|
|
16
19
|
API?: APIConfig;
|
|
17
20
|
Analytics?: AnalyticsConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/core",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3-unstable.032ab8e.0+032ab8e",
|
|
4
4
|
"description": "Core category of aws-amplify",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"uuid": "^9.0.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@aws-amplify/react-native": "1.0.
|
|
63
|
+
"@aws-amplify/react-native": "1.0.3-unstable.032ab8e.0+032ab8e",
|
|
64
64
|
"@rollup/plugin-typescript": "11.1.5",
|
|
65
65
|
"@types/js-cookie": "3.0.2",
|
|
66
66
|
"genversion": "^2.2.0",
|
|
@@ -234,5 +234,5 @@
|
|
|
234
234
|
"dist"
|
|
235
235
|
]
|
|
236
236
|
},
|
|
237
|
-
"gitHead": "
|
|
237
|
+
"gitHead": "032ab8e4a0deeafa1c01692ea265508faecaf0e6"
|
|
238
238
|
}
|
package/src/Platform/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '6.0.
|
|
2
|
+
export const version = '6.0.3-unstable.032ab8e.0+032ab8e';
|
package/src/libraryUtils.ts
CHANGED
|
@@ -31,7 +31,17 @@ export {
|
|
|
31
31
|
assertOAuthConfig,
|
|
32
32
|
} from './singleton/Auth/utils';
|
|
33
33
|
export { isTokenExpired } from './singleton/Auth';
|
|
34
|
-
export {
|
|
34
|
+
export {
|
|
35
|
+
AssociationBelongsTo,
|
|
36
|
+
AssociationHasMany,
|
|
37
|
+
AssociationHasOne,
|
|
38
|
+
DocumentType,
|
|
39
|
+
GraphQLAuthMode,
|
|
40
|
+
ModelFieldType,
|
|
41
|
+
ModelIntrospectionSchema,
|
|
42
|
+
SchemaModel,
|
|
43
|
+
SchemaModels,
|
|
44
|
+
} from './singleton/API/types';
|
|
35
45
|
export { Signer } from './Signer';
|
|
36
46
|
export {
|
|
37
47
|
JWT,
|
package/src/parseAWSExports.ts
CHANGED
|
@@ -60,6 +60,7 @@ export const parseAWSExports = (
|
|
|
60
60
|
predictions,
|
|
61
61
|
aws_cloud_logic_custom,
|
|
62
62
|
Notifications,
|
|
63
|
+
modelIntrospection,
|
|
63
64
|
} = config;
|
|
64
65
|
const amplifyConfig: ResourcesConfig = {};
|
|
65
66
|
|
|
@@ -76,22 +77,25 @@ export const parseAWSExports = (
|
|
|
76
77
|
// Notifications
|
|
77
78
|
const { InAppMessaging, Push } = Notifications ?? {};
|
|
78
79
|
if (InAppMessaging?.AWSPinpoint || Push?.AWSPinpoint) {
|
|
79
|
-
amplifyConfig.Notifications = {};
|
|
80
80
|
if (InAppMessaging?.AWSPinpoint) {
|
|
81
81
|
const { appId, region } = InAppMessaging.AWSPinpoint;
|
|
82
|
-
amplifyConfig.Notifications
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
amplifyConfig.Notifications = {
|
|
83
|
+
InAppMessaging: {
|
|
84
|
+
Pinpoint: {
|
|
85
|
+
appId,
|
|
86
|
+
region,
|
|
87
|
+
},
|
|
86
88
|
},
|
|
87
89
|
};
|
|
88
90
|
}
|
|
89
91
|
if (Push?.AWSPinpoint) {
|
|
90
92
|
const { appId, region } = Push.AWSPinpoint;
|
|
91
|
-
amplifyConfig.Notifications
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
amplifyConfig.Notifications = {
|
|
94
|
+
PushNotification: {
|
|
95
|
+
Pinpoint: {
|
|
96
|
+
appId,
|
|
97
|
+
region,
|
|
98
|
+
},
|
|
95
99
|
},
|
|
96
100
|
};
|
|
97
101
|
}
|
|
@@ -120,6 +124,9 @@ export const parseAWSExports = (
|
|
|
120
124
|
defaultAuthMode: defaultAuthMode ?? 'iam',
|
|
121
125
|
},
|
|
122
126
|
};
|
|
127
|
+
if (modelIntrospection) {
|
|
128
|
+
amplifyConfig.API.GraphQL!.modelIntrospection = modelIntrospection;
|
|
129
|
+
}
|
|
123
130
|
}
|
|
124
131
|
|
|
125
132
|
// Auth
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { Headers } from '../../clients';
|
|
4
|
+
import { AtLeastOne } from '../types';
|
|
4
5
|
|
|
5
6
|
export type LibraryAPIOptions = {
|
|
6
7
|
GraphQL?: {
|
|
@@ -43,6 +44,7 @@ type APIGraphQLConfig = {
|
|
|
43
44
|
* Default auth mode for all the API calls to given service.
|
|
44
45
|
*/
|
|
45
46
|
defaultAuthMode: GraphQLAuthMode;
|
|
47
|
+
modelIntrospection?: ModelIntrospectionSchema;
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
type APIRestConfig = {
|
|
@@ -65,11 +67,16 @@ type APIRestConfig = {
|
|
|
65
67
|
service?: string;
|
|
66
68
|
};
|
|
67
69
|
|
|
68
|
-
export type
|
|
69
|
-
REST
|
|
70
|
-
GraphQL?: APIGraphQLConfig;
|
|
70
|
+
export type RESTProviderConfig = {
|
|
71
|
+
REST: Record<string, APIRestConfig>;
|
|
71
72
|
};
|
|
72
73
|
|
|
74
|
+
export type GraphQLProviderConfig = {
|
|
75
|
+
GraphQL: APIGraphQLConfig;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type APIConfig = AtLeastOne<RESTProviderConfig & GraphQLProviderConfig>;
|
|
79
|
+
|
|
73
80
|
export type GraphQLAuthMode =
|
|
74
81
|
| 'apiKey'
|
|
75
82
|
| 'oidc'
|
|
@@ -88,3 +95,118 @@ export type DocumentType =
|
|
|
88
95
|
| string
|
|
89
96
|
| DocumentType[]
|
|
90
97
|
| { [prop: string]: DocumentType };
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Root model instrospection schema shape.
|
|
101
|
+
*
|
|
102
|
+
* Borrowed from: https://github.com/aws-amplify/samsara-cli/pull/377/commits/c08ea2c1a43f36aafe63b6d14d03f884e9c0c671#diff-21ae6faa2f22c15bb25ff9b272eaab7846c0650e2d267ab720546c19559583d0R4-R108
|
|
103
|
+
*/
|
|
104
|
+
export type ModelIntrospectionSchema = {
|
|
105
|
+
version: 1;
|
|
106
|
+
models: SchemaModels;
|
|
107
|
+
nonModels: SchemaNonModels;
|
|
108
|
+
enums: SchemaEnums;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Top-level Entities on a Schema
|
|
113
|
+
*/
|
|
114
|
+
export type SchemaModels = Record<string, SchemaModel>;
|
|
115
|
+
export type SchemaNonModels = Record<string, SchemaNonModel>;
|
|
116
|
+
export type SchemaEnums = Record<string, SchemaEnum>;
|
|
117
|
+
|
|
118
|
+
export type SchemaModel = {
|
|
119
|
+
name: string;
|
|
120
|
+
attributes?: ModelAttribute[];
|
|
121
|
+
fields: Fields;
|
|
122
|
+
pluralName: string;
|
|
123
|
+
syncable?: boolean;
|
|
124
|
+
primaryKeyInfo: PrimaryKeyInfo;
|
|
125
|
+
};
|
|
126
|
+
export type SchemaNonModel = {
|
|
127
|
+
name: string;
|
|
128
|
+
fields: Fields;
|
|
129
|
+
};
|
|
130
|
+
export type SchemaEnum = {
|
|
131
|
+
name: string;
|
|
132
|
+
values: string[];
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export type ModelAttribute = {
|
|
136
|
+
type: string;
|
|
137
|
+
properties?: { [key: string]: any };
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Field Definition
|
|
142
|
+
*/
|
|
143
|
+
export type Fields = Record<string, Field>;
|
|
144
|
+
export type Field = {
|
|
145
|
+
name: string;
|
|
146
|
+
type: FieldType;
|
|
147
|
+
isArray: boolean;
|
|
148
|
+
isRequired: boolean;
|
|
149
|
+
isReadOnly?: boolean;
|
|
150
|
+
isArrayNullable?: boolean;
|
|
151
|
+
attributes?: FieldAttribute[];
|
|
152
|
+
association?: AssociationType;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type ModelFieldType = { model: string };
|
|
156
|
+
|
|
157
|
+
export type FieldType =
|
|
158
|
+
| 'ID'
|
|
159
|
+
| 'String'
|
|
160
|
+
| 'Int'
|
|
161
|
+
| 'Float'
|
|
162
|
+
| 'AWSDate'
|
|
163
|
+
| 'AWSTime'
|
|
164
|
+
| 'AWSDateTime'
|
|
165
|
+
| 'AWSTimestamp'
|
|
166
|
+
| 'AWSEmail'
|
|
167
|
+
| 'AWSURL'
|
|
168
|
+
| 'AWSIPAddress'
|
|
169
|
+
| 'Boolean'
|
|
170
|
+
| 'AWSJSON'
|
|
171
|
+
| 'AWSPhone'
|
|
172
|
+
| { enum: string }
|
|
173
|
+
| ModelFieldType
|
|
174
|
+
| { nonModel: string };
|
|
175
|
+
export type FieldAttribute = ModelAttribute;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Field-level Relationship Definitions
|
|
179
|
+
*/
|
|
180
|
+
export enum CodeGenConnectionType {
|
|
181
|
+
HAS_ONE = 'HAS_ONE',
|
|
182
|
+
BELONGS_TO = 'BELONGS_TO',
|
|
183
|
+
HAS_MANY = 'HAS_MANY',
|
|
184
|
+
}
|
|
185
|
+
export type AssociationBaseType = {
|
|
186
|
+
connectionType: CodeGenConnectionType;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export type AssociationHasMany = AssociationBaseType & {
|
|
190
|
+
connectionType: CodeGenConnectionType.HAS_MANY;
|
|
191
|
+
associatedWith: string[];
|
|
192
|
+
};
|
|
193
|
+
export type AssociationHasOne = AssociationBaseType & {
|
|
194
|
+
connectionType: CodeGenConnectionType.HAS_ONE;
|
|
195
|
+
associatedWith: string[];
|
|
196
|
+
targetNames: string[];
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export type AssociationBelongsTo = AssociationBaseType & {
|
|
200
|
+
connectionType: CodeGenConnectionType.BELONGS_TO;
|
|
201
|
+
targetNames: string[];
|
|
202
|
+
};
|
|
203
|
+
export type AssociationType =
|
|
204
|
+
| AssociationHasMany
|
|
205
|
+
| AssociationHasOne
|
|
206
|
+
| AssociationBelongsTo;
|
|
207
|
+
|
|
208
|
+
export type PrimaryKeyInfo = {
|
|
209
|
+
isCustomPrimaryKey: boolean;
|
|
210
|
+
primaryKeyFieldName: string;
|
|
211
|
+
sortKeyFieldNames: string[];
|
|
212
|
+
};
|
|
@@ -5,9 +5,7 @@ import { PinpointProviderConfig } from '../../providers/pinpoint/types';
|
|
|
5
5
|
import { KinesisProviderConfig } from '../../providers/kinesis/types';
|
|
6
6
|
import { KinesisFirehoseProviderConfig } from '../../providers/kinesis-firehose/types';
|
|
7
7
|
import { PersonalizeProviderConfig } from '../../providers/personalize/types';
|
|
8
|
-
|
|
9
|
-
type AtLeastOne<T, U = { [K in keyof T]: Pick<T, K> }> = Partial<T> &
|
|
10
|
-
U[keyof U];
|
|
8
|
+
import { AtLeastOne } from '../types';
|
|
11
9
|
|
|
12
10
|
export type AnalyticsConfig = AtLeastOne<
|
|
13
11
|
PinpointProviderConfig &
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { AtLeastOne } from '../types';
|
|
5
|
+
|
|
3
6
|
// From https://github.com/awslabs/aws-jwt-verify/blob/main/src/safe-json-parse.ts
|
|
4
7
|
// From https://github.com/awslabs/aws-jwt-verify/blob/main/src/jwt-model.ts
|
|
5
|
-
|
|
6
8
|
interface JwtPayloadStandardFields {
|
|
7
9
|
exp?: number; // expires: https://tools.ietf.org/html/rfc7519#section-4.1.4
|
|
8
10
|
iss?: string; // issuer: https://tools.ietf.org/html/rfc7519#section-4.1.1
|
|
@@ -97,7 +99,9 @@ export type AuthConfigUserAttributes = Partial<
|
|
|
97
99
|
Record<AuthStandardAttributeKey, { required: boolean }>
|
|
98
100
|
>;
|
|
99
101
|
|
|
100
|
-
export type AuthConfig =
|
|
102
|
+
export type AuthConfig = AtLeastOne<CognitoProviderConfig>;
|
|
103
|
+
|
|
104
|
+
export type CognitoProviderConfig = StrictUnion<
|
|
101
105
|
| AuthIdentityPoolConfig
|
|
102
106
|
| AuthUserPoolConfig
|
|
103
107
|
| AuthUserPoolAndIdentityPoolConfig
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { AuthConfigurationErrorCode, assert } from './errorHelpers';
|
|
4
4
|
import { base64Decoder } from '../../../utils/convert';
|
|
5
|
-
|
|
6
5
|
import {
|
|
7
6
|
AuthConfig,
|
|
8
7
|
JWT,
|
|
@@ -12,6 +11,7 @@ import {
|
|
|
12
11
|
CognitoUserPoolAndIdentityPoolConfig,
|
|
13
12
|
CognitoIdentityPoolConfig,
|
|
14
13
|
StrictUnion,
|
|
14
|
+
OAuthConfig,
|
|
15
15
|
} from '../types';
|
|
16
16
|
|
|
17
17
|
export function assertTokenProviderConfig(
|
|
@@ -38,20 +38,22 @@ export function assertTokenProviderConfig(
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export function assertOAuthConfig(
|
|
41
|
-
cognitoConfig?:
|
|
42
|
-
): asserts cognitoConfig is
|
|
41
|
+
cognitoConfig?: AuthConfig['Cognito']
|
|
42
|
+
): asserts cognitoConfig is AuthConfig['Cognito'] & {
|
|
43
|
+
loginWith: {
|
|
44
|
+
oauth: OAuthConfig;
|
|
45
|
+
};
|
|
46
|
+
} {
|
|
43
47
|
const validOAuthConfig =
|
|
44
48
|
!!cognitoConfig?.loginWith?.oauth?.domain &&
|
|
45
49
|
!!cognitoConfig?.loginWith?.oauth?.redirectSignOut &&
|
|
46
50
|
!!cognitoConfig?.loginWith?.oauth?.redirectSignIn &&
|
|
47
51
|
!!cognitoConfig?.loginWith?.oauth?.responseType;
|
|
48
|
-
|
|
49
52
|
return assert(
|
|
50
53
|
validOAuthConfig,
|
|
51
54
|
AuthConfigurationErrorCode.OAuthNotConfigureException
|
|
52
55
|
);
|
|
53
56
|
}
|
|
54
|
-
|
|
55
57
|
export function assertIdentityPoolIdConfig(
|
|
56
58
|
cognitoConfig?: StrictUnion<
|
|
57
59
|
| CognitoUserPoolConfig
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { AtLeastOne } from '../types';
|
|
5
|
+
|
|
6
|
+
export type LocationServiceConfig = {
|
|
7
|
+
LocationService: {
|
|
6
8
|
region: string;
|
|
7
9
|
maps?: {
|
|
8
10
|
items: {};
|
|
@@ -17,4 +19,6 @@ export interface GeoConfig {
|
|
|
17
19
|
default: string;
|
|
18
20
|
};
|
|
19
21
|
};
|
|
20
|
-
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type GeoConfig = AtLeastOne<LocationServiceConfig>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { AtLeastOne } from '../types';
|
|
5
|
+
|
|
4
6
|
interface LexV1BotConfig {
|
|
5
7
|
alias: string;
|
|
6
8
|
region: string;
|
|
@@ -21,9 +23,6 @@ type InteractionsLexV2Config = {
|
|
|
21
23
|
LexV2: Record<string, LexV2BotConfig>;
|
|
22
24
|
};
|
|
23
25
|
|
|
24
|
-
type AtLeastOne<T, U = { [K in keyof T]: Pick<T, K> }> = Partial<T> &
|
|
25
|
-
U[keyof U];
|
|
26
|
-
|
|
27
26
|
export type InteractionsConfig = AtLeastOne<
|
|
28
27
|
InteractionsLexV1Config & InteractionsLexV2Config
|
|
29
28
|
>;
|
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
import { InAppMessagingConfig } from './InAppMessaging/types';
|
|
5
5
|
import { PushNotificationConfig } from './PushNotification/types';
|
|
6
|
+
import { AtLeastOne } from '../types';
|
|
6
7
|
|
|
7
|
-
export type
|
|
8
|
-
InAppMessaging
|
|
9
|
-
PushNotification?: PushNotificationConfig;
|
|
8
|
+
export type InAppMessagingProviderConfig = {
|
|
9
|
+
InAppMessaging: InAppMessagingConfig;
|
|
10
10
|
};
|
|
11
|
+
|
|
12
|
+
export type PushNotificationProviderConfig = {
|
|
13
|
+
PushNotification: PushNotificationConfig;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type NotificationsConfig = AtLeastOne<
|
|
17
|
+
InAppMessagingProviderConfig & PushNotificationProviderConfig
|
|
18
|
+
>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { AtLeastOne } from '../types';
|
|
5
|
+
|
|
4
6
|
// Defaults for ConvertConfig
|
|
5
7
|
type SpeechGeneratorDefaults = {
|
|
6
8
|
voiceId?: string;
|
|
@@ -54,8 +56,18 @@ export type PredictionsProviderConfig<T> = {
|
|
|
54
56
|
defaults?: T;
|
|
55
57
|
};
|
|
56
58
|
|
|
57
|
-
export type
|
|
58
|
-
convert
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
export type PredictionsConvertConfig = {
|
|
60
|
+
convert: ConvertConfig;
|
|
61
|
+
};
|
|
62
|
+
export type PredictionsIdentifyConfig = {
|
|
63
|
+
identify: IdentifyConfig;
|
|
61
64
|
};
|
|
65
|
+
export type PredictionsInterpretConfig = {
|
|
66
|
+
interpret: InterpretConfig;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type PredictionsConfig = AtLeastOne<
|
|
70
|
+
PredictionsConvertConfig &
|
|
71
|
+
PredictionsIdentifyConfig &
|
|
72
|
+
PredictionsInterpretConfig
|
|
73
|
+
>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { AtLeastOne } from '../types';
|
|
5
|
+
|
|
4
6
|
export type StorageAccessLevel = 'guest' | 'protected' | 'private';
|
|
5
7
|
|
|
6
|
-
export
|
|
8
|
+
export type S3ProviderConfig = {
|
|
7
9
|
S3: {
|
|
8
10
|
bucket?: string;
|
|
9
11
|
region?: string;
|
|
@@ -14,7 +16,9 @@ export interface StorageConfig {
|
|
|
14
16
|
*/
|
|
15
17
|
dangerouslyConnectToHttpEndpointForTesting?: string;
|
|
16
18
|
};
|
|
17
|
-
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type StorageConfig = AtLeastOne<S3ProviderConfig>;
|
|
18
22
|
|
|
19
23
|
type StoragePrefixResolver = (params: {
|
|
20
24
|
accessLevel: StorageAccessLevel;
|
package/src/singleton/types.ts
CHANGED