@dxos/hypercore 0.7.5-labs.8c02d2a → 0.7.5-labs.a8b535d
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/lib/browser/index.mjs +156 -159
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +3 -3
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +4 -4
- package/dist/lib/node-esm/index.mjs.map +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/package.json +16 -15
|
@@ -48,8 +48,8 @@ var require_last_one_wins = __commonJS({
|
|
|
48
48
|
var callback = null;
|
|
49
49
|
var callbacks = null;
|
|
50
50
|
var next = null;
|
|
51
|
-
return function(
|
|
52
|
-
next =
|
|
51
|
+
return function(val2, cb) {
|
|
52
|
+
next = val2;
|
|
53
53
|
update(cb || noop);
|
|
54
54
|
};
|
|
55
55
|
function update(cb) {
|
|
@@ -58,10 +58,10 @@ var require_last_one_wins = __commonJS({
|
|
|
58
58
|
pending.push(cb);
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
var
|
|
61
|
+
var val2 = next;
|
|
62
62
|
next = null;
|
|
63
63
|
callback = cb;
|
|
64
|
-
work(
|
|
64
|
+
work(val2, done);
|
|
65
65
|
}
|
|
66
66
|
function done(err) {
|
|
67
67
|
var cb = callback;
|
|
@@ -452,19 +452,19 @@ var require_codecs = __commonJS({
|
|
|
452
452
|
return JSON.parse(buf.toString());
|
|
453
453
|
}
|
|
454
454
|
};
|
|
455
|
-
function encodeJSON(
|
|
456
|
-
return Buffer.from(JSON.stringify(
|
|
455
|
+
function encodeJSON(val2) {
|
|
456
|
+
return Buffer.from(JSON.stringify(val2));
|
|
457
457
|
}
|
|
458
|
-
function encodeNDJSON(
|
|
459
|
-
return Buffer.from(JSON.stringify(
|
|
458
|
+
function encodeNDJSON(val2) {
|
|
459
|
+
return Buffer.from(JSON.stringify(val2) + "\n");
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
function createString(type) {
|
|
463
463
|
return {
|
|
464
464
|
name: type,
|
|
465
|
-
encode: function encodeString(
|
|
466
|
-
if (typeof
|
|
467
|
-
return Buffer.from(
|
|
465
|
+
encode: function encodeString(val2) {
|
|
466
|
+
if (typeof val2 !== "string") val2 = val2.toString();
|
|
467
|
+
return Buffer.from(val2, type);
|
|
468
468
|
},
|
|
469
469
|
decode: function decodeString(buf) {
|
|
470
470
|
return buf.toString(type);
|
|
@@ -501,27 +501,27 @@ var require_atomic_batcher = __commonJS({
|
|
|
501
501
|
running = true;
|
|
502
502
|
run(nextBatch, done);
|
|
503
503
|
}
|
|
504
|
-
function append(
|
|
504
|
+
function append(val2, cb) {
|
|
505
505
|
if (running) {
|
|
506
506
|
if (!pendingBatch) {
|
|
507
507
|
pendingBatch = [];
|
|
508
508
|
pendingCallbacks = [];
|
|
509
509
|
}
|
|
510
|
-
pushAll(pendingBatch,
|
|
510
|
+
pushAll(pendingBatch, val2);
|
|
511
511
|
if (cb) pendingCallbacks.push(cb);
|
|
512
512
|
} else {
|
|
513
513
|
if (cb) callbacks = [cb];
|
|
514
514
|
running = true;
|
|
515
|
-
run(Array.isArray(
|
|
515
|
+
run(Array.isArray(val2) ? val2 : [val2], done);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
|
-
function pushAll(list,
|
|
520
|
-
if (Array.isArray(
|
|
521
|
-
else list.push(
|
|
519
|
+
function pushAll(list, val2) {
|
|
520
|
+
if (Array.isArray(val2)) pushArray(list, val2);
|
|
521
|
+
else list.push(val2);
|
|
522
522
|
}
|
|
523
|
-
function pushArray(list,
|
|
524
|
-
for (var i = 0; i <
|
|
523
|
+
function pushArray(list, val2) {
|
|
524
|
+
for (var i = 0; i < val2.length; i++) list.push(val2[i]);
|
|
525
525
|
}
|
|
526
526
|
function callAll(list, err) {
|
|
527
527
|
for (var i = 0; i < list.length; i++) list[i](err);
|
|
@@ -1435,21 +1435,21 @@ var require_buffer_fill = __commonJS({
|
|
|
1435
1435
|
return false;
|
|
1436
1436
|
}
|
|
1437
1437
|
}();
|
|
1438
|
-
function isSingleByte(
|
|
1439
|
-
return
|
|
1438
|
+
function isSingleByte(val2) {
|
|
1439
|
+
return val2.length === 1 && val2.charCodeAt(0) < 256;
|
|
1440
1440
|
}
|
|
1441
|
-
function fillWithNumber(buffer,
|
|
1441
|
+
function fillWithNumber(buffer, val2, start, end) {
|
|
1442
1442
|
if (start < 0 || end > buffer.length) {
|
|
1443
1443
|
throw new RangeError("Out of range index");
|
|
1444
1444
|
}
|
|
1445
1445
|
start = start >>> 0;
|
|
1446
1446
|
end = end === void 0 ? buffer.length : end >>> 0;
|
|
1447
1447
|
if (end > start) {
|
|
1448
|
-
buffer.fill(
|
|
1448
|
+
buffer.fill(val2, start, end);
|
|
1449
1449
|
}
|
|
1450
1450
|
return buffer;
|
|
1451
1451
|
}
|
|
1452
|
-
function fillWithBuffer(buffer,
|
|
1452
|
+
function fillWithBuffer(buffer, val2, start, end) {
|
|
1453
1453
|
if (start < 0 || end > buffer.length) {
|
|
1454
1454
|
throw new RangeError("Out of range index");
|
|
1455
1455
|
}
|
|
@@ -1459,24 +1459,24 @@ var require_buffer_fill = __commonJS({
|
|
|
1459
1459
|
start = start >>> 0;
|
|
1460
1460
|
end = end === void 0 ? buffer.length : end >>> 0;
|
|
1461
1461
|
var pos = start;
|
|
1462
|
-
var len =
|
|
1462
|
+
var len = val2.length;
|
|
1463
1463
|
while (pos <= end - len) {
|
|
1464
|
-
|
|
1464
|
+
val2.copy(buffer, pos);
|
|
1465
1465
|
pos += len;
|
|
1466
1466
|
}
|
|
1467
1467
|
if (pos !== end) {
|
|
1468
|
-
|
|
1468
|
+
val2.copy(buffer, pos, 0, end - pos);
|
|
1469
1469
|
}
|
|
1470
1470
|
return buffer;
|
|
1471
1471
|
}
|
|
1472
|
-
function fill(buffer,
|
|
1472
|
+
function fill(buffer, val2, start, end, encoding) {
|
|
1473
1473
|
if (hasFullSupport) {
|
|
1474
|
-
return buffer.fill(
|
|
1474
|
+
return buffer.fill(val2, start, end, encoding);
|
|
1475
1475
|
}
|
|
1476
|
-
if (typeof
|
|
1477
|
-
return fillWithNumber(buffer,
|
|
1476
|
+
if (typeof val2 === "number") {
|
|
1477
|
+
return fillWithNumber(buffer, val2, start, end);
|
|
1478
1478
|
}
|
|
1479
|
-
if (typeof
|
|
1479
|
+
if (typeof val2 === "string") {
|
|
1480
1480
|
if (typeof start === "string") {
|
|
1481
1481
|
encoding = start;
|
|
1482
1482
|
start = 0;
|
|
@@ -1494,16 +1494,16 @@ var require_buffer_fill = __commonJS({
|
|
|
1494
1494
|
if (typeof encoding === "string" && !Buffer.isEncoding(encoding)) {
|
|
1495
1495
|
throw new TypeError("Unknown encoding: " + encoding);
|
|
1496
1496
|
}
|
|
1497
|
-
if (
|
|
1497
|
+
if (val2 === "") {
|
|
1498
1498
|
return fillWithNumber(buffer, 0, start, end);
|
|
1499
1499
|
}
|
|
1500
|
-
if (isSingleByte(
|
|
1501
|
-
return fillWithNumber(buffer,
|
|
1500
|
+
if (isSingleByte(val2)) {
|
|
1501
|
+
return fillWithNumber(buffer, val2.charCodeAt(0), start, end);
|
|
1502
1502
|
}
|
|
1503
|
-
|
|
1503
|
+
val2 = new Buffer(val2, encoding);
|
|
1504
1504
|
}
|
|
1505
|
-
if (Buffer.isBuffer(
|
|
1506
|
-
return fillWithBuffer(buffer,
|
|
1505
|
+
if (Buffer.isBuffer(val2)) {
|
|
1506
|
+
return fillWithBuffer(buffer, val2, start, end);
|
|
1507
1507
|
}
|
|
1508
1508
|
return fillWithNumber(buffer, 0, start, end);
|
|
1509
1509
|
}
|
|
@@ -1637,15 +1637,15 @@ var require_hypercore_cache = __commonJS({
|
|
|
1637
1637
|
}
|
|
1638
1638
|
_del(namespace, key) {
|
|
1639
1639
|
const prefixedKey = this._prefix(namespace, key);
|
|
1640
|
-
let
|
|
1641
|
-
if (
|
|
1640
|
+
let val2 = this._stale && this._stale.get(prefixedKey);
|
|
1641
|
+
if (val2) {
|
|
1642
1642
|
this._stale.delete(prefixedKey);
|
|
1643
|
-
this._staleByteSize -= this.estimateSize(
|
|
1643
|
+
this._staleByteSize -= this.estimateSize(val2);
|
|
1644
1644
|
}
|
|
1645
|
-
|
|
1646
|
-
if (
|
|
1645
|
+
val2 = this._fresh.get(prefixedKey);
|
|
1646
|
+
if (val2) {
|
|
1647
1647
|
this._fresh.delete(prefixedKey);
|
|
1648
|
-
this._freshByteSize -= this.estimateSize(
|
|
1648
|
+
this._freshByteSize -= this.estimateSize(val2);
|
|
1649
1649
|
}
|
|
1650
1650
|
}
|
|
1651
1651
|
get byteSize() {
|
|
@@ -1840,9 +1840,9 @@ var require_storage = __commonJS({
|
|
|
1840
1840
|
var hash = buf.slice(0, 32);
|
|
1841
1841
|
var size = uint64be.decode(buf, 32);
|
|
1842
1842
|
if (!size && isBlank(hash)) return cb(new Error("No node found"));
|
|
1843
|
-
var
|
|
1844
|
-
if (self.treeCache) self.treeCache.set(index,
|
|
1845
|
-
cb(null,
|
|
1843
|
+
var val2 = new Node(index, self.treeCache ? copyMaybe(hash, 40) : hash, size, null);
|
|
1844
|
+
if (self.treeCache) self.treeCache.set(index, val2);
|
|
1845
|
+
cb(null, val2);
|
|
1846
1846
|
});
|
|
1847
1847
|
};
|
|
1848
1848
|
Storage.prototype.putNodeBatch = function(index, nodes, cb) {
|
|
@@ -2244,10 +2244,10 @@ var require_nanoguard = __commonJS({
|
|
|
2244
2244
|
wait() {
|
|
2245
2245
|
this._tick++;
|
|
2246
2246
|
}
|
|
2247
|
-
continue(cb, err,
|
|
2247
|
+
continue(cb, err, val2) {
|
|
2248
2248
|
if (this._tick === 1) process.nextTick(continueNT, this);
|
|
2249
2249
|
else this._tick--;
|
|
2250
|
-
if (cb) cb(err,
|
|
2250
|
+
if (cb) cb(err, val2);
|
|
2251
2251
|
}
|
|
2252
2252
|
waitAndContinue() {
|
|
2253
2253
|
let once = false;
|
|
@@ -2259,10 +2259,10 @@ var require_nanoguard = __commonJS({
|
|
|
2259
2259
|
return true;
|
|
2260
2260
|
};
|
|
2261
2261
|
}
|
|
2262
|
-
continueSync(cb, err,
|
|
2262
|
+
continueSync(cb, err, val2) {
|
|
2263
2263
|
if (--this._tick) return;
|
|
2264
2264
|
while (this._fns !== null && this._fns.length) this._ready(this._fns.pop());
|
|
2265
|
-
if (cb) cb(err,
|
|
2265
|
+
if (cb) cb(err, val2);
|
|
2266
2266
|
}
|
|
2267
2267
|
destroy() {
|
|
2268
2268
|
const fns = this._fns;
|
|
@@ -3798,9 +3798,9 @@ var require_signed_varint = __commonJS({
|
|
|
3798
3798
|
}
|
|
3799
3799
|
});
|
|
3800
3800
|
|
|
3801
|
-
// node_modules/.pnpm/b4a@1.6.
|
|
3801
|
+
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/ascii.js
|
|
3802
3802
|
var require_ascii = __commonJS({
|
|
3803
|
-
"node_modules/.pnpm/b4a@1.6.
|
|
3803
|
+
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/ascii.js"(exports, module) {
|
|
3804
3804
|
function byteLength(string) {
|
|
3805
3805
|
return string.length;
|
|
3806
3806
|
}
|
|
@@ -3827,9 +3827,9 @@ var require_ascii = __commonJS({
|
|
|
3827
3827
|
}
|
|
3828
3828
|
});
|
|
3829
3829
|
|
|
3830
|
-
// node_modules/.pnpm/b4a@1.6.
|
|
3830
|
+
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/base64.js
|
|
3831
3831
|
var require_base64 = __commonJS({
|
|
3832
|
-
"node_modules/.pnpm/b4a@1.6.
|
|
3832
|
+
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/base64.js"(exports, module) {
|
|
3833
3833
|
var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3834
3834
|
var codes = new Uint8Array(256);
|
|
3835
3835
|
for (let i = 0; i < alphabet.length; i++) {
|
|
@@ -3864,7 +3864,7 @@ var require_base64 = __commonJS({
|
|
|
3864
3864
|
}
|
|
3865
3865
|
function write(buffer, string, offset = 0, length = byteLength(string)) {
|
|
3866
3866
|
const len = Math.min(length, buffer.byteLength - offset);
|
|
3867
|
-
for (let i = 0, j = 0;
|
|
3867
|
+
for (let i = 0, j = 0; i < len; i += 4) {
|
|
3868
3868
|
const a = codes[string.charCodeAt(i)];
|
|
3869
3869
|
const b = codes[string.charCodeAt(i + 1)];
|
|
3870
3870
|
const c = codes[string.charCodeAt(i + 2)];
|
|
@@ -3883,9 +3883,9 @@ var require_base64 = __commonJS({
|
|
|
3883
3883
|
}
|
|
3884
3884
|
});
|
|
3885
3885
|
|
|
3886
|
-
// node_modules/.pnpm/b4a@1.6.
|
|
3886
|
+
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/hex.js
|
|
3887
3887
|
var require_hex = __commonJS({
|
|
3888
|
-
"node_modules/.pnpm/b4a@1.6.
|
|
3888
|
+
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/hex.js"(exports, module) {
|
|
3889
3889
|
function byteLength(string) {
|
|
3890
3890
|
return string.length >>> 1;
|
|
3891
3891
|
}
|
|
@@ -3927,9 +3927,9 @@ var require_hex = __commonJS({
|
|
|
3927
3927
|
}
|
|
3928
3928
|
});
|
|
3929
3929
|
|
|
3930
|
-
// node_modules/.pnpm/b4a@1.6.
|
|
3930
|
+
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/utf8.js
|
|
3931
3931
|
var require_utf8 = __commonJS({
|
|
3932
|
-
"node_modules/.pnpm/b4a@1.6.
|
|
3932
|
+
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/utf8.js"(exports, module) {
|
|
3933
3933
|
function byteLength(string) {
|
|
3934
3934
|
let length = 0;
|
|
3935
3935
|
for (let i = 0, n = string.length; i < n; i++) {
|
|
@@ -4047,9 +4047,9 @@ var require_utf8 = __commonJS({
|
|
|
4047
4047
|
}
|
|
4048
4048
|
});
|
|
4049
4049
|
|
|
4050
|
-
// node_modules/.pnpm/b4a@1.6.
|
|
4050
|
+
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/utf16le.js
|
|
4051
4051
|
var require_utf16le = __commonJS({
|
|
4052
|
-
"node_modules/.pnpm/b4a@1.6.
|
|
4052
|
+
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/lib/utf16le.js"(exports, module) {
|
|
4053
4053
|
function byteLength(string) {
|
|
4054
4054
|
return string.length * 2;
|
|
4055
4055
|
}
|
|
@@ -4082,9 +4082,9 @@ var require_utf16le = __commonJS({
|
|
|
4082
4082
|
}
|
|
4083
4083
|
});
|
|
4084
4084
|
|
|
4085
|
-
// node_modules/.pnpm/b4a@1.6.
|
|
4085
|
+
// node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/browser.js
|
|
4086
4086
|
var require_browser2 = __commonJS({
|
|
4087
|
-
"node_modules/.pnpm/b4a@1.6.
|
|
4087
|
+
"node_modules/.pnpm/b4a@1.6.0/node_modules/b4a/browser.js"(exports, module) {
|
|
4088
4088
|
var ascii = require_ascii();
|
|
4089
4089
|
var base64 = require_base64();
|
|
4090
4090
|
var hex = require_hex();
|
|
@@ -4125,7 +4125,7 @@ var require_browser2 = __commonJS({
|
|
|
4125
4125
|
}
|
|
4126
4126
|
function alloc(size, fill2, encoding) {
|
|
4127
4127
|
const buffer = new Uint8Array(size);
|
|
4128
|
-
if (fill2 !== void 0)
|
|
4128
|
+
if (fill2 !== void 0) fill2(buffer, fill2, 0, buffer.byteLength, encoding);
|
|
4129
4129
|
return buffer;
|
|
4130
4130
|
}
|
|
4131
4131
|
function allocUnsafe(size) {
|
|
@@ -4161,16 +4161,13 @@ var require_browser2 = __commonJS({
|
|
|
4161
4161
|
totalLength = buffers.reduce((len, buffer) => len + buffer.byteLength, 0);
|
|
4162
4162
|
}
|
|
4163
4163
|
const result = new Uint8Array(totalLength);
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
result.set(buffer, offset);
|
|
4172
|
-
offset += buffer.byteLength;
|
|
4173
|
-
}
|
|
4164
|
+
buffers.reduce(
|
|
4165
|
+
(offset, buffer) => {
|
|
4166
|
+
result.set(buffer, offset);
|
|
4167
|
+
return offset + buffer.byteLength;
|
|
4168
|
+
},
|
|
4169
|
+
0
|
|
4170
|
+
);
|
|
4174
4171
|
return result;
|
|
4175
4172
|
}
|
|
4176
4173
|
function copy(source, target, targetStart = 0, start = 0, end = source.byteLength) {
|
|
@@ -4218,9 +4215,9 @@ var require_browser2 = __commonJS({
|
|
|
4218
4215
|
encoding = end;
|
|
4219
4216
|
end = buffer.byteLength;
|
|
4220
4217
|
}
|
|
4221
|
-
} else if (typeof
|
|
4218
|
+
} else if (typeof val === "number") {
|
|
4222
4219
|
value = value & 255;
|
|
4223
|
-
} else if (typeof
|
|
4220
|
+
} else if (typeof val === "boolean") {
|
|
4224
4221
|
value = +value;
|
|
4225
4222
|
}
|
|
4226
4223
|
if (offset < 0 || buffer.byteLength < offset || buffer.byteLength < end) {
|
|
@@ -4446,7 +4443,7 @@ var require_browser2 = __commonJS({
|
|
|
4446
4443
|
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
4447
4444
|
return view.getInt32(offset, true);
|
|
4448
4445
|
}
|
|
4449
|
-
module.exports =
|
|
4446
|
+
module.exports = {
|
|
4450
4447
|
isBuffer,
|
|
4451
4448
|
isEncoding,
|
|
4452
4449
|
alloc,
|
|
@@ -4514,13 +4511,13 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4514
4511
|
};
|
|
4515
4512
|
exports.bytes = encoder(
|
|
4516
4513
|
2,
|
|
4517
|
-
function encode(
|
|
4514
|
+
function encode(val2, buffer, offset) {
|
|
4518
4515
|
var oldOffset = offset;
|
|
4519
|
-
var len = bufferLength(
|
|
4516
|
+
var len = bufferLength(val2);
|
|
4520
4517
|
varint.encode(len, buffer, offset);
|
|
4521
4518
|
offset += varint.encode.bytes;
|
|
4522
|
-
if (b4a.isBuffer(
|
|
4523
|
-
else b4a.write(buffer,
|
|
4519
|
+
if (b4a.isBuffer(val2)) b4a.copy(val2, buffer, offset);
|
|
4520
|
+
else b4a.write(buffer, val2, offset, len);
|
|
4524
4521
|
offset += len;
|
|
4525
4522
|
encode.bytes = offset - oldOffset;
|
|
4526
4523
|
return buffer;
|
|
@@ -4529,24 +4526,24 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4529
4526
|
var oldOffset = offset;
|
|
4530
4527
|
var len = varint.decode(buffer, offset);
|
|
4531
4528
|
offset += varint.decode.bytes;
|
|
4532
|
-
var
|
|
4533
|
-
offset +=
|
|
4529
|
+
var val2 = buffer.subarray(offset, offset + len);
|
|
4530
|
+
offset += val2.length;
|
|
4534
4531
|
decode.bytes = offset - oldOffset;
|
|
4535
|
-
return
|
|
4532
|
+
return val2;
|
|
4536
4533
|
},
|
|
4537
|
-
function encodingLength(
|
|
4538
|
-
var len = bufferLength(
|
|
4534
|
+
function encodingLength(val2) {
|
|
4535
|
+
var len = bufferLength(val2);
|
|
4539
4536
|
return varint.encodingLength(len) + len;
|
|
4540
4537
|
}
|
|
4541
4538
|
);
|
|
4542
4539
|
exports.string = encoder(
|
|
4543
4540
|
2,
|
|
4544
|
-
function encode(
|
|
4541
|
+
function encode(val2, buffer, offset) {
|
|
4545
4542
|
var oldOffset = offset;
|
|
4546
|
-
var len = b4a.byteLength(
|
|
4543
|
+
var len = b4a.byteLength(val2);
|
|
4547
4544
|
varint.encode(len, buffer, offset, "utf-8");
|
|
4548
4545
|
offset += varint.encode.bytes;
|
|
4549
|
-
b4a.write(buffer,
|
|
4546
|
+
b4a.write(buffer, val2, offset, len);
|
|
4550
4547
|
offset += len;
|
|
4551
4548
|
encode.bytes = offset - oldOffset;
|
|
4552
4549
|
return buffer;
|
|
@@ -4555,20 +4552,20 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4555
4552
|
var oldOffset = offset;
|
|
4556
4553
|
var len = varint.decode(buffer, offset);
|
|
4557
4554
|
offset += varint.decode.bytes;
|
|
4558
|
-
var
|
|
4555
|
+
var val2 = b4a.toString(buffer, "utf-8", offset, offset + len);
|
|
4559
4556
|
offset += len;
|
|
4560
4557
|
decode.bytes = offset - oldOffset;
|
|
4561
|
-
return
|
|
4558
|
+
return val2;
|
|
4562
4559
|
},
|
|
4563
|
-
function encodingLength(
|
|
4564
|
-
var len = b4a.byteLength(
|
|
4560
|
+
function encodingLength(val2) {
|
|
4561
|
+
var len = b4a.byteLength(val2);
|
|
4565
4562
|
return varint.encodingLength(len) + len;
|
|
4566
4563
|
}
|
|
4567
4564
|
);
|
|
4568
4565
|
exports.bool = encoder(
|
|
4569
4566
|
0,
|
|
4570
|
-
function encode(
|
|
4571
|
-
buffer[offset] =
|
|
4567
|
+
function encode(val2, buffer, offset) {
|
|
4568
|
+
buffer[offset] = val2 ? 1 : 0;
|
|
4572
4569
|
encode.bytes = 1;
|
|
4573
4570
|
return buffer;
|
|
4574
4571
|
},
|
|
@@ -4583,26 +4580,26 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4583
4580
|
);
|
|
4584
4581
|
exports.int32 = encoder(
|
|
4585
4582
|
0,
|
|
4586
|
-
function encode(
|
|
4587
|
-
varint.encode(
|
|
4583
|
+
function encode(val2, buffer, offset) {
|
|
4584
|
+
varint.encode(val2 < 0 ? val2 + 4294967296 : val2, buffer, offset);
|
|
4588
4585
|
encode.bytes = varint.encode.bytes;
|
|
4589
4586
|
return buffer;
|
|
4590
4587
|
},
|
|
4591
4588
|
function decode(buffer, offset) {
|
|
4592
|
-
var
|
|
4589
|
+
var val2 = varint.decode(buffer, offset);
|
|
4593
4590
|
decode.bytes = varint.decode.bytes;
|
|
4594
|
-
return
|
|
4591
|
+
return val2 > 2147483647 ? val2 - 4294967296 : val2;
|
|
4595
4592
|
},
|
|
4596
|
-
function encodingLength(
|
|
4597
|
-
return varint.encodingLength(
|
|
4593
|
+
function encodingLength(val2) {
|
|
4594
|
+
return varint.encodingLength(val2 < 0 ? val2 + 4294967296 : val2);
|
|
4598
4595
|
}
|
|
4599
4596
|
);
|
|
4600
4597
|
exports.int64 = encoder(
|
|
4601
4598
|
0,
|
|
4602
|
-
function encode(
|
|
4603
|
-
if (
|
|
4599
|
+
function encode(val2, buffer, offset) {
|
|
4600
|
+
if (val2 < 0) {
|
|
4604
4601
|
var last = offset + 9;
|
|
4605
|
-
varint.encode(
|
|
4602
|
+
varint.encode(val2 * -1, buffer, offset);
|
|
4606
4603
|
offset += varint.encode.bytes - 1;
|
|
4607
4604
|
buffer[offset] = buffer[offset] | 128;
|
|
4608
4605
|
while (offset < last - 1) {
|
|
@@ -4612,29 +4609,29 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4612
4609
|
buffer[last] = 1;
|
|
4613
4610
|
encode.bytes = 10;
|
|
4614
4611
|
} else {
|
|
4615
|
-
varint.encode(
|
|
4612
|
+
varint.encode(val2, buffer, offset);
|
|
4616
4613
|
encode.bytes = varint.encode.bytes;
|
|
4617
4614
|
}
|
|
4618
4615
|
return buffer;
|
|
4619
4616
|
},
|
|
4620
4617
|
function decode(buffer, offset) {
|
|
4621
|
-
var
|
|
4622
|
-
if (
|
|
4618
|
+
var val2 = varint.decode(buffer, offset);
|
|
4619
|
+
if (val2 >= Math.pow(2, 63)) {
|
|
4623
4620
|
var limit = 9;
|
|
4624
4621
|
while (buffer[offset + limit - 1] === 255) limit--;
|
|
4625
4622
|
limit = limit || 9;
|
|
4626
4623
|
var subset = b4a.allocUnsafe(limit);
|
|
4627
4624
|
b4a.copy(buffer, subset, 0, offset, offset + limit);
|
|
4628
4625
|
subset[limit - 1] = subset[limit - 1] & 127;
|
|
4629
|
-
|
|
4626
|
+
val2 = -1 * varint.decode(subset, 0);
|
|
4630
4627
|
decode.bytes = 10;
|
|
4631
4628
|
} else {
|
|
4632
4629
|
decode.bytes = varint.decode.bytes;
|
|
4633
4630
|
}
|
|
4634
|
-
return
|
|
4631
|
+
return val2;
|
|
4635
4632
|
},
|
|
4636
|
-
function encodingLength(
|
|
4637
|
-
return
|
|
4633
|
+
function encodingLength(val2) {
|
|
4634
|
+
return val2 < 0 ? 10 : varint.encodingLength(val2);
|
|
4638
4635
|
}
|
|
4639
4636
|
);
|
|
4640
4637
|
exports.sint32 = exports.sint64 = encoder(
|
|
@@ -4651,15 +4648,15 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4651
4648
|
);
|
|
4652
4649
|
exports.fixed64 = exports.sfixed64 = encoder(
|
|
4653
4650
|
1,
|
|
4654
|
-
function encode(
|
|
4655
|
-
b4a.copy(
|
|
4651
|
+
function encode(val2, buffer, offset) {
|
|
4652
|
+
b4a.copy(val2, buffer, offset);
|
|
4656
4653
|
encode.bytes = 8;
|
|
4657
4654
|
return buffer;
|
|
4658
4655
|
},
|
|
4659
4656
|
function decode(buffer, offset) {
|
|
4660
|
-
var
|
|
4657
|
+
var val2 = buffer.subarray(offset, offset + 8);
|
|
4661
4658
|
decode.bytes = 8;
|
|
4662
|
-
return
|
|
4659
|
+
return val2;
|
|
4663
4660
|
},
|
|
4664
4661
|
function encodingLength() {
|
|
4665
4662
|
return 8;
|
|
@@ -4667,15 +4664,15 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4667
4664
|
);
|
|
4668
4665
|
exports.double = encoder(
|
|
4669
4666
|
1,
|
|
4670
|
-
function encode(
|
|
4671
|
-
b4a.writeDoubleLE(buffer,
|
|
4667
|
+
function encode(val2, buffer, offset) {
|
|
4668
|
+
b4a.writeDoubleLE(buffer, val2, offset);
|
|
4672
4669
|
encode.bytes = 8;
|
|
4673
4670
|
return buffer;
|
|
4674
4671
|
},
|
|
4675
4672
|
function decode(buffer, offset) {
|
|
4676
|
-
var
|
|
4673
|
+
var val2 = b4a.readDoubleLE(buffer, offset);
|
|
4677
4674
|
decode.bytes = 8;
|
|
4678
|
-
return
|
|
4675
|
+
return val2;
|
|
4679
4676
|
},
|
|
4680
4677
|
function encodingLength() {
|
|
4681
4678
|
return 8;
|
|
@@ -4683,15 +4680,15 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4683
4680
|
);
|
|
4684
4681
|
exports.fixed32 = encoder(
|
|
4685
4682
|
5,
|
|
4686
|
-
function encode(
|
|
4687
|
-
b4a.writeUInt32LE(buffer,
|
|
4683
|
+
function encode(val2, buffer, offset) {
|
|
4684
|
+
b4a.writeUInt32LE(buffer, val2, offset);
|
|
4688
4685
|
encode.bytes = 4;
|
|
4689
4686
|
return buffer;
|
|
4690
4687
|
},
|
|
4691
4688
|
function decode(buffer, offset) {
|
|
4692
|
-
var
|
|
4689
|
+
var val2 = b4a.readUInt32LE(buffer, offset);
|
|
4693
4690
|
decode.bytes = 4;
|
|
4694
|
-
return
|
|
4691
|
+
return val2;
|
|
4695
4692
|
},
|
|
4696
4693
|
function encodingLength() {
|
|
4697
4694
|
return 4;
|
|
@@ -4699,15 +4696,15 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4699
4696
|
);
|
|
4700
4697
|
exports.sfixed32 = encoder(
|
|
4701
4698
|
5,
|
|
4702
|
-
function encode(
|
|
4703
|
-
b4a.writeInt32LE(buffer,
|
|
4699
|
+
function encode(val2, buffer, offset) {
|
|
4700
|
+
b4a.writeInt32LE(buffer, val2, offset);
|
|
4704
4701
|
encode.bytes = 4;
|
|
4705
4702
|
return buffer;
|
|
4706
4703
|
},
|
|
4707
4704
|
function decode(buffer, offset) {
|
|
4708
|
-
var
|
|
4705
|
+
var val2 = b4a.readInt32LE(buffer, offset);
|
|
4709
4706
|
decode.bytes = 4;
|
|
4710
|
-
return
|
|
4707
|
+
return val2;
|
|
4711
4708
|
},
|
|
4712
4709
|
function encodingLength() {
|
|
4713
4710
|
return 4;
|
|
@@ -4715,15 +4712,15 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4715
4712
|
);
|
|
4716
4713
|
exports.float = encoder(
|
|
4717
4714
|
5,
|
|
4718
|
-
function encode(
|
|
4719
|
-
b4a.writeFloatLE(buffer,
|
|
4715
|
+
function encode(val2, buffer, offset) {
|
|
4716
|
+
b4a.writeFloatLE(buffer, val2, offset);
|
|
4720
4717
|
encode.bytes = 4;
|
|
4721
4718
|
return buffer;
|
|
4722
4719
|
},
|
|
4723
4720
|
function decode(buffer, offset) {
|
|
4724
|
-
var
|
|
4721
|
+
var val2 = b4a.readFloatLE(buffer, offset);
|
|
4725
4722
|
decode.bytes = 4;
|
|
4726
|
-
return
|
|
4723
|
+
return val2;
|
|
4727
4724
|
},
|
|
4728
4725
|
function encodingLength() {
|
|
4729
4726
|
return 4;
|
|
@@ -4738,8 +4735,8 @@ var require_protocol_buffers_encodings = __commonJS({
|
|
|
4738
4735
|
encodingLength
|
|
4739
4736
|
};
|
|
4740
4737
|
}
|
|
4741
|
-
function bufferLength(
|
|
4742
|
-
return b4a.isBuffer(
|
|
4738
|
+
function bufferLength(val2) {
|
|
4739
|
+
return b4a.isBuffer(val2) ? val2.length : b4a.byteLength(val2);
|
|
4743
4740
|
}
|
|
4744
4741
|
}
|
|
4745
4742
|
});
|
|
@@ -5844,8 +5841,8 @@ var require_messages = __commonJS({
|
|
|
5844
5841
|
}
|
|
5845
5842
|
}
|
|
5846
5843
|
}
|
|
5847
|
-
function defined(
|
|
5848
|
-
return
|
|
5844
|
+
function defined(val2) {
|
|
5845
|
+
return val2 !== null && val2 !== void 0 && (typeof val2 !== "number" || !isNaN(val2));
|
|
5849
5846
|
}
|
|
5850
5847
|
}
|
|
5851
5848
|
});
|
|
@@ -6865,16 +6862,16 @@ var require_ms = __commonJS({
|
|
|
6865
6862
|
var d = h * 24;
|
|
6866
6863
|
var w = d * 7;
|
|
6867
6864
|
var y = d * 365.25;
|
|
6868
|
-
module.exports = function(
|
|
6865
|
+
module.exports = function(val2, options) {
|
|
6869
6866
|
options = options || {};
|
|
6870
|
-
var type = typeof
|
|
6871
|
-
if (type === "string" &&
|
|
6872
|
-
return parse(
|
|
6873
|
-
} else if (type === "number" && isFinite(
|
|
6874
|
-
return options.long ? fmtLong(
|
|
6867
|
+
var type = typeof val2;
|
|
6868
|
+
if (type === "string" && val2.length > 0) {
|
|
6869
|
+
return parse(val2);
|
|
6870
|
+
} else if (type === "number" && isFinite(val2)) {
|
|
6871
|
+
return options.long ? fmtLong(val2) : fmtShort(val2);
|
|
6875
6872
|
}
|
|
6876
6873
|
throw new Error(
|
|
6877
|
-
"val is not a non-empty string or a valid number. val=" + JSON.stringify(
|
|
6874
|
+
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val2)
|
|
6878
6875
|
);
|
|
6879
6876
|
};
|
|
6880
6877
|
function parse(str) {
|
|
@@ -7027,8 +7024,8 @@ var require_common = __commonJS({
|
|
|
7027
7024
|
index++;
|
|
7028
7025
|
const formatter = createDebug.formatters[format];
|
|
7029
7026
|
if (typeof formatter === "function") {
|
|
7030
|
-
const
|
|
7031
|
-
match = formatter.call(self,
|
|
7027
|
+
const val2 = args[index];
|
|
7028
|
+
match = formatter.call(self, val2);
|
|
7032
7029
|
args.splice(index, 1);
|
|
7033
7030
|
index--;
|
|
7034
7031
|
}
|
|
@@ -7119,11 +7116,11 @@ var require_common = __commonJS({
|
|
|
7119
7116
|
function toNamespace(regexp) {
|
|
7120
7117
|
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
|
|
7121
7118
|
}
|
|
7122
|
-
function coerce(
|
|
7123
|
-
if (
|
|
7124
|
-
return
|
|
7119
|
+
function coerce(val2) {
|
|
7120
|
+
if (val2 instanceof Error) {
|
|
7121
|
+
return val2.stack || val2.message;
|
|
7125
7122
|
}
|
|
7126
|
-
return
|
|
7123
|
+
return val2;
|
|
7127
7124
|
}
|
|
7128
7125
|
function destroy() {
|
|
7129
7126
|
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
@@ -7861,11 +7858,11 @@ var require_fast_bitfield = __commonJS({
|
|
|
7861
7858
|
iterator() {
|
|
7862
7859
|
return new Iterator(this);
|
|
7863
7860
|
}
|
|
7864
|
-
fill(
|
|
7861
|
+
fill(val2, start, end) {
|
|
7865
7862
|
if (!start) start = 0;
|
|
7866
|
-
if (
|
|
7867
|
-
if (
|
|
7868
|
-
this._fillBuffer(
|
|
7863
|
+
if (val2 === true) return this._fillBit(true, start, end === 0 ? end : end || this.length);
|
|
7864
|
+
if (val2 === false) return this._fillBit(false, start, end === 0 ? end : end || this.length);
|
|
7865
|
+
this._fillBuffer(val2, start, end === 0 ? end : end || start + 8 * val2.length);
|
|
7869
7866
|
}
|
|
7870
7867
|
grow() {
|
|
7871
7868
|
if (this._page.level === 3) throw new Error("Cannot grow beyond " + this.length);
|
|
@@ -8826,7 +8823,7 @@ var require_emitter = __commonJS({
|
|
|
8826
8823
|
this.actives++;
|
|
8827
8824
|
return true;
|
|
8828
8825
|
};
|
|
8829
|
-
Nanoresource.prototype.inactive = function(cb, err,
|
|
8826
|
+
Nanoresource.prototype.inactive = function(cb, err, val2) {
|
|
8830
8827
|
if (!--this.actives) {
|
|
8831
8828
|
const queue = this[preclosing];
|
|
8832
8829
|
if (queue) {
|
|
@@ -8834,7 +8831,7 @@ var require_emitter = __commonJS({
|
|
|
8834
8831
|
while (queue.length) this.close(queue.shift());
|
|
8835
8832
|
}
|
|
8836
8833
|
}
|
|
8837
|
-
if (cb) cb(err,
|
|
8834
|
+
if (cb) cb(err, val2);
|
|
8838
8835
|
};
|
|
8839
8836
|
Nanoresource.prototype.close = function(allowActive, cb) {
|
|
8840
8837
|
if (typeof allowActive === "function") return this.close(false, allowActive);
|
|
@@ -10319,10 +10316,10 @@ var require_hypercore = __commonJS({
|
|
|
10319
10316
|
err.code = "ETIMEDOUT";
|
|
10320
10317
|
cb(err);
|
|
10321
10318
|
}
|
|
10322
|
-
function done(err,
|
|
10319
|
+
function done(err, val2) {
|
|
10323
10320
|
if (failed) return;
|
|
10324
10321
|
clearTimeout(id);
|
|
10325
|
-
cb(err,
|
|
10322
|
+
cb(err, val2);
|
|
10326
10323
|
}
|
|
10327
10324
|
}
|
|
10328
10325
|
function toWantRange(i) {
|
|
@@ -10355,7 +10352,7 @@ var require_hypercore = __commonJS({
|
|
|
10355
10352
|
});
|
|
10356
10353
|
|
|
10357
10354
|
// packages/common/hypercore/src/index.ts
|
|
10358
|
-
var import_hypercore2 = __toESM(require_hypercore());
|
|
10355
|
+
var import_hypercore2 = __toESM(require_hypercore(), 1);
|
|
10359
10356
|
|
|
10360
10357
|
// packages/common/hypercore/src/crypto.ts
|
|
10361
10358
|
import { callbackify } from "@dxos/node-std/util";
|
|
@@ -10430,7 +10427,7 @@ var defaultReplicateOptions = {
|
|
|
10430
10427
|
};
|
|
10431
10428
|
|
|
10432
10429
|
// packages/common/hypercore/src/hypercore-factory.ts
|
|
10433
|
-
var import_hypercore = __toESM(require_hypercore());
|
|
10430
|
+
var import_hypercore = __toESM(require_hypercore(), 1);
|
|
10434
10431
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
10435
10432
|
import { createStorage, StorageType } from "@dxos/random-access-storage";
|
|
10436
10433
|
|