@funnycode/myclaude 0.1.157 → 0.1.159
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 +2190 -343
- package/dist/myclaude.mjs +2190 -343
- 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-07-
|
|
7
|
+
VERSION: "0.1.159",
|
|
8
|
+
BUILD_TIME: "2026-07-29T23:20:13.620Z",
|
|
9
9
|
PACKAGE_URL: "@funnycode/myclaude",
|
|
10
10
|
NATIVE_PACKAGE_URL: "@funnycode/myclaude",
|
|
11
11
|
VERSION_CHANGELOG: '',
|
|
@@ -85149,9 +85149,6 @@ var require_schema = __commonJS((exports) => {
|
|
|
85149
85149
|
}
|
|
85150
85150
|
struct2[anno.it] = it;
|
|
85151
85151
|
}
|
|
85152
|
-
structIteratorCbor() {
|
|
85153
|
-
throw new Error("@smithy/core/schema - structIteratorCbor not loaded.");
|
|
85154
|
-
}
|
|
85155
85152
|
}
|
|
85156
85153
|
function member(memberSchema, memberName) {
|
|
85157
85154
|
if (memberSchema instanceof NormalizedSchema) {
|
|
@@ -97310,23 +97307,23 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97310
97307
|
data2[tagSymbol] = true;
|
|
97311
97308
|
return data2;
|
|
97312
97309
|
}
|
|
97313
|
-
var USE_BUFFER$
|
|
97314
|
-
var
|
|
97315
|
-
var payload = alloc(0);
|
|
97316
|
-
var
|
|
97317
|
-
var dataView$
|
|
97310
|
+
var USE_BUFFER$3 = typeof Buffer !== "undefined";
|
|
97311
|
+
var textDecoder$1 = new TextDecoder;
|
|
97312
|
+
var payload$1 = alloc(0);
|
|
97313
|
+
var isBuffer$1 = false;
|
|
97314
|
+
var dataView$2 = new DataView(payload$1.buffer, payload$1.byteOffset, payload$1.byteLength);
|
|
97318
97315
|
var _offset = 0;
|
|
97319
97316
|
function setPayload(bytes) {
|
|
97320
|
-
payload = bytes;
|
|
97321
|
-
|
|
97322
|
-
dataView$
|
|
97317
|
+
payload$1 = bytes;
|
|
97318
|
+
isBuffer$1 = USE_BUFFER$3 && payload$1 instanceof Buffer;
|
|
97319
|
+
dataView$2 = new DataView(payload$1.buffer, payload$1.byteOffset, payload$1.byteLength);
|
|
97323
97320
|
}
|
|
97324
97321
|
function decode3(at, to) {
|
|
97325
97322
|
if (at >= to) {
|
|
97326
97323
|
throw new Error("unexpected end of (decode) payload.");
|
|
97327
97324
|
}
|
|
97328
|
-
const major = (payload[at] & 224) >> 5;
|
|
97329
|
-
const minor = payload[at] & 31;
|
|
97325
|
+
const major = (payload$1[at] & 224) >> 5;
|
|
97326
|
+
const minor = payload$1[at] & 31;
|
|
97330
97327
|
if (minor === minorIndefinite && 2 <= major && major <= 5) {
|
|
97331
97328
|
return decodeIndefinite(at, to);
|
|
97332
97329
|
}
|
|
@@ -97343,35 +97340,35 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97343
97340
|
switch (minor) {
|
|
97344
97341
|
case extendedOneByte:
|
|
97345
97342
|
if (to - at < 2) {
|
|
97346
|
-
overflow(1);
|
|
97343
|
+
overflow$1(1);
|
|
97347
97344
|
}
|
|
97348
|
-
unsignedInt = payload[at + 1];
|
|
97345
|
+
unsignedInt = payload$1[at + 1];
|
|
97349
97346
|
offset = 2;
|
|
97350
97347
|
break;
|
|
97351
97348
|
case extendedFloat16:
|
|
97352
97349
|
if (to - at < 3) {
|
|
97353
|
-
overflow(2);
|
|
97350
|
+
overflow$1(2);
|
|
97354
97351
|
}
|
|
97355
|
-
unsignedInt = dataView$
|
|
97352
|
+
unsignedInt = dataView$2.getUint16(at + 1);
|
|
97356
97353
|
offset = 3;
|
|
97357
97354
|
break;
|
|
97358
97355
|
case extendedFloat32:
|
|
97359
97356
|
if (to - at < 5) {
|
|
97360
|
-
overflow(4);
|
|
97357
|
+
overflow$1(4);
|
|
97361
97358
|
}
|
|
97362
|
-
unsignedInt = dataView$
|
|
97359
|
+
unsignedInt = dataView$2.getUint32(at + 1);
|
|
97363
97360
|
offset = 5;
|
|
97364
97361
|
break;
|
|
97365
97362
|
case extendedFloat64:
|
|
97366
97363
|
if (to - at < 9) {
|
|
97367
|
-
overflow(8);
|
|
97364
|
+
overflow$1(8);
|
|
97368
97365
|
}
|
|
97369
97366
|
{
|
|
97370
|
-
const hi = dataView$
|
|
97367
|
+
const hi = dataView$2.getUint32(at + 1);
|
|
97371
97368
|
if (hi < 2097152) {
|
|
97372
|
-
unsignedInt = hi * 4294967296 + dataView$
|
|
97369
|
+
unsignedInt = hi * 4294967296 + dataView$2.getUint32(at + 5);
|
|
97373
97370
|
} else {
|
|
97374
|
-
unsignedInt = dataView$
|
|
97371
|
+
unsignedInt = dataView$2.getBigUint64(at + 1);
|
|
97375
97372
|
}
|
|
97376
97373
|
}
|
|
97377
97374
|
offset = 9;
|
|
@@ -97382,7 +97379,7 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97382
97379
|
}
|
|
97383
97380
|
if (major === majorUint64) {
|
|
97384
97381
|
_offset = offset;
|
|
97385
|
-
return castBigInt(unsignedInt);
|
|
97382
|
+
return castBigInt$1(unsignedInt);
|
|
97386
97383
|
} else if (major === majorNegativeInt64) {
|
|
97387
97384
|
let negativeInt;
|
|
97388
97385
|
if (typeof unsignedInt === "bigint") {
|
|
@@ -97391,7 +97388,7 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97391
97388
|
negativeInt = -1 - unsignedInt;
|
|
97392
97389
|
}
|
|
97393
97390
|
_offset = offset;
|
|
97394
|
-
return castBigInt(negativeInt);
|
|
97391
|
+
return castBigInt$1(negativeInt);
|
|
97395
97392
|
} else {
|
|
97396
97393
|
return decodeTagValue(at, to, minor, unsignedInt, offset);
|
|
97397
97394
|
}
|
|
@@ -97409,8 +97406,8 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97409
97406
|
}
|
|
97410
97407
|
}
|
|
97411
97408
|
function decodeIndefinite(at, to) {
|
|
97412
|
-
const major = (payload[at] & 224) >> 5;
|
|
97413
|
-
const minor = payload[at] & 31;
|
|
97409
|
+
const major = (payload$1[at] & 224) >> 5;
|
|
97410
|
+
const minor = payload$1[at] & 31;
|
|
97414
97411
|
if (minor === minorIndefinite) {
|
|
97415
97412
|
switch (major) {
|
|
97416
97413
|
case majorUtf8String:
|
|
@@ -97424,7 +97421,7 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97424
97421
|
}
|
|
97425
97422
|
}
|
|
97426
97423
|
}
|
|
97427
|
-
function bytesToFloat16(a2, b) {
|
|
97424
|
+
function bytesToFloat16$1(a2, b) {
|
|
97428
97425
|
const sign = a2 >> 7;
|
|
97429
97426
|
const exponent = (a2 & 124) >> 2;
|
|
97430
97427
|
const fraction = (a2 & 3) << 8 | b;
|
|
@@ -97443,7 +97440,7 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97443
97440
|
return scalar * (Math.pow(2, exponent - 15) * (1 + fraction / 1024));
|
|
97444
97441
|
}
|
|
97445
97442
|
function decodeMap(at, to) {
|
|
97446
|
-
const mapDataLength = decodeCount(at, to);
|
|
97443
|
+
const mapDataLength = decodeCount$1(at, to);
|
|
97447
97444
|
if (mapDataLength < 25) {
|
|
97448
97445
|
return decodeMapSmall(at, to, mapDataLength);
|
|
97449
97446
|
}
|
|
@@ -97457,7 +97454,7 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97457
97454
|
for (let i2 = 0;i2 < mapDataLength; ++i2) {
|
|
97458
97455
|
const key = decodeUtf8String(at, to);
|
|
97459
97456
|
at += _offset;
|
|
97460
|
-
const valMajor = (payload[at] & 224) >> 5;
|
|
97457
|
+
const valMajor = (payload$1[at] & 224) >> 5;
|
|
97461
97458
|
if (valMajor === majorUtf8String) {
|
|
97462
97459
|
map2[key] = decodeUtf8String(at, to);
|
|
97463
97460
|
} else {
|
|
@@ -97484,7 +97481,7 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97484
97481
|
return map2;
|
|
97485
97482
|
}
|
|
97486
97483
|
function decodeList(at, to) {
|
|
97487
|
-
const listDataLength = decodeCount(at, to);
|
|
97484
|
+
const listDataLength = decodeCount$1(at, to);
|
|
97488
97485
|
const offset = _offset;
|
|
97489
97486
|
at += offset;
|
|
97490
97487
|
const base2 = at;
|
|
@@ -97497,74 +97494,74 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97497
97494
|
return list;
|
|
97498
97495
|
}
|
|
97499
97496
|
function decodeUtf8String(at, to) {
|
|
97500
|
-
const length = decodeCount(at, to);
|
|
97497
|
+
const length = decodeCount$1(at, to);
|
|
97501
97498
|
const offset = _offset;
|
|
97502
97499
|
at += offset;
|
|
97503
97500
|
if (to - at < length) {
|
|
97504
|
-
overflow(length);
|
|
97501
|
+
overflow$1(length);
|
|
97505
97502
|
}
|
|
97506
97503
|
_offset = offset + length;
|
|
97507
97504
|
if (length < 24) {
|
|
97508
97505
|
return decodeUtf8StringCached(at, length);
|
|
97509
97506
|
}
|
|
97510
|
-
if (
|
|
97511
|
-
return payload.toString("utf-8", at, at + length);
|
|
97507
|
+
if (isBuffer$1) {
|
|
97508
|
+
return payload$1.toString("utf-8", at, at + length);
|
|
97512
97509
|
}
|
|
97513
|
-
return
|
|
97510
|
+
return textDecoder$1.decode(payload$1.subarray(at, at + length));
|
|
97514
97511
|
}
|
|
97515
|
-
var stringCache = new Array(2048);
|
|
97516
|
-
var stringCacheEpochs = new Uint16Array(2048);
|
|
97517
|
-
var cacheEpoch = 0;
|
|
97512
|
+
var stringCache$1 = new Array(2048);
|
|
97513
|
+
var stringCacheEpochs$1 = new Uint16Array(2048);
|
|
97514
|
+
var cacheEpoch$1 = 0;
|
|
97518
97515
|
function advanceDecodingEpoch() {
|
|
97519
|
-
cacheEpoch = cacheEpoch + 1 & 65535;
|
|
97516
|
+
cacheEpoch$1 = cacheEpoch$1 + 1 & 65535;
|
|
97520
97517
|
}
|
|
97521
97518
|
function decodeUtf8StringCached(at, length) {
|
|
97522
97519
|
let h2 = length;
|
|
97523
97520
|
for (let i2 = 0;i2 < length; ++i2) {
|
|
97524
|
-
h2 = h2 * 31 + payload[at + i2] | 0;
|
|
97521
|
+
h2 = h2 * 31 + payload$1[at + i2] | 0;
|
|
97525
97522
|
}
|
|
97526
97523
|
const slot = h2 >>> 0 & 2047;
|
|
97527
|
-
const cached2 = stringCache[slot];
|
|
97524
|
+
const cached2 = stringCache$1[slot];
|
|
97528
97525
|
if (cached2 !== undefined) {
|
|
97529
97526
|
if (cached2.length === length) {
|
|
97530
97527
|
let match = true;
|
|
97531
97528
|
for (let i2 = 0;i2 < length; ++i2) {
|
|
97532
|
-
if (cached2.charCodeAt(i2) !== payload[at + i2]) {
|
|
97529
|
+
if (cached2.charCodeAt(i2) !== payload$1[at + i2]) {
|
|
97533
97530
|
match = false;
|
|
97534
97531
|
break;
|
|
97535
97532
|
}
|
|
97536
97533
|
}
|
|
97537
97534
|
if (match) {
|
|
97538
|
-
stringCacheEpochs[slot] = cacheEpoch;
|
|
97535
|
+
stringCacheEpochs$1[slot] = cacheEpoch$1;
|
|
97539
97536
|
return cached2;
|
|
97540
97537
|
}
|
|
97541
97538
|
}
|
|
97542
97539
|
}
|
|
97543
|
-
const result =
|
|
97544
|
-
if (stringCacheEpochs[slot] !== cacheEpoch) {
|
|
97545
|
-
stringCache[slot] = result;
|
|
97546
|
-
stringCacheEpochs[slot] = cacheEpoch;
|
|
97540
|
+
const result = isBuffer$1 ? payload$1.toString("utf-8", at, at + length) : textDecoder$1.decode(payload$1.subarray(at, at + length));
|
|
97541
|
+
if (stringCacheEpochs$1[slot] !== cacheEpoch$1) {
|
|
97542
|
+
stringCache$1[slot] = result;
|
|
97543
|
+
stringCacheEpochs$1[slot] = cacheEpoch$1;
|
|
97547
97544
|
}
|
|
97548
97545
|
return result;
|
|
97549
97546
|
}
|
|
97550
97547
|
function decodeUnstructuredByteString(at, to) {
|
|
97551
|
-
const length = decodeCount(at, to);
|
|
97548
|
+
const length = decodeCount$1(at, to);
|
|
97552
97549
|
const offset = _offset;
|
|
97553
97550
|
at += offset;
|
|
97554
97551
|
if (to - at < length) {
|
|
97555
|
-
overflow(length);
|
|
97552
|
+
overflow$1(length);
|
|
97556
97553
|
}
|
|
97557
|
-
const value = payload.subarray(at, at + length);
|
|
97554
|
+
const value = payload$1.subarray(at, at + length);
|
|
97558
97555
|
_offset = offset + length;
|
|
97559
97556
|
return value;
|
|
97560
97557
|
}
|
|
97561
97558
|
function decodeTagValue(at, to, minor, unsignedInt, offset) {
|
|
97562
97559
|
if (minor === 2 || minor === 3) {
|
|
97563
|
-
const length = decodeCount(at + offset, to);
|
|
97560
|
+
const length = decodeCount$1(at + offset, to);
|
|
97564
97561
|
let b = BigInt(0);
|
|
97565
97562
|
const start = at + offset + _offset;
|
|
97566
97563
|
for (let i2 = start;i2 < start + length; ++i2) {
|
|
97567
|
-
b = b << BigInt(8) | BigInt(payload[i2]);
|
|
97564
|
+
b = b << BigInt(8) | BigInt(payload$1[i2]);
|
|
97568
97565
|
}
|
|
97569
97566
|
_offset = offset + _offset + length;
|
|
97570
97567
|
return minor === 3 ? -b - BigInt(1) : b;
|
|
@@ -97590,11 +97587,11 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97590
97587
|
const value = decode3(at + offset, to);
|
|
97591
97588
|
const valueOffset = _offset;
|
|
97592
97589
|
_offset = offset + valueOffset;
|
|
97593
|
-
return tag({ tag: castBigInt(unsignedInt), value });
|
|
97590
|
+
return tag({ tag: castBigInt$1(unsignedInt), value });
|
|
97594
97591
|
}
|
|
97595
97592
|
}
|
|
97596
97593
|
function decodeSpecial(at, to) {
|
|
97597
|
-
const minor = payload[at] & 31;
|
|
97594
|
+
const minor = payload$1[at] & 31;
|
|
97598
97595
|
switch (minor) {
|
|
97599
97596
|
case specialTrue:
|
|
97600
97597
|
case specialFalse:
|
|
@@ -97611,25 +97608,25 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97611
97608
|
throw new Error("incomplete float16 at end of buf.");
|
|
97612
97609
|
}
|
|
97613
97610
|
_offset = 3;
|
|
97614
|
-
return bytesToFloat16(payload[at + 1], payload[at + 2]);
|
|
97611
|
+
return bytesToFloat16$1(payload$1[at + 1], payload$1[at + 2]);
|
|
97615
97612
|
case extendedFloat32:
|
|
97616
97613
|
if (to - at < 5) {
|
|
97617
97614
|
throw new Error("incomplete float32 at end of buf.");
|
|
97618
97615
|
}
|
|
97619
97616
|
_offset = 5;
|
|
97620
|
-
return dataView$
|
|
97617
|
+
return dataView$2.getFloat32(at + 1);
|
|
97621
97618
|
case extendedFloat64:
|
|
97622
97619
|
if (to - at < 9) {
|
|
97623
97620
|
throw new Error("incomplete float64 at end of buf.");
|
|
97624
97621
|
}
|
|
97625
97622
|
_offset = 9;
|
|
97626
|
-
return dataView$
|
|
97623
|
+
return dataView$2.getFloat64(at + 1);
|
|
97627
97624
|
default:
|
|
97628
97625
|
unexpectedMinor(minor);
|
|
97629
97626
|
}
|
|
97630
97627
|
}
|
|
97631
|
-
function decodeCount(at, to) {
|
|
97632
|
-
const minor = payload[at] & 31;
|
|
97628
|
+
function decodeCount$1(at, to) {
|
|
97629
|
+
const minor = payload$1[at] & 31;
|
|
97633
97630
|
if (minor < 24) {
|
|
97634
97631
|
_offset = 1;
|
|
97635
97632
|
return minor;
|
|
@@ -97637,28 +97634,28 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97637
97634
|
switch (minor) {
|
|
97638
97635
|
case extendedOneByte:
|
|
97639
97636
|
if (to - at < 2) {
|
|
97640
|
-
overflow(1);
|
|
97637
|
+
overflow$1(1);
|
|
97641
97638
|
}
|
|
97642
97639
|
_offset = 2;
|
|
97643
|
-
return payload[at + 1];
|
|
97640
|
+
return payload$1[at + 1];
|
|
97644
97641
|
case extendedFloat16:
|
|
97645
97642
|
if (to - at < 3) {
|
|
97646
|
-
overflow(2);
|
|
97643
|
+
overflow$1(2);
|
|
97647
97644
|
}
|
|
97648
97645
|
_offset = 3;
|
|
97649
|
-
return dataView$
|
|
97646
|
+
return dataView$2.getUint16(at + 1);
|
|
97650
97647
|
case extendedFloat32:
|
|
97651
97648
|
if (to - at < 5) {
|
|
97652
|
-
overflow(4);
|
|
97649
|
+
overflow$1(4);
|
|
97653
97650
|
}
|
|
97654
97651
|
_offset = 5;
|
|
97655
|
-
return dataView$
|
|
97652
|
+
return dataView$2.getUint32(at + 1);
|
|
97656
97653
|
case extendedFloat64:
|
|
97657
97654
|
if (to - at < 9) {
|
|
97658
|
-
overflow(8);
|
|
97655
|
+
overflow$1(8);
|
|
97659
97656
|
}
|
|
97660
97657
|
_offset = 9;
|
|
97661
|
-
return demote(dataView$
|
|
97658
|
+
return demote(dataView$2.getBigUint64(at + 1));
|
|
97662
97659
|
default:
|
|
97663
97660
|
unexpectedMinor(minor);
|
|
97664
97661
|
}
|
|
@@ -97668,7 +97665,7 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97668
97665
|
const base2 = at;
|
|
97669
97666
|
const map2 = {};
|
|
97670
97667
|
for (;at < to; ) {
|
|
97671
|
-
if (payload[at] === 255) {
|
|
97668
|
+
if (payload$1[at] === 255) {
|
|
97672
97669
|
_offset = at - base2 + 2;
|
|
97673
97670
|
return map2;
|
|
97674
97671
|
}
|
|
@@ -97683,7 +97680,7 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97683
97680
|
at += 1;
|
|
97684
97681
|
const list = [];
|
|
97685
97682
|
for (const base2 = at;at < to; ) {
|
|
97686
|
-
if (payload[at] === 255) {
|
|
97683
|
+
if (payload$1[at] === 255) {
|
|
97687
97684
|
_offset = at - base2 + 2;
|
|
97688
97685
|
return list;
|
|
97689
97686
|
}
|
|
@@ -97696,17 +97693,17 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97696
97693
|
at += 1;
|
|
97697
97694
|
const vector = [];
|
|
97698
97695
|
for (const base2 = at;at < to; ) {
|
|
97699
|
-
if (payload[at] === 255) {
|
|
97696
|
+
if (payload$1[at] === 255) {
|
|
97700
97697
|
const data2 = alloc(vector.length);
|
|
97701
97698
|
data2.set(vector, 0);
|
|
97702
97699
|
_offset = at - base2 + 2;
|
|
97703
|
-
if (USE_BUFFER$
|
|
97700
|
+
if (USE_BUFFER$3) {
|
|
97704
97701
|
return data2.toString("utf-8", 0, data2.length);
|
|
97705
97702
|
}
|
|
97706
|
-
return
|
|
97703
|
+
return textDecoder$1.decode(data2);
|
|
97707
97704
|
}
|
|
97708
|
-
const major = (payload[at] & 224) >> 5;
|
|
97709
|
-
const minor = payload[at] & 31;
|
|
97705
|
+
const major = (payload$1[at] & 224) >> 5;
|
|
97706
|
+
const minor = payload$1[at] & 31;
|
|
97710
97707
|
if (major !== majorUtf8String) {
|
|
97711
97708
|
unexpectedMajorInIndefiniteString(major);
|
|
97712
97709
|
}
|
|
@@ -97726,14 +97723,14 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97726
97723
|
at += 1;
|
|
97727
97724
|
const vector = [];
|
|
97728
97725
|
for (const base2 = at;at < to; ) {
|
|
97729
|
-
if (payload[at] === 255) {
|
|
97726
|
+
if (payload$1[at] === 255) {
|
|
97730
97727
|
const data2 = alloc(vector.length);
|
|
97731
97728
|
data2.set(vector, 0);
|
|
97732
97729
|
_offset = at - base2 + 2;
|
|
97733
97730
|
return data2;
|
|
97734
97731
|
}
|
|
97735
|
-
const major = (payload[at] & 224) >> 5;
|
|
97736
|
-
const minor = payload[at] & 31;
|
|
97732
|
+
const major = (payload$1[at] & 224) >> 5;
|
|
97733
|
+
const minor = payload$1[at] & 31;
|
|
97737
97734
|
if (major !== majorUnstructuredByteString) {
|
|
97738
97735
|
unexpectedMajorInIndefiniteString(major);
|
|
97739
97736
|
}
|
|
@@ -97749,7 +97746,7 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97749
97746
|
}
|
|
97750
97747
|
throw new Error("expected break marker.");
|
|
97751
97748
|
}
|
|
97752
|
-
function castBigInt(bigInt) {
|
|
97749
|
+
function castBigInt$1(bigInt) {
|
|
97753
97750
|
if (typeof bigInt === "number") {
|
|
97754
97751
|
return bigInt;
|
|
97755
97752
|
}
|
|
@@ -97766,7 +97763,7 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97766
97763
|
}
|
|
97767
97764
|
return num;
|
|
97768
97765
|
}
|
|
97769
|
-
function overflow(n2) {
|
|
97766
|
+
function overflow$1(n2) {
|
|
97770
97767
|
throw new Error(`length ${n2} greater than remaining buf len.`);
|
|
97771
97768
|
}
|
|
97772
97769
|
function unexpectedMinor(minor) {
|
|
@@ -97775,33 +97772,33 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97775
97772
|
function unexpectedMajorInIndefiniteString(major) {
|
|
97776
97773
|
throw new Error(`unexpected major type ${major} in indefinite string.`);
|
|
97777
97774
|
}
|
|
97778
|
-
var USE_BUFFER = typeof Buffer !== "undefined";
|
|
97775
|
+
var USE_BUFFER$2 = typeof Buffer !== "undefined";
|
|
97779
97776
|
var encodeStringCache = new Map;
|
|
97780
|
-
var encodeCacheEpoch = 0;
|
|
97781
|
-
var encodeCacheSaturated = false;
|
|
97777
|
+
var encodeCacheEpoch$1 = 0;
|
|
97778
|
+
var encodeCacheSaturated$1 = false;
|
|
97782
97779
|
var initialSize = 2048;
|
|
97783
97780
|
var data = alloc(initialSize);
|
|
97784
|
-
var dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
97785
|
-
var cursor = 0;
|
|
97781
|
+
var dataView$1 = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
97782
|
+
var cursor$1 = 0;
|
|
97786
97783
|
function encode6(_input) {
|
|
97787
97784
|
const encodeStack = [_input];
|
|
97788
97785
|
while (encodeStack.length) {
|
|
97789
97786
|
const input = encodeStack.pop();
|
|
97790
97787
|
if (typeof input === "string") {
|
|
97791
97788
|
const len = input.length;
|
|
97792
|
-
if (USE_BUFFER) {
|
|
97789
|
+
if (USE_BUFFER$2) {
|
|
97793
97790
|
ensureSpace(len * 3 + 9);
|
|
97794
97791
|
if (len > 23) {
|
|
97795
|
-
encodeHeader(majorUtf8String, Buffer.byteLength(input));
|
|
97796
|
-
cursor += data.write(input, cursor);
|
|
97792
|
+
encodeHeader$1(majorUtf8String, Buffer.byteLength(input));
|
|
97793
|
+
cursor$1 += data.write(input, cursor$1);
|
|
97797
97794
|
} else {
|
|
97798
97795
|
encodeStringCached(input);
|
|
97799
97796
|
}
|
|
97800
97797
|
} else {
|
|
97801
97798
|
const maxBytes = len * 3;
|
|
97802
97799
|
ensureSpace(maxBytes + 9);
|
|
97803
|
-
const headerPos = cursor;
|
|
97804
|
-
const result = new TextEncoder().encodeInto(input, data.subarray(cursor + 9));
|
|
97800
|
+
const headerPos = cursor$1;
|
|
97801
|
+
const result = new TextEncoder().encodeInto(input, data.subarray(cursor$1 + 9));
|
|
97805
97802
|
const byteLen = result.written;
|
|
97806
97803
|
let headerSize;
|
|
97807
97804
|
if (byteLen < 24) {
|
|
@@ -97818,46 +97815,46 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97818
97815
|
if (headerSize < 9) {
|
|
97819
97816
|
data.copyWithin(headerPos + headerSize, headerPos + 9, headerPos + 9 + byteLen);
|
|
97820
97817
|
}
|
|
97821
|
-
cursor = headerPos;
|
|
97818
|
+
cursor$1 = headerPos;
|
|
97822
97819
|
encodeInteger(majorUtf8String, byteLen);
|
|
97823
|
-
cursor += byteLen;
|
|
97820
|
+
cursor$1 += byteLen;
|
|
97824
97821
|
}
|
|
97825
97822
|
continue;
|
|
97826
97823
|
}
|
|
97827
|
-
if (data.byteLength - cursor < 9) {
|
|
97824
|
+
if (data.byteLength - cursor$1 < 9) {
|
|
97828
97825
|
ensureSpace(64);
|
|
97829
97826
|
}
|
|
97830
97827
|
if (typeof input === "number") {
|
|
97831
|
-
if (Number.isInteger(input)) {
|
|
97828
|
+
if (Number.isInteger(input) && input >= -9007199254740992 && input <= 9007199254740991) {
|
|
97832
97829
|
const nonNegative = input >= 0;
|
|
97833
97830
|
const major = nonNegative ? majorUint64 : majorNegativeInt64;
|
|
97834
97831
|
const value = nonNegative ? input : -input - 1;
|
|
97835
97832
|
if (value < 24) {
|
|
97836
|
-
data[cursor++] = major << 5 | value;
|
|
97833
|
+
data[cursor$1++] = major << 5 | value;
|
|
97837
97834
|
} else if (value < 256) {
|
|
97838
|
-
data[cursor++] = major << 5 | 24;
|
|
97839
|
-
data[cursor++] = value;
|
|
97835
|
+
data[cursor$1++] = major << 5 | 24;
|
|
97836
|
+
data[cursor$1++] = value;
|
|
97840
97837
|
} else if (value < 65536) {
|
|
97841
|
-
data[cursor++] = major << 5 | extendedFloat16;
|
|
97842
|
-
data[cursor++] = value >> 8;
|
|
97843
|
-
data[cursor++] = value & 255;
|
|
97838
|
+
data[cursor$1++] = major << 5 | extendedFloat16;
|
|
97839
|
+
data[cursor$1++] = value >> 8;
|
|
97840
|
+
data[cursor$1++] = value & 255;
|
|
97844
97841
|
} else if (value < 4294967296) {
|
|
97845
|
-
data[cursor++] = major << 5 | extendedFloat32;
|
|
97846
|
-
dataView.setUint32(cursor, value);
|
|
97847
|
-
cursor += 4;
|
|
97842
|
+
data[cursor$1++] = major << 5 | extendedFloat32;
|
|
97843
|
+
dataView$1.setUint32(cursor$1, value);
|
|
97844
|
+
cursor$1 += 4;
|
|
97848
97845
|
} else {
|
|
97849
|
-
data[cursor++] = major << 5 | extendedFloat64;
|
|
97846
|
+
data[cursor$1++] = major << 5 | extendedFloat64;
|
|
97850
97847
|
const hi = value / 4294967296 | 0;
|
|
97851
97848
|
const lo = value - hi * 4294967296 | 0;
|
|
97852
|
-
dataView.setUint32(cursor, hi);
|
|
97853
|
-
dataView.setUint32(cursor + 4, lo);
|
|
97854
|
-
cursor += 8;
|
|
97849
|
+
dataView$1.setUint32(cursor$1, hi);
|
|
97850
|
+
dataView$1.setUint32(cursor$1 + 4, lo);
|
|
97851
|
+
cursor$1 += 8;
|
|
97855
97852
|
}
|
|
97856
97853
|
continue;
|
|
97857
97854
|
}
|
|
97858
|
-
data[cursor++] = majorSpecial << 5 | extendedFloat64;
|
|
97859
|
-
dataView.setFloat64(cursor, input);
|
|
97860
|
-
cursor += 8;
|
|
97855
|
+
data[cursor$1++] = majorSpecial << 5 | extendedFloat64;
|
|
97856
|
+
dataView$1.setFloat64(cursor$1, input);
|
|
97857
|
+
cursor$1 += 8;
|
|
97861
97858
|
continue;
|
|
97862
97859
|
} else if (typeof input === "bigint") {
|
|
97863
97860
|
const nonNegative = input >= 0;
|
|
@@ -97868,9 +97865,9 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97868
97865
|
if (n2 < 4294967296) {
|
|
97869
97866
|
encodeInteger(major, n2);
|
|
97870
97867
|
} else {
|
|
97871
|
-
data[cursor++] = major << 5 | extendedFloat64;
|
|
97872
|
-
dataView.setBigUint64(cursor, value);
|
|
97873
|
-
cursor += 8;
|
|
97868
|
+
data[cursor$1++] = major << 5 | extendedFloat64;
|
|
97869
|
+
dataView$1.setBigUint64(cursor$1, value);
|
|
97870
|
+
cursor$1 += 8;
|
|
97874
97871
|
}
|
|
97875
97872
|
} else {
|
|
97876
97873
|
const binaryBigInt = value.toString(2);
|
|
@@ -97882,17 +97879,17 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97882
97879
|
b >>= BigInt(8);
|
|
97883
97880
|
}
|
|
97884
97881
|
ensureSpace(bigIntBytes.byteLength * 2 + 16);
|
|
97885
|
-
data[cursor++] = nonNegative ? 194 : 195;
|
|
97886
|
-
encodeHeader(majorUnstructuredByteString, bigIntBytes.byteLength);
|
|
97887
|
-
data.set(bigIntBytes, cursor);
|
|
97888
|
-
cursor += bigIntBytes.byteLength;
|
|
97882
|
+
data[cursor$1++] = nonNegative ? 194 : 195;
|
|
97883
|
+
encodeHeader$1(majorUnstructuredByteString, bigIntBytes.byteLength);
|
|
97884
|
+
data.set(bigIntBytes, cursor$1);
|
|
97885
|
+
cursor$1 += bigIntBytes.byteLength;
|
|
97889
97886
|
}
|
|
97890
97887
|
continue;
|
|
97891
97888
|
} else if (input === null) {
|
|
97892
|
-
data[cursor++] = majorSpecial << 5 | specialNull;
|
|
97889
|
+
data[cursor$1++] = majorSpecial << 5 | specialNull;
|
|
97893
97890
|
continue;
|
|
97894
97891
|
} else if (typeof input === "boolean") {
|
|
97895
|
-
data[cursor++] = majorSpecial << 5 | (input ? specialTrue : specialFalse);
|
|
97892
|
+
data[cursor$1++] = majorSpecial << 5 | (input ? specialTrue : specialFalse);
|
|
97896
97893
|
continue;
|
|
97897
97894
|
} else if (typeof input === "undefined") {
|
|
97898
97895
|
throw new Error("@smithy/core/cbor: client may not serialize undefined value.");
|
|
@@ -97906,15 +97903,15 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97906
97903
|
} else if (typeof input.byteLength === "number") {
|
|
97907
97904
|
ensureSpace(input.length * 2 + 9);
|
|
97908
97905
|
encodeInteger(majorUnstructuredByteString, input.length);
|
|
97909
|
-
data.set(input, cursor);
|
|
97910
|
-
cursor += input.byteLength;
|
|
97906
|
+
data.set(input, cursor$1);
|
|
97907
|
+
cursor$1 += input.byteLength;
|
|
97911
97908
|
continue;
|
|
97912
97909
|
} else if (typeof input === "object") {
|
|
97913
97910
|
if (input instanceof NumericValue) {
|
|
97914
97911
|
const decimalIndex = input.string.indexOf(".");
|
|
97915
97912
|
const exponent = decimalIndex === -1 ? 0 : decimalIndex - input.string.length + 1;
|
|
97916
97913
|
const mantissa = BigInt(input.string.replace(".", ""));
|
|
97917
|
-
data[cursor++] = 196;
|
|
97914
|
+
data[cursor$1++] = 196;
|
|
97918
97915
|
encodeInteger(majorList, 2);
|
|
97919
97916
|
encodeStack.push(mantissa);
|
|
97920
97917
|
encodeStack.push(exponent);
|
|
@@ -97923,7 +97920,7 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97923
97920
|
if (input[tagSymbol]) {
|
|
97924
97921
|
if ("tag" in input && "value" in input) {
|
|
97925
97922
|
encodeStack.push(input.value);
|
|
97926
|
-
encodeHeader(majorTag, input.tag);
|
|
97923
|
+
encodeHeader$1(majorTag, input.tag);
|
|
97927
97924
|
continue;
|
|
97928
97925
|
} else {
|
|
97929
97926
|
throw new Error("tag encountered with missing fields, need 'tag' and 'value', found: " + JSON.stringify(input));
|
|
@@ -97942,13 +97939,13 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97942
97939
|
}
|
|
97943
97940
|
}
|
|
97944
97941
|
function advanceEncodingEpoch() {
|
|
97945
|
-
encodeCacheEpoch = encodeCacheEpoch + 1 & 65535;
|
|
97946
|
-
encodeCacheSaturated = false;
|
|
97942
|
+
encodeCacheEpoch$1 = encodeCacheEpoch$1 + 1 & 65535;
|
|
97943
|
+
encodeCacheSaturated$1 = false;
|
|
97947
97944
|
}
|
|
97948
97945
|
function toUint8Array() {
|
|
97949
|
-
const out = alloc(cursor);
|
|
97950
|
-
out.set(data.subarray(0, cursor), 0);
|
|
97951
|
-
cursor = 0;
|
|
97946
|
+
const out = alloc(cursor$1);
|
|
97947
|
+
out.set(data.subarray(0, cursor$1), 0);
|
|
97948
|
+
cursor$1 = 0;
|
|
97952
97949
|
return out;
|
|
97953
97950
|
}
|
|
97954
97951
|
function resize(size) {
|
|
@@ -97961,23 +97958,23 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97961
97958
|
data.set(old, 0);
|
|
97962
97959
|
}
|
|
97963
97960
|
}
|
|
97964
|
-
dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
97961
|
+
dataView$1 = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
97965
97962
|
}
|
|
97966
97963
|
function encodeStringCached(input) {
|
|
97967
97964
|
const cached2 = encodeStringCache.get(input);
|
|
97968
97965
|
if (cached2 !== undefined) {
|
|
97969
|
-
data.set(cached2.bytes, cursor);
|
|
97970
|
-
cursor += cached2.bytes.length;
|
|
97971
|
-
cached2.epoch = encodeCacheEpoch;
|
|
97966
|
+
data.set(cached2.bytes, cursor$1);
|
|
97967
|
+
cursor$1 += cached2.bytes.length;
|
|
97968
|
+
cached2.epoch = encodeCacheEpoch$1;
|
|
97972
97969
|
return;
|
|
97973
97970
|
}
|
|
97974
|
-
const start = cursor;
|
|
97971
|
+
const start = cursor$1;
|
|
97975
97972
|
const byteLen = Buffer.byteLength(input);
|
|
97976
97973
|
encodeInteger(majorUtf8String, byteLen);
|
|
97977
|
-
cursor += data.write(input, cursor);
|
|
97978
|
-
const bytes = Uint8Array.prototype.slice.call(data, start, cursor);
|
|
97974
|
+
cursor$1 += data.write(input, cursor$1);
|
|
97975
|
+
const bytes = Uint8Array.prototype.slice.call(data, start, cursor$1);
|
|
97979
97976
|
if (encodeStringCache.size >= 2048) {
|
|
97980
|
-
if (encodeCacheSaturated) {
|
|
97977
|
+
if (encodeCacheSaturated$1) {
|
|
97981
97978
|
return;
|
|
97982
97979
|
}
|
|
97983
97980
|
let evicted = 0;
|
|
@@ -97985,71 +97982,71 @@ var require_cbor = __commonJS((exports) => {
|
|
|
97985
97982
|
if (evicted >= 1024) {
|
|
97986
97983
|
break;
|
|
97987
97984
|
}
|
|
97988
|
-
if (entry.epoch !== encodeCacheEpoch) {
|
|
97985
|
+
if (entry.epoch !== encodeCacheEpoch$1) {
|
|
97989
97986
|
encodeStringCache.delete(key);
|
|
97990
97987
|
evicted++;
|
|
97991
97988
|
}
|
|
97992
97989
|
}
|
|
97993
97990
|
if (evicted === 0) {
|
|
97994
|
-
encodeCacheSaturated = true;
|
|
97991
|
+
encodeCacheSaturated$1 = true;
|
|
97995
97992
|
return;
|
|
97996
97993
|
}
|
|
97997
97994
|
}
|
|
97998
97995
|
if (encodeStringCache.size < 2048) {
|
|
97999
|
-
encodeStringCache.set(input, { epoch: encodeCacheEpoch, bytes });
|
|
97996
|
+
encodeStringCache.set(input, { epoch: encodeCacheEpoch$1, bytes });
|
|
98000
97997
|
}
|
|
98001
97998
|
}
|
|
98002
97999
|
function ensureSpace(bytes) {
|
|
98003
|
-
const remaining = data.byteLength - cursor;
|
|
98000
|
+
const remaining = data.byteLength - cursor$1;
|
|
98004
98001
|
if (remaining < bytes) {
|
|
98005
|
-
if (cursor < 16000000) {
|
|
98002
|
+
if (cursor$1 < 16000000) {
|
|
98006
98003
|
resize(Math.max(data.byteLength * 4, data.byteLength + bytes));
|
|
98007
98004
|
} else {
|
|
98008
98005
|
resize(data.byteLength + bytes + 16000000);
|
|
98009
98006
|
}
|
|
98010
98007
|
}
|
|
98011
98008
|
}
|
|
98012
|
-
function encodeHeader(major, value) {
|
|
98009
|
+
function encodeHeader$1(major, value) {
|
|
98013
98010
|
if (value < 24) {
|
|
98014
|
-
data[cursor++] = major << 5 | value;
|
|
98011
|
+
data[cursor$1++] = major << 5 | value;
|
|
98015
98012
|
} else if (value < 256) {
|
|
98016
|
-
data[cursor++] = major << 5 | 24;
|
|
98017
|
-
data[cursor++] = value;
|
|
98013
|
+
data[cursor$1++] = major << 5 | 24;
|
|
98014
|
+
data[cursor$1++] = value;
|
|
98018
98015
|
} else if (value < 65536) {
|
|
98019
|
-
data[cursor++] = major << 5 | extendedFloat16;
|
|
98020
|
-
dataView.setUint16(cursor, value);
|
|
98021
|
-
cursor += 2;
|
|
98016
|
+
data[cursor$1++] = major << 5 | extendedFloat16;
|
|
98017
|
+
dataView$1.setUint16(cursor$1, value);
|
|
98018
|
+
cursor$1 += 2;
|
|
98022
98019
|
} else if (value < 4294967296) {
|
|
98023
|
-
data[cursor++] = major << 5 | extendedFloat32;
|
|
98024
|
-
dataView.setUint32(cursor, value);
|
|
98025
|
-
cursor += 4;
|
|
98020
|
+
data[cursor$1++] = major << 5 | extendedFloat32;
|
|
98021
|
+
dataView$1.setUint32(cursor$1, value);
|
|
98022
|
+
cursor$1 += 4;
|
|
98026
98023
|
} else {
|
|
98027
|
-
data[cursor++] = major << 5 | extendedFloat64;
|
|
98028
|
-
dataView.setBigUint64(cursor, typeof value === "bigint" ? value : BigInt(value));
|
|
98029
|
-
cursor += 8;
|
|
98024
|
+
data[cursor$1++] = major << 5 | extendedFloat64;
|
|
98025
|
+
dataView$1.setBigUint64(cursor$1, typeof value === "bigint" ? value : BigInt(value));
|
|
98026
|
+
cursor$1 += 8;
|
|
98030
98027
|
}
|
|
98031
98028
|
}
|
|
98032
98029
|
function encodeInteger(major, value) {
|
|
98033
98030
|
if (value < 24) {
|
|
98034
|
-
data[cursor++] = major << 5 | value;
|
|
98031
|
+
data[cursor$1++] = major << 5 | value;
|
|
98035
98032
|
} else if (value < 256) {
|
|
98036
|
-
data[cursor++] = major << 5 | 24;
|
|
98037
|
-
data[cursor++] = value;
|
|
98033
|
+
data[cursor$1++] = major << 5 | 24;
|
|
98034
|
+
data[cursor$1++] = value;
|
|
98038
98035
|
} else if (value < 65536) {
|
|
98039
|
-
data[cursor++] = major << 5 | extendedFloat16;
|
|
98040
|
-
data[cursor++] = value >> 8;
|
|
98041
|
-
data[cursor++] = value & 255;
|
|
98036
|
+
data[cursor$1++] = major << 5 | extendedFloat16;
|
|
98037
|
+
data[cursor$1++] = value >> 8;
|
|
98038
|
+
data[cursor$1++] = value & 255;
|
|
98042
98039
|
} else if (value < 4294967296) {
|
|
98043
|
-
data[cursor++] = major << 5 | extendedFloat32;
|
|
98044
|
-
dataView.setUint32(cursor, value);
|
|
98045
|
-
cursor += 4;
|
|
98040
|
+
data[cursor$1++] = major << 5 | extendedFloat32;
|
|
98041
|
+
dataView$1.setUint32(cursor$1, value);
|
|
98042
|
+
cursor$1 += 4;
|
|
98046
98043
|
} else {
|
|
98047
|
-
data[cursor++] = major << 5 | extendedFloat64;
|
|
98044
|
+
data[cursor$1++] = major << 5 | extendedFloat64;
|
|
98048
98045
|
const hi = value / 4294967296 | 0;
|
|
98049
98046
|
const lo = value - hi * 4294967296 | 0;
|
|
98050
|
-
dataView.setUint32(cursor, hi);
|
|
98051
|
-
dataView.setUint32(cursor + 4, lo);
|
|
98052
|
-
cursor += 8;
|
|
98047
|
+
dataView$1.setUint32(cursor$1, hi);
|
|
98048
|
+
dataView$1.setUint32(cursor$1 + 4, lo);
|
|
98049
|
+
cursor$1 += 8;
|
|
98053
98050
|
}
|
|
98054
98051
|
}
|
|
98055
98052
|
var cbor = {
|
|
@@ -98164,6 +98161,1278 @@ var require_cbor = __commonJS((exports) => {
|
|
|
98164
98161
|
return new HttpRequest(contents);
|
|
98165
98162
|
};
|
|
98166
98163
|
|
|
98164
|
+
class CborShapeSerializer2 extends SerdeContext {
|
|
98165
|
+
write(schema, value) {
|
|
98166
|
+
cursor = 0;
|
|
98167
|
+
const ns = NormalizedSchema.of(schema);
|
|
98168
|
+
writeValue(ns, value, undefined, this.serdeContext);
|
|
98169
|
+
}
|
|
98170
|
+
flush() {
|
|
98171
|
+
const result = buf.subarray(0, cursor);
|
|
98172
|
+
cursor = 0;
|
|
98173
|
+
buf = allocUnsafe2(INITIAL_BUFFER_SIZE);
|
|
98174
|
+
view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
98175
|
+
return result;
|
|
98176
|
+
}
|
|
98177
|
+
}
|
|
98178
|
+
var CBOR_STRUCT_CACHE = Symbol.for("@smithy/cbor-struct-cache");
|
|
98179
|
+
function loadCborStructIterator(ns) {
|
|
98180
|
+
const schema = ns.getSchema();
|
|
98181
|
+
const existing = schema[CBOR_STRUCT_CACHE];
|
|
98182
|
+
if (existing) {
|
|
98183
|
+
return existing;
|
|
98184
|
+
}
|
|
98185
|
+
const memberNames = [];
|
|
98186
|
+
const memberSchemas = [];
|
|
98187
|
+
for (const [name, memberSchema] of ns.structIterator()) {
|
|
98188
|
+
memberNames.push(name);
|
|
98189
|
+
memberSchemas.push(memberSchema);
|
|
98190
|
+
}
|
|
98191
|
+
const encodedKeys = new Array(memberNames.length);
|
|
98192
|
+
for (let i2 = 0;i2 < memberNames.length; ++i2) {
|
|
98193
|
+
encodedKeys[i2] = encodeCborStringKey(memberNames[i2]);
|
|
98194
|
+
}
|
|
98195
|
+
const cache = { memberNames, memberSchemas, encodedKeys };
|
|
98196
|
+
schema[CBOR_STRUCT_CACHE] = cache;
|
|
98197
|
+
return cache;
|
|
98198
|
+
}
|
|
98199
|
+
function encodeCborStringKey(s) {
|
|
98200
|
+
let utf8Bytes;
|
|
98201
|
+
if (USE_BUFFER$1) {
|
|
98202
|
+
utf8Bytes = Buffer.from(s, "utf-8");
|
|
98203
|
+
} else {
|
|
98204
|
+
utf8Bytes = new TextEncoder().encode(s);
|
|
98205
|
+
}
|
|
98206
|
+
const byteLen = utf8Bytes.length;
|
|
98207
|
+
let headerSize;
|
|
98208
|
+
if (byteLen < 24) {
|
|
98209
|
+
headerSize = 1;
|
|
98210
|
+
} else if (byteLen < 256) {
|
|
98211
|
+
headerSize = 2;
|
|
98212
|
+
} else {
|
|
98213
|
+
headerSize = 3;
|
|
98214
|
+
}
|
|
98215
|
+
const result = new Uint8Array(headerSize + byteLen);
|
|
98216
|
+
if (headerSize === 1) {
|
|
98217
|
+
result[0] = majorUtf8String << 5 | byteLen;
|
|
98218
|
+
} else if (headerSize === 2) {
|
|
98219
|
+
result[0] = majorUtf8String << 5 | 24;
|
|
98220
|
+
result[1] = byteLen;
|
|
98221
|
+
} else {
|
|
98222
|
+
result[0] = majorUtf8String << 5 | extendedFloat16;
|
|
98223
|
+
result[1] = byteLen >> 8;
|
|
98224
|
+
result[2] = byteLen & 255;
|
|
98225
|
+
}
|
|
98226
|
+
result.set(utf8Bytes, headerSize);
|
|
98227
|
+
return result;
|
|
98228
|
+
}
|
|
98229
|
+
var USE_BUFFER$1 = typeof Buffer !== "undefined";
|
|
98230
|
+
var textEncoder4 = new TextEncoder;
|
|
98231
|
+
var INITIAL_BUFFER_SIZE = 2048;
|
|
98232
|
+
var buf = USE_BUFFER$1 ? Buffer.allocUnsafe(INITIAL_BUFFER_SIZE) : new Uint8Array(INITIAL_BUFFER_SIZE);
|
|
98233
|
+
var view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
98234
|
+
var cursor = 0;
|
|
98235
|
+
var STRING_CACHE_MAX = 2048;
|
|
98236
|
+
var stringEncodeCache = new Map;
|
|
98237
|
+
var encodeCacheEpoch = 0;
|
|
98238
|
+
var encodeCacheSaturated = false;
|
|
98239
|
+
function allocUnsafe2(size) {
|
|
98240
|
+
return USE_BUFFER$1 ? Buffer.allocUnsafe(size) : new Uint8Array(size);
|
|
98241
|
+
}
|
|
98242
|
+
function writeValue(ns, value, container, serdeContext) {
|
|
98243
|
+
if (value == null) {
|
|
98244
|
+
if (value === undefined && ns.isIdempotencyToken()) {
|
|
98245
|
+
writeString(generateIdempotencyToken());
|
|
98246
|
+
return;
|
|
98247
|
+
}
|
|
98248
|
+
ensure(1);
|
|
98249
|
+
buf[cursor++] = majorSpecial << 5 | specialNull;
|
|
98250
|
+
return;
|
|
98251
|
+
}
|
|
98252
|
+
if (ns.isUnitSchema()) {
|
|
98253
|
+
ensure(1);
|
|
98254
|
+
encodeHeader(majorMap, 0);
|
|
98255
|
+
return;
|
|
98256
|
+
}
|
|
98257
|
+
const isObject5 = typeof value === "object";
|
|
98258
|
+
if (isObject5) {
|
|
98259
|
+
if (ns.isBlobSchema()) {
|
|
98260
|
+
if (value instanceof Uint8Array) {
|
|
98261
|
+
writeBytes(value);
|
|
98262
|
+
return;
|
|
98263
|
+
}
|
|
98264
|
+
}
|
|
98265
|
+
if (ns.isTimestampSchema()) {
|
|
98266
|
+
if (value instanceof Date) {
|
|
98267
|
+
writeTimestamp(value);
|
|
98268
|
+
return;
|
|
98269
|
+
}
|
|
98270
|
+
}
|
|
98271
|
+
if (ns.isStructSchema()) {
|
|
98272
|
+
writeStruct(ns, value, serdeContext);
|
|
98273
|
+
return;
|
|
98274
|
+
}
|
|
98275
|
+
if (Array.isArray(value) && (ns.isListSchema() || ns.isDocumentSchema())) {
|
|
98276
|
+
writeList(ns, value, ns.isDocumentSchema(), serdeContext);
|
|
98277
|
+
return;
|
|
98278
|
+
}
|
|
98279
|
+
if (ns.isMapSchema()) {
|
|
98280
|
+
writeMap(ns, value, false, serdeContext);
|
|
98281
|
+
return;
|
|
98282
|
+
}
|
|
98283
|
+
if (value instanceof Date) {
|
|
98284
|
+
writeTimestamp(value);
|
|
98285
|
+
return;
|
|
98286
|
+
}
|
|
98287
|
+
if (value instanceof Uint8Array) {
|
|
98288
|
+
writeBytes(value);
|
|
98289
|
+
return;
|
|
98290
|
+
}
|
|
98291
|
+
if (value instanceof NumericValue) {
|
|
98292
|
+
writeNumericValue(value);
|
|
98293
|
+
return;
|
|
98294
|
+
}
|
|
98295
|
+
if (value[tagSymbol]) {
|
|
98296
|
+
const tagged = value;
|
|
98297
|
+
writeTag(tagged.tag, tagged.value);
|
|
98298
|
+
return;
|
|
98299
|
+
}
|
|
98300
|
+
if (ns.isDocumentSchema()) {
|
|
98301
|
+
if (Array.isArray(value)) {
|
|
98302
|
+
writeList(ns, value, true, serdeContext);
|
|
98303
|
+
} else {
|
|
98304
|
+
writeMap(ns, value, true, serdeContext);
|
|
98305
|
+
}
|
|
98306
|
+
return;
|
|
98307
|
+
}
|
|
98308
|
+
if (ns.isBigDecimalSchema()) {
|
|
98309
|
+
writeUntypedValue(value);
|
|
98310
|
+
return;
|
|
98311
|
+
}
|
|
98312
|
+
writeMap(ns, value, true, serdeContext);
|
|
98313
|
+
return;
|
|
98314
|
+
}
|
|
98315
|
+
if (typeof value === "string") {
|
|
98316
|
+
if (ns.isBlobSchema()) {
|
|
98317
|
+
const bytes = (serdeContext?.base64Decoder ?? fromBase64)(value);
|
|
98318
|
+
writeBytes(bytes);
|
|
98319
|
+
return;
|
|
98320
|
+
}
|
|
98321
|
+
writeString(value);
|
|
98322
|
+
return;
|
|
98323
|
+
}
|
|
98324
|
+
if (typeof value === "number") {
|
|
98325
|
+
ensure(9);
|
|
98326
|
+
if (Number.isInteger(value) && value >= -9007199254740992 && value <= 9007199254740991) {
|
|
98327
|
+
writeInteger(value);
|
|
98328
|
+
} else {
|
|
98329
|
+
writeFloat64(value);
|
|
98330
|
+
}
|
|
98331
|
+
return;
|
|
98332
|
+
}
|
|
98333
|
+
if (typeof value === "boolean") {
|
|
98334
|
+
ensure(1);
|
|
98335
|
+
buf[cursor++] = majorSpecial << 5 | (value ? specialTrue : specialFalse);
|
|
98336
|
+
return;
|
|
98337
|
+
}
|
|
98338
|
+
if (typeof value === "bigint") {
|
|
98339
|
+
writeBigInt(value);
|
|
98340
|
+
return;
|
|
98341
|
+
}
|
|
98342
|
+
writeString(String(value));
|
|
98343
|
+
}
|
|
98344
|
+
function writeStruct(ns, value, serdeContext) {
|
|
98345
|
+
if (ns.isUnionSchema()) {
|
|
98346
|
+
let wrote = false;
|
|
98347
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
98348
|
+
const item = value[memberName];
|
|
98349
|
+
if (item != null) {
|
|
98350
|
+
ensure(9);
|
|
98351
|
+
encodeHeader(majorMap, 1);
|
|
98352
|
+
writeString(memberName);
|
|
98353
|
+
writeValue(memberSchema, item, ns, serdeContext);
|
|
98354
|
+
wrote = true;
|
|
98355
|
+
break;
|
|
98356
|
+
}
|
|
98357
|
+
}
|
|
98358
|
+
if (!wrote) {
|
|
98359
|
+
const { $unknown } = value;
|
|
98360
|
+
if (Array.isArray($unknown)) {
|
|
98361
|
+
ensure(9);
|
|
98362
|
+
encodeHeader(majorMap, 1);
|
|
98363
|
+
writeString($unknown[0]);
|
|
98364
|
+
writeUntypedValue($unknown[1]);
|
|
98365
|
+
} else {
|
|
98366
|
+
ensure(9);
|
|
98367
|
+
encodeHeader(majorMap, 0);
|
|
98368
|
+
}
|
|
98369
|
+
}
|
|
98370
|
+
return;
|
|
98371
|
+
}
|
|
98372
|
+
const cache = loadCborStructIterator(ns);
|
|
98373
|
+
const { memberNames, memberSchemas, encodedKeys } = cache;
|
|
98374
|
+
const z3 = memberNames.length;
|
|
98375
|
+
let headerSize;
|
|
98376
|
+
if (z3 < 24) {
|
|
98377
|
+
headerSize = 1;
|
|
98378
|
+
} else if (z3 < 256) {
|
|
98379
|
+
headerSize = 2;
|
|
98380
|
+
} else {
|
|
98381
|
+
headerSize = 3;
|
|
98382
|
+
}
|
|
98383
|
+
ensure(headerSize);
|
|
98384
|
+
const headerPos = cursor;
|
|
98385
|
+
cursor += headerSize;
|
|
98386
|
+
let count3 = 0;
|
|
98387
|
+
for (let i2 = 0;i2 < z3; ++i2) {
|
|
98388
|
+
const item = value[memberNames[i2]];
|
|
98389
|
+
if (item == null && !memberSchemas[i2].isIdempotencyToken()) {
|
|
98390
|
+
continue;
|
|
98391
|
+
}
|
|
98392
|
+
const key = encodedKeys[i2];
|
|
98393
|
+
ensure(key.length);
|
|
98394
|
+
buf.set(key, cursor);
|
|
98395
|
+
cursor += key.length;
|
|
98396
|
+
writeValue(memberSchemas[i2], item, ns, serdeContext);
|
|
98397
|
+
++count3;
|
|
98398
|
+
}
|
|
98399
|
+
if (typeof value.__type === "string") {
|
|
98400
|
+
for (const k in value) {
|
|
98401
|
+
if (!memberNames.includes(k)) {
|
|
98402
|
+
writeString(k);
|
|
98403
|
+
writeUntypedValue(value[k]);
|
|
98404
|
+
++count3;
|
|
98405
|
+
}
|
|
98406
|
+
}
|
|
98407
|
+
}
|
|
98408
|
+
if (headerSize === 1) {
|
|
98409
|
+
buf[headerPos] = majorMap << 5 | count3;
|
|
98410
|
+
} else if (headerSize === 2) {
|
|
98411
|
+
buf[headerPos] = majorMap << 5 | 24;
|
|
98412
|
+
buf[headerPos + 1] = count3;
|
|
98413
|
+
} else {
|
|
98414
|
+
buf[headerPos] = majorMap << 5 | extendedFloat16;
|
|
98415
|
+
buf[headerPos + 1] = count3 >> 8;
|
|
98416
|
+
buf[headerPos + 2] = count3 & 255;
|
|
98417
|
+
}
|
|
98418
|
+
}
|
|
98419
|
+
function writeList(ns, value, isDocument, serdeContext) {
|
|
98420
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
98421
|
+
const valueSchema = ns.getValueSchema();
|
|
98422
|
+
if (isDocument || sparse) {
|
|
98423
|
+
const items = [];
|
|
98424
|
+
for (let i2 = 0;i2 < value.length; ++i2) {
|
|
98425
|
+
const item = value[i2];
|
|
98426
|
+
if (isDocument) {
|
|
98427
|
+
if (item !== undefined) {
|
|
98428
|
+
items.push(item);
|
|
98429
|
+
}
|
|
98430
|
+
} else {
|
|
98431
|
+
if (item != null || sparse) {
|
|
98432
|
+
items.push(item);
|
|
98433
|
+
}
|
|
98434
|
+
}
|
|
98435
|
+
}
|
|
98436
|
+
ensure(9);
|
|
98437
|
+
encodeHeader(majorList, items.length);
|
|
98438
|
+
for (let i2 = 0;i2 < items.length; ++i2) {
|
|
98439
|
+
writeValue(valueSchema, items[i2], undefined, serdeContext);
|
|
98440
|
+
}
|
|
98441
|
+
} else {
|
|
98442
|
+
let count3 = 0;
|
|
98443
|
+
for (let i2 = 0;i2 < value.length; ++i2) {
|
|
98444
|
+
if (value[i2] != null) {
|
|
98445
|
+
++count3;
|
|
98446
|
+
}
|
|
98447
|
+
}
|
|
98448
|
+
ensure(9);
|
|
98449
|
+
encodeHeader(majorList, count3);
|
|
98450
|
+
for (let i2 = 0;i2 < value.length; ++i2) {
|
|
98451
|
+
if (value[i2] != null) {
|
|
98452
|
+
writeValue(valueSchema, value[i2], undefined, serdeContext);
|
|
98453
|
+
}
|
|
98454
|
+
}
|
|
98455
|
+
}
|
|
98456
|
+
}
|
|
98457
|
+
function writeMap(ns, value, isDocument, serdeContext) {
|
|
98458
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
98459
|
+
const valueSchema = ns.getValueSchema();
|
|
98460
|
+
const keys2 = [];
|
|
98461
|
+
for (const k in value) {
|
|
98462
|
+
const v = value[k];
|
|
98463
|
+
if (isDocument ? v !== undefined : v != null || sparse) {
|
|
98464
|
+
keys2.push(k);
|
|
98465
|
+
}
|
|
98466
|
+
}
|
|
98467
|
+
ensure(9);
|
|
98468
|
+
encodeHeader(majorMap, keys2.length);
|
|
98469
|
+
for (let i2 = 0;i2 < keys2.length; ++i2) {
|
|
98470
|
+
const k = keys2[i2];
|
|
98471
|
+
writeString(k);
|
|
98472
|
+
writeValue(valueSchema, value[k], undefined, serdeContext);
|
|
98473
|
+
}
|
|
98474
|
+
}
|
|
98475
|
+
function writeUntypedValue(value) {
|
|
98476
|
+
if (value == null) {
|
|
98477
|
+
ensure(1);
|
|
98478
|
+
buf[cursor++] = majorSpecial << 5 | specialNull;
|
|
98479
|
+
return;
|
|
98480
|
+
}
|
|
98481
|
+
if (typeof value === "string") {
|
|
98482
|
+
writeString(value);
|
|
98483
|
+
return;
|
|
98484
|
+
}
|
|
98485
|
+
if (typeof value === "number") {
|
|
98486
|
+
ensure(9);
|
|
98487
|
+
if (Number.isInteger(value) && value >= -9007199254740992 && value <= 9007199254740991) {
|
|
98488
|
+
writeInteger(value);
|
|
98489
|
+
} else {
|
|
98490
|
+
writeFloat64(value);
|
|
98491
|
+
}
|
|
98492
|
+
return;
|
|
98493
|
+
}
|
|
98494
|
+
if (typeof value === "boolean") {
|
|
98495
|
+
ensure(1);
|
|
98496
|
+
buf[cursor++] = majorSpecial << 5 | (value ? specialTrue : specialFalse);
|
|
98497
|
+
return;
|
|
98498
|
+
}
|
|
98499
|
+
if (typeof value === "bigint") {
|
|
98500
|
+
writeBigInt(value);
|
|
98501
|
+
return;
|
|
98502
|
+
}
|
|
98503
|
+
if (value instanceof Uint8Array) {
|
|
98504
|
+
writeBytes(value);
|
|
98505
|
+
return;
|
|
98506
|
+
}
|
|
98507
|
+
if (value instanceof Date) {
|
|
98508
|
+
writeTimestamp(value);
|
|
98509
|
+
return;
|
|
98510
|
+
}
|
|
98511
|
+
if (value instanceof NumericValue) {
|
|
98512
|
+
writeNumericValue(value);
|
|
98513
|
+
return;
|
|
98514
|
+
}
|
|
98515
|
+
if (value[tagSymbol]) {
|
|
98516
|
+
const tagged = value;
|
|
98517
|
+
writeTag(tagged.tag, tagged.value);
|
|
98518
|
+
return;
|
|
98519
|
+
}
|
|
98520
|
+
if (Array.isArray(value)) {
|
|
98521
|
+
ensure(9);
|
|
98522
|
+
encodeHeader(majorList, value.length);
|
|
98523
|
+
for (let i2 = 0;i2 < value.length; ++i2) {
|
|
98524
|
+
writeUntypedValue(value[i2]);
|
|
98525
|
+
}
|
|
98526
|
+
return;
|
|
98527
|
+
}
|
|
98528
|
+
if (typeof value === "object") {
|
|
98529
|
+
const keys2 = Object.keys(value);
|
|
98530
|
+
ensure(9);
|
|
98531
|
+
encodeHeader(majorMap, keys2.length);
|
|
98532
|
+
for (let i2 = 0;i2 < keys2.length; ++i2) {
|
|
98533
|
+
writeString(keys2[i2]);
|
|
98534
|
+
writeUntypedValue(value[keys2[i2]]);
|
|
98535
|
+
}
|
|
98536
|
+
return;
|
|
98537
|
+
}
|
|
98538
|
+
writeString(String(value));
|
|
98539
|
+
}
|
|
98540
|
+
function ensure(n2) {
|
|
98541
|
+
if (cursor + n2 > buf.length) {
|
|
98542
|
+
let newSize = buf.length * 2;
|
|
98543
|
+
while (newSize < cursor + n2) {
|
|
98544
|
+
newSize *= 2;
|
|
98545
|
+
}
|
|
98546
|
+
const next = allocUnsafe2(newSize);
|
|
98547
|
+
next.set(buf.subarray(0, cursor));
|
|
98548
|
+
buf = next;
|
|
98549
|
+
view = new DataView(next.buffer, next.byteOffset, next.byteLength);
|
|
98550
|
+
}
|
|
98551
|
+
}
|
|
98552
|
+
function encodeHeader(major, value) {
|
|
98553
|
+
if (value < 24) {
|
|
98554
|
+
buf[cursor++] = major << 5 | value;
|
|
98555
|
+
} else if (value < 256) {
|
|
98556
|
+
buf[cursor++] = major << 5 | 24;
|
|
98557
|
+
buf[cursor++] = value;
|
|
98558
|
+
} else if (value < 65536) {
|
|
98559
|
+
buf[cursor++] = major << 5 | extendedFloat16;
|
|
98560
|
+
buf[cursor++] = value >> 8;
|
|
98561
|
+
buf[cursor++] = value & 255;
|
|
98562
|
+
} else if (value < 4294967296) {
|
|
98563
|
+
buf[cursor++] = major << 5 | extendedFloat32;
|
|
98564
|
+
view.setUint32(cursor, value);
|
|
98565
|
+
cursor += 4;
|
|
98566
|
+
} else {
|
|
98567
|
+
buf[cursor++] = major << 5 | extendedFloat64;
|
|
98568
|
+
const hi = value / 4294967296 | 0;
|
|
98569
|
+
const lo = value - hi * 4294967296 | 0;
|
|
98570
|
+
view.setUint32(cursor, hi);
|
|
98571
|
+
view.setUint32(cursor + 4, lo);
|
|
98572
|
+
cursor += 8;
|
|
98573
|
+
}
|
|
98574
|
+
}
|
|
98575
|
+
function encodeBigHeader(major, value) {
|
|
98576
|
+
const n2 = Number(value);
|
|
98577
|
+
if (n2 < 4294967296) {
|
|
98578
|
+
encodeHeader(major, n2);
|
|
98579
|
+
return;
|
|
98580
|
+
}
|
|
98581
|
+
buf[cursor++] = major << 5 | extendedFloat64;
|
|
98582
|
+
view.setBigUint64(cursor, value);
|
|
98583
|
+
cursor += 8;
|
|
98584
|
+
}
|
|
98585
|
+
function writeString(s) {
|
|
98586
|
+
const len = s.length;
|
|
98587
|
+
if (len <= 23) {
|
|
98588
|
+
const cached2 = stringEncodeCache.get(s);
|
|
98589
|
+
if (cached2) {
|
|
98590
|
+
ensure(cached2.bytes.length);
|
|
98591
|
+
buf.set(cached2.bytes, cursor);
|
|
98592
|
+
cursor += cached2.bytes.length;
|
|
98593
|
+
cached2.epoch = encodeCacheEpoch;
|
|
98594
|
+
return;
|
|
98595
|
+
}
|
|
98596
|
+
const start = cursor;
|
|
98597
|
+
writeStringUncached(s, len);
|
|
98598
|
+
const end2 = cursor;
|
|
98599
|
+
const bytes = Uint8Array.prototype.slice.call(buf, start, end2);
|
|
98600
|
+
if (stringEncodeCache.size >= STRING_CACHE_MAX) {
|
|
98601
|
+
if (encodeCacheSaturated) {
|
|
98602
|
+
return;
|
|
98603
|
+
}
|
|
98604
|
+
let evicted = 0;
|
|
98605
|
+
for (const [key, entry] of stringEncodeCache) {
|
|
98606
|
+
if (evicted >= 1024) {
|
|
98607
|
+
break;
|
|
98608
|
+
}
|
|
98609
|
+
if (entry.epoch !== encodeCacheEpoch) {
|
|
98610
|
+
stringEncodeCache.delete(key);
|
|
98611
|
+
++evicted;
|
|
98612
|
+
}
|
|
98613
|
+
}
|
|
98614
|
+
if (evicted === 0) {
|
|
98615
|
+
encodeCacheSaturated = true;
|
|
98616
|
+
return;
|
|
98617
|
+
}
|
|
98618
|
+
}
|
|
98619
|
+
if (stringEncodeCache.size < STRING_CACHE_MAX) {
|
|
98620
|
+
stringEncodeCache.set(s, { epoch: encodeCacheEpoch, bytes });
|
|
98621
|
+
}
|
|
98622
|
+
return;
|
|
98623
|
+
}
|
|
98624
|
+
writeStringUncached(s, len);
|
|
98625
|
+
}
|
|
98626
|
+
function writeStringUncached(s, len) {
|
|
98627
|
+
if (USE_BUFFER$1) {
|
|
98628
|
+
const maxBytes = len * 3;
|
|
98629
|
+
ensure(maxBytes + 9);
|
|
98630
|
+
const byteLen = Buffer.byteLength(s);
|
|
98631
|
+
encodeHeader(majorUtf8String, byteLen);
|
|
98632
|
+
cursor += buf.write(s, cursor);
|
|
98633
|
+
} else {
|
|
98634
|
+
const maxBytes = len * 3;
|
|
98635
|
+
ensure(maxBytes + 9);
|
|
98636
|
+
const headerPos = cursor;
|
|
98637
|
+
const result = textEncoder4.encodeInto(s, buf.subarray(headerPos + 9));
|
|
98638
|
+
const byteLen = result.written;
|
|
98639
|
+
let headerSize;
|
|
98640
|
+
if (byteLen < 24) {
|
|
98641
|
+
headerSize = 1;
|
|
98642
|
+
} else if (byteLen < 256) {
|
|
98643
|
+
headerSize = 2;
|
|
98644
|
+
} else if (byteLen < 65536) {
|
|
98645
|
+
headerSize = 3;
|
|
98646
|
+
} else if (byteLen < 4294967296) {
|
|
98647
|
+
headerSize = 5;
|
|
98648
|
+
} else {
|
|
98649
|
+
headerSize = 9;
|
|
98650
|
+
}
|
|
98651
|
+
if (headerSize < 9) {
|
|
98652
|
+
buf.copyWithin(headerPos + headerSize, headerPos + 9, headerPos + 9 + byteLen);
|
|
98653
|
+
}
|
|
98654
|
+
cursor = headerPos;
|
|
98655
|
+
encodeHeader(majorUtf8String, byteLen);
|
|
98656
|
+
cursor += byteLen;
|
|
98657
|
+
}
|
|
98658
|
+
}
|
|
98659
|
+
function writeFloat64(value) {
|
|
98660
|
+
ensure(9);
|
|
98661
|
+
buf[cursor++] = majorSpecial << 5 | extendedFloat64;
|
|
98662
|
+
view.setFloat64(cursor, value);
|
|
98663
|
+
cursor += 8;
|
|
98664
|
+
}
|
|
98665
|
+
function writeInteger(value) {
|
|
98666
|
+
ensure(9);
|
|
98667
|
+
const nonNegative = value >= 0;
|
|
98668
|
+
const major = nonNegative ? majorUint64 : majorNegativeInt64;
|
|
98669
|
+
const abs = nonNegative ? value : -value - 1;
|
|
98670
|
+
encodeHeader(major, abs);
|
|
98671
|
+
}
|
|
98672
|
+
function writeBigInt(value) {
|
|
98673
|
+
const nonNegative = value >= 0;
|
|
98674
|
+
const major = nonNegative ? majorUint64 : majorNegativeInt64;
|
|
98675
|
+
const abs = nonNegative ? value : -value - BigInt(1);
|
|
98676
|
+
if (abs < BigInt("18446744073709551616")) {
|
|
98677
|
+
ensure(9);
|
|
98678
|
+
encodeBigHeader(major, abs);
|
|
98679
|
+
} else {
|
|
98680
|
+
const binaryStr = abs.toString(2);
|
|
98681
|
+
const byteLen = Math.ceil(binaryStr.length / 8);
|
|
98682
|
+
const bigIntBytes = new Uint8Array(byteLen);
|
|
98683
|
+
let b = abs;
|
|
98684
|
+
for (let i2 = byteLen - 1;i2 >= 0; --i2) {
|
|
98685
|
+
bigIntBytes[i2] = Number(b & BigInt(255));
|
|
98686
|
+
b >>= BigInt(8);
|
|
98687
|
+
}
|
|
98688
|
+
ensure(byteLen + 16);
|
|
98689
|
+
buf[cursor++] = nonNegative ? 194 : 195;
|
|
98690
|
+
encodeHeader(majorUnstructuredByteString, byteLen);
|
|
98691
|
+
buf.set(bigIntBytes, cursor);
|
|
98692
|
+
cursor += byteLen;
|
|
98693
|
+
}
|
|
98694
|
+
}
|
|
98695
|
+
function writeBytes(data2) {
|
|
98696
|
+
ensure(data2.length + 9);
|
|
98697
|
+
encodeHeader(majorUnstructuredByteString, data2.length);
|
|
98698
|
+
buf.set(data2, cursor);
|
|
98699
|
+
cursor += data2.length;
|
|
98700
|
+
}
|
|
98701
|
+
function writeTag(tagValue, innerValue) {
|
|
98702
|
+
ensure(9);
|
|
98703
|
+
if (typeof tagValue === "bigint") {
|
|
98704
|
+
encodeBigHeader(majorTag, tagValue);
|
|
98705
|
+
} else {
|
|
98706
|
+
encodeHeader(majorTag, tagValue);
|
|
98707
|
+
}
|
|
98708
|
+
writeUntypedValue(innerValue);
|
|
98709
|
+
}
|
|
98710
|
+
function writeNumericValue(nv2) {
|
|
98711
|
+
const decimalIndex = nv2.string.indexOf(".");
|
|
98712
|
+
const exponent = decimalIndex === -1 ? 0 : decimalIndex - nv2.string.length + 1;
|
|
98713
|
+
const mantissa = BigInt(nv2.string.replace(".", ""));
|
|
98714
|
+
ensure(9);
|
|
98715
|
+
buf[cursor++] = 196;
|
|
98716
|
+
encodeHeader(majorList, 2);
|
|
98717
|
+
ensure(9);
|
|
98718
|
+
writeInteger(exponent);
|
|
98719
|
+
writeBigInt(mantissa);
|
|
98720
|
+
}
|
|
98721
|
+
function writeTimestamp(date5) {
|
|
98722
|
+
ensure(18);
|
|
98723
|
+
encodeHeader(majorTag, 1);
|
|
98724
|
+
const epochSecs = date5.getTime() / 1000;
|
|
98725
|
+
if (Number.isInteger(epochSecs)) {
|
|
98726
|
+
writeInteger(epochSecs);
|
|
98727
|
+
} else {
|
|
98728
|
+
writeFloat64(epochSecs);
|
|
98729
|
+
}
|
|
98730
|
+
}
|
|
98731
|
+
|
|
98732
|
+
class CborShapeDeserializer2 extends SerdeContext {
|
|
98733
|
+
read(schema, bytes) {
|
|
98734
|
+
payload = bytes;
|
|
98735
|
+
isBuffer3 = USE_BUFFER && bytes instanceof Buffer;
|
|
98736
|
+
dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
98737
|
+
pos = 0;
|
|
98738
|
+
end = bytes.length;
|
|
98739
|
+
cacheEpoch = cacheEpoch + 1 & 65535;
|
|
98740
|
+
return readValue(NormalizedSchema.of(schema));
|
|
98741
|
+
}
|
|
98742
|
+
readValue(_schema, value) {
|
|
98743
|
+
return transformObject(NormalizedSchema.of(_schema), value);
|
|
98744
|
+
}
|
|
98745
|
+
}
|
|
98746
|
+
var USE_BUFFER = typeof Buffer !== "undefined";
|
|
98747
|
+
var textDecoder2 = new TextDecoder;
|
|
98748
|
+
var payload = new Uint8Array(0);
|
|
98749
|
+
var isBuffer3 = false;
|
|
98750
|
+
var dataView = new DataView(new ArrayBuffer(0));
|
|
98751
|
+
var pos = 0;
|
|
98752
|
+
var end = 0;
|
|
98753
|
+
var STRING_CACHE_SIZE = 2048;
|
|
98754
|
+
var stringCache = new Array(STRING_CACHE_SIZE);
|
|
98755
|
+
var stringCacheEpochs = new Uint16Array(STRING_CACHE_SIZE);
|
|
98756
|
+
var cacheEpoch = 0;
|
|
98757
|
+
function readValue(ns) {
|
|
98758
|
+
if (pos >= end) {
|
|
98759
|
+
throw new Error("unexpected end of CBOR payload.");
|
|
98760
|
+
}
|
|
98761
|
+
const major = (payload[pos] & 224) >> 5;
|
|
98762
|
+
const minor = payload[pos] & 31;
|
|
98763
|
+
if (minor === minorIndefinite && major >= 2 && major <= 5) {
|
|
98764
|
+
return readIndefinite(ns, major);
|
|
98765
|
+
}
|
|
98766
|
+
switch (major) {
|
|
98767
|
+
case majorUint64:
|
|
98768
|
+
return readUnsignedInt();
|
|
98769
|
+
case majorNegativeInt64:
|
|
98770
|
+
return readNegativeInt();
|
|
98771
|
+
case majorUnstructuredByteString:
|
|
98772
|
+
return readByteString();
|
|
98773
|
+
case majorUtf8String:
|
|
98774
|
+
return readUtf8String();
|
|
98775
|
+
case majorList:
|
|
98776
|
+
return readList(ns);
|
|
98777
|
+
case majorMap:
|
|
98778
|
+
return readMap(ns);
|
|
98779
|
+
case majorTag:
|
|
98780
|
+
return readTag();
|
|
98781
|
+
case majorSpecial:
|
|
98782
|
+
return readSpecial();
|
|
98783
|
+
default:
|
|
98784
|
+
throw new Error(`unexpected CBOR major type ${major}.`);
|
|
98785
|
+
}
|
|
98786
|
+
}
|
|
98787
|
+
function readList(ns) {
|
|
98788
|
+
const count3 = decodeCount();
|
|
98789
|
+
const memberSchema = ns.isListSchema() ? ns.getValueSchema() : ns;
|
|
98790
|
+
const list = Array(count3);
|
|
98791
|
+
for (let i2 = 0;i2 < count3; ++i2) {
|
|
98792
|
+
list[i2] = readValue(memberSchema);
|
|
98793
|
+
}
|
|
98794
|
+
return list;
|
|
98795
|
+
}
|
|
98796
|
+
function readMap(ns) {
|
|
98797
|
+
const count3 = decodeCount();
|
|
98798
|
+
if (ns.isStructSchema()) {
|
|
98799
|
+
const startPos = pos;
|
|
98800
|
+
return readStruct(ns, count3, startPos);
|
|
98801
|
+
}
|
|
98802
|
+
const valueSchema = ns.isMapSchema() ? ns.getValueSchema() : ns;
|
|
98803
|
+
const map2 = {};
|
|
98804
|
+
for (let i2 = 0;i2 < count3; ++i2) {
|
|
98805
|
+
const key = readUtf8String();
|
|
98806
|
+
map2[key] = readValue(valueSchema);
|
|
98807
|
+
}
|
|
98808
|
+
return map2;
|
|
98809
|
+
}
|
|
98810
|
+
function readStruct(ns, count3, startPos) {
|
|
98811
|
+
const isUnion = ns.isUnionSchema();
|
|
98812
|
+
const cache = loadCborStructIterator(ns);
|
|
98813
|
+
const { memberSchemas, encodedKeys, memberNames } = cache;
|
|
98814
|
+
const z3 = encodedKeys.length;
|
|
98815
|
+
const result = {};
|
|
98816
|
+
let unknownKey;
|
|
98817
|
+
let unknownValue;
|
|
98818
|
+
let unknownCount = 0;
|
|
98819
|
+
let hasType = false;
|
|
98820
|
+
let hint = 0;
|
|
98821
|
+
for (let i2 = 0;i2 < count3; ++i2) {
|
|
98822
|
+
const matchIdx = matchStructKey(encodedKeys, z3, hint);
|
|
98823
|
+
if (matchIdx >= 0) {
|
|
98824
|
+
hint = matchIdx + 1;
|
|
98825
|
+
if (hint >= z3) {
|
|
98826
|
+
hint = 0;
|
|
98827
|
+
}
|
|
98828
|
+
const val = readValue(memberSchemas[matchIdx]);
|
|
98829
|
+
if (val != null) {
|
|
98830
|
+
result[memberNames[matchIdx]] = val;
|
|
98831
|
+
}
|
|
98832
|
+
} else {
|
|
98833
|
+
const key = readUtf8String();
|
|
98834
|
+
const val = readValue(NormalizedSchema.of(15));
|
|
98835
|
+
if (key === "__type" && typeof val === "string") {
|
|
98836
|
+
hasType = true;
|
|
98837
|
+
} else {
|
|
98838
|
+
unknownKey = key;
|
|
98839
|
+
unknownValue = val;
|
|
98840
|
+
++unknownCount;
|
|
98841
|
+
}
|
|
98842
|
+
}
|
|
98843
|
+
}
|
|
98844
|
+
if (isUnion) {
|
|
98845
|
+
let resultEmpty = true;
|
|
98846
|
+
for (const _ in result) {
|
|
98847
|
+
resultEmpty = false;
|
|
98848
|
+
break;
|
|
98849
|
+
}
|
|
98850
|
+
if (resultEmpty && unknownCount === 1) {
|
|
98851
|
+
result.$unknown = [unknownKey, unknownValue];
|
|
98852
|
+
}
|
|
98853
|
+
} else if (hasType) {
|
|
98854
|
+
pos = startPos;
|
|
98855
|
+
const docSchema = NormalizedSchema.of(15);
|
|
98856
|
+
for (let i2 = 0;i2 < count3; ++i2) {
|
|
98857
|
+
const key = readUtf8String();
|
|
98858
|
+
const val = readValue(docSchema);
|
|
98859
|
+
if (!(key in result)) {
|
|
98860
|
+
result[key] = val;
|
|
98861
|
+
}
|
|
98862
|
+
}
|
|
98863
|
+
}
|
|
98864
|
+
return result;
|
|
98865
|
+
}
|
|
98866
|
+
function readTag(ns) {
|
|
98867
|
+
const tagNum = decodeArgument();
|
|
98868
|
+
const tagNumber = typeof tagNum === "bigint" ? Number(tagNum) : tagNum;
|
|
98869
|
+
if (tagNumber === 1) {
|
|
98870
|
+
const docSchema2 = NormalizedSchema.of(15);
|
|
98871
|
+
const epochValue = readValue(docSchema2);
|
|
98872
|
+
return _parseEpochTimestamp(epochValue);
|
|
98873
|
+
}
|
|
98874
|
+
if (tagNumber === 2 || tagNumber === 3) {
|
|
98875
|
+
const byteStr = readByteString();
|
|
98876
|
+
let b = BigInt(0);
|
|
98877
|
+
for (let i2 = 0;i2 < byteStr.length; ++i2) {
|
|
98878
|
+
b = b << BigInt(8) | BigInt(byteStr[i2]);
|
|
98879
|
+
}
|
|
98880
|
+
return tagNumber === 3 ? -b - BigInt(1) : b;
|
|
98881
|
+
}
|
|
98882
|
+
if (tagNumber === 4) {
|
|
98883
|
+
const docSchema2 = NormalizedSchema.of(15);
|
|
98884
|
+
const pair = readValue(docSchema2);
|
|
98885
|
+
const [exponent, mantissa] = pair;
|
|
98886
|
+
const normalizer = mantissa < 0 ? -1 : 1;
|
|
98887
|
+
const mantissaStr = "0".repeat(Math.abs(exponent) + 1) + String(BigInt(normalizer) * BigInt(mantissa));
|
|
98888
|
+
let numericString;
|
|
98889
|
+
const sign = mantissa < 0 ? "-" : "";
|
|
98890
|
+
numericString = exponent === 0 ? mantissaStr : mantissaStr.slice(0, mantissaStr.length + exponent) + "." + mantissaStr.slice(exponent);
|
|
98891
|
+
numericString = numericString.replace(/^0+/g, "");
|
|
98892
|
+
if (numericString === "") {
|
|
98893
|
+
numericString = "0";
|
|
98894
|
+
}
|
|
98895
|
+
if (numericString[0] === ".") {
|
|
98896
|
+
numericString = "0" + numericString;
|
|
98897
|
+
}
|
|
98898
|
+
numericString = sign + numericString;
|
|
98899
|
+
return nv(numericString);
|
|
98900
|
+
}
|
|
98901
|
+
const docSchema = NormalizedSchema.of(15);
|
|
98902
|
+
const innerValue = readValue(docSchema);
|
|
98903
|
+
return { tag: castBigInt(tagNum), value: innerValue };
|
|
98904
|
+
}
|
|
98905
|
+
function readIndefinite(ns, major) {
|
|
98906
|
+
switch (major) {
|
|
98907
|
+
case majorUtf8String:
|
|
98908
|
+
return readUtf8StringIndefinite();
|
|
98909
|
+
case majorUnstructuredByteString:
|
|
98910
|
+
return readByteStringIndefinite();
|
|
98911
|
+
case majorList:
|
|
98912
|
+
return readListIndefinite(ns);
|
|
98913
|
+
case majorMap:
|
|
98914
|
+
return readMapIndefinite(ns);
|
|
98915
|
+
default:
|
|
98916
|
+
throw new Error(`unexpected indefinite length for major ${major}.`);
|
|
98917
|
+
}
|
|
98918
|
+
}
|
|
98919
|
+
function readUtf8StringIndefinite() {
|
|
98920
|
+
pos += 1;
|
|
98921
|
+
const chunks = [];
|
|
98922
|
+
let totalLen = 0;
|
|
98923
|
+
while (pos < end) {
|
|
98924
|
+
if (payload[pos] === 255) {
|
|
98925
|
+
pos += 1;
|
|
98926
|
+
const combined = new Uint8Array(totalLen);
|
|
98927
|
+
let offset = 0;
|
|
98928
|
+
for (let i2 = 0;i2 < chunks.length; ++i2) {
|
|
98929
|
+
combined.set(chunks[i2], offset);
|
|
98930
|
+
offset += chunks[i2].length;
|
|
98931
|
+
}
|
|
98932
|
+
if (USE_BUFFER) {
|
|
98933
|
+
return Buffer.from(combined.buffer, combined.byteOffset, combined.byteLength).toString("utf-8");
|
|
98934
|
+
}
|
|
98935
|
+
return textDecoder2.decode(combined);
|
|
98936
|
+
}
|
|
98937
|
+
const bytes = readByteString();
|
|
98938
|
+
chunks.push(bytes);
|
|
98939
|
+
totalLen += bytes.length;
|
|
98940
|
+
}
|
|
98941
|
+
throw new Error("expected break marker.");
|
|
98942
|
+
}
|
|
98943
|
+
function readByteStringIndefinite() {
|
|
98944
|
+
pos += 1;
|
|
98945
|
+
const chunks = [];
|
|
98946
|
+
let totalLen = 0;
|
|
98947
|
+
while (pos < end) {
|
|
98948
|
+
if (payload[pos] === 255) {
|
|
98949
|
+
pos += 1;
|
|
98950
|
+
const combined = new Uint8Array(totalLen);
|
|
98951
|
+
let offset = 0;
|
|
98952
|
+
for (let i2 = 0;i2 < chunks.length; ++i2) {
|
|
98953
|
+
combined.set(chunks[i2], offset);
|
|
98954
|
+
offset += chunks[i2].length;
|
|
98955
|
+
}
|
|
98956
|
+
return combined;
|
|
98957
|
+
}
|
|
98958
|
+
const bytes = readByteString();
|
|
98959
|
+
chunks.push(bytes);
|
|
98960
|
+
totalLen += bytes.length;
|
|
98961
|
+
}
|
|
98962
|
+
throw new Error("expected break marker.");
|
|
98963
|
+
}
|
|
98964
|
+
function readListIndefinite(ns) {
|
|
98965
|
+
pos += 1;
|
|
98966
|
+
const memberSchema = ns.isListSchema() ? ns.getValueSchema() : ns;
|
|
98967
|
+
const list = [];
|
|
98968
|
+
while (pos < end) {
|
|
98969
|
+
if (payload[pos] === 255) {
|
|
98970
|
+
pos += 1;
|
|
98971
|
+
return list;
|
|
98972
|
+
}
|
|
98973
|
+
list.push(readValue(memberSchema));
|
|
98974
|
+
}
|
|
98975
|
+
throw new Error("expected break marker.");
|
|
98976
|
+
}
|
|
98977
|
+
function readMapIndefinite(ns) {
|
|
98978
|
+
pos += 1;
|
|
98979
|
+
if (ns.isStructSchema()) {
|
|
98980
|
+
const cache = loadCborStructIterator(ns);
|
|
98981
|
+
const { memberSchemas, encodedKeys, memberNames } = cache;
|
|
98982
|
+
const z3 = encodedKeys.length;
|
|
98983
|
+
const isUnion = ns.isUnionSchema();
|
|
98984
|
+
const result = {};
|
|
98985
|
+
let unknownKey;
|
|
98986
|
+
let unknownValue;
|
|
98987
|
+
let unknownCount = 0;
|
|
98988
|
+
let hint = 0;
|
|
98989
|
+
while (pos < end) {
|
|
98990
|
+
if (payload[pos] === 255) {
|
|
98991
|
+
pos += 1;
|
|
98992
|
+
if (isUnion) {
|
|
98993
|
+
let resultEmpty = true;
|
|
98994
|
+
for (const _ in result) {
|
|
98995
|
+
resultEmpty = false;
|
|
98996
|
+
break;
|
|
98997
|
+
}
|
|
98998
|
+
if (resultEmpty && unknownCount === 1) {
|
|
98999
|
+
result.$unknown = [unknownKey, unknownValue];
|
|
99000
|
+
}
|
|
99001
|
+
}
|
|
99002
|
+
return result;
|
|
99003
|
+
}
|
|
99004
|
+
const matchIdx = matchStructKey(encodedKeys, z3, hint);
|
|
99005
|
+
if (matchIdx >= 0) {
|
|
99006
|
+
hint = matchIdx + 1;
|
|
99007
|
+
if (hint >= z3) {
|
|
99008
|
+
hint = 0;
|
|
99009
|
+
}
|
|
99010
|
+
const val = readValue(memberSchemas[matchIdx]);
|
|
99011
|
+
if (val != null) {
|
|
99012
|
+
result[memberNames[matchIdx]] = val;
|
|
99013
|
+
}
|
|
99014
|
+
} else {
|
|
99015
|
+
const key = readUtf8String();
|
|
99016
|
+
const val = readValue(NormalizedSchema.of(15));
|
|
99017
|
+
if (key !== "__type") {
|
|
99018
|
+
unknownKey = key;
|
|
99019
|
+
unknownValue = val;
|
|
99020
|
+
++unknownCount;
|
|
99021
|
+
}
|
|
99022
|
+
}
|
|
99023
|
+
}
|
|
99024
|
+
throw new Error("expected break marker.");
|
|
99025
|
+
}
|
|
99026
|
+
const valueSchema = ns.isMapSchema() ? ns.getValueSchema() : ns;
|
|
99027
|
+
const map2 = {};
|
|
99028
|
+
while (pos < end) {
|
|
99029
|
+
if (payload[pos] === 255) {
|
|
99030
|
+
pos += 1;
|
|
99031
|
+
return map2;
|
|
99032
|
+
}
|
|
99033
|
+
const key = readUtf8String();
|
|
99034
|
+
map2[key] = readValue(valueSchema);
|
|
99035
|
+
}
|
|
99036
|
+
throw new Error("expected break marker.");
|
|
99037
|
+
}
|
|
99038
|
+
function matchStructKey(encodedKeys, z3, hint) {
|
|
99039
|
+
const hintKey = encodedKeys[hint];
|
|
99040
|
+
if (pos + hintKey.length <= end && bytesMatch(pos, hintKey)) {
|
|
99041
|
+
pos += hintKey.length;
|
|
99042
|
+
return hint;
|
|
99043
|
+
}
|
|
99044
|
+
for (let i2 = 0;i2 < z3; ++i2) {
|
|
99045
|
+
if (i2 === hint) {
|
|
99046
|
+
continue;
|
|
99047
|
+
}
|
|
99048
|
+
const ek = encodedKeys[i2];
|
|
99049
|
+
if (pos + ek.length <= end && bytesMatch(pos, ek)) {
|
|
99050
|
+
pos += ek.length;
|
|
99051
|
+
return i2;
|
|
99052
|
+
}
|
|
99053
|
+
}
|
|
99054
|
+
return -1;
|
|
99055
|
+
}
|
|
99056
|
+
function bytesMatch(at, expected) {
|
|
99057
|
+
const len = expected.length;
|
|
99058
|
+
if (payload[at] !== expected[0]) {
|
|
99059
|
+
return false;
|
|
99060
|
+
}
|
|
99061
|
+
for (let i2 = 1;i2 < len; ++i2) {
|
|
99062
|
+
if (payload[at + i2] !== expected[i2]) {
|
|
99063
|
+
return false;
|
|
99064
|
+
}
|
|
99065
|
+
}
|
|
99066
|
+
return true;
|
|
99067
|
+
}
|
|
99068
|
+
function decodeArgument() {
|
|
99069
|
+
const minor = payload[pos] & 31;
|
|
99070
|
+
if (minor < 24) {
|
|
99071
|
+
pos += 1;
|
|
99072
|
+
return minor;
|
|
99073
|
+
}
|
|
99074
|
+
switch (minor) {
|
|
99075
|
+
case extendedOneByte:
|
|
99076
|
+
if (end - pos < 2) {
|
|
99077
|
+
overflow(1);
|
|
99078
|
+
}
|
|
99079
|
+
pos += 2;
|
|
99080
|
+
return payload[pos - 1];
|
|
99081
|
+
case extendedFloat16:
|
|
99082
|
+
if (end - pos < 3) {
|
|
99083
|
+
overflow(2);
|
|
99084
|
+
}
|
|
99085
|
+
pos += 3;
|
|
99086
|
+
return dataView.getUint16(pos - 2);
|
|
99087
|
+
case extendedFloat32:
|
|
99088
|
+
if (end - pos < 5) {
|
|
99089
|
+
overflow(4);
|
|
99090
|
+
}
|
|
99091
|
+
pos += 5;
|
|
99092
|
+
return dataView.getUint32(pos - 4);
|
|
99093
|
+
case extendedFloat64: {
|
|
99094
|
+
if (end - pos < 9) {
|
|
99095
|
+
overflow(8);
|
|
99096
|
+
}
|
|
99097
|
+
pos += 9;
|
|
99098
|
+
const hi = dataView.getUint32(pos - 8);
|
|
99099
|
+
if (hi < 2097152) {
|
|
99100
|
+
return hi * 4294967296 + dataView.getUint32(pos - 4);
|
|
99101
|
+
}
|
|
99102
|
+
return dataView.getBigUint64(pos - 8);
|
|
99103
|
+
}
|
|
99104
|
+
default:
|
|
99105
|
+
throw new Error(`unexpected minor value ${minor}.`);
|
|
99106
|
+
}
|
|
99107
|
+
}
|
|
99108
|
+
function decodeCount() {
|
|
99109
|
+
const val = decodeArgument();
|
|
99110
|
+
return typeof val === "bigint" ? Number(val) : val;
|
|
99111
|
+
}
|
|
99112
|
+
function readUnsignedInt() {
|
|
99113
|
+
const val = decodeArgument();
|
|
99114
|
+
return castBigInt(val);
|
|
99115
|
+
}
|
|
99116
|
+
function readNegativeInt() {
|
|
99117
|
+
const val = decodeArgument();
|
|
99118
|
+
if (typeof val === "bigint") {
|
|
99119
|
+
return BigInt(-1) - val;
|
|
99120
|
+
}
|
|
99121
|
+
return -1 - val;
|
|
99122
|
+
}
|
|
99123
|
+
function readByteString() {
|
|
99124
|
+
const length = decodeCount();
|
|
99125
|
+
if (end - pos < length) {
|
|
99126
|
+
overflow(length);
|
|
99127
|
+
}
|
|
99128
|
+
const start = pos;
|
|
99129
|
+
pos += length;
|
|
99130
|
+
return payload.subarray(start, start + length);
|
|
99131
|
+
}
|
|
99132
|
+
function readUtf8String() {
|
|
99133
|
+
const length = decodeCount();
|
|
99134
|
+
if (end - pos < length) {
|
|
99135
|
+
overflow(length);
|
|
99136
|
+
}
|
|
99137
|
+
const start = pos;
|
|
99138
|
+
pos += length;
|
|
99139
|
+
if (length < 24) {
|
|
99140
|
+
return decodeUtf8Cached(start, length);
|
|
99141
|
+
}
|
|
99142
|
+
if (isBuffer3) {
|
|
99143
|
+
return payload.toString("utf-8", start, start + length);
|
|
99144
|
+
}
|
|
99145
|
+
return textDecoder2.decode(payload.subarray(start, start + length));
|
|
99146
|
+
}
|
|
99147
|
+
function decodeUtf8Cached(at, length) {
|
|
99148
|
+
let h2 = length;
|
|
99149
|
+
for (let i2 = 0;i2 < length; ++i2) {
|
|
99150
|
+
h2 = h2 * 31 + payload[at + i2] | 0;
|
|
99151
|
+
}
|
|
99152
|
+
const slot = h2 >>> 0 & STRING_CACHE_SIZE - 1;
|
|
99153
|
+
const cached2 = stringCache[slot];
|
|
99154
|
+
if (cached2 !== undefined && cached2.length === length) {
|
|
99155
|
+
let match = true;
|
|
99156
|
+
for (let i2 = 0;i2 < length; ++i2) {
|
|
99157
|
+
if (cached2.charCodeAt(i2) !== payload[at + i2]) {
|
|
99158
|
+
match = false;
|
|
99159
|
+
break;
|
|
99160
|
+
}
|
|
99161
|
+
}
|
|
99162
|
+
if (match) {
|
|
99163
|
+
stringCacheEpochs[slot] = cacheEpoch;
|
|
99164
|
+
return cached2;
|
|
99165
|
+
}
|
|
99166
|
+
}
|
|
99167
|
+
const result = isBuffer3 ? payload.toString("utf-8", at, at + length) : textDecoder2.decode(payload.subarray(at, at + length));
|
|
99168
|
+
if (stringCacheEpochs[slot] !== cacheEpoch) {
|
|
99169
|
+
stringCache[slot] = result;
|
|
99170
|
+
stringCacheEpochs[slot] = cacheEpoch;
|
|
99171
|
+
}
|
|
99172
|
+
return result;
|
|
99173
|
+
}
|
|
99174
|
+
function readSpecial() {
|
|
99175
|
+
const p = pos;
|
|
99176
|
+
const minor = payload[p] & 31;
|
|
99177
|
+
switch (minor) {
|
|
99178
|
+
case specialTrue:
|
|
99179
|
+
pos = p + 1;
|
|
99180
|
+
return true;
|
|
99181
|
+
case specialFalse:
|
|
99182
|
+
pos = p + 1;
|
|
99183
|
+
return false;
|
|
99184
|
+
case specialNull:
|
|
99185
|
+
pos = p + 1;
|
|
99186
|
+
return null;
|
|
99187
|
+
case specialUndefined:
|
|
99188
|
+
pos = p + 1;
|
|
99189
|
+
return null;
|
|
99190
|
+
case extendedFloat16: {
|
|
99191
|
+
if (end - p < 3) {
|
|
99192
|
+
overflow(2);
|
|
99193
|
+
}
|
|
99194
|
+
pos = p + 3;
|
|
99195
|
+
return bytesToFloat16(payload[p + 1], payload[p + 2]);
|
|
99196
|
+
}
|
|
99197
|
+
case extendedFloat32: {
|
|
99198
|
+
if (end - p < 5) {
|
|
99199
|
+
overflow(4);
|
|
99200
|
+
}
|
|
99201
|
+
pos = p + 5;
|
|
99202
|
+
return dataView.getFloat32(p + 1);
|
|
99203
|
+
}
|
|
99204
|
+
case extendedFloat64: {
|
|
99205
|
+
if (end - p < 9) {
|
|
99206
|
+
overflow(8);
|
|
99207
|
+
}
|
|
99208
|
+
pos = p + 9;
|
|
99209
|
+
return dataView.getFloat64(p + 1);
|
|
99210
|
+
}
|
|
99211
|
+
default:
|
|
99212
|
+
throw new Error(`unexpected minor value ${minor} for major 7.`);
|
|
99213
|
+
}
|
|
99214
|
+
}
|
|
99215
|
+
function bytesToFloat16(a2, b) {
|
|
99216
|
+
const sign = a2 >> 7;
|
|
99217
|
+
const exponent = (a2 & 124) >> 2;
|
|
99218
|
+
const fraction = (a2 & 3) << 8 | b;
|
|
99219
|
+
const scalar = sign === 0 ? 1 : -1;
|
|
99220
|
+
if (exponent === 0) {
|
|
99221
|
+
if (fraction === 0) {
|
|
99222
|
+
return 0;
|
|
99223
|
+
}
|
|
99224
|
+
return scalar * (Math.pow(2, 1 - 15) * (fraction / 1024));
|
|
99225
|
+
} else if (exponent === 31) {
|
|
99226
|
+
if (fraction === 0) {
|
|
99227
|
+
return scalar * Infinity;
|
|
99228
|
+
}
|
|
99229
|
+
return NaN;
|
|
99230
|
+
}
|
|
99231
|
+
return scalar * (Math.pow(2, exponent - 15) * (1 + fraction / 1024));
|
|
99232
|
+
}
|
|
99233
|
+
function castBigInt(value) {
|
|
99234
|
+
if (typeof value === "number") {
|
|
99235
|
+
return value;
|
|
99236
|
+
}
|
|
99237
|
+
const num = Number(value);
|
|
99238
|
+
if (Number.MIN_SAFE_INTEGER <= num && num <= Number.MAX_SAFE_INTEGER) {
|
|
99239
|
+
return num;
|
|
99240
|
+
}
|
|
99241
|
+
return value;
|
|
99242
|
+
}
|
|
99243
|
+
function overflow(n2) {
|
|
99244
|
+
throw new Error(`CBOR: length ${n2} greater than remaining buffer length.`);
|
|
99245
|
+
}
|
|
99246
|
+
function transformObject(ns, value) {
|
|
99247
|
+
if (ns.isTimestampSchema()) {
|
|
99248
|
+
if (typeof value === "number") {
|
|
99249
|
+
return _parseEpochTimestamp(value);
|
|
99250
|
+
}
|
|
99251
|
+
if (typeof value === "object" && value !== null) {
|
|
99252
|
+
if (value.tag === 1 && "value" in value) {
|
|
99253
|
+
return _parseEpochTimestamp(value.value);
|
|
99254
|
+
}
|
|
99255
|
+
}
|
|
99256
|
+
}
|
|
99257
|
+
if (ns.isBlobSchema()) {
|
|
99258
|
+
return value;
|
|
99259
|
+
}
|
|
99260
|
+
if (typeof value === "undefined" || typeof value === "boolean" || typeof value === "number" || typeof value === "string" || typeof value === "bigint" || typeof value === "symbol") {
|
|
99261
|
+
return value;
|
|
99262
|
+
}
|
|
99263
|
+
if (typeof value !== "object" || value === null) {
|
|
99264
|
+
return value;
|
|
99265
|
+
}
|
|
99266
|
+
if ("byteLength" in value) {
|
|
99267
|
+
return value;
|
|
99268
|
+
}
|
|
99269
|
+
if (value instanceof Date) {
|
|
99270
|
+
return value;
|
|
99271
|
+
}
|
|
99272
|
+
if (value instanceof NumericValue) {
|
|
99273
|
+
return value;
|
|
99274
|
+
}
|
|
99275
|
+
if (ns.isDocumentSchema()) {
|
|
99276
|
+
return value;
|
|
99277
|
+
}
|
|
99278
|
+
if (ns.isListSchema()) {
|
|
99279
|
+
const memberSchema = ns.getValueSchema();
|
|
99280
|
+
const out = [];
|
|
99281
|
+
for (const item of value) {
|
|
99282
|
+
out.push(transformObject(memberSchema, item));
|
|
99283
|
+
}
|
|
99284
|
+
return out;
|
|
99285
|
+
}
|
|
99286
|
+
const newObject = {};
|
|
99287
|
+
if (ns.isMapSchema()) {
|
|
99288
|
+
const targetSchema = ns.getValueSchema();
|
|
99289
|
+
for (const key in value) {
|
|
99290
|
+
newObject[key] = transformObject(targetSchema, value[key]);
|
|
99291
|
+
}
|
|
99292
|
+
} else if (ns.isStructSchema()) {
|
|
99293
|
+
const isUnion = ns.isUnionSchema();
|
|
99294
|
+
let keys2;
|
|
99295
|
+
if (isUnion) {
|
|
99296
|
+
keys2 = new Set;
|
|
99297
|
+
for (const k in value) {
|
|
99298
|
+
if (k !== "__type") {
|
|
99299
|
+
keys2.add(k);
|
|
99300
|
+
}
|
|
99301
|
+
}
|
|
99302
|
+
}
|
|
99303
|
+
for (const [key, memberSchema] of ns.structIterator()) {
|
|
99304
|
+
if (isUnion) {
|
|
99305
|
+
keys2.delete(key);
|
|
99306
|
+
}
|
|
99307
|
+
if (value[key] != null) {
|
|
99308
|
+
newObject[key] = transformObject(memberSchema, value[key]);
|
|
99309
|
+
}
|
|
99310
|
+
}
|
|
99311
|
+
if (isUnion && keys2?.size === 1) {
|
|
99312
|
+
let newObjectEmpty = true;
|
|
99313
|
+
for (const _ in newObject) {
|
|
99314
|
+
newObjectEmpty = false;
|
|
99315
|
+
break;
|
|
99316
|
+
}
|
|
99317
|
+
if (newObjectEmpty) {
|
|
99318
|
+
const k = keys2.values().next().value;
|
|
99319
|
+
newObject.$unknown = [k, value[k]];
|
|
99320
|
+
}
|
|
99321
|
+
} else if (typeof value.__type === "string") {
|
|
99322
|
+
for (const k in value) {
|
|
99323
|
+
if (!(k in newObject)) {
|
|
99324
|
+
newObject[k] = value[k];
|
|
99325
|
+
}
|
|
99326
|
+
}
|
|
99327
|
+
}
|
|
99328
|
+
}
|
|
99329
|
+
return newObject;
|
|
99330
|
+
}
|
|
99331
|
+
|
|
99332
|
+
class CborCodec extends SerdeContext {
|
|
99333
|
+
createSerializer() {
|
|
99334
|
+
const serializer = new CborShapeSerializer2;
|
|
99335
|
+
serializer.setSerdeContext(this.serdeContext);
|
|
99336
|
+
return serializer;
|
|
99337
|
+
}
|
|
99338
|
+
createDeserializer() {
|
|
99339
|
+
const deserializer = new CborShapeDeserializer2;
|
|
99340
|
+
deserializer.setSerdeContext(this.serdeContext);
|
|
99341
|
+
return deserializer;
|
|
99342
|
+
}
|
|
99343
|
+
}
|
|
99344
|
+
|
|
99345
|
+
class SmithyRpcV2CborProtocol extends RpcProtocol {
|
|
99346
|
+
codec = new CborCodec;
|
|
99347
|
+
serializer = this.codec.createSerializer();
|
|
99348
|
+
deserializer = this.codec.createDeserializer();
|
|
99349
|
+
constructor({ defaultNamespace, errorTypeRegistries }) {
|
|
99350
|
+
super({ defaultNamespace, errorTypeRegistries });
|
|
99351
|
+
}
|
|
99352
|
+
getShapeId() {
|
|
99353
|
+
return "smithy.protocols#rpcv2Cbor";
|
|
99354
|
+
}
|
|
99355
|
+
getPayloadCodec() {
|
|
99356
|
+
return this.codec;
|
|
99357
|
+
}
|
|
99358
|
+
async serializeRequest(operationSchema, input, context) {
|
|
99359
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
99360
|
+
Object.assign(request.headers, {
|
|
99361
|
+
"content-type": this.getDefaultContentType(),
|
|
99362
|
+
"smithy-protocol": "rpc-v2-cbor",
|
|
99363
|
+
accept: this.getDefaultContentType()
|
|
99364
|
+
});
|
|
99365
|
+
if (deref(operationSchema.input) === "unit") {
|
|
99366
|
+
delete request.body;
|
|
99367
|
+
delete request.headers["content-type"];
|
|
99368
|
+
} else {
|
|
99369
|
+
if (!request.body) {
|
|
99370
|
+
this.serializer.write(15, {});
|
|
99371
|
+
request.body = this.serializer.flush();
|
|
99372
|
+
}
|
|
99373
|
+
try {
|
|
99374
|
+
request.headers["content-length"] = String(request.body.byteLength);
|
|
99375
|
+
} catch (ignored) {}
|
|
99376
|
+
}
|
|
99377
|
+
const { service, operation } = getSmithyContext(context);
|
|
99378
|
+
const path12 = `/service/${service}/operation/${operation}`;
|
|
99379
|
+
if (request.path.endsWith("/")) {
|
|
99380
|
+
request.path += path12.slice(1);
|
|
99381
|
+
} else {
|
|
99382
|
+
request.path += path12;
|
|
99383
|
+
}
|
|
99384
|
+
return request;
|
|
99385
|
+
}
|
|
99386
|
+
async deserializeResponse(operationSchema, context, response) {
|
|
99387
|
+
return super.deserializeResponse(operationSchema, context, response);
|
|
99388
|
+
}
|
|
99389
|
+
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
99390
|
+
const errorName = loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown";
|
|
99391
|
+
const errorMetadata = {
|
|
99392
|
+
$metadata: metadata,
|
|
99393
|
+
$fault: response.statusCode <= 500 ? "client" : "server"
|
|
99394
|
+
};
|
|
99395
|
+
let namespace = this.options.defaultNamespace;
|
|
99396
|
+
if (errorName.includes("#")) {
|
|
99397
|
+
[namespace] = errorName.split("#");
|
|
99398
|
+
}
|
|
99399
|
+
const registry2 = this.compositeErrorRegistry;
|
|
99400
|
+
const nsRegistry = TypeRegistry.for(namespace);
|
|
99401
|
+
registry2.copyFrom(nsRegistry);
|
|
99402
|
+
let errorSchema;
|
|
99403
|
+
try {
|
|
99404
|
+
errorSchema = registry2.getSchema(errorName);
|
|
99405
|
+
} catch (ignored) {
|
|
99406
|
+
if (dataObject.Message) {
|
|
99407
|
+
dataObject.message = dataObject.Message;
|
|
99408
|
+
}
|
|
99409
|
+
const syntheticRegistry = TypeRegistry.for("smithy.ts.sdk.synthetic." + namespace);
|
|
99410
|
+
registry2.copyFrom(syntheticRegistry);
|
|
99411
|
+
const baseExceptionSchema = registry2.getBaseException();
|
|
99412
|
+
if (baseExceptionSchema) {
|
|
99413
|
+
const ErrorCtor2 = registry2.getErrorCtor(baseExceptionSchema);
|
|
99414
|
+
throw Object.assign(new ErrorCtor2({ name: errorName }), errorMetadata, dataObject);
|
|
99415
|
+
}
|
|
99416
|
+
throw Object.assign(new Error(errorName), errorMetadata, dataObject);
|
|
99417
|
+
}
|
|
99418
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
99419
|
+
const ErrorCtor = registry2.getErrorCtor(errorSchema);
|
|
99420
|
+
const message = dataObject.message ?? dataObject.Message ?? "Unknown";
|
|
99421
|
+
const exception = new ErrorCtor({});
|
|
99422
|
+
const output = {};
|
|
99423
|
+
for (const [name, member] of ns.structIterator()) {
|
|
99424
|
+
output[name] = this.deserializer.readValue(member, dataObject[name]);
|
|
99425
|
+
}
|
|
99426
|
+
throw Object.assign(exception, errorMetadata, {
|
|
99427
|
+
$fault: ns.getMergedTraits().error,
|
|
99428
|
+
message
|
|
99429
|
+
}, output);
|
|
99430
|
+
}
|
|
99431
|
+
getDefaultContentType() {
|
|
99432
|
+
return "application/cbor";
|
|
99433
|
+
}
|
|
99434
|
+
}
|
|
99435
|
+
|
|
98167
99436
|
class CborShapeSerializer extends SerdeContext {
|
|
98168
99437
|
value;
|
|
98169
99438
|
write(schema, value) {
|
|
@@ -98234,6 +99503,14 @@ var require_cbor = __commonJS((exports) => {
|
|
|
98234
99503
|
}
|
|
98235
99504
|
}
|
|
98236
99505
|
} else if (ns.isDocumentSchema()) {
|
|
99506
|
+
if (Array.isArray(sourceObject)) {
|
|
99507
|
+
const newArray = [];
|
|
99508
|
+
let i2 = 0;
|
|
99509
|
+
for (const item of sourceObject) {
|
|
99510
|
+
newArray[i2++] = this.serialize(ns.getValueSchema(), item);
|
|
99511
|
+
}
|
|
99512
|
+
return newArray;
|
|
99513
|
+
}
|
|
98237
99514
|
for (const key in sourceObject) {
|
|
98238
99515
|
newObject[key] = this.serialize(ns.getValueSchema(), sourceObject[key]);
|
|
98239
99516
|
}
|
|
@@ -98350,113 +99627,11 @@ var require_cbor = __commonJS((exports) => {
|
|
|
98350
99627
|
}
|
|
98351
99628
|
}
|
|
98352
99629
|
}
|
|
98353
|
-
|
|
98354
|
-
class CborCodec extends SerdeContext {
|
|
98355
|
-
createSerializer() {
|
|
98356
|
-
const serializer = new CborShapeSerializer;
|
|
98357
|
-
serializer.setSerdeContext(this.serdeContext);
|
|
98358
|
-
return serializer;
|
|
98359
|
-
}
|
|
98360
|
-
createDeserializer() {
|
|
98361
|
-
const deserializer = new CborShapeDeserializer;
|
|
98362
|
-
deserializer.setSerdeContext(this.serdeContext);
|
|
98363
|
-
return deserializer;
|
|
98364
|
-
}
|
|
98365
|
-
}
|
|
98366
|
-
|
|
98367
|
-
class SmithyRpcV2CborProtocol extends RpcProtocol {
|
|
98368
|
-
codec = new CborCodec;
|
|
98369
|
-
serializer = this.codec.createSerializer();
|
|
98370
|
-
deserializer = this.codec.createDeserializer();
|
|
98371
|
-
constructor({ defaultNamespace, errorTypeRegistries }) {
|
|
98372
|
-
super({ defaultNamespace, errorTypeRegistries });
|
|
98373
|
-
}
|
|
98374
|
-
getShapeId() {
|
|
98375
|
-
return "smithy.protocols#rpcv2Cbor";
|
|
98376
|
-
}
|
|
98377
|
-
getPayloadCodec() {
|
|
98378
|
-
return this.codec;
|
|
98379
|
-
}
|
|
98380
|
-
async serializeRequest(operationSchema, input, context) {
|
|
98381
|
-
const request = await super.serializeRequest(operationSchema, input, context);
|
|
98382
|
-
Object.assign(request.headers, {
|
|
98383
|
-
"content-type": this.getDefaultContentType(),
|
|
98384
|
-
"smithy-protocol": "rpc-v2-cbor",
|
|
98385
|
-
accept: this.getDefaultContentType()
|
|
98386
|
-
});
|
|
98387
|
-
if (deref(operationSchema.input) === "unit") {
|
|
98388
|
-
delete request.body;
|
|
98389
|
-
delete request.headers["content-type"];
|
|
98390
|
-
} else {
|
|
98391
|
-
if (!request.body) {
|
|
98392
|
-
this.serializer.write(15, {});
|
|
98393
|
-
request.body = this.serializer.flush();
|
|
98394
|
-
}
|
|
98395
|
-
try {
|
|
98396
|
-
request.headers["content-length"] = String(request.body.byteLength);
|
|
98397
|
-
} catch (ignored) {}
|
|
98398
|
-
}
|
|
98399
|
-
const { service, operation } = getSmithyContext(context);
|
|
98400
|
-
const path12 = `/service/${service}/operation/${operation}`;
|
|
98401
|
-
if (request.path.endsWith("/")) {
|
|
98402
|
-
request.path += path12.slice(1);
|
|
98403
|
-
} else {
|
|
98404
|
-
request.path += path12;
|
|
98405
|
-
}
|
|
98406
|
-
return request;
|
|
98407
|
-
}
|
|
98408
|
-
async deserializeResponse(operationSchema, context, response) {
|
|
98409
|
-
return super.deserializeResponse(operationSchema, context, response);
|
|
98410
|
-
}
|
|
98411
|
-
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
98412
|
-
const errorName = loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown";
|
|
98413
|
-
const errorMetadata = {
|
|
98414
|
-
$metadata: metadata,
|
|
98415
|
-
$fault: response.statusCode <= 500 ? "client" : "server"
|
|
98416
|
-
};
|
|
98417
|
-
let namespace = this.options.defaultNamespace;
|
|
98418
|
-
if (errorName.includes("#")) {
|
|
98419
|
-
[namespace] = errorName.split("#");
|
|
98420
|
-
}
|
|
98421
|
-
const registry2 = this.compositeErrorRegistry;
|
|
98422
|
-
const nsRegistry = TypeRegistry.for(namespace);
|
|
98423
|
-
registry2.copyFrom(nsRegistry);
|
|
98424
|
-
let errorSchema;
|
|
98425
|
-
try {
|
|
98426
|
-
errorSchema = registry2.getSchema(errorName);
|
|
98427
|
-
} catch (ignored) {
|
|
98428
|
-
if (dataObject.Message) {
|
|
98429
|
-
dataObject.message = dataObject.Message;
|
|
98430
|
-
}
|
|
98431
|
-
const syntheticRegistry = TypeRegistry.for("smithy.ts.sdk.synthetic." + namespace);
|
|
98432
|
-
registry2.copyFrom(syntheticRegistry);
|
|
98433
|
-
const baseExceptionSchema = registry2.getBaseException();
|
|
98434
|
-
if (baseExceptionSchema) {
|
|
98435
|
-
const ErrorCtor2 = registry2.getErrorCtor(baseExceptionSchema);
|
|
98436
|
-
throw Object.assign(new ErrorCtor2({ name: errorName }), errorMetadata, dataObject);
|
|
98437
|
-
}
|
|
98438
|
-
throw Object.assign(new Error(errorName), errorMetadata, dataObject);
|
|
98439
|
-
}
|
|
98440
|
-
const ns = NormalizedSchema.of(errorSchema);
|
|
98441
|
-
const ErrorCtor = registry2.getErrorCtor(errorSchema);
|
|
98442
|
-
const message = dataObject.message ?? dataObject.Message ?? "Unknown";
|
|
98443
|
-
const exception = new ErrorCtor({});
|
|
98444
|
-
const output = {};
|
|
98445
|
-
for (const [name, member] of ns.structIterator()) {
|
|
98446
|
-
output[name] = this.deserializer.readValue(member, dataObject[name]);
|
|
98447
|
-
}
|
|
98448
|
-
throw Object.assign(exception, errorMetadata, {
|
|
98449
|
-
$fault: ns.getMergedTraits().error,
|
|
98450
|
-
message
|
|
98451
|
-
}, output);
|
|
98452
|
-
}
|
|
98453
|
-
getDefaultContentType() {
|
|
98454
|
-
return "application/cbor";
|
|
98455
|
-
}
|
|
98456
|
-
}
|
|
98457
99630
|
exports.CborCodec = CborCodec;
|
|
98458
99631
|
exports.CborShapeDeserializer = CborShapeDeserializer;
|
|
99632
|
+
exports.CborShapeDeserializer2 = CborShapeDeserializer2;
|
|
98459
99633
|
exports.CborShapeSerializer = CborShapeSerializer;
|
|
99634
|
+
exports.CborShapeSerializer2 = CborShapeSerializer2;
|
|
98460
99635
|
exports.SmithyRpcV2CborProtocol = SmithyRpcV2CborProtocol;
|
|
98461
99636
|
exports.buildHttpRpcRequest = buildHttpRpcRequest;
|
|
98462
99637
|
exports.cbor = cbor;
|
|
@@ -99026,55 +100201,6 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
99026
100201
|
}, output), dataObject);
|
|
99027
100202
|
}
|
|
99028
100203
|
}
|
|
99029
|
-
var _toStr = (val) => {
|
|
99030
|
-
if (val == null) {
|
|
99031
|
-
return val;
|
|
99032
|
-
}
|
|
99033
|
-
if (typeof val === "number" || typeof val === "bigint") {
|
|
99034
|
-
const warning = new Error(`Received number ${val} where a string was expected.`);
|
|
99035
|
-
warning.name = "Warning";
|
|
99036
|
-
console.warn(warning);
|
|
99037
|
-
return String(val);
|
|
99038
|
-
}
|
|
99039
|
-
if (typeof val === "boolean") {
|
|
99040
|
-
const warning = new Error(`Received boolean ${val} where a string was expected.`);
|
|
99041
|
-
warning.name = "Warning";
|
|
99042
|
-
console.warn(warning);
|
|
99043
|
-
return String(val);
|
|
99044
|
-
}
|
|
99045
|
-
return val;
|
|
99046
|
-
};
|
|
99047
|
-
var _toBool = (val) => {
|
|
99048
|
-
if (val == null) {
|
|
99049
|
-
return val;
|
|
99050
|
-
}
|
|
99051
|
-
if (typeof val === "string") {
|
|
99052
|
-
const lowercase2 = val.toLowerCase();
|
|
99053
|
-
if (val !== "" && lowercase2 !== "false" && lowercase2 !== "true") {
|
|
99054
|
-
const warning = new Error(`Received string "${val}" where a boolean was expected.`);
|
|
99055
|
-
warning.name = "Warning";
|
|
99056
|
-
console.warn(warning);
|
|
99057
|
-
}
|
|
99058
|
-
return val !== "" && lowercase2 !== "false";
|
|
99059
|
-
}
|
|
99060
|
-
return val;
|
|
99061
|
-
};
|
|
99062
|
-
var _toNum = (val) => {
|
|
99063
|
-
if (val == null) {
|
|
99064
|
-
return val;
|
|
99065
|
-
}
|
|
99066
|
-
if (typeof val === "string") {
|
|
99067
|
-
const num = Number(val);
|
|
99068
|
-
if (num.toString() !== val) {
|
|
99069
|
-
const warning = new Error(`Received string "${val}" where a number was expected.`);
|
|
99070
|
-
warning.name = "Warning";
|
|
99071
|
-
console.warn(warning);
|
|
99072
|
-
return val;
|
|
99073
|
-
}
|
|
99074
|
-
return num;
|
|
99075
|
-
}
|
|
99076
|
-
return val;
|
|
99077
|
-
};
|
|
99078
100204
|
|
|
99079
100205
|
class SerdeContextConfig {
|
|
99080
100206
|
serdeContext;
|
|
@@ -99873,15 +100999,667 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
99873
100999
|
return "application/json";
|
|
99874
101000
|
}
|
|
99875
101001
|
}
|
|
99876
|
-
|
|
99877
|
-
|
|
99878
|
-
|
|
101002
|
+
|
|
101003
|
+
class JsonShapeDeserializer2 extends SerdeContextConfig {
|
|
101004
|
+
settings;
|
|
101005
|
+
constructor(settings) {
|
|
101006
|
+
super();
|
|
101007
|
+
this.settings = settings;
|
|
99879
101008
|
}
|
|
99880
|
-
|
|
99881
|
-
|
|
101009
|
+
async read(schema, data) {
|
|
101010
|
+
const reviver = needsReviver(schema) ? jsonReviver : undefined;
|
|
101011
|
+
let parsed;
|
|
101012
|
+
if (typeof data === "string") {
|
|
101013
|
+
parsed = JSON.parse(data, reviver);
|
|
101014
|
+
} else if (data instanceof Uint8Array && detectBufferParsing()) {
|
|
101015
|
+
const buf = Buffer.isBuffer(data) ? data : Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
101016
|
+
parsed = JSON.parse(buf, reviver);
|
|
101017
|
+
} else {
|
|
101018
|
+
parsed = await parseJsonBody(data, this.serdeContext);
|
|
101019
|
+
}
|
|
101020
|
+
return this._read(schema, parsed);
|
|
99882
101021
|
}
|
|
99883
|
-
|
|
99884
|
-
|
|
101022
|
+
readObject(schema, data) {
|
|
101023
|
+
return this._read(schema, data);
|
|
101024
|
+
}
|
|
101025
|
+
_read(schema, value) {
|
|
101026
|
+
const isObject5 = value !== null && typeof value === "object";
|
|
101027
|
+
const ns = NormalizedSchema.of(schema);
|
|
101028
|
+
if (isObject5) {
|
|
101029
|
+
if (ns.isStructSchema()) {
|
|
101030
|
+
return this._readStruct(ns, value);
|
|
101031
|
+
}
|
|
101032
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
101033
|
+
const listMember = ns.getValueSchema();
|
|
101034
|
+
for (let i2 = 0;i2 < value.length; ++i2) {
|
|
101035
|
+
value[i2] = this._read(listMember, value[i2]);
|
|
101036
|
+
}
|
|
101037
|
+
return value;
|
|
101038
|
+
}
|
|
101039
|
+
if (ns.isMapSchema()) {
|
|
101040
|
+
const mapMember = ns.getValueSchema();
|
|
101041
|
+
const map2 = value;
|
|
101042
|
+
for (const k in map2) {
|
|
101043
|
+
if (k === "__proto__") {
|
|
101044
|
+
writeKey(map2);
|
|
101045
|
+
}
|
|
101046
|
+
map2[k] = this._read(mapMember, map2[k]);
|
|
101047
|
+
}
|
|
101048
|
+
return map2;
|
|
101049
|
+
}
|
|
101050
|
+
}
|
|
101051
|
+
if (ns.isBlobSchema() && typeof value === "string") {
|
|
101052
|
+
return fromBase64(value);
|
|
101053
|
+
}
|
|
101054
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
|
101055
|
+
if (ns.isStringSchema() && typeof value === "string" && mediaType) {
|
|
101056
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
101057
|
+
if (isJson) {
|
|
101058
|
+
return LazyJsonString.from(value);
|
|
101059
|
+
}
|
|
101060
|
+
return value;
|
|
101061
|
+
}
|
|
101062
|
+
if (ns.isTimestampSchema() && value != null) {
|
|
101063
|
+
const format3 = determineTimestampFormat(ns, this.settings);
|
|
101064
|
+
switch (format3) {
|
|
101065
|
+
case 5:
|
|
101066
|
+
return parseRfc3339DateTimeWithOffset(value);
|
|
101067
|
+
case 6:
|
|
101068
|
+
return parseRfc7231DateTime(value);
|
|
101069
|
+
case 7:
|
|
101070
|
+
return parseEpochTimestamp(value);
|
|
101071
|
+
default:
|
|
101072
|
+
console.warn("Missing timestamp format, parsing value with Date constructor:", value);
|
|
101073
|
+
return new Date(value);
|
|
101074
|
+
}
|
|
101075
|
+
}
|
|
101076
|
+
if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) {
|
|
101077
|
+
return BigInt(value);
|
|
101078
|
+
}
|
|
101079
|
+
if (ns.isBigDecimalSchema() && value != null) {
|
|
101080
|
+
if (value instanceof NumericValue) {
|
|
101081
|
+
return value;
|
|
101082
|
+
}
|
|
101083
|
+
const untyped = value;
|
|
101084
|
+
if (untyped.type === "bigDecimal" && "string" in untyped) {
|
|
101085
|
+
return new NumericValue(untyped.string, untyped.type);
|
|
101086
|
+
}
|
|
101087
|
+
return new NumericValue(String(value), "bigDecimal");
|
|
101088
|
+
}
|
|
101089
|
+
if (ns.isNumericSchema() && typeof value === "string") {
|
|
101090
|
+
switch (value) {
|
|
101091
|
+
case "Infinity":
|
|
101092
|
+
return Infinity;
|
|
101093
|
+
case "-Infinity":
|
|
101094
|
+
return -Infinity;
|
|
101095
|
+
case "NaN":
|
|
101096
|
+
return NaN;
|
|
101097
|
+
}
|
|
101098
|
+
return value;
|
|
101099
|
+
}
|
|
101100
|
+
if (ns.isDocumentSchema()) {
|
|
101101
|
+
if (isObject5) {
|
|
101102
|
+
if (Array.isArray(value)) {
|
|
101103
|
+
for (let i2 = 0;i2 < value.length; ++i2) {
|
|
101104
|
+
const v = value[i2];
|
|
101105
|
+
if (!(v instanceof NumericValue)) {
|
|
101106
|
+
value[i2] = this._read(ns, v);
|
|
101107
|
+
}
|
|
101108
|
+
}
|
|
101109
|
+
} else {
|
|
101110
|
+
const doc2 = value;
|
|
101111
|
+
for (const k in doc2) {
|
|
101112
|
+
if (k === "__proto__") {
|
|
101113
|
+
writeKey(doc2);
|
|
101114
|
+
}
|
|
101115
|
+
const v = doc2[k];
|
|
101116
|
+
if (!(v instanceof NumericValue)) {
|
|
101117
|
+
doc2[k] = this._read(ns, v);
|
|
101118
|
+
}
|
|
101119
|
+
}
|
|
101120
|
+
}
|
|
101121
|
+
return value;
|
|
101122
|
+
} else {
|
|
101123
|
+
return value;
|
|
101124
|
+
}
|
|
101125
|
+
}
|
|
101126
|
+
return value;
|
|
101127
|
+
}
|
|
101128
|
+
_readStruct(ns, record2) {
|
|
101129
|
+
const union2 = ns.isUnionSchema();
|
|
101130
|
+
const out = {};
|
|
101131
|
+
let nameMap = undefined;
|
|
101132
|
+
const { jsonName } = this.settings;
|
|
101133
|
+
if (jsonName) {
|
|
101134
|
+
nameMap = {};
|
|
101135
|
+
}
|
|
101136
|
+
let unionSerde;
|
|
101137
|
+
if (union2) {
|
|
101138
|
+
unionSerde = new UnionSerde(record2, out);
|
|
101139
|
+
}
|
|
101140
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
101141
|
+
let fromKey = memberName;
|
|
101142
|
+
if (jsonName) {
|
|
101143
|
+
fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
|
|
101144
|
+
nameMap[fromKey] = memberName;
|
|
101145
|
+
}
|
|
101146
|
+
if (union2) {
|
|
101147
|
+
unionSerde.mark(fromKey);
|
|
101148
|
+
}
|
|
101149
|
+
if (record2[fromKey] != null) {
|
|
101150
|
+
out[memberName] = this._read(memberSchema, record2[fromKey]);
|
|
101151
|
+
}
|
|
101152
|
+
}
|
|
101153
|
+
if (union2) {
|
|
101154
|
+
unionSerde.writeUnknown();
|
|
101155
|
+
} else if (typeof record2.__type === "string") {
|
|
101156
|
+
for (const k in record2) {
|
|
101157
|
+
const v = record2[k];
|
|
101158
|
+
const t = jsonName ? nameMap[k] ?? k : k;
|
|
101159
|
+
if (!(t in out)) {
|
|
101160
|
+
out[t] = v;
|
|
101161
|
+
}
|
|
101162
|
+
}
|
|
101163
|
+
}
|
|
101164
|
+
return out;
|
|
101165
|
+
}
|
|
101166
|
+
}
|
|
101167
|
+
var encoder2 = new TextEncoder;
|
|
101168
|
+
var OPEN_BRACE = 123;
|
|
101169
|
+
var CLOSE_BRACE = 125;
|
|
101170
|
+
var OPEN_BRACKET = 91;
|
|
101171
|
+
var CLOSE_BRACKET = 93;
|
|
101172
|
+
var QUOTE = 34;
|
|
101173
|
+
var COLON = 58;
|
|
101174
|
+
var COMMA = 44;
|
|
101175
|
+
var BACKSLASH = 92;
|
|
101176
|
+
var TRUE = new Uint8Array([116, 114, 117, 101]);
|
|
101177
|
+
var FALSE = new Uint8Array([102, 97, 108, 115, 101]);
|
|
101178
|
+
var NULL = new Uint8Array([110, 117, 108, 108]);
|
|
101179
|
+
var ESCAPE_TABLE = new Array(128).fill(null);
|
|
101180
|
+
ESCAPE_TABLE[8] = "b";
|
|
101181
|
+
ESCAPE_TABLE[9] = "t";
|
|
101182
|
+
ESCAPE_TABLE[10] = "n";
|
|
101183
|
+
ESCAPE_TABLE[12] = "f";
|
|
101184
|
+
ESCAPE_TABLE[13] = "r";
|
|
101185
|
+
ESCAPE_TABLE[34] = '"';
|
|
101186
|
+
ESCAPE_TABLE[92] = "\\";
|
|
101187
|
+
for (let i2 = 0;i2 < 32; i2++) {
|
|
101188
|
+
if (ESCAPE_TABLE[i2] === null) {
|
|
101189
|
+
ESCAPE_TABLE[i2] = "u00" + i2.toString(16).padStart(2, "0");
|
|
101190
|
+
}
|
|
101191
|
+
}
|
|
101192
|
+
var INITIAL_BUFFER_SIZE = 2048;
|
|
101193
|
+
function alloc(size) {
|
|
101194
|
+
return typeof Buffer !== "undefined" ? Buffer.allocUnsafe(size) : new Uint8Array(size);
|
|
101195
|
+
}
|
|
101196
|
+
|
|
101197
|
+
class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
101198
|
+
settings;
|
|
101199
|
+
json;
|
|
101200
|
+
i = 0;
|
|
101201
|
+
rootSchema;
|
|
101202
|
+
rawValue;
|
|
101203
|
+
passthrough = false;
|
|
101204
|
+
constructor(settings) {
|
|
101205
|
+
super();
|
|
101206
|
+
this.settings = settings;
|
|
101207
|
+
this.json = alloc(INITIAL_BUFFER_SIZE);
|
|
101208
|
+
}
|
|
101209
|
+
write(schema, value) {
|
|
101210
|
+
this.i = 0;
|
|
101211
|
+
this.rawValue = value;
|
|
101212
|
+
this.rootSchema = NormalizedSchema.of(schema);
|
|
101213
|
+
this.passthrough = !this.rootSchema.isStructSchema() && !this.rootSchema.isDocumentSchema() && (this.rootSchema.isBlobSchema() || this.rootSchema.isStringSchema());
|
|
101214
|
+
if (!this.passthrough) {
|
|
101215
|
+
this.writeValue(this.rootSchema, value, undefined);
|
|
101216
|
+
}
|
|
101217
|
+
}
|
|
101218
|
+
writeDiscriminatedDocument(schema, value) {
|
|
101219
|
+
this.i = 0;
|
|
101220
|
+
this.rootSchema = NormalizedSchema.of(schema);
|
|
101221
|
+
const ns = this.rootSchema;
|
|
101222
|
+
if (ns.isStructSchema() && value != null && typeof value === "object") {
|
|
101223
|
+
this.ensure(2);
|
|
101224
|
+
this.json[this.i++] = OPEN_BRACE;
|
|
101225
|
+
this.writeAsciiQuoted("__type");
|
|
101226
|
+
this.json[this.i++] = COLON;
|
|
101227
|
+
this.writeAsciiQuoted(ns.getName(true) ?? "Unknown");
|
|
101228
|
+
let wroteAny = true;
|
|
101229
|
+
const { jsonName } = this.settings;
|
|
101230
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
101231
|
+
const item = value[memberName];
|
|
101232
|
+
if (item == null && !memberSchema.isIdempotencyToken()) {
|
|
101233
|
+
continue;
|
|
101234
|
+
}
|
|
101235
|
+
if (wroteAny) {
|
|
101236
|
+
this.ensure(1);
|
|
101237
|
+
this.json[this.i++] = COMMA;
|
|
101238
|
+
}
|
|
101239
|
+
const targetKey = jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
|
|
101240
|
+
this.writeAsciiQuoted(targetKey);
|
|
101241
|
+
this.json[this.i++] = COLON;
|
|
101242
|
+
this.writeValue(memberSchema, item, ns);
|
|
101243
|
+
wroteAny = true;
|
|
101244
|
+
}
|
|
101245
|
+
this.ensure(1);
|
|
101246
|
+
this.json[this.i++] = CLOSE_BRACE;
|
|
101247
|
+
} else {
|
|
101248
|
+
this.writeValue(ns, value, undefined);
|
|
101249
|
+
}
|
|
101250
|
+
}
|
|
101251
|
+
flush() {
|
|
101252
|
+
this.rootSchema = undefined;
|
|
101253
|
+
const finalPosition = this.i;
|
|
101254
|
+
this.i = 0;
|
|
101255
|
+
const raw = this.rawValue;
|
|
101256
|
+
this.rawValue = undefined;
|
|
101257
|
+
if (finalPosition === 0) {
|
|
101258
|
+
return raw;
|
|
101259
|
+
}
|
|
101260
|
+
const result = this.json.subarray(0, finalPosition);
|
|
101261
|
+
this.json = alloc(INITIAL_BUFFER_SIZE);
|
|
101262
|
+
return result;
|
|
101263
|
+
}
|
|
101264
|
+
ensure(byteCount) {
|
|
101265
|
+
const { i: i2, json: json2 } = this;
|
|
101266
|
+
if (i2 + byteCount > json2.length) {
|
|
101267
|
+
let newSize = json2.length * 2;
|
|
101268
|
+
while (newSize < i2 + byteCount) {
|
|
101269
|
+
newSize *= 2;
|
|
101270
|
+
}
|
|
101271
|
+
const next = alloc(newSize);
|
|
101272
|
+
next.set(this.json);
|
|
101273
|
+
this.json = next;
|
|
101274
|
+
}
|
|
101275
|
+
}
|
|
101276
|
+
writeAscii(s) {
|
|
101277
|
+
const z3 = s.length;
|
|
101278
|
+
this.ensure(z3);
|
|
101279
|
+
let { i: i2, json: json2 } = this;
|
|
101280
|
+
for (let j = 0;j < z3; ++j) {
|
|
101281
|
+
json2[i2] = s.charCodeAt(j);
|
|
101282
|
+
i2 += 1;
|
|
101283
|
+
}
|
|
101284
|
+
this.i = i2;
|
|
101285
|
+
}
|
|
101286
|
+
writeAsciiQuoted(s) {
|
|
101287
|
+
const z3 = s.length;
|
|
101288
|
+
this.ensure(z3 + 4);
|
|
101289
|
+
let { json: json2, i: i2 } = this;
|
|
101290
|
+
json2[i2++] = QUOTE;
|
|
101291
|
+
for (let j = 0;j < z3; ++j) {
|
|
101292
|
+
json2[i2++] = s.charCodeAt(j);
|
|
101293
|
+
}
|
|
101294
|
+
json2[i2++] = QUOTE;
|
|
101295
|
+
this.i = i2;
|
|
101296
|
+
}
|
|
101297
|
+
writeJsonString(s) {
|
|
101298
|
+
this.ensure(s.length * 2 + 2);
|
|
101299
|
+
this.json[this.i++] = QUOTE;
|
|
101300
|
+
const z3 = s.length;
|
|
101301
|
+
for (let j = 0;j < z3; ++j) {
|
|
101302
|
+
const c5 = s.charCodeAt(j);
|
|
101303
|
+
if (c5 > 34 && c5 < 92) {
|
|
101304
|
+
this.json[this.i++] = c5;
|
|
101305
|
+
} else if (c5 < 128) {
|
|
101306
|
+
const esc2 = ESCAPE_TABLE[c5];
|
|
101307
|
+
if (esc2 !== null) {
|
|
101308
|
+
this.ensure(esc2.length + 1);
|
|
101309
|
+
this.json[this.i++] = BACKSLASH;
|
|
101310
|
+
for (let k = 0;k < esc2.length; k++) {
|
|
101311
|
+
this.json[this.i++] = esc2.charCodeAt(k);
|
|
101312
|
+
}
|
|
101313
|
+
} else {
|
|
101314
|
+
this.json[this.i++] = c5;
|
|
101315
|
+
}
|
|
101316
|
+
} else if (c5 >= 55296 && c5 <= 56319) {
|
|
101317
|
+
const next = j + 1 < z3 ? s.charCodeAt(j + 1) : 0;
|
|
101318
|
+
if (next >= 56320 && next <= 57343) {
|
|
101319
|
+
this.ensure(4);
|
|
101320
|
+
const { written } = encoder2.encodeInto(s.substring(j, j + 2), this.json.subarray(this.i));
|
|
101321
|
+
this.i += written;
|
|
101322
|
+
j++;
|
|
101323
|
+
} else {
|
|
101324
|
+
this.ensure(6);
|
|
101325
|
+
this.writeUnicodeEscape(c5);
|
|
101326
|
+
}
|
|
101327
|
+
} else if (c5 >= 56320 && c5 <= 57343) {
|
|
101328
|
+
this.ensure(6);
|
|
101329
|
+
this.writeUnicodeEscape(c5);
|
|
101330
|
+
} else {
|
|
101331
|
+
let { i: i2, json: json2 } = this;
|
|
101332
|
+
if (c5 < 2048) {
|
|
101333
|
+
json2[i2++] = 192 | c5 >> 6;
|
|
101334
|
+
json2[i2++] = 128 | c5 & 63;
|
|
101335
|
+
} else {
|
|
101336
|
+
json2[i2++] = 224 | c5 >> 12;
|
|
101337
|
+
json2[i2++] = 128 | c5 >> 6 & 63;
|
|
101338
|
+
json2[i2++] = 128 | c5 & 63;
|
|
101339
|
+
}
|
|
101340
|
+
this.i = i2;
|
|
101341
|
+
}
|
|
101342
|
+
}
|
|
101343
|
+
this.json[this.i++] = QUOTE;
|
|
101344
|
+
}
|
|
101345
|
+
writeUnicodeEscape(code) {
|
|
101346
|
+
let { json: json2, i: i2 } = this;
|
|
101347
|
+
json2[i2++] = BACKSLASH;
|
|
101348
|
+
json2[i2++] = 117;
|
|
101349
|
+
const hex3 = code.toString(16).padStart(4, "0");
|
|
101350
|
+
for (let j = 0;j < 4; ++j) {
|
|
101351
|
+
json2[i2++] = hex3.charCodeAt(j);
|
|
101352
|
+
}
|
|
101353
|
+
this.i = i2;
|
|
101354
|
+
}
|
|
101355
|
+
static B64 = (() => {
|
|
101356
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
101357
|
+
const table = new Uint8Array(64);
|
|
101358
|
+
for (let i2 = 0;i2 < 64; i2++)
|
|
101359
|
+
table[i2] = chars.charCodeAt(i2);
|
|
101360
|
+
return table;
|
|
101361
|
+
})();
|
|
101362
|
+
writeBase64(data) {
|
|
101363
|
+
const b64Len = Math.ceil(data.length / 3) * 4;
|
|
101364
|
+
this.ensure(b64Len + 2);
|
|
101365
|
+
const json2 = this.json;
|
|
101366
|
+
const B64 = JsonShapeSerializer2.B64;
|
|
101367
|
+
let i2 = this.i;
|
|
101368
|
+
json2[i2++] = QUOTE;
|
|
101369
|
+
const len = data.length;
|
|
101370
|
+
const remainder = len % 3;
|
|
101371
|
+
const mainLen = len - remainder;
|
|
101372
|
+
for (let j = 0;j < mainLen; j += 3) {
|
|
101373
|
+
const a2 = data[j];
|
|
101374
|
+
const b = data[j + 1];
|
|
101375
|
+
const c5 = data[j + 2];
|
|
101376
|
+
json2[i2++] = B64[a2 >> 2];
|
|
101377
|
+
json2[i2++] = B64[(a2 & 3) << 4 | b >> 4];
|
|
101378
|
+
json2[i2++] = B64[(b & 15) << 2 | c5 >> 6];
|
|
101379
|
+
json2[i2++] = B64[c5 & 63];
|
|
101380
|
+
}
|
|
101381
|
+
if (remainder === 2) {
|
|
101382
|
+
const a2 = data[mainLen];
|
|
101383
|
+
const b = data[mainLen + 1];
|
|
101384
|
+
json2[i2++] = B64[a2 >> 2];
|
|
101385
|
+
json2[i2++] = B64[(a2 & 3) << 4 | b >> 4];
|
|
101386
|
+
json2[i2++] = B64[(b & 15) << 2];
|
|
101387
|
+
json2[i2++] = 61;
|
|
101388
|
+
} else if (remainder === 1) {
|
|
101389
|
+
const a2 = data[mainLen];
|
|
101390
|
+
json2[i2++] = B64[a2 >> 2];
|
|
101391
|
+
json2[i2++] = B64[(a2 & 3) << 4];
|
|
101392
|
+
json2[i2++] = 61;
|
|
101393
|
+
json2[i2++] = 61;
|
|
101394
|
+
}
|
|
101395
|
+
json2[i2++] = QUOTE;
|
|
101396
|
+
this.i = i2;
|
|
101397
|
+
}
|
|
101398
|
+
writeValue(schema, value, container) {
|
|
101399
|
+
if (value == null) {
|
|
101400
|
+
if (container?.isStructSchema()) {
|
|
101401
|
+
if (value === undefined) {
|
|
101402
|
+
const ns2 = NormalizedSchema.of(schema);
|
|
101403
|
+
if (ns2.isIdempotencyToken()) {
|
|
101404
|
+
this.writeAsciiQuoted(generateIdempotencyToken());
|
|
101405
|
+
return;
|
|
101406
|
+
}
|
|
101407
|
+
}
|
|
101408
|
+
return;
|
|
101409
|
+
}
|
|
101410
|
+
this.ensure(4);
|
|
101411
|
+
this.json.set(NULL, this.i);
|
|
101412
|
+
this.i += 4;
|
|
101413
|
+
return;
|
|
101414
|
+
}
|
|
101415
|
+
const ns = NormalizedSchema.of(schema);
|
|
101416
|
+
const isObject5 = typeof value === "object";
|
|
101417
|
+
if (ns.isStringSchema()) {
|
|
101418
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
|
101419
|
+
if (mediaType) {
|
|
101420
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
101421
|
+
if (isJson) {
|
|
101422
|
+
this.writeJsonString(LazyJsonString.from(value).toString());
|
|
101423
|
+
return;
|
|
101424
|
+
}
|
|
101425
|
+
}
|
|
101426
|
+
}
|
|
101427
|
+
if (isObject5) {
|
|
101428
|
+
if (ns.isStructSchema()) {
|
|
101429
|
+
this.writeStruct(ns, value);
|
|
101430
|
+
return;
|
|
101431
|
+
}
|
|
101432
|
+
if (Array.isArray(value) && (ns.isListSchema() || ns.isDocumentSchema())) {
|
|
101433
|
+
this.writeList(ns, value, ns.isDocumentSchema());
|
|
101434
|
+
return;
|
|
101435
|
+
}
|
|
101436
|
+
if (ns.isMapSchema()) {
|
|
101437
|
+
this.writeMap(ns, value, false);
|
|
101438
|
+
return;
|
|
101439
|
+
}
|
|
101440
|
+
if (value instanceof Uint8Array && (ns.isBlobSchema() || ns.isDocumentSchema())) {
|
|
101441
|
+
this.writeBase64(value);
|
|
101442
|
+
return;
|
|
101443
|
+
}
|
|
101444
|
+
if (value instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
|
|
101445
|
+
this.writeTimestamp(ns, value);
|
|
101446
|
+
return;
|
|
101447
|
+
}
|
|
101448
|
+
if (value instanceof NumericValue) {
|
|
101449
|
+
this.writeAscii(value.string);
|
|
101450
|
+
return;
|
|
101451
|
+
}
|
|
101452
|
+
if (ns.isDocumentSchema()) {
|
|
101453
|
+
if (Array.isArray(value)) {
|
|
101454
|
+
this.writeList(ns, value, true);
|
|
101455
|
+
} else {
|
|
101456
|
+
this.writeMap(ns, value, true);
|
|
101457
|
+
}
|
|
101458
|
+
return;
|
|
101459
|
+
}
|
|
101460
|
+
const json2 = JSON.stringify(value);
|
|
101461
|
+
this.writeAscii(json2);
|
|
101462
|
+
return;
|
|
101463
|
+
}
|
|
101464
|
+
if (typeof value === "string") {
|
|
101465
|
+
if (ns.isBlobSchema()) {
|
|
101466
|
+
const b64 = (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
101467
|
+
this.writeAsciiQuoted(b64);
|
|
101468
|
+
return;
|
|
101469
|
+
}
|
|
101470
|
+
this.writeJsonString(value);
|
|
101471
|
+
return;
|
|
101472
|
+
}
|
|
101473
|
+
if (typeof value === "number") {
|
|
101474
|
+
if (ns.isNumericSchema() && (Math.abs(value) === Infinity || isNaN(value))) {
|
|
101475
|
+
this.writeAsciiQuoted(String(value));
|
|
101476
|
+
return;
|
|
101477
|
+
}
|
|
101478
|
+
const numStr = String(value);
|
|
101479
|
+
this.writeAscii(numStr);
|
|
101480
|
+
return;
|
|
101481
|
+
}
|
|
101482
|
+
if (typeof value === "boolean") {
|
|
101483
|
+
this.ensure(5);
|
|
101484
|
+
if (value) {
|
|
101485
|
+
this.json.set(TRUE, this.i);
|
|
101486
|
+
this.i += 4;
|
|
101487
|
+
} else {
|
|
101488
|
+
this.json.set(FALSE, this.i);
|
|
101489
|
+
this.i += 5;
|
|
101490
|
+
}
|
|
101491
|
+
return;
|
|
101492
|
+
}
|
|
101493
|
+
if (typeof value === "bigint") {
|
|
101494
|
+
this.writeAscii(value.toString());
|
|
101495
|
+
return;
|
|
101496
|
+
}
|
|
101497
|
+
this.writeAscii(String(value));
|
|
101498
|
+
}
|
|
101499
|
+
writeStruct(ns, value) {
|
|
101500
|
+
this.ensure(2);
|
|
101501
|
+
this.json[this.i++] = OPEN_BRACE;
|
|
101502
|
+
let first = true;
|
|
101503
|
+
let wroteAny = false;
|
|
101504
|
+
const hasType = typeof value.__type === "string";
|
|
101505
|
+
let writtenKeys;
|
|
101506
|
+
if (hasType) {
|
|
101507
|
+
writtenKeys = new Set;
|
|
101508
|
+
}
|
|
101509
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
101510
|
+
const item = value[memberName];
|
|
101511
|
+
if (item == null && !memberSchema.isIdempotencyToken())
|
|
101512
|
+
continue;
|
|
101513
|
+
if (!first) {
|
|
101514
|
+
this.ensure(1);
|
|
101515
|
+
this.json[this.i++] = COMMA;
|
|
101516
|
+
}
|
|
101517
|
+
first = false;
|
|
101518
|
+
wroteAny = true;
|
|
101519
|
+
const targetKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
|
|
101520
|
+
if (writtenKeys) {
|
|
101521
|
+
writtenKeys.add(memberName);
|
|
101522
|
+
writtenKeys.add(targetKey);
|
|
101523
|
+
}
|
|
101524
|
+
this.writeAsciiQuoted(targetKey);
|
|
101525
|
+
this.json[this.i++] = COLON;
|
|
101526
|
+
this.writeValue(memberSchema, item, ns);
|
|
101527
|
+
}
|
|
101528
|
+
if (!wroteAny && ns.isUnionSchema()) {
|
|
101529
|
+
const { $unknown } = value;
|
|
101530
|
+
if (Array.isArray($unknown)) {
|
|
101531
|
+
const [k, v] = $unknown;
|
|
101532
|
+
this.writeAsciiQuoted(k);
|
|
101533
|
+
this.ensure(1);
|
|
101534
|
+
this.json[this.i++] = COLON;
|
|
101535
|
+
this.writeValue(15, v, ns);
|
|
101536
|
+
}
|
|
101537
|
+
} else if (hasType) {
|
|
101538
|
+
for (const k in value) {
|
|
101539
|
+
const targetKey = this.settings.jsonName ? writtenKeys.has(k) ? k : k : k;
|
|
101540
|
+
if (writtenKeys.has(targetKey))
|
|
101541
|
+
continue;
|
|
101542
|
+
writtenKeys.add(targetKey);
|
|
101543
|
+
const v = value[k];
|
|
101544
|
+
if (!first) {
|
|
101545
|
+
this.ensure(1);
|
|
101546
|
+
this.json[this.i++] = COMMA;
|
|
101547
|
+
}
|
|
101548
|
+
first = false;
|
|
101549
|
+
this.writeAsciiQuoted(targetKey);
|
|
101550
|
+
this.ensure(1);
|
|
101551
|
+
this.json[this.i++] = COLON;
|
|
101552
|
+
this.writeValue(15, v, undefined);
|
|
101553
|
+
}
|
|
101554
|
+
}
|
|
101555
|
+
this.ensure(1);
|
|
101556
|
+
this.json[this.i++] = CLOSE_BRACE;
|
|
101557
|
+
}
|
|
101558
|
+
writeList(ns, value, isDocument) {
|
|
101559
|
+
this.ensure(2);
|
|
101560
|
+
this.json[this.i++] = OPEN_BRACKET;
|
|
101561
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
101562
|
+
const valueSchema = ns.getValueSchema();
|
|
101563
|
+
for (let i2 = 0;i2 < value.length; ++i2) {
|
|
101564
|
+
const item = value[i2];
|
|
101565
|
+
if (isDocument ? item === undefined : item == null && !sparse) {
|
|
101566
|
+
continue;
|
|
101567
|
+
}
|
|
101568
|
+
if (i2 !== 0) {
|
|
101569
|
+
this.ensure(1);
|
|
101570
|
+
this.json[this.i++] = COMMA;
|
|
101571
|
+
}
|
|
101572
|
+
this.writeValue(valueSchema, item, undefined);
|
|
101573
|
+
}
|
|
101574
|
+
this.ensure(1);
|
|
101575
|
+
this.json[this.i++] = CLOSE_BRACKET;
|
|
101576
|
+
}
|
|
101577
|
+
writeMap(ns, value, isDocument) {
|
|
101578
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
101579
|
+
const valueSchema = ns.getValueSchema();
|
|
101580
|
+
if (!isDocument) {
|
|
101581
|
+
if (valueSchema.isStringSchema() || valueSchema.isNumericSchema() || valueSchema.isBooleanSchema()) {
|
|
101582
|
+
let input = value;
|
|
101583
|
+
if (sparse) {
|
|
101584
|
+
input = {};
|
|
101585
|
+
for (const k in value) {
|
|
101586
|
+
if (k === "__proto__") {
|
|
101587
|
+
writeKey(input);
|
|
101588
|
+
}
|
|
101589
|
+
input[k] = value[k] ?? null;
|
|
101590
|
+
}
|
|
101591
|
+
}
|
|
101592
|
+
const json2 = JSON.stringify(input);
|
|
101593
|
+
this.ensure(json2.length * 3);
|
|
101594
|
+
const { written } = encoder2.encodeInto(json2, this.json.subarray(this.i));
|
|
101595
|
+
this.i += written;
|
|
101596
|
+
return;
|
|
101597
|
+
}
|
|
101598
|
+
}
|
|
101599
|
+
this.ensure(2);
|
|
101600
|
+
this.json[this.i++] = OPEN_BRACE;
|
|
101601
|
+
let first = true;
|
|
101602
|
+
for (const k in value) {
|
|
101603
|
+
const v = value[k];
|
|
101604
|
+
if (isDocument ? v === undefined : v == null && !sparse) {
|
|
101605
|
+
continue;
|
|
101606
|
+
}
|
|
101607
|
+
if (!first) {
|
|
101608
|
+
this.ensure(1);
|
|
101609
|
+
this.json[this.i++] = COMMA;
|
|
101610
|
+
}
|
|
101611
|
+
first = false;
|
|
101612
|
+
this.writeJsonString(k);
|
|
101613
|
+
this.ensure(1);
|
|
101614
|
+
this.json[this.i++] = COLON;
|
|
101615
|
+
this.writeValue(valueSchema, v, undefined);
|
|
101616
|
+
}
|
|
101617
|
+
this.ensure(1);
|
|
101618
|
+
this.json[this.i++] = CLOSE_BRACE;
|
|
101619
|
+
}
|
|
101620
|
+
writeTimestamp(ns, value) {
|
|
101621
|
+
const format3 = determineTimestampFormat(ns, this.settings);
|
|
101622
|
+
switch (format3) {
|
|
101623
|
+
case 5: {
|
|
101624
|
+
const iso = value.toISOString().replace(".000Z", "Z");
|
|
101625
|
+
this.writeAsciiQuoted(iso);
|
|
101626
|
+
return;
|
|
101627
|
+
}
|
|
101628
|
+
case 6: {
|
|
101629
|
+
this.writeAsciiQuoted(dateToUtcString(value));
|
|
101630
|
+
return;
|
|
101631
|
+
}
|
|
101632
|
+
case 7: {
|
|
101633
|
+
const epochSecs = String(value.getTime() / 1000);
|
|
101634
|
+
this.writeAscii(epochSecs);
|
|
101635
|
+
return;
|
|
101636
|
+
}
|
|
101637
|
+
default: {
|
|
101638
|
+
const epochSecs = String(value.getTime() / 1000);
|
|
101639
|
+
this.writeAscii(epochSecs);
|
|
101640
|
+
return;
|
|
101641
|
+
}
|
|
101642
|
+
}
|
|
101643
|
+
}
|
|
101644
|
+
}
|
|
101645
|
+
|
|
101646
|
+
class JsonCodec2 extends SerdeContextConfig {
|
|
101647
|
+
settings;
|
|
101648
|
+
constructor(settings) {
|
|
101649
|
+
super();
|
|
101650
|
+
this.settings = settings;
|
|
101651
|
+
}
|
|
101652
|
+
createSerializer() {
|
|
101653
|
+
const serializer = new JsonShapeSerializer2(this.settings);
|
|
101654
|
+
serializer.setSerdeContext(this.serdeContext);
|
|
101655
|
+
return serializer;
|
|
101656
|
+
}
|
|
101657
|
+
createDeserializer() {
|
|
101658
|
+
const deserializer = new JsonShapeDeserializer2(this.settings);
|
|
101659
|
+
deserializer.setSerdeContext(this.serdeContext);
|
|
101660
|
+
return deserializer;
|
|
101661
|
+
}
|
|
101662
|
+
}
|
|
99885
101663
|
|
|
99886
101664
|
class XmlShapeDeserializer extends SerdeContextConfig {
|
|
99887
101665
|
settings;
|
|
@@ -100759,6 +102537,64 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
100759
102537
|
return false;
|
|
100760
102538
|
}
|
|
100761
102539
|
}
|
|
102540
|
+
var awsExpectUnion = (value) => {
|
|
102541
|
+
if (value == null) {
|
|
102542
|
+
return;
|
|
102543
|
+
}
|
|
102544
|
+
if (typeof value === "object" && "__type" in value) {
|
|
102545
|
+
delete value.__type;
|
|
102546
|
+
}
|
|
102547
|
+
return expectUnion(value);
|
|
102548
|
+
};
|
|
102549
|
+
var _toStr = (val) => {
|
|
102550
|
+
if (val == null) {
|
|
102551
|
+
return val;
|
|
102552
|
+
}
|
|
102553
|
+
if (typeof val === "number" || typeof val === "bigint") {
|
|
102554
|
+
const warning = new Error(`Received number ${val} where a string was expected.`);
|
|
102555
|
+
warning.name = "Warning";
|
|
102556
|
+
console.warn(warning);
|
|
102557
|
+
return String(val);
|
|
102558
|
+
}
|
|
102559
|
+
if (typeof val === "boolean") {
|
|
102560
|
+
const warning = new Error(`Received boolean ${val} where a string was expected.`);
|
|
102561
|
+
warning.name = "Warning";
|
|
102562
|
+
console.warn(warning);
|
|
102563
|
+
return String(val);
|
|
102564
|
+
}
|
|
102565
|
+
return val;
|
|
102566
|
+
};
|
|
102567
|
+
var _toBool = (val) => {
|
|
102568
|
+
if (val == null) {
|
|
102569
|
+
return val;
|
|
102570
|
+
}
|
|
102571
|
+
if (typeof val === "string") {
|
|
102572
|
+
const lowercase2 = val.toLowerCase();
|
|
102573
|
+
if (val !== "" && lowercase2 !== "false" && lowercase2 !== "true") {
|
|
102574
|
+
const warning = new Error(`Received string "${val}" where a boolean was expected.`);
|
|
102575
|
+
warning.name = "Warning";
|
|
102576
|
+
console.warn(warning);
|
|
102577
|
+
}
|
|
102578
|
+
return val !== "" && lowercase2 !== "false";
|
|
102579
|
+
}
|
|
102580
|
+
return val;
|
|
102581
|
+
};
|
|
102582
|
+
var _toNum = (val) => {
|
|
102583
|
+
if (val == null) {
|
|
102584
|
+
return val;
|
|
102585
|
+
}
|
|
102586
|
+
if (typeof val === "string") {
|
|
102587
|
+
const num = Number(val);
|
|
102588
|
+
if (num.toString() !== val) {
|
|
102589
|
+
const warning = new Error(`Received string "${val}" where a number was expected.`);
|
|
102590
|
+
warning.name = "Warning";
|
|
102591
|
+
console.warn(warning);
|
|
102592
|
+
return val;
|
|
102593
|
+
}
|
|
102594
|
+
return num;
|
|
102595
|
+
}
|
|
102596
|
+
return val;
|
|
102597
|
+
};
|
|
100762
102598
|
exports.AwsEc2QueryProtocol = AwsEc2QueryProtocol;
|
|
100763
102599
|
exports.AwsJson1_0Protocol = AwsJson1_0Protocol;
|
|
100764
102600
|
exports.AwsJson1_1Protocol = AwsJson1_1Protocol;
|
|
@@ -100768,8 +102604,11 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
100768
102604
|
exports.AwsRestXmlProtocol = AwsRestXmlProtocol;
|
|
100769
102605
|
exports.AwsSmithyRpcV2CborProtocol = AwsSmithyRpcV2CborProtocol;
|
|
100770
102606
|
exports.JsonCodec = JsonCodec;
|
|
102607
|
+
exports.JsonCodec2 = JsonCodec2;
|
|
100771
102608
|
exports.JsonShapeDeserializer = JsonShapeDeserializer;
|
|
102609
|
+
exports.JsonShapeDeserializer2 = JsonShapeDeserializer2;
|
|
100772
102610
|
exports.JsonShapeSerializer = JsonShapeSerializer;
|
|
102611
|
+
exports.JsonShapeSerializer2 = JsonShapeSerializer2;
|
|
100773
102612
|
exports.QueryShapeSerializer = QueryShapeSerializer;
|
|
100774
102613
|
exports.XmlCodec = XmlCodec;
|
|
100775
102614
|
exports.XmlShapeDeserializer = XmlShapeDeserializer;
|
|
@@ -100865,7 +102704,7 @@ var require_sso_oidc = __commonJS((exports) => {
|
|
|
100865
102704
|
Region: { type: "builtInParams", name: "region" },
|
|
100866
102705
|
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
|
|
100867
102706
|
};
|
|
100868
|
-
var version2 = "3.997.
|
|
102707
|
+
var version2 = "3.997.37";
|
|
100869
102708
|
var packageInfo = {
|
|
100870
102709
|
version: version2
|
|
100871
102710
|
};
|
|
@@ -101762,7 +103601,7 @@ var require_sso = __commonJS((exports) => {
|
|
|
101762
103601
|
Region: { type: "builtInParams", name: "region" },
|
|
101763
103602
|
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
|
|
101764
103603
|
};
|
|
101765
|
-
var version2 = "3.997.
|
|
103604
|
+
var version2 = "3.997.37";
|
|
101766
103605
|
var packageInfo = {
|
|
101767
103606
|
version: version2
|
|
101768
103607
|
};
|
|
@@ -102856,7 +104695,7 @@ var require_sts = __commonJS((exports) => {
|
|
|
102856
104695
|
Region: { type: "builtInParams", name: "region" },
|
|
102857
104696
|
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
|
|
102858
104697
|
};
|
|
102859
|
-
var version2 = "3.997.
|
|
104698
|
+
var version2 = "3.997.37";
|
|
102860
104699
|
var packageInfo = {
|
|
102861
104700
|
version: version2
|
|
102862
104701
|
};
|
|
@@ -103625,7 +105464,7 @@ var require_signin = __commonJS((exports) => {
|
|
|
103625
105464
|
Region: { type: "builtInParams", name: "region" },
|
|
103626
105465
|
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
|
|
103627
105466
|
};
|
|
103628
|
-
var version2 = "3.997.
|
|
105467
|
+
var version2 = "3.997.37";
|
|
103629
105468
|
var packageInfo = {
|
|
103630
105469
|
version: version2
|
|
103631
105470
|
};
|
|
@@ -117990,7 +119829,7 @@ var package_default;
|
|
|
117990
119829
|
var init_package = __esm(() => {
|
|
117991
119830
|
package_default = {
|
|
117992
119831
|
name: "@funnycode/myclaude",
|
|
117993
|
-
version: "0.1.
|
|
119832
|
+
version: "0.1.159",
|
|
117994
119833
|
private: false,
|
|
117995
119834
|
description: "An open-source AI coding assistant in your terminal - powered by Claude",
|
|
117996
119835
|
license: "MIT",
|
|
@@ -564530,9 +566369,9 @@ function migrateEnableAllProjectMcpServersToSettings() {
|
|
|
564530
566369
|
const originalProjectConfig = { ...projectConfig };
|
|
564531
566370
|
const originalSettingsKeys = new Set(Object.keys(originalSettings));
|
|
564532
566371
|
const fieldsToRemove = [];
|
|
566372
|
+
const updates = {};
|
|
564533
566373
|
try {
|
|
564534
566374
|
const existingSettings = originalSettings;
|
|
564535
|
-
const updates = {};
|
|
564536
566375
|
if (hasEnableAll) {
|
|
564537
566376
|
updates.enableAllProjectMcpServers = projectConfig.enableAllProjectMcpServers;
|
|
564538
566377
|
fieldsToRemove.push("enableAllProjectMcpServers");
|
|
@@ -564580,12 +566419,12 @@ function migrateEnableAllProjectMcpServersToSettings() {
|
|
|
564580
566419
|
}
|
|
564581
566420
|
const existingHadEnabledServers = Array.isArray(existingSettings.enabledMcpjsonServers);
|
|
564582
566421
|
const existingHadDisabledServers = Array.isArray(existingSettings.disabledMcpjsonServers);
|
|
564583
|
-
const
|
|
564584
|
-
const
|
|
564585
|
-
if (existingHadEnabledServers ||
|
|
566422
|
+
const hasEnabledServersArray = hasEnabledServers && Array.isArray(projectConfig.enabledMcpjsonServers);
|
|
566423
|
+
const hasDisabledServersArray = hasDisabledServers && Array.isArray(projectConfig.disabledMcpjsonServers);
|
|
566424
|
+
if (existingHadEnabledServers || hasEnabledServersArray) {
|
|
564586
566425
|
updates.enabledMcpjsonServers = existingEnabledServers;
|
|
564587
566426
|
}
|
|
564588
|
-
if (existingHadDisabledServers ||
|
|
566427
|
+
if (existingHadDisabledServers || hasDisabledServersArray) {
|
|
564589
566428
|
updates.disabledMcpjsonServers = existingDisabledServers;
|
|
564590
566429
|
}
|
|
564591
566430
|
updateSettingsForSource("localSettings", updates);
|
|
@@ -564603,7 +566442,6 @@ function migrateEnableAllProjectMcpServersToSettings() {
|
|
|
564603
566442
|
});
|
|
564604
566443
|
} catch (error49) {
|
|
564605
566444
|
logError2("Failed to migrate MCP server settings, rolling back", error49);
|
|
564606
|
-
const currentSettings = getSettingsForSource("localSettings") || {};
|
|
564607
566445
|
let rollbackFailed = false;
|
|
564608
566446
|
const rollbackUpdates = {};
|
|
564609
566447
|
const migratedFields = [
|
|
@@ -564639,10 +566477,19 @@ function migrateEnableAllProjectMcpServersToSettings() {
|
|
|
564639
566477
|
rollbackFailed = true;
|
|
564640
566478
|
if (settingsRollbackSucceeded) {
|
|
564641
566479
|
try {
|
|
564642
|
-
|
|
564643
|
-
|
|
564644
|
-
|
|
566480
|
+
const reapplyUpdates = {};
|
|
566481
|
+
for (const field of migratedFields) {
|
|
566482
|
+
if (updates[field] !== undefined) {
|
|
566483
|
+
reapplyUpdates[field] = updates[field];
|
|
566484
|
+
}
|
|
566485
|
+
}
|
|
566486
|
+
updateSettingsForSource("localSettings", reapplyUpdates);
|
|
566487
|
+
logError2("Re-applied migrated state to settings after project config rollback failure. " + "System is now consistent (migration state re-applied).", rollbackError);
|
|
566488
|
+
} catch (reapplyError) {
|
|
566489
|
+
logError2("Failed to re-apply migrated state to settings after project config rollback failure. " + "System is in an inconsistent state. Manual intervention may be required.", reapplyError);
|
|
564645
566490
|
}
|
|
566491
|
+
} else {
|
|
566492
|
+
logError2("Settings rollback succeeded but project config rollback failed. " + "System is in an inconsistent state. Manual intervention may be required.", rollbackError);
|
|
564646
566493
|
}
|
|
564647
566494
|
}
|
|
564648
566495
|
if (rollbackFailed) {
|