@digipair/skill-s3 0.136.0 → 0.136.3

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,99 +1,29 @@
1
- import { 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, d as NODE_REGION_CONFIG_OPTIONS, e as NODE_MAX_ATTEMPT_CONFIG_OPTIONS, f as createDefaultUserAgentProvider, p as packageInfo, g as calculateBodyLength, h as NODE_RETRY_MODE_CONFIG_OPTIONS, i as NODE_REGION_CONFIG_FILE_OPTIONS, D as DEFAULT_RETRY_MODE, j as getAwsRegionExtensionConfiguration, k as resolveAwsRegionExtensionConfiguration, l as resolveUserAgentConfig, m as resolveRetryConfig, n as resolveRegionConfig, o as resolveEndpointConfig, q as resolveHostHeaderConfig, s as getUserAgentPlugin, t as getRetryPlugin, u as getContentLengthPlugin, v as getHostHeaderPlugin, w as getLoggerPlugin, x as getRecursionDetectionPlugin, y as getEndpointPlugin, z as createAggregatedClient } from './index.esm14.js';
2
- import { av as NumericValue, aw as NormalizedSchema, ax as UnionSerde, K as fromBase64, ay as LazyJsonString, az as determineTimestampFormat, aA as parseEpochTimestamp, aB as parseRfc7231DateTime, aC as parseRfc3339DateTimeWithOffset, aD as SerdeContextConfig, J as toBase64, aE as dateToUtcString, aF as v4, aG as ProtocolLib, aH as HttpInterceptingShapeSerializer, aI as HttpInterceptingShapeDeserializer, aJ as HttpBindingProtocol, aK as TypeRegistry, 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, L as emitWarningIfUnsupportedVersion, O as emitWarningIfUnsupportedVersion$1, n as loadConfig, 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 } from './index.esm3.js';
3
- import { p as parseJsonBody, l as loadRestJsonErrorCode } from './parseJsonBody.esm.js';
4
- import { N as NoAuthSigner } from './noAuth.esm.js';
5
- import 'stream';
6
- import 'os';
7
- import 'process';
8
- import 'buffer';
9
- import 'crypto';
10
- import 'node:fs';
11
- import 'path';
1
+ import { aX as ProviderError, aY as IniSectionType, aZ as CONFIG_PREFIX_SEPARATOR, a5 as readFile, a_ as getConfigFilepath, a$ as parseIni, x as getProfileName, C as CredentialsProviderError, s as setCredentialFeature } from './index.esm3.js';
2
+ import { g as getSSOTokenFilepath, a as getSSOTokenFromFile } from './getSSOTokenFromFile.esm.js';
3
+ import { promises } from 'node:fs';
4
+ import { p as parseKnownFiles } from './parseKnownFiles.esm.js';
5
+ import 'node:crypto';
6
+ import 'node:path';
7
+ import 'node:os';
12
8
  import 'node:fs/promises';
13
9
  import 'node:stream';
14
- import 'http';
15
- import 'https';
16
- import 'zlib';
17
-
18
- function jsonReviver(key, value, context) {
19
- if (context === null || context === void 0 ? void 0 : context.source) {
20
- var numericString = context.source;
21
- if (typeof value === "number") {
22
- if (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER || numericString !== String(value)) {
23
- var isFractional = numericString.includes(".");
24
- if (isFractional) {
25
- return new NumericValue(numericString, "bigDecimal");
26
- } else {
27
- return BigInt(numericString);
28
- }
29
- }
30
- }
31
- }
32
- return value;
33
- }
10
+ import 'node:process';
11
+ import 'buffer';
12
+ import 'node:https';
13
+ import 'node:zlib';
34
14
 
