@aws-amplify/core 6.0.1-console-preview.d807e55.0 → 6.0.1-console-preview.a1c533e.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 (134) hide show
  1. package/internals/aws-clients/pinpoint/package.json +4 -4
  2. package/lib/Hub/index.d.ts +7 -0
  3. package/lib/Hub/index.js +8 -1
  4. package/lib/Platform/customUserAgent.d.ts +16 -0
  5. package/lib/Platform/customUserAgent.js +70 -0
  6. package/lib/Platform/index.js +10 -1
  7. package/lib/Platform/types.d.ts +59 -4
  8. package/lib/Platform/types.js +26 -35
  9. package/lib/Platform/version.d.ts +1 -1
  10. package/lib/Platform/version.js +1 -1
  11. package/lib/clients/middleware/signing/signer/signatureV4/index.d.ts +1 -0
  12. package/lib/clients/middleware/signing/signer/signatureV4/index.js +1 -0
  13. package/lib/clients/middleware/signing/signer/signatureV4/polyfills/index.d.ts +0 -0
  14. package/lib/clients/middleware/signing/signer/signatureV4/polyfills/index.js +4 -0
  15. package/lib/clients/middleware/signing/signer/signatureV4/polyfills/index.native.d.ts +1 -0
  16. package/lib/clients/middleware/signing/signer/signatureV4/polyfills/index.native.js +6 -0
  17. package/lib/index.d.ts +1 -1
  18. package/lib/index.js +3 -3
  19. package/lib/libraryUtils.d.ts +4 -3
  20. package/lib/libraryUtils.js +6 -4
  21. package/lib/parseAWSExports.js +70 -14
  22. package/lib/providers/pinpoint/apis/updateEndpoint.js +2 -2
  23. package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +2 -2
  24. package/lib/singleton/Auth/types.d.ts +27 -0
  25. package/lib/tsconfig.tsbuildinfo +1 -1
  26. package/lib/utils/globalHelpers/index.native.d.ts +2 -3
  27. package/lib/utils/globalHelpers/index.native.js +3 -3
  28. package/lib-esm/Hub/index.d.ts +7 -0
  29. package/lib-esm/Hub/index.js +7 -0
  30. package/lib-esm/Platform/customUserAgent.d.ts +16 -0
  31. package/lib-esm/Platform/customUserAgent.js +65 -0
  32. package/lib-esm/Platform/index.js +10 -1
  33. package/lib-esm/Platform/types.d.ts +59 -4
  34. package/lib-esm/Platform/types.js +26 -35
  35. package/lib-esm/Platform/version.d.ts +1 -1
  36. package/lib-esm/Platform/version.js +1 -1
  37. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.d.ts +1 -0
  38. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.js +1 -0
  39. package/lib-esm/clients/middleware/signing/signer/signatureV4/polyfills/index.d.ts +0 -0
  40. package/lib-esm/clients/middleware/signing/signer/signatureV4/polyfills/index.js +4 -0
  41. package/lib-esm/clients/middleware/signing/signer/signatureV4/polyfills/index.native.d.ts +1 -0
  42. package/lib-esm/clients/middleware/signing/signer/signatureV4/polyfills/index.native.js +4 -0
  43. package/lib-esm/index.d.ts +1 -1
  44. package/lib-esm/index.js +1 -1
  45. package/lib-esm/libraryUtils.d.ts +4 -3
  46. package/lib-esm/libraryUtils.js +3 -2
  47. package/lib-esm/parseAWSExports.js +70 -14
  48. package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +1 -1
  49. package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +1 -1
  50. package/lib-esm/singleton/Auth/types.d.ts +27 -0
  51. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  52. package/lib-esm/utils/globalHelpers/index.native.d.ts +2 -3
  53. package/lib-esm/utils/globalHelpers/index.native.js +2 -2
  54. package/package.json +4 -4
  55. package/src/Hub/index.ts +8 -0
  56. package/src/Platform/customUserAgent.ts +75 -0
  57. package/src/Platform/index.ts +14 -1
  58. package/src/Platform/types.ts +69 -35
  59. package/src/Platform/version.ts +1 -1
  60. package/src/clients/middleware/signing/signer/signatureV4/index.ts +2 -0
  61. package/src/clients/middleware/signing/signer/signatureV4/polyfills/index.native.ts +5 -0
  62. package/src/clients/middleware/signing/signer/signatureV4/polyfills/index.ts +4 -0
  63. package/src/index.ts +1 -1
  64. package/src/libraryUtils.ts +13 -8
  65. package/src/parseAWSExports.ts +54 -13
  66. package/src/providers/pinpoint/apis/updateEndpoint.ts +1 -1
  67. package/src/providers/pinpoint/utils/PinpointEventBuffer.ts +1 -1
  68. package/src/singleton/Auth/types.ts +49 -0
  69. package/src/utils/globalHelpers/index.native.ts +2 -2
  70. package/lib/clients/middleware/signing/signer/signatureV4/index.native.d.ts +0 -4
  71. package/lib/clients/middleware/signing/signer/signatureV4/index.native.js +0 -16
  72. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.native.d.ts +0 -4
  73. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.native.js +0 -9
  74. package/src/clients/middleware/signing/signer/signatureV4/index.native.ts +0 -12
  75. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.d.ts +0 -0
  76. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.js +0 -0
  77. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.d.ts +0 -0
  78. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.js +0 -0
  79. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.d.ts +0 -0
  80. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.js +0 -0
  81. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.d.ts +0 -0
  82. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.js +0 -0
  83. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/types.d.ts +0 -0
  84. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/types.js +0 -0
  85. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/base.d.ts +0 -0
  86. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/base.js +0 -0
  87. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/errorHelpers.d.ts +0 -0
  88. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/errorHelpers.js +0 -0
  89. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/getInAppMessages.d.ts +0 -0
  90. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/getInAppMessages.js +0 -0
  91. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/index.d.ts +0 -0
  92. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/index.js +0 -0
  93. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/putEvents.d.ts +0 -0
  94. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/putEvents.js +0 -0
  95. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/types.d.ts +0 -0
  96. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/types.js +0 -0
  97. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.d.ts +0 -0
  98. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.js +0 -0
  99. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.d.ts +0 -0
  100. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.js +0 -0
  101. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.d.ts +0 -0
  102. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.js +0 -0
  103. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.d.ts +0 -0
  104. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.js +0 -0
  105. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.d.ts +0 -0
  106. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.js +0 -0
  107. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/types.d.ts +0 -0
  108. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/types.js +0 -0
  109. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/base.d.ts +0 -0
  110. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/base.js +0 -0
  111. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/errorHelpers.d.ts +0 -0
  112. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/errorHelpers.js +0 -0
  113. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/getInAppMessages.d.ts +0 -0
  114. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/getInAppMessages.js +0 -0
  115. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/index.d.ts +0 -0
  116. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/index.js +0 -0
  117. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/putEvents.d.ts +0 -0
  118. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/putEvents.js +0 -0
  119. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/types.d.ts +0 -0
  120. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/types.js +0 -0
  121. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.d.ts +0 -0
  122. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.js +0 -0
  123. /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.ts +0 -0
  124. /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.ts +0 -0
  125. /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.ts +0 -0
  126. /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.ts +0 -0
  127. /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/types.ts +0 -0
  128. /package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/base.ts +0 -0
  129. /package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/errorHelpers.ts +0 -0
  130. /package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/getInAppMessages.ts +0 -0
  131. /package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/index.ts +0 -0
  132. /package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/putEvents.ts +0 -0
  133. /package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/types.ts +0 -0
  134. /package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.ts +0 -0
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@aws-amplify/core/internals/aws-clients/pinpoint",
3
- "types": "../../../lib-esm/AwsClients/Pinpoint/index.d.ts",
4
- "main": "../../../lib/AwsClients/Pinpoint/index.js",
5
- "module": "../../../lib-esm/AwsClients/Pinpoint/index.js",
6
- "react-native": "../../../lib-esm/AwsClients/Pinpoint/index.js",
3
+ "types": "../../../lib-esm/awsClients/pinpoint/index.d.ts",
4
+ "main": "../../../lib/awsClients/pinpoint/index.js",
5
+ "module": "../../../lib-esm/awsClients/pinpoint/index.js",
6
+ "react-native": "../../../lib-esm/awsClients/pinpoint/index.js",
7
7
  "sideEffects": false
