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