@aws-amplify/core 5.8.2 → 6.0.1-console-preview.f63250a.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 +147 -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 +143 -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 +131 -0
  299. package/src/singleton/types.ts +48 -0
  300. package/src/types/types.ts +38 -1
@@ -1,30 +1,42 @@
1
1
  import { I18nOptions } from './types';
2
2
  /**
3
- * Language transition class
3
+ * Language translation utility.
4
+ *
5
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
4
6
  */
5
7
  export declare class I18n {
6
8
  /**
7
9
  * @private
8
10
  */
9
- _options: I18nOptions;
11
+ _options: I18nOptions | null;
10
12
  /**
11
13
  * @private
12
14
  */
13
- _lang: any;
15
+ _lang?: string | null;
14
16
  /**
15
17
  * @private
16
18
  */
17
- _dict: {};
19
+ _dict: Record<string, any>;
18
20
  /**
19
21
  * @constructor
20
22
  * Initialize with configurations
21
23
  * @param {Object} options
24
+ *
25
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
22
26
  */
23
- constructor(options: I18nOptions);
27
+ constructor();
28
+ /**
29
+ * Sets the default language from the configuration when required.
30
+ *
31
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
32
+ */
33
+ setDefaultLanguage(): void;
24
34
  /**
25
35
  * @method
26
36
  * Explicitly setting language
27
37
  * @param {String} lang
38
+ *
39
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
28
40
  */
29
41
  setLanguage(lang: string): void;
30
42
  /**
@@ -32,28 +44,36 @@ export declare class I18n {
32
44
  * Get value
33
45
  * @param {String} key
34
46
  * @param {String} defVal - Default value
47
+ *
48
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
35
49
  */
36
- get(key: any, defVal?: any): any;
50
+ get(key: string, defVal?: string | undefined): any;
37
51
  /**
38
52
  * @method
39
53
  * Get value according to specified language
40
54
  * @param {String} key
41
55
  * @param {String} language - Specified langurage to be used
42
56
  * @param {String} defVal - Default value
57
+ *
58
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
43
59
  */
44
- getByLanguage(key: any, language: any, defVal?: any): any;
60
+ getByLanguage(key: string, language: string, defVal?: string | null): any;
45
61
  /**
46
62
  * @method
47
63
  * Add vocabularies for one language
48
64
  * @param {String} language - Language of the dictionary
49
65
  * @param {Object} vocabularies - Object that has key-value as dictionary entry
66
+ *
67
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
50
68
  */
51
- putVocabulariesForLanguage(language: any, vocabularies: any): void;
69
+ putVocabulariesForLanguage(language: string, vocabularies: Record<string, any>): void;
52
70
  /**
53
71
  * @method
54
72
  * Add vocabularies for one language
55
73
  * @param {Object} vocabularies - Object that has language as key,
56
74
  * vocabularies of each language as value
75
+ *
76
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
57
77
  */
58
- putVocabularies(vocabularies: any): void;
78
+ putVocabularies(vocabularies: Record<string, any>): void;
59
79
  }
@@ -12,17 +12,22 @@ var __assign = (this && this.__assign) || function () {
12
12
  return __assign.apply(this, arguments);
13
13
  };
14
14
  import { ConsoleLogger as Logger } from '../Logger';
15
+ import { AmplifyV6 } from '../singleton';
15
16
  var logger = new Logger('I18n');
16
17
  /**
17
- * Language transition class
18
+ * Language translation utility.
19
+ *
20
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
18
21
  */
