@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
|
@@ -7,7 +7,7 @@ import { PinpointAnalyticsEvent, PinpointSession } from './pinpoint';
|
|
|
7
7
|
export type EventBufferConfig = {
|
|
8
8
|
appId: string;
|
|
9
9
|
bufferSize: number;
|
|
10
|
-
credentials: AuthSession['credentials'];
|
|
10
|
+
credentials: Required<AuthSession>['credentials'];
|
|
11
11
|
identityId: AuthSession['identityId'];
|
|
12
12
|
flushInterval: number;
|
|
13
13
|
flushSize: number;
|
|
@@ -38,7 +38,7 @@ export type PinpointAnalyticsEvent = {
|
|
|
38
38
|
type PinpointCommonParameters = {
|
|
39
39
|
appId: string;
|
|
40
40
|
category: SupportedCategory;
|
|
41
|
-
credentials: AuthSession['credentials'];
|
|
41
|
+
credentials: Required<AuthSession>['credentials'];
|
|
42
42
|
identityId?: AuthSession['identityId'];
|
|
43
43
|
region: string;
|
|
44
44
|
userAgentValue?: string;
|
|
@@ -52,8 +52,7 @@ export class AuthClass {
|
|
|
52
52
|
let userSub: string | undefined;
|
|
53
53
|
|
|
54
54
|
// Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available
|
|
55
|
-
tokens =
|
|
56
|
-
(await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined;
|
|
55
|
+
tokens = await this.getTokens(options);
|
|
57
56
|
|
|
58
57
|
if (tokens) {
|
|
59
58
|
userSub = tokens.accessToken?.payload?.sub;
|
|
@@ -93,4 +92,12 @@ export class AuthClass {
|
|
|
93
92
|
return await this.authOptions.credentialsProvider.clearCredentialsAndIdentityId();
|
|
94
93
|
}
|
|
95
94
|
}
|
|
95
|
+
|
|
96
|
+
async getTokens(
|
|
97
|
+
options: FetchAuthSessionOptions
|
|
98
|
+
): Promise<AuthTokens | undefined> {
|
|
99
|
+
return (
|
|
100
|
+
(await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined
|
|
101
|
+
);
|
|
102
|
+
}
|
|
96
103
|
}
|
|
@@ -63,10 +63,10 @@ export function assertIdentityPooIdConfig(
|
|
|
63
63
|
): asserts cognitoConfig is CognitoIdentityPoolConfig {
|
|
64
64
|
const validConfig = !!cognitoConfig?.identityPoolId;
|
|
65
65
|
return asserts(validConfig, {
|
|
66
|
-
name: '
|
|
67
|
-
message: '
|
|
66
|
+
name: 'InvalidIdentityPoolIdException',
|
|
67
|
+
message: 'Invalid identity pool id provided.',
|
|
68
68
|
recoverySuggestion:
|
|
69
|
-
'Make sure
|
|
69
|
+
'Make sure a valid identityPoolId is given in the config.',
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
|
package/src/singleton/types.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { APIConfig, LibraryAPIOptions } from './API/types';
|
|
5
4
|
import { AnalyticsConfig } from './Analytics/types';
|
|
6
5
|
import {
|
|
7
6
|
AuthConfig,
|
|
@@ -19,7 +18,7 @@ import {
|
|
|
19
18
|
} from './Storage/types';
|
|
20
19
|
|
|
21
20
|
export type ResourcesConfig = {
|
|
22
|
-
API?:
|
|
21
|
+
// API?: {};
|
|
23
22
|
Analytics?: AnalyticsConfig;
|
|
24
23
|
Auth?: AuthConfig;
|
|
25
24
|
// Cache?: CacheConfig;
|
|
@@ -32,14 +31,12 @@ export type ResourcesConfig = {
|
|
|
32
31
|
};
|
|
33
32
|
|
|
34
33
|
export type LibraryOptions = {
|
|
35
|
-
API?: LibraryAPIOptions;
|
|
36
34
|
Auth?: LibraryAuthOptions;
|
|
37
35
|
Storage?: LibraryStorageOptions;
|
|
38
36
|
ssr?: boolean;
|
|
39
37
|
};
|
|
40
38
|
|
|
41
39
|
export {
|
|
42
|
-
APIConfig,
|
|
43
40
|
AuthConfig,
|
|
44
41
|
AuthUserPoolConfig,
|
|
45
42
|
AuthIdentityPoolConfig,
|
package/src/types/storage.ts
CHANGED
|
@@ -1,34 +0,0 @@
|
|
|
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,32 +0,0 @@
|
|
|
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;
|
|
@@ -1,33 +0,0 @@
|
|
|
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,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*/
|
|
4
|
-
export declare class InMemoryStorage implements Storage {
|
|
5
|
-
storage: Map<string, string>;
|
|
6
|
-
get length(): number;
|
|
7
|
-
key(index: number): string | null;
|
|
8
|
-
setItem(key: string, value: string): void;
|
|
9
|
-
getItem(key: string): string | null;
|
|
10
|
-
removeItem(key: string): void;
|
|
11
|
-
clear(): void;
|
|
12
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
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.InMemoryStorage = void 0;
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
var InMemoryStorage = /** @class */ (function () {
|
|
10
|
-
function InMemoryStorage() {
|
|
11
|
-
this.storage = new Map();
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(InMemoryStorage.prototype, "length", {
|
|
14
|
-
get: function () {
|
|
15
|
-
return this.storage.size;
|
|
16
|
-
},
|
|
17
|
-
enumerable: false,
|
|
18
|
-
configurable: true
|
|
19
|
-
});
|
|
20
|
-
InMemoryStorage.prototype.key = function (index) {
|
|
21
|
-
if (index > this.length - 1) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
return Array.from(this.storage.keys())[index];
|
|
25
|
-
};
|
|
26
|
-
InMemoryStorage.prototype.setItem = function (key, value) {
|
|
27
|
-
this.storage.set(key, value);
|
|
28
|
-
};
|
|
29
|
-
InMemoryStorage.prototype.getItem = function (key) {
|
|
30
|
-
var _a;
|
|
31
|
-
return (_a = this.storage.get(key)) !== null && _a !== void 0 ? _a : null;
|
|
32
|
-
};
|
|
33
|
-
InMemoryStorage.prototype.removeItem = function (key) {
|
|
34
|
-
this.storage.delete(key);
|
|
35
|
-
};
|
|
36
|
-
InMemoryStorage.prototype.clear = function () {
|
|
37
|
-
this.storage.clear();
|
|
38
|
-
};
|
|
39
|
-
return InMemoryStorage;
|
|
40
|
-
}());
|
|
41
|
-
exports.InMemoryStorage = InMemoryStorage;
|
|
@@ -1,33 +0,0 @@
|
|
|
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.SessionStorage = void 0;
|
|
21
|
-
var KeyValueStorage_1 = require("./KeyValueStorage");
|
|
22
|
-
var utils_1 = require("./utils");
|
|
23
|
-
/**
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
var SessionStorage = /** @class */ (function (_super) {
|
|
27
|
-
__extends(SessionStorage, _super);
|
|
28
|
-
function SessionStorage() {
|
|
29
|
-
return _super.call(this, (0, utils_1.getSessionStorageWithFallback)()) || this;
|
|
30
|
-
}
|
|
31
|
-
return SessionStorage;
|
|
32
|
-
}(KeyValueStorage_1.KeyValueStorage));
|
|
33
|
-
exports.SessionStorage = SessionStorage;
|
package/lib/storage/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DefaultStorage } from './DefaultStorage';
|
|
2
|
-
import { KeyValueStorage } from './KeyValueStorage';
|
|
3
|
-
import { SessionStorage } from './SessionStorage';
|
|
4
|
-
export { CookieStorage } from './CookieStorage';
|
|
5
|
-
export declare const defaultStorage: DefaultStorage;
|
|
6
|
-
export declare const sessionStorage: SessionStorage;
|
|
7
|
-
export declare const sharedInMemoryStorage: KeyValueStorage;
|
package/lib/storage/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = void 0;
|
|
6
|
-
var DefaultStorage_1 = require("./DefaultStorage");
|
|
7
|
-
var InMemoryStorage_1 = require("./InMemoryStorage");
|
|
8
|
-
var KeyValueStorage_1 = require("./KeyValueStorage");
|
|
9
|
-
var SessionStorage_1 = require("./SessionStorage");
|
|
10
|
-
var CookieStorage_1 = require("./CookieStorage");
|
|
11
|
-
Object.defineProperty(exports, "CookieStorage", { enumerable: true, get: function () { return CookieStorage_1.CookieStorage; } });
|
|
12
|
-
exports.defaultStorage = new DefaultStorage_1.DefaultStorage();
|
|
13
|
-
exports.sessionStorage = new SessionStorage_1.SessionStorage();
|
|
14
|
-
exports.sharedInMemoryStorage = new KeyValueStorage_1.KeyValueStorage(new InMemoryStorage_1.InMemoryStorage());
|
package/lib/storage/utils.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
* @returns Either a reference to window.localStorage or an in-memory storage as fallback
|
|
4
|
-
*/
|
|
5
|
-
export declare const getDefaultStorageWithFallback: () => Storage;
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
* @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
|
|
9
|
-
*/
|
|
10
|
-
export declare const getSessionStorageWithFallback: () => Storage;
|
package/lib/storage/utils.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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.getSessionStorageWithFallback = exports.getDefaultStorageWithFallback = void 0;
|
|
6
|
-
var InMemoryStorage_1 = require("./InMemoryStorage");
|
|
7
|
-
/**
|
|
8
|
-
* @internal
|
|
9
|
-
* @returns Either a reference to window.localStorage or an in-memory storage as fallback
|
|
10
|
-
*/
|
|
11
|
-
var getDefaultStorageWithFallback = function () {
|
|
12
|
-
return typeof window !== 'undefined' && window.localStorage
|
|
13
|
-
? window.localStorage
|
|
14
|
-
: new InMemoryStorage_1.InMemoryStorage();
|
|
15
|
-
};
|
|
16
|
-
exports.getDefaultStorageWithFallback = getDefaultStorageWithFallback;
|
|
17
|
-
/**
|
|
18
|
-
* @internal
|
|
19
|
-
* @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
|
|
20
|
-
*/
|
|
21
|
-
var getSessionStorageWithFallback = function () {
|
|
22
|
-
return typeof window !== 'undefined' && window.sessionStorage
|
|
23
|
-
? window.sessionStorage
|
|
24
|
-
: new InMemoryStorage_1.InMemoryStorage();
|
|
25
|
-
};
|
|
26
|
-
exports.getSessionStorageWithFallback = getSessionStorageWithFallback;
|
|
@@ -1,34 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
var __extends = (this && this.__extends) || (function () {
|
|
4
|
-
var extendStatics = function (d, b) {
|
|
5
|
-
extendStatics = Object.setPrototypeOf ||
|
|
6
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
-
return extendStatics(d, b);
|
|
9
|
-
};
|
|
10
|
-
return function (d, b) {
|
|
11
|
-
if (typeof b !== "function" && b !== null)
|
|
12
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
-
extendStatics(d, b);
|
|
14
|
-
function __() { this.constructor = d; }
|
|
15
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
-
};
|
|
17
|
-
})();
|
|
18
|
-
import { KeyValueStorage } from './KeyValueStorage';
|
|
19
|
-
/**
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
var CookieStorage = /** @class */ (function (_super) {
|
|
23
|
-
__extends(CookieStorage, _super);
|
|
24
|
-
function CookieStorage() {
|
|
25
|
-
return _super.call(this) || this;
|
|
26
|
-
}
|
|
27
|
-
return CookieStorage;
|
|
28
|
-
}(KeyValueStorage));
|
|
29
|
-
export { CookieStorage };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
var __extends = (this && this.__extends) || (function () {
|
|
4
|
-
var extendStatics = function (d, b) {
|
|
5
|
-
extendStatics = Object.setPrototypeOf ||
|
|
6
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
-
return extendStatics(d, b);
|
|
9
|
-
};
|
|
10
|
-
return function (d, b) {
|
|
11
|
-
if (typeof b !== "function" && b !== null)
|
|
12
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
-
extendStatics(d, b);
|
|
14
|
-
function __() { this.constructor = d; }
|
|
15
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
-
};
|
|
17
|
-
})();
|
|
18
|
-
import { KeyValueStorage } from './KeyValueStorage';
|
|
19
|
-
import { getDefaultStorageWithFallback } from './utils';
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
var DefaultStorage = /** @class */ (function (_super) {
|
|
24
|
-
__extends(DefaultStorage, _super);
|
|
25
|
-
function DefaultStorage() {
|
|
26
|
-
return _super.call(this, getDefaultStorageWithFallback()) || this;
|
|
27
|
-
}
|
|
28
|
-
return DefaultStorage;
|
|
29
|
-
}(KeyValueStorage));
|
|
30
|
-
export { DefaultStorage };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*/
|
|
4
|
-
export declare class InMemoryStorage implements Storage {
|
|
5
|
-
storage: Map<string, string>;
|
|
6
|
-
get length(): number;
|
|
7
|
-
key(index: number): string | null;
|
|
8
|
-
setItem(key: string, value: string): void;
|
|
9
|
-
getItem(key: string): string | null;
|
|
10
|
-
removeItem(key: string): void;
|
|
11
|
-
clear(): void;
|
|
12
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
var InMemoryStorage = /** @class */ (function () {
|
|
7
|
-
function InMemoryStorage() {
|
|
8
|
-
this.storage = new Map();
|
|
9
|
-
}
|
|
10
|
-
Object.defineProperty(InMemoryStorage.prototype, "length", {
|
|
11
|
-
get: function () {
|
|
12
|
-
return this.storage.size;
|
|
13
|
-
},
|
|
14
|
-
enumerable: false,
|
|
15
|
-
configurable: true
|
|
16
|
-
});
|
|
17
|
-
InMemoryStorage.prototype.key = function (index) {
|
|
18
|
-
if (index > this.length - 1) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
return Array.from(this.storage.keys())[index];
|
|
22
|
-
};
|
|
23
|
-
InMemoryStorage.prototype.setItem = function (key, value) {
|
|
24
|
-
this.storage.set(key, value);
|
|
25
|
-
};
|
|
26
|
-
InMemoryStorage.prototype.getItem = function (key) {
|
|
27
|
-
var _a;
|
|
28
|
-
return (_a = this.storage.get(key)) !== null && _a !== void 0 ? _a : null;
|
|
29
|
-
};
|
|
30
|
-
InMemoryStorage.prototype.removeItem = function (key) {
|
|
31
|
-
this.storage.delete(key);
|
|
32
|
-
};
|
|
33
|
-
InMemoryStorage.prototype.clear = function () {
|
|
34
|
-
this.storage.clear();
|
|
35
|
-
};
|
|
36
|
-
return InMemoryStorage;
|
|
37
|
-
}());
|
|
38
|
-
export { InMemoryStorage };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
var __extends = (this && this.__extends) || (function () {
|
|
4
|
-
var extendStatics = function (d, b) {
|
|
5
|
-
extendStatics = Object.setPrototypeOf ||
|
|
6
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
7
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
8
|
-
return extendStatics(d, b);
|
|
9
|
-
};
|
|
10
|
-
return function (d, b) {
|
|
11
|
-
if (typeof b !== "function" && b !== null)
|
|
12
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
13
|
-
extendStatics(d, b);
|
|
14
|
-
function __() { this.constructor = d; }
|
|
15
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16
|
-
};
|
|
17
|
-
})();
|
|
18
|
-
import { KeyValueStorage } from './KeyValueStorage';
|
|
19
|
-
import { getSessionStorageWithFallback } from './utils';
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
var SessionStorage = /** @class */ (function (_super) {
|
|
24
|
-
__extends(SessionStorage, _super);
|
|
25
|
-
function SessionStorage() {
|
|
26
|
-
return _super.call(this, getSessionStorageWithFallback()) || this;
|
|
27
|
-
}
|
|
28
|
-
return SessionStorage;
|
|
29
|
-
}(KeyValueStorage));
|
|
30
|
-
export { SessionStorage };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DefaultStorage } from './DefaultStorage';
|
|
2
|
-
import { KeyValueStorage } from './KeyValueStorage';
|
|
3
|
-
import { SessionStorage } from './SessionStorage';
|
|
4
|
-
export { CookieStorage } from './CookieStorage';
|
|
5
|
-
export declare const defaultStorage: DefaultStorage;
|
|
6
|
-
export declare const sessionStorage: SessionStorage;
|
|
7
|
-
export declare const sharedInMemoryStorage: KeyValueStorage;
|
package/lib-esm/storage/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { DefaultStorage } from './DefaultStorage';
|
|
4
|
-
import { InMemoryStorage } from './InMemoryStorage';
|
|
5
|
-
import { KeyValueStorage } from './KeyValueStorage';
|
|
6
|
-
import { SessionStorage } from './SessionStorage';
|
|
7
|
-
export { CookieStorage } from './CookieStorage';
|
|
8
|
-
export var defaultStorage = new DefaultStorage();
|
|
9
|
-
export var sessionStorage = new SessionStorage();
|
|
10
|
-
export var sharedInMemoryStorage = new KeyValueStorage(new InMemoryStorage());
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
* @returns Either a reference to window.localStorage or an in-memory storage as fallback
|
|
4
|
-
*/
|
|
5
|
-
export declare const getDefaultStorageWithFallback: () => Storage;
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
* @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
|
|
9
|
-
*/
|
|
10
|
-
export declare const getSessionStorageWithFallback: () => Storage;
|
package/lib-esm/storage/utils.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { InMemoryStorage } from './InMemoryStorage';
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
* @returns Either a reference to window.localStorage or an in-memory storage as fallback
|
|
7
|
-
*/
|
|
8
|
-
export var getDefaultStorageWithFallback = function () {
|
|
9
|
-
return typeof window !== 'undefined' && window.localStorage
|
|
10
|
-
? window.localStorage
|
|
11
|
-
: new InMemoryStorage();
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
* @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
|
|
16
|
-
*/
|
|
17
|
-
export var getSessionStorageWithFallback = function () {
|
|
18
|
-
return typeof window !== 'undefined' && window.sessionStorage
|
|
19
|
-
? window.sessionStorage
|
|
20
|
-
: new InMemoryStorage();
|
|
21
|
-
};
|