@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.
@@ -0,0 +1,1858 @@
1
+ import { ag as NumericValue, aa as collectBody, t as toUtf8, a9 as NormalizedSchema, ap as UnionSerde, D as fromBase64, aq as LazyJsonString, ac as determineTimestampFormat, ar as parseEpochTimestamp, as as parseRfc7231DateTime, at as parseRfc3339DateTimeWithOffset, af as SerdeContextConfig, B as toBase64, ad as dateToUtcString, ab as v4, ah as ProtocolLib, au as HttpInterceptingShapeSerializer, av as HttpInterceptingShapeDeserializer, aw as HttpBindingProtocol, T as TypeRegistry } from './index.esm2.js';
2
+
3
+ function jsonReviver(key, value, context) {
4
+ if (context === null || context === void 0 ? void 0 : context.source) {
5
+ var numericString = context.source;
6
+ if (typeof value === "number") {
7
+ if (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER || numericString !== String(value)) {
8
+ var isFractional = numericString.includes(".");
9
+ if (isFractional) {
10
+ return new NumericValue(numericString, "bigDecimal");
11
+ } else {
12
+ return BigInt(numericString);
13
+ }
14
+ }
15
+ }
16
+ }
17
+ return value;
18
+ }
19
+
20
+ var collectBodyString = function(streamBody, context) {
21
+ return collectBody(streamBody, context).then(function(body) {
22
+ var _context_utf8Encoder;
23
+ return ((_context_utf8Encoder = context === null || context === void 0 ? void 0 : context.utf8Encoder) !== null && _context_utf8Encoder !== void 0 ? _context_utf8Encoder : toUtf8)(body);
24
+ });
25
+ };
26
+
27
+ function _type_of$5(obj) {
28
+ "@swc/helpers - typeof";
29
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
30
+ }
31
+ var parseJsonBody = function(streamBody, context) {
32
+ return collectBodyString(streamBody, context).then(function(encoded) {
33
+ if (encoded.length) {
34
+ try {
35
+ return JSON.parse(encoded);
36
+ } catch (e) {
37
+ if ((e === null || e === void 0 ? void 0 : e.name) === "SyntaxError") {
38
+ Object.defineProperty(e, "$responseBodyText", {
39
+ value: encoded
40
+ });
41
+ }
42
+ throw e;
43
+ }
44
+ }
45
+ return {};
46
+ });
47
+ };
48
+ var loadRestJsonErrorCode = function(output, data) {
49
+ var findKey = function(object, key) {
50
+ return Object.keys(object).find(function(k) {
51
+ return k.toLowerCase() === key.toLowerCase();
52
+ });
53
+ };
54
+ var sanitizeErrorCode = function(rawValue) {
55
+ var cleanValue = rawValue;
56
+ if (typeof cleanValue === "number") {
57
+ cleanValue = cleanValue.toString();
58
+ }
59
+ if (cleanValue.indexOf(",") >= 0) {
60
+ cleanValue = cleanValue.split(",")[0];
61
+ }
62
+ if (cleanValue.indexOf(":") >= 0) {
63
+ cleanValue = cleanValue.split(":")[0];
64
+ }
65
+ if (cleanValue.indexOf("#") >= 0) {
66
+ cleanValue = cleanValue.split("#")[1];
67
+ }
68
+ return cleanValue;
69
+ };
70
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
71
+ if (headerKey !== undefined) {
72
+ return sanitizeErrorCode(output.headers[headerKey]);
73
+ }
74
+ if (data && (typeof data === "undefined" ? "undefined" : _type_of$5(data)) === "object") {
75
+ var codeKey = findKey(data, "code");
76
+ if (codeKey && data[codeKey] !== undefined) {
77
+ return sanitizeErrorCode(data[codeKey]);
78
+ }
79
+ if (data["__type"] !== undefined) {
80
+ return sanitizeErrorCode(data["__type"]);
81
+ }
82
+ }
83
+ };
84
+
85
+ function _array_like_to_array$3(arr, len) {
86
+ if (len == null || len > arr.length) len = arr.length;
87
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
88
+ return arr2;
89
+ }
90
+ function _array_with_holes$3(arr) {
91
+ if (Array.isArray(arr)) return arr;
92
+ }
93
+ function _assert_this_initialized$3(self) {
94
+ if (self === void 0) {
95
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
96
+ }
97
+ return self;
98
+ }
99
+ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
100
+ try {
101
+ var info = gen[key](arg);
102
+ var value = info.value;
103
+ } catch (error) {
104
+ reject(error);
105
+ return;
106
+ }
107
+ if (info.done) {
108
+ resolve(value);
109
+ } else {
110
+ Promise.resolve(value).then(_next, _throw);
111
+ }
112
+ }
113
+ function _async_to_generator$1(fn) {
114
+ return function() {
115
+ var self = this, args = arguments;
116
+ return new Promise(function(resolve, reject) {
117
+ var gen = fn.apply(self, args);
118
+ function _next(value) {
119
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
120
+ }
121
+ function _throw(err) {
122
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
123
+ }
124
+ _next(undefined);
125
+ });
126
+ };
127
+ }
128
+ function _class_call_check$4(instance, Constructor) {
129
+ if (!(instance instanceof Constructor)) {
130
+ throw new TypeError("Cannot call a class as a function");
131
+ }
132
+ }
133
+ function _defineProperties$4(target, props) {
134
+ for(var i = 0; i < props.length; i++){
135
+ var descriptor = props[i];
136
+ descriptor.enumerable = descriptor.enumerable || false;
137
+ descriptor.configurable = true;
138
+ if ("value" in descriptor) descriptor.writable = true;
139
+ Object.defineProperty(target, descriptor.key, descriptor);
140
+ }
141
+ }
142
+ function _create_class$4(Constructor, protoProps, staticProps) {
143
+ if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
144
+ return Constructor;
145
+ }
146
+ function _define_property$4(obj, key, value) {
147
+ if (key in obj) {
148
+ Object.defineProperty(obj, key, {
149
+ value: value,
150
+ enumerable: true,
151
+ configurable: true,
152
+ writable: true
153
+ });
154
+ } else {
155
+ obj[key] = value;
156
+ }
157
+ return obj;
158
+ }
159
+ function _get_prototype_of$3(o) {
160
+ _get_prototype_of$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
161
+ return o.__proto__ || Object.getPrototypeOf(o);
162
+ };
163
+ return _get_prototype_of$3(o);
164
+ }
165
+ function _inherits$3(subClass, superClass) {
166
+ if (typeof superClass !== "function" && superClass !== null) {
167
+ throw new TypeError("Super expression must either be null or a function");
168
+ }
169
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
170
+ constructor: {
171
+ value: subClass,
172
+ writable: true,
173
+ configurable: true
174
+ }
175
+ });
176
+ if (superClass) _set_prototype_of$3(subClass, superClass);
177
+ }
178
+ function _instanceof$2(left, right) {
179
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
180
+ return !!right[Symbol.hasInstance](left);
181
+ } else {
182
+ return left instanceof right;
183
+ }
184
+ }
185
+ function _iterable_to_array_limit$3(arr, i) {
186
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
187
+ if (_i == null) return;
188
+ var _arr = [];
189
+ var _n = true;
190
+ var _d = false;
191
+ var _s, _e;
192
+ try {
193
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
194
+ _arr.push(_s.value);
195
+ if (i && _arr.length === i) break;
196
+ }
197
+ } catch (err) {
198
+ _d = true;
199
+ _e = err;
200
+ } finally{
201
+ try {
202
+ if (!_n && _i["return"] != null) _i["return"]();
203
+ } finally{
204
+ if (_d) throw _e;
205
+ }
206
+ }
207
+ return _arr;
208
+ }
209
+ function _non_iterable_rest$3() {
210
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
211
+ }
212
+ function _possible_constructor_return$3(self, call) {
213
+ if (call && (_type_of$4(call) === "object" || typeof call === "function")) {
214
+ return call;
215
+ }
216
+ return _assert_this_initialized$3(self);
217
+ }
218
+ function _set_prototype_of$3(o, p) {
219
+ _set_prototype_of$3 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
220
+ o.__proto__ = p;
221
+ return o;
222
+ };
223
+ return _set_prototype_of$3(o, p);
224
+ }
225
+ function _sliced_to_array$3(arr, i) {
226
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
227
+ }
228
+ function _type_of$4(obj) {
229
+ "@swc/helpers - typeof";
230
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
231
+ }
232
+ function _unsupported_iterable_to_array$3(o, minLen) {
233
+ if (!o) return;
234
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
235
+ var n = Object.prototype.toString.call(o).slice(8, -1);
236
+ if (n === "Object" && o.constructor) n = o.constructor.name;
237
+ if (n === "Map" || n === "Set") return Array.from(n);
238
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
239
+ }
240
+ function _is_native_reflect_construct$3() {
241
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
242
+ if (Reflect.construct.sham) return false;
243
+ if (typeof Proxy === "function") return true;
244
+ try {
245
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
246
+ return true;
247
+ } catch (e) {
248
+ return false;
249
+ }
250
+ }
251
+ function _create_super$3(Derived) {
252
+ var hasNativeReflectConstruct = _is_native_reflect_construct$3();
253
+ return function _createSuperInternal() {
254
+ var Super = _get_prototype_of$3(Derived), result;
255
+ if (hasNativeReflectConstruct) {
256
+ var NewTarget = _get_prototype_of$3(this).constructor;
257
+ result = Reflect.construct(Super, arguments, NewTarget);
258
+ } else {
259
+ result = Super.apply(this, arguments);
260
+ }
261
+ return _possible_constructor_return$3(this, result);
262
+ };
263
+ }
264
+ function _ts_generator$1(thisArg, body) {
265
+ var f, y, t, g, _ = {
266
+ label: 0,
267
+ sent: function() {
268
+ if (t[0] & 1) throw t[1];
269
+ return t[1];
270
+ },
271
+ trys: [],
272
+ ops: []
273
+ };
274
+ return g = {
275
+ next: verb(0),
276
+ "throw": verb(1),
277
+ "return": verb(2)
278
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
279
+ return this;
280
+ }), g;
281
+ function verb(n) {
282
+ return function(v) {
283
+ return step([
284
+ n,
285
+ v
286
+ ]);
287
+ };
288
+ }
289
+ function step(op) {
290
+ if (f) throw new TypeError("Generator is already executing.");
291
+ while(_)try {
292
+ 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;
293
+ if (y = 0, t) op = [
294
+ op[0] & 2,
295
+ t.value
296
+ ];
297
+ switch(op[0]){
298
+ case 0:
299
+ case 1:
300
+ t = op;
301
+ break;
302
+ case 4:
303
+ _.label++;
304
+ return {
305
+ value: op[1],
306
+ done: false
307
+ };
308
+ case 5:
309
+ _.label++;
310
+ y = op[1];
311
+ op = [
312
+ 0
313
+ ];
314
+ continue;
315
+ case 7:
316
+ op = _.ops.pop();
317
+ _.trys.pop();
318
+ continue;
319
+ default:
320
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
321
+ _ = 0;
322
+ continue;
323
+ }
324
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
325
+ _.label = op[1];
326
+ break;
327
+ }
328
+ if (op[0] === 6 && _.label < t[1]) {
329
+ _.label = t[1];
330
+ t = op;
331
+ break;
332
+ }
333
+ if (t && _.label < t[2]) {
334
+ _.label = t[2];
335
+ _.ops.push(op);
336
+ break;
337
+ }
338
+ if (t[2]) _.ops.pop();
339
+ _.trys.pop();
340
+ continue;
341
+ }
342
+ op = body.call(thisArg, _);
343
+ } catch (e) {
344
+ op = [
345
+ 6,
346
+ e
347
+ ];
348
+ y = 0;
349
+ } finally{
350
+ f = t = 0;
351
+ }
352
+ if (op[0] & 5) throw op[1];
353
+ return {
354
+ value: op[0] ? op[1] : void 0,
355
+ done: true
356
+ };
357
+ }
358
+ }
359
+ var JsonShapeDeserializer = /*#__PURE__*/ function(SerdeContextConfig) {
360
+ _inherits$3(JsonShapeDeserializer, SerdeContextConfig);
361
+ var _super = _create_super$3(JsonShapeDeserializer);
362
+ function JsonShapeDeserializer(settings) {
363
+ _class_call_check$4(this, JsonShapeDeserializer);
364
+ var _this;
365
+ _this = _super.call(this);
366
+ _define_property$4(_assert_this_initialized$3(_this), "settings", void 0);
367
+ _this.settings = settings;
368
+ return _this;
369
+ }
370
+ _create_class$4(JsonShapeDeserializer, [
371
+ {
372
+ key: "read",
373
+ value: function read(schema, data) {
374
+ var _this = this;
375
+ return _async_to_generator$1(function() {
376
+ var _, _tmp, _tmp1;
377
+ return _ts_generator$1(this, function(_state) {
378
+ switch(_state.label){
379
+ case 0:
380
+ _ = _this._read;
381
+ _tmp = [
382
+ schema
383
+ ];
384
+ if (!(typeof data === "string")) return [
385
+ 3,
386
+ 1
387
+ ];
388
+ _tmp1 = JSON.parse(data, jsonReviver);
389
+ return [
390
+ 3,
391
+ 3
392
+ ];
393
+ case 1:
394
+ return [
395
+ 4,
396
+ parseJsonBody(data, _this.serdeContext)
397
+ ];
398
+ case 2:
399
+ _tmp1 = _state.sent();
400
+ _state.label = 3;
401
+ case 3:
402
+ return [
403
+ 2,
404
+ _.apply(_this, _tmp.concat([
405
+ _tmp1
406
+ ]))
407
+ ];
408
+ }
409
+ });
410
+ })();
411
+ }
412
+ },
413
+ {
414
+ key: "readObject",
415
+ value: function readObject(schema, data) {
416
+ return this._read(schema, data);
417
+ }
418
+ },
419
+ {
420
+ key: "_read",
421
+ value: function _read(schema, value) {
422
+ var isObject = value !== null && (typeof value === "undefined" ? "undefined" : _type_of$4(value)) === "object";
423
+ var ns = NormalizedSchema.of(schema);
424
+ if (isObject) {
425
+ if (ns.isStructSchema()) {
426
+ var record = value;
427
+ var union = ns.isUnionSchema();
428
+ var out = {};
429
+ var nameMap = void 0;
430
+ var jsonName = this.settings.jsonName;
431
+ if (jsonName) {
432
+ nameMap = {};
433
+ }
434
+ var unionSerde;
435
+ if (union) {
436
+ unionSerde = new UnionSerde(record, out);
437
+ }
438
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
439
+ try {
440
+ for(var _iterator = ns.structIterator()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
441
+ var _step_value = _sliced_to_array$3(_step.value, 2), memberName = _step_value[0], memberSchema = _step_value[1];
442
+ var fromKey = memberName;
443
+ if (jsonName) {
444
+ var _memberSchema_getMergedTraits_jsonName;
445
+ fromKey = (_memberSchema_getMergedTraits_jsonName = memberSchema.getMergedTraits().jsonName) !== null && _memberSchema_getMergedTraits_jsonName !== void 0 ? _memberSchema_getMergedTraits_jsonName : fromKey;
446
+ nameMap[fromKey] = memberName;
447
+ }
448
+ if (union) {
449
+ unionSerde.mark(fromKey);
450
+ }
451
+ if (record[fromKey] != null) {
452
+ out[memberName] = this._read(memberSchema, record[fromKey]);
453
+ }
454
+ }
455
+ } catch (err) {
456
+ _didIteratorError = true;
457
+ _iteratorError = err;
458
+ } finally{
459
+ try {
460
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
461
+ _iterator.return();
462
+ }
463
+ } finally{
464
+ if (_didIteratorError) {
465
+ throw _iteratorError;
466
+ }
467
+ }
468
+ }
469
+ if (union) {
470
+ unionSerde.writeUnknown();
471
+ } else if (typeof record.__type === "string") {
472
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
473
+ try {
474
+ for(var _iterator1 = Object.entries(record)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
475
+ var _step_value1 = _sliced_to_array$3(_step1.value, 2), k = _step_value1[0], v = _step_value1[1];
476
+ var _nameMap_k;
477
+ var t = jsonName ? (_nameMap_k = nameMap[k]) !== null && _nameMap_k !== void 0 ? _nameMap_k : k : k;
478
+ if (!(t in out)) {
479
+ out[t] = v;
480
+ }
481
+ }
482
+ } catch (err) {
483
+ _didIteratorError1 = true;
484
+ _iteratorError1 = err;
485
+ } finally{
486
+ try {
487
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
488
+ _iterator1.return();
489
+ }
490
+ } finally{
491
+ if (_didIteratorError1) {
492
+ throw _iteratorError1;
493
+ }
494
+ }
495
+ }
496
+ }
497
+ return out;
498
+ }
499
+ if (Array.isArray(value) && ns.isListSchema()) {
500
+ var listMember = ns.getValueSchema();
501
+ var out1 = [];
502
+ var sparse = !!ns.getMergedTraits().sparse;
503
+ var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
504
+ try {
505
+ for(var _iterator2 = value[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
506
+ var item = _step2.value;
507
+ if (sparse || item != null) {
508
+ out1.push(this._read(listMember, item));
509
+ }
510
+ }
511
+ } catch (err) {
512
+ _didIteratorError2 = true;
513
+ _iteratorError2 = err;
514
+ } finally{
515
+ try {
516
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
517
+ _iterator2.return();
518
+ }
519
+ } finally{
520
+ if (_didIteratorError2) {
521
+ throw _iteratorError2;
522
+ }
523
+ }
524
+ }
525
+ return out1;
526
+ }
527
+ if (ns.isMapSchema()) {
528
+ var mapMember = ns.getValueSchema();
529
+ var out2 = {};
530
+ var sparse1 = !!ns.getMergedTraits().sparse;
531
+ var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
532
+ try {
533
+ for(var _iterator3 = Object.entries(value)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
534
+ var _step_value2 = _sliced_to_array$3(_step3.value, 2), _k = _step_value2[0], _v = _step_value2[1];
535
+ if (sparse1 || _v != null) {
536
+ out2[_k] = this._read(mapMember, _v);
537
+ }
538
+ }
539
+ } catch (err) {
540
+ _didIteratorError3 = true;
541
+ _iteratorError3 = err;
542
+ } finally{
543
+ try {
544
+ if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
545
+ _iterator3.return();
546
+ }
547
+ } finally{
548
+ if (_didIteratorError3) {
549
+ throw _iteratorError3;
550
+ }
551
+ }
552
+ }
553
+ return out2;
554
+ }
555
+ }
556
+ if (ns.isBlobSchema() && typeof value === "string") {
557
+ return fromBase64(value);
558
+ }
559
+ var mediaType = ns.getMergedTraits().mediaType;
560
+ if (ns.isStringSchema() && typeof value === "string" && mediaType) {
561
+ var isJson = mediaType === "application/json" || mediaType.endsWith("+json");
562
+ if (isJson) {
563
+ return LazyJsonString.from(value);
564
+ }
565
+ return value;
566
+ }
567
+ if (ns.isTimestampSchema() && value != null) {
568
+ var format = determineTimestampFormat(ns, this.settings);
569
+ switch(format){
570
+ case 5:
571
+ return parseRfc3339DateTimeWithOffset(value);
572
+ case 6:
573
+ return parseRfc7231DateTime(value);
574
+ case 7:
575
+ return parseEpochTimestamp(value);
576
+ default:
577
+ console.warn("Missing timestamp format, parsing value with Date constructor:", value);
578
+ return new Date(value);
579
+ }
580
+ }
581
+ if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) {
582
+ return BigInt(value);
583
+ }
584
+ if (ns.isBigDecimalSchema() && value != undefined) {
585
+ if (_instanceof$2(value, NumericValue)) {
586
+ return value;
587
+ }
588
+ var untyped = value;
589
+ if (untyped.type === "bigDecimal" && "string" in untyped) {
590
+ return new NumericValue(untyped.string, untyped.type);
591
+ }
592
+ return new NumericValue(String(value), "bigDecimal");
593
+ }
594
+ if (ns.isNumericSchema() && typeof value === "string") {
595
+ switch(value){
596
+ case "Infinity":
597
+ return Infinity;
598
+ case "-Infinity":
599
+ return -Infinity;
600
+ case "NaN":
601
+ return NaN;
602
+ }
603
+ return value;
604
+ }
605
+ if (ns.isDocumentSchema()) {
606
+ if (isObject) {
607
+ var out3 = Array.isArray(value) ? [] : {};
608
+ var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = undefined;
609
+ try {
610
+ for(var _iterator4 = Object.entries(value)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true){
611
+ var _step_value3 = _sliced_to_array$3(_step4.value, 2), k1 = _step_value3[0], v1 = _step_value3[1];
612
+ if (_instanceof$2(v1, NumericValue)) {
613
+ out3[k1] = v1;
614
+ } else {
615
+ out3[k1] = this._read(ns, v1);
616
+ }
617
+ }
618
+ } catch (err) {
619
+ _didIteratorError4 = true;
620
+ _iteratorError4 = err;
621
+ } finally{
622
+ try {
623
+ if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
624
+ _iterator4.return();
625
+ }
626
+ } finally{
627
+ if (_didIteratorError4) {
628
+ throw _iteratorError4;
629
+ }
630
+ }
631
+ }
632
+ return out3;
633
+ } else {
634
+ return structuredClone(value);
635
+ }
636
+ }
637
+ return value;
638
+ }
639
+ }
640
+ ]);
641
+ return JsonShapeDeserializer;
642
+ }(SerdeContextConfig);
643
+
644
+ function _array_like_to_array$2(arr, len) {
645
+ if (len == null || len > arr.length) len = arr.length;
646
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
647
+ return arr2;
648
+ }
649
+ function _array_with_holes$2(arr) {
650
+ if (Array.isArray(arr)) return arr;
651
+ }
652
+ function _class_call_check$3(instance, Constructor) {
653
+ if (!(instance instanceof Constructor)) {
654
+ throw new TypeError("Cannot call a class as a function");
655
+ }
656
+ }
657
+ function _defineProperties$3(target, props) {
658
+ for(var i = 0; i < props.length; i++){
659
+ var descriptor = props[i];
660
+ descriptor.enumerable = descriptor.enumerable || false;
661
+ descriptor.configurable = true;
662
+ if ("value" in descriptor) descriptor.writable = true;
663
+ Object.defineProperty(target, descriptor.key, descriptor);
664
+ }
665
+ }
666
+ function _create_class$3(Constructor, protoProps, staticProps) {
667
+ if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
668
+ return Constructor;
669
+ }
670
+ function _define_property$3(obj, key, value) {
671
+ if (key in obj) {
672
+ Object.defineProperty(obj, key, {
673
+ value: value,
674
+ enumerable: true,
675
+ configurable: true,
676
+ writable: true
677
+ });
678
+ } else {
679
+ obj[key] = value;
680
+ }
681
+ return obj;
682
+ }
683
+ function _instanceof$1(left, right) {
684
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
685
+ return !!right[Symbol.hasInstance](left);
686
+ } else {
687
+ return left instanceof right;
688
+ }
689
+ }
690
+ function _iterable_to_array_limit$2(arr, i) {
691
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
692
+ if (_i == null) return;
693
+ var _arr = [];
694
+ var _n = true;
695
+ var _d = false;
696
+ var _s, _e;
697
+ try {
698
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
699
+ _arr.push(_s.value);
700
+ if (i && _arr.length === i) break;
701
+ }
702
+ } catch (err) {
703
+ _d = true;
704
+ _e = err;
705
+ } finally{
706
+ try {
707
+ if (!_n && _i["return"] != null) _i["return"]();
708
+ } finally{
709
+ if (_d) throw _e;
710
+ }
711
+ }
712
+ return _arr;
713
+ }
714
+ function _non_iterable_rest$2() {
715
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
716
+ }
717
+ function _sliced_to_array$2(arr, i) {
718
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
719
+ }
720
+ function _type_of$3(obj) {
721
+ "@swc/helpers - typeof";
722
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
723
+ }
724
+ function _unsupported_iterable_to_array$2(o, minLen) {
725
+ if (!o) return;
726
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
727
+ var n = Object.prototype.toString.call(o).slice(8, -1);
728
+ if (n === "Object" && o.constructor) n = o.constructor.name;
729
+ if (n === "Map" || n === "Set") return Array.from(n);
730
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
731
+ }
732
+ var NUMERIC_CONTROL_CHAR = String.fromCharCode(925);
733
+ var JsonReplacer = /*#__PURE__*/ function() {
734
+ function JsonReplacer() {
735
+ _class_call_check$3(this, JsonReplacer);
736
+ _define_property$3(this, "values", new Map());
737
+ _define_property$3(this, "counter", 0);
738
+ _define_property$3(this, "stage", 0);
739
+ }
740
+ _create_class$3(JsonReplacer, [
741
+ {
742
+ key: "createReplacer",
743
+ value: function createReplacer() {
744
+ var _this = this;
745
+ if (this.stage === 1) {
746
+ throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");
747
+ }
748
+ if (this.stage === 2) {
749
+ throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
750
+ }
751
+ this.stage = 1;
752
+ return function(key, value) {
753
+ if (_instanceof$1(value, NumericValue)) {
754
+ var v = "".concat(NUMERIC_CONTROL_CHAR + "nv" + _this.counter++, "_") + value.string;
755
+ _this.values.set('"'.concat(v, '"'), value.string);
756
+ return v;
757
+ }
758
+ if ((typeof value === "undefined" ? "undefined" : _type_of$3(value)) === "bigint") {
759
+ var s = value.toString();
760
+ var v1 = "".concat(NUMERIC_CONTROL_CHAR + "b" + _this.counter++, "_") + s;
761
+ _this.values.set('"'.concat(v1, '"'), s);
762
+ return v1;
763
+ }
764
+ return value;
765
+ };
766
+ }
767
+ },
768
+ {
769
+ key: "replaceInJson",
770
+ value: function replaceInJson(json) {
771
+ if (this.stage === 0) {
772
+ throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");
773
+ }
774
+ if (this.stage === 2) {
775
+ throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
776
+ }
777
+ this.stage = 2;
778
+ if (this.counter === 0) {
779
+ return json;
780
+ }
781
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
782
+ try {
783
+ for(var _iterator = this.values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
784
+ var _step_value = _sliced_to_array$2(_step.value, 2), key = _step_value[0], value = _step_value[1];
785
+ json = json.replace(key, value);
786
+ }
787
+ } catch (err) {
788
+ _didIteratorError = true;
789
+ _iteratorError = err;
790
+ } finally{
791
+ try {
792
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
793
+ _iterator.return();
794
+ }
795
+ } finally{
796
+ if (_didIteratorError) {
797
+ throw _iteratorError;
798
+ }
799
+ }
800
+ }
801
+ return json;
802
+ }
803
+ }
804
+ ]);
805
+ return JsonReplacer;
806
+ }();
807
+
808
+ function _array_like_to_array$1(arr, len) {
809
+ if (len == null || len > arr.length) len = arr.length;
810
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
811
+ return arr2;
812
+ }
813
+ function _array_with_holes$1(arr) {
814
+ if (Array.isArray(arr)) return arr;
815
+ }
816
+ function _assert_this_initialized$2(self) {
817
+ if (self === void 0) {
818
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
819
+ }
820
+ return self;
821
+ }
822
+ function _class_call_check$2(instance, Constructor) {
823
+ if (!(instance instanceof Constructor)) {
824
+ throw new TypeError("Cannot call a class as a function");
825
+ }
826
+ }
827
+ function _defineProperties$2(target, props) {
828
+ for(var i = 0; i < props.length; i++){
829
+ var descriptor = props[i];
830
+ descriptor.enumerable = descriptor.enumerable || false;
831
+ descriptor.configurable = true;
832
+ if ("value" in descriptor) descriptor.writable = true;
833
+ Object.defineProperty(target, descriptor.key, descriptor);
834
+ }
835
+ }
836
+ function _create_class$2(Constructor, protoProps, staticProps) {
837
+ if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
838
+ return Constructor;
839
+ }
840
+ function _define_property$2(obj, key, value) {
841
+ if (key in obj) {
842
+ Object.defineProperty(obj, key, {
843
+ value: value,
844
+ enumerable: true,
845
+ configurable: true,
846
+ writable: true
847
+ });
848
+ } else {
849
+ obj[key] = value;
850
+ }
851
+ return obj;
852
+ }
853
+ function _get_prototype_of$2(o) {
854
+ _get_prototype_of$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
855
+ return o.__proto__ || Object.getPrototypeOf(o);
856
+ };
857
+ return _get_prototype_of$2(o);
858
+ }
859
+ function _inherits$2(subClass, superClass) {
860
+ if (typeof superClass !== "function" && superClass !== null) {
861
+ throw new TypeError("Super expression must either be null or a function");
862
+ }
863
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
864
+ constructor: {
865
+ value: subClass,
866
+ writable: true,
867
+ configurable: true
868
+ }
869
+ });
870
+ if (superClass) _set_prototype_of$2(subClass, superClass);
871
+ }
872
+ function _instanceof(left, right) {
873
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
874
+ return !!right[Symbol.hasInstance](left);
875
+ } else {
876
+ return left instanceof right;
877
+ }
878
+ }
879
+ function _iterable_to_array_limit$1(arr, i) {
880
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
881
+ if (_i == null) return;
882
+ var _arr = [];
883
+ var _n = true;
884
+ var _d = false;
885
+ var _s, _e;
886
+ try {
887
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
888
+ _arr.push(_s.value);
889
+ if (i && _arr.length === i) break;
890
+ }
891
+ } catch (err) {
892
+ _d = true;
893
+ _e = err;
894
+ } finally{
895
+ try {
896
+ if (!_n && _i["return"] != null) _i["return"]();
897
+ } finally{
898
+ if (_d) throw _e;
899
+ }
900
+ }
901
+ return _arr;
902
+ }
903
+ function _non_iterable_rest$1() {
904
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
905
+ }
906
+ function _possible_constructor_return$2(self, call) {
907
+ if (call && (_type_of$2(call) === "object" || typeof call === "function")) {
908
+ return call;
909
+ }
910
+ return _assert_this_initialized$2(self);
911
+ }
912
+ function _set_prototype_of$2(o, p) {
913
+ _set_prototype_of$2 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
914
+ o.__proto__ = p;
915
+ return o;
916
+ };
917
+ return _set_prototype_of$2(o, p);
918
+ }
919
+ function _sliced_to_array$1(arr, i) {
920
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
921
+ }
922
+ function _type_of$2(obj) {
923
+ "@swc/helpers - typeof";
924
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
925
+ }
926
+ function _unsupported_iterable_to_array$1(o, minLen) {
927
+ if (!o) return;
928
+ if (typeof o === "string") return _array_like_to_array$1(o, minLen);
929
+ var n = Object.prototype.toString.call(o).slice(8, -1);
930
+ if (n === "Object" && o.constructor) n = o.constructor.name;
931
+ if (n === "Map" || n === "Set") return Array.from(n);
932
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
933
+ }
934
+ function _is_native_reflect_construct$2() {
935
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
936
+ if (Reflect.construct.sham) return false;
937
+ if (typeof Proxy === "function") return true;
938
+ try {
939
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
940
+ return true;
941
+ } catch (e) {
942
+ return false;
943
+ }
944
+ }
945
+ function _create_super$2(Derived) {
946
+ var hasNativeReflectConstruct = _is_native_reflect_construct$2();
947
+ return function _createSuperInternal() {
948
+ var Super = _get_prototype_of$2(Derived), result;
949
+ if (hasNativeReflectConstruct) {
950
+ var NewTarget = _get_prototype_of$2(this).constructor;
951
+ result = Reflect.construct(Super, arguments, NewTarget);
952
+ } else {
953
+ result = Super.apply(this, arguments);
954
+ }
955
+ return _possible_constructor_return$2(this, result);
956
+ };
957
+ }
958
+ var JsonShapeSerializer = /*#__PURE__*/ function(SerdeContextConfig) {
959
+ _inherits$2(JsonShapeSerializer, SerdeContextConfig);
960
+ var _super = _create_super$2(JsonShapeSerializer);
961
+ function JsonShapeSerializer(settings) {
962
+ _class_call_check$2(this, JsonShapeSerializer);
963
+ var _this;
964
+ _this = _super.call(this);
965
+ _define_property$2(_assert_this_initialized$2(_this), "settings", void 0);
966
+ _define_property$2(_assert_this_initialized$2(_this), "buffer", void 0);
967
+ _define_property$2(_assert_this_initialized$2(_this), "useReplacer", false);
968
+ _define_property$2(_assert_this_initialized$2(_this), "rootSchema", void 0);
969
+ _this.settings = settings;
970
+ return _this;
971
+ }
972
+ _create_class$2(JsonShapeSerializer, [
973
+ {
974
+ key: "write",
975
+ value: function write(schema, value) {
976
+ this.rootSchema = NormalizedSchema.of(schema);
977
+ this.buffer = this._write(this.rootSchema, value);
978
+ }
979
+ },
980
+ {
981
+ key: "writeDiscriminatedDocument",
982
+ value: function writeDiscriminatedDocument(schema, value) {
983
+ this.write(schema, value);
984
+ if (_type_of$2(this.buffer) === "object") {
985
+ this.buffer.__type = NormalizedSchema.of(schema).getName(true);
986
+ }
987
+ }
988
+ },
989
+ {
990
+ key: "flush",
991
+ value: function flush() {
992
+ var _this = this, rootSchema = _this.rootSchema, useReplacer = _this.useReplacer;
993
+ this.rootSchema = undefined;
994
+ this.useReplacer = false;
995
+ if ((rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.isStructSchema()) || (rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.isDocumentSchema())) {
996
+ if (!useReplacer) {
997
+ return JSON.stringify(this.buffer);
998
+ }
999
+ var replacer = new JsonReplacer();
1000
+ return replacer.replaceInJson(JSON.stringify(this.buffer, replacer.createReplacer(), 0));
1001
+ }
1002
+ return this.buffer;
1003
+ }
1004
+ },
1005
+ {
1006
+ key: "_write",
1007
+ value: function _write(schema, value, container) {
1008
+ var isObject = value !== null && (typeof value === "undefined" ? "undefined" : _type_of$2(value)) === "object";
1009
+ var ns = NormalizedSchema.of(schema);
1010
+ if (isObject) {
1011
+ if (ns.isStructSchema()) {
1012
+ var record = value;
1013
+ var out = {};
1014
+ var jsonName = this.settings.jsonName;
1015
+ var nameMap = void 0;
1016
+ if (jsonName) {
1017
+ nameMap = {};
1018
+ }
1019
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1020
+ try {
1021
+ for(var _iterator = ns.structIterator()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1022
+ var _step_value = _sliced_to_array$1(_step.value, 2), memberName = _step_value[0], memberSchema = _step_value[1];
1023
+ var serializableValue = this._write(memberSchema, record[memberName], ns);
1024
+ if (serializableValue !== undefined) {
1025
+ var targetKey = memberName;
1026
+ if (jsonName) {
1027
+ var _memberSchema_getMergedTraits_jsonName;
1028
+ targetKey = (_memberSchema_getMergedTraits_jsonName = memberSchema.getMergedTraits().jsonName) !== null && _memberSchema_getMergedTraits_jsonName !== void 0 ? _memberSchema_getMergedTraits_jsonName : memberName;
1029
+ nameMap[memberName] = targetKey;
1030
+ }
1031
+ out[targetKey] = serializableValue;
1032
+ }
1033
+ }
1034
+ } catch (err) {
1035
+ _didIteratorError = true;
1036
+ _iteratorError = err;
1037
+ } finally{
1038
+ try {
1039
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1040
+ _iterator.return();
1041
+ }
1042
+ } finally{
1043
+ if (_didIteratorError) {
1044
+ throw _iteratorError;
1045
+ }
1046
+ }
1047
+ }
1048
+ if (ns.isUnionSchema() && Object.keys(out).length === 0) {
1049
+ var $unknown = record.$unknown;
1050
+ if (Array.isArray($unknown)) {
1051
+ var _$unknown = _sliced_to_array$1($unknown, 2), k = _$unknown[0], v = _$unknown[1];
1052
+ out[k] = this._write(15, v);
1053
+ }
1054
+ } else if (typeof record.__type === "string") {
1055
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
1056
+ try {
1057
+ for(var _iterator1 = Object.entries(record)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
1058
+ var _step_value1 = _sliced_to_array$1(_step1.value, 2), k1 = _step_value1[0], v1 = _step_value1[1];
1059
+ var _nameMap_k;
1060
+ var targetKey1 = jsonName ? (_nameMap_k = nameMap[k1]) !== null && _nameMap_k !== void 0 ? _nameMap_k : k1 : k1;
1061
+ if (!(targetKey1 in out)) {
1062
+ out[targetKey1] = this._write(15, v1);
1063
+ }
1064
+ }
1065
+ } catch (err) {
1066
+ _didIteratorError1 = true;
1067
+ _iteratorError1 = err;
1068
+ } finally{
1069
+ try {
1070
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
1071
+ _iterator1.return();
1072
+ }
1073
+ } finally{
1074
+ if (_didIteratorError1) {
1075
+ throw _iteratorError1;
1076
+ }
1077
+ }
1078
+ }
1079
+ }
1080
+ return out;
1081
+ }
1082
+ if (Array.isArray(value) && ns.isListSchema()) {
1083
+ var listMember = ns.getValueSchema();
1084
+ var out1 = [];
1085
+ var sparse = !!ns.getMergedTraits().sparse;
1086
+ var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
1087
+ try {
1088
+ for(var _iterator2 = value[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
1089
+ var item = _step2.value;
1090
+ if (sparse || item != null) {
1091
+ out1.push(this._write(listMember, item));
1092
+ }
1093
+ }
1094
+ } catch (err) {
1095
+ _didIteratorError2 = true;
1096
+ _iteratorError2 = err;
1097
+ } finally{
1098
+ try {
1099
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
1100
+ _iterator2.return();
1101
+ }
1102
+ } finally{
1103
+ if (_didIteratorError2) {
1104
+ throw _iteratorError2;
1105
+ }
1106
+ }
1107
+ }
1108
+ return out1;
1109
+ }
1110
+ if (ns.isMapSchema()) {
1111
+ var mapMember = ns.getValueSchema();
1112
+ var out2 = {};
1113
+ var sparse1 = !!ns.getMergedTraits().sparse;
1114
+ var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
1115
+ try {
1116
+ for(var _iterator3 = Object.entries(value)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
1117
+ var _step_value2 = _sliced_to_array$1(_step3.value, 2), _k = _step_value2[0], _v = _step_value2[1];
1118
+ if (sparse1 || _v != null) {
1119
+ out2[_k] = this._write(mapMember, _v);
1120
+ }
1121
+ }
1122
+ } catch (err) {
1123
+ _didIteratorError3 = true;
1124
+ _iteratorError3 = err;
1125
+ } finally{
1126
+ try {
1127
+ if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
1128
+ _iterator3.return();
1129
+ }
1130
+ } finally{
1131
+ if (_didIteratorError3) {
1132
+ throw _iteratorError3;
1133
+ }
1134
+ }
1135
+ }
1136
+ return out2;
1137
+ }
1138
+ if (_instanceof(value, Uint8Array) && (ns.isBlobSchema() || ns.isDocumentSchema())) {
1139
+ var _this_serdeContext;
1140
+ if (ns === this.rootSchema) {
1141
+ return value;
1142
+ }
1143
+ var _this_serdeContext_base64Encoder;
1144
+ 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);
1145
+ }
1146
+ if (_instanceof(value, Date) && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
1147
+ var format = determineTimestampFormat(ns, this.settings);
1148
+ switch(format){
1149
+ case 5:
1150
+ return value.toISOString().replace(".000Z", "Z");
1151
+ case 6:
1152
+ return dateToUtcString(value);
1153
+ case 7:
1154
+ return value.getTime() / 1000;
1155
+ default:
1156
+ console.warn("Missing timestamp format, using epoch seconds", value);
1157
+ return value.getTime() / 1000;
1158
+ }
1159
+ }
1160
+ if (_instanceof(value, NumericValue)) {
1161
+ this.useReplacer = true;
1162
+ }
1163
+ }
1164
+ if (value === null && (container === null || container === void 0 ? void 0 : container.isStructSchema())) {
1165
+ return void 0;
1166
+ }
1167
+ if (ns.isStringSchema()) {
1168
+ if (typeof value === "undefined" && ns.isIdempotencyToken()) {
1169
+ return v4();
1170
+ }
1171
+ var mediaType = ns.getMergedTraits().mediaType;
1172
+ if (value != null && mediaType) {
1173
+ var isJson = mediaType === "application/json" || mediaType.endsWith("+json");
1174
+ if (isJson) {
1175
+ return LazyJsonString.from(value);
1176
+ }
1177
+ }
1178
+ return value;
1179
+ }
1180
+ if (typeof value === "number" && ns.isNumericSchema()) {
1181
+ if (Math.abs(value) === Infinity || isNaN(value)) {
1182
+ return String(value);
1183
+ }
1184
+ return value;
1185
+ }
1186
+ if (typeof value === "string" && ns.isBlobSchema()) {
1187
+ var _this_serdeContext1;
1188
+ if (ns === this.rootSchema) {
1189
+ return value;
1190
+ }
1191
+ var _this_serdeContext_base64Encoder1;
1192
+ 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);
1193
+ }
1194
+ if ((typeof value === "undefined" ? "undefined" : _type_of$2(value)) === "bigint") {
1195
+ this.useReplacer = true;
1196
+ }
1197
+ if (ns.isDocumentSchema()) {
1198
+ if (isObject) {
1199
+ var out3 = Array.isArray(value) ? [] : {};
1200
+ var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = undefined;
1201
+ try {
1202
+ for(var _iterator4 = Object.entries(value)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true){
1203
+ var _step_value3 = _sliced_to_array$1(_step4.value, 2), k2 = _step_value3[0], v2 = _step_value3[1];
1204
+ if (_instanceof(v2, NumericValue)) {
1205
+ this.useReplacer = true;
1206
+ out3[k2] = v2;
1207
+ } else {
1208
+ out3[k2] = this._write(ns, v2);
1209
+ }
1210
+ }
1211
+ } catch (err) {
1212
+ _didIteratorError4 = true;
1213
+ _iteratorError4 = err;
1214
+ } finally{
1215
+ try {
1216
+ if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
1217
+ _iterator4.return();
1218
+ }
1219
+ } finally{
1220
+ if (_didIteratorError4) {
1221
+ throw _iteratorError4;
1222
+ }
1223
+ }
1224
+ }
1225
+ return out3;
1226
+ } else {
1227
+ return structuredClone(value);
1228
+ }
1229
+ }
1230
+ return value;
1231
+ }
1232
+ }
1233
+ ]);
1234
+ return JsonShapeSerializer;
1235
+ }(SerdeContextConfig);
1236
+
1237
+ function _assert_this_initialized$1(self) {
1238
+ if (self === void 0) {
1239
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1240
+ }
1241
+ return self;
1242
+ }
1243
+ function _class_call_check$1(instance, Constructor) {
1244
+ if (!(instance instanceof Constructor)) {
1245
+ throw new TypeError("Cannot call a class as a function");
1246
+ }
1247
+ }
1248
+ function _defineProperties$1(target, props) {
1249
+ for(var i = 0; i < props.length; i++){
1250
+ var descriptor = props[i];
1251
+ descriptor.enumerable = descriptor.enumerable || false;
1252
+ descriptor.configurable = true;
1253
+ if ("value" in descriptor) descriptor.writable = true;
1254
+ Object.defineProperty(target, descriptor.key, descriptor);
1255
+ }
1256
+ }
1257
+ function _create_class$1(Constructor, protoProps, staticProps) {
1258
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
1259
+ return Constructor;
1260
+ }
1261
+ function _define_property$1(obj, key, value) {
1262
+ if (key in obj) {
1263
+ Object.defineProperty(obj, key, {
1264
+ value: value,
1265
+ enumerable: true,
1266
+ configurable: true,
1267
+ writable: true
1268
+ });
1269
+ } else {
1270
+ obj[key] = value;
1271
+ }
1272
+ return obj;
1273
+ }
1274
+ function _get_prototype_of$1(o) {
1275
+ _get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1276
+ return o.__proto__ || Object.getPrototypeOf(o);
1277
+ };
1278
+ return _get_prototype_of$1(o);
1279
+ }
1280
+ function _inherits$1(subClass, superClass) {
1281
+ if (typeof superClass !== "function" && superClass !== null) {
1282
+ throw new TypeError("Super expression must either be null or a function");
1283
+ }
1284
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
1285
+ constructor: {
1286
+ value: subClass,
1287
+ writable: true,
1288
+ configurable: true
1289
+ }
1290
+ });
1291
+ if (superClass) _set_prototype_of$1(subClass, superClass);
1292
+ }
1293
+ function _possible_constructor_return$1(self, call) {
1294
+ if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
1295
+ return call;
1296
+ }
1297
+ return _assert_this_initialized$1(self);
1298
+ }
1299
+ function _set_prototype_of$1(o, p) {
1300
+ _set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1301
+ o.__proto__ = p;
1302
+ return o;
1303
+ };
1304
+ return _set_prototype_of$1(o, p);
1305
+ }
1306
+ function _type_of$1(obj) {
1307
+ "@swc/helpers - typeof";
1308
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1309
+ }
1310
+ function _is_native_reflect_construct$1() {
1311
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
1312
+ if (Reflect.construct.sham) return false;
1313
+ if (typeof Proxy === "function") return true;
1314
+ try {
1315
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1316
+ return true;
1317
+ } catch (e) {
1318
+ return false;
1319
+ }
1320
+ }
1321
+ function _create_super$1(Derived) {
1322
+ var hasNativeReflectConstruct = _is_native_reflect_construct$1();
1323
+ return function _createSuperInternal() {
1324
+ var Super = _get_prototype_of$1(Derived), result;
1325
+ if (hasNativeReflectConstruct) {
1326
+ var NewTarget = _get_prototype_of$1(this).constructor;
1327
+ result = Reflect.construct(Super, arguments, NewTarget);
1328
+ } else {
1329
+ result = Super.apply(this, arguments);
1330
+ }
1331
+ return _possible_constructor_return$1(this, result);
1332
+ };
1333
+ }
1334
+ var JsonCodec = /*#__PURE__*/ function(SerdeContextConfig) {
1335
+ _inherits$1(JsonCodec, SerdeContextConfig);
1336
+ var _super = _create_super$1(JsonCodec);
1337
+ function JsonCodec(settings) {
1338
+ _class_call_check$1(this, JsonCodec);
1339
+ var _this;
1340
+ _this = _super.call(this);
1341
+ _define_property$1(_assert_this_initialized$1(_this), "settings", void 0);
1342
+ _this.settings = settings;
1343
+ return _this;
1344
+ }
1345
+ _create_class$1(JsonCodec, [
1346
+ {
1347
+ key: "createSerializer",
1348
+ value: function createSerializer() {
1349
+ var serializer = new JsonShapeSerializer(this.settings);
1350
+ serializer.setSerdeContext(this.serdeContext);
1351
+ return serializer;
1352
+ }
1353
+ },
1354
+ {
1355
+ key: "createDeserializer",
1356
+ value: function createDeserializer() {
1357
+ var deserializer = new JsonShapeDeserializer(this.settings);
1358
+ deserializer.setSerdeContext(this.serdeContext);
1359
+ return deserializer;
1360
+ }
1361
+ }
1362
+ ]);
1363
+ return JsonCodec;
1364
+ }(SerdeContextConfig);
1365
+
1366
+ function _array_like_to_array(arr, len) {
1367
+ if (len == null || len > arr.length) len = arr.length;
1368
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1369
+ return arr2;
1370
+ }
1371
+ function _array_with_holes(arr) {
1372
+ if (Array.isArray(arr)) return arr;
1373
+ }
1374
+ function _assert_this_initialized(self) {
1375
+ if (self === void 0) {
1376
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1377
+ }
1378
+ return self;
1379
+ }
1380
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1381
+ try {
1382
+ var info = gen[key](arg);
1383
+ var value = info.value;
1384
+ } catch (error) {
1385
+ reject(error);
1386
+ return;
1387
+ }
1388
+ if (info.done) {
1389
+ resolve(value);
1390
+ } else {
1391
+ Promise.resolve(value).then(_next, _throw);
1392
+ }
1393
+ }
1394
+ function _async_to_generator(fn) {
1395
+ return function() {
1396
+ var self = this, args = arguments;
1397
+ return new Promise(function(resolve, reject) {
1398
+ var gen = fn.apply(self, args);
1399
+ function _next(value) {
1400
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1401
+ }
1402
+ function _throw(err) {
1403
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1404
+ }
1405
+ _next(undefined);
1406
+ });
1407
+ };
1408
+ }
1409
+ function _class_call_check(instance, Constructor) {
1410
+ if (!(instance instanceof Constructor)) {
1411
+ throw new TypeError("Cannot call a class as a function");
1412
+ }
1413
+ }
1414
+ function _defineProperties(target, props) {
1415
+ for(var i = 0; i < props.length; i++){
1416
+ var descriptor = props[i];
1417
+ descriptor.enumerable = descriptor.enumerable || false;
1418
+ descriptor.configurable = true;
1419
+ if ("value" in descriptor) descriptor.writable = true;
1420
+ Object.defineProperty(target, descriptor.key, descriptor);
1421
+ }
1422
+ }
1423
+ function _create_class(Constructor, protoProps, staticProps) {
1424
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1425
+ return Constructor;
1426
+ }
1427
+ function _define_property(obj, key, value) {
1428
+ if (key in obj) {
1429
+ Object.defineProperty(obj, key, {
1430
+ value: value,
1431
+ enumerable: true,
1432
+ configurable: true,
1433
+ writable: true
1434
+ });
1435
+ } else {
1436
+ obj[key] = value;
1437
+ }
1438
+ return obj;
1439
+ }
1440
+ function _get(target, property, receiver) {
1441
+ if (typeof Reflect !== "undefined" && Reflect.get) {
1442
+ _get = Reflect.get;
1443
+ } else {
1444
+ _get = function get(target, property, receiver) {
1445
+ var base = _super_prop_base(target, property);
1446
+ if (!base) return;
1447
+ var desc = Object.getOwnPropertyDescriptor(base, property);
1448
+ if (desc.get) {
1449
+ return desc.get.call(receiver || target);
1450
+ }
1451
+ return desc.value;
1452
+ };
1453
+ }
1454
+ return _get(target, property, receiver || target);
1455
+ }
1456
+ function _get_prototype_of(o) {
1457
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1458
+ return o.__proto__ || Object.getPrototypeOf(o);
1459
+ };
1460
+ return _get_prototype_of(o);
1461
+ }
1462
+ function _inherits(subClass, superClass) {
1463
+ if (typeof superClass !== "function" && superClass !== null) {
1464
+ throw new TypeError("Super expression must either be null or a function");
1465
+ }
1466
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
1467
+ constructor: {
1468
+ value: subClass,
1469
+ writable: true,
1470
+ configurable: true
1471
+ }
1472
+ });
1473
+ if (superClass) _set_prototype_of(subClass, superClass);
1474
+ }
1475
+ function _iterable_to_array_limit(arr, i) {
1476
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1477
+ if (_i == null) return;
1478
+ var _arr = [];
1479
+ var _n = true;
1480
+ var _d = false;
1481
+ var _s, _e;
1482
+ try {
1483
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1484
+ _arr.push(_s.value);
1485
+ if (i && _arr.length === i) break;
1486
+ }
1487
+ } catch (err) {
1488
+ _d = true;
1489
+ _e = err;
1490
+ } finally{
1491
+ try {
1492
+ if (!_n && _i["return"] != null) _i["return"]();
1493
+ } finally{
1494
+ if (_d) throw _e;
1495
+ }
1496
+ }
1497
+ return _arr;
1498
+ }
1499
+ function _non_iterable_rest() {
1500
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1501
+ }
1502
+ function _possible_constructor_return(self, call) {
1503
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
1504
+ return call;
1505
+ }
1506
+ return _assert_this_initialized(self);
1507
+ }
1508
+ function _set_prototype_of(o, p) {
1509
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1510
+ o.__proto__ = p;
1511
+ return o;
1512
+ };
1513
+ return _set_prototype_of(o, p);
1514
+ }
1515
+ function _sliced_to_array(arr, i) {
1516
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
1517
+ }
1518
+ function _super_prop_base(object, property) {
1519
+ while(!Object.prototype.hasOwnProperty.call(object, property)){
1520
+ object = _get_prototype_of(object);
1521
+ if (object === null) break;
1522
+ }
1523
+ return object;
1524
+ }
1525
+ function _type_of(obj) {
1526
+ "@swc/helpers - typeof";
1527
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1528
+ }
1529
+ function _unsupported_iterable_to_array(o, minLen) {
1530
+ if (!o) return;
1531
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
1532
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1533
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1534
+ if (n === "Map" || n === "Set") return Array.from(n);
1535
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
1536
+ }
1537
+ function _is_native_reflect_construct() {
1538
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
1539
+ if (Reflect.construct.sham) return false;
1540
+ if (typeof Proxy === "function") return true;
1541
+ try {
1542
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1543
+ return true;
1544
+ } catch (e) {
1545
+ return false;
1546
+ }
1547
+ }
1548
+ function _create_super(Derived) {
1549
+ var hasNativeReflectConstruct = _is_native_reflect_construct();
1550
+ return function _createSuperInternal() {
1551
+ var Super = _get_prototype_of(Derived), result;
1552
+ if (hasNativeReflectConstruct) {
1553
+ var NewTarget = _get_prototype_of(this).constructor;
1554
+ result = Reflect.construct(Super, arguments, NewTarget);
1555
+ } else {
1556
+ result = Super.apply(this, arguments);
1557
+ }
1558
+ return _possible_constructor_return(this, result);
1559
+ };
1560
+ }
1561
+ function _ts_generator(thisArg, body) {
1562
+ var f, y, t, g, _ = {
1563
+ label: 0,
1564
+ sent: function() {
1565
+ if (t[0] & 1) throw t[1];
1566
+ return t[1];
1567
+ },
1568
+ trys: [],
1569
+ ops: []
1570
+ };
1571
+ return g = {
1572
+ next: verb(0),
1573
+ "throw": verb(1),
1574
+ "return": verb(2)
1575
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
1576
+ return this;
1577
+ }), g;
1578
+ function verb(n) {
1579
+ return function(v) {
1580
+ return step([
1581
+ n,
1582
+ v
1583
+ ]);
1584
+ };
1585
+ }
1586
+ function step(op) {
1587
+ if (f) throw new TypeError("Generator is already executing.");
1588
+ while(_)try {
1589
+ 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;
1590
+ if (y = 0, t) op = [
1591
+ op[0] & 2,
1592
+ t.value
1593
+ ];
1594
+ switch(op[0]){
1595
+ case 0:
1596
+ case 1:
1597
+ t = op;
1598
+ break;
1599
+ case 4:
1600
+ _.label++;
1601
+ return {
1602
+ value: op[1],
1603
+ done: false
1604
+ };
1605
+ case 5:
1606
+ _.label++;
1607
+ y = op[1];
1608
+ op = [
1609
+ 0
1610
+ ];
1611
+ continue;
1612
+ case 7:
1613
+ op = _.ops.pop();
1614
+ _.trys.pop();
1615
+ continue;
1616
+ default:
1617
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1618
+ _ = 0;
1619
+ continue;
1620
+ }
1621
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1622
+ _.label = op[1];
1623
+ break;
1624
+ }
1625
+ if (op[0] === 6 && _.label < t[1]) {
1626
+ _.label = t[1];
1627
+ t = op;
1628
+ break;
1629
+ }
1630
+ if (t && _.label < t[2]) {
1631
+ _.label = t[2];
1632
+ _.ops.push(op);
1633
+ break;
1634
+ }
1635
+ if (t[2]) _.ops.pop();
1636
+ _.trys.pop();
1637
+ continue;
1638
+ }
1639
+ op = body.call(thisArg, _);
1640
+ } catch (e) {
1641
+ op = [
1642
+ 6,
1643
+ e
1644
+ ];
1645
+ y = 0;
1646
+ } finally{
1647
+ f = t = 0;
1648
+ }
1649
+ if (op[0] & 5) throw op[1];
1650
+ return {
1651
+ value: op[0] ? op[1] : void 0,
1652
+ done: true
1653
+ };
1654
+ }
1655
+ }
1656
+ var AwsRestJsonProtocol = /*#__PURE__*/ function(HttpBindingProtocol) {
1657
+ _inherits(AwsRestJsonProtocol, HttpBindingProtocol);
1658
+ var _super = _create_super(AwsRestJsonProtocol);
1659
+ function AwsRestJsonProtocol(param) {
1660
+ var defaultNamespace = param.defaultNamespace;
1661
+ _class_call_check(this, AwsRestJsonProtocol);
1662
+ var _this;
1663
+ _this = _super.call(this, {
1664
+ defaultNamespace: defaultNamespace
1665
+ });
1666
+ _define_property(_assert_this_initialized(_this), "serializer", void 0);
1667
+ _define_property(_assert_this_initialized(_this), "deserializer", void 0);
1668
+ _define_property(_assert_this_initialized(_this), "codec", void 0);
1669
+ _define_property(_assert_this_initialized(_this), "mixin", new ProtocolLib());
1670
+ var settings = {
1671
+ timestampFormat: {
1672
+ useTrait: true,
1673
+ default: 7
1674
+ },
1675
+ httpBindings: true,
1676
+ jsonName: true
1677
+ };
1678
+ _this.codec = new JsonCodec(settings);
1679
+ _this.serializer = new HttpInterceptingShapeSerializer(_this.codec.createSerializer(), settings);
1680
+ _this.deserializer = new HttpInterceptingShapeDeserializer(_this.codec.createDeserializer(), settings);
1681
+ return _this;
1682
+ }
1683
+ _create_class(AwsRestJsonProtocol, [
1684
+ {
1685
+ key: "getShapeId",
1686
+ value: function getShapeId() {
1687
+ return "aws.protocols#restJson1";
1688
+ }
1689
+ },
1690
+ {
1691
+ key: "getPayloadCodec",
1692
+ value: function getPayloadCodec() {
1693
+ return this.codec;
1694
+ }
1695
+ },
1696
+ {
1697
+ key: "setSerdeContext",
1698
+ value: function setSerdeContext(serdeContext) {
1699
+ this.codec.setSerdeContext(serdeContext);
1700
+ _get(_get_prototype_of(AwsRestJsonProtocol.prototype), "setSerdeContext", this).call(this, serdeContext);
1701
+ }
1702
+ },
1703
+ {
1704
+ key: "serializeRequest",
1705
+ value: function serializeRequest(operationSchema, input, context) {
1706
+ var _this = this;
1707
+ var _this1 = this, _superprop_get_serializeRequest = function() {
1708
+ return _get(_get_prototype_of(AwsRestJsonProtocol.prototype), "serializeRequest", _this);
1709
+ };
1710
+ return _async_to_generator(function() {
1711
+ var request, inputSchema, contentType;
1712
+ return _ts_generator(this, function(_state) {
1713
+ switch(_state.label){
1714
+ case 0:
1715
+ return [
1716
+ 4,
1717
+ _superprop_get_serializeRequest().call(_this1, operationSchema, input, context)
1718
+ ];
1719
+ case 1:
1720
+ request = _state.sent();
1721
+ inputSchema = NormalizedSchema.of(operationSchema.input);
1722
+ if (!request.headers["content-type"]) {
1723
+ contentType = _this1.mixin.resolveRestContentType(_this1.getDefaultContentType(), inputSchema);
1724
+ if (contentType) {
1725
+ request.headers["content-type"] = contentType;
1726
+ }
1727
+ }
1728
+ if (request.body == null && request.headers["content-type"] === _this1.getDefaultContentType()) {
1729
+ request.body = "{}";
1730
+ }
1731
+ return [
1732
+ 2,
1733
+ request
1734
+ ];
1735
+ }
1736
+ });
1737
+ })();
1738
+ }
1739
+ },
1740
+ {
1741
+ key: "deserializeResponse",
1742
+ value: function deserializeResponse(operationSchema, context, response) {
1743
+ var _this = this;
1744
+ var _this1 = this, _superprop_get_deserializeResponse = function() {
1745
+ return _get(_get_prototype_of(AwsRestJsonProtocol.prototype), "deserializeResponse", _this);
1746
+ };
1747
+ return _async_to_generator(function() {
1748
+ var output, outputSchema, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, member;
1749
+ return _ts_generator(this, function(_state) {
1750
+ switch(_state.label){
1751
+ case 0:
1752
+ return [
1753
+ 4,
1754
+ _superprop_get_deserializeResponse().call(_this1, operationSchema, context, response)
1755
+ ];
1756
+ case 1:
1757
+ output = _state.sent();
1758
+ outputSchema = NormalizedSchema.of(operationSchema.output);
1759
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1760
+ try {
1761
+ for(_iterator = outputSchema.structIterator()[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1762
+ _step_value = _sliced_to_array(_step.value, 2), name = _step_value[0], member = _step_value[1];
1763
+ if (member.getMemberTraits().httpPayload && !(name in output)) {
1764
+ output[name] = null;
1765
+ }
1766
+ }
1767
+ } catch (err) {
1768
+ _didIteratorError = true;
1769
+ _iteratorError = err;
1770
+ } finally{
1771
+ try {
1772
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1773
+ _iterator.return();
1774
+ }
1775
+ } finally{
1776
+ if (_didIteratorError) {
1777
+ throw _iteratorError;
1778
+ }
1779
+ }
1780
+ }
1781
+ return [
1782
+ 2,
1783
+ output
1784
+ ];
1785
+ }
1786
+ });
1787
+ })();
1788
+ }
1789
+ },
1790
+ {
1791
+ key: "handleError",
1792
+ value: function handleError(operationSchema, context, response, dataObject, metadata) {
1793
+ var _this = this;
1794
+ return _async_to_generator(function() {
1795
+ 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;
1796
+ return _ts_generator(this, function(_state) {
1797
+ switch(_state.label){
1798
+ case 0:
1799
+ errorIdentifier = (_loadRestJsonErrorCode = loadRestJsonErrorCode(response, dataObject)) !== null && _loadRestJsonErrorCode !== void 0 ? _loadRestJsonErrorCode : "Unknown";
1800
+ return [
1801
+ 4,
1802
+ _this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, _this.options.defaultNamespace, response, dataObject, metadata)
1803
+ ];
1804
+ case 1:
1805
+ _ref = _state.sent(), errorSchema = _ref.errorSchema, errorMetadata = _ref.errorMetadata;
1806
+ ns = NormalizedSchema.of(errorSchema);
1807
+ message = (_ref1 = (_dataObject_message = dataObject.message) !== null && _dataObject_message !== void 0 ? _dataObject_message : dataObject.Message) !== null && _ref1 !== void 0 ? _ref1 : "Unknown";
1808
+ ErrorCtor = (_TypeRegistry_for_getErrorCtor = TypeRegistry.for(errorSchema[1]).getErrorCtor(errorSchema)) !== null && _TypeRegistry_for_getErrorCtor !== void 0 ? _TypeRegistry_for_getErrorCtor : Error;
1809
+ exception = new ErrorCtor(message);
1810
+ return [
1811
+ 4,
1812
+ _this.deserializeHttpMessage(errorSchema, context, response, dataObject)
1813
+ ];
1814
+ case 2:
1815
+ _state.sent();
1816
+ output = {};
1817
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1818
+ try {
1819
+ for(_iterator = ns.structIterator()[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1820
+ _step_value = _sliced_to_array(_step.value, 2), name = _step_value[0], member = _step_value[1];
1821
+ ;
1822
+ target = (_member_getMergedTraits_jsonName = member.getMergedTraits().jsonName) !== null && _member_getMergedTraits_jsonName !== void 0 ? _member_getMergedTraits_jsonName : name;
1823
+ output[name] = _this.codec.createDeserializer().readObject(member, dataObject[target]);
1824
+ }
1825
+ } catch (err) {
1826
+ _didIteratorError = true;
1827
+ _iteratorError = err;
1828
+ } finally{
1829
+ try {
1830
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1831
+ _iterator.return();
1832
+ }
1833
+ } finally{
1834
+ if (_didIteratorError) {
1835
+ throw _iteratorError;
1836
+ }
1837
+ }
1838
+ }
1839
+ throw _this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
1840
+ $fault: ns.getMergedTraits().error,
1841
+ message: message
1842
+ }, output), dataObject);
1843
+ }
1844
+ });
1845
+ })();
1846
+ }
1847
+ },
1848
+ {
1849
+ key: "getDefaultContentType",
1850
+ value: function getDefaultContentType() {
1851
+ return "application/json";
1852
+ }
1853
+ }
1854
+ ]);
1855
+ return AwsRestJsonProtocol;
1856
+ }(HttpBindingProtocol);
1857
+
1858
+ export { AwsRestJsonProtocol as A };