35
- function _array_like_to_array$4(arr, len) {
36
- if (len == null || len > arr.length) len = arr.length;
37
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
38
- return arr2;
39
- }
40
- function _array_with_holes$4(arr) {
41
- if (Array.isArray(arr)) return arr;
42
- }
43
- function _assert_this_initialized$8(self) {
15
+ function _assert_this_initialized(self) {
44
16
  if (self === void 0) {
45
17
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
46
18
  }
47
19
  return self;
48
20
  }
49
- function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
50
- try {
51
- var info = gen[key](arg);
52
- var value = info.value;
53
- } catch (error) {
54
- reject(error);
55
- return;
56
- }
57
- if (info.done) {
58
- resolve(value);
59
- } else {
60
- Promise.resolve(value).then(_next, _throw);
61
- }
62
- }
63
- function _async_to_generator$5(fn) {
64
- return function() {
65
- var self = this, args = arguments;
66
- return new Promise(function(resolve, reject) {
67
- var gen = fn.apply(self, args);
68
- function _next(value) {
69
- asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
70
- }
71
- function _throw(err) {
72
- asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
73
- }
74
- _next(undefined);
75
- });
76
- };
77
- }
78
- function _class_call_check$9(instance, Constructor) {
21
+ function _class_call_check(instance, Constructor) {
79
22
  if (!(instance instanceof Constructor)) {
80
23
  throw new TypeError("Cannot call a class as a function");
81
24
  }
82
25
  }
83
- function _defineProperties$5(target, props) {
84
- for(var i = 0; i < props.length; i++){
85
- var descriptor = props[i];
86
- descriptor.enumerable = descriptor.enumerable || false;
87
- descriptor.configurable = true;
88
- if ("value" in descriptor) descriptor.writable = true;
89
- Object.defineProperty(target, descriptor.key, descriptor);
90
- }
91
- }
92
- function _create_class$5(Constructor, protoProps, staticProps) {
93
- if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
94
- return Constructor;
95
- }
96
- function _define_property$9(obj, key, value) {
26
+ function _define_property$3(obj, key, value) {
97
27
  if (key in obj) {
98
28
  Object.defineProperty(obj, key, {
99
29
  value: value,
@@ -106,13 +36,13 @@ function _define_property$9(obj, key, value) {
106
36
  }
107
37
  return obj;
108
38
  }
109
- function _get_prototype_of$8(o) {
110
- _get_prototype_of$8 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
39
+ function _get_prototype_of(o) {
40
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
111
41
  return o.__proto__ || Object.getPrototypeOf(o);
112
42
  };
113
- return _get_prototype_of$8(o);
43
+ return _get_prototype_of(o);
114
44
  }
115
- function _inherits$8(subClass, superClass) {
45
+ function _inherits(subClass, superClass) {
116
46
  if (typeof superClass !== "function" && superClass !== null) {
117
47
  throw new TypeError("Super expression must either be null or a function");
118
48
  }
@@ -123,16 +53,86 @@ function _inherits$8(subClass, superClass) {
123
53
  configurable: true
124
54
  }
125
55
  });
126
- if (superClass) _set_prototype_of$8(subClass, superClass);
56
+ if (superClass) _set_prototype_of(subClass, superClass);
57
+ }
58
+ function _possible_constructor_return(self, call) {
59
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
60
+ return call;
61
+ }
62
+ return _assert_this_initialized(self);
63
+ }
64
+ function _set_prototype_of(o, p) {
65
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
66
+ o.__proto__ = p;
67
+ return o;
68
+ };
69
+ return _set_prototype_of(o, p);
70
+ }
71
+ function _type_of(obj) {
72
+ "@swc/helpers - typeof";
73
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
74
+ }
75
+ function _is_native_reflect_construct() {
76
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
77
+ if (Reflect.construct.sham) return false;
78
+ if (typeof Proxy === "function") return true;
79
+ try {
80
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
81
+ return true;
82
+ } catch (e) {
83
+ return false;
84
+ }
85
+ }
86
+ function _create_super(Derived) {
87
+ var hasNativeReflectConstruct = _is_native_reflect_construct();
88
+ return function _createSuperInternal() {
89
+ var Super = _get_prototype_of(Derived), result;
90
+ if (hasNativeReflectConstruct) {
91
+ var NewTarget = _get_prototype_of(this).constructor;
92
+ result = Reflect.construct(Super, arguments, NewTarget);
93
+ } else {
94
+ result = Super.apply(this, arguments);
95
+ }
96
+ return _possible_constructor_return(this, result);
97
+ };
98
+ }
99
+ var TokenProviderError = /*#__PURE__*/ function(ProviderError) {
100
+ _inherits(TokenProviderError, ProviderError);
101
+ var _super = _create_super(TokenProviderError);
102
+ function TokenProviderError(message) {
103
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
104
+ _class_call_check(this, TokenProviderError);
105
+ var _this;
106
+ _this = _super.call(this, message, options);
107
+ _define_property$3(_assert_this_initialized(_this), "name", "TokenProviderError");
108
+ Object.setPrototypeOf(_assert_this_initialized(_this), TokenProviderError.prototype);
109
+ return _this;
110
+ }
111
+ return TokenProviderError;
112
+ }(ProviderError);
113
+
114
+ function _array_like_to_array(arr, len) {
115
+ if (len == null || len > arr.length) len = arr.length;
116
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
117
+ return arr2;
118
+ }
119
+ function _array_with_holes(arr) {
120
+ if (Array.isArray(arr)) return arr;
127
121
  }
128
- function _instanceof$2(left, right) {
129
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
130
- return !!right[Symbol.hasInstance](left);
122
+ function _define_property$2(obj, key, value) {
123
+ if (key in obj) {
124
+ Object.defineProperty(obj, key, {
125
+ value: value,
126
+ enumerable: true,
127
+ configurable: true,
128
+ writable: true
129
+ });
131
130
  } else {
132
- return left instanceof right;
131
+ obj[key] = value;
133
132
  }
133
+ return obj;
134
134
  }
135
- function _iterable_to_array_limit$4(arr, i) {
135
+ function _iterable_to_array_limit(arr, i) {
136
136
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
137
137
  if (_i == null) return;
138
138
  var _arr = [];
@@ -156,59 +156,91 @@ function _iterable_to_array_limit$4(arr, i) {
156
156
  }
157
157
  return _arr;
158
158
  }
159
- function _non_iterable_rest$4() {
159
+ function _non_iterable_rest() {
160
160
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
161
161
  }
162
- function _possible_constructor_return$8(self, call) {
163
- if (call && (_type_of$9(call) === "object" || typeof call === "function")) {
164
- return call;
162
+ function _object_spread$2(target) {
163
+ for(var i = 1; i < arguments.length; i++){
164
+ var source = arguments[i] != null ? arguments[i] : {};
165
+ var ownKeys = Object.keys(source);
166
+ if (typeof Object.getOwnPropertySymbols === "function") {
167
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
168
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
169
+ }));
170
+ }
171
+ ownKeys.forEach(function(key) {
172
+ _define_property$2(target, key, source[key]);
173
+ });
165
174
  }
166
- return _assert_this_initialized$8(self);
175
+ return target;
167
176
  }
168
- function _set_prototype_of$8(o, p) {
169
- _set_prototype_of$8 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
170
- o.__proto__ = p;
171
- return o;
172
- };
173
- return _set_prototype_of$8(o, p);
177
+ function ownKeys$1(object, enumerableOnly) {
178
+ var keys = Object.keys(object);
179
+ if (Object.getOwnPropertySymbols) {
180
+ var symbols = Object.getOwnPropertySymbols(object);
181
+ keys.push.apply(keys, symbols);
182
+ }
183
+ return keys;
174
184
  }
175
- function _sliced_to_array$4(arr, i) {
176
- return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
185
+ function _object_spread_props$1(target, source) {
186
+ source = source != null ? source : {};
187
+ if (Object.getOwnPropertyDescriptors) {
188
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
189
+ } else {
190
+ ownKeys$1(Object(source)).forEach(function(key) {
191
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
192
+ });
193
+ }
194
+ return target;
177
195
  }
178
- function _type_of$9(obj) {
179
- "@swc/helpers - typeof";
180
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
196
+ function _sliced_to_array(arr, i) {
197
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
181
198
  }
182
- function _unsupported_iterable_to_array$4(o, minLen) {
199
+ function _unsupported_iterable_to_array(o, minLen) {
183
200
  if (!o) return;
184
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
201
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
185
202
  var n = Object.prototype.toString.call(o).slice(8, -1);
186
203
  if (n === "Object" && o.constructor) n = o.constructor.name;
187
204
  if (n === "Map" || n === "Set") return Array.from(n);
188
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
205
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
189
206
  }
190
- function _is_native_reflect_construct$8() {
191
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
192
- if (Reflect.construct.sham) return false;
193
- if (typeof Proxy === "function") return true;
207
+ var getSsoSessionData = function(data) {
208
+ return Object.entries(data).filter(function(param) {
209
+ var _param = _sliced_to_array(param, 1), key = _param[0];
210
+ return key.startsWith(IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR);
211
+ }).reduce(function(acc, param) {
212
+ var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
213
+ return _object_spread_props$1(_object_spread$2({}, acc), _define_property$2({}, key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1), value));
214
+ }, {});
215
+ };
216
+
217
+ function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
194
218
  try {
195
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
196
- return true;
197
- } catch (e) {
198
- return false;
219
+ var info = gen[key](arg);
220
+ var value = info.value;
221
+ } catch (error) {
222
+ reject(error);
223
+ return;
224
+ }
225
+ if (info.done) {
226
+ resolve(value);
227
+ } else {
228
+ Promise.resolve(value).then(_next, _throw);
199
229
  }
200
230
  }
201
- function _create_super$8(Derived) {
202
- var hasNativeReflectConstruct = _is_native_reflect_construct$8();
203
- return function _createSuperInternal() {
204
- var Super = _get_prototype_of$8(Derived), result;
205
- if (hasNativeReflectConstruct) {
206
- var NewTarget = _get_prototype_of$8(this).constructor;
207
- result = Reflect.construct(Super, arguments, NewTarget);
208
- } else {
209
- result = Super.apply(this, arguments);
210
- }
211
- return _possible_constructor_return$8(this, result);
231
+ function _async_to_generator$5(fn) {
232
+ return function() {
233
+ var self = this, args = arguments;
234
+ return new Promise(function(resolve, reject) {
235
+ var gen = fn.apply(self, args);
236
+ function _next(value) {
237
+ asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
238
+ }
239
+ function _throw(err) {
240
+ asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
241
+ }
242
+ _next(undefined);
243
+ });
212
244
  };
213
245
  }
214
246
  function _ts_generator$5(thisArg, body) {
@@ -306,1039 +338,45 @@ function _ts_generator$5(thisArg, body) {
306
338
  };
307
339
  }
308
340
  }
309
- var JsonShapeDeserializer = /*#__PURE__*/ function(SerdeContextConfig) {
310
- _inherits$8(JsonShapeDeserializer, SerdeContextConfig);
311
- var _super = _create_super$8(JsonShapeDeserializer);
312
- function JsonShapeDeserializer(settings) {
313
- _class_call_check$9(this, JsonShapeDeserializer);
314
- var _this;
315
- _this = _super.call(this);
316
- _define_property$9(_assert_this_initialized$8(_this), "settings", void 0);
317
- _this.settings = settings;
318
- return _this;
319
- }
320
- _create_class$5(JsonShapeDeserializer, [
321
- {
322
- key: "read",
323
- value: function read(schema, data) {
324
- var _this = this;
325
- return _async_to_generator$5(function() {
326
- var _, _tmp, _tmp1;
327
- return _ts_generator$5(this, function(_state) {
328
- switch(_state.label){
329
- case 0:
330
- _ = _this._read;
331
- _tmp = [
332
- schema
333
- ];
334
- if (!(typeof data === "string")) return [
335
- 3,
336
- 1
337
- ];
338
- _tmp1 = JSON.parse(data, jsonReviver);
339
- return [
340
- 3,
341
- 3
342
- ];
343
- case 1:
344
- return [
345
- 4,
346
- parseJsonBody(data, _this.serdeContext)
347
- ];
348
- case 2:
349
- _tmp1 = _state.sent();
350
- _state.label = 3;
351
- case 3:
352
- return [
353
- 2,
354
- _.apply(_this, _tmp.concat([
355
- _tmp1
356
- ]))
357
- ];
358
- }
359
- });
360
- })();
361
- }
362
- },
363
- {
364
- key: "readObject",
365
- value: function readObject(schema, data) {
366
- return this._read(schema, data);
367
- }
368
- },
369
- {
370
- key: "_read",
371
- value: function _read(schema, value) {
372
- var isObject = value !== null && (typeof value === "undefined" ? "undefined" : _type_of$9(value)) === "object";
373
- var ns = NormalizedSchema.of(schema);
374
- if (isObject) {
375
- if (ns.isStructSchema()) {
376
- var record = value;
377
- var union = ns.isUnionSchema();
378
- var out = {};
379
- var nameMap = void 0;
380
- var jsonName = this.settings.jsonName;
381
- if (jsonName) {
382
- nameMap = {};
383
- }
384
- var unionSerde;
385
- if (union) {
386
- unionSerde = new UnionSerde(record, out);
387
- }
388
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
389
- try {
390
- for(var _iterator = ns.structIterator()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
391
- var _step_value = _sliced_to_array$4(_step.value, 2), memberName = _step_value[0], memberSchema = _step_value[1];
392
- var fromKey = memberName;
393
- if (jsonName) {
394
- var _memberSchema_getMergedTraits_jsonName;
395
- fromKey = (_memberSchema_getMergedTraits_jsonName = memberSchema.getMergedTraits().jsonName) !== null && _memberSchema_getMergedTraits_jsonName !== void 0 ? _memberSchema_getMergedTraits_jsonName : fromKey;
396
- nameMap[fromKey] = memberName;
397
- }
398
- if (union) {
399
- unionSerde.mark(fromKey);
400
- }
401
- if (record[fromKey] != null) {
402
- out[memberName] = this._read(memberSchema, record[fromKey]);
403
- }
404
- }
405
- } catch (err) {
406
- _didIteratorError = true;
407
- _iteratorError = err;
408
- } finally{
409
- try {
410
- if (!_iteratorNormalCompletion && _iterator.return != null) {
411
- _iterator.return();
412
- }
413
- } finally{
414
- if (_didIteratorError) {
415
- throw _iteratorError;
416
- }
417
- }
418
- }
419
- if (union) {
420
- unionSerde.writeUnknown();
421
- } else if (typeof record.__type === "string") {
422
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
423
- try {
424
- for(var _iterator1 = Object.entries(record)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
425
- var _step_value1 = _sliced_to_array$4(_step1.value, 2), k = _step_value1[0], v = _step_value1[1];
426
- var _nameMap_k;
427
- var t = jsonName ? (_nameMap_k = nameMap[k]) !== null && _nameMap_k !== void 0 ? _nameMap_k : k : k;
428
- if (!(t in out)) {
429
- out[t] = v;
430
- }
431
- }
432
- } catch (err) {
433
- _didIteratorError1 = true;
434
- _iteratorError1 = err;
435
- } finally{
436
- try {
437
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
438
- _iterator1.return();
439
- }
440
- } finally{
441
- if (_didIteratorError1) {
442
- throw _iteratorError1;
443
- }
444
- }
445
- }
446
- }
447
- return out;
448
- }
449
- if (Array.isArray(value) && ns.isListSchema()) {
450
- var listMember = ns.getValueSchema();
451
- var out1 = [];
452
- var sparse = !!ns.getMergedTraits().sparse;
453
- var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
454
- try {
455
- for(var _iterator2 = value[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
456
- var item = _step2.value;
457
- if (sparse || item != null) {
458
- out1.push(this._read(listMember, item));
459
- }
460
- }
461
- } catch (err) {
462
- _didIteratorError2 = true;
463
- _iteratorError2 = err;
464
- } finally{
465
- try {
466
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
467
- _iterator2.return();
468
- }
469
- } finally{
470
- if (_didIteratorError2) {
471
- throw _iteratorError2;
472
- }
473
- }
474
- }
475
- return out1;
476
- }
477
- if (ns.isMapSchema()) {
478
- var mapMember = ns.getValueSchema();
479
- var out2 = {};
480
- var sparse1 = !!ns.getMergedTraits().sparse;
481
- var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
482
- try {
483
- for(var _iterator3 = Object.entries(value)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
484
- var _step_value2 = _sliced_to_array$4(_step3.value, 2), _k = _step_value2[0], _v = _step_value2[1];
485
- if (sparse1 || _v != null) {
486
- out2[_k] = this._read(mapMember, _v);
487
- }
488
- }
489
- } catch (err) {
490
- _didIteratorError3 = true;
491
- _iteratorError3 = err;
492
- } finally{
493
- try {
494
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
495
- _iterator3.return();
496
- }
497
- } finally{
498
- if (_didIteratorError3) {
499
- throw _iteratorError3;
500
- }
501
- }
502
- }
503
- return out2;
504
- }
505
- }
506
- if (ns.isBlobSchema() && typeof value === "string") {
507
- return fromBase64(value);
508
- }
509
- var mediaType = ns.getMergedTraits().mediaType;
510
- if (ns.isStringSchema() && typeof value === "string" && mediaType) {
511
- var isJson = mediaType === "application/json" || mediaType.endsWith("+json");
512
- if (isJson) {
513
- return LazyJsonString.from(value);
514
- }
515
- return value;
516
- }
517
- if (ns.isTimestampSchema() && value != null) {
518
- var format = determineTimestampFormat(ns, this.settings);
519
- switch(format){
520
- case 5:
521
- return parseRfc3339DateTimeWithOffset(value);
522
- case 6:
523
- return parseRfc7231DateTime(value);
524
- case 7:
525
- return parseEpochTimestamp(value);
526
- default:
527
- console.warn("Missing timestamp format, parsing value with Date constructor:", value);
528
- return new Date(value);
529
- }
530
- }
531
- if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) {
532
- return BigInt(value);
533
- }
534
- if (ns.isBigDecimalSchema() && value != undefined) {
535
- if (_instanceof$2(value, NumericValue)) {
536
- return value;
537
- }
538
- var untyped = value;
539
- if (untyped.type === "bigDecimal" && "string" in untyped) {
540
- return new NumericValue(untyped.string, untyped.type);
541
- }
542
- return new NumericValue(String(value), "bigDecimal");
543
- }
544
- if (ns.isNumericSchema() && typeof value === "string") {
545
- switch(value){
546
- case "Infinity":
547
- return Infinity;
548
- case "-Infinity":
549
- return -Infinity;
550
- case "NaN":
551
- return NaN;
552
- }
553
- return value;
554
- }
555
- if (ns.isDocumentSchema()) {
556
- if (isObject) {
557
- var out3 = Array.isArray(value) ? [] : {};
558
- var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = undefined;
559
- try {
560
- for(var _iterator4 = Object.entries(value)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true){
561
- var _step_value3 = _sliced_to_array$4(_step4.value, 2), k1 = _step_value3[0], v1 = _step_value3[1];
562
- if (_instanceof$2(v1, NumericValue)) {
563
- out3[k1] = v1;
564
- } else {
565
- out3[k1] = this._read(ns, v1);
566
- }
567
- }
568
- } catch (err) {
569
- _didIteratorError4 = true;
570
- _iteratorError4 = err;
571
- } finally{
572
- try {
573
- if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
574
- _iterator4.return();
575
- }
576
- } finally{
577
- if (_didIteratorError4) {
578
- throw _iteratorError4;
579
- }
580
- }
581
- }
582
- return out3;
583
- } else {
584
- return structuredClone(value);
585
- }
586
- }
587
- return value;
588
- }
589
- }
590
- ]);
591
- return JsonShapeDeserializer;
592
- }(SerdeContextConfig);
341
+ var swallowError = function() {
342
+ return {};
343
+ };
344
+ var loadSsoSessionData = function() {
345
+ var _ref = _async_to_generator$5(function() {
346
+ var init, _init_configFilepath;
347
+ var _arguments = arguments;
348
+ return _ts_generator$5(this, function(_state) {
349
+ init = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
350
+ return [
351
+ 2,
352
+ readFile((_init_configFilepath = init.configFilepath) !== null && _init_configFilepath !== void 0 ? _init_configFilepath : getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError)
353
+ ];
354
+ });
355
+ });
356
+ return function loadSsoSessionData() {
357
+ return _ref.apply(this, arguments);
358
+ };
359
+ }();
593
360
 
594
- function _array_like_to_array$3(arr, len) {
595
- if (len == null || len > arr.length) len = arr.length;
596
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
597
- return arr2;
598
- }
599
- function _array_with_holes$3(arr) {
600
- if (Array.isArray(arr)) return arr;
601
- }
602
- function _class_call_check$8(instance, Constructor) {
603
- if (!(instance instanceof Constructor)) {
604
- throw new TypeError("Cannot call a class as a function");
361
+ var isSsoProfile = function(arg) {
362
+ 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");
363
+ };
364
+
365
+ var EXPIRE_WINDOW_MS = 5 * 60 * 1000;
366
+ var REFRESH_MESSAGE = "To refresh this SSO session run 'aws sso login' with the corresponding profile.";
367
+
368
+ function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
369
+ try {
370
+ var info = gen[key](arg);
371
+ var value = info.value;
372
+ } catch (error) {
373
+ reject(error);
374
+ return;
605
375
  }
606
- }
607
- function _defineProperties$4(target, props) {
608
- for(var i = 0; i < props.length; i++){
609
- var descriptor = props[i];
610
- descriptor.enumerable = descriptor.enumerable || false;
611
- descriptor.configurable = true;
612
- if ("value" in descriptor) descriptor.writable = true;
613
- Object.defineProperty(target, descriptor.key, descriptor);
614
- }
615
- }
616
- function _create_class$4(Constructor, protoProps, staticProps) {
617
- if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
618
- return Constructor;
619
- }
620
- function _define_property$8(obj, key, value) {
621
- if (key in obj) {
622
- Object.defineProperty(obj, key, {
623
- value: value,
624
- enumerable: true,
625
- configurable: true,
626
- writable: true
627
- });
628
- } else {
629
- obj[key] = value;
630
- }
631
- return obj;
632
- }
633
- function _instanceof$1(left, right) {
634
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
635
- return !!right[Symbol.hasInstance](left);
636
- } else {
637
- return left instanceof right;
638
- }
639
- }
640
- function _iterable_to_array_limit$3(arr, i) {
641
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
642
- if (_i == null) return;
643
- var _arr = [];
644
- var _n = true;
645
- var _d = false;
646
- var _s, _e;
647
- try {
648
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
649
- _arr.push(_s.value);
650
- if (i && _arr.length === i) break;
651
- }
652
- } catch (err) {
653
- _d = true;
654
- _e = err;
655
- } finally{
656
- try {
657
- if (!_n && _i["return"] != null) _i["return"]();
658
- } finally{
659
- if (_d) throw _e;
660
- }
661
- }
662
- return _arr;
663
- }
664
- function _non_iterable_rest$3() {
665
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
666
- }
667
- function _sliced_to_array$3(arr, i) {
668
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
669
- }
670
- function _type_of$8(obj) {
671
- "@swc/helpers - typeof";
672
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
673
- }
674
- function _unsupported_iterable_to_array$3(o, minLen) {
675
- if (!o) return;
676
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
677
- var n = Object.prototype.toString.call(o).slice(8, -1);
678
- if (n === "Object" && o.constructor) n = o.constructor.name;
679
- if (n === "Map" || n === "Set") return Array.from(n);
680
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
681
- }
682
- var NUMERIC_CONTROL_CHAR = String.fromCharCode(925);
683
- var JsonReplacer = /*#__PURE__*/ function() {
684
- function JsonReplacer() {
685
- _class_call_check$8(this, JsonReplacer);
686
- _define_property$8(this, "values", new Map());
687
- _define_property$8(this, "counter", 0);
688
- _define_property$8(this, "stage", 0);
689
- }
690
- _create_class$4(JsonReplacer, [
691
- {
692
- key: "createReplacer",
693
- value: function createReplacer() {
694
- var _this = this;
695
- if (this.stage === 1) {
696
- throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");
697
- }
698
- if (this.stage === 2) {
699
- throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
700
- }
701
- this.stage = 1;
702
- return function(key, value) {
703
- if (_instanceof$1(value, NumericValue)) {
704
- var v = "".concat(NUMERIC_CONTROL_CHAR + "nv" + _this.counter++, "_") + value.string;
705
- _this.values.set('"'.concat(v, '"'), value.string);
706
- return v;
707
- }
708
- if ((typeof value === "undefined" ? "undefined" : _type_of$8(value)) === "bigint") {
709
- var s = value.toString();
710
- var v1 = "".concat(NUMERIC_CONTROL_CHAR + "b" + _this.counter++, "_") + s;
711
- _this.values.set('"'.concat(v1, '"'), s);
712
- return v1;
713
- }
714
- return value;
715
- };
716
- }
717
- },
718
- {
719
- key: "replaceInJson",
720
- value: function replaceInJson(json) {
721
- if (this.stage === 0) {
722
- throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");
723
- }
724
- if (this.stage === 2) {
725
- throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
726
- }
727
- this.stage = 2;
728
- if (this.counter === 0) {
729
- return json;
730
- }
731
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
732
- try {
733
- for(var _iterator = this.values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
734
- var _step_value = _sliced_to_array$3(_step.value, 2), key = _step_value[0], value = _step_value[1];
735
- json = json.replace(key, value);
736
- }
737
- } catch (err) {
738
- _didIteratorError = true;
739
- _iteratorError = err;
740
- } finally{
741
- try {
742
- if (!_iteratorNormalCompletion && _iterator.return != null) {
743
- _iterator.return();
744
- }
745
- } finally{
746
- if (_didIteratorError) {
747
- throw _iteratorError;
748
- }
749
- }
750
- }
751
- return json;
752
- }
753
- }
754
- ]);
755
- return JsonReplacer;
756
- }();
757
-
758
- function _array_like_to_array$2(arr, len) {
759
- if (len == null || len > arr.length) len = arr.length;
760
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
761
- return arr2;
762
- }
763
- function _array_with_holes$2(arr) {
764
- if (Array.isArray(arr)) return arr;
765
- }
766
- function _assert_this_initialized$7(self) {
767
- if (self === void 0) {
768
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
769
- }
770
- return self;
771
- }
772
- function _class_call_check$7(instance, Constructor) {
773
- if (!(instance instanceof Constructor)) {
774
- throw new TypeError("Cannot call a class as a function");
775
- }
776
- }
777
- function _defineProperties$3(target, props) {
778
- for(var i = 0; i < props.length; i++){
779
- var descriptor = props[i];
780
- descriptor.enumerable = descriptor.enumerable || false;
781
- descriptor.configurable = true;
782
- if ("value" in descriptor) descriptor.writable = true;
783
- Object.defineProperty(target, descriptor.key, descriptor);
784
- }
785
- }
786
- function _create_class$3(Constructor, protoProps, staticProps) {
787
- if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
788
- return Constructor;
789
- }
790
- function _define_property$7(obj, key, value) {
791
- if (key in obj) {
792
- Object.defineProperty(obj, key, {
793
- value: value,
794
- enumerable: true,
795
- configurable: true,
796
- writable: true
797
- });
798
- } else {
799
- obj[key] = value;
800
- }
801
- return obj;
802
- }
803
- function _get_prototype_of$7(o) {
804
- _get_prototype_of$7 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
805
- return o.__proto__ || Object.getPrototypeOf(o);
806
- };
807
- return _get_prototype_of$7(o);
808
- }
809
- function _inherits$7(subClass, superClass) {
810
- if (typeof superClass !== "function" && superClass !== null) {
811
- throw new TypeError("Super expression must either be null or a function");
812
- }
813
- subClass.prototype = Object.create(superClass && superClass.prototype, {
814
- constructor: {
815
- value: subClass,
816
- writable: true,
817
- configurable: true
818
- }
819
- });
820
- if (superClass) _set_prototype_of$7(subClass, superClass);
821
- }
822
- function _instanceof(left, right) {
823
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
824
- return !!right[Symbol.hasInstance](left);
825
- } else {
826
- return left instanceof right;
827
- }
828
- }
829
- function _iterable_to_array_limit$2(arr, i) {
830
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
831
- if (_i == null) return;
832
- var _arr = [];
833
- var _n = true;
834
- var _d = false;
835
- var _s, _e;
836
- try {
837
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
838
- _arr.push(_s.value);
839
- if (i && _arr.length === i) break;
840
- }
841
- } catch (err) {
842
- _d = true;
843
- _e = err;
844
- } finally{
845
- try {
846
- if (!_n && _i["return"] != null) _i["return"]();
847
- } finally{
848
- if (_d) throw _e;
849
- }
850
- }
851
- return _arr;
852
- }
853
- function _non_iterable_rest$2() {
854
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
855
- }
856
- function _possible_constructor_return$7(self, call) {
857
- if (call && (_type_of$7(call) === "object" || typeof call === "function")) {
858
- return call;
859
- }
860
- return _assert_this_initialized$7(self);
861
- }
862
- function _set_prototype_of$7(o, p) {
863
- _set_prototype_of$7 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
864
- o.__proto__ = p;
865
- return o;
866
- };
867
- return _set_prototype_of$7(o, p);
868
- }
869
- function _sliced_to_array$2(arr, i) {
870
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
871
- }
872
- function _type_of$7(obj) {
873
- "@swc/helpers - typeof";
874
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
875
- }
876
- function _unsupported_iterable_to_array$2(o, minLen) {
877
- if (!o) return;
878
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
879
- var n = Object.prototype.toString.call(o).slice(8, -1);
880
- if (n === "Object" && o.constructor) n = o.constructor.name;
881
- if (n === "Map" || n === "Set") return Array.from(n);
882
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
883
- }
884
- function _is_native_reflect_construct$7() {
885
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
886
- if (Reflect.construct.sham) return false;
887
- if (typeof Proxy === "function") return true;
888
- try {
889
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
890
- return true;
891
- } catch (e) {
892
- return false;
893
- }
894
- }
895
- function _create_super$7(Derived) {
896
- var hasNativeReflectConstruct = _is_native_reflect_construct$7();
897
- return function _createSuperInternal() {
898
- var Super = _get_prototype_of$7(Derived), result;
899
- if (hasNativeReflectConstruct) {
900
- var NewTarget = _get_prototype_of$7(this).constructor;
901
- result = Reflect.construct(Super, arguments, NewTarget);
902
- } else {
903
- result = Super.apply(this, arguments);
904
- }
905
- return _possible_constructor_return$7(this, result);
906
- };
907
- }
908
- var JsonShapeSerializer = /*#__PURE__*/ function(SerdeContextConfig) {
909
- _inherits$7(JsonShapeSerializer, SerdeContextConfig);
910
- var _super = _create_super$7(JsonShapeSerializer);
911
- function JsonShapeSerializer(settings) {
912
- _class_call_check$7(this, JsonShapeSerializer);
913
- var _this;
914
- _this = _super.call(this);
915
- _define_property$7(_assert_this_initialized$7(_this), "settings", void 0);
916
- _define_property$7(_assert_this_initialized$7(_this), "buffer", void 0);
917
- _define_property$7(_assert_this_initialized$7(_this), "useReplacer", false);
918
- _define_property$7(_assert_this_initialized$7(_this), "rootSchema", void 0);
919
- _this.settings = settings;
920
- return _this;
921
- }
922
- _create_class$3(JsonShapeSerializer, [
923
- {
924
- key: "write",
925
- value: function write(schema, value) {
926
- this.rootSchema = NormalizedSchema.of(schema);
927
- this.buffer = this._write(this.rootSchema, value);
928
- }
929
- },
930
- {
931
- key: "writeDiscriminatedDocument",
932
- value: function writeDiscriminatedDocument(schema, value) {
933
- this.write(schema, value);
934
- if (_type_of$7(this.buffer) === "object") {
935
- this.buffer.__type = NormalizedSchema.of(schema).getName(true);
936
- }
937
- }
938
- },
939
- {
940
- key: "flush",
941
- value: function flush() {
942
- var _this = this, rootSchema = _this.rootSchema, useReplacer = _this.useReplacer;
943
- this.rootSchema = undefined;
944
- this.useReplacer = false;
945
- if ((rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.isStructSchema()) || (rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.isDocumentSchema())) {
946
- if (!useReplacer) {
947
- return JSON.stringify(this.buffer);
948
- }
949
- var replacer = new JsonReplacer();
950
- return replacer.replaceInJson(JSON.stringify(this.buffer, replacer.createReplacer(), 0));
951
- }
952
- return this.buffer;
953
- }
954
- },
955
- {
956
- key: "_write",
957
- value: function _write(schema, value, container) {
958
- var isObject = value !== null && (typeof value === "undefined" ? "undefined" : _type_of$7(value)) === "object";
959
- var ns = NormalizedSchema.of(schema);
960
- if (isObject) {
961
- if (ns.isStructSchema()) {
962
- var record = value;
963
- var out = {};
964
- var jsonName = this.settings.jsonName;
965
- var nameMap = void 0;
966
- if (jsonName) {
967
- nameMap = {};
968
- }
969
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
970
- try {
971
- for(var _iterator = ns.structIterator()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
972
- var _step_value = _sliced_to_array$2(_step.value, 2), memberName = _step_value[0], memberSchema = _step_value[1];
973
- var serializableValue = this._write(memberSchema, record[memberName], ns);
974
- if (serializableValue !== undefined) {
975
- var targetKey = memberName;
976
- if (jsonName) {
977
- var _memberSchema_getMergedTraits_jsonName;
978
- targetKey = (_memberSchema_getMergedTraits_jsonName = memberSchema.getMergedTraits().jsonName) !== null && _memberSchema_getMergedTraits_jsonName !== void 0 ? _memberSchema_getMergedTraits_jsonName : memberName;
979
- nameMap[memberName] = targetKey;
980
- }
981
- out[targetKey] = serializableValue;
982
- }
983
- }
984
- } catch (err) {
985
- _didIteratorError = true;
986
- _iteratorError = err;
987
- } finally{
988
- try {
989
- if (!_iteratorNormalCompletion && _iterator.return != null) {
990
- _iterator.return();
991
- }
992
- } finally{
993
- if (_didIteratorError) {
994
- throw _iteratorError;
995
- }
996
- }
997
- }
998
- if (ns.isUnionSchema() && Object.keys(out).length === 0) {
999
- var $unknown = record.$unknown;
1000
- if (Array.isArray($unknown)) {
1001
- var _$unknown = _sliced_to_array$2($unknown, 2), k = _$unknown[0], v = _$unknown[1];
1002
- out[k] = this._write(15, v);
1003
- }
1004
- } else if (typeof record.__type === "string") {
1005
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
1006
- try {
1007
- for(var _iterator1 = Object.entries(record)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
1008
- var _step_value1 = _sliced_to_array$2(_step1.value, 2), k1 = _step_value1[0], v1 = _step_value1[1];
1009
- var _nameMap_k;
1010
- var targetKey1 = jsonName ? (_nameMap_k = nameMap[k1]) !== null && _nameMap_k !== void 0 ? _nameMap_k : k1 : k1;
1011
- if (!(targetKey1 in out)) {
1012
- out[targetKey1] = this._write(15, v1);
1013
- }
1014
- }
1015
- } catch (err) {
1016
- _didIteratorError1 = true;
1017
- _iteratorError1 = err;
1018
- } finally{
1019
- try {
1020
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
1021
- _iterator1.return();
1022
- }
1023
- } finally{
1024
- if (_didIteratorError1) {
1025
- throw _iteratorError1;
1026
- }
1027
- }
1028
- }
1029
- }
1030
- return out;
1031
- }
1032
- if (Array.isArray(value) && ns.isListSchema()) {
1033
- var listMember = ns.getValueSchema();
1034
- var out1 = [];
1035
- var sparse = !!ns.getMergedTraits().sparse;
1036
- var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
1037
- try {
1038
- for(var _iterator2 = value[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
1039
- var item = _step2.value;
1040
- if (sparse || item != null) {
1041
- out1.push(this._write(listMember, item));
1042
- }
1043
- }
1044
- } catch (err) {
1045
- _didIteratorError2 = true;
1046
- _iteratorError2 = err;
1047
- } finally{
1048
- try {
1049
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
1050
- _iterator2.return();
1051
- }
1052
- } finally{
1053
- if (_didIteratorError2) {
1054
- throw _iteratorError2;
1055
- }
1056
- }
1057
- }
1058
- return out1;
1059
- }
1060
- if (ns.isMapSchema()) {
1061
- var mapMember = ns.getValueSchema();
1062
- var out2 = {};
1063
- var sparse1 = !!ns.getMergedTraits().sparse;
1064
- var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
1065
- try {
1066
- for(var _iterator3 = Object.entries(value)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
1067
- var _step_value2 = _sliced_to_array$2(_step3.value, 2), _k = _step_value2[0], _v = _step_value2[1];
1068
- if (sparse1 || _v != null) {
1069
- out2[_k] = this._write(mapMember, _v);
1070
- }
1071
- }
1072
- } catch (err) {
1073
- _didIteratorError3 = true;
1074
- _iteratorError3 = err;
1075
- } finally{
1076
- try {
1077
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
1078
- _iterator3.return();
1079
- }
1080
- } finally{
1081
- if (_didIteratorError3) {
1082
- throw _iteratorError3;
1083
- }
1084
- }
1085
- }
1086
- return out2;
1087
- }
1088
- if (_instanceof(value, Uint8Array) && (ns.isBlobSchema() || ns.isDocumentSchema())) {
1089
- var _this_serdeContext;
1090
- if (ns === this.rootSchema) {
1091
- return value;
1092
- }
1093
- var _this_serdeContext_base64Encoder;
1094
- return ((_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);
1095
- }
1096
- if (_instanceof(value, Date) && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
1097
- var format = determineTimestampFormat(ns, this.settings);
1098
- switch(format){
1099
- case 5:
1100
- return value.toISOString().replace(".000Z", "Z");
1101
- case 6:
1102
- return dateToUtcString(value);
1103
- case 7:
1104
- return value.getTime() / 1000;
1105
- default:
1106
- console.warn("Missing timestamp format, using epoch seconds", value);
1107
- return value.getTime() / 1000;
1108
- }
1109
- }
1110
- if (_instanceof(value, NumericValue)) {
1111
- this.useReplacer = true;
1112
- }
1113
- }
1114
- if (value === null && (container === null || container === void 0 ? void 0 : container.isStructSchema())) {
1115
- return void 0;
1116
- }
1117
- if (ns.isStringSchema()) {
1118
- if (typeof value === "undefined" && ns.isIdempotencyToken()) {
1119
- return v4();
1120
- }
1121
- var mediaType = ns.getMergedTraits().mediaType;
1122
- if (value != null && mediaType) {
1123
- var isJson = mediaType === "application/json" || mediaType.endsWith("+json");
1124
- if (isJson) {
1125
- return LazyJsonString.from(value);
1126
- }
1127
- }
1128
- return value;
1129
- }
1130
- if (typeof value === "number" && ns.isNumericSchema()) {
1131
- if (Math.abs(value) === Infinity || isNaN(value)) {
1132
- return String(value);
1133
- }
1134
- return value;
1135
- }
1136
- if (typeof value === "string" && ns.isBlobSchema()) {
1137
- var _this_serdeContext1;
1138
- if (ns === this.rootSchema) {
1139
- return value;
1140
- }
1141
- var _this_serdeContext_base64Encoder1;
1142
- return ((_this_serdeContext_base64Encoder1 = (_this_serdeContext1 = this.serdeContext) === null || _this_serdeContext1 === void 0 ? void 0 : _this_serdeContext1.base64Encoder) !== null && _this_serdeContext_base64Encoder1 !== void 0 ? _this_serdeContext_base64Encoder1 : toBase64)(value);
1143
- }
1144
- if ((typeof value === "undefined" ? "undefined" : _type_of$7(value)) === "bigint") {
1145
- this.useReplacer = true;
1146
- }
1147
- if (ns.isDocumentSchema()) {
1148
- if (isObject) {
1149
- var out3 = Array.isArray(value) ? [] : {};
1150
- var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = undefined;
1151
- try {
1152
- for(var _iterator4 = Object.entries(value)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true){
1153
- var _step_value3 = _sliced_to_array$2(_step4.value, 2), k2 = _step_value3[0], v2 = _step_value3[1];
1154
- if (_instanceof(v2, NumericValue)) {
1155
- this.useReplacer = true;
1156
- out3[k2] = v2;
1157
- } else {
1158
- out3[k2] = this._write(ns, v2);
1159
- }
1160
- }
1161
- } catch (err) {
1162
- _didIteratorError4 = true;
1163
- _iteratorError4 = err;
1164
- } finally{
1165
- try {
1166
- if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
1167
- _iterator4.return();
1168
- }
1169
- } finally{
1170
- if (_didIteratorError4) {
1171
- throw _iteratorError4;
1172
- }
1173
- }
1174
- }
1175
- return out3;
1176
- } else {
1177
- return structuredClone(value);
1178
- }
1179
- }
1180
- return value;
1181
- }
1182
- }
1183
- ]);
1184
- return JsonShapeSerializer;
1185
- }(SerdeContextConfig);
1186
-
1187
- function _assert_this_initialized$6(self) {
1188
- if (self === void 0) {
1189
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1190
- }
1191
- return self;
1192
- }
1193
- function _class_call_check$6(instance, Constructor) {
1194
- if (!(instance instanceof Constructor)) {
1195
- throw new TypeError("Cannot call a class as a function");
1196
- }
1197
- }
1198
- function _defineProperties$2(target, props) {
1199
- for(var i = 0; i < props.length; i++){
1200
- var descriptor = props[i];
1201
- descriptor.enumerable = descriptor.enumerable || false;
1202
- descriptor.configurable = true;
1203
- if ("value" in descriptor) descriptor.writable = true;
1204
- Object.defineProperty(target, descriptor.key, descriptor);
1205
- }
1206
- }
1207
- function _create_class$2(Constructor, protoProps, staticProps) {
1208
- if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
1209
- return Constructor;
1210
- }
1211
- function _define_property$6(obj, key, value) {
1212
- if (key in obj) {
1213
- Object.defineProperty(obj, key, {
1214
- value: value,
1215
- enumerable: true,
1216
- configurable: true,
1217
- writable: true
1218
- });
1219
- } else {
1220
- obj[key] = value;
1221
- }
1222
- return obj;
1223
- }
1224
- function _get_prototype_of$6(o) {
1225
- _get_prototype_of$6 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1226
- return o.__proto__ || Object.getPrototypeOf(o);
1227
- };
1228
- return _get_prototype_of$6(o);
1229
- }
1230
- function _inherits$6(subClass, superClass) {
1231
- if (typeof superClass !== "function" && superClass !== null) {
1232
- throw new TypeError("Super expression must either be null or a function");
1233
- }
1234
- subClass.prototype = Object.create(superClass && superClass.prototype, {
1235
- constructor: {
1236
- value: subClass,
1237
- writable: true,
1238
- configurable: true
1239
- }
1240
- });
1241
- if (superClass) _set_prototype_of$6(subClass, superClass);
1242
- }
1243
- function _possible_constructor_return$6(self, call) {
1244
- if (call && (_type_of$6(call) === "object" || typeof call === "function")) {
1245
- return call;
1246
- }
1247
- return _assert_this_initialized$6(self);
1248
- }
1249
- function _set_prototype_of$6(o, p) {
1250
- _set_prototype_of$6 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1251
- o.__proto__ = p;
1252
- return o;
1253
- };
1254
- return _set_prototype_of$6(o, p);
1255
- }
1256
- function _type_of$6(obj) {
1257
- "@swc/helpers - typeof";
1258
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1259
- }
1260
- function _is_native_reflect_construct$6() {
1261
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
1262
- if (Reflect.construct.sham) return false;
1263
- if (typeof Proxy === "function") return true;
1264
- try {
1265
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1266
- return true;
1267
- } catch (e) {
1268
- return false;
1269
- }
1270
- }
1271
- function _create_super$6(Derived) {
1272
- var hasNativeReflectConstruct = _is_native_reflect_construct$6();
1273
- return function _createSuperInternal() {
1274
- var Super = _get_prototype_of$6(Derived), result;
1275
- if (hasNativeReflectConstruct) {
1276
- var NewTarget = _get_prototype_of$6(this).constructor;
1277
- result = Reflect.construct(Super, arguments, NewTarget);
1278
- } else {
1279
- result = Super.apply(this, arguments);
1280
- }
1281
- return _possible_constructor_return$6(this, result);
1282
- };
1283
- }
1284
- var JsonCodec = /*#__PURE__*/ function(SerdeContextConfig) {
1285
- _inherits$6(JsonCodec, SerdeContextConfig);
1286
- var _super = _create_super$6(JsonCodec);
1287
- function JsonCodec(settings) {
1288
- _class_call_check$6(this, JsonCodec);
1289
- var _this;
1290
- _this = _super.call(this);
1291
- _define_property$6(_assert_this_initialized$6(_this), "settings", void 0);
1292
- _this.settings = settings;
1293
- return _this;
1294
- }
1295
- _create_class$2(JsonCodec, [
1296
- {
1297
- key: "createSerializer",
1298
- value: function createSerializer() {
1299
- var serializer = new JsonShapeSerializer(this.settings);
1300
- serializer.setSerdeContext(this.serdeContext);
1301
- return serializer;
1302
- }
1303
- },
1304
- {
1305
- key: "createDeserializer",
1306
- value: function createDeserializer() {
1307
- var deserializer = new JsonShapeDeserializer(this.settings);
1308
- deserializer.setSerdeContext(this.serdeContext);
1309
- return deserializer;
1310
- }
1311
- }
1312
- ]);
1313
- return JsonCodec;
1314
- }(SerdeContextConfig);
1315
-
1316
- function _array_like_to_array$1(arr, len) {
1317
- if (len == null || len > arr.length) len = arr.length;
1318
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1319
- return arr2;
1320
- }
1321
- function _array_with_holes$1(arr) {
1322
- if (Array.isArray(arr)) return arr;
1323
- }
1324
- function _assert_this_initialized$5(self) {
1325
- if (self === void 0) {
1326
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1327
- }
1328
- return self;
1329
- }
1330
- function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
1331
- try {
1332
- var info = gen[key](arg);
1333
- var value = info.value;
1334
- } catch (error) {
1335
- reject(error);
1336
- return;
1337
- }
1338
- if (info.done) {
1339
- resolve(value);
1340
- } else {
1341
- Promise.resolve(value).then(_next, _throw);
376
+ if (info.done) {
377
+ resolve(value);
378
+ } else {
379
+ Promise.resolve(value).then(_next, _throw);
1342
380
  }
1343
381
  }
