@digipair/skill-s3 0.136.1 → 0.136.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,224 +1,21 @@
1
- import { g as getSSOTokenFilepath, a as getSSOTokenFromFile } from './getSSOTokenFromFile.esm.js';
2
- import { P as ProviderError, I as IniSectionType, o as CONFIG_PREFIX_SEPARATOR, r as readFile, q as getConfigFilepath, u as parseIni, k as getProfileName, C as CredentialsProviderError, s as setCredentialFeature } from './index.esm3.js';
3
- import { promises } from 'fs';
4
- import { p as parseKnownFiles } from './parseKnownFiles.esm.js';
5
- import 'fs/promises';
1
+ import { a as awsEndpointFunctions, N as NODE_APP_ID_CONFIG_OPTIONS, H as Hash, c as createDefaultUserAgentProvider, p as packageInfo, D as DEFAULT_RETRY_MODE, g as getAwsRegionExtensionConfiguration, r as resolveAwsRegionExtensionConfiguration, b as resolveUserAgentConfig, d as resolveEndpointConfig, e as resolveHostHeaderConfig, f as getUserAgentPlugin, h as getContentLengthPlugin, i as getHostHeaderPlugin, j as getLoggerPlugin, k as getRecursionDetectionPlugin, l as getEndpointPlugin, m as createAggregatedClient } from './index.esm20.js';
2
+ import { u as resolveAwsSdkSigV4Config, q as normalizeProvider, m as getSmithyContext, E as EndpointCache, y as resolveEndpoint, h as customEndpointFunctions, S as ServiceException, T as TypeRegistry, t as toUtf8, f as fromUtf8, p as parseUrl, z as NoOpLogger, A as AwsSdkSigV4Signer, B as toBase64, D as fromBase64, F as emitWarningIfUnsupportedVersion, G as resolveDefaultsModeConfig, I as emitWarningIfUnsupportedVersion$1, l as loadConfig, J as NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, K as NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, L as streamCollector, N as NodeHttpHandler, M as NODE_REGION_CONFIG_OPTIONS, O as NODE_MAX_ATTEMPT_CONFIG_OPTIONS, Q as calculateBodyLength, R as NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, U as loadConfigsForDefaultMode, V as NODE_RETRY_MODE_CONFIG_OPTIONS, W as NODE_REGION_CONFIG_FILE_OPTIONS, X as getDefaultExtensionConfiguration, Y as getHttpHandlerExtensionConfiguration, Z as resolveDefaultRuntimeConfig, _ as resolveHttpHandlerRuntimeConfig, $ as resolveRetryConfig, a0 as resolveRegionConfig, a1 as getSchemaSerdePlugin, a2 as getRetryPlugin, a3 as getHttpAuthSchemeEndpointRuleSetPlugin, a4 as getHttpSigningPlugin, a5 as Client, a6 as DefaultIdentityProviderConfig, a7 as Command } from './index.esm2.js';
3
+ import { A as AwsRestJsonProtocol } from './AwsRestJsonProtocol.esm.js';
4
+ import { N as NoAuthSigner } from './noAuth.esm.js';
5
+ import 'os';
6
+ import 'process';
7
+ import 'buffer';
6
8
  import 'crypto';
7
9
  import 'path';
8
- import 'buffer';
9
- import 'os';
10
10
  import 'node:fs/promises';
11
11
  import 'stream';
12
12
  import 'node:stream';
13
13
  import 'http';
14
14
  import 'https';
15
- import 'process';
16
15
  import 'node:fs';
17
16
  import 'zlib';
18
17
 
19
- function _assert_this_initialized(self) {
20
- if (self === void 0) {
21
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
22
- }
23
- return self;
24
- }
25
- function _class_call_check(instance, Constructor) {
26
- if (!(instance instanceof Constructor)) {
27
- throw new TypeError("Cannot call a class as a function");
28
- }
29
- }
30
- function _define_property$3(obj, key, value) {
31
- if (key in obj) {
32
- Object.defineProperty(obj, key, {
33
- value: value,
34
- enumerable: true,
35
- configurable: true,
36
- writable: true
37
- });
38
- } else {
39
- obj[key] = value;
40
- }
41
- return obj;
42
- }
43
- function _get_prototype_of(o) {
44
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
45
- return o.__proto__ || Object.getPrototypeOf(o);
46
- };
47
- return _get_prototype_of(o);
48
- }
49
- function _inherits(subClass, superClass) {
50
- if (typeof superClass !== "function" && superClass !== null) {
51
- throw new TypeError("Super expression must either be null or a function");
52
- }
53
- subClass.prototype = Object.create(superClass && superClass.prototype, {
54
- constructor: {
55
- value: subClass,
56
- writable: true,
57
- configurable: true
58
- }
59
- });
60
- if (superClass) _set_prototype_of(subClass, superClass);
61
- }
62
- function _possible_constructor_return(self, call) {
63
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
64
- return call;
65
- }
66
- return _assert_this_initialized(self);
67
- }
68
- function _set_prototype_of(o, p) {
69
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
70
- o.__proto__ = p;
71
- return o;
72
- };
73
- return _set_prototype_of(o, p);
74
- }
75
- function _type_of(obj) {
76
- "@swc/helpers - typeof";
77
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
78
- }
79
- function _is_native_reflect_construct() {
80
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
81
- if (Reflect.construct.sham) return false;
82
- if (typeof Proxy === "function") return true;
83
- try {
84
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
85
- return true;
86
- } catch (e) {
87
- return false;
88
- }
89
- }
90
- function _create_super(Derived) {
91
- var hasNativeReflectConstruct = _is_native_reflect_construct();
92
- return function _createSuperInternal() {
93
- var Super = _get_prototype_of(Derived), result;
94
- if (hasNativeReflectConstruct) {
95
- var NewTarget = _get_prototype_of(this).constructor;
96
- result = Reflect.construct(Super, arguments, NewTarget);
97
- } else {
98
- result = Super.apply(this, arguments);
99
- }
100
- return _possible_constructor_return(this, result);
101
- };
102
- }
103
- var TokenProviderError = /*#__PURE__*/ function(ProviderError) {
104
- _inherits(TokenProviderError, ProviderError);
105
- var _super = _create_super(TokenProviderError);
106
- function TokenProviderError(message) {
107
- var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
108
- _class_call_check(this, TokenProviderError);
109
- var _this;
110
- _this = _super.call(this, message, options);
111
- _define_property$3(_assert_this_initialized(_this), "name", "TokenProviderError");
112
- Object.setPrototypeOf(_assert_this_initialized(_this), TokenProviderError.prototype);
113
- return _this;
114
- }
115
- return TokenProviderError;
116
- }(ProviderError);
117
-
118
- function _array_like_to_array(arr, len) {
119
- if (len == null || len > arr.length) len = arr.length;
120
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
121
- return arr2;
122
- }
123
- function _array_with_holes(arr) {
124
- if (Array.isArray(arr)) return arr;
125
- }
126
- function _define_property$2(obj, key, value) {
127
- if (key in obj) {
128
- Object.defineProperty(obj, key, {
129
- value: value,
130
- enumerable: true,
131
- configurable: true,
132
- writable: true
133
- });
134
- } else {
135
- obj[key] = value;
136
- }
137
- return obj;
138
- }
139
- function _iterable_to_array_limit(arr, i) {
140
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
141
- if (_i == null) return;
142
- var _arr = [];
143
- var _n = true;
144
- var _d = false;
145
- var _s, _e;
146
- try {
147
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
148
- _arr.push(_s.value);
149
- if (i && _arr.length === i) break;
150
- }
151
- } catch (err) {
152
- _d = true;
153
- _e = err;
154
- } finally{
155
- try {
156
- if (!_n && _i["return"] != null) _i["return"]();
157
- } finally{
158
- if (_d) throw _e;
159
- }
160
- }
161
- return _arr;
162
- }
163
- function _non_iterable_rest() {
164
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
165
- }
166
- function _object_spread$2(target) {
167
- for(var i = 1; i < arguments.length; i++){
168
- var source = arguments[i] != null ? arguments[i] : {};
169
- var ownKeys = Object.keys(source);
170
- if (typeof Object.getOwnPropertySymbols === "function") {
171
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
172
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
173
- }));
174
- }
175
- ownKeys.forEach(function(key) {
176
- _define_property$2(target, key, source[key]);
177
- });
178
- }
179
- return target;
180
- }
181
- function ownKeys$1(object, enumerableOnly) {
182
- var keys = Object.keys(object);
183
- if (Object.getOwnPropertySymbols) {
184
- var symbols = Object.getOwnPropertySymbols(object);
185
- keys.push.apply(keys, symbols);
186
- }
187
- return keys;
188
- }
189
- function _object_spread_props$1(target, source) {
190
- source = source != null ? source : {};
191
- if (Object.getOwnPropertyDescriptors) {
192
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
193
- } else {
194
- ownKeys$1(Object(source)).forEach(function(key) {
195
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
196
- });
197
- }
198
- return target;
199
- }
200
- function _sliced_to_array(arr, i) {
201
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
202
- }
203
- function _unsupported_iterable_to_array(o, minLen) {
204
- if (!o) return;
205
- if (typeof o === "string") return _array_like_to_array(o, minLen);
206
- var n = Object.prototype.toString.call(o).slice(8, -1);
207
- if (n === "Object" && o.constructor) n = o.constructor.name;
208
- if (n === "Map" || n === "Set") return Array.from(n);
209
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
210
- }
211
- var getSsoSessionData = function(data) {
212
- return Object.entries(data).filter(function(param) {
213
- var _param = _sliced_to_array(param, 1), key = _param[0];
214
- return key.startsWith(IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR);
215
- }).reduce(function(acc, param) {
216
- var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
217
- return _object_spread_props$1(_object_spread$2({}, acc), _define_property$2({}, key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1), value));
218
- }, {});
219
- };
220
-
221
- function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
18
+ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
222
19
  try {
223
20
  var info = gen[key](arg);
224
21
  var value = info.value;
@@ -232,22 +29,22 @@ function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
232
29
  Promise.resolve(value).then(_next, _throw);
233
30
  }
234
31
  }
