@aws-amplify/core 6.0.7-unstable.ca62f29.0 → 6.0.7-unstable.f21f8f1.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.
@@ -3,5 +3,5 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.version = void 0;
5
5
  // generated by genversion
6
- exports.version = '6.0.7-unstable.ca62f29.0+ca62f29';
6
+ exports.version = '6.0.7-unstable.f21f8f1.0+f21f8f1';
7
7
  //# sourceMappingURL=version.js.map
@@ -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.7-unstable.ca62f29.0+ca62f29';\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;;"}
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.7-unstable.f21f8f1.0+f21f8f1';\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;;"}
@@ -5,6 +5,7 @@ exports.parseAWSExports = void 0;
5
5
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
6
  // SPDX-License-Identifier: Apache-2.0
7
7
  const Logger_1 = require("./Logger");
8
+ const errors_1 = require("./errors");
8
9
  const logger = new Logger_1.ConsoleLogger('parseAWSExports');
9
10
  const authTypeMapping = {
10
11
  API_KEY: 'apiKey',
@@ -15,15 +16,22 @@ const authTypeMapping = {
15
16
  LAMBDA: 'lambda',
16
17
  };
17
18
  /**
18
- * This utility converts the `aws-exports.js` file generated by the Amplify CLI into a {@link ResourcesConfig} object
19
- * consumable by Amplify.
19
+ * Converts the object imported from `aws-exports.js` or `amplifyconfiguration.json` files generated by
20
+ * the Amplify CLI into an object that conforms to the {@link ResourcesConfig}.
20
21
  *
21
- * @param config A configuration object from `aws-exports.js`.
22
+ * @param config A configuration object imported from `aws-exports.js` or `amplifyconfiguration.json`.
22
23
  *
23
- * @returns A {@link ResourcesConfig} object.
24
+ * @returns An object that conforms to the {@link ResourcesConfig} .
24
25
  */
25
26
  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, modelIntrospection, } = config;
27
+ if (!Object.prototype.hasOwnProperty.call(config, 'aws_project_region')) {
28
+ throw new errors_1.AmplifyError({
29
+ name: 'InvalidParameterException',
30
+ message: 'Invalid config parameter.',
31
+ recoverySuggestion: 'Ensure passing the config object imported from `amplifyconfiguration.json`.',
32
+ });
33
+ }
34
+ const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, 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
35
  const amplifyConfig = {};
28
36
  // Analytics
