@aws-amplify/core 6.0.1-console-preview.7739091.0 → 6.0.1-preview-testing.64b45b1.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 +0 -4
- 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/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 +0 -4
- 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/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 +0 -10
- 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/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
package/lib/types/storage.d.ts
CHANGED
|
@@ -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
|
*/
|
|
@@ -83,6 +83,7 @@ export var defaultConfig = {
|
|
|
83
83
|
retryDecider: getRetryDecider(parseJsonError),
|
|
84
84
|
computeDelay: jitteredBackoff,
|
|
85
85
|
userAgentValue: getAmplifyUserAgent(),
|
|
86
|
+
cache: 'no-store',
|
|
86
87
|
};
|
|
87
88
|
observeFrameworkChanges(function () {
|
|
88
89
|
defaultConfig.userAgentValue = 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("@aws-sdk/types/dist-types/credentials").Credentials | (() => Promise<import("@aws-sdk/types/dist-types/credentials").Credentials>);
|
|
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("@aws-sdk/types/dist-types/credentials").Credentials | (() => Promise<import("@aws-sdk/types/dist-types/credentials").Credentials>);
|
|
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("@aws-sdk/types/dist-types/credentials").Credentials | (() => Promise<import("@aws-sdk/types/dist-types/credentials").Credentials>);
|
|
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>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
3
|
+
import { StorageHelper } from '../../StorageHelper';
|
|
4
4
|
/**
|
|
5
5
|
* Default cache config
|
|
6
6
|
*/
|
|
@@ -11,7 +11,9 @@ export var defaultConfig = {
|
|
|
11
11
|
defaultTTL: 259200000,
|
|
12
12
|
defaultPriority: 5,
|
|
13
13
|
warningThreshold: 0.8,
|
|
14
|
-
storage
|
|
14
|
+
// the storage helper will check if localStorage exists,
|
|
15
|
+
// if not, will use a in-memory object instead
|
|
16
|
+
storage: new StorageHelper().getStorage(),
|
|
15
17
|
};
|
|
16
18
|
/**
|
|
17
19
|
* 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.64b45b1.0+64b45b1";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export var version = '6.0.1-
|
|
2
|
+
export var version = '6.0.1-preview-testing.64b45b1.0+64b45b1';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { getDefaultStorageWithFallback } from '../storage/utils';
|
|
4
3
|
import { isBrowser } from '../Util/JS';
|
|
4
|
+
import { StorageHelper } from '../StorageHelper';
|
|
5
5
|
export var Linking = {};
|
|
6
6
|
export var AppState = {
|
|
7
7
|
addEventListener: function (action, handler) { return undefined; },
|
|
@@ -9,5 +9,5 @@ export var AppState = {
|
|
|
9
9
|
};
|
|
10
10
|
// if not in react native, just use local storage
|
|
11
11
|
export var AsyncStorage = isBrowser()
|
|
12
|
-
?
|
|
12
|
+
? new StorageHelper().getStorage()
|
|
13
13
|
: 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,3 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
var __assign = (this && this.__assign) || function () {
|
|
4
|
-
__assign = Object.assign || function(t) {
|
|
5
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
-
s = arguments[i];
|
|
7
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
-
t[p] = s[p];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
return __assign.apply(this, arguments);
|
|
13
|
-
};
|
|
14
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -47,60 +34,101 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
34
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
35
|
}
|
|
49
36
|
};
|
|
50
|
-
|
|
37
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
38
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
import * as Cookies from 'js-cookie';
|
|
51
41
|
var CookieStorage = /** @class */ (function () {
|
|
52
42
|
function CookieStorage(data) {
|
|
53
43
|
if (data === void 0) { data = {}; }
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
if (data.domain) {
|
|
45
|
+
this.domain = data.domain;
|
|
46
|
+
}
|
|
47
|
+
if (data.path) {
|
|
48
|
+
this.path = data.path;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.path = '/';
|
|
52
|
+
}
|
|
53
|
+
if (Object.prototype.hasOwnProperty.call(data, 'expires')) {
|
|
54
|
+
this.expires = data.expires;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.expires = 365;
|
|
58
|
+
}
|
|
59
|
+
if (Object.prototype.hasOwnProperty.call(data, 'secure')) {
|
|
60
|
+
this.secure = data.secure;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
this.secure = true;
|
|
64
|
+
}
|
|
59
65
|
if (data.hasOwnProperty('sameSite')) {
|
|
60
|
-
if (!sameSite ||
|
|
66
|
+
if (!data.sameSite ||
|
|
67
|
+
!['strict', 'lax', 'none'].includes(data.sameSite)) {
|
|
61
68
|
throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');
|
|
62
69
|
}
|
|
63
|
-
if (sameSite === 'none' && !this.secure) {
|
|
70
|
+
if (data.sameSite === 'none' && !this.secure) {
|
|
64
71
|
throw new Error('sameSite = None requires the Secure attribute in latest browser versions.');
|
|
65
72
|
}
|
|
66
|
-
this.sameSite = sameSite;
|
|
73
|
+
this.sameSite = data.sameSite;
|
|
67
74
|
}
|
|
68
75
|
}
|
|
69
76
|
CookieStorage.prototype.setItem = function (key, value) {
|
|
70
77
|
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
var options;
|
|
71
79
|
return __generator(this, function (_a) {
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
options = {
|
|
81
|
+
path: this.path,
|
|
82
|
+
expires: this.expires,
|
|
83
|
+
domain: this.domain,
|
|
84
|
+
secure: this.secure,
|
|
85
|
+
};
|
|
86
|
+
if (this.sameSite) {
|
|
87
|
+
options.sameSite = this.sameSite;
|
|
88
|
+
}
|
|
89
|
+
Cookies.set(key, value, options);
|
|
90
|
+
return [2 /*return*/, Cookies.get(key)];
|
|
74
91
|
});
|
|
75
92
|
});
|
|
76
93
|
};
|
|
77
94
|
CookieStorage.prototype.getItem = function (key) {
|
|
78
95
|
return __awaiter(this, void 0, void 0, function () {
|
|
79
|
-
var item;
|
|
80
96
|
return __generator(this, function (_a) {
|
|
81
|
-
|
|
82
|
-
return [2 /*return*/, item !== null && item !== void 0 ? item : null];
|
|
97
|
+
return [2 /*return*/, Cookies.get(key)];
|
|
83
98
|
});
|
|
84
99
|
});
|
|
85
100
|
};
|
|
86
101
|
CookieStorage.prototype.removeItem = function (key) {
|
|
87
102
|
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
+
var options;
|
|
88
104
|
return __generator(this, function (_a) {
|
|
89
|
-
|
|
105
|
+
options = {
|
|
106
|
+
path: this.path,
|
|
107
|
+
expires: this.expires,
|
|
108
|
+
domain: this.domain,
|
|
109
|
+
secure: this.secure,
|
|
110
|
+
};
|
|
111
|
+
if (this.sameSite) {
|
|
112
|
+
options.sameSite = this.sameSite;
|
|
113
|
+
}
|
|
114
|
+
Cookies.remove(key, options);
|
|
90
115
|
return [2 /*return*/];
|
|
91
116
|
});
|
|
92
117
|
});
|
|
93
118
|
};
|
|
94
119
|
CookieStorage.prototype.clear = function () {
|
|
95
120
|
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
-
var
|
|
97
|
-
var _this = this;
|
|
121
|
+
var cookies, numKeys, promiseArray, index;
|
|
98
122
|
return __generator(this, function (_a) {
|
|
99
123
|
switch (_a.label) {
|
|
100
124
|
case 0:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
125
|
+
cookies = Cookies.get();
|
|
126
|
+
numKeys = Object.keys(cookies).length;
|
|
127
|
+
promiseArray = [];
|
|
128
|
+
for (index = 0; index < numKeys; ++index) {
|
|
129
|
+
promiseArray.push(this.removeItem(Object.keys(cookies)[index]));
|
|
130
|
+
}
|
|
131
|
+
return [4 /*yield*/, Promise.all(promiseArray)];
|
|
104
132
|
case 1:
|
|
105
133
|
_a.sent();
|
|
106
134
|
return [2 /*return*/];
|
|
@@ -108,9 +136,6 @@ var CookieStorage = /** @class */ (function () {
|
|
|
108
136
|
});
|
|
109
137
|
});
|
|
110
138
|
};
|
|
111
|
-
CookieStorage.prototype.getData = function () {
|
|
112
|
-
return __assign({ path: this.path, expires: this.expires, domain: this.domain, secure: this.secure }, (this.sameSite && { sameSite: this.sameSite }));
|
|
113
|
-
};
|
|
114
139
|
return CookieStorage;
|
|
115
140
|
}());
|
|
116
141
|
export { 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,79 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
13
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
14
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
15
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
16
|
+
function step(op) {
|
|
17
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
18
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
19
|
+
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;
|
|
20
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
21
|
+
switch (op[0]) {
|
|
22
|
+
case 0: case 1: t = op; break;
|
|
23
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
24
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
25
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
26
|
+
default:
|
|
27
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
28
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
29
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
30
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
31
|
+
if (t[2]) _.ops.pop();
|
|
32
|
+
_.trys.pop(); continue;
|
|
33
|
+
}
|
|
34
|
+
op = body.call(thisArg, _);
|
|
35
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
36
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var MemoryKeyValueStorageClass = /** @class */ (function () {
|
|
40
|
+
function MemoryKeyValueStorageClass() {
|
|
41
|
+
this.myStorage = {};
|
|
42
|
+
}
|
|
43
|
+
MemoryKeyValueStorageClass.prototype.setItem = function (key, value) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
this.myStorage[key] = value;
|
|
47
|
+
return [2 /*return*/];
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
MemoryKeyValueStorageClass.prototype.getItem = function (key) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
return [2 /*return*/, this.myStorage[key]];
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
MemoryKeyValueStorageClass.prototype.removeItem = function (key) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
+
return __generator(this, function (_a) {
|
|
61
|
+
delete this.myStorage[key];
|
|
62
|
+
return [2 /*return*/];
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
MemoryKeyValueStorageClass.prototype.clear = function () {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
+
var _this = this;
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
Object.keys(this.myStorage).forEach(function (key) {
|
|
71
|
+
delete _this.myStorage[key];
|
|
72
|
+
});
|
|
73
|
+
return [2 /*return*/];
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
return MemoryKeyValueStorageClass;
|
|
78
|
+
}());
|
|
79
|
+
export var 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';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var dataMemory = {};
|
|
4
|
+
/** @class */
|
|
5
|
+
var MemoryStorage = /** @class */ (function () {
|
|
6
|
+
function MemoryStorage() {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* This is used to set a specific item in storage
|
|
10
|
+
* @param {string} key - the key for the item
|
|
11
|
+
* @param {object} value - the value
|
|
12
|
+
* @returns {string} value that was set
|
|
13
|
+
*/
|
|
14
|
+
MemoryStorage.setItem = function (key, value) {
|
|
15
|
+
dataMemory[key] = value;
|
|
16
|
+
return dataMemory[key];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* This is used to get a specific key from storage
|
|
20
|
+
* @param {string} key - the key for the item
|
|
21
|
+
* This is used to clear the storage
|
|
22
|
+
* @returns {string} the data item
|
|
23
|
+
*/
|
|
24
|
+
MemoryStorage.getItem = function (key) {
|
|
25
|
+
return Object.prototype.hasOwnProperty.call(dataMemory, key)
|
|
26
|
+
? dataMemory[key]
|
|
27
|
+
: undefined;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* This is used to remove an item from storage
|
|
31
|
+
* @param {string} key - the key being set
|
|
32
|
+
* @returns {string} value - value that was deleted
|
|
33
|
+
*/
|
|
34
|
+
MemoryStorage.removeItem = function (key) {
|
|
35
|
+
return delete dataMemory[key];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* This is used to clear the storage
|
|
39
|
+
* @returns {string} nothing
|
|
40
|
+
*/
|
|
41
|
+
MemoryStorage.clear = function () {
|
|
42
|
+
dataMemory = {};
|
|
43
|
+
return dataMemory;
|
|
44
|
+
};
|
|
45
|
+
return MemoryStorage;
|
|
46
|
+
}());
|
|
47
|
+
export { MemoryStorage };
|
|
48
|
+
var StorageHelper = /** @class */ (function () {
|
|
49
|
+
/**
|
|
50
|
+
* This is used to get a storage object
|
|
51
|
+
* @returns {object} the storage
|
|
52
|
+
*/
|
|
53
|
+
function StorageHelper() {
|
|
54
|
+
try {
|
|
55
|
+
this.storageWindow = window.localStorage;
|
|
56
|
+
this.storageWindow.setItem('aws.amplify.test-ls', 1);
|
|
57
|
+
this.storageWindow.removeItem('aws.amplify.test-ls');
|
|
58
|
+
}
|
|
59
|
+
catch (exception) {
|
|
60
|
+
this.storageWindow = MemoryStorage;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* This is used to return the storage
|
|
65
|
+
* @returns {object} the storage
|
|
66
|
+
*/
|
|
67
|
+
StorageHelper.prototype.getStorage = function () {
|
|
68
|
+
return this.storageWindow;
|
|
69
|
+
};
|
|
70
|
+
return StorageHelper;
|
|
71
|
+
}());
|
|
72
|
+
export { StorageHelper };
|
|
73
|
+
export { SessionStorage } from './sessionStorage';
|
|
74
|
+
export { LocalStorage } from './localStorage';
|
|
75
|
+
export { MemoryKeyValueStorage } from './inMemoryStorage';
|
|
76
|
+
export { CookieStorage } from './cookieStorage';
|