235
- function _async_to_generator$5(fn) {
32
+ function _async_to_generator$3(fn) {
236
33
  return function() {
237
34
  var self = this, args = arguments;
238
35
  return new Promise(function(resolve, reject) {
239
36
  var gen = fn.apply(self, args);
240
37
  function _next(value) {
241
- asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
38
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
242
39
  }
243
40
  function _throw(err) {
244
- asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
41
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
245
42
  }
246
43
  _next(undefined);
247
44
  });
248
45
  };
249
46
  }
250
- function _ts_generator$5(thisArg, body) {
47
+ function _ts_generator$3(thisArg, body) {
251
48
  var f, y, t, g, _ = {
252
49
  label: 0,
253
50
  sent: function() {
@@ -342,70 +139,1172 @@ function _ts_generator$5(thisArg, body) {
342
139
  };
343
140
  }
344
141
  }
345
- var swallowError = function() {
346
- return {};
347
- };
348
- var loadSsoSessionData = function() {
349
- var _ref = _async_to_generator$5(function() {
350
- var init, _init_configFilepath;
351
- var _arguments = arguments;
352
- return _ts_generator$5(this, function(_state) {
353
- init = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
354
- return [
355
- 2,
356
- readFile((_init_configFilepath = init.configFilepath) !== null && _init_configFilepath !== void 0 ? _init_configFilepath : getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError)
357
- ];
142
+ var defaultSSOOIDCHttpAuthSchemeParametersProvider = function() {
143
+ var _ref = _async_to_generator$3(function(config, context, input) {
144
+ var _tmp;
145
+ return _ts_generator$3(this, function(_state) {
146
+ switch(_state.label){
147
+ case 0:
148
+ _tmp = {
149
+ operation: getSmithyContext(context).operation
150
+ };
151
+ return [
152
+ 4,
153
+ normalizeProvider(config.region)()
154
+ ];
155
+ case 1:
156
+ return [
157
+ 2,
158
+ (_tmp.region = _state.sent() || function() {
159
+ throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
160
+ }(), _tmp)
161
+ ];
162
+ }
358
163
  });
359
164
  });
360
- return function loadSsoSessionData() {
165
+ return function defaultSSOOIDCHttpAuthSchemeParametersProvider(config, context, input) {
361
166
  return _ref.apply(this, arguments);
362
167
  };
363
168
  }();
364
-
365
- var isSsoProfile = function(arg) {
366
- 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");
169
+ function createAwsAuthSigv4HttpAuthOption(authParameters) {
170
+ return {
171
+ schemeId: "aws.auth#sigv4",
172
+ signingProperties: {
173
+ name: "sso-oauth",
174
+ region: authParameters.region
175
+ },
176
+ propertiesExtractor: function(config, context) {
177
+ return {
178
+ signingProperties: {
179
+ config: config,
180
+ context: context
181
+ }
182
+ };
183
+ }
184
+ };
185
+ }
186
+ function createSmithyApiNoAuthHttpAuthOption(authParameters) {
187
+ return {
188
+ schemeId: "smithy.api#noAuth"
189
+ };
190
+ }
191
+ var defaultSSOOIDCHttpAuthSchemeProvider = function(authParameters) {
192
+ var options = [];
193
+ switch(authParameters.operation){
194
+ case "CreateToken":
195
+ {
196
+ options.push(createSmithyApiNoAuthHttpAuthOption());
197
+ break;
198
+ }
199
+ default:
200
+ {
201
+ options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
202
+ }
203
+ }
204
+ return options;
205
+ };
206
+ var resolveHttpAuthSchemeConfig = function(config) {
207
+ var config_0 = resolveAwsSdkSigV4Config(config);
208
+ var _config_authSchemePreference;
209
+ return Object.assign(config_0, {
210
+ authSchemePreference: normalizeProvider((_config_authSchemePreference = config.authSchemePreference) !== null && _config_authSchemePreference !== void 0 ? _config_authSchemePreference : [])
211
+ });
367
212
  };
368
213
 
369
- var EXPIRE_WINDOW_MS = 5 * 60 * 1000;
370
- var REFRESH_MESSAGE = "To refresh this SSO session run 'aws sso login' with the corresponding profile.";
371
-
372
- function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
373
- try {
374
- var info = gen[key](arg);
375
- var value = info.value;
376
- } catch (error) {
377
- reject(error);
378
- return;
214
+ var resolveClientEndpointParameters = function(options) {
215
+ var _options_useDualstackEndpoint, _options_useFipsEndpoint;
216
+ return Object.assign(options, {
217
+ useDualstackEndpoint: (_options_useDualstackEndpoint = options.useDualstackEndpoint) !== null && _options_useDualstackEndpoint !== void 0 ? _options_useDualstackEndpoint : false,
218
+ useFipsEndpoint: (_options_useFipsEndpoint = options.useFipsEndpoint) !== null && _options_useFipsEndpoint !== void 0 ? _options_useFipsEndpoint : false,
219
+ defaultSigningName: "sso-oauth"
220
+ });
221
+ };
222
+ var commonParams = {
223
+ UseFIPS: {
224
+ type: "builtInParams",
225
+ name: "useFipsEndpoint"
226
+ },
227
+ Endpoint: {
228
+ type: "builtInParams",
229
+ name: "endpoint"
230
+ },
231
+ Region: {
232
+ type: "builtInParams",
233
+ name: "region"
234
+ },
235
+ UseDualStack: {
236
+ type: "builtInParams",
237
+ name: "useDualstackEndpoint"
379
238
  }
380
- if (info.done) {
381
- resolve(value);
239
+ };
240
+
241
+ function _define_property$4(obj, key, value) {
242
+ if (key in obj) {
243
+ Object.defineProperty(obj, key, {
244
+ value: value,
245
+ enumerable: true,
246
+ configurable: true,
247
+ writable: true
248
+ });
382
249
  } else {
383
- Promise.resolve(value).then(_next, _throw);
250
+ obj[key] = value;
384
251
  }
252
+ return obj;
385
253
  }
386
- function _async_to_generator$4(fn) {
387
- return function() {
388
- var self = this, args = arguments;
389
- return new Promise(function(resolve, reject) {
390
- var gen = fn.apply(self, args);
391
- function _next(value) {
392
- asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
393
- }
394
- function _throw(err) {
395
- asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
396
- }
397
- _next(undefined);
398
- });
399
- };
400
- }
401
- function _ts_generator$4(thisArg, body) {
402
- var f, y, t, g, _ = {
403
- label: 0,
404
- sent: function() {
405
- if (t[0] & 1) throw t[1];
406
- return t[1];
254
+ var u = "required", v = "fn", w = "argv", x = "ref";
255
+ var _obj$1, _obj1$1, _obj2$1, _obj3$1, _obj4$1, _obj5$1, _obj6$1;
256
+ 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, [
257
+ _define_property$4({}, x, "UseFIPS"),
258
+ true
259
+ ]), _obj2$1), m = (_obj3$1 = {}, _define_property$4(_obj3$1, v, c), _define_property$4(_obj3$1, w, [
260
+ _define_property$4({}, x, "UseDualStack"),
261
+ true
262
+ ]), _obj3$1), n = {}, o = (_obj4$1 = {}, _define_property$4(_obj4$1, v, h), _define_property$4(_obj4$1, w, [
263
+ _define_property$4({}, x, g),
264
+ "supportsFIPS"
265
+ ]), _obj4$1), p = _define_property$4({}, x, g), q = (_obj6$1 = {}, _define_property$4(_obj6$1, v, c), _define_property$4(_obj6$1, w, [
266
+ true,
267
+ (_obj5$1 = {}, _define_property$4(_obj5$1, v, h), _define_property$4(_obj5$1, w, [
268
+ p,
269
+ "supportsDualStack"
270
+ ]), _obj5$1)
271
+ ]), _obj6$1), r = [
272
+ l
273
+ ], s = [
274
+ m
275
+ ], t = [
276
+ _define_property$4({}, x, "Region")
277
+ ];
278
+ var _obj7$1, _obj8$1, _obj9$1, _obj10$1, _obj11, _obj12, _obj13;
279
+ var _data = {
280
+ parameters: {
281
+ Region: i,
282
+ UseDualStack: j,
283
+ UseFIPS: j,
284
+ Endpoint: i
285
+ },
286
+ rules: [
287
+ {
288
+ conditions: [
289
+ (_obj7$1 = {}, _define_property$4(_obj7$1, v, b), _define_property$4(_obj7$1, w, [
290
+ k
291
+ ]), _obj7$1)
292
+ ],
293
+ rules: [
294
+ {
295
+ conditions: r,
296
+ error: "Invalid Configuration: FIPS and custom endpoint are not supported",
297
+ type: d
298
+ },
299
+ {
300
+ conditions: s,
301
+ error: "Invalid Configuration: Dualstack and custom endpoint are not supported",
302
+ type: d
303
+ },
304
+ {
305
+ endpoint: {
306
+ url: k,
307
+ properties: n,
308
+ headers: n
309
+ },
310
+ type: e
311
+ }
312
+ ],
313
+ type: f
407
314
  },
408
- trys: [],
315
+ {
316
+ conditions: [
317
+ (_obj8$1 = {}, _define_property$4(_obj8$1, v, b), _define_property$4(_obj8$1, w, t), _obj8$1)
318
+ ],
319
+ rules: [
320
+ {
321
+ conditions: [
322
+ (_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)
323
+ ],
324
+ rules: [
325
+ {
326
+ conditions: [
327
+ l,
328
+ m
329
+ ],
330
+ rules: [
331
+ {
332
+ conditions: [
333
+ (_obj10$1 = {}, _define_property$4(_obj10$1, v, c), _define_property$4(_obj10$1, w, [
334
+ a,
335
+ o
336
+ ]), _obj10$1),
337
+ q
338
+ ],
339
+ rules: [
340
+ {
341
+ endpoint: {
342
+ url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",
343
+ properties: n,
344
+ headers: n
345
+ },
346
+ type: e
347
+ }
348
+ ],
349
+ type: f
350
+ },
351
+ {
352
+ error: "FIPS and DualStack are enabled, but this partition does not support one or both",
353
+ type: d
354
+ }
355
+ ],
356
+ type: f
357
+ },
358
+ {
359
+ conditions: r,
360
+ rules: [
361
+ {
362
+ conditions: [
363
+ (_obj11 = {}, _define_property$4(_obj11, v, c), _define_property$4(_obj11, w, [
364
+ o,
365
+ a
366
+ ]), _obj11)
367
+ ],
368
+ rules: [
369
+ {
370
+ conditions: [
371
+ (_obj13 = {}, _define_property$4(_obj13, v, "stringEquals"), _define_property$4(_obj13, w, [
372
+ (_obj12 = {}, _define_property$4(_obj12, v, h), _define_property$4(_obj12, w, [
373
+ p,
374
+ "name"
375
+ ]), _obj12),
376
+ "aws-us-gov"
377
+ ]), _obj13)
378
+ ],
379
+ endpoint: {
380
+ url: "https://oidc.{Region}.amazonaws.com",
381
+ properties: n,
382
+ headers: n
383
+ },
384
+ type: e
385
+ },
386
+ {
387
+ endpoint: {
388
+ url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",
389
+ properties: n,
390
+ headers: n
391
+ },
392
+ type: e
393
+ }
394
+ ],
395
+ type: f
396
+ },
397
+ {
398
+ error: "FIPS is enabled but this partition does not support FIPS",
399
+ type: d
400
+ }
401
+ ],
402
+ type: f
403
+ },
404
+ {
405
+ conditions: s,
406
+ rules: [
407
+ {
408
+ conditions: [
409
+ q
410
+ ],
411
+ rules: [
412
+ {
413
+ endpoint: {
414
+ url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",
415
+ properties: n,
416
+ headers: n
417
+ },
418
+ type: e
419
+ }
420
+ ],
421
+ type: f
422
+ },
423
+ {
424
+ error: "DualStack is enabled but this partition does not support DualStack",
425
+ type: d
426
+ }
427
+ ],
428
+ type: f
429
+ },
430
+ {
431
+ endpoint: {
432
+ url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}",
433
+ properties: n,
434
+ headers: n
435
+ },
436
+ type: e
437
+ }
438
+ ],
439
+ type: f
440
+ }
441
+ ],
442
+ type: f
443
+ },
444
+ {
445
+ error: "Invalid Configuration: Missing Region",
446
+ type: d
447
+ }
448
+ ]
449
+ };
450
+ var ruleSet = _data;
451
+
452
+ var cache = new EndpointCache({
453
+ size: 50,
454
+ params: [
455
+ "Endpoint",
456
+ "Region",
457
+ "UseDualStack",
458
+ "UseFIPS"
459
+ ]
460
+ });
461
+ var defaultEndpointResolver = function(endpointParams) {
462
+ var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
463
+ return cache.get(endpointParams, function() {
464
+ return resolveEndpoint(ruleSet, {
465
+ endpointParams: endpointParams,
466
+ logger: context.logger
467
+ });
468
+ });
469
+ };
470
+ customEndpointFunctions.aws = awsEndpointFunctions;
471
+
472
+ function _assert_this_initialized$4(self) {
473
+ if (self === void 0) {
474
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
475
+ }
476
+ return self;
477
+ }
478
+ function _class_call_check$4(instance, Constructor) {
479
+ if (!(instance instanceof Constructor)) {
480
+ throw new TypeError("Cannot call a class as a function");
481
+ }
482
+ }
483
+ function _get_prototype_of$4(o) {
484
+ _get_prototype_of$4 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
485
+ return o.__proto__ || Object.getPrototypeOf(o);
486
+ };
487
+ return _get_prototype_of$4(o);
488
+ }
489
+ function _inherits$4(subClass, superClass) {
490
+ if (typeof superClass !== "function" && superClass !== null) {
491
+ throw new TypeError("Super expression must either be null or a function");
492
+ }
493
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
494
+ constructor: {
495
+ value: subClass,
496
+ writable: true,
497
+ configurable: true
498
+ }
499
+ });
500
+ if (superClass) _set_prototype_of$4(subClass, superClass);
501
+ }
502
+ function _possible_constructor_return$4(self, call) {
503
+ if (call && (_type_of$4(call) === "object" || typeof call === "function")) {
504
+ return call;
505
+ }
506
+ return _assert_this_initialized$4(self);
507
+ }
508
+ function _set_prototype_of$4(o, p) {
509
+ _set_prototype_of$4 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
510
+ o.__proto__ = p;
511
+ return o;
512
+ };
513
+ return _set_prototype_of$4(o, p);
514
+ }
515
+ function _type_of$4(obj) {
516
+ "@swc/helpers - typeof";
517
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
518
+ }
519
+ function _is_native_reflect_construct$4() {
520
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
521
+ if (Reflect.construct.sham) return false;
522
+ if (typeof Proxy === "function") return true;
523
+ try {
524
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
525
+ return true;
526
+ } catch (e) {
527
+ return false;
528
+ }
529
+ }
530
+ function _create_super$4(Derived) {
531
+ var hasNativeReflectConstruct = _is_native_reflect_construct$4();
532
+ return function _createSuperInternal() {
533
+ var Super = _get_prototype_of$4(Derived), result;
534
+ if (hasNativeReflectConstruct) {
535
+ var NewTarget = _get_prototype_of$4(this).constructor;
536
+ result = Reflect.construct(Super, arguments, NewTarget);
537
+ } else {
538
+ result = Super.apply(this, arguments);
539
+ }
540
+ return _possible_constructor_return$4(this, result);
541
+ };
542
+ }
543
+ var SSOOIDCServiceException = /*#__PURE__*/ function(__ServiceException) {
544
+ _inherits$4(SSOOIDCServiceException, __ServiceException);
545
+ var _super = _create_super$4(SSOOIDCServiceException);
546
+ function SSOOIDCServiceException(options) {
547
+ _class_call_check$4(this, SSOOIDCServiceException);
548
+ var _this;
549
+ _this = _super.call(this, options);
550
+ Object.setPrototypeOf(_assert_this_initialized$4(_this), SSOOIDCServiceException.prototype);
551
+ return _this;
552
+ }
553
+ return SSOOIDCServiceException;
554
+ }(ServiceException);
555
+
556
+ function _assert_this_initialized$3(self) {
557
+ if (self === void 0) {
558
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
559
+ }
560
+ return self;
561
+ }
562
+ function _class_call_check$3(instance, Constructor) {
563
+ if (!(instance instanceof Constructor)) {
564
+ throw new TypeError("Cannot call a class as a function");
565
+ }
566
+ }
567
+ function _define_property$3(obj, key, value) {
568
+ if (key in obj) {
569
+ Object.defineProperty(obj, key, {
570
+ value: value,
571
+ enumerable: true,
572
+ configurable: true,
573
+ writable: true
574
+ });
575
+ } else {
576
+ obj[key] = value;
577
+ }
578
+ return obj;
579
+ }
580
+ function _get_prototype_of$3(o) {
581
+ _get_prototype_of$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
582
+ return o.__proto__ || Object.getPrototypeOf(o);
583
+ };
584
+ return _get_prototype_of$3(o);
585
+ }
586
+ function _inherits$3(subClass, superClass) {
587
+ if (typeof superClass !== "function" && superClass !== null) {
588
+ throw new TypeError("Super expression must either be null or a function");
589
+ }
590
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
591
+ constructor: {
592
+ value: subClass,
593
+ writable: true,
594
+ configurable: true
595
+ }
596
+ });
597
+ if (superClass) _set_prototype_of$3(subClass, superClass);
598
+ }
599
+ function _object_spread$1(target) {
600
+ for(var i = 1; i < arguments.length; i++){
601
+ var source = arguments[i] != null ? arguments[i] : {};
602
+ var ownKeys = Object.keys(source);
603
+ if (typeof Object.getOwnPropertySymbols === "function") {
604
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
605
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
606
+ }));
607
+ }
608
+ ownKeys.forEach(function(key) {
609
+ _define_property$3(target, key, source[key]);
610
+ });
611
+ }
612
+ return target;
613
+ }
614
+ function _possible_constructor_return$3(self, call) {
615
+ if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
616
+ return call;
617
+ }
618
+ return _assert_this_initialized$3(self);
619
+ }
620
+ function _set_prototype_of$3(o, p) {
621
+ _set_prototype_of$3 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
622
+ o.__proto__ = p;
623
+ return o;
624
+ };
625
+ return _set_prototype_of$3(o, p);
626
+ }
627
+ function _type_of$3(obj) {
628
+ "@swc/helpers - typeof";
629
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
630
+ }
631
+ function _is_native_reflect_construct$3() {
632
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
633
+ if (Reflect.construct.sham) return false;
634
+ if (typeof Proxy === "function") return true;
635
+ try {
636
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
637
+ return true;
638
+ } catch (e) {
639
+ return false;
640
+ }
641
+ }
642
+ function _create_super$3(Derived) {
643
+ var hasNativeReflectConstruct = _is_native_reflect_construct$3();
644
+ return function _createSuperInternal() {
645
+ var Super = _get_prototype_of$3(Derived), result;
646
+ if (hasNativeReflectConstruct) {
647
+ var NewTarget = _get_prototype_of$3(this).constructor;
648
+ result = Reflect.construct(Super, arguments, NewTarget);
649
+ } else {
650
+ result = Super.apply(this, arguments);
651
+ }
652
+ return _possible_constructor_return$3(this, result);
653
+ };
654
+ }
655
+ var AccessDeniedException = /*#__PURE__*/ function(__BaseException) {
656
+ _inherits$3(AccessDeniedException, __BaseException);
657
+ var _super = _create_super$3(AccessDeniedException);
658
+ function AccessDeniedException(opts) {
659
+ _class_call_check$3(this, AccessDeniedException);
660
+ var _this;
661
+ _this = _super.call(this, _object_spread$1({
662
+ name: "AccessDeniedException",
663
+ $fault: "client"
664
+ }, opts));
665
+ _define_property$3(_assert_this_initialized$3(_this), "name", "AccessDeniedException");
666
+ _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
667
+ _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
668
+ _define_property$3(_assert_this_initialized$3(_this), "reason", void 0);
669
+ _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
670
+ Object.setPrototypeOf(_assert_this_initialized$3(_this), AccessDeniedException.prototype);
671
+ _this.error = opts.error;
672
+ _this.reason = opts.reason;
673
+ _this.error_description = opts.error_description;
674
+ return _this;
675
+ }
676
+ return AccessDeniedException;
677
+ }(SSOOIDCServiceException);
678
+ var AuthorizationPendingException = /*#__PURE__*/ function(__BaseException) {
679
+ _inherits$3(AuthorizationPendingException, __BaseException);
680
+ var _super = _create_super$3(AuthorizationPendingException);
681
+ function AuthorizationPendingException(opts) {
682
+ _class_call_check$3(this, AuthorizationPendingException);
683
+ var _this;
684
+ _this = _super.call(this, _object_spread$1({
685
+ name: "AuthorizationPendingException",
686
+ $fault: "client"
687
+ }, opts));
688
+ _define_property$3(_assert_this_initialized$3(_this), "name", "AuthorizationPendingException");
689
+ _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
690
+ _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
691
+ _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
692
+ Object.setPrototypeOf(_assert_this_initialized$3(_this), AuthorizationPendingException.prototype);
693
+ _this.error = opts.error;
694
+ _this.error_description = opts.error_description;
695
+ return _this;
696
+ }
697
+ return AuthorizationPendingException;
698
+ }(SSOOIDCServiceException);
699
+ var ExpiredTokenException = /*#__PURE__*/ function(__BaseException) {
700
+ _inherits$3(ExpiredTokenException, __BaseException);
701
+ var _super = _create_super$3(ExpiredTokenException);
702
+ function ExpiredTokenException(opts) {
703
+ _class_call_check$3(this, ExpiredTokenException);
704
+ var _this;
705
+ _this = _super.call(this, _object_spread$1({
706
+ name: "ExpiredTokenException",
707
+ $fault: "client"
708
+ }, opts));
709
+ _define_property$3(_assert_this_initialized$3(_this), "name", "ExpiredTokenException");
710
+ _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
711
+ _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
712
+ _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
713
+ Object.setPrototypeOf(_assert_this_initialized$3(_this), ExpiredTokenException.prototype);
714
+ _this.error = opts.error;
715
+ _this.error_description = opts.error_description;
716
+ return _this;
717
+ }
718
+ return ExpiredTokenException;
719
+ }(SSOOIDCServiceException);
720
+ var InternalServerException = /*#__PURE__*/ function(__BaseException) {
721
+ _inherits$3(InternalServerException, __BaseException);
722
+ var _super = _create_super$3(InternalServerException);
723
+ function InternalServerException(opts) {
724
+ _class_call_check$3(this, InternalServerException);
725
+ var _this;
726
+ _this = _super.call(this, _object_spread$1({
727
+ name: "InternalServerException",
728
+ $fault: "server"
729
+ }, opts));
730
+ _define_property$3(_assert_this_initialized$3(_this), "name", "InternalServerException");
731
+ _define_property$3(_assert_this_initialized$3(_this), "$fault", "server");
732
+ _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
733
+ _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
734
+ Object.setPrototypeOf(_assert_this_initialized$3(_this), InternalServerException.prototype);
735
+ _this.error = opts.error;
736
+ _this.error_description = opts.error_description;
737
+ return _this;
738
+ }
739
+ return InternalServerException;
740
+ }(SSOOIDCServiceException);
741
+ var InvalidClientException = /*#__PURE__*/ function(__BaseException) {
742
+ _inherits$3(InvalidClientException, __BaseException);
743
+ var _super = _create_super$3(InvalidClientException);
744
+ function InvalidClientException(opts) {
745
+ _class_call_check$3(this, InvalidClientException);
746
+ var _this;
747
+ _this = _super.call(this, _object_spread$1({
748
+ name: "InvalidClientException",
749
+ $fault: "client"
750
+ }, opts));
751
+ _define_property$3(_assert_this_initialized$3(_this), "name", "InvalidClientException");
752
+ _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
753
+ _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
754
+ _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
755
+ Object.setPrototypeOf(_assert_this_initialized$3(_this), InvalidClientException.prototype);
756
+ _this.error = opts.error;
757
+ _this.error_description = opts.error_description;
758
+ return _this;
759
+ }
760
+ return InvalidClientException;
761
+ }(SSOOIDCServiceException);
762
+ var InvalidGrantException = /*#__PURE__*/ function(__BaseException) {
763
+ _inherits$3(InvalidGrantException, __BaseException);
764
+ var _super = _create_super$3(InvalidGrantException);
765
+ function InvalidGrantException(opts) {
766
+ _class_call_check$3(this, InvalidGrantException);
767
+ var _this;
768
+ _this = _super.call(this, _object_spread$1({
769
+ name: "InvalidGrantException",
770
+ $fault: "client"
771
+ }, opts));
772
+ _define_property$3(_assert_this_initialized$3(_this), "name", "InvalidGrantException");
773
+ _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
774
+ _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
775
+ _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
776
+ Object.setPrototypeOf(_assert_this_initialized$3(_this), InvalidGrantException.prototype);
777
+ _this.error = opts.error;
778
+ _this.error_description = opts.error_description;
779
+ return _this;
780
+ }
781
+ return InvalidGrantException;
782
+ }(SSOOIDCServiceException);
783
+ var InvalidRequestException = /*#__PURE__*/ function(__BaseException) {
784
+ _inherits$3(InvalidRequestException, __BaseException);
785
+ var _super = _create_super$3(InvalidRequestException);
786
+ function InvalidRequestException(opts) {
787
+ _class_call_check$3(this, InvalidRequestException);
788
+ var _this;
789
+ _this = _super.call(this, _object_spread$1({
790
+ name: "InvalidRequestException",
791
+ $fault: "client"
792
+ }, opts));
793
+ _define_property$3(_assert_this_initialized$3(_this), "name", "InvalidRequestException");
794
+ _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
795
+ _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
796
+ _define_property$3(_assert_this_initialized$3(_this), "reason", void 0);
797
+ _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
798
+ Object.setPrototypeOf(_assert_this_initialized$3(_this), InvalidRequestException.prototype);
799
+ _this.error = opts.error;
800
+ _this.reason = opts.reason;
801
+ _this.error_description = opts.error_description;
802
+ return _this;
803
+ }
804
+ return InvalidRequestException;
805
+ }(SSOOIDCServiceException);
806
+ var InvalidScopeException = /*#__PURE__*/ function(__BaseException) {
807
+ _inherits$3(InvalidScopeException, __BaseException);
808
+ var _super = _create_super$3(InvalidScopeException);
809
+ function InvalidScopeException(opts) {
810
+ _class_call_check$3(this, InvalidScopeException);
811
+ var _this;
812
+ _this = _super.call(this, _object_spread$1({
813
+ name: "InvalidScopeException",
814
+ $fault: "client"
815
+ }, opts));
816
+ _define_property$3(_assert_this_initialized$3(_this), "name", "InvalidScopeException");
817
+ _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
818
+ _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
819
+ _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
820
+ Object.setPrototypeOf(_assert_this_initialized$3(_this), InvalidScopeException.prototype);
821
+ _this.error = opts.error;
822
+ _this.error_description = opts.error_description;
823
+ return _this;
824
+ }
825
+ return InvalidScopeException;
826
+ }(SSOOIDCServiceException);
827
+ var SlowDownException = /*#__PURE__*/ function(__BaseException) {
828
+ _inherits$3(SlowDownException, __BaseException);
829
+ var _super = _create_super$3(SlowDownException);
830
+ function SlowDownException(opts) {
831
+ _class_call_check$3(this, SlowDownException);
832
+ var _this;
833
+ _this = _super.call(this, _object_spread$1({
834
+ name: "SlowDownException",
835
+ $fault: "client"
836
+ }, opts));
837
+ _define_property$3(_assert_this_initialized$3(_this), "name", "SlowDownException");
838
+ _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
839
+ _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
840
+ _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
841
+ Object.setPrototypeOf(_assert_this_initialized$3(_this), SlowDownException.prototype);
842
+ _this.error = opts.error;
843
+ _this.error_description = opts.error_description;
844
+ return _this;
845
+ }
846
+ return SlowDownException;
847
+ }(SSOOIDCServiceException);
848
+ var UnauthorizedClientException = /*#__PURE__*/ function(__BaseException) {
849
+ _inherits$3(UnauthorizedClientException, __BaseException);
850
+ var _super = _create_super$3(UnauthorizedClientException);
851
+ function UnauthorizedClientException(opts) {
852
+ _class_call_check$3(this, UnauthorizedClientException);
853
+ var _this;
854
+ _this = _super.call(this, _object_spread$1({
855
+ name: "UnauthorizedClientException",
856
+ $fault: "client"
857
+ }, opts));
858
+ _define_property$3(_assert_this_initialized$3(_this), "name", "UnauthorizedClientException");
859
+ _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
860
+ _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
861
+ _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
862
+ Object.setPrototypeOf(_assert_this_initialized$3(_this), UnauthorizedClientException.prototype);
863
+ _this.error = opts.error;
864
+ _this.error_description = opts.error_description;
865
+ return _this;
866
+ }
867
+ return UnauthorizedClientException;
868
+ }(SSOOIDCServiceException);
869
+ var UnsupportedGrantTypeException = /*#__PURE__*/ function(__BaseException) {
870
+ _inherits$3(UnsupportedGrantTypeException, __BaseException);
871
+ var _super = _create_super$3(UnsupportedGrantTypeException);
872
+ function UnsupportedGrantTypeException(opts) {
873
+ _class_call_check$3(this, UnsupportedGrantTypeException);
874
+ var _this;
875
+ _this = _super.call(this, _object_spread$1({
876
+ name: "UnsupportedGrantTypeException",
877
+ $fault: "client"
878
+ }, opts));
879
+ _define_property$3(_assert_this_initialized$3(_this), "name", "UnsupportedGrantTypeException");
880
+ _define_property$3(_assert_this_initialized$3(_this), "$fault", "client");
881
+ _define_property$3(_assert_this_initialized$3(_this), "error", void 0);
882
+ _define_property$3(_assert_this_initialized$3(_this), "error_description", void 0);
883
+ Object.setPrototypeOf(_assert_this_initialized$3(_this), UnsupportedGrantTypeException.prototype);
884
+ _this.error = opts.error;
885
+ _this.error_description = opts.error_description;
886
+ return _this;
887
+ }
888
+ return UnsupportedGrantTypeException;
889
+ }(SSOOIDCServiceException);
890
+
891
+ function _define_property$2(obj, key, value) {
892
+ if (key in obj) {
893
+ Object.defineProperty(obj, key, {
894
+ value: value,
895
+ enumerable: true,
896
+ configurable: true,
897
+ writable: true
898
+ });
899
+ } else {
900
+ obj[key] = value;
901
+ }
902
+ return obj;
903
+ }
904
+ var _ADE = "AccessDeniedException";
905
+ var _APE = "AuthorizationPendingException";
906
+ var _AT = "AccessToken";
907
+ var _CS = "ClientSecret";
908
+ var _CT = "CreateToken";
909
+ var _CTR = "CreateTokenRequest";
910
+ var _CTRr = "CreateTokenResponse";
911
+ var _CV = "CodeVerifier";
912
+ var _ETE = "ExpiredTokenException";
913
+ var _ICE = "InvalidClientException";
914
+ var _IGE = "InvalidGrantException";
915
+ var _IRE = "InvalidRequestException";
916
+ var _ISE = "InternalServerException";
917
+ var _ISEn = "InvalidScopeException";
918
+ var _IT = "IdToken";
919
+ var _RT = "RefreshToken";
920
+ var _SDE = "SlowDownException";
921
+ var _UCE = "UnauthorizedClientException";
922
+ var _UGTE = "UnsupportedGrantTypeException";
923
+ var _aT = "accessToken";
924
+ var _c = "client";
925
+ var _cI = "clientId";
926
+ var _cS = "clientSecret";
927
+ var _cV = "codeVerifier";
928
+ var _co = "code";
929
+ var _dC = "deviceCode";
930
+ var _e = "error";
931
+ var _eI = "expiresIn";
932
+ var _ed = "error_description";
933
+ var _gT = "grantType";
934
+ var _h = "http";
935
+ var _hE = "httpError";
936
+ var _iT = "idToken";
937
+ var _r = "reason";
938
+ var _rT = "refreshToken";
939
+ var _rU = "redirectUri";
940
+ var _s = "smithy.ts.sdk.synthetic.com.amazonaws.ssooidc";
941
+ var _sc = "scope";
942
+ var _se = "server";
943
+ var _tT = "tokenType";
944
+ var n0 = "com.amazonaws.ssooidc";
945
+ var _s_registry = TypeRegistry.for(_s);
946
+ var SSOOIDCServiceException$ = [
947
+ -3,
948
+ _s,
949
+ "SSOOIDCServiceException",
950
+ 0,
951
+ [],
952
+ []
953
+ ];
954
+ _s_registry.registerError(SSOOIDCServiceException$, SSOOIDCServiceException);
955
+ var n0_registry = TypeRegistry.for(n0);
956
+ var _obj;
957
+ var AccessDeniedException$ = [
958
+ -3,
959
+ n0,
960
+ _ADE,
961
+ (_obj = {}, _define_property$2(_obj, _e, _c), _define_property$2(_obj, _hE, 400), _obj),
962
+ [
963
+ _e,
964
+ _r,
965
+ _ed
966
+ ],
967
+ [
968
+ 0,
969
+ 0,
970
+ 0
971
+ ]
972
+ ];
973
+ n0_registry.registerError(AccessDeniedException$, AccessDeniedException);
974
+ var _obj1;
975
+ var AuthorizationPendingException$ = [
976
+ -3,
977
+ n0,
978
+ _APE,
979
+ (_obj1 = {}, _define_property$2(_obj1, _e, _c), _define_property$2(_obj1, _hE, 400), _obj1),
980
+ [
981
+ _e,
982
+ _ed
983
+ ],
984
+ [
985
+ 0,
986
+ 0
987
+ ]
988
+ ];
989
+ n0_registry.registerError(AuthorizationPendingException$, AuthorizationPendingException);
990
+ var _obj2;
991
+ var ExpiredTokenException$ = [
992
+ -3,
993
+ n0,
994
+ _ETE,
995
+ (_obj2 = {}, _define_property$2(_obj2, _e, _c), _define_property$2(_obj2, _hE, 400), _obj2),
996
+ [
997
+ _e,
998
+ _ed
999
+ ],
1000
+ [
1001
+ 0,
1002
+ 0
1003
+ ]
1004
+ ];
1005
+ n0_registry.registerError(ExpiredTokenException$, ExpiredTokenException);
1006
+ var _obj3;
1007
+ var InternalServerException$ = [
1008
+ -3,
1009
+ n0,
1010
+ _ISE,
1011
+ (_obj3 = {}, _define_property$2(_obj3, _e, _se), _define_property$2(_obj3, _hE, 500), _obj3),
1012
+ [
1013
+ _e,
1014
+ _ed
1015
+ ],
1016
+ [
1017
+ 0,
1018
+ 0
1019
+ ]
1020
+ ];
1021
+ n0_registry.registerError(InternalServerException$, InternalServerException);
1022
+ var _obj4;
1023
+ var InvalidClientException$ = [
1024
+ -3,
1025
+ n0,
1026
+ _ICE,
1027
+ (_obj4 = {}, _define_property$2(_obj4, _e, _c), _define_property$2(_obj4, _hE, 401), _obj4),
1028
+ [
1029
+ _e,
1030
+ _ed
1031
+ ],
1032
+ [
1033
+ 0,
1034
+ 0
1035
+ ]
1036
+ ];
1037
+ n0_registry.registerError(InvalidClientException$, InvalidClientException);
1038
+ var _obj5;
1039
+ var InvalidGrantException$ = [
1040
+ -3,
1041
+ n0,
1042
+ _IGE,
1043
+ (_obj5 = {}, _define_property$2(_obj5, _e, _c), _define_property$2(_obj5, _hE, 400), _obj5),
1044
+ [
1045
+ _e,
1046
+ _ed
1047
+ ],
1048
+ [
1049
+ 0,
1050
+ 0
1051
+ ]
1052
+ ];
1053
+ n0_registry.registerError(InvalidGrantException$, InvalidGrantException);
1054
+ var _obj6;
1055
+ var InvalidRequestException$ = [
1056
+ -3,
1057
+ n0,
1058
+ _IRE,
1059
+ (_obj6 = {}, _define_property$2(_obj6, _e, _c), _define_property$2(_obj6, _hE, 400), _obj6),
1060
+ [
1061
+ _e,
1062
+ _r,
1063
+ _ed
1064
+ ],
1065
+ [
1066
+ 0,
1067
+ 0,
1068
+ 0
1069
+ ]
1070
+ ];
1071
+ n0_registry.registerError(InvalidRequestException$, InvalidRequestException);
1072
+ var _obj7;
1073
+ var InvalidScopeException$ = [
1074
+ -3,
1075
+ n0,
1076
+ _ISEn,
1077
+ (_obj7 = {}, _define_property$2(_obj7, _e, _c), _define_property$2(_obj7, _hE, 400), _obj7),
1078
+ [
1079
+ _e,
1080
+ _ed
1081
+ ],
1082
+ [
1083
+ 0,
1084
+ 0
1085
+ ]
1086
+ ];
1087
+ n0_registry.registerError(InvalidScopeException$, InvalidScopeException);
1088
+ var _obj8;
1089
+ var SlowDownException$ = [
1090
+ -3,
1091
+ n0,
1092
+ _SDE,
1093
+ (_obj8 = {}, _define_property$2(_obj8, _e, _c), _define_property$2(_obj8, _hE, 400), _obj8),
1094
+ [
1095
+ _e,
1096
+ _ed
1097
+ ],
1098
+ [
1099
+ 0,
1100
+ 0
1101
+ ]
1102
+ ];
1103
+ n0_registry.registerError(SlowDownException$, SlowDownException);
1104
+ var _obj9;
1105
+ var UnauthorizedClientException$ = [
1106
+ -3,
1107
+ n0,
1108
+ _UCE,
1109
+ (_obj9 = {}, _define_property$2(_obj9, _e, _c), _define_property$2(_obj9, _hE, 400), _obj9),
1110
+ [
1111
+ _e,
1112
+ _ed
1113
+ ],
1114
+ [
1115
+ 0,
1116
+ 0
1117
+ ]
1118
+ ];
1119
+ n0_registry.registerError(UnauthorizedClientException$, UnauthorizedClientException);
1120
+ var _obj10;
1121
+ var UnsupportedGrantTypeException$ = [
1122
+ -3,
1123
+ n0,
1124
+ _UGTE,
1125
+ (_obj10 = {}, _define_property$2(_obj10, _e, _c), _define_property$2(_obj10, _hE, 400), _obj10),
1126
+ [
1127
+ _e,
1128
+ _ed
1129
+ ],
1130
+ [
1131
+ 0,
1132
+ 0
1133
+ ]
1134
+ ];
1135
+ n0_registry.registerError(UnsupportedGrantTypeException$, UnsupportedGrantTypeException);
1136
+ var errorTypeRegistries = [
1137
+ _s_registry,
1138
+ n0_registry
1139
+ ];
1140
+ var AccessToken = [
1141
+ 0,
1142
+ n0,
1143
+ _AT,
1144
+ 8,
1145
+ 0
1146
+ ];
1147
+ var ClientSecret = [
1148
+ 0,
1149
+ n0,
1150
+ _CS,
1151
+ 8,
1152
+ 0
1153
+ ];
1154
+ var CodeVerifier = [
1155
+ 0,
1156
+ n0,
1157
+ _CV,
1158
+ 8,
1159
+ 0
1160
+ ];
1161
+ var IdToken = [
1162
+ 0,
1163
+ n0,
1164
+ _IT,
1165
+ 8,
1166
+ 0
1167
+ ];
1168
+ var RefreshToken = [
1169
+ 0,
1170
+ n0,
1171
+ _RT,
1172
+ 8,
1173
+ 0
1174
+ ];
1175
+ var CreateTokenRequest$ = [
1176
+ 3,
1177
+ n0,
1178
+ _CTR,
1179
+ 0,
1180
+ [
1181
+ _cI,
1182
+ _cS,
1183
+ _gT,
1184
+ _dC,
1185
+ _co,
1186
+ _rT,
1187
+ _sc,
1188
+ _rU,
1189
+ _cV
1190
+ ],
1191
+ [
1192
+ 0,
1193
+ [
1194
+ function() {
1195
+ return ClientSecret;
1196
+ },
1197
+ 0
1198
+ ],
1199
+ 0,
1200
+ 0,
1201
+ 0,
1202
+ [
1203
+ function() {
1204
+ return RefreshToken;
1205
+ },
1206
+ 0
1207
+ ],
1208
+ 64 | 0,
1209
+ 0,
1210
+ [
1211
+ function() {
1212
+ return CodeVerifier;
1213
+ },
1214
+ 0
1215
+ ]
1216
+ ],
1217
+ 3
1218
+ ];
1219
+ var CreateTokenResponse$ = [
1220
+ 3,
1221
+ n0,
1222
+ _CTRr,
1223
+ 0,
1224
+ [
1225
+ _aT,
1226
+ _tT,
1227
+ _eI,
1228
+ _rT,
1229
+ _iT
1230
+ ],
1231
+ [
1232
+ [
1233
+ function() {
1234
+ return AccessToken;
1235
+ },
1236
+ 0
1237
+ ],
1238
+ 0,
1239
+ 1,
1240
+ [
1241
+ function() {
1242
+ return RefreshToken;
1243
+ },
1244
+ 0
1245
+ ],
1246
+ [
1247
+ function() {
1248
+ return IdToken;
1249
+ },
1250
+ 0
1251
+ ]
1252
+ ]
1253
+ ];
1254
+ var CreateToken$ = [
1255
+ 9,
1256
+ n0,
1257
+ _CT,
1258
+ _define_property$2({}, _h, [
1259
+ "POST",
1260
+ "/token",
1261
+ 200
1262
+ ]),
1263
+ function() {
1264
+ return CreateTokenRequest$;
1265
+ },
1266
+ function() {
1267
+ return CreateTokenResponse$;
1268
+ }
1269
+ ];
1270
+
1271
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
1272
+ try {
1273
+ var info = gen[key](arg);
1274
+ var value = info.value;
1275
+ } catch (error) {
1276
+ reject(error);
1277
+ return;
1278
+ }
1279
+ if (info.done) {
1280
+ resolve(value);
1281
+ } else {
1282
+ Promise.resolve(value).then(_next, _throw);
1283
+ }
1284
+ }
1285
+ function _async_to_generator$2(fn) {
1286
+ return function() {
1287
+ var self = this, args = arguments;
1288
+ return new Promise(function(resolve, reject) {
1289
+ var gen = fn.apply(self, args);
1290
+ function _next(value) {
1291
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
1292
+ }
1293
+ function _throw(err) {
1294
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
1295
+ }
1296
+ _next(undefined);
1297
+ });
1298
+ };
1299
+ }
1300
+ function _ts_generator$2(thisArg, body) {
1301
+ var f, y, t, g, _ = {
1302
+ label: 0,
1303
+ sent: function() {
1304
+ if (t[0] & 1) throw t[1];
1305
+ return t[1];
1306
+ },
1307
+ trys: [],
409
1308
  ops: []
410
1309
  };
411
1310
  return g = {
@@ -493,37 +1392,55 @@ function _ts_generator$4(thisArg, body) {
493
1392
  };
494
1393
  }
495
1394
  }
