mito-ai 0.1.39__py3-none-any.whl → 0.1.41__py3-none-any.whl

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.

Potentially problematic release.


This version of mito-ai might be problematic. Click here for more details.

Files changed (55) hide show
  1. mito_ai/__init__.py +12 -6
  2. mito_ai/_version.py +1 -1
  3. mito_ai/app_builder/handlers.py +1 -2
  4. mito_ai/completions/handlers.py +1 -1
  5. mito_ai/completions/message_history.py +9 -1
  6. mito_ai/completions/models.py +1 -1
  7. mito_ai/completions/prompt_builders/agent_execution_prompt.py +2 -0
  8. mito_ai/completions/prompt_builders/agent_smart_debug_prompt.py +8 -0
  9. mito_ai/completions/prompt_builders/agent_system_message.py +17 -0
  10. mito_ai/constants.py +3 -2
  11. mito_ai/file_uploads/__init__.py +3 -0
  12. mito_ai/file_uploads/handlers.py +225 -0
  13. mito_ai/file_uploads/urls.py +21 -0
  14. mito_ai/openai_client.py +1 -1
  15. mito_ai/tests/file_uploads/__init__.py +2 -0
  16. mito_ai/tests/file_uploads/test_handlers.py +267 -0
  17. mito_ai/tests/message_history/test_message_history_utils.py +57 -4
  18. mito_ai/utils/mito_server_utils.py +7 -0
  19. mito_ai/utils/server_limits.py +1 -1
  20. mito_ai/utils/telemetry_utils.py +26 -9
  21. {mito_ai-0.1.39.data → mito_ai-0.1.41.data}/data/share/jupyter/labextensions/mito_ai/build_log.json +102 -100
  22. {mito_ai-0.1.39.data → mito_ai-0.1.41.data}/data/share/jupyter/labextensions/mito_ai/package.json +4 -2
  23. {mito_ai-0.1.39.data → mito_ai-0.1.41.data}/data/share/jupyter/labextensions/mito_ai/schemas/mito_ai/package.json.orig +3 -1
  24. mito_ai-0.1.39.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.16b532b655cd2906e04a.js → mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.01a962c68c8fae380f30.js +1782 -891
  25. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.01a962c68c8fae380f30.js.map +1 -0
  26. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/node_modules_aws-amplify_core_dist_esm_singleton_apis_fetchAuthSession_mjs.182232e7bc6311fe4528.js +63 -0
  27. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/node_modules_aws-amplify_core_dist_esm_singleton_apis_fetchAuthSession_mjs.182232e7bc6311fe4528.js.map +1 -0
  28. mito_ai-0.1.39.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.606207904e6aaa42b1bf.js → mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.9a70f033717ba8689564.js +49 -25
  29. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.9a70f033717ba8689564.js.map +1 -0
  30. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_auth_dist_esm_providers_cognito_tokenProvider_tokenProvider_mjs.16430abf3466c3153f59.js +4574 -0
  31. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_auth_dist_esm_providers_cognito_tokenProvider_tokenProvider_mjs.16430abf3466c3153f59.js.map +1 -0
  32. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_core_dist_esm_singleton_Amplify_mjs.3c0035b95fe369aede82.js +2345 -0
  33. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_core_dist_esm_singleton_Amplify_mjs.3c0035b95fe369aede82.js.map +1 -0
  34. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_core_dist_esm_singleton_apis_fetchAuthSession_mjs-node_modul-758875.dc495fd682071d97070c.js +7498 -0
  35. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_core_dist_esm_singleton_apis_fetchAuthSession_mjs-node_modul-758875.dc495fd682071d97070c.js.map +1 -0
  36. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_dist_esm_index_mjs.6bac1a8c4cc93f15f6b7.js +1021 -0
  37. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_dist_esm_index_mjs.6bac1a8c4cc93f15f6b7.js.map +1 -0
  38. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_ui-react_dist_esm_index_mjs.61289bff0db44828605b.js +60178 -0
  39. mito_ai-0.1.41.data/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_aws-amplify_ui-react_dist_esm_index_mjs.61289bff0db44828605b.js.map +1 -0
  40. {mito_ai-0.1.39.dist-info → mito_ai-0.1.41.dist-info}/METADATA +1 -1
  41. {mito_ai-0.1.39.dist-info → mito_ai-0.1.41.dist-info}/RECORD +53 -36
  42. mito_ai-0.1.39.data/data/share/jupyter/labextensions/mito_ai/static/lib_index_js.16b532b655cd2906e04a.js.map +0 -1
  43. mito_ai-0.1.39.data/data/share/jupyter/labextensions/mito_ai/static/remoteEntry.606207904e6aaa42b1bf.js.map +0 -1
  44. {mito_ai-0.1.39.data → mito_ai-0.1.41.data}/data/etc/jupyter/jupyter_server_config.d/mito_ai.json +0 -0
  45. {mito_ai-0.1.39.data → mito_ai-0.1.41.data}/data/share/jupyter/labextensions/mito_ai/schemas/mito_ai/toolbar-buttons.json +0 -0
  46. {mito_ai-0.1.39.data → mito_ai-0.1.41.data}/data/share/jupyter/labextensions/mito_ai/static/style.js +0 -0
  47. {mito_ai-0.1.39.data → mito_ai-0.1.41.data}/data/share/jupyter/labextensions/mito_ai/static/style_index_js.5876024bb17dbd6a3ee6.js +0 -0
  48. {mito_ai-0.1.39.data → mito_ai-0.1.41.data}/data/share/jupyter/labextensions/mito_ai/static/style_index_js.5876024bb17dbd6a3ee6.js.map +0 -0
  49. {mito_ai-0.1.39.data → mito_ai-0.1.41.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_semver_index_js.9795f79265ddb416864b.js +0 -0
  50. {mito_ai-0.1.39.data → mito_ai-0.1.41.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_semver_index_js.9795f79265ddb416864b.js.map +0 -0
  51. {mito_ai-0.1.39.data → mito_ai-0.1.41.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_vscode-diff_dist_index_js.ea55f1f9346638aafbcf.js +0 -0
  52. {mito_ai-0.1.39.data → mito_ai-0.1.41.data}/data/share/jupyter/labextensions/mito_ai/static/vendors-node_modules_vscode-diff_dist_index_js.ea55f1f9346638aafbcf.js.map +0 -0
  53. {mito_ai-0.1.39.dist-info → mito_ai-0.1.41.dist-info}/WHEEL +0 -0
  54. {mito_ai-0.1.39.dist-info → mito_ai-0.1.41.dist-info}/entry_points.txt +0 -0
  55. {mito_ai-0.1.39.dist-info → mito_ai-0.1.41.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,1021 @@
1
+ "use strict";
2
+ (self["webpackChunkmito_ai"] = self["webpackChunkmito_ai"] || []).push([["vendors-node_modules_aws-amplify_dist_esm_index_mjs"],{
3
+
4
+ /***/ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/IdentityIdProvider.mjs":
5
+ /*!**************************************************************************************************************!*\
6
+ !*** ./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/IdentityIdProvider.mjs ***!
7
+ \**************************************************************************************************************/
8
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9
+
10
+ __webpack_require__.r(__webpack_exports__);
11
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
12
+ /* harmony export */ cognitoIdentityIdProvider: () => (/* binding */ cognitoIdentityIdProvider)
13
+ /* harmony export */ });
14
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aws-amplify/core */ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.mjs");
15
+ /* harmony import */ var _errors_AuthError_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../errors/AuthError.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/errors/AuthError.mjs");
16
+ /* harmony import */ var _errors_utils_assertServiceError_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../errors/utils/assertServiceError.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/errors/utils/assertServiceError.mjs");
17
+ /* harmony import */ var _foundation_parsers_regionParsers_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../foundation/parsers/regionParsers.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/foundation/parsers/regionParsers.mjs");
18
+ /* harmony import */ var _factories_createCognitoIdentityPoolEndpointResolver_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../factories/createCognitoIdentityPoolEndpointResolver.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.mjs");
19
+ /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/utils.mjs");
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
30
+ // SPDX-License-Identifier: Apache-2.0
31
+ /**
32
+ * Provides a Cognito identityId
33
+ *
34
+ * @param tokens - The AuthTokens received after SignIn
35
+ * @returns string
36
+ * @throws configuration exceptions: `InvalidIdentityPoolIdException`
37
+ * - Auth errors that may arise from misconfiguration.
38
+ * @throws service exceptions: {@link GetIdException }
39
+ */
40
+ async function cognitoIdentityIdProvider({ tokens, authConfig, identityIdStore, }) {
41
+ identityIdStore.setAuthConfig({ Cognito: authConfig });
42
+ // will return null only if there is no identityId cached or if there is an error retrieving it
43
+ const identityId = await identityIdStore.loadIdentityId();
44
+ if (identityId) {
45
+ return identityId.id;
46
+ }
47
+ const logins = tokens?.idToken
48
+ ? (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_0__.formLoginsMap)(tokens.idToken.toString())
49
+ : {};
50
+ const generatedIdentityId = await generateIdentityId(logins, authConfig);
51
+ // Store generated identityId
52
+ identityIdStore.storeIdentityId({
53
+ id: generatedIdentityId,
54
+ type: tokens ? 'primary' : 'guest',
55
+ });
56
+ return generatedIdentityId;
57
+ }
58
+ async function generateIdentityId(logins, authConfig) {
59
+ const identityPoolId = authConfig?.identityPoolId;
60
+ const region = (0,_foundation_parsers_regionParsers_mjs__WEBPACK_IMPORTED_MODULE_1__.getRegionFromIdentityPoolId)(identityPoolId);
61
+ const getId = (0,_aws_amplify_core__WEBPACK_IMPORTED_MODULE_2__.createGetIdClient)({
62
+ endpointResolver: (0,_factories_createCognitoIdentityPoolEndpointResolver_mjs__WEBPACK_IMPORTED_MODULE_3__.createCognitoIdentityPoolEndpointResolver)({
63
+ endpointOverride: authConfig.identityPoolEndpoint,
64
+ }),
65
+ });
66
+ // IdentityId is absent so get it using IdentityPoolId with Cognito's GetId API
67
+ let idResult;
68
+ // for a first-time user, this will return a brand new identity
69
+ // for a returning user, this will retrieve the previous identity assocaited with the logins
70
+ try {
71
+ idResult = (await getId({
72
+ region,
73
+ }, {
74
+ IdentityPoolId: identityPoolId,
75
+ Logins: logins,
76
+ })).IdentityId;
77
+ }
78
+ catch (e) {
79
+ (0,_errors_utils_assertServiceError_mjs__WEBPACK_IMPORTED_MODULE_4__.assertServiceError)(e);
80
+ throw new _errors_AuthError_mjs__WEBPACK_IMPORTED_MODULE_5__.AuthError(e);
81
+ }
82
+ if (!idResult) {
83
+ throw new _errors_AuthError_mjs__WEBPACK_IMPORTED_MODULE_5__.AuthError({
84
+ name: 'GetIdResponseException',
85
+ message: 'Received undefined response from getId operation',
86
+ recoverySuggestion: 'Make sure to pass a valid identityPoolId in the configuration.',
87
+ });
88
+ }
89
+ return idResult;
90
+ }
91
+
92
+
93
+ //# sourceMappingURL=IdentityIdProvider.mjs.map
94
+
95
+
96
+ /***/ }),
97
+
98
+ /***/ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/IdentityIdStore.mjs":
99
+ /*!***********************************************************************************************************!*\
100
+ !*** ./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/IdentityIdStore.mjs ***!
101
+ \***********************************************************************************************************/
102
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
103
+
104
+ __webpack_require__.r(__webpack_exports__);
105
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
106
+ /* harmony export */ DefaultIdentityIdStore: () => (/* binding */ DefaultIdentityIdStore)
107
+ /* harmony export */ });
108
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "./node_modules/@aws-amplify/core/dist/esm/Logger/ConsoleLogger.mjs");
109
+ /* harmony import */ var _aws_amplify_core_internals_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core/internals/utils */ "./node_modules/@aws-amplify/core/dist/esm/singleton/Auth/utils/index.mjs");
110
+ /* harmony import */ var _tokenProvider_TokenStore_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../tokenProvider/TokenStore.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/tokenProvider/TokenStore.mjs");
111
+ /* harmony import */ var _types_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./types.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/types.mjs");
112
+
113
+
114
+
115
+
116
+
117
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
118
+ // SPDX-License-Identifier: Apache-2.0
119
+ const logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__.ConsoleLogger('DefaultIdentityIdStore');
120
+ class DefaultIdentityIdStore {
121
+ setAuthConfig(authConfigParam) {
122
+ (0,_aws_amplify_core_internals_utils__WEBPACK_IMPORTED_MODULE_1__.assertIdentityPoolIdConfig)(authConfigParam.Cognito);
123
+ this.authConfig = authConfigParam;
124
+ this._authKeys = createKeysForAuthStorage('Cognito', authConfigParam.Cognito.identityPoolId);
125
+ }
126
+ constructor(keyValueStorage) {
127
+ this._authKeys = {};
128
+ this._hasGuestIdentityId = false;
129
+ this.keyValueStorage = keyValueStorage;
130
+ }
131
+ async loadIdentityId() {
132
+ (0,_aws_amplify_core_internals_utils__WEBPACK_IMPORTED_MODULE_1__.assertIdentityPoolIdConfig)(this.authConfig?.Cognito);
133
+ try {
134
+ if (this._primaryIdentityId) {
135
+ return {
136
+ id: this._primaryIdentityId,
137
+ type: 'primary',
138
+ };
139
+ }
140
+ else {
141
+ const storedIdentityId = await this.keyValueStorage.getItem(this._authKeys.identityId);
142
+ if (storedIdentityId) {
143
+ this._hasGuestIdentityId = true;
144
+ return {
145
+ id: storedIdentityId,
146
+ type: 'guest',
147
+ };
148
+ }
149
+ return null;
150
+ }
151
+ }
152
+ catch (err) {
153
+ logger.log('Error getting stored IdentityId.', err);
154
+ return null;
155
+ }
156
+ }
157
+ async storeIdentityId(identity) {
158
+ (0,_aws_amplify_core_internals_utils__WEBPACK_IMPORTED_MODULE_1__.assertIdentityPoolIdConfig)(this.authConfig?.Cognito);
159
+ if (identity.type === 'guest') {
160
+ this.keyValueStorage.setItem(this._authKeys.identityId, identity.id);
161
+ // Clear in-memory storage of primary identityId
162
+ this._primaryIdentityId = undefined;
163
+ this._hasGuestIdentityId = true;
164
+ }
165
+ else {
166
+ this._primaryIdentityId = identity.id;
167
+ // Clear locally stored guest id
168
+ if (this._hasGuestIdentityId) {
169
+ this.keyValueStorage.removeItem(this._authKeys.identityId);
170
+ this._hasGuestIdentityId = false;
171
+ }
172
+ }
173
+ }
174
+ async clearIdentityId() {
175
+ this._primaryIdentityId = undefined;
176
+ await this.keyValueStorage.removeItem(this._authKeys.identityId);
177
+ }
178
+ }
179
+ const createKeysForAuthStorage = (provider, identifier) => {
180
+ return (0,_tokenProvider_TokenStore_mjs__WEBPACK_IMPORTED_MODULE_2__.getAuthStorageKeys)(_types_mjs__WEBPACK_IMPORTED_MODULE_3__.IdentityIdStorageKeys)(`com.amplify.${provider}`, identifier);
181
+ };
182
+
183
+
184
+ //# sourceMappingURL=IdentityIdStore.mjs.map
185
+
186
+
187
+ /***/ }),
188
+
189
+ /***/ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/credentialsProvider.mjs":
190
+ /*!***************************************************************************************************************!*\
191
+ !*** ./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/credentialsProvider.mjs ***!
192
+ \***************************************************************************************************************/
193
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
194
+
195
+ __webpack_require__.r(__webpack_exports__);
196
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
197
+ /* harmony export */ CognitoAWSCredentialsAndIdentityIdProvider: () => (/* binding */ CognitoAWSCredentialsAndIdentityIdProvider)
198
+ /* harmony export */ });
199
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "./node_modules/@aws-amplify/core/dist/esm/Logger/ConsoleLogger.mjs");
200
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @aws-amplify/core */ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.mjs");
201
+ /* harmony import */ var _aws_amplify_core_internals_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core/internals/utils */ "./node_modules/@aws-amplify/core/dist/esm/singleton/Auth/utils/index.mjs");
202
+ /* harmony import */ var _errors_AuthError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../errors/AuthError.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/errors/AuthError.mjs");
203
+ /* harmony import */ var _errors_utils_assertServiceError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../errors/utils/assertServiceError.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/errors/utils/assertServiceError.mjs");
204
+ /* harmony import */ var _foundation_parsers_regionParsers_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../foundation/parsers/regionParsers.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/foundation/parsers/regionParsers.mjs");
205
+ /* harmony import */ var _utils_types_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/types.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/utils/types.mjs");
206
+ /* harmony import */ var _factories_createCognitoIdentityPoolEndpointResolver_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../factories/createCognitoIdentityPoolEndpointResolver.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.mjs");
207
+ /* harmony import */ var _IdentityIdProvider_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./IdentityIdProvider.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/IdentityIdProvider.mjs");
208
+ /* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/utils.mjs");
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
221
+ // SPDX-License-Identifier: Apache-2.0
222
+ const logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__.ConsoleLogger('CognitoCredentialsProvider');
223
+ const CREDENTIALS_TTL = 50 * 60 * 1000; // 50 min, can be modified on config if required in the future
224
+ class CognitoAWSCredentialsAndIdentityIdProvider {
225
+ constructor(identityIdStore) {
226
+ this._nextCredentialsRefresh = 0;
227
+ this._identityIdStore = identityIdStore;
228
+ }
229
+ async clearCredentialsAndIdentityId() {
230
+ logger.debug('Clearing out credentials and identityId');
231
+ this._credentialsAndIdentityId = undefined;
232
+ await this._identityIdStore.clearIdentityId();
233
+ }
234
+ async clearCredentials() {
235
+ logger.debug('Clearing out in-memory credentials');
236
+ this._credentialsAndIdentityId = undefined;
237
+ }
238
+ async getCredentialsAndIdentityId(getCredentialsOptions) {
239
+ const isAuthenticated = getCredentialsOptions.authenticated;
240
+ const { tokens } = getCredentialsOptions;
241
+ const { authConfig } = getCredentialsOptions;
242
+ try {
243
+ (0,_aws_amplify_core_internals_utils__WEBPACK_IMPORTED_MODULE_1__.assertIdentityPoolIdConfig)(authConfig?.Cognito);
244
+ }
245
+ catch {
246
+ // No identity pool configured, skipping
247
+ return;
248
+ }
249
+ if (!isAuthenticated && !authConfig.Cognito.allowGuestAccess) {
250
+ // TODO(V6): return partial result like Native platforms
251
+ return;
252
+ }
253
+ const { forceRefresh } = getCredentialsOptions;
254
+ const tokenHasChanged = this.hasTokenChanged(tokens);
255
+ const identityId = await (0,_IdentityIdProvider_mjs__WEBPACK_IMPORTED_MODULE_2__.cognitoIdentityIdProvider)({
256
+ tokens,
257
+ authConfig: authConfig.Cognito,
258
+ identityIdStore: this._identityIdStore,
259
+ });
260
+ // Clear cached credentials when forceRefresh is true OR the cache token has changed
261
+ if (forceRefresh || tokenHasChanged) {
262
+ this.clearCredentials();
263
+ }
264
+ if (!isAuthenticated) {
265
+ return this.getGuestCredentials(identityId, authConfig.Cognito);
266
+ }
267
+ else {
268
+ (0,_utils_types_mjs__WEBPACK_IMPORTED_MODULE_3__.assertIdTokenInAuthTokens)(tokens);
269
+ return this.credsForOIDCTokens(authConfig.Cognito, tokens, identityId);
270
+ }
271
+ }
272
+ async getGuestCredentials(identityId, authConfig) {
273
+ // Return existing in-memory cached credentials only if it exists, is not past it's lifetime and is unauthenticated credentials
274
+ if (this._credentialsAndIdentityId &&
275
+ !this.isPastTTL() &&
276
+ this._credentialsAndIdentityId.isAuthenticatedCreds === false) {
277
+ logger.info('returning stored credentials as they neither past TTL nor expired.');
278
+ return this._credentialsAndIdentityId;
279
+ }
280
+ // Clear to discard if any authenticated credentials are set and start with a clean slate
281
+ this.clearCredentials();
282
+ const region = (0,_foundation_parsers_regionParsers_mjs__WEBPACK_IMPORTED_MODULE_4__.getRegionFromIdentityPoolId)(authConfig.identityPoolId);
283
+ const getCredentialsForIdentity = (0,_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__.createGetCredentialsForIdentityClient)({
284
+ endpointResolver: (0,_factories_createCognitoIdentityPoolEndpointResolver_mjs__WEBPACK_IMPORTED_MODULE_6__.createCognitoIdentityPoolEndpointResolver)({
285
+ endpointOverride: authConfig.identityPoolEndpoint,
286
+ }),
287
+ });
288
+ // use identityId to obtain guest credentials
289
+ // save credentials in-memory
290
+ // No logins params should be passed for guest creds:
291
+ // https://docs.aws.amazon.com/cognitoidentity/latest/APIReference/API_GetCredentialsForIdentity.html
292
+ let clientResult;
293
+ try {
294
+ clientResult = await getCredentialsForIdentity({ region }, {
295
+ IdentityId: identityId,
296
+ });
297
+ }
298
+ catch (e) {
299
+ (0,_errors_utils_assertServiceError_mjs__WEBPACK_IMPORTED_MODULE_7__.assertServiceError)(e);
300
+ throw new _errors_AuthError_mjs__WEBPACK_IMPORTED_MODULE_8__.AuthError(e);
301
+ }
302
+ if (clientResult?.Credentials?.AccessKeyId &&
303
+ clientResult?.Credentials?.SecretKey) {
304
+ this._nextCredentialsRefresh = new Date().getTime() + CREDENTIALS_TTL;
305
+ const res = {
306
+ credentials: {
307
+ accessKeyId: clientResult.Credentials.AccessKeyId,
308
+ secretAccessKey: clientResult.Credentials.SecretKey,
309
+ sessionToken: clientResult.Credentials.SessionToken,
310
+ expiration: clientResult.Credentials.Expiration,
311
+ },
312
+ identityId,
313
+ };
314
+ if (clientResult.IdentityId) {
315
+ res.identityId = clientResult.IdentityId;
316
+ this._identityIdStore.storeIdentityId({
317
+ id: clientResult.IdentityId,
318
+ type: 'guest',
319
+ });
320
+ }
321
+ this._credentialsAndIdentityId = {
322
+ ...res,
323
+ isAuthenticatedCreds: false,
324
+ };
325
+ return res;
326
+ }
327
+ else {
328
+ throw new _errors_AuthError_mjs__WEBPACK_IMPORTED_MODULE_8__.AuthError({
329
+ name: 'CredentialsNotFoundException',
330
+ message: `Cognito did not respond with either Credentials, AccessKeyId or SecretKey.`,
331
+ });
332
+ }
333
+ }
334
+ async credsForOIDCTokens(authConfig, authTokens, identityId) {
335
+ if (this._credentialsAndIdentityId &&
336
+ !this.isPastTTL() &&
337
+ this._credentialsAndIdentityId.isAuthenticatedCreds === true) {
338
+ logger.debug('returning stored credentials as they neither past TTL nor expired.');
339
+ return this._credentialsAndIdentityId;
340
+ }
341
+ // Clear to discard if any unauthenticated credentials are set and start with a clean slate
342
+ this.clearCredentials();
343
+ const logins = authTokens.idToken
344
+ ? (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_9__.formLoginsMap)(authTokens.idToken.toString())
345
+ : {};
346
+ const region = (0,_foundation_parsers_regionParsers_mjs__WEBPACK_IMPORTED_MODULE_4__.getRegionFromIdentityPoolId)(authConfig.identityPoolId);
347
+ const getCredentialsForIdentity = (0,_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__.createGetCredentialsForIdentityClient)({
348
+ endpointResolver: (0,_factories_createCognitoIdentityPoolEndpointResolver_mjs__WEBPACK_IMPORTED_MODULE_6__.createCognitoIdentityPoolEndpointResolver)({
349
+ endpointOverride: authConfig.identityPoolEndpoint,
350
+ }),
351
+ });
352
+ let clientResult;
353
+ try {
354
+ clientResult = await getCredentialsForIdentity({ region }, {
355
+ IdentityId: identityId,
356
+ Logins: logins,
357
+ });
358
+ }
359
+ catch (e) {
360
+ (0,_errors_utils_assertServiceError_mjs__WEBPACK_IMPORTED_MODULE_7__.assertServiceError)(e);
361
+ throw new _errors_AuthError_mjs__WEBPACK_IMPORTED_MODULE_8__.AuthError(e);
362
+ }
363
+ if (clientResult?.Credentials?.AccessKeyId &&
364
+ clientResult?.Credentials?.SecretKey) {
365
+ this._nextCredentialsRefresh = new Date().getTime() + CREDENTIALS_TTL;
366
+ const res = {
367
+ credentials: {
368
+ accessKeyId: clientResult.Credentials.AccessKeyId,
369
+ secretAccessKey: clientResult.Credentials.SecretKey,
370
+ sessionToken: clientResult.Credentials.SessionToken,
371
+ expiration: clientResult.Credentials.Expiration,
372
+ },
373
+ identityId,
374
+ };
375
+ if (clientResult.IdentityId) {
376
+ res.identityId = clientResult.IdentityId;
377
+ // note: the following call removes guest identityId from the persistent store (localStorage)
378
+ this._identityIdStore.storeIdentityId({
379
+ id: clientResult.IdentityId,
380
+ type: 'primary',
381
+ });
382
+ }
383
+ // Store the credentials in-memory along with the expiration
384
+ this._credentialsAndIdentityId = {
385
+ ...res,
386
+ isAuthenticatedCreds: true,
387
+ associatedIdToken: authTokens.idToken?.toString(),
388
+ };
389
+ return res;
390
+ }
391
+ else {
392
+ throw new _errors_AuthError_mjs__WEBPACK_IMPORTED_MODULE_8__.AuthError({
393
+ name: 'CredentialsException',
394
+ message: `Cognito did not respond with either Credentials, AccessKeyId or SecretKey.`,
395
+ });
396
+ }
397
+ }
398
+ isPastTTL() {
399
+ return this._nextCredentialsRefresh === undefined
400
+ ? true
401
+ : this._nextCredentialsRefresh <= Date.now();
402
+ }
403
+ hasTokenChanged(tokens) {
404
+ return (!!tokens &&
405
+ !!this._credentialsAndIdentityId?.associatedIdToken &&
406
+ tokens.idToken?.toString() !==
407
+ this._credentialsAndIdentityId.associatedIdToken);
408
+ }
409
+ }
410
+
411
+
412
+ //# sourceMappingURL=credentialsProvider.mjs.map
413
+
414
+
415
+ /***/ }),
416
+
417
+ /***/ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/index.mjs":
418
+ /*!*************************************************************************************************!*\
419
+ !*** ./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/index.mjs ***!
420
+ \*************************************************************************************************/
421
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
422
+
423
+ __webpack_require__.r(__webpack_exports__);
424
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
425
+ /* harmony export */ CognitoAWSCredentialsAndIdentityIdProvider: () => (/* reexport safe */ _credentialsProvider_mjs__WEBPACK_IMPORTED_MODULE_0__.CognitoAWSCredentialsAndIdentityIdProvider),
426
+ /* harmony export */ DefaultIdentityIdStore: () => (/* reexport safe */ _IdentityIdStore_mjs__WEBPACK_IMPORTED_MODULE_1__.DefaultIdentityIdStore),
427
+ /* harmony export */ cognitoCredentialsProvider: () => (/* binding */ cognitoCredentialsProvider)
428
+ /* harmony export */ });
429
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aws-amplify/core */ "./node_modules/@aws-amplify/core/dist/esm/storage/index.mjs");
430
+ /* harmony import */ var _IdentityIdStore_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./IdentityIdStore.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/IdentityIdStore.mjs");
431
+ /* harmony import */ var _credentialsProvider_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credentialsProvider.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/credentialsProvider.mjs");
432
+
433
+
434
+
435
+
436
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
437
+ // SPDX-License-Identifier: Apache-2.0
438
+ /**
439
+ * Cognito specific implmentation of the CredentialsProvider interface
440
+ * that manages setting and getting of AWS Credentials.
441
+ *
442
+ * @throws configuration expections: `InvalidIdentityPoolIdException`
443
+ * - Auth errors that may arise from misconfiguration.
444
+ * @throws service expections: {@link GetCredentialsForIdentityException}, {@link GetIdException}
445
+ *
446
+ */
447
+ const cognitoCredentialsProvider = new _credentialsProvider_mjs__WEBPACK_IMPORTED_MODULE_0__.CognitoAWSCredentialsAndIdentityIdProvider(new _IdentityIdStore_mjs__WEBPACK_IMPORTED_MODULE_1__.DefaultIdentityIdStore(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_2__.defaultStorage));
448
+
449
+
450
+ //# sourceMappingURL=index.mjs.map
451
+
452
+
453
+ /***/ }),
454
+
455
+ /***/ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/types.mjs":
456
+ /*!*************************************************************************************************!*\
457
+ !*** ./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/types.mjs ***!
458
+ \*************************************************************************************************/
459
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
460
+
461
+ __webpack_require__.r(__webpack_exports__);
462
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
463
+ /* harmony export */ IdentityIdStorageKeys: () => (/* binding */ IdentityIdStorageKeys)
464
+ /* harmony export */ });
465
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
466
+ // SPDX-License-Identifier: Apache-2.0
467
+ const IdentityIdStorageKeys = {
468
+ identityId: 'identityId',
469
+ };
470
+
471
+
472
+ //# sourceMappingURL=types.mjs.map
473
+
474
+
475
+ /***/ }),
476
+
477
+ /***/ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/utils.mjs":
478
+ /*!*************************************************************************************************!*\
479
+ !*** ./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/utils.mjs ***!
480
+ \*************************************************************************************************/
481
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
482
+
483
+ __webpack_require__.r(__webpack_exports__);
484
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
485
+ /* harmony export */ formLoginsMap: () => (/* binding */ formLoginsMap)
486
+ /* harmony export */ });
487
+ /* harmony import */ var _aws_amplify_core_internals_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core/internals/utils */ "./node_modules/@aws-amplify/core/dist/esm/singleton/Auth/utils/index.mjs");
488
+ /* harmony import */ var _errors_AuthError_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../errors/AuthError.mjs */ "./node_modules/@aws-amplify/auth/dist/esm/errors/AuthError.mjs");
489
+
490
+
491
+
492
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
493
+ // SPDX-License-Identifier: Apache-2.0
494
+ function formLoginsMap(idToken) {
495
+ const issuer = (0,_aws_amplify_core_internals_utils__WEBPACK_IMPORTED_MODULE_0__.decodeJWT)(idToken).payload.iss;
496
+ const res = {};
497
+ if (!issuer) {
498
+ throw new _errors_AuthError_mjs__WEBPACK_IMPORTED_MODULE_1__.AuthError({
499
+ name: 'InvalidIdTokenException',
500
+ message: 'Invalid Idtoken.',
501
+ });
502
+ }
503
+ const domainName = issuer.replace(/(^\w+:|^)\/\//, '');
504
+ res[domainName] = idToken;
505
+ return res;
506
+ }
507
+
508
+
509
+ //# sourceMappingURL=utils.mjs.map
510
+
511
+
512
+ /***/ }),
513
+
514
+ /***/ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.mjs":
515
+ /*!***************************************************************************************************************************!*\
516
+ !*** ./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.mjs ***!
517
+ \***************************************************************************************************************************/
518
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
519
+
520
+ __webpack_require__.r(__webpack_exports__);
521
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
522
+ /* harmony export */ createCognitoIdentityPoolEndpointResolver: () => (/* binding */ createCognitoIdentityPoolEndpointResolver)
523
+ /* harmony export */ });
524
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core */ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.mjs");
525
+ /* harmony import */ var _aws_amplify_core_internals_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core/internals/utils */ "./node_modules/@aws-amplify/core/dist/esm/utils/amplifyUrl/index.mjs");
526
+
527
+
528
+
529
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
530
+ // SPDX-License-Identifier: Apache-2.0
531
+ const createCognitoIdentityPoolEndpointResolver = ({ endpointOverride }) => (input) => {
532
+ if (endpointOverride) {
533
+ return { url: new _aws_amplify_core_internals_utils__WEBPACK_IMPORTED_MODULE_0__.AmplifyUrl(endpointOverride) };
534
+ }
535
+ return (0,_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__.cognitoIdentityPoolEndpointResolver)(input);
536
+ };
537
+
538
+
539
+ //# sourceMappingURL=createCognitoIdentityPoolEndpointResolver.mjs.map
540
+
541
+
542
+ /***/ }),
543
+
544
+ /***/ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/middleware/createDisableCacheMiddleware.mjs":
545
+ /*!******************************************************************************************************************!*\
546
+ !*** ./node_modules/@aws-amplify/core/dist/esm/foundation/factories/middleware/createDisableCacheMiddleware.mjs ***!
547
+ \******************************************************************************************************************/
548
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
549
+
550
+ __webpack_require__.r(__webpack_exports__);
551
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
552
+ /* harmony export */ createDisableCacheMiddleware: () => (/* binding */ createDisableCacheMiddleware)
553
+ /* harmony export */ });
554
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
555
+ // SPDX-License-Identifier: Apache-2.0
556
+ /**
557
+ * A Cognito Identity-specific middleware that disables caching for all requests.
558
+ */
559
+ const createDisableCacheMiddleware = () => next => async function disableCacheMiddleware(request) {
560
+ request.headers['cache-control'] = 'no-store';
561
+ return next(request);
562
+ };
563
+
564
+
565
+ //# sourceMappingURL=createDisableCacheMiddleware.mjs.map
566
+
567
+
568
+ /***/ }),
569
+
570
+ /***/ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.mjs":
571
+ /*!*********************************************************************************************************************************************!*\
572
+ !*** ./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.mjs ***!
573
+ \*********************************************************************************************************************************************/
574
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
575
+
576
+ __webpack_require__.r(__webpack_exports__);
577
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
578
+ /* harmony export */ cognitoIdentityPoolEndpointResolver: () => (/* binding */ cognitoIdentityPoolEndpointResolver)
579
+ /* harmony export */ });
580
+ /* harmony import */ var _clients_endpoints_getDnsSuffix_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../clients/endpoints/getDnsSuffix.mjs */ "./node_modules/@aws-amplify/core/dist/esm/clients/endpoints/getDnsSuffix.mjs");
581
+ /* harmony import */ var _utils_amplifyUrl_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../utils/amplifyUrl/index.mjs */ "./node_modules/@aws-amplify/core/dist/esm/utils/amplifyUrl/index.mjs");
582
+ /* harmony import */ var _aws_crypto_sha256_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-crypto/sha256-js */ "./node_modules/@aws-crypto/sha256-js/build/module/index.js");
583
+ /* harmony import */ var _smithy_util_hex_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @smithy/util-hex-encoding */ "./node_modules/@aws-amplify/core/node_modules/@smithy/util-hex-encoding/dist-es/index.js");
584
+ /* harmony import */ var _constants_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants.mjs */ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/constants.mjs");
585
+
586
+
587
+
588
+
589
+
590
+
591
+
592
+
593
+
594
+
595
+
596
+
597
+
598
+
599
+
600
+
601
+
602
+
603
+
604
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
605
+ // SPDX-License-Identifier: Apache-2.0
606
+ const cognitoIdentityPoolEndpointResolver = ({ region, }) => ({
607
+ url: new _utils_amplifyUrl_index_mjs__WEBPACK_IMPORTED_MODULE_2__.AmplifyUrl(`https://${_constants_mjs__WEBPACK_IMPORTED_MODULE_3__.COGNITO_IDENTITY_SERVICE_NAME}.${region}.${(0,_clients_endpoints_getDnsSuffix_mjs__WEBPACK_IMPORTED_MODULE_4__.getDnsSuffix)(region)}`),
608
+ });
609
+
610
+
611
+ //# sourceMappingURL=cognitoIdentityPoolEndpointResolver.mjs.map
612
+
613
+
614
+ /***/ }),
615
+
616
+ /***/ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/constants.mjs":
617
+ /*!*******************************************************************************************************************!*\
618
+ !*** ./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/constants.mjs ***!
619
+ \*******************************************************************************************************************/
620
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
621
+
622
+ __webpack_require__.r(__webpack_exports__);
623
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
624
+ /* harmony export */ COGNITO_IDENTITY_SERVICE_NAME: () => (/* binding */ COGNITO_IDENTITY_SERVICE_NAME),
625
+ /* harmony export */ DEFAULT_SERVICE_CLIENT_API_CONFIG: () => (/* binding */ DEFAULT_SERVICE_CLIENT_API_CONFIG)
626
+ /* harmony export */ });
627
+ /* harmony import */ var _clients_middleware_retry_jitteredBackoff_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../clients/middleware/retry/jitteredBackoff.mjs */ "./node_modules/@aws-amplify/core/dist/esm/clients/middleware/retry/jitteredBackoff.mjs");
628
+ /* harmony import */ var _clients_middleware_retry_defaultRetryDecider_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../clients/middleware/retry/defaultRetryDecider.mjs */ "./node_modules/@aws-amplify/core/dist/esm/clients/middleware/retry/defaultRetryDecider.mjs");
629
+ /* harmony import */ var _aws_crypto_sha256_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-crypto/sha256-js */ "./node_modules/@aws-crypto/sha256-js/build/module/index.js");
630
+ /* harmony import */ var _smithy_util_hex_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @smithy/util-hex-encoding */ "./node_modules/@aws-amplify/core/node_modules/@smithy/util-hex-encoding/dist-es/index.js");
631
+ /* harmony import */ var _clients_serde_json_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../clients/serde/json.mjs */ "./node_modules/@aws-amplify/core/dist/esm/clients/serde/json.mjs");
632
+
633
+
634
+
635
+
636
+
637
+
638
+
639
+
640
+
641
+
642
+
643
+
644
+
645
+
646
+
647
+
648
+
649
+
650
+
651
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
652
+ // SPDX-License-Identifier: Apache-2.0
653
+ /**
654
+ * The service name used to sign requests if the API requires authentication.
655
+ */
656
+ const COGNITO_IDENTITY_SERVICE_NAME = 'cognito-identity';
657
+ const DEFAULT_SERVICE_CLIENT_API_CONFIG = {
658
+ service: COGNITO_IDENTITY_SERVICE_NAME,
659
+ retryDecider: (0,_clients_middleware_retry_defaultRetryDecider_mjs__WEBPACK_IMPORTED_MODULE_2__.getRetryDecider)(_clients_serde_json_mjs__WEBPACK_IMPORTED_MODULE_3__.parseJsonError),
660
+ computeDelay: _clients_middleware_retry_jitteredBackoff_mjs__WEBPACK_IMPORTED_MODULE_4__.jitteredBackoff,
661
+ cache: 'no-store',
662
+ };
663
+
664
+
665
+ //# sourceMappingURL=constants.mjs.map
666
+
667
+
668
+ /***/ }),
669
+
670
+ /***/ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.mjs":
671
+ /*!***********************************************************************************************************************************************!*\
672
+ !*** ./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.mjs ***!
673
+ \***********************************************************************************************************************************************/
674
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
675
+
676
+ __webpack_require__.r(__webpack_exports__);
677
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
678
+ /* harmony export */ createGetCredentialsForIdentityClient: () => (/* binding */ createGetCredentialsForIdentityClient)
679
+ /* harmony export */ });
680
+ /* harmony import */ var _aws_crypto_sha256_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-crypto/sha256-js */ "./node_modules/@aws-crypto/sha256-js/build/module/index.js");
681
+ /* harmony import */ var _smithy_util_hex_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @smithy/util-hex-encoding */ "./node_modules/@aws-amplify/core/node_modules/@smithy/util-hex-encoding/dist-es/index.js");
682
+ /* harmony import */ var _Platform_index_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Platform/index.mjs */ "./node_modules/@aws-amplify/core/dist/esm/Platform/index.mjs");
683
+ /* harmony import */ var _clients_serde_responseInfo_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../../clients/serde/responseInfo.mjs */ "./node_modules/@aws-amplify/core/dist/esm/clients/serde/responseInfo.mjs");
684
+ /* harmony import */ var _clients_serde_json_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../clients/serde/json.mjs */ "./node_modules/@aws-amplify/core/dist/esm/clients/serde/json.mjs");
685
+ /* harmony import */ var _clients_internal_composeServiceApi_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../clients/internal/composeServiceApi.mjs */ "./node_modules/@aws-amplify/core/dist/esm/clients/internal/composeServiceApi.mjs");
686
+ /* harmony import */ var _constants_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants.mjs */ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/constants.mjs");
687
+ /* harmony import */ var _handler_cognitoIdentityTransferHandler_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./handler/cognitoIdentityTransferHandler.mjs */ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.mjs");
688
+ /* harmony import */ var _serde_createClientSerializer_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./serde/createClientSerializer.mjs */ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.mjs");
689
+
690
+
691
+
692
+
693
+
694
+
695
+
696
+
697
+
698
+
699
+
700
+
701
+
702
+
703
+
704
+
705
+
706
+
707
+
708
+
709
+
710
+
711
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
712
+ // SPDX-License-Identifier: Apache-2.0
713
+ const createGetCredentialsForIdentityClient = (config) => (0,_clients_internal_composeServiceApi_mjs__WEBPACK_IMPORTED_MODULE_2__.composeServiceApi)(_handler_cognitoIdentityTransferHandler_mjs__WEBPACK_IMPORTED_MODULE_3__.cognitoIdentityTransferHandler, (0,_serde_createClientSerializer_mjs__WEBPACK_IMPORTED_MODULE_4__.createClientSerializer)('GetCredentialsForIdentity'), getCredentialsForIdentityDeserializer, {
714
+ ..._constants_mjs__WEBPACK_IMPORTED_MODULE_5__.DEFAULT_SERVICE_CLIENT_API_CONFIG,
715
+ ...config,
716
+ userAgentValue: (0,_Platform_index_mjs__WEBPACK_IMPORTED_MODULE_6__.getAmplifyUserAgent)(),
717
+ });
718
+ const getCredentialsForIdentityDeserializer = async (response) => {
719
+ if (response.statusCode >= 300) {
720
+ const error = await (0,_clients_serde_json_mjs__WEBPACK_IMPORTED_MODULE_7__.parseJsonError)(response);
721
+ throw error;
722
+ }
723
+ const body = await (0,_clients_serde_json_mjs__WEBPACK_IMPORTED_MODULE_7__.parseJsonBody)(response);
724
+ return {
725
+ IdentityId: body.IdentityId,
726
+ Credentials: deserializeCredentials(body.Credentials),
727
+ $metadata: (0,_clients_serde_responseInfo_mjs__WEBPACK_IMPORTED_MODULE_8__.parseMetadata)(response),
728
+ };
729
+ };
730
+ const deserializeCredentials = ({ Expiration, ...rest } = {}) => ({
731
+ ...rest,
732
+ Expiration: Expiration && new Date(Expiration * 1000),
733
+ });
734
+
735
+
736
+ //# sourceMappingURL=createGetCredentialsForIdentityClient.mjs.map
737
+
738
+
739
+ /***/ }),
740
+
741
+ /***/ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.mjs":
742
+ /*!***************************************************************************************************************************!*\
743
+ !*** ./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.mjs ***!
744
+ \***************************************************************************************************************************/
745
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
746
+
747
+ __webpack_require__.r(__webpack_exports__);
748
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
749
+ /* harmony export */ createGetIdClient: () => (/* binding */ createGetIdClient)
750
+ /* harmony export */ });
751
+ /* harmony import */ var _aws_crypto_sha256_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-crypto/sha256-js */ "./node_modules/@aws-crypto/sha256-js/build/module/index.js");
752
+ /* harmony import */ var _smithy_util_hex_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @smithy/util-hex-encoding */ "./node_modules/@aws-amplify/core/node_modules/@smithy/util-hex-encoding/dist-es/index.js");
753
+ /* harmony import */ var _Platform_index_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Platform/index.mjs */ "./node_modules/@aws-amplify/core/dist/esm/Platform/index.mjs");
754
+ /* harmony import */ var _clients_serde_responseInfo_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../../clients/serde/responseInfo.mjs */ "./node_modules/@aws-amplify/core/dist/esm/clients/serde/responseInfo.mjs");
755
+ /* harmony import */ var _clients_serde_json_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../clients/serde/json.mjs */ "./node_modules/@aws-amplify/core/dist/esm/clients/serde/json.mjs");
756
+ /* harmony import */ var _clients_internal_composeServiceApi_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../clients/internal/composeServiceApi.mjs */ "./node_modules/@aws-amplify/core/dist/esm/clients/internal/composeServiceApi.mjs");
757
+ /* harmony import */ var _constants_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants.mjs */ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/constants.mjs");
758
+ /* harmony import */ var _handler_cognitoIdentityTransferHandler_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./handler/cognitoIdentityTransferHandler.mjs */ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.mjs");
759
+ /* harmony import */ var _serde_createClientSerializer_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./serde/createClientSerializer.mjs */ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.mjs");
760
+
761
+
762
+
763
+
764
+
765
+
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+
780
+
781
+
782
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
783
+ // SPDX-License-Identifier: Apache-2.0
784
+ const createGetIdClient = (config) => (0,_clients_internal_composeServiceApi_mjs__WEBPACK_IMPORTED_MODULE_2__.composeServiceApi)(_handler_cognitoIdentityTransferHandler_mjs__WEBPACK_IMPORTED_MODULE_3__.cognitoIdentityTransferHandler, (0,_serde_createClientSerializer_mjs__WEBPACK_IMPORTED_MODULE_4__.createClientSerializer)('GetId'), getIdDeserializer, {
785
+ ..._constants_mjs__WEBPACK_IMPORTED_MODULE_5__.DEFAULT_SERVICE_CLIENT_API_CONFIG,
786
+ ...config,
787
+ userAgentValue: (0,_Platform_index_mjs__WEBPACK_IMPORTED_MODULE_6__.getAmplifyUserAgent)(),
788
+ });
789
+ const getIdDeserializer = async (response) => {
790
+ if (response.statusCode >= 300) {
791
+ const error = await (0,_clients_serde_json_mjs__WEBPACK_IMPORTED_MODULE_7__.parseJsonError)(response);
792
+ throw error;
793
+ }
794
+ const body = await (0,_clients_serde_json_mjs__WEBPACK_IMPORTED_MODULE_7__.parseJsonBody)(response);
795
+ return {
796
+ IdentityId: body.IdentityId,
797
+ $metadata: (0,_clients_serde_responseInfo_mjs__WEBPACK_IMPORTED_MODULE_8__.parseMetadata)(response),
798
+ };
799
+ };
800
+
801
+
802
+ //# sourceMappingURL=createGetIdClient.mjs.map
803
+
804
+
805
+ /***/ }),
806
+
807
+ /***/ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.mjs":
808
+ /*!************************************************************************************************************************************************!*\
809
+ !*** ./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.mjs ***!
810
+ \************************************************************************************************************************************************/
811
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
812
+
813
+ __webpack_require__.r(__webpack_exports__);
814
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
815
+ /* harmony export */ cognitoIdentityTransferHandler: () => (/* binding */ cognitoIdentityTransferHandler)
816
+ /* harmony export */ });
817
+ /* harmony import */ var _clients_handlers_aws_unauthenticated_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../../clients/handlers/aws/unauthenticated.mjs */ "./node_modules/@aws-amplify/core/dist/esm/clients/handlers/aws/unauthenticated.mjs");
818
+ /* harmony import */ var _aws_crypto_sha256_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-crypto/sha256-js */ "./node_modules/@aws-crypto/sha256-js/build/module/index.js");
819
+ /* harmony import */ var _smithy_util_hex_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @smithy/util-hex-encoding */ "./node_modules/@aws-amplify/core/node_modules/@smithy/util-hex-encoding/dist-es/index.js");
820
+ /* harmony import */ var _clients_internal_composeTransferHandler_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../../clients/internal/composeTransferHandler.mjs */ "./node_modules/@aws-amplify/core/dist/esm/clients/internal/composeTransferHandler.mjs");
821
+ /* harmony import */ var _middleware_createDisableCacheMiddleware_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../middleware/createDisableCacheMiddleware.mjs */ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/middleware/createDisableCacheMiddleware.mjs");
822
+
823
+
824
+
825
+
826
+
827
+
828
+
829
+
830
+
831
+
832
+
833
+
834
+
835
+
836
+
837
+
838
+
839
+
840
+
841
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
842
+ // SPDX-License-Identifier: Apache-2.0
843
+ /**
844
+ * A Cognito Identity-specific transfer handler that does NOT sign requests, and
845
+ * disables caching.
846
+ *
847
+ * @internal
848
+ */
849
+ const cognitoIdentityTransferHandler = (0,_clients_internal_composeTransferHandler_mjs__WEBPACK_IMPORTED_MODULE_2__.composeTransferHandler)(_clients_handlers_aws_unauthenticated_mjs__WEBPACK_IMPORTED_MODULE_3__.unauthenticatedHandler, [_middleware_createDisableCacheMiddleware_mjs__WEBPACK_IMPORTED_MODULE_4__.createDisableCacheMiddleware]);
850
+
851
+
852
+ //# sourceMappingURL=cognitoIdentityTransferHandler.mjs.map
853
+
854
+
855
+ /***/ }),
856
+
857
+ /***/ "./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.mjs":
858
+ /*!**************************************************************************************************************************************!*\
859
+ !*** ./node_modules/@aws-amplify/core/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.mjs ***!
860
+ \**************************************************************************************************************************************/
861
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
862
+
863
+ __webpack_require__.r(__webpack_exports__);
864
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
865
+ /* harmony export */ buildHttpRpcRequest: () => (/* binding */ buildHttpRpcRequest),
866
+ /* harmony export */ createClientSerializer: () => (/* binding */ createClientSerializer)
867
+ /* harmony export */ });
868
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
869
+ // SPDX-License-Identifier: Apache-2.0
870
+ const createClientSerializer = (operation) => (input, endpoint) => {
871
+ const headers = getSharedHeaders(operation);
872
+ const body = JSON.stringify(input);
873
+ return buildHttpRpcRequest(endpoint, headers, body);
874
+ };
875
+ const getSharedHeaders = (operation) => ({
876
+ 'content-type': 'application/x-amz-json-1.1',
877
+ 'x-amz-target': `AWSCognitoIdentityService.${operation}`,
878
+ });
879
+ const buildHttpRpcRequest = ({ url }, headers, body) => ({
880
+ headers,
881
+ url,
882
+ body,
883
+ method: 'POST',
884
+ });
885
+
886
+
887
+ //# sourceMappingURL=createClientSerializer.mjs.map
888
+
889
+
890
+ /***/ }),
891
+
892
+ /***/ "./node_modules/aws-amplify/dist/esm/index.mjs":
893
+ /*!*****************************************************!*\
894
+ !*** ./node_modules/aws-amplify/dist/esm/index.mjs ***!
895
+ \*****************************************************/
896
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
897
+
898
+ __webpack_require__.r(__webpack_exports__);
899
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
900
+ /* harmony export */ Amplify: () => (/* reexport safe */ _initSingleton_mjs__WEBPACK_IMPORTED_MODULE_0__.DefaultAmplify)
901
+ /* harmony export */ });
902
+ /* harmony import */ var _initSingleton_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./initSingleton.mjs */ "./node_modules/aws-amplify/dist/esm/initSingleton.mjs");
903
+
904
+ //# sourceMappingURL=index.mjs.map
905
+
906
+
907
+ /***/ }),
908
+
909
+ /***/ "./node_modules/aws-amplify/dist/esm/initSingleton.mjs":
910
+ /*!*************************************************************!*\
911
+ !*** ./node_modules/aws-amplify/dist/esm/initSingleton.mjs ***!
912
+ \*************************************************************/
913
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
914
+
915
+ __webpack_require__.r(__webpack_exports__);
916
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
917
+ /* harmony export */ DefaultAmplify: () => (/* binding */ DefaultAmplify)
918
+ /* harmony export */ });
919
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core */ "./node_modules/@aws-amplify/core/dist/esm/storage/CookieStorage.mjs");
920
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aws-amplify/core */ "./node_modules/@aws-amplify/core/dist/esm/storage/index.mjs");
921
+ /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @aws-amplify/core */ "./node_modules/@aws-amplify/core/dist/esm/singleton/Amplify.mjs");
922
+ /* harmony import */ var _aws_amplify_core_internals_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core/internals/utils */ "./node_modules/@aws-amplify/core/dist/esm/utils/parseAmplifyConfig.mjs");
923
+ /* harmony import */ var _aws_amplify_auth_cognito__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @aws-amplify/auth/cognito */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/credentialsProvider.mjs");
924
+ /* harmony import */ var _aws_amplify_auth_cognito__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @aws-amplify/auth/cognito */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/IdentityIdStore.mjs");
925
+ /* harmony import */ var _aws_amplify_auth_cognito__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @aws-amplify/auth/cognito */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/credentialsProvider/index.mjs");
926
+ /* harmony import */ var _aws_amplify_auth_cognito__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @aws-amplify/auth/cognito */ "./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/tokenProvider/tokenProvider.mjs");
927
+
928
+
929
+
930
+
931
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
932
+ // SPDX-License-Identifier: Apache-2.0
933
+ const DefaultAmplify = {
934
+ /**
935
+ * Configures Amplify with the {@link resourceConfig} and {@link libraryOptions}.
936
+ *
937
+ * @param resourceConfig The {@link ResourcesConfig} object that is typically imported from the
938
+ * `amplifyconfiguration.json` file. It can also be an object literal created inline when calling `Amplify.configure`.
939
+ * @param libraryOptions The {@link LibraryOptions} additional options for the library.
940
+ *
941
+ * @example
942
+ * import config from './amplifyconfiguration.json';
943
+ *
944
+ * Amplify.configure(config);
945
+ */
946
+ configure(resourceConfig, libraryOptions) {
947
+ const resolvedResourceConfig = (0,_aws_amplify_core_internals_utils__WEBPACK_IMPORTED_MODULE_0__.parseAmplifyConfig)(resourceConfig);
948
+ const cookieBasedKeyValueStorage = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__.CookieStorage({ sameSite: 'lax' });
949
+ const resolvedKeyValueStorage = libraryOptions?.ssr
950
+ ? cookieBasedKeyValueStorage
951
+ : _aws_amplify_core__WEBPACK_IMPORTED_MODULE_2__.defaultStorage;
952
+ const resolvedCredentialsProvider = libraryOptions?.ssr
953
+ ? new _aws_amplify_auth_cognito__WEBPACK_IMPORTED_MODULE_3__.CognitoAWSCredentialsAndIdentityIdProvider(new _aws_amplify_auth_cognito__WEBPACK_IMPORTED_MODULE_4__.DefaultIdentityIdStore(cookieBasedKeyValueStorage))
954
+ : _aws_amplify_auth_cognito__WEBPACK_IMPORTED_MODULE_5__.cognitoCredentialsProvider;
955
+ // If no Auth config is provided, no special handling will be required, configure as is.
956
+ // Otherwise, we can assume an Auth config is provided from here on.
957
+ if (!resolvedResourceConfig.Auth) {
958
+ _aws_amplify_core__WEBPACK_IMPORTED_MODULE_6__.Amplify.configure(resolvedResourceConfig, libraryOptions);
959
+ return;
960
+ }
961
+ // If Auth options are provided, always just configure as is.
962
+ // Otherwise, we can assume no Auth libraryOptions were provided from here on.
963
+ if (libraryOptions?.Auth) {
964
+ _aws_amplify_core__WEBPACK_IMPORTED_MODULE_6__.Amplify.configure(resolvedResourceConfig, libraryOptions);
965
+ return;
966
+ }
967
+ // If no Auth libraryOptions were previously configured, then always add default providers.
968
+ if (!_aws_amplify_core__WEBPACK_IMPORTED_MODULE_6__.Amplify.libraryOptions.Auth) {
969
+ _aws_amplify_auth_cognito__WEBPACK_IMPORTED_MODULE_7__.cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);
970
+ _aws_amplify_auth_cognito__WEBPACK_IMPORTED_MODULE_7__.cognitoUserPoolsTokenProvider.setKeyValueStorage(
971
+ // TODO: allow configure with a public interface
972
+ resolvedKeyValueStorage);
973
+ _aws_amplify_core__WEBPACK_IMPORTED_MODULE_6__.Amplify.configure(resolvedResourceConfig, {
974
+ ...libraryOptions,
975
+ Auth: {
976
+ tokenProvider: _aws_amplify_auth_cognito__WEBPACK_IMPORTED_MODULE_7__.cognitoUserPoolsTokenProvider,
977
+ credentialsProvider: resolvedCredentialsProvider,
978
+ },
979
+ });
980
+ return;
981
+ }
982
+ // At this point, Auth libraryOptions would have been previously configured and no overriding
983
+ // Auth options were given, so we should preserve the currently configured Auth libraryOptions.
984
+ if (libraryOptions) {
985
+ const authLibraryOptions = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_6__.Amplify.libraryOptions.Auth;
986
+ // If ssr is provided through libraryOptions, we should respect the intentional reconfiguration.
987
+ if (libraryOptions.ssr !== undefined) {
988
+ _aws_amplify_auth_cognito__WEBPACK_IMPORTED_MODULE_7__.cognitoUserPoolsTokenProvider.setKeyValueStorage(
989
+ // TODO: allow configure with a public interface
990
+ resolvedKeyValueStorage);
991
+ authLibraryOptions.credentialsProvider = resolvedCredentialsProvider;
992
+ }
993
+ _aws_amplify_core__WEBPACK_IMPORTED_MODULE_6__.Amplify.configure(resolvedResourceConfig, {
994
+ Auth: authLibraryOptions,
995
+ ...libraryOptions,
996
+ });
997
+ return;
998
+ }
999
+ // Finally, if there were no libraryOptions given at all, we should simply not touch the currently
1000
+ // configured libraryOptions.
1001
+ _aws_amplify_core__WEBPACK_IMPORTED_MODULE_6__.Amplify.configure(resolvedResourceConfig);
1002
+ },
1003
+ /**
1004
+ * Returns the {@link ResourcesConfig} object passed in as the `resourceConfig` parameter when calling
1005
+ * `Amplify.configure`.
1006
+ *
1007
+ * @returns An {@link ResourcesConfig} object.
1008
+ */
1009
+ getConfig() {
1010
+ return _aws_amplify_core__WEBPACK_IMPORTED_MODULE_6__.Amplify.getConfig();
1011
+ },
1012
+ };
1013
+
1014
+
1015
+ //# sourceMappingURL=initSingleton.mjs.map
1016
+
1017
+
1018
+ /***/ })
1019
+
1020
+ }]);
1021
+ //# sourceMappingURL=vendors-node_modules_aws-amplify_dist_esm_index_mjs.6bac1a8c4cc93f15f6b7.js.map