@digipair/skill-s3 0.136.1 → 0.136.4

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.
@@ -1,34 +1,30 @@
1
- import { i as NODE_REGION_CONFIG_FILE_OPTIONS, d as NODE_REGION_CONFIG_OPTIONS, a as awsEndpointFunctions, r as resolveDefaultsModeConfig, N as NODE_APP_ID_CONFIG_OPTIONS, b as NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, c as NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, H as Hash, e as NODE_MAX_ATTEMPT_CONFIG_OPTIONS, f as createDefaultUserAgentProvider, g as calculateBodyLength, h as NODE_RETRY_MODE_CONFIG_OPTIONS, D as DEFAULT_RETRY_MODE, p as packageInfo, j as getAwsRegionExtensionConfiguration, k as resolveAwsRegionExtensionConfiguration, l as resolveUserAgentConfig, m as resolveRetryConfig, n as resolveRegionConfig, o as resolveEndpointConfig, s as getUserAgentPlugin, t as getRetryPlugin, u as getContentLengthPlugin, v as getHostHeaderPlugin, w as getLoggerPlugin, x as getRecursionDetectionPlugin, q as resolveHostHeaderConfig, y as getEndpointPlugin, z as createAggregatedClient } from './index.esm14.js';
2
- import { aM as HttpProtocol, aw as NormalizedSchema, H as HttpRequest, j as collectBody, J as toBase64, aF as v4, az as determineTimestampFormat, aE as dateToUtcString, v as extendedEncodeURIComponent, aD as SerdeContextConfig, av as NumericValue, aG as ProtocolLib, aN as XmlShapeDeserializer, aO as deref, aK as TypeRegistry, n as loadConfig, x as resolveAwsSdkSigV4Config, y as normalizeProvider, z as getSmithyContext, A as EndpointCache, B as resolveEndpoint, F as customEndpointFunctions, ao as ServiceException, t as toUtf8, h as fromUtf8, p as parseUrl, N as NoOpLogger, G as AwsSdkSigV4Signer, K as fromBase64, L as emitWarningIfUnsupportedVersion, O as emitWarningIfUnsupportedVersion$1, T as streamCollector, V as NodeHttpHandler, _ as NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, $ as loadConfigsForDefaultMode, a4 as getDefaultExtensionConfiguration, a5 as getHttpHandlerExtensionConfiguration, a7 as resolveDefaultRuntimeConfig, a8 as resolveHttpHandlerRuntimeConfig, aL as getSchemaSerdePlugin, ak as getHttpAuthSchemeEndpointRuleSetPlugin, al as getHttpSigningPlugin, am as Client, an as DefaultIdentityProviderConfig, as as Command, s as setCredentialFeature } from './index.esm3.js';
3
- import { N as NoAuthSigner } from './noAuth.esm.js';
4
- import 'stream';
5
- import 'os';
6
- import 'process';
7
- import 'buffer';
1
+ import { g as getSSOTokenFilepath, a as getSSOTokenFromFile } from './getSSOTokenFromFile.esm.js';
2
+ import { T as TokenProviderError, l as loadSsoSessionData } from './loadSsoSessionData.esm.js';
3
+ import { promises } from 'fs';
4
+ import { p as parseKnownFiles } from './parseKnownFiles.esm.js';
5
+ import { g as getProfileName, C as CredentialsProviderError, s as setCredentialFeature } from './index.esm2.js';
6
+ import 'fs/promises';
8
7
  import 'crypto';
9
- import 'node:fs';
10
8
  import 'path';
9
+ import 'buffer';
10
+ import 'os';
11
11
  import 'node:fs/promises';
12
+ import 'stream';
12
13
  import 'node:stream';
13
14
  import 'http';
14
15
  import 'https';
16
+ import 'process';
17
+ import 'node:fs';
15
18
  import 'zlib';
16
19
 
17
- function _array_like_to_array$3(arr, len) {
18
- if (len == null || len > arr.length) len = arr.length;
19
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
20
- return arr2;
21
- }
22
- function _array_with_holes$3(arr) {
23
- if (Array.isArray(arr)) return arr;
24
- }
25
- function _assert_this_initialized$9(self) {
26
- if (self === void 0) {
27
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
28
- }
29
- return self;
30
- }
31
- function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
20
+ var isSsoProfile = function(arg) {
21
+ return arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string");
22
+ };
23
+
24
+ var EXPIRE_WINDOW_MS = 5 * 60 * 1000;
25
+ var REFRESH_MESSAGE = "To refresh this SSO session run 'aws sso login' with the corresponding profile.";
26
+
27
+ function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
32
28
  try {
33
29
  var info = gen[key](arg);
34
30
  var value = info.value;
@@ -42,166 +38,22 @@ function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
42
38
  Promise.resolve(value).then(_next, _throw);
43
39
  }
44
40
  }
45
- function _async_to_generator$7(fn) {
41
+ function _async_to_generator$4(fn) {
46
42
  return function() {
47
43
  var self = this, args = arguments;
48
44
  return new Promise(function(resolve, reject) {
49
45
  var gen = fn.apply(self, args);
50
46
  function _next(value) {
51
- asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "next", value);
47
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
52
48
  }
53
49
  function _throw(err) {
54
- asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "throw", err);
50
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
55
51
  }
56
52
  _next(undefined);
57
53
  });
58
54
  };
59
55
  }
