@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.
Files changed (300) hide show
  1. package/README.md +3 -0
  2. package/lib/Amplify.d.ts +18 -17
  3. package/lib/Amplify.js +9 -0
  4. package/lib/AwsClients/CognitoIdentity/base.d.ts +3 -10
  5. package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +3 -17
  6. package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +8 -8
  7. package/lib/AwsClients/CognitoIdentity/getId.d.ts +3 -17
  8. package/lib/AwsClients/Pinpoint/base.d.ts +2 -10
  9. package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +3 -17
  10. package/lib/AwsClients/Pinpoint/getInAppMessages.js +1 -1
  11. package/lib/AwsClients/Pinpoint/putEvents.d.ts +3 -17
  12. package/lib/AwsClients/Pinpoint/putEvents.js +6 -0
  13. package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +3 -17
  14. package/lib/AwsClients/Pinpoint/updateEndpoint.js +2 -2
  15. package/lib/Cache/AsyncStorageCache.d.ts +154 -0
  16. package/lib/Cache/AsyncStorageCache.js +744 -0
  17. package/lib/Cache/BrowserStorageCache.d.ts +166 -0
  18. package/lib/Cache/BrowserStorageCache.js +469 -0
  19. package/lib/Cache/InMemoryCache.d.ts +129 -0
  20. package/lib/Cache/InMemoryCache.js +349 -0
  21. package/lib/Cache/StorageCache.d.ts +39 -0
  22. package/lib/Cache/StorageCache.js +121 -0
  23. package/lib/Cache/Utils/CacheList.d.ts +89 -0
  24. package/lib/Cache/Utils/CacheList.js +196 -0
  25. package/lib/Cache/Utils/CacheUtils.d.ts +25 -0
  26. package/lib/Cache/Utils/CacheUtils.js +88 -0
  27. package/lib/Cache/Utils/index.d.ts +2 -0
  28. package/lib/Cache/Utils/index.js +16 -0
  29. package/lib/Cache/reactnative.d.ts +3 -0
  30. package/lib/Cache/reactnative.js +8 -0
  31. package/lib/Cache/types/Cache.d.ts +55 -0
  32. package/lib/Cache/types/Cache.js +4 -0
  33. package/lib/Cache/types/index.d.ts +1 -0
  34. package/lib/Cache/types/index.js +19 -0
  35. package/lib/ClientDevice/android.js +3 -2
  36. package/lib/ClientDevice/ios.d.ts +2 -2
  37. package/lib/ClientDevice/ios.js +3 -2
  38. package/lib/ClientDevice/reactnative.js +3 -2
  39. package/lib/Credentials.d.ts +1 -1
  40. package/lib/Credentials.js +2 -1
  41. package/lib/Errors.d.ts +19 -0
  42. package/lib/Errors.js +50 -1
  43. package/lib/Hub.js +1 -0
  44. package/lib/I18n/I18n.d.ts +29 -9
  45. package/lib/I18n/I18n.js +30 -5
  46. package/lib/I18n/index.d.ts +18 -5
  47. package/lib/I18n/index.js +35 -5
  48. package/lib/I18n/types.d.ts +4 -1
  49. package/lib/I18n/types.js +3 -0
  50. package/lib/JS.d.ts +6 -6
  51. package/lib/Logger/ConsoleLogger.d.ts +11 -11
  52. package/lib/OAuthHelper/GoogleOAuth.js +2 -1
  53. package/lib/Platform/detectFramework.js +2 -1
  54. package/lib/Platform/detection/Next.d.ts +1 -1
  55. package/lib/Platform/detection/React.js +1 -0
  56. package/lib/Platform/version.d.ts +1 -1
  57. package/lib/Platform/version.js +1 -1
  58. package/lib/Providers/AWSCloudWatchProvider.d.ts +2 -2
  59. package/lib/Providers/AWSCloudWatchProvider.js +35 -12
  60. package/lib/RNComponents/index.d.ts +1 -1
  61. package/lib/RNComponents/reactnative.js +3 -2
  62. package/lib/ServiceWorker/ServiceWorker.d.ts +4 -4
  63. package/lib/ServiceWorker/ServiceWorker.js +37 -11
  64. package/lib/Signer.d.ts +14 -1
  65. package/lib/StorageHelper/cookieStorage.d.ts +13 -0
  66. package/lib/StorageHelper/cookieStorage.js +167 -0
  67. package/lib/StorageHelper/inMemoryStorage.d.ts +10 -0
  68. package/lib/StorageHelper/inMemoryStorage.js +82 -0
  69. package/lib/StorageHelper/index.d.ts +7 -3
  70. package/lib/StorageHelper/index.js +9 -1
  71. package/lib/StorageHelper/localStorage.d.ts +32 -0
  72. package/lib/StorageHelper/localStorage.js +114 -0
  73. package/lib/StorageHelper/reactnative.d.ts +71 -1
  74. package/lib/StorageHelper/reactnative.js +154 -10
  75. package/lib/StorageHelper/sessionStorage.d.ts +32 -0
  76. package/lib/StorageHelper/sessionStorage.js +114 -0
  77. package/lib/UniversalStorage/index.d.ts +2 -2
  78. package/lib/Util/BackgroundProcessManager.d.ts +2 -2
  79. package/lib/Util/BackgroundProcessManager.js +1 -0
  80. package/lib/Util/DateUtils.d.ts +12 -1
  81. package/lib/Util/Reachability.js +7 -5
  82. package/lib/Util/Reachability.native.d.ts +3 -2
  83. package/lib/Util/StringUtils.js +3 -10
  84. package/lib/Util/errors/AssertError.d.ts +2 -0
  85. package/lib/Util/errors/AssertError.js +11 -0
  86. package/lib/clients/middleware/retry/defaultRetryDecider.d.ts +1 -1
  87. package/lib/clients/middleware/retry/defaultRetryDecider.js +17 -13
  88. package/lib/clients/middleware/retry/isClockSkewError.js +1 -1
  89. package/lib/clients/middleware/retry/middleware.d.ts +1 -1
  90. package/lib/clients/middleware/retry/middleware.js +13 -13
  91. package/lib/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +1 -1
  92. package/lib/clients/serde/responseInfo.js +1 -1
  93. package/lib/clients/types/aws.d.ts +4 -0
  94. package/lib/clients/types/index.d.ts +1 -1
  95. package/lib/constants.d.ts +7 -0
  96. package/lib/constants.js +9 -1
  97. package/lib/index.d.ts +18 -4
  98. package/lib/index.js +32 -5
  99. package/lib/parseAWSExports.d.ts +1 -1
  100. package/lib/singleton/Auth/index.d.ts +30 -0
  101. package/lib/singleton/Auth/index.js +133 -0
  102. package/lib/singleton/Auth/types.d.ts +95 -0
  103. package/lib/singleton/Auth/types.js +6 -0
  104. package/lib/singleton/Auth/utils/index.d.ts +5 -0
  105. package/lib/singleton/Auth/utils/index.js +52 -0
  106. package/lib/singleton/Storage/types.d.ts +14 -0
  107. package/lib/singleton/Storage/types.js +4 -0
  108. package/lib/singleton/index.d.ts +46 -0
  109. package/lib/singleton/index.js +160 -0
  110. package/lib/singleton/types.d.ts +21 -0
  111. package/lib/singleton/types.js +4 -0
  112. package/lib/tsconfig.tsbuildinfo +1 -1
  113. package/lib/types/types.d.ts +31 -1
  114. package/lib/types/types.js +2 -0
  115. package/lib-esm/Amplify.d.ts +18 -17
  116. package/lib-esm/Amplify.js +9 -0
  117. package/lib-esm/AwsClients/CognitoIdentity/base.d.ts +3 -10
  118. package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +3 -17
  119. package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +8 -8
  120. package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +3 -17
  121. package/lib-esm/AwsClients/Pinpoint/base.d.ts +2 -10
  122. package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +3 -17
  123. package/lib-esm/AwsClients/Pinpoint/getInAppMessages.js +1 -1
  124. package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +3 -17
  125. package/lib-esm/AwsClients/Pinpoint/putEvents.js +6 -0
  126. package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +3 -17
  127. package/lib-esm/AwsClients/Pinpoint/updateEndpoint.js +2 -2
  128. package/lib-esm/Cache/AsyncStorageCache.d.ts +154 -0
  129. package/lib-esm/Cache/AsyncStorageCache.js +737 -0
  130. package/lib-esm/Cache/BrowserStorageCache.d.ts +166 -0
  131. package/lib-esm/Cache/BrowserStorageCache.js +466 -0
  132. package/lib-esm/Cache/InMemoryCache.d.ts +129 -0
  133. package/lib-esm/Cache/InMemoryCache.js +346 -0
  134. package/lib-esm/Cache/StorageCache.d.ts +39 -0
  135. package/lib-esm/Cache/StorageCache.js +118 -0
  136. package/lib-esm/Cache/Utils/CacheList.d.ts +89 -0
  137. package/lib-esm/Cache/Utils/CacheList.js +194 -0
  138. package/lib-esm/Cache/Utils/CacheUtils.d.ts +25 -0
  139. package/lib-esm/Cache/Utils/CacheUtils.js +81 -0
  140. package/lib-esm/Cache/Utils/index.d.ts +2 -0
  141. package/lib-esm/Cache/Utils/index.js +4 -0
  142. package/lib-esm/Cache/reactnative.d.ts +3 -0
  143. package/lib-esm/Cache/reactnative.js +6 -0
  144. package/lib-esm/Cache/types/Cache.d.ts +55 -0
  145. package/lib-esm/Cache/types/Cache.js +3 -0
  146. package/lib-esm/Cache/types/index.d.ts +1 -0
  147. package/lib-esm/Cache/types/index.js +3 -0
  148. package/lib-esm/ClientDevice/android.js +1 -0
  149. package/lib-esm/ClientDevice/ios.d.ts +2 -2
  150. package/lib-esm/ClientDevice/ios.js +1 -0
  151. package/lib-esm/ClientDevice/reactnative.js +1 -0
  152. package/lib-esm/Credentials.d.ts +1 -1
  153. package/lib-esm/Credentials.js +2 -1
  154. package/lib-esm/Errors.d.ts +19 -0
  155. package/lib-esm/Errors.js +49 -0
  156. package/lib-esm/Hub.js +1 -0
  157. package/lib-esm/I18n/I18n.d.ts +29 -9
  158. package/lib-esm/I18n/I18n.js +30 -5
  159. package/lib-esm/I18n/index.d.ts +18 -5
  160. package/lib-esm/I18n/index.js +35 -5
  161. package/lib-esm/I18n/types.d.ts +4 -1
  162. package/lib-esm/I18n/types.js +3 -0
  163. package/lib-esm/JS.d.ts +6 -6
  164. package/lib-esm/Logger/ConsoleLogger.d.ts +11 -11
  165. package/lib-esm/OAuthHelper/GoogleOAuth.js +2 -1
  166. package/lib-esm/Platform/detectFramework.js +2 -1
  167. package/lib-esm/Platform/detection/Next.d.ts +1 -1
  168. package/lib-esm/Platform/detection/React.js +1 -0
  169. package/lib-esm/Platform/version.d.ts +1 -1
  170. package/lib-esm/Platform/version.js +1 -1
  171. package/lib-esm/Providers/AWSCloudWatchProvider.d.ts +2 -2
  172. package/lib-esm/Providers/AWSCloudWatchProvider.js +33 -10
  173. package/lib-esm/RNComponents/index.d.ts +1 -1
  174. package/lib-esm/RNComponents/reactnative.js +1 -0
  175. package/lib-esm/ServiceWorker/ServiceWorker.d.ts +4 -4
  176. package/lib-esm/ServiceWorker/ServiceWorker.js +37 -11
  177. package/lib-esm/Signer.d.ts +14 -1
  178. package/lib-esm/StorageHelper/cookieStorage.d.ts +13 -0
  179. package/lib-esm/StorageHelper/cookieStorage.js +141 -0
  180. package/lib-esm/StorageHelper/inMemoryStorage.d.ts +10 -0
  181. package/lib-esm/StorageHelper/inMemoryStorage.js +79 -0
  182. package/lib-esm/StorageHelper/index.d.ts +7 -3
  183. package/lib-esm/StorageHelper/index.js +4 -0
  184. package/lib-esm/StorageHelper/localStorage.d.ts +32 -0
  185. package/lib-esm/StorageHelper/localStorage.js +111 -0
  186. package/lib-esm/StorageHelper/reactnative.d.ts +71 -1
  187. package/lib-esm/StorageHelper/reactnative.js +153 -9
  188. package/lib-esm/StorageHelper/sessionStorage.d.ts +32 -0
  189. package/lib-esm/StorageHelper/sessionStorage.js +111 -0
  190. package/lib-esm/UniversalStorage/index.d.ts +2 -2
  191. package/lib-esm/Util/BackgroundProcessManager.d.ts +2 -2
  192. package/lib-esm/Util/BackgroundProcessManager.js +1 -0
  193. package/lib-esm/Util/DateUtils.d.ts +12 -1
  194. package/lib-esm/Util/Reachability.js +5 -3
  195. package/lib-esm/Util/Reachability.native.d.ts +3 -2
  196. package/lib-esm/Util/StringUtils.js +3 -10
  197. package/lib-esm/Util/errors/AssertError.d.ts +2 -0
  198. package/lib-esm/Util/errors/AssertError.js +7 -0
  199. package/lib-esm/clients/middleware/retry/defaultRetryDecider.d.ts +1 -1
  200. package/lib-esm/clients/middleware/retry/defaultRetryDecider.js +17 -13
  201. package/lib-esm/clients/middleware/retry/isClockSkewError.js +1 -1
  202. package/lib-esm/clients/middleware/retry/middleware.d.ts +1 -1
  203. package/lib-esm/clients/middleware/retry/middleware.js +13 -13
  204. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +1 -1
  205. package/lib-esm/clients/serde/responseInfo.js +1 -1
  206. package/lib-esm/clients/types/aws.d.ts +4 -0
  207. package/lib-esm/clients/types/index.d.ts +1 -1
  208. package/lib-esm/constants.d.ts +7 -0
  209. package/lib-esm/constants.js +8 -0
  210. package/lib-esm/index.d.ts +18 -4
  211. package/lib-esm/index.js +15 -3
  212. package/lib-esm/parseAWSExports.d.ts +1 -1
  213. package/lib-esm/singleton/Auth/index.d.ts +30 -0
  214. package/lib-esm/singleton/Auth/index.js +129 -0
  215. package/lib-esm/singleton/Auth/types.d.ts +95 -0
  216. package/lib-esm/singleton/Auth/types.js +5 -0
  217. package/lib-esm/singleton/Auth/utils/index.d.ts +5 -0
  218. package/lib-esm/singleton/Auth/utils/index.js +45 -0
  219. package/lib-esm/singleton/Storage/types.d.ts +14 -0
  220. package/lib-esm/singleton/Storage/types.js +3 -0
  221. package/lib-esm/singleton/index.d.ts +46 -0
  222. package/lib-esm/singleton/index.js +156 -0
  223. package/lib-esm/singleton/types.d.ts +21 -0
  224. package/lib-esm/singleton/types.js +3 -0
  225. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  226. package/lib-esm/types/types.d.ts +31 -1
  227. package/lib-esm/types/types.js +2 -0
  228. package/package.json +38 -15
  229. package/src/Amplify.ts +9 -3
  230. package/src/AwsClients/CognitoIdentity/base.ts +2 -1
  231. package/src/AwsClients/CognitoIdentity/getCredentialsForIdentity.ts +13 -6
  232. package/src/AwsClients/Pinpoint/base.ts +6 -2
  233. package/src/AwsClients/Pinpoint/getInAppMessages.ts +1 -1
  234. package/src/AwsClients/Pinpoint/putEvents.ts +6 -0
  235. package/src/AwsClients/Pinpoint/updateEndpoint.ts +2 -2
  236. package/src/Cache/AsyncStorageCache.ts +500 -0
  237. package/src/Cache/BrowserStorageCache.ts +517 -0
  238. package/src/Cache/CHANGELOG.md +1227 -0
  239. package/src/Cache/InMemoryCache.ts +354 -0
  240. package/src/Cache/StorageCache.ts +157 -0
  241. package/src/Cache/Utils/CacheList.ts +198 -0
  242. package/src/Cache/Utils/CacheUtils.ts +92 -0
  243. package/src/Cache/Utils/index.ts +11 -0
  244. package/src/Cache/reactnative.ts +9 -0
  245. package/src/Cache/types/Cache.ts +75 -0
  246. package/src/Cache/types/index.ts +4 -0
  247. package/src/ClientDevice/android.ts +1 -1
  248. package/src/ClientDevice/ios.ts +2 -2
  249. package/src/ClientDevice/reactnative.ts +1 -1
  250. package/src/Credentials.ts +19 -17
  251. package/src/Errors.ts +41 -0
  252. package/src/Hub.ts +1 -0
  253. package/src/I18n/I18n.ts +40 -12
  254. package/src/I18n/index.ts +45 -12
  255. package/src/I18n/types.ts +3 -0
  256. package/src/JS.ts +24 -17
  257. package/src/Logger/ConsoleLogger.ts +10 -10
  258. package/src/OAuthHelper/FacebookOAuth.ts +2 -2
  259. package/src/OAuthHelper/GoogleOAuth.ts +9 -6
  260. package/src/Platform/detectFramework.ts +1 -1
  261. package/src/Platform/detection/React.ts +5 -3
  262. package/src/Platform/version.ts +1 -1
  263. package/src/Providers/AWSCloudWatchProvider.ts +39 -14
  264. package/src/RNComponents/index.ts +1 -1
  265. package/src/RNComponents/reactnative.ts +1 -1
  266. package/src/ServiceWorker/ServiceWorker.ts +58 -18
  267. package/src/Signer.ts +22 -3
  268. package/src/StorageHelper/cookieStorage.ts +99 -0
  269. package/src/StorageHelper/inMemoryStorage.ts +32 -0
  270. package/src/StorageHelper/index.ts +6 -1
  271. package/src/StorageHelper/localStorage.ts +60 -0
  272. package/src/StorageHelper/reactnative.ts +94 -14
  273. package/src/StorageHelper/sessionStorage.ts +60 -0
  274. package/src/Util/BackgroundProcessManager.ts +33 -9
  275. package/src/Util/DateUtils.ts +14 -5
  276. package/src/Util/Reachability.native.ts +3 -2
  277. package/src/Util/Reachability.ts +9 -7
  278. package/src/Util/Retry.ts +2 -1
  279. package/src/Util/StringUtils.ts +3 -10
  280. package/src/Util/errors/AssertError.ts +11 -0
  281. package/src/clients/handlers/fetch.ts +2 -2
  282. package/src/clients/middleware/retry/defaultRetryDecider.ts +12 -6
  283. package/src/clients/middleware/retry/isClockSkewError.ts +1 -1
  284. package/src/clients/middleware/retry/middleware.ts +9 -9
  285. package/src/clients/middleware/signing/middleware.ts +1 -1
  286. package/src/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.ts +1 -1
  287. package/src/clients/serde/responseInfo.ts +2 -1
  288. package/src/clients/types/aws.ts +10 -0
  289. package/src/clients/types/index.ts +1 -0
  290. package/src/constants.ts +16 -0
  291. package/src/global.d.ts +11 -0
  292. package/src/index.ts +66 -4
  293. package/src/parseAWSExports.ts +1 -1
  294. package/src/singleton/Auth/index.ts +113 -0
  295. package/src/singleton/Auth/types.ts +129 -0
  296. package/src/singleton/Auth/utils/index.ts +68 -0
  297. package/src/singleton/Storage/types.ts +21 -0
  298. package/src/singleton/index.ts +144 -0
  299. package/src/singleton/types.ts +48 -0
  300. package/src/types/types.ts +38 -1
@@ -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?: Error) => number | false;
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
+ };
@@ -1 +1,3 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
1
3
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/core",
3
- "version": "5.8.2",
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.build.json -t 76.41"
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
- "tslib": "^1.8.0",
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.4 kB"
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.12 kB"
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": "d35fc7e10dca73672624ed8b5344cad40ac5bcc9"
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
- register(comp) {
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 = (output: unknown = {}): Credentials => ({
53
- AccessKeyId: output['AccessKeyId'] as string,
54
- SecretKey: output['SecretKey'] as string,
55
- SessionToken: output['SessionToken'] as string,
56
- Expiration: new Date((output['Expiration'] as number) * 1000),
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 { EndpointResolverOptions, Headers } from '../../clients/types';
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