8
8
  }
@@ -37,3 +37,10 @@ export declare class HubClass {
37
37
  private _toListeners;
38
38
  }
39
39
  export declare const Hub: HubClass;
40
+ /**
41
+ * @internal
42
+ *
43
+ * Internal hub used for core Amplify functionality. Not intended for use outside of Amplify.
44
+ *
45
+ */
46
+ export declare const HubInternal: HubClass;
package/lib/Hub/index.js CHANGED
@@ -38,7 +38,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
38
38
  return to.concat(ar || Array.prototype.slice.call(from));
39
39
  };
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.Hub = exports.HubClass = exports.AMPLIFY_SYMBOL = void 0;
41
+ exports.HubInternal = exports.Hub = exports.HubClass = exports.AMPLIFY_SYMBOL = void 0;
42
42
  var Logger_1 = require("../Logger");
43
43
  var constants_1 = require("../constants");
44
44
  var errors_1 = require("../errors");
@@ -149,3 +149,10 @@ exports.HubClass = HubClass;
149
149
  pseudo Singleton for the main messaging bus, however you can still create
150
150
  your own instance of HubClass() for a separate "private bus" of events.*/
151
151
  exports.Hub = new HubClass('__default__');
152
+ /**
153
+ * @internal
154
+ *
155
+ * Internal hub used for core Amplify functionality. Not intended for use outside of Amplify.
156
+ *
157
+ */
158
+ exports.HubInternal = new HubClass('internal-hub');
@@ -0,0 +1,16 @@
1
+ import { AdditionalDetails, SetCustomUserAgentInput } from './types';
2
+ /**
3
+ * Sets custom user agent state which will be appended to applicable requests. Returns a function that can be used to
4
+ * clean up any custom state set with this API.
5
+ *
6
+ * @note
7
+ * This API operates globally. Calling this API multiple times will result in the most recently set values for a
8
+ * particular API being used.
9
+ *
10
+ * @note
11
+ * This utility IS NOT compatible with SSR.
12
+ *
13
+ * @param input - SetCustomUserAgentInput that defines custom state to apply to the specified APIs.
14
+ */
15
+ export declare const setCustomUserAgent: (input: SetCustomUserAgentInput) => (() => void);
16
+ export declare const getCustomUserAgent: (category: string, api: string) => AdditionalDetails | undefined;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ var __assign = (this && this.__assign) || function () {
5
+ __assign = Object.assign || function(t) {
6
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
7
+ s = arguments[i];
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
9
+ t[p] = s[p];
10
+ }
11
+ return t;
12
+ };
13
+ return __assign.apply(this, arguments);
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.getCustomUserAgent = exports.setCustomUserAgent = void 0;
17
+ // Maintains custom user-agent state set by external consumers.
18
+ var customUserAgentState = {};
19
+ /**
20
+ * Sets custom user agent state which will be appended to applicable requests. Returns a function that can be used to
21
+ * clean up any custom state set with this API.
22
+ *
23
+ * @note
24
+ * This API operates globally. Calling this API multiple times will result in the most recently set values for a
25
+ * particular API being used.
26
+ *
27
+ * @note
28
+ * This utility IS NOT compatible with SSR.
29
+ *
30
+ * @param input - SetCustomUserAgentInput that defines custom state to apply to the specified APIs.
31
+ */
32
+ var setCustomUserAgent = function (input) {
33
+ var _a;
34
+ // Save custom user-agent state & increment reference counter
35
+ // TODO Remove `any` when we upgrade to TypeScript 5.2, see: https://github.com/microsoft/TypeScript/issues/44373
36
+ customUserAgentState[input.category] = input.apis.reduce(function (acc, api) {
37
+ var _a;
38
+ var _b;
39
+ return (__assign(__assign({}, acc), (_a = {}, _a[api] = {
40
+ refCount: ((_b = acc[api]) === null || _b === void 0 ? void 0 : _b.refCount) ? acc[api].refCount + 1 : 1,
41
+ additionalDetails: input.additionalDetails,
42
+ }, _a)));
43
+ }, (_a = customUserAgentState[input.category]) !== null && _a !== void 0 ? _a : {});
44
+ // Callback that cleans up state for APIs recorded by this call
45
+ var cleanUpCallbackCalled = false;
46
+ var cleanUpCallback = function () {
47
+ // Only allow the cleanup callback to be called once
48
+ if (cleanUpCallbackCalled) {
49
+ return;
50
+ }
51
+ cleanUpCallbackCalled = true;
52
+ input.apis.forEach(function (api) {
53
+ var apiRefCount = customUserAgentState[input.category][api].refCount;
54
+ if (apiRefCount > 1) {
55
+ customUserAgentState[input.category][api].refCount = apiRefCount - 1;
56
+ }
57
+ else {
58
+ delete customUserAgentState[input.category][api];
59
+ // Clean up category if no more APIs set
60
+ if (!Object.keys(customUserAgentState[input.category]).length) {
61
+ delete customUserAgentState[input.category];
62
+ }
63
+ }
64
+ });
65
+ };
66
+ return cleanUpCallback;
67
+ };
68
+ exports.setCustomUserAgent = setCustomUserAgent;
69
+ var getCustomUserAgent = function (category, api) { var _a, _b; return (_b = (_a = customUserAgentState[category]) === null || _a === void 0 ? void 0 : _a[api]) === null || _b === void 0 ? void 0 : _b.additionalDetails; };
70
+ exports.getCustomUserAgent = getCustomUserAgent;
@@ -22,6 +22,7 @@ exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platfo
22
22
  var types_1 = require("./types");
