nowbackup 1.0.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/README.md +392 -0
- package/dist/bin.cjs +36571 -0
- package/dist/bin.js +53 -0
- package/dist/chunk-57ZU5VQ4.js +2994 -0
- package/dist/chunk-6QIWSQ6Y.js +574 -0
- package/dist/chunk-APZ4HNNC.js +1428 -0
- package/dist/chunk-BBB75FHV.js +11988 -0
- package/dist/chunk-FLLLYAHH.js +13 -0
- package/dist/chunk-KKIIHNPF.js +440 -0
- package/dist/chunk-LZQGIK32.js +1388 -0
- package/dist/chunk-SSPSJLWK.js +140 -0
- package/dist/chunk-T7W5F6M2.js +47 -0
- package/dist/chunk-V5IHRGZ2.js +12 -0
- package/dist/chunk-YMVDJI7O.js +3578 -0
- package/dist/chunk-ZHQB65KV.js +4726 -0
- package/dist/dist-es-3KJE4GI3.js +377 -0
- package/dist/dist-es-C4NCVBOK.js +21 -0
- package/dist/dist-es-FJYDFRNF.js +493 -0
- package/dist/dist-es-GOKCIKU2.js +319 -0
- package/dist/dist-es-GYBVDBEN.js +70 -0
- package/dist/dist-es-NQIG67M4.js +164 -0
- package/dist/dist-es-TJCQA2TA.js +89 -0
- package/dist/event-streams-CYRJEQX4.js +41 -0
- package/dist/index.cjs +36537 -0
- package/dist/index.js +15 -0
- package/dist/loadSso-S6XBGQED.js +548 -0
- package/dist/signin-YKKM2Q24.js +643 -0
- package/dist/sso-oidc-YLLTNKNX.js +783 -0
- package/dist/sts-WXTYIV32.js +1387 -0
- package/package.json +64 -0
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
import {
|
|
2
|
+
collectBodyString
|
|
3
|
+
} from "./chunk-FLLLYAHH.js";
|
|
4
|
+
import {
|
|
5
|
+
ProtocolLib,
|
|
6
|
+
SerdeContextConfig,
|
|
7
|
+
UnionSerde
|
|
8
|
+
} from "./chunk-57ZU5VQ4.js";
|
|
9
|
+
import {
|
|
10
|
+
HttpBindingProtocol,
|
|
11
|
+
HttpInterceptingShapeDeserializer,
|
|
12
|
+
HttpInterceptingShapeSerializer,
|
|
13
|
+
NormalizedSchema,
|
|
14
|
+
determineTimestampFormat
|
|
15
|
+
} from "./chunk-YMVDJI7O.js";
|
|
16
|
+
import {
|
|
17
|
+
LazyJsonString,
|
|
18
|
+
NumericValue,
|
|
19
|
+
dateToUtcString,
|
|
20
|
+
fromBase64,
|
|
21
|
+
generateIdempotencyToken,
|
|
22
|
+
parseEpochTimestamp,
|
|
23
|
+
parseRfc3339DateTimeWithOffset,
|
|
24
|
+
parseRfc7231DateTime,
|
|
25
|
+
toBase64
|
|
26
|
+
} from "./chunk-APZ4HNNC.js";
|
|
27
|
+
|
|
28
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js
|
|
29
|
+
function jsonReviver(key, value, context) {
|
|
30
|
+
if (context == null ? void 0 : context.source) {
|
|
31
|
+
const numericString = context.source;
|
|
32
|
+
if (typeof value === "number") {
|
|
33
|
+
if (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER || numericString !== String(value)) {
|
|
34
|
+
const isFractional = numericString.includes(".");
|
|
35
|
+
if (isFractional) {
|
|
36
|
+
return new NumericValue(numericString, "bigDecimal");
|
|
37
|
+
} else {
|
|
38
|
+
return BigInt(numericString);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js
|
|
47
|
+
var parseJsonBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
48
|
+
if (encoded.length) {
|
|
49
|
+
try {
|
|
50
|
+
return JSON.parse(encoded);
|
|
51
|
+
} catch (e) {
|
|
52
|
+
if ((e == null ? void 0 : e.name) === "SyntaxError") {
|
|
53
|
+
Object.defineProperty(e, "$responseBodyText", {
|
|
54
|
+
value: encoded
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
throw e;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return {};
|
|
61
|
+
});
|
|
62
|
+
var findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
63
|
+
var sanitizeErrorCode = (rawValue, removeNamespace = true) => {
|
|
64
|
+
let cleanValue = rawValue;
|
|
65
|
+
if (typeof cleanValue === "number") {
|
|
66
|
+
cleanValue = cleanValue.toString();
|
|
67
|
+
}
|
|
68
|
+
if (cleanValue.indexOf(",") >= 0) {
|
|
69
|
+
cleanValue = cleanValue.split(",")[0];
|
|
70
|
+
}
|
|
71
|
+
if (cleanValue.indexOf(":") >= 0) {
|
|
72
|
+
cleanValue = cleanValue.split(":")[0];
|
|
73
|
+
}
|
|
74
|
+
if (removeNamespace && cleanValue.indexOf("#") >= 0) {
|
|
75
|
+
cleanValue = cleanValue.split("#")[1];
|
|
76
|
+
}
|
|
77
|
+
return cleanValue;
|
|
78
|
+
};
|
|
79
|
+
var loadRestJsonErrorCode = (output, data) => {
|
|
80
|
+
return loadErrorCode(output, data, true, ["header", "code", "type"]);
|
|
81
|
+
};
|
|
82
|
+
var loadErrorCode = ({ headers }, data, removeNamespace, order) => {
|
|
83
|
+
while (order.length > 0) {
|
|
84
|
+
const location = order.shift();
|
|
85
|
+
switch (location) {
|
|
86
|
+
case "header":
|
|
87
|
+
const headerKey = findKey(headers ?? {}, "x-amzn-errortype");
|
|
88
|
+
if (headerKey !== void 0) {
|
|
89
|
+
return sanitizeErrorCode(headers[headerKey], removeNamespace);
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
case "code":
|
|
93
|
+
const codeKey = findKey(data ?? {}, "code");
|
|
94
|
+
if (codeKey && data[codeKey] !== void 0) {
|
|
95
|
+
return sanitizeErrorCode(data[codeKey], removeNamespace);
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
case "type":
|
|
99
|
+
if ((data == null ? void 0 : data.__type) !== void 0) {
|
|
100
|
+
return sanitizeErrorCode(data.__type, removeNamespace);
|
|
101
|
+
}
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js
|
|
108
|
+
var JsonShapeDeserializer = class extends SerdeContextConfig {
|
|
109
|
+
settings;
|
|
110
|
+
constructor(settings) {
|
|
111
|
+
super();
|
|
112
|
+
this.settings = settings;
|
|
113
|
+
}
|
|
114
|
+
async read(schema, data) {
|
|
115
|
+
return this._read(schema, typeof data === "string" ? JSON.parse(data, jsonReviver) : await parseJsonBody(data, this.serdeContext));
|
|
116
|
+
}
|
|
117
|
+
readObject(schema, data) {
|
|
118
|
+
return this._read(schema, data);
|
|
119
|
+
}
|
|
120
|
+
_read(schema, value) {
|
|
121
|
+
const isObject = value !== null && typeof value === "object";
|
|
122
|
+
const ns = NormalizedSchema.of(schema);
|
|
123
|
+
if (isObject) {
|
|
124
|
+
if (ns.isStructSchema()) {
|
|
125
|
+
const record = value;
|
|
126
|
+
const union = ns.isUnionSchema();
|
|
127
|
+
const out = {};
|
|
128
|
+
let nameMap = void 0;
|
|
129
|
+
const { jsonName } = this.settings;
|
|
130
|
+
if (jsonName) {
|
|
131
|
+
nameMap = {};
|
|
132
|
+
}
|
|
133
|
+
let unionSerde;
|
|
134
|
+
if (union) {
|
|
135
|
+
unionSerde = new UnionSerde(record, out);
|
|
136
|
+
}
|
|
137
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
138
|
+
let fromKey = memberName;
|
|
139
|
+
if (jsonName) {
|
|
140
|
+
fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
|
|
141
|
+
nameMap[fromKey] = memberName;
|
|
142
|
+
}
|
|
143
|
+
if (union) {
|
|
144
|
+
unionSerde.mark(fromKey);
|
|
145
|
+
}
|
|
146
|
+
if (record[fromKey] != null) {
|
|
147
|
+
out[memberName] = this._read(memberSchema, record[fromKey]);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (union) {
|
|
151
|
+
unionSerde.writeUnknown();
|
|
152
|
+
} else if (typeof record.__type === "string") {
|
|
153
|
+
for (const k in record) {
|
|
154
|
+
const v = record[k];
|
|
155
|
+
const t = jsonName ? nameMap[k] ?? k : k;
|
|
156
|
+
if (!(t in out)) {
|
|
157
|
+
out[t] = v;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return out;
|
|
162
|
+
}
|
|
163
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
164
|
+
const listMember = ns.getValueSchema();
|
|
165
|
+
const out = [];
|
|
166
|
+
for (const item of value) {
|
|
167
|
+
out.push(this._read(listMember, item));
|
|
168
|
+
}
|
|
169
|
+
return out;
|
|
170
|
+
}
|
|
171
|
+
if (ns.isMapSchema()) {
|
|
172
|
+
const mapMember = ns.getValueSchema();
|
|
173
|
+
const out = {};
|
|
174
|
+
for (const _k in value) {
|
|
175
|
+
out[_k] = this._read(mapMember, value[_k]);
|
|
176
|
+
}
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (ns.isBlobSchema() && typeof value === "string") {
|
|
181
|
+
return fromBase64(value);
|
|
182
|
+
}
|
|
183
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
|
184
|
+
if (ns.isStringSchema() && typeof value === "string" && mediaType) {
|
|
185
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
186
|
+
if (isJson) {
|
|
187
|
+
return LazyJsonString.from(value);
|
|
188
|
+
}
|
|
189
|
+
return value;
|
|
190
|
+
}
|
|
191
|
+
if (ns.isTimestampSchema() && value != null) {
|
|
192
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
193
|
+
switch (format) {
|
|
194
|
+
case 5:
|
|
195
|
+
return parseRfc3339DateTimeWithOffset(value);
|
|
196
|
+
case 6:
|
|
197
|
+
return parseRfc7231DateTime(value);
|
|
198
|
+
case 7:
|
|
199
|
+
return parseEpochTimestamp(value);
|
|
200
|
+
default:
|
|
201
|
+
console.warn("Missing timestamp format, parsing value with Date constructor:", value);
|
|
202
|
+
return new Date(value);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) {
|
|
206
|
+
return BigInt(value);
|
|
207
|
+
}
|
|
208
|
+
if (ns.isBigDecimalSchema() && value != void 0) {
|
|
209
|
+
if (value instanceof NumericValue) {
|
|
210
|
+
return value;
|
|
211
|
+
}
|
|
212
|
+
const untyped = value;
|
|
213
|
+
if (untyped.type === "bigDecimal" && "string" in untyped) {
|
|
214
|
+
return new NumericValue(untyped.string, untyped.type);
|
|
215
|
+
}
|
|
216
|
+
return new NumericValue(String(value), "bigDecimal");
|
|
217
|
+
}
|
|
218
|
+
if (ns.isNumericSchema() && typeof value === "string") {
|
|
219
|
+
switch (value) {
|
|
220
|
+
case "Infinity":
|
|
221
|
+
return Infinity;
|
|
222
|
+
case "-Infinity":
|
|
223
|
+
return -Infinity;
|
|
224
|
+
case "NaN":
|
|
225
|
+
return NaN;
|
|
226
|
+
}
|
|
227
|
+
return value;
|
|
228
|
+
}
|
|
229
|
+
if (ns.isDocumentSchema()) {
|
|
230
|
+
if (isObject) {
|
|
231
|
+
const out = Array.isArray(value) ? [] : {};
|
|
232
|
+
for (const k in value) {
|
|
233
|
+
const v = value[k];
|
|
234
|
+
if (v instanceof NumericValue) {
|
|
235
|
+
out[k] = v;
|
|
236
|
+
} else {
|
|
237
|
+
out[k] = this._read(ns, v);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return out;
|
|
241
|
+
} else {
|
|
242
|
+
return structuredClone(value);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return value;
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReplacer.js
|
|
250
|
+
var NUMERIC_CONTROL_CHAR = String.fromCharCode(925);
|
|
251
|
+
var JsonReplacer = class {
|
|
252
|
+
values = /* @__PURE__ */ new Map();
|
|
253
|
+
counter = 0;
|
|
254
|
+
stage = 0;
|
|
255
|
+
createReplacer() {
|
|
256
|
+
if (this.stage === 1) {
|
|
257
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");
|
|
258
|
+
}
|
|
259
|
+
if (this.stage === 2) {
|
|
260
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
|
|
261
|
+
}
|
|
262
|
+
this.stage = 1;
|
|
263
|
+
return (key, value) => {
|
|
264
|
+
if (value instanceof NumericValue) {
|
|
265
|
+
const v = `${NUMERIC_CONTROL_CHAR + "nv" + this.counter++}_` + value.string;
|
|
266
|
+
this.values.set(`"${v}"`, value.string);
|
|
267
|
+
return v;
|
|
268
|
+
}
|
|
269
|
+
if (typeof value === "bigint") {
|
|
270
|
+
const s = value.toString();
|
|
271
|
+
const v = `${NUMERIC_CONTROL_CHAR + "b" + this.counter++}_` + s;
|
|
272
|
+
this.values.set(`"${v}"`, s);
|
|
273
|
+
return v;
|
|
274
|
+
}
|
|
275
|
+
return value;
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
replaceInJson(json) {
|
|
279
|
+
if (this.stage === 0) {
|
|
280
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");
|
|
281
|
+
}
|
|
282
|
+
if (this.stage === 2) {
|
|
283
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
|
|
284
|
+
}
|
|
285
|
+
this.stage = 2;
|
|
286
|
+
if (this.counter === 0) {
|
|
287
|
+
return json;
|
|
288
|
+
}
|
|
289
|
+
for (const [key, value] of this.values) {
|
|
290
|
+
json = json.replace(key, value);
|
|
291
|
+
}
|
|
292
|
+
return json;
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js
|
|
297
|
+
var JsonShapeSerializer = class extends SerdeContextConfig {
|
|
298
|
+
settings;
|
|
299
|
+
buffer;
|
|
300
|
+
useReplacer = false;
|
|
301
|
+
rootSchema;
|
|
302
|
+
constructor(settings) {
|
|
303
|
+
super();
|
|
304
|
+
this.settings = settings;
|
|
305
|
+
}
|
|
306
|
+
write(schema, value) {
|
|
307
|
+
this.rootSchema = NormalizedSchema.of(schema);
|
|
308
|
+
this.buffer = this._write(this.rootSchema, value);
|
|
309
|
+
}
|
|
310
|
+
flush() {
|
|
311
|
+
const { rootSchema, useReplacer } = this;
|
|
312
|
+
this.rootSchema = void 0;
|
|
313
|
+
this.useReplacer = false;
|
|
314
|
+
if ((rootSchema == null ? void 0 : rootSchema.isStructSchema()) || (rootSchema == null ? void 0 : rootSchema.isDocumentSchema())) {
|
|
315
|
+
if (!useReplacer) {
|
|
316
|
+
return JSON.stringify(this.buffer);
|
|
317
|
+
}
|
|
318
|
+
const replacer = new JsonReplacer();
|
|
319
|
+
return replacer.replaceInJson(JSON.stringify(this.buffer, replacer.createReplacer(), 0));
|
|
320
|
+
}
|
|
321
|
+
return this.buffer;
|
|
322
|
+
}
|
|
323
|
+
writeDiscriminatedDocument(schema, value) {
|
|
324
|
+
this.write(schema, value);
|
|
325
|
+
if (typeof this.buffer === "object") {
|
|
326
|
+
this.buffer.__type = NormalizedSchema.of(schema).getName(true);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
_write(schema, value, container) {
|
|
330
|
+
var _a, _b;
|
|
331
|
+
const isObject = value !== null && typeof value === "object";
|
|
332
|
+
const ns = NormalizedSchema.of(schema);
|
|
333
|
+
if (isObject) {
|
|
334
|
+
if (ns.isStructSchema()) {
|
|
335
|
+
const record = value;
|
|
336
|
+
const out = {};
|
|
337
|
+
const { jsonName } = this.settings;
|
|
338
|
+
let nameMap = void 0;
|
|
339
|
+
if (jsonName) {
|
|
340
|
+
nameMap = {};
|
|
341
|
+
}
|
|
342
|
+
let outCount = 0;
|
|
343
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
344
|
+
const serializableValue = this._write(memberSchema, record[memberName], ns);
|
|
345
|
+
if (serializableValue !== void 0) {
|
|
346
|
+
let targetKey = memberName;
|
|
347
|
+
if (jsonName) {
|
|
348
|
+
targetKey = memberSchema.getMergedTraits().jsonName ?? memberName;
|
|
349
|
+
nameMap[memberName] = targetKey;
|
|
350
|
+
}
|
|
351
|
+
out[targetKey] = serializableValue;
|
|
352
|
+
outCount++;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
if (ns.isUnionSchema() && outCount === 0) {
|
|
356
|
+
const { $unknown } = record;
|
|
357
|
+
if (Array.isArray($unknown)) {
|
|
358
|
+
const [k, v] = $unknown;
|
|
359
|
+
out[k] = this._write(15, v);
|
|
360
|
+
}
|
|
361
|
+
} else if (typeof record.__type === "string") {
|
|
362
|
+
for (const k in record) {
|
|
363
|
+
const v = record[k];
|
|
364
|
+
const targetKey = jsonName ? nameMap[k] ?? k : k;
|
|
365
|
+
if (!(targetKey in out)) {
|
|
366
|
+
out[targetKey] = this._write(15, v);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return out;
|
|
371
|
+
}
|
|
372
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
373
|
+
const listMember = ns.getValueSchema();
|
|
374
|
+
const out = [];
|
|
375
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
376
|
+
for (const item of value) {
|
|
377
|
+
if (sparse || item != null) {
|
|
378
|
+
out.push(this._write(listMember, item));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return out;
|
|
382
|
+
}
|
|
383
|
+
if (ns.isMapSchema()) {
|
|
384
|
+
const mapMember = ns.getValueSchema();
|
|
385
|
+
const out = {};
|
|
386
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
387
|
+
for (const _k in value) {
|
|
388
|
+
const _v = value[_k];
|
|
389
|
+
if (sparse || _v != null) {
|
|
390
|
+
out[_k] = this._write(mapMember, _v);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return out;
|
|
394
|
+
}
|
|
395
|
+
if (value instanceof Uint8Array && (ns.isBlobSchema() || ns.isDocumentSchema())) {
|
|
396
|
+
if (ns === this.rootSchema) {
|
|
397
|
+
return value;
|
|
398
|
+
}
|
|
399
|
+
return (((_a = this.serdeContext) == null ? void 0 : _a.base64Encoder) ?? toBase64)(value);
|
|
400
|
+
}
|
|
401
|
+
if (value instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
|
|
402
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
403
|
+
switch (format) {
|
|
404
|
+
case 5:
|
|
405
|
+
return value.toISOString().replace(".000Z", "Z");
|
|
406
|
+
case 6:
|
|
407
|
+
return dateToUtcString(value);
|
|
408
|
+
case 7:
|
|
409
|
+
return value.getTime() / 1e3;
|
|
410
|
+
default:
|
|
411
|
+
console.warn("Missing timestamp format, using epoch seconds", value);
|
|
412
|
+
return value.getTime() / 1e3;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
if (value instanceof NumericValue) {
|
|
416
|
+
this.useReplacer = true;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (value === null && (container == null ? void 0 : container.isStructSchema())) {
|
|
420
|
+
return void 0;
|
|
421
|
+
}
|
|
422
|
+
if (ns.isStringSchema()) {
|
|
423
|
+
if (typeof value === "undefined" && ns.isIdempotencyToken()) {
|
|
424
|
+
return generateIdempotencyToken();
|
|
425
|
+
}
|
|
426
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
|
427
|
+
if (value != null && mediaType) {
|
|
428
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
429
|
+
if (isJson) {
|
|
430
|
+
return LazyJsonString.from(value);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return value;
|
|
434
|
+
}
|
|
435
|
+
if (typeof value === "number" && ns.isNumericSchema()) {
|
|
436
|
+
if (Math.abs(value) === Infinity || isNaN(value)) {
|
|
437
|
+
return String(value);
|
|
438
|
+
}
|
|
439
|
+
return value;
|
|
440
|
+
}
|
|
441
|
+
if (typeof value === "string" && ns.isBlobSchema()) {
|
|
442
|
+
if (ns === this.rootSchema) {
|
|
443
|
+
return value;
|
|
444
|
+
}
|
|
445
|
+
return (((_b = this.serdeContext) == null ? void 0 : _b.base64Encoder) ?? toBase64)(value);
|
|
446
|
+
}
|
|
447
|
+
if (typeof value === "bigint") {
|
|
448
|
+
this.useReplacer = true;
|
|
449
|
+
}
|
|
450
|
+
if (ns.isDocumentSchema()) {
|
|
451
|
+
if (isObject) {
|
|
452
|
+
const out = Array.isArray(value) ? [] : {};
|
|
453
|
+
for (const k in value) {
|
|
454
|
+
const v = value[k];
|
|
455
|
+
if (v instanceof NumericValue) {
|
|
456
|
+
this.useReplacer = true;
|
|
457
|
+
out[k] = v;
|
|
458
|
+
} else {
|
|
459
|
+
out[k] = this._write(ns, v);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return out;
|
|
463
|
+
} else {
|
|
464
|
+
return structuredClone(value);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return value;
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonCodec.js
|
|
472
|
+
var JsonCodec = class extends SerdeContextConfig {
|
|
473
|
+
settings;
|
|
474
|
+
constructor(settings) {
|
|
475
|
+
super();
|
|
476
|
+
this.settings = settings;
|
|
477
|
+
}
|
|
478
|
+
createSerializer() {
|
|
479
|
+
const serializer = new JsonShapeSerializer(this.settings);
|
|
480
|
+
serializer.setSerdeContext(this.serdeContext);
|
|
481
|
+
return serializer;
|
|
482
|
+
}
|
|
483
|
+
createDeserializer() {
|
|
484
|
+
const deserializer = new JsonShapeDeserializer(this.settings);
|
|
485
|
+
deserializer.setSerdeContext(this.serdeContext);
|
|
486
|
+
return deserializer;
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js
|
|
491
|
+
var AwsRestJsonProtocol = class extends HttpBindingProtocol {
|
|
492
|
+
serializer;
|
|
493
|
+
deserializer;
|
|
494
|
+
codec;
|
|
495
|
+
mixin = new ProtocolLib();
|
|
496
|
+
constructor({ defaultNamespace, errorTypeRegistries }) {
|
|
497
|
+
super({
|
|
498
|
+
defaultNamespace,
|
|
499
|
+
errorTypeRegistries
|
|
500
|
+
});
|
|
501
|
+
const settings = {
|
|
502
|
+
timestampFormat: {
|
|
503
|
+
useTrait: true,
|
|
504
|
+
default: 7
|
|
505
|
+
},
|
|
506
|
+
httpBindings: true,
|
|
507
|
+
jsonName: true
|
|
508
|
+
};
|
|
509
|
+
this.codec = new JsonCodec(settings);
|
|
510
|
+
this.serializer = new HttpInterceptingShapeSerializer(this.codec.createSerializer(), settings);
|
|
511
|
+
this.deserializer = new HttpInterceptingShapeDeserializer(this.codec.createDeserializer(), settings);
|
|
512
|
+
}
|
|
513
|
+
getShapeId() {
|
|
514
|
+
return "aws.protocols#restJson1";
|
|
515
|
+
}
|
|
516
|
+
getPayloadCodec() {
|
|
517
|
+
return this.codec;
|
|
518
|
+
}
|
|
519
|
+
setSerdeContext(serdeContext) {
|
|
520
|
+
this.codec.setSerdeContext(serdeContext);
|
|
521
|
+
super.setSerdeContext(serdeContext);
|
|
522
|
+
}
|
|
523
|
+
async serializeRequest(operationSchema, input, context) {
|
|
524
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
525
|
+
const inputSchema = NormalizedSchema.of(operationSchema.input);
|
|
526
|
+
if (!request.headers["content-type"]) {
|
|
527
|
+
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema);
|
|
528
|
+
if (contentType) {
|
|
529
|
+
request.headers["content-type"] = contentType;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
if (request.body == null && request.headers["content-type"] === this.getDefaultContentType()) {
|
|
533
|
+
request.body = "{}";
|
|
534
|
+
}
|
|
535
|
+
return request;
|
|
536
|
+
}
|
|
537
|
+
async deserializeResponse(operationSchema, context, response) {
|
|
538
|
+
const output = await super.deserializeResponse(operationSchema, context, response);
|
|
539
|
+
const outputSchema = NormalizedSchema.of(operationSchema.output);
|
|
540
|
+
for (const [name, member] of outputSchema.structIterator()) {
|
|
541
|
+
if (member.getMemberTraits().httpPayload && !(name in output)) {
|
|
542
|
+
output[name] = null;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
return output;
|
|
546
|
+
}
|
|
547
|
+
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
548
|
+
const errorIdentifier = loadRestJsonErrorCode(response, dataObject) ?? "Unknown";
|
|
549
|
+
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
550
|
+
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, dataObject, metadata);
|
|
551
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
552
|
+
const message = dataObject.message ?? dataObject.Message ?? "UnknownError";
|
|
553
|
+
const ErrorCtor = this.compositeErrorRegistry.getErrorCtor(errorSchema) ?? Error;
|
|
554
|
+
const exception = new ErrorCtor({});
|
|
555
|
+
await this.deserializeHttpMessage(errorSchema, context, response, dataObject);
|
|
556
|
+
const output = {};
|
|
557
|
+
const errorDeserializer = this.codec.createDeserializer();
|
|
558
|
+
for (const [name, member] of ns.structIterator()) {
|
|
559
|
+
const target = member.getMergedTraits().jsonName ?? name;
|
|
560
|
+
output[name] = errorDeserializer.readObject(member, dataObject[target]);
|
|
561
|
+
}
|
|
562
|
+
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
|
|
563
|
+
$fault: ns.getMergedTraits().error,
|
|
564
|
+
message
|
|
565
|
+
}, output), dataObject);
|
|
566
|
+
}
|
|
567
|
+
getDefaultContentType() {
|
|
568
|
+
return "application/json";
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
export {
|
|
573
|
+
AwsRestJsonProtocol
|
|
574
|
+
};
|