496
- var getSsoOidcClient = function() {
497
- var _ref = _async_to_generator$4(function(ssoRegion) {
498
- var init, _init_clientConfig, _init_clientConfig1, _init_parentClientConfig, SSOOIDCClient, _init_clientConfig2, _init_clientConfig_logger, ssoOidcClient;
499
- var _arguments = arguments;
500
- return _ts_generator$4(this, function(_state) {
501
- switch(_state.label){
502
- case 0:
503
- init = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
504
- return [
505
- 4,
506
- import('./index.esm12.js')
507
- ];
508
- case 1:
509
- SSOOIDCClient = _state.sent().SSOOIDCClient;
510
- ssoOidcClient = new SSOOIDCClient(Object.assign({}, (_init_clientConfig2 = init.clientConfig) !== null && _init_clientConfig2 !== void 0 ? _init_clientConfig2 : {}, {
511
- region: ssoRegion !== null && ssoRegion !== void 0 ? ssoRegion : (_init_clientConfig = init.clientConfig) === null || _init_clientConfig === void 0 ? void 0 : _init_clientConfig.region,
512
- logger: (_init_clientConfig_logger = (_init_clientConfig1 = init.clientConfig) === null || _init_clientConfig1 === void 0 ? void 0 : _init_clientConfig1.logger) !== null && _init_clientConfig_logger !== void 0 ? _init_clientConfig_logger : (_init_parentClientConfig = init.parentClientConfig) === null || _init_parentClientConfig === void 0 ? void 0 : _init_parentClientConfig.logger
513
- }));
514
- return [
515
- 2,
516
- ssoOidcClient
517
- ];
1395
+ var getRuntimeConfig$1 = function(config) {
1396
+ 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;
1397
+ return {
1398
+ apiVersion: "2019-06-10",
1399
+ base64Decoder: (_config_base64Decoder = config === null || config === void 0 ? void 0 : config.base64Decoder) !== null && _config_base64Decoder !== void 0 ? _config_base64Decoder : fromBase64,
1400
+ base64Encoder: (_config_base64Encoder = config === null || config === void 0 ? void 0 : config.base64Encoder) !== null && _config_base64Encoder !== void 0 ? _config_base64Encoder : toBase64,
1401
+ disableHostPrefix: (_config_disableHostPrefix = config === null || config === void 0 ? void 0 : config.disableHostPrefix) !== null && _config_disableHostPrefix !== void 0 ? _config_disableHostPrefix : false,
1402
+ endpointProvider: (_config_endpointProvider = config === null || config === void 0 ? void 0 : config.endpointProvider) !== null && _config_endpointProvider !== void 0 ? _config_endpointProvider : defaultEndpointResolver,
1403
+ extensions: (_config_extensions = config === null || config === void 0 ? void 0 : config.extensions) !== null && _config_extensions !== void 0 ? _config_extensions : [],
1404
+ httpAuthSchemeProvider: (_config_httpAuthSchemeProvider = config === null || config === void 0 ? void 0 : config.httpAuthSchemeProvider) !== null && _config_httpAuthSchemeProvider !== void 0 ? _config_httpAuthSchemeProvider : defaultSSOOIDCHttpAuthSchemeProvider,
1405
+ httpAuthSchemes: (_config_httpAuthSchemes = config === null || config === void 0 ? void 0 : config.httpAuthSchemes) !== null && _config_httpAuthSchemes !== void 0 ? _config_httpAuthSchemes : [
1406
+ {
1407
+ schemeId: "aws.auth#sigv4",
1408
+ identityProvider: function(ipc) {
1409
+ return ipc.getIdentityProvider("aws.auth#sigv4");
1410
+ },
1411
+ signer: new AwsSdkSigV4Signer()
1412
+ },
1413
+ {
1414
+ schemeId: "smithy.api#noAuth",
1415
+ identityProvider: function(ipc) {
1416
+ return ipc.getIdentityProvider("smithy.api#noAuth") || /*#__PURE__*/ _async_to_generator$2(function() {
1417
+ return _ts_generator$2(this, function(_state) {
1418
+ return [
1419
+ 2,
1420
+ {}
1421
+ ];
1422
+ });
1423
+ });
1424
+ },
1425
+ signer: new NoAuthSigner()
518
1426
  }
519
- });
520
- });
521
- return function getSsoOidcClient(ssoRegion) {
522
- return _ref.apply(this, arguments);
1427
+ ],
1428
+ logger: (_config_logger = config === null || config === void 0 ? void 0 : config.logger) !== null && _config_logger !== void 0 ? _config_logger : new NoOpLogger(),
1429
+ protocol: (_config_protocol = config === null || config === void 0 ? void 0 : config.protocol) !== null && _config_protocol !== void 0 ? _config_protocol : AwsRestJsonProtocol,
1430
+ protocolSettings: (_config_protocolSettings = config === null || config === void 0 ? void 0 : config.protocolSettings) !== null && _config_protocolSettings !== void 0 ? _config_protocolSettings : {
1431
+ defaultNamespace: "com.amazonaws.ssooidc",
1432
+ errorTypeRegistries: errorTypeRegistries,
1433
+ version: "2019-06-10",
1434
+ serviceTarget: "AWSSSOOIDCService"
1435
+ },
1436
+ serviceId: (_config_serviceId = config === null || config === void 0 ? void 0 : config.serviceId) !== null && _config_serviceId !== void 0 ? _config_serviceId : "SSO OIDC",
1437
+ urlParser: (_config_urlParser = config === null || config === void 0 ? void 0 : config.urlParser) !== null && _config_urlParser !== void 0 ? _config_urlParser : parseUrl,
1438
+ utf8Decoder: (_config_utf8Decoder = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _config_utf8Decoder !== void 0 ? _config_utf8Decoder : fromUtf8,
1439
+ utf8Encoder: (_config_utf8Encoder = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _config_utf8Encoder !== void 0 ? _config_utf8Encoder : toUtf8
523
1440
  };
524
- }();
1441
+ };
525
1442
 
526
- function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
1443
+ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
527
1444
  try {
528
1445
  var info = gen[key](arg);
529
1446
  var value = info.value;
@@ -537,22 +1454,69 @@ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
537
1454
  Promise.resolve(value).then(_next, _throw);
538
1455
  }
539
1456
  }
540
- function _async_to_generator$3(fn) {
1457
+ function _async_to_generator$1(fn) {
541
1458
  return function() {
542
1459
  var self = this, args = arguments;
543
1460
  return new Promise(function(resolve, reject) {
544
1461
  var gen = fn.apply(self, args);
545
1462
  function _next(value) {
546
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
1463
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
547
1464
  }
548
1465
  function _throw(err) {
549
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
1466
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
550
1467
  }
551
1468
  _next(undefined);
552
1469
  });
553
1470
  };
554
1471
  }
555
- function _ts_generator$3(thisArg, body) {
1472
+ function _define_property$1(obj, key, value) {
1473
+ if (key in obj) {
1474
+ Object.defineProperty(obj, key, {
1475
+ value: value,
1476
+ enumerable: true,
1477
+ configurable: true,
1478
+ writable: true
1479
+ });
1480
+ } else {
1481
+ obj[key] = value;
1482
+ }
1483
+ return obj;
1484
+ }
1485
+ function _object_spread(target) {
1486
+ for(var i = 1; i < arguments.length; i++){
1487
+ var source = arguments[i] != null ? arguments[i] : {};
1488
+ var ownKeys = Object.keys(source);
1489
+ if (typeof Object.getOwnPropertySymbols === "function") {
1490
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1491
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1492
+ }));
1493
+ }
1494
+ ownKeys.forEach(function(key) {
1495
+ _define_property$1(target, key, source[key]);
1496
+ });
1497
+ }
1498
+ return target;
1499
+ }
1500
+ function ownKeys(object, enumerableOnly) {
1501
+ var keys = Object.keys(object);
1502
+ if (Object.getOwnPropertySymbols) {
1503
+ var symbols = Object.getOwnPropertySymbols(object);
1504
+ keys.push.apply(keys, symbols);
1505
+ }
1506
+ return keys;
1507
+ }
1508
+ function _object_spread_props(target, source) {
1509
+ source = source != null ? source : {};
1510
+ if (Object.getOwnPropertyDescriptors) {
1511
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1512
+ } else {
1513
+ ownKeys(Object(source)).forEach(function(key) {
1514
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1515
+ });
1516
+ }
1517
+ return target;
1518
+ }
1519
+ function _ts_generator$1(thisArg, body) {
556
1520
  var f, y, t, g, _ = {
557
1521
  label: 0,
558
1522
  sent: function() {
@@ -647,64 +1611,120 @@ function _ts_generator$3(thisArg, body) {
647
1611
  };
648
1612
  }
649
1613
  }
650
- var getNewSsoOidcToken = function() {
651
- var _ref = _async_to_generator$3(function(ssoToken, ssoRegion) {
652
- var init, CreateTokenCommand, ssoOidcClient;
653
- var _arguments = arguments;
654
- return _ts_generator$3(this, function(_state) {
655
- switch(_state.label){
656
- case 0:
657
- init = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {};
658
- return [
659
- 4,
660
- import('./index.esm12.js')
661
- ];
662
- case 1:
663
- CreateTokenCommand = _state.sent().CreateTokenCommand;
664
- return [
665
- 4,
666
- getSsoOidcClient(ssoRegion, init)
667
- ];
668
- case 2:
669
- ssoOidcClient = _state.sent();
670
- return [
671
- 2,
672
- ssoOidcClient.send(new CreateTokenCommand({
673
- clientId: ssoToken.clientId,
674
- clientSecret: ssoToken.clientSecret,
675
- refreshToken: ssoToken.refreshToken,
676
- grantType: "refresh_token"
677
- }))
678
- ];
679
- }
680
- });
681
- });
682
- return function getNewSsoOidcToken(ssoToken, ssoRegion) {
683
- return _ref.apply(this, arguments);
1614
+ var getRuntimeConfig = function(config) {
1615
+ emitWarningIfUnsupportedVersion(process.version);
1616
+ var defaultsMode = resolveDefaultsModeConfig(config);
1617
+ var defaultConfigProvider = function() {
1618
+ return defaultsMode().then(loadConfigsForDefaultMode);
684
1619
  };
685
- }();
686
-
687
- var validateTokenExpiry = function(token) {
688
- if (token.expiration && token.expiration.getTime() < Date.now()) {
689
- throw new TokenProviderError("Token is expired. ".concat(REFRESH_MESSAGE), false);
690
- }
1620
+ var clientSharedValues = getRuntimeConfig$1(config);
1621
+ emitWarningIfUnsupportedVersion$1(process.version);
1622
+ var loaderConfig = {
1623
+ profile: config === null || config === void 0 ? void 0 : config.profile,
1624
+ logger: clientSharedValues.logger
1625
+ };
1626
+ 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;
1627
+ return _object_spread_props(_object_spread({}, clientSharedValues, config), {
1628
+ runtime: "node",
1629
+ defaultsMode: defaultsMode,
1630
+ 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),
1631
+ bodyLengthChecker: (_config_bodyLengthChecker = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _config_bodyLengthChecker !== void 0 ? _config_bodyLengthChecker : calculateBodyLength,
1632
+ defaultUserAgentProvider: (_config_defaultUserAgentProvider = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _config_defaultUserAgentProvider !== void 0 ? _config_defaultUserAgentProvider : createDefaultUserAgentProvider({
1633
+ serviceId: clientSharedValues.serviceId,
1634
+ clientVersion: packageInfo.version
1635
+ }),
1636
+ 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),
1637
+ 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)),
1638
+ requestHandler: NodeHttpHandler.create((_config_requestHandler = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _config_requestHandler !== void 0 ? _config_requestHandler : defaultConfigProvider),
1639
+ 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), {
1640
+ default: /*#__PURE__*/ _async_to_generator$1(function() {
1641
+ return _ts_generator$1(this, function(_state) {
1642
+ switch(_state.label){
1643
+ case 0:
1644
+ return [
1645
+ 4,
1646
+ defaultConfigProvider()
1647
+ ];
1648
+ case 1:
1649
+ return [
1650
+ 2,
1651
+ _state.sent().retryMode || DEFAULT_RETRY_MODE
1652
+ ];
1653
+ }
1654
+ });
1655
+ })
1656
+ }), config),
1657
+ sha256: (_config_sha256 = config === null || config === void 0 ? void 0 : config.sha256) !== null && _config_sha256 !== void 0 ? _config_sha256 : Hash.bind(null, "sha256"),
1658
+ streamCollector: (_config_streamCollector = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _config_streamCollector !== void 0 ? _config_streamCollector : streamCollector,
1659
+ 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),
1660
+ 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),
1661
+ 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)
1662
+ });
691
1663
  };