1344
382
  function _async_to_generator$4(fn) {
@@ -1356,158 +394,6 @@ function _async_to_generator$4(fn) {
1356
394
  });
1357
395
  };
1358
396
  }
1359
- function _class_call_check$5(instance, Constructor) {
1360
- if (!(instance instanceof Constructor)) {
1361
- throw new TypeError("Cannot call a class as a function");
1362
- }
1363
- }
1364
- function _defineProperties$1(target, props) {
1365
- for(var i = 0; i < props.length; i++){
1366
- var descriptor = props[i];
1367
- descriptor.enumerable = descriptor.enumerable || false;
1368
- descriptor.configurable = true;
1369
- if ("value" in descriptor) descriptor.writable = true;
1370
- Object.defineProperty(target, descriptor.key, descriptor);
1371
- }
1372
- }
1373
- function _create_class$1(Constructor, protoProps, staticProps) {
1374
- if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
1375
- return Constructor;
1376
- }
1377
- function _define_property$5(obj, key, value) {
1378
- if (key in obj) {
1379
- Object.defineProperty(obj, key, {
1380
- value: value,
1381
- enumerable: true,
1382
- configurable: true,
1383
- writable: true
1384
- });
1385
- } else {
1386
- obj[key] = value;
1387
- }
1388
- return obj;
1389
- }
1390
- function _get$1(target, property, receiver) {
1391
- if (typeof Reflect !== "undefined" && Reflect.get) {
1392
- _get$1 = Reflect.get;
1393
- } else {
1394
- _get$1 = function get(target, property, receiver) {
1395
- var base = _super_prop_base$1(target, property);
1396
- if (!base) return;
1397
- var desc = Object.getOwnPropertyDescriptor(base, property);
1398
- if (desc.get) {
1399
- return desc.get.call(receiver || target);
1400
- }
1401
- return desc.value;
1402
- };
1403
- }
1404
- return _get$1(target, property, receiver || target);
1405
- }
1406
- function _get_prototype_of$5(o) {
1407
- _get_prototype_of$5 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1408
- return o.__proto__ || Object.getPrototypeOf(o);
1409
- };
1410
- return _get_prototype_of$5(o);
1411
- }
1412
- function _inherits$5(subClass, superClass) {
1413
- if (typeof superClass !== "function" && superClass !== null) {
1414
- throw new TypeError("Super expression must either be null or a function");
1415
- }
1416
- subClass.prototype = Object.create(superClass && superClass.prototype, {
1417
- constructor: {
1418
- value: subClass,
1419
- writable: true,
1420
- configurable: true
1421
- }
1422
- });
1423
- if (superClass) _set_prototype_of$5(subClass, superClass);
1424
- }
1425
- function _iterable_to_array_limit$1(arr, i) {
1426
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1427
- if (_i == null) return;
1428
- var _arr = [];
1429
- var _n = true;
1430
- var _d = false;
1431
- var _s, _e;
1432
- try {
1433
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1434
- _arr.push(_s.value);
1435
- if (i && _arr.length === i) break;
1436
- }
1437
- } catch (err) {
1438
- _d = true;
1439
- _e = err;
1440
- } finally{
1441
- try {
1442
- if (!_n && _i["return"] != null) _i["return"]();
1443
- } finally{
1444
- if (_d) throw _e;
1445
- }
1446
- }
1447
- return _arr;
1448
- }
1449
- function _non_iterable_rest$1() {
1450
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1451
- }
1452
- function _possible_constructor_return$5(self, call) {
1453
- if (call && (_type_of$5(call) === "object" || typeof call === "function")) {
1454
- return call;
1455
- }
1456
- return _assert_this_initialized$5(self);
1457
- }
1458
- function _set_prototype_of$5(o, p) {
1459
- _set_prototype_of$5 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1460
- o.__proto__ = p;
1461
- return o;
1462
- };
1463
- return _set_prototype_of$5(o, p);
1464
- }
1465
- function _sliced_to_array$1(arr, i) {
1466
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
1467
- }
1468
- function _super_prop_base$1(object, property) {
1469
- while(!Object.prototype.hasOwnProperty.call(object, property)){
1470
- object = _get_prototype_of$5(object);
1471
- if (object === null) break;
1472
- }
1473
- return object;
1474
- }
1475
- function _type_of$5(obj) {
1476
- "@swc/helpers - typeof";
1477
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1478
- }
1479
- function _unsupported_iterable_to_array$1(o, minLen) {
1480
- if (!o) return;
1481
- if (typeof o === "string") return _array_like_to_array$1(o, minLen);
1482
- var n = Object.prototype.toString.call(o).slice(8, -1);
1483
- if (n === "Object" && o.constructor) n = o.constructor.name;
1484
- if (n === "Map" || n === "Set") return Array.from(n);
1485
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
1486
- }
1487
- function _is_native_reflect_construct$5() {
1488
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
1489
- if (Reflect.construct.sham) return false;
1490
- if (typeof Proxy === "function") return true;
1491
- try {
1492
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1493
- return true;
1494
- } catch (e) {
1495
- return false;
1496
- }
1497
- }
1498
- function _create_super$5(Derived) {
1499
- var hasNativeReflectConstruct = _is_native_reflect_construct$5();
1500
- return function _createSuperInternal() {
1501
- var Super = _get_prototype_of$5(Derived), result;
1502
- if (hasNativeReflectConstruct) {
1503
- var NewTarget = _get_prototype_of$5(this).constructor;
1504
- result = Reflect.construct(Super, arguments, NewTarget);
1505
- } else {
1506
- result = Super.apply(this, arguments);
1507
- }
1508
- return _possible_constructor_return$5(this, result);
1509
- };
1510
- }
1511
397
  function _ts_generator$4(thisArg, body) {
1512
398
  var f, y, t, g, _ = {
1513
399
  label: 0,
@@ -1593,217 +479,51 @@ function _ts_generator$4(thisArg, body) {
1593
479
  e
1594
480
  ];
1595
481
  y = 0;
1596
- } finally{
1597
- f = t = 0;
1598
- }
1599
- if (op[0] & 5) throw op[1];
1600
- return {
1601
- value: op[0] ? op[1] : void 0,
1602
- done: true
1603
- };
1604
- }
1605
- }
1606
- var AwsRestJsonProtocol = /*#__PURE__*/ function(HttpBindingProtocol) {
1607
- _inherits$5(AwsRestJsonProtocol, HttpBindingProtocol);
1608
- var _super = _create_super$5(AwsRestJsonProtocol);
1609
- function AwsRestJsonProtocol(param) {
1610
- var defaultNamespace = param.defaultNamespace;
1611
- _class_call_check$5(this, AwsRestJsonProtocol);
1612
- var _this;
1613
- _this = _super.call(this, {
1614
- defaultNamespace: defaultNamespace
1615
- });
1616
- _define_property$5(_assert_this_initialized$5(_this), "serializer", void 0);
1617
- _define_property$5(_assert_this_initialized$5(_this), "deserializer", void 0);
1618
- _define_property$5(_assert_this_initialized$5(_this), "codec", void 0);
1619
- _define_property$5(_assert_this_initialized$5(_this), "mixin", new ProtocolLib());
1620
- var settings = {
1621
- timestampFormat: {
1622
- useTrait: true,
1623
- default: 7
1624
- },
1625
- httpBindings: true,
1626
- jsonName: true
1627
- };
1628
- _this.codec = new JsonCodec(settings);
1629
- _this.serializer = new HttpInterceptingShapeSerializer(_this.codec.createSerializer(), settings);
1630
- _this.deserializer = new HttpInterceptingShapeDeserializer(_this.codec.createDeserializer(), settings);
1631
- return _this;
1632
- }
1633
- _create_class$1(AwsRestJsonProtocol, [
1634
- {
1635
- key: "getShapeId",
1636
- value: function getShapeId() {
1637
- return "aws.protocols#restJson1";
1638
- }
1639
- },
1640
- {
1641
- key: "getPayloadCodec",
1642
- value: function getPayloadCodec() {
1643
- return this.codec;
1644
- }
1645
- },
1646
- {
1647
- key: "setSerdeContext",
1648
- value: function setSerdeContext(serdeContext) {
1649
- this.codec.setSerdeContext(serdeContext);
1650
- _get$1(_get_prototype_of$5(AwsRestJsonProtocol.prototype), "setSerdeContext", this).call(this, serdeContext);
1651
- }
1652
- },
1653
- {
1654
- key: "serializeRequest",
1655
- value: function serializeRequest(operationSchema, input, context) {
1656
- var _this = this;
1657
- var _this1 = this, _superprop_get_serializeRequest = function() {
1658
- return _get$1(_get_prototype_of$5(AwsRestJsonProtocol.prototype), "serializeRequest", _this);
1659
- };
1660
- return _async_to_generator$4(function() {
1661
- var request, inputSchema, contentType;
1662
- return _ts_generator$4(this, function(_state) {
1663
- switch(_state.label){
1664
- case 0:
1665
- return [
1666
- 4,
1667
- _superprop_get_serializeRequest().call(_this1, operationSchema, input, context)
1668
- ];
1669
- case 1:
1670
- request = _state.sent();
1671
- inputSchema = NormalizedSchema.of(operationSchema.input);
1672
- if (!request.headers["content-type"]) {
1673
- contentType = _this1.mixin.resolveRestContentType(_this1.getDefaultContentType(), inputSchema);
1674
- if (contentType) {
1675
- request.headers["content-type"] = contentType;
1676
- }
1677
- }
1678
- if (request.body == null && request.headers["content-type"] === _this1.getDefaultContentType()) {
1679
- request.body = "{}";
1680
- }
1681
- return [
1682
- 2,
1683
- request
1684
- ];
1685
- }
1686
- });
1687
- })();
1688
- }
1689
- },
1690
- {
1691
- key: "deserializeResponse",
1692
- value: function deserializeResponse(operationSchema, context, response) {
1693
- var _this = this;
1694
- var _this1 = this, _superprop_get_deserializeResponse = function() {
1695
- return _get$1(_get_prototype_of$5(AwsRestJsonProtocol.prototype), "deserializeResponse", _this);
1696
- };
1697
- return _async_to_generator$4(function() {
1698
- var output, outputSchema, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, member;
1699
- return _ts_generator$4(this, function(_state) {
1700
- switch(_state.label){
1701
- case 0:
1702
- return [
1703
- 4,
1704
- _superprop_get_deserializeResponse().call(_this1, operationSchema, context, response)
1705
- ];
1706
- case 1:
1707
- output = _state.sent();
1708
- outputSchema = NormalizedSchema.of(operationSchema.output);
1709
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1710
- try {
1711
- for(_iterator = outputSchema.structIterator()[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1712
- _step_value = _sliced_to_array$1(_step.value, 2), name = _step_value[0], member = _step_value[1];
1713
- if (member.getMemberTraits().httpPayload && !(name in output)) {
1714
- output[name] = null;
1715
- }
1716
- }
1717
- } catch (err) {
1718
- _didIteratorError = true;
1719
- _iteratorError = err;
1720
- } finally{
1721
- try {
1722
- if (!_iteratorNormalCompletion && _iterator.return != null) {
1723
- _iterator.return();
1724
- }
1725
- } finally{
1726
- if (_didIteratorError) {
1727
- throw _iteratorError;
1728
- }
1729
- }
1730
- }
1731
- return [
1732
- 2,
1733
- output
1734
- ];
1735
- }
1736
- });
1737
- })();
1738
- }
1739
- },
1740
- {
1741
- key: "handleError",
1742
- value: function handleError(operationSchema, context, response, dataObject, metadata) {
1743
- var _this = this;
1744
- return _async_to_generator$4(function() {
1745
- var _loadRestJsonErrorCode, errorIdentifier, _ref, errorSchema, errorMetadata, ns, _dataObject_message, _ref1, message, _TypeRegistry_for_getErrorCtor, ErrorCtor, exception, output, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, member, _member_getMergedTraits_jsonName, target;
1746
- return _ts_generator$4(this, function(_state) {
1747
- switch(_state.label){
1748
- case 0:
1749
- errorIdentifier = (_loadRestJsonErrorCode = loadRestJsonErrorCode(response, dataObject)) !== null && _loadRestJsonErrorCode !== void 0 ? _loadRestJsonErrorCode : "Unknown";
1750
- return [
1751
- 4,
1752
- _this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, _this.options.defaultNamespace, response, dataObject, metadata)
1753
- ];
1754
- case 1:
1755
- _ref = _state.sent(), errorSchema = _ref.errorSchema, errorMetadata = _ref.errorMetadata;
1756
- ns = NormalizedSchema.of(errorSchema);
1757
- message = (_ref1 = (_dataObject_message = dataObject.message) !== null && _dataObject_message !== void 0 ? _dataObject_message : dataObject.Message) !== null && _ref1 !== void 0 ? _ref1 : "Unknown";
1758
- ErrorCtor = (_TypeRegistry_for_getErrorCtor = TypeRegistry.for(errorSchema[1]).getErrorCtor(errorSchema)) !== null && _TypeRegistry_for_getErrorCtor !== void 0 ? _TypeRegistry_for_getErrorCtor : Error;
1759
- exception = new ErrorCtor(message);
1760
- return [
1761
- 4,
1762
- _this.deserializeHttpMessage(errorSchema, context, response, dataObject)
1763
- ];
1764
- case 2:
1765
- _state.sent();
1766
- output = {};
1767
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1768
- try {
1769
- for(_iterator = ns.structIterator()[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1770
- _step_value = _sliced_to_array$1(_step.value, 2), name = _step_value[0], member = _step_value[1];
1771
- ;
1772
- target = (_member_getMergedTraits_jsonName = member.getMergedTraits().jsonName) !== null && _member_getMergedTraits_jsonName !== void 0 ? _member_getMergedTraits_jsonName : name;
1773
- output[name] = _this.codec.createDeserializer().readObject(member, dataObject[target]);
1774
- }
1775
- } catch (err) {
1776
- _didIteratorError = true;
1777
- _iteratorError = err;
1778
- } finally{
1779
- try {
1780
- if (!_iteratorNormalCompletion && _iterator.return != null) {
1781
- _iterator.return();
1782
- }
1783
- } finally{
1784
- if (_didIteratorError) {
1785
- throw _iteratorError;
1786
- }
1787
- }
1788
- }
1789
- throw _this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
1790
- $fault: ns.getMergedTraits().error,
1791
- message: message
1792
- }, output), dataObject);
1793
- }
1794
- });
1795
- })();
1796
- }
1797
- },
1798
- {
1799
- key: "getDefaultContentType",
1800
- value: function getDefaultContentType() {
1801
- return "application/json";
1802
- }
482
+ } finally{
483
+ f = t = 0;
1803
484
  }
1804
- ]);
1805
- return AwsRestJsonProtocol;
1806
- }(HttpBindingProtocol);
485
+ if (op[0] & 5) throw op[1];
486
+ return {
487
+ value: op[0] ? op[1] : void 0,
488
+ done: true
489
+ };
490
+ }
491
+ }
492
+ var getSsoOidcClient = function() {
493
+ var _ref = _async_to_generator$4(function(ssoRegion) {
494
+ var init, callerClientConfig, _init_clientConfig, SSOOIDCClient, coalesce, _init_clientConfig1, ssoOidcClient;
495
+ var _arguments = arguments;
496
+ return _ts_generator$4(this, function(_state) {
497
+ switch(_state.label){
498
+ case 0:
499
+ init = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, callerClientConfig = _arguments.length > 2 ? _arguments[2] : void 0;
500
+ return [
501
+ 4,
502
+ import('./index.esm13.js')
503
+ ];
504
+ case 1:
505
+ SSOOIDCClient = _state.sent().SSOOIDCClient;
506
+ coalesce = function(prop) {
507
+ var _init_clientConfig, _init_parentClientConfig;
508
+ var _init_clientConfig_prop, _ref;
509
+ 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];
510
+ };
511
+ ssoOidcClient = new SSOOIDCClient(Object.assign({}, (_init_clientConfig1 = init.clientConfig) !== null && _init_clientConfig1 !== void 0 ? _init_clientConfig1 : {}, {
512
+ region: ssoRegion !== null && ssoRegion !== void 0 ? ssoRegion : (_init_clientConfig = init.clientConfig) === null || _init_clientConfig === void 0 ? void 0 : _init_clientConfig.region,
513
+ logger: coalesce("logger"),
514
+ userAgentAppId: coalesce("userAgentAppId")
515
+ }));
516
+ return [
517
+ 2,
518
+ ssoOidcClient
519
+ ];
520
+ }
521
+ });
522
+ });
523
+ return function getSsoOidcClient(ssoRegion) {
524
+ return _ref.apply(this, arguments);
525
+ };
526
+ }();
1807
527
 
