@digipair/skill-s3 0.136.1 → 0.136.4

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