@aws-amplify/core 6.0.1-console-preview.7739091.0 → 6.0.1-preview-testing.ddb17c0.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 +4 -2
- 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 +2 -2
- package/{lib-esm/storage/CookieStorage.d.ts → lib/StorageHelper/cookieStorage.d.ts} +3 -4
- package/lib/{storage/CookieStorage.js → StorageHelper/cookieStorage.js} +83 -35
- package/lib/StorageHelper/inMemoryStorage.d.ts +10 -0
- package/lib/StorageHelper/inMemoryStorage.js +82 -0
- package/lib/StorageHelper/index.d.ts +45 -0
- package/lib/StorageHelper/index.js +83 -0
- package/lib/{storage/DefaultStorage.native.d.ts → StorageHelper/localStorage.d.ts} +6 -7
- package/lib/{storage/KeyValueStorage.js → StorageHelper/localStorage.js} +15 -13
- package/lib/StorageHelper/reactnative.d.ts +83 -0
- package/lib/StorageHelper/reactnative.js +250 -0
- package/lib/{storage/KeyValueStorage.d.ts → StorageHelper/sessionStorage.d.ts} +4 -5
- package/lib/{storage/DefaultStorage.native.js → StorageHelper/sessionStorage.js} +43 -46
- package/lib/clients/handlers/authenticated.d.ts +1 -1
- package/lib/clients/handlers/fetch.js +2 -1
- 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 -1
- package/lib/index.js +8 -6
- package/lib/parseAWSExports.js +1 -20
- package/lib/providers/pinpoint/types/buffer.d.ts +1 -1
- package/lib/providers/pinpoint/types/pinpoint.d.ts +1 -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/types.d.ts +1 -4
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/storage.d.ts +0 -3
- 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 +4 -2
- 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 +2 -2
- package/{lib/storage/CookieStorage.d.ts → lib-esm/StorageHelper/cookieStorage.d.ts} +3 -4
- package/lib-esm/{storage/CookieStorage.js → StorageHelper/cookieStorage.js} +61 -36
- package/lib-esm/StorageHelper/inMemoryStorage.d.ts +10 -0
- package/lib-esm/StorageHelper/inMemoryStorage.js +79 -0
- package/lib-esm/StorageHelper/index.d.ts +45 -0
- package/lib-esm/StorageHelper/index.js +76 -0
- package/lib-esm/{storage/DefaultStorage.native.d.ts → StorageHelper/localStorage.d.ts} +6 -7
- package/lib-esm/{storage/KeyValueStorage.js → StorageHelper/localStorage.js} +14 -12
- package/lib-esm/StorageHelper/reactnative.d.ts +83 -0
- package/lib-esm/StorageHelper/reactnative.js +244 -0
- package/lib-esm/{storage/KeyValueStorage.d.ts → StorageHelper/sessionStorage.d.ts} +4 -5
- package/lib-esm/{storage/DefaultStorage.native.js → StorageHelper/sessionStorage.js} +42 -45
- package/lib-esm/clients/handlers/authenticated.d.ts +1 -1
- package/lib-esm/clients/handlers/fetch.js +2 -1
- 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 -1
- package/lib-esm/index.js +1 -1
- package/lib-esm/parseAWSExports.js +1 -20
- package/lib-esm/providers/pinpoint/types/buffer.d.ts +1 -1
- package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +1 -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/types.d.ts +1 -4
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/storage.d.ts +0 -3
- package/package.json +3 -3
- package/src/AwsClients/CognitoIdentity/base.ts +2 -2
- package/src/AwsClients/Pinpoint/base.ts +2 -6
- package/src/Cache/Utils/CacheUtils.ts +4 -2
- package/src/Platform/version.ts +1 -1
- package/src/RNComponents/index.ts +2 -2
- package/src/StorageHelper/cookieStorage.ts +99 -0
- package/src/StorageHelper/inMemoryStorage.ts +32 -0
- package/src/StorageHelper/index.ts +78 -0
- package/src/StorageHelper/localStorage.ts +60 -0
- package/src/StorageHelper/reactnative.ts +182 -0
- package/src/{storage/KeyValueStorage.ts → StorageHelper/sessionStorage.ts} +13 -10
- package/src/clients/handlers/authenticated.ts +2 -1
- package/src/clients/handlers/fetch.ts +2 -1
- 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 +6 -4
- package/src/parseAWSExports.ts +0 -26
- package/src/providers/pinpoint/types/buffer.ts +1 -1
- package/src/providers/pinpoint/types/pinpoint.ts +1 -1
- package/src/singleton/Auth/index.ts +9 -2
- package/src/singleton/Auth/utils/index.ts +3 -3
- package/src/singleton/types.ts +1 -4
- package/src/types/storage.ts +0 -4
- package/lib/singleton/API/types.d.ts +0 -34
- package/lib/singleton/API/types.js +0 -2
- package/lib/storage/CookieStorage.native.d.ts +0 -7
- package/lib/storage/CookieStorage.native.js +0 -32
- package/lib/storage/DefaultStorage.d.ts +0 -7
- package/lib/storage/DefaultStorage.js +0 -33
- package/lib/storage/InMemoryStorage.d.ts +0 -12
- package/lib/storage/InMemoryStorage.js +0 -41
- package/lib/storage/SessionStorage.d.ts +0 -7
- package/lib/storage/SessionStorage.js +0 -33
- package/lib/storage/index.d.ts +0 -7
- package/lib/storage/index.js +0 -14
- package/lib/storage/utils.d.ts +0 -10
- package/lib/storage/utils.js +0 -26
- package/lib-esm/singleton/API/types.d.ts +0 -34
- package/lib-esm/singleton/API/types.js +0 -1
- package/lib-esm/storage/CookieStorage.native.d.ts +0 -7
- package/lib-esm/storage/CookieStorage.native.js +0 -29
- package/lib-esm/storage/DefaultStorage.d.ts +0 -7
- package/lib-esm/storage/DefaultStorage.js +0 -30
- package/lib-esm/storage/InMemoryStorage.d.ts +0 -12
- package/lib-esm/storage/InMemoryStorage.js +0 -38
- package/lib-esm/storage/SessionStorage.d.ts +0 -7
- package/lib-esm/storage/SessionStorage.js +0 -30
- package/lib-esm/storage/index.d.ts +0 -7
- package/lib-esm/storage/index.js +0 -10
- package/lib-esm/storage/utils.d.ts +0 -10
- package/lib-esm/storage/utils.js +0 -21
- package/src/singleton/API/types.ts +0 -31
- package/src/storage/CookieStorage.native.ts +0 -13
- package/src/storage/CookieStorage.ts +0 -72
- package/src/storage/DefaultStorage.native.ts +0 -78
- package/src/storage/DefaultStorage.ts +0 -14
- package/src/storage/InMemoryStorage.ts +0 -36
- package/src/storage/SessionStorage.ts +0 -14
- package/src/storage/index.ts +0 -13
- package/src/storage/utils.ts +0 -22
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import { Endpoint, Headers, HttpRequest, HttpResponse } from '../../clients';
|
|
2
|
-
import { DefaultConfigOptions } from '../../clients/types';
|
|
1
|
+
import { Endpoint, EndpointResolverOptions, Headers, HttpRequest, HttpResponse } from '../../clients';
|
|
3
2
|
/**
|
|
4
3
|
* A Cognito Identity-specific transfer handler that does NOT sign requests, and
|
|
5
4
|
* disables caching.
|
|
6
5
|
*
|
|
7
6
|
* @internal
|
|
8
7
|
*/
|
|
9
|
-
export declare const cognitoIdentityTransferHandler: (request: HttpRequest, options: import("../../clients").UserAgentOptions & import("../../clients").RetryOptions<HttpResponse>) => Promise<HttpResponse>;
|
|
8
|
+
export declare const cognitoIdentityTransferHandler: (request: HttpRequest, options: import("../../clients").UserAgentOptions & import("../../clients").RetryOptions<HttpResponse> & import("../../clients").HttpTransferOptions) => Promise<HttpResponse>;
|
|
10
9
|
/**
|
|
11
10
|
* @internal
|
|
12
11
|
*/
|
|
13
|
-
export declare const defaultConfig:
|
|
12
|
+
export declare const defaultConfig: {
|
|
13
|
+
service: string;
|
|
14
|
+
endpointResolver: ({ region }: EndpointResolverOptions) => {
|
|
15
|
+
url: URL;
|
|
16
|
+
};
|
|
17
|
+
retryDecider: (response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>;
|
|
18
|
+
computeDelay: (attempt: number) => number;
|
|
19
|
+
userAgentValue: string;
|
|
20
|
+
cache: string;
|
|
21
|
+
};
|
|
14
22
|
/**
|
|
15
23
|
* @internal
|
|
16
24
|
*/
|
|
@@ -86,6 +86,7 @@ exports.defaultConfig = {
|
|
|
86
86
|
retryDecider: (0, retry_1.getRetryDecider)(clients_1.parseJsonError),
|
|
87
87
|
computeDelay: retry_1.jitteredBackoff,
|
|
88
88
|
userAgentValue: (0, Platform_1.getAmplifyUserAgent)(),
|
|
89
|
+
cache: 'no-store',
|
|
89
90
|
};
|
|
90
91
|
(0, detectFramework_1.observeFrameworkChanges)(function () {
|
|
91
92
|
exports.defaultConfig.userAgentValue = (0, Platform_1.getAmplifyUserAgent)();
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import { HttpResponse } from '../../clients';
|
|
1
|
+
import { Endpoint, HttpResponse } from '../../clients';
|
|
2
2
|
import type { GetCredentialsForIdentityCommandInput as GetCredentialsForIdentityInput, GetCredentialsForIdentityCommandOutput as GetCredentialsForIdentityOutput } from './types';
|
|
3
3
|
export type { GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput };
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare const getCredentialsForIdentity: (config:
|
|
8
|
-
|
|
7
|
+
export declare const getCredentialsForIdentity: (config: {
|
|
8
|
+
service?: string | undefined;
|
|
9
|
+
endpointResolver?: (((options: import("../../clients").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients").EndpointResolverOptions) => {
|
|
10
|
+
url: URL;
|
|
11
|
+
})) | undefined;
|
|
12
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
|
|
13
|
+
computeDelay?: ((attempt: number) => number) | undefined;
|
|
14
|
+
userAgentValue?: string | undefined;
|
|
15
|
+
cache?: "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
region: string;
|
|
18
|
+
abortSignal?: AbortSignal | undefined;
|
|
19
|
+
maxAttempts?: number | undefined;
|
|
20
|
+
userAgentHeader?: string | undefined;
|
|
9
21
|
}, input: GetCredentialsForIdentityInput) => Promise<GetCredentialsForIdentityOutput>;
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import { HttpResponse } from '../../clients';
|
|
1
|
+
import { Endpoint, HttpResponse } from '../../clients';
|
|
2
2
|
import { GetIdCommandInput as GetIdInput, GetIdCommandOutput as GetIdOutput } from './types';
|
|
3
3
|
export type { GetIdInput, GetIdOutput };
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare const getId: (config:
|
|
8
|
-
|
|
7
|
+
export declare const getId: (config: {
|
|
8
|
+
service?: string | undefined;
|
|
9
|
+
endpointResolver?: (((options: import("../../clients").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients").EndpointResolverOptions) => {
|
|
10
|
+
url: URL;
|
|
11
|
+
})) | undefined;
|
|
12
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
|
|
13
|
+
computeDelay?: ((attempt: number) => number) | undefined;
|
|
14
|
+
userAgentValue?: string | undefined;
|
|
15
|
+
cache?: "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
region: string;
|
|
18
|
+
abortSignal?: AbortSignal | undefined;
|
|
19
|
+
maxAttempts?: number | undefined;
|
|
20
|
+
userAgentHeader?: string | undefined;
|
|
9
21
|
}, input: GetIdInput) => Promise<GetIdOutput>;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EndpointResolverOptions, Headers } from '../../clients/types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare const defaultConfig:
|
|
5
|
+
export declare const defaultConfig: {
|
|
6
|
+
service: string;
|
|
7
|
+
endpointResolver: ({ region }: EndpointResolverOptions) => {
|
|
8
|
+
url: URL;
|
|
9
|
+
};
|
|
10
|
+
retryDecider: (response?: import("../../clients/types").HttpResponse | undefined, error?: unknown) => Promise<boolean>;
|
|
11
|
+
computeDelay: (attempt: number) => number;
|
|
12
|
+
userAgentValue: string;
|
|
13
|
+
};
|
|
6
14
|
/**
|
|
7
15
|
* @internal
|
|
8
16
|
*/
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import { HttpResponse } from '../../clients/types';
|
|
1
|
+
import { Endpoint, HttpResponse } from '../../clients/types';
|
|
2
2
|
import type { GetInAppMessagesCommandInput as GetInAppMessagesInput, GetInAppMessagesCommandOutput as GetInAppMessagesOutput } from './types';
|
|
3
3
|
export type { GetInAppMessagesInput, GetInAppMessagesOutput };
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare const getInAppMessages: (config:
|
|
8
|
-
|
|
7
|
+
export declare const getInAppMessages: (config: {
|
|
8
|
+
service?: string | undefined;
|
|
9
|
+
endpointResolver?: (((options: import("../../clients/types").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients/types").EndpointResolverOptions) => {
|
|
10
|
+
url: URL;
|
|
11
|
+
})) | undefined;
|
|
12
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
|
|
13
|
+
computeDelay?: ((attempt: number) => number) | undefined;
|
|
14
|
+
userAgentValue?: string | undefined;
|
|
15
|
+
} & {
|
|
16
|
+
uriEscapePath?: boolean | undefined;
|
|
17
|
+
credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
|
|
18
|
+
region: string;
|
|
19
|
+
abortSignal?: AbortSignal | undefined;
|
|
20
|
+
cache?: RequestCache | undefined;
|
|
21
|
+
maxAttempts?: number | undefined;
|
|
22
|
+
userAgentHeader?: string | undefined;
|
|
9
23
|
}, input: GetInAppMessagesInput) => Promise<GetInAppMessagesOutput>;
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import { HttpResponse } from '../../clients/types';
|
|
1
|
+
import { Endpoint, HttpResponse } from '../../clients/types';
|
|
2
2
|
import type { PutEventsCommandInput as PutEventsInput, PutEventsCommandOutput as PutEventsOutput } from './types';
|
|
3
3
|
export type { PutEventsInput, PutEventsOutput };
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare const putEvents: (config:
|
|
8
|
-
|
|
7
|
+
export declare const putEvents: (config: {
|
|
8
|
+
service?: string | undefined;
|
|
9
|
+
endpointResolver?: (((options: import("../../clients/types").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients/types").EndpointResolverOptions) => {
|
|
10
|
+
url: URL;
|
|
11
|
+
})) | undefined;
|
|
12
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
|
|
13
|
+
computeDelay?: ((attempt: number) => number) | undefined;
|
|
14
|
+
userAgentValue?: string | undefined;
|
|
15
|
+
} & {
|
|
16
|
+
uriEscapePath?: boolean | undefined;
|
|
17
|
+
credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
|
|
18
|
+
region: string;
|
|
19
|
+
abortSignal?: AbortSignal | undefined;
|
|
20
|
+
cache?: RequestCache | undefined;
|
|
21
|
+
maxAttempts?: number | undefined;
|
|
22
|
+
userAgentHeader?: string | undefined;
|
|
9
23
|
}, input: PutEventsInput) => Promise<PutEventsOutput>;
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import { HttpResponse } from '../../clients/types';
|
|
1
|
+
import { Endpoint, HttpResponse } from '../../clients/types';
|
|
2
2
|
import type { UpdateEndpointCommandInput as UpdateEndpointInput, UpdateEndpointCommandOutput as UpdateEndpointOutput } from './types';
|
|
3
3
|
export type { UpdateEndpointInput, UpdateEndpointOutput };
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare const updateEndpoint: (config:
|
|
8
|
-
|
|
7
|
+
export declare const updateEndpoint: (config: {
|
|
8
|
+
service?: string | undefined;
|
|
9
|
+
endpointResolver?: (((options: import("../../clients/types").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients/types").EndpointResolverOptions) => {
|
|
10
|
+
url: URL;
|
|
11
|
+
})) | undefined;
|
|
12
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
|
|
13
|
+
computeDelay?: ((attempt: number) => number) | undefined;
|
|
14
|
+
userAgentValue?: string | undefined;
|
|
15
|
+
} & {
|
|
16
|
+
uriEscapePath?: boolean | undefined;
|
|
17
|
+
credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
|
|
18
|
+
region: string;
|
|
19
|
+
abortSignal?: AbortSignal | undefined;
|
|
20
|
+
cache?: RequestCache | undefined;
|
|
21
|
+
maxAttempts?: number | undefined;
|
|
22
|
+
userAgentHeader?: string | undefined;
|
|
9
23
|
}, input: UpdateEndpointInput) => Promise<UpdateEndpointOutput>;
|
|
@@ -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 StorageHelper_1 = require("../../StorageHelper");
|
|
7
7
|
/**
|
|
8
8
|
* Default cache config
|
|
9
9
|
*/
|
|
@@ -14,7 +14,9 @@ exports.defaultConfig = {
|
|
|
14
14
|
defaultTTL: 259200000,
|
|
15
15
|
defaultPriority: 5,
|
|
16
16
|
warningThreshold: 0.8,
|
|
17
|
-
storage
|
|
17
|
+
// the storage helper will check if localStorage exists,
|
|
18
|
+
// if not, will use a in-memory object instead
|
|
19
|
+
storage: new StorageHelper_1.StorageHelper().getStorage(),
|
|
18
20
|
};
|
|
19
21
|
/**
|
|
20
22
|
* return the byte size of the string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.1-
|
|
1
|
+
export declare const version = "6.0.1-preview-testing.ddb17c0.0+ddb17c0";
|
package/lib/Platform/version.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
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");
|
|
7
6
|
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; },
|
|
@@ -12,5 +12,5 @@ exports.AppState = {
|
|
|
12
12
|
};
|
|
13
13
|
// if not in react native, just use local storage
|
|
14
14
|
exports.AsyncStorage = (0, JS_1.isBrowser)()
|
|
15
|
-
?
|
|
15
|
+
? new StorageHelper_1.StorageHelper().getStorage()
|
|
16
16
|
: undefined;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { CookieStorageData, KeyValueStorageInterface, SameSite } from '../types';
|
|
2
2
|
export declare class CookieStorage implements KeyValueStorageInterface {
|
|
3
|
-
path: string;
|
|
4
3
|
domain?: string;
|
|
4
|
+
path: string;
|
|
5
5
|
expires?: number;
|
|
6
|
-
sameSite?: SameSite;
|
|
7
6
|
secure?: boolean;
|
|
7
|
+
sameSite?: SameSite;
|
|
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>;
|
|
11
11
|
removeItem(key: string): Promise<void>;
|
|
12
12
|
clear(): Promise<void>;
|
|
13
|
-
private getData;
|
|
14
13
|
}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
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;
|
|
14
24
|
};
|
|
15
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -50,60 +60,101 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
60
|
};
|
|
51
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
62
|
exports.CookieStorage = void 0;
|
|
53
|
-
|
|
63
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
64
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
var Cookies = __importStar(require("js-cookie"));
|
|
54
67
|
var CookieStorage = /** @class */ (function () {
|
|
55
68
|
function CookieStorage(data) {
|
|
56
69
|
if (data === void 0) { data = {}; }
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
if (data.domain) {
|
|
71
|
+
this.domain = data.domain;
|
|
72
|
+
}
|
|
73
|
+
if (data.path) {
|
|
74
|
+
this.path = data.path;
|
|
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
|
+
}
|
|
62
91
|
if (data.hasOwnProperty('sameSite')) {
|
|
63
|
-
if (!sameSite ||
|
|
92
|
+
if (!data.sameSite ||
|
|
93
|
+
!['strict', 'lax', 'none'].includes(data.sameSite)) {
|
|
64
94
|
throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');
|
|
65
95
|
}
|
|
66
|
-
if (sameSite === 'none' && !this.secure) {
|
|
96
|
+
if (data.sameSite === 'none' && !this.secure) {
|
|
67
97
|
throw new Error('sameSite = None requires the Secure attribute in latest browser versions.');
|
|
68
98
|
}
|
|
69
|
-
this.sameSite = sameSite;
|
|
99
|
+
this.sameSite = data.sameSite;
|
|
70
100
|
}
|
|
71
101
|
}
|
|
72
102
|
CookieStorage.prototype.setItem = function (key, value) {
|
|
73
103
|
return __awaiter(this, void 0, void 0, function () {
|
|
104
|
+
var options;
|
|
74
105
|
return __generator(this, function (_a) {
|
|
75
|
-
|
|
76
|
-
|
|
106
|
+
options = {
|
|
107
|
+
path: this.path,
|
|
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)];
|
|
77
117
|
});
|
|
78
118
|
});
|
|
79
119
|
};
|
|
80
120
|
CookieStorage.prototype.getItem = function (key) {
|
|
81
121
|
return __awaiter(this, void 0, void 0, function () {
|
|
82
|
-
var item;
|
|
83
122
|
return __generator(this, function (_a) {
|
|
84
|
-
|
|
85
|
-
return [2 /*return*/, item !== null && item !== void 0 ? item : null];
|
|
123
|
+
return [2 /*return*/, Cookies.get(key)];
|
|
86
124
|
});
|
|
87
125
|
});
|
|
88
126
|
};
|
|
89
127
|
CookieStorage.prototype.removeItem = function (key) {
|
|
90
128
|
return __awaiter(this, void 0, void 0, function () {
|
|
129
|
+
var options;
|
|
91
130
|
return __generator(this, function (_a) {
|
|
92
|
-
|
|
131
|
+
options = {
|
|
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);
|
|
93
141
|
return [2 /*return*/];
|
|
94
142
|
});
|
|
95
143
|
});
|
|
96
144
|
};
|
|
97
145
|
CookieStorage.prototype.clear = function () {
|
|
98
146
|
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
-
var
|
|
100
|
-
var _this = this;
|
|
147
|
+
var cookies, numKeys, promiseArray, index;
|
|
101
148
|
return __generator(this, function (_a) {
|
|
102
149
|
switch (_a.label) {
|
|
103
150
|
case 0:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
151
|
+
cookies = Cookies.get();
|
|
152
|
+
numKeys = Object.keys(cookies).length;
|
|
153
|
+
promiseArray = [];
|
|
154
|
+
for (index = 0; index < numKeys; ++index) {
|
|
155
|
+
promiseArray.push(this.removeItem(Object.keys(cookies)[index]));
|
|
156
|
+
}
|
|
157
|
+
return [4 /*yield*/, Promise.all(promiseArray)];
|
|
107
158
|
case 1:
|
|
108
159
|
_a.sent();
|
|
109
160
|
return [2 /*return*/];
|
|
@@ -111,9 +162,6 @@ var CookieStorage = /** @class */ (function () {
|
|
|
111
162
|
});
|
|
112
163
|
});
|
|
113
164
|
};
|
|
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
|
-
};
|
|
117
165
|
return CookieStorage;
|
|
118
166
|
}());
|
|
119
167
|
exports.CookieStorage = CookieStorage;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KeyValueStorageInterface } from '../types';
|
|
2
|
+
declare class MemoryKeyValueStorageClass implements KeyValueStorageInterface {
|
|
3
|
+
myStorage: Record<string, string>;
|
|
4
|
+
setItem(key: string, value: string): Promise<void>;
|
|
5
|
+
getItem(key: string): Promise<string | null>;
|
|
6
|
+
removeItem(key: string): Promise<void>;
|
|
7
|
+
clear(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const MemoryKeyValueStorage: MemoryKeyValueStorageClass;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
15
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
16
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
17
|
+
function step(op) {
|
|
18
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
19
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
20
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
21
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
22
|
+
switch (op[0]) {
|
|
23
|
+
case 0: case 1: t = op; break;
|
|
24
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
25
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
26
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
27
|
+
default:
|
|
28
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
29
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
30
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
31
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
32
|
+
if (t[2]) _.ops.pop();
|
|
33
|
+
_.trys.pop(); continue;
|
|
34
|
+
}
|
|
35
|
+
op = body.call(thisArg, _);
|
|
36
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
37
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.MemoryKeyValueStorage = void 0;
|
|
42
|
+
var MemoryKeyValueStorageClass = /** @class */ (function () {
|
|
43
|
+
function MemoryKeyValueStorageClass() {
|
|
44
|
+
this.myStorage = {};
|
|
45
|
+
}
|
|
46
|
+
MemoryKeyValueStorageClass.prototype.setItem = function (key, value) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
this.myStorage[key] = value;
|
|
50
|
+
return [2 /*return*/];
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
MemoryKeyValueStorageClass.prototype.getItem = function (key) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
return [2 /*return*/, this.myStorage[key]];
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
MemoryKeyValueStorageClass.prototype.removeItem = function (key) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
+
return __generator(this, function (_a) {
|
|
64
|
+
delete this.myStorage[key];
|
|
65
|
+
return [2 /*return*/];
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
MemoryKeyValueStorageClass.prototype.clear = function () {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
var _this = this;
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
Object.keys(this.myStorage).forEach(function (key) {
|
|
74
|
+
delete _this.myStorage[key];
|
|
75
|
+
});
|
|
76
|
+
return [2 /*return*/];
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
return MemoryKeyValueStorageClass;
|
|
81
|
+
}());
|
|
82
|
+
exports.MemoryKeyValueStorage = new MemoryKeyValueStorageClass();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** @class */
|
|
2
|
+
export declare class MemoryStorage {
|
|
3
|
+
/**
|
|
4
|
+
* This is used to set a specific item in storage
|
|
5
|
+
* @param {string} key - the key for the item
|
|
6
|
+
* @param {object} value - the value
|
|
7
|
+
* @returns {string} value that was set
|
|
8
|
+
*/
|
|
9
|
+
static setItem(key: string, value: any): string;
|
|
10
|
+
/**
|
|
11
|
+
* This is used to get a specific key from storage
|
|
12
|
+
* @param {string} key - the key for the item
|
|
13
|
+
* This is used to clear the storage
|
|
14
|
+
* @returns {string} the data item
|
|
15
|
+
*/
|
|
16
|
+
static getItem(key: string): string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* This is used to remove an item from storage
|
|
19
|
+
* @param {string} key - the key being set
|
|
20
|
+
* @returns {string} value - value that was deleted
|
|
21
|
+
*/
|
|
22
|
+
static removeItem(key: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* This is used to clear the storage
|
|
25
|
+
* @returns {string} nothing
|
|
26
|
+
*/
|
|
27
|
+
static clear(): Record<string, string>;
|
|
28
|
+
}
|
|
29
|
+
export declare class StorageHelper {
|
|
30
|
+
private storageWindow;
|
|
31
|
+
/**
|
|
32
|
+
* This is used to get a storage object
|
|
33
|
+
* @returns {object} the storage
|
|
34
|
+
*/
|
|
35
|
+
constructor();
|
|
36
|
+
/**
|
|
37
|
+
* This is used to return the storage
|
|
38
|
+
* @returns {object} the storage
|
|
39
|
+
*/
|
|
40
|
+
getStorage(): any;
|
|
41
|
+
}
|
|
42
|
+
export { SessionStorage } from './sessionStorage';
|
|
43
|
+
export { LocalStorage } from './localStorage';
|
|
44
|
+
export { MemoryKeyValueStorage } from './inMemoryStorage';
|
|
45
|
+
export { CookieStorage } from './cookieStorage';
|