1808
528
  function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
1809
529
  try {
@@ -1929,432 +649,93 @@ function _ts_generator$3(thisArg, body) {
1929
649
  };
1930
650
  }
1931
651
  }
1932
- var defaultSSOOIDCHttpAuthSchemeParametersProvider = function() {
1933
- var _ref = _async_to_generator$3(function(config, context, input) {
1934
- var _tmp;
652
+ var getNewSsoOidcToken = function() {
653
+ var _ref = _async_to_generator$3(function(ssoToken, ssoRegion) {
654
+ var init, callerClientConfig, CreateTokenCommand, ssoOidcClient;
655
+ var _arguments = arguments;
1935
656
  return _ts_generator$3(this, function(_state) {
1936
657
  switch(_state.label){
1937
658
  case 0:
1938
- _tmp = {
1939
- operation: getSmithyContext(context).operation
1940
- };
659
+ init = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {}, callerClientConfig = _arguments.length > 3 ? _arguments[3] : void 0;
1941
660
  return [
1942
661
  4,
1943
- normalizeProvider(config.region)()
662
+ import('./index.esm13.js')
1944
663
  ];
1945
664
  case 1:
665
+ CreateTokenCommand = _state.sent().CreateTokenCommand;
666
+ return [
667
+ 4,
668
+ getSsoOidcClient(ssoRegion, init, callerClientConfig)
669
+ ];
670
+ case 2:
671
+ ssoOidcClient = _state.sent();
1946
672
  return [
1947
673
  2,
1948
- (_tmp.region = _state.sent() || function() {
1949
- throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
1950
- }(), _tmp)
674
+ ssoOidcClient.send(new CreateTokenCommand({
675
+ clientId: ssoToken.clientId,
676
+ clientSecret: ssoToken.clientSecret,
677
+ refreshToken: ssoToken.refreshToken,
678
+ grantType: "refresh_token"
679
+ }))
1951
680
  ];
1952
681
  }
1953
682
  });
1954
683
  });
1955
- return function defaultSSOOIDCHttpAuthSchemeParametersProvider(config, context, input) {
684
+ return function getNewSsoOidcToken(ssoToken, ssoRegion) {
1956
685
  return _ref.apply(this, arguments);
1957
686
  };
1958
687
  }();
1959
- function createAwsAuthSigv4HttpAuthOption(authParameters) {
1960
- return {
1961
- schemeId: "aws.auth#sigv4",
1962
- signingProperties: {
1963
- name: "sso-oauth",
1964
- region: authParameters.region
1965
- },
1966
- propertiesExtractor: function(config, context) {
1967
- return {
1968
- signingProperties: {
1969
- config: config,
1970
- context: context
1971
- }
1972
- };
1973
- }
1974
- };
1975
- }
1976
- function createSmithyApiNoAuthHttpAuthOption(authParameters) {
1977
- return {
1978
- schemeId: "smithy.api#noAuth"
1979
- };
1980
- }
1981
- var defaultSSOOIDCHttpAuthSchemeProvider = function(authParameters) {
1982
- var options = [];
1983
- switch(authParameters.operation){
1984
- case "CreateToken":
1985
- {
1986
- options.push(createSmithyApiNoAuthHttpAuthOption());
1987
- break;
1988
- }
1989
- default:
1990
- {
1991
- options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
1992
- }
1993
- }
1994
- return options;
1995
- };
1996
- var resolveHttpAuthSchemeConfig = function(config) {
1997
- var config_0 = resolveAwsSdkSigV4Config(config);
1998
- var _config_authSchemePreference;
1999
- return Object.assign(config_0, {
2000
- authSchemePreference: normalizeProvider((_config_authSchemePreference = config.authSchemePreference) !== null && _config_authSchemePreference !== void 0 ? _config_authSchemePreference : [])
2001
- });
2002
- };
2003
688
 
2004
- var resolveClientEndpointParameters = function(options) {
2005
- var _options_useDualstackEndpoint, _options_useFipsEndpoint;
2006
- return Object.assign(options, {
2007
- useDualstackEndpoint: (_options_useDualstackEndpoint = options.useDualstackEndpoint) !== null && _options_useDualstackEndpoint !== void 0 ? _options_useDualstackEndpoint : false,
2008
- useFipsEndpoint: (_options_useFipsEndpoint = options.useFipsEndpoint) !== null && _options_useFipsEndpoint !== void 0 ? _options_useFipsEndpoint : false,
2009
- defaultSigningName: "sso-oauth"
2010
- });
2011
- };
2012
- var commonParams = {
2013
- UseFIPS: {
2014
- type: "builtInParams",
2015
- name: "useFipsEndpoint"
2016
- },
2017
- Endpoint: {
2018
- type: "builtInParams",
2019
- name: "endpoint"
2020
- },
2021
- Region: {
2022
- type: "builtInParams",
2023
- name: "region"
2024
- },
2025
- UseDualStack: {
2026
- type: "builtInParams",
2027
- name: "useDualstackEndpoint"
689
+ var validateTokenExpiry = function(token) {
690
+ if (token.expiration && token.expiration.getTime() < Date.now()) {
691
+ throw new TokenProviderError("Token is expired. ".concat(REFRESH_MESSAGE), false);
2028
692
  }
2029
693
  };
2030
694
 
2031
- function _define_property$4(obj, key, value) {
2032
- if (key in obj) {
2033
- Object.defineProperty(obj, key, {
2034
- value: value,
2035
- enumerable: true,
2036
- configurable: true,
2037
- writable: true
2038
- });
2039
- } else {
2040
- obj[key] = value;
695
+ var validateTokenKey = function(key, value) {
696
+ var forRefresh = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
697
+ if (typeof value === "undefined") {
698
+ throw new TokenProviderError("Value not present for '".concat(key, "' in SSO Token").concat(forRefresh ? ". Cannot refresh" : "", ". ").concat(REFRESH_MESSAGE), false);
2041
699
  }
2042
- return obj;
2043
- }
2044
- var u = "required", v = "fn", w = "argv", x = "ref";
2045
- var _obj$1, _obj1$1, _obj2$1, _obj3$1, _obj4$1, _obj5$1, _obj6$1;
2046
- var a = true, b = "isSet", c = "booleanEquals", d = "error", e = "endpoint", f = "tree", g = "PartitionResult", h = "getAttr", i = (_obj$1 = {}, _define_property$4(_obj$1, u, false), _define_property$4(_obj$1, "type", "string"), _obj$1), j = (_obj1$1 = {}, _define_property$4(_obj1$1, u, true), _define_property$4(_obj1$1, "default", false), _define_property$4(_obj1$1, "type", "boolean"), _obj1$1), k = _define_property$4({}, x, "Endpoint"), l = (_obj2$1 = {}, _define_property$4(_obj2$1, v, c), _define_property$4(_obj2$1, w, [
2047
- _define_property$4({}, x, "UseFIPS"),
2048
- true
2049
- ]), _obj2$1), m = (_obj3$1 = {}, _define_property$4(_obj3$1, v, c), _define_property$4(_obj3$1, w, [
2050
- _define_property$4({}, x, "UseDualStack"),
2051
- true
2052
- ]), _obj3$1), n = {}, o = (_obj4$1 = {}, _define_property$4(_obj4$1, v, h), _define_property$4(_obj4$1, w, [
2053
- _define_property$4({}, x, g),
2054
- "supportsFIPS"
2055
- ]), _obj4$1), p = _define_property$4({}, x, g), q = (_obj6$1 = {}, _define_property$4(_obj6$1, v, c), _define_property$4(_obj6$1, w, [
2056
- true,
2057
- (_obj5$1 = {}, _define_property$4(_obj5$1, v, h), _define_property$4(_obj5$1, w, [
2058
- p,
2059
- "supportsDualStack"
2060
- ]), _obj5$1)
2061
- ]), _obj6$1), r = [
2062
- l
2063
- ], s = [
2064
- m
2065
- ], t = [
2066
- _define_property$4({}, x, "Region")
2067
- ];
2068
- var _obj7$1, _obj8$1, _obj9$1, _obj10$1, _obj11, _obj12, _obj13;
2069
- var _data = {
2070
- parameters: {
2071
- Region: i,
2072
- UseDualStack: j,
2073
- UseFIPS: j,
2074
- Endpoint: i
2075
- },
2076
- rules: [
2077
- {
2078
- conditions: [
2079
- (_obj7$1 = {}, _define_property$4(_obj7$1, v, b), _define_property$4(_obj7$1, w, [
2080
- k
2081
- ]), _obj7$1)
2082
- ],
2083
- rules: [
2084
- {
2085
- conditions: r,
2086
- error: "Invalid Configuration: FIPS and custom endpoint are not supported",
2087
- type: d
2088
- },
2089
- {
2090
- conditions: s,
2091
- error: "Invalid Configuration: Dualstack and custom endpoint are not supported",
2092
- type: d
2093
- },
2094
- {
2095
- endpoint: {
2096
- url: k,
2097
- properties: n,
2098
- headers: n
2099
- },
2100
- type: e
2101
- }
2102
- ],
2103
- type: f
2104
- },
2105
- {
2106
- conditions: [
2107
- (_obj8$1 = {}, _define_property$4(_obj8$1, v, b), _define_property$4(_obj8$1, w, t), _obj8$1)
2108
- ],
2109
- rules: [
2110
- {
2111
- conditions: [
2112
- (_obj9$1 = {}, _define_property$4(_obj9$1, v, "aws.partition"), _define_property$4(_obj9$1, w, t), _define_property$4(_obj9$1, "assign", g), _obj9$1)
2113
- ],
2114
- rules: [
2115
- {
2116
- conditions: [
2117
- l,
2118
- m
2119
- ],
2120
- rules: [
2121
- {
2122
- conditions: [
2123
- (_obj10$1 = {}, _define_property$4(_obj10$1, v, c), _define_property$4(_obj10$1, w, [
2124
- a,
2125
- o
2126
- ]), _obj10$1),
2127
- q
2128
- ],
2129
- rules: [
2130
- {
2131
- endpoint: {
2132
- url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",
2133
- properties: n,
2134
- headers: n
2135
- },
2136
- type: e
2137
- }
2138
- ],
2139
- type: f
2140
- },
2141
- {
2142
- error: "FIPS and DualStack are enabled, but this partition does not support one or both",
2143
- type: d
2144
- }
2145
- ],
2146
- type: f
2147
- },
2148
- {
2149
- conditions: r,
2150
- rules: [
2151
- {
2152
- conditions: [
2153
- (_obj11 = {}, _define_property$4(_obj11, v, c), _define_property$4(_obj11, w, [
2154
- o,
2155
- a
2156
- ]), _obj11)
2157
- ],
2158
- rules: [
2159
- {
2160
- conditions: [
2161
- (_obj13 = {}, _define_property$4(_obj13, v, "stringEquals"), _define_property$4(_obj13, w, [
2162
- (_obj12 = {}, _define_property$4(_obj12, v, h), _define_property$4(_obj12, w, [
2163
- p,
2164
- "name"
2165
- ]), _obj12),
2166
- "aws-us-gov"
2167
- ]), _obj13)
2168
- ],
2169
- endpoint: {
2170
- url: "https://oidc.{Region}.amazonaws.com",
2171
- properties: n,
2172
- headers: n
2173
- },
2174
- type: e
2175
- },
2176
- {
2177
- endpoint: {
2178
- url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",
2179
- properties: n,
2180
- headers: n
2181
- },
2182
- type: e
2183
- }
2184
- ],
2185
- type: f
2186
- },
2187
- {
2188
- error: "FIPS is enabled but this partition does not support FIPS",
2189
- type: d
2190
- }
2191
- ],
2192
- type: f
2193
- },
2194
- {
2195
- conditions: s,
2196
- rules: [
2197
- {
2198
- conditions: [
2199
- q
2200
- ],
2201
- rules: [
2202
- {
2203
- endpoint: {
2204
- url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",
2205
- properties: n,
2206
- headers: n
2207
- },
2208
- type: e
2209
- }
2210
- ],
2211
- type: f
2212
- },
2213
- {
2214
- error: "DualStack is enabled but this partition does not support DualStack",
2215
- type: d
2216
- }
2217
- ],
2218
- type: f
2219
- },
2220
- {
2221
- endpoint: {
2222
- url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}",
2223
- properties: n,
2224
- headers: n
2225
- },
2226
- type: e
2227
- }
2228
- ],
2229
- type: f
2230
- }
2231
- ],
2232
- type: f
2233
- },
2234
- {
2235
- error: "Invalid Configuration: Missing Region",
2236
- type: d
2237
- }
2238
- ]
2239
700
  };
2240
- var ruleSet = _data;
2241
701
 
2242
- var cache = new EndpointCache({
2243
- size: 50,
2244
- params: [
2245
- "Endpoint",
2246
- "Region",
2247
- "UseDualStack",
2248
- "UseFIPS"
2249
- ]
2250
- });
2251
- var defaultEndpointResolver = function(endpointParams) {
2252
- var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2253
- return cache.get(endpointParams, function() {
2254
- return resolveEndpoint(ruleSet, {
2255
- endpointParams: endpointParams,
2256
- logger: context.logger
2257
- });
2258
- });
702
+ var writeFile = promises.writeFile;
703
+ var writeSSOTokenToFile = function(id, ssoToken) {
704
+ var tokenFilepath = getSSOTokenFilepath(id);
705
+ var tokenString = JSON.stringify(ssoToken, null, 2);
706
+ return writeFile(tokenFilepath, tokenString);
2259
707
  };
2260
- customEndpointFunctions.aws = awsEndpointFunctions;
2261
708
 
2262
- function _assert_this_initialized$4(self) {
2263
- if (self === void 0) {
2264
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2265
- }
2266
- return self;
2267
- }
2268
- function _class_call_check$4(instance, Constructor) {
2269
- if (!(instance instanceof Constructor)) {
2270
- throw new TypeError("Cannot call a class as a function");
2271
- }
2272
- }
2273
- function _get_prototype_of$4(o) {
2274
- _get_prototype_of$4 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
2275
- return o.__proto__ || Object.getPrototypeOf(o);
2276
- };
2277
- return _get_prototype_of$4(o);
2278
- }
2279
- function _inherits$4(subClass, superClass) {
2280
- if (typeof superClass !== "function" && superClass !== null) {
2281
- throw new TypeError("Super expression must either be null or a function");
2282
- }
2283
- subClass.prototype = Object.create(superClass && superClass.prototype, {
2284
- constructor: {
2285
- value: subClass,
2286
- writable: true,
2287
- configurable: true
2288
- }
2289
- });
2290
- if (superClass) _set_prototype_of$4(subClass, superClass);
2291
- }
2292
- function _possible_constructor_return$4(self, call) {
2293
- if (call && (_type_of$4(call) === "object" || typeof call === "function")) {
2294
- return call;
2295
- }
2296
- return _assert_this_initialized$4(self);
2297
- }
2298
- function _set_prototype_of$4(o, p) {
2299
- _set_prototype_of$4 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
2300
- o.__proto__ = p;
2301
- return o;
2302
- };
2303
- return _set_prototype_of$4(o, p);
2304
- }
2305
- function _type_of$4(obj) {
2306
- "@swc/helpers - typeof";
2307
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
2308
- }
2309
- function _is_native_reflect_construct$4() {
2310
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
2311
- if (Reflect.construct.sham) return false;
2312
- if (typeof Proxy === "function") return true;
709
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
2313
710
  try {
2314
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
2315
- return true;
2316
- } catch (e) {
2317
- return false;
2318
- }
2319
- }
2320
- function _create_super$4(Derived) {
2321
- var hasNativeReflectConstruct = _is_native_reflect_construct$4();
2322
- return function _createSuperInternal() {
2323
- var Super = _get_prototype_of$4(Derived), result;
2324
- if (hasNativeReflectConstruct) {
2325
- var NewTarget = _get_prototype_of$4(this).constructor;
2326
- result = Reflect.construct(Super, arguments, NewTarget);
2327
- } else {
2328
- result = Super.apply(this, arguments);
2329
- }
2330
- return _possible_constructor_return$4(this, result);
2331
- };
2332
- }
2333
- var SSOOIDCServiceException = /*#__PURE__*/ function(__ServiceException) {
2334
- _inherits$4(SSOOIDCServiceException, __ServiceException);
2335
- var _super = _create_super$4(SSOOIDCServiceException);
2336
- function SSOOIDCServiceException(options) {
2337
- _class_call_check$4(this, SSOOIDCServiceException);
2338
- var _this;
2339
- _this = _super.call(this, options);
2340
- Object.setPrototypeOf(_assert_this_initialized$4(_this), SSOOIDCServiceException.prototype);
2341
- return _this;
711
+ var info = gen[key](arg);
712
+ var value = info.value;
713
+ } catch (error) {
714
+ reject(error);
715
+ return;
2342
716
  }
2343
- return SSOOIDCServiceException;
2344
- }(ServiceException);
2345
-
2346
- function _assert_this_initialized$3(self) {
2347
- if (self === void 0) {
2348
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
717
+ if (info.done) {
718
+ resolve(value);
719
+ } else {
720
+ Promise.resolve(value).then(_next, _throw);
2349
721
  }
2350
- return self;
2351
722
  }
2352
- function _class_call_check$3(instance, Constructor) {
2353
- if (!(instance instanceof Constructor)) {
2354
- throw new TypeError("Cannot call a class as a function");
2355
- }
723
+ function _async_to_generator$2(fn) {
724
+ return function() {
725
+ var self = this, args = arguments;
726
+ return new Promise(function(resolve, reject) {
727
+ var gen = fn.apply(self, args);
728
+ function _next(value) {
729
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
730
+ }
731
+ function _throw(err) {
732
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
733
+ }
734
+ _next(undefined);
735
+ });
736
+ };
2356
737
  }
2357
- function _define_property$3(obj, key, value) {
738
+ function _define_property$1(obj, key, value) {
2358
739
  if (key in obj) {
2359
740
  Object.defineProperty(obj, key, {
2360
741
  value: value,
@@ -2367,25 +748,6 @@ function _define_property$3(obj, key, value) {
2367
748
  }
2368
749
  return obj;
2369
750
  }
2370
- function _get_prototype_of$3(o) {
2371
- _get_prototype_of$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
2372
- return o.__proto__ || Object.getPrototypeOf(o);
2373
- };
2374
- return _get_prototype_of$3(o);
2375
- }
2376
- function _inherits$3(subClass, superClass) {
2377
- if (typeof superClass !== "function" && superClass !== null) {
2378
- throw new TypeError("Super expression must either be null or a function");
2379
- }
2380
- subClass.prototype = Object.create(superClass && superClass.prototype, {
2381
- constructor: {
2382
- value: subClass,
2383
- writable: true,
2384
- configurable: true
2385
- }
2386
- });
2387
- if (superClass) _set_prototype_of$3(subClass, superClass);
2388
- }
2389
751
  function _object_spread$1(target) {
2390
752
  for(var i = 1; i < arguments.length; i++){
2391
753
  var source = arguments[i] != null ? arguments[i] : {};
@@ -2396,696 +758,29 @@ function _object_spread$1(target) {
2396
758
  }));
2397
759
  }
2398
760
  ownKeys.forEach(function(key) {
2399
- _define_property$3(target, key, source[key]);
2400
- });
2401
- }
2402
- return target;
2403
- }
2404
- function _possible_constructor_return$3(self, call) {
2405
- if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
2406
- return call;
2407
- }
2408
- return _assert_this_initialized$3(self);
2409
- }
2410
- function _set_prototype_of$3(o, p) {
2411
- _set_prototype_of$3 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
2412
- o.__proto__ = p;
2413
- return o;
2414
- };
2415
- return _set_prototype_of$3(o, p);
2416
- }
2417
- function _type_of$3(obj) {
2418
- "@swc/helpers - typeof";
2419
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
2420
- }
2421
- function _is_native_reflect_construct$3() {
2422
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
2423
- if (Reflect.construct.sham) return false;
2424
- if (typeof Proxy === "function") return true;
2425
- try {
2426
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
2427
- return true;
2428
- } catch (e) {
2429
- return false;
2430
- }
2431
- }
2432
- function _create_super$3(Derived) {
2433
- var hasNativeReflectConstruct = _is_native_reflect_construct$3();
2434
- return function _createSuperInternal() {
2435
- var Super = _get_prototype_of$3(Derived), result;
2436
- if (hasNativeReflectConstruct) {
2437
- var NewTarget = _get_prototype_of$3(this).constructor;
2438
- result = Reflect.construct(Super, arguments, NewTarget);
2439
- } else {
2440
- result = Super.apply(this, arguments);
2441
- }
2442
- return _possible_constructor_return$3(this, result);
2443
- };
2444
- }
2445
- var AccessDeniedException = /*#__PURE__*/ function(__BaseException) {
2446
- _inherits$3(AccessDeniedException, __BaseException);
2447
- var _super = _create_super$3(AccessDeniedException);
2448
- function AccessDeniedException(opts) {
2449
- _class_call_check$3(this, AccessDeniedException);
2450
- var _this;
2451
- _this = _super.call(this, _object_spread$1({
2452
- name: "AccessDeniedException",
2453
- $fault: "client"
2454
- }, opts));
2455
- _define_property$3(_assert_this_initialized$3(_this), "name", "AccessDeniedException");
2456
- _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
2457
- _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
2458
- _define_property$3(_assert_this_initialized$3(_this), "reason", void 0);
2459
- _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
2460
- Object.setPrototypeOf(_assert_this_initialized$3(_this), AccessDeniedException.prototype);
2461
- _this.error = opts.error;
2462
- _this.reason = opts.reason;
2463
- _this.error_description = opts.error_description;
2464
- return _this;
2465
- }
2466
- return AccessDeniedException;
2467
- }(SSOOIDCServiceException);
2468
- var AuthorizationPendingException = /*#__PURE__*/ function(__BaseException) {
2469
- _inherits$3(AuthorizationPendingException, __BaseException);
2470
- var _super = _create_super$3(AuthorizationPendingException);
2471
- function AuthorizationPendingException(opts) {
2472
- _class_call_check$3(this, AuthorizationPendingException);
2473
- var _this;
2474
- _this = _super.call(this, _object_spread$1({
2475
- name: "AuthorizationPendingException",
2476
- $fault: "client"
2477
- }, opts));
2478
- _define_property$3(_assert_this_initialized$3(_this), "name", "AuthorizationPendingException");
2479
- _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
2480
- _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
2481
- _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
2482
- Object.setPrototypeOf(_assert_this_initialized$3(_this), AuthorizationPendingException.prototype);
2483
- _this.error = opts.error;
2484
- _this.error_description = opts.error_description;
2485
- return _this;
2486
- }
2487
- return AuthorizationPendingException;
2488
- }(SSOOIDCServiceException);
2489
- var ExpiredTokenException = /*#__PURE__*/ function(__BaseException) {
2490
- _inherits$3(ExpiredTokenException, __BaseException);
2491
- var _super = _create_super$3(ExpiredTokenException);
2492
- function ExpiredTokenException(opts) {
2493
- _class_call_check$3(this, ExpiredTokenException);
2494
- var _this;
2495
- _this = _super.call(this, _object_spread$1({
2496
- name: "ExpiredTokenException",
2497
- $fault: "client"
2498
- }, opts));
2499
- _define_property$3(_assert_this_initialized$3(_this), "name", "ExpiredTokenException");
2500
- _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
2501
- _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
2502
- _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
2503
- Object.setPrototypeOf(_assert_this_initialized$3(_this), ExpiredTokenException.prototype);
2504
- _this.error = opts.error;
2505
- _this.error_description = opts.error_description;
2506
- return _this;
2507
- }
2508
- return ExpiredTokenException;
2509
- }(SSOOIDCServiceException);
2510
- var InternalServerException = /*#__PURE__*/ function(__BaseException) {
2511
- _inherits$3(InternalServerException, __BaseException);
2512
- var _super = _create_super$3(InternalServerException);
2513
- function InternalServerException(opts) {
2514
- _class_call_check$3(this, InternalServerException);
2515
- var _this;
2516
- _this = _super.call(this, _object_spread$1({
2517
- name: "InternalServerException",
2518
- $fault: "server"
2519
- }, opts));
2520
- _define_property$3(_assert_this_initialized$3(_this), "name", "InternalServerException");
2521
- _define_property$3(_assert_this_initialized$3(_this), "$fault", "server");
2522
- _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
2523
- _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
2524
- Object.setPrototypeOf(_assert_this_initialized$3(_this), InternalServerException.prototype);
2525
- _this.error = opts.error;
2526
- _this.error_description = opts.error_description;
2527
- return _this;
2528
- }
2529
- return InternalServerException;
2530
- }(SSOOIDCServiceException);
2531
- var InvalidClientException = /*#__PURE__*/ function(__BaseException) {
2532
- _inherits$3(InvalidClientException, __BaseException);
2533
- var _super = _create_super$3(InvalidClientException);
2534
- function InvalidClientException(opts) {
2535
- _class_call_check$3(this, InvalidClientException);
2536
- var _this;
2537
- _this = _super.call(this, _object_spread$1({
2538
- name: "InvalidClientException",
2539
- $fault: "client"
2540
- }, opts));
2541
- _define_property$3(_assert_this_initialized$3(_this), "name", "InvalidClientException");
2542
- _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
2543
- _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
2544
- _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
2545
- Object.setPrototypeOf(_assert_this_initialized$3(_this), InvalidClientException.prototype);
2546
- _this.error = opts.error;
2547
- _this.error_description = opts.error_description;
2548
- return _this;
2549
- }
2550
- return InvalidClientException;
2551
- }(SSOOIDCServiceException);
2552
- var InvalidGrantException = /*#__PURE__*/ function(__BaseException) {
2553
- _inherits$3(InvalidGrantException, __BaseException);
2554
- var _super = _create_super$3(InvalidGrantException);
2555
- function InvalidGrantException(opts) {
2556
- _class_call_check$3(this, InvalidGrantException);
2557
- var _this;
2558
- _this = _super.call(this, _object_spread$1({
2559
- name: "InvalidGrantException",
2560
- $fault: "client"
2561
- }, opts));
2562
- _define_property$3(_assert_this_initialized$3(_this), "name", "InvalidGrantException");
2563
- _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
2564
- _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
2565
- _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
2566
- Object.setPrototypeOf(_assert_this_initialized$3(_this), InvalidGrantException.prototype);
2567
- _this.error = opts.error;
2568
- _this.error_description = opts.error_description;
2569
- return _this;
2570
- }
2571
- return InvalidGrantException;
2572
- }(SSOOIDCServiceException);
2573
- var InvalidRequestException = /*#__PURE__*/ function(__BaseException) {
2574
- _inherits$3(InvalidRequestException, __BaseException);
2575
- var _super = _create_super$3(InvalidRequestException);
2576
- function InvalidRequestException(opts) {
2577
- _class_call_check$3(this, InvalidRequestException);
2578
- var _this;
2579
- _this = _super.call(this, _object_spread$1({
2580
- name: "InvalidRequestException",
2581
- $fault: "client"
2582
- }, opts));
2583
- _define_property$3(_assert_this_initialized$3(_this), "name", "InvalidRequestException");
2584
- _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
2585
- _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
2586
- _define_property$3(_assert_this_initialized$3(_this), "reason", void 0);
2587
- _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
2588
- Object.setPrototypeOf(_assert_this_initialized$3(_this), InvalidRequestException.prototype);
2589
- _this.error = opts.error;
2590
- _this.reason = opts.reason;
2591
- _this.error_description = opts.error_description;
2592
- return _this;
2593
- }
2594
- return InvalidRequestException;
2595
- }(SSOOIDCServiceException);
2596
- var InvalidScopeException = /*#__PURE__*/ function(__BaseException) {
2597
- _inherits$3(InvalidScopeException, __BaseException);
2598
- var _super = _create_super$3(InvalidScopeException);
2599
- function InvalidScopeException(opts) {
2600
- _class_call_check$3(this, InvalidScopeException);
2601
- var _this;
2602
- _this = _super.call(this, _object_spread$1({
2603
- name: "InvalidScopeException",
2604
- $fault: "client"
2605
- }, opts));
2606
- _define_property$3(_assert_this_initialized$3(_this), "name", "InvalidScopeException");
2607
- _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
2608
- _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
2609
- _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
2610
- Object.setPrototypeOf(_assert_this_initialized$3(_this), InvalidScopeException.prototype);
2611
- _this.error = opts.error;
2612
- _this.error_description = opts.error_description;
2613
- return _this;
2614
- }
2615
- return InvalidScopeException;
2616
- }(SSOOIDCServiceException);
2617
- var SlowDownException = /*#__PURE__*/ function(__BaseException) {
2618
- _inherits$3(SlowDownException, __BaseException);
2619
- var _super = _create_super$3(SlowDownException);
2620
- function SlowDownException(opts) {
2621
- _class_call_check$3(this, SlowDownException);
2622
- var _this;
2623
- _this = _super.call(this, _object_spread$1({
2624
- name: "SlowDownException",
2625
- $fault: "client"
2626
- }, opts));
2627
- _define_property$3(_assert_this_initialized$3(_this), "name", "SlowDownException");
2628
- _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
2629
- _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
2630
- _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
2631
- Object.setPrototypeOf(_assert_this_initialized$3(_this), SlowDownException.prototype);
2632
- _this.error = opts.error;
2633
- _this.error_description = opts.error_description;
2634
- return _this;
2635
- }
2636
- return SlowDownException;
2637
- }(SSOOIDCServiceException);
2638
- var UnauthorizedClientException = /*#__PURE__*/ function(__BaseException) {
2639
- _inherits$3(UnauthorizedClientException, __BaseException);
2640
- var _super = _create_super$3(UnauthorizedClientException);
2641
- function UnauthorizedClientException(opts) {
2642
- _class_call_check$3(this, UnauthorizedClientException);
2643
- var _this;
2644
- _this = _super.call(this, _object_spread$1({
2645
- name: "UnauthorizedClientException",
2646
- $fault: "client"
2647
- }, opts));
2648
- _define_property$3(_assert_this_initialized$3(_this), "name", "UnauthorizedClientException");
2649
- _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
2650
- _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
2651
- _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
2652
- Object.setPrototypeOf(_assert_this_initialized$3(_this), UnauthorizedClientException.prototype);
2653
- _this.error = opts.error;
2654
- _this.error_description = opts.error_description;
2655
- return _this;
2656
- }
2657
- return UnauthorizedClientException;
2658
- }(SSOOIDCServiceException);
2659
- var UnsupportedGrantTypeException = /*#__PURE__*/ function(__BaseException) {
2660
- _inherits$3(UnsupportedGrantTypeException, __BaseException);
2661
- var _super = _create_super$3(UnsupportedGrantTypeException);
2662
- function UnsupportedGrantTypeException(opts) {
2663
- _class_call_check$3(this, UnsupportedGrantTypeException);
2664
- var _this;
2665
- _this = _super.call(this, _object_spread$1({
2666
- name: "UnsupportedGrantTypeException",
2667
- $fault: "client"
2668
- }, opts));
2669
- _define_property$3(_assert_this_initialized$3(_this), "name", "UnsupportedGrantTypeException");
2670
- _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
2671
- _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
2672
- _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
2673
- Object.setPrototypeOf(_assert_this_initialized$3(_this), UnsupportedGrantTypeException.prototype);
2674
- _this.error = opts.error;
2675
- _this.error_description = opts.error_description;
2676
- return _this;
2677
- }
2678
- return UnsupportedGrantTypeException;
2679
- }(SSOOIDCServiceException);
2680
-
2681
- function _define_property$2(obj, key, value) {
2682
- if (key in obj) {
2683
- Object.defineProperty(obj, key, {
2684
- value: value,
2685
- enumerable: true,
2686
- configurable: true,
2687
- writable: true
2688
- });
2689
- } else {
2690
- obj[key] = value;
2691
- }
2692
- return obj;
2693
- }
2694
- var _ADE = "AccessDeniedException";
2695
- var _APE = "AuthorizationPendingException";
2696
- var _AT = "AccessToken";
2697
- var _CS = "ClientSecret";
2698
- var _CT = "CreateToken";
2699
- var _CTR = "CreateTokenRequest";
2700
- var _CTRr = "CreateTokenResponse";
2701
- var _CV = "CodeVerifier";
2702
- var _ETE = "ExpiredTokenException";
2703
- var _ICE = "InvalidClientException";
2704
- var _IGE = "InvalidGrantException";
2705
- var _IRE = "InvalidRequestException";
2706
- var _ISE = "InternalServerException";
2707
- var _ISEn = "InvalidScopeException";
2708
- var _IT = "IdToken";
2709
- var _RT = "RefreshToken";
2710
- var _SDE = "SlowDownException";
2711
- var _UCE = "UnauthorizedClientException";
2712
- var _UGTE = "UnsupportedGrantTypeException";
2713
- var _aT = "accessToken";
2714
- var _c = "client";
2715
- var _cI = "clientId";
2716
- var _cS = "clientSecret";
2717
- var _cV = "codeVerifier";
2718
- var _co = "code";
2719
- var _dC = "deviceCode";
2720
- var _e = "error";
2721
- var _eI = "expiresIn";
2722
- var _ed = "error_description";
2723
- var _gT = "grantType";
2724
- var _h = "http";
2725
- var _hE = "httpError";
2726
- var _iT = "idToken";
2727
- var _r = "reason";
2728
- var _rT = "refreshToken";
2729
- var _rU = "redirectUri";
2730
- var _s = "smithy.ts.sdk.synthetic.com.amazonaws.ssooidc";
2731
- var _sc = "scope";
2732
- var _se = "server";
2733
- var _tT = "tokenType";
2734
- var n0 = "com.amazonaws.ssooidc";
2735
- var _s_registry = TypeRegistry.for(_s);
2736
- var SSOOIDCServiceException$ = [
2737
- -3,
2738
- _s,
2739
- "SSOOIDCServiceException",
2740
- 0,
2741
- [],
2742
- []
2743
- ];
2744
- _s_registry.registerError(SSOOIDCServiceException$, SSOOIDCServiceException);
2745
- var n0_registry = TypeRegistry.for(n0);
2746
- var _obj;
2747
- var AccessDeniedException$ = [
2748
- -3,
2749
- n0,
2750
- _ADE,
2751
- (_obj = {}, _define_property$2(_obj, _e, _c), _define_property$2(_obj, _hE, 400), _obj),
2752
- [
2753
- _e,
2754
- _r,
2755
- _ed
2756
- ],
2757
- [
2758
- 0,
2759
- 0,
2760
- 0
2761
- ]
2762
- ];
2763
- n0_registry.registerError(AccessDeniedException$, AccessDeniedException);
2764
- var _obj1;
2765
- var AuthorizationPendingException$ = [
2766
- -3,
2767
- n0,
2768
- _APE,
2769
- (_obj1 = {}, _define_property$2(_obj1, _e, _c), _define_property$2(_obj1, _hE, 400), _obj1),
2770
- [
2771
- _e,
2772
- _ed
2773
- ],
2774
- [
2775
- 0,
2776
- 0
2777
- ]
2778
- ];
2779
- n0_registry.registerError(AuthorizationPendingException$, AuthorizationPendingException);
2780
- var _obj2;
2781
- var ExpiredTokenException$ = [
2782
- -3,
2783
- n0,
2784
- _ETE,
2785
- (_obj2 = {}, _define_property$2(_obj2, _e, _c), _define_property$2(_obj2, _hE, 400), _obj2),
2786
- [
2787
- _e,
2788
- _ed
2789
- ],
2790
- [
2791
- 0,
2792
- 0
2793
- ]
2794
- ];
2795
- n0_registry.registerError(ExpiredTokenException$, ExpiredTokenException);
2796
- var _obj3;
2797
- var InternalServerException$ = [
2798
- -3,
2799
- n0,
2800
- _ISE,
2801
- (_obj3 = {}, _define_property$2(_obj3, _e, _se), _define_property$2(_obj3, _hE, 500), _obj3),
2802
- [
2803
- _e,
2804
- _ed
2805
- ],
2806
- [
2807
- 0,
2808
- 0
2809
- ]
2810
- ];
2811
- n0_registry.registerError(InternalServerException$, InternalServerException);
2812
- var _obj4;
2813
- var InvalidClientException$ = [
2814
- -3,
2815
- n0,
2816
- _ICE,
2817
- (_obj4 = {}, _define_property$2(_obj4, _e, _c), _define_property$2(_obj4, _hE, 401), _obj4),
2818
- [
2819
- _e,
2820
- _ed
2821
- ],
2822
- [
2823
- 0,
2824
- 0
2825
- ]
2826
- ];
2827
- n0_registry.registerError(InvalidClientException$, InvalidClientException);
2828
- var _obj5;
2829
- var InvalidGrantException$ = [
2830
- -3,
2831
- n0,
2832
- _IGE,
2833
- (_obj5 = {}, _define_property$2(_obj5, _e, _c), _define_property$2(_obj5, _hE, 400), _obj5),
2834
- [
2835
- _e,
2836
- _ed
2837
- ],
2838
- [
2839
- 0,
2840
- 0
2841
- ]
2842
- ];
2843
- n0_registry.registerError(InvalidGrantException$, InvalidGrantException);
2844
- var _obj6;
2845
- var InvalidRequestException$ = [
2846
- -3,
2847
- n0,
2848
- _IRE,
2849
- (_obj6 = {}, _define_property$2(_obj6, _e, _c), _define_property$2(_obj6, _hE, 400), _obj6),
2850
- [
2851
- _e,
2852
- _r,
2853
- _ed
2854
- ],
2855
- [
2856
- 0,
2857
- 0,
2858
- 0
2859
- ]
2860
- ];
2861
- n0_registry.registerError(InvalidRequestException$, InvalidRequestException);
2862
- var _obj7;
2863
- var InvalidScopeException$ = [
2864
- -3,
2865
- n0,
2866
- _ISEn,
2867
- (_obj7 = {}, _define_property$2(_obj7, _e, _c), _define_property$2(_obj7, _hE, 400), _obj7),
2868
- [
2869
- _e,
2870
- _ed
2871
- ],
2872
- [
2873
- 0,
2874
- 0
2875
- ]
2876
- ];
2877
- n0_registry.registerError(InvalidScopeException$, InvalidScopeException);
2878
- var _obj8;
2879
- var SlowDownException$ = [
2880
- -3,
2881
- n0,
2882
- _SDE,
2883
- (_obj8 = {}, _define_property$2(_obj8, _e, _c), _define_property$2(_obj8, _hE, 400), _obj8),
2884
- [
2885
- _e,
2886
- _ed
2887
- ],
2888
- [
2889
- 0,
2890
- 0
2891
- ]
2892
- ];
2893
- n0_registry.registerError(SlowDownException$, SlowDownException);
2894
- var _obj9;
2895
- var UnauthorizedClientException$ = [
2896
- -3,
2897
- n0,
2898
- _UCE,
2899
- (_obj9 = {}, _define_property$2(_obj9, _e, _c), _define_property$2(_obj9, _hE, 400), _obj9),
2900
- [
2901
- _e,
2902
- _ed
2903
- ],
2904
- [
2905
- 0,
2906
- 0
2907
- ]
2908
- ];
2909
- n0_registry.registerError(UnauthorizedClientException$, UnauthorizedClientException);
2910
- var _obj10;
2911
- var UnsupportedGrantTypeException$ = [
2912
- -3,
2913
- n0,
2914
- _UGTE,
2915
- (_obj10 = {}, _define_property$2(_obj10, _e, _c), _define_property$2(_obj10, _hE, 400), _obj10),
2916
- [
2917
- _e,
2918
- _ed
2919
- ],
2920
- [
2921
- 0,
2922
- 0
2923
- ]
2924
- ];
2925
- n0_registry.registerError(UnsupportedGrantTypeException$, UnsupportedGrantTypeException);
2926
- var errorTypeRegistries = [
2927
- _s_registry,
2928
- n0_registry
2929
- ];
2930
- var AccessToken = [
2931
- 0,
2932
- n0,
2933
- _AT,
2934
- 8,
2935
- 0
2936
- ];
2937
- var ClientSecret = [
2938
- 0,
2939
- n0,
2940
- _CS,
2941
- 8,
2942
- 0
2943
- ];
2944
- var CodeVerifier = [
2945
- 0,
2946
- n0,
2947
- _CV,
2948
- 8,
2949
- 0
2950
- ];
2951
- var IdToken = [
2952
- 0,
2953
- n0,
2954
- _IT,
2955
- 8,
2956
- 0
2957
- ];
2958
- var RefreshToken = [
2959
- 0,
2960
- n0,
2961
- _RT,
2962
- 8,
2963
- 0
2964
- ];
2965
- var CreateTokenRequest$ = [
2966
- 3,
2967
- n0,
2968
- _CTR,
2969
- 0,
2970
- [
2971
- _cI,
2972
- _cS,
2973
- _gT,
2974
- _dC,
2975
- _co,
2976
- _rT,
2977
- _sc,
2978
- _rU,
2979
- _cV
2980
- ],
2981
- [
2982
- 0,
2983
- [
2984
- function() {
2985
- return ClientSecret;
2986
- },
2987
- 0
2988
- ],
2989
- 0,
2990
- 0,
2991
- 0,
2992
- [
2993
- function() {
2994
- return RefreshToken;
2995
- },
2996
- 0
2997
- ],
2998
- 64 | 0,
2999
- 0,
3000
- [
3001
- function() {
3002
- return CodeVerifier;
3003
- },
3004
- 0
3005
- ]
3006
- ],
3007
- 3
3008
- ];
3009
- var CreateTokenResponse$ = [
3010
- 3,
3011
- n0,
3012
- _CTRr,
3013
- 0,
3014
- [
3015
- _aT,
3016
- _tT,
3017
- _eI,
3018
- _rT,
3019
- _iT
3020
- ],
3021
- [
3022
- [
3023
- function() {
3024
- return AccessToken;
3025
- },
3026
- 0
3027
- ],
3028
- 0,
3029
- 1,
3030
- [
3031
- function() {
3032
- return RefreshToken;
3033
- },
3034
- 0
3035
- ],
3036
- [
3037
- function() {
3038
- return IdToken;
3039
- },
3040
- 0
3041
- ]
3042
- ]
3043
- ];
3044
- var CreateToken$ = [
3045
- 9,
3046
- n0,
3047
- _CT,
3048
- _define_property$2({}, _h, [
3049
- "POST",
3050
- "/token",
3051
- 200
3052
- ]),
3053
- function() {
3054
- return CreateTokenRequest$;
3055
- },
3056
- function() {
3057
- return CreateTokenResponse$;
3058
- }
3059
- ];
3060
-
3061
- function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
3062
- try {
3063
- var info = gen[key](arg);
3064
- var value = info.value;
3065
- } catch (error) {
3066
- reject(error);
3067
- return;
3068
- }
3069
- if (info.done) {
3070
- resolve(value);
3071
- } else {
3072
- Promise.resolve(value).then(_next, _throw);
761
+ _define_property$1(target, key, source[key]);
762
+ });
3073
763
  }
764
+ return target;
3074
765
  }
3075
- function _async_to_generator$2(fn) {
3076
- return function() {
3077
- var self = this, args = arguments;
3078
- return new Promise(function(resolve, reject) {
3079
- var gen = fn.apply(self, args);
3080
- function _next(value) {
3081
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
3082
- }
3083
- function _throw(err) {
3084
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
3085
- }
3086
- _next(undefined);
766
+ function ownKeys(object, enumerableOnly) {
767
+ var keys = Object.keys(object);
768
+ if (Object.getOwnPropertySymbols) {
769
+ var symbols = Object.getOwnPropertySymbols(object);
770
+ keys.push.apply(keys, symbols);
771
+ }
772
+ return keys;
773
+ }
774
+ function _object_spread_props(target, source) {
775
+ source = source != null ? source : {};
776
+ if (Object.getOwnPropertyDescriptors) {
777
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
778
+ } else {
779
+ ownKeys(Object(source)).forEach(function(key) {
780
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3087
781
  });
3088
- };
782
+ }
783
+ return target;
3089
784
  }
3090
785
  function _ts_generator$2(thisArg, body) {
3091
786
  var f, y, t, g, _ = {
@@ -3182,52 +877,167 @@ function _ts_generator$2(thisArg, body) {
3182
877
  };
3183
878
  }
3184
879
  }
3185
- var getRuntimeConfig$1 = function(config) {
3186
- 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;
3187
- return {
3188
- apiVersion: "2019-06-10",
3189
- base64Decoder: (_config_base64Decoder = config === null || config === void 0 ? void 0 : config.base64Decoder) !== null && _config_base64Decoder !== void 0 ? _config_base64Decoder : fromBase64,
3190
- base64Encoder: (_config_base64Encoder = config === null || config === void 0 ? void 0 : config.base64Encoder) !== null && _config_base64Encoder !== void 0 ? _config_base64Encoder : toBase64,
3191
- disableHostPrefix: (_config_disableHostPrefix = config === null || config === void 0 ? void 0 : config.disableHostPrefix) !== null && _config_disableHostPrefix !== void 0 ? _config_disableHostPrefix : false,
3192
- endpointProvider: (_config_endpointProvider = config === null || config === void 0 ? void 0 : config.endpointProvider) !== null && _config_endpointProvider !== void 0 ? _config_endpointProvider : defaultEndpointResolver,
3193
- extensions: (_config_extensions = config === null || config === void 0 ? void 0 : config.extensions) !== null && _config_extensions !== void 0 ? _config_extensions : [],
3194
- httpAuthSchemeProvider: (_config_httpAuthSchemeProvider = config === null || config === void 0 ? void 0 : config.httpAuthSchemeProvider) !== null && _config_httpAuthSchemeProvider !== void 0 ? _config_httpAuthSchemeProvider : defaultSSOOIDCHttpAuthSchemeProvider,
3195
- httpAuthSchemes: (_config_httpAuthSchemes = config === null || config === void 0 ? void 0 : config.httpAuthSchemes) !== null && _config_httpAuthSchemes !== void 0 ? _config_httpAuthSchemes : [
3196
- {
3197
- schemeId: "aws.auth#sigv4",
3198
- identityProvider: function(ipc) {
3199
- return ipc.getIdentityProvider("aws.auth#sigv4");
3200
- },
3201
- signer: new AwsSdkSigV4Signer()
3202
- },
3203
- {
3204
- schemeId: "smithy.api#noAuth",
3205
- identityProvider: function(ipc) {
3206
- return ipc.getIdentityProvider("smithy.api#noAuth") || /*#__PURE__*/ _async_to_generator$2(function() {
3207
- return _ts_generator$2(this, function(_state) {
3208
- return [
3209
- 2,
3210
- {}
3211
- ];
3212
- });
880
+ var lastRefreshAttemptTime = new Date(0);
881
+ var fromSso = function() {
882
+ var init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
883
+ return /*#__PURE__*/ _async_to_generator$2(function() {
884
+ var callerClientConfig, _init_logger, profiles, _init_profile, profileName, profile, ssoSessionName, ssoSessions, ssoSession, _i, _iter, ssoSessionRequiredKey, ssoRegion, ssoToken, accessToken, expiresAt, existingToken, newSsoOidcToken, newTokenExpiration;
885
+ var _arguments = arguments;
886
+ return _ts_generator$2(this, function(_state) {
887
+ switch(_state.label){
888
+ case 0:
889
+ callerClientConfig = (_arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}).callerClientConfig;
890
+ (_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : _init_logger.debug("@aws-sdk/token-providers - fromSso");
891
+ return [
892
+ 4,
893
+ parseKnownFiles(init)
894
+ ];
895
+ case 1:
896
+ profiles = _state.sent();
897
+ profileName = getProfileName({
898
+ profile: (_init_profile = init.profile) !== null && _init_profile !== void 0 ? _init_profile : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.profile
3213
899
  });
3214
- },
3215
- signer: new NoAuthSigner()
900
+ profile = profiles[profileName];
901
+ if (!profile) {
902
+ throw new TokenProviderError("Profile '".concat(profileName, "' could not be found in shared credentials file."), false);
903
+ } else if (!profile["sso_session"]) {
904
+ throw new TokenProviderError("Profile '".concat(profileName, "' is missing required property 'sso_session'."));
905
+ }
906
+ ssoSessionName = profile["sso_session"];
907
+ return [
908
+ 4,
909
+ loadSsoSessionData(init)
910
+ ];
911
+ case 2:
912
+ ssoSessions = _state.sent();
913
+ ssoSession = ssoSessions[ssoSessionName];
914
+ if (!ssoSession) {
915
+ throw new TokenProviderError("Sso session '".concat(ssoSessionName, "' could not be found in shared credentials file."), false);
916
+ }
917
+ for(_i = 0, _iter = [
918
+ "sso_start_url",
919
+ "sso_region"
920
+ ]; _i < _iter.length; _i++){
921
+ ssoSessionRequiredKey = _iter[_i];
922
+ if (!ssoSession[ssoSessionRequiredKey]) {
923
+ throw new TokenProviderError("Sso session '".concat(ssoSessionName, "' is missing required property '").concat(ssoSessionRequiredKey, "'."), false);
924
+ }
925
+ }
926
+ ssoSession["sso_start_url"];
927
+ ssoRegion = ssoSession["sso_region"];
928
+ _state.label = 3;
929
+ case 3:
930
+ _state.trys.push([
931
+ 3,
932
+ 5,
933
+ ,
934
+ 6
935
+ ]);
936
+ return [
937
+ 4,
938
+ getSSOTokenFromFile(ssoSessionName)
939
+ ];
940
+ case 4:
941
+ ssoToken = _state.sent();
942
+ return [
943
+ 3,
944
+ 6
945
+ ];
946
+ case 5:
947
+ _state.sent();
948
+ throw new TokenProviderError("The SSO session token associated with profile=".concat(profileName, " was not found or is invalid. ").concat(REFRESH_MESSAGE), false);
949
+ case 6:
950
+ validateTokenKey("accessToken", ssoToken.accessToken);
951
+ validateTokenKey("expiresAt", ssoToken.expiresAt);
952
+ accessToken = ssoToken.accessToken, expiresAt = ssoToken.expiresAt;
953
+ existingToken = {
954
+ token: accessToken,
955
+ expiration: new Date(expiresAt)
956
+ };
957
+ if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
958
+ return [
959
+ 2,
960
+ existingToken
961
+ ];
962
+ }
963
+ if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1000) {
964
+ validateTokenExpiry(existingToken);
965
+ return [
966
+ 2,
967
+ existingToken
968
+ ];
969
+ }
970
+ validateTokenKey("clientId", ssoToken.clientId, true);
971
+ validateTokenKey("clientSecret", ssoToken.clientSecret, true);
972
+ validateTokenKey("refreshToken", ssoToken.refreshToken, true);
973
+ _state.label = 7;
974
+ case 7:
975
+ _state.trys.push([
976
+ 7,
977
+ 13,
978
+ ,
979
+ 14
980
+ ]);
981
+ lastRefreshAttemptTime.setTime(Date.now());
982
+ return [
983
+ 4,
984
+ getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig)
985
+ ];
986
+ case 8:
987
+ newSsoOidcToken = _state.sent();
988
+ validateTokenKey("accessToken", newSsoOidcToken.accessToken);
989
+ validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
990
+ newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
991
+ _state.label = 9;
992
+ case 9:
993
+ _state.trys.push([
994
+ 9,
995
+ 11,
996
+ ,
997
+ 12
998
+ ]);
999
+ return [
1000
+ 4,
1001
+ writeSSOTokenToFile(ssoSessionName, _object_spread_props(_object_spread$1({}, ssoToken), {
1002
+ accessToken: newSsoOidcToken.accessToken,
1003
+ expiresAt: newTokenExpiration.toISOString(),
1004
+ refreshToken: newSsoOidcToken.refreshToken
1005
+ }))
1006
+ ];
1007
+ case 10:
1008
+ _state.sent();
1009
+ return [
1010
+ 3,
1011
+ 12
1012
+ ];
1013
+ case 11:
1014
+ _state.sent();
1015
+ return [
1016
+ 3,
1017
+ 12
1018
+ ];
1019
+ case 12:
1020
+ return [
1021
+ 2,
1022
+ {
1023
+ token: newSsoOidcToken.accessToken,
1024
+ expiration: newTokenExpiration
1025
+ }
1026
+ ];
1027
+ case 13:
1028
+ _state.sent();
1029
+ validateTokenExpiry(existingToken);
1030
+ return [
1031
+ 2,
1032
+ existingToken
1033
+ ];
1034
+ case 14:
1035
+ return [
1036
+ 2
1037
+ ];
3216
1038
  }
3217
- ],
3218
- logger: (_config_logger = config === null || config === void 0 ? void 0 : config.logger) !== null && _config_logger !== void 0 ? _config_logger : new NoOpLogger(),
3219
- protocol: (_config_protocol = config === null || config === void 0 ? void 0 : config.protocol) !== null && _config_protocol !== void 0 ? _config_protocol : AwsRestJsonProtocol,
3220
- protocolSettings: (_config_protocolSettings = config === null || config === void 0 ? void 0 : config.protocolSettings) !== null && _config_protocolSettings !== void 0 ? _config_protocolSettings : {
3221
- defaultNamespace: "com.amazonaws.ssooidc",
3222
- errorTypeRegistries: errorTypeRegistries,
3223
- version: "2019-06-10",
3224
- serviceTarget: "AWSSSOOIDCService"
3225
- },
3226
- serviceId: (_config_serviceId = config === null || config === void 0 ? void 0 : config.serviceId) !== null && _config_serviceId !== void 0 ? _config_serviceId : "SSO OIDC",
3227
- urlParser: (_config_urlParser = config === null || config === void 0 ? void 0 : config.urlParser) !== null && _config_urlParser !== void 0 ? _config_urlParser : parseUrl,
3228
- utf8Decoder: (_config_utf8Decoder = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _config_utf8Decoder !== void 0 ? _config_utf8Decoder : fromUtf8,
3229
- utf8Encoder: (_config_utf8Encoder = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _config_utf8Encoder !== void 0 ? _config_utf8Encoder : toUtf8
3230
- };
1039
+ });
1040
+ });
3231
1041
  };
3232
1042
 
3233
1043
  function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
@@ -3259,7 +1069,7 @@ function _async_to_generator$1(fn) {
3259
1069
  });
3260
1070
  };
3261
1071
  }
3262
- function _define_property$1(obj, key, value) {
1072
+ function _define_property(obj, key, value) {
3263
1073
  if (key in obj) {
3264
1074
  Object.defineProperty(obj, key, {
3265
1075
  value: value,
@@ -3282,26 +1092,7 @@ function _object_spread(target) {
3282
1092
  }));
3283
1093
  }
3284
1094
  ownKeys.forEach(function(key) {
3285
- _define_property$1(target, key, source[key]);
3286
- });
3287
- }
3288
- return target;
3289
- }
3290
- function ownKeys(object, enumerableOnly) {
3291
- var keys = Object.keys(object);
3292
- if (Object.getOwnPropertySymbols) {
3293
- var symbols = Object.getOwnPropertySymbols(object);
3294
- keys.push.apply(keys, symbols);
3295
- }
3296
- return keys;
3297
- }
3298
- function _object_spread_props(target, source) {
3299
- source = source != null ? source : {};
3300
- if (Object.getOwnPropertyDescriptors) {
3301
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3302
- } else {
3303
- ownKeys(Object(source)).forEach(function(key) {
3304
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1095
+ _define_property(target, key, source[key]);
3305
1096
  });
3306
1097
  }
3307
1098
  return target;
@@ -3401,298 +1192,205 @@ function _ts_generator$1(thisArg, body) {
3401
1192
  };
3402
1193
  }
3403
1194
  }
3404
- var getRuntimeConfig = function(config) {
3405
- emitWarningIfUnsupportedVersion(process.version);
3406
- var defaultsMode = resolveDefaultsModeConfig(config);
3407
- var defaultConfigProvider = function() {
3408
- return defaultsMode().then(loadConfigsForDefaultMode);
3409
- };
3410
- var clientSharedValues = getRuntimeConfig$1(config);
3411
- emitWarningIfUnsupportedVersion$1(process.version);
3412
- var loaderConfig = {
3413
- profile: config === null || config === void 0 ? void 0 : config.profile,
3414
- logger: clientSharedValues.logger
3415
- };
3416
- var _config_authSchemePreference, _config_bodyLengthChecker, _config_defaultUserAgentProvider, _config_maxAttempts, _config_region, _config_requestHandler, _config_retryMode, _config_sha256, _config_streamCollector, _config_useDualstackEndpoint, _config_useFipsEndpoint, _config_userAgentAppId;
3417
- return _object_spread_props(_object_spread({}, clientSharedValues, config), {
3418
- runtime: "node",
3419
- defaultsMode: defaultsMode,
3420
- 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),
3421
- bodyLengthChecker: (_config_bodyLengthChecker = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _config_bodyLengthChecker !== void 0 ? _config_bodyLengthChecker : calculateBodyLength,
3422
- defaultUserAgentProvider: (_config_defaultUserAgentProvider = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _config_defaultUserAgentProvider !== void 0 ? _config_defaultUserAgentProvider : createDefaultUserAgentProvider({
3423
- serviceId: clientSharedValues.serviceId,
3424
- clientVersion: packageInfo.version
3425
- }),
3426
- 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),
3427
- 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({}, NODE_REGION_CONFIG_FILE_OPTIONS, loaderConfig)),
3428
- requestHandler: NodeHttpHandler.create((_config_requestHandler = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _config_requestHandler !== void 0 ? _config_requestHandler : defaultConfigProvider),
3429
- retryMode: (_config_retryMode = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _config_retryMode !== void 0 ? _config_retryMode : loadConfig(_object_spread_props(_object_spread({}, NODE_RETRY_MODE_CONFIG_OPTIONS), {
3430
- default: /*#__PURE__*/ _async_to_generator$1(function() {
3431
- return _ts_generator$1(this, function(_state) {
3432
- switch(_state.label){
3433
- case 0:
3434
- return [
3435
- 4,
3436
- defaultConfigProvider()
3437
- ];
3438
- case 1:
3439
- return [
3440
- 2,
3441
- _state.sent().retryMode || DEFAULT_RETRY_MODE
3442
- ];
3443
- }
3444
- });
3445
- })
3446
- }), config),
3447
- sha256: (_config_sha256 = config === null || config === void 0 ? void 0 : config.sha256) !== null && _config_sha256 !== void 0 ? _config_sha256 : Hash.bind(null, "sha256"),
3448
- streamCollector: (_config_streamCollector = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _config_streamCollector !== void 0 ? _config_streamCollector : streamCollector,
3449
- 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),
3450
- 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),
3451
- 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)
3452
- });
3453
- };
3454
-
3455
- var getHttpAuthExtensionConfiguration = function(runtimeConfig) {
3456
- var _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
3457
- var _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
3458
- var _credentials = runtimeConfig.credentials;
3459
- return {
3460
- setHttpAuthScheme: function setHttpAuthScheme(httpAuthScheme) {
3461
- var index = _httpAuthSchemes.findIndex(function(scheme) {
3462
- return scheme.schemeId === httpAuthScheme.schemeId;
3463
- });
3464
- if (index === -1) {
3465
- _httpAuthSchemes.push(httpAuthScheme);
3466
- } else {
3467
- _httpAuthSchemes.splice(index, 1, httpAuthScheme);
3468
- }
3469
- },
3470
- httpAuthSchemes: function httpAuthSchemes() {
3471
- return _httpAuthSchemes;
3472
- },
3473
- setHttpAuthSchemeProvider: function setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
3474
- _httpAuthSchemeProvider = httpAuthSchemeProvider;
3475
- },
3476
- httpAuthSchemeProvider: function httpAuthSchemeProvider() {
3477
- return _httpAuthSchemeProvider;
3478
- },
3479
- setCredentials: function setCredentials(credentials) {
3480
- _credentials = credentials;
3481
- },
3482
- credentials: function credentials() {
3483
- return _credentials;
3484
- }
3485
- };
3486
- };
3487
- var resolveHttpAuthRuntimeConfig = function(config) {
3488
- return {
3489
- httpAuthSchemes: config.httpAuthSchemes(),
3490
- httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
3491
- credentials: config.credentials()
3492
- };
3493
- };
3494
-
3495
- var resolveRuntimeExtensions = function(runtimeConfig, extensions) {
3496
- var extensionConfiguration = Object.assign(getAwsRegionExtensionConfiguration(runtimeConfig), getDefaultExtensionConfiguration(runtimeConfig), getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
3497
- extensions.forEach(function(extension) {
3498
- return extension.configure(extensionConfiguration);
3499
- });
3500
- return Object.assign(runtimeConfig, resolveAwsRegionExtensionConfiguration(extensionConfiguration), resolveDefaultRuntimeConfig(extensionConfiguration), resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
3501
- };
3502
-
3503
- function _array_like_to_array(arr, len) {
3504
- if (len == null || len > arr.length) len = arr.length;
3505
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3506
- return arr2;
3507
- }
3508
- function _array_with_holes(arr) {
3509
- if (Array.isArray(arr)) return arr;
3510
- }
3511
- function _assert_this_initialized$2(self) {
3512
- if (self === void 0) {
3513
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3514
- }
3515
- return self;
3516
- }
3517
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
3518
- try {
3519
- var info = gen[key](arg);
3520
- var value = info.value;
3521
- } catch (error) {
3522
- reject(error);
3523
- return;
3524
- }
3525
- if (info.done) {
3526
- resolve(value);
3527
- } else {
3528
- Promise.resolve(value).then(_next, _throw);
3529
- }
3530
- }
3531
- function _async_to_generator(fn) {
3532
- return function() {
3533
- var self = this, args = arguments;
3534
- return new Promise(function(resolve, reject) {
3535
- var gen = fn.apply(self, args);
3536
- function _next(value) {
3537
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
3538
- }
3539
- function _throw(err) {
3540
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
3541
- }
3542
- _next(undefined);
3543
- });
3544
- };
3545
- }
3546
- function _class_call_check$2(instance, Constructor) {
3547
- if (!(instance instanceof Constructor)) {
3548
- throw new TypeError("Cannot call a class as a function");
3549
- }
3550
- }
3551
- function _defineProperties(target, props) {
3552
- for(var i = 0; i < props.length; i++){
3553
- var descriptor = props[i];
3554
- descriptor.enumerable = descriptor.enumerable || false;
3555
- descriptor.configurable = true;
3556
- if ("value" in descriptor) descriptor.writable = true;
3557
- Object.defineProperty(target, descriptor.key, descriptor);
3558
- }
3559
- }
3560
- function _create_class(Constructor, protoProps, staticProps) {
3561
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3562
- return Constructor;
3563
- }
3564
- function _define_property(obj, key, value) {
3565
- if (key in obj) {
3566
- Object.defineProperty(obj, key, {
3567
- value: value,
3568
- enumerable: true,
3569
- configurable: true,
3570
- writable: true
3571
- });
3572
- } else {
3573
- obj[key] = value;
3574
- }
3575
- return obj;
3576
- }
3577
- function _get(target, property, receiver) {
3578
- if (typeof Reflect !== "undefined" && Reflect.get) {
3579
- _get = Reflect.get;
3580
- } else {
3581
- _get = function get(target, property, receiver) {
3582
- var base = _super_prop_base(target, property);
3583
- if (!base) return;
3584
- var desc = Object.getOwnPropertyDescriptor(base, property);
3585
- if (desc.get) {
3586
- return desc.get.call(receiver || target);
3587
- }
3588
- return desc.value;
3589
- };
3590
- }
3591
- return _get(target, property, receiver || target);
3592
- }
3593
- function _get_prototype_of$2(o) {
3594
- _get_prototype_of$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
3595
- return o.__proto__ || Object.getPrototypeOf(o);
3596
- };
3597
- return _get_prototype_of$2(o);
3598
- }
3599
- function _inherits$2(subClass, superClass) {
3600
- if (typeof superClass !== "function" && superClass !== null) {
3601
- throw new TypeError("Super expression must either be null or a function");
3602
- }
3603
- subClass.prototype = Object.create(superClass && superClass.prototype, {
3604
- constructor: {
3605
- value: subClass,
3606
- writable: true,
3607
- configurable: true
3608
- }
3609
- });
3610
- if (superClass) _set_prototype_of$2(subClass, superClass);
3611
- }
3612
- function _iterable_to_array_limit(arr, i) {
3613
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
3614
- if (_i == null) return;
3615
- var _arr = [];
3616
- var _n = true;
3617
- var _d = false;
3618
- var _s, _e;
3619
- try {
3620
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
3621
- _arr.push(_s.value);
3622
- if (i && _arr.length === i) break;
3623
- }
3624
- } catch (err) {
3625
- _d = true;
3626
- _e = err;
3627
- } finally{
3628
- try {
3629
- if (!_n && _i["return"] != null) _i["return"]();
3630
- } finally{
3631
- if (_d) throw _e;
3632
- }
3633
- }
3634
- return _arr;
3635
- }
3636
- function _non_iterable_rest() {
3637
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3638
- }
3639
- function _possible_constructor_return$2(self, call) {
3640
- if (call && (_type_of$2(call) === "object" || typeof call === "function")) {
3641
- return call;
3642
- }
3643
- return _assert_this_initialized$2(self);
3644
- }
3645
- function _set_prototype_of$2(o, p) {
3646
- _set_prototype_of$2 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
3647
- o.__proto__ = p;
3648
- return o;
1195
+ var SHOULD_FAIL_CREDENTIAL_CHAIN = false;
1196
+ var resolveSSOCredentials = function() {
1197
+ var _ref = _async_to_generator$1(function(param) {
1198
+ 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;
1199
+ return _ts_generator$1(this, function(_state) {
1200
+ switch(_state.label){
1201
+ case 0:
1202
+ 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;
1203
+ refreshMessage = "To refresh this SSO session run aws sso login with the corresponding profile.";
1204
+ if (!ssoSession) return [
1205
+ 3,
1206
+ 5
1207
+ ];
1208
+ _state.label = 1;
1209
+ case 1:
1210
+ _state.trys.push([
1211
+ 1,
1212
+ 3,
1213
+ ,
1214
+ 4
1215
+ ]);
1216
+ return [
1217
+ 4,
1218
+ fromSso({
1219
+ profile: profile,
1220
+ filepath: filepath,
1221
+ configFilepath: configFilepath,
1222
+ ignoreCache: ignoreCache,
1223
+ clientConfig: clientConfig,
1224
+ parentClientConfig: parentClientConfig,
1225
+ logger: logger
1226
+ })({
1227
+ callerClientConfig: callerClientConfig
1228
+ })
1229
+ ];
1230
+ case 2:
1231
+ _token = _state.sent();
1232
+ token = {
1233
+ accessToken: _token.token,
1234
+ expiresAt: new Date(_token.expiration).toISOString()
1235
+ };
1236
+ return [
1237
+ 3,
1238
+ 4
1239
+ ];
1240
+ case 3:
1241
+ e = _state.sent();
1242
+ throw new CredentialsProviderError(e.message, {
1243
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
1244
+ logger: logger
1245
+ });
1246
+ case 4:
1247
+ return [
1248
+ 3,
1249
+ 8
1250
+ ];
1251
+ case 5:
1252
+ _state.trys.push([
1253
+ 5,
1254
+ 7,
1255
+ ,
1256
+ 8
1257
+ ]);
1258
+ return [
1259
+ 4,
1260
+ getSSOTokenFromFile(ssoStartUrl)
1261
+ ];
1262
+ case 6:
1263
+ token = _state.sent();
1264
+ return [
1265
+ 3,
1266
+ 8
1267
+ ];
1268
+ case 7:
1269
+ _state.sent();
1270
+ throw new CredentialsProviderError("The SSO session associated with this profile is invalid. ".concat(refreshMessage), {
1271
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
1272
+ logger: logger
1273
+ });
1274
+ case 8:
1275
+ if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
1276
+ throw new CredentialsProviderError("The SSO session associated with this profile has expired. ".concat(refreshMessage), {
1277
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
1278
+ logger: logger
1279
+ });
1280
+ }
1281
+ accessToken = token.accessToken;
1282
+ return [
1283
+ 4,
1284
+ import('./loadSso.esm.js')
1285
+ ];
1286
+ case 9:
1287
+ _ref = _state.sent(), SSOClient = _ref.SSOClient, GetRoleCredentialsCommand = _ref.GetRoleCredentialsCommand;
1288
+ sso = ssoClient || new SSOClient(Object.assign({}, clientConfig !== null && clientConfig !== void 0 ? clientConfig : {}, {
1289
+ 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,
1290
+ region: (_clientConfig_region = clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.region) !== null && _clientConfig_region !== void 0 ? _clientConfig_region : ssoRegion,
1291
+ 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
1292
+ }));
1293
+ _state.label = 10;
1294
+ case 10:
1295
+ _state.trys.push([
1296
+ 10,
1297
+ 12,
1298
+ ,
1299
+ 13
1300
+ ]);
1301
+ return [
1302
+ 4,
1303
+ sso.send(new GetRoleCredentialsCommand({
1304
+ accountId: ssoAccountId,
1305
+ roleName: ssoRoleName,
1306
+ accessToken: accessToken
1307
+ }))
1308
+ ];
1309
+ case 11:
1310
+ ssoResp = _state.sent();
1311
+ return [
1312
+ 3,
1313
+ 13
1314
+ ];
1315
+ case 12:
1316
+ e2 = _state.sent();
1317
+ throw new CredentialsProviderError(e2, {
1318
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
1319
+ logger: logger
1320
+ });
1321
+ case 13:
1322
+ 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;
1323
+ if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
1324
+ throw new CredentialsProviderError("SSO returns an invalid temporary credential.", {
1325
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
1326
+ logger: logger
1327
+ });
1328
+ }
1329
+ credentials = _object_spread({
1330
+ accessKeyId: accessKeyId,
1331
+ secretAccessKey: secretAccessKey,
1332
+ sessionToken: sessionToken,
1333
+ expiration: new Date(expiration)
1334
+ }, credentialScope && {
1335
+ credentialScope: credentialScope
1336
+ }, accountId && {
1337
+ accountId: accountId
1338
+ });
1339
+ if (ssoSession) {
1340
+ setCredentialFeature(credentials, "CREDENTIALS_SSO", "s");
1341
+ } else {
1342
+ setCredentialFeature(credentials, "CREDENTIALS_SSO_LEGACY", "u");
1343
+ }
1344
+ return [
1345
+ 2,
1346
+ credentials
1347
+ ];
1348
+ }
1349
+ });
1350
+ });
1351
+ return function resolveSSOCredentials(_) {
1352
+ return _ref.apply(this, arguments);
3649
1353
  };
3650
- return _set_prototype_of$2(o, p);
3651
- }
3652
- function _sliced_to_array(arr, i) {
3653
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
3654
- }
3655
- function _super_prop_base(object, property) {
3656
- while(!Object.prototype.hasOwnProperty.call(object, property)){
3657
- object = _get_prototype_of$2(object);
3658
- if (object === null) break;
1354
+ }();
1355
+
1356
+ var validateSsoProfile = function(profile, logger) {
1357
+ 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;
1358
+ if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
1359
+ 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"), {
1360
+ tryNextLink: false,
1361
+ logger: logger
1362
+ });
3659
1363
  }
