@aws-amplify/core 5.8.2 → 6.0.1-console-preview.7919075.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/README.md +3 -0
- package/lib/Amplify.d.ts +18 -17
- package/lib/Amplify.js +9 -0
- package/lib/AwsClients/CognitoIdentity/base.d.ts +3 -10
- package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +3 -17
- package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +8 -8
- package/lib/AwsClients/CognitoIdentity/getId.d.ts +3 -17
- package/lib/AwsClients/Pinpoint/base.d.ts +2 -10
- package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +3 -17
- package/lib/AwsClients/Pinpoint/getInAppMessages.js +1 -1
- package/lib/AwsClients/Pinpoint/putEvents.d.ts +3 -17
- package/lib/AwsClients/Pinpoint/putEvents.js +6 -0
- package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +3 -17
- package/lib/AwsClients/Pinpoint/updateEndpoint.js +2 -2
- package/lib/Cache/AsyncStorageCache.d.ts +154 -0
- package/lib/Cache/AsyncStorageCache.js +744 -0
- package/lib/Cache/BrowserStorageCache.d.ts +166 -0
- package/lib/Cache/BrowserStorageCache.js +469 -0
- package/lib/Cache/InMemoryCache.d.ts +129 -0
- package/lib/Cache/InMemoryCache.js +349 -0
- package/lib/Cache/StorageCache.d.ts +39 -0
- package/lib/Cache/StorageCache.js +121 -0
- package/lib/Cache/Utils/CacheList.d.ts +89 -0
- package/lib/Cache/Utils/CacheList.js +196 -0
- package/lib/Cache/Utils/CacheUtils.d.ts +25 -0
- package/lib/Cache/Utils/CacheUtils.js +88 -0
- package/lib/Cache/Utils/index.d.ts +2 -0
- package/lib/Cache/Utils/index.js +16 -0
- package/lib/Cache/reactnative.d.ts +3 -0
- package/lib/Cache/reactnative.js +8 -0
- package/lib/Cache/types/Cache.d.ts +55 -0
- package/lib/Cache/types/Cache.js +4 -0
- package/lib/Cache/types/index.d.ts +1 -0
- package/lib/Cache/types/index.js +19 -0
- package/lib/ClientDevice/android.js +3 -2
- package/lib/ClientDevice/ios.d.ts +2 -2
- package/lib/ClientDevice/ios.js +3 -2
- package/lib/ClientDevice/reactnative.js +3 -2
- package/lib/Credentials.d.ts +1 -1
- package/lib/Credentials.js +2 -1
- package/lib/Errors.d.ts +19 -0
- package/lib/Errors.js +50 -1
- package/lib/Hub.js +1 -0
- package/lib/I18n/I18n.d.ts +29 -9
- package/lib/I18n/I18n.js +30 -5
- package/lib/I18n/index.d.ts +18 -5
- package/lib/I18n/index.js +35 -5
- package/lib/I18n/types.d.ts +4 -1
- package/lib/I18n/types.js +3 -0
- package/lib/JS.d.ts +6 -6
- package/lib/Logger/ConsoleLogger.d.ts +11 -11
- package/lib/OAuthHelper/GoogleOAuth.js +2 -1
- package/lib/Platform/detectFramework.js +2 -1
- package/lib/Platform/detection/Next.d.ts +1 -1
- package/lib/Platform/detection/React.js +1 -0
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/Providers/AWSCloudWatchProvider.d.ts +2 -2
- package/lib/Providers/AWSCloudWatchProvider.js +35 -12
- package/lib/RNComponents/index.d.ts +1 -1
- package/lib/RNComponents/reactnative.js +3 -2
- package/lib/ServiceWorker/ServiceWorker.d.ts +4 -4
- package/lib/ServiceWorker/ServiceWorker.js +37 -11
- package/lib/Signer.d.ts +14 -1
- package/lib/StorageHelper/cookieStorage.d.ts +13 -0
- package/lib/StorageHelper/cookieStorage.js +167 -0
- package/lib/StorageHelper/inMemoryStorage.d.ts +10 -0
- package/lib/StorageHelper/inMemoryStorage.js +82 -0
- package/lib/StorageHelper/index.d.ts +7 -3
- package/lib/StorageHelper/index.js +9 -1
- package/lib/StorageHelper/localStorage.d.ts +32 -0
- package/lib/StorageHelper/localStorage.js +114 -0
- package/lib/StorageHelper/reactnative.d.ts +71 -1
- package/lib/StorageHelper/reactnative.js +154 -10
- package/lib/StorageHelper/sessionStorage.d.ts +32 -0
- package/lib/StorageHelper/sessionStorage.js +114 -0
- package/lib/UniversalStorage/index.d.ts +2 -2
- package/lib/Util/BackgroundProcessManager.d.ts +2 -2
- package/lib/Util/BackgroundProcessManager.js +1 -0
- package/lib/Util/DateUtils.d.ts +12 -1
- package/lib/Util/Reachability.js +7 -5
- package/lib/Util/Reachability.native.d.ts +3 -2
- package/lib/Util/StringUtils.js +3 -10
- package/lib/Util/errors/AssertError.d.ts +2 -0
- package/lib/Util/errors/AssertError.js +11 -0
- package/lib/clients/middleware/retry/defaultRetryDecider.d.ts +1 -1
- package/lib/clients/middleware/retry/defaultRetryDecider.js +17 -13
- package/lib/clients/middleware/retry/isClockSkewError.js +1 -1
- package/lib/clients/middleware/retry/middleware.d.ts +1 -1
- package/lib/clients/middleware/retry/middleware.js +13 -13
- package/lib/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +1 -1
- package/lib/clients/serde/responseInfo.js +1 -1
- package/lib/clients/types/aws.d.ts +4 -0
- package/lib/clients/types/index.d.ts +1 -1
- package/lib/constants.d.ts +7 -0
- package/lib/constants.js +9 -1
- package/lib/index.d.ts +18 -4
- package/lib/index.js +32 -5
- package/lib/parseAWSExports.d.ts +1 -1
- package/lib/singleton/Auth/index.d.ts +30 -0
- package/lib/singleton/Auth/index.js +133 -0
- package/lib/singleton/Auth/types.d.ts +95 -0
- package/lib/singleton/Auth/types.js +6 -0
- package/lib/singleton/Auth/utils/index.d.ts +5 -0
- package/lib/singleton/Auth/utils/index.js +52 -0
- package/lib/singleton/Storage/types.d.ts +14 -0
- package/lib/singleton/Storage/types.js +4 -0
- package/lib/singleton/index.d.ts +46 -0
- package/lib/singleton/index.js +160 -0
- package/lib/singleton/types.d.ts +21 -0
- package/lib/singleton/types.js +4 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/types.d.ts +31 -1
- package/lib/types/types.js +2 -0
- package/lib-esm/Amplify.d.ts +18 -17
- package/lib-esm/Amplify.js +9 -0
- package/lib-esm/AwsClients/CognitoIdentity/base.d.ts +3 -10
- package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +3 -17
- package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +8 -8
- package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +3 -17
- package/lib-esm/AwsClients/Pinpoint/base.d.ts +2 -10
- package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +3 -17
- package/lib-esm/AwsClients/Pinpoint/getInAppMessages.js +1 -1
- package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +3 -17
- package/lib-esm/AwsClients/Pinpoint/putEvents.js +6 -0
- package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +3 -17
- package/lib-esm/AwsClients/Pinpoint/updateEndpoint.js +2 -2
- package/lib-esm/Cache/AsyncStorageCache.d.ts +154 -0
- package/lib-esm/Cache/AsyncStorageCache.js +737 -0
- package/lib-esm/Cache/BrowserStorageCache.d.ts +166 -0
- package/lib-esm/Cache/BrowserStorageCache.js +466 -0
- package/lib-esm/Cache/InMemoryCache.d.ts +129 -0
- package/lib-esm/Cache/InMemoryCache.js +346 -0
- package/lib-esm/Cache/StorageCache.d.ts +39 -0
- package/lib-esm/Cache/StorageCache.js +118 -0
- package/lib-esm/Cache/Utils/CacheList.d.ts +89 -0
- package/lib-esm/Cache/Utils/CacheList.js +194 -0
- package/lib-esm/Cache/Utils/CacheUtils.d.ts +25 -0
- package/lib-esm/Cache/Utils/CacheUtils.js +81 -0
- package/lib-esm/Cache/Utils/index.d.ts +2 -0
- package/lib-esm/Cache/Utils/index.js +4 -0
- package/lib-esm/Cache/reactnative.d.ts +3 -0
- package/lib-esm/Cache/reactnative.js +6 -0
- package/lib-esm/Cache/types/Cache.d.ts +55 -0
- package/lib-esm/Cache/types/Cache.js +3 -0
- package/lib-esm/Cache/types/index.d.ts +1 -0
- package/lib-esm/Cache/types/index.js +3 -0
- package/lib-esm/ClientDevice/android.js +1 -0
- package/lib-esm/ClientDevice/ios.d.ts +2 -2
- package/lib-esm/ClientDevice/ios.js +1 -0
- package/lib-esm/ClientDevice/reactnative.js +1 -0
- package/lib-esm/Credentials.d.ts +1 -1
- package/lib-esm/Credentials.js +2 -1
- package/lib-esm/Errors.d.ts +19 -0
- package/lib-esm/Errors.js +49 -0
- package/lib-esm/Hub.js +1 -0
- package/lib-esm/I18n/I18n.d.ts +29 -9
- package/lib-esm/I18n/I18n.js +30 -5
- package/lib-esm/I18n/index.d.ts +18 -5
- package/lib-esm/I18n/index.js +35 -5
- package/lib-esm/I18n/types.d.ts +4 -1
- package/lib-esm/I18n/types.js +3 -0
- package/lib-esm/JS.d.ts +6 -6
- package/lib-esm/Logger/ConsoleLogger.d.ts +11 -11
- package/lib-esm/OAuthHelper/GoogleOAuth.js +2 -1
- package/lib-esm/Platform/detectFramework.js +2 -1
- package/lib-esm/Platform/detection/Next.d.ts +1 -1
- package/lib-esm/Platform/detection/React.js +1 -0
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/Providers/AWSCloudWatchProvider.d.ts +2 -2
- package/lib-esm/Providers/AWSCloudWatchProvider.js +33 -10
- package/lib-esm/RNComponents/index.d.ts +1 -1
- package/lib-esm/RNComponents/reactnative.js +1 -0
- package/lib-esm/ServiceWorker/ServiceWorker.d.ts +4 -4
- package/lib-esm/ServiceWorker/ServiceWorker.js +37 -11
- package/lib-esm/Signer.d.ts +14 -1
- package/lib-esm/StorageHelper/cookieStorage.d.ts +13 -0
- package/lib-esm/StorageHelper/cookieStorage.js +141 -0
- package/lib-esm/StorageHelper/inMemoryStorage.d.ts +10 -0
- package/lib-esm/StorageHelper/inMemoryStorage.js +79 -0
- package/lib-esm/StorageHelper/index.d.ts +7 -3
- package/lib-esm/StorageHelper/index.js +4 -0
- package/lib-esm/StorageHelper/localStorage.d.ts +32 -0
- package/lib-esm/StorageHelper/localStorage.js +111 -0
- package/lib-esm/StorageHelper/reactnative.d.ts +71 -1
- package/lib-esm/StorageHelper/reactnative.js +153 -9
- package/lib-esm/StorageHelper/sessionStorage.d.ts +32 -0
- package/lib-esm/StorageHelper/sessionStorage.js +111 -0
- package/lib-esm/UniversalStorage/index.d.ts +2 -2
- package/lib-esm/Util/BackgroundProcessManager.d.ts +2 -2
- package/lib-esm/Util/BackgroundProcessManager.js +1 -0
- package/lib-esm/Util/DateUtils.d.ts +12 -1
- package/lib-esm/Util/Reachability.js +5 -3
- package/lib-esm/Util/Reachability.native.d.ts +3 -2
- package/lib-esm/Util/StringUtils.js +3 -10
- package/lib-esm/Util/errors/AssertError.d.ts +2 -0
- package/lib-esm/Util/errors/AssertError.js +7 -0
- package/lib-esm/clients/middleware/retry/defaultRetryDecider.d.ts +1 -1
- package/lib-esm/clients/middleware/retry/defaultRetryDecider.js +17 -13
- package/lib-esm/clients/middleware/retry/isClockSkewError.js +1 -1
- package/lib-esm/clients/middleware/retry/middleware.d.ts +1 -1
- package/lib-esm/clients/middleware/retry/middleware.js +13 -13
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +1 -1
- package/lib-esm/clients/serde/responseInfo.js +1 -1
- package/lib-esm/clients/types/aws.d.ts +4 -0
- package/lib-esm/clients/types/index.d.ts +1 -1
- package/lib-esm/constants.d.ts +7 -0
- package/lib-esm/constants.js +8 -0
- package/lib-esm/index.d.ts +18 -4
- package/lib-esm/index.js +15 -3
- package/lib-esm/parseAWSExports.d.ts +1 -1
- package/lib-esm/singleton/Auth/index.d.ts +30 -0
- package/lib-esm/singleton/Auth/index.js +129 -0
- package/lib-esm/singleton/Auth/types.d.ts +95 -0
- package/lib-esm/singleton/Auth/types.js +5 -0
- package/lib-esm/singleton/Auth/utils/index.d.ts +5 -0
- package/lib-esm/singleton/Auth/utils/index.js +45 -0
- package/lib-esm/singleton/Storage/types.d.ts +14 -0
- package/lib-esm/singleton/Storage/types.js +3 -0
- package/lib-esm/singleton/index.d.ts +46 -0
- package/lib-esm/singleton/index.js +156 -0
- package/lib-esm/singleton/types.d.ts +21 -0
- package/lib-esm/singleton/types.js +3 -0
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/types.d.ts +31 -1
- package/lib-esm/types/types.js +2 -0
- package/package.json +38 -15
- package/src/Amplify.ts +9 -3
- package/src/AwsClients/CognitoIdentity/base.ts +2 -1
- package/src/AwsClients/CognitoIdentity/getCredentialsForIdentity.ts +13 -6
- package/src/AwsClients/Pinpoint/base.ts +6 -2
- package/src/AwsClients/Pinpoint/getInAppMessages.ts +1 -1
- package/src/AwsClients/Pinpoint/putEvents.ts +6 -0
- package/src/AwsClients/Pinpoint/updateEndpoint.ts +2 -2
- package/src/Cache/AsyncStorageCache.ts +500 -0
- package/src/Cache/BrowserStorageCache.ts +517 -0
- package/src/Cache/CHANGELOG.md +1227 -0
- package/src/Cache/InMemoryCache.ts +354 -0
- package/src/Cache/StorageCache.ts +157 -0
- package/src/Cache/Utils/CacheList.ts +198 -0
- package/src/Cache/Utils/CacheUtils.ts +92 -0
- package/src/Cache/Utils/index.ts +11 -0
- package/src/Cache/reactnative.ts +9 -0
- package/src/Cache/types/Cache.ts +75 -0
- package/src/Cache/types/index.ts +4 -0
- package/src/ClientDevice/android.ts +1 -1
- package/src/ClientDevice/ios.ts +2 -2
- package/src/ClientDevice/reactnative.ts +1 -1
- package/src/Credentials.ts +19 -17
- package/src/Errors.ts +41 -0
- package/src/Hub.ts +1 -0
- package/src/I18n/I18n.ts +40 -12
- package/src/I18n/index.ts +45 -12
- package/src/I18n/types.ts +3 -0
- package/src/JS.ts +24 -17
- package/src/Logger/ConsoleLogger.ts +10 -10
- package/src/OAuthHelper/FacebookOAuth.ts +2 -2
- package/src/OAuthHelper/GoogleOAuth.ts +9 -6
- package/src/Platform/detectFramework.ts +1 -1
- package/src/Platform/detection/React.ts +5 -3
- package/src/Platform/version.ts +1 -1
- package/src/Providers/AWSCloudWatchProvider.ts +39 -14
- package/src/RNComponents/index.ts +1 -1
- package/src/RNComponents/reactnative.ts +1 -1
- package/src/ServiceWorker/ServiceWorker.ts +58 -18
- package/src/Signer.ts +22 -3
- package/src/StorageHelper/cookieStorage.ts +99 -0
- package/src/StorageHelper/inMemoryStorage.ts +32 -0
- package/src/StorageHelper/index.ts +6 -1
- package/src/StorageHelper/localStorage.ts +60 -0
- package/src/StorageHelper/reactnative.ts +94 -14
- package/src/StorageHelper/sessionStorage.ts +60 -0
- package/src/Util/BackgroundProcessManager.ts +33 -9
- package/src/Util/DateUtils.ts +14 -5
- package/src/Util/Reachability.native.ts +3 -2
- package/src/Util/Reachability.ts +9 -7
- package/src/Util/Retry.ts +2 -1
- package/src/Util/StringUtils.ts +3 -10
- package/src/Util/errors/AssertError.ts +11 -0
- package/src/clients/handlers/fetch.ts +2 -2
- package/src/clients/middleware/retry/defaultRetryDecider.ts +12 -6
- package/src/clients/middleware/retry/isClockSkewError.ts +1 -1
- package/src/clients/middleware/retry/middleware.ts +9 -9
- package/src/clients/middleware/signing/middleware.ts +1 -1
- package/src/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.ts +1 -1
- package/src/clients/serde/responseInfo.ts +2 -1
- package/src/clients/types/aws.ts +10 -0
- package/src/clients/types/index.ts +1 -0
- package/src/constants.ts +16 -0
- package/src/global.d.ts +11 -0
- package/src/index.ts +66 -4
- package/src/parseAWSExports.ts +1 -1
- package/src/singleton/Auth/index.ts +113 -0
- package/src/singleton/Auth/types.ts +129 -0
- package/src/singleton/Auth/utils/index.ts +68 -0
- package/src/singleton/Storage/types.ts +21 -0
- package/src/singleton/index.ts +144 -0
- package/src/singleton/types.ts +48 -0
- package/src/types/types.ts +38 -1
package/lib-esm/types/types.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface ICredentials {
|
|
|
25
25
|
* @private
|
|
26
26
|
* Internal use of Amplify only
|
|
27
27
|
*/
|
|
28
|
-
export type DelayFunction = (attempt: number, args?: any[], error?:
|
|
28
|
+
export type DelayFunction = (attempt: number, args?: any[], error?: unknown) => number | false;
|
|
29
29
|
export interface LoggingProvider {
|
|
30
30
|
getProviderName(): string;
|
|
31
31
|
getCategoryName(): string;
|
|
@@ -44,3 +44,33 @@ export interface CloudWatchDataTracker {
|
|
|
44
44
|
logEvents: InputLogEvent[];
|
|
45
45
|
verifiedLogGroup?: LogGroup;
|
|
46
46
|
}
|
|
47
|
+
export type ErrorParams = {
|
|
48
|
+
message: string;
|
|
49
|
+
name: string;
|
|
50
|
+
recoverySuggestion?: string;
|
|
51
|
+
underlyingError?: Error | unknown;
|
|
52
|
+
};
|
|
53
|
+
export type AmplifyErrorMap<ErrorCode extends string> = {
|
|
54
|
+
[name in ErrorCode]: {
|
|
55
|
+
message: string;
|
|
56
|
+
recoverySuggestion?: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export type ServiceError = {
|
|
60
|
+
name: string;
|
|
61
|
+
message: string;
|
|
62
|
+
};
|
|
63
|
+
export interface KeyValueStorageInterface {
|
|
64
|
+
setItem(key: string, value: string): Promise<void>;
|
|
65
|
+
getItem(key: string): Promise<string | null>;
|
|
66
|
+
removeItem(key: string): Promise<void>;
|
|
67
|
+
clear(): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
export type SameSite = 'strict' | 'lax' | 'none';
|
|
70
|
+
export type CookieStorageData = {
|
|
71
|
+
domain?: string;
|
|
72
|
+
path?: string;
|
|
73
|
+
expires?: number;
|
|
74
|
+
secure?: boolean;
|
|
75
|
+
sameSite?: SameSite;
|
|
76
|
+
};
|
package/lib-esm/types/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1-console-preview.7919075.0+7919075",
|
|
4
4
|
"description": "Core category of aws-amplify",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
"./lib/I18n/index.js",
|
|
13
13
|
"./lib/Credentials.js",
|
|
14
14
|
"./lib-esm/I18n/index.js",
|
|
15
|
-
"./lib-esm/Credentials.js"
|
|
15
|
+
"./lib-esm/Credentials.js",
|
|
16
|
+
"./lib/Cache/BrowserStorageCache.js",
|
|
17
|
+
"./lib/Cache/AsyncStorageCache.js",
|
|
18
|
+
"./lib-esm/Cache/BrowserStorageCache.js",
|
|
19
|
+
"./lib-esm/Cache/AsyncStorageCache.js"
|
|
16
20
|
],
|
|
17
21
|
"scripts": {
|
|
18
22
|
"test": "npm run lint && jest -w 1 --coverage",
|
|
@@ -30,13 +34,14 @@
|
|
|
30
34
|
"format": "echo \"Not implemented\"",
|
|
31
35
|
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
|
|
32
36
|
"prepublishOnly": "npm run build",
|
|
33
|
-
"ts-coverage": "typescript-coverage-report -p ./tsconfig.
|
|
37
|
+
"ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 92.36"
|
|
34
38
|
},
|
|
35
39
|
"react-native": {
|
|
36
40
|
"./lib/index": "./lib-esm/index.js",
|
|
37
41
|
"./lib-esm/ClientDevice": "./lib-esm/ClientDevice/reactnative.js",
|
|
38
42
|
"./lib-esm/RNComponents": "./lib-esm/RNComponents/reactnative.js",
|
|
39
|
-
"./lib-esm/StorageHelper": "./lib-esm/StorageHelper/reactnative.js"
|
|
43
|
+
"./lib-esm/StorageHelper": "./lib-esm/StorageHelper/reactnative.js",
|
|
44
|
+
"./lib-esm/Cache": "./lib-esm/Cache/reactnative.js"
|
|
40
45
|
},
|
|
41
46
|
"repository": {
|
|
42
47
|
"type": "git",
|
|
@@ -48,13 +53,6 @@
|
|
|
48
53
|
"url": "https://github.com/aws/aws-amplify/issues"
|
|
49
54
|
},
|
|
50
55
|
"homepage": "https://aws-amplify.github.io/",
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@react-native-async-storage/async-storage": "^1.17.12",
|
|
53
|
-
"find": "^0.2.7",
|
|
54
|
-
"genversion": "^2.2.0",
|
|
55
|
-
"react-native": "^0.68.7",
|
|
56
|
-
"typescript": "5.0.2"
|
|
57
|
-
},
|
|
58
56
|
"files": [
|
|
59
57
|
"lib",
|
|
60
58
|
"lib-esm",
|
|
@@ -70,17 +68,26 @@
|
|
|
70
68
|
"@aws-sdk/util-hex-encoding": "3.6.1",
|
|
71
69
|
"@types/node-fetch": "2.6.4",
|
|
72
70
|
"isomorphic-unfetch": "^3.0.0",
|
|
71
|
+
"js-cookie": "^2.2.1",
|
|
73
72
|
"react-native-url-polyfill": "^1.3.0",
|
|
74
|
-
"
|
|
73
|
+
"rxjs": "^7.8.1",
|
|
74
|
+
"tslib": "^2.5.0",
|
|
75
75
|
"universal-cookie": "^4.0.4",
|
|
76
76
|
"zen-observable-ts": "0.8.19"
|
|
77
77
|
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@react-native-async-storage/async-storage": "^1.17.12",
|
|
80
|
+
"find": "^0.2.7",
|
|
81
|
+
"genversion": "^2.2.0",
|
|
82
|
+
"react-native": "^0.68.7",
|
|
83
|
+
"typescript": "5.0.2"
|
|
84
|
+
},
|
|
78
85
|
"size-limit": [
|
|
79
86
|
{
|
|
80
87
|
"name": "Core (ServiceWorker)",
|
|
81
88
|
"path": "./lib-esm/index.js",
|
|
82
89
|
"import": "{ ServiceWorker }",
|
|
83
|
-
"limit": "2.
|
|
90
|
+
"limit": "2.41 kB"
|
|
84
91
|
},
|
|
85
92
|
{
|
|
86
93
|
"name": "Core (Hub)",
|
|
@@ -92,7 +99,7 @@
|
|
|
92
99
|
"name": "Core (I18n)",
|
|
93
100
|
"path": "./lib-esm/index.js",
|
|
94
101
|
"import": "{ I18n }",
|
|
95
|
-
"limit": "2.
|
|
102
|
+
"limit": "2.17 kB"
|
|
96
103
|
},
|
|
97
104
|
{
|
|
98
105
|
"name": "Core (Logger)",
|
|
@@ -147,6 +154,18 @@
|
|
|
147
154
|
"path": "./lib-esm/clients/middleware/signing/signer/signatureV4/index.js",
|
|
148
155
|
"import": "{ presignUrl }",
|
|
149
156
|
"limit": "6.3 kB"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "Cache (default browser storage)",
|
|
160
|
+
"path": "./lib-esm/index.js",
|
|
161
|
+
"import": "{ Cache }",
|
|
162
|
+
"limit": "4.66 kB"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "Cache (in-memory)",
|
|
166
|
+
"path": "./lib-esm/index.js",
|
|
167
|
+
"import": "{ InMemoryCache }",
|
|
168
|
+
"limit": "4.35 kB"
|
|
150
169
|
}
|
|
151
170
|
],
|
|
152
171
|
"jest": {
|
|
@@ -170,6 +189,10 @@
|
|
|
170
189
|
"json",
|
|
171
190
|
"jsx"
|
|
172
191
|
],
|
|
192
|
+
"setupFiles": [
|
|
193
|
+
"./__mocks__/SessionStorage.js",
|
|
194
|
+
"./__mocks__/LocalStorage.js"
|
|
195
|
+
],
|
|
173
196
|
"testEnvironment": "jsdom",
|
|
174
197
|
"coverageThreshold": {
|
|
175
198
|
"global": {
|
|
@@ -187,5 +210,5 @@
|
|
|
187
210
|
"lib-esm"
|
|
188
211
|
]
|
|
189
212
|
},
|
|
190
|
-
"gitHead": "
|
|
213
|
+
"gitHead": "79190755720763a764aa7650655016a6d7b41a11"
|
|
191
214
|
}
|
package/src/Amplify.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
4
|
import { ConsoleLogger as LoggerClass } from './Logger';
|
|
@@ -6,7 +7,7 @@ const logger = new LoggerClass('Amplify');
|
|
|
6
7
|
|
|
7
8
|
export class AmplifyClass {
|
|
8
9
|
// Everything that is `register`ed is tracked here
|
|
9
|
-
private _components = [];
|
|
10
|
+
private _components:any[] = [];
|
|
10
11
|
private _config = {};
|
|
11
12
|
|
|
12
13
|
// All modules (with `getModuleName()`) are stored here for dependency injection
|
|
@@ -34,7 +35,12 @@ export class AmplifyClass {
|
|
|
34
35
|
Logger = LoggerClass;
|
|
35
36
|
ServiceWorker = null;
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
// TODO: update "any" when types are determined
|
|
39
|
+
public get config(): any {
|
|
40
|
+
return Object.assign({}, this._config);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
register(comp:any) {
|
|
38
44
|
logger.debug('component registered in amplify', comp);
|
|
39
45
|
this._components.push(comp);
|
|
40
46
|
if (typeof comp.getModuleName === 'function') {
|
|
@@ -62,7 +68,7 @@ export class AmplifyClass {
|
|
|
62
68
|
// Dependency Injection via property-setting.
|
|
63
69
|
// This avoids introducing a public method/interface/setter that's difficult to remove later.
|
|
64
70
|
// Plus, it reduces `if` statements within the `constructor` and `configure` of each module
|
|
65
|
-
Object.entries(this._modules).forEach(([Name, comp]) => {
|
|
71
|
+
Object.entries(this._modules).forEach(([Name, comp]:[any, any]) => {
|
|
66
72
|
// e.g. Auth.*
|
|
67
73
|
Object.keys(comp).forEach(property => {
|
|
68
74
|
// e.g. Auth["Credentials"] = this._modules["Credentials"] when set
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from '../../clients/middleware/retry';
|
|
20
20
|
import { getAmplifyUserAgent } from '../../Platform';
|
|
21
21
|
import { observeFrameworkChanges } from '../../Platform/detectFramework';
|
|
22
|
+
import { DefaultConfigOptions } from '../../clients/types';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* The service name used to sign requests if the API requires authentication.
|
|
@@ -58,7 +59,7 @@ export const cognitoIdentityTransferHandler = composeTransferHandler<
|
|
|
58
59
|
/**
|
|
59
60
|
* @internal
|
|
60
61
|
*/
|
|
61
|
-
export const defaultConfig = {
|
|
62
|
+
export const defaultConfig: DefaultConfigOptions = {
|
|
62
63
|
service: SERVICE_NAME,
|
|
63
64
|
endpointResolver,
|
|
64
65
|
retryDecider: getRetryDecider(parseJsonError),
|
|
@@ -49,12 +49,19 @@ const getCredentialsForIdentityDeserializer = async (
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
const deserializeCredentials = (
|
|
53
|
-
AccessKeyId
|
|
54
|
-
SecretKey
|
|
55
|
-
SessionToken
|
|
56
|
-
Expiration
|
|
57
|
-
})
|
|
52
|
+
const deserializeCredentials = ({
|
|
53
|
+
AccessKeyId,
|
|
54
|
+
SecretKey,
|
|
55
|
+
SessionToken,
|
|
56
|
+
Expiration,
|
|
57
|
+
}: Credentials = {}): Credentials => {
|
|
58
|
+
return {
|
|
59
|
+
AccessKeyId,
|
|
60
|
+
SecretKey,
|
|
61
|
+
SessionToken,
|
|
62
|
+
Expiration: Expiration && new Date((Expiration as any) * 1000),
|
|
63
|
+
};
|
|
64
|
+
};
|
|
58
65
|
|
|
59
66
|
/**
|
|
60
67
|
* @internal
|
|
@@ -7,7 +7,11 @@ import {
|
|
|
7
7
|
getRetryDecider,
|
|
8
8
|
} from '../../clients/middleware/retry';
|
|
9
9
|
import { parseJsonError } from '../../clients/serde/json';
|
|
10
|
-
import type {
|
|
10
|
+
import type {
|
|
11
|
+
DefaultConfigOptions,
|
|
12
|
+
EndpointResolverOptions,
|
|
13
|
+
Headers,
|
|
14
|
+
} from '../../clients/types';
|
|
11
15
|
import { getAmplifyUserAgent } from '../../Platform';
|
|
12
16
|
|
|
13
17
|
/**
|
|
@@ -25,7 +29,7 @@ const endpointResolver = ({ region }: EndpointResolverOptions) => ({
|
|
|
25
29
|
/**
|
|
26
30
|
* @internal
|
|
27
31
|
*/
|
|
28
|
-
export const defaultConfig = {
|
|
32
|
+
export const defaultConfig: DefaultConfigOptions = {
|
|
29
33
|
service: SERVICE_NAME,
|
|
30
34
|
endpointResolver,
|
|
31
35
|
retryDecider: getRetryDecider(parseJsonError),
|
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
export type { GetInAppMessagesInput, GetInAppMessagesOutput };
|
|
20
20
|
|
|
21
21
|
const getInAppMessagesSerializer = (
|
|
22
|
-
{ ApplicationId, EndpointId }: GetInAppMessagesInput,
|
|
22
|
+
{ ApplicationId = '', EndpointId = '' }: GetInAppMessagesInput,
|
|
23
23
|
endpoint: Endpoint
|
|
24
24
|
): HttpRequest => {
|
|
25
25
|
const headers = getSharedHeaders();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { asserts } from '../../Util/errors/AssertError';
|
|
4
5
|
import { authenticatedHandler } from '../../clients/handlers/authenticated';
|
|
5
6
|
import { composeServiceApi } from '../../clients/internal/composeServiceApi';
|
|
6
7
|
import { extendedEncodeURIComponent } from '../../clients/middleware/signing/utils/extendedEncodeURIComponent';
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
10
11
|
parseMetadata,
|
|
11
12
|
} from '../../clients/serde';
|
|
12
13
|
import { Endpoint, HttpRequest, HttpResponse } from '../../clients/types';
|
|
14
|
+
import { APPLICATION_ID_EXCEPTION } from '../../constants';
|
|
13
15
|
import { defaultConfig, getSharedHeaders } from './base';
|
|
14
16
|
import type {
|
|
15
17
|
PutEventsCommandInput as PutEventsInput,
|
|
@@ -22,6 +24,10 @@ const putEventsSerializer = (
|
|
|
22
24
|
{ ApplicationId, EventsRequest }: PutEventsInput,
|
|
23
25
|
endpoint: Endpoint
|
|
24
26
|
): HttpRequest => {
|
|
27
|
+
asserts(!!ApplicationId, {
|
|
28
|
+
name: APPLICATION_ID_EXCEPTION,
|
|
29
|
+
message: 'ApplicationId is required for putEvents',
|
|
30
|
+
});
|
|
25
31
|
const headers = getSharedHeaders();
|
|
26
32
|
const url = new URL(endpoint.url);
|
|
27
33
|
url.pathname = `v1/apps/${extendedEncodeURIComponent(ApplicationId)}/events`;
|
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
export type { UpdateEndpointInput, UpdateEndpointOutput };
|
|
20
20
|
|
|
21
21
|
const updateEndpointSerializer = (
|
|
22
|
-
{ ApplicationId, EndpointId, EndpointRequest }: UpdateEndpointInput,
|
|
22
|
+
{ ApplicationId = '', EndpointId = '', EndpointRequest }: UpdateEndpointInput,
|
|
23
23
|
endpoint: Endpoint
|
|
24
24
|
): HttpRequest => {
|
|
25
25
|
const headers = getSharedHeaders();
|
|
@@ -27,7 +27,7 @@ const updateEndpointSerializer = (
|
|
|
27
27
|
url.pathname = `v1/apps/${extendedEncodeURIComponent(
|
|
28
28
|
ApplicationId
|
|
29
29
|
)}/endpoints/${extendedEncodeURIComponent(EndpointId)}`;
|
|
30
|
-
const body = JSON.stringify(EndpointRequest
|
|
30
|
+
const body = JSON.stringify(EndpointRequest);
|
|
31
31
|
return { method: 'PUT', headers, url, body };
|
|
32
32
|
};
|
|
33
33
|
|