23
23
  var version_1 = require("./version");
24
24
  var detectFramework_1 = require("./detectFramework");
25
+ var customUserAgent_1 = require("./customUserAgent");
25
26
  var BASE_USER_AGENT = "aws-amplify";
26
27
  var PlatformBuilder = /** @class */ (function () {
27
28
  function PlatformBuilder() {
@@ -55,6 +56,14 @@ var getAmplifyUserAgentObject = function (_a) {
55
56
  userAgent.push([category, action]);
56
57
  }
57
58
  userAgent.push(['framework', (0, detectFramework_1.detectFramework)()]);
59
+ if (category && action) {
60
+ var customState = (0, customUserAgent_1.getCustomUserAgent)(category, action);
61
+ if (customState) {
62
+ customState.forEach(function (state) {
63
+ userAgent.push(state);
64
+ });
65
+ }
66
+ }
58
67
  return userAgent;
59
68
  };
60
69
  exports.getAmplifyUserAgentObject = getAmplifyUserAgentObject;
@@ -63,7 +72,7 @@ var getAmplifyUserAgent = function (customUserAgentDetails) {
63
72
  var userAgentString = userAgent
64
73
  .map(function (_a) {
65
74
  var _b = __read(_a, 2), agentKey = _b[0], agentValue = _b[1];
66
- return "".concat(agentKey, "/").concat(agentValue);
75
+ return agentKey && agentValue ? "".concat(agentKey, "/").concat(agentValue) : agentKey;
67
76
  })
68
77
  .join(' ');
69
78
  return userAgentString;
@@ -43,7 +43,30 @@ export declare enum ApiAction {
43
43
  Head = "7"
44
44
  }
45
45
  export declare enum AuthAction {
46
- FederatedSignIn = "30"
46
+ SignUp = "1",
47
+ ConfirmSignUp = "2",
48
+ ResendSignUpCode = "3",
49
+ SignIn = "4",
50
+ FetchMFAPreference = "6",
51
+ UpdateMFAPreference = "7",
52
+ SetUpTOTP = "10",
53
+ VerifyTOTPSetup = "11",
54
+ ConfirmSignIn = "12",
55
+ DeleteUserAttributes = "15",
56
+ DeleteUser = "16",
57
+ UpdateUserAttributes = "17",
58
+ FetchUserAttributes = "18",
59
+ ConfirmUserAttribute = "22",
60
+ SignOut = "26",
61
+ UpdatePassword = "27",
62
+ ResetPassword = "28",
63
+ ConfirmResetPassword = "29",
64
+ FederatedSignIn = "30",
65
+ RememberDevice = "32",
66
+ ForgetDevice = "33",
67
+ FetchDevices = "34",
68
+ SendUserAttributeVerificationCode = "35",
69
+ SignInWithRedirect = "36"
47
70
  }
48
71
  export declare enum DataStoreAction {
49
72
  Subscribe = "1",
@@ -71,12 +94,13 @@ export declare enum PushNotificationAction {
71
94
  None = "0"
72
95
  }
73
96
  export declare enum StorageAction {
74
- Put = "1",
75
- Get = "2",
97
+ UploadData = "1",
98
+ DownloadData = "2",
76
99
  List = "3",
77
100
  Copy = "4",
78
101
  Remove = "5",
79
- GetProperties = "6"
102
+ GetProperties = "6",
103
+ GetUrl = "7"
80
104
  }
81
105
  type ActionMap = {
82
106
  [Category.Auth]: AuthAction;
@@ -102,4 +126,35 @@ export type CustomUserAgentDetails = (CustomUserAgentDetailsBase & {
102
126
  category?: never;
103
127
  action?: never;
104
128
  }) | UserAgentDetailsWithCategory<Category.API> | UserAgentDetailsWithCategory<Category.Auth> | UserAgentDetailsWithCategory<Category.Analytics> | UserAgentDetailsWithCategory<Category.DataStore> | UserAgentDetailsWithCategory<Category.Geo> | UserAgentDetailsWithCategory<Category.Interactions> | UserAgentDetailsWithCategory<Category.InAppMessaging> | UserAgentDetailsWithCategory<Category.Predictions> | UserAgentDetailsWithCategory<Category.PubSub> | UserAgentDetailsWithCategory<Category.PushNotification> | UserAgentDetailsWithCategory<Category.Storage>;
129
+ /**
130
+ * `refCount` tracks how many consumers have set state for a particular API to avoid it being cleared before all
131
+ * consumers are done using it.
132
+ *
133
+ * Category -> Action -> Custom State
134
+ */
135
+ export type CategoryUserAgentStateMap = Record<string, {
136
+ refCount: number;
137
+ additionalDetails: AdditionalDetails;
138
+ }>;
139
+ export type CustomUserAgentStateMap = Record<string, CategoryUserAgentStateMap>;
140
+ export type AdditionalDetails = [string, string?][];
141
+ type StorageUserAgentInput = {
142
+ category: Category.Storage;
143
+ apis: StorageAction[];
144
+ };
145
+ type AuthUserAgentInput = {
146
+ category: Category.Auth;
147
+ apis: AuthAction[];
148
+ };
149
+ type InAppMessagingUserAgentInput = {
150
+ category: Category.InAppMessaging;
151
+ apis: InAppMessagingAction[];
152
+ };
153
+ type GeoUserAgentInput = {
154
+ category: Category.Geo;
155
+ apis: GeoAction[];
156
+ };
157
+ export type SetCustomUserAgentInput = (StorageUserAgentInput | AuthUserAgentInput | InAppMessagingUserAgentInput | GeoUserAgentInput) & {
158
+ additionalDetails: AdditionalDetails;
159
+ };
105
160
  export {};
@@ -56,40 +56,30 @@ var ApiAction;
56
56
  })(ApiAction = exports.ApiAction || (exports.ApiAction = {}));
57
57
  var AuthAction;
58
58
  (function (AuthAction) {
59
- // SignUp = '1',
60
- // ConfirmSignUp = '2',
61
- // ResendSignUp = '3',
62
- // SignIn = '4',
63
- // GetMFAOptions = '5',
64
- // GetPreferredMFA = '6',
65
- // SetPreferredMFA = '7',
66
- // DisableSMS = '8',
67
- // EnableSMS = '9',
68
- // SetupTOTP = '10',
69
- // VerifyTotpToken = '11',
70
- // ConfirmSignIn = '12',
71
- // CompleteNewPassword = '13',
72
- // SendCustomChallengeAnswer = '14',
73
- // DeleteUserAttributes = '15',
74
- // DeleteUser = '16',
75
- // UpdateUserAttributes = '17',
76
- // UserAttributes = '18',
77
- // CurrentUserPoolUser = '19',
78
- // CurrentAuthenticatedUser = '20',
79
- // CurrentSession = '21',
80
- // VerifyUserAttribute = '22',
81
- // VerifyUserAttributeSubmit = '23',
82
- // VerifyCurrentUserAttribute = '24',
83
- // VerifyCurrentUserAttributeSubmit = '25',
84
- // SignOut = '26',
85
- // ChangePassword = '27',
86
- // ForgotPassword = '28',
87
- // ForgotPasswordSubmit = '29',
59
+ AuthAction["SignUp"] = "1";
60
+ AuthAction["ConfirmSignUp"] = "2";
61
+ AuthAction["ResendSignUpCode"] = "3";
62
+ AuthAction["SignIn"] = "4";
63
+ AuthAction["FetchMFAPreference"] = "6";
64
+ AuthAction["UpdateMFAPreference"] = "7";
65
+ AuthAction["SetUpTOTP"] = "10";
66
+ AuthAction["VerifyTOTPSetup"] = "11";
67
+ AuthAction["ConfirmSignIn"] = "12";
68
+ AuthAction["DeleteUserAttributes"] = "15";
69
+ AuthAction["DeleteUser"] = "16";
70
+ AuthAction["UpdateUserAttributes"] = "17";
71
+ AuthAction["FetchUserAttributes"] = "18";
72
+ AuthAction["ConfirmUserAttribute"] = "22";
73
+ AuthAction["SignOut"] = "26";
74
+ AuthAction["UpdatePassword"] = "27";
75
+ AuthAction["ResetPassword"] = "28";
76
+ AuthAction["ConfirmResetPassword"] = "29";
88
77
  AuthAction["FederatedSignIn"] = "30";
89
- // CurrentUserInfo = '31',
90
- // RememberDevice = '32',
91
- // ForgetDevice = '33',
92
- // FetchDevices = '34',
78
+ AuthAction["RememberDevice"] = "32";
79
+ AuthAction["ForgetDevice"] = "33";
80
+ AuthAction["FetchDevices"] = "34";
81
+ AuthAction["SendUserAttributeVerificationCode"] = "35";
82
+ AuthAction["SignInWithRedirect"] = "36";
93
83
  })(AuthAction = exports.AuthAction || (exports.AuthAction = {}));
94
84
  var DataStoreAction;
95
85
  (function (DataStoreAction) {
@@ -125,10 +115,11 @@ var PushNotificationAction;
125
115
  })(PushNotificationAction = exports.PushNotificationAction || (exports.PushNotificationAction = {}));
126
116
  var StorageAction;
127
117
  (function (StorageAction) {
128
- StorageAction["Put"] = "1";
129
- StorageAction["Get"] = "2";
118
+ StorageAction["UploadData"] = "1";
119
+ StorageAction["DownloadData"] = "2";
130
120
  StorageAction["List"] = "3";
131
121
  StorageAction["Copy"] = "4";
132
122
  StorageAction["Remove"] = "5";
133
123
  StorageAction["GetProperties"] = "6";
124
+ StorageAction["GetUrl"] = "7";
134
125
  })(StorageAction = exports.StorageAction || (exports.StorageAction = {}));
@@ -1 +1 @@
1
- export declare const version = "6.0.1-console-preview.d807e55.0+d807e55";
1
+ export declare const version = "6.0.1-console-preview.a1c533e.0+a1c533e";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // generated by genversion
5
- exports.version = '6.0.1-console-preview.d807e55.0+d807e55';
5
+ exports.version = '6.0.1-console-preview.a1c533e.0+a1c533e';
@@ -1,3 +1,4 @@
1
+ import './polyfills';
1
2
  export { signRequest } from './signRequest';
2
3
  export { presignUrl } from './presignUrl';
3
4
  export { TOKEN_QUERY_PARAM } from './constants';
@@ -3,6 +3,7 @@
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.getHashedPayload = exports.TOKEN_QUERY_PARAM = exports.presignUrl = exports.signRequest = void 0;
6
+ require("./polyfills");
6
7
  // TODO: V6 replace Signer
7
8
  var signRequest_1 = require("./signRequest");
8
9
  Object.defineProperty(exports, "signRequest", { enumerable: true, get: function () { return signRequest_1.signRequest; } });
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // noop - polyfills not required on platform
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ var react_native_1 = require("@aws-amplify/react-native");
6
+ (0, react_native_1.loadUrlPolyfill)();
package/lib/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { HubCapsule, HubCallback, HubPayload } from './Hub/types';
3
3
  export { TokenProvider, AuthTokens, FetchAuthSessionOptions, AWSCredentialsAndIdentityIdProvider, AWSCredentialsAndIdentityId, Identity, OAuthConfig, CognitoUserPoolConfig, } from './singleton/Auth/types';
4
4
  export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, AnalyticsConfig, GeoConfig, } from './singleton/types';
5
5
  export { Amplify, fetchAuthSession, AmplifyClass as AmplifyClassV6, clearCredentials, } from './singleton';
6
- export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './AwsClients/CognitoIdentity';
6
+ export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './awsClients/cognitoIdentity';
7
7
  export { UserProfile } from './types';
8
8
  export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
9
9
  export { KeyValueStorageInterface } from './types';
package/lib/index.js CHANGED
@@ -15,9 +15,9 @@ Object.defineProperty(exports, "fetchAuthSession", { enumerable: true, get: func
15
15
  Object.defineProperty(exports, "AmplifyClassV6", { enumerable: true, get: function () { return singleton_1.AmplifyClass; } });
16
16
  Object.defineProperty(exports, "clearCredentials", { enumerable: true, get: function () { return singleton_1.clearCredentials; } });
17
17
  // AWSClients exports
18
- var CognitoIdentity_1 = require("./AwsClients/CognitoIdentity");
19
- Object.defineProperty(exports, "getCredentialsForIdentity", { enumerable: true, get: function () { return CognitoIdentity_1.getCredentialsForIdentity; } });
20
- Object.defineProperty(exports, "getId", { enumerable: true, get: function () { return CognitoIdentity_1.getId; } });
18
+ var cognitoIdentity_1 = require("./awsClients/cognitoIdentity");
19
+ Object.defineProperty(exports, "getCredentialsForIdentity", { enumerable: true, get: function () { return cognitoIdentity_1.getCredentialsForIdentity; } });
20
+ Object.defineProperty(exports, "getId", { enumerable: true, get: function () { return cognitoIdentity_1.getId; } });
21
21
  // Storage helpers
22
22
  var storage_1 = require("./storage");
23
23
  Object.defineProperty(exports, "CookieStorage", { enumerable: true, get: function () { return storage_1.CookieStorage; } });
@@ -1,15 +1,16 @@
1
1
  export { generateRandomString, isBrowser, isNonRetryableError, isWebWorker, jitteredBackoff, jitteredExponentialRetry, NonRetryableError, retry, urlSafeDecode, urlSafeEncode, } from './utils';
2
2
  export { parseAWSExports } from './parseAWSExports';
3
3
  export { LegacyConfig } from './singleton/types';
4
- export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, } from './singleton/Auth/types';
5
4
  export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
6
5
  export { isTokenExpired } from './singleton/Auth';
7
6
  export { APIAuthMode, DocumentType } from './singleton/API/types';
8
7
  export { Signer } from './Signer';
8
+ export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, AuthStandardAttributeKey, AuthVerifiableAttributeKey, } from './singleton/Auth/types';
9
9
  export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
10
10
  export { ClientDevice } from './ClientDevice';
11
11
  export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
12
- export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, } from './Platform/types';
12
+ export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, SetCustomUserAgentInput, } from './Platform/types';
13
+ export { setCustomUserAgent } from './Platform/customUserAgent';
13
14
  export { ServiceWorker } from './ServiceWorker';