3660
- return object;
3661
- }
3662
- function _type_of$2(obj) {
3663
- "@swc/helpers - typeof";
3664
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3665
- }
3666
- function _unsupported_iterable_to_array(o, minLen) {
3667
- if (!o) return;
3668
- if (typeof o === "string") return _array_like_to_array(o, minLen);
3669
- var n = Object.prototype.toString.call(o).slice(8, -1);
3670
- if (n === "Object" && o.constructor) n = o.constructor.name;
3671
- if (n === "Map" || n === "Set") return Array.from(n);
3672
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
3673
- }
3674
- function _is_native_reflect_construct$2() {
3675
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3676
- if (Reflect.construct.sham) return false;
3677
- if (typeof Proxy === "function") return true;
1364
+ return profile;
1365
+ };
1366
+
1367
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
3678
1368
  try {
3679
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
3680
- return true;
3681
- } catch (e) {
3682
- return false;
1369
+ var info = gen[key](arg);
1370
+ var value = info.value;
1371
+ } catch (error) {
1372
+ reject(error);
1373
+ return;
1374
+ }
1375
+ if (info.done) {
1376
+ resolve(value);
1377
+ } else {
1378
+ Promise.resolve(value).then(_next, _throw);
3683
1379
  }
3684
1380
  }
3685
- function _create_super$2(Derived) {
3686
- var hasNativeReflectConstruct = _is_native_reflect_construct$2();
3687
- return function _createSuperInternal() {
3688
- var Super = _get_prototype_of$2(Derived), result;
3689
- if (hasNativeReflectConstruct) {
3690
- var NewTarget = _get_prototype_of$2(this).constructor;
3691
- result = Reflect.construct(Super, arguments, NewTarget);
3692
- } else {
3693
- result = Super.apply(this, arguments);
3694
- }
3695
- return _possible_constructor_return$2(this, result);
1381
+ function _async_to_generator(fn) {
1382
+ return function() {
1383
+ var self = this, args = arguments;
1384
+ return new Promise(function(resolve, reject) {
1385
+ var gen = fn.apply(self, args);
1386
+ function _next(value) {
1387
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1388
+ }
1389
+ function _throw(err) {
1390
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1391
+ }
1392
+ _next(undefined);
1393
+ });
3696
1394
  };
3697
1395
  }
3698
1396
  function _ts_generator(thisArg, body) {
@@ -3790,246 +1488,124 @@ function _ts_generator(thisArg, body) {
3790
1488
  };
3791
1489
  }
3792
1490
  }
3793
- var SSOOIDCClient = /*#__PURE__*/ function(__Client) {
3794
- _inherits$2(SSOOIDCClient, __Client);
3795
- var _super = _create_super$2(SSOOIDCClient);
3796
- function SSOOIDCClient() {
3797
- for(var _len = arguments.length, _tmp = new Array(_len), _key = 0; _key < _len; _key++){
3798
- _tmp[_key] = arguments[_key];
3799
- }
3800
- var _tmp1 = _sliced_to_array(_tmp, 1), configuration = _tmp1[0];
3801
- _class_call_check$2(this, SSOOIDCClient);
3802
- var _this;
3803
- var _config_0 = getRuntimeConfig(configuration || {});
3804
- _this = _super.call(this, _config_0);
3805
- _define_property(_assert_this_initialized$2(_this), "config", void 0);
3806
- _this.initConfig = _config_0;
3807
- var _config_1 = resolveClientEndpointParameters(_config_0);
3808
- var _config_2 = resolveUserAgentConfig(_config_1);
3809
- var _config_3 = resolveRetryConfig(_config_2);
3810
- var _config_4 = resolveRegionConfig(_config_3);
3811
- var _config_5 = resolveHostHeaderConfig(_config_4);
3812
- var _config_6 = resolveEndpointConfig(_config_5);
3813
- var _config_7 = resolveHttpAuthSchemeConfig(_config_6);
3814
- var _config_8 = resolveRuntimeExtensions(_config_7, (configuration === null || configuration === void 0 ? void 0 : configuration.extensions) || []);
3815
- _this.config = _config_8;
3816
- _this.middlewareStack.use(getSchemaSerdePlugin(_this.config));
3817
- _this.middlewareStack.use(getUserAgentPlugin(_this.config));
3818
- _this.middlewareStack.use(getRetryPlugin(_this.config));
3819
- _this.middlewareStack.use(getContentLengthPlugin(_this.config));
3820
- _this.middlewareStack.use(getHostHeaderPlugin(_this.config));
3821
- _this.middlewareStack.use(getLoggerPlugin(_this.config));
3822
- _this.middlewareStack.use(getRecursionDetectionPlugin(_this.config));
3823
- _this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(_this.config, {
3824
- httpAuthSchemeParametersProvider: defaultSSOOIDCHttpAuthSchemeParametersProvider,
3825
- identityProviderConfigProvider: function() {
3826
- var _ref = _async_to_generator(function(config) {
3827
- return _ts_generator(this, function(_state) {
1491
+ var fromSSO = function() {
1492
+ var init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1493
+ return /*#__PURE__*/ _async_to_generator(function() {
1494
+ 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;
1495
+ var _arguments = arguments;
1496
+ return _ts_generator(this, function(_state) {
1497
+ switch(_state.label){
1498
+ case 0:
1499
+ callerClientConfig = (_arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}).callerClientConfig;
1500
+ (_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : _init_logger.debug("@aws-sdk/credential-provider-sso - fromSSO");
1501
+ ssoStartUrl = init.ssoStartUrl, ssoAccountId = init.ssoAccountId, ssoRegion = init.ssoRegion, ssoRoleName = init.ssoRoleName, ssoSession = init.ssoSession;
1502
+ ssoClient = init.ssoClient;
1503
+ profileName = getProfileName({
1504
+ profile: (_init_profile = init.profile) !== null && _init_profile !== void 0 ? _init_profile : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.profile
1505
+ });
1506
+ if (!(!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession)) return [
1507
+ 3,
1508
+ 4
1509
+ ];
1510
+ return [
1511
+ 4,
1512
+ parseKnownFiles(init)
1513
+ ];
1514
+ case 1:
1515
+ profiles = _state.sent();
1516
+ profile = profiles[profileName];
1517
+ if (!profile) {
1518
+ throw new CredentialsProviderError("Profile ".concat(profileName, " was not found."), {
1519
+ logger: init.logger
1520
+ });
1521
+ }
1522
+ if (!isSsoProfile(profile)) {
1523
+ throw new CredentialsProviderError("Profile ".concat(profileName, " is not configured with SSO credentials."), {
1524
+ logger: init.logger
1525
+ });
1526
+ }
1527
+ if (!(profile === null || profile === void 0 ? void 0 : profile.sso_session)) return [
1528
+ 3,
1529
+ 3
1530
+ ];
1531
+ return [
1532
+ 4,
1533
+ loadSsoSessionData(init)
1534
+ ];
1535
+ case 2:
1536
+ ssoSessions = _state.sent();
1537
+ session = ssoSessions[profile.sso_session];
1538
+ conflictMsg = " configurations in profile ".concat(profileName, " and sso-session ").concat(profile.sso_session);
1539
+ if (ssoRegion && ssoRegion !== session.sso_region) {
1540
+ throw new CredentialsProviderError("Conflicting SSO region" + conflictMsg, {
1541
+ tryNextLink: false,
1542
+ logger: init.logger
1543
+ });
1544
+ }
1545
+ if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
1546
+ throw new CredentialsProviderError("Conflicting SSO start_url" + conflictMsg, {
1547
+ tryNextLink: false,
1548
+ logger: init.logger
1549
+ });
1550
+ }
1551
+ profile.sso_region = session.sso_region;
1552
+ profile.sso_start_url = session.sso_start_url;
1553
+ _state.label = 3;
1554
+ case 3:
1555
+ _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;
1556
+ return [
1557
+ 2,
1558
+ resolveSSOCredentials({
1559
+ ssoStartUrl: sso_start_url,
1560
+ ssoSession: sso_session,
1561
+ ssoAccountId: sso_account_id,
1562
+ ssoRegion: sso_region,
1563
+ ssoRoleName: sso_role_name,
1564
+ ssoClient: ssoClient,
1565
+ clientConfig: init.clientConfig,
1566
+ parentClientConfig: init.parentClientConfig,
1567
+ callerClientConfig: init.callerClientConfig,
1568
+ profile: profileName,
1569
+ filepath: init.filepath,
1570
+ configFilepath: init.configFilepath,
1571
+ ignoreCache: init.ignoreCache,
1572
+ logger: init.logger
1573
+ })
1574
+ ];
1575
+ case 4:
1576
+ if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {
1577
+ throw new CredentialsProviderError("Incomplete configuration. The fromSSO() argument hash must include " + '"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', {
1578
+ tryNextLink: false,
1579
+ logger: init.logger
1580
+ });
1581
+ } else {
3828
1582
  return [
3829
1583
  2,
3830
- new DefaultIdentityProviderConfig({
3831
- "aws.auth#sigv4": config.credentials
1584
+ resolveSSOCredentials({
1585
+ ssoStartUrl: ssoStartUrl,
1586
+ ssoSession: ssoSession,
1587
+ ssoAccountId: ssoAccountId,
1588
+ ssoRegion: ssoRegion,
1589
+ ssoRoleName: ssoRoleName,
1590
+ ssoClient: ssoClient,
1591
+ clientConfig: init.clientConfig,
1592
+ parentClientConfig: init.parentClientConfig,
1593
+ callerClientConfig: init.callerClientConfig,
1594
+ profile: profileName,
1595
+ filepath: init.filepath,
1596
+ configFilepath: init.configFilepath,
1597
+ ignoreCache: init.ignoreCache,
1598
+ logger: init.logger
3832
1599
  })
3833
1600
  ];
3834
- });
3835
- });
3836
- return function(config) {
3837
- return _ref.apply(this, arguments);
3838
- };
3839
- }()
3840
- }));
3841
- _this.middlewareStack.use(getHttpSigningPlugin(_this.config));
3842
- return _this;
3843
- }
3844
- _create_class(SSOOIDCClient, [
3845
- {
3846
- key: "destroy",
3847
- value: function destroy() {
3848
- _get(_get_prototype_of$2(SSOOIDCClient.prototype), "destroy", this).call(this);
1601
+ }
1602
+ case 5:
1603
+ return [
1604
+ 2
1605
+ ];
3849
1606
  }
3850
- }
3851
- ]);
3852
- return SSOOIDCClient;
3853
- }(Client);
3854
-
3855
- function _assert_this_initialized$1(self) {
3856
- if (self === void 0) {
3857
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3858
- }
3859
- return self;
3860
- }
3861
- function _class_call_check$1(instance, Constructor) {
3862
- if (!(instance instanceof Constructor)) {
3863
- throw new TypeError("Cannot call a class as a function");
3864
- }
3865
- }
3866
- function _get_prototype_of$1(o) {
3867
- _get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
3868
- return o.__proto__ || Object.getPrototypeOf(o);
3869
- };
3870
- return _get_prototype_of$1(o);
3871
- }
3872
- function _inherits$1(subClass, superClass) {
3873
- if (typeof superClass !== "function" && superClass !== null) {
3874
- throw new TypeError("Super expression must either be null or a function");
3875
- }
3876
- subClass.prototype = Object.create(superClass && superClass.prototype, {
3877
- constructor: {
3878
- value: subClass,
3879
- writable: true,
3880
- configurable: true
3881
- }
3882
- });
3883
- if (superClass) _set_prototype_of$1(subClass, superClass);
3884
- }
3885
- function _possible_constructor_return$1(self, call) {
3886
- if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
3887
- return call;
3888
- }
3889
- return _assert_this_initialized$1(self);
3890
- }
3891
- function _set_prototype_of$1(o, p) {
3892
- _set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
3893
- o.__proto__ = p;
3894
- return o;
3895
- };
3896
- return _set_prototype_of$1(o, p);
3897
- }
3898
- function _type_of$1(obj) {
3899
- "@swc/helpers - typeof";
3900
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3901
- }
3902
- function _is_native_reflect_construct$1() {
3903
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3904
- if (Reflect.construct.sham) return false;
3905
- if (typeof Proxy === "function") return true;
3906
- try {
3907
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
3908
- return true;
3909
- } catch (e) {
3910
- return false;
3911
- }
3912
- }
3913
- function _create_super$1(Derived) {
3914
- var hasNativeReflectConstruct = _is_native_reflect_construct$1();
3915
- return function _createSuperInternal() {
3916
- var Super = _get_prototype_of$1(Derived), result;
3917
- if (hasNativeReflectConstruct) {
3918
- var NewTarget = _get_prototype_of$1(this).constructor;
3919
- result = Reflect.construct(Super, arguments, NewTarget);
3920
- } else {
3921
- result = Super.apply(this, arguments);
3922
- }
3923
- return _possible_constructor_return$1(this, result);
3924
- };
3925
- }
3926
- var CreateTokenCommand = /*#__PURE__*/ function(_$Command_classBuilder_ep_m_s_n_sc_build) {
3927
- _inherits$1(CreateTokenCommand, _$Command_classBuilder_ep_m_s_n_sc_build);
3928
- var _super = _create_super$1(CreateTokenCommand);
3929
- function CreateTokenCommand() {
3930
- _class_call_check$1(this, CreateTokenCommand);
3931
- return _super.apply(this, arguments);
3932
- }
3933
- return CreateTokenCommand;
3934
- }(Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
3935
- return [
3936
- getEndpointPlugin(config, Command.getEndpointParameterInstructions())
3937
- ];
3938
- }).s("AWSSSOOIDCService", "CreateToken", {}).n("SSOOIDCClient", "CreateTokenCommand").sc(CreateToken$).build());
3939
-
3940
- function _assert_this_initialized(self) {
3941
- if (self === void 0) {
3942
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3943
- }
3944
- return self;
3945
- }
3946
- function _class_call_check(instance, Constructor) {
3947
- if (!(instance instanceof Constructor)) {
3948
- throw new TypeError("Cannot call a class as a function");
3949
- }
3950
- }
3951
- function _get_prototype_of(o) {
3952
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
3953
- return o.__proto__ || Object.getPrototypeOf(o);
3954
- };
3955
- return _get_prototype_of(o);
3956
- }
3957
- function _inherits(subClass, superClass) {
3958
- if (typeof superClass !== "function" && superClass !== null) {
3959
- throw new TypeError("Super expression must either be null or a function");
3960
- }
3961
- subClass.prototype = Object.create(superClass && superClass.prototype, {
3962
- constructor: {
3963
- value: subClass,
3964
- writable: true,
3965
- configurable: true
3966
- }
1607
+ });
3967
1608
  });