60
- function _class_call_check$9(instance, Constructor) {
61
- if (!(instance instanceof Constructor)) {
62
- throw new TypeError("Cannot call a class as a function");
63
- }
64
- }
65
- function _defineProperties$3(target, props) {
66
- for(var i = 0; i < props.length; i++){
67
- var descriptor = props[i];
68
- descriptor.enumerable = descriptor.enumerable || false;
69
- descriptor.configurable = true;
70
- if ("value" in descriptor) descriptor.writable = true;
71
- Object.defineProperty(target, descriptor.key, descriptor);
72
- }
73
- }
74
- function _create_class$3(Constructor, protoProps, staticProps) {
75
- if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
76
- return Constructor;
77
- }
78
- function _define_property$a(obj, key, value) {
79
- if (key in obj) {
80
- Object.defineProperty(obj, key, {
81
- value: value,
82
- enumerable: true,
83
- configurable: true,
84
- writable: true
85
- });
86
- } else {
87
- obj[key] = value;
88
- }
89
- return obj;
90
- }
91
- function _get_prototype_of$9(o) {
92
- _get_prototype_of$9 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
93
- return o.__proto__ || Object.getPrototypeOf(o);
94
- };
95
- return _get_prototype_of$9(o);
96
- }
97
- function _inherits$9(subClass, superClass) {
98
- if (typeof superClass !== "function" && superClass !== null) {
99
- throw new TypeError("Super expression must either be null or a function");
100
- }
101
- subClass.prototype = Object.create(superClass && superClass.prototype, {
102
- constructor: {
103
- value: subClass,
104
- writable: true,
105
- configurable: true
106
- }
107
- });
108
- if (superClass) _set_prototype_of$9(subClass, superClass);
109
- }
110
- function _iterable_to_array_limit$3(arr, i) {
111
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
112
- if (_i == null) return;
113
- var _arr = [];
114
- var _n = true;
115
- var _d = false;
116
- var _s, _e;
117
- try {
118
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
119
- _arr.push(_s.value);
120
- if (i && _arr.length === i) break;
121
- }
122
- } catch (err) {
123
- _d = true;
124
- _e = err;
125
- } finally{
126
- try {
127
- if (!_n && _i["return"] != null) _i["return"]();
128
- } finally{
129
- if (_d) throw _e;
130
- }
131
- }
132
- return _arr;
133
- }
134
- function _non_iterable_rest$3() {
135
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
136
- }
137
- function _object_spread$6(target) {
138
- for(var i = 1; i < arguments.length; i++){
139
- var source = arguments[i] != null ? arguments[i] : {};
140
- var ownKeys = Object.keys(source);
141
- if (typeof Object.getOwnPropertySymbols === "function") {
142
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
143
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
144
- }));
145
- }
146
- ownKeys.forEach(function(key) {
147
- _define_property$a(target, key, source[key]);
148
- });
149
- }
150
- return target;
151
- }
152
- function _possible_constructor_return$9(self, call) {
153
- if (call && (_type_of$9(call) === "object" || typeof call === "function")) {
154
- return call;
155
- }
156
- return _assert_this_initialized$9(self);
157
- }
158
- function _set_prototype_of$9(o, p) {
159
- _set_prototype_of$9 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
160
- o.__proto__ = p;
161
- return o;
162
- };
163
- return _set_prototype_of$9(o, p);
164
- }
165
- function _sliced_to_array$3(arr, i) {
166
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
167
- }
168
- function _type_of$9(obj) {
169
- "@swc/helpers - typeof";
170
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
171
- }
172
- function _unsupported_iterable_to_array$3(o, minLen) {
173
- if (!o) return;
174
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
175
- var n = Object.prototype.toString.call(o).slice(8, -1);
176
- if (n === "Object" && o.constructor) n = o.constructor.name;
177
- if (n === "Map" || n === "Set") return Array.from(n);
178
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
179
- }
180
- function _is_native_reflect_construct$9() {
181
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
182
- if (Reflect.construct.sham) return false;
183
- if (typeof Proxy === "function") return true;
184
- try {
185
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
186
- return true;
187
- } catch (e) {
188
- return false;
189
- }
190
- }
191
- function _create_super$9(Derived) {
192
- var hasNativeReflectConstruct = _is_native_reflect_construct$9();
193
- return function _createSuperInternal() {
194
- var Super = _get_prototype_of$9(Derived), result;
195
- if (hasNativeReflectConstruct) {
196
- var NewTarget = _get_prototype_of$9(this).constructor;
197
- result = Reflect.construct(Super, arguments, NewTarget);
198
- } else {
199
- result = Super.apply(this, arguments);
200
- }
201
- return _possible_constructor_return$9(this, result);
202
- };
203
- }
204
- function _ts_generator$7(thisArg, body) {
56
+ function _ts_generator$4(thisArg, body) {
205
57
  var f, y, t, g, _ = {
206
58
  label: 0,
207
59
  sent: function() {
@@ -296,640 +148,43 @@ function _ts_generator$7(thisArg, body) {
296
148
  };
297
149
  }
298
150
  }
299
- var RpcProtocol = /*#__PURE__*/ function(HttpProtocol) {
300
- _inherits$9(RpcProtocol, HttpProtocol);
301
- var _super = _create_super$9(RpcProtocol);
302
- function RpcProtocol() {
303
- _class_call_check$9(this, RpcProtocol);
304
- return _super.apply(this, arguments);
305
- }
306
- _create_class$3(RpcProtocol, [
307
- {
308
- key: "serializeRequest",
309
- value: function serializeRequest(operationSchema, input, context) {
310
- var _this = this;
311
- return _async_to_generator$7(function() {
312
- var serializer, query, headers, endpoint, ns, schema, payload, request, _input, eventStreamMember, initialRequest, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, memberName, memberSchema;
313
- return _ts_generator$7(this, function(_state) {
314
- switch(_state.label){
315
- case 0:
316
- serializer = _this.serializer;
317
- query = {};
318
- headers = {};
319
- return [
320
- 4,
321
- context.endpoint()
322
- ];
323
- case 1:
324
- endpoint = _state.sent();
325
- ns = NormalizedSchema.of(operationSchema === null || operationSchema === void 0 ? void 0 : operationSchema.input);
326
- schema = ns.getSchema();
327
- request = new HttpRequest({
328
- protocol: "",
329
- hostname: "",
330
- port: undefined,
331
- path: "/",
332
- fragment: undefined,
333
- query: query,
334
- headers: headers,
335
- body: undefined
336
- });
337
- if (endpoint) {
338
- _this.updateServiceEndpoint(request, endpoint);
339
- _this.setHostPrefix(request, operationSchema, input);
340
- }
341
- _input = _object_spread$6({}, input);
342
- if (!input) return [
343
- 3,
344
- 5
345
- ];
346
- eventStreamMember = ns.getEventStreamMember();
347
- if (!eventStreamMember) return [
348
- 3,
349
- 4
350
- ];
351
- if (!_input[eventStreamMember]) return [
352
- 3,
353
- 3
354
- ];
355
- initialRequest = {};
356
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
357
- try {
358
- for(_iterator = ns.structIterator()[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
359
- _step_value = _sliced_to_array$3(_step.value, 2), memberName = _step_value[0], memberSchema = _step_value[1];
360
- if (memberName !== eventStreamMember && _input[memberName]) {
361
- serializer.write(memberSchema, _input[memberName]);
362
- initialRequest[memberName] = serializer.flush();
363
- }
364
- }
365
- } catch (err) {
366
- _didIteratorError = true;
367
- _iteratorError = err;
368
- } finally{
369
- try {
370
- if (!_iteratorNormalCompletion && _iterator.return != null) {
371
- _iterator.return();
372
- }
373
- } finally{
374
- if (_didIteratorError) {
375
- throw _iteratorError;
376
- }
377
- }
378
- }
379
- return [
380
- 4,
381
- _this.serializeEventStream({
382
- eventStream: _input[eventStreamMember],
383
- requestSchema: ns,
384
- initialRequest: initialRequest
385
- })
386
- ];
387
- case 2:
388
- payload = _state.sent();
389
- _state.label = 3;
390
- case 3:
391
- return [
392
- 3,
393
- 5
394
- ];
395
- case 4:
396
- serializer.write(schema, _input);
397
- payload = serializer.flush();
398
- _state.label = 5;
399
- case 5:
400
- request.headers = headers;
401
- request.query = query;
402
- request.body = payload;
403
- request.method = "POST";
404
- return [
405
- 2,
406
- request
407
- ];
408
- }
409
- });
410
- })();
411
- }
412
- },
413
- {
414
- key: "deserializeResponse",
415
- value: function deserializeResponse(operationSchema, context, response) {
416
- var _this = this;
417
- return _async_to_generator$7(function() {
418
- var deserializer, ns, dataObject, bytes, _, _tmp, value, eventStreamMember, bytes1, _1, _tmp1;
419
- return _ts_generator$7(this, function(_state) {
420
- switch(_state.label){
421
- case 0:
422
- deserializer = _this.deserializer;
423
- ns = NormalizedSchema.of(operationSchema.output);
424
- dataObject = {};
425
- if (!(response.statusCode >= 300)) return [
426
- 3,
427
- 5
428
- ];
429
- return [
430
- 4,
431
- collectBody(response.body, context)
432
- ];
433
- case 1:
434
- bytes = _state.sent();
435
- if (!(bytes.byteLength > 0)) return [
436
- 3,
437
- 3
438
- ];
439
- _ = Object.assign;
440
- _tmp = [
441
- dataObject
442
- ];
443
- return [
444
- 4,
445
- deserializer.read(15, bytes)
446
- ];
447
- case 2:
448
- _.apply(Object, _tmp.concat([
449
- _state.sent()
450
- ]));
451
- _state.label = 3;
452
- case 3:
453
- return [
454
- 4,
455
- _this.handleError(operationSchema, context, response, dataObject, _this.deserializeMetadata(response))
456
- ];
457
- case 4:
458
- _state.sent();
459
- throw new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.");
460
- case 5:
461
- for(var header in response.headers){
462
- value = response.headers[header];
463
- delete response.headers[header];
464
- response.headers[header.toLowerCase()] = value;
465
- }
466
- eventStreamMember = ns.getEventStreamMember();
467
- if (!eventStreamMember) return [
468
- 3,
469
- 7
470
- ];
471
- return [
472
- 4,
473
- _this.deserializeEventStream({
474
- response: response,
475
- responseSchema: ns,
476
- initialResponseContainer: dataObject
477
- })
478
- ];
479
- case 6:
480
- dataObject[eventStreamMember] = _state.sent();
481
- return [
482
- 3,
483
- 10
484
- ];
485
- case 7:
486
- return [
487
- 4,
488
- collectBody(response.body, context)
489
- ];
490
- case 8:
491
- bytes1 = _state.sent();
492
- if (!(bytes1.byteLength > 0)) return [
493
- 3,
494
- 10
495
- ];
496
- _1 = Object.assign;
497
- _tmp1 = [
498
- dataObject
499
- ];
500
- return [
501
- 4,
502
- deserializer.read(ns, bytes1)
503
- ];
504
- case 9:
505
- _1.apply(Object, _tmp1.concat([
506
- _state.sent()
507
- ]));
508
- _state.label = 10;
509
- case 10:
510
- dataObject.$metadata = _this.deserializeMetadata(response);
511
- return [
512
- 2,
513
- dataObject
514
- ];
515
- }
516
- });
517
- })();
151
+ var getSsoOidcClient = function() {
152
+ var _ref = _async_to_generator$4(function(ssoRegion) {
153
+ var init, callerClientConfig, _init_clientConfig, SSOOIDCClient, coalesce, _init_clientConfig1, ssoOidcClient;
154
+ var _arguments = arguments;
155
+ return _ts_generator$4(this, function(_state) {
156
+ switch(_state.label){
157
+ case 0:
158
+ init = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, callerClientConfig = _arguments.length > 2 ? _arguments[2] : void 0;
159
+ return [
160
+ 4,
161
+ import('./index.esm11.js')
162
+ ];
163
+ case 1:
164
+ SSOOIDCClient = _state.sent().SSOOIDCClient;
165
+ coalesce = function(prop) {
166
+ var _init_clientConfig, _init_parentClientConfig;
167
+ var _init_clientConfig_prop, _ref;
168
+ return (_ref = (_init_clientConfig_prop = (_init_clientConfig = init.clientConfig) === null || _init_clientConfig === void 0 ? void 0 : _init_clientConfig[prop]) !== null && _init_clientConfig_prop !== void 0 ? _init_clientConfig_prop : (_init_parentClientConfig = init.parentClientConfig) === null || _init_parentClientConfig === void 0 ? void 0 : _init_parentClientConfig[prop]) !== null && _ref !== void 0 ? _ref : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig[prop];
169
+ };
170
+ ssoOidcClient = new SSOOIDCClient(Object.assign({}, (_init_clientConfig1 = init.clientConfig) !== null && _init_clientConfig1 !== void 0 ? _init_clientConfig1 : {}, {
171
+ region: ssoRegion !== null && ssoRegion !== void 0 ? ssoRegion : (_init_clientConfig = init.clientConfig) === null || _init_clientConfig === void 0 ? void 0 : _init_clientConfig.region,
172
+ logger: coalesce("logger"),
173
+ userAgentAppId: coalesce("userAgentAppId")
174
+ }));
175
+ return [
176
+ 2,
177
+ ssoOidcClient
178
+ ];
518
179
  }
519
- }
520
- ]);
521
- return RpcProtocol;
522
- }(HttpProtocol);
523
-
524
- function _array_like_to_array$2(arr, len) {
525
- if (len == null || len > arr.length) len = arr.length;
526
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
527
- return arr2;
528
- }
529
- function _array_with_holes$2(arr) {
530
- if (Array.isArray(arr)) return arr;
531
- }
532
- function _assert_this_initialized$8(self) {
533
- if (self === void 0) {
534
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
535
- }
536
- return self;
537
- }
538
- function _class_call_check$8(instance, Constructor) {
539
- if (!(instance instanceof Constructor)) {
540
- throw new TypeError("Cannot call a class as a function");
541
- }
542
- }
543
- function _defineProperties$2(target, props) {
544
- for(var i = 0; i < props.length; i++){
545
- var descriptor = props[i];
546
- descriptor.enumerable = descriptor.enumerable || false;
547
- descriptor.configurable = true;
548
- if ("value" in descriptor) descriptor.writable = true;
549
- Object.defineProperty(target, descriptor.key, descriptor);
550
- }
551
- }
552
- function _create_class$2(Constructor, protoProps, staticProps) {
553
- if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
554
- return Constructor;
555
- }
556
- function _define_property$9(obj, key, value) {
557
- if (key in obj) {
558
- Object.defineProperty(obj, key, {
559
- value: value,
560
- enumerable: true,
561
- configurable: true,
562
- writable: true
563
180
  });
564
- } else {
565
- obj[key] = value;
566
- }
567
- return obj;
568
- }
569
- function _get_prototype_of$8(o) {
570
- _get_prototype_of$8 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
571
- return o.__proto__ || Object.getPrototypeOf(o);
572
- };
573
- return _get_prototype_of$8(o);
574
- }
575
- function _inherits$8(subClass, superClass) {
576
- if (typeof superClass !== "function" && superClass !== null) {
577
- throw new TypeError("Super expression must either be null or a function");
578
- }
579
- subClass.prototype = Object.create(superClass && superClass.prototype, {
580
- constructor: {
581
- value: subClass,
582
- writable: true,
583
- configurable: true
584
- }
585
181
  });
586
- if (superClass) _set_prototype_of$8(subClass, superClass);
587
- }
588
- function _instanceof(left, right) {
589
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
590
- return !!right[Symbol.hasInstance](left);
591
- } else {
592
- return left instanceof right;
593
- }
594
- }
595
- function _iterable_to_array_limit$2(arr, i) {
596
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
597
- if (_i == null) return;
598
- var _arr = [];
599
- var _n = true;
600
- var _d = false;
601
- var _s, _e;
602
- try {
603
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
604
- _arr.push(_s.value);
605
- if (i && _arr.length === i) break;
606
- }
607
- } catch (err) {
608
- _d = true;
609
- _e = err;
610
- } finally{
611
- try {
612
- if (!_n && _i["return"] != null) _i["return"]();
613
- } finally{
614
- if (_d) throw _e;
615
- }
616
- }
617
- return _arr;
618
- }
619
- function _non_iterable_rest$2() {
620
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
621
- }
622
- function _possible_constructor_return$8(self, call) {
623
- if (call && (_type_of$8(call) === "object" || typeof call === "function")) {
624
- return call;
625
- }
626
- return _assert_this_initialized$8(self);
627
- }
628
- function _set_prototype_of$8(o, p) {
629
- _set_prototype_of$8 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
630
- o.__proto__ = p;
631
- return o;
632
- };
633
- return _set_prototype_of$8(o, p);
634
- }
635
- function _sliced_to_array$2(arr, i) {
636
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
637
- }
638
- function _type_of$8(obj) {
639
- "@swc/helpers - typeof";
640
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
641
- }
642
- function _unsupported_iterable_to_array$2(o, minLen) {
643
- if (!o) return;
644
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
645
- var n = Object.prototype.toString.call(o).slice(8, -1);
646
- if (n === "Object" && o.constructor) n = o.constructor.name;
647
- if (n === "Map" || n === "Set") return Array.from(n);
648
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
649
- }
650
- function _is_native_reflect_construct$8() {
651
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
652
- if (Reflect.construct.sham) return false;
653
- if (typeof Proxy === "function") return true;
654
- try {
655
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
656
- return true;
657
- } catch (e) {
658
- return false;
659
- }
660
- }
661
- function _create_super$8(Derived) {
662
- var hasNativeReflectConstruct = _is_native_reflect_construct$8();
663
- return function _createSuperInternal() {
664
- var Super = _get_prototype_of$8(Derived), result;
665
- if (hasNativeReflectConstruct) {
666
- var NewTarget = _get_prototype_of$8(this).constructor;
667
- result = Reflect.construct(Super, arguments, NewTarget);
668
- } else {
669
- result = Super.apply(this, arguments);
670
- }
671
- return _possible_constructor_return$8(this, result);
182
+ return function getSsoOidcClient(ssoRegion) {
183
+ return _ref.apply(this, arguments);
672
184
  };
673
- }
674
- var QueryShapeSerializer = /*#__PURE__*/ function(SerdeContextConfig) {
675
- _inherits$8(QueryShapeSerializer, SerdeContextConfig);
676
- var _super = _create_super$8(QueryShapeSerializer);
677
- function QueryShapeSerializer(settings) {
678
- _class_call_check$8(this, QueryShapeSerializer);
679
- var _this;
680
- _this = _super.call(this);
681
- _define_property$9(_assert_this_initialized$8(_this), "settings", void 0);
682
- _define_property$9(_assert_this_initialized$8(_this), "buffer", void 0);
683
- _this.settings = settings;
684
- return _this;
685
- }
686
- _create_class$2(QueryShapeSerializer, [
687
- {
688
- key: "write",
689
- value: function write(schema, value) {
690
- var prefix = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
691
- if (this.buffer === undefined) {
692
- this.buffer = "";
693
- }
694
- var ns = NormalizedSchema.of(schema);
695
- if (prefix && !prefix.endsWith(".")) {
696
- prefix += ".";
697
- }
698
- if (ns.isBlobSchema()) {
699
- if (typeof value === "string" || _instanceof(value, Uint8Array)) {
700
- var _this_serdeContext;
701
- this.writeKey(prefix);
702
- var _this_serdeContext_base64Encoder;
703
- this.writeValue(((_this_serdeContext_base64Encoder = (_this_serdeContext = this.serdeContext) === null || _this_serdeContext === void 0 ? void 0 : _this_serdeContext.base64Encoder) !== null && _this_serdeContext_base64Encoder !== void 0 ? _this_serdeContext_base64Encoder : toBase64)(value));
704
- }
705
- } else if (ns.isBooleanSchema() || ns.isNumericSchema() || ns.isStringSchema()) {
706
- if (value != null) {
707
- this.writeKey(prefix);
708
- this.writeValue(String(value));
709
- } else if (ns.isIdempotencyToken()) {
710
- this.writeKey(prefix);
711
- this.writeValue(v4());
712
- }
713
- } else if (ns.isBigIntegerSchema()) {
714
- if (value != null) {
715
- this.writeKey(prefix);
716
- this.writeValue(String(value));
717
- }
718
- } else if (ns.isBigDecimalSchema()) {
719
- if (value != null) {
720
- this.writeKey(prefix);
721
- this.writeValue(_instanceof(value, NumericValue) ? value.string : String(value));
722
- }
723
- } else if (ns.isTimestampSchema()) {
724
- if (_instanceof(value, Date)) {
725
- this.writeKey(prefix);
726
- var format = determineTimestampFormat(ns, this.settings);
727
- switch(format){
728
- case 5:
729
- this.writeValue(value.toISOString().replace(".000Z", "Z"));
730
- break;
731
- case 6:
732
- this.writeValue(dateToUtcString(value));
733
- break;
734
- case 7:
735
- this.writeValue(String(value.getTime() / 1000));
736
- break;
737
- }
738
- }
739
- } else if (ns.isDocumentSchema()) {
740
- if (Array.isArray(value)) {
741
- this.write(64 | 15, value, prefix);
742
- } else if (_instanceof(value, Date)) {
743
- this.write(4, value, prefix);
744
- } else if (_instanceof(value, Uint8Array)) {
745
- this.write(21, value, prefix);
746
- } else if (value && (typeof value === "undefined" ? "undefined" : _type_of$8(value)) === "object") {
747
- this.write(128 | 15, value, prefix);
748
- } else {
749
- this.writeKey(prefix);
750
- this.writeValue(String(value));
751
- }
752
- } else if (ns.isListSchema()) {
753
- if (Array.isArray(value)) {
754
- if (value.length === 0) {
755
- if (this.settings.serializeEmptyLists) {
756
- this.writeKey(prefix);
757
- this.writeValue("");
758
- }
759
- } else {
760
- var member = ns.getValueSchema();
761
- var flat = this.settings.flattenLists || ns.getMergedTraits().xmlFlattened;
762
- var i = 1;
763
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
764
- try {
765
- for(var _iterator = value[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
766
- var item = _step.value;
767
- if (item == null) {
768
- continue;
769
- }
770
- var traits = member.getMergedTraits();
771
- var suffix = this.getKey("member", traits.xmlName, traits.ec2QueryName);
772
- var key = flat ? "".concat(prefix).concat(i) : "".concat(prefix).concat(suffix, ".").concat(i);
773
- this.write(member, item, key);
774
- ++i;
775
- }
776
- } catch (err) {
777
- _didIteratorError = true;
778
- _iteratorError = err;
779
- } finally{
780
- try {
781
- if (!_iteratorNormalCompletion && _iterator.return != null) {
782
- _iterator.return();
783
- }
784
- } finally{
785
- if (_didIteratorError) {
786
- throw _iteratorError;
787
- }
788
- }
789
- }
790
- }
791
- }
792
- } else if (ns.isMapSchema()) {
793
- if (value && (typeof value === "undefined" ? "undefined" : _type_of$8(value)) === "object") {
794
- var keySchema = ns.getKeySchema();
795
- var memberSchema = ns.getValueSchema();
796
- var flat1 = ns.getMergedTraits().xmlFlattened;
797
- var i1 = 1;
798
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
799
- try {
800
- for(var _iterator1 = Object.entries(value)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
801
- var _step_value = _sliced_to_array$2(_step1.value, 2), k = _step_value[0], v = _step_value[1];
802
- if (v == null) {
803
- continue;
804
- }
805
- var keyTraits = keySchema.getMergedTraits();
806
- var keySuffix = this.getKey("key", keyTraits.xmlName, keyTraits.ec2QueryName);
807
- var key1 = flat1 ? "".concat(prefix).concat(i1, ".").concat(keySuffix) : "".concat(prefix, "entry.").concat(i1, ".").concat(keySuffix);
808
- var valTraits = memberSchema.getMergedTraits();
809
- var valueSuffix = this.getKey("value", valTraits.xmlName, valTraits.ec2QueryName);
810
- var valueKey = flat1 ? "".concat(prefix).concat(i1, ".").concat(valueSuffix) : "".concat(prefix, "entry.").concat(i1, ".").concat(valueSuffix);
811
- this.write(keySchema, k, key1);
812
- this.write(memberSchema, v, valueKey);
813
- ++i1;
814
- }
815
- } catch (err) {
816
- _didIteratorError1 = true;
817
- _iteratorError1 = err;
818
- } finally{
819
- try {
820
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
821
- _iterator1.return();
822
- }
823
- } finally{
824
- if (_didIteratorError1) {
825
- throw _iteratorError1;
826
- }
827
- }
828
- }
829
- }
830
- } else if (ns.isStructSchema()) {
831
- if (value && (typeof value === "undefined" ? "undefined" : _type_of$8(value)) === "object") {
832
- var didWriteMember = false;
833
- var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
834
- try {
835
- for(var _iterator2 = ns.structIterator()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
836
- var _step_value1 = _sliced_to_array$2(_step2.value, 2), memberName = _step_value1[0], member1 = _step_value1[1];
837
- if (value[memberName] == null && !member1.isIdempotencyToken()) {
838
- continue;
839
- }
840
- var traits1 = member1.getMergedTraits();
841
- var suffix1 = this.getKey(memberName, traits1.xmlName, traits1.ec2QueryName, "struct");
842
- var key2 = "".concat(prefix).concat(suffix1);
843
- this.write(member1, value[memberName], key2);
844
- didWriteMember = true;
845
- }
846
- } catch (err) {
847
- _didIteratorError2 = true;
848
- _iteratorError2 = err;
849
- } finally{
850
- try {
851
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
852
- _iterator2.return();
853
- }
854
- } finally{
855
- if (_didIteratorError2) {
856
- throw _iteratorError2;
857
- }
858
- }
859
- }
860
- if (!didWriteMember && ns.isUnionSchema()) {
861
- var $unknown = value.$unknown;
862
- if (Array.isArray($unknown)) {
863
- var _$unknown = _sliced_to_array$2($unknown, 2), k1 = _$unknown[0], v1 = _$unknown[1];
864
- var key3 = "".concat(prefix).concat(k1);
865
- this.write(15, v1, key3);
866
- }
867
- }
868
- }
869
- } else if (ns.isUnitSchema()) ; else {
870
- throw new Error("@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ".concat(ns.getName(true)));
871
- }
872
- }
873
- },
874
- {
875
- key: "flush",
876
- value: function flush() {
877
- if (this.buffer === undefined) {
878
- throw new Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.");
879
- }
880
- var str = this.buffer;
881
- delete this.buffer;
882
- return str;
883
- }
884
- },
885
- {
886
- key: "getKey",
887
- value: function getKey(memberName, xmlName, ec2QueryName, keySource) {
888
- var _this_settings = this.settings, ec2 = _this_settings.ec2, capitalizeKeys = _this_settings.capitalizeKeys;
889
- if (ec2 && ec2QueryName) {
890
- return ec2QueryName;
891
- }
892
- var key = xmlName !== null && xmlName !== void 0 ? xmlName : memberName;
893
- if (capitalizeKeys && keySource === "struct") {
894
- return key[0].toUpperCase() + key.slice(1);
895
- }
896
- return key;
897
- }
898
- },
899
- {
900
- key: "writeKey",
901
- value: function writeKey(key) {
902
- if (key.endsWith(".")) {
903
- key = key.slice(0, key.length - 1);
904
- }
905
- this.buffer += "&".concat(extendedEncodeURIComponent(key), "=");
906
- }
907
- },
908
- {
909
- key: "writeValue",
910
- value: function writeValue(value) {
911
- this.buffer += extendedEncodeURIComponent(value);
912
- }
913
- }
914
- ]);
915
- return QueryShapeSerializer;
916
- }(SerdeContextConfig);
185
+ }();
917
186
 
918
- function _array_like_to_array$1(arr, len) {
919
- if (len == null || len > arr.length) len = arr.length;
920
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
921
- return arr2;
922
- }
923
- function _array_with_holes$1(arr) {
924
- if (Array.isArray(arr)) return arr;
925
- }
926
- function _assert_this_initialized$7(self) {
927
- if (self === void 0) {
928
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
929
- }
930
- return self;
931
- }
932
- function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
187
+ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
933
188
  try {
934
189
  var info = gen[key](arg);
935
190
  var value = info.value;
@@ -943,189 +198,22 @@ function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
943
198
  Promise.resolve(value).then(_next, _throw);
944
199
  }
945
200
  }
946
- function _async_to_generator$6(fn) {
201
+ function _async_to_generator$3(fn) {
947
202
  return function() {
948
203
  var self = this, args = arguments;
949
204
  return new Promise(function(resolve, reject) {
950
205
  var gen = fn.apply(self, args);
951
206
  function _next(value) {
952
- asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "next", value);
207
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
953
208
  }
954
209
  function _throw(err) {
955
- asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "throw", err);
210
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
956
211
  }
957
212
  _next(undefined);
958
213
  });
959
214
  };
960
215
  }
961
- function _class_call_check$7(instance, Constructor) {
962
- if (!(instance instanceof Constructor)) {
963
- throw new TypeError("Cannot call a class as a function");
964
- }
965
- }
966
- function _defineProperties$1(target, props) {
967
- for(var i = 0; i < props.length; i++){
968
- var descriptor = props[i];
969
- descriptor.enumerable = descriptor.enumerable || false;
970
- descriptor.configurable = true;
971
- if ("value" in descriptor) descriptor.writable = true;
972
- Object.defineProperty(target, descriptor.key, descriptor);
973
- }
974
- }
975
- function _create_class$1(Constructor, protoProps, staticProps) {
976
- if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
977
- return Constructor;
978
- }
979
- function _define_property$8(obj, key, value) {
980
- if (key in obj) {
981
- Object.defineProperty(obj, key, {
982
- value: value,
983
- enumerable: true,
984
- configurable: true,
985
- writable: true
986
- });
987
- } else {
988
- obj[key] = value;
989
- }
990
- return obj;
991
- }
992
- function _get$1(target, property, receiver) {
993
- if (typeof Reflect !== "undefined" && Reflect.get) {
994
- _get$1 = Reflect.get;
995
- } else {
996
- _get$1 = function get(target, property, receiver) {
997
- var base = _super_prop_base$1(target, property);
998
- if (!base) return;
999
- var desc = Object.getOwnPropertyDescriptor(base, property);
1000
- if (desc.get) {
1001
- return desc.get.call(receiver || target);
1002
- }
1003
- return desc.value;
1004
- };
1005
- }
1006
- return _get$1(target, property, receiver || target);
1007
- }
1008
- function _get_prototype_of$7(o) {
1009
- _get_prototype_of$7 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1010
- return o.__proto__ || Object.getPrototypeOf(o);
1011
- };
1012
- return _get_prototype_of$7(o);
1013
- }
1014
- function _inherits$7(subClass, superClass) {
1015
- if (typeof superClass !== "function" && superClass !== null) {
1016
- throw new TypeError("Super expression must either be null or a function");
1017
- }
1018
- subClass.prototype = Object.create(superClass && superClass.prototype, {
1019
- constructor: {
1020
- value: subClass,
1021
- writable: true,
1022
- configurable: true
1023
- }
1024
- });
1025
- if (superClass) _set_prototype_of$7(subClass, superClass);
1026
- }
1027
- function _iterable_to_array_limit$1(arr, i) {
1028
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1029
- if (_i == null) return;
1030
- var _arr = [];
1031
- var _n = true;
1032
- var _d = false;
1033
- var _s, _e;
1034
- try {
1035
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1036
- _arr.push(_s.value);
1037
- if (i && _arr.length === i) break;
1038
- }
1039
- } catch (err) {
1040
- _d = true;
1041
- _e = err;
1042
- } finally{
1043
- try {
1044
- if (!_n && _i["return"] != null) _i["return"]();
1045
- } finally{
1046
- if (_d) throw _e;
1047
- }
1048
- }
1049
- return _arr;
1050
- }
1051
- function _non_iterable_rest$1() {
1052
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1053
- }
1054
- function _object_spread$5(target) {
1055
- for(var i = 1; i < arguments.length; i++){
1056
- var source = arguments[i] != null ? arguments[i] : {};
1057
- var ownKeys = Object.keys(source);
1058
- if (typeof Object.getOwnPropertySymbols === "function") {
1059
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1060
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1061
- }));
1062
- }
1063
- ownKeys.forEach(function(key) {
1064
- _define_property$8(target, key, source[key]);
1065
- });
1066
- }
1067
- return target;
1068
- }
1069
- function _possible_constructor_return$7(self, call) {
1070
- if (call && (_type_of$7(call) === "object" || typeof call === "function")) {
1071
- return call;
1072
- }
1073
- return _assert_this_initialized$7(self);
1074
- }
1075
- function _set_prototype_of$7(o, p) {
1076
- _set_prototype_of$7 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1077
- o.__proto__ = p;
1078
- return o;
1079
- };
1080
- return _set_prototype_of$7(o, p);
1081
- }
1082
- function _sliced_to_array$1(arr, i) {
1083
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
1084
- }
1085
- function _super_prop_base$1(object, property) {
1086
- while(!Object.prototype.hasOwnProperty.call(object, property)){
1087
- object = _get_prototype_of$7(object);
1088
- if (object === null) break;
1089
- }
1090
- return object;
1091
- }
1092
- function _type_of$7(obj) {
1093
- "@swc/helpers - typeof";
1094
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1095
- }
1096
- function _unsupported_iterable_to_array$1(o, minLen) {
1097
- if (!o) return;
1098
- if (typeof o === "string") return _array_like_to_array$1(o, minLen);
1099
- var n = Object.prototype.toString.call(o).slice(8, -1);
1100
- if (n === "Object" && o.constructor) n = o.constructor.name;
1101
- if (n === "Map" || n === "Set") return Array.from(n);
1102
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
1103
- }
1104
- function _is_native_reflect_construct$7() {
1105
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
1106
- if (Reflect.construct.sham) return false;
1107
- if (typeof Proxy === "function") return true;
1108
- try {
1109
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1110
- return true;
1111
- } catch (e) {
1112
- return false;
1113
- }
1114
- }
1115
- function _create_super$7(Derived) {
1116
- var hasNativeReflectConstruct = _is_native_reflect_construct$7();
1117
- return function _createSuperInternal() {
1118
- var Super = _get_prototype_of$7(Derived), result;
1119
- if (hasNativeReflectConstruct) {
1120
- var NewTarget = _get_prototype_of$7(this).constructor;
1121
- result = Reflect.construct(Super, arguments, NewTarget);
1122
- } else {
1123
- result = Super.apply(this, arguments);
1124
- }
1125
- return _possible_constructor_return$7(this, result);
1126
- };
1127
- }
1128
- function _ts_generator$6(thisArg, body) {
216
+ function _ts_generator$3(thisArg, body) {
1129
217
  var f, y, t, g, _ = {
1130
218
  label: 0,
1131
219
  sent: function() {
@@ -1220,298 +308,64 @@ function _ts_generator$6(thisArg, body) {
1220
308
  };
1221
309
  }
1222
310
  }
1223
- var AwsQueryProtocol = /*#__PURE__*/ function(RpcProtocol) {
1224
- _inherits$7(AwsQueryProtocol, RpcProtocol);
1225
- var _super = _create_super$7(AwsQueryProtocol);
1226
- function AwsQueryProtocol(options) {
1227
- _class_call_check$7(this, AwsQueryProtocol);
1228
- var _this;
1229
- _this = _super.call(this, {
1230
- defaultNamespace: options.defaultNamespace
1231
- });
1232
- _define_property$8(_assert_this_initialized$7(_this), "options", void 0);
1233
- _define_property$8(_assert_this_initialized$7(_this), "serializer", void 0);
1234
- _define_property$8(_assert_this_initialized$7(_this), "deserializer", void 0);
1235
- _define_property$8(_assert_this_initialized$7(_this), "mixin", new ProtocolLib());
1236
- _this.options = options;
1237
- var settings = {
1238
- timestampFormat: {
1239
- useTrait: true,
1240
- default: 5
1241
- },
1242
- httpBindings: false,
1243
- xmlNamespace: options.xmlNamespace,
1244
- serviceNamespace: options.defaultNamespace,
1245
- serializeEmptyLists: true
1246
- };
1247
- _this.serializer = new QueryShapeSerializer(settings);
1248
- _this.deserializer = new XmlShapeDeserializer(settings);
1249
- return _this;
1250
- }
1251
- _create_class$1(AwsQueryProtocol, [
1252
- {
1253
- key: "getShapeId",
1254
- value: function getShapeId() {
1255
- return "aws.protocols#awsQuery";
1256
- }
1257
- },
1258
- {
1259
- key: "setSerdeContext",
1260
- value: function setSerdeContext(serdeContext) {
1261
- this.serializer.setSerdeContext(serdeContext);
1262
- this.deserializer.setSerdeContext(serdeContext);
1263
- }
1264
- },
1265
- {
1266
- key: "getPayloadCodec",
1267
- value: function getPayloadCodec() {
1268
- throw new Error("AWSQuery protocol has no payload codec.");
1269
- }
1270
- },
1271
- {
1272
- key: "serializeRequest",
1273
- value: function serializeRequest(operationSchema, input, context) {
1274
- var _this = this;
1275
- var _this1 = this, _superprop_get_serializeRequest = function() {
1276
- return _get$1(_get_prototype_of$7(AwsQueryProtocol.prototype), "serializeRequest", _this);
1277
- };
1278
- return _async_to_generator$6(function() {
1279
- var request, _operationSchema_name_split_, action;
1280
- return _ts_generator$6(this, function(_state) {
1281
- switch(_state.label){
1282
- case 0:
1283
- return [
1284
- 4,
1285
- _superprop_get_serializeRequest().call(_this1, operationSchema, input, context)
1286
- ];
1287
- case 1:
1288
- request = _state.sent();
1289
- if (!request.path.endsWith("/")) {
1290
- request.path += "/";
1291
- }
1292
- Object.assign(request.headers, {
1293
- "content-type": "application/x-www-form-urlencoded"
1294
- });
1295
- if (deref(operationSchema.input) === "unit" || !request.body) {
1296
- request.body = "";
1297
- }
1298
- action = (_operationSchema_name_split_ = operationSchema.name.split("#")[1]) !== null && _operationSchema_name_split_ !== void 0 ? _operationSchema_name_split_ : operationSchema.name;
1299
- request.body = "Action=".concat(action, "&Version=").concat(_this1.options.version) + request.body;
1300
- if (request.body.endsWith("&")) {
1301
- request.body = request.body.slice(-1);
1302
- }
1303
- return [
1304
- 2,
1305
- request
1306
- ];
1307
- }
1308
- });
1309
- })();
1310
- }
1311
- },
1312
- {
1313
- key: "deserializeResponse",
1314
- value: function deserializeResponse(operationSchema, context, response) {
1315
- var _this = this;
1316
- return _async_to_generator$6(function() {
1317
- var deserializer, ns, dataObject, bytes, _, _tmp, value, _operationSchema_name_split_, shortName, awsQueryResultKey, bytes1, _1, _tmp1, output;
1318
- return _ts_generator$6(this, function(_state) {
1319
- switch(_state.label){
1320
- case 0:
1321
- deserializer = _this.deserializer;
1322
- ns = NormalizedSchema.of(operationSchema.output);
1323
- dataObject = {};
1324
- if (!(response.statusCode >= 300)) return [
1325
- 3,
1326
- 5
1327
- ];
1328
- return [
1329
- 4,
1330
- collectBody(response.body, context)
1331
- ];
1332
- case 1:
1333
- bytes = _state.sent();
1334
- if (!(bytes.byteLength > 0)) return [
1335
- 3,
1336
- 3
1337
- ];
1338
- _ = Object.assign;
1339
- _tmp = [
1340
- dataObject
1341
- ];
1342
- return [
1343
- 4,
1344
- deserializer.read(15, bytes)
1345
- ];
1346
- case 2:
1347
- _.apply(Object, _tmp.concat([
1348
- _state.sent()
1349
- ]));
1350
- _state.label = 3;
1351
- case 3:
1352
- return [
1353
- 4,
1354
- _this.handleError(operationSchema, context, response, dataObject, _this.deserializeMetadata(response))
1355
- ];
1356
- case 4:
1357
- _state.sent();
1358
- _state.label = 5;
1359
- case 5:
1360
- for(var header in response.headers){
1361
- value = response.headers[header];
1362
- delete response.headers[header];
1363
- response.headers[header.toLowerCase()] = value;
1364
- }
1365
- shortName = (_operationSchema_name_split_ = operationSchema.name.split("#")[1]) !== null && _operationSchema_name_split_ !== void 0 ? _operationSchema_name_split_ : operationSchema.name;
1366
- awsQueryResultKey = ns.isStructSchema() && _this.useNestedResult() ? shortName + "Result" : undefined;
1367
- return [
1368
- 4,
1369
- collectBody(response.body, context)
1370
- ];
1371
- case 6:
1372
- bytes1 = _state.sent();
1373
- if (!(bytes1.byteLength > 0)) return [
1374
- 3,
1375
- 8
1376
- ];
1377
- _1 = Object.assign;
1378
- _tmp1 = [
1379
- dataObject
1380
- ];
1381
- return [
1382
- 4,
1383
- deserializer.read(ns, bytes1, awsQueryResultKey)
1384
- ];
1385
- case 7:
1386
- _1.apply(Object, _tmp1.concat([
1387
- _state.sent()
1388
- ]));
1389
- _state.label = 8;
1390
- case 8:
1391
- output = _object_spread$5({
1392
- $metadata: _this.deserializeMetadata(response)
1393
- }, dataObject);
1394
- return [
1395
- 2,
1396
- output
1397
- ];
1398
- }
1399
- });
1400
- })();
1401
- }
1402
- },
1403
- {
1404
- key: "useNestedResult",
1405
- value: function useNestedResult() {
1406
- return true;
1407
- }
1408
- },
1409
- {
1410
- key: "handleError",
1411
- value: function handleError(operationSchema, context, response, dataObject, metadata) {
1412
- var _this = this;
1413
- return _async_to_generator$6(function() {
1414
- var _this_loadQueryErrorCode, errorIdentifier, errorData, message, _ref, errorSchema, errorMetadata, ns, _TypeRegistry_for_getErrorCtor, ErrorCtor, exception, output, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, member, _member_getMergedTraits_xmlName, target, _errorData_target, value;
1415
- return _ts_generator$6(this, function(_state) {
1416
- switch(_state.label){
1417
- case 0:
1418
- errorIdentifier = (_this_loadQueryErrorCode = _this.loadQueryErrorCode(response, dataObject)) !== null && _this_loadQueryErrorCode !== void 0 ? _this_loadQueryErrorCode : "Unknown";
1419
- errorData = _this.loadQueryError(dataObject);
1420
- message = _this.loadQueryErrorMessage(dataObject);
1421
- errorData.message = message;
1422
- errorData.Error = {
1423
- Type: errorData.Type,
1424
- Code: errorData.Code,
1425
- Message: message
1426
- };
1427
- return [
1428
- 4,
1429
- _this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, _this.options.defaultNamespace, response, errorData, metadata, _this.mixin.findQueryCompatibleError)
1430
- ];
1431
- case 1:
1432
- _ref = _state.sent(), errorSchema = _ref.errorSchema, errorMetadata = _ref.errorMetadata;
1433
- ns = NormalizedSchema.of(errorSchema);
1434
- ErrorCtor = (_TypeRegistry_for_getErrorCtor = TypeRegistry.for(errorSchema[1]).getErrorCtor(errorSchema)) !== null && _TypeRegistry_for_getErrorCtor !== void 0 ? _TypeRegistry_for_getErrorCtor : Error;
1435
- exception = new ErrorCtor(message);
1436
- output = {
1437
- Type: errorData.Error.Type,
1438
- Code: errorData.Error.Code,
1439
- Error: errorData.Error
1440
- };
1441
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1442
- try {
1443
- for(_iterator = ns.structIterator()[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1444
- _step_value = _sliced_to_array$1(_step.value, 2), name = _step_value[0], member = _step_value[1];
1445
- ;
1446
- target = (_member_getMergedTraits_xmlName = member.getMergedTraits().xmlName) !== null && _member_getMergedTraits_xmlName !== void 0 ? _member_getMergedTraits_xmlName : name;
1447
- ;
1448
- value = (_errorData_target = errorData[target]) !== null && _errorData_target !== void 0 ? _errorData_target : dataObject[target];
1449
- output[name] = _this.deserializer.readSchema(member, value);
1450
- }
1451
- } catch (err) {
1452
- _didIteratorError = true;
1453
- _iteratorError = err;
1454
- } finally{
1455
- try {
1456
- if (!_iteratorNormalCompletion && _iterator.return != null) {
1457
- _iterator.return();
1458
- }
1459
- } finally{
1460
- if (_didIteratorError) {
1461
- throw _iteratorError;
1462
- }
1463
- }
1464
- }
1465
- throw _this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
1466
- $fault: ns.getMergedTraits().error,
1467
- message: message
1468
- }, output), dataObject);
1469
- }
1470
- });
1471
- })();
1472
- }
1473
- },
1474
- {
1475
- key: "loadQueryErrorCode",
1476
- value: function loadQueryErrorCode(output, data) {
1477
- var _this, _data_Errors_, _data_Errors, _data_Errors1;
1478
- var _data_Errors__Error, _ref;
1479
- var code = (_this = (_ref = (_data_Errors__Error = (_data_Errors = data.Errors) === null || _data_Errors === void 0 ? void 0 : (_data_Errors_ = _data_Errors[0]) === null || _data_Errors_ === void 0 ? void 0 : _data_Errors_.Error) !== null && _data_Errors__Error !== void 0 ? _data_Errors__Error : (_data_Errors1 = data.Errors) === null || _data_Errors1 === void 0 ? void 0 : _data_Errors1.Error) !== null && _ref !== void 0 ? _ref : data.Error) === null || _this === void 0 ? void 0 : _this.Code;
1480
- if (code !== undefined) {
1481
- return code;
1482
- }
1483
- if (output.statusCode == 404) {
1484
- return "NotFound";
1485
- }
1486
- }
1487
- },
1488
- {
1489
- key: "loadQueryError",
1490
- value: function loadQueryError(data) {
1491
- var _data_Errors_, _data_Errors, _data_Errors1;
1492
- var _data_Errors__Error, _ref;
1493
- return (_ref = (_data_Errors__Error = (_data_Errors = data.Errors) === null || _data_Errors === void 0 ? void 0 : (_data_Errors_ = _data_Errors[0]) === null || _data_Errors_ === void 0 ? void 0 : _data_Errors_.Error) !== null && _data_Errors__Error !== void 0 ? _data_Errors__Error : (_data_Errors1 = data.Errors) === null || _data_Errors1 === void 0 ? void 0 : _data_Errors1.Error) !== null && _ref !== void 0 ? _ref : data.Error;
1494
- }
1495
- },
1496
- {
1497
- key: "loadQueryErrorMessage",
1498
- value: function loadQueryErrorMessage(data) {
1499
- var errorData = this.loadQueryError(data);
1500
- var _errorData_message, _ref, _ref1, _ref2;
1501
- return (_ref2 = (_ref1 = (_ref = (_errorData_message = errorData === null || errorData === void 0 ? void 0 : errorData.message) !== null && _errorData_message !== void 0 ? _errorData_message : errorData === null || errorData === void 0 ? void 0 : errorData.Message) !== null && _ref !== void 0 ? _ref : data.message) !== null && _ref1 !== void 0 ? _ref1 : data.Message) !== null && _ref2 !== void 0 ? _ref2 : "Unknown";
1502
- }
1503
- },
1504
- {
1505
- key: "getDefaultContentType",
1506
- value: function getDefaultContentType() {
1507
- return "application/x-www-form-urlencoded";
311
+ var getNewSsoOidcToken = function() {
312
+ var _ref = _async_to_generator$3(function(ssoToken, ssoRegion) {
313
+ var init, callerClientConfig, CreateTokenCommand, ssoOidcClient;
314
+ var _arguments = arguments;
315
+ return _ts_generator$3(this, function(_state) {
316
+ switch(_state.label){
317
+ case 0:
318
+ init = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {}, callerClientConfig = _arguments.length > 3 ? _arguments[3] : void 0;
319
+ return [
320
+ 4,
321
+ import('./index.esm11.js')
322
+ ];
323
+ case 1:
324
+ CreateTokenCommand = _state.sent().CreateTokenCommand;
325
+ return [
326
+ 4,
327
+ getSsoOidcClient(ssoRegion, init, callerClientConfig)
328
+ ];
329
+ case 2:
330
+ ssoOidcClient = _state.sent();
331
+ return [
332
+ 2,
333
+ ssoOidcClient.send(new CreateTokenCommand({
334
+ clientId: ssoToken.clientId,
335
+ clientSecret: ssoToken.clientSecret,
336
+ refreshToken: ssoToken.refreshToken,
337
+ grantType: "refresh_token"
338
+ }))
339
+ ];
1508
340
  }
1509
- }
1510
- ]);
1511
- return AwsQueryProtocol;
1512
- }(RpcProtocol);
341
+ });
342
+ });
343
+ return function getNewSsoOidcToken(ssoToken, ssoRegion) {
344
+ return _ref.apply(this, arguments);
345
+ };
346
+ }();
347
+
348
+ var validateTokenExpiry = function(token) {
349
+ if (token.expiration && token.expiration.getTime() < Date.now()) {
350
+ throw new TokenProviderError("Token is expired. ".concat(REFRESH_MESSAGE), false);
351
+ }
352
+ };
353
+
354
+ var validateTokenKey = function(key, value) {
355
+ var forRefresh = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
356
+ if (typeof value === "undefined") {
357
+ throw new TokenProviderError("Value not present for '".concat(key, "' in SSO Token").concat(forRefresh ? ". Cannot refresh" : "", ". ").concat(REFRESH_MESSAGE), false);
358
+ }
359
+ };
360
+
361
+ var writeFile = promises.writeFile;
362
+ var writeSSOTokenToFile = function(id, ssoToken) {
363
+ var tokenFilepath = getSSOTokenFilepath(id);
364
+ var tokenString = JSON.stringify(ssoToken, null, 2);
365
+ return writeFile(tokenFilepath, tokenString);
366
+ };
1513
367
 
