@digipair/skill-s3 0.136.3 → 0.136.5

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