@semiont/graph 0.5.9 → 0.5.10
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/{chunk-GT55OYHJ.js → chunk-2UFYZAZA.js} +2 -2
- package/dist/chunk-2UFYZAZA.js.map +1 -0
- package/dist/chunk-GXSQEW4F.js +694 -0
- package/dist/chunk-GXSQEW4F.js.map +1 -0
- package/dist/{chunk-6TGQEJA4.js → chunk-HQ3XLO52.js} +3 -3
- package/dist/{chunk-6TGQEJA4.js.map → chunk-HQ3XLO52.js.map} +1 -1
- package/dist/{chunk-XVAXFDCH.js → chunk-MTWDPBDH.js} +2 -2
- package/dist/{chunk-5I735PFE.js → chunk-USQJFUZP.js} +2 -2
- package/dist/{chunk-VAQKCHGM.js → chunk-WVFBW2BJ.js} +2 -2
- package/dist/{dist-es-VCGRE52I.js → dist-es-F3ITMM62.js} +2 -2
- package/dist/{dist-es-O4WJLVW6.js → dist-es-HQN7ECGH.js} +3 -3
- package/dist/{dist-es-IYLVRDN3.js → dist-es-PIT4UOVB.js} +5 -5
- package/dist/{dist-es-LTFG4B4M.js → dist-es-RHZZGTBH.js} +2 -2
- package/dist/{dist-es-BICV5PRG.js → dist-es-RKGSX75L.js} +14 -14
- package/dist/{dist-es-BICV5PRG.js.map → dist-es-RKGSX75L.js.map} +1 -1
- package/dist/{dist-es-UN7O5Q4Y.js → dist-es-T7UQEVTL.js} +3 -3
- package/dist/{dist-es-RW76EFCY.js → dist-es-ZEE6WCCG.js} +9 -9
- package/dist/index.js +1 -1
- package/dist/{loadSso-GUTPMZHZ.js → loadSso-GG2G7R6K.js} +5 -5
- package/dist/{signin-HRP5GJ43.js → signin-W2DUKDEU.js} +5 -5
- package/dist/{sso-oidc-HISAR7RH.js → sso-oidc-QMDDOWYK.js} +5 -5
- package/dist/{sts-IK55KWBZ.js → sts-3APBVT3H.js} +5 -5
- package/package.json +5 -5
- package/dist/chunk-CRYMBICT.js +0 -5143
- package/dist/chunk-CRYMBICT.js.map +0 -1
- package/dist/chunk-GT55OYHJ.js.map +0 -1
- /package/dist/{chunk-XVAXFDCH.js.map → chunk-MTWDPBDH.js.map} +0 -0
- /package/dist/{chunk-5I735PFE.js.map → chunk-USQJFUZP.js.map} +0 -0
- /package/dist/{chunk-VAQKCHGM.js.map → chunk-WVFBW2BJ.js.map} +0 -0
- /package/dist/{dist-es-VCGRE52I.js.map → dist-es-F3ITMM62.js.map} +0 -0
- /package/dist/{dist-es-O4WJLVW6.js.map → dist-es-HQN7ECGH.js.map} +0 -0
- /package/dist/{dist-es-IYLVRDN3.js.map → dist-es-PIT4UOVB.js.map} +0 -0
- /package/dist/{dist-es-LTFG4B4M.js.map → dist-es-RHZZGTBH.js.map} +0 -0
- /package/dist/{dist-es-UN7O5Q4Y.js.map → dist-es-T7UQEVTL.js.map} +0 -0
- /package/dist/{dist-es-RW76EFCY.js.map → dist-es-ZEE6WCCG.js.map} +0 -0
- /package/dist/{loadSso-GUTPMZHZ.js.map → loadSso-GG2G7R6K.js.map} +0 -0
- /package/dist/{signin-HRP5GJ43.js.map → signin-W2DUKDEU.js.map} +0 -0
- /package/dist/{sso-oidc-HISAR7RH.js.map → sso-oidc-QMDDOWYK.js.map} +0 -0
- /package/dist/{sts-IK55KWBZ.js.map → sts-3APBVT3H.js.map} +0 -0
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ProtocolLib,
|
|
3
|
+
SerdeContextConfig,
|
|
4
|
+
UnionSerde
|
|
5
|
+
} from "./chunk-USQJFUZP.js";
|
|
6
|
+
import {
|
|
7
|
+
getValueFromTextNode
|
|
8
|
+
} from "./chunk-2UFYZAZA.js";
|
|
9
|
+
import {
|
|
10
|
+
FromStringShapeDeserializer,
|
|
11
|
+
NormalizedSchema,
|
|
12
|
+
RpcProtocol,
|
|
13
|
+
collectBody,
|
|
14
|
+
deref,
|
|
15
|
+
determineTimestampFormat,
|
|
16
|
+
extendedEncodeURIComponent
|
|
17
|
+
} from "./chunk-7UEKNJE3.js";
|
|
18
|
+
import {
|
|
19
|
+
NumericValue,
|
|
20
|
+
dateToUtcString,
|
|
21
|
+
generateIdempotencyToken,
|
|
22
|
+
toBase64,
|
|
23
|
+
toUtf8
|
|
24
|
+
} from "./chunk-DCLCNCC5.js";
|
|
25
|
+
|
|
26
|
+
// ../../node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js
|
|
27
|
+
function parseXML(xml) {
|
|
28
|
+
const state = new AwsXmlParser(xml);
|
|
29
|
+
return state.parse();
|
|
30
|
+
}
|
|
31
|
+
var AwsXmlParser = class _AwsXmlParser {
|
|
32
|
+
x;
|
|
33
|
+
i = 0;
|
|
34
|
+
z;
|
|
35
|
+
constructor(x) {
|
|
36
|
+
this.x = x;
|
|
37
|
+
this.x = x.replace(/\r\n?/g, "\n");
|
|
38
|
+
this.z = this.x.length;
|
|
39
|
+
}
|
|
40
|
+
parse() {
|
|
41
|
+
const p = this;
|
|
42
|
+
const { z } = p;
|
|
43
|
+
while (p.i < z) {
|
|
44
|
+
p.trim();
|
|
45
|
+
if (p.i >= z) {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
if (p.isNext("<?")) {
|
|
49
|
+
p.readTo("?>");
|
|
50
|
+
p.trim();
|
|
51
|
+
} else if (p.isNext("<!--")) {
|
|
52
|
+
p.readTo("-->");
|
|
53
|
+
p.trim();
|
|
54
|
+
} else if (p.isNext("<!DOCTYPE", false)) {
|
|
55
|
+
p.skipDoctype();
|
|
56
|
+
p.trim();
|
|
57
|
+
} else if (p.x[p.i] === "<") {
|
|
58
|
+
const root = p.parseTag();
|
|
59
|
+
return { [root.tag]: root.value };
|
|
60
|
+
} else {
|
|
61
|
+
throw new Error("@aws-sdk XML parse error: unexpected content.");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
throw new Error("@aws-sdk XML parse error: no root element.");
|
|
65
|
+
}
|
|
66
|
+
isNext(s, caseSensitive = true) {
|
|
67
|
+
const p = this;
|
|
68
|
+
if (caseSensitive) {
|
|
69
|
+
return p.x.startsWith(s, p.i);
|
|
70
|
+
}
|
|
71
|
+
return p.x.toLowerCase().startsWith(s.toLowerCase(), p.i);
|
|
72
|
+
}
|
|
73
|
+
readTo(stop) {
|
|
74
|
+
const p = this;
|
|
75
|
+
const _i = p.x.indexOf(stop, p.i);
|
|
76
|
+
if (_i === -1) {
|
|
77
|
+
throw new Error(`@aws-sdk XML parse error: expected "${stop}" not found.`);
|
|
78
|
+
}
|
|
79
|
+
const result = p.x.slice(p.i, _i);
|
|
80
|
+
p.i = _i + stop.length;
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
trim() {
|
|
84
|
+
const p = this;
|
|
85
|
+
while (p.i < p.z && " \r\n".includes(p.x[p.i])) {
|
|
86
|
+
++p.i;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
readAttrValue() {
|
|
90
|
+
const p = this;
|
|
91
|
+
const quote = p.x[p.i];
|
|
92
|
+
++p.i;
|
|
93
|
+
let value = "";
|
|
94
|
+
while (p.i < p.z && p.x[p.i] !== quote) {
|
|
95
|
+
value += p.x[p.i++];
|
|
96
|
+
}
|
|
97
|
+
++p.i;
|
|
98
|
+
return p.decodeEntities(value);
|
|
99
|
+
}
|
|
100
|
+
parseTag() {
|
|
101
|
+
const p = this;
|
|
102
|
+
++p.i;
|
|
103
|
+
let tag = "";
|
|
104
|
+
while (p.i < p.z && !" \r\n>/".includes(p.x[p.i])) {
|
|
105
|
+
tag += p.x[p.i++];
|
|
106
|
+
}
|
|
107
|
+
let hasAttrs = false;
|
|
108
|
+
const attrs = /* @__PURE__ */ Object.create(null);
|
|
109
|
+
while (p.i < p.z) {
|
|
110
|
+
p.trim();
|
|
111
|
+
if (">/".includes(p.x[p.i])) {
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
let name = "";
|
|
115
|
+
while (p.i < p.z && !"= \r\n>/?".includes(p.x[p.i])) {
|
|
116
|
+
name += p.x[p.i++];
|
|
117
|
+
}
|
|
118
|
+
p.trim();
|
|
119
|
+
if (p.x[p.i] !== "=") {
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
++p.i;
|
|
123
|
+
p.trim();
|
|
124
|
+
attrs[name] = p.readAttrValue();
|
|
125
|
+
hasAttrs = true;
|
|
126
|
+
}
|
|
127
|
+
if (p.i >= p.z) {
|
|
128
|
+
throw new Error("@aws-sdk XML parse error: unexpected end of input.");
|
|
129
|
+
}
|
|
130
|
+
if (p.x[p.i] === "/") {
|
|
131
|
+
++p.i;
|
|
132
|
+
if (p.i >= p.z || p.x[p.i] !== ">") {
|
|
133
|
+
throw new Error("@aws-sdk XML parse error: expected > at the end of self-closing tag.");
|
|
134
|
+
}
|
|
135
|
+
++p.i;
|
|
136
|
+
Object.setPrototypeOf(attrs, Object.prototype);
|
|
137
|
+
return { tag, value: hasAttrs ? attrs : "" };
|
|
138
|
+
}
|
|
139
|
+
if (p.x[p.i] !== ">") {
|
|
140
|
+
throw new Error("@aws-sdk XML parse error: expected > at the end of opening tag.");
|
|
141
|
+
}
|
|
142
|
+
++p.i;
|
|
143
|
+
const textParts = [];
|
|
144
|
+
const childTags = [];
|
|
145
|
+
let hasElementChild = false;
|
|
146
|
+
while (p.i < p.z) {
|
|
147
|
+
if (p.isNext("</")) {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
if (p.x[p.i] === "<") {
|
|
151
|
+
if (p.isNext("<!--")) {
|
|
152
|
+
p.readTo("-->");
|
|
153
|
+
} else if (p.isNext("<![CDATA[")) {
|
|
154
|
+
p.i += 9;
|
|
155
|
+
textParts.push(p.readTo("]]>"));
|
|
156
|
+
} else if (p.isNext("<?")) {
|
|
157
|
+
p.readTo("?>");
|
|
158
|
+
} else {
|
|
159
|
+
hasElementChild = true;
|
|
160
|
+
childTags.push(p.parseTag());
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
let text = "";
|
|
164
|
+
while (p.i < p.z && p.x[p.i] !== "<") {
|
|
165
|
+
text += p.x[p.i++];
|
|
166
|
+
}
|
|
167
|
+
textParts.push(p.decodeEntities(text));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (!p.isNext("</")) {
|
|
171
|
+
throw new Error(`@aws-sdk XML parse error: missing closing tag </${tag}>.`);
|
|
172
|
+
}
|
|
173
|
+
p.i += 2;
|
|
174
|
+
const closeTag = p.readTo(">").trim();
|
|
175
|
+
if (closeTag !== tag) {
|
|
176
|
+
throw new Error(`@aws-sdk XML parse error: mismatched tags <${tag}> and </${closeTag}>.`);
|
|
177
|
+
}
|
|
178
|
+
if (!hasAttrs && textParts.length === 0 && !hasElementChild) {
|
|
179
|
+
return { tag, value: "" };
|
|
180
|
+
}
|
|
181
|
+
if (!hasAttrs && !hasElementChild) {
|
|
182
|
+
const text = textParts.length === 1 ? textParts[0] : textParts.join("");
|
|
183
|
+
if (text.trim() === "" && text.includes("\n")) {
|
|
184
|
+
return { tag, value: "" };
|
|
185
|
+
}
|
|
186
|
+
return { tag, value: text };
|
|
187
|
+
}
|
|
188
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
189
|
+
for (const text of textParts) {
|
|
190
|
+
if (text.trim() === "" && text.includes("\n")) {
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
obj["#text"] = "#text" in obj ? obj["#text"] + text : text;
|
|
194
|
+
}
|
|
195
|
+
for (const child of childTags) {
|
|
196
|
+
if (child.tag in obj) {
|
|
197
|
+
if (Array.isArray(obj[child.tag])) {
|
|
198
|
+
obj[child.tag].push(child.value);
|
|
199
|
+
} else {
|
|
200
|
+
obj[child.tag] = [obj[child.tag], child.value];
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
obj[child.tag] = child.value;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
for (const [k, v] of Object.entries(attrs)) {
|
|
207
|
+
obj[k] = v;
|
|
208
|
+
}
|
|
209
|
+
Object.setPrototypeOf(obj, Object.prototype);
|
|
210
|
+
return { tag, value: obj };
|
|
211
|
+
}
|
|
212
|
+
static ENTITIES = {
|
|
213
|
+
amp: "&",
|
|
214
|
+
lt: "<",
|
|
215
|
+
gt: ">",
|
|
216
|
+
quot: '"',
|
|
217
|
+
apos: "'"
|
|
218
|
+
};
|
|
219
|
+
skipDoctype() {
|
|
220
|
+
const p = this;
|
|
221
|
+
p.i += 9;
|
|
222
|
+
let depth = 0;
|
|
223
|
+
while (p.i < p.z) {
|
|
224
|
+
const c = p.x[p.i];
|
|
225
|
+
if (c === "[") {
|
|
226
|
+
++depth;
|
|
227
|
+
} else if (c === "]") {
|
|
228
|
+
--depth;
|
|
229
|
+
} else if (c === ">" && depth === 0) {
|
|
230
|
+
++p.i;
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
++p.i;
|
|
234
|
+
}
|
|
235
|
+
throw new Error("@aws-sdk XML parse error: unclosed DOCTYPE.");
|
|
236
|
+
}
|
|
237
|
+
decodeEntities(s) {
|
|
238
|
+
return s.replace(/&(?:#x([0-9a-fA-F]{1,6})|#(\d{1,7})|([a-zA-Z][a-zA-Z0-9]{0,30}));/g, (_, hex, dec, named) => {
|
|
239
|
+
if (hex) {
|
|
240
|
+
return String.fromCharCode(parseInt(hex, 16));
|
|
241
|
+
}
|
|
242
|
+
if (dec) {
|
|
243
|
+
return String.fromCharCode(parseInt(dec, 10));
|
|
244
|
+
}
|
|
245
|
+
return _AwsXmlParser.ENTITIES[named] ?? "";
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeDeserializer.js
|
|
251
|
+
var XmlShapeDeserializer = class extends SerdeContextConfig {
|
|
252
|
+
settings;
|
|
253
|
+
stringDeserializer;
|
|
254
|
+
constructor(settings) {
|
|
255
|
+
super();
|
|
256
|
+
this.settings = settings;
|
|
257
|
+
this.stringDeserializer = new FromStringShapeDeserializer(settings);
|
|
258
|
+
}
|
|
259
|
+
setSerdeContext(serdeContext) {
|
|
260
|
+
this.serdeContext = serdeContext;
|
|
261
|
+
this.stringDeserializer.setSerdeContext(serdeContext);
|
|
262
|
+
}
|
|
263
|
+
read(schema, bytes, key) {
|
|
264
|
+
const ns = NormalizedSchema.of(schema);
|
|
265
|
+
const memberSchemas = ns.getMemberSchemas();
|
|
266
|
+
const isEventPayload = ns.isStructSchema() && ns.isMemberSchema() && !!Object.values(memberSchemas).find((memberNs) => {
|
|
267
|
+
return !!memberNs.getMemberTraits().eventPayload;
|
|
268
|
+
});
|
|
269
|
+
if (isEventPayload) {
|
|
270
|
+
const output = {};
|
|
271
|
+
const memberName = Object.keys(memberSchemas)[0];
|
|
272
|
+
const eventMemberSchema = memberSchemas[memberName];
|
|
273
|
+
if (eventMemberSchema.isBlobSchema()) {
|
|
274
|
+
output[memberName] = bytes;
|
|
275
|
+
} else {
|
|
276
|
+
output[memberName] = this.read(memberSchemas[memberName], bytes);
|
|
277
|
+
}
|
|
278
|
+
return output;
|
|
279
|
+
}
|
|
280
|
+
const xmlString = (this.serdeContext?.utf8Encoder ?? toUtf8)(bytes);
|
|
281
|
+
const parsedObject = this.parseXml(xmlString);
|
|
282
|
+
return this.readSchema(schema, key ? parsedObject[key] : parsedObject);
|
|
283
|
+
}
|
|
284
|
+
readSchema(_schema, value) {
|
|
285
|
+
const ns = NormalizedSchema.of(_schema);
|
|
286
|
+
if (ns.isUnitSchema()) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
const traits = ns.getMergedTraits();
|
|
290
|
+
if (ns.isListSchema() && !Array.isArray(value)) {
|
|
291
|
+
return this.readSchema(ns, [value]);
|
|
292
|
+
}
|
|
293
|
+
if (value == null) {
|
|
294
|
+
return value;
|
|
295
|
+
}
|
|
296
|
+
if (typeof value === "object") {
|
|
297
|
+
const flat = !!traits.xmlFlattened;
|
|
298
|
+
if (ns.isListSchema()) {
|
|
299
|
+
const listValue = ns.getValueSchema();
|
|
300
|
+
const buffer2 = [];
|
|
301
|
+
const sourceKey = listValue.getMergedTraits().xmlName ?? "member";
|
|
302
|
+
const source = flat ? value : (value[0] ?? value)[sourceKey];
|
|
303
|
+
if (source == null) {
|
|
304
|
+
return buffer2;
|
|
305
|
+
}
|
|
306
|
+
const sourceArray = Array.isArray(source) ? source : [source];
|
|
307
|
+
for (const v of sourceArray) {
|
|
308
|
+
buffer2.push(this.readSchema(listValue, v));
|
|
309
|
+
}
|
|
310
|
+
return buffer2;
|
|
311
|
+
}
|
|
312
|
+
const buffer = {};
|
|
313
|
+
if (ns.isMapSchema()) {
|
|
314
|
+
const keyNs = ns.getKeySchema();
|
|
315
|
+
const memberNs = ns.getValueSchema();
|
|
316
|
+
let entries;
|
|
317
|
+
if (flat) {
|
|
318
|
+
entries = Array.isArray(value) ? value : [value];
|
|
319
|
+
} else {
|
|
320
|
+
entries = Array.isArray(value.entry) ? value.entry : [value.entry];
|
|
321
|
+
}
|
|
322
|
+
const keyProperty = keyNs.getMergedTraits().xmlName ?? "key";
|
|
323
|
+
const valueProperty = memberNs.getMergedTraits().xmlName ?? "value";
|
|
324
|
+
for (const entry of entries) {
|
|
325
|
+
const key = entry[keyProperty];
|
|
326
|
+
const value2 = entry[valueProperty];
|
|
327
|
+
buffer[key] = this.readSchema(memberNs, value2);
|
|
328
|
+
}
|
|
329
|
+
return buffer;
|
|
330
|
+
}
|
|
331
|
+
if (ns.isStructSchema()) {
|
|
332
|
+
const union = ns.isUnionSchema();
|
|
333
|
+
let unionSerde;
|
|
334
|
+
if (union) {
|
|
335
|
+
unionSerde = new UnionSerde(value, buffer);
|
|
336
|
+
}
|
|
337
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
338
|
+
const memberTraits = memberSchema.getMergedTraits();
|
|
339
|
+
const xmlObjectKey = !memberTraits.httpPayload ? memberSchema.getMemberTraits().xmlName ?? memberName : memberTraits.xmlName ?? memberSchema.getName();
|
|
340
|
+
if (union) {
|
|
341
|
+
unionSerde.mark(xmlObjectKey);
|
|
342
|
+
}
|
|
343
|
+
if (value[xmlObjectKey] != null) {
|
|
344
|
+
buffer[memberName] = this.readSchema(memberSchema, value[xmlObjectKey]);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
if (union) {
|
|
348
|
+
unionSerde.writeUnknown();
|
|
349
|
+
}
|
|
350
|
+
return buffer;
|
|
351
|
+
}
|
|
352
|
+
if (ns.isDocumentSchema()) {
|
|
353
|
+
return value;
|
|
354
|
+
}
|
|
355
|
+
throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${ns.getName(true)}`);
|
|
356
|
+
}
|
|
357
|
+
if (ns.isListSchema()) {
|
|
358
|
+
return [];
|
|
359
|
+
}
|
|
360
|
+
if (ns.isMapSchema() || ns.isStructSchema()) {
|
|
361
|
+
return {};
|
|
362
|
+
}
|
|
363
|
+
return this.stringDeserializer.read(ns, value);
|
|
364
|
+
}
|
|
365
|
+
parseXml(xml) {
|
|
366
|
+
if (xml.length) {
|
|
367
|
+
let parsedObj;
|
|
368
|
+
try {
|
|
369
|
+
parsedObj = parseXML(xml);
|
|
370
|
+
} catch (e) {
|
|
371
|
+
if (e && typeof e === "object") {
|
|
372
|
+
Object.defineProperty(e, "$responseBodyText", {
|
|
373
|
+
value: xml
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
throw e;
|
|
377
|
+
}
|
|
378
|
+
const textNodeName = "#text";
|
|
379
|
+
const key = Object.keys(parsedObj)[0];
|
|
380
|
+
const parsedObjToReturn = parsedObj[key];
|
|
381
|
+
if (parsedObjToReturn[textNodeName]) {
|
|
382
|
+
parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
|
|
383
|
+
delete parsedObjToReturn[textNodeName];
|
|
384
|
+
}
|
|
385
|
+
return getValueFromTextNode(parsedObjToReturn);
|
|
386
|
+
}
|
|
387
|
+
return {};
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js
|
|
392
|
+
var QueryShapeSerializer = class extends SerdeContextConfig {
|
|
393
|
+
settings;
|
|
394
|
+
buffer;
|
|
395
|
+
constructor(settings) {
|
|
396
|
+
super();
|
|
397
|
+
this.settings = settings;
|
|
398
|
+
}
|
|
399
|
+
write(schema, value, prefix = "") {
|
|
400
|
+
if (this.buffer === void 0) {
|
|
401
|
+
this.buffer = "";
|
|
402
|
+
}
|
|
403
|
+
const ns = NormalizedSchema.of(schema);
|
|
404
|
+
if (prefix && !prefix.endsWith(".")) {
|
|
405
|
+
prefix += ".";
|
|
406
|
+
}
|
|
407
|
+
if (ns.isBlobSchema()) {
|
|
408
|
+
if (typeof value === "string" || value instanceof Uint8Array) {
|
|
409
|
+
this.writeKey(prefix);
|
|
410
|
+
this.writeValue((this.serdeContext?.base64Encoder ?? toBase64)(value));
|
|
411
|
+
}
|
|
412
|
+
} else if (ns.isBooleanSchema() || ns.isNumericSchema() || ns.isStringSchema()) {
|
|
413
|
+
if (value != null) {
|
|
414
|
+
this.writeKey(prefix);
|
|
415
|
+
this.writeValue(String(value));
|
|
416
|
+
} else if (ns.isIdempotencyToken()) {
|
|
417
|
+
this.writeKey(prefix);
|
|
418
|
+
this.writeValue(generateIdempotencyToken());
|
|
419
|
+
}
|
|
420
|
+
} else if (ns.isBigIntegerSchema()) {
|
|
421
|
+
if (value != null) {
|
|
422
|
+
this.writeKey(prefix);
|
|
423
|
+
this.writeValue(String(value));
|
|
424
|
+
}
|
|
425
|
+
} else if (ns.isBigDecimalSchema()) {
|
|
426
|
+
if (value != null) {
|
|
427
|
+
this.writeKey(prefix);
|
|
428
|
+
this.writeValue(value instanceof NumericValue ? value.string : String(value));
|
|
429
|
+
}
|
|
430
|
+
} else if (ns.isTimestampSchema()) {
|
|
431
|
+
if (value instanceof Date) {
|
|
432
|
+
this.writeKey(prefix);
|
|
433
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
434
|
+
switch (format) {
|
|
435
|
+
case 5:
|
|
436
|
+
this.writeValue(value.toISOString().replace(".000Z", "Z"));
|
|
437
|
+
break;
|
|
438
|
+
case 6:
|
|
439
|
+
this.writeValue(dateToUtcString(value));
|
|
440
|
+
break;
|
|
441
|
+
case 7:
|
|
442
|
+
this.writeValue(String(value.getTime() / 1e3));
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
} else if (ns.isDocumentSchema()) {
|
|
447
|
+
if (Array.isArray(value)) {
|
|
448
|
+
this.write(64 | 15, value, prefix);
|
|
449
|
+
} else if (value instanceof Date) {
|
|
450
|
+
this.write(4, value, prefix);
|
|
451
|
+
} else if (value instanceof Uint8Array) {
|
|
452
|
+
this.write(21, value, prefix);
|
|
453
|
+
} else if (value && typeof value === "object") {
|
|
454
|
+
this.write(128 | 15, value, prefix);
|
|
455
|
+
} else {
|
|
456
|
+
this.writeKey(prefix);
|
|
457
|
+
this.writeValue(String(value));
|
|
458
|
+
}
|
|
459
|
+
} else if (ns.isListSchema()) {
|
|
460
|
+
if (Array.isArray(value)) {
|
|
461
|
+
if (value.length === 0) {
|
|
462
|
+
if (this.settings.serializeEmptyLists) {
|
|
463
|
+
this.writeKey(prefix);
|
|
464
|
+
this.writeValue("");
|
|
465
|
+
}
|
|
466
|
+
} else {
|
|
467
|
+
const member = ns.getValueSchema();
|
|
468
|
+
const flat = this.settings.flattenLists || ns.getMergedTraits().xmlFlattened;
|
|
469
|
+
let i = 1;
|
|
470
|
+
for (const item of value) {
|
|
471
|
+
if (item == null) {
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
const traits = member.getMergedTraits();
|
|
475
|
+
const suffix = this.getKey("member", traits.xmlName, traits.ec2QueryName);
|
|
476
|
+
const key = flat ? `${prefix}${i}` : `${prefix}${suffix}.${i}`;
|
|
477
|
+
this.write(member, item, key);
|
|
478
|
+
++i;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
} else if (ns.isMapSchema()) {
|
|
483
|
+
if (value && typeof value === "object") {
|
|
484
|
+
const keySchema = ns.getKeySchema();
|
|
485
|
+
const memberSchema = ns.getValueSchema();
|
|
486
|
+
const flat = ns.getMergedTraits().xmlFlattened;
|
|
487
|
+
let i = 1;
|
|
488
|
+
for (const k in value) {
|
|
489
|
+
const v = value[k];
|
|
490
|
+
if (v == null) {
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
const keyTraits = keySchema.getMergedTraits();
|
|
494
|
+
const keySuffix = this.getKey("key", keyTraits.xmlName, keyTraits.ec2QueryName);
|
|
495
|
+
const key = flat ? `${prefix}${i}.${keySuffix}` : `${prefix}entry.${i}.${keySuffix}`;
|
|
496
|
+
const valTraits = memberSchema.getMergedTraits();
|
|
497
|
+
const valueSuffix = this.getKey("value", valTraits.xmlName, valTraits.ec2QueryName);
|
|
498
|
+
const valueKey = flat ? `${prefix}${i}.${valueSuffix}` : `${prefix}entry.${i}.${valueSuffix}`;
|
|
499
|
+
this.write(keySchema, k, key);
|
|
500
|
+
this.write(memberSchema, v, valueKey);
|
|
501
|
+
++i;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
} else if (ns.isStructSchema()) {
|
|
505
|
+
if (value && typeof value === "object") {
|
|
506
|
+
let didWriteMember = false;
|
|
507
|
+
for (const [memberName, member] of ns.structIterator()) {
|
|
508
|
+
if (value[memberName] == null && !member.isIdempotencyToken()) {
|
|
509
|
+
continue;
|
|
510
|
+
}
|
|
511
|
+
const traits = member.getMergedTraits();
|
|
512
|
+
const suffix = this.getKey(memberName, traits.xmlName, traits.ec2QueryName, "struct");
|
|
513
|
+
const key = `${prefix}${suffix}`;
|
|
514
|
+
this.write(member, value[memberName], key);
|
|
515
|
+
didWriteMember = true;
|
|
516
|
+
}
|
|
517
|
+
if (!didWriteMember && ns.isUnionSchema()) {
|
|
518
|
+
const { $unknown } = value;
|
|
519
|
+
if (Array.isArray($unknown)) {
|
|
520
|
+
const [k, v] = $unknown;
|
|
521
|
+
const key = `${prefix}${k}`;
|
|
522
|
+
this.write(15, v, key);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
} else if (ns.isUnitSchema()) {
|
|
527
|
+
} else {
|
|
528
|
+
throw new Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${ns.getName(true)}`);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
flush() {
|
|
532
|
+
if (this.buffer === void 0) {
|
|
533
|
+
throw new Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.");
|
|
534
|
+
}
|
|
535
|
+
const str = this.buffer;
|
|
536
|
+
delete this.buffer;
|
|
537
|
+
return str;
|
|
538
|
+
}
|
|
539
|
+
getKey(memberName, xmlName, ec2QueryName, keySource) {
|
|
540
|
+
const { ec2, capitalizeKeys } = this.settings;
|
|
541
|
+
if (ec2 && ec2QueryName) {
|
|
542
|
+
return ec2QueryName;
|
|
543
|
+
}
|
|
544
|
+
const key = xmlName ?? memberName;
|
|
545
|
+
if (capitalizeKeys && keySource === "struct") {
|
|
546
|
+
return key[0].toUpperCase() + key.slice(1);
|
|
547
|
+
}
|
|
548
|
+
return key;
|
|
549
|
+
}
|
|
550
|
+
writeKey(key) {
|
|
551
|
+
if (key.endsWith(".")) {
|
|
552
|
+
key = key.slice(0, key.length - 1);
|
|
553
|
+
}
|
|
554
|
+
this.buffer += `&${extendedEncodeURIComponent(key)}=`;
|
|
555
|
+
}
|
|
556
|
+
writeValue(value) {
|
|
557
|
+
this.buffer += extendedEncodeURIComponent(value);
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsQueryProtocol.js
|
|
562
|
+
var AwsQueryProtocol = class extends RpcProtocol {
|
|
563
|
+
options;
|
|
564
|
+
serializer;
|
|
565
|
+
deserializer;
|
|
566
|
+
mixin = new ProtocolLib();
|
|
567
|
+
constructor(options) {
|
|
568
|
+
super({
|
|
569
|
+
defaultNamespace: options.defaultNamespace,
|
|
570
|
+
errorTypeRegistries: options.errorTypeRegistries
|
|
571
|
+
});
|
|
572
|
+
this.options = options;
|
|
573
|
+
const settings = {
|
|
574
|
+
timestampFormat: {
|
|
575
|
+
useTrait: true,
|
|
576
|
+
default: 5
|
|
577
|
+
},
|
|
578
|
+
httpBindings: false,
|
|
579
|
+
xmlNamespace: options.xmlNamespace,
|
|
580
|
+
serviceNamespace: options.defaultNamespace,
|
|
581
|
+
serializeEmptyLists: true
|
|
582
|
+
};
|
|
583
|
+
this.serializer = new QueryShapeSerializer(settings);
|
|
584
|
+
this.deserializer = new XmlShapeDeserializer(settings);
|
|
585
|
+
}
|
|
586
|
+
getShapeId() {
|
|
587
|
+
return "aws.protocols#awsQuery";
|
|
588
|
+
}
|
|
589
|
+
setSerdeContext(serdeContext) {
|
|
590
|
+
this.serializer.setSerdeContext(serdeContext);
|
|
591
|
+
this.deserializer.setSerdeContext(serdeContext);
|
|
592
|
+
}
|
|
593
|
+
getPayloadCodec() {
|
|
594
|
+
throw new Error("AWSQuery protocol has no payload codec.");
|
|
595
|
+
}
|
|
596
|
+
async serializeRequest(operationSchema, input, context) {
|
|
597
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
598
|
+
if (!request.path.endsWith("/")) {
|
|
599
|
+
request.path += "/";
|
|
600
|
+
}
|
|
601
|
+
request.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
602
|
+
if (deref(operationSchema.input) === "unit" || !request.body) {
|
|
603
|
+
request.body = "";
|
|
604
|
+
}
|
|
605
|
+
const action = operationSchema.name.split("#")[1] ?? operationSchema.name;
|
|
606
|
+
request.body = `Action=${action}&Version=${this.options.version}` + request.body;
|
|
607
|
+
if (request.body.endsWith("&")) {
|
|
608
|
+
request.body = request.body.slice(-1);
|
|
609
|
+
}
|
|
610
|
+
return request;
|
|
611
|
+
}
|
|
612
|
+
async deserializeResponse(operationSchema, context, response) {
|
|
613
|
+
const deserializer = this.deserializer;
|
|
614
|
+
const ns = NormalizedSchema.of(operationSchema.output);
|
|
615
|
+
const dataObject = {};
|
|
616
|
+
if (response.statusCode >= 300) {
|
|
617
|
+
const bytes2 = await collectBody(response.body, context);
|
|
618
|
+
if (bytes2.byteLength > 0) {
|
|
619
|
+
Object.assign(dataObject, await deserializer.read(15, bytes2));
|
|
620
|
+
}
|
|
621
|
+
await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
|
|
622
|
+
}
|
|
623
|
+
for (const header in response.headers) {
|
|
624
|
+
const value = response.headers[header];
|
|
625
|
+
delete response.headers[header];
|
|
626
|
+
response.headers[header.toLowerCase()] = value;
|
|
627
|
+
}
|
|
628
|
+
const shortName = operationSchema.name.split("#")[1] ?? operationSchema.name;
|
|
629
|
+
const awsQueryResultKey = ns.isStructSchema() && this.useNestedResult() ? shortName + "Result" : void 0;
|
|
630
|
+
const bytes = await collectBody(response.body, context);
|
|
631
|
+
if (bytes.byteLength > 0) {
|
|
632
|
+
Object.assign(dataObject, await deserializer.read(ns, bytes, awsQueryResultKey));
|
|
633
|
+
}
|
|
634
|
+
dataObject.$metadata = this.deserializeMetadata(response);
|
|
635
|
+
return dataObject;
|
|
636
|
+
}
|
|
637
|
+
useNestedResult() {
|
|
638
|
+
return true;
|
|
639
|
+
}
|
|
640
|
+
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
641
|
+
const errorIdentifier = this.loadQueryErrorCode(response, dataObject) ?? "Unknown";
|
|
642
|
+
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
643
|
+
const errorData = this.loadQueryError(dataObject) ?? {};
|
|
644
|
+
const message = this.loadQueryErrorMessage(dataObject);
|
|
645
|
+
errorData.message = message;
|
|
646
|
+
errorData.Error = {
|
|
647
|
+
Type: errorData.Type,
|
|
648
|
+
Code: errorData.Code,
|
|
649
|
+
Message: message
|
|
650
|
+
};
|
|
651
|
+
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, errorData, metadata, this.mixin.findQueryCompatibleError);
|
|
652
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
653
|
+
const ErrorCtor = this.compositeErrorRegistry.getErrorCtor(errorSchema) ?? Error;
|
|
654
|
+
const exception = new ErrorCtor({});
|
|
655
|
+
const output = {
|
|
656
|
+
Type: errorData.Error.Type,
|
|
657
|
+
Code: errorData.Error.Code,
|
|
658
|
+
Error: errorData.Error
|
|
659
|
+
};
|
|
660
|
+
for (const [name, member] of ns.structIterator()) {
|
|
661
|
+
const target = member.getMergedTraits().xmlName ?? name;
|
|
662
|
+
const value = errorData[target] ?? dataObject[target];
|
|
663
|
+
output[name] = this.deserializer.readSchema(member, value);
|
|
664
|
+
}
|
|
665
|
+
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
|
|
666
|
+
$fault: ns.getMergedTraits().error,
|
|
667
|
+
message
|
|
668
|
+
}, output), dataObject);
|
|
669
|
+
}
|
|
670
|
+
loadQueryErrorCode(output, data) {
|
|
671
|
+
const code = (data.Errors?.[0]?.Error ?? data.Errors?.Error ?? data.Error)?.Code;
|
|
672
|
+
if (code !== void 0) {
|
|
673
|
+
return code;
|
|
674
|
+
}
|
|
675
|
+
if (output.statusCode == 404) {
|
|
676
|
+
return "NotFound";
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
loadQueryError(data) {
|
|
680
|
+
return data.Errors?.[0]?.Error ?? data.Errors?.Error ?? data.Error;
|
|
681
|
+
}
|
|
682
|
+
loadQueryErrorMessage(data) {
|
|
683
|
+
const errorData = this.loadQueryError(data);
|
|
684
|
+
return errorData?.message ?? errorData?.Message ?? data.message ?? data.Message ?? "Unknown";
|
|
685
|
+
}
|
|
686
|
+
getDefaultContentType() {
|
|
687
|
+
return "application/x-www-form-urlencoded";
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
export {
|
|
692
|
+
AwsQueryProtocol
|
|
693
|
+
};
|
|
694
|
+
//# sourceMappingURL=chunk-GXSQEW4F.js.map
|