@aws-amplify/core 6.0.1-console-preview.814dea6.0 → 6.0.1-console-preview.047a1dd.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/AwsClients/CognitoIdentity/base.d.ts +12 -4
- package/lib/AwsClients/CognitoIdentity/base.js +1 -0
- package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +15 -3
- package/lib/AwsClients/CognitoIdentity/getId.d.ts +15 -3
- package/lib/AwsClients/Pinpoint/base.d.ts +10 -2
- package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +17 -3
- package/lib/AwsClients/Pinpoint/putEvents.d.ts +17 -3
- package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +17 -3
- 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/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/authenticated.d.ts +1 -1
- package/lib/clients/handlers/fetch.d.ts +0 -1
- package/lib/clients/handlers/fetch.js +2 -2
- package/lib/clients/handlers/unauthenticated.d.ts +1 -1
- package/lib/clients/internal/composeServiceApi.d.ts +5 -3
- package/lib/clients/types/aws.d.ts +1 -5
- package/lib/clients/types/http.d.ts +8 -0
- package/lib/clients/types/index.d.ts +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.js +6 -10
- package/lib/libraryUtils.d.ts +3 -3
- package/lib/libraryUtils.js +5 -10
- 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/buffer.d.ts +1 -1
- package/lib/providers/pinpoint/types/pinpoint.d.ts +3 -3
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +7 -5
- package/lib/providers/pinpoint/utils/isAppInForeground.d.ts +1 -0
- package/lib/{RNComponents → providers/pinpoint/utils}/isAppInForeground.js +1 -4
- package/lib/providers/pinpoint/utils/isAppInForeground.native.d.ts +1 -0
- package/lib/providers/pinpoint/utils/isAppInForeground.native.js +9 -0
- package/lib/singleton/API/types.d.ts +34 -0
- package/lib/singleton/API/types.js +2 -0
- package/lib/singleton/Amplify.d.ts +2 -2
- package/lib/singleton/Amplify.js +9 -1
- package/lib/singleton/Auth/index.d.ts +2 -1
- package/lib/singleton/Auth/index.js +22 -12
- package/lib/singleton/Auth/utils/index.js +3 -3
- package/lib/singleton/Storage/types.d.ts +5 -0
- package/lib/singleton/types.d.ts +10 -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/AwsClients/CognitoIdentity/base.d.ts +12 -4
- package/lib-esm/AwsClients/CognitoIdentity/base.js +1 -0
- package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +15 -3
- package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +15 -3
- package/lib-esm/AwsClients/Pinpoint/base.d.ts +10 -2
- package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +17 -3
- package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +17 -3
- package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +17 -3
- 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/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/authenticated.d.ts +1 -1
- package/lib-esm/clients/handlers/fetch.d.ts +0 -1
- package/lib-esm/clients/handlers/fetch.js +2 -2
- package/lib-esm/clients/handlers/unauthenticated.d.ts +1 -1
- package/lib-esm/clients/internal/composeServiceApi.d.ts +5 -3
- package/lib-esm/clients/types/aws.d.ts +1 -5
- package/lib-esm/clients/types/http.d.ts +8 -0
- package/lib-esm/clients/types/index.d.ts +1 -1
- package/lib-esm/index.d.ts +1 -2
- package/lib-esm/index.js +1 -2
- package/lib-esm/libraryUtils.d.ts +3 -3
- package/lib-esm/libraryUtils.js +2 -3
- 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/buffer.d.ts +1 -1
- package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +3 -3
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +7 -5
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.js +3 -0
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.js +5 -0
- package/lib-esm/singleton/API/types.d.ts +34 -0
- package/lib-esm/singleton/API/types.js +1 -0
- package/lib-esm/singleton/Amplify.d.ts +2 -2
- package/lib-esm/singleton/Amplify.js +9 -1
- package/lib-esm/singleton/Auth/index.d.ts +2 -1
- package/lib-esm/singleton/Auth/index.js +22 -12
- package/lib-esm/singleton/Auth/utils/index.js +3 -3
- package/lib-esm/singleton/Storage/types.d.ts +5 -0
- package/lib-esm/singleton/types.d.ts +10 -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 -6
- package/src/AwsClients/CognitoIdentity/base.ts +2 -2
- package/src/AwsClients/Pinpoint/base.ts +2 -6
- package/src/Cache/Utils/CacheUtils.ts +2 -4
- package/src/Platform/version.ts +1 -1
- 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/authenticated.ts +2 -1
- package/src/clients/handlers/fetch.ts +2 -2
- package/src/clients/handlers/unauthenticated.ts +2 -1
- package/src/clients/internal/composeServiceApi.ts +10 -3
- package/src/clients/types/aws.ts +4 -11
- package/src/clients/types/http.ts +8 -0
- package/src/clients/types/index.ts +0 -1
- package/src/index.ts +4 -8
- package/src/libraryUtils.ts +3 -4
- 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/buffer.ts +1 -1
- package/src/providers/pinpoint/types/pinpoint.ts +8 -7
- package/src/providers/pinpoint/utils/PinpointEventBuffer.ts +16 -12
- package/src/providers/pinpoint/utils/isAppInForeground.native.ts +7 -0
- package/src/providers/pinpoint/utils/isAppInForeground.ts +4 -0
- package/src/singleton/API/types.ts +31 -0
- package/src/singleton/Amplify.ts +12 -3
- package/src/singleton/Auth/index.ts +9 -2
- package/src/singleton/Auth/utils/index.ts +3 -3
- package/src/singleton/Storage/types.ts +6 -2
- package/src/singleton/types.ts +11 -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/RNComponents/index.d.ts +0 -6
- package/lib/RNComponents/index.js +0 -16
- package/lib/RNComponents/reactnative.d.ts +0 -3
- package/lib/RNComponents/reactnative.js +0 -14
- 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/RNComponents/index.d.ts +0 -6
- package/lib-esm/RNComponents/index.js +0 -13
- package/lib-esm/RNComponents/isAppInForeground.js +0 -6
- package/lib-esm/RNComponents/reactnative.d.ts +0 -3
- package/lib-esm/RNComponents/reactnative.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/RNComponents/index.ts +0 -16
- package/src/RNComponents/isAppInForeground.ts +0 -8
- package/src/RNComponents/reactnative.ts +0 -6
- 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
- /package/lib-esm/{RNComponents → providers/pinpoint/utils}/isAppInForeground.d.ts +0 -0
- /package/{lib/RNComponents/isAppInForeground.d.ts → lib-esm/providers/pinpoint/utils/isAppInForeground.native.d.ts} +0 -0
|
@@ -3,7 +3,7 @@ import { PinpointAnalyticsEvent, PinpointSession } from './pinpoint';
|
|
|
3
3
|
export type EventBufferConfig = {
|
|
4
4
|
appId: string;
|
|
5
5
|
bufferSize: number;
|
|
6
|
-
credentials: AuthSession['credentials'];
|
|
6
|
+
credentials: Required<AuthSession>['credentials'];
|
|
7
7
|
identityId: AuthSession['identityId'];
|
|
8
8
|
flushInterval: number;
|
|
9
9
|
flushSize: number;
|
|
@@ -24,17 +24,17 @@ export type PinpointAnalyticsEvent = {
|
|
|
24
24
|
type PinpointCommonParameters = {
|
|
25
25
|
appId: string;
|
|
26
26
|
category: SupportedCategory;
|
|
27
|
-
credentials: AuthSession['credentials'];
|
|
27
|
+
credentials: Required<AuthSession>['credentials'];
|
|
28
28
|
identityId?: AuthSession['identityId'];
|
|
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 {};
|
|
@@ -77,7 +77,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
77
77
|
exports.PinpointEventBuffer = void 0;
|
|
78
78
|
var Logger_1 = require("../../../Logger");
|
|
79
79
|
var Pinpoint_1 = require("../../../AwsClients/Pinpoint");
|
|
80
|
-
var isAppInForeground_1 = require("
|
|
80
|
+
var isAppInForeground_1 = require("./isAppInForeground");
|
|
81
81
|
var logger = new Logger_1.ConsoleLogger('PinpointEventBuffer');
|
|
82
82
|
var RETRYABLE_CODES = [429, 500];
|
|
83
83
|
var ACCEPTED_CODES = [202];
|
|
@@ -94,7 +94,9 @@ var PinpointEventBuffer = /** @class */ (function () {
|
|
|
94
94
|
PinpointEventBuffer.prototype.push = function (event) {
|
|
95
95
|
var _a;
|
|
96
96
|
if (this._buffer.length >= this._config.bufferSize) {
|
|
97
|
-
logger.debug('Exceeded Pinpoint event buffer limits, event dropped.', {
|
|
97
|
+
logger.debug('Exceeded Pinpoint event buffer limits, event dropped.', {
|
|
98
|
+
eventId: event.eventId,
|
|
99
|
+
});
|
|
98
100
|
return;
|
|
99
101
|
}
|
|
100
102
|
this._buffer.push((_a = {}, _a[event.eventId] = event, _a));
|
|
@@ -233,7 +235,7 @@ var PinpointEventBuffer = /** @class */ (function () {
|
|
|
233
235
|
logger.warn('Pinpoint event failed to send.', {
|
|
234
236
|
eventId: eventId,
|
|
235
237
|
name: name,
|
|
236
|
-
message: Message
|
|
238
|
+
message: Message,
|
|
237
239
|
});
|
|
238
240
|
});
|
|
239
241
|
});
|
|
@@ -253,14 +255,14 @@ var PinpointEventBuffer = /** @class */ (function () {
|
|
|
253
255
|
logger.debug('Resending event.', {
|
|
254
256
|
eventId: eventId,
|
|
255
257
|
name: name,
|
|
256
|
-
remainingAttempts: bufferedEvent.resendLimit
|
|
258
|
+
remainingAttempts: bufferedEvent.resendLimit,
|
|
257
259
|
});
|
|
258
260
|
eligibleEvents.push((_a = {}, _a[eventId] = bufferedEvent, _a));
|
|
259
261
|
return;
|
|
260
262
|
}
|
|
261
263
|
logger.debug('No retry attempts remaining for event.', {
|
|
262
264
|
eventId: eventId,
|
|
263
|
-
name: name
|
|
265
|
+
name: name,
|
|
264
266
|
});
|
|
265
267
|
});
|
|
266
268
|
// add the events to the front of the buffer
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isAppInForeground: () => boolean;
|
|
@@ -3,8 +3,5 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.isAppInForeground = void 0;
|
|
6
|
-
var
|
|
7
|
-
var isAppInForeground = function () {
|
|
8
|
-
return _1.AppState.currentState === 'active';
|
|
9
|
-
};
|
|
6
|
+
var isAppInForeground = function () { return true; };
|
|
10
7
|
exports.isAppInForeground = isAppInForeground;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isAppInForeground: () => boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.isAppInForeground = void 0;
|
|
6
|
+
// @ts-ignore: missing type definition
|
|
7
|
+
var react_native_1 = require("react-native");
|
|
8
|
+
var isAppInForeground = function () { return react_native_1.AppState.currentState === 'active'; };
|
|
9
|
+
exports.isAppInForeground = isAppInForeground;
|
|
@@ -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
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AuthClass } from './Auth';
|
|
2
|
-
import { LibraryOptions, ResourcesConfig } from './types';
|
|
2
|
+
import { LegacyConfig, LibraryOptions, ResourcesConfig } from './types';
|
|
3
3
|
export declare class AmplifyClass {
|
|
4
4
|
resourcesConfig: ResourcesConfig;
|
|
5
5
|
libraryOptions: LibraryOptions;
|
|
@@ -19,7 +19,7 @@ export declare class AmplifyClass {
|
|
|
19
19
|
* @param resourceConfig - Back-end resource configuration. Typically provided via the `aws-exports.js` file.
|
|
20
20
|
* @param libraryOptions - Additional options for customizing the behavior of the library.
|
|
21
21
|
*/
|
|
22
|
-
configure(resourcesConfig: ResourcesConfig, libraryOptions?: LibraryOptions): void;
|
|
22
|
+
configure(resourcesConfig: ResourcesConfig | LegacyConfig, libraryOptions?: LibraryOptions): void;
|
|
23
23
|
/**
|
|
24
24
|
* Provides access to the current back-end resource configuration for the Library.
|
|
25
25
|
*
|
package/lib/singleton/Amplify.js
CHANGED
|
@@ -27,6 +27,7 @@ exports.Amplify = exports.AmplifyClass = void 0;
|
|
|
27
27
|
// SPDX-License-Identifier: Apache-2.0
|
|
28
28
|
var Auth_1 = require("./Auth");
|
|
29
29
|
var Hub_1 = require("../Hub");
|
|
30
|
+
var parseAWSExports_1 = require("../parseAWSExports");
|
|
30
31
|
// TODO(v6): add default AuthTokenStore for each platform
|
|
31
32
|
var AmplifyClass = /** @class */ (function () {
|
|
32
33
|
function AmplifyClass() {
|
|
@@ -46,7 +47,14 @@ var AmplifyClass = /** @class */ (function () {
|
|
|
46
47
|
*/
|
|
47
48
|
AmplifyClass.prototype.configure = function (resourcesConfig, libraryOptions) {
|
|
48
49
|
if (libraryOptions === void 0) { libraryOptions = {}; }
|
|
49
|
-
|
|
50
|
+
var resolvedResourceConfig;
|
|
51
|
+
if (Object.keys(resourcesConfig).some(function (key) { return key.startsWith('aws_'); })) {
|
|
52
|
+
resolvedResourceConfig = (0, parseAWSExports_1.parseAWSExports)(resourcesConfig);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
resolvedResourceConfig = resourcesConfig;
|
|
56
|
+
}
|
|
57
|
+
this.resourcesConfig = mergeResourceConfig(this.resourcesConfig, resolvedResourceConfig);
|
|
50
58
|
this.libraryOptions = mergeLibraryOptions(this.libraryOptions, libraryOptions);
|
|
51
59
|
this.Auth.configure(this.resourcesConfig.Auth, this.libraryOptions.Auth);
|
|
52
60
|
Hub_1.Hub.dispatch('core', {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthConfig, AuthSession, FetchAuthSessionOptions, LibraryAuthOptions } from './types';
|
|
1
|
+
import { AuthConfig, AuthSession, AuthTokens, FetchAuthSessionOptions, LibraryAuthOptions } from './types';
|
|
2
2
|
export declare function isTokenExpired({ expiresAt, clockDrift, }: {
|
|
3
3
|
expiresAt: number;
|
|
4
4
|
clockDrift: number;
|
|
@@ -20,4 +20,5 @@ export declare class AuthClass {
|
|
|
20
20
|
configure(authResourcesConfig: AuthConfig, authOptions?: LibraryAuthOptions): void;
|
|
21
21
|
fetchAuthSession(options?: FetchAuthSessionOptions): Promise<AuthSession>;
|
|
22
22
|
clearCredentials(): Promise<void>;
|
|
23
|
+
getTokens(options: FetchAuthSessionOptions): Promise<AuthTokens | undefined>;
|
|
23
24
|
}
|
|
@@ -61,20 +61,19 @@ var AuthClass = /** @class */ (function () {
|
|
|
61
61
|
this.authOptions = authOptions;
|
|
62
62
|
};
|
|
63
63
|
AuthClass.prototype.fetchAuthSession = function (options) {
|
|
64
|
-
var _a, _b, _c, _d, _e, _f
|
|
64
|
+
var _a, _b, _c, _d, _e, _f;
|
|
65
65
|
if (options === void 0) { options = {}; }
|
|
66
66
|
return __awaiter(this, void 0, void 0, function () {
|
|
67
67
|
var tokens, credentialsAndIdentityId, userSub;
|
|
68
|
-
return __generator(this, function (
|
|
69
|
-
switch (
|
|
70
|
-
case 0: return [4 /*yield*/,
|
|
68
|
+
return __generator(this, function (_g) {
|
|
69
|
+
switch (_g.label) {
|
|
70
|
+
case 0: return [4 /*yield*/, this.getTokens(options)];
|
|
71
71
|
case 1:
|
|
72
72
|
// Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available
|
|
73
|
-
tokens =
|
|
74
|
-
(_c = (_k.sent())) !== null && _c !== void 0 ? _c : undefined;
|
|
73
|
+
tokens = _g.sent();
|
|
75
74
|
if (!tokens) return [3 /*break*/, 3];
|
|
76
|
-
userSub = (
|
|
77
|
-
return [4 /*yield*/, ((
|
|
75
|
+
userSub = (_b = (_a = tokens.accessToken) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.sub;
|
|
76
|
+
return [4 /*yield*/, ((_d = (_c = this.authOptions) === null || _c === void 0 ? void 0 : _c.credentialsProvider) === null || _d === void 0 ? void 0 : _d.getCredentialsAndIdentityId({
|
|
78
77
|
authConfig: this.authConfig,
|
|
79
78
|
tokens: tokens,
|
|
80
79
|
authenticated: true,
|
|
@@ -83,9 +82,9 @@ var AuthClass = /** @class */ (function () {
|
|
|
83
82
|
case 2:
|
|
84
83
|
// getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)
|
|
85
84
|
credentialsAndIdentityId =
|
|
86
|
-
|
|
85
|
+
_g.sent();
|
|
87
86
|
return [3 /*break*/, 5];
|
|
88
|
-
case 3: return [4 /*yield*/, ((
|
|
87
|
+
case 3: return [4 /*yield*/, ((_f = (_e = this.authOptions) === null || _e === void 0 ? void 0 : _e.credentialsProvider) === null || _f === void 0 ? void 0 : _f.getCredentialsAndIdentityId({
|
|
89
88
|
authConfig: this.authConfig,
|
|
90
89
|
authenticated: false,
|
|
91
90
|
forceRefresh: options.forceRefresh,
|
|
@@ -93,8 +92,8 @@ var AuthClass = /** @class */ (function () {
|
|
|
93
92
|
case 4:
|
|
94
93
|
// getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)
|
|
95
94
|
credentialsAndIdentityId =
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
_g.sent();
|
|
96
|
+
_g.label = 5;
|
|
98
97
|
case 5: return [2 /*return*/, {
|
|
99
98
|
tokens: tokens,
|
|
100
99
|
credentials: credentialsAndIdentityId === null || credentialsAndIdentityId === void 0 ? void 0 : credentialsAndIdentityId.credentials,
|
|
@@ -119,6 +118,17 @@ var AuthClass = /** @class */ (function () {
|
|
|
119
118
|
});
|
|
120
119
|
});
|
|
121
120
|
};
|
|
121
|
+
AuthClass.prototype.getTokens = function (options) {
|
|
122
|
+
var _a, _b, _c;
|
|
123
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124
|
+
return __generator(this, function (_d) {
|
|
125
|
+
switch (_d.label) {
|
|
126
|
+
case 0: return [4 /*yield*/, ((_b = (_a = this.authOptions) === null || _a === void 0 ? void 0 : _a.tokenProvider) === null || _b === void 0 ? void 0 : _b.getTokens(options))];
|
|
127
|
+
case 1: return [2 /*return*/, ((_c = (_d.sent())) !== null && _c !== void 0 ? _c : undefined)];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
};
|
|
122
132
|
return AuthClass;
|
|
123
133
|
}());
|
|
124
134
|
exports.AuthClass = AuthClass;
|
|
@@ -36,9 +36,9 @@ exports.assertOAuthConfig = assertOAuthConfig;
|
|
|
36
36
|
function assertIdentityPooIdConfig(cognitoConfig) {
|
|
37
37
|
var validConfig = !!(cognitoConfig === null || cognitoConfig === void 0 ? void 0 : cognitoConfig.identityPoolId);
|
|
38
38
|
return (0, AssertError_1.asserts)(validConfig, {
|
|
39
|
-
name: '
|
|
40
|
-
message: '
|
|
41
|
-
recoverySuggestion: 'Make sure
|
|
39
|
+
name: 'InvalidIdentityPoolIdException',
|
|
40
|
+
message: 'Invalid identity pool id provided.',
|
|
41
|
+
recoverySuggestion: 'Make sure a valid identityPoolId is given in the config.',
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
exports.assertIdentityPooIdConfig = assertIdentityPooIdConfig;
|
package/lib/singleton/types.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
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';
|
|
5
|
+
export type LegacyConfig = {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated The field should not be used.
|
|
8
|
+
*/
|
|
9
|
+
aws_project_region?: string;
|
|
10
|
+
};
|
|
4
11
|
export type ResourcesConfig = {
|
|
12
|
+
API?: APIConfig;
|
|
5
13
|
Analytics?: AnalyticsConfig;
|
|
6
14
|
Auth?: AuthConfig;
|
|
7
15
|
Storage?: StorageConfig;
|
|
8
16
|
};
|
|
9
17
|
export type LibraryOptions = {
|
|
18
|
+
API?: LibraryAPIOptions;
|
|
10
19
|
Auth?: LibraryAuthOptions;
|
|
11
20
|
Storage?: LibraryStorageOptions;
|
|
12
21
|
ssr?: boolean;
|
|
13
22
|
};
|
|
14
|
-
export { AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, };
|
|
23
|
+
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;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
var __extends = (this && this.__extends) || (function () {
|
|
5
|
+
var extendStatics = function (d, b) {
|
|
6
|
+
extendStatics = Object.setPrototypeOf ||
|
|
7
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
8
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
9
|
+
return extendStatics(d, b);
|
|
10
|
+
};
|
|
11
|
+
return function (d, b) {
|
|
12
|
+
if (typeof b !== "function" && b !== null)
|
|
13
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14
|
+
extendStatics(d, b);
|
|
15
|
+
function __() { this.constructor = d; }
|
|
16
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.CookieStorage = void 0;
|
|
21
|
+
var KeyValueStorage_1 = require("./KeyValueStorage");
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
var CookieStorage = /** @class */ (function (_super) {
|
|
26
|
+
__extends(CookieStorage, _super);
|
|
27
|
+
function CookieStorage() {
|
|
28
|
+
return _super.call(this) || this;
|
|
29
|
+
}
|
|
30
|
+
return CookieStorage;
|
|
31
|
+
}(KeyValueStorage_1.KeyValueStorage));
|
|
32
|
+
exports.CookieStorage = CookieStorage;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
var __extends = (this && this.__extends) || (function () {
|
|
5
|
+
var extendStatics = function (d, b) {
|
|
6
|
+
extendStatics = Object.setPrototypeOf ||
|
|
7
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
8
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
9
|
+
return extendStatics(d, b);
|
|
10
|
+
};
|
|
11
|
+
return function (d, b) {
|
|
12
|
+
if (typeof b !== "function" && b !== null)
|
|
13
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14
|
+
extendStatics(d, b);
|
|
15
|
+
function __() { this.constructor = d; }
|
|
16
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.DefaultStorage = void 0;
|
|
21
|
+
var KeyValueStorage_1 = require("./KeyValueStorage");
|
|
22
|
+
var utils_1 = require("./utils");
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
var DefaultStorage = /** @class */ (function (_super) {
|
|
27
|
+
__extends(DefaultStorage, _super);
|
|
28
|
+
function DefaultStorage() {
|
|
29
|
+
return _super.call(this, (0, utils_1.getDefaultStorageWithFallback)()) || this;
|
|
30
|
+
}
|
|
31
|
+
return DefaultStorage;
|
|
32
|
+
}(KeyValueStorage_1.KeyValueStorage));
|
|
33
|
+
exports.DefaultStorage = DefaultStorage;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { KeyValueStorageInterface } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { KeyValueStorageInterface } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare class DefaultStorage implements KeyValueStorageInterface {
|
|
6
|
+
private asyncStorage?;
|
|
5
7
|
/**
|
|
6
8
|
* This is used to set a specific item in storage
|
|
7
9
|
* @param {string} key - the key for the item
|
|
@@ -27,6 +29,5 @@ declare class LocalStorageClass implements KeyValueStorageInterface {
|
|
|
27
29
|
* @returns {string} nothing
|
|
28
30
|
*/
|
|
29
31
|
clear(): Promise<void>;
|
|
32
|
+
private assertModule;
|
|
30
33
|
}
|
|
31
|
-
export declare const LocalStorage: LocalStorageClass;
|
|
32
|
-
export {};
|