@aws-amplify/core 6.7.4-unstable.ec2ff53.0 → 6.8.1-unstable.0ecded1.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/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/parseAmplifyOutputs.js +9 -1
- package/dist/cjs/parseAmplifyOutputs.js.map +1 -1
- package/dist/cjs/storage/SyncKeyValueStorage.js +55 -0
- package/dist/cjs/storage/SyncKeyValueStorage.js.map +1 -0
- package/dist/cjs/storage/SyncSessionStorage.js +18 -0
- package/dist/cjs/storage/SyncSessionStorage.js.map +1 -0
- package/dist/cjs/storage/index.js +3 -1
- package/dist/cjs/storage/index.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/index.d.ts +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/parseAmplifyOutputs.mjs +9 -1
- package/dist/esm/parseAmplifyOutputs.mjs.map +1 -1
- package/dist/esm/singleton/AmplifyOutputs/types.d.ts +1 -1
- package/dist/esm/storage/SyncKeyValueStorage.d.ts +34 -0
- package/dist/esm/storage/SyncKeyValueStorage.mjs +54 -0
- package/dist/esm/storage/SyncKeyValueStorage.mjs.map +1 -0
- package/dist/esm/storage/SyncSessionStorage.d.ts +7 -0
- package/dist/esm/storage/SyncSessionStorage.mjs +16 -0
- package/dist/esm/storage/SyncSessionStorage.mjs.map +1 -0
- package/dist/esm/storage/index.d.ts +2 -0
- package/dist/esm/storage/index.mjs +3 -1
- package/dist/esm/storage/index.mjs.map +1 -1
- package/dist/esm/types/storage.d.ts +6 -0
- package/package.json +3 -3
- package/src/Platform/version.ts +1 -1
- package/src/index.ts +1 -0
- package/src/parseAmplifyOutputs.ts +13 -1
- package/src/singleton/AmplifyOutputs/types.ts +1 -1
- package/src/storage/SyncKeyValueStorage.ts +59 -0
- package/src/storage/SyncSessionStorage.ts +14 -0
- package/src/storage/index.ts +2 -0
- package/src/types/storage.ts +7 -0
|
@@ -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.
|
|
6
|
+
exports.version = '6.11.1-unstable.0ecded1.0+0ecded1';
|
|
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.
|
|
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.11.1-unstable.0ecded1.0+0ecded1';\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,mCAAmC;;"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ServiceWorker = exports.ConsoleLogger = exports.I18n = exports.Cache = exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.decodeJWT = exports.Hub = void 0;
|
|
6
|
+
exports.ServiceWorker = exports.ConsoleLogger = exports.I18n = exports.Cache = exports.sharedInMemoryStorage = exports.syncSessionStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.decodeJWT = exports.Hub = void 0;
|
|
7
7
|
/*
|
|
8
8
|
This file maps top-level exports from `@aws-amplify/core`. These are intended to be potentially customer-facing exports.
|
|
9
9
|
*/
|
|
@@ -26,6 +26,7 @@ var storage_1 = require("./storage");
|
|
|
26
26
|
Object.defineProperty(exports, "CookieStorage", { enumerable: true, get: function () { return storage_1.CookieStorage; } });
|
|
27
27
|
Object.defineProperty(exports, "defaultStorage", { enumerable: true, get: function () { return storage_1.defaultStorage; } });
|
|
28
28
|
Object.defineProperty(exports, "sessionStorage", { enumerable: true, get: function () { return storage_1.sessionStorage; } });
|
|
29
|
+
Object.defineProperty(exports, "syncSessionStorage", { enumerable: true, get: function () { return storage_1.syncSessionStorage; } });
|
|
29
30
|
Object.defineProperty(exports, "sharedInMemoryStorage", { enumerable: true, get: function () { return storage_1.sharedInMemoryStorage; } });
|
|
30
31
|
// Cache exports
|
|
31
32
|
var Cache_1 = require("./Cache");
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.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 });\nexports.ServiceWorker = exports.ConsoleLogger = exports.I18n = exports.Cache = exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.decodeJWT = exports.Hub = void 0;\n/*\nThis file maps top-level exports from `@aws-amplify/core`. These are intended to be potentially customer-facing exports.\n*/\n// Hub exports\nvar Hub_1 = require(\"./Hub\");\nObject.defineProperty(exports, \"Hub\", { enumerable: true, get: function () { return Hub_1.Hub; } });\nvar utils_1 = require(\"./singleton/Auth/utils\");\nObject.defineProperty(exports, \"decodeJWT\", { enumerable: true, get: function () { return utils_1.decodeJWT; } });\nvar singleton_1 = require(\"./singleton\");\nObject.defineProperty(exports, \"Amplify\", { enumerable: true, get: function () { return singleton_1.Amplify; } });\nObject.defineProperty(exports, \"fetchAuthSession\", { enumerable: true, get: function () { return singleton_1.fetchAuthSession; } });\nObject.defineProperty(exports, \"AmplifyClassV6\", { enumerable: true, get: function () { return singleton_1.AmplifyClass; } });\nObject.defineProperty(exports, \"clearCredentials\", { enumerable: true, get: function () { return singleton_1.clearCredentials; } });\n// AWSClients exports\nvar cognitoIdentity_1 = require(\"./awsClients/cognitoIdentity\");\nObject.defineProperty(exports, \"getCredentialsForIdentity\", { enumerable: true, get: function () { return cognitoIdentity_1.getCredentialsForIdentity; } });\nObject.defineProperty(exports, \"getId\", { enumerable: true, get: function () { return cognitoIdentity_1.getId; } });\n// Storage helpers\nvar storage_1 = require(\"./storage\");\nObject.defineProperty(exports, \"CookieStorage\", { enumerable: true, get: function () { return storage_1.CookieStorage; } });\nObject.defineProperty(exports, \"defaultStorage\", { enumerable: true, get: function () { return storage_1.defaultStorage; } });\nObject.defineProperty(exports, \"sessionStorage\", { enumerable: true, get: function () { return storage_1.sessionStorage; } });\nObject.defineProperty(exports, \"sharedInMemoryStorage\", { enumerable: true, get: function () { return storage_1.sharedInMemoryStorage; } });\n// Cache exports\nvar Cache_1 = require(\"./Cache\");\nObject.defineProperty(exports, \"Cache\", { enumerable: true, get: function () { return Cache_1.Cache; } });\n// Internationalization utilities\nvar I18n_1 = require(\"./I18n\");\nObject.defineProperty(exports, \"I18n\", { enumerable: true, get: function () { return I18n_1.I18n; } });\n// Logging utilities\nvar Logger_1 = require(\"./Logger\");\nObject.defineProperty(exports, \"ConsoleLogger\", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });\n// Service worker\nvar ServiceWorker_1 = require(\"./ServiceWorker\");\nObject.defineProperty(exports, \"ServiceWorker\", { enumerable: true, get: function () { return ServiceWorker_1.ServiceWorker; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,yBAAyB,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.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 });\nexports.ServiceWorker = exports.ConsoleLogger = exports.I18n = exports.Cache = exports.sharedInMemoryStorage = exports.syncSessionStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.decodeJWT = exports.Hub = void 0;\n/*\nThis file maps top-level exports from `@aws-amplify/core`. These are intended to be potentially customer-facing exports.\n*/\n// Hub exports\nvar Hub_1 = require(\"./Hub\");\nObject.defineProperty(exports, \"Hub\", { enumerable: true, get: function () { return Hub_1.Hub; } });\nvar utils_1 = require(\"./singleton/Auth/utils\");\nObject.defineProperty(exports, \"decodeJWT\", { enumerable: true, get: function () { return utils_1.decodeJWT; } });\nvar singleton_1 = require(\"./singleton\");\nObject.defineProperty(exports, \"Amplify\", { enumerable: true, get: function () { return singleton_1.Amplify; } });\nObject.defineProperty(exports, \"fetchAuthSession\", { enumerable: true, get: function () { return singleton_1.fetchAuthSession; } });\nObject.defineProperty(exports, \"AmplifyClassV6\", { enumerable: true, get: function () { return singleton_1.AmplifyClass; } });\nObject.defineProperty(exports, \"clearCredentials\", { enumerable: true, get: function () { return singleton_1.clearCredentials; } });\n// AWSClients exports\nvar cognitoIdentity_1 = require(\"./awsClients/cognitoIdentity\");\nObject.defineProperty(exports, \"getCredentialsForIdentity\", { enumerable: true, get: function () { return cognitoIdentity_1.getCredentialsForIdentity; } });\nObject.defineProperty(exports, \"getId\", { enumerable: true, get: function () { return cognitoIdentity_1.getId; } });\n// Storage helpers\nvar storage_1 = require(\"./storage\");\nObject.defineProperty(exports, \"CookieStorage\", { enumerable: true, get: function () { return storage_1.CookieStorage; } });\nObject.defineProperty(exports, \"defaultStorage\", { enumerable: true, get: function () { return storage_1.defaultStorage; } });\nObject.defineProperty(exports, \"sessionStorage\", { enumerable: true, get: function () { return storage_1.sessionStorage; } });\nObject.defineProperty(exports, \"syncSessionStorage\", { enumerable: true, get: function () { return storage_1.syncSessionStorage; } });\nObject.defineProperty(exports, \"sharedInMemoryStorage\", { enumerable: true, get: function () { return storage_1.sharedInMemoryStorage; } });\n// Cache exports\nvar Cache_1 = require(\"./Cache\");\nObject.defineProperty(exports, \"Cache\", { enumerable: true, get: function () { return Cache_1.Cache; } });\n// Internationalization utilities\nvar I18n_1 = require(\"./I18n\");\nObject.defineProperty(exports, \"I18n\", { enumerable: true, get: function () { return I18n_1.I18n; } });\n// Logging utilities\nvar Logger_1 = require(\"./Logger\");\nObject.defineProperty(exports, \"ConsoleLogger\", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });\n// Service worker\nvar ServiceWorker_1 = require(\"./ServiceWorker\");\nObject.defineProperty(exports, \"ServiceWorker\", { enumerable: true, get: function () { return ServiceWorker_1.ServiceWorker; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,yBAAyB,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;AACpZ;AACA;AACA;AACA;AACA,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;AACpG,IAAI,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAChD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;AAClH,IAAI,WAAW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G,OAAO,CAAC,UAAU,CAAC,CAAC;AACnC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC;AAC3H;AACA,IAAI,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACjD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC;;"}
|
|
@@ -243,10 +243,18 @@ function createBucketInfoMap(buckets) {
|
|
|
243
243
|
if (name in mappedBuckets) {
|
|
244
244
|
throw new Error(`Duplicate friendly name found: ${name}. Name must be unique.`);
|
|
245
245
|
}
|
|
246
|
+
const sanitizedPaths = paths
|
|
247
|
+
? Object.entries(paths).reduce((acc, [key, value]) => {
|
|
248
|
+
if (value !== undefined) {
|
|
249
|
+
acc[key] = value;
|
|
250
|
+
}
|
|
251
|
+
return acc;
|
|
252
|
+
}, {})
|
|
253
|
+
: undefined;
|
|
246
254
|
mappedBuckets[name] = {
|
|
247
255
|
bucketName,
|
|
248
256
|
region,
|
|
249
|
-
paths,
|
|
257
|
+
paths: sanitizedPaths,
|
|
250
258
|
};
|
|
251
259
|
});
|
|
252
260
|
return mappedBuckets;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseAmplifyOutputs.js","sources":["../../src/parseAmplifyOutputs.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 });\nexports.parseAmplifyOutputs = exports.parseAnalytics = exports.isAmplifyOutputs = void 0;\nfunction isAmplifyOutputs(config) {\n // version format initially will be '1' but is expected to be something like x.y where x is major and y minor version\n const { version } = config;\n if (!version) {\n return false;\n }\n return version.startsWith('1');\n}\nexports.isAmplifyOutputs = isAmplifyOutputs;\nfunction parseStorage(amplifyOutputsStorageProperties) {\n if (!amplifyOutputsStorageProperties) {\n return undefined;\n }\n const { bucket_name, aws_region, buckets } = amplifyOutputsStorageProperties;\n return {\n S3: {\n bucket: bucket_name,\n region: aws_region,\n buckets: buckets && createBucketInfoMap(buckets),\n },\n };\n}\nfunction parseAuth(amplifyOutputsAuthProperties) {\n if (!amplifyOutputsAuthProperties) {\n return undefined;\n }\n const { user_pool_id, user_pool_client_id, identity_pool_id, password_policy, mfa_configuration, mfa_methods, unauthenticated_identities_enabled, oauth, username_attributes, standard_required_attributes, groups, } = amplifyOutputsAuthProperties;\n const authConfig = {\n Cognito: {\n userPoolId: user_pool_id,\n userPoolClientId: user_pool_client_id,\n groups,\n },\n };\n if (identity_pool_id) {\n authConfig.Cognito = {\n ...authConfig.Cognito,\n identityPoolId: identity_pool_id,\n };\n }\n if (password_policy) {\n authConfig.Cognito.passwordFormat = {\n requireLowercase: password_policy.require_lowercase,\n requireNumbers: password_policy.require_numbers,\n requireUppercase: password_policy.require_uppercase,\n requireSpecialCharacters: password_policy.require_symbols,\n minLength: password_policy.min_length ?? 6,\n };\n }\n if (mfa_configuration) {\n authConfig.Cognito.mfa = {\n status: getMfaStatus(mfa_configuration),\n smsEnabled: mfa_methods?.includes('SMS'),\n totpEnabled: mfa_methods?.includes('TOTP'),\n };\n }\n if (unauthenticated_identities_enabled) {\n authConfig.Cognito.allowGuestAccess = unauthenticated_identities_enabled;\n }\n if (oauth) {\n authConfig.Cognito.loginWith = {\n oauth: {\n domain: oauth.domain,\n redirectSignIn: oauth.redirect_sign_in_uri,\n redirectSignOut: oauth.redirect_sign_out_uri,\n responseType: oauth.response_type === 'token' ? 'token' : 'code',\n scopes: oauth.scopes,\n providers: getOAuthProviders(oauth.identity_providers),\n },\n };\n }\n if (username_attributes) {\n authConfig.Cognito.loginWith = {\n ...authConfig.Cognito.loginWith,\n email: username_attributes.includes('email'),\n phone: username_attributes.includes('phone_number'),\n // Signing in with a username is not currently supported in Gen2, this should always evaluate to false\n username: username_attributes.includes('username'),\n };\n }\n if (standard_required_attributes) {\n authConfig.Cognito.userAttributes = standard_required_attributes.reduce((acc, curr) => ({ ...acc, [curr]: { required: true } }), {});\n }\n return authConfig;\n}\nfunction parseAnalytics(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties?.amazon_pinpoint) {\n return undefined;\n }\n const { amazon_pinpoint } = amplifyOutputsAnalyticsProperties;\n return {\n Pinpoint: {\n appId: amazon_pinpoint.app_id,\n region: amazon_pinpoint.aws_region,\n },\n };\n}\nexports.parseAnalytics = parseAnalytics;\nfunction parseGeo(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties) {\n return undefined;\n }\n const { aws_region, geofence_collections, maps, search_indices } = amplifyOutputsAnalyticsProperties;\n return {\n LocationService: {\n region: aws_region,\n searchIndices: search_indices,\n geofenceCollections: geofence_collections,\n maps,\n },\n };\n}\nfunction parseData(amplifyOutputsDataProperties) {\n if (!amplifyOutputsDataProperties) {\n return undefined;\n }\n const { aws_region, default_authorization_type, url, api_key, model_introspection, } = amplifyOutputsDataProperties;\n const GraphQL = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n modelIntrospection: model_introspection,\n };\n return {\n GraphQL,\n };\n}\nfunction parseCustom(amplifyOutputsCustomProperties) {\n if (!amplifyOutputsCustomProperties?.events) {\n return undefined;\n }\n const { url, aws_region, api_key, default_authorization_type } = amplifyOutputsCustomProperties.events;\n const Events = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n };\n return {\n Events,\n };\n}\nfunction parseNotifications(amplifyOutputsNotificationsProperties) {\n if (!amplifyOutputsNotificationsProperties) {\n return undefined;\n }\n const { aws_region, channels, amazon_pinpoint_app_id } = amplifyOutputsNotificationsProperties;\n const hasInAppMessaging = channels.includes('IN_APP_MESSAGING');\n const hasPushNotification = channels.includes('APNS') || channels.includes('FCM');\n if (!(hasInAppMessaging || hasPushNotification)) {\n return undefined;\n }\n // At this point, we know the Amplify outputs contains at least one supported channel\n const notificationsConfig = {};\n if (hasInAppMessaging) {\n notificationsConfig.InAppMessaging = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n if (hasPushNotification) {\n notificationsConfig.PushNotification = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n return notificationsConfig;\n}\nfunction parseAmplifyOutputs(amplifyOutputs) {\n const resourcesConfig = {};\n if (amplifyOutputs.storage) {\n resourcesConfig.Storage = parseStorage(amplifyOutputs.storage);\n }\n if (amplifyOutputs.auth) {\n resourcesConfig.Auth = parseAuth(amplifyOutputs.auth);\n }\n if (amplifyOutputs.analytics) {\n resourcesConfig.Analytics = parseAnalytics(amplifyOutputs.analytics);\n }\n if (amplifyOutputs.geo) {\n resourcesConfig.Geo = parseGeo(amplifyOutputs.geo);\n }\n if (amplifyOutputs.data) {\n resourcesConfig.API = parseData(amplifyOutputs.data);\n }\n if (amplifyOutputs.custom) {\n const customConfig = parseCustom(amplifyOutputs.custom);\n if (customConfig && 'Events' in customConfig) {\n resourcesConfig.API = { ...resourcesConfig.API, ...customConfig };\n }\n }\n if (amplifyOutputs.notifications) {\n resourcesConfig.Notifications = parseNotifications(amplifyOutputs.notifications);\n }\n return resourcesConfig;\n}\nexports.parseAmplifyOutputs = parseAmplifyOutputs;\nconst authModeNames = {\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AWS_LAMBDA: 'lambda',\n OPENID_CONNECT: 'oidc',\n};\nfunction getGraphQLAuthMode(authType) {\n return authModeNames[authType];\n}\nconst providerNames = {\n GOOGLE: 'Google',\n LOGIN_WITH_AMAZON: 'Amazon',\n FACEBOOK: 'Facebook',\n SIGN_IN_WITH_APPLE: 'Apple',\n};\nfunction getOAuthProviders(providers = []) {\n return providers.reduce((oAuthProviders, provider) => {\n if (providerNames[provider] !== undefined) {\n oAuthProviders.push(providerNames[provider]);\n }\n return oAuthProviders;\n }, []);\n}\nfunction getMfaStatus(mfaConfiguration) {\n if (mfaConfiguration === 'OPTIONAL')\n return 'optional';\n if (mfaConfiguration === 'REQUIRED')\n return 'on';\n return 'off';\n}\nfunction createBucketInfoMap(buckets) {\n const mappedBuckets = {};\n buckets.forEach(({ name, bucket_name: bucketName, aws_region: region, paths }) => {\n if (name in mappedBuckets) {\n throw new Error(`Duplicate friendly name found: ${name}. Name must be unique.`);\n }\n mappedBuckets[name] = {\n bucketName,\n region,\n paths,\n };\n });\n return mappedBuckets;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,gBAAgB,GAAG,KAAK,CAAC,CAAC;AACzF,SAAS,gBAAgB,CAAC,MAAM,EAAE;AAClC;AACA,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;AAC/B,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AACD,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AAC5C,SAAS,YAAY,CAAC,+BAA+B,EAAE;AACvD,IAAI,IAAI,CAAC,+BAA+B,EAAE;AAC1C,QAAQ,OAAO,SAAS,CAAC;AACzB,KAAK;AACL,IAAI,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,+B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IAAI,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,cAAc,EAAE,QAAQ,KAAK;AAC1D,QAAQ,IAAI,aAAa,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE;AACnD,YAAY,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;AACzD,SAAS;AACT,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK,EAAE,EAAE,CAAC,CAAC;AACX,CAAC;AACD,SAAS,YAAY,CAAC,gBAAgB,EAAE;AACxC,IAAI,IAAI,gBAAgB,KAAK,UAAU;AACvC,QAAQ,OAAO,UAAU,CAAC;AAC1B,IAAI,IAAI,gBAAgB,KAAK,UAAU;AACvC,QAAQ,OAAO,IAAI,CAAC;AACpB,IAAI,OAAO,KAAK,CAAC;AACjB,CAAC;AACD,SAAS,mBAAmB,CAAC,OAAO,EAAE;AACtC,IAAI,MAAM,aAAa,GAAG,EAAE,CAAC;AAC7B,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;AACtF,QAAQ,IAAI,IAAI,IAAI,aAAa,EAAE;AACnC,YAAY,MAAM,IAAI,KAAK,CAAC,CAAC,+BAA+B,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAC5F,SAAS;AACT,QAAQ,aAAa,CAAC,IAAI,CAAC,GAAG;AAC9B,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,KAAK;AACjB,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,aAAa,CAAC;AACzB;;"}
|
|
1
|
+
{"version":3,"file":"parseAmplifyOutputs.js","sources":["../../src/parseAmplifyOutputs.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 });\nexports.parseAmplifyOutputs = exports.parseAnalytics = exports.isAmplifyOutputs = void 0;\nfunction isAmplifyOutputs(config) {\n // version format initially will be '1' but is expected to be something like x.y where x is major and y minor version\n const { version } = config;\n if (!version) {\n return false;\n }\n return version.startsWith('1');\n}\nexports.isAmplifyOutputs = isAmplifyOutputs;\nfunction parseStorage(amplifyOutputsStorageProperties) {\n if (!amplifyOutputsStorageProperties) {\n return undefined;\n }\n const { bucket_name, aws_region, buckets } = amplifyOutputsStorageProperties;\n return {\n S3: {\n bucket: bucket_name,\n region: aws_region,\n buckets: buckets && createBucketInfoMap(buckets),\n },\n };\n}\nfunction parseAuth(amplifyOutputsAuthProperties) {\n if (!amplifyOutputsAuthProperties) {\n return undefined;\n }\n const { user_pool_id, user_pool_client_id, identity_pool_id, password_policy, mfa_configuration, mfa_methods, unauthenticated_identities_enabled, oauth, username_attributes, standard_required_attributes, groups, } = amplifyOutputsAuthProperties;\n const authConfig = {\n Cognito: {\n userPoolId: user_pool_id,\n userPoolClientId: user_pool_client_id,\n groups,\n },\n };\n if (identity_pool_id) {\n authConfig.Cognito = {\n ...authConfig.Cognito,\n identityPoolId: identity_pool_id,\n };\n }\n if (password_policy) {\n authConfig.Cognito.passwordFormat = {\n requireLowercase: password_policy.require_lowercase,\n requireNumbers: password_policy.require_numbers,\n requireUppercase: password_policy.require_uppercase,\n requireSpecialCharacters: password_policy.require_symbols,\n minLength: password_policy.min_length ?? 6,\n };\n }\n if (mfa_configuration) {\n authConfig.Cognito.mfa = {\n status: getMfaStatus(mfa_configuration),\n smsEnabled: mfa_methods?.includes('SMS'),\n totpEnabled: mfa_methods?.includes('TOTP'),\n };\n }\n if (unauthenticated_identities_enabled) {\n authConfig.Cognito.allowGuestAccess = unauthenticated_identities_enabled;\n }\n if (oauth) {\n authConfig.Cognito.loginWith = {\n oauth: {\n domain: oauth.domain,\n redirectSignIn: oauth.redirect_sign_in_uri,\n redirectSignOut: oauth.redirect_sign_out_uri,\n responseType: oauth.response_type === 'token' ? 'token' : 'code',\n scopes: oauth.scopes,\n providers: getOAuthProviders(oauth.identity_providers),\n },\n };\n }\n if (username_attributes) {\n authConfig.Cognito.loginWith = {\n ...authConfig.Cognito.loginWith,\n email: username_attributes.includes('email'),\n phone: username_attributes.includes('phone_number'),\n // Signing in with a username is not currently supported in Gen2, this should always evaluate to false\n username: username_attributes.includes('username'),\n };\n }\n if (standard_required_attributes) {\n authConfig.Cognito.userAttributes = standard_required_attributes.reduce((acc, curr) => ({ ...acc, [curr]: { required: true } }), {});\n }\n return authConfig;\n}\nfunction parseAnalytics(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties?.amazon_pinpoint) {\n return undefined;\n }\n const { amazon_pinpoint } = amplifyOutputsAnalyticsProperties;\n return {\n Pinpoint: {\n appId: amazon_pinpoint.app_id,\n region: amazon_pinpoint.aws_region,\n },\n };\n}\nexports.parseAnalytics = parseAnalytics;\nfunction parseGeo(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties) {\n return undefined;\n }\n const { aws_region, geofence_collections, maps, search_indices } = amplifyOutputsAnalyticsProperties;\n return {\n LocationService: {\n region: aws_region,\n searchIndices: search_indices,\n geofenceCollections: geofence_collections,\n maps,\n },\n };\n}\nfunction parseData(amplifyOutputsDataProperties) {\n if (!amplifyOutputsDataProperties) {\n return undefined;\n }\n const { aws_region, default_authorization_type, url, api_key, model_introspection, } = amplifyOutputsDataProperties;\n const GraphQL = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n modelIntrospection: model_introspection,\n };\n return {\n GraphQL,\n };\n}\nfunction parseCustom(amplifyOutputsCustomProperties) {\n if (!amplifyOutputsCustomProperties?.events) {\n return undefined;\n }\n const { url, aws_region, api_key, default_authorization_type } = amplifyOutputsCustomProperties.events;\n const Events = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n };\n return {\n Events,\n };\n}\nfunction parseNotifications(amplifyOutputsNotificationsProperties) {\n if (!amplifyOutputsNotificationsProperties) {\n return undefined;\n }\n const { aws_region, channels, amazon_pinpoint_app_id } = amplifyOutputsNotificationsProperties;\n const hasInAppMessaging = channels.includes('IN_APP_MESSAGING');\n const hasPushNotification = channels.includes('APNS') || channels.includes('FCM');\n if (!(hasInAppMessaging || hasPushNotification)) {\n return undefined;\n }\n // At this point, we know the Amplify outputs contains at least one supported channel\n const notificationsConfig = {};\n if (hasInAppMessaging) {\n notificationsConfig.InAppMessaging = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n if (hasPushNotification) {\n notificationsConfig.PushNotification = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n return notificationsConfig;\n}\nfunction parseAmplifyOutputs(amplifyOutputs) {\n const resourcesConfig = {};\n if (amplifyOutputs.storage) {\n resourcesConfig.Storage = parseStorage(amplifyOutputs.storage);\n }\n if (amplifyOutputs.auth) {\n resourcesConfig.Auth = parseAuth(amplifyOutputs.auth);\n }\n if (amplifyOutputs.analytics) {\n resourcesConfig.Analytics = parseAnalytics(amplifyOutputs.analytics);\n }\n if (amplifyOutputs.geo) {\n resourcesConfig.Geo = parseGeo(amplifyOutputs.geo);\n }\n if (amplifyOutputs.data) {\n resourcesConfig.API = parseData(amplifyOutputs.data);\n }\n if (amplifyOutputs.custom) {\n const customConfig = parseCustom(amplifyOutputs.custom);\n if (customConfig && 'Events' in customConfig) {\n resourcesConfig.API = { ...resourcesConfig.API, ...customConfig };\n }\n }\n if (amplifyOutputs.notifications) {\n resourcesConfig.Notifications = parseNotifications(amplifyOutputs.notifications);\n }\n return resourcesConfig;\n}\nexports.parseAmplifyOutputs = parseAmplifyOutputs;\nconst authModeNames = {\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AWS_LAMBDA: 'lambda',\n OPENID_CONNECT: 'oidc',\n};\nfunction getGraphQLAuthMode(authType) {\n return authModeNames[authType];\n}\nconst providerNames = {\n GOOGLE: 'Google',\n LOGIN_WITH_AMAZON: 'Amazon',\n FACEBOOK: 'Facebook',\n SIGN_IN_WITH_APPLE: 'Apple',\n};\nfunction getOAuthProviders(providers = []) {\n return providers.reduce((oAuthProviders, provider) => {\n if (providerNames[provider] !== undefined) {\n oAuthProviders.push(providerNames[provider]);\n }\n return oAuthProviders;\n }, []);\n}\nfunction getMfaStatus(mfaConfiguration) {\n if (mfaConfiguration === 'OPTIONAL')\n return 'optional';\n if (mfaConfiguration === 'REQUIRED')\n return 'on';\n return 'off';\n}\nfunction createBucketInfoMap(buckets) {\n const mappedBuckets = {};\n buckets.forEach(({ name, bucket_name: bucketName, aws_region: region, paths }) => {\n if (name in mappedBuckets) {\n throw new Error(`Duplicate friendly name found: ${name}. Name must be unique.`);\n }\n const sanitizedPaths = paths\n ? Object.entries(paths).reduce((acc, [key, value]) => {\n if (value !== undefined) {\n acc[key] = value;\n }\n return acc;\n }, {})\n : undefined;\n mappedBuckets[name] = {\n bucketName,\n region,\n paths: sanitizedPaths,\n };\n });\n return mappedBuckets;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,gBAAgB,GAAG,KAAK,CAAC,CAAC;AACzF,SAAS,gBAAgB,CAAC,MAAM,EAAE;AAClC;AACA,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;AAC/B,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAC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,GAAG,EAAE,KAAK,CAAC,KAAK;AAClE,gBAAgB,IAAI,KAAK,KAAK,SAAS,EAAE;AACzC,oBAAoB,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACrC,iBAAiB;AACjB,gBAAgB,OAAO,GAAG,CAAC;AAC3B,aAAa,EAAE,EAAE,CAAC;AAClB,cAAc,SAAS,CAAC;AACxB,QAAQ,aAAa,CAAC,IAAI,CAAC,GAAG;AAC9B,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,KAAK,EAAE,cAAc;AACjC,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,aAAa,CAAC;AACzB;;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SyncKeyValueStorage = void 0;
|
|
7
|
+
const errors_1 = require("../errors");
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
class SyncKeyValueStorage {
|
|
12
|
+
constructor(storage) {
|
|
13
|
+
this._storage = storage;
|
|
14
|
+
}
|
|
15
|
+
get storage() {
|
|
16
|
+
if (!this._storage)
|
|
17
|
+
throw new errors_1.PlatformNotSupportedError();
|
|
18
|
+
return this._storage;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* This is used to set a specific item in storage
|
|
22
|
+
* @param {string} key - the key for the item
|
|
23
|
+
* @param {object} value - the value
|
|
24
|
+
* @returns {string} value that was set
|
|
25
|
+
*/
|
|
26
|
+
setItem(key, value) {
|
|
27
|
+
this.storage.setItem(key, value);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* This is used to get a specific key from storage
|
|
31
|
+
* @param {string} key - the key for the item
|
|
32
|
+
* This is used to clear the storage
|
|
33
|
+
* @returns {string} the data item
|
|
34
|
+
*/
|
|
35
|
+
getItem(key) {
|
|
36
|
+
return this.storage.getItem(key);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* This is used to remove an item from storage
|
|
40
|
+
* @param {string} key - the key being set
|
|
41
|
+
* @returns {string} value - value that was deleted
|
|
42
|
+
*/
|
|
43
|
+
removeItem(key) {
|
|
44
|
+
this.storage.removeItem(key);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* This is used to clear the storage
|
|
48
|
+
* @returns {string} nothing
|
|
49
|
+
*/
|
|
50
|
+
clear() {
|
|
51
|
+
this.storage.clear();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.SyncKeyValueStorage = SyncKeyValueStorage;
|
|
55
|
+
//# sourceMappingURL=SyncKeyValueStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SyncKeyValueStorage.js","sources":["../../../src/storage/SyncKeyValueStorage.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 });\nexports.SyncKeyValueStorage = void 0;\nconst errors_1 = require(\"../errors\");\n/**\n * @internal\n */\nclass SyncKeyValueStorage {\n constructor(storage) {\n this._storage = storage;\n }\n get storage() {\n if (!this._storage)\n throw new errors_1.PlatformNotSupportedError();\n return this._storage;\n }\n /**\n * This is used to set a specific item in storage\n * @param {string} key - the key for the item\n * @param {object} value - the value\n * @returns {string} value that was set\n */\n setItem(key, value) {\n this.storage.setItem(key, value);\n }\n /**\n * This is used to get a specific key from storage\n * @param {string} key - the key for the item\n * This is used to clear the storage\n * @returns {string} the data item\n */\n getItem(key) {\n return this.storage.getItem(key);\n }\n /**\n * This is used to remove an item from storage\n * @param {string} key - the key being set\n * @returns {string} value - value that was deleted\n */\n removeItem(key) {\n this.storage.removeItem(key);\n }\n /**\n * This is used to clear the storage\n * @returns {string} nothing\n */\n clear() {\n this.storage.clear();\n }\n}\nexports.SyncKeyValueStorage = SyncKeyValueStorage;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,mBAAmB,GAAG,KAAK,CAAC,CAAC;AACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACtC;AACA;AACA;AACA,MAAM,mBAAmB,CAAC;AAC1B,IAAI,WAAW,CAAC,OAAO,EAAE;AACzB,QAAQ,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;AAChC,KAAK;AACL,IAAI,IAAI,OAAO,GAAG;AAClB,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ;AAC1B,YAAY,MAAM,IAAI,QAAQ,CAAC,yBAAyB,EAAE,CAAC;AAC3D,QAAQ,OAAO,IAAI,CAAC,QAAQ,CAAC;AAC7B,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE;AACxB,QAAQ,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACzC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,CAAC,GAAG,EAAE;AACjB,QAAQ,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACzC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,GAAG,EAAE;AACpB,QAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACrC,KAAK;AACL;AACA;AACA;AACA;AACA,IAAI,KAAK,GAAG;AACZ,QAAQ,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;AAC7B,KAAK;AACL,CAAC;AACD,OAAO,CAAC,mBAAmB,GAAG,mBAAmB;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SyncSessionStorage = void 0;
|
|
7
|
+
const SyncKeyValueStorage_1 = require("./SyncKeyValueStorage");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
class SyncSessionStorage extends SyncKeyValueStorage_1.SyncKeyValueStorage {
|
|
13
|
+
constructor() {
|
|
14
|
+
super((0, utils_1.getSessionStorageWithFallback)());
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.SyncSessionStorage = SyncSessionStorage;
|
|
18
|
+
//# sourceMappingURL=SyncSessionStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SyncSessionStorage.js","sources":["../../../src/storage/SyncSessionStorage.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 });\nexports.SyncSessionStorage = void 0;\nconst SyncKeyValueStorage_1 = require(\"./SyncKeyValueStorage\");\nconst utils_1 = require(\"./utils\");\n/**\n * @internal\n */\nclass SyncSessionStorage extends SyncKeyValueStorage_1.SyncKeyValueStorage {\n constructor() {\n super((0, utils_1.getSessionStorageWithFallback)());\n }\n}\nexports.SyncSessionStorage = SyncSessionStorage;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,KAAK,CAAC,CAAC;AACpC,MAAM,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAC/D,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACnC;AACA;AACA;AACA,MAAM,kBAAkB,SAAS,qBAAqB,CAAC,mBAAmB,CAAC;AAC3E,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,IAAI,OAAO,CAAC,6BAA6B,GAAG,CAAC,CAAC;AAC5D,KAAK;AACL,CAAC;AACD,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;;"}
|
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = void 0;
|
|
6
|
+
exports.sharedInMemoryStorage = exports.syncSessionStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = void 0;
|
|
7
7
|
const DefaultStorage_1 = require("./DefaultStorage");
|
|
8
8
|
const InMemoryStorage_1 = require("./InMemoryStorage");
|
|
9
9
|
const KeyValueStorage_1 = require("./KeyValueStorage");
|
|
10
10
|
const SessionStorage_1 = require("./SessionStorage");
|
|
11
|
+
const SyncSessionStorage_1 = require("./SyncSessionStorage");
|
|
11
12
|
var CookieStorage_1 = require("./CookieStorage");
|
|
12
13
|
Object.defineProperty(exports, "CookieStorage", { enumerable: true, get: function () { return CookieStorage_1.CookieStorage; } });
|
|
13
14
|
exports.defaultStorage = new DefaultStorage_1.DefaultStorage();
|
|
14
15
|
exports.sessionStorage = new SessionStorage_1.SessionStorage();
|
|
16
|
+
exports.syncSessionStorage = new SyncSessionStorage_1.SyncSessionStorage();
|
|
15
17
|
exports.sharedInMemoryStorage = new KeyValueStorage_1.KeyValueStorage(new InMemoryStorage_1.InMemoryStorage());
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/storage/index.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 });\nexports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = void 0;\nconst DefaultStorage_1 = require(\"./DefaultStorage\");\nconst InMemoryStorage_1 = require(\"./InMemoryStorage\");\nconst KeyValueStorage_1 = require(\"./KeyValueStorage\");\nconst SessionStorage_1 = require(\"./SessionStorage\");\nvar CookieStorage_1 = require(\"./CookieStorage\");\nObject.defineProperty(exports, \"CookieStorage\", { enumerable: true, get: function () { return CookieStorage_1.CookieStorage; } });\nexports.defaultStorage = new DefaultStorage_1.DefaultStorage();\nexports.sessionStorage = new SessionStorage_1.SessionStorage();\nexports.sharedInMemoryStorage = new KeyValueStorage_1.KeyValueStorage(new InMemoryStorage_1.InMemoryStorage());\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/storage/index.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 });\nexports.sharedInMemoryStorage = exports.syncSessionStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = void 0;\nconst DefaultStorage_1 = require(\"./DefaultStorage\");\nconst InMemoryStorage_1 = require(\"./InMemoryStorage\");\nconst KeyValueStorage_1 = require(\"./KeyValueStorage\");\nconst SessionStorage_1 = require(\"./SessionStorage\");\nconst SyncSessionStorage_1 = require(\"./SyncSessionStorage\");\nvar CookieStorage_1 = require(\"./CookieStorage\");\nObject.defineProperty(exports, \"CookieStorage\", { enumerable: true, get: function () { return CookieStorage_1.CookieStorage; } });\nexports.defaultStorage = new DefaultStorage_1.DefaultStorage();\nexports.sessionStorage = new SessionStorage_1.SessionStorage();\nexports.syncSessionStorage = new SyncSessionStorage_1.SyncSessionStorage();\nexports.sharedInMemoryStorage = new KeyValueStorage_1.KeyValueStorage(new InMemoryStorage_1.InMemoryStorage());\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AAC9I,MAAM,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACrD,MAAM,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACvD,MAAM,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACvD,MAAM,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACrD,MAAM,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAC7D,IAAI,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACjD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC;AAClI,OAAO,CAAC,cAAc,GAAG,IAAI,gBAAgB,CAAC,cAAc,EAAE,CAAC;AAC/D,OAAO,CAAC,cAAc,GAAG,IAAI,gBAAgB,CAAC,cAAc,EAAE,CAAC;AAC/D,OAAO,CAAC,kBAAkB,GAAG,IAAI,oBAAoB,CAAC,kBAAkB,EAAE,CAAC;AAC3E,OAAO,CAAC,qBAAqB,GAAG,IAAI,iBAAiB,CAAC,eAAe,CAAC,IAAI,iBAAiB,CAAC,eAAe,EAAE,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.
|
|
1
|
+
export declare const version = "6.11.1-unstable.0ecded1.0+0ecded1";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.11.1-unstable.0ecded1.0+0ecded1';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, APIC
|
|
|
6
6
|
export { Amplify, fetchAuthSession, AmplifyClass as AmplifyClassV6, clearCredentials, } from './singleton';
|
|
7
7
|
export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './awsClients/cognitoIdentity';
|
|
8
8
|
export { UserProfile } from './types';
|
|
9
|
-
export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
|
|
9
|
+
export { CookieStorage, defaultStorage, sessionStorage, syncSessionStorage, sharedInMemoryStorage, } from './storage';
|
|
10
10
|
export { KeyValueStorageInterface } from './types';
|
|
11
11
|
export { Cache } from './Cache';
|
|
12
12
|
export { CacheConfig } from './Cache/types';
|
package/dist/esm/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ export { fetchAuthSession } from './singleton/apis/fetchAuthSession.mjs';
|
|
|
5
5
|
export { clearCredentials } from './singleton/apis/clearCredentials.mjs';
|
|
6
6
|
export { getId } from './awsClients/cognitoIdentity/getId.mjs';
|
|
7
7
|
export { getCredentialsForIdentity } from './awsClients/cognitoIdentity/getCredentialsForIdentity.mjs';
|
|
8
|
-
export { defaultStorage, sessionStorage, sharedInMemoryStorage } from './storage/index.mjs';
|
|
8
|
+
export { defaultStorage, sessionStorage, sharedInMemoryStorage, syncSessionStorage } from './storage/index.mjs';
|
|
9
9
|
export { Cache } from './Cache/index.mjs';
|
|
10
10
|
export { I18n } from './I18n/index.mjs';
|
|
11
11
|
export { ConsoleLogger } from './Logger/ConsoleLogger.mjs';
|
|
@@ -236,10 +236,18 @@ function createBucketInfoMap(buckets) {
|
|
|
236
236
|
if (name in mappedBuckets) {
|
|
237
237
|
throw new Error(`Duplicate friendly name found: ${name}. Name must be unique.`);
|
|
238
238
|
}
|
|
239
|
+
const sanitizedPaths = paths
|
|
240
|
+
? Object.entries(paths).reduce((acc, [key, value]) => {
|
|
241
|
+
if (value !== undefined) {
|
|
242
|
+
acc[key] = value;
|
|
243
|
+
}
|
|
244
|
+
return acc;
|
|
245
|
+
}, {})
|
|
246
|
+
: undefined;
|
|
239
247
|
mappedBuckets[name] = {
|
|
240
248
|
bucketName,
|
|
241
249
|
region,
|
|
242
|
-
paths,
|
|
250
|
+
paths: sanitizedPaths,
|
|
243
251
|
};
|
|
244
252
|
});
|
|
245
253
|
return mappedBuckets;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseAmplifyOutputs.mjs","sources":["../../src/parseAmplifyOutputs.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport function isAmplifyOutputs(config) {\n // version format initially will be '1' but is expected to be something like x.y where x is major and y minor version\n const { version } = config;\n if (!version) {\n return false;\n }\n return version.startsWith('1');\n}\nfunction parseStorage(amplifyOutputsStorageProperties) {\n if (!amplifyOutputsStorageProperties) {\n return undefined;\n }\n const { bucket_name, aws_region, buckets } = amplifyOutputsStorageProperties;\n return {\n S3: {\n bucket: bucket_name,\n region: aws_region,\n buckets: buckets && createBucketInfoMap(buckets),\n },\n };\n}\nfunction parseAuth(amplifyOutputsAuthProperties) {\n if (!amplifyOutputsAuthProperties) {\n return undefined;\n }\n const { user_pool_id, user_pool_client_id, identity_pool_id, password_policy, mfa_configuration, mfa_methods, unauthenticated_identities_enabled, oauth, username_attributes, standard_required_attributes, groups, } = amplifyOutputsAuthProperties;\n const authConfig = {\n Cognito: {\n userPoolId: user_pool_id,\n userPoolClientId: user_pool_client_id,\n groups,\n },\n };\n if (identity_pool_id) {\n authConfig.Cognito = {\n ...authConfig.Cognito,\n identityPoolId: identity_pool_id,\n };\n }\n if (password_policy) {\n authConfig.Cognito.passwordFormat = {\n requireLowercase: password_policy.require_lowercase,\n requireNumbers: password_policy.require_numbers,\n requireUppercase: password_policy.require_uppercase,\n requireSpecialCharacters: password_policy.require_symbols,\n minLength: password_policy.min_length ?? 6,\n };\n }\n if (mfa_configuration) {\n authConfig.Cognito.mfa = {\n status: getMfaStatus(mfa_configuration),\n smsEnabled: mfa_methods?.includes('SMS'),\n totpEnabled: mfa_methods?.includes('TOTP'),\n };\n }\n if (unauthenticated_identities_enabled) {\n authConfig.Cognito.allowGuestAccess = unauthenticated_identities_enabled;\n }\n if (oauth) {\n authConfig.Cognito.loginWith = {\n oauth: {\n domain: oauth.domain,\n redirectSignIn: oauth.redirect_sign_in_uri,\n redirectSignOut: oauth.redirect_sign_out_uri,\n responseType: oauth.response_type === 'token' ? 'token' : 'code',\n scopes: oauth.scopes,\n providers: getOAuthProviders(oauth.identity_providers),\n },\n };\n }\n if (username_attributes) {\n authConfig.Cognito.loginWith = {\n ...authConfig.Cognito.loginWith,\n email: username_attributes.includes('email'),\n phone: username_attributes.includes('phone_number'),\n // Signing in with a username is not currently supported in Gen2, this should always evaluate to false\n username: username_attributes.includes('username'),\n };\n }\n if (standard_required_attributes) {\n authConfig.Cognito.userAttributes = standard_required_attributes.reduce((acc, curr) => ({ ...acc, [curr]: { required: true } }), {});\n }\n return authConfig;\n}\nexport function parseAnalytics(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties?.amazon_pinpoint) {\n return undefined;\n }\n const { amazon_pinpoint } = amplifyOutputsAnalyticsProperties;\n return {\n Pinpoint: {\n appId: amazon_pinpoint.app_id,\n region: amazon_pinpoint.aws_region,\n },\n };\n}\nfunction parseGeo(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties) {\n return undefined;\n }\n const { aws_region, geofence_collections, maps, search_indices } = amplifyOutputsAnalyticsProperties;\n return {\n LocationService: {\n region: aws_region,\n searchIndices: search_indices,\n geofenceCollections: geofence_collections,\n maps,\n },\n };\n}\nfunction parseData(amplifyOutputsDataProperties) {\n if (!amplifyOutputsDataProperties) {\n return undefined;\n }\n const { aws_region, default_authorization_type, url, api_key, model_introspection, } = amplifyOutputsDataProperties;\n const GraphQL = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n modelIntrospection: model_introspection,\n };\n return {\n GraphQL,\n };\n}\nfunction parseCustom(amplifyOutputsCustomProperties) {\n if (!amplifyOutputsCustomProperties?.events) {\n return undefined;\n }\n const { url, aws_region, api_key, default_authorization_type } = amplifyOutputsCustomProperties.events;\n const Events = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n };\n return {\n Events,\n };\n}\nfunction parseNotifications(amplifyOutputsNotificationsProperties) {\n if (!amplifyOutputsNotificationsProperties) {\n return undefined;\n }\n const { aws_region, channels, amazon_pinpoint_app_id } = amplifyOutputsNotificationsProperties;\n const hasInAppMessaging = channels.includes('IN_APP_MESSAGING');\n const hasPushNotification = channels.includes('APNS') || channels.includes('FCM');\n if (!(hasInAppMessaging || hasPushNotification)) {\n return undefined;\n }\n // At this point, we know the Amplify outputs contains at least one supported channel\n const notificationsConfig = {};\n if (hasInAppMessaging) {\n notificationsConfig.InAppMessaging = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n if (hasPushNotification) {\n notificationsConfig.PushNotification = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n return notificationsConfig;\n}\nexport function parseAmplifyOutputs(amplifyOutputs) {\n const resourcesConfig = {};\n if (amplifyOutputs.storage) {\n resourcesConfig.Storage = parseStorage(amplifyOutputs.storage);\n }\n if (amplifyOutputs.auth) {\n resourcesConfig.Auth = parseAuth(amplifyOutputs.auth);\n }\n if (amplifyOutputs.analytics) {\n resourcesConfig.Analytics = parseAnalytics(amplifyOutputs.analytics);\n }\n if (amplifyOutputs.geo) {\n resourcesConfig.Geo = parseGeo(amplifyOutputs.geo);\n }\n if (amplifyOutputs.data) {\n resourcesConfig.API = parseData(amplifyOutputs.data);\n }\n if (amplifyOutputs.custom) {\n const customConfig = parseCustom(amplifyOutputs.custom);\n if (customConfig && 'Events' in customConfig) {\n resourcesConfig.API = { ...resourcesConfig.API, ...customConfig };\n }\n }\n if (amplifyOutputs.notifications) {\n resourcesConfig.Notifications = parseNotifications(amplifyOutputs.notifications);\n }\n return resourcesConfig;\n}\nconst authModeNames = {\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AWS_LAMBDA: 'lambda',\n OPENID_CONNECT: 'oidc',\n};\nfunction getGraphQLAuthMode(authType) {\n return authModeNames[authType];\n}\nconst providerNames = {\n GOOGLE: 'Google',\n LOGIN_WITH_AMAZON: 'Amazon',\n FACEBOOK: 'Facebook',\n SIGN_IN_WITH_APPLE: 'Apple',\n};\nfunction getOAuthProviders(providers = []) {\n return providers.reduce((oAuthProviders, provider) => {\n if (providerNames[provider] !== undefined) {\n oAuthProviders.push(providerNames[provider]);\n }\n return oAuthProviders;\n }, []);\n}\nfunction getMfaStatus(mfaConfiguration) {\n if (mfaConfiguration === 'OPTIONAL')\n return 'optional';\n if (mfaConfiguration === 'REQUIRED')\n return 'on';\n return 'off';\n}\nfunction createBucketInfoMap(buckets) {\n const mappedBuckets = {};\n buckets.forEach(({ name, bucket_name: bucketName, aws_region: region, paths }) => {\n if (name in mappedBuckets) {\n throw new Error(`Duplicate friendly name found: ${name}. Name must be unique.`);\n }\n mappedBuckets[name] = {\n bucketName,\n region,\n paths,\n };\n });\n return mappedBuckets;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACO,SAAS,gBAAgB,CAAC,MAAM,EAAE;AACzC;AACA,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;AAC/B,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AACD,SAAS,YAAY,CAAC,+BAA+B,EAAE;AACvD,IAAI,IAAI,CAAC,+BAA+B,EAAE;AAC1C,QAAQ,OAAO,SAAS,CAAC;AACzB,KAAK;AACL,IAAI,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,+BAA+B,CAAC;AACjF,IAAI,OAAO;AACX,QAAQ,EAAE,EAAE;AACZ,YAAY,MAAM,EAAE,WAAW;AAC/B,YAAY,MAAM,EAAE,UAAU;AAC9B,YAAY,OAAO,EAAE,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC;AAC5D,SAAS;AACT,KAAK,CAAC;AACN,CAAC;AACD,SAAS,SAAS,CAAC,4BAA4B,EAAE;AACjD,IAAI,IAAI,CAAC,4BAA4B,EAAE;AACvC,QAAQ,OAAO,SAAS,CAAC;AACzB,KAAK;AACL,IAAI,MAAM,EAAE,YAAY,EAAE,mBAAmB,EAAE,gB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I,OAAO,KAAK,CAAC;AACjB,CAAC;AACD,SAAS,mBAAmB,CAAC,OAAO,EAAE;AACtC,IAAI,MAAM,aAAa,GAAG,EAAE,CAAC;AAC7B,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;AACtF,QAAQ,IAAI,IAAI,IAAI,aAAa,EAAE;AACnC,YAAY,MAAM,IAAI,KAAK,CAAC,CAAC,+BAA+B,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAC5F,SAAS;AACT,QAAQ,aAAa,CAAC,IAAI,CAAC,GAAG;AAC9B,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,KAAK;AACjB,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,aAAa,CAAC;AACzB;;;;"}
|
|
1
|
+
{"version":3,"file":"parseAmplifyOutputs.mjs","sources":["../../src/parseAmplifyOutputs.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport function isAmplifyOutputs(config) {\n // version format initially will be '1' but is expected to be something like x.y where x is major and y minor version\n const { version } = config;\n if (!version) {\n return false;\n }\n return version.startsWith('1');\n}\nfunction parseStorage(amplifyOutputsStorageProperties) {\n if (!amplifyOutputsStorageProperties) {\n return undefined;\n }\n const { bucket_name, aws_region, buckets } = amplifyOutputsStorageProperties;\n return {\n S3: {\n bucket: bucket_name,\n region: aws_region,\n buckets: buckets && createBucketInfoMap(buckets),\n },\n };\n}\nfunction parseAuth(amplifyOutputsAuthProperties) {\n if (!amplifyOutputsAuthProperties) {\n return undefined;\n }\n const { user_pool_id, user_pool_client_id, identity_pool_id, password_policy, mfa_configuration, mfa_methods, unauthenticated_identities_enabled, oauth, username_attributes, standard_required_attributes, groups, } = amplifyOutputsAuthProperties;\n const authConfig = {\n Cognito: {\n userPoolId: user_pool_id,\n userPoolClientId: user_pool_client_id,\n groups,\n },\n };\n if (identity_pool_id) {\n authConfig.Cognito = {\n ...authConfig.Cognito,\n identityPoolId: identity_pool_id,\n };\n }\n if (password_policy) {\n authConfig.Cognito.passwordFormat = {\n requireLowercase: password_policy.require_lowercase,\n requireNumbers: password_policy.require_numbers,\n requireUppercase: password_policy.require_uppercase,\n requireSpecialCharacters: password_policy.require_symbols,\n minLength: password_policy.min_length ?? 6,\n };\n }\n if (mfa_configuration) {\n authConfig.Cognito.mfa = {\n status: getMfaStatus(mfa_configuration),\n smsEnabled: mfa_methods?.includes('SMS'),\n totpEnabled: mfa_methods?.includes('TOTP'),\n };\n }\n if (unauthenticated_identities_enabled) {\n authConfig.Cognito.allowGuestAccess = unauthenticated_identities_enabled;\n }\n if (oauth) {\n authConfig.Cognito.loginWith = {\n oauth: {\n domain: oauth.domain,\n redirectSignIn: oauth.redirect_sign_in_uri,\n redirectSignOut: oauth.redirect_sign_out_uri,\n responseType: oauth.response_type === 'token' ? 'token' : 'code',\n scopes: oauth.scopes,\n providers: getOAuthProviders(oauth.identity_providers),\n },\n };\n }\n if (username_attributes) {\n authConfig.Cognito.loginWith = {\n ...authConfig.Cognito.loginWith,\n email: username_attributes.includes('email'),\n phone: username_attributes.includes('phone_number'),\n // Signing in with a username is not currently supported in Gen2, this should always evaluate to false\n username: username_attributes.includes('username'),\n };\n }\n if (standard_required_attributes) {\n authConfig.Cognito.userAttributes = standard_required_attributes.reduce((acc, curr) => ({ ...acc, [curr]: { required: true } }), {});\n }\n return authConfig;\n}\nexport function parseAnalytics(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties?.amazon_pinpoint) {\n return undefined;\n }\n const { amazon_pinpoint } = amplifyOutputsAnalyticsProperties;\n return {\n Pinpoint: {\n appId: amazon_pinpoint.app_id,\n region: amazon_pinpoint.aws_region,\n },\n };\n}\nfunction parseGeo(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties) {\n return undefined;\n }\n const { aws_region, geofence_collections, maps, search_indices } = amplifyOutputsAnalyticsProperties;\n return {\n LocationService: {\n region: aws_region,\n searchIndices: search_indices,\n geofenceCollections: geofence_collections,\n maps,\n },\n };\n}\nfunction parseData(amplifyOutputsDataProperties) {\n if (!amplifyOutputsDataProperties) {\n return undefined;\n }\n const { aws_region, default_authorization_type, url, api_key, model_introspection, } = amplifyOutputsDataProperties;\n const GraphQL = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n modelIntrospection: model_introspection,\n };\n return {\n GraphQL,\n };\n}\nfunction parseCustom(amplifyOutputsCustomProperties) {\n if (!amplifyOutputsCustomProperties?.events) {\n return undefined;\n }\n const { url, aws_region, api_key, default_authorization_type } = amplifyOutputsCustomProperties.events;\n const Events = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n };\n return {\n Events,\n };\n}\nfunction parseNotifications(amplifyOutputsNotificationsProperties) {\n if (!amplifyOutputsNotificationsProperties) {\n return undefined;\n }\n const { aws_region, channels, amazon_pinpoint_app_id } = amplifyOutputsNotificationsProperties;\n const hasInAppMessaging = channels.includes('IN_APP_MESSAGING');\n const hasPushNotification = channels.includes('APNS') || channels.includes('FCM');\n if (!(hasInAppMessaging || hasPushNotification)) {\n return undefined;\n }\n // At this point, we know the Amplify outputs contains at least one supported channel\n const notificationsConfig = {};\n if (hasInAppMessaging) {\n notificationsConfig.InAppMessaging = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n if (hasPushNotification) {\n notificationsConfig.PushNotification = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n return notificationsConfig;\n}\nexport function parseAmplifyOutputs(amplifyOutputs) {\n const resourcesConfig = {};\n if (amplifyOutputs.storage) {\n resourcesConfig.Storage = parseStorage(amplifyOutputs.storage);\n }\n if (amplifyOutputs.auth) {\n resourcesConfig.Auth = parseAuth(amplifyOutputs.auth);\n }\n if (amplifyOutputs.analytics) {\n resourcesConfig.Analytics = parseAnalytics(amplifyOutputs.analytics);\n }\n if (amplifyOutputs.geo) {\n resourcesConfig.Geo = parseGeo(amplifyOutputs.geo);\n }\n if (amplifyOutputs.data) {\n resourcesConfig.API = parseData(amplifyOutputs.data);\n }\n if (amplifyOutputs.custom) {\n const customConfig = parseCustom(amplifyOutputs.custom);\n if (customConfig && 'Events' in customConfig) {\n resourcesConfig.API = { ...resourcesConfig.API, ...customConfig };\n }\n }\n if (amplifyOutputs.notifications) {\n resourcesConfig.Notifications = parseNotifications(amplifyOutputs.notifications);\n }\n return resourcesConfig;\n}\nconst authModeNames = {\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AWS_LAMBDA: 'lambda',\n OPENID_CONNECT: 'oidc',\n};\nfunction getGraphQLAuthMode(authType) {\n return authModeNames[authType];\n}\nconst providerNames = {\n GOOGLE: 'Google',\n LOGIN_WITH_AMAZON: 'Amazon',\n FACEBOOK: 'Facebook',\n SIGN_IN_WITH_APPLE: 'Apple',\n};\nfunction getOAuthProviders(providers = []) {\n return providers.reduce((oAuthProviders, provider) => {\n if (providerNames[provider] !== undefined) {\n oAuthProviders.push(providerNames[provider]);\n }\n return oAuthProviders;\n }, []);\n}\nfunction getMfaStatus(mfaConfiguration) {\n if (mfaConfiguration === 'OPTIONAL')\n return 'optional';\n if (mfaConfiguration === 'REQUIRED')\n return 'on';\n return 'off';\n}\nfunction createBucketInfoMap(buckets) {\n const mappedBuckets = {};\n buckets.forEach(({ name, bucket_name: bucketName, aws_region: region, paths }) => {\n if (name in mappedBuckets) {\n throw new Error(`Duplicate friendly name found: ${name}. Name must be unique.`);\n }\n const sanitizedPaths = paths\n ? Object.entries(paths).reduce((acc, [key, value]) => {\n if (value !== undefined) {\n acc[key] = value;\n }\n return acc;\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AY,MAAM,IAAI,KAAK,CAAC,CAAC,+BAA+B,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAC5F,SAAS;AACT,QAAQ,MAAM,cAAc,GAAG,KAAK;AACpC,cAAc,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AAClE,gBAAgB,IAAI,KAAK,KAAK,SAAS,EAAE;AACzC,oBAAoB,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACrC,iBAAiB;AACjB,gBAAgB,OAAO,GAAG,CAAC;AAC3B,aAAa,EAAE,EAAE,CAAC;AAClB,cAAc,SAAS,CAAC;AACxB,QAAQ,aAAa,CAAC,IAAI,CAAC,GAAG;AAC9B,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,KAAK,EAAE,cAAc;AACjC,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,aAAa,CAAC;AACzB;;;;"}
|
|
@@ -40,7 +40,7 @@ export interface AmplifyOutputsStorageBucketProperties {
|
|
|
40
40
|
/** Region for the bucket */
|
|
41
41
|
aws_region: string;
|
|
42
42
|
/** Paths to object with access permissions */
|
|
43
|
-
paths?: Record<string, Record<string, string[] | undefined
|
|
43
|
+
paths?: Partial<Record<string, Record<string, string[] | undefined>>>;
|
|
44
44
|
}
|
|
45
45
|
export interface AmplifyOutputsStorageProperties {
|
|
46
46
|
/** Default region for Storage */
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SyncStorage } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare class SyncKeyValueStorage implements SyncStorage {
|
|
6
|
+
_storage?: Storage;
|
|
7
|
+
constructor(storage?: Storage);
|
|
8
|
+
get storage(): Storage;
|
|
9
|
+
/**
|
|
10
|
+
* This is used to set a specific item in storage
|
|
11
|
+
* @param {string} key - the key for the item
|
|
12
|
+
* @param {object} value - the value
|
|
13
|
+
* @returns {string} value that was set
|
|
14
|
+
*/
|
|
15
|
+
setItem(key: string, value: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* This is used to get a specific key from storage
|
|
18
|
+
* @param {string} key - the key for the item
|
|
19
|
+
* This is used to clear the storage
|
|
20
|
+
* @returns {string} the data item
|
|
21
|
+
*/
|
|
22
|
+
getItem(key: string): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* This is used to remove an item from storage
|
|
25
|
+
* @param {string} key - the key being set
|
|
26
|
+
* @returns {string} value - value that was deleted
|
|
27
|
+
*/
|
|
28
|
+
removeItem(key: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* This is used to clear the storage
|
|
31
|
+
* @returns {string} nothing
|
|
32
|
+
*/
|
|
33
|
+
clear(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { PlatformNotSupportedError } from '../errors/PlatformNotSupportedError.mjs';
|
|
2
|
+
import '../errors/errorHelpers.mjs';
|
|
3
|
+
|
|
4
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
class SyncKeyValueStorage {
|
|
10
|
+
constructor(storage) {
|
|
11
|
+
this._storage = storage;
|
|
12
|
+
}
|
|
13
|
+
get storage() {
|
|
14
|
+
if (!this._storage)
|
|
15
|
+
throw new PlatformNotSupportedError();
|
|
16
|
+
return this._storage;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* This is used to set a specific item in storage
|
|
20
|
+
* @param {string} key - the key for the item
|
|
21
|
+
* @param {object} value - the value
|
|
22
|
+
* @returns {string} value that was set
|
|
23
|
+
*/
|
|
24
|
+
setItem(key, value) {
|
|
25
|
+
this.storage.setItem(key, value);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* This is used to get a specific key from storage
|
|
29
|
+
* @param {string} key - the key for the item
|
|
30
|
+
* This is used to clear the storage
|
|
31
|
+
* @returns {string} the data item
|
|
32
|
+
*/
|
|
33
|
+
getItem(key) {
|
|
34
|
+
return this.storage.getItem(key);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* This is used to remove an item from storage
|
|
38
|
+
* @param {string} key - the key being set
|
|
39
|
+
* @returns {string} value - value that was deleted
|
|
40
|
+
*/
|
|
41
|
+
removeItem(key) {
|
|
42
|
+
this.storage.removeItem(key);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* This is used to clear the storage
|
|
46
|
+
* @returns {string} nothing
|
|
47
|
+
*/
|
|
48
|
+
clear() {
|
|
49
|
+
this.storage.clear();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { SyncKeyValueStorage };
|
|
54
|
+
//# sourceMappingURL=SyncKeyValueStorage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SyncKeyValueStorage.mjs","sources":["../../../src/storage/SyncKeyValueStorage.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { PlatformNotSupportedError } from '../errors';\n/**\n * @internal\n */\nexport class SyncKeyValueStorage {\n constructor(storage) {\n this._storage = storage;\n }\n get storage() {\n if (!this._storage)\n throw new PlatformNotSupportedError();\n return this._storage;\n }\n /**\n * This is used to set a specific item in storage\n * @param {string} key - the key for the item\n * @param {object} value - the value\n * @returns {string} value that was set\n */\n setItem(key, value) {\n this.storage.setItem(key, value);\n }\n /**\n * This is used to get a specific key from storage\n * @param {string} key - the key for the item\n * This is used to clear the storage\n * @returns {string} the data item\n */\n getItem(key) {\n return this.storage.getItem(key);\n }\n /**\n * This is used to remove an item from storage\n * @param {string} key - the key being set\n * @returns {string} value - value that was deleted\n */\n removeItem(key) {\n this.storage.removeItem(key);\n }\n /**\n * This is used to clear the storage\n * @returns {string} nothing\n */\n clear() {\n this.storage.clear();\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAEA;AACA;AACA;AACO,MAAM,mBAAmB,CAAC;AACjC,IAAI,WAAW,CAAC,OAAO,EAAE;AACzB,QAAQ,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;AAChC,KAAK;AACL,IAAI,IAAI,OAAO,GAAG;AAClB,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ;AAC1B,YAAY,MAAM,IAAI,yBAAyB,EAAE,CAAC;AAClD,QAAQ,OAAO,IAAI,CAAC,QAAQ,CAAC;AAC7B,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE;AACxB,QAAQ,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACzC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,CAAC,GAAG,EAAE;AACjB,QAAQ,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACzC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,GAAG,EAAE;AACpB,QAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACrC,KAAK;AACL;AACA;AACA;AACA;AACA,IAAI,KAAK,GAAG;AACZ,QAAQ,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;AAC7B,KAAK;AACL;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SyncKeyValueStorage } from './SyncKeyValueStorage.mjs';
|
|
2
|
+
import { getSessionStorageWithFallback } from './utils.mjs';
|
|
3
|
+
|
|
4
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
class SyncSessionStorage extends SyncKeyValueStorage {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(getSessionStorageWithFallback());
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { SyncSessionStorage };
|
|
16
|
+
//# sourceMappingURL=SyncSessionStorage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SyncSessionStorage.mjs","sources":["../../../src/storage/SyncSessionStorage.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { SyncKeyValueStorage } from './SyncKeyValueStorage';\nimport { getSessionStorageWithFallback } from './utils';\n/**\n * @internal\n */\nexport class SyncSessionStorage extends SyncKeyValueStorage {\n constructor() {\n super(getSessionStorageWithFallback());\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACO,MAAM,kBAAkB,SAAS,mBAAmB,CAAC;AAC5D,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,6BAA6B,EAAE,CAAC,CAAC;AAC/C,KAAK;AACL;;;;"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { DefaultStorage } from './DefaultStorage';
|
|
2
2
|
import { KeyValueStorage } from './KeyValueStorage';
|
|
3
3
|
import { SessionStorage } from './SessionStorage';
|
|
4
|
+
import { SyncSessionStorage } from './SyncSessionStorage';
|
|
4
5
|
export { CookieStorage } from './CookieStorage';
|
|
5
6
|
export declare const defaultStorage: DefaultStorage;
|
|
6
7
|
export declare const sessionStorage: SessionStorage;
|
|
8
|
+
export declare const syncSessionStorage: SyncSessionStorage;
|
|
7
9
|
export declare const sharedInMemoryStorage: KeyValueStorage;
|
|
@@ -2,13 +2,15 @@ import { DefaultStorage } from './DefaultStorage.mjs';
|
|
|
2
2
|
import { InMemoryStorage } from './InMemoryStorage.mjs';
|
|
3
3
|
import { KeyValueStorage } from './KeyValueStorage.mjs';
|
|
4
4
|
import { SessionStorage } from './SessionStorage.mjs';
|
|
5
|
+
import { SyncSessionStorage } from './SyncSessionStorage.mjs';
|
|
5
6
|
export { CookieStorage } from './CookieStorage.mjs';
|
|
6
7
|
|
|
7
8
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
8
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
10
|
const defaultStorage = new DefaultStorage();
|
|
10
11
|
const sessionStorage = new SessionStorage();
|
|
12
|
+
const syncSessionStorage = new SyncSessionStorage();
|
|
11
13
|
const sharedInMemoryStorage = new KeyValueStorage(new InMemoryStorage());
|
|
12
14
|
|
|
13
|
-
export { defaultStorage, sessionStorage, sharedInMemoryStorage };
|
|
15
|
+
export { defaultStorage, sessionStorage, sharedInMemoryStorage, syncSessionStorage };
|
|
14
16
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/storage/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DefaultStorage } from './DefaultStorage';\nimport { InMemoryStorage } from './InMemoryStorage';\nimport { KeyValueStorage } from './KeyValueStorage';\nimport { SessionStorage } from './SessionStorage';\nexport { CookieStorage } from './CookieStorage';\nexport const defaultStorage = new DefaultStorage();\nexport const sessionStorage = new SessionStorage();\nexport const sharedInMemoryStorage = new KeyValueStorage(new InMemoryStorage());\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/storage/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DefaultStorage } from './DefaultStorage';\nimport { InMemoryStorage } from './InMemoryStorage';\nimport { KeyValueStorage } from './KeyValueStorage';\nimport { SessionStorage } from './SessionStorage';\nimport { SyncSessionStorage } from './SyncSessionStorage';\nexport { CookieStorage } from './CookieStorage';\nexport const defaultStorage = new DefaultStorage();\nexport const sessionStorage = new SessionStorage();\nexport const syncSessionStorage = new SyncSessionStorage();\nexport const sharedInMemoryStorage = new KeyValueStorage(new InMemoryStorage());\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;AAOY,MAAC,cAAc,GAAG,IAAI,cAAc,GAAG;AACvC,MAAC,cAAc,GAAG,IAAI,cAAc,GAAG;AACvC,MAAC,kBAAkB,GAAG,IAAI,kBAAkB,GAAG;AAC/C,MAAC,qBAAqB,GAAG,IAAI,eAAe,CAAC,IAAI,eAAe,EAAE;;;;"}
|
|
@@ -15,3 +15,9 @@ export interface CookieStorageData {
|
|
|
15
15
|
secure?: boolean;
|
|
16
16
|
sameSite?: SameSite;
|
|
17
17
|
}
|
|
18
|
+
export interface SyncStorage {
|
|
19
|
+
setItem(key: string, value: string): void;
|
|
20
|
+
getItem(key: string): string | null;
|
|
21
|
+
removeItem(key: string): void;
|
|
22
|
+
clear(): void;
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.1-unstable.0ecded1.0+0ecded1",
|
|
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.1.7-unstable.
|
|
63
|
+
"@aws-amplify/react-native": "1.1.7-unstable.0ecded1.0+0ecded1",
|
|
64
64
|
"@types/js-cookie": "3.0.2",
|
|
65
65
|
"genversion": "^2.2.0",
|
|
66
66
|
"typescript": "5.0.2"
|
|
@@ -192,5 +192,5 @@
|
|
|
192
192
|
]
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
|
-
"gitHead": "
|
|
195
|
+
"gitHead": "0ecded15a4d1318fe10b16dbe534a111a12bdc21"
|
|
196
196
|
}
|
package/src/Platform/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '6.
|
|
2
|
+
export const version = '6.11.1-unstable.0ecded1.0+0ecded1';
|
package/src/index.ts
CHANGED
|
@@ -383,10 +383,22 @@ function createBucketInfoMap(
|
|
|
383
383
|
);
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
+
const sanitizedPaths = paths
|
|
387
|
+
? Object.entries(paths).reduce<
|
|
388
|
+
Record<string, Record<string, string[] | undefined>>
|
|
389
|
+
>((acc, [key, value]) => {
|
|
390
|
+
if (value !== undefined) {
|
|
391
|
+
acc[key] = value;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
return acc;
|
|
395
|
+
}, {})
|
|
396
|
+
: undefined;
|
|
397
|
+
|
|
386
398
|
mappedBuckets[name] = {
|
|
387
399
|
bucketName,
|
|
388
400
|
region,
|
|
389
|
-
paths,
|
|
401
|
+
paths: sanitizedPaths,
|
|
390
402
|
};
|
|
391
403
|
},
|
|
392
404
|
);
|
|
@@ -53,7 +53,7 @@ export interface AmplifyOutputsStorageBucketProperties {
|
|
|
53
53
|
/** Region for the bucket */
|
|
54
54
|
aws_region: string;
|
|
55
55
|
/** Paths to object with access permissions */
|
|
56
|
-
paths?: Record<string, Record<string, string[] | undefined
|
|
56
|
+
paths?: Partial<Record<string, Record<string, string[] | undefined>>>;
|
|
57
57
|
}
|
|
58
58
|
export interface AmplifyOutputsStorageProperties {
|
|
59
59
|
/** Default region for Storage */
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { PlatformNotSupportedError } from '../errors';
|
|
5
|
+
import { SyncStorage } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export class SyncKeyValueStorage implements SyncStorage {
|
|
11
|
+
_storage?: Storage;
|
|
12
|
+
|
|
13
|
+
constructor(storage?: Storage) {
|
|
14
|
+
this._storage = storage;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get storage() {
|
|
18
|
+
if (!this._storage) throw new PlatformNotSupportedError();
|
|
19
|
+
|
|
20
|
+
return this._storage;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* This is used to set a specific item in storage
|
|
25
|
+
* @param {string} key - the key for the item
|
|
26
|
+
* @param {object} value - the value
|
|
27
|
+
* @returns {string} value that was set
|
|
28
|
+
*/
|
|
29
|
+
setItem(key: string, value: string) {
|
|
30
|
+
this.storage.setItem(key, value);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* This is used to get a specific key from storage
|
|
35
|
+
* @param {string} key - the key for the item
|
|
36
|
+
* This is used to clear the storage
|
|
37
|
+
* @returns {string} the data item
|
|
38
|
+
*/
|
|
39
|
+
getItem(key: string) {
|
|
40
|
+
return this.storage.getItem(key);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* This is used to remove an item from storage
|
|
45
|
+
* @param {string} key - the key being set
|
|
46
|
+
* @returns {string} value - value that was deleted
|
|
47
|
+
*/
|
|
48
|
+
removeItem(key: string) {
|
|
49
|
+
this.storage.removeItem(key);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* This is used to clear the storage
|
|
54
|
+
* @returns {string} nothing
|
|
55
|
+
*/
|
|
56
|
+
clear() {
|
|
57
|
+
this.storage.clear();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { SyncKeyValueStorage } from './SyncKeyValueStorage';
|
|
5
|
+
import { getSessionStorageWithFallback } from './utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export class SyncSessionStorage extends SyncKeyValueStorage {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(getSessionStorageWithFallback());
|
|
13
|
+
}
|
|
14
|
+
}
|
package/src/storage/index.ts
CHANGED
|
@@ -5,9 +5,11 @@ import { DefaultStorage } from './DefaultStorage';
|
|
|
5
5
|
import { InMemoryStorage } from './InMemoryStorage';
|
|
6
6
|
import { KeyValueStorage } from './KeyValueStorage';
|
|
7
7
|
import { SessionStorage } from './SessionStorage';
|
|
8
|
+
import { SyncSessionStorage } from './SyncSessionStorage';
|
|
8
9
|
|
|
9
10
|
export { CookieStorage } from './CookieStorage';
|
|
10
11
|
|
|
11
12
|
export const defaultStorage = new DefaultStorage();
|
|
12
13
|
export const sessionStorage = new SessionStorage();
|
|
14
|
+
export const syncSessionStorage = new SyncSessionStorage();
|
|
13
15
|
export const sharedInMemoryStorage = new KeyValueStorage(new InMemoryStorage());
|
package/src/types/storage.ts
CHANGED
|
@@ -21,3 +21,10 @@ export interface CookieStorageData {
|
|
|
21
21
|
secure?: boolean;
|
|
22
22
|
sameSite?: SameSite;
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
export interface SyncStorage {
|
|
26
|
+
setItem(key: string, value: string): void;
|
|
27
|
+
getItem(key: string): string | null;
|
|
28
|
+
removeItem(key: string): void;
|
|
29
|
+
clear(): void;
|
|
30
|
+
}
|