@funnycode/myclaude 0.1.178 → 0.1.180
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/myclaude.js +741 -711
- package/dist/myclaude.mjs +741 -711
- package/package.json +1 -1
package/dist/myclaude.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// MACRO - build-time constants (injected by build.ts)
|
|
5
5
|
// MACRO injected by build script
|
|
6
6
|
globalThis.MACRO = {
|
|
7
|
-
VERSION: "0.1.
|
|
8
|
-
BUILD_TIME: "2026-08-
|
|
7
|
+
VERSION: "0.1.180",
|
|
8
|
+
BUILD_TIME: "2026-08-04T07:11:41.203Z",
|
|
9
9
|
PACKAGE_URL: "@funnycode/myclaude",
|
|
10
10
|
NATIVE_PACKAGE_URL: "@funnycode/myclaude",
|
|
11
11
|
VERSION_CHANGELOG: '',
|
|
@@ -100018,7 +100018,7 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
100018
100018
|
var { TypeRegistry, NormalizedSchema, deref } = require_schema();
|
|
100019
100019
|
var { decorateServiceException, getValueFromTextNode } = require_client2();
|
|
100020
100020
|
var { collectBody, determineTimestampFormat, RpcProtocol, HttpBindingProtocol, HttpInterceptingShapeSerializer, HttpInterceptingShapeDeserializer, FromStringShapeDeserializer, extendedEncodeURIComponent } = require_protocols();
|
|
100021
|
-
var { NumericValue, toUtf8, fromBase64, LazyJsonString, parseEpochTimestamp, parseRfc7231DateTime, parseRfc3339DateTimeWithOffset, toBase64, dateToUtcString,
|
|
100021
|
+
var { NumericValue, toUtf8, fromBase64, LazyJsonString, parseEpochTimestamp, parseRfc7231DateTime, parseRfc3339DateTimeWithOffset, generateIdempotencyToken, toBase64, dateToUtcString, expectUnion } = require_serde();
|
|
100022
100022
|
var { parseXML, XmlNode, XmlText } = require_dist_cjs8();
|
|
100023
100023
|
|
|
100024
100024
|
class ProtocolLib {
|
|
@@ -100235,6 +100235,22 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
100235
100235
|
}
|
|
100236
100236
|
}
|
|
100237
100237
|
}
|
|
100238
|
+
var canParseBuffer;
|
|
100239
|
+
function detectBufferParsing() {
|
|
100240
|
+
if (canParseBuffer === undefined) {
|
|
100241
|
+
try {
|
|
100242
|
+
if (typeof Buffer !== "function") {
|
|
100243
|
+
canParseBuffer = false;
|
|
100244
|
+
} else {
|
|
100245
|
+
const result = JSON.parse(Buffer.from([123, 125]));
|
|
100246
|
+
canParseBuffer = result !== null && typeof result === "object";
|
|
100247
|
+
}
|
|
100248
|
+
} catch {
|
|
100249
|
+
canParseBuffer = false;
|
|
100250
|
+
}
|
|
100251
|
+
}
|
|
100252
|
+
return canParseBuffer;
|
|
100253
|
+
}
|
|
100238
100254
|
function jsonReviver(key, value, context) {
|
|
100239
100255
|
if (context?.source) {
|
|
100240
100256
|
const numericString = context.source;
|
|
@@ -100309,22 +100325,6 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
100309
100325
|
return false;
|
|
100310
100326
|
}
|
|
100311
100327
|
var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => (context?.utf8Encoder ?? toUtf8)(body));
|
|
100312
|
-
var canParseBuffer;
|
|
100313
|
-
function detectBufferParsing() {
|
|
100314
|
-
if (canParseBuffer === undefined) {
|
|
100315
|
-
try {
|
|
100316
|
-
if (typeof Buffer !== "function") {
|
|
100317
|
-
canParseBuffer = false;
|
|
100318
|
-
} else {
|
|
100319
|
-
const result = JSON.parse(Buffer.from([123, 125]));
|
|
100320
|
-
canParseBuffer = result !== null && typeof result === "object";
|
|
100321
|
-
}
|
|
100322
|
-
} catch {
|
|
100323
|
-
canParseBuffer = false;
|
|
100324
|
-
}
|
|
100325
|
-
}
|
|
100326
|
-
return canParseBuffer;
|
|
100327
|
-
}
|
|
100328
100328
|
async function parseJsonBody(streamBody, context, schema) {
|
|
100329
100329
|
let parsingInput;
|
|
100330
100330
|
if (detectBufferParsing() && typeof streamBody?.[Symbol.asyncIterator] === "function") {
|
|
@@ -100411,595 +100411,6 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
100411
100411
|
Object.defineProperty(obj, "__proto__", { value: undefined, writable: true, enumerable: true, configurable: true });
|
|
100412
100412
|
}
|
|
100413
100413
|
|
|
100414
|
-
class JsonShapeDeserializer extends SerdeContextConfig {
|
|
100415
|
-
settings;
|
|
100416
|
-
constructor(settings) {
|
|
100417
|
-
super();
|
|
100418
|
-
this.settings = settings;
|
|
100419
|
-
}
|
|
100420
|
-
async read(schema, data) {
|
|
100421
|
-
const reviver = needsReviver(schema) ? jsonReviver : undefined;
|
|
100422
|
-
return this._read(schema, typeof data === "string" ? JSON.parse(data, reviver) : await parseJsonBody(data, this.serdeContext, schema));
|
|
100423
|
-
}
|
|
100424
|
-
readObject(schema, data) {
|
|
100425
|
-
return this._read(schema, data);
|
|
100426
|
-
}
|
|
100427
|
-
_read(schema, value) {
|
|
100428
|
-
const isObject5 = value !== null && typeof value === "object";
|
|
100429
|
-
const ns = NormalizedSchema.of(schema);
|
|
100430
|
-
if (isObject5) {
|
|
100431
|
-
if (ns.isStructSchema()) {
|
|
100432
|
-
const record2 = value;
|
|
100433
|
-
const union2 = ns.isUnionSchema();
|
|
100434
|
-
const out = {};
|
|
100435
|
-
let nameMap = undefined;
|
|
100436
|
-
const { jsonName } = this.settings;
|
|
100437
|
-
if (jsonName) {
|
|
100438
|
-
nameMap = {};
|
|
100439
|
-
}
|
|
100440
|
-
let unionSerde;
|
|
100441
|
-
if (union2) {
|
|
100442
|
-
unionSerde = new UnionSerde(record2, out);
|
|
100443
|
-
}
|
|
100444
|
-
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
100445
|
-
let fromKey = memberName;
|
|
100446
|
-
if (jsonName) {
|
|
100447
|
-
fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
|
|
100448
|
-
nameMap[fromKey] = memberName;
|
|
100449
|
-
}
|
|
100450
|
-
if (union2) {
|
|
100451
|
-
unionSerde.mark(fromKey);
|
|
100452
|
-
}
|
|
100453
|
-
if (record2[fromKey] != null) {
|
|
100454
|
-
out[memberName] = this._read(memberSchema, record2[fromKey]);
|
|
100455
|
-
}
|
|
100456
|
-
}
|
|
100457
|
-
if (union2) {
|
|
100458
|
-
unionSerde.writeUnknown();
|
|
100459
|
-
} else if (typeof record2.__type === "string") {
|
|
100460
|
-
for (const k in record2) {
|
|
100461
|
-
const v = record2[k];
|
|
100462
|
-
const t = jsonName ? nameMap[k] ?? k : k;
|
|
100463
|
-
if (!(t in out)) {
|
|
100464
|
-
out[t] = v;
|
|
100465
|
-
}
|
|
100466
|
-
}
|
|
100467
|
-
}
|
|
100468
|
-
return out;
|
|
100469
|
-
}
|
|
100470
|
-
if (Array.isArray(value) && ns.isListSchema()) {
|
|
100471
|
-
const listMember = ns.getValueSchema();
|
|
100472
|
-
const out = [];
|
|
100473
|
-
for (const item of value) {
|
|
100474
|
-
out.push(this._read(listMember, item));
|
|
100475
|
-
}
|
|
100476
|
-
return out;
|
|
100477
|
-
}
|
|
100478
|
-
if (ns.isMapSchema()) {
|
|
100479
|
-
const mapMember = ns.getValueSchema();
|
|
100480
|
-
const out = {};
|
|
100481
|
-
for (const _k in value) {
|
|
100482
|
-
if (_k === "__proto__") {
|
|
100483
|
-
writeKey(out);
|
|
100484
|
-
}
|
|
100485
|
-
out[_k] = this._read(mapMember, value[_k]);
|
|
100486
|
-
}
|
|
100487
|
-
return out;
|
|
100488
|
-
}
|
|
100489
|
-
}
|
|
100490
|
-
if (ns.isBlobSchema() && typeof value === "string") {
|
|
100491
|
-
return fromBase64(value);
|
|
100492
|
-
}
|
|
100493
|
-
const mediaType = ns.getMergedTraits().mediaType;
|
|
100494
|
-
if (ns.isStringSchema() && typeof value === "string" && mediaType) {
|
|
100495
|
-
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
100496
|
-
if (isJson) {
|
|
100497
|
-
return LazyJsonString.from(value);
|
|
100498
|
-
}
|
|
100499
|
-
return value;
|
|
100500
|
-
}
|
|
100501
|
-
if (ns.isTimestampSchema() && value != null) {
|
|
100502
|
-
const format3 = determineTimestampFormat(ns, this.settings);
|
|
100503
|
-
switch (format3) {
|
|
100504
|
-
case 5:
|
|
100505
|
-
return parseRfc3339DateTimeWithOffset(value);
|
|
100506
|
-
case 6:
|
|
100507
|
-
return parseRfc7231DateTime(value);
|
|
100508
|
-
case 7:
|
|
100509
|
-
return parseEpochTimestamp(value);
|
|
100510
|
-
default:
|
|
100511
|
-
console.warn("Missing timestamp format, parsing value with Date constructor:", value);
|
|
100512
|
-
return new Date(value);
|
|
100513
|
-
}
|
|
100514
|
-
}
|
|
100515
|
-
if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) {
|
|
100516
|
-
return BigInt(value);
|
|
100517
|
-
}
|
|
100518
|
-
if (ns.isBigDecimalSchema() && value != null) {
|
|
100519
|
-
if (value instanceof NumericValue) {
|
|
100520
|
-
return value;
|
|
100521
|
-
}
|
|
100522
|
-
const untyped = value;
|
|
100523
|
-
if (untyped.type === "bigDecimal" && "string" in untyped) {
|
|
100524
|
-
return new NumericValue(untyped.string, untyped.type);
|
|
100525
|
-
}
|
|
100526
|
-
return new NumericValue(String(value), "bigDecimal");
|
|
100527
|
-
}
|
|
100528
|
-
if (ns.isNumericSchema() && typeof value === "string") {
|
|
100529
|
-
switch (value) {
|
|
100530
|
-
case "Infinity":
|
|
100531
|
-
return Infinity;
|
|
100532
|
-
case "-Infinity":
|
|
100533
|
-
return -Infinity;
|
|
100534
|
-
case "NaN":
|
|
100535
|
-
return NaN;
|
|
100536
|
-
}
|
|
100537
|
-
return value;
|
|
100538
|
-
}
|
|
100539
|
-
if (ns.isDocumentSchema()) {
|
|
100540
|
-
if (isObject5) {
|
|
100541
|
-
const out = Array.isArray(value) ? [] : {};
|
|
100542
|
-
for (const k in value) {
|
|
100543
|
-
if (k === "__proto__") {
|
|
100544
|
-
writeKey(out);
|
|
100545
|
-
}
|
|
100546
|
-
const v = value[k];
|
|
100547
|
-
if (v instanceof NumericValue) {
|
|
100548
|
-
out[k] = v;
|
|
100549
|
-
} else {
|
|
100550
|
-
out[k] = this._read(ns, v);
|
|
100551
|
-
}
|
|
100552
|
-
}
|
|
100553
|
-
return out;
|
|
100554
|
-
} else {
|
|
100555
|
-
return structuredClone(value);
|
|
100556
|
-
}
|
|
100557
|
-
}
|
|
100558
|
-
return value;
|
|
100559
|
-
}
|
|
100560
|
-
}
|
|
100561
|
-
var NUMERIC_CONTROL_CHAR = String.fromCharCode(925);
|
|
100562
|
-
|
|
100563
|
-
class JsonReplacer {
|
|
100564
|
-
values = new Map;
|
|
100565
|
-
counter = 0;
|
|
100566
|
-
stage = 0;
|
|
100567
|
-
createReplacer() {
|
|
100568
|
-
if (this.stage === 1) {
|
|
100569
|
-
throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");
|
|
100570
|
-
}
|
|
100571
|
-
if (this.stage === 2) {
|
|
100572
|
-
throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
|
|
100573
|
-
}
|
|
100574
|
-
this.stage = 1;
|
|
100575
|
-
return (key, value) => {
|
|
100576
|
-
if (value instanceof NumericValue) {
|
|
100577
|
-
const v = `${NUMERIC_CONTROL_CHAR + "nv" + this.counter++}_` + value.string;
|
|
100578
|
-
this.values.set(`"${v}"`, value.string);
|
|
100579
|
-
return v;
|
|
100580
|
-
}
|
|
100581
|
-
if (typeof value === "bigint") {
|
|
100582
|
-
const s = value.toString();
|
|
100583
|
-
const v = `${NUMERIC_CONTROL_CHAR + "b" + this.counter++}_` + s;
|
|
100584
|
-
this.values.set(`"${v}"`, s);
|
|
100585
|
-
return v;
|
|
100586
|
-
}
|
|
100587
|
-
return value;
|
|
100588
|
-
};
|
|
100589
|
-
}
|
|
100590
|
-
replaceInJson(json2) {
|
|
100591
|
-
if (this.stage === 0) {
|
|
100592
|
-
throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");
|
|
100593
|
-
}
|
|
100594
|
-
if (this.stage === 2) {
|
|
100595
|
-
throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
|
|
100596
|
-
}
|
|
100597
|
-
this.stage = 2;
|
|
100598
|
-
if (this.counter === 0) {
|
|
100599
|
-
return json2;
|
|
100600
|
-
}
|
|
100601
|
-
for (const [key, value] of this.values) {
|
|
100602
|
-
json2 = json2.replace(key, value);
|
|
100603
|
-
}
|
|
100604
|
-
return json2;
|
|
100605
|
-
}
|
|
100606
|
-
}
|
|
100607
|
-
|
|
100608
|
-
class JsonShapeSerializer extends SerdeContextConfig {
|
|
100609
|
-
settings;
|
|
100610
|
-
buffer;
|
|
100611
|
-
useReplacer = false;
|
|
100612
|
-
rootSchema;
|
|
100613
|
-
constructor(settings) {
|
|
100614
|
-
super();
|
|
100615
|
-
this.settings = settings;
|
|
100616
|
-
}
|
|
100617
|
-
write(schema, value) {
|
|
100618
|
-
this.rootSchema = NormalizedSchema.of(schema);
|
|
100619
|
-
this.buffer = this._write(this.rootSchema, value);
|
|
100620
|
-
}
|
|
100621
|
-
flush() {
|
|
100622
|
-
const { rootSchema, useReplacer } = this;
|
|
100623
|
-
this.rootSchema = undefined;
|
|
100624
|
-
this.useReplacer = false;
|
|
100625
|
-
if (rootSchema?.isStructSchema() || rootSchema?.isDocumentSchema()) {
|
|
100626
|
-
if (!useReplacer) {
|
|
100627
|
-
return JSON.stringify(this.buffer);
|
|
100628
|
-
}
|
|
100629
|
-
const replacer = new JsonReplacer;
|
|
100630
|
-
return replacer.replaceInJson(JSON.stringify(this.buffer, replacer.createReplacer(), 0));
|
|
100631
|
-
}
|
|
100632
|
-
return this.buffer;
|
|
100633
|
-
}
|
|
100634
|
-
writeDiscriminatedDocument(schema, value) {
|
|
100635
|
-
this.write(schema, value);
|
|
100636
|
-
if (typeof this.buffer === "object") {
|
|
100637
|
-
this.buffer.__type = NormalizedSchema.of(schema).getName(true);
|
|
100638
|
-
}
|
|
100639
|
-
}
|
|
100640
|
-
_write(schema, value, container) {
|
|
100641
|
-
const isObject5 = value !== null && typeof value === "object";
|
|
100642
|
-
const ns = NormalizedSchema.of(schema);
|
|
100643
|
-
if (isObject5) {
|
|
100644
|
-
if (ns.isStructSchema()) {
|
|
100645
|
-
const record2 = value;
|
|
100646
|
-
const out = {};
|
|
100647
|
-
const { jsonName } = this.settings;
|
|
100648
|
-
let nameMap = undefined;
|
|
100649
|
-
if (jsonName) {
|
|
100650
|
-
nameMap = {};
|
|
100651
|
-
}
|
|
100652
|
-
let outCount = 0;
|
|
100653
|
-
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
100654
|
-
const serializableValue = this._write(memberSchema, record2[memberName], ns);
|
|
100655
|
-
if (serializableValue !== undefined) {
|
|
100656
|
-
let targetKey = memberName;
|
|
100657
|
-
if (jsonName) {
|
|
100658
|
-
targetKey = memberSchema.getMergedTraits().jsonName ?? memberName;
|
|
100659
|
-
nameMap[memberName] = targetKey;
|
|
100660
|
-
}
|
|
100661
|
-
out[targetKey] = serializableValue;
|
|
100662
|
-
outCount++;
|
|
100663
|
-
}
|
|
100664
|
-
}
|
|
100665
|
-
if (ns.isUnionSchema() && outCount === 0) {
|
|
100666
|
-
const { $unknown } = record2;
|
|
100667
|
-
if (Array.isArray($unknown)) {
|
|
100668
|
-
const [k, v] = $unknown;
|
|
100669
|
-
if (k === "__proto__") {
|
|
100670
|
-
writeKey(out);
|
|
100671
|
-
}
|
|
100672
|
-
out[k] = this._write(15, v);
|
|
100673
|
-
}
|
|
100674
|
-
} else if (typeof record2.__type === "string") {
|
|
100675
|
-
for (const k in record2) {
|
|
100676
|
-
const v = record2[k];
|
|
100677
|
-
const targetKey = jsonName ? nameMap[k] ?? k : k;
|
|
100678
|
-
if (!(targetKey in out)) {
|
|
100679
|
-
out[targetKey] = this._write(15, v);
|
|
100680
|
-
}
|
|
100681
|
-
}
|
|
100682
|
-
}
|
|
100683
|
-
return out;
|
|
100684
|
-
}
|
|
100685
|
-
if (Array.isArray(value) && ns.isListSchema()) {
|
|
100686
|
-
const listMember = ns.getValueSchema();
|
|
100687
|
-
const out = [];
|
|
100688
|
-
const sparse = !!ns.getMergedTraits().sparse;
|
|
100689
|
-
for (const item of value) {
|
|
100690
|
-
if (sparse || item != null) {
|
|
100691
|
-
out.push(this._write(listMember, item));
|
|
100692
|
-
}
|
|
100693
|
-
}
|
|
100694
|
-
return out;
|
|
100695
|
-
}
|
|
100696
|
-
if (ns.isMapSchema()) {
|
|
100697
|
-
const mapMember = ns.getValueSchema();
|
|
100698
|
-
const out = {};
|
|
100699
|
-
const sparse = !!ns.getMergedTraits().sparse;
|
|
100700
|
-
for (const _k in value) {
|
|
100701
|
-
const _v = value[_k];
|
|
100702
|
-
if (sparse || _v != null) {
|
|
100703
|
-
if (_k === "__proto__") {
|
|
100704
|
-
writeKey(out);
|
|
100705
|
-
}
|
|
100706
|
-
out[_k] = this._write(mapMember, _v);
|
|
100707
|
-
}
|
|
100708
|
-
}
|
|
100709
|
-
return out;
|
|
100710
|
-
}
|
|
100711
|
-
if (value instanceof Uint8Array && (ns.isBlobSchema() || ns.isDocumentSchema())) {
|
|
100712
|
-
if (ns === this.rootSchema) {
|
|
100713
|
-
return value;
|
|
100714
|
-
}
|
|
100715
|
-
return (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
100716
|
-
}
|
|
100717
|
-
if (value instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
|
|
100718
|
-
const format3 = determineTimestampFormat(ns, this.settings);
|
|
100719
|
-
switch (format3) {
|
|
100720
|
-
case 5:
|
|
100721
|
-
return value.toISOString().replace(".000Z", "Z");
|
|
100722
|
-
case 6:
|
|
100723
|
-
return dateToUtcString(value);
|
|
100724
|
-
case 7:
|
|
100725
|
-
return value.getTime() / 1000;
|
|
100726
|
-
default:
|
|
100727
|
-
console.warn("Missing timestamp format, using epoch seconds", value);
|
|
100728
|
-
return value.getTime() / 1000;
|
|
100729
|
-
}
|
|
100730
|
-
}
|
|
100731
|
-
if (value instanceof NumericValue) {
|
|
100732
|
-
this.useReplacer = true;
|
|
100733
|
-
}
|
|
100734
|
-
}
|
|
100735
|
-
if (value === null && container?.isStructSchema()) {
|
|
100736
|
-
return;
|
|
100737
|
-
}
|
|
100738
|
-
if (ns.isStringSchema()) {
|
|
100739
|
-
if (typeof value === "undefined" && ns.isIdempotencyToken()) {
|
|
100740
|
-
return generateIdempotencyToken();
|
|
100741
|
-
}
|
|
100742
|
-
const mediaType = ns.getMergedTraits().mediaType;
|
|
100743
|
-
if (value != null && mediaType) {
|
|
100744
|
-
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
100745
|
-
if (isJson) {
|
|
100746
|
-
return LazyJsonString.from(value);
|
|
100747
|
-
}
|
|
100748
|
-
}
|
|
100749
|
-
return value;
|
|
100750
|
-
}
|
|
100751
|
-
if (typeof value === "number" && ns.isNumericSchema()) {
|
|
100752
|
-
if (Math.abs(value) === Infinity || isNaN(value)) {
|
|
100753
|
-
return String(value);
|
|
100754
|
-
}
|
|
100755
|
-
return value;
|
|
100756
|
-
}
|
|
100757
|
-
if (typeof value === "string" && ns.isBlobSchema()) {
|
|
100758
|
-
if (ns === this.rootSchema) {
|
|
100759
|
-
return value;
|
|
100760
|
-
}
|
|
100761
|
-
return (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
100762
|
-
}
|
|
100763
|
-
if (typeof value === "bigint") {
|
|
100764
|
-
this.useReplacer = true;
|
|
100765
|
-
}
|
|
100766
|
-
if (ns.isDocumentSchema()) {
|
|
100767
|
-
if (isObject5) {
|
|
100768
|
-
const out = Array.isArray(value) ? [] : {};
|
|
100769
|
-
for (const k in value) {
|
|
100770
|
-
const v = value[k];
|
|
100771
|
-
if (k === "__proto__") {
|
|
100772
|
-
writeKey(out);
|
|
100773
|
-
}
|
|
100774
|
-
if (v instanceof NumericValue) {
|
|
100775
|
-
this.useReplacer = true;
|
|
100776
|
-
out[k] = v;
|
|
100777
|
-
} else {
|
|
100778
|
-
out[k] = this._write(ns, v);
|
|
100779
|
-
}
|
|
100780
|
-
}
|
|
100781
|
-
return out;
|
|
100782
|
-
} else {
|
|
100783
|
-
return structuredClone(value);
|
|
100784
|
-
}
|
|
100785
|
-
}
|
|
100786
|
-
return value;
|
|
100787
|
-
}
|
|
100788
|
-
}
|
|
100789
|
-
|
|
100790
|
-
class JsonCodec extends SerdeContextConfig {
|
|
100791
|
-
settings;
|
|
100792
|
-
constructor(settings) {
|
|
100793
|
-
super();
|
|
100794
|
-
this.settings = settings;
|
|
100795
|
-
}
|
|
100796
|
-
createSerializer() {
|
|
100797
|
-
const serializer = new JsonShapeSerializer(this.settings);
|
|
100798
|
-
serializer.setSerdeContext(this.serdeContext);
|
|
100799
|
-
return serializer;
|
|
100800
|
-
}
|
|
100801
|
-
createDeserializer() {
|
|
100802
|
-
const deserializer = new JsonShapeDeserializer(this.settings);
|
|
100803
|
-
deserializer.setSerdeContext(this.serdeContext);
|
|
100804
|
-
return deserializer;
|
|
100805
|
-
}
|
|
100806
|
-
}
|
|
100807
|
-
|
|
100808
|
-
class AwsJsonRpcProtocol extends RpcProtocol {
|
|
100809
|
-
serializer;
|
|
100810
|
-
deserializer;
|
|
100811
|
-
serviceTarget;
|
|
100812
|
-
codec;
|
|
100813
|
-
mixin;
|
|
100814
|
-
awsQueryCompatible;
|
|
100815
|
-
constructor({ defaultNamespace, errorTypeRegistries, serviceTarget, awsQueryCompatible, jsonCodec }) {
|
|
100816
|
-
super({
|
|
100817
|
-
defaultNamespace,
|
|
100818
|
-
errorTypeRegistries
|
|
100819
|
-
});
|
|
100820
|
-
this.serviceTarget = serviceTarget;
|
|
100821
|
-
this.codec = jsonCodec ?? new JsonCodec({
|
|
100822
|
-
timestampFormat: {
|
|
100823
|
-
useTrait: true,
|
|
100824
|
-
default: 7
|
|
100825
|
-
},
|
|
100826
|
-
jsonName: false
|
|
100827
|
-
});
|
|
100828
|
-
this.serializer = this.codec.createSerializer();
|
|
100829
|
-
this.deserializer = this.codec.createDeserializer();
|
|
100830
|
-
this.awsQueryCompatible = !!awsQueryCompatible;
|
|
100831
|
-
this.mixin = new ProtocolLib(this.awsQueryCompatible);
|
|
100832
|
-
}
|
|
100833
|
-
async serializeRequest(operationSchema, input, context) {
|
|
100834
|
-
const request = await super.serializeRequest(operationSchema, input, context);
|
|
100835
|
-
if (!request.path.endsWith("/")) {
|
|
100836
|
-
request.path += "/";
|
|
100837
|
-
}
|
|
100838
|
-
request.headers["content-type"] = `application/x-amz-json-${this.getJsonRpcVersion()}`;
|
|
100839
|
-
request.headers["x-amz-target"] = `${this.serviceTarget}.${operationSchema.name}`;
|
|
100840
|
-
if (this.awsQueryCompatible) {
|
|
100841
|
-
request.headers["x-amzn-query-mode"] = "true";
|
|
100842
|
-
}
|
|
100843
|
-
if (deref(operationSchema.input) === "unit" || !request.body) {
|
|
100844
|
-
request.body = "{}";
|
|
100845
|
-
}
|
|
100846
|
-
return request;
|
|
100847
|
-
}
|
|
100848
|
-
getPayloadCodec() {
|
|
100849
|
-
return this.codec;
|
|
100850
|
-
}
|
|
100851
|
-
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
100852
|
-
const { awsQueryCompatible } = this;
|
|
100853
|
-
if (awsQueryCompatible) {
|
|
100854
|
-
this.mixin.setQueryCompatError(dataObject, response);
|
|
100855
|
-
}
|
|
100856
|
-
const errorIdentifier = loadJsonRpcErrorCode(response, dataObject, awsQueryCompatible) ?? "Unknown";
|
|
100857
|
-
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
100858
|
-
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, dataObject, metadata, awsQueryCompatible ? this.mixin.findQueryCompatibleError : undefined);
|
|
100859
|
-
const ns = NormalizedSchema.of(errorSchema);
|
|
100860
|
-
const message = dataObject.message ?? dataObject.Message ?? "UnknownError";
|
|
100861
|
-
const ErrorCtor = this.compositeErrorRegistry.getErrorCtor(errorSchema) ?? Error;
|
|
100862
|
-
const exception = new ErrorCtor({});
|
|
100863
|
-
const output = {};
|
|
100864
|
-
const errorDeserializer = this.codec.createDeserializer();
|
|
100865
|
-
for (const [name, member] of ns.structIterator()) {
|
|
100866
|
-
if (dataObject[name] != null) {
|
|
100867
|
-
output[name] = errorDeserializer.readObject(member, dataObject[name]);
|
|
100868
|
-
}
|
|
100869
|
-
}
|
|
100870
|
-
if (awsQueryCompatible) {
|
|
100871
|
-
this.mixin.queryCompatOutput(dataObject, output);
|
|
100872
|
-
}
|
|
100873
|
-
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
|
|
100874
|
-
$fault: ns.getMergedTraits().error,
|
|
100875
|
-
message
|
|
100876
|
-
}, output), dataObject);
|
|
100877
|
-
}
|
|
100878
|
-
}
|
|
100879
|
-
|
|
100880
|
-
class AwsJson1_0Protocol extends AwsJsonRpcProtocol {
|
|
100881
|
-
constructor({ defaultNamespace, errorTypeRegistries, serviceTarget, awsQueryCompatible, jsonCodec }) {
|
|
100882
|
-
super({
|
|
100883
|
-
defaultNamespace,
|
|
100884
|
-
errorTypeRegistries,
|
|
100885
|
-
serviceTarget,
|
|
100886
|
-
awsQueryCompatible,
|
|
100887
|
-
jsonCodec
|
|
100888
|
-
});
|
|
100889
|
-
}
|
|
100890
|
-
getShapeId() {
|
|
100891
|
-
return "aws.protocols#awsJson1_0";
|
|
100892
|
-
}
|
|
100893
|
-
getJsonRpcVersion() {
|
|
100894
|
-
return "1.0";
|
|
100895
|
-
}
|
|
100896
|
-
getDefaultContentType() {
|
|
100897
|
-
return "application/x-amz-json-1.0";
|
|
100898
|
-
}
|
|
100899
|
-
}
|
|
100900
|
-
|
|
100901
|
-
class AwsJson1_1Protocol extends AwsJsonRpcProtocol {
|
|
100902
|
-
constructor({ defaultNamespace, errorTypeRegistries, serviceTarget, awsQueryCompatible, jsonCodec }) {
|
|
100903
|
-
super({
|
|
100904
|
-
defaultNamespace,
|
|
100905
|
-
errorTypeRegistries,
|
|
100906
|
-
serviceTarget,
|
|
100907
|
-
awsQueryCompatible,
|
|
100908
|
-
jsonCodec
|
|
100909
|
-
});
|
|
100910
|
-
}
|
|
100911
|
-
getShapeId() {
|
|
100912
|
-
return "aws.protocols#awsJson1_1";
|
|
100913
|
-
}
|
|
100914
|
-
getJsonRpcVersion() {
|
|
100915
|
-
return "1.1";
|
|
100916
|
-
}
|
|
100917
|
-
getDefaultContentType() {
|
|
100918
|
-
return "application/x-amz-json-1.1";
|
|
100919
|
-
}
|
|
100920
|
-
}
|
|
100921
|
-
|
|
100922
|
-
class AwsRestJsonProtocol extends HttpBindingProtocol {
|
|
100923
|
-
serializer;
|
|
100924
|
-
deserializer;
|
|
100925
|
-
codec;
|
|
100926
|
-
mixin = new ProtocolLib;
|
|
100927
|
-
constructor({ defaultNamespace, errorTypeRegistries }) {
|
|
100928
|
-
super({
|
|
100929
|
-
defaultNamespace,
|
|
100930
|
-
errorTypeRegistries
|
|
100931
|
-
});
|
|
100932
|
-
const settings = {
|
|
100933
|
-
timestampFormat: {
|
|
100934
|
-
useTrait: true,
|
|
100935
|
-
default: 7
|
|
100936
|
-
},
|
|
100937
|
-
httpBindings: true,
|
|
100938
|
-
jsonName: true
|
|
100939
|
-
};
|
|
100940
|
-
this.codec = new JsonCodec(settings);
|
|
100941
|
-
this.serializer = new HttpInterceptingShapeSerializer(this.codec.createSerializer(), settings);
|
|
100942
|
-
this.deserializer = new HttpInterceptingShapeDeserializer(this.codec.createDeserializer(), settings);
|
|
100943
|
-
}
|
|
100944
|
-
getShapeId() {
|
|
100945
|
-
return "aws.protocols#restJson1";
|
|
100946
|
-
}
|
|
100947
|
-
getPayloadCodec() {
|
|
100948
|
-
return this.codec;
|
|
100949
|
-
}
|
|
100950
|
-
setSerdeContext(serdeContext) {
|
|
100951
|
-
this.codec.setSerdeContext(serdeContext);
|
|
100952
|
-
super.setSerdeContext(serdeContext);
|
|
100953
|
-
}
|
|
100954
|
-
async serializeRequest(operationSchema, input, context) {
|
|
100955
|
-
const request = await super.serializeRequest(operationSchema, input, context);
|
|
100956
|
-
const inputSchema = NormalizedSchema.of(operationSchema.input);
|
|
100957
|
-
if (!request.headers["content-type"]) {
|
|
100958
|
-
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema);
|
|
100959
|
-
if (contentType) {
|
|
100960
|
-
request.headers["content-type"] = contentType;
|
|
100961
|
-
}
|
|
100962
|
-
}
|
|
100963
|
-
if (request.body == null && request.headers["content-type"] === this.getDefaultContentType()) {
|
|
100964
|
-
request.body = "{}";
|
|
100965
|
-
}
|
|
100966
|
-
return request;
|
|
100967
|
-
}
|
|
100968
|
-
async deserializeResponse(operationSchema, context, response) {
|
|
100969
|
-
const output = await super.deserializeResponse(operationSchema, context, response);
|
|
100970
|
-
const outputSchema = NormalizedSchema.of(operationSchema.output);
|
|
100971
|
-
for (const [name, member] of outputSchema.structIterator()) {
|
|
100972
|
-
if (member.getMemberTraits().httpPayload && !(name in output)) {
|
|
100973
|
-
output[name] = null;
|
|
100974
|
-
}
|
|
100975
|
-
}
|
|
100976
|
-
return output;
|
|
100977
|
-
}
|
|
100978
|
-
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
100979
|
-
const errorIdentifier = loadRestJsonErrorCode(response, dataObject) ?? "Unknown";
|
|
100980
|
-
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
100981
|
-
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, dataObject, metadata);
|
|
100982
|
-
const ns = NormalizedSchema.of(errorSchema);
|
|
100983
|
-
const message = dataObject.message ?? dataObject.Message ?? "UnknownError";
|
|
100984
|
-
const ErrorCtor = this.compositeErrorRegistry.getErrorCtor(errorSchema) ?? Error;
|
|
100985
|
-
const exception = new ErrorCtor({});
|
|
100986
|
-
await this.deserializeHttpMessage(errorSchema, context, response, dataObject);
|
|
100987
|
-
const output = {};
|
|
100988
|
-
const errorDeserializer = this.codec.createDeserializer();
|
|
100989
|
-
for (const [name, member] of ns.structIterator()) {
|
|
100990
|
-
const target = member.getMergedTraits().jsonName ?? name;
|
|
100991
|
-
output[name] = errorDeserializer.readObject(member, dataObject[target]);
|
|
100992
|
-
}
|
|
100993
|
-
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
|
|
100994
|
-
$fault: ns.getMergedTraits().error,
|
|
100995
|
-
message
|
|
100996
|
-
}, output), dataObject);
|
|
100997
|
-
}
|
|
100998
|
-
getDefaultContentType() {
|
|
100999
|
-
return "application/json";
|
|
101000
|
-
}
|
|
101001
|
-
}
|
|
101002
|
-
|
|
101003
100414
|
class JsonShapeDeserializer2 extends SerdeContextConfig {
|
|
101004
100415
|
settings;
|
|
101005
100416
|
constructor(settings) {
|
|
@@ -101579,7 +100990,7 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
101579
100990
|
return;
|
|
101580
100991
|
}
|
|
101581
100992
|
if (typeof value === "number") {
|
|
101582
|
-
if (
|
|
100993
|
+
if (Math.abs(value) === Infinity || Number.isNaN(value)) {
|
|
101583
100994
|
this.writeAsciiQuoted(String(value));
|
|
101584
100995
|
return;
|
|
101585
100996
|
}
|
|
@@ -101669,7 +101080,31 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
101669
101080
|
const valueSchema = ns.getValueSchema();
|
|
101670
101081
|
if (!isDocument) {
|
|
101671
101082
|
if (valueSchema.isStringSchema() || valueSchema.isNumericSchema() || valueSchema.isBooleanSchema()) {
|
|
101672
|
-
|
|
101083
|
+
let hasSpecials = false;
|
|
101084
|
+
for (let i2 = 0;i2 < value.length; ++i2) {
|
|
101085
|
+
const v = value[i2];
|
|
101086
|
+
if (Number.isNaN(v) || v === Infinity || v === -Infinity || v == null && !sparse) {
|
|
101087
|
+
hasSpecials = true;
|
|
101088
|
+
break;
|
|
101089
|
+
}
|
|
101090
|
+
}
|
|
101091
|
+
let json2;
|
|
101092
|
+
if (!hasSpecials) {
|
|
101093
|
+
json2 = JSON.stringify(value);
|
|
101094
|
+
} else {
|
|
101095
|
+
const out = [];
|
|
101096
|
+
for (let i2 = 0;i2 < value.length; ++i2) {
|
|
101097
|
+
const v = value[i2];
|
|
101098
|
+
if (v == null && !sparse)
|
|
101099
|
+
continue;
|
|
101100
|
+
if (Number.isNaN(v) || v === Infinity || v === -Infinity) {
|
|
101101
|
+
out.push(String(v));
|
|
101102
|
+
} else {
|
|
101103
|
+
out.push(v);
|
|
101104
|
+
}
|
|
101105
|
+
}
|
|
101106
|
+
json2 = JSON.stringify(out);
|
|
101107
|
+
}
|
|
101673
101108
|
this.ensure(json2.length * 3);
|
|
101674
101109
|
this.i += encoder2.encodeInto(json2, this.json.subarray(this.i)).written;
|
|
101675
101110
|
return;
|
|
@@ -101698,17 +101133,21 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
101698
101133
|
const valueSchema = ns.getValueSchema();
|
|
101699
101134
|
if (!isDocument) {
|
|
101700
101135
|
if (valueSchema.isStringSchema() || valueSchema.isNumericSchema() || valueSchema.isBooleanSchema()) {
|
|
101701
|
-
let
|
|
101702
|
-
|
|
101703
|
-
|
|
101704
|
-
|
|
101705
|
-
|
|
101706
|
-
|
|
101707
|
-
|
|
101708
|
-
|
|
101136
|
+
let modifications;
|
|
101137
|
+
for (const k in value) {
|
|
101138
|
+
const v = value[k];
|
|
101139
|
+
if (Number.isNaN(v) || v === Infinity || v === -Infinity) {
|
|
101140
|
+
(modifications ??= {})[k] = v;
|
|
101141
|
+
value[k] = String(v);
|
|
101142
|
+
} else if (v === null && !sparse) {
|
|
101143
|
+
(modifications ??= {})[k] = null;
|
|
101144
|
+
value[k] = undefined;
|
|
101709
101145
|
}
|
|
101710
101146
|
}
|
|
101711
|
-
const json2 = JSON.stringify(
|
|
101147
|
+
const json2 = JSON.stringify(value);
|
|
101148
|
+
if (modifications) {
|
|
101149
|
+
Object.assign(value, modifications);
|
|
101150
|
+
}
|
|
101712
101151
|
this.ensure(json2.length * 3);
|
|
101713
101152
|
this.i += encoder2.encodeInto(json2, this.json.subarray(this.i)).written;
|
|
101714
101153
|
return;
|
|
@@ -101779,6 +101218,598 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
101779
101218
|
}
|
|
101780
101219
|
}
|
|
101781
101220
|
|
|
101221
|
+
class AwsJsonRpcProtocol extends RpcProtocol {
|
|
101222
|
+
serializer;
|
|
101223
|
+
deserializer;
|
|
101224
|
+
serviceTarget;
|
|
101225
|
+
codec;
|
|
101226
|
+
mixin;
|
|
101227
|
+
awsQueryCompatible;
|
|
101228
|
+
constructor({ defaultNamespace, errorTypeRegistries, serviceTarget, awsQueryCompatible, jsonCodec }) {
|
|
101229
|
+
super({
|
|
101230
|
+
defaultNamespace,
|
|
101231
|
+
errorTypeRegistries
|
|
101232
|
+
});
|
|
101233
|
+
this.serviceTarget = serviceTarget;
|
|
101234
|
+
this.codec = jsonCodec ?? new JsonCodec2({
|
|
101235
|
+
timestampFormat: {
|
|
101236
|
+
useTrait: true,
|
|
101237
|
+
default: 7
|
|
101238
|
+
},
|
|
101239
|
+
jsonName: false
|
|
101240
|
+
});
|
|
101241
|
+
this.serializer = this.codec.createSerializer();
|
|
101242
|
+
this.deserializer = this.codec.createDeserializer();
|
|
101243
|
+
this.awsQueryCompatible = !!awsQueryCompatible;
|
|
101244
|
+
this.mixin = new ProtocolLib(this.awsQueryCompatible);
|
|
101245
|
+
}
|
|
101246
|
+
async serializeRequest(operationSchema, input, context) {
|
|
101247
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
101248
|
+
if (!request.path.endsWith("/")) {
|
|
101249
|
+
request.path += "/";
|
|
101250
|
+
}
|
|
101251
|
+
request.headers["content-type"] = `application/x-amz-json-${this.getJsonRpcVersion()}`;
|
|
101252
|
+
request.headers["x-amz-target"] = `${this.serviceTarget}.${operationSchema.name}`;
|
|
101253
|
+
if (this.awsQueryCompatible) {
|
|
101254
|
+
request.headers["x-amzn-query-mode"] = "true";
|
|
101255
|
+
}
|
|
101256
|
+
if (deref(operationSchema.input) === "unit" || !request.body) {
|
|
101257
|
+
request.body = "{}";
|
|
101258
|
+
}
|
|
101259
|
+
return request;
|
|
101260
|
+
}
|
|
101261
|
+
getPayloadCodec() {
|
|
101262
|
+
return this.codec;
|
|
101263
|
+
}
|
|
101264
|
+
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
101265
|
+
const { awsQueryCompatible } = this;
|
|
101266
|
+
if (awsQueryCompatible) {
|
|
101267
|
+
this.mixin.setQueryCompatError(dataObject, response);
|
|
101268
|
+
}
|
|
101269
|
+
const errorIdentifier = loadJsonRpcErrorCode(response, dataObject, awsQueryCompatible) ?? "Unknown";
|
|
101270
|
+
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
101271
|
+
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, dataObject, metadata, awsQueryCompatible ? this.mixin.findQueryCompatibleError : undefined);
|
|
101272
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
101273
|
+
const message = dataObject.message ?? dataObject.Message ?? "UnknownError";
|
|
101274
|
+
const ErrorCtor = this.compositeErrorRegistry.getErrorCtor(errorSchema) ?? Error;
|
|
101275
|
+
const exception = new ErrorCtor({});
|
|
101276
|
+
const output = {};
|
|
101277
|
+
const errorDeserializer = this.codec.createDeserializer();
|
|
101278
|
+
for (const [name, member] of ns.structIterator()) {
|
|
101279
|
+
if (dataObject[name] != null) {
|
|
101280
|
+
output[name] = errorDeserializer.readObject(member, dataObject[name]);
|
|
101281
|
+
}
|
|
101282
|
+
}
|
|
101283
|
+
if (awsQueryCompatible) {
|
|
101284
|
+
this.mixin.queryCompatOutput(dataObject, output);
|
|
101285
|
+
}
|
|
101286
|
+
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
|
|
101287
|
+
$fault: ns.getMergedTraits().error,
|
|
101288
|
+
message
|
|
101289
|
+
}, output), dataObject);
|
|
101290
|
+
}
|
|
101291
|
+
}
|
|
101292
|
+
|
|
101293
|
+
class AwsJson1_0Protocol extends AwsJsonRpcProtocol {
|
|
101294
|
+
constructor({ defaultNamespace, errorTypeRegistries, serviceTarget, awsQueryCompatible, jsonCodec }) {
|
|
101295
|
+
super({
|
|
101296
|
+
defaultNamespace,
|
|
101297
|
+
errorTypeRegistries,
|
|
101298
|
+
serviceTarget,
|
|
101299
|
+
awsQueryCompatible,
|
|
101300
|
+
jsonCodec
|
|
101301
|
+
});
|
|
101302
|
+
}
|
|
101303
|
+
getShapeId() {
|
|
101304
|
+
return "aws.protocols#awsJson1_0";
|
|
101305
|
+
}
|
|
101306
|
+
getJsonRpcVersion() {
|
|
101307
|
+
return "1.0";
|
|
101308
|
+
}
|
|
101309
|
+
getDefaultContentType() {
|
|
101310
|
+
return "application/x-amz-json-1.0";
|
|
101311
|
+
}
|
|
101312
|
+
}
|
|
101313
|
+
|
|
101314
|
+
class AwsJson1_1Protocol extends AwsJsonRpcProtocol {
|
|
101315
|
+
constructor({ defaultNamespace, errorTypeRegistries, serviceTarget, awsQueryCompatible, jsonCodec }) {
|
|
101316
|
+
super({
|
|
101317
|
+
defaultNamespace,
|
|
101318
|
+
errorTypeRegistries,
|
|
101319
|
+
serviceTarget,
|
|
101320
|
+
awsQueryCompatible,
|
|
101321
|
+
jsonCodec
|
|
101322
|
+
});
|
|
101323
|
+
}
|
|
101324
|
+
getShapeId() {
|
|
101325
|
+
return "aws.protocols#awsJson1_1";
|
|
101326
|
+
}
|
|
101327
|
+
getJsonRpcVersion() {
|
|
101328
|
+
return "1.1";
|
|
101329
|
+
}
|
|
101330
|
+
getDefaultContentType() {
|
|
101331
|
+
return "application/x-amz-json-1.1";
|
|
101332
|
+
}
|
|
101333
|
+
}
|
|
101334
|
+
|
|
101335
|
+
class AwsRestJsonProtocol extends HttpBindingProtocol {
|
|
101336
|
+
serializer;
|
|
101337
|
+
deserializer;
|
|
101338
|
+
codec;
|
|
101339
|
+
mixin = new ProtocolLib;
|
|
101340
|
+
constructor({ defaultNamespace, errorTypeRegistries, jsonCodec }) {
|
|
101341
|
+
super({
|
|
101342
|
+
defaultNamespace,
|
|
101343
|
+
errorTypeRegistries
|
|
101344
|
+
});
|
|
101345
|
+
const settings = {
|
|
101346
|
+
timestampFormat: {
|
|
101347
|
+
useTrait: true,
|
|
101348
|
+
default: 7
|
|
101349
|
+
},
|
|
101350
|
+
httpBindings: true,
|
|
101351
|
+
jsonName: true
|
|
101352
|
+
};
|
|
101353
|
+
this.codec = jsonCodec ?? new JsonCodec2(settings);
|
|
101354
|
+
this.serializer = new HttpInterceptingShapeSerializer(this.codec.createSerializer(), settings);
|
|
101355
|
+
this.deserializer = new HttpInterceptingShapeDeserializer(this.codec.createDeserializer(), settings);
|
|
101356
|
+
}
|
|
101357
|
+
getShapeId() {
|
|
101358
|
+
return "aws.protocols#restJson1";
|
|
101359
|
+
}
|
|
101360
|
+
getPayloadCodec() {
|
|
101361
|
+
return this.codec;
|
|
101362
|
+
}
|
|
101363
|
+
setSerdeContext(serdeContext) {
|
|
101364
|
+
this.codec.setSerdeContext(serdeContext);
|
|
101365
|
+
super.setSerdeContext(serdeContext);
|
|
101366
|
+
}
|
|
101367
|
+
async serializeRequest(operationSchema, input, context) {
|
|
101368
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
101369
|
+
const inputSchema = NormalizedSchema.of(operationSchema.input);
|
|
101370
|
+
if (!request.headers["content-type"]) {
|
|
101371
|
+
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema);
|
|
101372
|
+
if (contentType) {
|
|
101373
|
+
request.headers["content-type"] = contentType;
|
|
101374
|
+
}
|
|
101375
|
+
}
|
|
101376
|
+
if (request.body == null && request.headers["content-type"] === this.getDefaultContentType()) {
|
|
101377
|
+
request.body = "{}";
|
|
101378
|
+
}
|
|
101379
|
+
return request;
|
|
101380
|
+
}
|
|
101381
|
+
async deserializeResponse(operationSchema, context, response) {
|
|
101382
|
+
const output = await super.deserializeResponse(operationSchema, context, response);
|
|
101383
|
+
const outputSchema = NormalizedSchema.of(operationSchema.output);
|
|
101384
|
+
for (const [name, member] of outputSchema.structIterator()) {
|
|
101385
|
+
if (member.getMemberTraits().httpPayload && !(name in output)) {
|
|
101386
|
+
output[name] = null;
|
|
101387
|
+
}
|
|
101388
|
+
}
|
|
101389
|
+
return output;
|
|
101390
|
+
}
|
|
101391
|
+
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
101392
|
+
const errorIdentifier = loadRestJsonErrorCode(response, dataObject) ?? "Unknown";
|
|
101393
|
+
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
101394
|
+
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, dataObject, metadata);
|
|
101395
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
101396
|
+
const message = dataObject.message ?? dataObject.Message ?? "UnknownError";
|
|
101397
|
+
const ErrorCtor = this.compositeErrorRegistry.getErrorCtor(errorSchema) ?? Error;
|
|
101398
|
+
const exception = new ErrorCtor({});
|
|
101399
|
+
await this.deserializeHttpMessage(errorSchema, context, response, dataObject);
|
|
101400
|
+
const output = {};
|
|
101401
|
+
const errorDeserializer = this.codec.createDeserializer();
|
|
101402
|
+
for (const [name, member] of ns.structIterator()) {
|
|
101403
|
+
const target = member.getMergedTraits().jsonName ?? name;
|
|
101404
|
+
output[name] = errorDeserializer.readObject(member, dataObject[target]);
|
|
101405
|
+
}
|
|
101406
|
+
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
|
|
101407
|
+
$fault: ns.getMergedTraits().error,
|
|
101408
|
+
message
|
|
101409
|
+
}, output), dataObject);
|
|
101410
|
+
}
|
|
101411
|
+
getDefaultContentType() {
|
|
101412
|
+
return "application/json";
|
|
101413
|
+
}
|
|
101414
|
+
}
|
|
101415
|
+
|
|
101416
|
+
class JsonShapeDeserializer extends SerdeContextConfig {
|
|
101417
|
+
settings;
|
|
101418
|
+
constructor(settings) {
|
|
101419
|
+
super();
|
|
101420
|
+
this.settings = settings;
|
|
101421
|
+
}
|
|
101422
|
+
async read(schema, data) {
|
|
101423
|
+
const reviver = needsReviver(schema) ? jsonReviver : undefined;
|
|
101424
|
+
return this._read(schema, typeof data === "string" ? JSON.parse(data, reviver) : await parseJsonBody(data, this.serdeContext, schema));
|
|
101425
|
+
}
|
|
101426
|
+
readObject(schema, data) {
|
|
101427
|
+
return this._read(schema, data);
|
|
101428
|
+
}
|
|
101429
|
+
_read(schema, value) {
|
|
101430
|
+
const isObject5 = value !== null && typeof value === "object";
|
|
101431
|
+
const ns = NormalizedSchema.of(schema);
|
|
101432
|
+
if (isObject5) {
|
|
101433
|
+
if (ns.isStructSchema()) {
|
|
101434
|
+
const record2 = value;
|
|
101435
|
+
const union2 = ns.isUnionSchema();
|
|
101436
|
+
const out = {};
|
|
101437
|
+
let nameMap = undefined;
|
|
101438
|
+
const { jsonName } = this.settings;
|
|
101439
|
+
if (jsonName) {
|
|
101440
|
+
nameMap = {};
|
|
101441
|
+
}
|
|
101442
|
+
let unionSerde;
|
|
101443
|
+
if (union2) {
|
|
101444
|
+
unionSerde = new UnionSerde(record2, out);
|
|
101445
|
+
}
|
|
101446
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
101447
|
+
let fromKey = memberName;
|
|
101448
|
+
if (jsonName) {
|
|
101449
|
+
fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
|
|
101450
|
+
nameMap[fromKey] = memberName;
|
|
101451
|
+
}
|
|
101452
|
+
if (union2) {
|
|
101453
|
+
unionSerde.mark(fromKey);
|
|
101454
|
+
}
|
|
101455
|
+
if (record2[fromKey] != null) {
|
|
101456
|
+
out[memberName] = this._read(memberSchema, record2[fromKey]);
|
|
101457
|
+
}
|
|
101458
|
+
}
|
|
101459
|
+
if (union2) {
|
|
101460
|
+
unionSerde.writeUnknown();
|
|
101461
|
+
} else if (typeof record2.__type === "string") {
|
|
101462
|
+
for (const k in record2) {
|
|
101463
|
+
const v = record2[k];
|
|
101464
|
+
const t = jsonName ? nameMap[k] ?? k : k;
|
|
101465
|
+
if (!(t in out)) {
|
|
101466
|
+
out[t] = v;
|
|
101467
|
+
}
|
|
101468
|
+
}
|
|
101469
|
+
}
|
|
101470
|
+
return out;
|
|
101471
|
+
}
|
|
101472
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
101473
|
+
const listMember = ns.getValueSchema();
|
|
101474
|
+
const out = [];
|
|
101475
|
+
for (const item of value) {
|
|
101476
|
+
out.push(this._read(listMember, item));
|
|
101477
|
+
}
|
|
101478
|
+
return out;
|
|
101479
|
+
}
|
|
101480
|
+
if (ns.isMapSchema()) {
|
|
101481
|
+
const mapMember = ns.getValueSchema();
|
|
101482
|
+
const out = {};
|
|
101483
|
+
for (const _k in value) {
|
|
101484
|
+
if (_k === "__proto__") {
|
|
101485
|
+
writeKey(out);
|
|
101486
|
+
}
|
|
101487
|
+
out[_k] = this._read(mapMember, value[_k]);
|
|
101488
|
+
}
|
|
101489
|
+
return out;
|
|
101490
|
+
}
|
|
101491
|
+
}
|
|
101492
|
+
if (ns.isBlobSchema() && typeof value === "string") {
|
|
101493
|
+
return fromBase64(value);
|
|
101494
|
+
}
|
|
101495
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
|
101496
|
+
if (ns.isStringSchema() && typeof value === "string" && mediaType) {
|
|
101497
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
101498
|
+
if (isJson) {
|
|
101499
|
+
return LazyJsonString.from(value);
|
|
101500
|
+
}
|
|
101501
|
+
return value;
|
|
101502
|
+
}
|
|
101503
|
+
if (ns.isTimestampSchema() && value != null) {
|
|
101504
|
+
const format3 = determineTimestampFormat(ns, this.settings);
|
|
101505
|
+
switch (format3) {
|
|
101506
|
+
case 5:
|
|
101507
|
+
return parseRfc3339DateTimeWithOffset(value);
|
|
101508
|
+
case 6:
|
|
101509
|
+
return parseRfc7231DateTime(value);
|
|
101510
|
+
case 7:
|
|
101511
|
+
return parseEpochTimestamp(value);
|
|
101512
|
+
default:
|
|
101513
|
+
console.warn("Missing timestamp format, parsing value with Date constructor:", value);
|
|
101514
|
+
return new Date(value);
|
|
101515
|
+
}
|
|
101516
|
+
}
|
|
101517
|
+
if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) {
|
|
101518
|
+
return BigInt(value);
|
|
101519
|
+
}
|
|
101520
|
+
if (ns.isBigDecimalSchema() && value != null) {
|
|
101521
|
+
if (value instanceof NumericValue) {
|
|
101522
|
+
return value;
|
|
101523
|
+
}
|
|
101524
|
+
const untyped = value;
|
|
101525
|
+
if (untyped.type === "bigDecimal" && "string" in untyped) {
|
|
101526
|
+
return new NumericValue(untyped.string, untyped.type);
|
|
101527
|
+
}
|
|
101528
|
+
return new NumericValue(String(value), "bigDecimal");
|
|
101529
|
+
}
|
|
101530
|
+
if (ns.isNumericSchema() && typeof value === "string") {
|
|
101531
|
+
switch (value) {
|
|
101532
|
+
case "Infinity":
|
|
101533
|
+
return Infinity;
|
|
101534
|
+
case "-Infinity":
|
|
101535
|
+
return -Infinity;
|
|
101536
|
+
case "NaN":
|
|
101537
|
+
return NaN;
|
|
101538
|
+
}
|
|
101539
|
+
return value;
|
|
101540
|
+
}
|
|
101541
|
+
if (ns.isDocumentSchema()) {
|
|
101542
|
+
if (isObject5) {
|
|
101543
|
+
const out = Array.isArray(value) ? [] : {};
|
|
101544
|
+
for (const k in value) {
|
|
101545
|
+
if (k === "__proto__") {
|
|
101546
|
+
writeKey(out);
|
|
101547
|
+
}
|
|
101548
|
+
const v = value[k];
|
|
101549
|
+
if (v instanceof NumericValue) {
|
|
101550
|
+
out[k] = v;
|
|
101551
|
+
} else {
|
|
101552
|
+
out[k] = this._read(ns, v);
|
|
101553
|
+
}
|
|
101554
|
+
}
|
|
101555
|
+
return out;
|
|
101556
|
+
} else {
|
|
101557
|
+
return structuredClone(value);
|
|
101558
|
+
}
|
|
101559
|
+
}
|
|
101560
|
+
return value;
|
|
101561
|
+
}
|
|
101562
|
+
}
|
|
101563
|
+
var NUMERIC_CONTROL_CHAR = String.fromCharCode(925);
|
|
101564
|
+
|
|
101565
|
+
class JsonReplacer {
|
|
101566
|
+
values = new Map;
|
|
101567
|
+
counter = 0;
|
|
101568
|
+
stage = 0;
|
|
101569
|
+
createReplacer() {
|
|
101570
|
+
if (this.stage === 1) {
|
|
101571
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");
|
|
101572
|
+
}
|
|
101573
|
+
if (this.stage === 2) {
|
|
101574
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
|
|
101575
|
+
}
|
|
101576
|
+
this.stage = 1;
|
|
101577
|
+
return (key, value) => {
|
|
101578
|
+
if (value instanceof NumericValue) {
|
|
101579
|
+
const v = `${NUMERIC_CONTROL_CHAR + "nv" + this.counter++}_` + value.string;
|
|
101580
|
+
this.values.set(`"${v}"`, value.string);
|
|
101581
|
+
return v;
|
|
101582
|
+
}
|
|
101583
|
+
if (typeof value === "bigint") {
|
|
101584
|
+
const s = value.toString();
|
|
101585
|
+
const v = `${NUMERIC_CONTROL_CHAR + "b" + this.counter++}_` + s;
|
|
101586
|
+
this.values.set(`"${v}"`, s);
|
|
101587
|
+
return v;
|
|
101588
|
+
}
|
|
101589
|
+
return value;
|
|
101590
|
+
};
|
|
101591
|
+
}
|
|
101592
|
+
replaceInJson(json2) {
|
|
101593
|
+
if (this.stage === 0) {
|
|
101594
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");
|
|
101595
|
+
}
|
|
101596
|
+
if (this.stage === 2) {
|
|
101597
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
|
|
101598
|
+
}
|
|
101599
|
+
this.stage = 2;
|
|
101600
|
+
if (this.counter === 0) {
|
|
101601
|
+
return json2;
|
|
101602
|
+
}
|
|
101603
|
+
for (const [key, value] of this.values) {
|
|
101604
|
+
json2 = json2.replace(key, value);
|
|
101605
|
+
}
|
|
101606
|
+
return json2;
|
|
101607
|
+
}
|
|
101608
|
+
}
|
|
101609
|
+
|
|
101610
|
+
class JsonShapeSerializer extends SerdeContextConfig {
|
|
101611
|
+
settings;
|
|
101612
|
+
buffer;
|
|
101613
|
+
useReplacer = false;
|
|
101614
|
+
rootSchema;
|
|
101615
|
+
constructor(settings) {
|
|
101616
|
+
super();
|
|
101617
|
+
this.settings = settings;
|
|
101618
|
+
}
|
|
101619
|
+
write(schema, value) {
|
|
101620
|
+
this.rootSchema = NormalizedSchema.of(schema);
|
|
101621
|
+
this.buffer = this._write(this.rootSchema, value);
|
|
101622
|
+
}
|
|
101623
|
+
flush() {
|
|
101624
|
+
const { rootSchema, useReplacer } = this;
|
|
101625
|
+
this.rootSchema = undefined;
|
|
101626
|
+
this.useReplacer = false;
|
|
101627
|
+
if (rootSchema?.isStructSchema() || rootSchema?.isDocumentSchema()) {
|
|
101628
|
+
if (!useReplacer) {
|
|
101629
|
+
return JSON.stringify(this.buffer);
|
|
101630
|
+
}
|
|
101631
|
+
const replacer = new JsonReplacer;
|
|
101632
|
+
return replacer.replaceInJson(JSON.stringify(this.buffer, replacer.createReplacer(), 0));
|
|
101633
|
+
}
|
|
101634
|
+
return this.buffer;
|
|
101635
|
+
}
|
|
101636
|
+
writeDiscriminatedDocument(schema, value) {
|
|
101637
|
+
this.write(schema, value);
|
|
101638
|
+
if (typeof this.buffer === "object") {
|
|
101639
|
+
this.buffer.__type = NormalizedSchema.of(schema).getName(true);
|
|
101640
|
+
}
|
|
101641
|
+
}
|
|
101642
|
+
_write(schema, value, container) {
|
|
101643
|
+
const isObject5 = value !== null && typeof value === "object";
|
|
101644
|
+
const ns = NormalizedSchema.of(schema);
|
|
101645
|
+
if (isObject5) {
|
|
101646
|
+
if (ns.isStructSchema()) {
|
|
101647
|
+
const record2 = value;
|
|
101648
|
+
const out = {};
|
|
101649
|
+
const { jsonName } = this.settings;
|
|
101650
|
+
let nameMap = undefined;
|
|
101651
|
+
if (jsonName) {
|
|
101652
|
+
nameMap = {};
|
|
101653
|
+
}
|
|
101654
|
+
let outCount = 0;
|
|
101655
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
101656
|
+
const serializableValue = this._write(memberSchema, record2[memberName], ns);
|
|
101657
|
+
if (serializableValue !== undefined) {
|
|
101658
|
+
let targetKey = memberName;
|
|
101659
|
+
if (jsonName) {
|
|
101660
|
+
targetKey = memberSchema.getMergedTraits().jsonName ?? memberName;
|
|
101661
|
+
nameMap[memberName] = targetKey;
|
|
101662
|
+
}
|
|
101663
|
+
out[targetKey] = serializableValue;
|
|
101664
|
+
outCount++;
|
|
101665
|
+
}
|
|
101666
|
+
}
|
|
101667
|
+
if (ns.isUnionSchema() && outCount === 0) {
|
|
101668
|
+
const { $unknown } = record2;
|
|
101669
|
+
if (Array.isArray($unknown)) {
|
|
101670
|
+
const [k, v] = $unknown;
|
|
101671
|
+
if (k === "__proto__") {
|
|
101672
|
+
writeKey(out);
|
|
101673
|
+
}
|
|
101674
|
+
out[k] = this._write(15, v);
|
|
101675
|
+
}
|
|
101676
|
+
} else if (typeof record2.__type === "string") {
|
|
101677
|
+
for (const k in record2) {
|
|
101678
|
+
const v = record2[k];
|
|
101679
|
+
const targetKey = jsonName ? nameMap[k] ?? k : k;
|
|
101680
|
+
if (!(targetKey in out)) {
|
|
101681
|
+
out[targetKey] = this._write(15, v);
|
|
101682
|
+
}
|
|
101683
|
+
}
|
|
101684
|
+
}
|
|
101685
|
+
return out;
|
|
101686
|
+
}
|
|
101687
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
101688
|
+
const listMember = ns.getValueSchema();
|
|
101689
|
+
const out = [];
|
|
101690
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
101691
|
+
for (const item of value) {
|
|
101692
|
+
if (sparse || item != null) {
|
|
101693
|
+
out.push(this._write(listMember, item));
|
|
101694
|
+
}
|
|
101695
|
+
}
|
|
101696
|
+
return out;
|
|
101697
|
+
}
|
|
101698
|
+
if (ns.isMapSchema()) {
|
|
101699
|
+
const mapMember = ns.getValueSchema();
|
|
101700
|
+
const out = {};
|
|
101701
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
101702
|
+
for (const _k in value) {
|
|
101703
|
+
const _v = value[_k];
|
|
101704
|
+
if (sparse || _v != null) {
|
|
101705
|
+
if (_k === "__proto__") {
|
|
101706
|
+
writeKey(out);
|
|
101707
|
+
}
|
|
101708
|
+
out[_k] = this._write(mapMember, _v);
|
|
101709
|
+
}
|
|
101710
|
+
}
|
|
101711
|
+
return out;
|
|
101712
|
+
}
|
|
101713
|
+
if (value instanceof Uint8Array && ns.isBlobSchema()) {
|
|
101714
|
+
if (ns === this.rootSchema) {
|
|
101715
|
+
return value;
|
|
101716
|
+
}
|
|
101717
|
+
return (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
101718
|
+
}
|
|
101719
|
+
if (value instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
|
|
101720
|
+
const format3 = determineTimestampFormat(ns, this.settings);
|
|
101721
|
+
switch (format3) {
|
|
101722
|
+
case 5:
|
|
101723
|
+
return value.toISOString().replace(".000Z", "Z");
|
|
101724
|
+
case 6:
|
|
101725
|
+
return dateToUtcString(value);
|
|
101726
|
+
case 7:
|
|
101727
|
+
return value.getTime() / 1000;
|
|
101728
|
+
default:
|
|
101729
|
+
console.warn("Missing timestamp format, using epoch seconds", value);
|
|
101730
|
+
return value.getTime() / 1000;
|
|
101731
|
+
}
|
|
101732
|
+
}
|
|
101733
|
+
if (value instanceof NumericValue) {
|
|
101734
|
+
this.useReplacer = true;
|
|
101735
|
+
}
|
|
101736
|
+
}
|
|
101737
|
+
if (value === null && container?.isStructSchema()) {
|
|
101738
|
+
return;
|
|
101739
|
+
}
|
|
101740
|
+
if (ns.isStringSchema()) {
|
|
101741
|
+
if (typeof value === "undefined" && ns.isIdempotencyToken()) {
|
|
101742
|
+
return generateIdempotencyToken();
|
|
101743
|
+
}
|
|
101744
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
|
101745
|
+
if (value != null && mediaType) {
|
|
101746
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
101747
|
+
if (isJson) {
|
|
101748
|
+
return LazyJsonString.from(value);
|
|
101749
|
+
}
|
|
101750
|
+
}
|
|
101751
|
+
return value;
|
|
101752
|
+
}
|
|
101753
|
+
if (typeof value === "number") {
|
|
101754
|
+
if (Math.abs(value) === Infinity || isNaN(value)) {
|
|
101755
|
+
return String(value);
|
|
101756
|
+
}
|
|
101757
|
+
return value;
|
|
101758
|
+
}
|
|
101759
|
+
if (typeof value === "string" && ns.isBlobSchema()) {
|
|
101760
|
+
if (ns === this.rootSchema) {
|
|
101761
|
+
return value;
|
|
101762
|
+
}
|
|
101763
|
+
return (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
101764
|
+
}
|
|
101765
|
+
if (typeof value === "bigint") {
|
|
101766
|
+
this.useReplacer = true;
|
|
101767
|
+
}
|
|
101768
|
+
if (ns.isDocumentSchema()) {
|
|
101769
|
+
if (isObject5) {
|
|
101770
|
+
if (value instanceof Uint8Array) {
|
|
101771
|
+
return (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
101772
|
+
}
|
|
101773
|
+
const out = Array.isArray(value) ? [] : {};
|
|
101774
|
+
for (const k in value) {
|
|
101775
|
+
const v = value[k];
|
|
101776
|
+
if (k === "__proto__") {
|
|
101777
|
+
writeKey(out);
|
|
101778
|
+
}
|
|
101779
|
+
if (v instanceof NumericValue) {
|
|
101780
|
+
this.useReplacer = true;
|
|
101781
|
+
out[k] = v;
|
|
101782
|
+
} else {
|
|
101783
|
+
out[k] = this._write(ns, v);
|
|
101784
|
+
}
|
|
101785
|
+
}
|
|
101786
|
+
return out;
|
|
101787
|
+
} else {
|
|
101788
|
+
return structuredClone(value);
|
|
101789
|
+
}
|
|
101790
|
+
}
|
|
101791
|
+
return value;
|
|
101792
|
+
}
|
|
101793
|
+
}
|
|
101794
|
+
|
|
101795
|
+
class JsonCodec extends SerdeContextConfig {
|
|
101796
|
+
settings;
|
|
101797
|
+
constructor(settings) {
|
|
101798
|
+
super();
|
|
101799
|
+
this.settings = settings;
|
|
101800
|
+
}
|
|
101801
|
+
createSerializer() {
|
|
101802
|
+
const serializer = new JsonShapeSerializer(this.settings);
|
|
101803
|
+
serializer.setSerdeContext(this.serdeContext);
|
|
101804
|
+
return serializer;
|
|
101805
|
+
}
|
|
101806
|
+
createDeserializer() {
|
|
101807
|
+
const deserializer = new JsonShapeDeserializer(this.settings);
|
|
101808
|
+
deserializer.setSerdeContext(this.serdeContext);
|
|
101809
|
+
return deserializer;
|
|
101810
|
+
}
|
|
101811
|
+
}
|
|
101812
|
+
|
|
101782
101813
|
class XmlShapeDeserializer extends SerdeContextConfig {
|
|
101783
101814
|
settings;
|
|
101784
101815
|
stringDeserializer;
|
|
@@ -102822,7 +102853,7 @@ var require_sso_oidc = __commonJS((exports) => {
|
|
|
102822
102853
|
Region: { type: "builtInParams", name: "region" },
|
|
102823
102854
|
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
|
|
102824
102855
|
};
|
|
102825
|
-
var version2 = "3.997.
|
|
102856
|
+
var version2 = "3.997.39";
|
|
102826
102857
|
var packageInfo = {
|
|
102827
102858
|
version: version2
|
|
102828
102859
|
};
|
|
@@ -103719,7 +103750,7 @@ var require_sso = __commonJS((exports) => {
|
|
|
103719
103750
|
Region: { type: "builtInParams", name: "region" },
|
|
103720
103751
|
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
|
|
103721
103752
|
};
|
|
103722
|
-
var version2 = "3.997.
|
|
103753
|
+
var version2 = "3.997.39";
|
|
103723
103754
|
var packageInfo = {
|
|
103724
103755
|
version: version2
|
|
103725
103756
|
};
|
|
@@ -104813,7 +104844,7 @@ var require_sts = __commonJS((exports) => {
|
|
|
104813
104844
|
Region: { type: "builtInParams", name: "region" },
|
|
104814
104845
|
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
|
|
104815
104846
|
};
|
|
104816
|
-
var version2 = "3.997.
|
|
104847
|
+
var version2 = "3.997.39";
|
|
104817
104848
|
var packageInfo = {
|
|
104818
104849
|
version: version2
|
|
104819
104850
|
};
|
|
@@ -105582,7 +105613,7 @@ var require_signin = __commonJS((exports) => {
|
|
|
105582
105613
|
Region: { type: "builtInParams", name: "region" },
|
|
105583
105614
|
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
|
|
105584
105615
|
};
|
|
105585
|
-
var version2 = "3.997.
|
|
105616
|
+
var version2 = "3.997.39";
|
|
105586
105617
|
var packageInfo = {
|
|
105587
105618
|
version: version2
|
|
105588
105619
|
};
|
|
@@ -106239,7 +106270,7 @@ var require_signin = __commonJS((exports) => {
|
|
|
106239
106270
|
// node_modules/@aws-sdk/credential-provider-login/dist-cjs/index.js
|
|
106240
106271
|
var require_dist_cjs12 = __commonJS((exports) => {
|
|
106241
106272
|
var { setCredentialFeature } = require_client3();
|
|
106242
|
-
var { CredentialsProviderError,
|
|
106273
|
+
var { CredentialsProviderError, parseKnownFiles, getProfileName } = require_config();
|
|
106243
106274
|
var { HttpRequest } = require_protocols();
|
|
106244
106275
|
var { createHash: createHash2, createPrivateKey, createPublicKey, sign } = __require("node:crypto");
|
|
106245
106276
|
var { promises } = __require("node:fs");
|
|
@@ -106268,13 +106299,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
|
|
|
106268
106299
|
if (timeUntilExpiry <= LoginCredentialsFetcher.REFRESH_THRESHOLD) {
|
|
106269
106300
|
return this.refresh(token);
|
|
106270
106301
|
}
|
|
106271
|
-
return
|
|
106272
|
-
accessKeyId: accessToken.accessKeyId,
|
|
106273
|
-
secretAccessKey: accessToken.secretAccessKey,
|
|
106274
|
-
sessionToken: accessToken.sessionToken,
|
|
106275
|
-
accountId: accessToken.accountId,
|
|
106276
|
-
expiration: new Date(accessToken.expiresAt)
|
|
106277
|
-
};
|
|
106302
|
+
return this.toCredentials(token.accessToken);
|
|
106278
106303
|
}
|
|
106279
106304
|
get logger() {
|
|
106280
106305
|
return this.init?.logger;
|
|
@@ -106282,7 +106307,25 @@ var require_dist_cjs12 = __commonJS((exports) => {
|
|
|
106282
106307
|
get loginSession() {
|
|
106283
106308
|
return this.profileData.login_session;
|
|
106284
106309
|
}
|
|
106310
|
+
toCredentials(token) {
|
|
106311
|
+
return {
|
|
106312
|
+
accessKeyId: token.accessKeyId,
|
|
106313
|
+
secretAccessKey: token.secretAccessKey,
|
|
106314
|
+
sessionToken: token.sessionToken,
|
|
106315
|
+
accountId: token.accountId,
|
|
106316
|
+
expiration: new Date(token.expiresAt)
|
|
106317
|
+
};
|
|
106318
|
+
}
|
|
106285
106319
|
async refresh(token) {
|
|
106320
|
+
const diskToken = await this.loadToken().catch(() => token);
|
|
106321
|
+
const now = Date.now();
|
|
106322
|
+
const diskExpiry = new Date(diskToken.accessToken.expiresAt).getTime();
|
|
106323
|
+
const tokenExpiry = new Date(token.accessToken.expiresAt).getTime();
|
|
106324
|
+
const freshToken = diskExpiry <= now && tokenExpiry > now ? token : diskToken;
|
|
106325
|
+
const freshExpiry = new Date(freshToken.accessToken.expiresAt).getTime();
|
|
106326
|
+
if (freshExpiry - Date.now() > LoginCredentialsFetcher.REFRESH_THRESHOLD) {
|
|
106327
|
+
return this.toCredentials(freshToken.accessToken);
|
|
106328
|
+
}
|
|
106286
106329
|
const { SigninClient, CreateOAuth2TokenCommand } = require_signin();
|
|
106287
106330
|
const { logger, userAgentAppId } = this.callerClientConfig ?? {};
|
|
106288
106331
|
const isH2 = (requestHandler2) => {
|
|
@@ -106304,8 +106347,8 @@ var require_dist_cjs12 = __commonJS((exports) => {
|
|
|
106304
106347
|
this.createDPoPInterceptor(client.middlewareStack);
|
|
106305
106348
|
const commandInput = {
|
|
106306
106349
|
tokenInput: {
|
|
106307
|
-
clientId:
|
|
106308
|
-
refreshToken:
|
|
106350
|
+
clientId: freshToken.clientId,
|
|
106351
|
+
refreshToken: freshToken.refreshToken,
|
|
106309
106352
|
grantType: "refresh_token"
|
|
106310
106353
|
}
|
|
106311
106354
|
};
|
|
@@ -106322,9 +106365,9 @@ var require_dist_cjs12 = __commonJS((exports) => {
|
|
|
106322
106365
|
const expiresInMs = (expiresIn ?? 900) * 1000;
|
|
106323
106366
|
const expiration = new Date(Date.now() + expiresInMs);
|
|
106324
106367
|
const updatedToken = {
|
|
106325
|
-
...
|
|
106368
|
+
...freshToken,
|
|
106326
106369
|
accessToken: {
|
|
106327
|
-
...
|
|
106370
|
+
...freshToken.accessToken,
|
|
106328
106371
|
accessKeyId,
|
|
106329
106372
|
secretAccessKey,
|
|
106330
106373
|
sessionToken,
|
|
@@ -106333,14 +106376,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
|
|
|
106333
106376
|
refreshToken
|
|
106334
106377
|
};
|
|
106335
106378
|
await this.saveToken(updatedToken);
|
|
106336
|
-
|
|
106337
|
-
return {
|
|
106338
|
-
accessKeyId: newAccessToken.accessKeyId,
|
|
106339
|
-
secretAccessKey: newAccessToken.secretAccessKey,
|
|
106340
|
-
sessionToken: newAccessToken.sessionToken,
|
|
106341
|
-
accountId: newAccessToken.accountId,
|
|
106342
|
-
expiration
|
|
106343
|
-
};
|
|
106379
|
+
return this.toCredentials(updatedToken.accessToken);
|
|
106344
106380
|
} catch (error49) {
|
|
106345
106381
|
if (error49.name === "AccessDeniedException") {
|
|
106346
106382
|
const errorType = error49.error;
|
|
@@ -106358,7 +106394,15 @@ var require_dist_cjs12 = __commonJS((exports) => {
|
|
|
106358
106394
|
default:
|
|
106359
106395
|
message = `Failed to refresh token: ${String(error49)}. Please re-authenticate using \`aws login\``;
|
|
106360
106396
|
}
|
|
106361
|
-
throw new CredentialsProviderError(message, {
|
|
106397
|
+
throw new CredentialsProviderError(message, {
|
|
106398
|
+
logger: this.logger,
|
|
106399
|
+
tryNextLink: false
|
|
106400
|
+
});
|
|
106401
|
+
}
|
|
106402
|
+
const tokenExpiry2 = new Date(freshToken.accessToken.expiresAt).getTime();
|
|
106403
|
+
if (tokenExpiry2 > Date.now()) {
|
|
106404
|
+
this.logger?.warn?.(`Failed to refresh token: ${String(error49)}. Using existing token until expiry.`);
|
|
106405
|
+
return this.toCredentials(freshToken.accessToken);
|
|
106362
106406
|
}
|
|
106363
106407
|
throw new CredentialsProviderError(`Failed to refresh token: ${String(error49)}. Please re-authenticate using aws login`, { logger: this.logger });
|
|
106364
106408
|
}
|
|
@@ -106366,12 +106410,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
|
|
|
106366
106410
|
async loadToken() {
|
|
106367
106411
|
const tokenFilePath = this.getTokenFilePath();
|
|
106368
106412
|
try {
|
|
106369
|
-
|
|
106370
|
-
try {
|
|
106371
|
-
tokenData = await readFile8(tokenFilePath, { ignoreCache: this.init?.ignoreCache });
|
|
106372
|
-
} catch {
|
|
106373
|
-
tokenData = await promises.readFile(tokenFilePath, "utf8");
|
|
106374
|
-
}
|
|
106413
|
+
const tokenData = await promises.readFile(tokenFilePath, "utf8");
|
|
106375
106414
|
const token = JSON.parse(tokenData);
|
|
106376
106415
|
const missingFields = ["accessToken", "clientId", "refreshToken", "dpopKey"].filter((k) => !token[k]);
|
|
106377
106416
|
if (!token.accessToken?.accountId) {
|
|
@@ -119947,7 +119986,7 @@ var package_default;
|
|
|
119947
119986
|
var init_package = __esm(() => {
|
|
119948
119987
|
package_default = {
|
|
119949
119988
|
name: "@funnycode/myclaude",
|
|
119950
|
-
version: "0.1.
|
|
119989
|
+
version: "0.1.180",
|
|
119951
119990
|
private: false,
|
|
119952
119991
|
description: "An open-source AI coding assistant in your terminal - powered by Claude",
|
|
119953
119992
|
license: "MIT",
|
|
@@ -410197,45 +410236,42 @@ function getDirectoryFingerprint(dirPath, recursionStack, rootRealPath, maxDepth
|
|
|
410197
410236
|
const fullPath = join105(dirPath, entry);
|
|
410198
410237
|
try {
|
|
410199
410238
|
const lstat7 = fs13.lstatSync(fullPath);
|
|
410200
|
-
if (lstat7.
|
|
410239
|
+
if (lstat7.isDirectory()) {
|
|
410240
|
+
const targetBasename = basename37(fullPath);
|
|
410241
|
+
if (targetBasename === "node_modules" || targetBasename === ".git" || targetBasename === "dist" || targetBasename === "build" || targetBasename === ".next" || targetBasename === "out" || targetBasename === "coverage" || targetBasename === "target" || targetBasename === "vendor" || targetBasename === "__pycache__" || targetBasename === ".cache" || targetBasename === ".mypy_cache" || targetBasename === ".svn" || targetBasename === ".hg" || targetBasename === "venv" || targetBasename === ".venv" || targetBasename === "env") {
|
|
410242
|
+
fingerprintParts.push(entry + "/");
|
|
410243
|
+
continue;
|
|
410244
|
+
}
|
|
410245
|
+
fingerprintParts.push(entry + "/");
|
|
410246
|
+
fingerprintParts.push(getDirectoryFingerprint(fullPath, recursionStack, rootRealPath, maxDepth));
|
|
410247
|
+
} else if (lstat7.isSymbolicLink()) {
|
|
410248
|
+
const linkTarget = fs13.readlinkSync(fullPath);
|
|
410249
|
+
const resolvedTarget = resolve44(dirPath, linkTarget);
|
|
410250
|
+
let targetRealPath;
|
|
410201
410251
|
try {
|
|
410202
|
-
|
|
410203
|
-
|
|
410204
|
-
|
|
410205
|
-
|
|
410206
|
-
|
|
410207
|
-
|
|
410208
|
-
|
|
410209
|
-
|
|
410210
|
-
|
|
410211
|
-
|
|
410212
|
-
|
|
410213
|
-
|
|
410214
|
-
const stat37 = fs13.statSync(resolvedTarget);
|
|
410215
|
-
if (stat37.isDirectory()) {
|
|
410216
|
-
const targetBasename = basename37(resolvedTarget);
|
|
410217
|
-
if (targetBasename === "node_modules" || targetBasename === ".git" || targetBasename === "dist" || targetBasename === "build" || targetBasename === ".next" || targetBasename === "out" || targetBasename === "coverage" || targetBasename === "target" || targetBasename === "vendor" || targetBasename === "__pycache__" || targetBasename === ".cache" || targetBasename === ".mypy_cache" || targetBasename === ".svn" || targetBasename === ".hg" || targetBasename === "venv" || targetBasename === ".venv" || targetBasename === "env") {
|
|
410218
|
-
fingerprintParts.push(entry + "/");
|
|
410219
|
-
continue;
|
|
410220
|
-
}
|
|
410252
|
+
targetRealPath = fs13.realpathSync(resolvedTarget);
|
|
410253
|
+
} catch (err2) {
|
|
410254
|
+
console.warn(`[getDirectoryFingerprint] Failed to resolve target real path for symlink '${fullPath}': ${err2}`);
|
|
410255
|
+
targetRealPath = resolvedTarget;
|
|
410256
|
+
}
|
|
410257
|
+
const targetLower = targetRealPath.toLowerCase();
|
|
410258
|
+
const rootLower = rootRealPath.toLowerCase();
|
|
410259
|
+
if (targetLower === rootLower || targetLower.startsWith(rootLower + pathSep2)) {
|
|
410260
|
+
const stat37 = fs13.statSync(resolvedTarget);
|
|
410261
|
+
if (stat37.isDirectory()) {
|
|
410262
|
+
const targetBasename = basename37(resolvedTarget);
|
|
410263
|
+
if (targetBasename === "node_modules" || targetBasename === ".git" || targetBasename === "dist" || targetBasename === "build" || targetBasename === ".next" || targetBasename === "out" || targetBasename === "coverage" || targetBasename === "target" || targetBasename === "vendor" || targetBasename === "__pycache__" || targetBasename === ".cache" || targetBasename === ".mypy_cache" || targetBasename === ".svn" || targetBasename === ".hg" || targetBasename === "venv" || targetBasename === ".venv" || targetBasename === "env") {
|
|
410221
410264
|
fingerprintParts.push(entry + "/");
|
|
410222
|
-
|
|
410223
|
-
} else {
|
|
410224
|
-
fingerprintParts.push(entry);
|
|
410265
|
+
continue;
|
|
410225
410266
|
}
|
|
410226
|
-
} else {
|
|
410227
410267
|
fingerprintParts.push(entry + "/");
|
|
410268
|
+
fingerprintParts.push(getDirectoryFingerprint(resolvedTarget, recursionStack, rootRealPath, maxDepth));
|
|
410269
|
+
} else {
|
|
410270
|
+
fingerprintParts.push(entry);
|
|
410228
410271
|
}
|
|
410229
|
-
}
|
|
410230
|
-
|
|
410231
|
-
continue;
|
|
410232
|
-
}
|
|
410233
|
-
} else if (lstat7.isDirectory()) {
|
|
410234
|
-
if (entry === "node_modules" || entry === ".git" || entry === "dist" || entry === "build" || entry === ".next" || entry === "out" || entry === "coverage" || entry === "target" || entry === "vendor" || entry === "__pycache__" || entry === ".cache" || entry === ".mypy_cache" || entry === ".svn" || entry === ".hg" || entry === "venv" || entry === ".venv" || entry === "env") {
|
|
410235
|
-
continue;
|
|
410272
|
+
} else {
|
|
410273
|
+
fingerprintParts.push(entry + "/");
|
|
410236
410274
|
}
|
|
410237
|
-
fingerprintParts.push(entry + "/");
|
|
410238
|
-
fingerprintParts.push(getDirectoryFingerprint(fullPath, recursionStack, rootRealPath, maxDepth));
|
|
410239
410275
|
} else {
|
|
410240
410276
|
fingerprintParts.push(entry);
|
|
410241
410277
|
}
|
|
@@ -566639,23 +566675,31 @@ function migrateEnableAllProjectMcpServersToSettings() {
|
|
|
566639
566675
|
const existingEnabledServers = Array.isArray(existingSettings.enabledMcpjsonServers) ? [...existingSettings.enabledMcpjsonServers] : [];
|
|
566640
566676
|
const existingDisabledServers = Array.isArray(existingSettings.disabledMcpjsonServers) ? [...existingSettings.disabledMcpjsonServers] : [];
|
|
566641
566677
|
if (hasEnabledServers) {
|
|
566642
|
-
if (Array.isArray(projectConfig.enabledMcpjsonServers)
|
|
566643
|
-
|
|
566644
|
-
|
|
566645
|
-
|
|
566646
|
-
|
|
566647
|
-
|
|
566678
|
+
if (Array.isArray(projectConfig.enabledMcpjsonServers)) {
|
|
566679
|
+
if (projectConfig.enabledMcpjsonServers.length === 0) {
|
|
566680
|
+
existingEnabledServers.length = 0;
|
|
566681
|
+
} else {
|
|
566682
|
+
const seen = new Set(existingEnabledServers);
|
|
566683
|
+
for (const server of projectConfig.enabledMcpjsonServers) {
|
|
566684
|
+
if (!seen.has(server)) {
|
|
566685
|
+
existingEnabledServers.push(server);
|
|
566686
|
+
seen.add(server);
|
|
566687
|
+
}
|
|
566648
566688
|
}
|
|
566649
566689
|
}
|
|
566650
566690
|
}
|
|
566651
566691
|
}
|
|
566652
566692
|
if (hasDisabledServers) {
|
|
566653
|
-
if (Array.isArray(projectConfig.disabledMcpjsonServers)
|
|
566654
|
-
|
|
566655
|
-
|
|
566656
|
-
|
|
566657
|
-
|
|
566658
|
-
|
|
566693
|
+
if (Array.isArray(projectConfig.disabledMcpjsonServers)) {
|
|
566694
|
+
if (projectConfig.disabledMcpjsonServers.length === 0) {
|
|
566695
|
+
existingDisabledServers.length = 0;
|
|
566696
|
+
} else {
|
|
566697
|
+
const seen = new Set(existingDisabledServers);
|
|
566698
|
+
for (const server of projectConfig.disabledMcpjsonServers) {
|
|
566699
|
+
if (!seen.has(server)) {
|
|
566700
|
+
existingDisabledServers.push(server);
|
|
566701
|
+
seen.add(server);
|
|
566702
|
+
}
|
|
566659
566703
|
}
|
|
566660
566704
|
}
|
|
566661
566705
|
}
|
|
@@ -566769,21 +566813,7 @@ function migrateReplBridgeEnabledToRemoteControlAtStartup() {
|
|
|
566769
566813
|
if (prev.remoteControlAtStartup !== undefined)
|
|
566770
566814
|
return prev;
|
|
566771
566815
|
const newValue = typeof oldValue === "string" ? !["false", "0", "no", ""].includes(oldValue.toLowerCase().trim()) : Boolean(oldValue);
|
|
566772
|
-
|
|
566773
|
-
});
|
|
566774
|
-
saveGlobalConfig((prev) => {
|
|
566775
|
-
const oldValue = prev["replBridgeEnabled"];
|
|
566776
|
-
if (oldValue === undefined)
|
|
566777
|
-
return prev;
|
|
566778
|
-
if (prev.remoteControlAtStartup === undefined) {
|
|
566779
|
-
const newValue = typeof oldValue === "string" ? !["false", "0", "no", ""].includes(oldValue.toLowerCase().trim()) : Boolean(oldValue);
|
|
566780
|
-
return {
|
|
566781
|
-
...prev,
|
|
566782
|
-
remoteControlAtStartup: newValue,
|
|
566783
|
-
replBridgeEnabled: undefined
|
|
566784
|
-
};
|
|
566785
|
-
}
|
|
566786
|
-
const next = { ...prev };
|
|
566816
|
+
const next = { ...prev, remoteControlAtStartup: newValue };
|
|
566787
566817
|
delete next.replBridgeEnabled;
|
|
566788
566818
|
return next;
|
|
566789
566819
|
});
|