@aws-amplify/core 6.0.1-console-preview.814dea6.0 → 6.0.1-console-preview.7739091.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/lib/Cache/Utils/CacheUtils.js +2 -4
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/RNComponents/index.d.ts +1 -1
- package/lib/RNComponents/index.js +4 -4
- package/lib/ServiceWorker/ServiceWorker.js +1 -1
- package/lib/Util/JS.d.ts +1 -4
- package/lib/Util/JS.js +4 -11
- package/lib/Util/Reachability.js +0 -3
- package/lib/clients/handlers/fetch.d.ts +0 -1
- package/lib/clients/handlers/fetch.js +0 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +6 -8
- package/lib/libraryUtils.d.ts +1 -2
- package/lib/libraryUtils.js +3 -6
- package/lib/parseAWSExports.js +20 -1
- package/lib/providers/pinpoint/apis/record.d.ts +2 -2
- package/lib/providers/pinpoint/apis/record.js +3 -3
- package/lib/providers/pinpoint/apis/updateEndpoint.d.ts +2 -2
- package/lib/providers/pinpoint/types/pinpoint.d.ts +2 -2
- package/lib/singleton/API/types.d.ts +34 -0
- package/lib/singleton/API/types.js +2 -0
- package/lib/singleton/Storage/types.d.ts +5 -0
- package/lib/singleton/types.d.ts +4 -1
- package/lib/{StorageHelper/cookieStorage.d.ts → storage/CookieStorage.d.ts} +4 -3
- package/lib/{StorageHelper/cookieStorage.js → storage/CookieStorage.js} +35 -83
- package/lib/storage/CookieStorage.native.d.ts +7 -0
- package/lib/storage/CookieStorage.native.js +32 -0
- package/lib/storage/DefaultStorage.d.ts +7 -0
- package/lib/storage/DefaultStorage.js +33 -0
- package/{lib-esm/StorageHelper/localStorage.d.ts → lib/storage/DefaultStorage.native.d.ts} +7 -6
- package/lib/{StorageHelper/sessionStorage.js → storage/DefaultStorage.native.js} +46 -43
- package/lib/storage/InMemoryStorage.d.ts +12 -0
- package/lib/storage/InMemoryStorage.js +41 -0
- package/lib/{StorageHelper/sessionStorage.d.ts → storage/KeyValueStorage.d.ts} +5 -4
- package/lib/{StorageHelper/localStorage.js → storage/KeyValueStorage.js} +13 -15
- package/lib/storage/SessionStorage.d.ts +7 -0
- package/lib/storage/SessionStorage.js +33 -0
- package/lib/storage/index.d.ts +7 -0
- package/lib/storage/index.js +14 -0
- package/lib/storage/utils.d.ts +10 -0
- package/lib/storage/utils.js +26 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/storage.d.ts +3 -0
- package/lib-esm/Cache/Utils/CacheUtils.js +2 -4
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/RNComponents/index.d.ts +1 -1
- package/lib-esm/RNComponents/index.js +5 -5
- package/lib-esm/ServiceWorker/ServiceWorker.js +2 -2
- package/lib-esm/Util/JS.d.ts +1 -4
- package/lib-esm/Util/JS.js +2 -9
- package/lib-esm/Util/Reachability.js +1 -4
- package/lib-esm/clients/handlers/fetch.d.ts +0 -1
- package/lib-esm/clients/handlers/fetch.js +0 -1
- package/lib-esm/index.d.ts +1 -1
- package/lib-esm/index.js +1 -1
- package/lib-esm/libraryUtils.d.ts +1 -2
- package/lib-esm/libraryUtils.js +1 -2
- package/lib-esm/parseAWSExports.js +20 -1
- package/lib-esm/providers/pinpoint/apis/record.d.ts +2 -2
- package/lib-esm/providers/pinpoint/apis/record.js +3 -3
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.d.ts +2 -2
- package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +2 -2
- package/lib-esm/singleton/API/types.d.ts +34 -0
- package/lib-esm/singleton/API/types.js +1 -0
- package/lib-esm/singleton/Storage/types.d.ts +5 -0
- package/lib-esm/singleton/types.d.ts +4 -1
- package/lib-esm/{StorageHelper/cookieStorage.d.ts → storage/CookieStorage.d.ts} +4 -3
- package/lib-esm/{StorageHelper/cookieStorage.js → storage/CookieStorage.js} +36 -61
- package/lib-esm/storage/CookieStorage.native.d.ts +7 -0
- package/lib-esm/storage/CookieStorage.native.js +29 -0
- package/lib-esm/storage/DefaultStorage.d.ts +7 -0
- package/lib-esm/storage/DefaultStorage.js +30 -0
- package/{lib/StorageHelper/localStorage.d.ts → lib-esm/storage/DefaultStorage.native.d.ts} +7 -6
- package/lib-esm/{StorageHelper/sessionStorage.js → storage/DefaultStorage.native.js} +45 -42
- package/lib-esm/storage/InMemoryStorage.d.ts +12 -0
- package/lib-esm/storage/InMemoryStorage.js +38 -0
- package/lib-esm/{StorageHelper/sessionStorage.d.ts → storage/KeyValueStorage.d.ts} +5 -4
- package/lib-esm/{StorageHelper/localStorage.js → storage/KeyValueStorage.js} +12 -14
- package/lib-esm/storage/SessionStorage.d.ts +7 -0
- package/lib-esm/storage/SessionStorage.js +30 -0
- package/lib-esm/storage/index.d.ts +7 -0
- package/lib-esm/storage/index.js +10 -0
- package/lib-esm/storage/utils.d.ts +10 -0
- package/lib-esm/storage/utils.js +21 -0
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/storage.d.ts +3 -0
- package/package.json +3 -5
- package/src/Cache/Utils/CacheUtils.ts +2 -4
- package/src/Platform/version.ts +1 -1
- package/src/RNComponents/index.ts +5 -5
- package/src/ServiceWorker/ServiceWorker.ts +2 -2
- package/src/Util/JS.ts +2 -13
- package/src/Util/Reachability.ts +1 -5
- package/src/clients/handlers/fetch.ts +0 -1
- package/src/index.ts +4 -6
- package/src/libraryUtils.ts +1 -2
- package/src/parseAWSExports.ts +26 -0
- package/src/providers/pinpoint/apis/record.ts +8 -8
- package/src/providers/pinpoint/apis/updateEndpoint.ts +2 -2
- package/src/providers/pinpoint/types/pinpoint.ts +7 -6
- package/src/singleton/API/types.ts +31 -0
- package/src/singleton/Storage/types.ts +6 -2
- package/src/singleton/types.ts +4 -1
- package/src/storage/CookieStorage.native.ts +13 -0
- package/src/storage/CookieStorage.ts +72 -0
- package/src/storage/DefaultStorage.native.ts +78 -0
- package/src/storage/DefaultStorage.ts +14 -0
- package/src/storage/InMemoryStorage.ts +36 -0
- package/src/{StorageHelper/sessionStorage.ts → storage/KeyValueStorage.ts} +10 -13
- package/src/storage/SessionStorage.ts +14 -0
- package/src/storage/index.ts +13 -0
- package/src/storage/utils.ts +22 -0
- package/src/types/storage.ts +4 -0
- package/lib/OAuthHelper/FacebookOAuth.d.ts +0 -6
- package/lib/OAuthHelper/FacebookOAuth.js +0 -124
- package/lib/OAuthHelper/GoogleOAuth.d.ts +0 -6
- package/lib/OAuthHelper/GoogleOAuth.js +0 -134
- package/lib/OAuthHelper/index.d.ts +0 -4
- package/lib/OAuthHelper/index.js +0 -9
- package/lib/StorageHelper/inMemoryStorage.d.ts +0 -10
- package/lib/StorageHelper/inMemoryStorage.js +0 -82
- package/lib/StorageHelper/index.d.ts +0 -45
- package/lib/StorageHelper/index.js +0 -83
- package/lib/StorageHelper/reactnative.d.ts +0 -83
- package/lib/StorageHelper/reactnative.js +0 -250
- package/lib-esm/OAuthHelper/FacebookOAuth.d.ts +0 -6
- package/lib-esm/OAuthHelper/FacebookOAuth.js +0 -121
- package/lib-esm/OAuthHelper/GoogleOAuth.d.ts +0 -6
- package/lib-esm/OAuthHelper/GoogleOAuth.js +0 -131
- package/lib-esm/OAuthHelper/index.d.ts +0 -4
- package/lib-esm/OAuthHelper/index.js +0 -6
- package/lib-esm/StorageHelper/inMemoryStorage.d.ts +0 -10
- package/lib-esm/StorageHelper/inMemoryStorage.js +0 -79
- package/lib-esm/StorageHelper/index.d.ts +0 -45
- package/lib-esm/StorageHelper/index.js +0 -76
- package/lib-esm/StorageHelper/reactnative.d.ts +0 -83
- package/lib-esm/StorageHelper/reactnative.js +0 -244
- package/src/OAuthHelper/FacebookOAuth.ts +0 -83
- package/src/OAuthHelper/GoogleOAuth.ts +0 -97
- package/src/OAuthHelper/index.ts +0 -7
- package/src/StorageHelper/cookieStorage.ts +0 -99
- package/src/StorageHelper/inMemoryStorage.ts +0 -32
- package/src/StorageHelper/index.ts +0 -78
- package/src/StorageHelper/localStorage.ts +0 -60
- package/src/StorageHelper/reactnative.ts +0 -182
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.getCurrSizeKey = exports.CacheObject = exports.isInteger = exports.getCurrTime = exports.getByteLength = exports.defaultConfig = void 0;
|
|
6
|
-
var
|
|
6
|
+
var utils_1 = require("../../storage/utils");
|
|
7
7
|
/**
|
|
8
8
|
* Default cache config
|
|
9
9
|
*/
|
|
@@ -14,9 +14,7 @@ exports.defaultConfig = {
|
|
|
14
14
|
defaultTTL: 259200000,
|
|
15
15
|
defaultPriority: 5,
|
|
16
16
|
warningThreshold: 0.8,
|
|
17
|
-
|
|
18
|
-
// if not, will use a in-memory object instead
|
|
19
|
-
storage: new StorageHelper_1.StorageHelper().getStorage(),
|
|
17
|
+
storage: (0, utils_1.getDefaultStorageWithFallback)(),
|
|
20
18
|
};
|
|
21
19
|
/**
|
|
22
20
|
* return the byte size of the string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.1-console-preview.
|
|
1
|
+
export declare const version = "6.0.1-console-preview.7739091.0+7739091";
|
package/lib/Platform/version.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.AsyncStorage = exports.AppState = exports.Linking = void 0;
|
|
6
|
+
var utils_1 = require("../storage/utils");
|
|
6
7
|
var JS_1 = require("../Util/JS");
|
|
7
|
-
var StorageHelper_1 = require("../StorageHelper");
|
|
8
8
|
exports.Linking = {};
|
|
9
9
|
exports.AppState = {
|
|
10
10
|
addEventListener: function (action, handler) { return undefined; },
|
|
11
|
-
currentState: 'active'
|
|
11
|
+
currentState: 'active',
|
|
12
12
|
};
|
|
13
13
|
// if not in react native, just use local storage
|
|
14
|
-
exports.AsyncStorage = (0, JS_1.
|
|
15
|
-
?
|
|
14
|
+
exports.AsyncStorage = (0, JS_1.isBrowser)()
|
|
15
|
+
? (0, utils_1.getDefaultStorageWithFallback)()
|
|
16
16
|
: undefined;
|
|
@@ -127,7 +127,7 @@ var ServiceWorkerClass = /** @class */ (function () {
|
|
|
127
127
|
});
|
|
128
128
|
this._publicKey = publicKey;
|
|
129
129
|
return new Promise(function (resolve, reject) {
|
|
130
|
-
if ((0, JS_1.
|
|
130
|
+
if ((0, JS_1.isBrowser)()) {
|
|
131
131
|
(0, AssertError_1.asserts)(_this._registration !== undefined, {
|
|
132
132
|
name: Constants_1.SERVICE_WORKER_EXCEPTION,
|
|
133
133
|
message: 'Service Worker registration is undefined',
|
package/lib/Util/JS.d.ts
CHANGED
|
@@ -6,10 +6,7 @@ export declare const isTextFile: (contentType: string) => boolean;
|
|
|
6
6
|
export declare const generateRandomString: () => string;
|
|
7
7
|
export declare const makeQuerablePromise: (promise: any) => any;
|
|
8
8
|
export declare const isWebWorker: () => boolean;
|
|
9
|
-
export declare const
|
|
10
|
-
isBrowser: boolean;
|
|
11
|
-
isNode: boolean;
|
|
12
|
-
};
|
|
9
|
+
export declare const isBrowser: () => boolean;
|
|
13
10
|
/**
|
|
14
11
|
* transfer the first letter of the keys to lowercase
|
|
15
12
|
* @param {Object} obj - the object need to be transferred
|
package/lib/Util/JS.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.isStrictObject = exports.transferKeyToUpperCase = exports.transferKeyToLowerCase = exports.
|
|
5
|
+
exports.isStrictObject = exports.transferKeyToUpperCase = exports.transferKeyToLowerCase = exports.isBrowser = exports.isWebWorker = exports.makeQuerablePromise = exports.generateRandomString = exports.isTextFile = exports.filenameToContentType = exports.objectLessAttributes = exports.sortByField = exports.isEmpty = void 0;
|
|
6
6
|
var MIME_MAP = [
|
|
7
7
|
{ type: 'text/plain', ext: 'txt' },
|
|
8
8
|
{ type: 'text/html', ext: 'html' },
|
|
@@ -144,17 +144,10 @@ var isWebWorker = function () {
|
|
|
144
144
|
self instanceof selfContext.WorkerGlobalScope);
|
|
145
145
|
};
|
|
146
146
|
exports.isWebWorker = isWebWorker;
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
var isNode = typeof process !== 'undefined' &&
|
|
150
|
-
process.versions != null &&
|
|
151
|
-
process.versions.node != null;
|
|
152
|
-
return {
|
|
153
|
-
isBrowser: isBrowser,
|
|
154
|
-
isNode: isNode,
|
|
155
|
-
};
|
|
147
|
+
var isBrowser = function () {
|
|
148
|
+
return typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
156
149
|
};
|
|
157
|
-
exports.
|
|
150
|
+
exports.isBrowser = isBrowser;
|
|
158
151
|
/**
|
|
159
152
|
* transfer the first letter of the keys to lowercase
|
|
160
153
|
* @param {Object} obj - the object need to be transferred
|
package/lib/Util/Reachability.js
CHANGED
|
@@ -22,9 +22,6 @@ var ReachabilityNavigator = /** @class */ (function () {
|
|
|
22
22
|
function ReachabilityNavigator() {
|
|
23
23
|
}
|
|
24
24
|
ReachabilityNavigator.prototype.networkMonitor = function (netInfo) {
|
|
25
|
-
if ((0, JS_1.browserOrNode)().isNode) {
|
|
26
|
-
return zen_observable_ts_1.default.from([{ online: true }]);
|
|
27
|
-
}
|
|
28
25
|
var globalObj = (0, JS_1.isWebWorker)() ? self : window;
|
|
29
26
|
return new zen_observable_ts_1.default(function (observer) {
|
|
30
27
|
observer.next({ online: globalObj.navigator.onLine });
|
|
@@ -50,7 +50,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
};
|
|
51
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
52
|
exports.fetchTransferHandler = void 0;
|
|
53
|
-
require("isomorphic-unfetch"); // TODO: remove this dependency in v6
|
|
54
53
|
var memoization_1 = require("../utils/memoization");
|
|
55
54
|
var shouldSendBody = function (method) {
|
|
56
55
|
return !['HEAD', 'GET', 'DELETE'].includes(method.toUpperCase());
|
package/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, Stor
|
|
|
5
5
|
export { Amplify, fetchAuthSession, AmplifyClass as AmplifyClassV6, clearCredentials, } from './singleton';
|
|
6
6
|
export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './AwsClients/CognitoIdentity';
|
|
7
7
|
export { UserProfile } from './types';
|
|
8
|
-
export {
|
|
8
|
+
export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
|
|
9
9
|
export { KeyValueStorageInterface } from './types';
|
|
10
10
|
import { BrowserStorageCache } from './Cache/BrowserStorageCache';
|
|
11
11
|
export { InMemoryCache } from './Cache/InMemoryCache';
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.parseAWSExports = exports.I18n = exports.Cache = exports.BrowserStorageCache = exports.InMemoryCache = exports.
|
|
5
|
+
exports.parseAWSExports = exports.I18n = exports.Cache = exports.BrowserStorageCache = exports.InMemoryCache = exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.Hub = void 0;
|
|
6
6
|
/*
|
|
7
7
|
This file maps top-level exports from `@aws-amplify/core`. These are intended to be potentially customer-facing exports.
|
|
8
8
|
*/
|
|
@@ -19,13 +19,11 @@ var CognitoIdentity_1 = require("./AwsClients/CognitoIdentity");
|
|
|
19
19
|
Object.defineProperty(exports, "getCredentialsForIdentity", { enumerable: true, get: function () { return CognitoIdentity_1.getCredentialsForIdentity; } });
|
|
20
20
|
Object.defineProperty(exports, "getId", { enumerable: true, get: function () { return CognitoIdentity_1.getId; } });
|
|
21
21
|
// Storage helpers
|
|
22
|
-
var
|
|
23
|
-
Object.defineProperty(exports, "
|
|
24
|
-
Object.defineProperty(exports, "
|
|
25
|
-
Object.defineProperty(exports, "
|
|
26
|
-
Object.defineProperty(exports, "
|
|
27
|
-
Object.defineProperty(exports, "SessionStorage", { enumerable: true, get: function () { return StorageHelper_1.SessionStorage; } });
|
|
28
|
-
Object.defineProperty(exports, "MemoryKeyValueStorage", { enumerable: true, get: function () { return StorageHelper_1.MemoryKeyValueStorage; } });
|
|
22
|
+
var storage_1 = require("./storage");
|
|
23
|
+
Object.defineProperty(exports, "CookieStorage", { enumerable: true, get: function () { return storage_1.CookieStorage; } });
|
|
24
|
+
Object.defineProperty(exports, "defaultStorage", { enumerable: true, get: function () { return storage_1.defaultStorage; } });
|
|
25
|
+
Object.defineProperty(exports, "sessionStorage", { enumerable: true, get: function () { return storage_1.sessionStorage; } });
|
|
26
|
+
Object.defineProperty(exports, "sharedInMemoryStorage", { enumerable: true, get: function () { return storage_1.sharedInMemoryStorage; } });
|
|
29
27
|
// Cache exports
|
|
30
28
|
var BrowserStorageCache_1 = require("./Cache/BrowserStorageCache");
|
|
31
29
|
Object.defineProperty(exports, "BrowserStorageCache", { enumerable: true, get: function () { return BrowserStorageCache_1.BrowserStorageCache; } });
|
package/lib/libraryUtils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { isBrowser, filenameToContentType, generateRandomString, isEmpty, isStrictObject, isTextFile, isWebWorker, makeQuerablePromise, objectLessAttributes, sortByField, transferKeyToLowerCase, transferKeyToUpperCase, } from './Util/JS';
|
|
2
2
|
export { JWT, StrictUnion, CognitoIdentityPoolConfig, } from './singleton/Auth/types';
|
|
3
3
|
export { decodeJWT, assertTokenProviderConfig, assertIdentityPooIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
|
|
4
4
|
export { isTokenExpired } from './singleton/Auth';
|
|
@@ -14,7 +14,6 @@ export { ServiceWorker } from './ServiceWorker';
|
|
|
14
14
|
export { AWS_CLOUDWATCH_CATEGORY, BackgroundManagerNotOpenError, BackgroundProcessManager, BackgroundProcessManagerState, DateUtils, Mutex, NO_CREDS_ERROR_STRING, NonRetryableError, RETRY_ERROR_CODES, Reachability, isNonRetryableError, jitteredBackoff, jitteredExponentialRetry, retry, urlSafeDecode, urlSafeEncode, } from './Util';
|
|
15
15
|
export { asserts } from './Util/errors/AssertError';
|
|
16
16
|
export { invalidParameter, missingConfig, AmplifyError, AmplifyErrorString, } from './Util/Errors';
|
|
17
|
-
export { FacebookOAuth, GoogleOAuth } from './OAuthHelper';
|
|
18
17
|
export { AppState, AsyncStorage, Linking } from './RNComponents';
|
|
19
18
|
export { ErrorParams, AmplifyErrorMap, ServiceError } from './types';
|
|
20
19
|
export { INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, } from './Util/Constants';
|
package/lib/libraryUtils.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.isNonRetryableError = exports.Reachability = exports.RETRY_ERROR_CODES = exports.NonRetryableError = exports.NO_CREDS_ERROR_STRING = exports.Mutex = exports.DateUtils = exports.BackgroundProcessManagerState = exports.BackgroundProcessManager = exports.BackgroundManagerNotOpenError = exports.AWS_CLOUDWATCH_CATEGORY = exports.ServiceWorker = exports.Constants = exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InAppMessagingAction = exports.InteractionsAction = exports.GeoAction = exports.Framework = exports.DataStoreAction = exports.Category = exports.AnalyticsAction = exports.AuthAction = exports.ApiAction = exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platform = exports.ClientDevice = exports.Logger = exports.ConsoleLogger = exports.Signer = exports.isTokenExpired = exports.assertOAuthConfig = exports.assertIdentityPooIdConfig = exports.assertTokenProviderConfig = exports.decodeJWT = exports.transferKeyToUpperCase = exports.transferKeyToLowerCase = exports.sortByField = exports.objectLessAttributes = exports.makeQuerablePromise = exports.isWebWorker = exports.isTextFile = exports.isStrictObject = exports.isEmpty = exports.generateRandomString = exports.filenameToContentType = exports.
|
|
6
|
-
exports.AMPLIFY_SYMBOL = exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.Linking = exports.AsyncStorage = exports.AppState = exports.
|
|
5
|
+
exports.isNonRetryableError = exports.Reachability = exports.RETRY_ERROR_CODES = exports.NonRetryableError = exports.NO_CREDS_ERROR_STRING = exports.Mutex = exports.DateUtils = exports.BackgroundProcessManagerState = exports.BackgroundProcessManager = exports.BackgroundManagerNotOpenError = exports.AWS_CLOUDWATCH_CATEGORY = exports.ServiceWorker = exports.Constants = exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InAppMessagingAction = exports.InteractionsAction = exports.GeoAction = exports.Framework = exports.DataStoreAction = exports.Category = exports.AnalyticsAction = exports.AuthAction = exports.ApiAction = exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platform = exports.ClientDevice = exports.Logger = exports.ConsoleLogger = exports.Signer = exports.isTokenExpired = exports.assertOAuthConfig = exports.assertIdentityPooIdConfig = exports.assertTokenProviderConfig = exports.decodeJWT = exports.transferKeyToUpperCase = exports.transferKeyToLowerCase = exports.sortByField = exports.objectLessAttributes = exports.makeQuerablePromise = exports.isWebWorker = exports.isTextFile = exports.isStrictObject = exports.isEmpty = exports.generateRandomString = exports.filenameToContentType = exports.isBrowser = void 0;
|
|
6
|
+
exports.AMPLIFY_SYMBOL = exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.Linking = exports.AsyncStorage = exports.AppState = exports.AmplifyErrorString = exports.AmplifyError = exports.missingConfig = exports.invalidParameter = exports.asserts = exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.jitteredExponentialRetry = exports.jitteredBackoff = void 0;
|
|
7
7
|
/*
|
|
8
8
|
This file maps top-level exports from `@aws-amplify/core/internals/utils`. These are intended to be internal
|
|
9
9
|
utils for use throughout the library.
|
|
10
10
|
*/
|
|
11
11
|
// JS utilities
|
|
12
12
|
var JS_1 = require("./Util/JS");
|
|
13
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "isBrowser", { enumerable: true, get: function () { return JS_1.isBrowser; } });
|
|
14
14
|
Object.defineProperty(exports, "filenameToContentType", { enumerable: true, get: function () { return JS_1.filenameToContentType; } });
|
|
15
15
|
Object.defineProperty(exports, "generateRandomString", { enumerable: true, get: function () { return JS_1.generateRandomString; } });
|
|
16
16
|
Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return JS_1.isEmpty; } });
|
|
@@ -89,9 +89,6 @@ Object.defineProperty(exports, "invalidParameter", { enumerable: true, get: func
|
|
|
89
89
|
Object.defineProperty(exports, "missingConfig", { enumerable: true, get: function () { return Errors_1.missingConfig; } });
|
|
90
90
|
Object.defineProperty(exports, "AmplifyError", { enumerable: true, get: function () { return Errors_1.AmplifyError; } });
|
|
91
91
|
Object.defineProperty(exports, "AmplifyErrorString", { enumerable: true, get: function () { return Errors_1.AmplifyErrorString; } });
|
|
92
|
-
var OAuthHelper_1 = require("./OAuthHelper");
|
|
93
|
-
Object.defineProperty(exports, "FacebookOAuth", { enumerable: true, get: function () { return OAuthHelper_1.FacebookOAuth; } });
|
|
94
|
-
Object.defineProperty(exports, "GoogleOAuth", { enumerable: true, get: function () { return OAuthHelper_1.GoogleOAuth; } });
|
|
95
92
|
var RNComponents_1 = require("./RNComponents");
|
|
96
93
|
Object.defineProperty(exports, "AppState", { enumerable: true, get: function () { return RNComponents_1.AppState; } });
|
|
97
94
|
Object.defineProperty(exports, "AsyncStorage", { enumerable: true, get: function () { return RNComponents_1.AsyncStorage; } });
|
package/lib/parseAWSExports.js
CHANGED
|
@@ -12,6 +12,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.parseAWSExports = void 0;
|
|
15
|
+
var authTypeMapping = {
|
|
16
|
+
API_KEY: 'apiKey',
|
|
17
|
+
AWS_IAM: 'iam',
|
|
18
|
+
AMAZON_COGNITO_USER_POOLS: 'jwt',
|
|
19
|
+
};
|
|
15
20
|
/**
|
|
16
21
|
* This utility converts the `aws-exports.js` file generated by the Amplify CLI into a {@link ResourcesConfig} object
|
|
17
22
|
* consumable by Amplify.
|
|
@@ -22,7 +27,7 @@ exports.parseAWSExports = void 0;
|
|
|
22
27
|
*/
|
|
23
28
|
var parseAWSExports = function (config) {
|
|
24
29
|
if (config === void 0) { config = {}; }
|
|
25
|
-
var aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth;
|
|
30
|
+
var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth;
|
|
26
31
|
var amplifyConfig = {};
|
|
27
32
|
// Analytics
|
|
28
33
|
if (aws_mobile_analytics_app_id) {
|
|
@@ -33,6 +38,20 @@ var parseAWSExports = function (config) {
|
|
|
33
38
|
},
|
|
34
39
|
};
|
|
35
40
|
}
|
|
41
|
+
// TODO: Need to support all API configurations
|
|
42
|
+
// API
|
|
43
|
+
if (aws_appsync_graphqlEndpoint) {
|
|
44
|
+
amplifyConfig.API = {
|
|
45
|
+
AppSync: {
|
|
46
|
+
defaultAuthMode: {
|
|
47
|
+
type: authTypeMapping[aws_appsync_authenticationType],
|
|
48
|
+
apiKey: aws_appsync_apiKey,
|
|
49
|
+
},
|
|
50
|
+
endpoint: aws_appsync_graphqlEndpoint,
|
|
51
|
+
region: aws_appsync_region,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
36
55
|
// Auth
|
|
37
56
|
if (aws_cognito_identity_pool_id || aws_user_pools_id) {
|
|
38
57
|
amplifyConfig.Auth = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PinpointRecordInput } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare const record: ({ appId, category, credentials, event, identityId, region, userAgentValue, }:
|
|
5
|
+
export declare const record: ({ appId, category, credentials, event, identityId, region, userAgentValue, }: PinpointRecordInput) => Promise<void>;
|
|
@@ -71,7 +71,7 @@ var record = function (_a) {
|
|
|
71
71
|
identityId: identityId,
|
|
72
72
|
region: region,
|
|
73
73
|
resendLimit: constants_1.RESEND_LIMIT,
|
|
74
|
-
userAgentValue: userAgentValue
|
|
74
|
+
userAgentValue: userAgentValue,
|
|
75
75
|
});
|
|
76
76
|
if (!!endpointId) return [3 /*break*/, 4];
|
|
77
77
|
return [4 /*yield*/, (0, updateEndpoint_1.updateEndpoint)({
|
|
@@ -92,7 +92,7 @@ var record = function (_a) {
|
|
|
92
92
|
if (!endpointId) {
|
|
93
93
|
throw new libraryUtils_1.AmplifyError({
|
|
94
94
|
name: 'ENDPOINT_NOT_CREATED',
|
|
95
|
-
message: 'Endpoint was not created.'
|
|
95
|
+
message: 'Endpoint was not created.',
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
// Generate session if required
|
|
@@ -110,7 +110,7 @@ var record = function (_a) {
|
|
|
110
110
|
event: event,
|
|
111
111
|
session: session,
|
|
112
112
|
timestamp: timestampISOString,
|
|
113
|
-
resendLimit: constants_1.RESEND_LIMIT
|
|
113
|
+
resendLimit: constants_1.RESEND_LIMIT,
|
|
114
114
|
});
|
|
115
115
|
return [2 /*return*/];
|
|
116
116
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PinpointUpdateEndpointInput } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare const updateEndpoint: ({ address, appId, category, channelType, credentials, identityId, optOut, region, userId, userProfile, userAgentValue, }:
|
|
5
|
+
export declare const updateEndpoint: ({ address, appId, category, channelType, credentials, identityId, optOut, region, userId, userProfile, userAgentValue, }: PinpointUpdateEndpointInput) => Promise<void>;
|
|
@@ -29,12 +29,12 @@ type PinpointCommonParameters = {
|
|
|
29
29
|
region: string;
|
|
30
30
|
userAgentValue?: string;
|
|
31
31
|
};
|
|
32
|
-
export type
|
|
32
|
+
export type PinpointUpdateEndpointInput = PinpointCommonParameters & PinpointServiceOptions & {
|
|
33
33
|
channelType?: SupportedChannelType;
|
|
34
34
|
userId?: string;
|
|
35
35
|
userProfile?: UserProfile;
|
|
36
36
|
};
|
|
37
|
-
export type
|
|
37
|
+
export type PinpointRecordInput = PinpointCommonParameters & {
|
|
38
38
|
event: PinpointAnalyticsEvent;
|
|
39
39
|
};
|
|
40
40
|
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type LibraryAPIOptions = {
|
|
2
|
+
AppSync: {
|
|
3
|
+
query: string;
|
|
4
|
+
variables?: object;
|
|
5
|
+
authMode?: any;
|
|
6
|
+
authToken?: string;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated This property should not be used
|
|
9
|
+
*/
|
|
10
|
+
userAgentSuffix?: string;
|
|
11
|
+
};
|
|
12
|
+
customHeaders: Function;
|
|
13
|
+
};
|
|
14
|
+
export type APIConfig = {
|
|
15
|
+
AppSync?: {
|
|
16
|
+
defaultAuthMode?: GraphQLAuthMode;
|
|
17
|
+
region?: string;
|
|
18
|
+
endpoint?: string;
|
|
19
|
+
modelIntrospectionSchema?: any;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type GraphQLAuthMode = {
|
|
23
|
+
type: 'apiKey';
|
|
24
|
+
apiKey: string;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'jwt';
|
|
27
|
+
token: 'id' | 'access';
|
|
28
|
+
} | {
|
|
29
|
+
type: 'iam';
|
|
30
|
+
} | {
|
|
31
|
+
type: 'lambda';
|
|
32
|
+
} | {
|
|
33
|
+
type: 'custom';
|
|
34
|
+
};
|
package/lib/singleton/types.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import { APIConfig, LibraryAPIOptions } from './API/types';
|
|
1
2
|
import { AnalyticsConfig } from './Analytics/types';
|
|
2
3
|
import { AuthConfig, LibraryAuthOptions, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, CognitoIdentityPoolConfig } from './Auth/types';
|
|
3
4
|
import { LibraryStorageOptions, StorageAccessLevel, StorageConfig } from './Storage/types';
|
|
4
5
|
export type ResourcesConfig = {
|
|
6
|
+
API?: APIConfig;
|
|
5
7
|
Analytics?: AnalyticsConfig;
|
|
6
8
|
Auth?: AuthConfig;
|
|
7
9
|
Storage?: StorageConfig;
|
|
8
10
|
};
|
|
9
11
|
export type LibraryOptions = {
|
|
12
|
+
API?: LibraryAPIOptions;
|
|
10
13
|
Auth?: LibraryAuthOptions;
|
|
11
14
|
Storage?: LibraryStorageOptions;
|
|
12
15
|
ssr?: boolean;
|
|
13
16
|
};
|
|
14
|
-
export { AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, };
|
|
17
|
+
export { APIConfig, AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { CookieStorageData, KeyValueStorageInterface, SameSite } from '../types';
|
|
2
2
|
export declare class CookieStorage implements KeyValueStorageInterface {
|
|
3
|
-
domain?: string;
|
|
4
3
|
path: string;
|
|
4
|
+
domain?: string;
|
|
5
5
|
expires?: number;
|
|
6
|
-
secure?: boolean;
|
|
7
6
|
sameSite?: SameSite;
|
|
7
|
+
secure?: boolean;
|
|
8
8
|
constructor(data?: CookieStorageData);
|
|
9
9
|
setItem(key: string, value: string): Promise<void>;
|
|
10
|
-
getItem(key: string): Promise<string>;
|
|
10
|
+
getItem(key: string): Promise<string | null>;
|
|
11
11
|
removeItem(key: string): Promise<void>;
|
|
12
12
|
clear(): Promise<void>;
|
|
13
|
+
private getData;
|
|
13
14
|
}
|
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
var __assign = (this && this.__assign) || function () {
|
|
5
|
+
__assign = Object.assign || function(t) {
|
|
6
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7
|
+
s = arguments[i];
|
|
8
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
9
|
+
t[p] = s[p];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
return __assign.apply(this, arguments);
|
|
24
14
|
};
|
|
25
15
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
16
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -60,101 +50,60 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
60
50
|
};
|
|
61
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
52
|
exports.CookieStorage = void 0;
|
|
63
|
-
|
|
64
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
65
|
-
// @ts-ignore
|
|
66
|
-
var Cookies = __importStar(require("js-cookie"));
|
|
53
|
+
var js_cookie_1 = require("js-cookie");
|
|
67
54
|
var CookieStorage = /** @class */ (function () {
|
|
68
55
|
function CookieStorage(data) {
|
|
69
56
|
if (data === void 0) { data = {}; }
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
this.path = '/';
|
|
78
|
-
}
|
|
79
|
-
if (Object.prototype.hasOwnProperty.call(data, 'expires')) {
|
|
80
|
-
this.expires = data.expires;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
this.expires = 365;
|
|
84
|
-
}
|
|
85
|
-
if (Object.prototype.hasOwnProperty.call(data, 'secure')) {
|
|
86
|
-
this.secure = data.secure;
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
this.secure = true;
|
|
90
|
-
}
|
|
57
|
+
var path = data.path, domain = data.domain, expires = data.expires, sameSite = data.sameSite, secure = data.secure;
|
|
58
|
+
this.domain = domain;
|
|
59
|
+
this.path = path ? path : '/';
|
|
60
|
+
this.expires = data.hasOwnProperty('expires') ? expires : 365;
|
|
61
|
+
this.secure = data.hasOwnProperty('secure') ? secure : true;
|
|
91
62
|
if (data.hasOwnProperty('sameSite')) {
|
|
92
|
-
if (!
|
|
93
|
-
!['strict', 'lax', 'none'].includes(data.sameSite)) {
|
|
63
|
+
if (!sameSite || !['strict', 'lax', 'none'].includes(sameSite)) {
|
|
94
64
|
throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');
|
|
95
65
|
}
|
|
96
|
-
if (
|
|
66
|
+
if (sameSite === 'none' && !this.secure) {
|
|
97
67
|
throw new Error('sameSite = None requires the Secure attribute in latest browser versions.');
|
|
98
68
|
}
|
|
99
|
-
this.sameSite =
|
|
69
|
+
this.sameSite = sameSite;
|
|
100
70
|
}
|
|
101
71
|
}
|
|
102
72
|
CookieStorage.prototype.setItem = function (key, value) {
|
|
103
73
|
return __awaiter(this, void 0, void 0, function () {
|
|
104
|
-
var options;
|
|
105
74
|
return __generator(this, function (_a) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
expires: this.expires,
|
|
109
|
-
domain: this.domain,
|
|
110
|
-
secure: this.secure,
|
|
111
|
-
};
|
|
112
|
-
if (this.sameSite) {
|
|
113
|
-
options.sameSite = this.sameSite;
|
|
114
|
-
}
|
|
115
|
-
Cookies.set(key, value, options);
|
|
116
|
-
return [2 /*return*/, Cookies.get(key)];
|
|
75
|
+
(0, js_cookie_1.set)(key, value, this.getData());
|
|
76
|
+
return [2 /*return*/];
|
|
117
77
|
});
|
|
118
78
|
});
|
|
119
79
|
};
|
|
120
80
|
CookieStorage.prototype.getItem = function (key) {
|
|
121
81
|
return __awaiter(this, void 0, void 0, function () {
|
|
82
|
+
var item;
|
|
122
83
|
return __generator(this, function (_a) {
|
|
123
|
-
|
|
84
|
+
item = (0, js_cookie_1.get)(key);
|
|
85
|
+
return [2 /*return*/, item !== null && item !== void 0 ? item : null];
|
|
124
86
|
});
|
|
125
87
|
});
|
|
126
88
|
};
|
|
127
89
|
CookieStorage.prototype.removeItem = function (key) {
|
|
128
90
|
return __awaiter(this, void 0, void 0, function () {
|
|
129
|
-
var options;
|
|
130
91
|
return __generator(this, function (_a) {
|
|
131
|
-
|
|
132
|
-
path: this.path,
|
|
133
|
-
expires: this.expires,
|
|
134
|
-
domain: this.domain,
|
|
135
|
-
secure: this.secure,
|
|
136
|
-
};
|
|
137
|
-
if (this.sameSite) {
|
|
138
|
-
options.sameSite = this.sameSite;
|
|
139
|
-
}
|
|
140
|
-
Cookies.remove(key, options);
|
|
92
|
+
(0, js_cookie_1.remove)(key, this.getData());
|
|
141
93
|
return [2 /*return*/];
|
|
142
94
|
});
|
|
143
95
|
});
|
|
144
96
|
};
|
|
145
97
|
CookieStorage.prototype.clear = function () {
|
|
146
98
|
return __awaiter(this, void 0, void 0, function () {
|
|
147
|
-
var
|
|
99
|
+
var cookie, promises;
|
|
100
|
+
var _this = this;
|
|
148
101
|
return __generator(this, function (_a) {
|
|
149
102
|
switch (_a.label) {
|
|
150
103
|
case 0:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
for (index = 0; index < numKeys; ++index) {
|
|
155
|
-
promiseArray.push(this.removeItem(Object.keys(cookies)[index]));
|
|
156
|
-
}
|
|
157
|
-
return [4 /*yield*/, Promise.all(promiseArray)];
|
|
104
|
+
cookie = (0, js_cookie_1.get)();
|
|
105
|
+
promises = Object.keys(cookie).map(function (key) { return _this.removeItem(key); });
|
|
106
|
+
return [4 /*yield*/, Promise.all(promises)];
|
|
158
107
|
case 1:
|
|
159
108
|
_a.sent();
|
|
160
109
|
return [2 /*return*/];
|
|
@@ -162,6 +111,9 @@ var CookieStorage = /** @class */ (function () {
|
|
|
162
111
|
});
|
|
163
112
|
});
|
|
164
113
|
};
|
|
114
|
+
CookieStorage.prototype.getData = function () {
|
|
115
|
+
return __assign({ path: this.path, expires: this.expires, domain: this.domain, secure: this.secure }, (this.sameSite && { sameSite: this.sameSite }));
|
|
116
|
+
};
|
|
165
117
|
return CookieStorage;
|
|
166
118
|
}());
|
|
167
119
|
exports.CookieStorage = CookieStorage;
|