@aws-amplify/core 4.7.13-unstable.4 → 4.7.13

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 (278) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/build.js +5 -0
  3. package/dist/aws-amplify-core.js +42702 -0
  4. package/dist/aws-amplify-core.js.map +1 -0
  5. package/dist/aws-amplify-core.min.js +32 -0
  6. package/dist/aws-amplify-core.min.js.map +1 -0
  7. package/index.js +7 -0
  8. package/lib/Amplify.js +21 -3
  9. package/lib/Amplify.js.map +1 -1
  10. package/lib/ClientDevice/android.js +12 -2
  11. package/lib/ClientDevice/android.js.map +1 -1
  12. package/lib/ClientDevice/browser.js +12 -2
  13. package/lib/ClientDevice/browser.js.map +1 -1
  14. package/lib/ClientDevice/index.js +16 -2
  15. package/lib/ClientDevice/index.js.map +1 -1
  16. package/lib/ClientDevice/ios.js +12 -2
  17. package/lib/ClientDevice/ios.js.map +1 -1
  18. package/lib/ClientDevice/reactnative.js +16 -2
  19. package/lib/ClientDevice/reactnative.js.map +1 -1
  20. package/lib/Credentials.js +90 -59
  21. package/lib/Credentials.js.map +1 -1
  22. package/lib/Errors.js +12 -2
  23. package/lib/Errors.js.map +1 -1
  24. package/lib/Hub.js +57 -41
  25. package/lib/Hub.js.map +1 -1
  26. package/lib/I18n/I18n.js +12 -2
  27. package/lib/I18n/I18n.js.map +1 -1
  28. package/lib/I18n/index.js +16 -2
  29. package/lib/I18n/index.js.map +1 -1
  30. package/lib/I18n/types.js +12 -2
  31. package/lib/I18n/types.js.map +1 -1
  32. package/lib/JS.js +39 -4
  33. package/lib/JS.js.map +1 -1
  34. package/lib/Logger/ConsoleLogger.js +50 -10
  35. package/lib/Logger/ConsoleLogger.js.map +1 -1
  36. package/lib/Logger/index.js +16 -5
  37. package/lib/Logger/index.js.map +1 -1
  38. package/lib/Logger/logger-interface.js +12 -2
  39. package/lib/Logger/logger-interface.js.map +1 -1
  40. package/lib/OAuthHelper/FacebookOAuth.js +54 -5
  41. package/lib/OAuthHelper/FacebookOAuth.js.map +1 -1
  42. package/lib/OAuthHelper/GoogleOAuth.js +54 -5
  43. package/lib/OAuthHelper/GoogleOAuth.js.map +1 -1
  44. package/lib/OAuthHelper/index.js +12 -2
  45. package/lib/OAuthHelper/index.js.map +1 -1
  46. package/lib/{parseAWSExports.js → Parser.js} +28 -4
  47. package/lib/Parser.js.map +1 -0
  48. package/lib/Platform/index.js +16 -2
  49. package/lib/Platform/index.js.map +1 -1
  50. package/lib/Platform/version.js +1 -1
  51. package/lib/Providers/AWSCloudWatchProvider.js +97 -32
  52. package/lib/Providers/AWSCloudWatchProvider.js.map +1 -1
  53. package/lib/Providers/index.js +4 -2
  54. package/lib/Providers/index.js.map +1 -1
  55. package/lib/RNComponents/index.js +12 -2
  56. package/lib/RNComponents/index.js.map +1 -1
  57. package/lib/RNComponents/reactnative.js +16 -4
  58. package/lib/RNComponents/reactnative.js.map +1 -1
  59. package/lib/ServiceWorker/ServiceWorker.js +4 -0
  60. package/lib/ServiceWorker/ServiceWorker.js.map +1 -1
  61. package/lib/Signer.js +43 -8
  62. package/lib/Signer.js.map +1 -1
  63. package/lib/StorageHelper/index.js +16 -2
  64. package/lib/StorageHelper/index.js.map +1 -1
  65. package/lib/StorageHelper/reactnative.js +20 -4
  66. package/lib/StorageHelper/reactnative.js.map +1 -1
  67. package/lib/UniversalStorage/index.js +4 -2
  68. package/lib/UniversalStorage/index.js.map +1 -1
  69. package/lib/Util/BackgroundProcessManager.js +69 -10
  70. package/lib/Util/BackgroundProcessManager.js.map +1 -1
  71. package/lib/Util/CognitoIdentityClient.js +41 -0
  72. package/lib/Util/CognitoIdentityClient.js.map +1 -0
  73. package/lib/Util/Constants.js +12 -2
  74. package/lib/Util/Constants.js.map +1 -1
  75. package/lib/Util/DateUtils.js +17 -2
  76. package/lib/Util/DateUtils.js.map +1 -1
  77. package/lib/Util/Reachability.js +16 -3
  78. package/lib/Util/Reachability.js.map +1 -1
  79. package/lib/Util/Reachability.native.js +4 -2
  80. package/lib/Util/Reachability.native.js.map +1 -1
  81. package/lib/Util/Retry.js +78 -10
  82. package/lib/Util/Retry.js.map +1 -1
  83. package/lib/Util/index.js +8 -23
  84. package/lib/Util/index.js.map +1 -1
  85. package/lib/constants.js +12 -2
  86. package/lib/constants.js.map +1 -1
  87. package/lib/index.js +25 -54
  88. package/lib/index.js.map +1 -1
  89. package/lib-esm/Amplify.d.ts +4 -1
  90. package/lib-esm/Amplify.js +20 -2
  91. package/lib-esm/Amplify.js.map +1 -1
  92. package/lib-esm/ClientDevice/android.js +12 -2
  93. package/lib-esm/ClientDevice/android.js.map +1 -1
  94. package/lib-esm/ClientDevice/browser.js +12 -2
  95. package/lib-esm/ClientDevice/browser.js.map +1 -1
  96. package/lib-esm/ClientDevice/index.d.ts +4 -0
  97. package/lib-esm/ClientDevice/index.js +16 -2
  98. package/lib-esm/ClientDevice/index.js.map +1 -1
  99. package/lib-esm/ClientDevice/ios.js +12 -2
  100. package/lib-esm/ClientDevice/ios.js.map +1 -1
  101. package/lib-esm/ClientDevice/reactnative.d.ts +7 -0
  102. package/lib-esm/ClientDevice/reactnative.js +16 -2
  103. package/lib-esm/ClientDevice/reactnative.js.map +1 -1
  104. package/lib-esm/Credentials.d.ts +4 -0
  105. package/lib-esm/Credentials.js +63 -32
  106. package/lib-esm/Credentials.js.map +1 -1
  107. package/lib-esm/Errors.js +12 -2
  108. package/lib-esm/Errors.js.map +1 -1
  109. package/lib-esm/Hub.d.ts +4 -28
  110. package/lib-esm/Hub.js +52 -36
  111. package/lib-esm/Hub.js.map +1 -1
  112. package/lib-esm/I18n/I18n.js +12 -2
  113. package/lib-esm/I18n/I18n.js.map +1 -1
  114. package/lib-esm/I18n/index.d.ts +4 -0
  115. package/lib-esm/I18n/index.js +16 -2
  116. package/lib-esm/I18n/index.js.map +1 -1
  117. package/lib-esm/I18n/types.js +12 -2
  118. package/lib-esm/I18n/types.js.map +1 -1
  119. package/lib-esm/JS.d.ts +24 -0
  120. package/lib-esm/JS.js +39 -4
  121. package/lib-esm/JS.js.map +1 -1
  122. package/lib-esm/Logger/ConsoleLogger.js +43 -3
  123. package/lib-esm/Logger/ConsoleLogger.js.map +1 -1
  124. package/lib-esm/Logger/index.d.ts +1 -1
  125. package/lib-esm/Logger/index.js +13 -3
  126. package/lib-esm/Logger/index.js.map +1 -1
  127. package/lib-esm/Logger/logger-interface.d.ts +4 -0
  128. package/lib-esm/Logger/logger-interface.js +12 -2
  129. package/lib-esm/Logger/logger-interface.js.map +1 -1
  130. package/lib-esm/OAuthHelper/FacebookOAuth.d.ts +4 -0
  131. package/lib-esm/OAuthHelper/FacebookOAuth.js +52 -3
  132. package/lib-esm/OAuthHelper/FacebookOAuth.js.map +1 -1
  133. package/lib-esm/OAuthHelper/GoogleOAuth.d.ts +4 -0
  134. package/lib-esm/OAuthHelper/GoogleOAuth.js +52 -3
  135. package/lib-esm/OAuthHelper/GoogleOAuth.js.map +1 -1
  136. package/lib-esm/OAuthHelper/index.js +12 -2
  137. package/lib-esm/OAuthHelper/index.js.map +1 -1
  138. package/lib-esm/Parser.d.ts +12 -0
  139. package/lib-esm/{parseAWSExports.js → Parser.js} +27 -3
  140. package/lib-esm/Parser.js.map +1 -0
  141. package/lib-esm/Platform/index.d.ts +4 -0
  142. package/lib-esm/Platform/index.js +16 -2
  143. package/lib-esm/Platform/index.js.map +1 -1
  144. package/lib-esm/Platform/version.d.ts +1 -1
  145. package/lib-esm/Platform/version.js +1 -1
  146. package/lib-esm/Providers/AWSCloudWatchProvider.js +70 -5
  147. package/lib-esm/Providers/AWSCloudWatchProvider.js.map +1 -1
  148. package/lib-esm/Providers/index.d.ts +1 -1
  149. package/lib-esm/Providers/index.js +1 -1
  150. package/lib-esm/Providers/index.js.map +1 -1
  151. package/lib-esm/RNComponents/index.js +12 -2
  152. package/lib-esm/RNComponents/index.js.map +1 -1
  153. package/lib-esm/RNComponents/reactnative.js +12 -2
  154. package/lib-esm/RNComponents/reactnative.js.map +1 -1
  155. package/lib-esm/ServiceWorker/ServiceWorker.d.ts +4 -0
  156. package/lib-esm/ServiceWorker/ServiceWorker.js +4 -0
  157. package/lib-esm/ServiceWorker/ServiceWorker.js.map +1 -1
  158. package/lib-esm/Signer.d.ts +4 -0
  159. package/lib-esm/Signer.js +38 -3
  160. package/lib-esm/Signer.js.map +1 -1
  161. package/lib-esm/StorageHelper/index.d.ts +4 -0
  162. package/lib-esm/StorageHelper/index.js +16 -2
  163. package/lib-esm/StorageHelper/index.js.map +1 -1
  164. package/lib-esm/StorageHelper/reactnative.d.ts +4 -0
  165. package/lib-esm/StorageHelper/reactnative.js +16 -2
  166. package/lib-esm/StorageHelper/reactnative.js.map +1 -1
  167. package/lib-esm/Util/BackgroundProcessManager.js +60 -1
  168. package/lib-esm/Util/BackgroundProcessManager.js.map +1 -1
  169. package/lib-esm/Util/CognitoIdentityClient.d.ts +14 -0
  170. package/lib-esm/Util/CognitoIdentityClient.js +37 -0
  171. package/lib-esm/Util/CognitoIdentityClient.js.map +1 -0
  172. package/lib-esm/Util/Constants.js +12 -2
  173. package/lib-esm/Util/Constants.js.map +1 -1
  174. package/lib-esm/Util/DateUtils.js +16 -1
  175. package/lib-esm/Util/DateUtils.js.map +1 -1
  176. package/lib-esm/Util/Reachability.js +11 -1
  177. package/lib-esm/Util/Reachability.js.map +1 -1
  178. package/lib-esm/Util/Retry.d.ts +0 -1
  179. package/lib-esm/Util/Retry.js +70 -2
  180. package/lib-esm/Util/Retry.js.map +1 -1
  181. package/lib-esm/Util/index.d.ts +5 -5
  182. package/lib-esm/Util/index.js +5 -5
  183. package/lib-esm/Util/index.js.map +1 -1
  184. package/lib-esm/constants.js +12 -2
  185. package/lib-esm/constants.js.map +1 -1
  186. package/lib-esm/index.d.ts +9 -8
  187. package/lib-esm/index.js +21 -10
  188. package/lib-esm/index.js.map +1 -1
  189. package/lib-esm/types/types.d.ts +0 -3
  190. package/package.json +9 -13
  191. package/src/Amplify.ts +5 -1
  192. package/src/ClientDevice/android.ts +12 -2
  193. package/src/ClientDevice/browser.ts +12 -2
  194. package/src/ClientDevice/index.ts +17 -2
  195. package/src/ClientDevice/ios.ts +12 -2
  196. package/src/ClientDevice/reactnative.ts +17 -2
  197. package/src/Credentials.ts +10 -42
  198. package/src/Errors.ts +12 -2
  199. package/src/Hub.ts +23 -40
  200. package/src/I18n/I18n.ts +12 -2
  201. package/src/I18n/index.ts +17 -2
  202. package/src/I18n/types.ts +12 -2
  203. package/src/JS.ts +37 -6
  204. package/src/Logger/ConsoleLogger.ts +12 -2
  205. package/src/Logger/index.ts +13 -3
  206. package/src/Logger/logger-interface.ts +17 -2
  207. package/src/OAuthHelper/FacebookOAuth.ts +17 -2
  208. package/src/OAuthHelper/GoogleOAuth.ts +17 -2
  209. package/src/OAuthHelper/index.ts +12 -2
  210. package/src/{parseAWSExports.ts → Parser.ts} +13 -1
  211. package/src/Platform/index.ts +17 -2
  212. package/src/Platform/version.ts +1 -1
  213. package/src/Providers/AWSCloudWatchProvider.ts +14 -4
  214. package/src/Providers/index.ts +1 -1
  215. package/src/RNComponents/index.ts +12 -2
  216. package/src/RNComponents/reactnative.ts +12 -2
  217. package/src/ServiceWorker/ServiceWorker.ts +6 -1
  218. package/src/Signer.ts +17 -2
  219. package/src/StorageHelper/index.ts +17 -2
  220. package/src/StorageHelper/reactnative.ts +17 -2
  221. package/src/Util/CognitoIdentityClient.ts +48 -0
  222. package/src/Util/Constants.ts +12 -2
  223. package/src/Util/Retry.ts +1 -1
  224. package/src/Util/index.ts +5 -23
  225. package/src/constants.ts +12 -2
  226. package/src/index.ts +21 -48
  227. package/src/types/types.ts +0 -3
  228. package/webpack.config.dev.js +6 -0
  229. package/lib/.tsbuildinfo +0 -3
  230. package/lib/Amplify.d.ts +0 -28
  231. package/lib/ClientDevice/android.d.ts +0 -5
  232. package/lib/ClientDevice/browser.d.ts +0 -25
  233. package/lib/ClientDevice/index.d.ts +0 -23
  234. package/lib/ClientDevice/ios.d.ts +0 -7
  235. package/lib/ClientDevice/reactnative.d.ts +0 -7
  236. package/lib/Credentials.d.ts +0 -47
  237. package/lib/Errors.d.ts +0 -2
  238. package/lib/Hub.d.ts +0 -55
  239. package/lib/I18n/I18n.d.ts +0 -59
  240. package/lib/I18n/index.d.ts +0 -49
  241. package/lib/I18n/types.d.ts +0 -3
  242. package/lib/JS.d.ts +0 -32
  243. package/lib/Logger/ConsoleLogger.d.ts +0 -80
  244. package/lib/Logger/index.d.ts +0 -1
  245. package/lib/Logger/logger-interface.d.ts +0 -8
  246. package/lib/OAuthHelper/FacebookOAuth.d.ts +0 -6
  247. package/lib/OAuthHelper/GoogleOAuth.d.ts +0 -6
  248. package/lib/OAuthHelper/index.d.ts +0 -4
  249. package/lib/Platform/index.d.ts +0 -7
  250. package/lib/Platform/version.d.ts +0 -1
  251. package/lib/Providers/AWSCloudWatchProvider.d.ts +0 -34
  252. package/lib/Providers/index.d.ts +0 -1
  253. package/lib/RNComponents/index.d.ts +0 -5
  254. package/lib/RNComponents/reactnative.d.ts +0 -3
  255. package/lib/ServiceWorker/ServiceWorker.d.ts +0 -68
  256. package/lib/ServiceWorker/index.d.ts +0 -13
  257. package/lib/Signer.d.ts +0 -41
  258. package/lib/StorageHelper/index.d.ts +0 -41
  259. package/lib/StorageHelper/reactnative.d.ts +0 -13
  260. package/lib/UniversalStorage/index.d.ts +0 -23
  261. package/lib/Util/BackgroundProcessManager.d.ts +0 -204
  262. package/lib/Util/Constants.d.ts +0 -8
  263. package/lib/Util/DateUtils.d.ts +0 -7
  264. package/lib/Util/Mutex.d.ts +0 -45
  265. package/lib/Util/Reachability.d.ts +0 -13
  266. package/lib/Util/Reachability.native.d.ts +0 -11
  267. package/lib/Util/Retry.d.ts +0 -21
  268. package/lib/Util/StringUtils.d.ts +0 -2
  269. package/lib/Util/index.d.ts +0 -7
  270. package/lib/constants.d.ts +0 -6
  271. package/lib/index.d.ts +0 -29
  272. package/lib/parseAWSExports.d.ts +0 -2
  273. package/lib/parseAWSExports.js.map +0 -1
  274. package/lib/types/index.d.ts +0 -1
  275. package/lib/types/types.d.ts +0 -46
  276. package/lib-esm/.tsbuildinfo +0 -3
  277. package/lib-esm/parseAWSExports.d.ts +0 -2
  278. package/lib-esm/parseAWSExports.js.map +0 -1