3968
- if (superClass) _set_prototype_of(subClass, superClass);
3969
- }
3970
- function _possible_constructor_return(self, call) {
3971
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
3972
- return call;
3973
- }
3974
- return _assert_this_initialized(self);
3975
- }
3976
- function _set_prototype_of(o, p) {
3977
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
3978
- o.__proto__ = p;
3979
- return o;
3980
- };
3981
- return _set_prototype_of(o, p);
3982
- }
3983
- function _type_of(obj) {
3984
- "@swc/helpers - typeof";
3985
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3986
- }
3987
- function _is_native_reflect_construct() {
3988
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3989
- if (Reflect.construct.sham) return false;
3990
- if (typeof Proxy === "function") return true;
3991
- try {
3992
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
3993
- return true;
3994
- } catch (e) {
3995
- return false;
3996
- }
3997
- }
3998
- function _create_super(Derived) {
3999
- var hasNativeReflectConstruct = _is_native_reflect_construct();
4000
- return function _createSuperInternal() {
4001
- var Super = _get_prototype_of(Derived), result;
4002
- if (hasNativeReflectConstruct) {
4003
- var NewTarget = _get_prototype_of(this).constructor;
4004
- result = Reflect.construct(Super, arguments, NewTarget);
4005
- } else {
4006
- result = Super.apply(this, arguments);
4007
- }
4008
- return _possible_constructor_return(this, result);
4009
- };
4010
- }
4011
- var commands = {
4012
- CreateTokenCommand: CreateTokenCommand
4013
- };
4014
- var SSOOIDC = /*#__PURE__*/ function(SSOOIDCClient) {
4015
- _inherits(SSOOIDC, SSOOIDCClient);
4016
- var _super = _create_super(SSOOIDC);
4017
- function SSOOIDC() {
4018
- _class_call_check(this, SSOOIDC);
4019
- return _super.apply(this, arguments);
4020
- }
4021
- return SSOOIDC;
4022
- }(SSOOIDCClient);
4023
- createAggregatedClient(commands, SSOOIDC);
4024
-
4025
- var AccessDeniedExceptionReason = {
4026
- KMS_ACCESS_DENIED: "KMS_AccessDeniedException"
4027
- };
4028
- var InvalidRequestExceptionReason = {
4029
- KMS_DISABLED_KEY: "KMS_DisabledException",
4030
- KMS_INVALID_KEY_USAGE: "KMS_InvalidKeyUsageException",
4031
- KMS_INVALID_STATE: "KMS_InvalidStateException",
4032
- KMS_KEY_NOT_FOUND: "KMS_NotFoundException"
4033
1609
  };
4034
1610
 
4035
- export { Command as $Command, AccessDeniedException, AccessDeniedException$, AccessDeniedExceptionReason, AuthorizationPendingException, AuthorizationPendingException$, CreateToken$, CreateTokenCommand, CreateTokenRequest$, CreateTokenResponse$, ExpiredTokenException, ExpiredTokenException$, InternalServerException, InternalServerException$, InvalidClientException, InvalidClientException$, InvalidGrantException, InvalidGrantException$, InvalidRequestException, InvalidRequestException$, InvalidRequestExceptionReason, InvalidScopeException, InvalidScopeException$, SSOOIDC, SSOOIDCClient, SSOOIDCServiceException, SSOOIDCServiceException$, SlowDownException, SlowDownException$, UnauthorizedClientException, UnauthorizedClientException$, UnsupportedGrantTypeException, UnsupportedGrantTypeException$, Client as __Client, errorTypeRegistries };
1611
+ export { fromSSO, isSsoProfile, validateSsoProfile };