1514
- function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
368
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
1515
369
  try {
1516
370
  var info = gen[key](arg);
1517
371
  var value = info.value;
@@ -1525,22 +379,22 @@ function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
1525
379
  Promise.resolve(value).then(_next, _throw);
1526
380
  }
1527
381
  }
1528
- function _async_to_generator$5(fn) {
382
+ function _async_to_generator$2(fn) {
1529
383
  return function() {
1530
384
  var self = this, args = arguments;
1531
385
  return new Promise(function(resolve, reject) {
1532
386
  var gen = fn.apply(self, args);
1533
387
  function _next(value) {
1534
- asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
388
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
1535
389
  }
1536
390
  function _throw(err) {
1537
- asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
391
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
1538
392
  }
1539
393
  _next(undefined);
1540
394
  });
1541
395
  };
1542
396
  }
1543
- function _define_property$7(obj, key, value) {
397
+ function _define_property$1(obj, key, value) {
1544
398
  if (key in obj) {
1545
399
  Object.defineProperty(obj, key, {
1546
400
  value: value,
@@ -1553,7 +407,7 @@ function _define_property$7(obj, key, value) {
1553
407
  }
1554
408
  return obj;
1555
409
  }
1556
- function _object_spread$4(target) {
410
+ function _object_spread$1(target) {
1557
411
  for(var i = 1; i < arguments.length; i++){
1558
412
  var source = arguments[i] != null ? arguments[i] : {};
1559
413
  var ownKeys = Object.keys(source);
@@ -1563,12 +417,12 @@ function _object_spread$4(target) {
1563
417
  }));
1564
418
  }
1565
419
  ownKeys.forEach(function(key) {
1566
- _define_property$7(target, key, source[key]);
420
+ _define_property$1(target, key, source[key]);
1567
421
  });
1568
422
  }
1569
423
  return target;
1570
424
  }
1571
- function ownKeys$2(object, enumerableOnly) {
425
+ function ownKeys(object, enumerableOnly) {
1572
426
  var keys = Object.keys(object);
1573
427
  if (Object.getOwnPropertySymbols) {
1574
428
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1576,18 +430,18 @@ function ownKeys$2(object, enumerableOnly) {
1576
430
  }
1577
431
  return keys;
1578
432
  }
1579
- function _object_spread_props$2(target, source) {
433
+ function _object_spread_props(target, source) {
1580
434
  source = source != null ? source : {};
1581
435
  if (Object.getOwnPropertyDescriptors) {
1582
436
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1583
437
  } else {
1584
- ownKeys$2(Object(source)).forEach(function(key) {
438
+ ownKeys(Object(source)).forEach(function(key) {
1585
439
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1586
440
  });
1587
441
  }
1588
442
  return target;
1589
443
  }
1590
- function _ts_generator$5(thisArg, body) {
444
+ function _ts_generator$2(thisArg, body) {
1591
445
  var f, y, t, g, _ = {
1592
446
  label: 0,
1593
447
  sent: function() {
@@ -1682,26 +536,170 @@ function _ts_generator$5(thisArg, body) {
1682
536
  };
1683
537
  }
1684
538
  }
1685
- function stsRegionDefaultResolver() {
1686
- var loaderConfig = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1687
- return loadConfig(_object_spread_props$2(_object_spread$4({}, NODE_REGION_CONFIG_OPTIONS), {
1688
- default: function _default() {
1689
- return _async_to_generator$5(function() {
1690
- return _ts_generator$5(this, function(_state) {
1691
- {
1692
- console.warn("@aws-sdk - WARN - default STS region of us-east-1 used. See @aws-sdk/credential-providers README and set a region explicitly.");
539
+ var lastRefreshAttemptTime = new Date(0);
540
+ var fromSso = function() {
541
+ var init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
542
+ return /*#__PURE__*/ _async_to_generator$2(function() {
543
+ var callerClientConfig, _init_logger, profiles, _init_profile, profileName, profile, ssoSessionName, ssoSessions, ssoSession, _i, _iter, ssoSessionRequiredKey, ssoRegion, ssoToken, accessToken, expiresAt, existingToken, newSsoOidcToken, newTokenExpiration;
544
+ var _arguments = arguments;
545
+ return _ts_generator$2(this, function(_state) {
546
+ switch(_state.label){
547
+ case 0:
548
+ callerClientConfig = (_arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}).callerClientConfig;
549
+ (_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : _init_logger.debug("@aws-sdk/token-providers - fromSso");
550
+ return [
551
+ 4,
552
+ parseKnownFiles(init)
553
+ ];
554
+ case 1:
555
+ profiles = _state.sent();
556
+ profileName = getProfileName({
557
+ profile: (_init_profile = init.profile) !== null && _init_profile !== void 0 ? _init_profile : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.profile
558
+ });
559
+ profile = profiles[profileName];
560
+ if (!profile) {
561
+ throw new TokenProviderError("Profile '".concat(profileName, "' could not be found in shared credentials file."), false);
562
+ } else if (!profile["sso_session"]) {
563
+ throw new TokenProviderError("Profile '".concat(profileName, "' is missing required property 'sso_session'."));
564
+ }
565
+ ssoSessionName = profile["sso_session"];
566
+ return [
567
+ 4,
568
+ loadSsoSessionData(init)
569
+ ];
570
+ case 2:
571
+ ssoSessions = _state.sent();
572
+ ssoSession = ssoSessions[ssoSessionName];
573
+ if (!ssoSession) {
574
+ throw new TokenProviderError("Sso session '".concat(ssoSessionName, "' could not be found in shared credentials file."), false);
575
+ }
576
+ for(_i = 0, _iter = [
577
+ "sso_start_url",
578
+ "sso_region"
579
+ ]; _i < _iter.length; _i++){
580
+ ssoSessionRequiredKey = _iter[_i];
581
+ if (!ssoSession[ssoSessionRequiredKey]) {
582
+ throw new TokenProviderError("Sso session '".concat(ssoSessionName, "' is missing required property '").concat(ssoSessionRequiredKey, "'."), false);
583
+ }
584
+ }
585
+ ssoSession["sso_start_url"];
586
+ ssoRegion = ssoSession["sso_region"];
587
+ _state.label = 3;
588
+ case 3:
589
+ _state.trys.push([
590
+ 3,
591
+ 5,
592
+ ,
593
+ 6
594
+ ]);
595
+ return [
596
+ 4,
597
+ getSSOTokenFromFile(ssoSessionName)
598
+ ];
599
+ case 4:
600
+ ssoToken = _state.sent();
601
+ return [
602
+ 3,
603
+ 6
604
+ ];
605
+ case 5:
606
+ _state.sent();
607
+ throw new TokenProviderError("The SSO session token associated with profile=".concat(profileName, " was not found or is invalid. ").concat(REFRESH_MESSAGE), false);
608
+ case 6:
609
+ validateTokenKey("accessToken", ssoToken.accessToken);
610
+ validateTokenKey("expiresAt", ssoToken.expiresAt);
611
+ accessToken = ssoToken.accessToken, expiresAt = ssoToken.expiresAt;
612
+ existingToken = {
613
+ token: accessToken,
614
+ expiration: new Date(expiresAt)
615
+ };
616
+ if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
617
+ return [
618
+ 2,
619
+ existingToken
620
+ ];
621
+ }
622
+ if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1000) {
623
+ validateTokenExpiry(existingToken);
624
+ return [
625
+ 2,
626
+ existingToken
627
+ ];
1693
628
  }
629
+ validateTokenKey("clientId", ssoToken.clientId, true);
630
+ validateTokenKey("clientSecret", ssoToken.clientSecret, true);
631
+ validateTokenKey("refreshToken", ssoToken.refreshToken, true);
632
+ _state.label = 7;
633
+ case 7:
634
+ _state.trys.push([
635
+ 7,
636
+ 13,
637
+ ,
638
+ 14
639
+ ]);
640
+ lastRefreshAttemptTime.setTime(Date.now());
641
+ return [
642
+ 4,
643
+ getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig)
644
+ ];
645
+ case 8:
646
+ newSsoOidcToken = _state.sent();
647
+ validateTokenKey("accessToken", newSsoOidcToken.accessToken);
648
+ validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
649
+ newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
650
+ _state.label = 9;
651
+ case 9:
652
+ _state.trys.push([
653
+ 9,
654
+ 11,
655
+ ,
656
+ 12
657
+ ]);
658
+ return [
659
+ 4,
660
+ writeSSOTokenToFile(ssoSessionName, _object_spread_props(_object_spread$1({}, ssoToken), {
661
+ accessToken: newSsoOidcToken.accessToken,
662
+ expiresAt: newTokenExpiration.toISOString(),
663
+ refreshToken: newSsoOidcToken.refreshToken
664
+ }))
665
+ ];
666
+ case 10:
667
+ _state.sent();
668
+ return [
669
+ 3,
670
+ 12
671
+ ];
672
+ case 11:
673
+ _state.sent();
674
+ return [
675
+ 3,
676
+ 12
677
+ ];
678
+ case 12:
1694
679
  return [
1695
680
  2,
1696
- "us-east-1"
681
+ {
682
+ token: newSsoOidcToken.accessToken,
683
+ expiration: newTokenExpiration
684
+ }
1697
685
  ];
1698
- });
1699
- })();
1700
- }
1701
- }), _object_spread$4({}, NODE_REGION_CONFIG_FILE_OPTIONS, loaderConfig));
1702
- }
686
+ case 13:
687
+ _state.sent();
688
+ validateTokenExpiry(existingToken);
689
+ return [
690
+ 2,
691
+ existingToken
692
+ ];
693
+ case 14:
694
+ return [
695
+ 2
696
+ ];
697
+ }
698
+ });
699
+ });
700
+ };
1703
701
 
1704
- function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
702
+ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
1705
703
  try {
1706
704
  var info = gen[key](arg);
1707
705
  var value = info.value;
@@ -1715,22 +713,50 @@ function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
1715
713
  Promise.resolve(value).then(_next, _throw);
1716
714
  }
1717
715
  }
1718
- function _async_to_generator$4(fn) {
716
+ function _async_to_generator$1(fn) {
1719
717
  return function() {
1720
718
  var self = this, args = arguments;
1721
719
  return new Promise(function(resolve, reject) {
1722
720
  var gen = fn.apply(self, args);
1723
721
  function _next(value) {
1724
- asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
722
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
1725
723
  }
1726
724
  function _throw(err) {
1727
- asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
725
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
1728
726
  }
1729
727
  _next(undefined);
1730
728
  });
1731
729
  };
1732
730
  }
1733
- function _ts_generator$4(thisArg, body) {
731
+ function _define_property(obj, key, value) {
732
+ if (key in obj) {
733
+ Object.defineProperty(obj, key, {
734
+ value: value,
735
+ enumerable: true,
736
+ configurable: true,
737
+ writable: true
738
+ });
739
+ } else {
740
+ obj[key] = value;
741
+ }
742
+ return obj;
743
+ }
744
+ function _object_spread(target) {
745
+ for(var i = 1; i < arguments.length; i++){
746
+ var source = arguments[i] != null ? arguments[i] : {};
747
+ var ownKeys = Object.keys(source);
748
+ if (typeof Object.getOwnPropertySymbols === "function") {
749
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
750
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
751
+ }));
752
+ }
753
+ ownKeys.forEach(function(key) {
754
+ _define_property(target, key, source[key]);
755
+ });
756
+ }
757
+ return target;
758
+ }
759
+ function _ts_generator$1(thisArg, body) {
1734
760
  var f, y, t, g, _ = {
1735
761
  label: 0,
1736
762
  sent: function() {
@@ -1825,2421 +851,194 @@ function _ts_generator$4(thisArg, body) {
1825
851
  };
1826
852
  }
1827
853
  }
1828
- var defaultSTSHttpAuthSchemeParametersProvider = function() {
1829
- var _ref = _async_to_generator$4(function(config, context, input) {
1830
- var _tmp;
1831
- return _ts_generator$4(this, function(_state) {
854
+ var SHOULD_FAIL_CREDENTIAL_CHAIN = false;
855
+ var resolveSSOCredentials = function() {
856
+ var _ref = _async_to_generator$1(function(param) {
857
+ var ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger, token, refreshMessage, _token, e, accessToken, _ref, SSOClient, GetRoleCredentialsCommand, _clientConfig_logger, _ref1, _clientConfig_region, _clientConfig_userAgentAppId, _ref2, sso, ssoResp, e2, tmp, _ref3, accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId, credentials;
858
+ return _ts_generator$1(this, function(_state) {
1832
859
  switch(_state.label){
1833
860
  case 0:
1834
- _tmp = {
1835
- operation: getSmithyContext(context).operation
861
+ ssoStartUrl = param.ssoStartUrl, ssoSession = param.ssoSession, ssoAccountId = param.ssoAccountId, ssoRegion = param.ssoRegion, ssoRoleName = param.ssoRoleName, ssoClient = param.ssoClient, clientConfig = param.clientConfig, parentClientConfig = param.parentClientConfig, callerClientConfig = param.callerClientConfig, profile = param.profile, filepath = param.filepath, configFilepath = param.configFilepath, ignoreCache = param.ignoreCache, logger = param.logger;
862
+ refreshMessage = "To refresh this SSO session run aws sso login with the corresponding profile.";
863
+ if (!ssoSession) return [
864
+ 3,
865
+ 5
866
+ ];
867
+ _state.label = 1;
868
+ case 1:
869
+ _state.trys.push([
870
+ 1,
871
+ 3,
872
+ ,
873
+ 4
874
+ ]);
875
+ return [
876
+ 4,
877
+ fromSso({
878
+ profile: profile,
879
+ filepath: filepath,
880
+ configFilepath: configFilepath,
881
+ ignoreCache: ignoreCache
882
+ })()
883
+ ];
884
+ case 2:
885
+ _token = _state.sent();
886
+ token = {
887
+ accessToken: _token.token,
888
+ expiresAt: new Date(_token.expiration).toISOString()
1836
889
  };
890
+ return [
891
+ 3,
892
+ 4
893
+ ];
894
+ case 3:
895
+ e = _state.sent();
896
+ throw new CredentialsProviderError(e.message, {
897
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
898
+ logger: logger
899
+ });
900
+ case 4:
901
+ return [
902
+ 3,
903
+ 8
904
+ ];
905
+ case 5:
906
+ _state.trys.push([
907
+ 5,
908
+ 7,
909
+ ,
910
+ 8
911
+ ]);
1837
912
  return [
1838
913
  4,
1839
- normalizeProvider(config.region)()
914
+ getSSOTokenFromFile(ssoStartUrl)
1840
915
  ];
1841
- case 1:
916
+ case 6:
917
+ token = _state.sent();
918
+ return [
919
+ 3,
920
+ 8
921
+ ];
922
+ case 7:
923
+ _state.sent();
924
+ throw new CredentialsProviderError("The SSO session associated with this profile is invalid. ".concat(refreshMessage), {
925
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
926
+ logger: logger
927
+ });
928
+ case 8:
929
+ if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
930
+ throw new CredentialsProviderError("The SSO session associated with this profile has expired. ".concat(refreshMessage), {
931
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
932
+ logger: logger
933
+ });
934
+ }
935
+ accessToken = token.accessToken;
936
+ return [
937
+ 4,
938
+ import('./loadSso.esm.js')
939
+ ];
940
+ case 9:
941
+ _ref = _state.sent(), SSOClient = _ref.SSOClient, GetRoleCredentialsCommand = _ref.GetRoleCredentialsCommand;
942
+ sso = ssoClient || new SSOClient(Object.assign({}, clientConfig !== null && clientConfig !== void 0 ? clientConfig : {}, {
943
+ logger: (_ref1 = (_clientConfig_logger = clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.logger) !== null && _clientConfig_logger !== void 0 ? _clientConfig_logger : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.logger) !== null && _ref1 !== void 0 ? _ref1 : parentClientConfig === null || parentClientConfig === void 0 ? void 0 : parentClientConfig.logger,
944
+ region: (_clientConfig_region = clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.region) !== null && _clientConfig_region !== void 0 ? _clientConfig_region : ssoRegion,
945
+ userAgentAppId: (_ref2 = (_clientConfig_userAgentAppId = clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.userAgentAppId) !== null && _clientConfig_userAgentAppId !== void 0 ? _clientConfig_userAgentAppId : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.userAgentAppId) !== null && _ref2 !== void 0 ? _ref2 : parentClientConfig === null || parentClientConfig === void 0 ? void 0 : parentClientConfig.userAgentAppId
946
+ }));
947
+ _state.label = 10;
948
+ case 10:
949
+ _state.trys.push([
950
+ 10,
951
+ 12,
952
+ ,
953
+ 13
954
+ ]);
955
+ return [
956
+ 4,
957
+ sso.send(new GetRoleCredentialsCommand({
958
+ accountId: ssoAccountId,
959
+ roleName: ssoRoleName,
960
+ accessToken: accessToken
961
+ }))
962
+ ];
963
+ case 11:
964
+ ssoResp = _state.sent();
965
+ return [
966
+ 3,
967
+ 13
968
+ ];
969
+ case 12:
970
+ e2 = _state.sent();
971
+ throw new CredentialsProviderError(e2, {
972
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
973
+ logger: logger
974
+ });
975
+ case 13:
976
+ tmp = ssoResp.roleCredentials, _ref3 = tmp === void 0 ? {} : tmp, accessKeyId = _ref3.accessKeyId, secretAccessKey = _ref3.secretAccessKey, sessionToken = _ref3.sessionToken, expiration = _ref3.expiration, credentialScope = _ref3.credentialScope, accountId = _ref3.accountId;
977
+ if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
978
+ throw new CredentialsProviderError("SSO returns an invalid temporary credential.", {
979
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
980
+ logger: logger
981
+ });
982
+ }
983
+ credentials = _object_spread({
984
+ accessKeyId: accessKeyId,
985
+ secretAccessKey: secretAccessKey,
986
+ sessionToken: sessionToken,
987
+ expiration: new Date(expiration)
988
+ }, credentialScope && {
989
+ credentialScope: credentialScope
990
+ }, accountId && {
991
+ accountId: accountId
992
+ });
993
+ if (ssoSession) {
994
+ setCredentialFeature(credentials, "CREDENTIALS_SSO", "s");
995
+ } else {
996
+ setCredentialFeature(credentials, "CREDENTIALS_SSO_LEGACY", "u");
997
+ }
1842
998
  return [
1843
999
  2,
1844
- (_tmp.region = _state.sent() || function() {
1845
- throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
1846
- }(), _tmp)
1000
+ credentials
1847
1001
  ];
1848
1002
  }
1849
1003
  });
1850
1004
  });
1851
- return function defaultSTSHttpAuthSchemeParametersProvider(config, context, input) {
1005
+ return function resolveSSOCredentials(_) {
1852
1006
  return _ref.apply(this, arguments);
1853
1007
  };
1854
1008
  }();
1855
- function createAwsAuthSigv4HttpAuthOption(authParameters) {
1856
- return {
1857
- schemeId: "aws.auth#sigv4",
1858
- signingProperties: {
1859
- name: "sts",
1860
- region: authParameters.region
1861
- },
1862
- propertiesExtractor: function(config, context) {
1863
- return {
1864
- signingProperties: {
1865
- config: config,
1866
- context: context
1867
- }
1868
- };
1869
- }
1870
- };
1871
- }
1872
- function createSmithyApiNoAuthHttpAuthOption(authParameters) {
1873
- return {
1874
- schemeId: "smithy.api#noAuth"
1875
- };
1876
- }
1877
- var defaultSTSHttpAuthSchemeProvider = function(authParameters) {
1878
- var options = [];
1879
- switch(authParameters.operation){
1880
- case "AssumeRoleWithWebIdentity":
1881
- {
1882
- options.push(createSmithyApiNoAuthHttpAuthOption());
1883
- break;
1884
- }
1885
- default:
1886
- {
1887
- options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
1888
- }
1889
- }
1890
- return options;
1891
- };
1892
- var resolveStsAuthConfig = function(input) {
1893
- return Object.assign(input, {
1894
- stsClientCtor: STSClient
1895
- });
1896
- };
1897
- var resolveHttpAuthSchemeConfig = function(config) {
1898
- var config_0 = resolveStsAuthConfig(config);
1899
- var config_1 = resolveAwsSdkSigV4Config(config_0);
1900
- var _config_authSchemePreference;
1901
- return Object.assign(config_1, {
1902
- authSchemePreference: normalizeProvider((_config_authSchemePreference = config.authSchemePreference) !== null && _config_authSchemePreference !== void 0 ? _config_authSchemePreference : [])
1903
- });
1904
- };
1905
1009
 
1906
- var resolveClientEndpointParameters = function(options) {
1907
- var _options_useDualstackEndpoint, _options_useFipsEndpoint, _options_useGlobalEndpoint;
1908
- return Object.assign(options, {
1909
- useDualstackEndpoint: (_options_useDualstackEndpoint = options.useDualstackEndpoint) !== null && _options_useDualstackEndpoint !== void 0 ? _options_useDualstackEndpoint : false,
1910
- useFipsEndpoint: (_options_useFipsEndpoint = options.useFipsEndpoint) !== null && _options_useFipsEndpoint !== void 0 ? _options_useFipsEndpoint : false,
1911
- useGlobalEndpoint: (_options_useGlobalEndpoint = options.useGlobalEndpoint) !== null && _options_useGlobalEndpoint !== void 0 ? _options_useGlobalEndpoint : false,
1912
- defaultSigningName: "sts"
1913
- });
1914
- };
1915
- var commonParams = {
1916
- UseGlobalEndpoint: {
1917
- type: "builtInParams",
1918
- name: "useGlobalEndpoint"
1919
- },
1920
- UseFIPS: {
1921
- type: "builtInParams",
1922
- name: "useFipsEndpoint"
1923
- },
1924
- Endpoint: {
1925
- type: "builtInParams",
1926
- name: "endpoint"
1927
- },
1928
- Region: {
1929
- type: "builtInParams",
1930
- name: "region"
1931
- },
1932
- UseDualStack: {
1933
- type: "builtInParams",
1934
- name: "useDualstackEndpoint"
1010
+ var validateSsoProfile = function(profile, logger) {
1011
+ var sso_start_url = profile.sso_start_url, sso_account_id = profile.sso_account_id, sso_region = profile.sso_region, sso_role_name = profile.sso_role_name;
1012
+ if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
1013
+ throw new CredentialsProviderError('Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", ' + '"sso_region", "sso_role_name", "sso_start_url". Got '.concat(Object.keys(profile).join(", "), "\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html"), {
1014
+ tryNextLink: false,
1015
+ logger: logger
1016
+ });
1935
1017
  }
1018
+ return profile;
1936
1019
  };
1937
1020
 
1938
- function _define_property$6(obj, key, value) {
1939
- if (key in obj) {
1940
- Object.defineProperty(obj, key, {
1941
- value: value,
1942
- enumerable: true,
1943
- configurable: true,
1944
- writable: true
1945
- });
1021
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1022
+ try {
1023
+ var info = gen[key](arg);
1024
+ var value = info.value;
1025
+ } catch (error) {
1026
+ reject(error);
1027
+ return;
1028
+ }
1029
+ if (info.done) {
1030
+ resolve(value);
1946
1031
  } else {
1947
- obj[key] = value;
1032
+ Promise.resolve(value).then(_next, _throw);
1948
1033
  }
1949
- return obj;
1950
1034
  }
1951
- var F = "required", G = "type", H = "fn", I = "argv", J = "ref";
1952
- var _obj$1, _obj1$1, _obj2$1, _obj3$1, _obj4$1, _obj5$1, _obj6$1, _obj7, _obj8, _obj9, _obj10, _obj11;
1953
- var a = false, b = true, c = "booleanEquals", d = "stringEquals", e = "sigv4", f = "sts", g = "us-east-1", h = "endpoint", i = "https://sts.{Region}.{PartitionResult#dnsSuffix}", j = "tree", k = "error", l = "getAttr", m = (_obj$1 = {}, _define_property$6(_obj$1, F, false), _define_property$6(_obj$1, G, "string"), _obj$1), n = (_obj1$1 = {}, _define_property$6(_obj1$1, F, true), _define_property$6(_obj1$1, "default", false), _define_property$6(_obj1$1, G, "boolean"), _obj1$1), o = _define_property$6({}, J, "Endpoint"), p = (_obj2$1 = {}, _define_property$6(_obj2$1, H, "isSet"), _define_property$6(_obj2$1, I, [
1954
- _define_property$6({}, J, "Region")
1955
- ]), _obj2$1), q = _define_property$6({}, J, "Region"), r = (_obj3$1 = {}, _define_property$6(_obj3$1, H, "aws.partition"), _define_property$6(_obj3$1, I, [
1956
- q
1957
- ]), _define_property$6(_obj3$1, "assign", "PartitionResult"), _obj3$1), s = _define_property$6({}, J, "UseFIPS"), t = _define_property$6({}, J, "UseDualStack"), u = {
1958
- "url": "https://sts.amazonaws.com",
1959
- "properties": {
1960
- "authSchemes": [
1961
- {
1962
- "name": e,
1963
- "signingName": f,
1964
- "signingRegion": g
1965
- }
1966
- ]
1967
- },
1968
- "headers": {}
1969
- }, v = {}, w = (_obj5$1 = {
1970
- "conditions": [
1971
- (_obj4$1 = {}, _define_property$6(_obj4$1, H, d), _define_property$6(_obj4$1, I, [
1972
- q,
1973
- "aws-global"
1974
- ]), _obj4$1)
1975
- ]
1976
- }, _define_property$6(_obj5$1, h, u), _define_property$6(_obj5$1, G, h), _obj5$1), x = (_obj6$1 = {}, _define_property$6(_obj6$1, H, c), _define_property$6(_obj6$1, I, [
1977
- s,
1978
- true
1979
- ]), _obj6$1), y = (_obj7 = {}, _define_property$6(_obj7, H, c), _define_property$6(_obj7, I, [
1980
- t,
1981
- true
1982
- ]), _obj7), z = (_obj8 = {}, _define_property$6(_obj8, H, l), _define_property$6(_obj8, I, [
1983
- _define_property$6({}, J, "PartitionResult"),
1984
- "supportsFIPS"
1985
- ]), _obj8), A = _define_property$6({}, J, "PartitionResult"), B = (_obj10 = {}, _define_property$6(_obj10, H, c), _define_property$6(_obj10, I, [
1986
- true,
1987
- (_obj9 = {}, _define_property$6(_obj9, H, l), _define_property$6(_obj9, I, [
1988
- A,
1989
- "supportsDualStack"
1990
- ]), _obj9)
1991
- ]), _obj10), C = [
1992
- (_obj11 = {}, _define_property$6(_obj11, H, "isSet"), _define_property$6(_obj11, I, [
1993
- o
1994
- ]), _obj11)
1995
- ], D = [
1996
- x
1997
- ], E = [
1998
- y
1999
- ];
2000
- var _obj12, _obj13, _obj14, _obj15, _obj16, _obj17, _obj18, _obj19, _obj20, _obj21, _obj22, _obj23, _obj24, _obj25, _obj26, _obj27, _obj28, _obj29, _obj30, _obj31, _obj32, _obj33, _obj34;
2001
- var _data = {
2002
- parameters: {
2003
- Region: m,
2004
- UseDualStack: n,
2005
- UseFIPS: n,
2006
- Endpoint: m,
2007
- UseGlobalEndpoint: n
2008
- },
2009
- rules: [
2010
- _define_property$6({
2011
- conditions: [
2012
- (_obj12 = {}, _define_property$6(_obj12, H, c), _define_property$6(_obj12, I, [
2013
- _define_property$6({}, J, "UseGlobalEndpoint"),
2014
- b
2015
- ]), _obj12),
2016
- (_obj13 = {}, _define_property$6(_obj13, H, "not"), _define_property$6(_obj13, I, C), _obj13),
2017
- p,
2018
- r,
2019
- (_obj14 = {}, _define_property$6(_obj14, H, c), _define_property$6(_obj14, I, [
2020
- s,
2021
- a
2022
- ]), _obj14),
2023
- (_obj15 = {}, _define_property$6(_obj15, H, c), _define_property$6(_obj15, I, [
2024
- t,
2025
- a
2026
- ]), _obj15)
2027
- ],
2028
- rules: [
2029
- _define_property$6({
2030
- conditions: [
2031
- (_obj16 = {}, _define_property$6(_obj16, H, d), _define_property$6(_obj16, I, [
2032
- q,
2033
- "ap-northeast-1"
2034
- ]), _obj16)
2035
- ],
2036
- endpoint: u
2037
- }, G, h),
2038
- _define_property$6({
2039
- conditions: [
2040
- (_obj17 = {}, _define_property$6(_obj17, H, d), _define_property$6(_obj17, I, [
2041
- q,
2042
- "ap-south-1"
2043
- ]), _obj17)
2044
- ],
2045
- endpoint: u
2046
- }, G, h),
2047
- _define_property$6({
2048
- conditions: [
2049
- (_obj18 = {}, _define_property$6(_obj18, H, d), _define_property$6(_obj18, I, [
2050
- q,
2051
- "ap-southeast-1"
2052
- ]), _obj18)
2053
- ],
2054
- endpoint: u
2055
- }, G, h),
2056
- _define_property$6({
2057
- conditions: [
2058
- (_obj19 = {}, _define_property$6(_obj19, H, d), _define_property$6(_obj19, I, [
2059
- q,
2060
- "ap-southeast-2"
2061
- ]), _obj19)
2062
- ],
2063
- endpoint: u
2064
- }, G, h),
2065
- w,
2066
- _define_property$6({
2067
- conditions: [
2068
- (_obj20 = {}, _define_property$6(_obj20, H, d), _define_property$6(_obj20, I, [
2069
- q,
2070
- "ca-central-1"
2071
- ]), _obj20)
2072
- ],
2073
- endpoint: u
2074
- }, G, h),
2075
- _define_property$6({
2076
- conditions: [
2077
- (_obj21 = {}, _define_property$6(_obj21, H, d), _define_property$6(_obj21, I, [
2078
- q,
2079
- "eu-central-1"
2080
- ]), _obj21)
2081
- ],
2082
- endpoint: u
2083
- }, G, h),
2084
- _define_property$6({
2085
- conditions: [
2086
- (_obj22 = {}, _define_property$6(_obj22, H, d), _define_property$6(_obj22, I, [
2087
- q,
2088
- "eu-north-1"
2089
- ]), _obj22)
2090
- ],
2091
- endpoint: u
2092
- }, G, h),
2093
- _define_property$6({
2094
- conditions: [
2095
- (_obj23 = {}, _define_property$6(_obj23, H, d), _define_property$6(_obj23, I, [
2096
- q,
2097
- "eu-west-1"
2098
- ]), _obj23)
2099
- ],
2100
- endpoint: u
2101
- }, G, h),
2102
- _define_property$6({
2103
- conditions: [
2104
- (_obj24 = {}, _define_property$6(_obj24, H, d), _define_property$6(_obj24, I, [
2105
- q,
2106
- "eu-west-2"
2107
- ]), _obj24)
2108
- ],
2109
- endpoint: u
2110
- }, G, h),
2111
- _define_property$6({
2112
- conditions: [
2113
- (_obj25 = {}, _define_property$6(_obj25, H, d), _define_property$6(_obj25, I, [
2114
- q,
2115
- "eu-west-3"
2116
- ]), _obj25)
2117
- ],
2118
- endpoint: u
2119
- }, G, h),
2120
- _define_property$6({
2121
- conditions: [
2122
- (_obj26 = {}, _define_property$6(_obj26, H, d), _define_property$6(_obj26, I, [
2123
- q,
2124
- "sa-east-1"
2125
- ]), _obj26)
2126
- ],
2127
- endpoint: u
2128
- }, G, h),
2129
- _define_property$6({
2130
- conditions: [
2131
- (_obj27 = {}, _define_property$6(_obj27, H, d), _define_property$6(_obj27, I, [
2132
- q,
2133
- g
2134
- ]), _obj27)
2135
- ],
2136
- endpoint: u
2137
- }, G, h),
2138
- _define_property$6({
2139
- conditions: [
2140
- (_obj28 = {}, _define_property$6(_obj28, H, d), _define_property$6(_obj28, I, [
2141
- q,
2142
- "us-east-2"
2143
- ]), _obj28)
2144
- ],
2145
- endpoint: u
2146
- }, G, h),
2147
- _define_property$6({
2148
- conditions: [
2149
- (_obj29 = {}, _define_property$6(_obj29, H, d), _define_property$6(_obj29, I, [
2150
- q,
2151
- "us-west-1"
2152
- ]), _obj29)
2153
- ],
2154
- endpoint: u
2155
- }, G, h),
2156
- _define_property$6({
2157
- conditions: [
2158
- (_obj30 = {}, _define_property$6(_obj30, H, d), _define_property$6(_obj30, I, [
2159
- q,
2160
- "us-west-2"
2161
- ]), _obj30)
2162
- ],
2163
- endpoint: u
2164
- }, G, h),
2165
- _define_property$6({
2166
- endpoint: {
2167
- url: i,
2168
- properties: {
2169
- authSchemes: [
2170
- {
2171
- name: e,
2172
- signingName: f,
2173
- signingRegion: "{Region}"
2174
- }
2175
- ]
2176
- },
2177
- headers: v
2178
- }
2179
- }, G, h)
2180
- ]
2181
- }, G, j),
2182
- _define_property$6({
2183
- conditions: C,
2184
- rules: [
2185
- _define_property$6({
2186
- conditions: D,
2187
- error: "Invalid Configuration: FIPS and custom endpoint are not supported"
2188
- }, G, k),
2189
- _define_property$6({
2190
- conditions: E,
2191
- error: "Invalid Configuration: Dualstack and custom endpoint are not supported"
2192
- }, G, k),
2193
- _define_property$6({
2194
- endpoint: {
2195
- url: o,
2196
- properties: v,
2197
- headers: v
2198
- }
2199
- }, G, h)
2200
- ]
2201
- }, G, j),
2202
- _define_property$6({
2203
- conditions: [
2204
- p
2205
- ],
2206
- rules: [
2207
- _define_property$6({
2208
- conditions: [
2209
- r
2210
- ],
2211
- rules: [
2212
- _define_property$6({
2213
- conditions: [
2214
- x,
2215
- y
2216
- ],
2217
- rules: [
2218
- _define_property$6({
2219
- conditions: [
2220
- (_obj31 = {}, _define_property$6(_obj31, H, c), _define_property$6(_obj31, I, [
2221
- b,
2222
- z
2223
- ]), _obj31),
2224
- B
2225
- ],
2226
- rules: [
2227
- _define_property$6({
2228
- endpoint: {
2229
- url: "https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",
2230
- properties: v,
2231
- headers: v
2232
- }
2233
- }, G, h)
2234
- ]
2235
- }, G, j),
2236
- _define_property$6({
2237
- error: "FIPS and DualStack are enabled, but this partition does not support one or both"
2238
- }, G, k)
2239
- ]
2240
- }, G, j),
2241
- _define_property$6({
2242
- conditions: D,
2243
- rules: [
2244
- _define_property$6({
2245
- conditions: [
2246
- (_obj32 = {}, _define_property$6(_obj32, H, c), _define_property$6(_obj32, I, [
2247
- z,
2248
- b
2249
- ]), _obj32)
2250
- ],
2251
- rules: [
2252
- _define_property$6({
2253
- conditions: [
2254
- (_obj34 = {}, _define_property$6(_obj34, H, d), _define_property$6(_obj34, I, [
2255
- (_obj33 = {}, _define_property$6(_obj33, H, l), _define_property$6(_obj33, I, [
2256
- A,
2257
- "name"
2258
- ]), _obj33),
2259
- "aws-us-gov"
2260
- ]), _obj34)
2261
- ],
2262
- endpoint: {
2263
- url: "https://sts.{Region}.amazonaws.com",
2264
- properties: v,
2265
- headers: v
2266
- }
2267
- }, G, h),
2268
- _define_property$6({
2269
- endpoint: {
2270
- url: "https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",
2271
- properties: v,
2272
- headers: v
2273
- }
2274
- }, G, h)
2275
- ]
2276
- }, G, j),
2277
- _define_property$6({
2278
- error: "FIPS is enabled but this partition does not support FIPS"
2279
- }, G, k)
2280
- ]
2281
- }, G, j),
2282
- _define_property$6({
2283
- conditions: E,
2284
- rules: [
2285
- _define_property$6({
2286
- conditions: [
2287
- B
2288
- ],
2289
- rules: [
2290
- _define_property$6({
2291
- endpoint: {
2292
- url: "https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",
2293
- properties: v,
2294
- headers: v
2295
- }
2296
- }, G, h)
2297
- ]
2298
- }, G, j),
2299
- _define_property$6({
2300
- error: "DualStack is enabled but this partition does not support DualStack"
2301
- }, G, k)
2302
- ]
2303
- }, G, j),
2304
- w,
2305
- _define_property$6({
2306
- endpoint: {
2307
- url: i,
2308
- properties: v,
2309
- headers: v
2310
- }
2311
- }, G, h)
2312
- ]
2313
- }, G, j)
2314
- ]
2315
- }, G, j),
2316
- _define_property$6({
2317
- error: "Invalid Configuration: Missing Region"
2318
- }, G, k)
2319
- ]
2320
- };
2321
- var ruleSet = _data;
2322
-
2323
- var cache = new EndpointCache({
2324
- size: 50,
2325
- params: [
2326
- "Endpoint",
2327
- "Region",
2328
- "UseDualStack",
2329
- "UseFIPS",
2330
- "UseGlobalEndpoint"
2331
- ]
2332
- });
2333
- var defaultEndpointResolver = function(endpointParams) {
2334
- var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2335
- return cache.get(endpointParams, function() {
2336
- return resolveEndpoint(ruleSet, {
2337
- endpointParams: endpointParams,
2338
- logger: context.logger
2339
- });
2340
- });
2341
- };
2342
- customEndpointFunctions.aws = awsEndpointFunctions;
2343
-
2344
- function _assert_this_initialized$6(self) {
2345
- if (self === void 0) {
2346
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2347
- }
2348
- return self;
2349
- }
2350
- function _class_call_check$6(instance, Constructor) {
2351
- if (!(instance instanceof Constructor)) {
2352
- throw new TypeError("Cannot call a class as a function");
2353
- }
2354
- }
2355
- function _get_prototype_of$6(o) {
2356
- _get_prototype_of$6 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
2357
- return o.__proto__ || Object.getPrototypeOf(o);
2358
- };
2359
- return _get_prototype_of$6(o);
2360
- }
2361
- function _inherits$6(subClass, superClass) {
2362
- if (typeof superClass !== "function" && superClass !== null) {
2363
- throw new TypeError("Super expression must either be null or a function");
2364
- }
2365
- subClass.prototype = Object.create(superClass && superClass.prototype, {
2366
- constructor: {
2367
- value: subClass,
2368
- writable: true,
2369
- configurable: true
2370
- }
2371
- });
2372
- if (superClass) _set_prototype_of$6(subClass, superClass);
2373
- }
2374
- function _possible_constructor_return$6(self, call) {
2375
- if (call && (_type_of$6(call) === "object" || typeof call === "function")) {
2376
- return call;
2377
- }
2378
- return _assert_this_initialized$6(self);
2379
- }
2380
- function _set_prototype_of$6(o, p) {
2381
- _set_prototype_of$6 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
2382
- o.__proto__ = p;
2383
- return o;
2384
- };
2385
- return _set_prototype_of$6(o, p);
2386
- }
2387
- function _type_of$6(obj) {
2388
- "@swc/helpers - typeof";
2389
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
2390
- }
2391
- function _is_native_reflect_construct$6() {
2392
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
2393
- if (Reflect.construct.sham) return false;
2394
- if (typeof Proxy === "function") return true;
2395
- try {
2396
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
2397
- return true;
2398
- } catch (e) {
2399
- return false;
2400
- }
2401
- }
2402
- function _create_super$6(Derived) {
2403
- var hasNativeReflectConstruct = _is_native_reflect_construct$6();
2404
- return function _createSuperInternal() {
2405
- var Super = _get_prototype_of$6(Derived), result;
2406
- if (hasNativeReflectConstruct) {
2407
- var NewTarget = _get_prototype_of$6(this).constructor;
2408
- result = Reflect.construct(Super, arguments, NewTarget);
2409
- } else {
2410
- result = Super.apply(this, arguments);
2411
- }
2412
- return _possible_constructor_return$6(this, result);
2413
- };
2414
- }
2415
- var STSServiceException = /*#__PURE__*/ function(__ServiceException) {
2416
- _inherits$6(STSServiceException, __ServiceException);
2417
- var _super = _create_super$6(STSServiceException);
2418
- function STSServiceException(options) {
2419
- _class_call_check$6(this, STSServiceException);
2420
- var _this;
2421
- _this = _super.call(this, options);
2422
- Object.setPrototypeOf(_assert_this_initialized$6(_this), STSServiceException.prototype);
2423
- return _this;
2424
- }
2425
- return STSServiceException;
2426
- }(ServiceException);
2427
-
2428
- function _assert_this_initialized$5(self) {
2429
- if (self === void 0) {
2430
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2431
- }
2432
- return self;
2433
- }
2434
- function _class_call_check$5(instance, Constructor) {
2435
- if (!(instance instanceof Constructor)) {
2436
- throw new TypeError("Cannot call a class as a function");
2437
- }
2438
- }
2439
- function _define_property$5(obj, key, value) {
2440
- if (key in obj) {
2441
- Object.defineProperty(obj, key, {
2442
- value: value,
2443
- enumerable: true,
2444
- configurable: true,
2445
- writable: true
2446
- });
2447
- } else {
2448
- obj[key] = value;
2449
- }
2450
- return obj;
2451
- }
2452
- function _get_prototype_of$5(o) {
2453
- _get_prototype_of$5 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
2454
- return o.__proto__ || Object.getPrototypeOf(o);
2455
- };
2456
- return _get_prototype_of$5(o);
2457
- }
2458
- function _inherits$5(subClass, superClass) {
2459
- if (typeof superClass !== "function" && superClass !== null) {
2460
- throw new TypeError("Super expression must either be null or a function");
2461
- }
2462
- subClass.prototype = Object.create(superClass && superClass.prototype, {
2463
- constructor: {
2464
- value: subClass,
2465
- writable: true,
2466
- configurable: true
2467
- }
2468
- });
2469
- if (superClass) _set_prototype_of$5(subClass, superClass);
2470
- }
2471
- function _object_spread$3(target) {
2472
- for(var i = 1; i < arguments.length; i++){
2473
- var source = arguments[i] != null ? arguments[i] : {};
2474
- var ownKeys = Object.keys(source);
2475
- if (typeof Object.getOwnPropertySymbols === "function") {
2476
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2477
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2478
- }));
2479
- }
2480
- ownKeys.forEach(function(key) {
2481
- _define_property$5(target, key, source[key]);
2482
- });
2483
- }
2484
- return target;
2485
- }
2486
- function _possible_constructor_return$5(self, call) {
2487
- if (call && (_type_of$5(call) === "object" || typeof call === "function")) {
2488
- return call;
2489
- }
2490
- return _assert_this_initialized$5(self);
2491
- }
2492
- function _set_prototype_of$5(o, p) {
2493
- _set_prototype_of$5 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
2494
- o.__proto__ = p;
2495
- return o;
2496
- };
2497
- return _set_prototype_of$5(o, p);
2498
- }
2499
- function _type_of$5(obj) {
2500
- "@swc/helpers - typeof";
2501
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
2502
- }
2503
- function _is_native_reflect_construct$5() {
2504
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
2505
- if (Reflect.construct.sham) return false;
2506
- if (typeof Proxy === "function") return true;
2507
- try {
2508
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
2509
- return true;
2510
- } catch (e) {
2511
- return false;
2512
- }
2513
- }
2514
- function _create_super$5(Derived) {
2515
- var hasNativeReflectConstruct = _is_native_reflect_construct$5();
2516
- return function _createSuperInternal() {
2517
- var Super = _get_prototype_of$5(Derived), result;
2518
- if (hasNativeReflectConstruct) {
2519
- var NewTarget = _get_prototype_of$5(this).constructor;
2520
- result = Reflect.construct(Super, arguments, NewTarget);
2521
- } else {
2522
- result = Super.apply(this, arguments);
2523
- }
2524
- return _possible_constructor_return$5(this, result);
2525
- };
2526
- }
2527
- var ExpiredTokenException = /*#__PURE__*/ function(__BaseException) {
2528
- _inherits$5(ExpiredTokenException, __BaseException);
2529
- var _super = _create_super$5(ExpiredTokenException);
2530
- function ExpiredTokenException(opts) {
2531
- _class_call_check$5(this, ExpiredTokenException);
2532
- var _this;
2533
- _this = _super.call(this, _object_spread$3({
2534
- name: "ExpiredTokenException",
2535
- $fault: "client"
2536
- }, opts));
2537
- _define_property$5(_assert_this_initialized$5(_this), "name", "ExpiredTokenException");
2538
- _define_property$5(_assert_this_initialized$5(_this), "$fault", "client");
2539
- Object.setPrototypeOf(_assert_this_initialized$5(_this), ExpiredTokenException.prototype);
2540
- return _this;
2541
- }
2542
- return ExpiredTokenException;
2543
- }(STSServiceException);
2544
- var MalformedPolicyDocumentException = /*#__PURE__*/ function(__BaseException) {
2545
- _inherits$5(MalformedPolicyDocumentException, __BaseException);
2546
- var _super = _create_super$5(MalformedPolicyDocumentException);
2547
- function MalformedPolicyDocumentException(opts) {
2548
- _class_call_check$5(this, MalformedPolicyDocumentException);
2549
- var _this;
2550
- _this = _super.call(this, _object_spread$3({
2551
- name: "MalformedPolicyDocumentException",
2552
- $fault: "client"
2553
- }, opts));
2554
- _define_property$5(_assert_this_initialized$5(_this), "name", "MalformedPolicyDocumentException");
2555
- _define_property$5(_assert_this_initialized$5(_this), "$fault", "client");
2556
- Object.setPrototypeOf(_assert_this_initialized$5(_this), MalformedPolicyDocumentException.prototype);
2557
- return _this;
2558
- }
2559
- return MalformedPolicyDocumentException;
2560
- }(STSServiceException);
2561
- var PackedPolicyTooLargeException = /*#__PURE__*/ function(__BaseException) {
2562
- _inherits$5(PackedPolicyTooLargeException, __BaseException);
2563
- var _super = _create_super$5(PackedPolicyTooLargeException);
2564
- function PackedPolicyTooLargeException(opts) {
2565
- _class_call_check$5(this, PackedPolicyTooLargeException);
2566
- var _this;
2567
- _this = _super.call(this, _object_spread$3({
2568
- name: "PackedPolicyTooLargeException",
2569
- $fault: "client"
2570
- }, opts));
2571
- _define_property$5(_assert_this_initialized$5(_this), "name", "PackedPolicyTooLargeException");
2572
- _define_property$5(_assert_this_initialized$5(_this), "$fault", "client");
2573
- Object.setPrototypeOf(_assert_this_initialized$5(_this), PackedPolicyTooLargeException.prototype);
2574
- return _this;
2575
- }
2576
- return PackedPolicyTooLargeException;
2577
- }(STSServiceException);
2578
- var RegionDisabledException = /*#__PURE__*/ function(__BaseException) {
2579
- _inherits$5(RegionDisabledException, __BaseException);
2580
- var _super = _create_super$5(RegionDisabledException);
2581
- function RegionDisabledException(opts) {
2582
- _class_call_check$5(this, RegionDisabledException);
2583
- var _this;
2584
- _this = _super.call(this, _object_spread$3({
2585
- name: "RegionDisabledException",
2586
- $fault: "client"
2587
- }, opts));
2588
- _define_property$5(_assert_this_initialized$5(_this), "name", "RegionDisabledException");
2589
- _define_property$5(_assert_this_initialized$5(_this), "$fault", "client");
2590
- Object.setPrototypeOf(_assert_this_initialized$5(_this), RegionDisabledException.prototype);
2591
- return _this;
2592
- }
2593
- return RegionDisabledException;
2594
- }(STSServiceException);
2595
- var IDPRejectedClaimException = /*#__PURE__*/ function(__BaseException) {
2596
- _inherits$5(IDPRejectedClaimException, __BaseException);
2597
- var _super = _create_super$5(IDPRejectedClaimException);
2598
- function IDPRejectedClaimException(opts) {
2599
- _class_call_check$5(this, IDPRejectedClaimException);
2600
- var _this;
2601
- _this = _super.call(this, _object_spread$3({
2602
- name: "IDPRejectedClaimException",
2603
- $fault: "client"
2604
- }, opts));
2605
- _define_property$5(_assert_this_initialized$5(_this), "name", "IDPRejectedClaimException");
2606
- _define_property$5(_assert_this_initialized$5(_this), "$fault", "client");
2607
- Object.setPrototypeOf(_assert_this_initialized$5(_this), IDPRejectedClaimException.prototype);
2608
- return _this;
2609
- }
2610
- return IDPRejectedClaimException;
2611
- }(STSServiceException);
2612
- var InvalidIdentityTokenException = /*#__PURE__*/ function(__BaseException) {
2613
- _inherits$5(InvalidIdentityTokenException, __BaseException);
2614
- var _super = _create_super$5(InvalidIdentityTokenException);
2615
- function InvalidIdentityTokenException(opts) {
2616
- _class_call_check$5(this, InvalidIdentityTokenException);
2617
- var _this;
2618
- _this = _super.call(this, _object_spread$3({
2619
- name: "InvalidIdentityTokenException",
2620
- $fault: "client"
2621
- }, opts));
2622
- _define_property$5(_assert_this_initialized$5(_this), "name", "InvalidIdentityTokenException");
2623
- _define_property$5(_assert_this_initialized$5(_this), "$fault", "client");
2624
- Object.setPrototypeOf(_assert_this_initialized$5(_this), InvalidIdentityTokenException.prototype);
2625
- return _this;
2626
- }
2627
- return InvalidIdentityTokenException;
2628
- }(STSServiceException);
2629
- var IDPCommunicationErrorException = /*#__PURE__*/ function(__BaseException) {
2630
- _inherits$5(IDPCommunicationErrorException, __BaseException);
2631
- var _super = _create_super$5(IDPCommunicationErrorException);
2632
- function IDPCommunicationErrorException(opts) {
2633
- _class_call_check$5(this, IDPCommunicationErrorException);
2634
- var _this;
2635
- _this = _super.call(this, _object_spread$3({
2636
- name: "IDPCommunicationErrorException",
2637
- $fault: "client"
2638
- }, opts));
2639
- _define_property$5(_assert_this_initialized$5(_this), "name", "IDPCommunicationErrorException");
2640
- _define_property$5(_assert_this_initialized$5(_this), "$fault", "client");
2641
- Object.setPrototypeOf(_assert_this_initialized$5(_this), IDPCommunicationErrorException.prototype);
2642
- return _this;
2643
- }
2644
- return IDPCommunicationErrorException;
2645
- }(STSServiceException);
2646
-
2647
- function _define_property$4(obj, key, value) {
2648
- if (key in obj) {
2649
- Object.defineProperty(obj, key, {
2650
- value: value,
2651
- enumerable: true,
2652
- configurable: true,
2653
- writable: true
2654
- });
2655
- } else {
2656
- obj[key] = value;
2657
- }
2658
- return obj;
2659
- }
2660
- var _A = "Arn";
2661
- var _AKI = "AccessKeyId";
2662
- var _AR = "AssumeRole";
2663
- var _ARI = "AssumedRoleId";
2664
- var _ARR = "AssumeRoleRequest";
2665
- var _ARRs = "AssumeRoleResponse";
2666
- var _ARU = "AssumedRoleUser";
2667
- var _ARWWI = "AssumeRoleWithWebIdentity";
2668
- var _ARWWIR = "AssumeRoleWithWebIdentityRequest";
2669
- var _ARWWIRs = "AssumeRoleWithWebIdentityResponse";
2670
- var _Au = "Audience";
2671
- var _C = "Credentials";
2672
- var _CA = "ContextAssertion";
2673
- var _DS = "DurationSeconds";
2674
- var _E = "Expiration";
2675
- var _EI = "ExternalId";
2676
- var _ETE = "ExpiredTokenException";
2677
- var _IDPCEE = "IDPCommunicationErrorException";
2678
- var _IDPRCE = "IDPRejectedClaimException";
2679
- var _IITE = "InvalidIdentityTokenException";
2680
- var _K = "Key";
2681
- var _MPDE = "MalformedPolicyDocumentException";
2682
- var _P = "Policy";
2683
- var _PA = "PolicyArns";
2684
- var _PAr = "ProviderArn";
2685
- var _PC = "ProvidedContexts";
2686
- var _PCLT = "ProvidedContextsListType";
2687
- var _PCr = "ProvidedContext";
2688
- var _PDT = "PolicyDescriptorType";
2689
- var _PI = "ProviderId";
2690
- var _PPS = "PackedPolicySize";
2691
- var _PPTLE = "PackedPolicyTooLargeException";
2692
- var _Pr = "Provider";
2693
- var _RA = "RoleArn";
2694
- var _RDE = "RegionDisabledException";
2695
- var _RSN = "RoleSessionName";
2696
- var _SAK = "SecretAccessKey";
2697
- var _SFWIT = "SubjectFromWebIdentityToken";
2698
- var _SI = "SourceIdentity";
2699
- var _SN = "SerialNumber";
2700
- var _ST = "SessionToken";
2701
- var _T = "Tags";
2702
- var _TC = "TokenCode";
2703
- var _TTK = "TransitiveTagKeys";
2704
- var _Ta = "Tag";
2705
- var _V = "Value";
2706
- var _WIT = "WebIdentityToken";
2707
- var _a = "arn";
2708
- var _aKST = "accessKeySecretType";
2709
- var _aQE = "awsQueryError";
2710
- var _c = "client";
2711
- var _cTT = "clientTokenType";
2712
- var _e = "error";
2713
- var _hE = "httpError";
2714
- var _m = "message";
2715
- var _pDLT = "policyDescriptorListType";
2716
- var _s = "smithy.ts.sdk.synthetic.com.amazonaws.sts";
2717
- var _tLT = "tagListType";
2718
- var n0 = "com.amazonaws.sts";
2719
- var _s_registry = TypeRegistry.for(_s);
2720
- var STSServiceException$ = [
2721
- -3,
2722
- _s,
2723
- "STSServiceException",
2724
- 0,
2725
- [],
2726
- []
2727
- ];
2728
- _s_registry.registerError(STSServiceException$, STSServiceException);
2729
- var n0_registry = TypeRegistry.for(n0);
2730
- var _obj;
2731
- var ExpiredTokenException$ = [
2732
- -3,
2733
- n0,
2734
- _ETE,
2735
- (_obj = {}, _define_property$4(_obj, _aQE, [
2736
- "ExpiredTokenException",
2737
- 400
2738
- ]), _define_property$4(_obj, _e, _c), _define_property$4(_obj, _hE, 400), _obj),
2739
- [
2740
- _m
2741
- ],
2742
- [
2743
- 0
2744
- ]
2745
- ];
2746
- n0_registry.registerError(ExpiredTokenException$, ExpiredTokenException);
2747
- var _obj1;
2748
- var IDPCommunicationErrorException$ = [
2749
- -3,
2750
- n0,
2751
- _IDPCEE,
2752
- (_obj1 = {}, _define_property$4(_obj1, _aQE, [
2753
- "IDPCommunicationError",
2754
- 400
2755
- ]), _define_property$4(_obj1, _e, _c), _define_property$4(_obj1, _hE, 400), _obj1),
2756
- [
2757
- _m
2758
- ],
2759
- [
2760
- 0
2761
- ]
2762
- ];
2763
- n0_registry.registerError(IDPCommunicationErrorException$, IDPCommunicationErrorException);
2764
- var _obj2;
2765
- var IDPRejectedClaimException$ = [
2766
- -3,
2767
- n0,
2768
- _IDPRCE,
2769
- (_obj2 = {}, _define_property$4(_obj2, _aQE, [
2770
- "IDPRejectedClaim",
2771
- 403
2772
- ]), _define_property$4(_obj2, _e, _c), _define_property$4(_obj2, _hE, 403), _obj2),
2773
- [
2774
- _m
2775
- ],
2776
- [
2777
- 0
2778
- ]
2779
- ];
2780
- n0_registry.registerError(IDPRejectedClaimException$, IDPRejectedClaimException);
2781
- var _obj3;
2782
- var InvalidIdentityTokenException$ = [
2783
- -3,
2784
- n0,
2785
- _IITE,
2786
- (_obj3 = {}, _define_property$4(_obj3, _aQE, [
2787
- "InvalidIdentityToken",
2788
- 400
2789
- ]), _define_property$4(_obj3, _e, _c), _define_property$4(_obj3, _hE, 400), _obj3),
2790
- [
2791
- _m
2792
- ],
2793
- [
2794
- 0
2795
- ]
2796
- ];
2797
- n0_registry.registerError(InvalidIdentityTokenException$, InvalidIdentityTokenException);
2798
- var _obj4;
2799
- var MalformedPolicyDocumentException$ = [
2800
- -3,
2801
- n0,
2802
- _MPDE,
2803
- (_obj4 = {}, _define_property$4(_obj4, _aQE, [
2804
- "MalformedPolicyDocument",
2805
- 400
2806
- ]), _define_property$4(_obj4, _e, _c), _define_property$4(_obj4, _hE, 400), _obj4),
2807
- [
2808
- _m
2809
- ],
2810
- [
2811
- 0
2812
- ]
2813
- ];
2814
- n0_registry.registerError(MalformedPolicyDocumentException$, MalformedPolicyDocumentException);
2815
- var _obj5;
2816
- var PackedPolicyTooLargeException$ = [
2817
- -3,
2818
- n0,
2819
- _PPTLE,
2820
- (_obj5 = {}, _define_property$4(_obj5, _aQE, [
2821
- "PackedPolicyTooLarge",
2822
- 400
2823
- ]), _define_property$4(_obj5, _e, _c), _define_property$4(_obj5, _hE, 400), _obj5),
2824
- [
2825
- _m
2826
- ],
2827
- [
2828
- 0
2829
- ]
2830
- ];
2831
- n0_registry.registerError(PackedPolicyTooLargeException$, PackedPolicyTooLargeException);
2832
- var _obj6;
2833
- var RegionDisabledException$ = [
2834
- -3,
2835
- n0,
2836
- _RDE,
2837
- (_obj6 = {}, _define_property$4(_obj6, _aQE, [
2838
- "RegionDisabledException",
2839
- 403
2840
- ]), _define_property$4(_obj6, _e, _c), _define_property$4(_obj6, _hE, 403), _obj6),
2841
- [
2842
- _m
2843
- ],
2844
- [
2845
- 0
2846
- ]
2847
- ];
2848
- n0_registry.registerError(RegionDisabledException$, RegionDisabledException);
2849
- var errorTypeRegistries = [
2850
- _s_registry,
2851
- n0_registry
2852
- ];
2853
- var accessKeySecretType = [
2854
- 0,
2855
- n0,
2856
- _aKST,
2857
- 8,
2858
- 0
2859
- ];
2860
- var clientTokenType = [
2861
- 0,
2862
- n0,
2863
- _cTT,
2864
- 8,
2865
- 0
2866
- ];
2867
- var AssumedRoleUser$ = [
2868
- 3,
2869
- n0,
2870
- _ARU,
2871
- 0,
2872
- [
2873
- _ARI,
2874
- _A
2875
- ],
2876
- [
2877
- 0,
2878
- 0
2879
- ],
2880
- 2
2881
- ];
2882
- var AssumeRoleRequest$ = [
2883
- 3,
2884
- n0,
2885
- _ARR,
2886
- 0,
2887
- [
2888
- _RA,
2889
- _RSN,
2890
- _PA,
2891
- _P,
2892
- _DS,
2893
- _T,
2894
- _TTK,
2895
- _EI,
2896
- _SN,
2897
- _TC,
2898
- _SI,
2899
- _PC
2900
- ],
2901
- [
2902
- 0,
2903
- 0,
2904
- function() {
2905
- return policyDescriptorListType;
2906
- },
2907
- 0,
2908
- 1,
2909
- function() {
2910
- return tagListType;
2911
- },
2912
- 64 | 0,
2913
- 0,
2914
- 0,
2915
- 0,
2916
- 0,
2917
- function() {
2918
- return ProvidedContextsListType;
2919
- }
2920
- ],
2921
- 2
2922
- ];
2923
- var AssumeRoleResponse$ = [
2924
- 3,
2925
- n0,
2926
- _ARRs,
2927
- 0,
2928
- [
2929
- _C,
2930
- _ARU,
2931
- _PPS,
2932
- _SI
2933
- ],
2934
- [
2935
- [
2936
- function() {
2937
- return Credentials$;
2938
- },
2939
- 0
2940
- ],
2941
- function() {
2942
- return AssumedRoleUser$;
2943
- },
2944
- 1,
2945
- 0
2946
- ]
2947
- ];
2948
- var AssumeRoleWithWebIdentityRequest$ = [
2949
- 3,
2950
- n0,
2951
- _ARWWIR,
2952
- 0,
2953
- [
2954
- _RA,
2955
- _RSN,
2956
- _WIT,
2957
- _PI,
2958
- _PA,
2959
- _P,
2960
- _DS
2961
- ],
2962
- [
2963
- 0,
2964
- 0,
2965
- [
2966
- function() {
2967
- return clientTokenType;
2968
- },
2969
- 0
2970
- ],
2971
- 0,
2972
- function() {
2973
- return policyDescriptorListType;
2974
- },
2975
- 0,
2976
- 1
2977
- ],
2978
- 3
2979
- ];
2980
- var AssumeRoleWithWebIdentityResponse$ = [
2981
- 3,
2982
- n0,
2983
- _ARWWIRs,
2984
- 0,
2985
- [
2986
- _C,
2987
- _SFWIT,
2988
- _ARU,
2989
- _PPS,
2990
- _Pr,
2991
- _Au,
2992
- _SI
2993
- ],
2994
- [
2995
- [
2996
- function() {
2997
- return Credentials$;
2998
- },
2999
- 0
3000
- ],
3001
- 0,
3002
- function() {
3003
- return AssumedRoleUser$;
3004
- },
3005
- 1,
3006
- 0,
3007
- 0,
3008
- 0
3009
- ]
3010
- ];
3011
- var Credentials$ = [
3012
- 3,
3013
- n0,
3014
- _C,
3015
- 0,
3016
- [
3017
- _AKI,
3018
- _SAK,
3019
- _ST,
3020
- _E
3021
- ],
3022
- [
3023
- 0,
3024
- [
3025
- function() {
3026
- return accessKeySecretType;
3027
- },
3028
- 0
3029
- ],
3030
- 0,
3031
- 4
3032
- ],
3033
- 4
3034
- ];
3035
- var PolicyDescriptorType$ = [
3036
- 3,
3037
- n0,
3038
- _PDT,
3039
- 0,
3040
- [
3041
- _a
3042
- ],
3043
- [
3044
- 0
3045
- ]
3046
- ];
3047
- var ProvidedContext$ = [
3048
- 3,
3049
- n0,
3050
- _PCr,
3051
- 0,
3052
- [
3053
- _PAr,
3054
- _CA
3055
- ],
3056
- [
3057
- 0,
3058
- 0
3059
- ]
3060
- ];
3061
- var Tag$ = [
3062
- 3,
3063
- n0,
3064
- _Ta,
3065
- 0,
3066
- [
3067
- _K,
3068
- _V
3069
- ],
3070
- [
3071
- 0,
3072
- 0
3073
- ],
3074
- 2
3075
- ];
3076
- var policyDescriptorListType = [
3077
- 1,
3078
- n0,
3079
- _pDLT,
3080
- 0,
3081
- function() {
3082
- return PolicyDescriptorType$;
3083
- }
3084
- ];
3085
- var ProvidedContextsListType = [
3086
- 1,
3087
- n0,
3088
- _PCLT,
3089
- 0,
3090
- function() {
3091
- return ProvidedContext$;
3092
- }
3093
- ];
3094
- var tagListType = [
3095
- 1,
3096
- n0,
3097
- _tLT,
3098
- 0,
3099
- function() {
3100
- return Tag$;
3101
- }
3102
- ];
3103
- var AssumeRole$ = [
3104
- 9,
3105
- n0,
3106
- _AR,
3107
- 0,
3108
- function() {
3109
- return AssumeRoleRequest$;
3110
- },
3111
- function() {
3112
- return AssumeRoleResponse$;
3113
- }
3114
- ];
3115
- var AssumeRoleWithWebIdentity$ = [
3116
- 9,
3117
- n0,
3118
- _ARWWI,
3119
- 0,
3120
- function() {
3121
- return AssumeRoleWithWebIdentityRequest$;
3122
- },
3123
- function() {
3124
- return AssumeRoleWithWebIdentityResponse$;
3125
- }
3126
- ];
3127
-
3128
- function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
3129
- try {
3130
- var info = gen[key](arg);
3131
- var value = info.value;
3132
- } catch (error) {
3133
- reject(error);
3134
- return;
3135
- }
3136
- if (info.done) {
3137
- resolve(value);
3138
- } else {
3139
- Promise.resolve(value).then(_next, _throw);
3140
- }
3141
- }
3142
- function _async_to_generator$3(fn) {
3143
- return function() {
3144
- var self = this, args = arguments;
3145
- return new Promise(function(resolve, reject) {
3146
- var gen = fn.apply(self, args);
3147
- function _next(value) {
3148
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
3149
- }
3150
- function _throw(err) {
3151
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
3152
- }
3153
- _next(undefined);
3154
- });
3155
- };
3156
- }
3157
- function _ts_generator$3(thisArg, body) {
3158
- var f, y, t, g, _ = {
3159
- label: 0,
3160
- sent: function() {
3161
- if (t[0] & 1) throw t[1];
3162
- return t[1];
3163
- },
3164
- trys: [],
3165
- ops: []
3166
- };
3167
- return g = {
3168
- next: verb(0),
3169
- "throw": verb(1),
3170
- "return": verb(2)
3171
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
3172
- return this;
3173
- }), g;
3174
- function verb(n) {
3175
- return function(v) {
3176
- return step([
3177
- n,
3178
- v
3179
- ]);
3180
- };
3181
- }
3182
- function step(op) {
3183
- if (f) throw new TypeError("Generator is already executing.");
3184
- while(_)try {
3185
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
3186
- if (y = 0, t) op = [
3187
- op[0] & 2,
3188
- t.value
3189
- ];
3190
- switch(op[0]){
3191
- case 0:
3192
- case 1:
3193
- t = op;
3194
- break;
3195
- case 4:
3196
- _.label++;
3197
- return {
3198
- value: op[1],
3199
- done: false
3200
- };
3201
- case 5:
3202
- _.label++;
3203
- y = op[1];
3204
- op = [
3205
- 0
3206
- ];
3207
- continue;
3208
- case 7:
3209
- op = _.ops.pop();
3210
- _.trys.pop();
3211
- continue;
3212
- default:
3213
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
3214
- _ = 0;
3215
- continue;
3216
- }
3217
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
3218
- _.label = op[1];
3219
- break;
3220
- }
3221
- if (op[0] === 6 && _.label < t[1]) {
3222
- _.label = t[1];
3223
- t = op;
3224
- break;
3225
- }
3226
- if (t && _.label < t[2]) {
3227
- _.label = t[2];
3228
- _.ops.push(op);
3229
- break;
3230
- }
3231
- if (t[2]) _.ops.pop();
3232
- _.trys.pop();
3233
- continue;
3234
- }
3235
- op = body.call(thisArg, _);
3236
- } catch (e) {
3237
- op = [
3238
- 6,
3239
- e
3240
- ];
3241
- y = 0;
3242
- } finally{
3243
- f = t = 0;
3244
- }
3245
- if (op[0] & 5) throw op[1];
3246
- return {
3247
- value: op[0] ? op[1] : void 0,
3248
- done: true
3249
- };
3250
- }
3251
- }
3252
- var getRuntimeConfig$1 = function(config) {
3253
- var _config_base64Decoder, _config_base64Encoder, _config_disableHostPrefix, _config_endpointProvider, _config_extensions, _config_httpAuthSchemeProvider, _config_httpAuthSchemes, _config_logger, _config_protocol, _config_protocolSettings, _config_serviceId, _config_urlParser, _config_utf8Decoder, _config_utf8Encoder;
3254
- return {
3255
- apiVersion: "2011-06-15",
3256
- base64Decoder: (_config_base64Decoder = config === null || config === void 0 ? void 0 : config.base64Decoder) !== null && _config_base64Decoder !== void 0 ? _config_base64Decoder : fromBase64,
3257
- base64Encoder: (_config_base64Encoder = config === null || config === void 0 ? void 0 : config.base64Encoder) !== null && _config_base64Encoder !== void 0 ? _config_base64Encoder : toBase64,
3258
- disableHostPrefix: (_config_disableHostPrefix = config === null || config === void 0 ? void 0 : config.disableHostPrefix) !== null && _config_disableHostPrefix !== void 0 ? _config_disableHostPrefix : false,
3259
- endpointProvider: (_config_endpointProvider = config === null || config === void 0 ? void 0 : config.endpointProvider) !== null && _config_endpointProvider !== void 0 ? _config_endpointProvider : defaultEndpointResolver,
3260
- extensions: (_config_extensions = config === null || config === void 0 ? void 0 : config.extensions) !== null && _config_extensions !== void 0 ? _config_extensions : [],
3261
- httpAuthSchemeProvider: (_config_httpAuthSchemeProvider = config === null || config === void 0 ? void 0 : config.httpAuthSchemeProvider) !== null && _config_httpAuthSchemeProvider !== void 0 ? _config_httpAuthSchemeProvider : defaultSTSHttpAuthSchemeProvider,
3262
- httpAuthSchemes: (_config_httpAuthSchemes = config === null || config === void 0 ? void 0 : config.httpAuthSchemes) !== null && _config_httpAuthSchemes !== void 0 ? _config_httpAuthSchemes : [
3263
- {
3264
- schemeId: "aws.auth#sigv4",
3265
- identityProvider: function(ipc) {
3266
- return ipc.getIdentityProvider("aws.auth#sigv4");
3267
- },
3268
- signer: new AwsSdkSigV4Signer()
3269
- },
3270
- {
3271
- schemeId: "smithy.api#noAuth",
3272
- identityProvider: function(ipc) {
3273
- return ipc.getIdentityProvider("smithy.api#noAuth") || /*#__PURE__*/ _async_to_generator$3(function() {
3274
- return _ts_generator$3(this, function(_state) {
3275
- return [
3276
- 2,
3277
- {}
3278
- ];
3279
- });
3280
- });
3281
- },
3282
- signer: new NoAuthSigner()
3283
- }
3284
- ],
3285
- logger: (_config_logger = config === null || config === void 0 ? void 0 : config.logger) !== null && _config_logger !== void 0 ? _config_logger : new NoOpLogger(),
3286
- protocol: (_config_protocol = config === null || config === void 0 ? void 0 : config.protocol) !== null && _config_protocol !== void 0 ? _config_protocol : AwsQueryProtocol,
3287
- protocolSettings: (_config_protocolSettings = config === null || config === void 0 ? void 0 : config.protocolSettings) !== null && _config_protocolSettings !== void 0 ? _config_protocolSettings : {
3288
- defaultNamespace: "com.amazonaws.sts",
3289
- errorTypeRegistries: errorTypeRegistries,
3290
- xmlNamespace: "https://sts.amazonaws.com/doc/2011-06-15/",
3291
- version: "2011-06-15",
3292
- serviceTarget: "AWSSecurityTokenServiceV20110615"
3293
- },
3294
- serviceId: (_config_serviceId = config === null || config === void 0 ? void 0 : config.serviceId) !== null && _config_serviceId !== void 0 ? _config_serviceId : "STS",
3295
- urlParser: (_config_urlParser = config === null || config === void 0 ? void 0 : config.urlParser) !== null && _config_urlParser !== void 0 ? _config_urlParser : parseUrl,
3296
- utf8Decoder: (_config_utf8Decoder = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _config_utf8Decoder !== void 0 ? _config_utf8Decoder : fromUtf8,
3297
- utf8Encoder: (_config_utf8Encoder = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _config_utf8Encoder !== void 0 ? _config_utf8Encoder : toUtf8
3298
- };
3299
- };
3300
-
3301
- function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
3302
- try {
3303
- var info = gen[key](arg);
3304
- var value = info.value;
3305
- } catch (error) {
3306
- reject(error);
3307
- return;
3308
- }
3309
- if (info.done) {
3310
- resolve(value);
3311
- } else {
3312
- Promise.resolve(value).then(_next, _throw);
3313
- }
3314
- }
3315
- function _async_to_generator$2(fn) {
3316
- return function() {
3317
- var self = this, args = arguments;
3318
- return new Promise(function(resolve, reject) {
3319
- var gen = fn.apply(self, args);
3320
- function _next(value) {
3321
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
3322
- }
3323
- function _throw(err) {
3324
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
3325
- }
3326
- _next(undefined);
3327
- });
3328
- };
3329
- }
3330
- function _define_property$3(obj, key, value) {
3331
- if (key in obj) {
3332
- Object.defineProperty(obj, key, {
3333
- value: value,
3334
- enumerable: true,
3335
- configurable: true,
3336
- writable: true
3337
- });
3338
- } else {
3339
- obj[key] = value;
3340
- }
3341
- return obj;
3342
- }
3343
- function _object_spread$2(target) {
3344
- for(var i = 1; i < arguments.length; i++){
3345
- var source = arguments[i] != null ? arguments[i] : {};
3346
- var ownKeys = Object.keys(source);
3347
- if (typeof Object.getOwnPropertySymbols === "function") {
3348
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
3349
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
3350
- }));
3351
- }
3352
- ownKeys.forEach(function(key) {
3353
- _define_property$3(target, key, source[key]);
3354
- });
3355
- }
3356
- return target;
3357
- }
3358
- function ownKeys$1(object, enumerableOnly) {
3359
- var keys = Object.keys(object);
3360
- if (Object.getOwnPropertySymbols) {
3361
- var symbols = Object.getOwnPropertySymbols(object);
3362
- keys.push.apply(keys, symbols);
3363
- }
3364
- return keys;
3365
- }
3366
- function _object_spread_props$1(target, source) {
3367
- source = source != null ? source : {};
3368
- if (Object.getOwnPropertyDescriptors) {
3369
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3370
- } else {
3371
- ownKeys$1(Object(source)).forEach(function(key) {
3372
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3373
- });
3374
- }
3375
- return target;
3376
- }
3377
- function _ts_generator$2(thisArg, body) {
3378
- var f, y, t, g, _ = {
3379
- label: 0,
3380
- sent: function() {
3381
- if (t[0] & 1) throw t[1];
3382
- return t[1];
3383
- },
3384
- trys: [],
3385
- ops: []
3386
- };
3387
- return g = {
3388
- next: verb(0),
3389
- "throw": verb(1),
3390
- "return": verb(2)
3391
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
3392
- return this;
3393
- }), g;
3394
- function verb(n) {
3395
- return function(v) {
3396
- return step([
3397
- n,
3398
- v
3399
- ]);
3400
- };
3401
- }
3402
- function step(op) {
3403
- if (f) throw new TypeError("Generator is already executing.");
3404
- while(_)try {
3405
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
3406
- if (y = 0, t) op = [
3407
- op[0] & 2,
3408
- t.value
3409
- ];
3410
- switch(op[0]){
3411
- case 0:
3412
- case 1:
3413
- t = op;
3414
- break;
3415
- case 4:
3416
- _.label++;
3417
- return {
3418
- value: op[1],
3419
- done: false
3420
- };
3421
- case 5:
3422
- _.label++;
3423
- y = op[1];
3424
- op = [
3425
- 0
3426
- ];
3427
- continue;
3428
- case 7:
3429
- op = _.ops.pop();
3430
- _.trys.pop();
3431
- continue;
3432
- default:
3433
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
3434
- _ = 0;
3435
- continue;
3436
- }
3437
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
3438
- _.label = op[1];
3439
- break;
3440
- }
3441
- if (op[0] === 6 && _.label < t[1]) {
3442
- _.label = t[1];
3443
- t = op;
3444
- break;
3445
- }
3446
- if (t && _.label < t[2]) {
3447
- _.label = t[2];
3448
- _.ops.push(op);
3449
- break;
3450
- }
3451
- if (t[2]) _.ops.pop();
3452
- _.trys.pop();
3453
- continue;
3454
- }
3455
- op = body.call(thisArg, _);
3456
- } catch (e) {
3457
- op = [
3458
- 6,
3459
- e
3460
- ];
3461
- y = 0;
3462
- } finally{
3463
- f = t = 0;
3464
- }
3465
- if (op[0] & 5) throw op[1];
3466
- return {
3467
- value: op[0] ? op[1] : void 0,
3468
- done: true
3469
- };
3470
- }
3471
- }
3472
- var getRuntimeConfig = function(config) {
3473
- emitWarningIfUnsupportedVersion(process.version);
3474
- var defaultsMode = resolveDefaultsModeConfig(config);
3475
- var defaultConfigProvider = function() {
3476
- return defaultsMode().then(loadConfigsForDefaultMode);
3477
- };
3478
- var clientSharedValues = getRuntimeConfig$1(config);
3479
- emitWarningIfUnsupportedVersion$1(process.version);
3480
- var loaderConfig = {
3481
- profile: config === null || config === void 0 ? void 0 : config.profile,
3482
- logger: clientSharedValues.logger
3483
- };
3484
- var _config_authSchemePreference, _config_bodyLengthChecker, _config_defaultUserAgentProvider, _config_httpAuthSchemes, _config_maxAttempts, _config_region, _config_requestHandler, _config_retryMode, _config_sha256, _config_streamCollector, _config_useDualstackEndpoint, _config_useFipsEndpoint, _config_userAgentAppId;
3485
- return _object_spread_props$1(_object_spread$2({}, clientSharedValues, config), {
3486
- runtime: "node",
3487
- defaultsMode: defaultsMode,
3488
- authSchemePreference: (_config_authSchemePreference = config === null || config === void 0 ? void 0 : config.authSchemePreference) !== null && _config_authSchemePreference !== void 0 ? _config_authSchemePreference : loadConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
3489
- bodyLengthChecker: (_config_bodyLengthChecker = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _config_bodyLengthChecker !== void 0 ? _config_bodyLengthChecker : calculateBodyLength,
3490
- defaultUserAgentProvider: (_config_defaultUserAgentProvider = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _config_defaultUserAgentProvider !== void 0 ? _config_defaultUserAgentProvider : createDefaultUserAgentProvider({
3491
- serviceId: clientSharedValues.serviceId,
3492
- clientVersion: packageInfo.version
3493
- }),
3494
- httpAuthSchemes: (_config_httpAuthSchemes = config === null || config === void 0 ? void 0 : config.httpAuthSchemes) !== null && _config_httpAuthSchemes !== void 0 ? _config_httpAuthSchemes : [
3495
- {
3496
- schemeId: "aws.auth#sigv4",
3497
- identityProvider: function(ipc) {
3498
- return ipc.getIdentityProvider("aws.auth#sigv4") || function() {
3499
- var _ref = _async_to_generator$2(function(idProps) {
3500
- return _ts_generator$2(this, function(_state) {
3501
- switch(_state.label){
3502
- case 0:
3503
- return [
3504
- 4,
3505
- config.credentialDefaultProvider((idProps === null || idProps === void 0 ? void 0 : idProps.__config) || {})()
3506
- ];
3507
- case 1:
3508
- return [
3509
- 2,
3510
- _state.sent()
3511
- ];
3512
- }
3513
- });
3514
- });
3515
- return function(idProps) {
3516
- return _ref.apply(this, arguments);
3517
- };
3518
- }();
3519
- },
3520
- signer: new AwsSdkSigV4Signer()
3521
- },
3522
- {
3523
- schemeId: "smithy.api#noAuth",
3524
- identityProvider: function(ipc) {
3525
- return ipc.getIdentityProvider("smithy.api#noAuth") || /*#__PURE__*/ _async_to_generator$2(function() {
3526
- return _ts_generator$2(this, function(_state) {
3527
- return [
3528
- 2,
3529
- {}
3530
- ];
3531
- });
3532
- });
3533
- },
3534
- signer: new NoAuthSigner()
3535
- }
3536
- ],
3537
- maxAttempts: (_config_maxAttempts = config === null || config === void 0 ? void 0 : config.maxAttempts) !== null && _config_maxAttempts !== void 0 ? _config_maxAttempts : loadConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
3538
- region: (_config_region = config === null || config === void 0 ? void 0 : config.region) !== null && _config_region !== void 0 ? _config_region : loadConfig(NODE_REGION_CONFIG_OPTIONS, _object_spread$2({}, NODE_REGION_CONFIG_FILE_OPTIONS, loaderConfig)),
3539
- requestHandler: NodeHttpHandler.create((_config_requestHandler = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _config_requestHandler !== void 0 ? _config_requestHandler : defaultConfigProvider),
3540
- retryMode: (_config_retryMode = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _config_retryMode !== void 0 ? _config_retryMode : loadConfig(_object_spread_props$1(_object_spread$2({}, NODE_RETRY_MODE_CONFIG_OPTIONS), {
3541
- default: /*#__PURE__*/ _async_to_generator$2(function() {
3542
- return _ts_generator$2(this, function(_state) {
3543
- switch(_state.label){
3544
- case 0:
3545
- return [
3546
- 4,
3547
- defaultConfigProvider()
3548
- ];
3549
- case 1:
3550
- return [
3551
- 2,
3552
- _state.sent().retryMode || DEFAULT_RETRY_MODE
3553
- ];
3554
- }
3555
- });
3556
- })
3557
- }), config),
3558
- sha256: (_config_sha256 = config === null || config === void 0 ? void 0 : config.sha256) !== null && _config_sha256 !== void 0 ? _config_sha256 : Hash.bind(null, "sha256"),
3559
- streamCollector: (_config_streamCollector = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _config_streamCollector !== void 0 ? _config_streamCollector : streamCollector,
3560
- useDualstackEndpoint: (_config_useDualstackEndpoint = config === null || config === void 0 ? void 0 : config.useDualstackEndpoint) !== null && _config_useDualstackEndpoint !== void 0 ? _config_useDualstackEndpoint : loadConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
3561
- useFipsEndpoint: (_config_useFipsEndpoint = config === null || config === void 0 ? void 0 : config.useFipsEndpoint) !== null && _config_useFipsEndpoint !== void 0 ? _config_useFipsEndpoint : loadConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
3562
- userAgentAppId: (_config_userAgentAppId = config === null || config === void 0 ? void 0 : config.userAgentAppId) !== null && _config_userAgentAppId !== void 0 ? _config_userAgentAppId : loadConfig(NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
3563
- });
3564
- };
3565
-
3566
- var getHttpAuthExtensionConfiguration = function(runtimeConfig) {
3567
- var _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
3568
- var _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
3569
- var _credentials = runtimeConfig.credentials;
3570
- return {
3571
- setHttpAuthScheme: function setHttpAuthScheme(httpAuthScheme) {
3572
- var index = _httpAuthSchemes.findIndex(function(scheme) {
3573
- return scheme.schemeId === httpAuthScheme.schemeId;
3574
- });
3575
- if (index === -1) {
3576
- _httpAuthSchemes.push(httpAuthScheme);
3577
- } else {
3578
- _httpAuthSchemes.splice(index, 1, httpAuthScheme);
3579
- }
3580
- },
3581
- httpAuthSchemes: function httpAuthSchemes() {
3582
- return _httpAuthSchemes;
3583
- },
3584
- setHttpAuthSchemeProvider: function setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
3585
- _httpAuthSchemeProvider = httpAuthSchemeProvider;
3586
- },
3587
- httpAuthSchemeProvider: function httpAuthSchemeProvider() {
3588
- return _httpAuthSchemeProvider;
3589
- },
3590
- setCredentials: function setCredentials(credentials) {
3591
- _credentials = credentials;
3592
- },
3593
- credentials: function credentials() {
3594
- return _credentials;
3595
- }
3596
- };
3597
- };
3598
- var resolveHttpAuthRuntimeConfig = function(config) {
3599
- return {
3600
- httpAuthSchemes: config.httpAuthSchemes(),
3601
- httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
3602
- credentials: config.credentials()
3603
- };
3604
- };
3605
-
3606
- var resolveRuntimeExtensions = function(runtimeConfig, extensions) {
3607
- var extensionConfiguration = Object.assign(getAwsRegionExtensionConfiguration(runtimeConfig), getDefaultExtensionConfiguration(runtimeConfig), getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
3608
- extensions.forEach(function(extension) {
3609
- return extension.configure(extensionConfiguration);
3610
- });
3611
- return Object.assign(runtimeConfig, resolveAwsRegionExtensionConfiguration(extensionConfiguration), resolveDefaultRuntimeConfig(extensionConfiguration), resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
3612
- };
3613
-
3614
- function _array_like_to_array(arr, len) {
3615
- if (len == null || len > arr.length) len = arr.length;
3616
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3617
- return arr2;
3618
- }
3619
- function _array_with_holes(arr) {
3620
- if (Array.isArray(arr)) return arr;
3621
- }
3622
- function _assert_this_initialized$4(self) {
3623
- if (self === void 0) {
3624
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3625
- }
3626
- return self;
3627
- }
3628
- function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
3629
- try {
3630
- var info = gen[key](arg);
3631
- var value = info.value;
3632
- } catch (error) {
3633
- reject(error);
3634
- return;
3635
- }
3636
- if (info.done) {
3637
- resolve(value);
3638
- } else {
3639
- Promise.resolve(value).then(_next, _throw);
3640
- }
3641
- }
3642
- function _async_to_generator$1(fn) {
3643
- return function() {
3644
- var self = this, args = arguments;
3645
- return new Promise(function(resolve, reject) {
3646
- var gen = fn.apply(self, args);
3647
- function _next(value) {
3648
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
3649
- }
3650
- function _throw(err) {
3651
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
3652
- }
3653
- _next(undefined);
3654
- });
3655
- };
3656
- }
3657
- function _class_call_check$4(instance, Constructor) {
3658
- if (!(instance instanceof Constructor)) {
3659
- throw new TypeError("Cannot call a class as a function");
3660
- }
3661
- }
3662
- function _defineProperties(target, props) {
3663
- for(var i = 0; i < props.length; i++){
3664
- var descriptor = props[i];
3665
- descriptor.enumerable = descriptor.enumerable || false;
3666
- descriptor.configurable = true;
3667
- if ("value" in descriptor) descriptor.writable = true;
3668
- Object.defineProperty(target, descriptor.key, descriptor);
3669
- }
3670
- }
3671
- function _create_class(Constructor, protoProps, staticProps) {
3672
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3673
- return Constructor;
3674
- }
3675
- function _define_property$2(obj, key, value) {
3676
- if (key in obj) {
3677
- Object.defineProperty(obj, key, {
3678
- value: value,
3679
- enumerable: true,
3680
- configurable: true,
3681
- writable: true
3682
- });
3683
- } else {
3684
- obj[key] = value;
3685
- }
3686
- return obj;
3687
- }
3688
- function _get(target, property, receiver) {
3689
- if (typeof Reflect !== "undefined" && Reflect.get) {
3690
- _get = Reflect.get;
3691
- } else {
3692
- _get = function get(target, property, receiver) {
3693
- var base = _super_prop_base(target, property);
3694
- if (!base) return;
3695
- var desc = Object.getOwnPropertyDescriptor(base, property);
3696
- if (desc.get) {
3697
- return desc.get.call(receiver || target);
3698
- }
3699
- return desc.value;
3700
- };
3701
- }
3702
- return _get(target, property, receiver || target);
3703
- }
3704
- function _get_prototype_of$4(o) {
3705
- _get_prototype_of$4 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
3706
- return o.__proto__ || Object.getPrototypeOf(o);
3707
- };
3708
- return _get_prototype_of$4(o);
3709
- }
3710
- function _inherits$4(subClass, superClass) {
3711
- if (typeof superClass !== "function" && superClass !== null) {
3712
- throw new TypeError("Super expression must either be null or a function");
3713
- }
3714
- subClass.prototype = Object.create(superClass && superClass.prototype, {
3715
- constructor: {
3716
- value: subClass,
3717
- writable: true,
3718
- configurable: true
3719
- }
3720
- });
3721
- if (superClass) _set_prototype_of$4(subClass, superClass);
3722
- }
3723
- function _iterable_to_array_limit(arr, i) {
3724
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
3725
- if (_i == null) return;
3726
- var _arr = [];
3727
- var _n = true;
3728
- var _d = false;
3729
- var _s, _e;
3730
- try {
3731
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
3732
- _arr.push(_s.value);
3733
- if (i && _arr.length === i) break;
3734
- }
3735
- } catch (err) {
3736
- _d = true;
3737
- _e = err;
3738
- } finally{
3739
- try {
3740
- if (!_n && _i["return"] != null) _i["return"]();
3741
- } finally{
3742
- if (_d) throw _e;
3743
- }
3744
- }
3745
- return _arr;
3746
- }
3747
- function _non_iterable_rest() {
3748
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3749
- }
3750
- function _possible_constructor_return$4(self, call) {
3751
- if (call && (_type_of$4(call) === "object" || typeof call === "function")) {
3752
- return call;
3753
- }
3754
- return _assert_this_initialized$4(self);
3755
- }
3756
- function _set_prototype_of$4(o, p) {
3757
- _set_prototype_of$4 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
3758
- o.__proto__ = p;
3759
- return o;
3760
- };
3761
- return _set_prototype_of$4(o, p);
3762
- }
3763
- function _sliced_to_array(arr, i) {
3764
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
3765
- }
3766
- function _super_prop_base(object, property) {
3767
- while(!Object.prototype.hasOwnProperty.call(object, property)){
3768
- object = _get_prototype_of$4(object);
3769
- if (object === null) break;
3770
- }
3771
- return object;
3772
- }
3773
- function _type_of$4(obj) {
3774
- "@swc/helpers - typeof";
3775
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3776
- }
3777
- function _unsupported_iterable_to_array(o, minLen) {
3778
- if (!o) return;
3779
- if (typeof o === "string") return _array_like_to_array(o, minLen);
3780
- var n = Object.prototype.toString.call(o).slice(8, -1);
3781
- if (n === "Object" && o.constructor) n = o.constructor.name;
3782
- if (n === "Map" || n === "Set") return Array.from(n);
3783
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
3784
- }
3785
- function _is_native_reflect_construct$4() {
3786
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3787
- if (Reflect.construct.sham) return false;
3788
- if (typeof Proxy === "function") return true;
3789
- try {
3790
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
3791
- return true;
3792
- } catch (e) {
3793
- return false;
3794
- }
3795
- }
3796
- function _create_super$4(Derived) {
3797
- var hasNativeReflectConstruct = _is_native_reflect_construct$4();
3798
- return function _createSuperInternal() {
3799
- var Super = _get_prototype_of$4(Derived), result;
3800
- if (hasNativeReflectConstruct) {
3801
- var NewTarget = _get_prototype_of$4(this).constructor;
3802
- result = Reflect.construct(Super, arguments, NewTarget);
3803
- } else {
3804
- result = Super.apply(this, arguments);
3805
- }
3806
- return _possible_constructor_return$4(this, result);
3807
- };
3808
- }
3809
- function _ts_generator$1(thisArg, body) {
3810
- var f, y, t, g, _ = {
3811
- label: 0,
3812
- sent: function() {
3813
- if (t[0] & 1) throw t[1];
3814
- return t[1];
3815
- },
3816
- trys: [],
3817
- ops: []
3818
- };
3819
- return g = {
3820
- next: verb(0),
3821
- "throw": verb(1),
3822
- "return": verb(2)
3823
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
3824
- return this;
3825
- }), g;
3826
- function verb(n) {
3827
- return function(v) {
3828
- return step([
3829
- n,
3830
- v
3831
- ]);
3832
- };
3833
- }
3834
- function step(op) {
3835
- if (f) throw new TypeError("Generator is already executing.");
3836
- while(_)try {
3837
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
3838
- if (y = 0, t) op = [
3839
- op[0] & 2,
3840
- t.value
3841
- ];
3842
- switch(op[0]){
3843
- case 0:
3844
- case 1:
3845
- t = op;
3846
- break;
3847
- case 4:
3848
- _.label++;
3849
- return {
3850
- value: op[1],
3851
- done: false
3852
- };
3853
- case 5:
3854
- _.label++;
3855
- y = op[1];
3856
- op = [
3857
- 0
3858
- ];
3859
- continue;
3860
- case 7:
3861
- op = _.ops.pop();
3862
- _.trys.pop();
3863
- continue;
3864
- default:
3865
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
3866
- _ = 0;
3867
- continue;
3868
- }
3869
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
3870
- _.label = op[1];
3871
- break;
3872
- }
3873
- if (op[0] === 6 && _.label < t[1]) {
3874
- _.label = t[1];
3875
- t = op;
3876
- break;
3877
- }
3878
- if (t && _.label < t[2]) {
3879
- _.label = t[2];
3880
- _.ops.push(op);
3881
- break;
3882
- }
3883
- if (t[2]) _.ops.pop();
3884
- _.trys.pop();
3885
- continue;
3886
- }
3887
- op = body.call(thisArg, _);
3888
- } catch (e) {
3889
- op = [
3890
- 6,
3891
- e
3892
- ];
3893
- y = 0;
3894
- } finally{
3895
- f = t = 0;
3896
- }
3897
- if (op[0] & 5) throw op[1];
3898
- return {
3899
- value: op[0] ? op[1] : void 0,
3900
- done: true
3901
- };
3902
- }
3903
- }
3904
- var STSClient = /*#__PURE__*/ function(__Client) {
3905
- _inherits$4(STSClient, __Client);
3906
- var _super = _create_super$4(STSClient);
3907
- function STSClient() {
3908
- for(var _len = arguments.length, _tmp = new Array(_len), _key = 0; _key < _len; _key++){
3909
- _tmp[_key] = arguments[_key];
3910
- }
3911
- var _tmp1 = _sliced_to_array(_tmp, 1), configuration = _tmp1[0];
3912
- _class_call_check$4(this, STSClient);
3913
- var _this;
3914
- var _config_0 = getRuntimeConfig(configuration || {});
3915
- _this = _super.call(this, _config_0);
3916
- _define_property$2(_assert_this_initialized$4(_this), "config", void 0);
3917
- _this.initConfig = _config_0;
3918
- var _config_1 = resolveClientEndpointParameters(_config_0);
3919
- var _config_2 = resolveUserAgentConfig(_config_1);
3920
- var _config_3 = resolveRetryConfig(_config_2);
3921
- var _config_4 = resolveRegionConfig(_config_3);
3922
- var _config_5 = resolveHostHeaderConfig(_config_4);
3923
- var _config_6 = resolveEndpointConfig(_config_5);
3924
- var _config_7 = resolveHttpAuthSchemeConfig(_config_6);
3925
- var _config_8 = resolveRuntimeExtensions(_config_7, (configuration === null || configuration === void 0 ? void 0 : configuration.extensions) || []);
3926
- _this.config = _config_8;
3927
- _this.middlewareStack.use(getSchemaSerdePlugin(_this.config));
3928
- _this.middlewareStack.use(getUserAgentPlugin(_this.config));
3929
- _this.middlewareStack.use(getRetryPlugin(_this.config));
3930
- _this.middlewareStack.use(getContentLengthPlugin(_this.config));
3931
- _this.middlewareStack.use(getHostHeaderPlugin(_this.config));
3932
- _this.middlewareStack.use(getLoggerPlugin(_this.config));
3933
- _this.middlewareStack.use(getRecursionDetectionPlugin(_this.config));
3934
- _this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(_this.config, {
3935
- httpAuthSchemeParametersProvider: defaultSTSHttpAuthSchemeParametersProvider,
3936
- identityProviderConfigProvider: function() {
3937
- var _ref = _async_to_generator$1(function(config) {
3938
- return _ts_generator$1(this, function(_state) {
3939
- return [
3940
- 2,
3941
- new DefaultIdentityProviderConfig({
3942
- "aws.auth#sigv4": config.credentials
3943
- })
3944
- ];
3945
- });
3946
- });
3947
- return function(config) {
3948
- return _ref.apply(this, arguments);
3949
- };
3950
- }()
3951
- }));
3952
- _this.middlewareStack.use(getHttpSigningPlugin(_this.config));
3953
- return _this;
3954
- }
3955
- _create_class(STSClient, [
3956
- {
3957
- key: "destroy",
3958
- value: function destroy() {
3959
- _get(_get_prototype_of$4(STSClient.prototype), "destroy", this).call(this);
3960
- }
3961
- }
3962
- ]);
3963
- return STSClient;
3964
- }(Client);
3965
-
3966
- function _assert_this_initialized$3(self) {
3967
- if (self === void 0) {
3968
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3969
- }
3970
- return self;
3971
- }
3972
- function _class_call_check$3(instance, Constructor) {
3973
- if (!(instance instanceof Constructor)) {
3974
- throw new TypeError("Cannot call a class as a function");
3975
- }
3976
- }
3977
- function _get_prototype_of$3(o) {
3978
- _get_prototype_of$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
3979
- return o.__proto__ || Object.getPrototypeOf(o);
3980
- };
3981
- return _get_prototype_of$3(o);
3982
- }
3983
- function _inherits$3(subClass, superClass) {
3984
- if (typeof superClass !== "function" && superClass !== null) {
3985
- throw new TypeError("Super expression must either be null or a function");
3986
- }
3987
- subClass.prototype = Object.create(superClass && superClass.prototype, {
3988
- constructor: {
3989
- value: subClass,
3990
- writable: true,
3991
- configurable: true
3992
- }
3993
- });
3994
- if (superClass) _set_prototype_of$3(subClass, superClass);
3995
- }
3996
- function _possible_constructor_return$3(self, call) {
3997
- if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
3998
- return call;
3999
- }
4000
- return _assert_this_initialized$3(self);
4001
- }
4002
- function _set_prototype_of$3(o, p) {
4003
- _set_prototype_of$3 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
4004
- o.__proto__ = p;
4005
- return o;
4006
- };
4007
- return _set_prototype_of$3(o, p);
4008
- }
4009
- function _type_of$3(obj) {
4010
- "@swc/helpers - typeof";
4011
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
4012
- }
4013
- function _is_native_reflect_construct$3() {
4014
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
4015
- if (Reflect.construct.sham) return false;
4016
- if (typeof Proxy === "function") return true;
4017
- try {
4018
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
4019
- return true;
4020
- } catch (e) {
4021
- return false;
4022
- }
4023
- }
4024
- function _create_super$3(Derived) {
4025
- var hasNativeReflectConstruct = _is_native_reflect_construct$3();
4026
- return function _createSuperInternal() {
4027
- var Super = _get_prototype_of$3(Derived), result;
4028
- if (hasNativeReflectConstruct) {
4029
- var NewTarget = _get_prototype_of$3(this).constructor;
4030
- result = Reflect.construct(Super, arguments, NewTarget);
4031
- } else {
4032
- result = Super.apply(this, arguments);
4033
- }
4034
- return _possible_constructor_return$3(this, result);
4035
- };
4036
- }
4037
- var AssumeRoleCommand = /*#__PURE__*/ function(_$Command_classBuilder_ep_m_s_n_sc_build) {
4038
- _inherits$3(AssumeRoleCommand, _$Command_classBuilder_ep_m_s_n_sc_build);
4039
- var _super = _create_super$3(AssumeRoleCommand);
4040
- function AssumeRoleCommand() {
4041
- _class_call_check$3(this, AssumeRoleCommand);
4042
- return _super.apply(this, arguments);
4043
- }
4044
- return AssumeRoleCommand;
4045
- }(Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
4046
- return [
4047
- getEndpointPlugin(config, Command.getEndpointParameterInstructions())
4048
- ];
4049
- }).s("AWSSecurityTokenServiceV20110615", "AssumeRole", {}).n("STSClient", "AssumeRoleCommand").sc(AssumeRole$).build());
4050
-
4051
- function _assert_this_initialized$2(self) {
4052
- if (self === void 0) {
4053
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4054
- }
4055
- return self;
4056
- }
4057
- function _class_call_check$2(instance, Constructor) {
4058
- if (!(instance instanceof Constructor)) {
4059
- throw new TypeError("Cannot call a class as a function");
4060
- }
4061
- }
4062
- function _get_prototype_of$2(o) {
4063
- _get_prototype_of$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
4064
- return o.__proto__ || Object.getPrototypeOf(o);
4065
- };
4066
- return _get_prototype_of$2(o);
4067
- }
4068
- function _inherits$2(subClass, superClass) {
4069
- if (typeof superClass !== "function" && superClass !== null) {
4070
- throw new TypeError("Super expression must either be null or a function");
4071
- }
4072
- subClass.prototype = Object.create(superClass && superClass.prototype, {
4073
- constructor: {
4074
- value: subClass,
4075
- writable: true,
4076
- configurable: true
4077
- }
4078
- });
4079
- if (superClass) _set_prototype_of$2(subClass, superClass);
4080
- }
4081
- function _possible_constructor_return$2(self, call) {
4082
- if (call && (_type_of$2(call) === "object" || typeof call === "function")) {
4083
- return call;
4084
- }
4085
- return _assert_this_initialized$2(self);
4086
- }
4087
- function _set_prototype_of$2(o, p) {
4088
- _set_prototype_of$2 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
4089
- o.__proto__ = p;
4090
- return o;
4091
- };
4092
- return _set_prototype_of$2(o, p);
4093
- }
4094
- function _type_of$2(obj) {
4095
- "@swc/helpers - typeof";
4096
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
4097
- }
4098
- function _is_native_reflect_construct$2() {
4099
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
4100
- if (Reflect.construct.sham) return false;
4101
- if (typeof Proxy === "function") return true;
4102
- try {
4103
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
4104
- return true;
4105
- } catch (e) {
4106
- return false;
4107
- }
4108
- }
4109
- function _create_super$2(Derived) {
4110
- var hasNativeReflectConstruct = _is_native_reflect_construct$2();
4111
- return function _createSuperInternal() {
4112
- var Super = _get_prototype_of$2(Derived), result;
4113
- if (hasNativeReflectConstruct) {
4114
- var NewTarget = _get_prototype_of$2(this).constructor;
4115
- result = Reflect.construct(Super, arguments, NewTarget);
4116
- } else {
4117
- result = Super.apply(this, arguments);
4118
- }
4119
- return _possible_constructor_return$2(this, result);
4120
- };
4121
- }
4122
- var AssumeRoleWithWebIdentityCommand = /*#__PURE__*/ function(_$Command_classBuilder_ep_m_s_n_sc_build) {
4123
- _inherits$2(AssumeRoleWithWebIdentityCommand, _$Command_classBuilder_ep_m_s_n_sc_build);
4124
- var _super = _create_super$2(AssumeRoleWithWebIdentityCommand);
4125
- function AssumeRoleWithWebIdentityCommand() {
4126
- _class_call_check$2(this, AssumeRoleWithWebIdentityCommand);
4127
- return _super.apply(this, arguments);
4128
- }
4129
- return AssumeRoleWithWebIdentityCommand;
4130
- }(Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
4131
- return [
4132
- getEndpointPlugin(config, Command.getEndpointParameterInstructions())
4133
- ];
4134
- }).s("AWSSecurityTokenServiceV20110615", "AssumeRoleWithWebIdentity", {}).n("STSClient", "AssumeRoleWithWebIdentityCommand").sc(AssumeRoleWithWebIdentity$).build());
4135
-
4136
- function _assert_this_initialized$1(self) {
4137
- if (self === void 0) {
4138
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4139
- }
4140
- return self;
4141
- }
4142
- function _class_call_check$1(instance, Constructor) {
4143
- if (!(instance instanceof Constructor)) {
4144
- throw new TypeError("Cannot call a class as a function");
4145
- }
4146
- }
4147
- function _get_prototype_of$1(o) {
4148
- _get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
4149
- return o.__proto__ || Object.getPrototypeOf(o);
4150
- };
4151
- return _get_prototype_of$1(o);
4152
- }
4153
- function _inherits$1(subClass, superClass) {
4154
- if (typeof superClass !== "function" && superClass !== null) {
4155
- throw new TypeError("Super expression must either be null or a function");
4156
- }
4157
- subClass.prototype = Object.create(superClass && superClass.prototype, {
4158
- constructor: {
4159
- value: subClass,
4160
- writable: true,
4161
- configurable: true
4162
- }
4163
- });
4164
- if (superClass) _set_prototype_of$1(subClass, superClass);
4165
- }
4166
- function _possible_constructor_return$1(self, call) {
4167
- if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
4168
- return call;
4169
- }
4170
- return _assert_this_initialized$1(self);
4171
- }
4172
- function _set_prototype_of$1(o, p) {
4173
- _set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
4174
- o.__proto__ = p;
4175
- return o;
4176
- };
4177
- return _set_prototype_of$1(o, p);
4178
- }
4179
- function _type_of$1(obj) {
4180
- "@swc/helpers - typeof";
4181
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
4182
- }
4183
- function _is_native_reflect_construct$1() {
4184
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
4185
- if (Reflect.construct.sham) return false;
4186
- if (typeof Proxy === "function") return true;
4187
- try {
4188
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
4189
- return true;
4190
- } catch (e) {
4191
- return false;
4192
- }
4193
- }
4194
- function _create_super$1(Derived) {
4195
- var hasNativeReflectConstruct = _is_native_reflect_construct$1();
4196
- return function _createSuperInternal() {
4197
- var Super = _get_prototype_of$1(Derived), result;
4198
- if (hasNativeReflectConstruct) {
4199
- var NewTarget = _get_prototype_of$1(this).constructor;
4200
- result = Reflect.construct(Super, arguments, NewTarget);
4201
- } else {
4202
- result = Super.apply(this, arguments);
4203
- }
4204
- return _possible_constructor_return$1(this, result);
4205
- };
4206
- }
4207
- var commands = {
4208
- AssumeRoleCommand: AssumeRoleCommand,
4209
- AssumeRoleWithWebIdentityCommand: AssumeRoleWithWebIdentityCommand
4210
- };
4211
- var STS = /*#__PURE__*/ function(STSClient) {
4212
- _inherits$1(STS, STSClient);
4213
- var _super = _create_super$1(STS);
4214
- function STS() {
4215
- _class_call_check$1(this, STS);
4216
- return _super.apply(this, arguments);
4217
- }
4218
- return STS;
4219
- }(STSClient);
4220
- createAggregatedClient(commands, STS);
4221
-
4222
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
4223
- try {
4224
- var info = gen[key](arg);
4225
- var value = info.value;
4226
- } catch (error) {
4227
- reject(error);
4228
- return;
4229
- }
4230
- if (info.done) {
4231
- resolve(value);
4232
- } else {
4233
- Promise.resolve(value).then(_next, _throw);
4234
- }
4235
- }
4236
- function _async_to_generator(fn) {
4237
- return function() {
4238
- var self = this, args = arguments;
4239
- return new Promise(function(resolve, reject) {
4240
- var gen = fn.apply(self, args);
4241
- function _next(value) {
4242
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1035
+ function _async_to_generator(fn) {
1036
+ return function() {
1037
+ var self = this, args = arguments;
1038
+ return new Promise(function(resolve, reject) {
1039
+ var gen = fn.apply(self, args);
1040
+ function _next(value) {
1041
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
4243
1042
  }
4244
1043
  function _throw(err) {
4245
1044
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
@@ -4248,53 +1047,6 @@ function _async_to_generator(fn) {
4248
1047
  });
4249
1048
  };
4250
1049
  }
4251
- function _define_property$1(obj, key, value) {
4252
- if (key in obj) {
4253
- Object.defineProperty(obj, key, {
4254
- value: value,
4255
- enumerable: true,
4256
- configurable: true,
4257
- writable: true
4258
- });
4259
- } else {
4260
- obj[key] = value;
4261
- }
4262
- return obj;
4263
- }
4264
- function _object_spread$1(target) {
4265
- for(var i = 1; i < arguments.length; i++){
4266
- var source = arguments[i] != null ? arguments[i] : {};
4267
- var ownKeys = Object.keys(source);
4268
- if (typeof Object.getOwnPropertySymbols === "function") {
4269
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
4270
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
4271
- }));
4272
- }
4273
- ownKeys.forEach(function(key) {
4274
- _define_property$1(target, key, source[key]);
4275
- });
4276
- }
4277
- return target;
4278
- }
4279
- function ownKeys(object, enumerableOnly) {
4280
- var keys = Object.keys(object);
4281
- if (Object.getOwnPropertySymbols) {
4282
- var symbols = Object.getOwnPropertySymbols(object);
4283
- keys.push.apply(keys, symbols);
4284
- }
4285
- return keys;
4286
- }
4287
- function _object_spread_props(target, source) {
4288
- source = source != null ? source : {};
4289
- if (Object.getOwnPropertyDescriptors) {
4290
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4291
- } else {
4292
- ownKeys(Object(source)).forEach(function(key) {
4293
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4294
- });
4295
- }
4296
- return target;
4297
- }
4298
1050
  function _ts_generator(thisArg, body) {
4299
1051
  var f, y, t, g, _ = {
4300
1052
  label: 0,
@@ -4390,391 +1142,124 @@ function _ts_generator(thisArg, body) {
4390
1142
  };
4391
1143
  }
4392
1144
  }
4393
- var getAccountIdFromAssumedRoleUser = function(assumedRoleUser) {
4394
- if (typeof (assumedRoleUser === null || assumedRoleUser === void 0 ? void 0 : assumedRoleUser.Arn) === "string") {
4395
- var arnComponents = assumedRoleUser.Arn.split(":");
4396
- if (arnComponents.length > 4 && arnComponents[4] !== "") {
4397
- return arnComponents[4];
4398
- }
4399
- }
4400
- return undefined;
4401
- };
4402
- var resolveRegion = function() {
4403
- var _ref = _async_to_generator(function(_region, _parentRegion, credentialProviderLogger) {
4404
- var loaderConfig, _credentialProviderLogger_debug, region, _tmp, parentRegion, _tmp1, stsDefaultRegion, _ref, resolvedRegion, _tmp2;
1145
+ var fromSSO = function() {
1146
+ var init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1147
+ return /*#__PURE__*/ _async_to_generator(function() {
1148
+ var callerClientConfig, _init_logger, ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession, ssoClient, _init_profile, profileName, profiles, profile, ssoSessions, session, conflictMsg, _validateSsoProfile, sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session;
4405
1149
  var _arguments = arguments;
4406
1150
  return _ts_generator(this, function(_state) {
4407
1151
  switch(_state.label){
4408
1152
  case 0:
4409
- loaderConfig = _arguments.length > 3 && _arguments[3] !== void 0 ? _arguments[3] : {};
4410
- if (!(typeof _region === "function")) return [
1153
+ callerClientConfig = (_arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}).callerClientConfig;
1154
+ (_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : _init_logger.debug("@aws-sdk/credential-provider-sso - fromSSO");
1155
+ ssoStartUrl = init.ssoStartUrl, ssoAccountId = init.ssoAccountId, ssoRegion = init.ssoRegion, ssoRoleName = init.ssoRoleName, ssoSession = init.ssoSession;
1156
+ ssoClient = init.ssoClient;
1157
+ profileName = getProfileName({
1158
+ profile: (_init_profile = init.profile) !== null && _init_profile !== void 0 ? _init_profile : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.profile
1159
+ });
1160
+ if (!(!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession)) return [
4411
1161
  3,
4412
- 2
1162
+ 4
4413
1163
  ];
4414
1164
  return [
4415
1165
  4,
4416
- _region()
1166
+ parseKnownFiles(init)
4417
1167
  ];
4418
1168
  case 1:
4419
- _tmp = _state.sent();
4420
- return [
1169
+ profiles = _state.sent();
1170
+ profile = profiles[profileName];
1171
+ if (!profile) {
1172
+ throw new CredentialsProviderError("Profile ".concat(profileName, " was not found."), {
1173
+ logger: init.logger
1174
+ });
1175
+ }
1176
+ if (!isSsoProfile(profile)) {
1177
+ throw new CredentialsProviderError("Profile ".concat(profileName, " is not configured with SSO credentials."), {
1178
+ logger: init.logger
1179
+ });
1180
+ }
1181
+ if (!(profile === null || profile === void 0 ? void 0 : profile.sso_session)) return [
4421
1182
  3,
4422
1183
  3
4423
1184
  ];
4424
- case 2:
4425
- _tmp = _region;
4426
- _state.label = 3;
4427
- case 3:
4428
- region = _tmp;
4429
- if (!(typeof _parentRegion === "function")) return [
4430
- 3,
4431
- 5
4432
- ];
4433
- return [
4434
- 4,
4435
- _parentRegion()
4436
- ];
4437
- case 4:
4438
- _tmp1 = _state.sent();
4439
- return [
4440
- 3,
4441
- 6
4442
- ];
4443
- case 5:
4444
- _tmp1 = _parentRegion;
4445
- _state.label = 6;
4446
- case 6:
4447
- parentRegion = _tmp1;
4448
- stsDefaultRegion = "";
4449
- if (!((_ref = region !== null && region !== void 0 ? region : parentRegion) !== null && _ref !== void 0)) return [
4450
- 3,
4451
- 7
4452
- ];
4453
- _tmp2 = _ref;
4454
- return [
4455
- 3,
4456
- 9
4457
- ];
4458
- case 7:
4459
1185
  return [
4460
1186
  4,
4461
- stsRegionDefaultResolver(loaderConfig)()
1187
+ loadSsoSessionData(init)
4462
1188
  ];
4463
- case 8:
4464
- _tmp2 = stsDefaultRegion = _state.sent();
4465
- _state.label = 9;
4466
- case 9:
4467
- resolvedRegion = _tmp2;
4468
- credentialProviderLogger === null || credentialProviderLogger === void 0 ? void 0 : (_credentialProviderLogger_debug = credentialProviderLogger.debug) === null || _credentialProviderLogger_debug === void 0 ? void 0 : _credentialProviderLogger_debug.call(credentialProviderLogger, "@aws-sdk/client-sts::resolveRegion", "accepting first of:", "".concat(region, " (credential provider clientConfig)"), "".concat(parentRegion, " (contextual client)"), "".concat(stsDefaultRegion, " (STS default: AWS_REGION, profile region, or us-east-1)"));
1189
+ case 2:
1190
+ ssoSessions = _state.sent();
1191
+ session = ssoSessions[profile.sso_session];
1192
+ conflictMsg = " configurations in profile ".concat(profileName, " and sso-session ").concat(profile.sso_session);
1193
+ if (ssoRegion && ssoRegion !== session.sso_region) {
1194
+ throw new CredentialsProviderError("Conflicting SSO region" + conflictMsg, {
1195
+ tryNextLink: false,
1196
+ logger: init.logger
1197
+ });
1198
+ }
1199
+ if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
1200
+ throw new CredentialsProviderError("Conflicting SSO start_url" + conflictMsg, {
1201
+ tryNextLink: false,
1202
+ logger: init.logger
1203
+ });
1204
+ }
1205
+ profile.sso_region = session.sso_region;
1206
+ profile.sso_start_url = session.sso_start_url;
1207
+ _state.label = 3;
1208
+ case 3:
1209
+ _validateSsoProfile = validateSsoProfile(profile, init.logger), sso_start_url = _validateSsoProfile.sso_start_url, sso_account_id = _validateSsoProfile.sso_account_id, sso_region = _validateSsoProfile.sso_region, sso_role_name = _validateSsoProfile.sso_role_name, sso_session = _validateSsoProfile.sso_session;
4469
1210
  return [
4470
1211
  2,
4471
- resolvedRegion
1212
+ resolveSSOCredentials({
1213
+ ssoStartUrl: sso_start_url,
1214
+ ssoSession: sso_session,
1215
+ ssoAccountId: sso_account_id,
1216
+ ssoRegion: sso_region,
1217
+ ssoRoleName: sso_role_name,
1218
+ ssoClient: ssoClient,
1219
+ clientConfig: init.clientConfig,
1220
+ parentClientConfig: init.parentClientConfig,
1221
+ callerClientConfig: init.callerClientConfig,
1222
+ profile: profileName,
1223
+ filepath: init.filepath,
1224
+ configFilepath: init.configFilepath,
1225
+ ignoreCache: init.ignoreCache,
1226
+ logger: init.logger
1227
+ })
4472
1228
  ];
4473
- }
4474
- });
4475
- });
4476
- return function resolveRegion(_region, _parentRegion, credentialProviderLogger) {
4477
- return _ref.apply(this, arguments);
4478
- };
4479
- }();
4480
- var getDefaultRoleAssumer$1 = function(stsOptions, STSClient) {
4481
- var stsClient;
4482
- var closureSourceCreds;
4483
- return function() {
4484
- var _ref = _async_to_generator(function(sourceCreds, params) {
4485
- var _stsOptions_parentClientConfig, _stsOptions_parentClientConfig1, _stsOptions_parentClientConfig2, _stsOptions_parentClientConfig3, _stsOptions_parentClientConfig4, _stsOptions_logger, logger, _stsOptions_profile, profile, region, _stsOptions_requestHandler, requestHandler, credentialProviderLogger, _stsOptions_userAgentAppId, userAgentAppId, resolvedRegion, isCompatibleRequestHandler, _ref, Credentials, AssumedRoleUser, accountId, credentials;
4486
- return _ts_generator(this, function(_state) {
4487
- switch(_state.label){
4488
- case 0:
4489
- closureSourceCreds = sourceCreds;
4490
- if (!!stsClient) return [
4491
- 3,
4492
- 2
4493
- ];
4494
- _stsOptions_logger = stsOptions.logger, logger = _stsOptions_logger === void 0 ? stsOptions === null || stsOptions === void 0 ? void 0 : (_stsOptions_parentClientConfig = stsOptions.parentClientConfig) === null || _stsOptions_parentClientConfig === void 0 ? void 0 : _stsOptions_parentClientConfig.logger : _stsOptions_logger, _stsOptions_profile = stsOptions.profile, profile = _stsOptions_profile === void 0 ? stsOptions === null || stsOptions === void 0 ? void 0 : (_stsOptions_parentClientConfig1 = stsOptions.parentClientConfig) === null || _stsOptions_parentClientConfig1 === void 0 ? void 0 : _stsOptions_parentClientConfig1.profile : _stsOptions_profile, region = stsOptions.region, _stsOptions_requestHandler = stsOptions.requestHandler, requestHandler = _stsOptions_requestHandler === void 0 ? stsOptions === null || stsOptions === void 0 ? void 0 : (_stsOptions_parentClientConfig2 = stsOptions.parentClientConfig) === null || _stsOptions_parentClientConfig2 === void 0 ? void 0 : _stsOptions_parentClientConfig2.requestHandler : _stsOptions_requestHandler, credentialProviderLogger = stsOptions.credentialProviderLogger, _stsOptions_userAgentAppId = stsOptions.userAgentAppId, userAgentAppId = _stsOptions_userAgentAppId === void 0 ? stsOptions === null || stsOptions === void 0 ? void 0 : (_stsOptions_parentClientConfig3 = stsOptions.parentClientConfig) === null || _stsOptions_parentClientConfig3 === void 0 ? void 0 : _stsOptions_parentClientConfig3.userAgentAppId : _stsOptions_userAgentAppId;
4495
- return [
4496
- 4,
4497
- resolveRegion(region, stsOptions === null || stsOptions === void 0 ? void 0 : (_stsOptions_parentClientConfig4 = stsOptions.parentClientConfig) === null || _stsOptions_parentClientConfig4 === void 0 ? void 0 : _stsOptions_parentClientConfig4.region, credentialProviderLogger, {
4498
- logger: logger,
4499
- profile: profile
4500
- })
4501
- ];
4502
- case 1:
4503
- resolvedRegion = _state.sent();
4504
- isCompatibleRequestHandler = !isH2(requestHandler);
4505
- stsClient = new STSClient(_object_spread_props(_object_spread$1({}, stsOptions), {
4506
- userAgentAppId: userAgentAppId,
4507
- profile: profile,
4508
- credentialDefaultProvider: function() {
4509
- return /*#__PURE__*/ _async_to_generator(function() {
4510
- return _ts_generator(this, function(_state) {
4511
- return [
4512
- 2,
4513
- closureSourceCreds
4514
- ];
4515
- });
4516
- });
4517
- },
4518
- region: resolvedRegion,
4519
- requestHandler: isCompatibleRequestHandler ? requestHandler : undefined,
4520
- logger: logger
4521
- }));
4522
- _state.label = 2;
4523
- case 2:
4524
- return [
4525
- 4,
4526
- stsClient.send(new AssumeRoleCommand(params))
4527
- ];
4528
- case 3:
4529
- _ref = _state.sent(), Credentials = _ref.Credentials, AssumedRoleUser = _ref.AssumedRoleUser;
4530
- if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
4531
- throw new Error("Invalid response from STS.assumeRole call with role ".concat(params.RoleArn));
4532
- }
4533
- accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser);
4534
- credentials = _object_spread$1({
4535
- accessKeyId: Credentials.AccessKeyId,
4536
- secretAccessKey: Credentials.SecretAccessKey,
4537
- sessionToken: Credentials.SessionToken,
4538
- expiration: Credentials.Expiration
4539
- }, Credentials.CredentialScope && {
4540
- credentialScope: Credentials.CredentialScope
4541
- }, accountId && {
4542
- accountId: accountId
1229
+ case 4:
1230
+ if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {
1231
+ throw new CredentialsProviderError("Incomplete configuration. The fromSSO() argument hash must include " + '"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', {
1232
+ tryNextLink: false,
1233
+ logger: init.logger
4543
1234
  });
4544
- setCredentialFeature(credentials, "CREDENTIALS_STS_ASSUME_ROLE", "i");
1235
+ } else {
4545
1236
  return [
4546
1237
  2,
4547
- credentials
4548
- ];
4549
- }
4550
- });
4551
- });
4552
- return function(sourceCreds, params) {
4553
- return _ref.apply(this, arguments);
4554
- };
4555
- }();
4556
- };
4557
- var getDefaultRoleAssumerWithWebIdentity$1 = function(stsOptions, STSClient) {
4558
- var stsClient;
4559
- return function() {
4560
- var _ref = _async_to_generator(function(params) {
4561
- var _stsOptions_parentClientConfig, _stsOptions_parentClientConfig1, _stsOptions_parentClientConfig2, _stsOptions_parentClientConfig3, _stsOptions_parentClientConfig4, _stsOptions_logger, logger, _stsOptions_profile, profile, region, _stsOptions_requestHandler, requestHandler, credentialProviderLogger, _stsOptions_userAgentAppId, userAgentAppId, resolvedRegion, isCompatibleRequestHandler, _ref, Credentials, AssumedRoleUser, accountId, credentials;
4562
- return _ts_generator(this, function(_state) {
4563
- switch(_state.label){
4564
- case 0:
4565
- if (!!stsClient) return [
4566
- 3,
4567
- 2
4568
- ];
4569
- _stsOptions_logger = stsOptions.logger, logger = _stsOptions_logger === void 0 ? stsOptions === null || stsOptions === void 0 ? void 0 : (_stsOptions_parentClientConfig = stsOptions.parentClientConfig) === null || _stsOptions_parentClientConfig === void 0 ? void 0 : _stsOptions_parentClientConfig.logger : _stsOptions_logger, _stsOptions_profile = stsOptions.profile, profile = _stsOptions_profile === void 0 ? stsOptions === null || stsOptions === void 0 ? void 0 : (_stsOptions_parentClientConfig1 = stsOptions.parentClientConfig) === null || _stsOptions_parentClientConfig1 === void 0 ? void 0 : _stsOptions_parentClientConfig1.profile : _stsOptions_profile, region = stsOptions.region, _stsOptions_requestHandler = stsOptions.requestHandler, requestHandler = _stsOptions_requestHandler === void 0 ? stsOptions === null || stsOptions === void 0 ? void 0 : (_stsOptions_parentClientConfig2 = stsOptions.parentClientConfig) === null || _stsOptions_parentClientConfig2 === void 0 ? void 0 : _stsOptions_parentClientConfig2.requestHandler : _stsOptions_requestHandler, credentialProviderLogger = stsOptions.credentialProviderLogger, _stsOptions_userAgentAppId = stsOptions.userAgentAppId, userAgentAppId = _stsOptions_userAgentAppId === void 0 ? stsOptions === null || stsOptions === void 0 ? void 0 : (_stsOptions_parentClientConfig3 = stsOptions.parentClientConfig) === null || _stsOptions_parentClientConfig3 === void 0 ? void 0 : _stsOptions_parentClientConfig3.userAgentAppId : _stsOptions_userAgentAppId;
4570
- return [
4571
- 4,
4572
- resolveRegion(region, stsOptions === null || stsOptions === void 0 ? void 0 : (_stsOptions_parentClientConfig4 = stsOptions.parentClientConfig) === null || _stsOptions_parentClientConfig4 === void 0 ? void 0 : _stsOptions_parentClientConfig4.region, credentialProviderLogger, {
4573
- logger: logger,
4574
- profile: profile
1238
+ resolveSSOCredentials({
1239
+ ssoStartUrl: ssoStartUrl,
1240
+ ssoSession: ssoSession,
1241
+ ssoAccountId: ssoAccountId,
1242
+ ssoRegion: ssoRegion,
1243
+ ssoRoleName: ssoRoleName,
1244
+ ssoClient: ssoClient,
1245
+ clientConfig: init.clientConfig,
1246
+ parentClientConfig: init.parentClientConfig,
1247
+ callerClientConfig: init.callerClientConfig,
1248
+ profile: profileName,
1249
+ filepath: init.filepath,
1250
+ configFilepath: init.configFilepath,
1251
+ ignoreCache: init.ignoreCache,
1252
+ logger: init.logger
4575
1253
  })
4576
1254
  ];
4577
- case 1:
4578
- resolvedRegion = _state.sent();
4579
- isCompatibleRequestHandler = !isH2(requestHandler);
4580
- stsClient = new STSClient(_object_spread_props(_object_spread$1({}, stsOptions), {
4581
- userAgentAppId: userAgentAppId,
4582
- profile: profile,
4583
- region: resolvedRegion,
4584
- requestHandler: isCompatibleRequestHandler ? requestHandler : undefined,
4585
- logger: logger
4586
- }));
4587
- _state.label = 2;
4588
- case 2:
4589
- return [
4590
- 4,
4591
- stsClient.send(new AssumeRoleWithWebIdentityCommand(params))
4592
- ];
4593
- case 3:
4594
- _ref = _state.sent(), Credentials = _ref.Credentials, AssumedRoleUser = _ref.AssumedRoleUser;
4595
- if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
4596
- throw new Error("Invalid response from STS.assumeRoleWithWebIdentity call with role ".concat(params.RoleArn));
4597
- }
4598
- accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser);
4599
- credentials = _object_spread$1({
4600
- accessKeyId: Credentials.AccessKeyId,
4601
- secretAccessKey: Credentials.SecretAccessKey,
4602
- sessionToken: Credentials.SessionToken,
4603
- expiration: Credentials.Expiration
4604
- }, Credentials.CredentialScope && {
4605
- credentialScope: Credentials.CredentialScope
4606
- }, accountId && {
4607
- accountId: accountId
4608
- });
4609
- if (accountId) {
4610
- setCredentialFeature(credentials, "RESOLVED_ACCOUNT_ID", "T");
4611
- }
4612
- setCredentialFeature(credentials, "CREDENTIALS_STS_ASSUME_ROLE_WEB_ID", "k");
4613
- return [
4614
- 2,
4615
- credentials
4616
- ];
4617
- }
4618
- });
4619
- });
4620
- return function(params) {
4621
- return _ref.apply(this, arguments);
4622
- };
4623
- }();
4624
- };
4625
- var isH2 = function(requestHandler) {
4626
- var _requestHandler_metadata;
4627
- return (requestHandler === null || requestHandler === void 0 ? void 0 : (_requestHandler_metadata = requestHandler.metadata) === null || _requestHandler_metadata === void 0 ? void 0 : _requestHandler_metadata.handlerProtocol) === "h2";
4628
- };
4629
-
4630
- function _assert_this_initialized(self) {
4631
- if (self === void 0) {
4632
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4633
- }
4634
- return self;
4635
- }
4636
- function _class_call_check(instance, Constructor) {
4637
- if (!(instance instanceof Constructor)) {
4638
- throw new TypeError("Cannot call a class as a function");
4639
- }
4640
- }
4641
- function _define_property(obj, key, value) {
4642
- if (key in obj) {
4643
- Object.defineProperty(obj, key, {
4644
- value: value,
4645
- enumerable: true,
4646
- configurable: true,
4647
- writable: true
4648
- });
4649
- } else {
4650
- obj[key] = value;
4651
- }
4652
- return obj;
4653
- }
4654
- function _get_prototype_of(o) {
4655
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
4656
- return o.__proto__ || Object.getPrototypeOf(o);
4657
- };
4658
- return _get_prototype_of(o);
4659
- }
4660
- function _inherits(subClass, superClass) {
4661
- if (typeof superClass !== "function" && superClass !== null) {
4662
- throw new TypeError("Super expression must either be null or a function");
4663
- }
4664
- subClass.prototype = Object.create(superClass && superClass.prototype, {
4665
- constructor: {
4666
- value: subClass,
4667
- writable: true,
4668
- configurable: true
4669
- }
4670
- });
4671
- if (superClass) _set_prototype_of(subClass, superClass);
4672
- }
4673
- function _object_spread(target) {
4674
- for(var i = 1; i < arguments.length; i++){
4675
- var source = arguments[i] != null ? arguments[i] : {};
4676
- var ownKeys = Object.keys(source);
4677
- if (typeof Object.getOwnPropertySymbols === "function") {
4678
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
4679
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
4680
- }));
4681
- }
4682
- ownKeys.forEach(function(key) {
4683
- _define_property(target, key, source[key]);
4684
- });
4685
- }
4686
- return target;
4687
- }
4688
- function _possible_constructor_return(self, call) {
4689
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
4690
- return call;
4691
- }
4692
- return _assert_this_initialized(self);
4693
- }
4694
- function _set_prototype_of(o, p) {
4695
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
4696
- o.__proto__ = p;
4697
- return o;
4698
- };
4699
- return _set_prototype_of(o, p);
4700
- }
4701
- function _type_of(obj) {
4702
- "@swc/helpers - typeof";
4703
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
4704
- }
4705
- function _is_native_reflect_construct() {
4706
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
4707
- if (Reflect.construct.sham) return false;
4708
- if (typeof Proxy === "function") return true;
4709
- try {
4710
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
4711
- return true;
4712
- } catch (e) {
4713
- return false;
4714
- }
4715
- }
4716
- function _create_super(Derived) {
4717
- var hasNativeReflectConstruct = _is_native_reflect_construct();
4718
- return function _createSuperInternal() {
4719
- var Super = _get_prototype_of(Derived), result;
4720
- if (hasNativeReflectConstruct) {
4721
- var NewTarget = _get_prototype_of(this).constructor;
4722
- result = Reflect.construct(Super, arguments, NewTarget);
4723
- } else {
4724
- result = Super.apply(this, arguments);
4725
- }
4726
- return _possible_constructor_return(this, result);
4727
- };
4728
- }
4729
- var getCustomizableStsClientCtor = function(baseCtor, customizations) {
4730
- if (!customizations) return baseCtor;
4731
- else return /*#__PURE__*/ function(baseCtor) {
4732
- _inherits(CustomizableSTSClient, baseCtor);
4733
- var _super = _create_super(CustomizableSTSClient);
4734
- function CustomizableSTSClient(config) {
4735
- _class_call_check(this, CustomizableSTSClient);
4736
- var _this;
4737
- _this = _super.call(this, config);
4738
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4739
- try {
4740
- for(var _iterator = customizations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4741
- var customization = _step.value;
4742
- _this.middlewareStack.use(customization);
4743
- }
4744
- } catch (err) {
4745
- _didIteratorError = true;
4746
- _iteratorError = err;
4747
- } finally{
4748
- try {
4749
- if (!_iteratorNormalCompletion && _iterator.return != null) {
4750
- _iterator.return();
4751
1255
  }
4752
- } finally{
4753
- if (_didIteratorError) {
4754
- throw _iteratorError;
4755
- }
4756
- }
1256
+ case 5:
1257
+ return [
1258
+ 2
1259
+ ];
4757
1260
  }
4758
- return _this;
4759
- }
4760
- return CustomizableSTSClient;
4761
- }(baseCtor);
4762
- };
4763
- var getDefaultRoleAssumer = function() {
4764
- var stsOptions = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, stsPlugins = arguments.length > 1 ? arguments[1] : void 0;
4765
- return getDefaultRoleAssumer$1(stsOptions, getCustomizableStsClientCtor(STSClient, stsPlugins));
4766
- };
4767
- var getDefaultRoleAssumerWithWebIdentity = function() {
4768
- var stsOptions = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, stsPlugins = arguments.length > 1 ? arguments[1] : void 0;
4769
- return getDefaultRoleAssumerWithWebIdentity$1(stsOptions, getCustomizableStsClientCtor(STSClient, stsPlugins));
4770
- };
4771
- var decorateDefaultCredentialProvider = function(provider) {
4772
- return function(input) {
4773
- return provider(_object_spread({
4774
- roleAssumer: getDefaultRoleAssumer(input),
4775
- roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity(input)
4776
- }, input));
4777
- };
1261
+ });
1262
+ });
4778
1263
  };
4779
1264
 
4780
- export { Command as $Command, AssumeRole$, AssumeRoleCommand, AssumeRoleRequest$, AssumeRoleResponse$, AssumeRoleWithWebIdentity$, AssumeRoleWithWebIdentityCommand, AssumeRoleWithWebIdentityRequest$, AssumeRoleWithWebIdentityResponse$, AssumedRoleUser$, Credentials$, ExpiredTokenException, ExpiredTokenException$, IDPCommunicationErrorException, IDPCommunicationErrorException$, IDPRejectedClaimException, IDPRejectedClaimException$, InvalidIdentityTokenException, InvalidIdentityTokenException$, MalformedPolicyDocumentException, MalformedPolicyDocumentException$, PackedPolicyTooLargeException, PackedPolicyTooLargeException$, PolicyDescriptorType$, ProvidedContext$, RegionDisabledException, RegionDisabledException$, STS, STSClient, STSServiceException, STSServiceException$, Tag$, Client as __Client, decorateDefaultCredentialProvider, errorTypeRegistries, getDefaultRoleAssumer, getDefaultRoleAssumerWithWebIdentity };
1265
+ export { fromSSO, isSsoProfile, validateSsoProfile };