14
15
  export { BackgroundProcessManager } from './BackgroundProcessManager';
15
16
  export { Mutex } from './Mutex';
@@ -21,4 +22,4 @@ export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
21
22
  export { AMPLIFY_SYMBOL } from './Hub';
22
23
  export { base64Decoder, base64Encoder } from './utils/convert';
23
24
  export { getCrypto } from './utils/globalHelpers';
24
- export { HubClass } from './Hub';
25
+ export { HubInternal } from './Hub';
@@ -2,8 +2,8 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.base64Encoder = exports.base64Decoder = exports.AMPLIFY_SYMBOL = exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.AmplifyErrorCode = exports.createAssertionFunction = exports.PlatformNotSupportedError = exports.AmplifyError = exports.Reachability = exports.Mutex = exports.BackgroundProcessManager = exports.ServiceWorker = exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InAppMessagingAction = exports.InteractionsAction = exports.GeoAction = exports.Framework = exports.DataStoreAction = exports.Category = exports.AnalyticsAction = exports.AuthAction = exports.ApiAction = exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platform = exports.ClientDevice = exports.Logger = exports.ConsoleLogger = exports.Signer = exports.isTokenExpired = exports.assertOAuthConfig = exports.assertIdentityPoolIdConfig = exports.assertTokenProviderConfig = exports.decodeJWT = exports.parseAWSExports = exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.NonRetryableError = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isWebWorker = exports.isNonRetryableError = exports.isBrowser = exports.generateRandomString = void 0;
6
- exports.HubClass = exports.getCrypto = void 0;
5
+ exports.base64Decoder = exports.AMPLIFY_SYMBOL = exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.AmplifyErrorCode = exports.createAssertionFunction = exports.PlatformNotSupportedError = exports.AmplifyError = exports.Reachability = exports.Mutex = exports.BackgroundProcessManager = exports.ServiceWorker = exports.setCustomUserAgent = exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InAppMessagingAction = exports.InteractionsAction = exports.GeoAction = exports.Framework = exports.DataStoreAction = exports.Category = exports.AnalyticsAction = exports.AuthAction = exports.ApiAction = exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platform = exports.ClientDevice = exports.Logger = exports.ConsoleLogger = exports.Signer = exports.isTokenExpired = exports.assertOAuthConfig = exports.assertIdentityPoolIdConfig = exports.assertTokenProviderConfig = exports.decodeJWT = exports.parseAWSExports = exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.NonRetryableError = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isWebWorker = exports.isNonRetryableError = exports.isBrowser = exports.generateRandomString = void 0;
6
+ exports.HubInternal = exports.getCrypto = exports.base64Encoder = void 0;
7
7
  /*
8
8
  This file maps top-level exports from `@aws-amplify/core/internals/utils`. These are intended to be internal
9
9
  utils for use throughout the library.
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "Signer", { enumerable: true, get: function () {
36
36
  var Logger_1 = require("./Logger");
37
37
  Object.defineProperty(exports, "ConsoleLogger", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });
38
38
  Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });
39
- // Platform & device utils
39
+ // Platform & user-agent utilities
40
40
  var ClientDevice_1 = require("./ClientDevice");
41
41
  Object.defineProperty(exports, "ClientDevice", { enumerable: true, get: function () { return ClientDevice_1.ClientDevice; } });
42
42
  var Platform_1 = require("./Platform");
@@ -57,6 +57,8 @@ Object.defineProperty(exports, "PredictionsAction", { enumerable: true, get: fun
57
57
  Object.defineProperty(exports, "PubSubAction", { enumerable: true, get: function () { return types_1.PubSubAction; } });
58
58
  Object.defineProperty(exports, "PushNotificationAction", { enumerable: true, get: function () { return types_1.PushNotificationAction; } });
59
59
  Object.defineProperty(exports, "StorageAction", { enumerable: true, get: function () { return types_1.StorageAction; } });
60
+ var customUserAgent_1 = require("./Platform/customUserAgent");
61
+ Object.defineProperty(exports, "setCustomUserAgent", { enumerable: true, get: function () { return customUserAgent_1.setCustomUserAgent; } });
60
62
  // Service worker
61
63
  var ServiceWorker_1 = require("./ServiceWorker");
62
64
  Object.defineProperty(exports, "ServiceWorker", { enumerable: true, get: function () { return ServiceWorker_1.ServiceWorker; } });
@@ -87,4 +89,4 @@ var globalHelpers_1 = require("./utils/globalHelpers");
87
89
  Object.defineProperty(exports, "getCrypto", { enumerable: true, get: function () { return globalHelpers_1.getCrypto; } });
88
90
  // Hub
89
91
  var Hub_2 = require("./Hub");
90
- Object.defineProperty(exports, "HubClass", { enumerable: true, get: function () { return Hub_2.HubClass; } });
92
+ Object.defineProperty(exports, "HubInternal", { enumerable: true, get: function () { return Hub_2.HubInternal; } });
@@ -10,6 +10,31 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __read = (this && this.__read) || function (o, n) {
14
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
15
+ if (!m) return o;
16
+ var i = m.call(o), r, ar = [], e;
17
+ try {
18
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
19
+ }
20
+ catch (error) { e = { error: error }; }
21
+ finally {
22
+ try {
23
+ if (r && !r.done && (m = i["return"])) m.call(i);
24
+ }
25
+ finally { if (e) throw e.error; }
26
+ }
27
+ return ar;
28
+ };
29
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
30
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
31
+ if (ar || !(i in from)) {
32
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
33
+ ar[i] = from[i];
34
+ }
35
+ }
36
+ return to.concat(ar || Array.prototype.slice.call(from));
37
+ };
13
38
  Object.defineProperty(exports, "__esModule", { value: true });
14
39
  exports.parseAWSExports = void 0;
15
40
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -33,9 +58,9 @@ var authTypeMapping = {
33
58
  * @returns A {@link ResourcesConfig} object.
34
59
  */