@@ -4,7 +4,6 @@ import { makeQuerablePromise } from './JS';
4
4
  import { FacebookOAuth, GoogleOAuth } from './OAuthHelper';
5
5
  import { jitteredExponentialRetry } from './Util';
6
6
  import { ICredentials } from './types';
7
- import { getAmplifyUserAgent } from './Platform';
8
7
  import { Amplify } from './Amplify';
9
8
  import {
10
9
  fromCognitoIdentity,
@@ -13,13 +12,11 @@ import {
13
12
  FromCognitoIdentityPoolParameters,
14
13
  } from '@aws-sdk/credential-provider-cognito-identity';
15
14
  import {
16
- CognitoIdentityClient,
17
15
  GetIdCommand,
18
16
  GetCredentialsForIdentityCommand,
19
17
  } from '@aws-sdk/client-cognito-identity';
20
18
  import { CredentialProvider } from '@aws-sdk/types';
21
- import { parseAWSExports } from './parseAWSExports';
22
- import { Hub } from './Hub';
19
+ import { createCognitoIdentityClient } from './Util/CognitoIdentityClient';
23
20
 
24
21
  const logger = new Logger('Credentials');
25
22
 
@@ -27,20 +24,6 @@ const CREDENTIALS_TTL = 50 * 60 * 1000; // 50 min, can be modified on config if
27
24
 
28
25
  const COGNITO_IDENTITY_KEY_PREFIX = 'CognitoIdentityId-';
29
26
 
30
- const AMPLIFY_SYMBOL = (
31
- typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'
32
- ? Symbol.for('amplify_default')
33
- : '@@amplify_default'
34
- ) as Symbol;
35
-
36
- const dispatchCredentialsEvent = (
37
- event: string,
38
- data: any,
39
- message: string
40
- ) => {
41
- Hub.dispatch('core', { event, data, message }, 'Credentials', AMPLIFY_SYMBOL);
42
- };
43
-
44
27
  export class CredentialsClass {
45
28
  private _config;
46
29
  private _credentials;
@@ -94,12 +77,6 @@ export class CredentialsClass {
94
77
  this._storageSync = this._storage['sync']();
95
78
  }
96
79
 
97
- dispatchCredentialsEvent(
98
- 'credentials_configured',
99
- null,
100
- `Credentials has been configured successfully`
101
- );
102
-
103
80
  return this._config;
104
81
  }
105
82
 
@@ -139,8 +116,7 @@ export class CredentialsClass {
139
116
  const { Auth = Amplify.Auth } = this;
140
117
 
141
118
  if (!Auth || typeof Auth.currentUserCredentials !== 'function') {
142
- // If Auth module is not imported, do a best effort to get guest credentials
143
- return this._setCredentialsForGuest();
119
+ return Promise.reject('No Auth module registered in Amplify');
144
120
  }
145
121
 
146
122
  if (!this._isExpired(cred) && this._isPastTTL()) {
@@ -256,17 +232,7 @@ export class CredentialsClass {
256
232
 
257
233
  private async _setCredentialsForGuest() {
258
234
  logger.debug('setting credentials for guest');
259
- if (!this._config?.identityPoolId) {
260
- // If Credentials are not configured thru Auth module,
261
- // doing best effort to check if the library was configured
262
- this._config = Object.assign(
263
- {},
264
- this._config,
265
- parseAWSExports(this._config || {}).Auth
266
- );
267
- }
268
235
  const { identityPoolId, region, mandatorySignIn } = this._config;
269
-
270
236
  if (mandatorySignIn) {
271
237
  return Promise.reject(
272
238
  'cannot get guest credentials when mandatory signin enabled'
@@ -291,9 +257,8 @@ export class CredentialsClass {
291
257
 
292
258
  const identityId = (this._identityId = await this._getGuestIdentityId());
293
259
 
294
- const cognitoClient = new CognitoIdentityClient({
260
+ const cognitoClient = createCognitoIdentityClient({
295
261
  region,
296
- customUserAgent: getAmplifyUserAgent(),
297
262
  });
298
263
 
299
264
  let credentials = undefined;
@@ -408,9 +373,8 @@ export class CredentialsClass {
408
373
  );
409
374
  }
410
375
 
411
- const cognitoClient = new CognitoIdentityClient({
376
+ const cognitoClient = createCognitoIdentityClient({
412
377
  region,
413
- customUserAgent: getAmplifyUserAgent(),
414
378
  });
415
379
 
416
380
  let credentials = undefined;
@@ -450,9 +414,8 @@ export class CredentialsClass {
450
414
  const logins = {};
451
415
  logins[key] = idToken;
452
416
 
453
- const cognitoClient = new CognitoIdentityClient({
417
+ const cognitoClient = createCognitoIdentityClient({
454
418
  region,
455
- customUserAgent: getAmplifyUserAgent(),
456
419
  });
457
420
 
458
421
  /*
@@ -657,3 +620,8 @@ export class CredentialsClass {
657
620
  export const Credentials = new CredentialsClass(null);
658
621
 
659
622
  Amplify.register(Credentials);
623
+
624
+ /**
625
+ * @deprecated use named import
626
+ */
627
+ export default Credentials;
package/src/Errors.ts CHANGED
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
14
  export function missingConfig(name: string) {
5
15
  return new Error('Missing config value of ' + name);
package/src/Hub.ts CHANGED
@@ -1,15 +1,24 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
14
  import { ConsoleLogger as Logger } from './Logger';
5
15
 
6
16
  const logger = new Logger('Hub');
7
17
 
8
- const AMPLIFY_SYMBOL = (
9
- typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'
10
- ? Symbol.for('amplify_default')
11
- : '@@amplify_default'
12
- ) as Symbol;
18
+ const AMPLIFY_SYMBOL = (typeof Symbol !== 'undefined' &&
19
+ typeof Symbol.for === 'function'
20
+ ? Symbol.for('amplify_default')
21
+ : '@@amplify_default') as Symbol;
13
22
  interface IPattern {
14
23
  pattern: RegExp;
15
24
  callback: HubCallback;
@@ -62,13 +71,8 @@ export class HubClass {
62
71
  this.name = name;
63
72
  }
64
73
 
65
- /**
66
- * Used internally to remove a Hub listener.
67
- *
68
- * @remarks
69
- * This private method is for internal use only. Instead of calling Hub.remove, call the result of Hub.listen.
70
- */
71
- private _remove(channel: string | RegExp, listener: HubCallback) {
74
+ // Note - Need to pass channel as a reference for removal to work and not anonymous function
75
+ remove(channel: string | RegExp, listener: HubCallback) {
72
76
  if (channel instanceof RegExp) {
73
77
  const pattern = this.patterns.find(
74
78
  ({ pattern }) => pattern.source === channel.source
@@ -90,22 +94,6 @@ export class HubClass {
90
94
  }
91
95
  }
92
96
 
93
- /**
94
- * @deprecated Instead of calling Hub.remove, call the result of Hub.listen.
95
- */
96
- remove(channel: string | RegExp, listener: HubCallback) {
97
- this._remove(channel, listener);
98
- }
99
-
100
- /**
101
- * Used to send a Hub event.
102
- *
103
- * @param channel - The channel on which the event will be broadcast
104
- * @param payload - The HubPayload
105
- * @param source - The source of the event; defaults to ''
106
- * @param ampSymbol - Symbol used to determine if the event is dispatched internally on a protected channel
107
- *
108
- */
109
97
  dispatch(
110
98
  channel: string,
111
99
  payload: HubPayload,
@@ -136,15 +124,6 @@ export class HubClass {
136
124
  }
137
125
  }
138
126
 
139
- /**
140
- * Used to listen for Hub events.
141
- *
142
- * @param channel - The channel on which to listen
143
- * @param callback - The callback to execute when an event is received on the specified channel
144
- * @param listenerName - The name of the listener; defaults to 'noname'
145
- * @returns A function which can be called to cancel the listener.
146
- *
147
- */
148
127
  listen(
149
128
  channel: string | RegExp,
150
129
  callback?: HubCallback | LegacyCallback,
@@ -183,7 +162,7 @@ export class HubClass {
183
162
  }
184
163
 
185
164
  return () => {
186
- this._remove(channel, cb);
165
+ this.remove(channel, cb);
187
166
  };
188
167
  }
189
168
 
@@ -233,3 +212,7 @@ export class HubClass {
233
212
  pseudo Singleton for the main messaging bus, however you can still create
234
213
  your own instance of HubClass() for a separate "private bus" of events.*/
235
214
  export const Hub = new HubClass('__default__');
215
+ /**
216
+ * @deprecated use named import
217
+ */
218
+ export default Hub;
package/src/I18n/I18n.ts CHANGED
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
14
  import { I18nOptions } from './types';
5
15
  import { ConsoleLogger as Logger } from '../Logger';
package/src/I18n/index.ts CHANGED
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
14
  import { I18n as I18nClass } from './I18n';
5
15
 
@@ -112,3 +122,8 @@ export class I18n {
112
122
  }
113
123
 
114
124
  Amplify.register(I18n);
125
+
126
+ /**
127
+ * @deprecated use named import
128
+ */
129
+ export default I18n;
package/src/I18n/types.ts CHANGED
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
14
  export class I18nOptions {
5
15
  language = null;
package/src/JS.ts CHANGED
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
14
  const MIME_MAP = [
5
15
  { type: 'text/plain', ext: 'txt' },
@@ -157,10 +167,8 @@ export const isWebWorker = () => {
157
167
  return false;
158
168
  }
159
169
  const selfContext = self as { WorkerGlobalScope? };
160
- return (
161
- typeof selfContext.WorkerGlobalScope !== 'undefined' &&
162
- self instanceof selfContext.WorkerGlobalScope
163
- );
170
+ return typeof selfContext.WorkerGlobalScope !== 'undefined' &&
171
+ self instanceof selfContext.WorkerGlobalScope;
164
172
  };
165
173
 
166
174
  export const browserOrNode = () => {
@@ -257,3 +265,26 @@ export const isStrictObject = obj => {
257
265
  !(obj instanceof Boolean)
258
266
  );
259
267
  };
268
+
269
+ /**
270
+ * @deprecated use per-function imports
271
+ */
272
+ export class JS {
273
+ static isEmpty = isEmpty;
274
+ static sortByField = sortByField;
275
+ static objectLessAttributes = objectLessAttributes;
276
+ static filenameToContentType = filenameToContentType;
277
+ static isTextFile = isTextFile;
278
+ static generateRandomString = generateRandomString;
279
+ static makeQuerablePromise = makeQuerablePromise;
280
+ static isWebWorker = isWebWorker;
281
+ static browserOrNode = browserOrNode;
282
+ static transferKeyToLowerCase = transferKeyToLowerCase;
283
+ static transferKeyToUpperCase = transferKeyToUpperCase;
284
+ static isStrictObject = isStrictObject;
285
+ }
286
+
287
+ /**
288
+ * @deprecated use per-function imports
289
+ */
290
+ export default JS;
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
14
  import { InputLogEvent } from '@aws-sdk/client-cloudwatch-logs';
5
15
  import { LoggingProvider } from '../types';
@@ -1,4 +1,14 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
- export { ConsoleLogger, LOG_TYPE } from './ConsoleLogger';
14
+ export * from './ConsoleLogger';
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
14
  import { LoggingProvider } from '../types';
5
15
 
@@ -10,3 +20,8 @@ export interface Logger {
10
20
  error(msg: string): void;
11
21
  addPluggable(pluggable: LoggingProvider): void;
12
22
  }
23
+
24
+ /**
25
+ * @deprecated use named import
26
+ */
27
+ export default Logger;
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
  import { ConsoleLogger as Logger } from '../Logger';
4
14
  import { browserOrNode } from '../JS';
5
15
  import { NonRetryableError } from '../Util';
@@ -81,3 +91,8 @@ export class FacebookOAuth {
81
91
  });
82
92
  }
83
93
  }
94
+
95
+ /**
96
+ * @deprecated use named import
97
+ */
98
+ export default FacebookOAuth;
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
  import { ConsoleLogger as Logger } from '../Logger';
4
14
  import { browserOrNode } from '../JS';
5
15
  import { NonRetryableError } from '../Util';
@@ -92,3 +102,8 @@ export class GoogleOAuth {
92
102
  });
93
103
  }
94
104
  }
105
+
106
+ /**
107
+ * @deprecated use named import
108
+ */
109
+ export default GoogleOAuth;
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
  import { GoogleOAuth as GoogleOAuthClass } from './GoogleOAuth';
4
14
  import { FacebookOAuth as FacebookOAuthClass } from './FacebookOAuth';
5
15
 
@@ -3,7 +3,7 @@ import { ConsoleLogger as Logger } from './Logger';
3
3
 
4
4
  const logger = new Logger('Parser');
5
5
 
6
- export const parseAWSExports = (config): AmplifyConfig => {
6
+ export const parseMobileHubConfig = (config): AmplifyConfig => {
7
7
  const amplifyConfig: AmplifyConfig = {};
8
8
  // Analytics
9
9
  if (config['aws_mobile_analytics_app_id']) {
@@ -80,3 +80,15 @@ export const parseAWSExports = (config): AmplifyConfig => {
80
80
  logger.debug('parse config', config, 'to amplifyconfig', amplifyConfig);
81
81
  return amplifyConfig;
82
82
  };
83
+
84
+ /**
85
+ * @deprecated use per-function export
86
+ */
87
+ export class Parser {
88
+ static parseMobilehubConfig = parseMobileHubConfig;
89
+ }
90
+
91
+ /**
92
+ * @deprecated use per-function export
93
+ */
94
+ export default Parser;
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
  import { version } from './version';
4
14
 
5
15
  const BASE_USER_AGENT = `aws-amplify/${version}`;
@@ -28,3 +38,8 @@ if (typeof navigator !== 'undefined' && navigator.product) {
28
38
  export const getAmplifyUserAgent = (content?: string) => {
29
39
  return `${Platform.userAgent}${content ? content : ''}`;
30
40
  };
41
+
42
+ /**
43
+ * @deprecated use named import
44
+ */
45
+ export default Platform;
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '4.7.11';
2
+ export const version = '4.7.12';
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
14
  import {
5
15
  CloudWatchLogsClient,
@@ -33,7 +43,7 @@ import {
33
43
  import { Credentials } from '../..';
34
44
  import { ConsoleLogger as Logger } from '../Logger';
35
45
  import { getAmplifyUserAgent } from '../Platform';
36
- import { parseAWSExports } from '../parseAWSExports';
46
+ import { parseMobileHubConfig } from '../Parser';
37
47
  import {
38
48
  AWS_CLOUDWATCH_BASE_BUFFER_SIZE,
39
49
  AWS_CLOUDWATCH_CATEGORY,
@@ -86,7 +96,7 @@ class AWSCloudWatchProvider implements LoggingProvider {
86
96
  const conf = Object.assign(
87
97
  {},
88
98
  this._config,
89
- parseAWSExports(config).Logging,
99
+ parseMobileHubConfig(config).Logging,
90
100
  config
91
101
  );
92
102
  this._config = conf;
@@ -1 +1 @@
1
- export { AWSCloudWatchProvider } from './AWSCloudWatchProvider';
1
+ export * from './AWSCloudWatchProvider';
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
14
  import { browserOrNode } from '../JS';
5
15
  import { StorageHelper } from '../StorageHelper';
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
14
  import { Linking, AppState } from 'react-native';
5
15
  import AsyncStorage from '@react-native-async-storage/async-storage';
@@ -42,7 +42,7 @@ export class ServiceWorkerClass {
42
42
  // The AWS Amplify logger
43
43
  private _logger: Logger = new Logger('ServiceWorker');
44
44
 
45
- constructor() {}
45
+ constructor() { }
46
46
 
47
47
  /**
48
48
  * Get the currently active service worker
@@ -202,3 +202,8 @@ export class ServiceWorkerClass {
202
202
  });
203
203
  }
204
204
  }
205
+
206
+ /**
207
+ * @deprecated use named import
208
+ */
209
+ export default ServiceWorkerClass;