skill-tree 0.3.0 → 0.3.1

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