@xyo-network/xl1-cli 1.21.0 → 1.21.2
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/cli-min.mjs +405 -1056
- package/dist/cli-min.mjs.map +1 -1
- package/package.json +34 -34
package/dist/cli-min.mjs
CHANGED
|
@@ -53911,7 +53911,7 @@ function getGlobal() {
|
|
|
53911
53911
|
}
|
|
53912
53912
|
const globalObject = getGlobal();
|
|
53913
53913
|
const nodeBuffer = (_a$4 = globalObject.Buffer) !== null && _a$4 !== void 0 ? _a$4 : null;
|
|
53914
|
-
const textEncoder$
|
|
53914
|
+
const textEncoder$1 = globalObject.TextEncoder
|
|
53915
53915
|
? new globalObject.TextEncoder()
|
|
53916
53916
|
: null;
|
|
53917
53917
|
function hexCharCodesToInt(a, b) {
|
|
@@ -53966,7 +53966,7 @@ const getUInt8Buffer = nodeBuffer !== null
|
|
|
53966
53966
|
}
|
|
53967
53967
|
: (data) => {
|
|
53968
53968
|
if (typeof data === "string") {
|
|
53969
|
-
return textEncoder$
|
|
53969
|
+
return textEncoder$1.encode(data);
|
|
53970
53970
|
}
|
|
53971
53971
|
if (ArrayBuffer.isView(data)) {
|
|
53972
53972
|
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
@@ -74472,6 +74472,13 @@ var StorageConfigZod = object$4({
|
|
|
74472
74472
|
type: "string"
|
|
74473
74473
|
})
|
|
74474
74474
|
}).describe("Storage configuration options");
|
|
74475
|
+
var DefaultMetricsScrapePorts = {
|
|
74476
|
+
api: 9465,
|
|
74477
|
+
bridge: 9468,
|
|
74478
|
+
mempool: 9466,
|
|
74479
|
+
producer: 9464,
|
|
74480
|
+
rewardRedemptionApi: 9467
|
|
74481
|
+
};
|
|
74475
74482
|
var MetricsScrapeConfigZod = object$4({
|
|
74476
74483
|
path: string$2().default("/metrics").register(globalRegistry, {
|
|
74477
74484
|
default: "/metrics",
|
|
@@ -186922,20 +186929,7 @@ var NamedLmdbArchivist = class extends LmdbArchivist {
|
|
|
186922
186929
|
};
|
|
186923
186930
|
|
|
186924
186931
|
// src/node/manifest/getLocator.ts
|
|
186925
|
-
var getLocator$1 = /* @__PURE__ */ __name$8(async ({ logger, config }) => {
|
|
186926
|
-
const { otlpEndpoint } = config.telemetry?.otel ?? {};
|
|
186927
|
-
const { path: endpoint = "/metrics", port = 9465 } = config.telemetry?.metrics?.scrape ?? {};
|
|
186928
|
-
const { traceProvider, meterProvider } = await initTelemetry({
|
|
186929
|
-
attributes: {
|
|
186930
|
-
serviceName: "xl1-api",
|
|
186931
|
-
serviceVersion: "1.0.0"
|
|
186932
|
-
},
|
|
186933
|
-
otlpEndpoint,
|
|
186934
|
-
metricsConfig: {
|
|
186935
|
-
endpoint,
|
|
186936
|
-
port
|
|
186937
|
-
}
|
|
186938
|
-
});
|
|
186932
|
+
var getLocator$1 = /* @__PURE__ */ __name$8(async ({ logger, traceProvider, meterProvider, config }) => {
|
|
186939
186933
|
if (isDefined(logger)) AbstractModule.defaultLogger = logger;
|
|
186940
186934
|
const statusReporter = logger ? new LoggerModuleStatusReporter(logger) : void 0;
|
|
186941
186935
|
const locator = new ModuleFactoryLocator();
|
|
@@ -187486,9 +187480,9 @@ async function buildStatelessApiLocator(context, needs) {
|
|
|
187486
187480
|
return result.locator;
|
|
187487
187481
|
}
|
|
187488
187482
|
__name$8(buildStatelessApiLocator, "buildStatelessApiLocator");
|
|
187489
|
-
async function telemetryContextFromConfig(config, serviceName, serviceVersion) {
|
|
187483
|
+
async function telemetryContextFromConfig(config, serviceName, serviceVersion, defaultScrapePort = 9464) {
|
|
187490
187484
|
const { otlpEndpoint } = config.telemetry?.otel ?? {};
|
|
187491
|
-
const { path: endpoint = "/metrics", port =
|
|
187485
|
+
const { path: endpoint = "/metrics", port = defaultScrapePort } = config.telemetry?.metrics?.scrape ?? {};
|
|
187492
187486
|
return await initTelemetry({
|
|
187493
187487
|
attributes: {
|
|
187494
187488
|
serviceName,
|
|
@@ -187504,10 +187498,10 @@ async function telemetryContextFromConfig(config, serviceName, serviceVersion) {
|
|
|
187504
187498
|
__name$8(telemetryContextFromConfig, "telemetryContextFromConfig");
|
|
187505
187499
|
|
|
187506
187500
|
// src/node/config/locators/contextFromConfigWithoutLocator.ts
|
|
187507
|
-
async function contextFromConfigWithoutLocator(config, logger, serviceName, serviceVersion) {
|
|
187501
|
+
async function contextFromConfigWithoutLocator(config, logger, serviceName, serviceVersion, defaultScrapePort) {
|
|
187508
187502
|
const singletons = {};
|
|
187509
187503
|
const caches = {};
|
|
187510
|
-
const telemetryConfig = await telemetryContextFromConfig(config, serviceName, serviceVersion);
|
|
187504
|
+
const telemetryConfig = await telemetryContextFromConfig(config, serviceName, serviceVersion, defaultScrapePort);
|
|
187511
187505
|
const statusReporter = initStatusReporter({
|
|
187512
187506
|
logger
|
|
187513
187507
|
});
|
|
@@ -211453,7 +211447,6 @@ const C1 = new C1Type();
|
|
|
211453
211447
|
C1.name = 'MessagePack 0xC1';
|
|
211454
211448
|
var sequentialMode = false;
|
|
211455
211449
|
var inlineObjectReadThreshold = 2;
|
|
211456
|
-
var readStruct$1, onLoadedStructures$1, onSaveState;
|
|
211457
211450
|
|
|
211458
211451
|
class Unpackr {
|
|
211459
211452
|
constructor(options) {
|
|
@@ -211483,10 +211476,10 @@ class Unpackr {
|
|
|
211483
211476
|
unpack(source, options) {
|
|
211484
211477
|
if (src) {
|
|
211485
211478
|
// re-entrant execution, save the state and restore it after we do this unpack
|
|
211486
|
-
return saveState
|
|
211479
|
+
return saveState(() => {
|
|
211487
211480
|
clearSource();
|
|
211488
|
-
return this ? this.unpack(source, options) : Unpackr.prototype.unpack.call(defaultOptions, source, options)
|
|
211489
|
-
})
|
|
211481
|
+
return this ? this.unpack(source, options) : Unpackr.prototype.unpack.call(defaultOptions, source, options);
|
|
211482
|
+
});
|
|
211490
211483
|
}
|
|
211491
211484
|
if (!source.buffer && source.constructor === ArrayBuffer)
|
|
211492
211485
|
source = typeof Buffer !== 'undefined' ? Buffer.from(source) : new Uint8Array(source);
|
|
@@ -211512,14 +211505,14 @@ class Unpackr {
|
|
|
211512
211505
|
// if it doesn't have a buffer, maybe it is the wrong type of object
|
|
211513
211506
|
src = null;
|
|
211514
211507
|
if (source instanceof Uint8Array)
|
|
211515
|
-
throw error
|
|
211516
|
-
throw new Error('Source must be a Uint8Array or Buffer but was a ' + ((source && typeof source == 'object') ? source.constructor.name : typeof source))
|
|
211508
|
+
throw error;
|
|
211509
|
+
throw new Error('Source must be a Uint8Array or Buffer but was a ' + ((source && typeof source == 'object') ? source.constructor.name : typeof source));
|
|
211517
211510
|
}
|
|
211518
211511
|
if (this instanceof Unpackr) {
|
|
211519
211512
|
currentUnpackr = this;
|
|
211520
211513
|
if (this.structures) {
|
|
211521
211514
|
currentStructures = this.structures;
|
|
211522
|
-
return checkedRead(options)
|
|
211515
|
+
return checkedRead(options);
|
|
211523
211516
|
} else if (!currentStructures || currentStructures.length > 0) {
|
|
211524
211517
|
currentStructures = [];
|
|
211525
211518
|
}
|
|
@@ -211528,7 +211521,7 @@ class Unpackr {
|
|
|
211528
211521
|
if (!currentStructures || currentStructures.length > 0)
|
|
211529
211522
|
currentStructures = [];
|
|
211530
211523
|
}
|
|
211531
|
-
return checkedRead(options)
|
|
211524
|
+
return checkedRead(options);
|
|
211532
211525
|
}
|
|
211533
211526
|
unpackMultiple(source, forEach) {
|
|
211534
211527
|
let values, lastPosition = 0;
|
|
@@ -211541,7 +211534,7 @@ class Unpackr {
|
|
|
211541
211534
|
while(position$1 < size) {
|
|
211542
211535
|
lastPosition = position$1;
|
|
211543
211536
|
if (forEach(checkedRead(), lastPosition, position$1) === false) {
|
|
211544
|
-
return
|
|
211537
|
+
return;
|
|
211545
211538
|
}
|
|
211546
211539
|
}
|
|
211547
211540
|
}
|
|
@@ -211551,20 +211544,20 @@ class Unpackr {
|
|
|
211551
211544
|
lastPosition = position$1;
|
|
211552
211545
|
values.push(checkedRead());
|
|
211553
211546
|
}
|
|
211554
|
-
return values
|
|
211547
|
+
return values;
|
|
211555
211548
|
}
|
|
211556
211549
|
} catch(error) {
|
|
211557
211550
|
error.lastPosition = lastPosition;
|
|
211558
211551
|
error.values = values;
|
|
211559
|
-
throw error
|
|
211552
|
+
throw error;
|
|
211560
211553
|
} finally {
|
|
211561
211554
|
sequentialMode = false;
|
|
211562
211555
|
clearSource();
|
|
211563
211556
|
}
|
|
211564
211557
|
}
|
|
211565
211558
|
_mergeStructures(loadedStructures, existingStructures) {
|
|
211566
|
-
if (
|
|
211567
|
-
loadedStructures =
|
|
211559
|
+
if (this._onLoadedStructures)
|
|
211560
|
+
loadedStructures = this._onLoadedStructures(loadedStructures);
|
|
211568
211561
|
loadedStructures = loadedStructures || [];
|
|
211569
211562
|
if (Object.isFrozen(loadedStructures))
|
|
211570
211563
|
loadedStructures = loadedStructures.map(structure => structure.slice(0));
|
|
@@ -211588,10 +211581,10 @@ class Unpackr {
|
|
|
211588
211581
|
}
|
|
211589
211582
|
}
|
|
211590
211583
|
}
|
|
211591
|
-
return this.structures = loadedStructures
|
|
211584
|
+
return this.structures = loadedStructures;
|
|
211592
211585
|
}
|
|
211593
211586
|
decode(source, options) {
|
|
211594
|
-
return this.unpack(source, options)
|
|
211587
|
+
return this.unpack(source, options);
|
|
211595
211588
|
}
|
|
211596
211589
|
}
|
|
211597
211590
|
function checkedRead(options) {
|
|
@@ -211602,8 +211595,8 @@ function checkedRead(options) {
|
|
|
211602
211595
|
currentStructures.length = sharedLength;
|
|
211603
211596
|
}
|
|
211604
211597
|
let result;
|
|
211605
|
-
if (currentUnpackr.
|
|
211606
|
-
result =
|
|
211598
|
+
if (currentUnpackr._readStruct && src[position$1] < 0x40 && src[position$1] >= 0x20) {
|
|
211599
|
+
result = currentUnpackr._readStruct(src, position$1, srcEnd);
|
|
211607
211600
|
src = null; // dispose of this so that recursive unpack calls don't save state
|
|
211608
211601
|
if (!(options && options.lazy) && result)
|
|
211609
211602
|
result = result.toJSON();
|
|
@@ -211629,7 +211622,7 @@ function checkedRead(options) {
|
|
|
211629
211622
|
referenceMap = null;
|
|
211630
211623
|
} else if (position$1 > srcEnd) {
|
|
211631
211624
|
// over read
|
|
211632
|
-
throw new Error('Unexpected end of MessagePack data')
|
|
211625
|
+
throw new Error('Unexpected end of MessagePack data');
|
|
211633
211626
|
} else if (!sequentialMode) {
|
|
211634
211627
|
let jsonView;
|
|
211635
211628
|
try {
|
|
@@ -211637,10 +211630,10 @@ function checkedRead(options) {
|
|
|
211637
211630
|
} catch(error) {
|
|
211638
211631
|
jsonView = '(JSON view not available ' + error + ')';
|
|
211639
211632
|
}
|
|
211640
|
-
throw new Error('Data read, but end of buffer not reached ' + jsonView)
|
|
211633
|
+
throw new Error('Data read, but end of buffer not reached ' + jsonView);
|
|
211641
211634
|
}
|
|
211642
211635
|
// else more to read, but we are reading sequentially, so don't clear source yet
|
|
211643
|
-
return result
|
|
211636
|
+
return result;
|
|
211644
211637
|
} catch(error) {
|
|
211645
211638
|
if (currentStructures && currentStructures.restoreStructures)
|
|
211646
211639
|
restoreStructures();
|
|
@@ -211648,7 +211641,7 @@ function checkedRead(options) {
|
|
|
211648
211641
|
if (error instanceof RangeError || error.message.startsWith('Unexpected end of buffer') || position$1 > srcEnd) {
|
|
211649
211642
|
error.incomplete = true;
|
|
211650
211643
|
}
|
|
211651
|
-
throw error
|
|
211644
|
+
throw error;
|
|
211652
211645
|
}
|
|
211653
211646
|
}
|
|
211654
211647
|
|
|
@@ -211664,7 +211657,7 @@ function read() {
|
|
|
211664
211657
|
if (token < 0xa0) {
|
|
211665
211658
|
if (token < 0x80) {
|
|
211666
211659
|
if (token < 0x40)
|
|
211667
|
-
return token
|
|
211660
|
+
return token;
|
|
211668
211661
|
else {
|
|
211669
211662
|
let structure = currentStructures[token & 0x3f] ||
|
|
211670
211663
|
currentUnpackr.getStructures && loadStructures()[token & 0x3f];
|
|
@@ -211672,9 +211665,9 @@ function read() {
|
|
|
211672
211665
|
if (!structure.read) {
|
|
211673
211666
|
structure.read = createStructureReader(structure, token & 0x3f);
|
|
211674
211667
|
}
|
|
211675
|
-
return structure.read()
|
|
211668
|
+
return structure.read();
|
|
211676
211669
|
} else
|
|
211677
|
-
return token
|
|
211670
|
+
return token;
|
|
211678
211671
|
}
|
|
211679
211672
|
} else if (token < 0x90) {
|
|
211680
211673
|
// map
|
|
@@ -211687,13 +211680,13 @@ function read() {
|
|
|
211687
211680
|
key = '__proto_';
|
|
211688
211681
|
object[key] = read();
|
|
211689
211682
|
}
|
|
211690
|
-
return object
|
|
211683
|
+
return object;
|
|
211691
211684
|
} else {
|
|
211692
211685
|
let map = new Map();
|
|
211693
211686
|
for (let i = 0; i < token; i++) {
|
|
211694
211687
|
map.set(read(), read());
|
|
211695
211688
|
}
|
|
211696
|
-
return map
|
|
211689
|
+
return map;
|
|
211697
211690
|
}
|
|
211698
211691
|
} else {
|
|
211699
211692
|
token -= 0x90;
|
|
@@ -211702,91 +211695,91 @@ function read() {
|
|
|
211702
211695
|
array[i] = read();
|
|
211703
211696
|
}
|
|
211704
211697
|
if (currentUnpackr.freezeData)
|
|
211705
|
-
return Object.freeze(array)
|
|
211706
|
-
return array
|
|
211698
|
+
return Object.freeze(array);
|
|
211699
|
+
return array;
|
|
211707
211700
|
}
|
|
211708
211701
|
} else if (token < 0xc0) {
|
|
211709
211702
|
// fixstr
|
|
211710
211703
|
let length = token - 0xa0;
|
|
211711
211704
|
if (srcStringEnd >= position$1) {
|
|
211712
|
-
return srcString.slice(position$1 - srcStringStart, (position$1 += length) - srcStringStart)
|
|
211705
|
+
return srcString.slice(position$1 - srcStringStart, (position$1 += length) - srcStringStart);
|
|
211713
211706
|
}
|
|
211714
211707
|
if (srcStringEnd == 0 && srcEnd < 140) {
|
|
211715
211708
|
// for small blocks, avoiding the overhead of the extract call is helpful
|
|
211716
211709
|
let string = length < 16 ? shortStringInJS(length) : longStringInJS(length);
|
|
211717
211710
|
if (string != null)
|
|
211718
|
-
return string
|
|
211711
|
+
return string;
|
|
211719
211712
|
}
|
|
211720
|
-
return readFixedString(length)
|
|
211713
|
+
return readFixedString(length);
|
|
211721
211714
|
} else {
|
|
211722
211715
|
let value;
|
|
211723
211716
|
switch (token) {
|
|
211724
|
-
case 0xc0: return null
|
|
211717
|
+
case 0xc0: return null;
|
|
211725
211718
|
case 0xc1:
|
|
211726
211719
|
if (bundledStrings$1) {
|
|
211727
211720
|
value = read(); // followed by the length of the string in characters (not bytes!)
|
|
211728
211721
|
if (value > 0)
|
|
211729
|
-
return bundledStrings$1[1].slice(bundledStrings$1.position1, bundledStrings$1.position1 += value)
|
|
211722
|
+
return bundledStrings$1[1].slice(bundledStrings$1.position1, bundledStrings$1.position1 += value);
|
|
211730
211723
|
else
|
|
211731
|
-
return bundledStrings$1[0].slice(bundledStrings$1.position0, bundledStrings$1.position0 -= value)
|
|
211724
|
+
return bundledStrings$1[0].slice(bundledStrings$1.position0, bundledStrings$1.position0 -= value);
|
|
211732
211725
|
}
|
|
211733
211726
|
return C1; // "never-used", return special object to denote that
|
|
211734
|
-
case 0xc2: return false
|
|
211735
|
-
case 0xc3: return true
|
|
211727
|
+
case 0xc2: return false;
|
|
211728
|
+
case 0xc3: return true;
|
|
211736
211729
|
case 0xc4:
|
|
211737
211730
|
// bin 8
|
|
211738
211731
|
value = src[position$1++];
|
|
211739
211732
|
if (value === undefined)
|
|
211740
|
-
throw new Error('Unexpected end of buffer')
|
|
211741
|
-
return readBin(value)
|
|
211733
|
+
throw new Error('Unexpected end of buffer');
|
|
211734
|
+
return readBin(value);
|
|
211742
211735
|
case 0xc5:
|
|
211743
211736
|
// bin 16
|
|
211744
211737
|
value = dataView.getUint16(position$1);
|
|
211745
211738
|
position$1 += 2;
|
|
211746
|
-
return readBin(value)
|
|
211739
|
+
return readBin(value);
|
|
211747
211740
|
case 0xc6:
|
|
211748
211741
|
// bin 32
|
|
211749
211742
|
value = dataView.getUint32(position$1);
|
|
211750
211743
|
position$1 += 4;
|
|
211751
|
-
return readBin(value)
|
|
211744
|
+
return readBin(value);
|
|
211752
211745
|
case 0xc7:
|
|
211753
211746
|
// ext 8
|
|
211754
|
-
return readExt(src[position$1++])
|
|
211747
|
+
return readExt(src[position$1++]);
|
|
211755
211748
|
case 0xc8:
|
|
211756
211749
|
// ext 16
|
|
211757
211750
|
value = dataView.getUint16(position$1);
|
|
211758
211751
|
position$1 += 2;
|
|
211759
|
-
return readExt(value)
|
|
211752
|
+
return readExt(value);
|
|
211760
211753
|
case 0xc9:
|
|
211761
211754
|
// ext 32
|
|
211762
211755
|
value = dataView.getUint32(position$1);
|
|
211763
211756
|
position$1 += 4;
|
|
211764
|
-
return readExt(value)
|
|
211757
|
+
return readExt(value);
|
|
211765
211758
|
case 0xca:
|
|
211766
211759
|
value = dataView.getFloat32(position$1);
|
|
211767
211760
|
if (currentUnpackr.useFloat32 > 2) {
|
|
211768
211761
|
// this does rounding of numbers that were encoded in 32-bit float to nearest significant decimal digit that could be preserved
|
|
211769
211762
|
let multiplier = mult10[((src[position$1] & 0x7f) << 1) | (src[position$1 + 1] >> 7)];
|
|
211770
211763
|
position$1 += 4;
|
|
211771
|
-
return ((multiplier * value + (value > 0 ? 0.5 : -0.5)) >> 0) / multiplier
|
|
211764
|
+
return ((multiplier * value + (value > 0 ? 0.5 : -0.5)) >> 0) / multiplier;
|
|
211772
211765
|
}
|
|
211773
211766
|
position$1 += 4;
|
|
211774
|
-
return value
|
|
211767
|
+
return value;
|
|
211775
211768
|
case 0xcb:
|
|
211776
211769
|
value = dataView.getFloat64(position$1);
|
|
211777
211770
|
position$1 += 8;
|
|
211778
|
-
return value
|
|
211771
|
+
return value;
|
|
211779
211772
|
// uint handlers
|
|
211780
211773
|
case 0xcc:
|
|
211781
|
-
return src[position$1++]
|
|
211774
|
+
return src[position$1++];
|
|
211782
211775
|
case 0xcd:
|
|
211783
211776
|
value = dataView.getUint16(position$1);
|
|
211784
211777
|
position$1 += 2;
|
|
211785
|
-
return value
|
|
211778
|
+
return value;
|
|
211786
211779
|
case 0xce:
|
|
211787
211780
|
value = dataView.getUint32(position$1);
|
|
211788
211781
|
position$1 += 4;
|
|
211789
|
-
return value
|
|
211782
|
+
return value;
|
|
211790
211783
|
case 0xcf:
|
|
211791
211784
|
if (currentUnpackr.int64AsType === 'number') {
|
|
211792
211785
|
value = dataView.getUint32(position$1) * 0x100000000;
|
|
@@ -211799,19 +211792,19 @@ function read() {
|
|
|
211799
211792
|
} else
|
|
211800
211793
|
value = dataView.getBigUint64(position$1);
|
|
211801
211794
|
position$1 += 8;
|
|
211802
|
-
return value
|
|
211795
|
+
return value;
|
|
211803
211796
|
|
|
211804
211797
|
// int handlers
|
|
211805
211798
|
case 0xd0:
|
|
211806
|
-
return dataView.getInt8(position$1++)
|
|
211799
|
+
return dataView.getInt8(position$1++);
|
|
211807
211800
|
case 0xd1:
|
|
211808
211801
|
value = dataView.getInt16(position$1);
|
|
211809
211802
|
position$1 += 2;
|
|
211810
|
-
return value
|
|
211803
|
+
return value;
|
|
211811
211804
|
case 0xd2:
|
|
211812
211805
|
value = dataView.getInt32(position$1);
|
|
211813
211806
|
position$1 += 4;
|
|
211814
|
-
return value
|
|
211807
|
+
return value;
|
|
211815
211808
|
case 0xd3:
|
|
211816
211809
|
if (currentUnpackr.int64AsType === 'number') {
|
|
211817
211810
|
value = dataView.getInt32(position$1) * 0x100000000;
|
|
@@ -211824,96 +211817,96 @@ function read() {
|
|
|
211824
211817
|
} else
|
|
211825
211818
|
value = dataView.getBigInt64(position$1);
|
|
211826
211819
|
position$1 += 8;
|
|
211827
|
-
return value
|
|
211820
|
+
return value;
|
|
211828
211821
|
|
|
211829
211822
|
case 0xd4:
|
|
211830
211823
|
// fixext 1
|
|
211831
211824
|
value = src[position$1++];
|
|
211832
211825
|
if (value == 0x72) {
|
|
211833
|
-
return recordDefinition(src[position$1++] & 0x3f)
|
|
211826
|
+
return recordDefinition(src[position$1++] & 0x3f);
|
|
211834
211827
|
} else {
|
|
211835
211828
|
let extension = currentExtensions[value];
|
|
211836
211829
|
if (extension) {
|
|
211837
211830
|
if (extension.read) {
|
|
211838
211831
|
position$1++; // skip filler byte
|
|
211839
|
-
return extension.read(read())
|
|
211832
|
+
return extension.read(read());
|
|
211840
211833
|
} else if (extension.noBuffer) {
|
|
211841
211834
|
position$1++; // skip filler byte
|
|
211842
|
-
return extension()
|
|
211835
|
+
return extension();
|
|
211843
211836
|
} else
|
|
211844
|
-
return extension(src.subarray(position$1, ++position$1))
|
|
211837
|
+
return extension(src.subarray(position$1, ++position$1));
|
|
211845
211838
|
} else
|
|
211846
|
-
throw new Error('Unknown extension ' + value)
|
|
211839
|
+
throw new Error('Unknown extension ' + value);
|
|
211847
211840
|
}
|
|
211848
211841
|
case 0xd5:
|
|
211849
211842
|
// fixext 2
|
|
211850
211843
|
value = src[position$1];
|
|
211851
211844
|
if (value == 0x72) {
|
|
211852
211845
|
position$1++;
|
|
211853
|
-
return recordDefinition(src[position$1++] & 0x3f, src[position$1++])
|
|
211846
|
+
return recordDefinition(src[position$1++] & 0x3f, src[position$1++]);
|
|
211854
211847
|
} else
|
|
211855
|
-
return readExt(2)
|
|
211848
|
+
return readExt(2);
|
|
211856
211849
|
case 0xd6:
|
|
211857
211850
|
// fixext 4
|
|
211858
|
-
return readExt(4)
|
|
211851
|
+
return readExt(4);
|
|
211859
211852
|
case 0xd7:
|
|
211860
211853
|
// fixext 8
|
|
211861
|
-
return readExt(8)
|
|
211854
|
+
return readExt(8);
|
|
211862
211855
|
case 0xd8:
|
|
211863
211856
|
// fixext 16
|
|
211864
|
-
return readExt(16)
|
|
211857
|
+
return readExt(16);
|
|
211865
211858
|
case 0xd9:
|
|
211866
211859
|
// str 8
|
|
211867
211860
|
value = src[position$1++];
|
|
211868
211861
|
if (srcStringEnd >= position$1) {
|
|
211869
|
-
return srcString.slice(position$1 - srcStringStart, (position$1 += value) - srcStringStart)
|
|
211862
|
+
return srcString.slice(position$1 - srcStringStart, (position$1 += value) - srcStringStart);
|
|
211870
211863
|
}
|
|
211871
|
-
return readString8(value)
|
|
211864
|
+
return readString8(value);
|
|
211872
211865
|
case 0xda:
|
|
211873
211866
|
// str 16
|
|
211874
211867
|
value = dataView.getUint16(position$1);
|
|
211875
211868
|
position$1 += 2;
|
|
211876
211869
|
if (srcStringEnd >= position$1) {
|
|
211877
|
-
return srcString.slice(position$1 - srcStringStart, (position$1 += value) - srcStringStart)
|
|
211870
|
+
return srcString.slice(position$1 - srcStringStart, (position$1 += value) - srcStringStart);
|
|
211878
211871
|
}
|
|
211879
|
-
return readString16(value)
|
|
211872
|
+
return readString16(value);
|
|
211880
211873
|
case 0xdb:
|
|
211881
211874
|
// str 32
|
|
211882
211875
|
value = dataView.getUint32(position$1);
|
|
211883
211876
|
position$1 += 4;
|
|
211884
211877
|
if (srcStringEnd >= position$1) {
|
|
211885
|
-
return srcString.slice(position$1 - srcStringStart, (position$1 += value) - srcStringStart)
|
|
211878
|
+
return srcString.slice(position$1 - srcStringStart, (position$1 += value) - srcStringStart);
|
|
211886
211879
|
}
|
|
211887
|
-
return readString32(value)
|
|
211880
|
+
return readString32(value);
|
|
211888
211881
|
case 0xdc:
|
|
211889
211882
|
// array 16
|
|
211890
211883
|
value = dataView.getUint16(position$1);
|
|
211891
211884
|
position$1 += 2;
|
|
211892
|
-
return readArray(value)
|
|
211885
|
+
return readArray(value);
|
|
211893
211886
|
case 0xdd:
|
|
211894
211887
|
// array 32
|
|
211895
211888
|
value = dataView.getUint32(position$1);
|
|
211896
211889
|
position$1 += 4;
|
|
211897
|
-
return readArray(value)
|
|
211890
|
+
return readArray(value);
|
|
211898
211891
|
case 0xde:
|
|
211899
211892
|
// map 16
|
|
211900
211893
|
value = dataView.getUint16(position$1);
|
|
211901
211894
|
position$1 += 2;
|
|
211902
|
-
return readMap(value)
|
|
211895
|
+
return readMap(value);
|
|
211903
211896
|
case 0xdf:
|
|
211904
211897
|
// map 32
|
|
211905
211898
|
value = dataView.getUint32(position$1);
|
|
211906
211899
|
position$1 += 4;
|
|
211907
|
-
return readMap(value)
|
|
211900
|
+
return readMap(value);
|
|
211908
211901
|
default: // negative int
|
|
211909
211902
|
if (token >= 0xe0)
|
|
211910
|
-
return token - 0x100
|
|
211903
|
+
return token - 0x100;
|
|
211911
211904
|
if (token === undefined) {
|
|
211912
211905
|
let error = new Error('Unexpected end of MessagePack data');
|
|
211913
211906
|
error.incomplete = true;
|
|
211914
|
-
throw error
|
|
211907
|
+
throw error;
|
|
211915
211908
|
}
|
|
211916
|
-
throw new Error('Unknown MessagePack token ' + token)
|
|
211909
|
+
throw new Error('Unknown MessagePack token ' + token);
|
|
211917
211910
|
|
|
211918
211911
|
}
|
|
211919
211912
|
}
|
|
@@ -211934,7 +211927,7 @@ function createStructureReader(structure, firstId) {
|
|
|
211934
211927
|
}
|
|
211935
211928
|
if (structure.highByte === 0)
|
|
211936
211929
|
structure.read = createSecondByteReader(firstId, structure.read);
|
|
211937
|
-
return optimizedReadObject() // second byte is already read, if there is one so immediately read object
|
|
211930
|
+
return optimizedReadObject(); // second byte is already read, if there is one so immediately read object
|
|
211938
211931
|
}
|
|
211939
211932
|
let object = {};
|
|
211940
211933
|
for (let i = 0, l = structure.length; i < l; i++) {
|
|
@@ -211945,38 +211938,38 @@ function createStructureReader(structure, firstId) {
|
|
|
211945
211938
|
}
|
|
211946
211939
|
if (currentUnpackr.freezeData)
|
|
211947
211940
|
return Object.freeze(object);
|
|
211948
|
-
return object
|
|
211941
|
+
return object;
|
|
211949
211942
|
}
|
|
211950
211943
|
readObject.count = 0;
|
|
211951
211944
|
if (structure.highByte === 0) {
|
|
211952
|
-
return createSecondByteReader(firstId, readObject)
|
|
211945
|
+
return createSecondByteReader(firstId, readObject);
|
|
211953
211946
|
}
|
|
211954
|
-
return readObject
|
|
211947
|
+
return readObject;
|
|
211955
211948
|
}
|
|
211956
211949
|
|
|
211957
211950
|
const createSecondByteReader = (firstId, read0) => {
|
|
211958
211951
|
return function() {
|
|
211959
211952
|
let highByte = src[position$1++];
|
|
211960
211953
|
if (highByte === 0)
|
|
211961
|
-
return read0()
|
|
211954
|
+
return read0();
|
|
211962
211955
|
let id = firstId < 32 ? -(firstId + (highByte << 5)) : firstId + (highByte << 5);
|
|
211963
211956
|
let structure = currentStructures[id] || loadStructures()[id];
|
|
211964
211957
|
if (!structure) {
|
|
211965
|
-
throw new Error('Record id is not defined for ' + id)
|
|
211958
|
+
throw new Error('Record id is not defined for ' + id);
|
|
211966
211959
|
}
|
|
211967
211960
|
if (!structure.read)
|
|
211968
211961
|
structure.read = createStructureReader(structure, firstId);
|
|
211969
|
-
return structure.read()
|
|
211970
|
-
}
|
|
211962
|
+
return structure.read();
|
|
211963
|
+
};
|
|
211971
211964
|
};
|
|
211972
211965
|
|
|
211973
211966
|
function loadStructures() {
|
|
211974
|
-
let loadedStructures = saveState
|
|
211967
|
+
let loadedStructures = saveState(() => {
|
|
211975
211968
|
// save the state in case getStructures modifies our buffer
|
|
211976
211969
|
src = null;
|
|
211977
|
-
return currentUnpackr.getStructures()
|
|
211970
|
+
return currentUnpackr.getStructures();
|
|
211978
211971
|
});
|
|
211979
|
-
return currentStructures = currentUnpackr._mergeStructures(loadedStructures, currentStructures)
|
|
211972
|
+
return currentStructures = currentUnpackr._mergeStructures(loadedStructures, currentStructures);
|
|
211980
211973
|
}
|
|
211981
211974
|
|
|
211982
211975
|
var readFixedString = readStringJS;
|
|
@@ -211994,7 +211987,7 @@ function setExtractor(extractStrings) {
|
|
|
211994
211987
|
let string = strings[stringPosition++];
|
|
211995
211988
|
if (string == null) {
|
|
211996
211989
|
if (bundledStrings$1)
|
|
211997
|
-
return readStringJS(length)
|
|
211990
|
+
return readStringJS(length);
|
|
211998
211991
|
let byteOffset = src.byteOffset;
|
|
211999
211992
|
let extraction = extractStrings(position$1 - headerLength + byteOffset, srcEnd + byteOffset, src.buffer);
|
|
212000
211993
|
if (typeof extraction == 'string') {
|
|
@@ -212006,30 +211999,30 @@ function setExtractor(extractStrings) {
|
|
|
212006
211999
|
srcStringEnd = 1; // even if a utf-8 string was decoded, must indicate we are in the midst of extracted strings and can't skip strings
|
|
212007
212000
|
string = strings[0];
|
|
212008
212001
|
if (string === undefined)
|
|
212009
|
-
throw new Error('Unexpected end of buffer')
|
|
212002
|
+
throw new Error('Unexpected end of buffer');
|
|
212010
212003
|
}
|
|
212011
212004
|
}
|
|
212012
212005
|
let srcStringLength = string.length;
|
|
212013
212006
|
if (srcStringLength <= length) {
|
|
212014
212007
|
position$1 += length;
|
|
212015
|
-
return string
|
|
212008
|
+
return string;
|
|
212016
212009
|
}
|
|
212017
212010
|
srcString = string;
|
|
212018
212011
|
srcStringStart = position$1;
|
|
212019
212012
|
srcStringEnd = position$1 + srcStringLength;
|
|
212020
212013
|
position$1 += length;
|
|
212021
|
-
return string.slice(0, length) // we know we just want the beginning
|
|
212022
|
-
}
|
|
212014
|
+
return string.slice(0, length); // we know we just want the beginning
|
|
212015
|
+
};
|
|
212023
212016
|
}
|
|
212024
212017
|
}
|
|
212025
212018
|
function readStringJS(length) {
|
|
212026
212019
|
let result;
|
|
212027
212020
|
if (length < 16) {
|
|
212028
212021
|
if (result = shortStringInJS(length))
|
|
212029
|
-
return result
|
|
212022
|
+
return result;
|
|
212030
212023
|
}
|
|
212031
212024
|
if (length > 64 && decoder)
|
|
212032
|
-
return decoder.decode(src.subarray(position$1, position$1 += length))
|
|
212025
|
+
return decoder.decode(src.subarray(position$1, position$1 += length));
|
|
212033
212026
|
const end = position$1 + length;
|
|
212034
212027
|
const units = [];
|
|
212035
212028
|
result = '';
|
|
@@ -212092,17 +212085,7 @@ function readStringJS(length) {
|
|
|
212092
212085
|
result += fromCharCode.apply(String, units);
|
|
212093
212086
|
}
|
|
212094
212087
|
|
|
212095
|
-
return result
|
|
212096
|
-
}
|
|
212097
|
-
function readString(source, start, length) {
|
|
212098
|
-
let existingSrc = src;
|
|
212099
|
-
src = source;
|
|
212100
|
-
position$1 = start;
|
|
212101
|
-
try {
|
|
212102
|
-
return readStringJS(length);
|
|
212103
|
-
} finally {
|
|
212104
|
-
src = existingSrc;
|
|
212105
|
-
}
|
|
212088
|
+
return result;
|
|
212106
212089
|
}
|
|
212107
212090
|
|
|
212108
212091
|
function readArray(length) {
|
|
@@ -212111,8 +212094,8 @@ function readArray(length) {
|
|
|
212111
212094
|
array[i] = read();
|
|
212112
212095
|
}
|
|
212113
212096
|
if (currentUnpackr.freezeData)
|
|
212114
|
-
return Object.freeze(array)
|
|
212115
|
-
return array
|
|
212097
|
+
return Object.freeze(array);
|
|
212098
|
+
return array;
|
|
212116
212099
|
}
|
|
212117
212100
|
|
|
212118
212101
|
function readMap(length) {
|
|
@@ -212124,13 +212107,13 @@ function readMap(length) {
|
|
|
212124
212107
|
key = '__proto_';
|
|
212125
212108
|
object[key] = read();
|
|
212126
212109
|
}
|
|
212127
|
-
return object
|
|
212110
|
+
return object;
|
|
212128
212111
|
} else {
|
|
212129
212112
|
let map = new Map();
|
|
212130
212113
|
for (let i = 0; i < length; i++) {
|
|
212131
212114
|
map.set(read(), read());
|
|
212132
212115
|
}
|
|
212133
|
-
return map
|
|
212116
|
+
return map;
|
|
212134
212117
|
}
|
|
212135
212118
|
}
|
|
212136
212119
|
|
|
@@ -212142,40 +212125,40 @@ function longStringInJS(length) {
|
|
|
212142
212125
|
const byte = src[position$1++];
|
|
212143
212126
|
if ((byte & 0x80) > 0) {
|
|
212144
212127
|
position$1 = start;
|
|
212145
|
-
return
|
|
212128
|
+
return;
|
|
212146
212129
|
}
|
|
212147
212130
|
bytes[i] = byte;
|
|
212148
212131
|
}
|
|
212149
|
-
return fromCharCode.apply(String, bytes)
|
|
212132
|
+
return fromCharCode.apply(String, bytes);
|
|
212150
212133
|
}
|
|
212151
212134
|
function shortStringInJS(length) {
|
|
212152
212135
|
if (length < 4) {
|
|
212153
212136
|
if (length < 2) {
|
|
212154
212137
|
if (length === 0)
|
|
212155
|
-
return ''
|
|
212138
|
+
return '';
|
|
212156
212139
|
else {
|
|
212157
212140
|
let a = src[position$1++];
|
|
212158
212141
|
if ((a & 0x80) > 1) {
|
|
212159
212142
|
position$1 -= 1;
|
|
212160
|
-
return
|
|
212143
|
+
return;
|
|
212161
212144
|
}
|
|
212162
|
-
return fromCharCode(a)
|
|
212145
|
+
return fromCharCode(a);
|
|
212163
212146
|
}
|
|
212164
212147
|
} else {
|
|
212165
212148
|
let a = src[position$1++];
|
|
212166
212149
|
let b = src[position$1++];
|
|
212167
212150
|
if ((a & 0x80) > 0 || (b & 0x80) > 0) {
|
|
212168
212151
|
position$1 -= 2;
|
|
212169
|
-
return
|
|
212152
|
+
return;
|
|
212170
212153
|
}
|
|
212171
212154
|
if (length < 3)
|
|
212172
|
-
return fromCharCode(a, b)
|
|
212155
|
+
return fromCharCode(a, b);
|
|
212173
212156
|
let c = src[position$1++];
|
|
212174
212157
|
if ((c & 0x80) > 0) {
|
|
212175
212158
|
position$1 -= 3;
|
|
212176
|
-
return
|
|
212159
|
+
return;
|
|
212177
212160
|
}
|
|
212178
|
-
return fromCharCode(a, b, c)
|
|
212161
|
+
return fromCharCode(a, b, c);
|
|
212179
212162
|
}
|
|
212180
212163
|
} else {
|
|
212181
212164
|
let a = src[position$1++];
|
|
@@ -212184,34 +212167,34 @@ function shortStringInJS(length) {
|
|
|
212184
212167
|
let d = src[position$1++];
|
|
212185
212168
|
if ((a & 0x80) > 0 || (b & 0x80) > 0 || (c & 0x80) > 0 || (d & 0x80) > 0) {
|
|
212186
212169
|
position$1 -= 4;
|
|
212187
|
-
return
|
|
212170
|
+
return;
|
|
212188
212171
|
}
|
|
212189
212172
|
if (length < 6) {
|
|
212190
212173
|
if (length === 4)
|
|
212191
|
-
return fromCharCode(a, b, c, d)
|
|
212174
|
+
return fromCharCode(a, b, c, d);
|
|
212192
212175
|
else {
|
|
212193
212176
|
let e = src[position$1++];
|
|
212194
212177
|
if ((e & 0x80) > 0) {
|
|
212195
212178
|
position$1 -= 5;
|
|
212196
|
-
return
|
|
212179
|
+
return;
|
|
212197
212180
|
}
|
|
212198
|
-
return fromCharCode(a, b, c, d, e)
|
|
212181
|
+
return fromCharCode(a, b, c, d, e);
|
|
212199
212182
|
}
|
|
212200
212183
|
} else if (length < 8) {
|
|
212201
212184
|
let e = src[position$1++];
|
|
212202
212185
|
let f = src[position$1++];
|
|
212203
212186
|
if ((e & 0x80) > 0 || (f & 0x80) > 0) {
|
|
212204
212187
|
position$1 -= 6;
|
|
212205
|
-
return
|
|
212188
|
+
return;
|
|
212206
212189
|
}
|
|
212207
212190
|
if (length < 7)
|
|
212208
|
-
return fromCharCode(a, b, c, d, e, f)
|
|
212191
|
+
return fromCharCode(a, b, c, d, e, f);
|
|
212209
212192
|
let g = src[position$1++];
|
|
212210
212193
|
if ((g & 0x80) > 0) {
|
|
212211
212194
|
position$1 -= 7;
|
|
212212
|
-
return
|
|
212195
|
+
return;
|
|
212213
212196
|
}
|
|
212214
|
-
return fromCharCode(a, b, c, d, e, f, g)
|
|
212197
|
+
return fromCharCode(a, b, c, d, e, f, g);
|
|
212215
212198
|
} else {
|
|
212216
212199
|
let e = src[position$1++];
|
|
212217
212200
|
let f = src[position$1++];
|
|
@@ -212219,34 +212202,34 @@ function shortStringInJS(length) {
|
|
|
212219
212202
|
let h = src[position$1++];
|
|
212220
212203
|
if ((e & 0x80) > 0 || (f & 0x80) > 0 || (g & 0x80) > 0 || (h & 0x80) > 0) {
|
|
212221
212204
|
position$1 -= 8;
|
|
212222
|
-
return
|
|
212205
|
+
return;
|
|
212223
212206
|
}
|
|
212224
212207
|
if (length < 10) {
|
|
212225
212208
|
if (length === 8)
|
|
212226
|
-
return fromCharCode(a, b, c, d, e, f, g, h)
|
|
212209
|
+
return fromCharCode(a, b, c, d, e, f, g, h);
|
|
212227
212210
|
else {
|
|
212228
212211
|
let i = src[position$1++];
|
|
212229
212212
|
if ((i & 0x80) > 0) {
|
|
212230
212213
|
position$1 -= 9;
|
|
212231
|
-
return
|
|
212214
|
+
return;
|
|
212232
212215
|
}
|
|
212233
|
-
return fromCharCode(a, b, c, d, e, f, g, h, i)
|
|
212216
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i);
|
|
212234
212217
|
}
|
|
212235
212218
|
} else if (length < 12) {
|
|
212236
212219
|
let i = src[position$1++];
|
|
212237
212220
|
let j = src[position$1++];
|
|
212238
212221
|
if ((i & 0x80) > 0 || (j & 0x80) > 0) {
|
|
212239
212222
|
position$1 -= 10;
|
|
212240
|
-
return
|
|
212223
|
+
return;
|
|
212241
212224
|
}
|
|
212242
212225
|
if (length < 11)
|
|
212243
|
-
return fromCharCode(a, b, c, d, e, f, g, h, i, j)
|
|
212226
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i, j);
|
|
212244
212227
|
let k = src[position$1++];
|
|
212245
212228
|
if ((k & 0x80) > 0) {
|
|
212246
212229
|
position$1 -= 11;
|
|
212247
|
-
return
|
|
212230
|
+
return;
|
|
212248
212231
|
}
|
|
212249
|
-
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k)
|
|
212232
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k);
|
|
212250
212233
|
} else {
|
|
212251
212234
|
let i = src[position$1++];
|
|
212252
212235
|
let j = src[position$1++];
|
|
@@ -212254,34 +212237,34 @@ function shortStringInJS(length) {
|
|
|
212254
212237
|
let l = src[position$1++];
|
|
212255
212238
|
if ((i & 0x80) > 0 || (j & 0x80) > 0 || (k & 0x80) > 0 || (l & 0x80) > 0) {
|
|
212256
212239
|
position$1 -= 12;
|
|
212257
|
-
return
|
|
212240
|
+
return;
|
|
212258
212241
|
}
|
|
212259
212242
|
if (length < 14) {
|
|
212260
212243
|
if (length === 12)
|
|
212261
|
-
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l)
|
|
212244
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l);
|
|
212262
212245
|
else {
|
|
212263
212246
|
let m = src[position$1++];
|
|
212264
212247
|
if ((m & 0x80) > 0) {
|
|
212265
212248
|
position$1 -= 13;
|
|
212266
|
-
return
|
|
212249
|
+
return;
|
|
212267
212250
|
}
|
|
212268
|
-
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m)
|
|
212251
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m);
|
|
212269
212252
|
}
|
|
212270
212253
|
} else {
|
|
212271
212254
|
let m = src[position$1++];
|
|
212272
212255
|
let n = src[position$1++];
|
|
212273
212256
|
if ((m & 0x80) > 0 || (n & 0x80) > 0) {
|
|
212274
212257
|
position$1 -= 14;
|
|
212275
|
-
return
|
|
212258
|
+
return;
|
|
212276
212259
|
}
|
|
212277
212260
|
if (length < 15)
|
|
212278
|
-
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n)
|
|
212261
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n);
|
|
212279
212262
|
let o = src[position$1++];
|
|
212280
212263
|
if ((o & 0x80) > 0) {
|
|
212281
212264
|
position$1 -= 15;
|
|
212282
|
-
return
|
|
212265
|
+
return;
|
|
212283
212266
|
}
|
|
212284
|
-
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
|
|
212267
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
|
|
212285
212268
|
}
|
|
212286
212269
|
}
|
|
212287
212270
|
}
|
|
@@ -212299,22 +212282,22 @@ function readOnlyJSString() {
|
|
|
212299
212282
|
case 0xd9:
|
|
212300
212283
|
// str 8
|
|
212301
212284
|
length = src[position$1++];
|
|
212302
|
-
break
|
|
212285
|
+
break;
|
|
212303
212286
|
case 0xda:
|
|
212304
212287
|
// str 16
|
|
212305
212288
|
length = dataView.getUint16(position$1);
|
|
212306
212289
|
position$1 += 2;
|
|
212307
|
-
break
|
|
212290
|
+
break;
|
|
212308
212291
|
case 0xdb:
|
|
212309
212292
|
// str 32
|
|
212310
212293
|
length = dataView.getUint32(position$1);
|
|
212311
212294
|
position$1 += 4;
|
|
212312
|
-
break
|
|
212295
|
+
break;
|
|
212313
212296
|
default:
|
|
212314
|
-
throw new Error('Expected string')
|
|
212297
|
+
throw new Error('Expected string');
|
|
212315
212298
|
}
|
|
212316
212299
|
}
|
|
212317
|
-
return readStringJS(length)
|
|
212300
|
+
return readStringJS(length);
|
|
212318
212301
|
}
|
|
212319
212302
|
|
|
212320
212303
|
|
|
@@ -212322,7 +212305,7 @@ function readBin(length) {
|
|
|
212322
212305
|
return currentUnpackr.copyBuffers ?
|
|
212323
212306
|
// specifically use the copying slice (not the node one)
|
|
212324
212307
|
Uint8Array.prototype.slice.call(src, position$1, position$1 += length) :
|
|
212325
|
-
src.subarray(position$1, position$1 += length)
|
|
212308
|
+
src.subarray(position$1, position$1 += length);
|
|
212326
212309
|
}
|
|
212327
212310
|
function readExt(length) {
|
|
212328
212311
|
let type = src[position$1++];
|
|
@@ -212335,10 +212318,10 @@ function readExt(length) {
|
|
|
212335
212318
|
} finally {
|
|
212336
212319
|
position$1 = end;
|
|
212337
212320
|
}
|
|
212338
|
-
})
|
|
212321
|
+
});
|
|
212339
212322
|
}
|
|
212340
212323
|
else
|
|
212341
|
-
throw new Error('Unknown extension type ' + type)
|
|
212324
|
+
throw new Error('Unknown extension type ' + type);
|
|
212342
212325
|
}
|
|
212343
212326
|
|
|
212344
212327
|
var keyCache = new Array(4096);
|
|
@@ -212348,12 +212331,12 @@ function readKey() {
|
|
|
212348
212331
|
// fixstr, potentially use key cache
|
|
212349
212332
|
length = length - 0xa0;
|
|
212350
212333
|
if (srcStringEnd >= position$1) // if it has been extracted, must use it (and faster anyway)
|
|
212351
|
-
return srcString.slice(position$1 - srcStringStart, (position$1 += length) - srcStringStart)
|
|
212334
|
+
return srcString.slice(position$1 - srcStringStart, (position$1 += length) - srcStringStart);
|
|
212352
212335
|
else if (!(srcStringEnd == 0 && srcEnd < 180))
|
|
212353
|
-
return readFixedString(length)
|
|
212336
|
+
return readFixedString(length);
|
|
212354
212337
|
} else { // not cacheable, go back and do a standard read
|
|
212355
212338
|
position$1--;
|
|
212356
|
-
return asSafeString(read())
|
|
212339
|
+
return asSafeString(read());
|
|
212357
212340
|
}
|
|
212358
212341
|
let key = ((length << 5) ^ (length > 1 ? dataView.getUint16(position$1) : length > 0 ? src[position$1] : 0)) & 0xfff;
|
|
212359
212342
|
let entry = keyCache[key];
|
|
@@ -212366,7 +212349,7 @@ function readKey() {
|
|
|
212366
212349
|
chunk = dataView.getUint32(checkPosition);
|
|
212367
212350
|
if (chunk != entry[i++]) {
|
|
212368
212351
|
checkPosition = 0x70000000;
|
|
212369
|
-
break
|
|
212352
|
+
break;
|
|
212370
212353
|
}
|
|
212371
212354
|
checkPosition += 4;
|
|
212372
212355
|
}
|
|
@@ -212375,12 +212358,12 @@ function readKey() {
|
|
|
212375
212358
|
chunk = src[checkPosition++];
|
|
212376
212359
|
if (chunk != entry[i++]) {
|
|
212377
212360
|
checkPosition = 0x70000000;
|
|
212378
|
-
break
|
|
212361
|
+
break;
|
|
212379
212362
|
}
|
|
212380
212363
|
}
|
|
212381
212364
|
if (checkPosition === end) {
|
|
212382
212365
|
position$1 = checkPosition;
|
|
212383
|
-
return entry.string
|
|
212366
|
+
return entry.string;
|
|
212384
212367
|
}
|
|
212385
212368
|
end -= 3;
|
|
212386
212369
|
checkPosition = position$1;
|
|
@@ -212401,8 +212384,8 @@ function readKey() {
|
|
|
212401
212384
|
// for small blocks, avoiding the overhead of the extract call is helpful
|
|
212402
212385
|
let string = length < 16 ? shortStringInJS(length) : longStringInJS(length);
|
|
212403
212386
|
if (string != null)
|
|
212404
|
-
return entry.string = string
|
|
212405
|
-
return entry.string = readFixedString(length)
|
|
212387
|
+
return entry.string = string;
|
|
212388
|
+
return entry.string = readFixedString(length);
|
|
212406
212389
|
}
|
|
212407
212390
|
|
|
212408
212391
|
function asSafeString(property) {
|
|
@@ -212433,7 +212416,7 @@ const recordDefinition = (id, highByte) => {
|
|
|
212433
212416
|
}
|
|
212434
212417
|
currentStructures[id] = structure;
|
|
212435
212418
|
structure.read = createStructureReader(structure, firstByte);
|
|
212436
|
-
return structure.read()
|
|
212419
|
+
return structure.read();
|
|
212437
212420
|
};
|
|
212438
212421
|
currentExtensions[0] = () => {}; // notepack defines extension 0 to mean undefined, so use that as the default here
|
|
212439
212422
|
currentExtensions[0].noBuffer = true;
|
|
@@ -212455,17 +212438,17 @@ currentExtensions[0x42] = data => {
|
|
|
212455
212438
|
out <<= BigInt(64);
|
|
212456
212439
|
out |= view.getBigUint64(i);
|
|
212457
212440
|
}
|
|
212458
|
-
return out
|
|
212441
|
+
return out;
|
|
212459
212442
|
}
|
|
212460
212443
|
// if (length === 8) return view.getBigUint64(start)
|
|
212461
212444
|
let middle = start + (length >> 4 << 3);
|
|
212462
212445
|
let left = decode(start, middle);
|
|
212463
212446
|
let right = decode(middle, end);
|
|
212464
|
-
return (left << BigInt((end - middle) * 8)) | right
|
|
212447
|
+
return (left << BigInt((end - middle) * 8)) | right;
|
|
212465
212448
|
};
|
|
212466
212449
|
head = (head << BigInt((view.byteLength - headLength) * 8)) | decode(headLength, view.byteLength);
|
|
212467
212450
|
}
|
|
212468
|
-
return head
|
|
212451
|
+
return head;
|
|
212469
212452
|
};
|
|
212470
212453
|
|
|
212471
212454
|
let errors = {
|
|
@@ -212476,14 +212459,14 @@ currentExtensions[0x65] = () => {
|
|
|
212476
212459
|
if (!errors[data[0]]) {
|
|
212477
212460
|
let error = Error(data[1], { cause: data[2] });
|
|
212478
212461
|
error.name = data[0];
|
|
212479
|
-
return error
|
|
212462
|
+
return error;
|
|
212480
212463
|
}
|
|
212481
|
-
return errors[data[0]](data[1], { cause: data[2] })
|
|
212464
|
+
return errors[data[0]](data[1], { cause: data[2] });
|
|
212482
212465
|
};
|
|
212483
212466
|
|
|
212484
212467
|
currentExtensions[0x69] = (data) => {
|
|
212485
212468
|
// id extension (for structured clones)
|
|
212486
|
-
if (currentUnpackr.structuredClone === false) throw new Error('Structured clone extension is disabled')
|
|
212469
|
+
if (currentUnpackr.structuredClone === false) throw new Error('Structured clone extension is disabled');
|
|
212487
212470
|
let id = dataView.getUint32(position$1 - 4);
|
|
212488
212471
|
if (!referenceMap)
|
|
212489
212472
|
referenceMap = new Map();
|
|
@@ -212504,7 +212487,7 @@ currentExtensions[0x69] = (data) => {
|
|
|
212504
212487
|
let targetProperties = read(); // read the next value as the target object to id
|
|
212505
212488
|
if (!refEntry.used) {
|
|
212506
212489
|
// no cycle, can just use the returned read object
|
|
212507
|
-
return refEntry.target = targetProperties // replace the placeholder with the real one
|
|
212490
|
+
return refEntry.target = targetProperties; // replace the placeholder with the real one
|
|
212508
212491
|
} else {
|
|
212509
212492
|
// there is a cycle, so we have to assign properties to original target
|
|
212510
212493
|
Object.assign(target, targetProperties);
|
|
@@ -212515,16 +212498,16 @@ currentExtensions[0x69] = (data) => {
|
|
|
212515
212498
|
for (let [k, v] of targetProperties.entries()) target.set(k, v);
|
|
212516
212499
|
if (target instanceof Set)
|
|
212517
212500
|
for (let i of Array.from(targetProperties)) target.add(i);
|
|
212518
|
-
return target
|
|
212501
|
+
return target;
|
|
212519
212502
|
};
|
|
212520
212503
|
|
|
212521
212504
|
currentExtensions[0x70] = (data) => {
|
|
212522
212505
|
// pointer extension (for structured clones)
|
|
212523
|
-
if (currentUnpackr.structuredClone === false) throw new Error('Structured clone extension is disabled')
|
|
212506
|
+
if (currentUnpackr.structuredClone === false) throw new Error('Structured clone extension is disabled');
|
|
212524
212507
|
let id = dataView.getUint32(position$1 - 4);
|
|
212525
212508
|
let refEntry = referenceMap.get(id);
|
|
212526
212509
|
refEntry.used = true;
|
|
212527
|
-
return refEntry.target
|
|
212510
|
+
return refEntry.target;
|
|
212528
212511
|
};
|
|
212529
212512
|
|
|
212530
212513
|
currentExtensions[0x73] = () => new Set(read());
|
|
@@ -212539,15 +212522,15 @@ currentExtensions[0x74] = (data) => {
|
|
|
212539
212522
|
|
|
212540
212523
|
let typedArrayName = typedArrays[typeCode];
|
|
212541
212524
|
if (!typedArrayName) {
|
|
212542
|
-
if (typeCode === 16) return buffer
|
|
212543
|
-
if (typeCode === 17) return new DataView(buffer)
|
|
212544
|
-
throw new Error('Could not find typed array for code ' + typeCode)
|
|
212525
|
+
if (typeCode === 16) return buffer;
|
|
212526
|
+
if (typeCode === 17) return new DataView(buffer);
|
|
212527
|
+
throw new Error('Could not find typed array for code ' + typeCode);
|
|
212545
212528
|
}
|
|
212546
|
-
return new glbl[typedArrayName](buffer)
|
|
212529
|
+
return new glbl[typedArrayName](buffer);
|
|
212547
212530
|
};
|
|
212548
212531
|
currentExtensions[0x78] = () => {
|
|
212549
212532
|
let data = read();
|
|
212550
|
-
return new RegExp(data[0], data[1])
|
|
212533
|
+
return new RegExp(data[0], data[1]);
|
|
212551
212534
|
};
|
|
212552
212535
|
const TEMP_BUNDLE = [];
|
|
212553
212536
|
currentExtensions[0x62] = (data) => {
|
|
@@ -212560,30 +212543,30 @@ currentExtensions[0x62] = (data) => {
|
|
|
212560
212543
|
bundledStrings$1.position1 = 0;
|
|
212561
212544
|
bundledStrings$1.postBundlePosition = position$1;
|
|
212562
212545
|
position$1 = dataPosition;
|
|
212563
|
-
return read()
|
|
212546
|
+
return read();
|
|
212564
212547
|
};
|
|
212565
212548
|
|
|
212566
212549
|
currentExtensions[0xff] = (data) => {
|
|
212567
212550
|
// 32-bit date extension
|
|
212568
212551
|
if (data.length == 4)
|
|
212569
|
-
return new Date((data[0] * 0x1000000 + (data[1] << 16) + (data[2] << 8) + data[3]) * 1000)
|
|
212552
|
+
return new Date((data[0] * 0x1000000 + (data[1] << 16) + (data[2] << 8) + data[3]) * 1000);
|
|
212570
212553
|
else if (data.length == 8)
|
|
212571
212554
|
return new Date(
|
|
212572
212555
|
((data[0] << 22) + (data[1] << 14) + (data[2] << 6) + (data[3] >> 2)) / 1000000 +
|
|
212573
|
-
((data[3] & 0x3) * 0x100000000 + data[4] * 0x1000000 + (data[5] << 16) + (data[6] << 8) + data[7]) * 1000)
|
|
212556
|
+
((data[3] & 0x3) * 0x100000000 + data[4] * 0x1000000 + (data[5] << 16) + (data[6] << 8) + data[7]) * 1000);
|
|
212574
212557
|
else if (data.length == 12)
|
|
212575
212558
|
return new Date(
|
|
212576
212559
|
((data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3]) / 1000000 +
|
|
212577
|
-
(((data[4] & 0x80) ? -281474976710656 : 0) + data[6] * 0x10000000000 + data[7] * 0x100000000 + data[8] * 0x1000000 + (data[9] << 16) + (data[10] << 8) + data[11]) * 1000)
|
|
212560
|
+
(((data[4] & 0x80) ? -281474976710656 : 0) + data[6] * 0x10000000000 + data[7] * 0x100000000 + data[8] * 0x1000000 + (data[9] << 16) + (data[10] << 8) + data[11]) * 1000);
|
|
212578
212561
|
else
|
|
212579
|
-
return new Date('invalid')
|
|
212562
|
+
return new Date('invalid');
|
|
212580
212563
|
};
|
|
212581
212564
|
// registration of bulk record definition?
|
|
212582
212565
|
// currentExtensions[0x52] = () =>
|
|
212583
212566
|
|
|
212584
|
-
function saveState
|
|
212585
|
-
if (
|
|
212586
|
-
|
|
212567
|
+
function saveState(callback) {
|
|
212568
|
+
if (currentUnpackr && currentUnpackr._onSaveState)
|
|
212569
|
+
currentUnpackr._onSaveState();
|
|
212587
212570
|
let savedSrcEnd = srcEnd;
|
|
212588
212571
|
let savedPosition = position$1;
|
|
212589
212572
|
let savedStringPosition = stringPosition;
|
|
@@ -212616,7 +212599,7 @@ function saveState$1(callback) {
|
|
|
212616
212599
|
currentStructures.splice(0, currentStructures.length, ...savedStructuresContents);
|
|
212617
212600
|
currentUnpackr = savedPackr;
|
|
212618
212601
|
dataView = new DataView(src.buffer, src.byteOffset, src.byteLength);
|
|
212619
|
-
return value
|
|
212602
|
+
return value;
|
|
212620
212603
|
}
|
|
212621
212604
|
function clearSource() {
|
|
212622
212605
|
src = null;
|
|
@@ -212634,28 +212617,26 @@ defaultUnpackr.unpackMultiple;
|
|
|
212634
212617
|
defaultUnpackr.unpack;
|
|
212635
212618
|
let f32Array = new Float32Array(1);
|
|
212636
212619
|
new Uint8Array(f32Array.buffer, 0, 4);
|
|
212637
|
-
|
|
212638
|
-
|
|
212639
|
-
|
|
212640
|
-
|
|
212641
|
-
}
|
|
212620
|
+
// Marker for downstream libraries (e.g. structon) to detect per-instance
|
|
212621
|
+
// struct-decoding hooks (this._readStruct, this._onLoadedStructures,
|
|
212622
|
+
// this._onSaveState). See `checkedRead` for the dispatch.
|
|
212623
|
+
Unpackr.SUPPORTS_STRUCT_HOOKS = true;
|
|
212642
212624
|
|
|
212643
|
-
let textEncoder
|
|
212625
|
+
let textEncoder;
|
|
212644
212626
|
try {
|
|
212645
|
-
textEncoder
|
|
212627
|
+
textEncoder = new TextEncoder();
|
|
212646
212628
|
} catch (error) {}
|
|
212647
212629
|
let extensions, extensionClasses;
|
|
212648
|
-
const hasNodeBuffer
|
|
212649
|
-
const ByteArrayAllocate = hasNodeBuffer
|
|
212650
|
-
function(length) { return Buffer.allocUnsafeSlow(length) } : Uint8Array;
|
|
212651
|
-
const ByteArray = hasNodeBuffer
|
|
212652
|
-
const MAX_BUFFER_SIZE = hasNodeBuffer
|
|
212630
|
+
const hasNodeBuffer = typeof Buffer !== 'undefined';
|
|
212631
|
+
const ByteArrayAllocate = hasNodeBuffer ?
|
|
212632
|
+
function(length) { return Buffer.allocUnsafeSlow(length); } : Uint8Array;
|
|
212633
|
+
const ByteArray = hasNodeBuffer ? Buffer : Uint8Array;
|
|
212634
|
+
const MAX_BUFFER_SIZE = hasNodeBuffer ? 0x100000000 : 0x7fd00000;
|
|
212653
212635
|
let target, keysTarget;
|
|
212654
212636
|
let targetView;
|
|
212655
212637
|
let position = 0;
|
|
212656
212638
|
let safeEnd;
|
|
212657
212639
|
let bundledStrings = null;
|
|
212658
|
-
let writeStructSlots;
|
|
212659
212640
|
const MAX_BUNDLE_SIZE = 0x5500; // maximum characters such that the encoded bytes fits in 16 bits.
|
|
212660
212641
|
const hasNonLatin = /[\u0080-\uFFFF]/;
|
|
212661
212642
|
const RECORD_SYMBOL = Symbol('record-id');
|
|
@@ -212668,10 +212649,10 @@ class Packr extends Unpackr {
|
|
|
212668
212649
|
let structures;
|
|
212669
212650
|
let referenceMap;
|
|
212670
212651
|
let encodeUtf8 = ByteArray.prototype.utf8Write ? function(string, position) {
|
|
212671
|
-
return target.utf8Write(string, position, target.byteLength - position)
|
|
212672
|
-
} : (textEncoder
|
|
212652
|
+
return target.utf8Write(string, position, target.byteLength - position);
|
|
212653
|
+
} : (textEncoder && textEncoder.encodeInto) ?
|
|
212673
212654
|
function(string, position) {
|
|
212674
|
-
return textEncoder
|
|
212655
|
+
return textEncoder.encodeInto(string, target.subarray(position)).written;
|
|
212675
212656
|
} : false;
|
|
212676
212657
|
|
|
212677
212658
|
let packr = this;
|
|
@@ -212683,7 +212664,7 @@ class Packr extends Unpackr {
|
|
|
212683
212664
|
if (maxSharedStructures == null)
|
|
212684
212665
|
maxSharedStructures = hasSharedStructures ? 32 : 0;
|
|
212685
212666
|
if (maxSharedStructures > 8160)
|
|
212686
|
-
throw new Error('Maximum maxSharedStructure is 8160')
|
|
212667
|
+
throw new Error('Maximum maxSharedStructure is 8160');
|
|
212687
212668
|
if (options.structuredClone && options.moreTypes == undefined) {
|
|
212688
212669
|
this.moreTypes = true;
|
|
212689
212670
|
}
|
|
@@ -212697,7 +212678,7 @@ class Packr extends Unpackr {
|
|
|
212697
212678
|
let sharedLimitId = maxSharedStructures + 0x40;
|
|
212698
212679
|
let maxStructureId = maxSharedStructures + maxOwnStructures + 0x40;
|
|
212699
212680
|
if (maxStructureId > 8256) {
|
|
212700
|
-
throw new Error('Maximum maxSharedStructure + maxOwnStructure is 8192')
|
|
212681
|
+
throw new Error('Maximum maxSharedStructure + maxOwnStructure is 8192');
|
|
212701
212682
|
}
|
|
212702
212683
|
let recordIdsToRemove = [];
|
|
212703
212684
|
let transitionsCount = 0;
|
|
@@ -212733,7 +212714,7 @@ class Packr extends Unpackr {
|
|
|
212733
212714
|
let sharedLength = structures.sharedLength || 0;
|
|
212734
212715
|
if (sharedLength > maxSharedStructures) {
|
|
212735
212716
|
//if (maxSharedStructures <= 32 && structures.sharedLength > 32) // TODO: could support this, but would need to update the limit ids
|
|
212736
|
-
throw new Error('Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to ' + structures.sharedLength)
|
|
212717
|
+
throw new Error('Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to ' + structures.sharedLength);
|
|
212737
212718
|
}
|
|
212738
212719
|
if (!structures.transitions) {
|
|
212739
212720
|
// rebuild our structure transitions
|
|
@@ -212741,7 +212722,7 @@ class Packr extends Unpackr {
|
|
|
212741
212722
|
for (let i = 0; i < sharedLength; i++) {
|
|
212742
212723
|
let keys = structures[i];
|
|
212743
212724
|
if (!keys)
|
|
212744
|
-
continue
|
|
212725
|
+
continue;
|
|
212745
212726
|
let nextTransition, transition = structures.transitions;
|
|
212746
212727
|
for (let j = 0, l = keys.length; j < l; j++) {
|
|
212747
212728
|
let key = keys[j];
|
|
@@ -212763,7 +212744,7 @@ class Packr extends Unpackr {
|
|
|
212763
212744
|
hasSharedUpdate = false;
|
|
212764
212745
|
let encodingError;
|
|
212765
212746
|
try {
|
|
212766
|
-
if (packr.
|
|
212747
|
+
if (packr._writeStruct && value && typeof value === 'object') {
|
|
212767
212748
|
if (value.constructor === Object) writeStruct(value); // simple object
|
|
212768
212749
|
else if (value.constructor !== Map && !Array.isArray(value) && !extensionClasses.some(extClass => value instanceof extClass)) {
|
|
212769
212750
|
// allow user classes, if they don't need special handling (but do use toJSON if available)
|
|
@@ -212807,15 +212788,15 @@ class Packr extends Unpackr {
|
|
|
212807
212788
|
packr.offset = position;
|
|
212808
212789
|
let serialized = insertIds(target.subarray(start, position), idsToInsert);
|
|
212809
212790
|
referenceMap = null;
|
|
212810
|
-
return serialized
|
|
212791
|
+
return serialized;
|
|
212811
212792
|
}
|
|
212812
212793
|
packr.offset = position; // update the offset so next serialization doesn't write over our buffer, but can continue writing to same buffer sequentially
|
|
212813
212794
|
if (encodeOptions & REUSE_BUFFER_MODE) {
|
|
212814
212795
|
target.start = start;
|
|
212815
212796
|
target.end = position;
|
|
212816
|
-
return target
|
|
212797
|
+
return target;
|
|
212817
212798
|
}
|
|
212818
|
-
return target.subarray(start, position) // position can change if we call pack again in saveStructures, so we get the buffer now
|
|
212799
|
+
return target.subarray(start, position); // position can change if we call pack again in saveStructures, so we get the buffer now
|
|
212819
212800
|
} catch(error) {
|
|
212820
212801
|
encodingError = error;
|
|
212821
212802
|
throw error;
|
|
@@ -212826,16 +212807,16 @@ class Packr extends Unpackr {
|
|
|
212826
212807
|
let sharedLength = structures.sharedLength || 0;
|
|
212827
212808
|
// we can't rely on start/end with REUSE_BUFFER_MODE since they will (probably) change when we save
|
|
212828
212809
|
let returnBuffer = target.subarray(start, position);
|
|
212829
|
-
let newSharedData = prepareStructures
|
|
212810
|
+
let newSharedData = (packr._prepareStructures || prepareStructures)(structures, packr);
|
|
212830
212811
|
if (!encodingError) { // TODO: If there is an encoding error, should make the structures as uninitialized so they get rebuilt next time
|
|
212831
212812
|
if (packr.saveStructures(newSharedData, newSharedData.isCompatible) === false) {
|
|
212832
212813
|
// get updated structures and try again if the update failed
|
|
212833
|
-
return packr.pack(value, encodeOptions)
|
|
212814
|
+
return packr.pack(value, encodeOptions);
|
|
212834
212815
|
}
|
|
212835
212816
|
packr.lastNamedStructuresLength = sharedLength;
|
|
212836
212817
|
// don't keep large buffers around
|
|
212837
212818
|
if (target.length > 0x40000000) target = null;
|
|
212838
|
-
return returnBuffer
|
|
212819
|
+
return returnBuffer;
|
|
212839
212820
|
}
|
|
212840
212821
|
}
|
|
212841
212822
|
}
|
|
@@ -212921,7 +212902,7 @@ class Packr extends Unpackr {
|
|
|
212921
212902
|
bundledStrings[twoByte ? 0 : 1] += value;
|
|
212922
212903
|
target[position++] = 0xc1;
|
|
212923
212904
|
pack(twoByte ? -strLength : strLength);
|
|
212924
|
-
return
|
|
212905
|
+
return;
|
|
212925
212906
|
}
|
|
212926
212907
|
let headerSize;
|
|
212927
212908
|
// first we estimate the header size, so we can write to the correct location
|
|
@@ -212995,7 +212976,7 @@ class Packr extends Unpackr {
|
|
|
212995
212976
|
} else if (type === 'number') {
|
|
212996
212977
|
if (value >>> 0 === value) {// positive integer, 32-bit or less
|
|
212997
212978
|
// positive uint
|
|
212998
|
-
if (value < 0x20 || (value < 0x80 && this.useRecords === false) || (value < 0x40 && !this.
|
|
212979
|
+
if (value < 0x20 || (value < 0x80 && this.useRecords === false) || (value < 0x40 && !this._writeStruct)) {
|
|
212999
212980
|
target[position++] = value;
|
|
213000
212981
|
} else if (value < 0x100) {
|
|
213001
212982
|
target[position++] = 0xcc;
|
|
@@ -213034,7 +213015,7 @@ class Packr extends Unpackr {
|
|
|
213034
213015
|
// this checks for rounding of numbers that were encoded in 32-bit float to nearest significant decimal digit that could be preserved
|
|
213035
213016
|
((xShifted = value * mult10[((target[position] & 0x7f) << 1) | (target[position + 1] >> 7)]) >> 0) === xShifted) {
|
|
213036
213017
|
position += 4;
|
|
213037
|
-
return
|
|
213018
|
+
return;
|
|
213038
213019
|
} else
|
|
213039
213020
|
position--; // move back into position for writing a double
|
|
213040
213021
|
}
|
|
@@ -213057,7 +213038,7 @@ class Packr extends Unpackr {
|
|
|
213057
213038
|
target[position++] = 0x70; // "p" for pointer
|
|
213058
213039
|
targetView.setUint32(position, referee.id);
|
|
213059
213040
|
position += 4;
|
|
213060
|
-
return
|
|
213041
|
+
return;
|
|
213061
213042
|
} else
|
|
213062
213043
|
referenceMap.set(value, { offset: position - start });
|
|
213063
213044
|
}
|
|
@@ -213107,7 +213088,7 @@ class Packr extends Unpackr {
|
|
|
213107
213088
|
} else {
|
|
213108
213089
|
pack(writeResult);
|
|
213109
213090
|
}
|
|
213110
|
-
return
|
|
213091
|
+
return;
|
|
213111
213092
|
}
|
|
213112
213093
|
let currentTarget = target;
|
|
213113
213094
|
let currentTargetView = targetView;
|
|
@@ -213124,7 +213105,7 @@ class Packr extends Unpackr {
|
|
|
213124
213105
|
makeRoom(position);
|
|
213125
213106
|
return {
|
|
213126
213107
|
target, targetView, position: position - size
|
|
213127
|
-
}
|
|
213108
|
+
};
|
|
213128
213109
|
}, pack);
|
|
213129
213110
|
} finally {
|
|
213130
213111
|
// restore current target information (unless already restored)
|
|
@@ -213140,7 +213121,7 @@ class Packr extends Unpackr {
|
|
|
213140
213121
|
makeRoom(result.length + position);
|
|
213141
213122
|
position = writeExtensionData(result, target, position, extension.type);
|
|
213142
213123
|
}
|
|
213143
|
-
return
|
|
213124
|
+
return;
|
|
213144
213125
|
}
|
|
213145
213126
|
}
|
|
213146
213127
|
// check isArray after extensions, because extensions can extend Array
|
|
@@ -213152,7 +213133,7 @@ class Packr extends Unpackr {
|
|
|
213152
213133
|
const json = value.toJSON();
|
|
213153
213134
|
// if for some reason value.toJSON returns itself it'll loop forever
|
|
213154
213135
|
if (json !== value)
|
|
213155
|
-
return pack(json)
|
|
213136
|
+
return pack(json);
|
|
213156
213137
|
}
|
|
213157
213138
|
|
|
213158
213139
|
// if there is a writeFunction, use it, otherwise just encode as undefined
|
|
@@ -213191,7 +213172,7 @@ class Packr extends Unpackr {
|
|
|
213191
213172
|
let chunks = [];
|
|
213192
213173
|
while (true) {
|
|
213193
213174
|
chunks.push(value & mask);
|
|
213194
|
-
if ((value >> BigInt(63)) === empty) break
|
|
213175
|
+
if ((value >> BigInt(63)) === empty) break;
|
|
213195
213176
|
value >>= BigInt(64);
|
|
213196
213177
|
}
|
|
213197
213178
|
|
|
@@ -213206,7 +213187,7 @@ class Packr extends Unpackr {
|
|
|
213206
213187
|
string = '00' + string;
|
|
213207
213188
|
}
|
|
213208
213189
|
|
|
213209
|
-
if (hasNodeBuffer
|
|
213190
|
+
if (hasNodeBuffer) {
|
|
213210
213191
|
array = Buffer.from(string, 'hex');
|
|
213211
213192
|
} else {
|
|
213212
213193
|
array = new Uint8Array(string.length / 2);
|
|
@@ -213223,11 +213204,11 @@ class Packr extends Unpackr {
|
|
|
213223
213204
|
if (array.length + position > safeEnd)
|
|
213224
213205
|
makeRoom(array.length + position);
|
|
213225
213206
|
position = writeExtensionData(array, target, position, 0x42);
|
|
213226
|
-
return
|
|
213207
|
+
return;
|
|
213227
213208
|
} else {
|
|
213228
213209
|
throw new RangeError(value + ' was too large to fit in MessagePack 64-bit integer format, use' +
|
|
213229
213210
|
' useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set' +
|
|
213230
|
-
' largeBigIntToString to convert to string')
|
|
213211
|
+
' largeBigIntToString to convert to string');
|
|
213231
213212
|
}
|
|
213232
213213
|
}
|
|
213233
213214
|
position += 8;
|
|
@@ -213240,7 +213221,7 @@ class Packr extends Unpackr {
|
|
|
213240
213221
|
target[position++] = 0;
|
|
213241
213222
|
}
|
|
213242
213223
|
} else {
|
|
213243
|
-
throw new Error('Unknown type: ' + type)
|
|
213224
|
+
throw new Error('Unknown type: ' + type);
|
|
213244
213225
|
}
|
|
213245
213226
|
};
|
|
213246
213227
|
|
|
@@ -213386,12 +213367,30 @@ class Packr extends Unpackr {
|
|
|
213386
213367
|
checkUseRecords(object) ? writeRecord(object) : writePlainObject(object);
|
|
213387
213368
|
} : writeRecord;
|
|
213388
213369
|
|
|
213370
|
+
const writeStruct = (object) => {
|
|
213371
|
+
let newPosition = packr._writeStruct(object, target, start, position, structures, makeRoom, (value, newPosition, notifySharedUpdate) => {
|
|
213372
|
+
if (notifySharedUpdate)
|
|
213373
|
+
return hasSharedUpdate = true;
|
|
213374
|
+
position = newPosition;
|
|
213375
|
+
let startTarget = target;
|
|
213376
|
+
pack(value);
|
|
213377
|
+
resetStructures();
|
|
213378
|
+
if (startTarget !== target) {
|
|
213379
|
+
return { position, targetView, target }; // indicate the buffer was re-allocated
|
|
213380
|
+
}
|
|
213381
|
+
return position;
|
|
213382
|
+
});
|
|
213383
|
+
if (newPosition === 0) // bail and go to a msgpack object
|
|
213384
|
+
return writeObject(object);
|
|
213385
|
+
position = newPosition;
|
|
213386
|
+
};
|
|
213387
|
+
|
|
213389
213388
|
const makeRoom = (end) => {
|
|
213390
213389
|
let newSize;
|
|
213391
213390
|
if (end > 0x1000000) {
|
|
213392
213391
|
// special handling for really large buffers
|
|
213393
213392
|
if ((end - start) > MAX_BUFFER_SIZE)
|
|
213394
|
-
throw new Error('Packed buffer would be larger than maximum buffer size')
|
|
213393
|
+
throw new Error('Packed buffer would be larger than maximum buffer size');
|
|
213395
213394
|
newSize = Math.min(MAX_BUFFER_SIZE,
|
|
213396
213395
|
Math.round(Math.max((end - start) * (end > 0x4000000 ? 1.25 : 2), 0x400000) / 0x1000) * 0x1000);
|
|
213397
213396
|
} else // faster handling for smaller buffers
|
|
@@ -213406,7 +213405,7 @@ class Packr extends Unpackr {
|
|
|
213406
213405
|
position -= start;
|
|
213407
213406
|
start = 0;
|
|
213408
213407
|
safeEnd = newBuffer.length - 10;
|
|
213409
|
-
return target = newBuffer
|
|
213408
|
+
return target = newBuffer;
|
|
213410
213409
|
};
|
|
213411
213410
|
const newRecord = (transition, keys, newTransitions) => {
|
|
213412
213411
|
let recordId = structures.nextId;
|
|
@@ -213488,23 +213487,6 @@ class Packr extends Unpackr {
|
|
|
213488
213487
|
target[insertionOffset + start] = keysTarget[0];
|
|
213489
213488
|
}
|
|
213490
213489
|
};
|
|
213491
|
-
const writeStruct = (object) => {
|
|
213492
|
-
let newPosition = writeStructSlots(object, target, start, position, structures, makeRoom, (value, newPosition, notifySharedUpdate) => {
|
|
213493
|
-
if (notifySharedUpdate)
|
|
213494
|
-
return hasSharedUpdate = true;
|
|
213495
|
-
position = newPosition;
|
|
213496
|
-
let startTarget = target;
|
|
213497
|
-
pack(value);
|
|
213498
|
-
resetStructures();
|
|
213499
|
-
if (startTarget !== target) {
|
|
213500
|
-
return { position, targetView, target }; // indicate the buffer was re-allocated
|
|
213501
|
-
}
|
|
213502
|
-
return position;
|
|
213503
|
-
}, this);
|
|
213504
|
-
if (newPosition === 0) // bail and go to a msgpack object
|
|
213505
|
-
return writeObject(object);
|
|
213506
|
-
position = newPosition;
|
|
213507
|
-
};
|
|
213508
213490
|
}
|
|
213509
213491
|
useBuffer(buffer) {
|
|
213510
213492
|
// this means we are finished using our own buffer and we can write over it safely
|
|
@@ -213547,7 +213529,7 @@ extensions = [{
|
|
|
213547
213529
|
} else if (isNaN(seconds)) {
|
|
213548
213530
|
if (this.onInvalidDate) {
|
|
213549
213531
|
allocateForWrite(0);
|
|
213550
|
-
return pack(this.onInvalidDate())
|
|
213532
|
+
return pack(this.onInvalidDate());
|
|
213551
213533
|
}
|
|
213552
213534
|
// Intentionally invalid timestamp
|
|
213553
213535
|
let { target, targetView, position} = allocateForWrite(3);
|
|
@@ -213568,7 +213550,7 @@ extensions = [{
|
|
|
213568
213550
|
pack(set, allocateForWrite, pack) {
|
|
213569
213551
|
if (this.setAsEmptyObject) {
|
|
213570
213552
|
allocateForWrite(0);
|
|
213571
|
-
return pack({})
|
|
213553
|
+
return pack({});
|
|
213572
213554
|
}
|
|
213573
213555
|
let array = Array.from(set);
|
|
213574
213556
|
let { target, position} = allocateForWrite(this.moreTypes ? 3 : 0);
|
|
@@ -213604,7 +213586,7 @@ extensions = [{
|
|
|
213604
213586
|
if (this.moreTypes)
|
|
213605
213587
|
writeExtBuffer(arrayBuffer, 0x10, allocateForWrite);
|
|
213606
213588
|
else
|
|
213607
|
-
writeBuffer(hasNodeBuffer
|
|
213589
|
+
writeBuffer(hasNodeBuffer ? Buffer.from(arrayBuffer) : new Uint8Array(arrayBuffer), allocateForWrite);
|
|
213608
213590
|
}
|
|
213609
213591
|
}, {
|
|
213610
213592
|
pack(typedArray, allocateForWrite) {
|
|
@@ -213619,7 +213601,7 @@ extensions = [{
|
|
|
213619
213601
|
if (this.moreTypes)
|
|
213620
213602
|
writeExtBuffer(arrayBuffer, 0x11, allocateForWrite);
|
|
213621
213603
|
else
|
|
213622
|
-
writeBuffer(hasNodeBuffer
|
|
213604
|
+
writeBuffer(hasNodeBuffer ? Buffer.from(arrayBuffer) : new Uint8Array(arrayBuffer), allocateForWrite);
|
|
213623
213605
|
}
|
|
213624
213606
|
}, {
|
|
213625
213607
|
pack(c1, allocateForWrite) { // specific 0xC1 object
|
|
@@ -213676,19 +213658,19 @@ function writeExtensionData(result, target, position, type) {
|
|
|
213676
213658
|
switch (length) {
|
|
213677
213659
|
case 1:
|
|
213678
213660
|
target[position++] = 0xd4;
|
|
213679
|
-
break
|
|
213661
|
+
break;
|
|
213680
213662
|
case 2:
|
|
213681
213663
|
target[position++] = 0xd5;
|
|
213682
|
-
break
|
|
213664
|
+
break;
|
|
213683
213665
|
case 4:
|
|
213684
213666
|
target[position++] = 0xd6;
|
|
213685
|
-
break
|
|
213667
|
+
break;
|
|
213686
213668
|
case 8:
|
|
213687
213669
|
target[position++] = 0xd7;
|
|
213688
|
-
break
|
|
213670
|
+
break;
|
|
213689
213671
|
case 16:
|
|
213690
213672
|
target[position++] = 0xd8;
|
|
213691
|
-
break
|
|
213673
|
+
break;
|
|
213692
213674
|
default:
|
|
213693
213675
|
if (length < 0x100) {
|
|
213694
213676
|
target[position++] = 0xc7;
|
|
@@ -213708,7 +213690,7 @@ function writeExtensionData(result, target, position, type) {
|
|
|
213708
213690
|
target[position++] = type;
|
|
213709
213691
|
target.set(result, position);
|
|
213710
213692
|
position += length;
|
|
213711
|
-
return position
|
|
213693
|
+
return position;
|
|
213712
213694
|
}
|
|
213713
213695
|
|
|
213714
213696
|
function insertIds(serialized, idsToInsert) {
|
|
@@ -213730,7 +213712,7 @@ function insertIds(serialized, idsToInsert) {
|
|
|
213730
213712
|
serialized[position++] = id & 0xff;
|
|
213731
213713
|
lastEnd = offset;
|
|
213732
213714
|
}
|
|
213733
|
-
return serialized
|
|
213715
|
+
return serialized;
|
|
213734
213716
|
}
|
|
213735
213717
|
|
|
213736
213718
|
function writeBundles(start, pack, incrementPosition) {
|
|
@@ -213743,20 +213725,21 @@ function writeBundles(start, pack, incrementPosition) {
|
|
|
213743
213725
|
pack(writeStrings[1]);
|
|
213744
213726
|
}
|
|
213745
213727
|
}
|
|
213746
|
-
function prepareStructures
|
|
213728
|
+
function prepareStructures(structures, packr) {
|
|
213747
213729
|
structures.isCompatible = (existingStructures) => {
|
|
213748
213730
|
let compatible = !existingStructures || ((packr.lastNamedStructuresLength || 0) === existingStructures.length);
|
|
213749
213731
|
if (!compatible) // we want to merge these existing structures immediately since we already have it and we are in the right transaction
|
|
213750
213732
|
packr._mergeStructures(existingStructures);
|
|
213751
213733
|
return compatible;
|
|
213752
213734
|
};
|
|
213753
|
-
return structures
|
|
213754
|
-
}
|
|
213755
|
-
function setWriteStructSlots(writeSlots, makeStructures) {
|
|
213756
|
-
writeStructSlots = writeSlots;
|
|
213757
|
-
prepareStructures$1 = makeStructures;
|
|
213735
|
+
return structures;
|
|
213758
213736
|
}
|
|
213759
213737
|
|
|
213738
|
+
// Marker for downstream libraries (e.g. structon) to detect that this Packr
|
|
213739
|
+
// supports per-instance struct-encoding hooks (this._writeStruct,
|
|
213740
|
+
// this._prepareStructures). See `pack` for the dispatch.
|
|
213741
|
+
Packr.SUPPORTS_STRUCT_HOOKS = true;
|
|
213742
|
+
|
|
213760
213743
|
let defaultPackr = new Packr({ useRecords: false });
|
|
213761
213744
|
defaultPackr.pack;
|
|
213762
213745
|
defaultPackr.pack;
|
|
@@ -213764,779 +213747,6 @@ const REUSE_BUFFER_MODE = 512;
|
|
|
213764
213747
|
const RESET_BUFFER_MODE = 1024;
|
|
213765
213748
|
const RESERVE_START_SPACE = 2048;
|
|
213766
213749
|
|
|
213767
|
-
const ASCII = 3; // the MIBenum from https://www.iana.org/assignments/character-sets/character-sets.xhtml (and other character encodings could be referenced by MIBenum)
|
|
213768
|
-
const NUMBER = 0;
|
|
213769
|
-
const UTF8 = 2;
|
|
213770
|
-
const OBJECT_DATA = 1;
|
|
213771
|
-
const DATE = 16;
|
|
213772
|
-
const TYPE_NAMES = ['num', 'object', 'string', 'ascii'];
|
|
213773
|
-
TYPE_NAMES[DATE] = 'date';
|
|
213774
|
-
const float32Headers = [false, true, true, false, false, true, true, false];
|
|
213775
|
-
let evalSupported;
|
|
213776
|
-
try {
|
|
213777
|
-
new Function('');
|
|
213778
|
-
evalSupported = true;
|
|
213779
|
-
} catch(error) {
|
|
213780
|
-
// if eval variants are not supported, do not create inline object readers ever
|
|
213781
|
-
}
|
|
213782
|
-
|
|
213783
|
-
let updatedPosition;
|
|
213784
|
-
const hasNodeBuffer = typeof Buffer !== 'undefined';
|
|
213785
|
-
let textEncoder, currentSource;
|
|
213786
|
-
try {
|
|
213787
|
-
textEncoder = new TextEncoder();
|
|
213788
|
-
} catch (error) {}
|
|
213789
|
-
const encodeUtf8 = hasNodeBuffer ? function(target, string, position) {
|
|
213790
|
-
return target.utf8Write(string, position, target.byteLength - position)
|
|
213791
|
-
} : (textEncoder && textEncoder.encodeInto) ?
|
|
213792
|
-
function(target, string, position) {
|
|
213793
|
-
return textEncoder.encodeInto(string, target.subarray(position)).written
|
|
213794
|
-
} : false;
|
|
213795
|
-
setWriteStructSlots(writeStruct, prepareStructures);
|
|
213796
|
-
function writeStruct(object, target, encodingStart, position, structures, makeRoom, pack, packr) {
|
|
213797
|
-
let typedStructs = packr.typedStructs || (packr.typedStructs = []);
|
|
213798
|
-
// note that we rely on pack.js to load stored structures before we get to this point
|
|
213799
|
-
let targetView = target.dataView;
|
|
213800
|
-
let refsStartPosition = (typedStructs.lastStringStart || 100) + position;
|
|
213801
|
-
let safeEnd = target.length - 10;
|
|
213802
|
-
let start = position;
|
|
213803
|
-
if (position > safeEnd) {
|
|
213804
|
-
target = makeRoom(position);
|
|
213805
|
-
targetView = target.dataView;
|
|
213806
|
-
position -= encodingStart;
|
|
213807
|
-
start -= encodingStart;
|
|
213808
|
-
refsStartPosition -= encodingStart;
|
|
213809
|
-
encodingStart = 0;
|
|
213810
|
-
safeEnd = target.length - 10;
|
|
213811
|
-
}
|
|
213812
|
-
|
|
213813
|
-
let refOffset, refPosition = refsStartPosition;
|
|
213814
|
-
|
|
213815
|
-
let transition = typedStructs.transitions || (typedStructs.transitions = Object.create(null));
|
|
213816
|
-
let nextId = typedStructs.nextId || typedStructs.length;
|
|
213817
|
-
let headerSize =
|
|
213818
|
-
nextId < 0xf ? 1 :
|
|
213819
|
-
nextId < 0xf0 ? 2 :
|
|
213820
|
-
nextId < 0xf000 ? 3 :
|
|
213821
|
-
nextId < 0xf00000 ? 4 : 0;
|
|
213822
|
-
if (headerSize === 0)
|
|
213823
|
-
return 0;
|
|
213824
|
-
position += headerSize;
|
|
213825
|
-
let queuedReferences = [];
|
|
213826
|
-
let usedAscii0;
|
|
213827
|
-
let keyIndex = 0;
|
|
213828
|
-
for (let key in object) {
|
|
213829
|
-
let value = object[key];
|
|
213830
|
-
let nextTransition = transition[key];
|
|
213831
|
-
if (!nextTransition) {
|
|
213832
|
-
transition[key] = nextTransition = {
|
|
213833
|
-
key,
|
|
213834
|
-
parent: transition,
|
|
213835
|
-
enumerationOffset: 0,
|
|
213836
|
-
ascii0: null,
|
|
213837
|
-
ascii8: null,
|
|
213838
|
-
num8: null,
|
|
213839
|
-
string16: null,
|
|
213840
|
-
object16: null,
|
|
213841
|
-
num32: null,
|
|
213842
|
-
float64: null,
|
|
213843
|
-
date64: null
|
|
213844
|
-
};
|
|
213845
|
-
}
|
|
213846
|
-
if (position > safeEnd) {
|
|
213847
|
-
target = makeRoom(position);
|
|
213848
|
-
targetView = target.dataView;
|
|
213849
|
-
position -= encodingStart;
|
|
213850
|
-
start -= encodingStart;
|
|
213851
|
-
refsStartPosition -= encodingStart;
|
|
213852
|
-
refPosition -= encodingStart;
|
|
213853
|
-
encodingStart = 0;
|
|
213854
|
-
safeEnd = target.length - 10;
|
|
213855
|
-
}
|
|
213856
|
-
switch (typeof value) {
|
|
213857
|
-
case 'number':
|
|
213858
|
-
let number = value;
|
|
213859
|
-
// first check to see if we are using a lot of ids and should default to wide/common format
|
|
213860
|
-
if (nextId < 200 || !nextTransition.num64) {
|
|
213861
|
-
if (number >> 0 === number && number < 0x20000000 && number > -520093696) {
|
|
213862
|
-
if (number < 0xf6 && number >= 0 && (nextTransition.num8 && !(nextId > 200 && nextTransition.num32) || number < 0x20 && !nextTransition.num32)) {
|
|
213863
|
-
transition = nextTransition.num8 || createTypeTransition(nextTransition, NUMBER, 1);
|
|
213864
|
-
target[position++] = number;
|
|
213865
|
-
} else {
|
|
213866
|
-
transition = nextTransition.num32 || createTypeTransition(nextTransition, NUMBER, 4);
|
|
213867
|
-
targetView.setUint32(position, number, true);
|
|
213868
|
-
position += 4;
|
|
213869
|
-
}
|
|
213870
|
-
break;
|
|
213871
|
-
} else if (number < 0x100000000 && number >= -2147483648) {
|
|
213872
|
-
targetView.setFloat32(position, number, true);
|
|
213873
|
-
if (float32Headers[target[position + 3] >>> 5]) {
|
|
213874
|
-
let xShifted;
|
|
213875
|
-
// this checks for rounding of numbers that were encoded in 32-bit float to nearest significant decimal digit that could be preserved
|
|
213876
|
-
if (((xShifted = number * mult10[((target[position + 3] & 0x7f) << 1) | (target[position + 2] >> 7)]) >> 0) === xShifted) {
|
|
213877
|
-
transition = nextTransition.num32 || createTypeTransition(nextTransition, NUMBER, 4);
|
|
213878
|
-
position += 4;
|
|
213879
|
-
break;
|
|
213880
|
-
}
|
|
213881
|
-
}
|
|
213882
|
-
}
|
|
213883
|
-
}
|
|
213884
|
-
transition = nextTransition.num64 || createTypeTransition(nextTransition, NUMBER, 8);
|
|
213885
|
-
targetView.setFloat64(position, number, true);
|
|
213886
|
-
position += 8;
|
|
213887
|
-
break;
|
|
213888
|
-
case 'string':
|
|
213889
|
-
let strLength = value.length;
|
|
213890
|
-
refOffset = refPosition - refsStartPosition;
|
|
213891
|
-
if ((strLength << 2) + refPosition > safeEnd) {
|
|
213892
|
-
target = makeRoom((strLength << 2) + refPosition);
|
|
213893
|
-
targetView = target.dataView;
|
|
213894
|
-
position -= encodingStart;
|
|
213895
|
-
start -= encodingStart;
|
|
213896
|
-
refsStartPosition -= encodingStart;
|
|
213897
|
-
refPosition -= encodingStart;
|
|
213898
|
-
encodingStart = 0;
|
|
213899
|
-
safeEnd = target.length - 10;
|
|
213900
|
-
}
|
|
213901
|
-
if (strLength > ((0xff00 + refOffset) >> 2)) {
|
|
213902
|
-
queuedReferences.push(key, value, position - start);
|
|
213903
|
-
break;
|
|
213904
|
-
}
|
|
213905
|
-
let isNotAscii;
|
|
213906
|
-
let strStart = refPosition;
|
|
213907
|
-
if (strLength < 0x40) {
|
|
213908
|
-
let i, c1, c2;
|
|
213909
|
-
for (i = 0; i < strLength; i++) {
|
|
213910
|
-
c1 = value.charCodeAt(i);
|
|
213911
|
-
if (c1 < 0x80) {
|
|
213912
|
-
target[refPosition++] = c1;
|
|
213913
|
-
} else if (c1 < 0x800) {
|
|
213914
|
-
isNotAscii = true;
|
|
213915
|
-
target[refPosition++] = c1 >> 6 | 0xc0;
|
|
213916
|
-
target[refPosition++] = c1 & 0x3f | 0x80;
|
|
213917
|
-
} else if (
|
|
213918
|
-
(c1 & 0xfc00) === 0xd800 &&
|
|
213919
|
-
((c2 = value.charCodeAt(i + 1)) & 0xfc00) === 0xdc00
|
|
213920
|
-
) {
|
|
213921
|
-
isNotAscii = true;
|
|
213922
|
-
c1 = 0x10000 + ((c1 & 0x03ff) << 10) + (c2 & 0x03ff);
|
|
213923
|
-
i++;
|
|
213924
|
-
target[refPosition++] = c1 >> 18 | 0xf0;
|
|
213925
|
-
target[refPosition++] = c1 >> 12 & 0x3f | 0x80;
|
|
213926
|
-
target[refPosition++] = c1 >> 6 & 0x3f | 0x80;
|
|
213927
|
-
target[refPosition++] = c1 & 0x3f | 0x80;
|
|
213928
|
-
} else {
|
|
213929
|
-
isNotAscii = true;
|
|
213930
|
-
target[refPosition++] = c1 >> 12 | 0xe0;
|
|
213931
|
-
target[refPosition++] = c1 >> 6 & 0x3f | 0x80;
|
|
213932
|
-
target[refPosition++] = c1 & 0x3f | 0x80;
|
|
213933
|
-
}
|
|
213934
|
-
}
|
|
213935
|
-
} else {
|
|
213936
|
-
refPosition += encodeUtf8(target, value, refPosition);
|
|
213937
|
-
isNotAscii = refPosition - strStart > strLength;
|
|
213938
|
-
}
|
|
213939
|
-
if (refOffset < 0xa0 || (refOffset < 0xf6 && (nextTransition.ascii8 || nextTransition.string8))) {
|
|
213940
|
-
// short strings
|
|
213941
|
-
if (isNotAscii) {
|
|
213942
|
-
if (!(transition = nextTransition.string8)) {
|
|
213943
|
-
if (typedStructs.length > 10 && (transition = nextTransition.ascii8)) {
|
|
213944
|
-
// we can safely change ascii to utf8 in place since they are compatible
|
|
213945
|
-
transition.__type = UTF8;
|
|
213946
|
-
nextTransition.ascii8 = null;
|
|
213947
|
-
nextTransition.string8 = transition;
|
|
213948
|
-
pack(null, 0, true); // special call to notify that structures have been updated
|
|
213949
|
-
} else {
|
|
213950
|
-
transition = createTypeTransition(nextTransition, UTF8, 1);
|
|
213951
|
-
}
|
|
213952
|
-
}
|
|
213953
|
-
} else if (refOffset === 0 && !usedAscii0) {
|
|
213954
|
-
usedAscii0 = true;
|
|
213955
|
-
transition = nextTransition.ascii0 || createTypeTransition(nextTransition, ASCII, 0);
|
|
213956
|
-
break; // don't increment position
|
|
213957
|
-
}// else ascii:
|
|
213958
|
-
else if (!(transition = nextTransition.ascii8) && !(typedStructs.length > 10 && (transition = nextTransition.string8)))
|
|
213959
|
-
transition = createTypeTransition(nextTransition, ASCII, 1);
|
|
213960
|
-
target[position++] = refOffset;
|
|
213961
|
-
} else {
|
|
213962
|
-
// TODO: Enable ascii16 at some point, but get the logic right
|
|
213963
|
-
//if (isNotAscii)
|
|
213964
|
-
transition = nextTransition.string16 || createTypeTransition(nextTransition, UTF8, 2);
|
|
213965
|
-
//else
|
|
213966
|
-
//transition = nextTransition.ascii16 || createTypeTransition(nextTransition, ASCII, 2);
|
|
213967
|
-
targetView.setUint16(position, refOffset, true);
|
|
213968
|
-
position += 2;
|
|
213969
|
-
}
|
|
213970
|
-
break;
|
|
213971
|
-
case 'object':
|
|
213972
|
-
if (value) {
|
|
213973
|
-
if (value.constructor === Date) {
|
|
213974
|
-
transition = nextTransition.date64 || createTypeTransition(nextTransition, DATE, 8);
|
|
213975
|
-
targetView.setFloat64(position, value.getTime(), true);
|
|
213976
|
-
position += 8;
|
|
213977
|
-
} else {
|
|
213978
|
-
queuedReferences.push(key, value, keyIndex);
|
|
213979
|
-
}
|
|
213980
|
-
break;
|
|
213981
|
-
} else { // null
|
|
213982
|
-
nextTransition = anyType(nextTransition, position, targetView, -10); // match CBOR with this
|
|
213983
|
-
if (nextTransition) {
|
|
213984
|
-
transition = nextTransition;
|
|
213985
|
-
position = updatedPosition;
|
|
213986
|
-
} else queuedReferences.push(key, value, keyIndex);
|
|
213987
|
-
}
|
|
213988
|
-
break;
|
|
213989
|
-
case 'boolean':
|
|
213990
|
-
transition = nextTransition.num8 || nextTransition.ascii8 || createTypeTransition(nextTransition, NUMBER, 1);
|
|
213991
|
-
target[position++] = value ? 0xf9 : 0xf8; // match CBOR with these
|
|
213992
|
-
break;
|
|
213993
|
-
case 'undefined':
|
|
213994
|
-
nextTransition = anyType(nextTransition, position, targetView, -9); // match CBOR with this
|
|
213995
|
-
if (nextTransition) {
|
|
213996
|
-
transition = nextTransition;
|
|
213997
|
-
position = updatedPosition;
|
|
213998
|
-
} else queuedReferences.push(key, value, keyIndex);
|
|
213999
|
-
break;
|
|
214000
|
-
default:
|
|
214001
|
-
queuedReferences.push(key, value, keyIndex);
|
|
214002
|
-
}
|
|
214003
|
-
keyIndex++;
|
|
214004
|
-
}
|
|
214005
|
-
|
|
214006
|
-
for (let i = 0, l = queuedReferences.length; i < l;) {
|
|
214007
|
-
let key = queuedReferences[i++];
|
|
214008
|
-
let value = queuedReferences[i++];
|
|
214009
|
-
let propertyIndex = queuedReferences[i++];
|
|
214010
|
-
let nextTransition = transition[key];
|
|
214011
|
-
if (!nextTransition) {
|
|
214012
|
-
transition[key] = nextTransition = {
|
|
214013
|
-
key,
|
|
214014
|
-
parent: transition,
|
|
214015
|
-
enumerationOffset: propertyIndex - keyIndex,
|
|
214016
|
-
ascii0: null,
|
|
214017
|
-
ascii8: null,
|
|
214018
|
-
num8: null,
|
|
214019
|
-
string16: null,
|
|
214020
|
-
object16: null,
|
|
214021
|
-
num32: null,
|
|
214022
|
-
float64: null
|
|
214023
|
-
};
|
|
214024
|
-
}
|
|
214025
|
-
let newPosition;
|
|
214026
|
-
if (value) {
|
|
214027
|
-
/*if (typeof value === 'string') { // TODO: we could re-enable long strings
|
|
214028
|
-
if (position + value.length * 3 > safeEnd) {
|
|
214029
|
-
target = makeRoom(position + value.length * 3);
|
|
214030
|
-
position -= start;
|
|
214031
|
-
targetView = target.dataView;
|
|
214032
|
-
start = 0;
|
|
214033
|
-
}
|
|
214034
|
-
newPosition = position + target.utf8Write(value, position, 0xffffffff);
|
|
214035
|
-
} else { */
|
|
214036
|
-
let size;
|
|
214037
|
-
refOffset = refPosition - refsStartPosition;
|
|
214038
|
-
if (refOffset < 0xff00) {
|
|
214039
|
-
transition = nextTransition.object16;
|
|
214040
|
-
if (transition)
|
|
214041
|
-
size = 2;
|
|
214042
|
-
else if ((transition = nextTransition.object32))
|
|
214043
|
-
size = 4;
|
|
214044
|
-
else {
|
|
214045
|
-
transition = createTypeTransition(nextTransition, OBJECT_DATA, 2);
|
|
214046
|
-
size = 2;
|
|
214047
|
-
}
|
|
214048
|
-
} else {
|
|
214049
|
-
transition = nextTransition.object32 || createTypeTransition(nextTransition, OBJECT_DATA, 4);
|
|
214050
|
-
size = 4;
|
|
214051
|
-
}
|
|
214052
|
-
newPosition = pack(value, refPosition);
|
|
214053
|
-
//}
|
|
214054
|
-
if (typeof newPosition === 'object') {
|
|
214055
|
-
// re-allocated
|
|
214056
|
-
refPosition = newPosition.position;
|
|
214057
|
-
targetView = newPosition.targetView;
|
|
214058
|
-
target = newPosition.target;
|
|
214059
|
-
refsStartPosition -= encodingStart;
|
|
214060
|
-
position -= encodingStart;
|
|
214061
|
-
start -= encodingStart;
|
|
214062
|
-
encodingStart = 0;
|
|
214063
|
-
} else
|
|
214064
|
-
refPosition = newPosition;
|
|
214065
|
-
if (size === 2) {
|
|
214066
|
-
targetView.setUint16(position, refOffset, true);
|
|
214067
|
-
position += 2;
|
|
214068
|
-
} else {
|
|
214069
|
-
targetView.setUint32(position, refOffset, true);
|
|
214070
|
-
position += 4;
|
|
214071
|
-
}
|
|
214072
|
-
} else { // null or undefined
|
|
214073
|
-
transition = nextTransition.object16 || createTypeTransition(nextTransition, OBJECT_DATA, 2);
|
|
214074
|
-
targetView.setInt16(position, value === null ? -10 : -9, true);
|
|
214075
|
-
position += 2;
|
|
214076
|
-
}
|
|
214077
|
-
keyIndex++;
|
|
214078
|
-
}
|
|
214079
|
-
|
|
214080
|
-
|
|
214081
|
-
let recordId = transition[RECORD_SYMBOL];
|
|
214082
|
-
if (recordId == null) {
|
|
214083
|
-
recordId = packr.typedStructs.length;
|
|
214084
|
-
let structure = [];
|
|
214085
|
-
let nextTransition = transition;
|
|
214086
|
-
let key, type;
|
|
214087
|
-
while ((type = nextTransition.__type) !== undefined) {
|
|
214088
|
-
let size = nextTransition.__size;
|
|
214089
|
-
nextTransition = nextTransition.__parent;
|
|
214090
|
-
key = nextTransition.key;
|
|
214091
|
-
let property = [type, size, key];
|
|
214092
|
-
if (nextTransition.enumerationOffset)
|
|
214093
|
-
property.push(nextTransition.enumerationOffset);
|
|
214094
|
-
structure.push(property);
|
|
214095
|
-
nextTransition = nextTransition.parent;
|
|
214096
|
-
}
|
|
214097
|
-
structure.reverse();
|
|
214098
|
-
transition[RECORD_SYMBOL] = recordId;
|
|
214099
|
-
packr.typedStructs[recordId] = structure;
|
|
214100
|
-
pack(null, 0, true); // special call to notify that structures have been updated
|
|
214101
|
-
}
|
|
214102
|
-
|
|
214103
|
-
|
|
214104
|
-
switch (headerSize) {
|
|
214105
|
-
case 1:
|
|
214106
|
-
if (recordId >= 0x10) return 0;
|
|
214107
|
-
target[start] = recordId + 0x20;
|
|
214108
|
-
break;
|
|
214109
|
-
case 2:
|
|
214110
|
-
if (recordId >= 0x100) return 0;
|
|
214111
|
-
target[start] = 0x38;
|
|
214112
|
-
target[start + 1] = recordId;
|
|
214113
|
-
break;
|
|
214114
|
-
case 3:
|
|
214115
|
-
if (recordId >= 0x10000) return 0;
|
|
214116
|
-
target[start] = 0x39;
|
|
214117
|
-
targetView.setUint16(start + 1, recordId, true);
|
|
214118
|
-
break;
|
|
214119
|
-
case 4:
|
|
214120
|
-
if (recordId >= 0x1000000) return 0;
|
|
214121
|
-
targetView.setUint32(start, (recordId << 8) + 0x3a, true);
|
|
214122
|
-
break;
|
|
214123
|
-
}
|
|
214124
|
-
|
|
214125
|
-
if (position < refsStartPosition) {
|
|
214126
|
-
if (refsStartPosition === refPosition)
|
|
214127
|
-
return position; // no refs
|
|
214128
|
-
// adjust positioning
|
|
214129
|
-
target.copyWithin(position, refsStartPosition, refPosition);
|
|
214130
|
-
refPosition += position - refsStartPosition;
|
|
214131
|
-
typedStructs.lastStringStart = position - start;
|
|
214132
|
-
} else if (position > refsStartPosition) {
|
|
214133
|
-
if (refsStartPosition === refPosition)
|
|
214134
|
-
return position; // no refs
|
|
214135
|
-
typedStructs.lastStringStart = position - start;
|
|
214136
|
-
return writeStruct(object, target, encodingStart, start, structures, makeRoom, pack, packr);
|
|
214137
|
-
}
|
|
214138
|
-
return refPosition;
|
|
214139
|
-
}
|
|
214140
|
-
function anyType(transition, position, targetView, value) {
|
|
214141
|
-
let nextTransition;
|
|
214142
|
-
if ((nextTransition = transition.ascii8 || transition.num8)) {
|
|
214143
|
-
targetView.setInt8(position, value, true);
|
|
214144
|
-
updatedPosition = position + 1;
|
|
214145
|
-
return nextTransition;
|
|
214146
|
-
}
|
|
214147
|
-
if ((nextTransition = transition.string16 || transition.object16)) {
|
|
214148
|
-
targetView.setInt16(position, value, true);
|
|
214149
|
-
updatedPosition = position + 2;
|
|
214150
|
-
return nextTransition;
|
|
214151
|
-
}
|
|
214152
|
-
if (nextTransition = transition.num32) {
|
|
214153
|
-
targetView.setUint32(position, 0xe0000100 + value, true);
|
|
214154
|
-
updatedPosition = position + 4;
|
|
214155
|
-
return nextTransition;
|
|
214156
|
-
}
|
|
214157
|
-
// transition.float64
|
|
214158
|
-
if (nextTransition = transition.num64) {
|
|
214159
|
-
targetView.setFloat64(position, NaN, true);
|
|
214160
|
-
targetView.setInt8(position, value);
|
|
214161
|
-
updatedPosition = position + 8;
|
|
214162
|
-
return nextTransition;
|
|
214163
|
-
}
|
|
214164
|
-
updatedPosition = position;
|
|
214165
|
-
// TODO: can we do an "any" type where we defer the decision?
|
|
214166
|
-
return;
|
|
214167
|
-
}
|
|
214168
|
-
function createTypeTransition(transition, type, size) {
|
|
214169
|
-
let typeName = TYPE_NAMES[type] + (size << 3);
|
|
214170
|
-
let newTransition = transition[typeName] || (transition[typeName] = Object.create(null));
|
|
214171
|
-
newTransition.__type = type;
|
|
214172
|
-
newTransition.__size = size;
|
|
214173
|
-
newTransition.__parent = transition;
|
|
214174
|
-
return newTransition;
|
|
214175
|
-
}
|
|
214176
|
-
function onLoadedStructures(sharedData) {
|
|
214177
|
-
if (!(sharedData instanceof Map))
|
|
214178
|
-
return sharedData;
|
|
214179
|
-
let typed = sharedData.get('typed') || [];
|
|
214180
|
-
if (Object.isFrozen(typed))
|
|
214181
|
-
typed = typed.map(structure => structure.slice(0));
|
|
214182
|
-
let named = sharedData.get('named');
|
|
214183
|
-
let transitions = Object.create(null);
|
|
214184
|
-
for (let i = 0, l = typed.length; i < l; i++) {
|
|
214185
|
-
let structure = typed[i];
|
|
214186
|
-
let transition = transitions;
|
|
214187
|
-
for (let [type, size, key] of structure) {
|
|
214188
|
-
let nextTransition = transition[key];
|
|
214189
|
-
if (!nextTransition) {
|
|
214190
|
-
transition[key] = nextTransition = {
|
|
214191
|
-
key,
|
|
214192
|
-
parent: transition,
|
|
214193
|
-
enumerationOffset: 0,
|
|
214194
|
-
ascii0: null,
|
|
214195
|
-
ascii8: null,
|
|
214196
|
-
num8: null,
|
|
214197
|
-
string16: null,
|
|
214198
|
-
object16: null,
|
|
214199
|
-
num32: null,
|
|
214200
|
-
float64: null,
|
|
214201
|
-
date64: null,
|
|
214202
|
-
};
|
|
214203
|
-
}
|
|
214204
|
-
transition = createTypeTransition(nextTransition, type, size);
|
|
214205
|
-
}
|
|
214206
|
-
transition[RECORD_SYMBOL] = i;
|
|
214207
|
-
}
|
|
214208
|
-
typed.transitions = transitions;
|
|
214209
|
-
this.typedStructs = typed;
|
|
214210
|
-
this.lastTypedStructuresLength = typed.length;
|
|
214211
|
-
return named;
|
|
214212
|
-
}
|
|
214213
|
-
var sourceSymbol = Symbol.for('source');
|
|
214214
|
-
function readStruct(src, position, srcEnd, unpackr) {
|
|
214215
|
-
let recordId = src[position++] - 0x20;
|
|
214216
|
-
if (recordId >= 24) {
|
|
214217
|
-
switch(recordId) {
|
|
214218
|
-
case 24: recordId = src[position++]; break;
|
|
214219
|
-
// little endian:
|
|
214220
|
-
case 25: recordId = src[position++] + (src[position++] << 8); break;
|
|
214221
|
-
case 26: recordId = src[position++] + (src[position++] << 8) + (src[position++] << 16); break;
|
|
214222
|
-
case 27: recordId = src[position++] + (src[position++] << 8) + (src[position++] << 16) + (src[position++] << 24); break;
|
|
214223
|
-
}
|
|
214224
|
-
}
|
|
214225
|
-
let structure = unpackr.typedStructs && unpackr.typedStructs[recordId];
|
|
214226
|
-
if (!structure) {
|
|
214227
|
-
// copy src buffer because getStructures will override it
|
|
214228
|
-
src = Uint8Array.prototype.slice.call(src, position, srcEnd);
|
|
214229
|
-
srcEnd -= position;
|
|
214230
|
-
position = 0;
|
|
214231
|
-
if (!unpackr.getStructures)
|
|
214232
|
-
throw new Error(`Reference to shared structure ${recordId} without getStructures method`);
|
|
214233
|
-
unpackr._mergeStructures(unpackr.getStructures());
|
|
214234
|
-
if (!unpackr.typedStructs)
|
|
214235
|
-
throw new Error('Could not find any shared typed structures');
|
|
214236
|
-
unpackr.lastTypedStructuresLength = unpackr.typedStructs.length;
|
|
214237
|
-
structure = unpackr.typedStructs[recordId];
|
|
214238
|
-
if (!structure)
|
|
214239
|
-
throw new Error('Could not find typed structure ' + recordId);
|
|
214240
|
-
}
|
|
214241
|
-
var construct = structure.construct;
|
|
214242
|
-
var fullConstruct = structure.fullConstruct;
|
|
214243
|
-
if (!construct) {
|
|
214244
|
-
construct = structure.construct = function LazyObject() {
|
|
214245
|
-
};
|
|
214246
|
-
fullConstruct = structure.fullConstruct = function LoadedObject() {
|
|
214247
|
-
};
|
|
214248
|
-
fullConstruct.prototype = unpackr.structPrototype || {};
|
|
214249
|
-
var prototype = construct.prototype = unpackr.structPrototype ? Object.create(unpackr.structPrototype) : {};
|
|
214250
|
-
let properties = [];
|
|
214251
|
-
let currentOffset = 0;
|
|
214252
|
-
let lastRefProperty;
|
|
214253
|
-
for (let i = 0, l = structure.length; i < l; i++) {
|
|
214254
|
-
let definition = structure[i];
|
|
214255
|
-
let [ type, size, key, enumerationOffset ] = definition;
|
|
214256
|
-
if (key === '__proto__')
|
|
214257
|
-
key = '__proto_';
|
|
214258
|
-
let property = {
|
|
214259
|
-
key,
|
|
214260
|
-
offset: currentOffset,
|
|
214261
|
-
};
|
|
214262
|
-
if (enumerationOffset)
|
|
214263
|
-
properties.splice(i + enumerationOffset, 0, property);
|
|
214264
|
-
else
|
|
214265
|
-
properties.push(property);
|
|
214266
|
-
let getRef;
|
|
214267
|
-
switch(size) { // TODO: Move into a separate function
|
|
214268
|
-
case 0: getRef = () => 0; break;
|
|
214269
|
-
case 1:
|
|
214270
|
-
getRef = (source, position) => {
|
|
214271
|
-
let ref = source.bytes[position + property.offset];
|
|
214272
|
-
return ref >= 0xf6 ? toConstant(ref) : ref;
|
|
214273
|
-
};
|
|
214274
|
-
break;
|
|
214275
|
-
case 2:
|
|
214276
|
-
getRef = (source, position) => {
|
|
214277
|
-
let src = source.bytes;
|
|
214278
|
-
let dataView = src.dataView || (src.dataView = new DataView(src.buffer, src.byteOffset, src.byteLength));
|
|
214279
|
-
let ref = dataView.getUint16(position + property.offset, true);
|
|
214280
|
-
return ref >= 0xff00 ? toConstant(ref & 0xff) : ref;
|
|
214281
|
-
};
|
|
214282
|
-
break;
|
|
214283
|
-
case 4:
|
|
214284
|
-
getRef = (source, position) => {
|
|
214285
|
-
let src = source.bytes;
|
|
214286
|
-
let dataView = src.dataView || (src.dataView = new DataView(src.buffer, src.byteOffset, src.byteLength));
|
|
214287
|
-
let ref = dataView.getUint32(position + property.offset, true);
|
|
214288
|
-
return ref >= 0xffffff00 ? toConstant(ref & 0xff) : ref;
|
|
214289
|
-
};
|
|
214290
|
-
break;
|
|
214291
|
-
}
|
|
214292
|
-
property.getRef = getRef;
|
|
214293
|
-
currentOffset += size;
|
|
214294
|
-
let get;
|
|
214295
|
-
switch(type) {
|
|
214296
|
-
case ASCII:
|
|
214297
|
-
if (lastRefProperty && !lastRefProperty.next)
|
|
214298
|
-
lastRefProperty.next = property;
|
|
214299
|
-
lastRefProperty = property;
|
|
214300
|
-
property.multiGetCount = 0;
|
|
214301
|
-
get = function(source) {
|
|
214302
|
-
let src = source.bytes;
|
|
214303
|
-
let position = source.position;
|
|
214304
|
-
let refStart = currentOffset + position;
|
|
214305
|
-
let ref = getRef(source, position);
|
|
214306
|
-
if (typeof ref !== 'number') return ref;
|
|
214307
|
-
|
|
214308
|
-
let end, next = property.next;
|
|
214309
|
-
while(next) {
|
|
214310
|
-
end = next.getRef(source, position);
|
|
214311
|
-
if (typeof end === 'number')
|
|
214312
|
-
break;
|
|
214313
|
-
else
|
|
214314
|
-
end = null;
|
|
214315
|
-
next = next.next;
|
|
214316
|
-
}
|
|
214317
|
-
if (end == null)
|
|
214318
|
-
end = source.bytesEnd - refStart;
|
|
214319
|
-
if (source.srcString) {
|
|
214320
|
-
return source.srcString.slice(ref, end);
|
|
214321
|
-
}
|
|
214322
|
-
/*if (property.multiGetCount > 0) {
|
|
214323
|
-
let asciiEnd;
|
|
214324
|
-
next = firstRefProperty;
|
|
214325
|
-
let dataView = src.dataView || (src.dataView = new DataView(src.buffer, src.byteOffset, src.byteLength));
|
|
214326
|
-
do {
|
|
214327
|
-
asciiEnd = dataView.getUint16(source.position + next.offset, true);
|
|
214328
|
-
if (asciiEnd < 0xff00)
|
|
214329
|
-
break;
|
|
214330
|
-
else
|
|
214331
|
-
asciiEnd = null;
|
|
214332
|
-
} while((next = next.next));
|
|
214333
|
-
if (asciiEnd == null)
|
|
214334
|
-
asciiEnd = source.bytesEnd - refStart
|
|
214335
|
-
source.srcString = src.toString('latin1', refStart, refStart + asciiEnd);
|
|
214336
|
-
return source.srcString.slice(ref, end);
|
|
214337
|
-
}
|
|
214338
|
-
if (source.prevStringGet) {
|
|
214339
|
-
source.prevStringGet.multiGetCount += 2;
|
|
214340
|
-
} else {
|
|
214341
|
-
source.prevStringGet = property;
|
|
214342
|
-
property.multiGetCount--;
|
|
214343
|
-
}*/
|
|
214344
|
-
return readString(src, ref + refStart, end - ref);
|
|
214345
|
-
//return src.toString('latin1', ref + refStart, end + refStart);
|
|
214346
|
-
};
|
|
214347
|
-
break;
|
|
214348
|
-
case UTF8: case OBJECT_DATA:
|
|
214349
|
-
if (lastRefProperty && !lastRefProperty.next)
|
|
214350
|
-
lastRefProperty.next = property;
|
|
214351
|
-
lastRefProperty = property;
|
|
214352
|
-
get = function(source) {
|
|
214353
|
-
let position = source.position;
|
|
214354
|
-
let refStart = currentOffset + position;
|
|
214355
|
-
let ref = getRef(source, position);
|
|
214356
|
-
if (typeof ref !== 'number') return ref;
|
|
214357
|
-
let src = source.bytes;
|
|
214358
|
-
let end, next = property.next;
|
|
214359
|
-
while(next) {
|
|
214360
|
-
end = next.getRef(source, position);
|
|
214361
|
-
if (typeof end === 'number')
|
|
214362
|
-
break;
|
|
214363
|
-
else
|
|
214364
|
-
end = null;
|
|
214365
|
-
next = next.next;
|
|
214366
|
-
}
|
|
214367
|
-
if (end == null)
|
|
214368
|
-
end = source.bytesEnd - refStart;
|
|
214369
|
-
if (type === UTF8) {
|
|
214370
|
-
return src.toString('utf8', ref + refStart, end + refStart);
|
|
214371
|
-
} else {
|
|
214372
|
-
currentSource = source;
|
|
214373
|
-
try {
|
|
214374
|
-
return unpackr.unpack(src, { start: ref + refStart, end: end + refStart });
|
|
214375
|
-
} finally {
|
|
214376
|
-
currentSource = null;
|
|
214377
|
-
}
|
|
214378
|
-
}
|
|
214379
|
-
};
|
|
214380
|
-
break;
|
|
214381
|
-
case NUMBER:
|
|
214382
|
-
switch(size) {
|
|
214383
|
-
case 4:
|
|
214384
|
-
get = function (source) {
|
|
214385
|
-
let src = source.bytes;
|
|
214386
|
-
let dataView = src.dataView || (src.dataView = new DataView(src.buffer, src.byteOffset, src.byteLength));
|
|
214387
|
-
let position = source.position + property.offset;
|
|
214388
|
-
let value = dataView.getInt32(position, true);
|
|
214389
|
-
if (value < 0x20000000) {
|
|
214390
|
-
if (value > -520093696)
|
|
214391
|
-
return value;
|
|
214392
|
-
if (value > -536870912)
|
|
214393
|
-
return toConstant(value & 0xff);
|
|
214394
|
-
}
|
|
214395
|
-
let fValue = dataView.getFloat32(position, true);
|
|
214396
|
-
// this does rounding of numbers that were encoded in 32-bit float to nearest significant decimal digit that could be preserved
|
|
214397
|
-
let multiplier = mult10[((src[position + 3] & 0x7f) << 1) | (src[position + 2] >> 7)];
|
|
214398
|
-
return ((multiplier * fValue + (fValue > 0 ? 0.5 : -0.5)) >> 0) / multiplier;
|
|
214399
|
-
};
|
|
214400
|
-
break;
|
|
214401
|
-
case 8:
|
|
214402
|
-
get = function (source) {
|
|
214403
|
-
let src = source.bytes;
|
|
214404
|
-
let dataView = src.dataView || (src.dataView = new DataView(src.buffer, src.byteOffset, src.byteLength));
|
|
214405
|
-
let value = dataView.getFloat64(source.position + property.offset, true);
|
|
214406
|
-
if (isNaN(value)) {
|
|
214407
|
-
let byte = src[source.position + property.offset];
|
|
214408
|
-
if (byte >= 0xf6)
|
|
214409
|
-
return toConstant(byte);
|
|
214410
|
-
}
|
|
214411
|
-
return value;
|
|
214412
|
-
};
|
|
214413
|
-
break;
|
|
214414
|
-
case 1:
|
|
214415
|
-
get = function (source) {
|
|
214416
|
-
let src = source.bytes;
|
|
214417
|
-
let value = src[source.position + property.offset];
|
|
214418
|
-
return value < 0xf6 ? value : toConstant(value);
|
|
214419
|
-
};
|
|
214420
|
-
break;
|
|
214421
|
-
}
|
|
214422
|
-
break;
|
|
214423
|
-
case DATE:
|
|
214424
|
-
get = function (source) {
|
|
214425
|
-
let src = source.bytes;
|
|
214426
|
-
let dataView = src.dataView || (src.dataView = new DataView(src.buffer, src.byteOffset, src.byteLength));
|
|
214427
|
-
return new Date(dataView.getFloat64(source.position + property.offset, true));
|
|
214428
|
-
};
|
|
214429
|
-
break;
|
|
214430
|
-
|
|
214431
|
-
}
|
|
214432
|
-
property.get = get;
|
|
214433
|
-
}
|
|
214434
|
-
// TODO: load the srcString for faster string decoding on toJSON
|
|
214435
|
-
if (evalSupported) {
|
|
214436
|
-
let objectLiteralProperties = [];
|
|
214437
|
-
let args = [];
|
|
214438
|
-
let i = 0;
|
|
214439
|
-
let hasInheritedProperties;
|
|
214440
|
-
for (let property of properties) { // assign in enumeration order
|
|
214441
|
-
if (unpackr.alwaysLazyProperty && unpackr.alwaysLazyProperty(property.key)) {
|
|
214442
|
-
// these properties are not eagerly evaluated and this can be used for creating properties
|
|
214443
|
-
// that are not serialized as JSON
|
|
214444
|
-
hasInheritedProperties = true;
|
|
214445
|
-
continue;
|
|
214446
|
-
}
|
|
214447
|
-
Object.defineProperty(prototype, property.key, { get: withSource(property.get), enumerable: true });
|
|
214448
|
-
let valueFunction = 'v' + i++;
|
|
214449
|
-
args.push(valueFunction);
|
|
214450
|
-
objectLiteralProperties.push('o[' + JSON.stringify(property.key) + ']=' + valueFunction + '(s)');
|
|
214451
|
-
}
|
|
214452
|
-
if (hasInheritedProperties) {
|
|
214453
|
-
objectLiteralProperties.push('__proto__:this');
|
|
214454
|
-
}
|
|
214455
|
-
let toObject = (new Function(...args, 'var c=this;return function(s){var o=new c();' + objectLiteralProperties.join(';') + ';return o;}')).apply(fullConstruct, properties.map(prop => prop.get));
|
|
214456
|
-
Object.defineProperty(prototype, 'toJSON', {
|
|
214457
|
-
value(omitUnderscoredProperties) {
|
|
214458
|
-
return toObject.call(this, this[sourceSymbol]);
|
|
214459
|
-
}
|
|
214460
|
-
});
|
|
214461
|
-
} else {
|
|
214462
|
-
Object.defineProperty(prototype, 'toJSON', {
|
|
214463
|
-
value(omitUnderscoredProperties) {
|
|
214464
|
-
// return an enumerable object with own properties to JSON stringify
|
|
214465
|
-
let resolved = {};
|
|
214466
|
-
for (let i = 0, l = properties.length; i < l; i++) {
|
|
214467
|
-
// TODO: check alwaysLazyProperty
|
|
214468
|
-
let key = properties[i].key;
|
|
214469
|
-
|
|
214470
|
-
resolved[key] = this[key];
|
|
214471
|
-
}
|
|
214472
|
-
return resolved;
|
|
214473
|
-
},
|
|
214474
|
-
// not enumerable or anything
|
|
214475
|
-
});
|
|
214476
|
-
}
|
|
214477
|
-
}
|
|
214478
|
-
var instance = new construct();
|
|
214479
|
-
instance[sourceSymbol] = {
|
|
214480
|
-
bytes: src,
|
|
214481
|
-
position,
|
|
214482
|
-
srcString: '',
|
|
214483
|
-
bytesEnd: srcEnd
|
|
214484
|
-
};
|
|
214485
|
-
return instance;
|
|
214486
|
-
}
|
|
214487
|
-
function toConstant(code) {
|
|
214488
|
-
switch(code) {
|
|
214489
|
-
case 0xf6: return null;
|
|
214490
|
-
case 0xf7: return undefined;
|
|
214491
|
-
case 0xf8: return false;
|
|
214492
|
-
case 0xf9: return true;
|
|
214493
|
-
}
|
|
214494
|
-
throw new Error('Unknown constant');
|
|
214495
|
-
}
|
|
214496
|
-
function withSource(get) {
|
|
214497
|
-
return function() {
|
|
214498
|
-
return get(this[sourceSymbol]);
|
|
214499
|
-
}
|
|
214500
|
-
}
|
|
214501
|
-
|
|
214502
|
-
function saveState() {
|
|
214503
|
-
if (currentSource) {
|
|
214504
|
-
currentSource.bytes = Uint8Array.prototype.slice.call(currentSource.bytes, currentSource.position, currentSource.bytesEnd);
|
|
214505
|
-
currentSource.position = 0;
|
|
214506
|
-
currentSource.bytesEnd = currentSource.bytes.length;
|
|
214507
|
-
}
|
|
214508
|
-
}
|
|
214509
|
-
function prepareStructures(structures, packr) {
|
|
214510
|
-
if (packr.typedStructs) {
|
|
214511
|
-
let structMap = new Map();
|
|
214512
|
-
structMap.set('named', structures);
|
|
214513
|
-
structMap.set('typed', packr.typedStructs);
|
|
214514
|
-
structures = structMap;
|
|
214515
|
-
}
|
|
214516
|
-
let lastTypedStructuresLength = packr.lastTypedStructuresLength || 0;
|
|
214517
|
-
structures.isCompatible = existing => {
|
|
214518
|
-
let compatible = true;
|
|
214519
|
-
if (existing instanceof Map) {
|
|
214520
|
-
let named = existing.get('named') || [];
|
|
214521
|
-
if (named.length !== (packr.lastNamedStructuresLength || 0))
|
|
214522
|
-
compatible = false;
|
|
214523
|
-
let typed = existing.get('typed') || [];
|
|
214524
|
-
if (typed.length !== lastTypedStructuresLength)
|
|
214525
|
-
compatible = false;
|
|
214526
|
-
} else if (existing instanceof Array || Array.isArray(existing)) {
|
|
214527
|
-
if (existing.length !== (packr.lastNamedStructuresLength || 0))
|
|
214528
|
-
compatible = false;
|
|
214529
|
-
}
|
|
214530
|
-
if (!compatible)
|
|
214531
|
-
packr._mergeStructures(existing);
|
|
214532
|
-
return compatible;
|
|
214533
|
-
};
|
|
214534
|
-
packr.lastTypedStructuresLength = packr.typedStructs && packr.typedStructs.length;
|
|
214535
|
-
return structures;
|
|
214536
|
-
}
|
|
214537
|
-
|
|
214538
|
-
setReadStruct(readStruct, onLoadedStructures, saveState);
|
|
214539
|
-
|
|
214540
213750
|
const nativeAccelerationDisabled = process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED !== undefined && process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED.toLowerCase() === 'true';
|
|
214541
213751
|
|
|
214542
213752
|
if (!nativeAccelerationDisabled) {
|
|
@@ -214553,7 +213763,7 @@ if (!nativeAccelerationDisabled) {
|
|
|
214553
213763
|
}
|
|
214554
213764
|
}
|
|
214555
213765
|
|
|
214556
|
-
const version$1 = '5.76.
|
|
213766
|
+
const version$1 = '5.76.6';
|
|
214557
213767
|
|
|
214558
213768
|
/**
|
|
214559
213769
|
* Includes all the scripts needed by the queue and jobs.
|
|
@@ -226164,6 +225374,12 @@ const overrideMessage = [
|
|
|
226164
225374
|
'and will be overridden by BullMQ.',
|
|
226165
225375
|
].join(' ');
|
|
226166
225376
|
const deprecationMessage = 'BullMQ: Your redis options maxRetriesPerRequest must be null.';
|
|
225377
|
+
const clusterReconnectPromise = Symbol('bullmqClusterReconnectPromise');
|
|
225378
|
+
const clusterPatchedForBlocking = Symbol('bullmqClusterPatchedForBlocking');
|
|
225379
|
+
const clusterOriginalBzpopmin = Symbol('bullmqClusterOriginalBzpopmin');
|
|
225380
|
+
const clusterWrappedBzpopmin = Symbol('bullmqClusterWrappedBzpopmin');
|
|
225381
|
+
const clusterPatchRefCount = Symbol('bullmqClusterPatchRefCount');
|
|
225382
|
+
const clusterClosingRefCount = Symbol('bullmqClusterClosingRefCount');
|
|
226167
225383
|
class RedisConnection extends EventEmitter {
|
|
226168
225384
|
constructor(opts, extraOptions) {
|
|
226169
225385
|
super();
|
|
@@ -226175,6 +225391,7 @@ class RedisConnection extends EventEmitter {
|
|
|
226175
225391
|
this.status = 'initializing';
|
|
226176
225392
|
this.dbType = 'redis';
|
|
226177
225393
|
this.packageVersion = version$1;
|
|
225394
|
+
this.disabledBlockingClusterReconnect = false;
|
|
226178
225395
|
// Set extra options defaults
|
|
226179
225396
|
this.extraOptions = Object.assign({ shared: false, blocking: true, skipVersionCheck: false, skipWaitingForReady: false }, extraOptions);
|
|
226180
225397
|
if (!isRedisInstance(opts)) {
|
|
@@ -226312,6 +225529,7 @@ class RedisConnection extends EventEmitter {
|
|
|
226312
225529
|
// ioredis treats connection errors as a different event ('close')
|
|
226313
225530
|
this._client.on('close', this.handleClientClose);
|
|
226314
225531
|
this._client.on('ready', this.handleClientReady);
|
|
225532
|
+
this.patchBlockingClusterClient();
|
|
226315
225533
|
if (!this.extraOptions.skipWaitingForReady) {
|
|
226316
225534
|
await RedisConnection.waitUntilReady(this._client);
|
|
226317
225535
|
}
|
|
@@ -226338,6 +225556,128 @@ class RedisConnection extends EventEmitter {
|
|
|
226338
225556
|
}
|
|
226339
225557
|
return this._client;
|
|
226340
225558
|
}
|
|
225559
|
+
patchBlockingClusterClient() {
|
|
225560
|
+
const client = this._client;
|
|
225561
|
+
const blockingClient = client;
|
|
225562
|
+
if (!this.extraOptions.blocking ||
|
|
225563
|
+
!isRedisCluster(client) ||
|
|
225564
|
+
typeof blockingClient.bzpopmin !== 'function') {
|
|
225565
|
+
return;
|
|
225566
|
+
}
|
|
225567
|
+
blockingClient[clusterPatchRefCount] =
|
|
225568
|
+
(blockingClient[clusterPatchRefCount] || 0) + 1;
|
|
225569
|
+
this.patchedBlockingClusterClient = blockingClient;
|
|
225570
|
+
if (blockingClient[clusterPatchedForBlocking]) {
|
|
225571
|
+
return;
|
|
225572
|
+
}
|
|
225573
|
+
const bzpopmin = blockingClient.bzpopmin;
|
|
225574
|
+
const wrappedBzpopmin = async (...args) => {
|
|
225575
|
+
await RedisConnection.reconnectClusterIfNeeded(blockingClient);
|
|
225576
|
+
try {
|
|
225577
|
+
return await bzpopmin.apply(blockingClient, args);
|
|
225578
|
+
}
|
|
225579
|
+
catch (error) {
|
|
225580
|
+
const commandError = error;
|
|
225581
|
+
if (RedisConnection.shouldReconnectClusterAfterError(blockingClient, commandError)) {
|
|
225582
|
+
try {
|
|
225583
|
+
await RedisConnection.reconnectCluster(blockingClient);
|
|
225584
|
+
}
|
|
225585
|
+
catch (_a) {
|
|
225586
|
+
// Preserve the original command failure if best-effort recovery fails.
|
|
225587
|
+
}
|
|
225588
|
+
}
|
|
225589
|
+
throw commandError;
|
|
225590
|
+
}
|
|
225591
|
+
};
|
|
225592
|
+
blockingClient[clusterOriginalBzpopmin] = bzpopmin;
|
|
225593
|
+
blockingClient[clusterWrappedBzpopmin] = wrappedBzpopmin;
|
|
225594
|
+
blockingClient[clusterPatchedForBlocking] = true;
|
|
225595
|
+
blockingClient.bzpopmin = wrappedBzpopmin;
|
|
225596
|
+
}
|
|
225597
|
+
disableBlockingClusterReconnect() {
|
|
225598
|
+
const client = this.patchedBlockingClusterClient;
|
|
225599
|
+
if (!client || this.disabledBlockingClusterReconnect) {
|
|
225600
|
+
return;
|
|
225601
|
+
}
|
|
225602
|
+
client[clusterClosingRefCount] = (client[clusterClosingRefCount] || 0) + 1;
|
|
225603
|
+
this.disabledBlockingClusterReconnect = true;
|
|
225604
|
+
}
|
|
225605
|
+
releaseBlockingClusterClientPatch() {
|
|
225606
|
+
const client = this.patchedBlockingClusterClient;
|
|
225607
|
+
if (!client) {
|
|
225608
|
+
return;
|
|
225609
|
+
}
|
|
225610
|
+
if (this.disabledBlockingClusterReconnect) {
|
|
225611
|
+
const closingRefCount = (client[clusterClosingRefCount] || 1) - 1;
|
|
225612
|
+
if (closingRefCount > 0) {
|
|
225613
|
+
client[clusterClosingRefCount] = closingRefCount;
|
|
225614
|
+
}
|
|
225615
|
+
else {
|
|
225616
|
+
delete client[clusterClosingRefCount];
|
|
225617
|
+
}
|
|
225618
|
+
this.disabledBlockingClusterReconnect = false;
|
|
225619
|
+
}
|
|
225620
|
+
const patchRefCount = (client[clusterPatchRefCount] || 1) - 1;
|
|
225621
|
+
if (patchRefCount > 0) {
|
|
225622
|
+
client[clusterPatchRefCount] = patchRefCount;
|
|
225623
|
+
this.patchedBlockingClusterClient = undefined;
|
|
225624
|
+
return;
|
|
225625
|
+
}
|
|
225626
|
+
if (client[clusterOriginalBzpopmin] &&
|
|
225627
|
+
client.bzpopmin === client[clusterWrappedBzpopmin]) {
|
|
225628
|
+
client.bzpopmin = client[clusterOriginalBzpopmin];
|
|
225629
|
+
}
|
|
225630
|
+
delete client[clusterPatchRefCount];
|
|
225631
|
+
delete client[clusterClosingRefCount];
|
|
225632
|
+
delete client[clusterOriginalBzpopmin];
|
|
225633
|
+
delete client[clusterWrappedBzpopmin];
|
|
225634
|
+
delete client[clusterPatchedForBlocking];
|
|
225635
|
+
this.patchedBlockingClusterClient = undefined;
|
|
225636
|
+
}
|
|
225637
|
+
static isClusterWithEmptyNodes(client) {
|
|
225638
|
+
return typeof client.nodes === 'function' && client.nodes().length === 0;
|
|
225639
|
+
}
|
|
225640
|
+
static isReconnectingDisabled(client) {
|
|
225641
|
+
const patchRefCount = client[clusterPatchRefCount] || 0;
|
|
225642
|
+
const closingRefCount = client[clusterClosingRefCount] || 0;
|
|
225643
|
+
return (patchRefCount === 0 ||
|
|
225644
|
+
closingRefCount >= patchRefCount ||
|
|
225645
|
+
client.status === 'end' ||
|
|
225646
|
+
client.status === 'closing');
|
|
225647
|
+
}
|
|
225648
|
+
static async reconnectClusterIfNeeded(client) {
|
|
225649
|
+
if (!RedisConnection.isReconnectingDisabled(client) &&
|
|
225650
|
+
RedisConnection.isClusterWithEmptyNodes(client)) {
|
|
225651
|
+
await RedisConnection.reconnectCluster(client);
|
|
225652
|
+
}
|
|
225653
|
+
}
|
|
225654
|
+
static shouldReconnectClusterAfterError(client, error) {
|
|
225655
|
+
var _a, _b;
|
|
225656
|
+
if (RedisConnection.isReconnectingDisabled(client)) {
|
|
225657
|
+
return false;
|
|
225658
|
+
}
|
|
225659
|
+
const message = [
|
|
225660
|
+
error.message,
|
|
225661
|
+
(_a = error.cause) === null || _a === void 0 ? void 0 : _a.message,
|
|
225662
|
+
(_b = error.lastNodeError) === null || _b === void 0 ? void 0 : _b.message,
|
|
225663
|
+
].join(' ');
|
|
225664
|
+
return (RedisConnection.isClusterWithEmptyNodes(client) ||
|
|
225665
|
+
/Command timed out|Failed to refresh slots cache/i.test(message));
|
|
225666
|
+
}
|
|
225667
|
+
static async reconnectCluster(client) {
|
|
225668
|
+
if (RedisConnection.isReconnectingDisabled(client)) {
|
|
225669
|
+
return;
|
|
225670
|
+
}
|
|
225671
|
+
if (!client[clusterReconnectPromise]) {
|
|
225672
|
+
client[clusterReconnectPromise] = (async () => {
|
|
225673
|
+
client.disconnect(false);
|
|
225674
|
+
await client.connect();
|
|
225675
|
+
})().finally(() => {
|
|
225676
|
+
client[clusterReconnectPromise] = null;
|
|
225677
|
+
});
|
|
225678
|
+
}
|
|
225679
|
+
await client[clusterReconnectPromise];
|
|
225680
|
+
}
|
|
226341
225681
|
async disconnect(wait = true) {
|
|
226342
225682
|
const client = await this.client;
|
|
226343
225683
|
if (client.status !== 'end') {
|
|
@@ -226372,6 +225712,7 @@ class RedisConnection extends EventEmitter {
|
|
|
226372
225712
|
const status = this.status;
|
|
226373
225713
|
this.status = 'closing';
|
|
226374
225714
|
this.closing = true;
|
|
225715
|
+
this.disableBlockingClusterReconnect();
|
|
226375
225716
|
try {
|
|
226376
225717
|
if (status === 'ready') {
|
|
226377
225718
|
// Not sure if we need to wait for this
|
|
@@ -226395,6 +225736,7 @@ class RedisConnection extends EventEmitter {
|
|
|
226395
225736
|
}
|
|
226396
225737
|
}
|
|
226397
225738
|
finally {
|
|
225739
|
+
this.releaseBlockingClusterClientPatch();
|
|
226398
225740
|
this._client.off('error', this.handleClientError);
|
|
226399
225741
|
this._client.off('close', this.handleClientClose);
|
|
226400
225742
|
this._client.off('ready', this.handleClientReady);
|
|
@@ -249771,9 +249113,15 @@ var optionsFromGlobalZodRegistry = /* @__PURE__ */ __name(() => {
|
|
|
249771
249113
|
|
|
249772
249114
|
// src/runCLI.ts
|
|
249773
249115
|
var DEFAULT_HEALTH_CHECK_PORT = 9090;
|
|
249116
|
+
function defaultScrapePortForActors(actors) {
|
|
249117
|
+
const primary = actors[0];
|
|
249118
|
+
const key = primary === "rewardRedemption" ? "rewardRedemptionApi" : primary;
|
|
249119
|
+
return DefaultMetricsScrapePorts[key] ?? DefaultMetricsScrapePorts.producer;
|
|
249120
|
+
}
|
|
249121
|
+
__name(defaultScrapePortForActors, "defaultScrapePortForActors");
|
|
249774
249122
|
var configuration;
|
|
249775
249123
|
var skipInsecureConfirm = false;
|
|
249776
|
-
var version = isDefined("1.21.
|
|
249124
|
+
var version = isDefined("1.21.2") ? "1.21.2" : "unknown";
|
|
249777
249125
|
function getConfiguration() {
|
|
249778
249126
|
return configuration;
|
|
249779
249127
|
}
|
|
@@ -249819,7 +249167,8 @@ async function getLocatorsFromConfig(actors, configuration2) {
|
|
|
249819
249167
|
if (collision) throw collision;
|
|
249820
249168
|
const walletReport = await initializeResolvedWalletReport(actors, configuration2);
|
|
249821
249169
|
logger.info(formatWalletReport(walletReport));
|
|
249822
|
-
const
|
|
249170
|
+
const serviceName = actors.length === 1 ? `xl1-${actors[0]}` : "xl1-cli";
|
|
249171
|
+
const context = await contextFromConfigWithoutLocator(config2, logger, serviceName, version, defaultScrapePortForActors(actors));
|
|
249823
249172
|
if (skipInsecureConfirm) {
|
|
249824
249173
|
logger.warn("Insecure genesis reward wallet is active. Interactive confirmation skipped via --skip-insecure-confirm.");
|
|
249825
249174
|
}
|