35
60
  var parseAWSExports = function (config) {
36
- var _a;
61
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
37
62
  if (config === void 0) { config = {}; }
38
- var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth, aws_cloud_logic_custom = config.aws_cloud_logic_custom, Notifications = config.Notifications;
63
+ var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration = config.aws_cognito_mfa_configuration, aws_cognito_mfa_types = config.aws_cognito_mfa_types, aws_cognito_password_protection_settings = config.aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms = config.aws_cognito_verification_mechanisms, aws_cognito_signup_attributes = config.aws_cognito_signup_attributes, aws_cognito_username_attributes = config.aws_cognito_username_attributes, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth, aws_cloud_logic_custom = config.aws_cloud_logic_custom, Notifications = config.Notifications;
39
64
  var amplifyConfig = {};
40
65
  // Analytics
41
66
  if (aws_mobile_analytics_app_id) {
@@ -49,7 +74,7 @@ var parseAWSExports = function (config) {
49
74
  // Notifications
50
75
  if (Notifications) {
51
76
  if ((_a = Notifications.InAppMessaging) === null || _a === void 0 ? void 0 : _a.AWSPinpoint) {
52
- var _b = Notifications.InAppMessaging.AWSPinpoint, appId = _b.appId, region = _b.region;
77
+ var _p = Notifications.InAppMessaging.AWSPinpoint, appId = _p.appId, region = _p.region;
53
78
  amplifyConfig.Notifications = {
54
79
  InAppMessaging: {
55
80
  Pinpoint: {
@@ -76,12 +101,45 @@ var parseAWSExports = function (config) {
76
101
  };
77
102
  }
78
103
  // Auth
104
+ var mfaConfig = aws_cognito_mfa_configuration ? {
105
+ status: aws_cognito_mfa_configuration && aws_cognito_mfa_configuration.toLowerCase(),
106
+ totpEnabled: (_b = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('TOTP')) !== null && _b !== void 0 ? _b : false,
107
+ smsEnabled: (_c = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('SMS')) !== null && _c !== void 0 ? _c : false
108
+ } : undefined;
109
+ var passwordFormatConfig = aws_cognito_password_protection_settings ? {
110
+ minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,
111
+ requireLowercase: (_e = (_d = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _d === void 0 ? void 0 : _d.includes('REQUIRES_LOWERCASE')) !== null && _e !== void 0 ? _e : false,
112
+ requireUppercase: (_g = (_f = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _f === void 0 ? void 0 : _f.includes('REQUIRES_UPPERCASE')) !== null && _g !== void 0 ? _g : false,
113
+ requireNumbers: (_j = (_h = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _h === void 0 ? void 0 : _h.includes('REQUIRES_NUMBERS')) !== null && _j !== void 0 ? _j : false,
114
+ requireSpecialCharacters: (_l = (_k = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _k === void 0 ? void 0 : _k.includes('REQUIRES_SYMBOLS')) !== null && _l !== void 0 ? _l : false,
115
+ } : undefined;
116
+ var mergedUserAttributes = Array.from(new Set(__spreadArray(__spreadArray([], __read((aws_cognito_verification_mechanisms !== null && aws_cognito_verification_mechanisms !== void 0 ? aws_cognito_verification_mechanisms : [])), false), __read((aws_cognito_signup_attributes !== null && aws_cognito_signup_attributes !== void 0 ? aws_cognito_signup_attributes : [])), false)));
117
+ var userAttributesConfig = mergedUserAttributes.map(function (s) {
118
+ var _a;
119
+ return (_a = {},
120
+ _a[s.toLowerCase()] = {
121
+ required: true // All user attributes generated by the CLI will be required
122
+ },
123
+ _a);
124
+ });
125
+ var loginWithEmailEnabled = (_m = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('EMAIL')) !== null && _m !== void 0 ? _m : false;
126
+ var loginWithPhoneEnabled = (_o = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('PHONE_NUMBER')) !== null && _o !== void 0 ? _o : false;
79
127
  if (aws_cognito_identity_pool_id || aws_user_pools_id) {
80
128
  amplifyConfig.Auth = {
81
- Cognito: __assign({ identityPoolId: aws_cognito_identity_pool_id, allowGuestAccess: aws_mandatory_sign_in !== 'enable', signUpVerificationMethod: aws_cognito_sign_up_verification_method, userPoolClientId: aws_user_pools_web_client_id, userPoolId: aws_user_pools_id }, (oauth &&
82
- Object.keys(oauth).length > 0 && {
83
- loginWith: getOAuthConfig(oauth),
84
- })),
129
+ Cognito: {
130
+ identityPoolId: aws_cognito_identity_pool_id,
131
+ allowGuestAccess: aws_mandatory_sign_in !== 'enable',
132
+ signUpVerificationMethod: aws_cognito_sign_up_verification_method,
133
+ userAttributes: userAttributesConfig,
134
+ userPoolClientId: aws_user_pools_web_client_id,
135
+ userPoolId: aws_user_pools_id,
136
+ mfa: mfaConfig,
137
+ passwordFormat: passwordFormatConfig,
138
+ loginWith: __assign({ username: (loginWithEmailEnabled || loginWithPhoneEnabled) ? false : true, email: loginWithEmailEnabled, phone: loginWithPhoneEnabled }, (oauth &&
139
+ Object.keys(oauth).length > 0 && {
140
+ oauth: getOAuthConfig(oauth),
141
+ })),
142
+ },
85
143
  };
86
144
  }
87
145
  // Storage
@@ -120,12 +178,10 @@ var getRedirectUrl = function (redirectStr) {
120
178
  var getOAuthConfig = function (_a) {
121
179
  var domain = _a.domain, scope = _a.scope, redirectSignIn = _a.redirectSignIn, redirectSignOut = _a.redirectSignOut, responseType = _a.responseType;
122
180
  return ({
123
- oauth: {
124
- domain: domain,
125
- scopes: scope,
126
- redirectSignIn: getRedirectUrl(redirectSignIn),
127
- redirectSignOut: getRedirectUrl(redirectSignOut),
128
- responseType: responseType,
129
- },
181
+ domain: domain,
182
+ scopes: scope,
183
+ redirectSignIn: getRedirectUrl(redirectSignIn),
184
+ redirectSignOut: getRedirectUrl(redirectSignOut),
185
+ responseType: responseType,
130
186
  });
131
187
  };
@@ -52,7 +52,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
52
52
  exports.updateEndpoint = void 0;
53
53
  var uuid_1 = require("uuid");
54
54
  var ClientDevice_1 = require("../../../ClientDevice");
55
- var Pinpoint_1 = require("../../../AwsClients/Pinpoint");
55
+ var pinpoint_1 = require("../../../awsClients/pinpoint");
56
56
  var utils_1 = require("../utils");
57
57
  /**
58
58
  * @internal
@@ -107,7 +107,7 @@ var updateEndpoint = function (_a) {
107
107
  },
108
108
  },
109
109
  };
110
- return [4 /*yield*/, (0, Pinpoint_1.updateEndpoint)({ credentials: credentials, region: region, userAgentValue: userAgentValue }, input)];
110
+ return [4 /*yield*/, (0, pinpoint_1.updateEndpoint)({ credentials: credentials, region: region, userAgentValue: userAgentValue }, input)];
111
111
  case 2:
112
112
  _c.sent();
113
113
  // if we had to create an endpoint id, we need to now cache it
@@ -76,7 +76,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
76
76
  Object.defineProperty(exports, "__esModule", { value: true });
77
77
  exports.PinpointEventBuffer = void 0;
78
78
  var Logger_1 = require("../../../Logger");
79
- var Pinpoint_1 = require("../../../AwsClients/Pinpoint");
79
+ var pinpoint_1 = require("../../../awsClients/pinpoint");
80
80
  var isAppInForeground_1 = require("./isAppInForeground");
81
81
  var logger = new Logger_1.ConsoleLogger('PinpointEventBuffer');
82
82
  var RETRYABLE_CODES = [429, 500];
@@ -148,7 +148,7 @@ var PinpointEventBuffer = /** @class */ (function () {
148
148
  case 1:
149
149
  _b.trys.push([1, 3, , 4]);
150
150
  _a = this._config, credentials = _a.credentials, region = _a.region, userAgentValue = _a.userAgentValue;
151
- return [4 /*yield*/, (0, Pinpoint_1.putEvents)({
151
+ return [4 /*yield*/, (0, pinpoint_1.putEvents)({
152
152
  credentials: credentials,
153
153
  region: region,
154
154
  userAgentValue: userAgentValue,