29
37
  if (aws_mobile_analytics_app_id) {
@@ -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, 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 userAttributes = mergedUserAttributes.reduce((attributes, key) => ({\n ...attributes,\n // All user attributes generated by the CLI are required\n [key.toLowerCase()]: { required: true },\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,\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,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,aAA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OAAO;AAC1C,oBAAoB,eAAe,EAAE;AACrC,wBAAwB,GAAG,WAAW,CAAC,OAAO,CAAC,eAAe;AAC9D,wBAAwB,QAAQ,EAAE,EAAE,OAAO,EAAE;AAC7C,qBAAqB;AACrB,iBAAiB;AACjB,aAAa;AACb,cAAc,WAAW,CAAC;AAC1B,KAAK;AACL,IAAI,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC;AACF,OAAO,CAAC,eAAe,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 errors_1 = require(\"./errors\");\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 * Converts the object imported from `aws-exports.js` or `amplifyconfiguration.json` files generated by\n * the Amplify CLI into an object that conforms to the {@link ResourcesConfig}.\n *\n * @param config A configuration object imported from `aws-exports.js` or `amplifyconfiguration.json`.\n *\n * @returns An object that conforms to the {@link ResourcesConfig} .\n */\nconst parseAWSExports = (config = {}) => {\n if (!Object.prototype.hasOwnProperty.call(config, 'aws_project_region')) {\n throw new errors_1.AmplifyError({\n name: 'InvalidParameterException',\n message: 'Invalid config parameter.',\n recoverySuggestion: 'Ensure passing the config object imported from `amplifyconfiguration.json`.',\n });\n }\n const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, 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 userAttributes = mergedUserAttributes.reduce((attributes, key) => ({\n ...attributes,\n // All user attributes generated by the CLI are required\n [key.toLowerCase()]: { required: true },\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,\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,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACrC,MAAM,MAAM,GAAG,IAAI,QAAQ,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O,EAAE;AAC7C,qBAAqB;AACrB,iBAAiB;AACjB,aAAa;AACb,cAAc,WAAW,CAAC;AAC1B,KAAK;AACL,IAAI,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC;AACF,OAAO,CAAC,eAAe,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;;"}
@@ -41,27 +41,33 @@ function browserTimezone() {
41
41
  return tzMatch ? tzMatch[1] || '' : '';
42
42
  }
43
43
  function getBrowserType(userAgent) {
44
- const operaMatch = /.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(userAgent);
44
+ // The latest user agents for Opera: https://www.whatismybrowser.com/guides/the-latest-user-agent/opera
45
+ const operaMatch = /.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9.]+).*/i.exec(userAgent);
45
46
  if (operaMatch) {
46
47
  return { type: operaMatch[1], version: operaMatch[2] };
47
48
  }
48
- const ieMatch = /.+(Trident|Edge)\/([0-9\.]+).*/i.exec(userAgent);
49
+ // The latest user agents for Edge: https://www.whatismybrowser.com/guides/the-latest-user-agent/edge
50
+ const ieMatch = /.+(Trident|Edge|Edg|EdgA|EdgiOS)\/([0-9.]+).*/i.exec(userAgent);
49
51
  if (ieMatch) {
50
52
  return { type: ieMatch[1], version: ieMatch[2] };
51
53
  }
52
- const cfMatch = /.+(Chrome|Firefox|FxiOS)\/([0-9\.]+).*/i.exec(userAgent);
54
+ // The latest user agents for web browsers on Firefox and Chrome
55
+ // https://www.whatismybrowser.com/guides/the-latest-user-agent/firefox
56
+ // https://www.whatismybrowser.com/guides/the-latest-user-agent/chrome
57
+ const cfMatch = /.+(Chrome|CriOS|Firefox|FxiOS)\/([0-9.]+).*/i.exec(userAgent);
53
58
  if (cfMatch) {
54
59
  return { type: cfMatch[1], version: cfMatch[2] };
55
60
  }
56
- const sMatch = /.+(Safari)\/([0-9\.]+).*/i.exec(userAgent);
61
+ // The latest user agents for Safari: https://www.whatismybrowser.com/guides/the-latest-user-agent/safari
62
+ const sMatch = /.+(Safari)\/([0-9.]+).*/i.exec(userAgent);
57
63
  if (sMatch) {
58
64
  return { type: sMatch[1], version: sMatch[2] };
59
65
  }
60
- const awkMatch = /.+(AppleWebKit)\/([0-9\.]+).*/i.exec(userAgent);
66
+ const awkMatch = /.+(AppleWebKit)\/([0-9.]+).*/i.exec(userAgent);
61
67
  if (awkMatch) {
62
68
  return { type: awkMatch[1], version: awkMatch[2] };
63
69
  }
64
- const anyMatch = /.*([A-Z]+)\/([0-9\.]+).*/i.exec(userAgent);
70
+ const anyMatch = /.*([A-Z]+)\/([0-9.]+).*/i.exec(userAgent);
65
71
  if (anyMatch) {
66
72
  return { type: anyMatch[1], version: anyMatch[2] };
67
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getClientInfo.js","sources":["../../../../src/utils/getClientInfo/getClientInfo.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getClientInfo = 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('getClientInfo');\nfunction getClientInfo() {\n if (typeof window === 'undefined') {\n return {};\n }\n return browserClientInfo();\n}\nexports.getClientInfo = getClientInfo;\nfunction browserClientInfo() {\n if (typeof window === 'undefined') {\n logger.warn('No window object available to get browser client info');\n return {};\n }\n const nav = window.navigator;\n if (!nav) {\n logger.warn('No navigator object available to get browser client info');\n return {};\n }\n const { platform, product, vendor, userAgent, language } = nav;\n const type = getBrowserType(userAgent);\n const timezone = browserTimezone();\n return {\n platform,\n make: product || vendor,\n model: type.type,\n version: type.version,\n appVersion: [type.type, type.version].join('/'),\n language,\n timezone,\n };\n}\nfunction browserTimezone() {\n const tzMatch = /\\(([A-Za-z\\s].*)\\)/.exec(new Date().toString());\n return tzMatch ? tzMatch[1] || '' : '';\n}\nfunction getBrowserType(userAgent) {\n const operaMatch = /.+(Opera[\\s[A-Z]*|OPR[\\sA-Z]*)\\/([0-9\\.]+).*/i.exec(userAgent);\n if (operaMatch) {\n return { type: operaMatch[1], version: operaMatch[2] };\n }\n const ieMatch = /.+(Trident|Edge)\\/([0-9\\.]+).*/i.exec(userAgent);\n if (ieMatch) {\n return { type: ieMatch[1], version: ieMatch[2] };\n }\n const cfMatch = /.+(Chrome|Firefox|FxiOS)\\/([0-9\\.]+).*/i.exec(userAgent);\n if (cfMatch) {\n return { type: cfMatch[1], version: cfMatch[2] };\n }\n const sMatch = /.+(Safari)\\/([0-9\\.]+).*/i.exec(userAgent);\n if (sMatch) {\n return { type: sMatch[1], version: sMatch[2] };\n }\n const awkMatch = /.+(AppleWebKit)\\/([0-9\\.]+).*/i.exec(userAgent);\n if (awkMatch) {\n return { type: awkMatch[1], version: awkMatch[2] };\n }\n const anyMatch = /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O,CAAC,CAAC,CAAC,EAAE,CAAC;AACzD,KAAK;AACL,IAAI,MAAM,MAAM,GAAG,2BAA2B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC/D,IAAI,IAAI,MAAM,EAAE;AAChB,QAAQ,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AACvD,KAAK;AACL,IAAI,MAAM,QAAQ,GAAG,gCAAgC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACtE,IAAI,IAAI,QAAQ,EAAE;AAClB,QAAQ,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,KAAK;AACL,IAAI,MAAM,QAAQ,GAAG,2BAA2B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACjE,IAAI,IAAI,QAAQ,EAAE;AAClB,QAAQ,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,KAAK;AACL,IAAI,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACrC;;"}
1
+ {"version":3,"file":"getClientInfo.js","sources":["../../../../src/utils/getClientInfo/getClientInfo.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getClientInfo = 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('getClientInfo');\nfunction getClientInfo() {\n if (typeof window === 'undefined') {\n return {};\n }\n return browserClientInfo();\n}\nexports.getClientInfo = getClientInfo;\nfunction browserClientInfo() {\n if (typeof window === 'undefined') {\n logger.warn('No window object available to get browser client info');\n return {};\n }\n const nav = window.navigator;\n if (!nav) {\n logger.warn('No navigator object available to get browser client info');\n return {};\n }\n const { platform, product, vendor, userAgent, language } = nav;\n const type = getBrowserType(userAgent);\n const timezone = browserTimezone();\n return {\n platform,\n make: product || vendor,\n model: type.type,\n version: type.version,\n appVersion: [type.type, type.version].join('/'),\n language,\n timezone,\n };\n}\nfunction browserTimezone() {\n const tzMatch = /\\(([A-Za-z\\s].*)\\)/.exec(new Date().toString());\n return tzMatch ? tzMatch[1] || '' : '';\n}\nfunction getBrowserType(userAgent) {\n // The latest user agents for Opera: https://www.whatismybrowser.com/guides/the-latest-user-agent/opera\n const operaMatch = /.+(Opera[\\s[A-Z]*|OPR[\\sA-Z]*)\\/([0-9.]+).*/i.exec(userAgent);\n if (operaMatch) {\n return { type: operaMatch[1], version: operaMatch[2] };\n }\n // The latest user agents for Edge: https://www.whatismybrowser.com/guides/the-latest-user-agent/edge\n const ieMatch = /.+(Trident|Edge|Edg|EdgA|EdgiOS)\\/([0-9.]+).*/i.exec(userAgent);\n if (ieMatch) {\n return { type: ieMatch[1], version: ieMatch[2] };\n }\n // The latest user agents for web browsers on Firefox and Chrome\n // https://www.whatismybrowser.com/guides/the-latest-user-agent/firefox\n // https://www.whatismybrowser.com/guides/the-latest-user-agent/chrome\n const cfMatch = /.+(Chrome|CriOS|Firefox|FxiOS)\\/([0-9.]+).*/i.exec(userAgent);\n if (cfMatch) {\n return { type: cfMatch[1], version: cfMatch[2] };\n }\n // The latest user agents for Safari: https://www.whatismybrowser.com/guides/the-latest-user-agent/safari\n const sMatch = /.+(Safari)\\/([0-9.]+).*/i.exec(userAgent);\n if (sMatch) {\n return { type: sMatch[1], version: sMatch[2] };\n }\n const awkMatch = /.+(AppleWebKit)\\/([0-9.]+).*/i.exec(userAgent);\n if (awkMatch) {\n return { type: awkMatch[1], version: awkMatch[2] };\n }\n const anyMatch = /.*([A-Z]+)\\/([0-9.]+).*/i.exec(userAgent);\n if (anyMat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AC;AACzD,KAAK;AACL;AACA,IAAI,MAAM,MAAM,GAAG,0BAA0B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC9D,IAAI,IAAI,MAAM,EAAE;AAChB,QAAQ,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AACvD,KAAK;AACL,IAAI,MAAM,QAAQ,GAAG,+BAA+B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACrE,IAAI,IAAI,QAAQ,EAAE;AAClB,QAAQ,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,KAAK;AACL,IAAI,MAAM,QAAQ,GAAG,0BAA0B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAChE,IAAI,IAAI,QAAQ,EAAE;AAClB,QAAQ,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,KAAK;AACL,IAAI,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACrC;;"}
@@ -1 +1 @@
1
- export declare const version = "6.0.7-unstable.ca62f29.0+ca62f29";
1
+ export declare const version = "6.0.7-unstable.f21f8f1.0+f21f8f1";
@@ -1,5 +1,5 @@
1
1
  // generated by genversion
2
- const version = '6.0.7-unstable.ca62f29.0+ca62f29';
2
+ const version = '6.0.7-unstable.f21f8f1.0+f21f8f1';
3
3
 
4
4
  export { version };
5
5
  //# sourceMappingURL=version.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.0.7-unstable.ca62f29.0+ca62f29';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
1
+ {"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.0.7-unstable.f21f8f1.0+f21f8f1';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
@@ -1,10 +1,10 @@
1
1
  import { ResourcesConfig } from './singleton/types';
2
2
  /**
3
- * This utility converts the `aws-exports.js` file generated by the Amplify CLI into a {@link ResourcesConfig} object
4
- * consumable by Amplify.
3
+ * Converts the object imported from `aws-exports.js` or `amplifyconfiguration.json` files generated by
4
+ * the Amplify CLI into an object that conforms to the {@link ResourcesConfig}.
5
5
  *
6
- * @param config A configuration object from `aws-exports.js`.
6
+ * @param config A configuration object imported from `aws-exports.js` or `amplifyconfiguration.json`.
7
7
  *
8
- * @returns A {@link ResourcesConfig} object.
8
+ * @returns An object that conforms to the {@link ResourcesConfig} .
9
9
  */
10
10
  export declare const parseAWSExports: (config?: Record<string, any>) => ResourcesConfig;
@@ -1,4 +1,7 @@
1
1
  import { ConsoleLogger } from './Logger/ConsoleLogger.mjs';
2
+ import { AmplifyError } from './errors/AmplifyError.mjs';
3
+ import './types/errors.mjs';
4
+ import './errors/errorHelpers.mjs';
2
5
 
3
6
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
7
  // SPDX-License-Identifier: Apache-2.0
@@ -12,15 +15,22 @@ const authTypeMapping = {
12
15
  LAMBDA: 'lambda',
13
16
  };
14
17
  /**
15
- * This utility converts the `aws-exports.js` file generated by the Amplify CLI into a {@link ResourcesConfig} object
16
- * consumable by Amplify.
18
+ * Converts the object imported from `aws-exports.js` or `amplifyconfiguration.json` files generated by
19
+ * the Amplify CLI into an object that conforms to the {@link ResourcesConfig}.
17
20
  *
18
- * @param config A configuration object from `aws-exports.js`.
21
+ * @param config A configuration object imported from `aws-exports.js` or `amplifyconfiguration.json`.
19
22
  *
20
- * @returns A {@link ResourcesConfig} object.
23
+ * @returns An object that conforms to the {@link ResourcesConfig} .
21
24
  */
22
25
  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, modelIntrospection, } = config;
26
+ if (!Object.prototype.hasOwnProperty.call(config, 'aws_project_region')) {
27
+ throw new AmplifyError({
28
+ name: 'InvalidParameterException',
29
+ message: 'Invalid config parameter.',
30
+ recoverySuggestion: 'Ensure passing the config object imported from `amplifyconfiguration.json`.',
31
+ });
32
+ }
33
+ const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, 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
34
  const amplifyConfig = {};
25
35
  // Analytics
26
36
  if (aws_mobile_analytics_app_id) {
@@ -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, 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 userAttributes = mergedUserAttributes.reduce((attributes, key) => ({\n ...attributes,\n // All user attributes generated by the CLI are required\n [key.toLowerCase()]: { required: true },\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,\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,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;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';\nimport { AmplifyError } from './errors';\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 * Converts the object imported from `aws-exports.js` or `amplifyconfiguration.json` files generated by\n * the Amplify CLI into an object that conforms to the {@link ResourcesConfig}.\n *\n * @param config A configuration object imported from `aws-exports.js` or `amplifyconfiguration.json`.\n *\n * @returns An object that conforms to the {@link ResourcesConfig} .\n */\nexport const parseAWSExports = (config = {}) => {\n if (!Object.prototype.hasOwnProperty.call(config, 'aws_project_region')) {\n throw new AmplifyError({\n name: 'InvalidParameterException',\n message: 'Invalid config parameter.',\n recoverySuggestion: 'Ensure passing the config object imported from `amplifyconfiguration.json`.',\n });\n }\n const { aws_appsync_apiKey, aws_appsync_authenticationType, aws_appsync_graphqlEndpoint, aws_appsync_region, 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 userAttributes = mergedUserAttributes.reduce((attributes, key) => ({\n ...attributes,\n // All user attributes generated by the CLI are required\n [key.toLowerCase()]: { required: true },\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,\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;AAGA,MAAM,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,EAAE;AAC7C,qBAAqB;AACrB,iBAAiB;AACjB,aAAa;AACb,cAAc,WAAW,CAAC;AAC1B,KAAK;AACL,IAAI,OAAO,aAAa,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;;;;"}
@@ -37,27 +37,33 @@ function browserTimezone() {
37
37
  return tzMatch ? tzMatch[1] || '' : '';
38
38
  }
39
39
  function getBrowserType(userAgent) {
40
- const operaMatch = /.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(userAgent);
40
+ // The latest user agents for Opera: https://www.whatismybrowser.com/guides/the-latest-user-agent/opera
41
+ const operaMatch = /.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9.]+).*/i.exec(userAgent);
41
42
  if (operaMatch) {
42
43
  return { type: operaMatch[1], version: operaMatch[2] };
43
44
  }
44
- const ieMatch = /.+(Trident|Edge)\/([0-9\.]+).*/i.exec(userAgent);
45
+ // The latest user agents for Edge: https://www.whatismybrowser.com/guides/the-latest-user-agent/edge
46
+ const ieMatch = /.+(Trident|Edge|Edg|EdgA|EdgiOS)\/([0-9.]+).*/i.exec(userAgent);
45
47
  if (ieMatch) {
46
48
  return { type: ieMatch[1], version: ieMatch[2] };
47
49
  }
48
- const cfMatch = /.+(Chrome|Firefox|FxiOS)\/([0-9\.]+).*/i.exec(userAgent);
50
+ // The latest user agents for web browsers on Firefox and Chrome
51
+ // https://www.whatismybrowser.com/guides/the-latest-user-agent/firefox
52
+ // https://www.whatismybrowser.com/guides/the-latest-user-agent/chrome
53
+ const cfMatch = /.+(Chrome|CriOS|Firefox|FxiOS)\/([0-9.]+).*/i.exec(userAgent);
49
54
  if (cfMatch) {
50
55
  return { type: cfMatch[1], version: cfMatch[2] };
51
56
  }
52
- const sMatch = /.+(Safari)\/([0-9\.]+).*/i.exec(userAgent);
57
+ // The latest user agents for Safari: https://www.whatismybrowser.com/guides/the-latest-user-agent/safari
58
+ const sMatch = /.+(Safari)\/([0-9.]+).*/i.exec(userAgent);
53
59
  if (sMatch) {
54
60
  return { type: sMatch[1], version: sMatch[2] };
55
61
  }
56
- const awkMatch = /.+(AppleWebKit)\/([0-9\.]+).*/i.exec(userAgent);
62
+ const awkMatch = /.+(AppleWebKit)\/([0-9.]+).*/i.exec(userAgent);
57
63
  if (awkMatch) {
58
64
  return { type: awkMatch[1], version: awkMatch[2] };
59
65
  }
60
- const anyMatch = /.*([A-Z]+)\/([0-9\.]+).*/i.exec(userAgent);
66
+ const anyMatch = /.*([A-Z]+)\/([0-9.]+).*/i.exec(userAgent);
61
67
  if (anyMatch) {
62
68
  return { type: anyMatch[1], version: anyMatch[2] };
63
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getClientInfo.mjs","sources":["../../../../src/utils/getClientInfo/getClientInfo.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('getClientInfo');\nexport function getClientInfo() {\n if (typeof window === 'undefined') {\n return {};\n }\n return browserClientInfo();\n}\nfunction browserClientInfo() {\n if (typeof window === 'undefined') {\n logger.warn('No window object available to get browser client info');\n return {};\n }\n const nav = window.navigator;\n if (!nav) {\n logger.warn('No navigator object available to get browser client info');\n return {};\n }\n const { platform, product, vendor, userAgent, language } = nav;\n const type = getBrowserType(userAgent);\n const timezone = browserTimezone();\n return {\n platform,\n make: product || vendor,\n model: type.type,\n version: type.version,\n appVersion: [type.type, type.version].join('/'),\n language,\n timezone,\n };\n}\nfunction browserTimezone() {\n const tzMatch = /\\(([A-Za-z\\s].*)\\)/.exec(new Date().toString());\n return tzMatch ? tzMatch[1] || '' : '';\n}\nfunction getBrowserType(userAgent) {\n const operaMatch = /.+(Opera[\\s[A-Z]*|OPR[\\sA-Z]*)\\/([0-9\\.]+).*/i.exec(userAgent);\n if (operaMatch) {\n return { type: operaMatch[1], version: operaMatch[2] };\n }\n const ieMatch = /.+(Trident|Edge)\\/([0-9\\.]+).*/i.exec(userAgent);\n if (ieMatch) {\n return { type: ieMatch[1], version: ieMatch[2] };\n }\n const cfMatch = /.+(Chrome|Firefox|FxiOS)\\/([0-9\\.]+).*/i.exec(userAgent);\n if (cfMatch) {\n return { type: cfMatch[1], version: cfMatch[2] };\n }\n const sMatch = /.+(Safari)\\/([0-9\\.]+).*/i.exec(userAgent);\n if (sMatch) {\n return { type: sMatch[1], version: sMatch[2] };\n }\n const awkMatch = /.+(AppleWebKit)\\/([0-9\\.]+).*/i.exec(userAgent);\n if (awkMatch) {\n return { type: awkMatch[1], version: awkMatch[2] };\n }\n const anyMatch = /.*([A-Z]+)\\/([0-9\\.]+).*/i.exec(userAgent);\n if (anyMatch) {\n return { type: anyMatch[1], version: anyMatch[2] };\n }\n return { type: '', version: '' };\n}\n"],"names":[],"mappings":";;AAAA;AACA;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,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,KAAK;AACL,IAAI,MAAM,QAAQ,GAAG,2BAA2B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACjE,IAAI,IAAI,QAAQ,EAAE;AAClB,QAAQ,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,KAAK;AACL,IAAI,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACrC;;;;"}
1
+ {"version":3,"file":"getClientInfo.mjs","sources":["../../../../src/utils/getClientInfo/getClientInfo.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('getClientInfo');\nexport function getClientInfo() {\n if (typeof window === 'undefined') {\n return {};\n }\n return browserClientInfo();\n}\nfunction browserClientInfo() {\n if (typeof window === 'undefined') {\n logger.warn('No window object available to get browser client info');\n return {};\n }\n const nav = window.navigator;\n if (!nav) {\n logger.warn('No navigator object available to get browser client info');\n return {};\n }\n const { platform, product, vendor, userAgent, language } = nav;\n const type = getBrowserType(userAgent);\n const timezone = browserTimezone();\n return {\n platform,\n make: product || vendor,\n model: type.type,\n version: type.version,\n appVersion: [type.type, type.version].join('/'),\n language,\n timezone,\n };\n}\nfunction browserTimezone() {\n const tzMatch = /\\(([A-Za-z\\s].*)\\)/.exec(new Date().toString());\n return tzMatch ? tzMatch[1] || '' : '';\n}\nfunction getBrowserType(userAgent) {\n // The latest user agents for Opera: https://www.whatismybrowser.com/guides/the-latest-user-agent/opera\n const operaMatch = /.+(Opera[\\s[A-Z]*|OPR[\\sA-Z]*)\\/([0-9.]+).*/i.exec(userAgent);\n if (operaMatch) {\n return { type: operaMatch[1], version: operaMatch[2] };\n }\n // The latest user agents for Edge: https://www.whatismybrowser.com/guides/the-latest-user-agent/edge\n const ieMatch = /.+(Trident|Edge|Edg|EdgA|EdgiOS)\\/([0-9.]+).*/i.exec(userAgent);\n if (ieMatch) {\n return { type: ieMatch[1], version: ieMatch[2] };\n }\n // The latest user agents for web browsers on Firefox and Chrome\n // https://www.whatismybrowser.com/guides/the-latest-user-agent/firefox\n // https://www.whatismybrowser.com/guides/the-latest-user-agent/chrome\n const cfMatch = /.+(Chrome|CriOS|Firefox|FxiOS)\\/([0-9.]+).*/i.exec(userAgent);\n if (cfMatch) {\n return { type: cfMatch[1], version: cfMatch[2] };\n }\n // The latest user agents for Safari: https://www.whatismybrowser.com/guides/the-latest-user-agent/safari\n const sMatch = /.+(Safari)\\/([0-9.]+).*/i.exec(userAgent);\n if (sMatch) {\n return { type: sMatch[1], version: sMatch[2] };\n }\n const awkMatch = /.+(AppleWebKit)\\/([0-9.]+).*/i.exec(userAgent);\n if (awkMatch) {\n return { type: awkMatch[1], version: awkMatch[2] };\n }\n const anyMatch = /.*([A-Z]+)\\/([0-9.]+).*/i.exec(userAgent);\n if (anyMatch) {\n return { type: anyMatch[1], version: anyMatch[2] };\n }\n return { type: '', version: '' };\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,eAAe,CAAC,CAAC;AAC3C,SAAS,aAAa,GAAG;AAChC,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACvC,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,OAAO,iBAAiB,EAAE,CAAC;AAC/B,CAAC;AACD,SAAS,iBAAiB,GAAG;AAC7B,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACvC,QAAQ,MAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;AAC7E,QAAQ,OAAO,EAAE,CAAC;AA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,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACrC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/core",
3
- "version": "6.0.7-unstable.ca62f29.0+ca62f29",
3
+ "version": "6.0.7-unstable.f21f8f1.0+f21f8f1",
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.7-unstable.ca62f29.0+ca62f29",
63
+ "@aws-amplify/react-native": "1.0.7-unstable.f21f8f1.0+f21f8f1",
64
64
  "@rollup/plugin-typescript": "11.1.5",
65
65
  "@types/js-cookie": "3.0.2",
66
66
  "genversion": "^2.2.0",
@@ -194,5 +194,5 @@
194
194
  ]
195
195
  }
196
196
  },
197
- "gitHead": "ca62f295ebc19ff874c63b2ba0d6fa2277f2e862"
197
+ "gitHead": "f21f8f16a36d17a99403a2c9b0bd9a620a3bb83b"
198
198
  }
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '6.0.7-unstable.ca62f29.0+ca62f29';
2
+ export const version = '6.0.7-unstable.f21f8f1.0+f21f8f1';
@@ -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 { ConsoleLogger } from './Logger';
4
+ import { AmplifyError } from './errors';
4
5
  import {
5
6
  AuthConfigUserAttributes,
6
7
  LegacyUserAttributeKey,
@@ -21,23 +22,31 @@ const authTypeMapping: Record<any, any> = {
21
22
  };
22
23
 
23
24
  /**
24
- * This utility converts the `aws-exports.js` file generated by the Amplify CLI into a {@link ResourcesConfig} object
25
- * consumable by Amplify.
25
+ * Converts the object imported from `aws-exports.js` or `amplifyconfiguration.json` files generated by
26
+ * the Amplify CLI into an object that conforms to the {@link ResourcesConfig}.
26
27
  *
27
- * @param config A configuration object from `aws-exports.js`.
28
+ * @param config A configuration object imported from `aws-exports.js` or `amplifyconfiguration.json`.
28
29
  *
29
- * @returns A {@link ResourcesConfig} object.
30
+ * @returns An object that conforms to the {@link ResourcesConfig} .
30
31
  */
31
32
 
32
33
  export const parseAWSExports = (
33
34
  config: Record<string, any> = {}
34
35
  ): ResourcesConfig => {
36
+ if (!Object.prototype.hasOwnProperty.call(config, 'aws_project_region')) {
37
+ throw new AmplifyError({
38
+ name: 'InvalidParameterException',
39
+ message: 'Invalid config parameter.',
40
+ recoverySuggestion:
41
+ 'Ensure passing the config object imported from `amplifyconfiguration.json`.',
42
+ });
43
+ }
44
+
35
45
  const {
36
46
  aws_appsync_apiKey,
37
47
  aws_appsync_authenticationType,
38
48
  aws_appsync_graphqlEndpoint,
39
49
  aws_appsync_region,
40
- aws_bots,
41
50
  aws_bots_config,
42
51
  aws_cognito_identity_pool_id,
43
52
  aws_cognito_sign_up_verification_method,
@@ -15,12 +15,14 @@ export function getClientInfo() {
15
15
  function browserClientInfo() {
16
16
  if (typeof window === 'undefined') {
17
17
  logger.warn('No window object available to get browser client info');
18
+
18
19
  return {};
19
20
  }
20
21
 
21
22
  const nav = window.navigator;
22
23
  if (!nav) {
23
24
  logger.warn('No navigator object available to get browser client info');
25
+
24
26
  return {};
25
27
  }
26
28
 
@@ -41,38 +43,49 @@ function browserClientInfo() {
41
43
 
42
44
  function browserTimezone() {
43
45
  const tzMatch = /\(([A-Za-z\s].*)\)/.exec(new Date().toString());
46
+
44
47
  return tzMatch ? tzMatch[1] || '' : '';
45
48
  }
46
49
 
47
50
  function getBrowserType(userAgent: string) {
48
- const operaMatch = /.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(
51
+ // The latest user agents for Opera: https://www.whatismybrowser.com/guides/the-latest-user-agent/opera
52
+ const operaMatch = /.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9.]+).*/i.exec(
49
53
  userAgent
50
54
  );
51
55
  if (operaMatch) {
52
56
  return { type: operaMatch[1], version: operaMatch[2] };
53
57
  }
54
58
 
55
- const ieMatch = /.+(Trident|Edge)\/([0-9\.]+).*/i.exec(userAgent);
59
+ // The latest user agents for Edge: https://www.whatismybrowser.com/guides/the-latest-user-agent/edge
60
+ const ieMatch = /.+(Trident|Edge|Edg|EdgA|EdgiOS)\/([0-9.]+).*/i.exec(
61
+ userAgent
62
+ );
56
63
  if (ieMatch) {
57
64
  return { type: ieMatch[1], version: ieMatch[2] };
58
65
  }
59
66
 
60
- const cfMatch = /.+(Chrome|Firefox|FxiOS)\/([0-9\.]+).*/i.exec(userAgent);
67
+ // The latest user agents for web browsers on Firefox and Chrome
68
+ // https://www.whatismybrowser.com/guides/the-latest-user-agent/firefox
69
+ // https://www.whatismybrowser.com/guides/the-latest-user-agent/chrome
70
+ const cfMatch = /.+(Chrome|CriOS|Firefox|FxiOS)\/([0-9.]+).*/i.exec(
71
+ userAgent
72
+ );
61
73
  if (cfMatch) {
62
74
  return { type: cfMatch[1], version: cfMatch[2] };
63
75
  }
64
76
 
65
- const sMatch = /.+(Safari)\/([0-9\.]+).*/i.exec(userAgent);
77
+ // The latest user agents for Safari: https://www.whatismybrowser.com/guides/the-latest-user-agent/safari
78
+ const sMatch = /.+(Safari)\/([0-9.]+).*/i.exec(userAgent);
66
79
  if (sMatch) {
67
80
  return { type: sMatch[1], version: sMatch[2] };
68
81
  }
69
82
 
70
- const awkMatch = /.+(AppleWebKit)\/([0-9\.]+).*/i.exec(userAgent);
83
+ const awkMatch = /.+(AppleWebKit)\/([0-9.]+).*/i.exec(userAgent);
71
84
  if (awkMatch) {
72
85
  return { type: awkMatch[1], version: awkMatch[2] };
73
86
  }
74
87
 
75
- const anyMatch = /.*([A-Z]+)\/([0-9\.]+).*/i.exec(userAgent);
88
+ const anyMatch = /.*([A-Z]+)\/([0-9.]+).*/i.exec(userAgent);
76
89
  if (anyMatch) {
77
90
  return { type: anyMatch[1], version: anyMatch[2] };
78
91
  }