19
22
  var I18n = /** @class */ (function () {
20
23
  /**
21
24
  * @constructor
22
25
  * Initialize with configurations
23
26
  * @param {Object} options
27
+ *
28
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
24
29
  */
25
- function I18n(options) {
30
+ function I18n() {
26
31
  /**
27
32
  * @private
28
33
  */
@@ -35,8 +40,18 @@ var I18n = /** @class */ (function () {
35
40
  * @private
36
41
  */
37
42
  this._dict = {};
38
- this._options = Object.assign({}, options);
39
- this._lang = this._options.language;
43
+ }
44
+ /**
45
+ * Sets the default language from the configuration when required.
46
+ *
47
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
48
+ */
49
+ I18n.prototype.setDefaultLanguage = function () {
50
+ if (!this._lang) {
51
+ var i18nConfig = AmplifyV6.getConfig().I18n;
52
+ this._lang = i18nConfig === null || i18nConfig === void 0 ? void 0 : i18nConfig.language;
53
+ }
54
+ // Default to window language if not set in config
40
55
  if (!this._lang &&
41
56
  typeof window !== 'undefined' &&
42
57
  window &&
@@ -44,11 +59,13 @@ var I18n = /** @class */ (function () {
44
59
  this._lang = window.navigator.language;
45
60
  }
46
61
  logger.debug(this._lang);
47
- }
62
+ };
48
63
  /**
49
64
  * @method
50
65
  * Explicitly setting language
51
66
  * @param {String} lang
67
+ *
68
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
52
69
  */
53
70
  I18n.prototype.setLanguage = function (lang) {
54
71
  this._lang = lang;
@@ -58,6 +75,8 @@ var I18n = /** @class */ (function () {
58
75
  * Get value
59
76
  * @param {String} key
60
77
  * @param {String} defVal - Default value
78
+ *
79
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
61
80
  */
62
81
  I18n.prototype.get = function (key, defVal) {
63
82
  if (defVal === void 0) { defVal = undefined; }
@@ -83,6 +102,8 @@ var I18n = /** @class */ (function () {
83
102
  * @param {String} key
84
103
  * @param {String} language - Specified langurage to be used
85
104
  * @param {String} defVal - Default value
105
+ *
106
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
86
107
  */
87
108
  I18n.prototype.getByLanguage = function (key, language, defVal) {
88
109
  if (defVal === void 0) { defVal = null; }
@@ -100,6 +121,8 @@ var I18n = /** @class */ (function () {
100
121
  * Add vocabularies for one language
101
122
  * @param {String} language - Language of the dictionary
102
123
  * @param {Object} vocabularies - Object that has key-value as dictionary entry
124
+ *
125
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
103
126
  */
104
127
  I18n.prototype.putVocabulariesForLanguage = function (language, vocabularies) {
105
128
  var lang_dict = this._dict[language];
@@ -113,6 +136,8 @@ var I18n = /** @class */ (function () {
113
136
  * Add vocabularies for one language
114
137
  * @param {Object} vocabularies - Object that has language as key,
115
138
  * vocabularies of each language as value
139
+ *
140
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
116
141
  */
117
142
  I18n.prototype.putVocabularies = function (vocabularies) {
118
143
  var _this = this;
@@ -1,5 +1,8 @@
1
+ import { I18nOptions } from './types';
1
2
  /**
2
3
  * Export I18n APIs
4
+ *
5
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
3
6
  */
4
7
  export declare class I18n {
5
8
  /**
@@ -8,42 +11,52 @@ export declare class I18n {
8
11
  * Configure I18n part
9
12
  * @param {Object} config - Configuration of the I18n
10
13
  */
11
- static configure(config: any): any;
14
+ static configure(config: Record<string, any>): I18nOptions;
12
15
  static getModuleName(): string;
13
16
  /**
14
17
  * @static
15
18
  * @method
16
19
  * Create an instance of I18n for the library
20
+ *
21
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
17
22
  */
18
23
  static createInstance(): void;
19
24
  /**
20
25
  * @static @method
21
26
  * Explicitly setting language
22
27
  * @param {String} lang
28
+ *
29
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
23
30
  */
24
- static setLanguage(lang: any): any;
31
+ static setLanguage(lang: string): void;
25
32
  /**
26
33
  * @static @method
27
34
  * Get value
28
35
  * @param {String} key
29
36
  * @param {String} defVal - Default value
37
+ *
38
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
30
39
  */
31
- static get(key: any, defVal?: any): any;
40
+ static get(key: string, defVal?: string): any;
32
41
  /**
33
42
  * @static
34
43
  * @method
35
44
  * Add vocabularies for one language
36
45
  * @param {String} langurage - Language of the dictionary
37
46
  * @param {Object} vocabularies - Object that has key-value as dictionary entry
47
+ *
48
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
38
49
  */
39
- static putVocabulariesForLanguage(language: any, vocabularies: any): any;
50
+ static putVocabulariesForLanguage(language: string, vocabularies: Record<string, string>): void;
40
51
  /**
41
52
  * @static
42
53
  * @method
43
54
  * Add vocabularies for one language
44
55
  * @param {Object} vocabularies - Object that has language as key,
45
56
  * vocabularies of each language as value
57
+ *
58
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
46
59
  */
47
- static putVocabularies(vocabularies: any): any;
60
+ static putVocabularies(vocabularies: Record<string, string>): void;
48
61
  static checkConfig(): boolean;
49
62
  }
@@ -2,12 +2,15 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { I18n as I18nClass } from './I18n';
4
4
  import { ConsoleLogger as Logger } from '../Logger';
5
- import { Amplify } from '../Amplify';
5
+ import { asserts } from '../Util/errors/AssertError';
6
+ import { I18N_EXCEPTION } from '../constants';
6
7
  var logger = new Logger('I18n');
7
- var _config = null;
8
+ var _config = { language: null };
8
9
  var _i18n = null;
9
10
  /**
10
11
  * Export I18n APIs
12
+ *
13
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
11
14
  */
12
15
  var I18n = /** @class */ (function () {
13
16
  function I18n() {
@@ -34,21 +37,29 @@ var I18n = /** @class */ (function () {
34
37
  * @static
35
38
  * @method
36
39
  * Create an instance of I18n for the library
40
+ *
41
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
37
42
  */
38
43
  I18n.createInstance = function () {
39
44
  logger.debug('create I18n instance');
40
45
  if (_i18n) {
41
46
  return;
42
47
  }
43
- _i18n = new I18nClass(_config);
48
+ _i18n = new I18nClass();
44
49
  };
45
50
  /**
46
51
  * @static @method
47
52
  * Explicitly setting language
48
53
  * @param {String} lang
54
+ *
55
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
49
56
  */
50
57
  I18n.setLanguage = function (lang) {
51
58
  I18n.checkConfig();
59
+ asserts(!!_i18n, {
60
+ name: I18N_EXCEPTION,
61
+ message: 'I18N is not configured',
62
+ });
52
63
  return _i18n.setLanguage(lang);
53
64
  };
54
65
  /**
@@ -56,11 +67,17 @@ var I18n = /** @class */ (function () {
56
67
  * Get value
57
68
  * @param {String} key
58
69
  * @param {String} defVal - Default value
70
+ *
71
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
59
72
  */
60
73
  I18n.get = function (key, defVal) {
61
74
  if (!I18n.checkConfig()) {
62
75
  return typeof defVal === 'undefined' ? key : defVal;
63
76
  }
77
+ asserts(!!_i18n, {
78
+ name: I18N_EXCEPTION,
79
+ message: 'I18N is not configured',
80
+ });
64
81
  return _i18n.get(key, defVal);
65
82
  };
66
83
  /**
@@ -69,9 +86,15 @@ var I18n = /** @class */ (function () {
69
86
  * Add vocabularies for one language
70
87
  * @param {String} langurage - Language of the dictionary
71
88
  * @param {Object} vocabularies - Object that has key-value as dictionary entry
89
+ *
90
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
72
91
  */
73
92
  I18n.putVocabulariesForLanguage = function (language, vocabularies) {
74
93
  I18n.checkConfig();
94
+ asserts(!!_i18n, {
95
+ name: I18N_EXCEPTION,
96
+ message: 'I18N is not configured',
97
+ });
75
98
  return _i18n.putVocabulariesForLanguage(language, vocabularies);
76
99
  };
77
100
  /**
@@ -80,18 +103,25 @@ var I18n = /** @class */ (function () {
80
103
  * Add vocabularies for one language
81
104
  * @param {Object} vocabularies - Object that has language as key,
82
105
  * vocabularies of each language as value
106
+ *
107
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
83
108
  */
84
109
  I18n.putVocabularies = function (vocabularies) {
85
110
  I18n.checkConfig();
111
+ asserts(!!_i18n, {
112
+ name: I18N_EXCEPTION,
113
+ message: 'I18N is not configured',
114
+ });
86
115
  return _i18n.putVocabularies(vocabularies);
87
116
  };
88
117
  I18n.checkConfig = function () {
89
118
  if (!_i18n) {
90
- _i18n = new I18nClass(_config);
119
+ I18n.createInstance();
91
120
  }
92
121
  return true;
93
122
  };
94
123
  return I18n;
95
124
  }());
96
125
  export { I18n };
97
- Amplify.register(I18n);
126
+ // Create an instance of I18n in the static class
127
+ I18n.createInstance();
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
3
+ */
1
4
  export declare class I18nOptions {
2
- language: any;
5
+ language: null;
3
6
  }
@@ -1,5 +1,8 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ /**
4
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
5
+ */
3
6
  var I18nOptions = /** @class */ (function () {
4
7
  function I18nOptions() {
5
8
  this.language = null;
package/lib-esm/JS.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export declare const isEmpty: (obj?: {}) => boolean;
2
- export declare const sortByField: (list: any, field: any, dir: any) => boolean;
3
- export declare const objectLessAttributes: (obj: any, less: any) => any;
4
- export declare const filenameToContentType: (filename: any, defVal?: string) => string;
5
- export declare const isTextFile: (contentType: any) => boolean;
2
+ export declare const sortByField: (list: any[], field: string | number, dir: string) => boolean;
3
+ export declare const objectLessAttributes: (obj: Record<string, any>, less: string | string[]) => Record<string, any>;
4
+ export declare const filenameToContentType: (filename: string, defVal?: string) => string;
5
+ export declare const isTextFile: (contentType: string) => boolean;
6
6
  export declare const generateRandomString: () => string;
7
7
  export declare const makeQuerablePromise: (promise: any) => any;
8
8
  export declare const isWebWorker: () => boolean;
@@ -16,14 +16,14 @@ export declare const browserOrNode: () => {
16
16
  * @param {Array} whiteListForItself - whitelist itself from being transferred
17
17
  * @param {Array} whiteListForChildren - whitelist its children keys from being transferred
18
18
  */
19
- export declare const transferKeyToLowerCase: (obj: any, whiteListForItself?: any[], whiteListForChildren?: any[]) => any;
19
+ export declare const transferKeyToLowerCase: (obj: Record<string, any>, whiteListForItself?: string[], whiteListForChildren?: string[]) => Record<string, any>;
20
20
  /**
21
21
  * transfer the first letter of the keys to lowercase
22
22
  * @param {Object} obj - the object need to be transferred
23
23
  * @param {Array} whiteListForItself - whitelist itself from being transferred
24
24
  * @param {Array} whiteListForChildren - whitelist its children keys from being transferred
25
25
  */
26
- export declare const transferKeyToUpperCase: (obj: any, whiteListForItself?: any[], whiteListForChildren?: any[]) => any;
26
+ export declare const transferKeyToUpperCase: (obj: Record<string, any>, whiteListForItself?: string[], whiteListForChildren?: string[]) => Record<string, any>;
27
27
  /**
28
28
  * Return true if the object is a strict object
29
29
  * which means it's not Array, Function, Number, String, Boolean or Null
@@ -15,16 +15,16 @@ export declare class ConsoleLogger implements Logger {
15
15
  name: string;
16
16
  level: LOG_TYPE | string;
17
17
  private _pluggables;
18
- private _config;
18
+ private _config?;
19
19
  /**
20
20
  * @constructor
21
21
  * @param {string} name - Name of the logger
22
22
  */
23
23
  constructor(name: string, level?: LOG_TYPE | string);
24
- static LOG_LEVEL: any;
25
- _padding(n: any): string;
24
+ static LOG_LEVEL: null;
25
+ _padding(n: number): string;
26
26
  _ts(): string;
27
- configure(config?: object): object;
27
+ configure(config?: object): object | undefined;
28
28
  /**
29
29
  * Write log
30
30
  * @method
@@ -32,49 +32,49 @@ export declare class ConsoleLogger implements Logger {
32
32
  * @param {LOG_TYPE|string} type - log type, default INFO
33
33
  * @param {string|object} msg - Logging message or object
34
34
  */
35
- _log(type: LOG_TYPE | string, ...msg: any[]): void;
35
+ _log(type: LOG_TYPE | string, ...msg: any): void;
36
36
  /**
37
37
  * Write General log. Default to INFO
38
38
  * @method
39
39
  * @memeberof Logger
40
40
  * @param {string|object} msg - Logging message or object
41
41
  */
42
- log(...msg: any[]): void;
42
+ log(...msg: any): void;
43
43
  /**
44
44
  * Write INFO log
45
45
  * @method
46
46
  * @memeberof Logger
47
47
  * @param {string|object} msg - Logging message or object
48
48
  */
49
- info(...msg: any[]): void;
49
+ info(...msg: any): void;
50
50
  /**
51
51
  * Write WARN log
52
52
  * @method
53
53
  * @memeberof Logger
54
54
  * @param {string|object} msg - Logging message or object
55
55
  */
56
- warn(...msg: any[]): void;
56
+ warn(...msg: any): void;
57
57
  /**
58
58
  * Write ERROR log
59
59
  * @method
60
60
  * @memeberof Logger
61
61
  * @param {string|object} msg - Logging message or object
62
62
  */
63
- error(...msg: any[]): void;
63
+ error(...msg: any): void;
64
64
  /**
65
65
  * Write DEBUG log
66
66
  * @method
67
67
  * @memeberof Logger
68
68
  * @param {string|object} msg - Logging message or object
69
69
  */
70
- debug(...msg: any[]): void;
70
+ debug(...msg: any): void;
71
71
  /**
72
72
  * Write VERBOSE log
73
73
  * @method
74
74
  * @memeberof Logger
75
75
  * @param {string|object} msg - Logging message or object
76
76
  */
77
- verbose(...msg: any[]): void;
77
+ verbose(...msg: any): void;
78
78
  addPluggable(pluggable: LoggingProvider): void;
79
79
  listPluggables(): LoggingProvider[];
80
80
  }
@@ -106,7 +106,8 @@ var GoogleOAuth = /** @class */ (function () {
106
106
  res({ token: id_token, expires_at: expires_at });
107
107
  })
108
108
  .catch(function (err) {
109
- if (err && err.error === 'network_error') {
109
+ if (err &&
110
+ err.error === 'network_error') {
110
111
  // Not using NonRetryableError so handler will be retried
111
112
  rej('Network error reloading google auth response');
112
113
  }
@@ -11,6 +11,7 @@ var SSR_RESET_TIMEOUT = 10; // ms
11
11
  var WEB_RESET_TIMEOUT = 10; // ms
12
12
  var PRIME_FRAMEWORK_DELAY = 1000; // ms
13
13
  export var detectFramework = function () {
14
+ var _a;
14
15
  if (!frameworkCache) {
15
16
  frameworkCache = detect();
16
17
  if (resetTriggered) {
@@ -19,7 +20,7 @@ export var detectFramework = function () {
19
20
  // So we don't need to notify the observers again so the observer
20
21
  // can be removed after the final notice.
21
22
  while (frameworkChangeObservers.length) {
22
- frameworkChangeObservers.pop()();
23
+ (_a = frameworkChangeObservers.pop()) === null || _a === void 0 ? void 0 : _a();
23
24
  }
24
25
  }
25
26
  else {
@@ -1,2 +1,2 @@
1
- export declare function nextWebDetect(): boolean;
1
+ export declare function nextWebDetect(): any;
2
2
  export declare function nextSSRDetect(): boolean;
@@ -17,3 +17,4 @@ export function reactSSRDetect() {
17
17
  typeof process.env !== 'undefined' &&
18
18
  !!Object.keys(process.env).find(function (key) { return key.includes('react'); }));
19
19
  }
20
+ // use the some
@@ -1 +1 @@
1
- export declare const version = "5.3.8";
1
+ export declare const version = "6.0.1-console-preview.f63250a.0+f63250a";
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export var version = '5.3.8';
2
+ export var version = '6.0.1-console-preview.f63250a.0+f63250a';
@@ -3,10 +3,10 @@ import { AWSCloudWatchProviderOptions, LoggingProvider } from '../types/types';
3
3
  declare class AWSCloudWatchProvider implements LoggingProvider {
4
4
  static readonly PROVIDER_NAME = "AWSCloudWatch";
5
5
  static readonly CATEGORY = "Logging";
6
- private _config;
6
+ private _config?;
7
7
  private _dataTracker;
8
8
  private _currentLogBatch;
9
- private _timer;
9
+ private _timer?;
10
10
  private _nextSequenceToken;
11
11
  constructor(config?: AWSCloudWatchProviderOptions);
12
12
  getProviderName(): string;