692
1664
 
693
- var validateTokenKey = function(key, value) {
694
- var forRefresh = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
695
- if (typeof value === "undefined") {
696
- throw new TokenProviderError("Value not present for '".concat(key, "' in SSO Token").concat(forRefresh ? ". Cannot refresh" : "", ". ").concat(REFRESH_MESSAGE), false);
697
- }
1665
+ var getHttpAuthExtensionConfiguration = function(runtimeConfig) {
1666
+ var _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
1667
+ var _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
1668
+ var _credentials = runtimeConfig.credentials;
1669
+ return {
1670
+ setHttpAuthScheme: function setHttpAuthScheme(httpAuthScheme) {
1671
+ var index = _httpAuthSchemes.findIndex(function(scheme) {
1672
+ return scheme.schemeId === httpAuthScheme.schemeId;
1673
+ });
1674
+ if (index === -1) {
1675
+ _httpAuthSchemes.push(httpAuthScheme);
1676
+ } else {
1677
+ _httpAuthSchemes.splice(index, 1, httpAuthScheme);
1678
+ }
1679
+ },
1680
+ httpAuthSchemes: function httpAuthSchemes() {
1681
+ return _httpAuthSchemes;
1682
+ },
1683
+ setHttpAuthSchemeProvider: function setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
1684
+ _httpAuthSchemeProvider = httpAuthSchemeProvider;
1685
+ },
1686
+ httpAuthSchemeProvider: function httpAuthSchemeProvider() {
1687
+ return _httpAuthSchemeProvider;
1688
+ },
1689
+ setCredentials: function setCredentials(credentials) {
1690
+ _credentials = credentials;
1691
+ },
1692
+ credentials: function credentials() {
1693
+ return _credentials;
1694
+ }
1695
+ };
1696
+ };
1697
+ var resolveHttpAuthRuntimeConfig = function(config) {
1698
+ return {
1699
+ httpAuthSchemes: config.httpAuthSchemes(),
1700
+ httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
1701
+ credentials: config.credentials()
1702
+ };
698
1703
  };
