@ampt/ai 1.0.3 → 2.0.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.
@@ -0,0 +1,1158 @@
1
+ import { createRequire as topLevelCreateRequire } from 'module'
2
+ const require = topLevelCreateRequire(import.meta.url || __dirname)
3
+ import {
4
+ AssumeRoleCommand,
5
+ Client,
6
+ Command,
7
+ CredentialsProviderError,
8
+ DEFAULT_RETRY_MODE,
9
+ Hash,
10
+ HttpRequest,
11
+ NODE_MAX_ATTEMPT_CONFIG_OPTIONS,
12
+ NODE_REGION_CONFIG_FILE_OPTIONS,
13
+ NODE_REGION_CONFIG_OPTIONS,
14
+ NODE_RETRY_MODE_CONFIG_OPTIONS,
15
+ NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,
16
+ NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,
17
+ NoOpLogger,
18
+ NodeHttpHandler,
19
+ SSOClient,
20
+ STSClient,
21
+ ServiceException,
22
+ calculateBodyLength,
23
+ decorateDefaultCredentialProvider,
24
+ decorateServiceException,
25
+ defaultProvider,
26
+ defaultUserAgent,
27
+ emitWarningIfUnsupportedVersion,
28
+ expectNonNull,
29
+ expectNumber,
30
+ expectString,
31
+ fromBase64,
32
+ fromContainerMetadata,
33
+ fromEnv,
34
+ fromIni,
35
+ fromInstanceMetadata,
36
+ fromProcess,
37
+ fromSSO,
38
+ fromTokenFile,
39
+ fromUtf8,
40
+ fromWebToken,
41
+ getContentLengthPlugin,
42
+ getDefaultRoleAssumer,
43
+ getDefaultRoleAssumerWithWebIdentity,
44
+ getEndpointPlugin,
45
+ getHostHeaderPlugin,
46
+ getLoggerPlugin,
47
+ getRecursionDetectionPlugin,
48
+ getRetryPlugin,
49
+ getSerdePlugin,
50
+ getUserAgentPlugin,
51
+ loadConfig,
52
+ loadConfigsForDefaultMode,
53
+ parseEpochTimestamp,
54
+ parseUrl,
55
+ resolveAwsAuthConfig,
56
+ resolveDefaultsModeConfig,
57
+ resolveEndpoint,
58
+ resolveEndpointConfig,
59
+ resolveHostHeaderConfig,
60
+ resolveRegionConfig,
61
+ resolveRetryConfig,
62
+ resolveUserAgentConfig,
63
+ streamCollector,
64
+ throwDefaultError,
65
+ toBase64,
66
+ toUtf8
67
+ } from "./chunk-JPKYSWKV.js";
68
+
69
+ // ../../node_modules/@aws-sdk/client-cognito-identity/dist-es/endpoint/EndpointParameters.js
70
+ var resolveClientEndpointParameters = (options) => {
71
+ return {
72
+ ...options,
73
+ useDualstackEndpoint: options.useDualstackEndpoint ?? false,
74
+ useFipsEndpoint: options.useFipsEndpoint ?? false,
75
+ defaultSigningName: "cognito-identity"
76
+ };
77
+ };
78
+
79
+ // ../../node_modules/@aws-sdk/client-cognito-identity/package.json
80
+ var package_default = {
81
+ name: "@aws-sdk/client-cognito-identity",
82
+ description: "AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native",
83
+ version: "3.272.0",
84
+ scripts: {
85
+ build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
86
+ "build:cjs": "tsc -p tsconfig.cjs.json",
87
+ "build:docs": "typedoc",
88
+ "build:es": "tsc -p tsconfig.es.json",
89
+ "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
90
+ "build:types": "tsc -p tsconfig.types.json",
91
+ "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
92
+ clean: "rimraf ./dist-* && rimraf *.tsbuildinfo",
93
+ "generate:client": "node ../../scripts/generate-clients/single-service --solo cognito-identity",
94
+ "test:e2e": "ts-mocha test/**/*.ispec.ts && karma start karma.conf.js"
95
+ },
96
+ main: "./dist-cjs/index.js",
97
+ types: "./dist-types/index.d.ts",
98
+ module: "./dist-es/index.js",
99
+ sideEffects: false,
100
+ dependencies: {
101
+ "@aws-crypto/sha256-browser": "3.0.0",
102
+ "@aws-crypto/sha256-js": "3.0.0",
103
+ "@aws-sdk/client-sts": "3.272.0",
104
+ "@aws-sdk/config-resolver": "3.272.0",
105
+ "@aws-sdk/credential-provider-node": "3.272.0",
106
+ "@aws-sdk/fetch-http-handler": "3.272.0",
107
+ "@aws-sdk/hash-node": "3.272.0",
108
+ "@aws-sdk/invalid-dependency": "3.272.0",
109
+ "@aws-sdk/middleware-content-length": "3.272.0",
110
+ "@aws-sdk/middleware-endpoint": "3.272.0",
111
+ "@aws-sdk/middleware-host-header": "3.272.0",
112
+ "@aws-sdk/middleware-logger": "3.272.0",
113
+ "@aws-sdk/middleware-recursion-detection": "3.272.0",
114
+ "@aws-sdk/middleware-retry": "3.272.0",
115
+ "@aws-sdk/middleware-serde": "3.272.0",
116
+ "@aws-sdk/middleware-signing": "3.272.0",
117
+ "@aws-sdk/middleware-stack": "3.272.0",
118
+ "@aws-sdk/middleware-user-agent": "3.272.0",
119
+ "@aws-sdk/node-config-provider": "3.272.0",
120
+ "@aws-sdk/node-http-handler": "3.272.0",
121
+ "@aws-sdk/protocol-http": "3.272.0",
122
+ "@aws-sdk/smithy-client": "3.272.0",
123
+ "@aws-sdk/types": "3.272.0",
124
+ "@aws-sdk/url-parser": "3.272.0",
125
+ "@aws-sdk/util-base64": "3.208.0",
126
+ "@aws-sdk/util-body-length-browser": "3.188.0",
127
+ "@aws-sdk/util-body-length-node": "3.208.0",
128
+ "@aws-sdk/util-defaults-mode-browser": "3.272.0",
129
+ "@aws-sdk/util-defaults-mode-node": "3.272.0",
130
+ "@aws-sdk/util-endpoints": "3.272.0",
131
+ "@aws-sdk/util-retry": "3.272.0",
132
+ "@aws-sdk/util-user-agent-browser": "3.272.0",
133
+ "@aws-sdk/util-user-agent-node": "3.272.0",
134
+ "@aws-sdk/util-utf8": "3.254.0",
135
+ tslib: "^2.3.1"
136
+ },
137
+ devDependencies: {
138
+ "@aws-sdk/client-iam": "3.272.0",
139
+ "@aws-sdk/service-client-documentation-generator": "3.208.0",
140
+ "@tsconfig/node14": "1.0.3",
141
+ "@types/chai": "^4.2.11",
142
+ "@types/mocha": "^8.0.4",
143
+ "@types/node": "^14.14.31",
144
+ concurrently: "7.0.0",
145
+ "downlevel-dts": "0.10.1",
146
+ rimraf: "3.0.2",
147
+ typedoc: "0.19.2",
148
+ typescript: "~4.6.2"
149
+ },
150
+ overrides: {
151
+ typedoc: {
152
+ typescript: "~4.6.2"
153
+ }
154
+ },
155
+ engines: {
156
+ node: ">=14.0.0"
157
+ },
158
+ typesVersions: {
159
+ "<4.0": {
160
+ "dist-types/*": [
161
+ "dist-types/ts3.4/*"
162
+ ]
163
+ }
164
+ },
165
+ files: [
166
+ "dist-*"
167
+ ],
168
+ author: {
169
+ name: "AWS SDK for JavaScript Team",
170
+ url: "https://aws.amazon.com/javascript/"
171
+ },
172
+ license: "Apache-2.0",
173
+ browser: {
174
+ "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
175
+ },
176
+ "react-native": {
177
+ "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native"
178
+ },
179
+ homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity",
180
+ repository: {
181
+ type: "git",
182
+ url: "https://github.com/aws/aws-sdk-js-v3.git",
183
+ directory: "clients/client-cognito-identity"
184
+ }
185
+ };
186
+
187
+ // ../../node_modules/@aws-sdk/client-cognito-identity/dist-es/endpoint/ruleset.js
188
+ var p = "required";
189
+ var q = "fn";
190
+ var r = "argv";
191
+ var s = "ref";
192
+ var a = "PartitionResult";
193
+ var b = "tree";
194
+ var c = "error";
195
+ var d = "endpoint";
196
+ var e = { [p]: false, "type": "String" };
197
+ var f = { [p]: true, "default": false, "type": "Boolean" };
198
+ var g = { [s]: "Endpoint" };
199
+ var h = { [q]: "booleanEquals", [r]: [{ [s]: "UseFIPS" }, true] };
200
+ var i = { [q]: "booleanEquals", [r]: [{ [s]: "UseDualStack" }, true] };
201
+ var j = {};
202
+ var k = { [q]: "booleanEquals", [r]: [true, { [q]: "getAttr", [r]: [{ [s]: a }, "supportsFIPS"] }] };
203
+ var l = { [q]: "booleanEquals", [r]: [true, { [q]: "getAttr", [r]: [{ [s]: a }, "supportsDualStack"] }] };
204
+ var m = [g];
205
+ var n = [h];
206
+ var o = [i];
207
+ var _data = { version: "1.0", parameters: { Region: e, UseDualStack: f, UseFIPS: f, Endpoint: e }, rules: [{ conditions: [{ [q]: "aws.partition", [r]: [{ [s]: "Region" }], assign: a }], type: b, rules: [{ conditions: [{ [q]: "isSet", [r]: m }, { [q]: "parseURL", [r]: m, assign: "url" }], type: b, rules: [{ conditions: n, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: c }, { type: b, rules: [{ conditions: o, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: c }, { endpoint: { url: g, properties: j, headers: j }, type: d }] }] }, { conditions: [h, i], type: b, rules: [{ conditions: [k, l], type: b, rules: [{ endpoint: { url: "https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: j, headers: j }, type: d }] }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: c }] }, { conditions: n, type: b, rules: [{ conditions: [k], type: b, rules: [{ type: b, rules: [{ endpoint: { url: "https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}", properties: j, headers: j }, type: d }] }] }, { error: "FIPS is enabled but this partition does not support FIPS", type: c }] }, { conditions: o, type: b, rules: [{ conditions: [l], type: b, rules: [{ endpoint: { url: "https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: j, headers: j }, type: d }] }, { error: "DualStack is enabled but this partition does not support DualStack", type: c }] }, { endpoint: { url: "https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}", properties: j, headers: j }, type: d }] }] };
208
+ var ruleSet = _data;
209
+
210
+ // ../../node_modules/@aws-sdk/client-cognito-identity/dist-es/endpoint/endpointResolver.js
211
+ var defaultEndpointResolver = (endpointParams, context = {}) => {
212
+ return resolveEndpoint(ruleSet, {
213
+ endpointParams,
214
+ logger: context.logger
215
+ });
216
+ };
217
+
218
+ // ../../node_modules/@aws-sdk/client-cognito-identity/dist-es/runtimeConfig.shared.js
219
+ var getRuntimeConfig = (config) => ({
220
+ apiVersion: "2014-06-30",
221
+ base64Decoder: config?.base64Decoder ?? fromBase64,
222
+ base64Encoder: config?.base64Encoder ?? toBase64,
223
+ disableHostPrefix: config?.disableHostPrefix ?? false,
224
+ endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
225
+ logger: config?.logger ?? new NoOpLogger(),
226
+ serviceId: config?.serviceId ?? "Cognito Identity",
227
+ urlParser: config?.urlParser ?? parseUrl,
228
+ utf8Decoder: config?.utf8Decoder ?? fromUtf8,
229
+ utf8Encoder: config?.utf8Encoder ?? toUtf8
230
+ });
231
+
232
+ // ../../node_modules/@aws-sdk/client-cognito-identity/dist-es/runtimeConfig.js
233
+ var getRuntimeConfig2 = (config) => {
234
+ emitWarningIfUnsupportedVersion(process.version);
235
+ const defaultsMode = resolveDefaultsModeConfig(config);
236
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
237
+ const clientSharedValues = getRuntimeConfig(config);
238
+ return {
239
+ ...clientSharedValues,
240
+ ...config,
241
+ runtime: "node",
242
+ defaultsMode,
243
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
244
+ credentialDefaultProvider: config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(defaultProvider),
245
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: package_default.version }),
246
+ maxAttempts: config?.maxAttempts ?? loadConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
247
+ region: config?.region ?? loadConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
248
+ requestHandler: config?.requestHandler ?? new NodeHttpHandler(defaultConfigProvider),
249
+ retryMode: config?.retryMode ?? loadConfig({
250
+ ...NODE_RETRY_MODE_CONFIG_OPTIONS,
251
+ default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE
252
+ }),
253
+ sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
254
+ streamCollector: config?.streamCollector ?? streamCollector,
255
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? loadConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
256
+ useFipsEndpoint: config?.useFipsEndpoint ?? loadConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS)
257
+ };
258
+ };
259
+
260
+ // ../../node_modules/@aws-sdk/client-cognito-identity/dist-es/CognitoIdentityClient.js
261
+ var CognitoIdentityClient = class extends Client {
262
+ constructor(configuration) {
263
+ const _config_0 = getRuntimeConfig2(configuration);
264
+ const _config_1 = resolveClientEndpointParameters(_config_0);
265
+ const _config_2 = resolveRegionConfig(_config_1);
266
+ const _config_3 = resolveEndpointConfig(_config_2);
267
+ const _config_4 = resolveRetryConfig(_config_3);
268
+ const _config_5 = resolveHostHeaderConfig(_config_4);
269
+ const _config_6 = resolveAwsAuthConfig(_config_5);
270
+ const _config_7 = resolveUserAgentConfig(_config_6);
271
+ super(_config_7);
272
+ this.config = _config_7;
273
+ this.middlewareStack.use(getRetryPlugin(this.config));
274
+ this.middlewareStack.use(getContentLengthPlugin(this.config));
275
+ this.middlewareStack.use(getHostHeaderPlugin(this.config));
276
+ this.middlewareStack.use(getLoggerPlugin(this.config));
277
+ this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
278
+ this.middlewareStack.use(getUserAgentPlugin(this.config));
279
+ }
280
+ destroy() {
281
+ super.destroy();
282
+ }
283
+ };
284
+
285
+ // ../../node_modules/@aws-sdk/client-cognito-identity/dist-es/models/CognitoIdentityServiceException.js
286
+ var CognitoIdentityServiceException = class extends ServiceException {
287
+ constructor(options) {
288
+ super(options);
289
+ Object.setPrototypeOf(this, CognitoIdentityServiceException.prototype);
290
+ }
291
+ };
292
+
293
+ // ../../node_modules/@aws-sdk/client-cognito-identity/dist-es/models/models_0.js
294
+ var AmbiguousRoleResolutionType;
295
+ (function(AmbiguousRoleResolutionType2) {
296
+ AmbiguousRoleResolutionType2["AUTHENTICATED_ROLE"] = "AuthenticatedRole";
297
+ AmbiguousRoleResolutionType2["DENY"] = "Deny";
298
+ })(AmbiguousRoleResolutionType || (AmbiguousRoleResolutionType = {}));
299
+ var InternalErrorException = class extends CognitoIdentityServiceException {
300
+ constructor(opts) {
301
+ super({
302
+ name: "InternalErrorException",
303
+ $fault: "server",
304
+ ...opts
305
+ });
306
+ this.name = "InternalErrorException";
307
+ this.$fault = "server";
308
+ Object.setPrototypeOf(this, InternalErrorException.prototype);
309
+ }
310
+ };
311
+ var InvalidParameterException = class extends CognitoIdentityServiceException {
312
+ constructor(opts) {
313
+ super({
314
+ name: "InvalidParameterException",
315
+ $fault: "client",
316
+ ...opts
317
+ });
318
+ this.name = "InvalidParameterException";
319
+ this.$fault = "client";
320
+ Object.setPrototypeOf(this, InvalidParameterException.prototype);
321
+ }
322
+ };
323
+ var LimitExceededException = class extends CognitoIdentityServiceException {
324
+ constructor(opts) {
325
+ super({
326
+ name: "LimitExceededException",
327
+ $fault: "client",
328
+ ...opts
329
+ });
330
+ this.name = "LimitExceededException";
331
+ this.$fault = "client";
332
+ Object.setPrototypeOf(this, LimitExceededException.prototype);
333
+ }
334
+ };
335
+ var NotAuthorizedException = class extends CognitoIdentityServiceException {
336
+ constructor(opts) {
337
+ super({
338
+ name: "NotAuthorizedException",
339
+ $fault: "client",
340
+ ...opts
341
+ });
342
+ this.name = "NotAuthorizedException";
343
+ this.$fault = "client";
344
+ Object.setPrototypeOf(this, NotAuthorizedException.prototype);
345
+ }
346
+ };
347
+ var ResourceConflictException = class extends CognitoIdentityServiceException {
348
+ constructor(opts) {
349
+ super({
350
+ name: "ResourceConflictException",
351
+ $fault: "client",
352
+ ...opts
353
+ });
354
+ this.name = "ResourceConflictException";
355
+ this.$fault = "client";
356
+ Object.setPrototypeOf(this, ResourceConflictException.prototype);
357
+ }
358
+ };
359
+ var TooManyRequestsException = class extends CognitoIdentityServiceException {
360
+ constructor(opts) {
361
+ super({
362
+ name: "TooManyRequestsException",
363
+ $fault: "client",
364
+ ...opts
365
+ });
366
+ this.name = "TooManyRequestsException";
367
+ this.$fault = "client";
368
+ Object.setPrototypeOf(this, TooManyRequestsException.prototype);
369
+ }
370
+ };
371
+ var ErrorCode;
372
+ (function(ErrorCode2) {
373
+ ErrorCode2["ACCESS_DENIED"] = "AccessDenied";
374
+ ErrorCode2["INTERNAL_SERVER_ERROR"] = "InternalServerError";
375
+ })(ErrorCode || (ErrorCode = {}));
376
+ var ResourceNotFoundException = class extends CognitoIdentityServiceException {
377
+ constructor(opts) {
378
+ super({
379
+ name: "ResourceNotFoundException",
380
+ $fault: "client",
381
+ ...opts
382
+ });
383
+ this.name = "ResourceNotFoundException";
384
+ this.$fault = "client";
385
+ Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
386
+ }
387
+ };
388
+ var ExternalServiceException = class extends CognitoIdentityServiceException {
389
+ constructor(opts) {
390
+ super({
391
+ name: "ExternalServiceException",
392
+ $fault: "client",
393
+ ...opts
394
+ });
395
+ this.name = "ExternalServiceException";
396
+ this.$fault = "client";
397
+ Object.setPrototypeOf(this, ExternalServiceException.prototype);
398
+ }
399
+ };
400
+ var InvalidIdentityPoolConfigurationException = class extends CognitoIdentityServiceException {
401
+ constructor(opts) {
402
+ super({
403
+ name: "InvalidIdentityPoolConfigurationException",
404
+ $fault: "client",
405
+ ...opts
406
+ });
407
+ this.name = "InvalidIdentityPoolConfigurationException";
408
+ this.$fault = "client";
409
+ Object.setPrototypeOf(this, InvalidIdentityPoolConfigurationException.prototype);
410
+ }
411
+ };
412
+ var MappingRuleMatchType;
413
+ (function(MappingRuleMatchType2) {
414
+ MappingRuleMatchType2["CONTAINS"] = "Contains";
415
+ MappingRuleMatchType2["EQUALS"] = "Equals";
416
+ MappingRuleMatchType2["NOT_EQUAL"] = "NotEqual";
417
+ MappingRuleMatchType2["STARTS_WITH"] = "StartsWith";
418
+ })(MappingRuleMatchType || (MappingRuleMatchType = {}));
419
+ var RoleMappingType;
420
+ (function(RoleMappingType2) {
421
+ RoleMappingType2["RULES"] = "Rules";
422
+ RoleMappingType2["TOKEN"] = "Token";
423
+ })(RoleMappingType || (RoleMappingType = {}));
424
+ var GetCredentialsForIdentityInputFilterSensitiveLog = (obj) => ({
425
+ ...obj
426
+ });
427
+ var GetCredentialsForIdentityResponseFilterSensitiveLog = (obj) => ({
428
+ ...obj
429
+ });
430
+ var GetIdInputFilterSensitiveLog = (obj) => ({
431
+ ...obj
432
+ });
433
+ var GetIdResponseFilterSensitiveLog = (obj) => ({
434
+ ...obj
435
+ });
436
+
437
+ // ../../node_modules/@aws-sdk/client-cognito-identity/dist-es/protocols/Aws_json1_1.js
438
+ var serializeAws_json1_1GetCredentialsForIdentityCommand = async (input, context) => {
439
+ const headers = {
440
+ "content-type": "application/x-amz-json-1.1",
441
+ "x-amz-target": "AWSCognitoIdentityService.GetCredentialsForIdentity"
442
+ };
443
+ let body;
444
+ body = JSON.stringify(serializeAws_json1_1GetCredentialsForIdentityInput(input, context));
445
+ return buildHttpRpcRequest(context, headers, "/", void 0, body);
446
+ };
447
+ var serializeAws_json1_1GetIdCommand = async (input, context) => {
448
+ const headers = {
449
+ "content-type": "application/x-amz-json-1.1",
450
+ "x-amz-target": "AWSCognitoIdentityService.GetId"
451
+ };
452
+ let body;
453
+ body = JSON.stringify(serializeAws_json1_1GetIdInput(input, context));
454
+ return buildHttpRpcRequest(context, headers, "/", void 0, body);
455
+ };
456
+ var deserializeAws_json1_1GetCredentialsForIdentityCommand = async (output, context) => {
457
+ if (output.statusCode >= 300) {
458
+ return deserializeAws_json1_1GetCredentialsForIdentityCommandError(output, context);
459
+ }
460
+ const data = await parseBody(output.body, context);
461
+ let contents = {};
462
+ contents = deserializeAws_json1_1GetCredentialsForIdentityResponse(data, context);
463
+ const response = {
464
+ $metadata: deserializeMetadata(output),
465
+ ...contents
466
+ };
467
+ return Promise.resolve(response);
468
+ };
469
+ var deserializeAws_json1_1GetCredentialsForIdentityCommandError = async (output, context) => {
470
+ const parsedOutput = {
471
+ ...output,
472
+ body: await parseErrorBody(output.body, context)
473
+ };
474
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
475
+ switch (errorCode) {
476
+ case "ExternalServiceException":
477
+ case "com.amazonaws.cognitoidentity#ExternalServiceException":
478
+ throw await deserializeAws_json1_1ExternalServiceExceptionResponse(parsedOutput, context);
479
+ case "InternalErrorException":
480
+ case "com.amazonaws.cognitoidentity#InternalErrorException":
481
+ throw await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context);
482
+ case "InvalidIdentityPoolConfigurationException":
483
+ case "com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":
484
+ throw await deserializeAws_json1_1InvalidIdentityPoolConfigurationExceptionResponse(parsedOutput, context);
485
+ case "InvalidParameterException":
486
+ case "com.amazonaws.cognitoidentity#InvalidParameterException":
487
+ throw await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context);
488
+ case "NotAuthorizedException":
489
+ case "com.amazonaws.cognitoidentity#NotAuthorizedException":
490
+ throw await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context);
491
+ case "ResourceConflictException":
492
+ case "com.amazonaws.cognitoidentity#ResourceConflictException":
493
+ throw await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context);
494
+ case "ResourceNotFoundException":
495
+ case "com.amazonaws.cognitoidentity#ResourceNotFoundException":
496
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
497
+ case "TooManyRequestsException":
498
+ case "com.amazonaws.cognitoidentity#TooManyRequestsException":
499
+ throw await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context);
500
+ default:
501
+ const parsedBody = parsedOutput.body;
502
+ throwDefaultError({
503
+ output,
504
+ parsedBody,
505
+ exceptionCtor: CognitoIdentityServiceException,
506
+ errorCode
507
+ });
508
+ }
509
+ };
510
+ var deserializeAws_json1_1GetIdCommand = async (output, context) => {
511
+ if (output.statusCode >= 300) {
512
+ return deserializeAws_json1_1GetIdCommandError(output, context);
513
+ }
514
+ const data = await parseBody(output.body, context);
515
+ let contents = {};
516
+ contents = deserializeAws_json1_1GetIdResponse(data, context);
517
+ const response = {
518
+ $metadata: deserializeMetadata(output),
519
+ ...contents
520
+ };
521
+ return Promise.resolve(response);
522
+ };
523
+ var deserializeAws_json1_1GetIdCommandError = async (output, context) => {
524
+ const parsedOutput = {
525
+ ...output,
526
+ body: await parseErrorBody(output.body, context)
527
+ };
528
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
529
+ switch (errorCode) {
530
+ case "ExternalServiceException":
531
+ case "com.amazonaws.cognitoidentity#ExternalServiceException":
532
+ throw await deserializeAws_json1_1ExternalServiceExceptionResponse(parsedOutput, context);
533
+ case "InternalErrorException":
534
+ case "com.amazonaws.cognitoidentity#InternalErrorException":
535
+ throw await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context);
536
+ case "InvalidParameterException":
537
+ case "com.amazonaws.cognitoidentity#InvalidParameterException":
538
+ throw await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context);
539
+ case "LimitExceededException":
540
+ case "com.amazonaws.cognitoidentity#LimitExceededException":
541
+ throw await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context);
542
+ case "NotAuthorizedException":
543
+ case "com.amazonaws.cognitoidentity#NotAuthorizedException":
544
+ throw await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context);
545
+ case "ResourceConflictException":
546
+ case "com.amazonaws.cognitoidentity#ResourceConflictException":
547
+ throw await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context);
548
+ case "ResourceNotFoundException":
549
+ case "com.amazonaws.cognitoidentity#ResourceNotFoundException":
550
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
551
+ case "TooManyRequestsException":
552
+ case "com.amazonaws.cognitoidentity#TooManyRequestsException":
553
+ throw await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context);
554
+ default:
555
+ const parsedBody = parsedOutput.body;
556
+ throwDefaultError({
557
+ output,
558
+ parsedBody,
559
+ exceptionCtor: CognitoIdentityServiceException,
560
+ errorCode
561
+ });
562
+ }
563
+ };
564
+ var deserializeAws_json1_1ExternalServiceExceptionResponse = async (parsedOutput, context) => {
565
+ const body = parsedOutput.body;
566
+ const deserialized = deserializeAws_json1_1ExternalServiceException(body, context);
567
+ const exception = new ExternalServiceException({
568
+ $metadata: deserializeMetadata(parsedOutput),
569
+ ...deserialized
570
+ });
571
+ return decorateServiceException(exception, body);
572
+ };
573
+ var deserializeAws_json1_1InternalErrorExceptionResponse = async (parsedOutput, context) => {
574
+ const body = parsedOutput.body;
575
+ const deserialized = deserializeAws_json1_1InternalErrorException(body, context);
576
+ const exception = new InternalErrorException({
577
+ $metadata: deserializeMetadata(parsedOutput),
578
+ ...deserialized
579
+ });
580
+ return decorateServiceException(exception, body);
581
+ };
582
+ var deserializeAws_json1_1InvalidIdentityPoolConfigurationExceptionResponse = async (parsedOutput, context) => {
583
+ const body = parsedOutput.body;
584
+ const deserialized = deserializeAws_json1_1InvalidIdentityPoolConfigurationException(body, context);
585
+ const exception = new InvalidIdentityPoolConfigurationException({
586
+ $metadata: deserializeMetadata(parsedOutput),
587
+ ...deserialized
588
+ });
589
+ return decorateServiceException(exception, body);
590
+ };
591
+ var deserializeAws_json1_1InvalidParameterExceptionResponse = async (parsedOutput, context) => {
592
+ const body = parsedOutput.body;
593
+ const deserialized = deserializeAws_json1_1InvalidParameterException(body, context);
594
+ const exception = new InvalidParameterException({
595
+ $metadata: deserializeMetadata(parsedOutput),
596
+ ...deserialized
597
+ });
598
+ return decorateServiceException(exception, body);
599
+ };
600
+ var deserializeAws_json1_1LimitExceededExceptionResponse = async (parsedOutput, context) => {
601
+ const body = parsedOutput.body;
602
+ const deserialized = deserializeAws_json1_1LimitExceededException(body, context);
603
+ const exception = new LimitExceededException({
604
+ $metadata: deserializeMetadata(parsedOutput),
605
+ ...deserialized
606
+ });
607
+ return decorateServiceException(exception, body);
608
+ };
609
+ var deserializeAws_json1_1NotAuthorizedExceptionResponse = async (parsedOutput, context) => {
610
+ const body = parsedOutput.body;
611
+ const deserialized = deserializeAws_json1_1NotAuthorizedException(body, context);
612
+ const exception = new NotAuthorizedException({
613
+ $metadata: deserializeMetadata(parsedOutput),
614
+ ...deserialized
615
+ });
616
+ return decorateServiceException(exception, body);
617
+ };
618
+ var deserializeAws_json1_1ResourceConflictExceptionResponse = async (parsedOutput, context) => {
619
+ const body = parsedOutput.body;
620
+ const deserialized = deserializeAws_json1_1ResourceConflictException(body, context);
621
+ const exception = new ResourceConflictException({
622
+ $metadata: deserializeMetadata(parsedOutput),
623
+ ...deserialized
624
+ });
625
+ return decorateServiceException(exception, body);
626
+ };
627
+ var deserializeAws_json1_1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
628
+ const body = parsedOutput.body;
629
+ const deserialized = deserializeAws_json1_1ResourceNotFoundException(body, context);
630
+ const exception = new ResourceNotFoundException({
631
+ $metadata: deserializeMetadata(parsedOutput),
632
+ ...deserialized
633
+ });
634
+ return decorateServiceException(exception, body);
635
+ };
636
+ var deserializeAws_json1_1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
637
+ const body = parsedOutput.body;
638
+ const deserialized = deserializeAws_json1_1TooManyRequestsException(body, context);
639
+ const exception = new TooManyRequestsException({
640
+ $metadata: deserializeMetadata(parsedOutput),
641
+ ...deserialized
642
+ });
643
+ return decorateServiceException(exception, body);
644
+ };
645
+ var serializeAws_json1_1GetCredentialsForIdentityInput = (input, context) => {
646
+ return {
647
+ ...input.CustomRoleArn != null && { CustomRoleArn: input.CustomRoleArn },
648
+ ...input.IdentityId != null && { IdentityId: input.IdentityId },
649
+ ...input.Logins != null && { Logins: serializeAws_json1_1LoginsMap(input.Logins, context) }
650
+ };
651
+ };
652
+ var serializeAws_json1_1GetIdInput = (input, context) => {
653
+ return {
654
+ ...input.AccountId != null && { AccountId: input.AccountId },
655
+ ...input.IdentityPoolId != null && { IdentityPoolId: input.IdentityPoolId },
656
+ ...input.Logins != null && { Logins: serializeAws_json1_1LoginsMap(input.Logins, context) }
657
+ };
658
+ };
659
+ var serializeAws_json1_1LoginsMap = (input, context) => {
660
+ return Object.entries(input).reduce((acc, [key, value]) => {
661
+ if (value === null) {
662
+ return acc;
663
+ }
664
+ acc[key] = value;
665
+ return acc;
666
+ }, {});
667
+ };
668
+ var deserializeAws_json1_1Credentials = (output, context) => {
669
+ return {
670
+ AccessKeyId: expectString(output.AccessKeyId),
671
+ Expiration: output.Expiration != null ? expectNonNull(parseEpochTimestamp(expectNumber(output.Expiration))) : void 0,
672
+ SecretKey: expectString(output.SecretKey),
673
+ SessionToken: expectString(output.SessionToken)
674
+ };
675
+ };
676
+ var deserializeAws_json1_1ExternalServiceException = (output, context) => {
677
+ return {
678
+ message: expectString(output.message)
679
+ };
680
+ };
681
+ var deserializeAws_json1_1GetCredentialsForIdentityResponse = (output, context) => {
682
+ return {
683
+ Credentials: output.Credentials != null ? deserializeAws_json1_1Credentials(output.Credentials, context) : void 0,
684
+ IdentityId: expectString(output.IdentityId)
685
+ };
686
+ };
687
+ var deserializeAws_json1_1GetIdResponse = (output, context) => {
688
+ return {
689
+ IdentityId: expectString(output.IdentityId)
690
+ };
691
+ };
692
+ var deserializeAws_json1_1InternalErrorException = (output, context) => {
693
+ return {
694
+ message: expectString(output.message)
695
+ };
696
+ };
697
+ var deserializeAws_json1_1InvalidIdentityPoolConfigurationException = (output, context) => {
698
+ return {
699
+ message: expectString(output.message)
700
+ };
701
+ };
702
+ var deserializeAws_json1_1InvalidParameterException = (output, context) => {
703
+ return {
704
+ message: expectString(output.message)
705
+ };
706
+ };
707
+ var deserializeAws_json1_1LimitExceededException = (output, context) => {
708
+ return {
709
+ message: expectString(output.message)
710
+ };
711
+ };
712
+ var deserializeAws_json1_1NotAuthorizedException = (output, context) => {
713
+ return {
714
+ message: expectString(output.message)
715
+ };
716
+ };
717
+ var deserializeAws_json1_1ResourceConflictException = (output, context) => {
718
+ return {
719
+ message: expectString(output.message)
720
+ };
721
+ };
722
+ var deserializeAws_json1_1ResourceNotFoundException = (output, context) => {
723
+ return {
724
+ message: expectString(output.message)
725
+ };
726
+ };
727
+ var deserializeAws_json1_1TooManyRequestsException = (output, context) => {
728
+ return {
729
+ message: expectString(output.message)
730
+ };
731
+ };
732
+ var deserializeMetadata = (output) => ({
733
+ httpStatusCode: output.statusCode,
734
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
735
+ extendedRequestId: output.headers["x-amz-id-2"],
736
+ cfId: output.headers["x-amz-cf-id"]
737
+ });
738
+ var collectBody = (streamBody = new Uint8Array(), context) => {
739
+ if (streamBody instanceof Uint8Array) {
740
+ return Promise.resolve(streamBody);
741
+ }
742
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
743
+ };
744
+ var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
745
+ var buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
746
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
747
+ const contents = {
748
+ protocol,
749
+ hostname,
750
+ port,
751
+ method: "POST",
752
+ path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
753
+ headers
754
+ };
755
+ if (resolvedHostname !== void 0) {
756
+ contents.hostname = resolvedHostname;
757
+ }
758
+ if (body !== void 0) {
759
+ contents.body = body;
760
+ }
761
+ return new HttpRequest(contents);
762
+ };
763
+ var parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
764
+ if (encoded.length) {
765
+ return JSON.parse(encoded);
766
+ }
767
+ return {};
768
+ });
769
+ var parseErrorBody = async (errorBody, context) => {
770
+ const value = await parseBody(errorBody, context);
771
+ value.message = value.message ?? value.Message;
772
+ return value;
773
+ };
774
+ var loadRestJsonErrorCode = (output, data) => {
775
+ const findKey = (object, key) => Object.keys(object).find((k2) => k2.toLowerCase() === key.toLowerCase());
776
+ const sanitizeErrorCode = (rawValue) => {
777
+ let cleanValue = rawValue;
778
+ if (typeof cleanValue === "number") {
779
+ cleanValue = cleanValue.toString();
780
+ }
781
+ if (cleanValue.indexOf(",") >= 0) {
782
+ cleanValue = cleanValue.split(",")[0];
783
+ }
784
+ if (cleanValue.indexOf(":") >= 0) {
785
+ cleanValue = cleanValue.split(":")[0];
786
+ }
787
+ if (cleanValue.indexOf("#") >= 0) {
788
+ cleanValue = cleanValue.split("#")[1];
789
+ }
790
+ return cleanValue;
791
+ };
792
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
793
+ if (headerKey !== void 0) {
794
+ return sanitizeErrorCode(output.headers[headerKey]);
795
+ }
796
+ if (data.code !== void 0) {
797
+ return sanitizeErrorCode(data.code);
798
+ }
799
+ if (data["__type"] !== void 0) {
800
+ return sanitizeErrorCode(data["__type"]);
801
+ }
802
+ };
803
+
804
+ // ../../node_modules/@aws-sdk/client-cognito-identity/dist-es/commands/GetCredentialsForIdentityCommand.js
805
+ var GetCredentialsForIdentityCommand = class extends Command {
806
+ constructor(input) {
807
+ super();
808
+ this.input = input;
809
+ }
810
+ static getEndpointParameterInstructions() {
811
+ return {
812
+ UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
813
+ Endpoint: { type: "builtInParams", name: "endpoint" },
814
+ Region: { type: "builtInParams", name: "region" },
815
+ UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
816
+ };
817
+ }
818
+ resolveMiddleware(clientStack, configuration, options) {
819
+ this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
820
+ this.middlewareStack.use(getEndpointPlugin(configuration, GetCredentialsForIdentityCommand.getEndpointParameterInstructions()));
821
+ const stack = clientStack.concat(this.middlewareStack);
822
+ const { logger } = configuration;
823
+ const clientName = "CognitoIdentityClient";
824
+ const commandName = "GetCredentialsForIdentityCommand";
825
+ const handlerExecutionContext = {
826
+ logger,
827
+ clientName,
828
+ commandName,
829
+ inputFilterSensitiveLog: GetCredentialsForIdentityInputFilterSensitiveLog,
830
+ outputFilterSensitiveLog: GetCredentialsForIdentityResponseFilterSensitiveLog
831
+ };
832
+ const { requestHandler } = configuration;
833
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
834
+ }
835
+ serialize(input, context) {
836
+ return serializeAws_json1_1GetCredentialsForIdentityCommand(input, context);
837
+ }
838
+ deserialize(output, context) {
839
+ return deserializeAws_json1_1GetCredentialsForIdentityCommand(output, context);
840
+ }
841
+ };
842
+
843
+ // ../../node_modules/@aws-sdk/client-cognito-identity/dist-es/commands/GetIdCommand.js
844
+ var GetIdCommand = class extends Command {
845
+ constructor(input) {
846
+ super();
847
+ this.input = input;
848
+ }
849
+ static getEndpointParameterInstructions() {
850
+ return {
851
+ UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
852
+ Endpoint: { type: "builtInParams", name: "endpoint" },
853
+ Region: { type: "builtInParams", name: "region" },
854
+ UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
855
+ };
856
+ }
857
+ resolveMiddleware(clientStack, configuration, options) {
858
+ this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
859
+ this.middlewareStack.use(getEndpointPlugin(configuration, GetIdCommand.getEndpointParameterInstructions()));
860
+ const stack = clientStack.concat(this.middlewareStack);
861
+ const { logger } = configuration;
862
+ const clientName = "CognitoIdentityClient";
863
+ const commandName = "GetIdCommand";
864
+ const handlerExecutionContext = {
865
+ logger,
866
+ clientName,
867
+ commandName,
868
+ inputFilterSensitiveLog: GetIdInputFilterSensitiveLog,
869
+ outputFilterSensitiveLog: GetIdResponseFilterSensitiveLog
870
+ };
871
+ const { requestHandler } = configuration;
872
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
873
+ }
874
+ serialize(input, context) {
875
+ return serializeAws_json1_1GetIdCommand(input, context);
876
+ }
877
+ deserialize(output, context) {
878
+ return deserializeAws_json1_1GetIdCommand(output, context);
879
+ }
880
+ };
881
+
882
+ // ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/resolveLogins.js
883
+ function resolveLogins(logins) {
884
+ return Promise.all(Object.keys(logins).reduce((arr, name) => {
885
+ const tokenOrProvider = logins[name];
886
+ if (typeof tokenOrProvider === "string") {
887
+ arr.push([name, tokenOrProvider]);
888
+ } else {
889
+ arr.push(tokenOrProvider().then((token) => [name, token]));
890
+ }
891
+ return arr;
892
+ }, [])).then((resolvedPairs) => resolvedPairs.reduce((logins2, [key, value]) => {
893
+ logins2[key] = value;
894
+ return logins2;
895
+ }, {}));
896
+ }
897
+
898
+ // ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/fromCognitoIdentity.js
899
+ function fromCognitoIdentity(parameters) {
900
+ return async () => {
901
+ const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(), Expiration, SecretKey = throwOnMissingSecretKey(), SessionToken } = throwOnMissingCredentials() } = await parameters.client.send(new GetCredentialsForIdentityCommand({
902
+ CustomRoleArn: parameters.customRoleArn,
903
+ IdentityId: parameters.identityId,
904
+ Logins: parameters.logins ? await resolveLogins(parameters.logins) : void 0
905
+ }));
906
+ return {
907
+ identityId: parameters.identityId,
908
+ accessKeyId: AccessKeyId,
909
+ secretAccessKey: SecretKey,
910
+ sessionToken: SessionToken,
911
+ expiration: Expiration
912
+ };
913
+ };
914
+ }
915
+ function throwOnMissingAccessKeyId() {
916
+ throw new CredentialsProviderError("Response from Amazon Cognito contained no access key ID");
917
+ }
918
+ function throwOnMissingCredentials() {
919
+ throw new CredentialsProviderError("Response from Amazon Cognito contained no credentials");
920
+ }
921
+ function throwOnMissingSecretKey() {
922
+ throw new CredentialsProviderError("Response from Amazon Cognito contained no secret key");
923
+ }
924
+
925
+ // ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/IndexedDbStorage.js
926
+ var STORE_NAME = "IdentityIds";
927
+ var IndexedDbStorage = class {
928
+ constructor(dbName = "aws:cognito-identity-ids") {
929
+ this.dbName = dbName;
930
+ }
931
+ getItem(key) {
932
+ return this.withObjectStore("readonly", (store) => {
933
+ const req = store.get(key);
934
+ return new Promise((resolve) => {
935
+ req.onerror = () => resolve(null);
936
+ req.onsuccess = () => resolve(req.result ? req.result.value : null);
937
+ });
938
+ }).catch(() => null);
939
+ }
940
+ removeItem(key) {
941
+ return this.withObjectStore("readwrite", (store) => {
942
+ const req = store.delete(key);
943
+ return new Promise((resolve, reject) => {
944
+ req.onerror = () => reject(req.error);
945
+ req.onsuccess = () => resolve();
946
+ });
947
+ });
948
+ }
949
+ setItem(id, value) {
950
+ return this.withObjectStore("readwrite", (store) => {
951
+ const req = store.put({ id, value });
952
+ return new Promise((resolve, reject) => {
953
+ req.onerror = () => reject(req.error);
954
+ req.onsuccess = () => resolve();
955
+ });
956
+ });
957
+ }
958
+ getDb() {
959
+ const openDbRequest = self.indexedDB.open(this.dbName, 1);
960
+ return new Promise((resolve, reject) => {
961
+ openDbRequest.onsuccess = () => {
962
+ resolve(openDbRequest.result);
963
+ };
964
+ openDbRequest.onerror = () => {
965
+ reject(openDbRequest.error);
966
+ };
967
+ openDbRequest.onblocked = () => {
968
+ reject(new Error("Unable to access DB"));
969
+ };
970
+ openDbRequest.onupgradeneeded = () => {
971
+ const db = openDbRequest.result;
972
+ db.onerror = () => {
973
+ reject(new Error("Failed to create object store"));
974
+ };
975
+ db.createObjectStore(STORE_NAME, { keyPath: "id" });
976
+ };
977
+ });
978
+ }
979
+ withObjectStore(mode, action) {
980
+ return this.getDb().then((db) => {
981
+ const tx = db.transaction(STORE_NAME, mode);
982
+ tx.oncomplete = () => db.close();
983
+ return new Promise((resolve, reject) => {
984
+ tx.onerror = () => reject(tx.error);
985
+ resolve(action(tx.objectStore(STORE_NAME)));
986
+ }).catch((err) => {
987
+ db.close();
988
+ throw err;
989
+ });
990
+ });
991
+ }
992
+ };
993
+
994
+ // ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/InMemoryStorage.js
995
+ var InMemoryStorage = class {
996
+ constructor(store = {}) {
997
+ this.store = store;
998
+ }
999
+ getItem(key) {
1000
+ if (key in this.store) {
1001
+ return this.store[key];
1002
+ }
1003
+ return null;
1004
+ }
1005
+ removeItem(key) {
1006
+ delete this.store[key];
1007
+ }
1008
+ setItem(key, value) {
1009
+ this.store[key] = value;
1010
+ }
1011
+ };
1012
+
1013
+ // ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/localStorage.js
1014
+ var inMemoryStorage = new InMemoryStorage();
1015
+ function localStorage() {
1016
+ if (typeof self === "object" && self.indexedDB) {
1017
+ return new IndexedDbStorage();
1018
+ }
1019
+ if (typeof window === "object" && window.localStorage) {
1020
+ return window.localStorage;
1021
+ }
1022
+ return inMemoryStorage;
1023
+ }
1024
+
1025
+ // ../../node_modules/@aws-sdk/credential-provider-cognito-identity/dist-es/fromCognitoIdentityPool.js
1026
+ function fromCognitoIdentityPool({ accountId, cache = localStorage(), client, customRoleArn, identityPoolId, logins, userIdentifier = !logins || Object.keys(logins).length === 0 ? "ANONYMOUS" : void 0 }) {
1027
+ const cacheKey = userIdentifier ? `aws:cognito-identity-credentials:${identityPoolId}:${userIdentifier}` : void 0;
1028
+ let provider = async () => {
1029
+ let identityId = cacheKey && await cache.getItem(cacheKey);
1030
+ if (!identityId) {
1031
+ const { IdentityId = throwOnMissingId() } = await client.send(new GetIdCommand({
1032
+ AccountId: accountId,
1033
+ IdentityPoolId: identityPoolId,
1034
+ Logins: logins ? await resolveLogins(logins) : void 0
1035
+ }));
1036
+ identityId = IdentityId;
1037
+ if (cacheKey) {
1038
+ Promise.resolve(cache.setItem(cacheKey, identityId)).catch(() => {
1039
+ });
1040
+ }
1041
+ }
1042
+ provider = fromCognitoIdentity({
1043
+ client,
1044
+ customRoleArn,
1045
+ logins,
1046
+ identityId
1047
+ });
1048
+ return provider();
1049
+ };
1050
+ return () => provider().catch(async (err) => {
1051
+ if (cacheKey) {
1052
+ Promise.resolve(cache.removeItem(cacheKey)).catch(() => {
1053
+ });
1054
+ }
1055
+ throw err;
1056
+ });
1057
+ }
1058
+ function throwOnMissingId() {
1059
+ throw new CredentialsProviderError("Response from Amazon Cognito contained no identity ID");
1060
+ }
1061
+
1062
+ // ../../node_modules/@aws-sdk/credential-providers/dist-es/fromCognitoIdentity.js
1063
+ var fromCognitoIdentity2 = (options) => fromCognitoIdentity({
1064
+ ...options,
1065
+ client: new CognitoIdentityClient(options.clientConfig ?? {})
1066
+ });
1067
+
1068
+ // ../../node_modules/@aws-sdk/credential-providers/dist-es/fromCognitoIdentityPool.js
1069
+ var fromCognitoIdentityPool2 = (options) => fromCognitoIdentityPool({
1070
+ ...options,
1071
+ client: new CognitoIdentityClient(options.clientConfig ?? {})
1072
+ });
1073
+
1074
+ // ../../node_modules/@aws-sdk/credential-providers/dist-es/fromContainerMetadata.js
1075
+ var fromContainerMetadata2 = (init) => fromContainerMetadata(init);
1076
+
1077
+ // ../../node_modules/@aws-sdk/credential-providers/dist-es/fromEnv.js
1078
+ var fromEnv2 = () => fromEnv();
1079
+
1080
+ // ../../node_modules/@aws-sdk/credential-providers/dist-es/fromIni.js
1081
+ var fromIni2 = (init = {}) => fromIni({
1082
+ ...init,
1083
+ roleAssumer: init.roleAssumer ?? getDefaultRoleAssumer(init.clientConfig, init.clientPlugins),
1084
+ roleAssumerWithWebIdentity: init.roleAssumerWithWebIdentity ?? getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins)
1085
+ });
1086
+
1087
+ // ../../node_modules/@aws-sdk/credential-providers/dist-es/fromInstanceMetadata.js
1088
+ var fromInstanceMetadata2 = (init) => fromInstanceMetadata(init);
1089
+
1090
+ // ../../node_modules/@aws-sdk/credential-providers/dist-es/fromNodeProviderChain.js
1091
+ var fromNodeProviderChain = (init = {}) => defaultProvider({
1092
+ ...init,
1093
+ roleAssumer: init.roleAssumer ?? getDefaultRoleAssumer(init.clientConfig, init.clientPlugins),
1094
+ roleAssumerWithWebIdentity: init.roleAssumerWithWebIdentity ?? getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins)
1095
+ });
1096
+
1097
+ // ../../node_modules/@aws-sdk/credential-providers/dist-es/fromProcess.js
1098
+ var fromProcess2 = (init) => fromProcess(init);
1099
+
1100
+ // ../../node_modules/@aws-sdk/credential-providers/dist-es/fromSSO.js
1101
+ var fromSSO2 = (init = {}) => fromSSO({ ...{ ssoClient: init.clientConfig ? new SSOClient(init.clientConfig) : void 0 }, ...init });
1102
+
1103
+ // ../../node_modules/@aws-sdk/credential-providers/dist-es/fromTemporaryCredentials.js
1104
+ var fromTemporaryCredentials = (options) => {
1105
+ let stsClient;
1106
+ return async () => {
1107
+ const params = { ...options.params, RoleSessionName: options.params.RoleSessionName ?? "aws-sdk-js-" + Date.now() };
1108
+ if (params?.SerialNumber) {
1109
+ if (!options.mfaCodeProvider) {
1110
+ throw new CredentialsProviderError(`Temporary credential requires multi-factor authentication, but no MFA code callback was provided.`, false);
1111
+ }
1112
+ params.TokenCode = await options.mfaCodeProvider(params?.SerialNumber);
1113
+ }
1114
+ if (!stsClient)
1115
+ stsClient = new STSClient({ ...options.clientConfig, credentials: options.masterCredentials });
1116
+ if (options.clientPlugins) {
1117
+ for (const plugin of options.clientPlugins) {
1118
+ stsClient.middlewareStack.use(plugin);
1119
+ }
1120
+ }
1121
+ const { Credentials } = await stsClient.send(new AssumeRoleCommand(params));
1122
+ if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
1123
+ throw new CredentialsProviderError(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`);
1124
+ }
1125
+ return {
1126
+ accessKeyId: Credentials.AccessKeyId,
1127
+ secretAccessKey: Credentials.SecretAccessKey,
1128
+ sessionToken: Credentials.SessionToken,
1129
+ expiration: Credentials.Expiration
1130
+ };
1131
+ };
1132
+ };
1133
+
1134
+ // ../../node_modules/@aws-sdk/credential-providers/dist-es/fromTokenFile.js
1135
+ var fromTokenFile2 = (init = {}) => fromTokenFile({
1136
+ ...init,
1137
+ roleAssumerWithWebIdentity: init.roleAssumerWithWebIdentity ?? getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins)
1138
+ });
1139
+
1140
+ // ../../node_modules/@aws-sdk/credential-providers/dist-es/fromWebToken.js
1141
+ var fromWebToken2 = (init) => fromWebToken({
1142
+ ...init,
1143
+ roleAssumerWithWebIdentity: init.roleAssumerWithWebIdentity ?? getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins)
1144
+ });
1145
+ export {
1146
+ fromCognitoIdentity2 as fromCognitoIdentity,
1147
+ fromCognitoIdentityPool2 as fromCognitoIdentityPool,
1148
+ fromContainerMetadata2 as fromContainerMetadata,
1149
+ fromEnv2 as fromEnv,
1150
+ fromIni2 as fromIni,
1151
+ fromInstanceMetadata2 as fromInstanceMetadata,
1152
+ fromNodeProviderChain,
1153
+ fromProcess2 as fromProcess,
1154
+ fromSSO2 as fromSSO,
1155
+ fromTemporaryCredentials,
1156
+ fromTokenFile2 as fromTokenFile,
1157
+ fromWebToken2 as fromWebToken
1158
+ };