699
1704
 
700
- var writeFile = promises.writeFile;
701
- var writeSSOTokenToFile = function(id, ssoToken) {
702
- var tokenFilepath = getSSOTokenFilepath(id);
703
- var tokenString = JSON.stringify(ssoToken, null, 2);
704
- return writeFile(tokenFilepath, tokenString);
1705
+ var resolveRuntimeExtensions = function(runtimeConfig, extensions) {
1706
+ var extensionConfiguration = Object.assign(getAwsRegionExtensionConfiguration(runtimeConfig), getDefaultExtensionConfiguration(runtimeConfig), getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
1707
+ extensions.forEach(function(extension) {
1708
+ return extension.configure(extensionConfiguration);
1709
+ });
1710
+ return Object.assign(runtimeConfig, resolveAwsRegionExtensionConfiguration(extensionConfiguration), resolveDefaultRuntimeConfig(extensionConfiguration), resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
705
1711
  };
706
1712
 
707
- function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
1713
+ function _array_like_to_array(arr, len) {
1714
+ if (len == null || len > arr.length) len = arr.length;
1715
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1716
+ return arr2;
1717
+ }
1718
+ function _array_with_holes(arr) {
1719
+ if (Array.isArray(arr)) return arr;
1720
+ }
1721
+ function _assert_this_initialized$2(self) {
1722
+ if (self === void 0) {
1723
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1724
+ }
1725
+ return self;
1726
+ }
1727
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
708
1728
  try {
709
1729
  var info = gen[key](arg);
710
1730
  var value = info.value;
@@ -718,22 +1738,40 @@ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
718
1738
  Promise.resolve(value).then(_next, _throw);
719
1739
  }
720
1740
  }
721
- function _async_to_generator$2(fn) {
1741
+ function _async_to_generator(fn) {
722
1742
  return function() {
723
1743
  var self = this, args = arguments;
724
1744
  return new Promise(function(resolve, reject) {
725
1745
  var gen = fn.apply(self, args);
726
1746
  function _next(value) {
727
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
1747
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
728
1748
  }
729
1749
  function _throw(err) {
730
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
1750
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
731
1751
  }
732
1752
  _next(undefined);
733
1753
  });
734
1754
  };
735
1755
  }
736
- function _define_property$1(obj, key, value) {
1756
+ function _class_call_check$2(instance, Constructor) {
1757
+ if (!(instance instanceof Constructor)) {
1758
+ throw new TypeError("Cannot call a class as a function");
1759
+ }
1760
+ }
1761
+ function _defineProperties(target, props) {
1762
+ for(var i = 0; i < props.length; i++){
1763
+ var descriptor = props[i];
1764
+ descriptor.enumerable = descriptor.enumerable || false;
1765
+ descriptor.configurable = true;
1766
+ if ("value" in descriptor) descriptor.writable = true;
1767
+ Object.defineProperty(target, descriptor.key, descriptor);
1768
+ }
1769
+ }
1770
+ function _create_class(Constructor, protoProps, staticProps) {
1771
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1772
+ return Constructor;
1773
+ }
1774
+ function _define_property(obj, key, value) {
737
1775
  if (key in obj) {
738
1776
  Object.defineProperty(obj, key, {
739
1777
  value: value,
@@ -746,41 +1784,128 @@ function _define_property$1(obj, key, value) {
746
1784
  }
747
1785
  return obj;
748
1786
  }
749
- function _object_spread$1(target) {
750
- for(var i = 1; i < arguments.length; i++){
751
- var source = arguments[i] != null ? arguments[i] : {};
752
- var ownKeys = Object.keys(source);
753
- if (typeof Object.getOwnPropertySymbols === "function") {
754
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
755
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
756
- }));
1787
+ function _get(target, property, receiver) {
1788
+ if (typeof Reflect !== "undefined" && Reflect.get) {
1789
+ _get = Reflect.get;
1790
+ } else {
1791
+ _get = function get(target, property, receiver) {
1792
+ var base = _super_prop_base(target, property);
1793
+ if (!base) return;
1794
+ var desc = Object.getOwnPropertyDescriptor(base, property);
1795
+ if (desc.get) {
1796
+ return desc.get.call(receiver || target);
1797
+ }
1798
+ return desc.value;
1799
+ };
1800
+ }
1801
+ return _get(target, property, receiver || target);
1802
+ }
1803
+ function _get_prototype_of$2(o) {
1804
+ _get_prototype_of$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1805
+ return o.__proto__ || Object.getPrototypeOf(o);
1806
+ };
1807
+ return _get_prototype_of$2(o);
1808
+ }
1809
+ function _inherits$2(subClass, superClass) {
1810
+ if (typeof superClass !== "function" && superClass !== null) {
1811
+ throw new TypeError("Super expression must either be null or a function");
1812
+ }
1813
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
1814
+ constructor: {
1815
+ value: subClass,
1816
+ writable: true,
1817
+ configurable: true
1818
+ }
1819
+ });
1820
+ if (superClass) _set_prototype_of$2(subClass, superClass);
1821
+ }
1822
+ function _iterable_to_array_limit(arr, i) {
1823
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1824
+ if (_i == null) return;
1825
+ var _arr = [];
1826
+ var _n = true;
1827
+ var _d = false;
1828
+ var _s, _e;
1829
+ try {
1830
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1831
+ _arr.push(_s.value);
1832
+ if (i && _arr.length === i) break;
1833
+ }
1834
+ } catch (err) {
1835
+ _d = true;
1836
+ _e = err;
1837
+ } finally{
1838
+ try {
1839
+ if (!_n && _i["return"] != null) _i["return"]();
1840
+ } finally{
1841
+ if (_d) throw _e;
757
1842
  }
758
- ownKeys.forEach(function(key) {
759
- _define_property$1(target, key, source[key]);
760
- });
761
1843
  }
762
- return target;
1844
+ return _arr;
763
1845
  }
764
- function ownKeys(object, enumerableOnly) {
765
- var keys = Object.keys(object);
766
- if (Object.getOwnPropertySymbols) {
767
- var symbols = Object.getOwnPropertySymbols(object);
768
- keys.push.apply(keys, symbols);
1846
+ function _non_iterable_rest() {
1847
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1848
+ }
1849
+ function _possible_constructor_return$2(self, call) {
1850
+ if (call && (_type_of$2(call) === "object" || typeof call === "function")) {
1851
+ return call;
769
1852
  }
770
- return keys;
1853
+ return _assert_this_initialized$2(self);
771
1854
  }
772
- function _object_spread_props(target, source) {
773
- source = source != null ? source : {};
774
- if (Object.getOwnPropertyDescriptors) {
775
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
776
- } else {
777
- ownKeys(Object(source)).forEach(function(key) {
778
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
779
- });
1855
+ function _set_prototype_of$2(o, p) {
1856
+ _set_prototype_of$2 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1857
+ o.__proto__ = p;
1858
+ return o;
1859
+ };
1860
+ return _set_prototype_of$2(o, p);
1861
+ }
1862
+ function _sliced_to_array(arr, i) {
1863
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
1864
+ }
1865
+ function _super_prop_base(object, property) {
1866
+ while(!Object.prototype.hasOwnProperty.call(object, property)){
1867
+ object = _get_prototype_of$2(object);
1868
+ if (object === null) break;
780
1869
  }
781
- return target;
1870
+ return object;
782
1871
  }
783
- function _ts_generator$2(thisArg, body) {
1872
+ function _type_of$2(obj) {
1873
+ "@swc/helpers - typeof";
1874
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1875
+ }
1876
+ function _unsupported_iterable_to_array(o, minLen) {
1877
+ if (!o) return;
1878
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
1879
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1880
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1881
+ if (n === "Map" || n === "Set") return Array.from(n);
1882
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
1883
+ }
1884
+ function _is_native_reflect_construct$2() {
1885
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
1886
+ if (Reflect.construct.sham) return false;
1887
+ if (typeof Proxy === "function") return true;
1888
+ try {
1889
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1890
+ return true;
1891
+ } catch (e) {
1892
+ return false;
1893
+ }
1894
+ }
1895
+ function _create_super$2(Derived) {
1896
+ var hasNativeReflectConstruct = _is_native_reflect_construct$2();
1897
+ return function _createSuperInternal() {
1898
+ var Super = _get_prototype_of$2(Derived), result;
1899
+ if (hasNativeReflectConstruct) {
1900
+ var NewTarget = _get_prototype_of$2(this).constructor;
1901
+ result = Reflect.construct(Super, arguments, NewTarget);
1902
+ } else {
1903
+ result = Super.apply(this, arguments);
1904
+ }
1905
+ return _possible_constructor_return$2(this, result);
1906
+ };
1907
+ }
1908
+ function _ts_generator(thisArg, body) {
784
1909
  var f, y, t, g, _ = {
785
1910
  label: 0,
786
1911
  sent: function() {
@@ -875,730 +2000,246 @@ function _ts_generator$2(thisArg, body) {
875
2000
  };
876
2001
  }
877
2002
  }
878
- var lastRefreshAttemptTime = new Date(0);
879
- var fromSso = function() {
880
- var _init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
881
- return /*#__PURE__*/ _async_to_generator$2(function() {
882
- var callerClientConfig, _init_logger, init, profiles, _init_profile, profileName, profile, ssoSessionName, ssoSessions, ssoSession, _i, _iter, ssoSessionRequiredKey, ssoRegion, ssoToken, accessToken, expiresAt, existingToken, newSsoOidcToken, newTokenExpiration;
883
- var _arguments = arguments;
884
- return _ts_generator$2(this, function(_state) {
885
- switch(_state.label){
886
- case 0:
887
- callerClientConfig = (_arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}).callerClientConfig;
888
- init = _object_spread_props(_object_spread$1({}, _init), {
889
- parentClientConfig: _object_spread$1({}, callerClientConfig, _init.parentClientConfig)
890
- });
891
- (_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : _init_logger.debug("@aws-sdk/token-providers - fromSso");
892
- return [
893
- 4,
894
- parseKnownFiles(init)
895
- ];
896
- case 1:
897
- profiles = _state.sent();
898
- profileName = getProfileName({
899
- profile: (_init_profile = init.profile) !== null && _init_profile !== void 0 ? _init_profile : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.profile
900
- });
901
- profile = profiles[profileName];
902
- if (!profile) {
903
- throw new TokenProviderError("Profile '".concat(profileName, "' could not be found in shared credentials file."), false);
904
- } else if (!profile["sso_session"]) {
905
- throw new TokenProviderError("Profile '".concat(profileName, "' is missing required property 'sso_session'."));
906
- }
907
- ssoSessionName = profile["sso_session"];
908
- return [
909
- 4,
910
- loadSsoSessionData(init)
911
- ];
912
- case 2:
913
- ssoSessions = _state.sent();
914
- ssoSession = ssoSessions[ssoSessionName];
915
- if (!ssoSession) {
916
- throw new TokenProviderError("Sso session '".concat(ssoSessionName, "' could not be found in shared credentials file."), false);
917
- }
918
- for(_i = 0, _iter = [
919
- "sso_start_url",
920
- "sso_region"
921
- ]; _i < _iter.length; _i++){
922
- ssoSessionRequiredKey = _iter[_i];
923
- if (!ssoSession[ssoSessionRequiredKey]) {
924
- throw new TokenProviderError("Sso session '".concat(ssoSessionName, "' is missing required property '").concat(ssoSessionRequiredKey, "'."), false);
925
- }
926
- }
927
- ssoSession["sso_start_url"];
928
- ssoRegion = ssoSession["sso_region"];
929
- _state.label = 3;
930
- case 3:
931
- _state.trys.push([
932
- 3,
933
- 5,
934
- ,
935
- 6
936
- ]);
937
- return [
938
- 4,
939
- getSSOTokenFromFile(ssoSessionName)
940
- ];
941
- case 4:
942
- ssoToken = _state.sent();
943
- return [
944
- 3,
945
- 6
946
- ];
947
- case 5:
948
- _state.sent();
949
- throw new TokenProviderError("The SSO session token associated with profile=".concat(profileName, " was not found or is invalid. ").concat(REFRESH_MESSAGE), false);
950
- case 6:
951
- validateTokenKey("accessToken", ssoToken.accessToken);
952
- validateTokenKey("expiresAt", ssoToken.expiresAt);
953
- accessToken = ssoToken.accessToken, expiresAt = ssoToken.expiresAt;
954
- existingToken = {
955
- token: accessToken,
956
- expiration: new Date(expiresAt)
957
- };
958
- if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
959
- return [
960
- 2,
961
- existingToken
962
- ];
963
- }
964
- if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1000) {
965
- validateTokenExpiry(existingToken);
2003
+ var SSOOIDCClient = /*#__PURE__*/ function(__Client) {
2004
+ _inherits$2(SSOOIDCClient, __Client);
2005
+ var _super = _create_super$2(SSOOIDCClient);
2006
+ function SSOOIDCClient() {
2007
+ for(var _len = arguments.length, _tmp = new Array(_len), _key = 0; _key < _len; _key++){
2008
+ _tmp[_key] = arguments[_key];
2009
+ }
2010
+ var _tmp1 = _sliced_to_array(_tmp, 1), configuration = _tmp1[0];
2011
+ _class_call_check$2(this, SSOOIDCClient);
2012
+ var _this;
2013
+ var _config_0 = getRuntimeConfig(configuration || {});
2014
+ _this = _super.call(this, _config_0);
2015
+ _define_property(_assert_this_initialized$2(_this), "config", void 0);
2016
+ _this.initConfig = _config_0;
2017
+ var _config_1 = resolveClientEndpointParameters(_config_0);
2018
+ var _config_2 = resolveUserAgentConfig(_config_1);
2019
+ var _config_3 = resolveRetryConfig(_config_2);
2020
+ var _config_4 = resolveRegionConfig(_config_3);
2021
+ var _config_5 = resolveHostHeaderConfig(_config_4);
2022
+ var _config_6 = resolveEndpointConfig(_config_5);
2023
+ var _config_7 = resolveHttpAuthSchemeConfig(_config_6);
2024
+ var _config_8 = resolveRuntimeExtensions(_config_7, (configuration === null || configuration === void 0 ? void 0 : configuration.extensions) || []);
2025
+ _this.config = _config_8;
2026
+ _this.middlewareStack.use(getSchemaSerdePlugin(_this.config));
2027
+ _this.middlewareStack.use(getUserAgentPlugin(_this.config));
2028
+ _this.middlewareStack.use(getRetryPlugin(_this.config));
2029
+ _this.middlewareStack.use(getContentLengthPlugin(_this.config));
2030
+ _this.middlewareStack.use(getHostHeaderPlugin(_this.config));
2031
+ _this.middlewareStack.use(getLoggerPlugin(_this.config));
2032
+ _this.middlewareStack.use(getRecursionDetectionPlugin(_this.config));
2033
+ _this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(_this.config, {
2034
+ httpAuthSchemeParametersProvider: defaultSSOOIDCHttpAuthSchemeParametersProvider,
2035
+ identityProviderConfigProvider: function() {
2036
+ var _ref = _async_to_generator(function(config) {
2037
+ return _ts_generator(this, function(_state) {
966
2038
  return [
967
2039
  2,
968
- existingToken
2040
+ new DefaultIdentityProviderConfig({
2041
+ "aws.auth#sigv4": config.credentials
2042
+ })
969
2043
  ];
970
- }
971
- validateTokenKey("clientId", ssoToken.clientId, true);
972
- validateTokenKey("clientSecret", ssoToken.clientSecret, true);
973
- validateTokenKey("refreshToken", ssoToken.refreshToken, true);
974
- _state.label = 7;
975
- case 7:
976
- _state.trys.push([
977
- 7,
978
- 13,
979
- ,
980
- 14
981
- ]);
982
- lastRefreshAttemptTime.setTime(Date.now());
983
- return [
984
- 4,
985
- getNewSsoOidcToken(ssoToken, ssoRegion, init)
986
- ];
987
- case 8:
988
- newSsoOidcToken = _state.sent();
989
- validateTokenKey("accessToken", newSsoOidcToken.accessToken);
990
- validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
991
- newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
992
- _state.label = 9;
993
- case 9:
994
- _state.trys.push([
995
- 9,
996
- 11,
997
- ,
998
- 12
999
- ]);
1000
- return [
1001
- 4,
1002
- writeSSOTokenToFile(ssoSessionName, _object_spread_props(_object_spread$1({}, ssoToken), {
1003
- accessToken: newSsoOidcToken.accessToken,
1004
- expiresAt: newTokenExpiration.toISOString(),
1005
- refreshToken: newSsoOidcToken.refreshToken
1006
- }))
1007
- ];
1008
- case 10:
1009
- _state.sent();
1010
- return [
1011
- 3,
1012
- 12
1013
- ];
1014
- case 11:
1015
- _state.sent();
1016
- return [
1017
- 3,
1018
- 12
1019
- ];
1020
- case 12:
1021
- return [
1022
- 2,
1023
- {
1024
- token: newSsoOidcToken.accessToken,
1025
- expiration: newTokenExpiration
1026
- }
1027
- ];
1028
- case 13:
1029
- _state.sent();
1030
- validateTokenExpiry(existingToken);
1031
- return [
1032
- 2,
1033
- existingToken
1034
- ];
1035
- case 14:
1036
- return [
1037
- 2
1038
- ];
2044
+ });
2045
+ });
2046
+ return function(config) {
2047
+ return _ref.apply(this, arguments);
2048
+ };
2049
+ }()
2050
+ }));
2051
+ _this.middlewareStack.use(getHttpSigningPlugin(_this.config));
2052
+ return _this;
2053
+ }
2054
+ _create_class(SSOOIDCClient, [
2055
+ {
2056
+ key: "destroy",
2057
+ value: function destroy() {
2058
+ _get(_get_prototype_of$2(SSOOIDCClient.prototype), "destroy", this).call(this);
1039
2059
  }
1040
- });
1041
- });
1042
- };
2060
+ }
2061
+ ]);
2062
+ return SSOOIDCClient;
2063
+ }(Client);
1043
2064
 
1044
- function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
1045
- try {
1046
- var info = gen[key](arg);
1047
- var value = info.value;
1048
- } catch (error) {
1049
- reject(error);
1050
- return;
2065
+ function _assert_this_initialized$1(self) {
2066
+ if (self === void 0) {
2067
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1051
2068
  }
1052
- if (info.done) {
1053
- resolve(value);
1054
- } else {
1055
- Promise.resolve(value).then(_next, _throw);
2069
+ return self;
2070
+ }
2071
+ function _class_call_check$1(instance, Constructor) {
2072
+ if (!(instance instanceof Constructor)) {
2073
+ throw new TypeError("Cannot call a class as a function");
1056
2074
  }
1057
2075
  }
1058
- function _async_to_generator$1(fn) {
1059
- return function() {
1060
- var self = this, args = arguments;
1061
- return new Promise(function(resolve, reject) {
1062
- var gen = fn.apply(self, args);
1063
- function _next(value) {
1064
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
1065
- }
1066
- function _throw(err) {
1067
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
1068
- }
1069
- _next(undefined);
1070
- });
2076
+ function _get_prototype_of$1(o) {
2077
+ _get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
2078
+ return o.__proto__ || Object.getPrototypeOf(o);
1071
2079
  };
2080
+ return _get_prototype_of$1(o);
1072
2081
  }
1073
- function _define_property(obj, key, value) {
1074
- if (key in obj) {
1075
- Object.defineProperty(obj, key, {
1076
- value: value,
1077
- enumerable: true,
1078
- configurable: true,
1079
- writable: true
1080
- });
1081
- } else {
1082
- obj[key] = value;
2082
+ function _inherits$1(subClass, superClass) {
2083
+ if (typeof superClass !== "function" && superClass !== null) {
2084
+ throw new TypeError("Super expression must either be null or a function");
1083
2085
  }
1084
- return obj;
1085
- }
1086
- function _object_spread(target) {
1087
- for(var i = 1; i < arguments.length; i++){
1088
- var source = arguments[i] != null ? arguments[i] : {};
1089
- var ownKeys = Object.keys(source);
1090
- if (typeof Object.getOwnPropertySymbols === "function") {
1091
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1092
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1093
- }));
2086
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
2087
+ constructor: {
2088
+ value: subClass,
2089
+ writable: true,
2090
+ configurable: true
1094
2091
  }
1095
- ownKeys.forEach(function(key) {
1096
- _define_property(target, key, source[key]);
1097
- });
2092
+ });
2093
+ if (superClass) _set_prototype_of$1(subClass, superClass);
2094
+ }
2095
+ function _possible_constructor_return$1(self, call) {
2096
+ if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
2097
+ return call;
1098
2098
  }
1099
- return target;
2099
+ return _assert_this_initialized$1(self);
1100
2100
  }
1101
- function _ts_generator$1(thisArg, body) {
1102
- var f, y, t, g, _ = {
1103
- label: 0,
1104
- sent: function() {
1105
- if (t[0] & 1) throw t[1];
1106
- return t[1];
1107
- },
1108
- trys: [],
1109
- ops: []
2101
+ function _set_prototype_of$1(o, p) {
2102
+ _set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
2103
+ o.__proto__ = p;
2104
+ return o;
1110
2105
  };
1111
- return g = {
1112
- next: verb(0),
1113
- "throw": verb(1),
1114
- "return": verb(2)
1115
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
1116
- return this;
1117
- }), g;
1118
- function verb(n) {
1119
- return function(v) {
1120
- return step([
1121
- n,
1122
- v
1123
- ]);
1124
- };
1125
- }
1126
- function step(op) {
1127
- if (f) throw new TypeError("Generator is already executing.");
1128
- while(_)try {
1129
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1130
- if (y = 0, t) op = [
1131
- op[0] & 2,
1132
- t.value
1133
- ];
1134
- switch(op[0]){
1135
- case 0:
1136
- case 1:
1137
- t = op;
1138
- break;
1139
- case 4:
1140
- _.label++;
1141
- return {
1142
- value: op[1],
1143
- done: false
1144
- };
1145
- case 5:
1146
- _.label++;
1147
- y = op[1];
1148
- op = [
1149
- 0
1150
- ];
1151
- continue;
1152
- case 7:
1153
- op = _.ops.pop();
1154
- _.trys.pop();
1155
- continue;
1156
- default:
1157
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1158
- _ = 0;
1159
- continue;
1160
- }
1161
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1162
- _.label = op[1];
1163
- break;
1164
- }
1165
- if (op[0] === 6 && _.label < t[1]) {
1166
- _.label = t[1];
1167
- t = op;
1168
- break;
1169
- }
1170
- if (t && _.label < t[2]) {
1171
- _.label = t[2];
1172
- _.ops.push(op);
1173
- break;
1174
- }
1175
- if (t[2]) _.ops.pop();
1176
- _.trys.pop();
1177
- continue;
1178
- }
1179
- op = body.call(thisArg, _);
1180
- } catch (e) {
1181
- op = [
1182
- 6,
1183
- e
1184
- ];
1185
- y = 0;
1186
- } finally{
1187
- f = t = 0;
1188
- }
1189
- if (op[0] & 5) throw op[1];
1190
- return {
1191
- value: op[0] ? op[1] : void 0,
1192
- done: true
1193
- };
2106
+ return _set_prototype_of$1(o, p);
2107
+ }
2108
+ function _type_of$1(obj) {
2109
+ "@swc/helpers - typeof";
2110
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
2111
+ }
2112
+ function _is_native_reflect_construct$1() {
2113
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
2114
+ if (Reflect.construct.sham) return false;
2115
+ if (typeof Proxy === "function") return true;
2116
+ try {
2117
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
2118
+ return true;
2119
+ } catch (e) {
2120
+ return false;
1194
2121
  }
1195
2122
  }
1196
- var SHOULD_FAIL_CREDENTIAL_CHAIN = false;
1197
- var resolveSSOCredentials = function() {
1198
- var _ref = _async_to_generator$1(function(param) {
1199
- var ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, profile, filepath, configFilepath, ignoreCache, logger, token, refreshMessage, _token, e, accessToken, _ref, SSOClient, GetRoleCredentialsCommand, _clientConfig_logger, _clientConfig_region, sso, ssoResp, e2, tmp, _ref1, accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId, credentials;
1200
- return _ts_generator$1(this, function(_state) {
1201
- switch(_state.label){
1202
- case 0:
1203
- ssoStartUrl = param.ssoStartUrl, ssoSession = param.ssoSession, ssoAccountId = param.ssoAccountId, ssoRegion = param.ssoRegion, ssoRoleName = param.ssoRoleName, ssoClient = param.ssoClient, clientConfig = param.clientConfig, parentClientConfig = param.parentClientConfig, profile = param.profile, filepath = param.filepath, configFilepath = param.configFilepath, ignoreCache = param.ignoreCache, logger = param.logger;
1204
- refreshMessage = "To refresh this SSO session run aws sso login with the corresponding profile.";
1205
- if (!ssoSession) return [
1206
- 3,
1207
- 5
1208
- ];
1209
- _state.label = 1;
1210
- case 1:
1211
- _state.trys.push([
1212
- 1,
1213
- 3,
1214
- ,
1215
- 4
1216
- ]);
1217
- return [
1218
- 4,
1219
- fromSso({
1220
- profile: profile,
1221
- filepath: filepath,
1222
- configFilepath: configFilepath,
1223
- ignoreCache: ignoreCache
1224
- })()
1225
- ];
1226
- case 2:
1227
- _token = _state.sent();
1228
- token = {
1229
- accessToken: _token.token,
1230
- expiresAt: new Date(_token.expiration).toISOString()
1231
- };
1232
- return [
1233
- 3,
1234
- 4
1235
- ];
1236
- case 3:
1237
- e = _state.sent();
1238
- throw new CredentialsProviderError(e.message, {
1239
- tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
1240
- logger: logger
1241
- });
1242
- case 4:
1243
- return [
1244
- 3,
1245
- 8
1246
- ];
1247
- case 5:
1248
- _state.trys.push([
1249
- 5,
1250
- 7,
1251
- ,
1252
- 8
1253
- ]);
1254
- return [
1255
- 4,
1256
- getSSOTokenFromFile(ssoStartUrl)
1257
- ];
1258
- case 6:
1259
- token = _state.sent();
1260
- return [
1261
- 3,
1262
- 8
1263
- ];
1264
- case 7:
1265
- _state.sent();
1266
- throw new CredentialsProviderError("The SSO session associated with this profile is invalid. ".concat(refreshMessage), {
1267
- tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
1268
- logger: logger
1269
- });
1270
- case 8:
1271
- if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
1272
- throw new CredentialsProviderError("The SSO session associated with this profile has expired. ".concat(refreshMessage), {
1273
- tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
1274
- logger: logger
1275
- });
1276
- }
1277
- accessToken = token.accessToken;
1278
- return [
1279
- 4,
1280
- import('./loadSso.esm.js')
1281
- ];
1282
- case 9:
1283
- _ref = _state.sent(), SSOClient = _ref.SSOClient, GetRoleCredentialsCommand = _ref.GetRoleCredentialsCommand;
1284
- sso = ssoClient || new SSOClient(Object.assign({}, clientConfig !== null && clientConfig !== void 0 ? clientConfig : {}, {
1285
- logger: (_clientConfig_logger = clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.logger) !== null && _clientConfig_logger !== void 0 ? _clientConfig_logger : parentClientConfig === null || parentClientConfig === void 0 ? void 0 : parentClientConfig.logger,
1286
- region: (_clientConfig_region = clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.region) !== null && _clientConfig_region !== void 0 ? _clientConfig_region : ssoRegion
1287
- }));
1288
- _state.label = 10;
1289
- case 10:
1290
- _state.trys.push([
1291
- 10,
1292
- 12,
1293
- ,
1294
- 13
1295
- ]);
1296
- return [
1297
- 4,
1298
- sso.send(new GetRoleCredentialsCommand({
1299
- accountId: ssoAccountId,
1300
- roleName: ssoRoleName,
1301
- accessToken: accessToken
1302
- }))
1303
- ];
1304
- case 11:
1305
- ssoResp = _state.sent();
1306
- return [
1307
- 3,
1308
- 13
1309
- ];
1310
- case 12:
1311
- e2 = _state.sent();
1312
- throw new CredentialsProviderError(e2, {
1313
- tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
1314
- logger: logger
1315
- });
1316
- case 13:
1317
- tmp = ssoResp.roleCredentials, _ref1 = tmp === void 0 ? {} : tmp, accessKeyId = _ref1.accessKeyId, secretAccessKey = _ref1.secretAccessKey, sessionToken = _ref1.sessionToken, expiration = _ref1.expiration, credentialScope = _ref1.credentialScope, accountId = _ref1.accountId;
1318
- if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
1319
- throw new CredentialsProviderError("SSO returns an invalid temporary credential.", {
1320
- tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
1321
- logger: logger
1322
- });
1323
- }
1324
- credentials = _object_spread({
1325
- accessKeyId: accessKeyId,
1326
- secretAccessKey: secretAccessKey,
1327
- sessionToken: sessionToken,
1328
- expiration: new Date(expiration)
1329
- }, credentialScope && {
1330
- credentialScope: credentialScope
1331
- }, accountId && {
1332
- accountId: accountId
1333
- });
1334
- if (ssoSession) {
1335
- setCredentialFeature(credentials, "CREDENTIALS_SSO", "s");
1336
- } else {
1337
- setCredentialFeature(credentials, "CREDENTIALS_SSO_LEGACY", "u");
1338
- }
1339
- return [
1340
- 2,
1341
- credentials
1342
- ];
1343
- }
1344
- });
1345
- });
1346
- return function resolveSSOCredentials(_) {
1347
- return _ref.apply(this, arguments);
2123
+ function _create_super$1(Derived) {
2124
+ var hasNativeReflectConstruct = _is_native_reflect_construct$1();
2125
+ return function _createSuperInternal() {
2126
+ var Super = _get_prototype_of$1(Derived), result;
2127
+ if (hasNativeReflectConstruct) {
2128
+ var NewTarget = _get_prototype_of$1(this).constructor;
2129
+ result = Reflect.construct(Super, arguments, NewTarget);
2130
+ } else {
2131
+ result = Super.apply(this, arguments);
2132
+ }
2133
+ return _possible_constructor_return$1(this, result);
1348
2134
  };
1349
- }();
1350
-
1351
- var validateSsoProfile = function(profile, logger) {
1352
- 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;
1353
- if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
1354
- 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"), {
1355
- tryNextLink: false,
1356
- logger: logger
1357
- });
2135
+ }
2136
+ var CreateTokenCommand = /*#__PURE__*/ function(_$Command_classBuilder_ep_m_s_n_sc_build) {
2137
+ _inherits$1(CreateTokenCommand, _$Command_classBuilder_ep_m_s_n_sc_build);
2138
+ var _super = _create_super$1(CreateTokenCommand);
2139
+ function CreateTokenCommand() {
2140
+ _class_call_check$1(this, CreateTokenCommand);
2141
+ return _super.apply(this, arguments);
1358
2142
  }
1359
- return profile;
1360
- };
2143
+ return CreateTokenCommand;
2144
+ }(Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
2145
+ return [
2146
+ getEndpointPlugin(config, Command.getEndpointParameterInstructions())
2147
+ ];
2148
+ }).s("AWSSSOOIDCService", "CreateToken", {}).n("SSOOIDCClient", "CreateTokenCommand").sc(CreateToken$).build());
1361
2149
 
1362
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1363
- try {
1364
- var info = gen[key](arg);
1365
- var value = info.value;
1366
- } catch (error) {
1367
- reject(error);
1368
- return;
2150
+ function _assert_this_initialized(self) {
2151
+ if (self === void 0) {
2152
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1369
2153
  }
1370
- if (info.done) {
1371
- resolve(value);
1372
- } else {
1373
- Promise.resolve(value).then(_next, _throw);
2154
+ return self;
2155
+ }
2156
+ function _class_call_check(instance, Constructor) {
2157
+ if (!(instance instanceof Constructor)) {
2158
+ throw new TypeError("Cannot call a class as a function");
1374
2159
  }
1375
2160
  }
1376
- function _async_to_generator(fn) {
1377
- return function() {
1378
- var self = this, args = arguments;
1379
- return new Promise(function(resolve, reject) {
1380
- var gen = fn.apply(self, args);
1381
- function _next(value) {
1382
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1383
- }
1384
- function _throw(err) {
1385
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1386
- }
1387
- _next(undefined);
1388
- });
2161
+ function _get_prototype_of(o) {
2162
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
2163
+ return o.__proto__ || Object.getPrototypeOf(o);
1389
2164
  };
2165
+ return _get_prototype_of(o);
1390
2166
  }
1391
- function _ts_generator(thisArg, body) {
1392
- var f, y, t, g, _ = {
1393
- label: 0,
1394
- sent: function() {
1395
- if (t[0] & 1) throw t[1];
1396
- return t[1];
1397
- },
1398
- trys: [],
1399
- ops: []
1400
- };
1401
- return g = {
1402
- next: verb(0),
1403
- "throw": verb(1),
1404
- "return": verb(2)
1405
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
1406
- return this;
1407
- }), g;
1408
- function verb(n) {
1409
- return function(v) {
1410
- return step([
1411
- n,
1412
- v
1413
- ]);
1414
- };
2167
+ function _inherits(subClass, superClass) {
2168
+ if (typeof superClass !== "function" && superClass !== null) {
2169
+ throw new TypeError("Super expression must either be null or a function");
1415
2170
  }
1416
- function step(op) {
1417
- if (f) throw new TypeError("Generator is already executing.");
1418
- while(_)try {
1419
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1420
- if (y = 0, t) op = [
1421
- op[0] & 2,
1422
- t.value
1423
- ];
1424
- switch(op[0]){
1425
- case 0:
1426
- case 1:
1427
- t = op;
1428
- break;
1429
- case 4:
1430
- _.label++;
1431
- return {
1432
- value: op[1],
1433
- done: false
1434
- };
1435
- case 5:
1436
- _.label++;
1437
- y = op[1];
1438
- op = [
1439
- 0
1440
- ];
1441
- continue;
1442
- case 7:
1443
- op = _.ops.pop();
1444
- _.trys.pop();
1445
- continue;
1446
- default:
1447
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1448
- _ = 0;
1449
- continue;
1450
- }
1451
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1452
- _.label = op[1];
1453
- break;
1454
- }
1455
- if (op[0] === 6 && _.label < t[1]) {
1456
- _.label = t[1];
1457
- t = op;
1458
- break;
1459
- }
1460
- if (t && _.label < t[2]) {
1461
- _.label = t[2];
1462
- _.ops.push(op);
1463
- break;
1464
- }
1465
- if (t[2]) _.ops.pop();
1466
- _.trys.pop();
1467
- continue;
1468
- }
1469
- op = body.call(thisArg, _);
1470
- } catch (e) {
1471
- op = [
1472
- 6,
1473
- e
1474
- ];
1475
- y = 0;
1476
- } finally{
1477
- f = t = 0;
2171
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
2172
+ constructor: {
2173
+ value: subClass,
2174
+ writable: true,
2175
+ configurable: true
1478
2176
  }
1479
- if (op[0] & 5) throw op[1];
1480
- return {
1481
- value: op[0] ? op[1] : void 0,
1482
- done: true
1483
- };
2177
+ });
2178
+ if (superClass) _set_prototype_of(subClass, superClass);
2179
+ }
2180
+ function _possible_constructor_return(self, call) {
2181
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
2182
+ return call;
1484
2183
  }
2184
+ return _assert_this_initialized(self);
1485
2185
  }
1486
- var fromSSO = function() {
1487
- var init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1488
- return /*#__PURE__*/ _async_to_generator(function() {
1489
- 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;
1490
- var _arguments = arguments;
1491
- return _ts_generator(this, function(_state) {
1492
- switch(_state.label){
1493
- case 0:
1494
- callerClientConfig = (_arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}).callerClientConfig;
1495
- (_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : _init_logger.debug("@aws-sdk/credential-provider-sso - fromSSO");
1496
- ssoStartUrl = init.ssoStartUrl, ssoAccountId = init.ssoAccountId, ssoRegion = init.ssoRegion, ssoRoleName = init.ssoRoleName, ssoSession = init.ssoSession;
1497
- ssoClient = init.ssoClient;
1498
- profileName = getProfileName({
1499
- profile: (_init_profile = init.profile) !== null && _init_profile !== void 0 ? _init_profile : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.profile
1500
- });
1501
- if (!(!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession)) return [
1502
- 3,
1503
- 4
1504
- ];
1505
- return [
1506
- 4,
1507
- parseKnownFiles(init)
1508
- ];
1509
- case 1:
1510
- profiles = _state.sent();
1511
- profile = profiles[profileName];
1512
- if (!profile) {
1513
- throw new CredentialsProviderError("Profile ".concat(profileName, " was not found."), {
1514
- logger: init.logger
1515
- });
1516
- }
1517
- if (!isSsoProfile(profile)) {
1518
- throw new CredentialsProviderError("Profile ".concat(profileName, " is not configured with SSO credentials."), {
1519
- logger: init.logger
1520
- });
1521
- }
1522
- if (!(profile === null || profile === void 0 ? void 0 : profile.sso_session)) return [
1523
- 3,
1524
- 3
1525
- ];
1526
- return [
1527
- 4,
1528
- loadSsoSessionData(init)
1529
- ];
1530
- case 2:
1531
- ssoSessions = _state.sent();
1532
- session = ssoSessions[profile.sso_session];
1533
- conflictMsg = " configurations in profile ".concat(profileName, " and sso-session ").concat(profile.sso_session);
1534
- if (ssoRegion && ssoRegion !== session.sso_region) {
1535
- throw new CredentialsProviderError("Conflicting SSO region" + conflictMsg, {
1536
- tryNextLink: false,
1537
- logger: init.logger
1538
- });
1539
- }
1540
- if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
1541
- throw new CredentialsProviderError("Conflicting SSO start_url" + conflictMsg, {
1542
- tryNextLink: false,
1543
- logger: init.logger
1544
- });
1545
- }
1546
- profile.sso_region = session.sso_region;
1547
- profile.sso_start_url = session.sso_start_url;
1548
- _state.label = 3;
1549
- case 3:
1550
- _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;
1551
- return [
1552
- 2,
1553
- resolveSSOCredentials({
1554
- ssoStartUrl: sso_start_url,
1555
- ssoSession: sso_session,
1556
- ssoAccountId: sso_account_id,
1557
- ssoRegion: sso_region,
1558
- ssoRoleName: sso_role_name,
1559
- ssoClient: ssoClient,
1560
- clientConfig: init.clientConfig,
1561
- parentClientConfig: init.parentClientConfig,
1562
- profile: profileName,
1563
- filepath: init.filepath,
1564
- configFilepath: init.configFilepath,
1565
- ignoreCache: init.ignoreCache,
1566
- logger: init.logger
1567
- })
1568
- ];
1569
- case 4:
1570
- if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {
1571
- throw new CredentialsProviderError("Incomplete configuration. The fromSSO() argument hash must include " + '"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', {
1572
- tryNextLink: false,
1573
- logger: init.logger
1574
- });
1575
- } else {
1576
- return [
1577
- 2,
1578
- resolveSSOCredentials({
1579
- ssoStartUrl: ssoStartUrl,
1580
- ssoSession: ssoSession,
1581
- ssoAccountId: ssoAccountId,
1582
- ssoRegion: ssoRegion,
1583
- ssoRoleName: ssoRoleName,
1584
- ssoClient: ssoClient,
1585
- clientConfig: init.clientConfig,
1586
- parentClientConfig: init.parentClientConfig,
1587
- profile: profileName,
1588
- filepath: init.filepath,
1589
- configFilepath: init.configFilepath,
1590
- ignoreCache: init.ignoreCache,
1591
- logger: init.logger
1592
- })
1593
- ];
1594
- }
1595
- case 5:
1596
- return [
1597
- 2
1598
- ];
1599
- }
1600
- });
1601
- });
2186
+ function _set_prototype_of(o, p) {
2187
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
2188
+ o.__proto__ = p;
2189
+ return o;
2190
+ };
2191
+ return _set_prototype_of(o, p);
2192
+ }
2193
+ function _type_of(obj) {
2194
+ "@swc/helpers - typeof";
2195
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
2196
+ }
2197
+ function _is_native_reflect_construct() {
2198
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
2199
+ if (Reflect.construct.sham) return false;
2200
+ if (typeof Proxy === "function") return true;
2201
+ try {
2202
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
2203
+ return true;
2204
+ } catch (e) {
2205
+ return false;
2206
+ }
2207
+ }
2208
+ function _create_super(Derived) {
2209
+ var hasNativeReflectConstruct = _is_native_reflect_construct();
2210
+ return function _createSuperInternal() {
2211
+ var Super = _get_prototype_of(Derived), result;
2212
+ if (hasNativeReflectConstruct) {
2213
+ var NewTarget = _get_prototype_of(this).constructor;
2214
+ result = Reflect.construct(Super, arguments, NewTarget);
2215
+ } else {
2216
+ result = Super.apply(this, arguments);
2217
+ }
2218
+ return _possible_constructor_return(this, result);
2219
+ };
2220
+ }
2221
+ var commands = {
2222
+ CreateTokenCommand: CreateTokenCommand
2223
+ };
2224
+ var SSOOIDC = /*#__PURE__*/ function(SSOOIDCClient) {
2225
+ _inherits(SSOOIDC, SSOOIDCClient);
2226
+ var _super = _create_super(SSOOIDC);
2227
+ function SSOOIDC() {
2228
+ _class_call_check(this, SSOOIDC);
2229
+ return _super.apply(this, arguments);
2230
+ }
2231
+ return SSOOIDC;
2232
+ }(SSOOIDCClient);
2233
+ createAggregatedClient(commands, SSOOIDC);
2234
+
2235
+ var AccessDeniedExceptionReason = {
2236
+ KMS_ACCESS_DENIED: "KMS_AccessDeniedException"
2237
+ };
2238
+ var InvalidRequestExceptionReason = {
2239
+ KMS_DISABLED_KEY: "KMS_DisabledException",
2240
+ KMS_INVALID_KEY_USAGE: "KMS_InvalidKeyUsageException",
2241
+ KMS_INVALID_STATE: "KMS_InvalidStateException",
2242
+ KMS_KEY_NOT_FOUND: "KMS_NotFoundException"
1602
2243
  };
1603
2244
 
1604
- export { fromSSO, isSsoProfile, validateSsoProfile };
2245
+ 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 };