@fireproof/core 0.19.8-dev-alldocs-export → 0.19.8-dev-getid
Sign up to get free protection for your applications and to get access to all the features.
- package/{chunk-DG6XSV44.js → chunk-BNL4PVBF.js} +25 -81
- package/chunk-BNL4PVBF.js.map +1 -0
- package/{chunk-OWQAHX2V.js → chunk-JW2QT6BF.js} +24 -4
- package/chunk-JW2QT6BF.js.map +1 -0
- package/index.cjs +444 -1300
- package/index.cjs.map +1 -1
- package/index.d.cts +156 -167
- package/index.d.ts +156 -167
- package/index.global.js +1037 -1214
- package/index.global.js.map +1 -1
- package/index.js +65 -59
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/metafile-iife.json +1 -1
- package/node-sys-container-MIEX6ELJ.js +29 -0
- package/node-sys-container-MIEX6ELJ.js.map +1 -0
- package/package.json +3 -2
- package/{store-file-WD746RSY.js → store-file-VJ6BI4II.js} +6 -8
- package/{store-file-WD746RSY.js.map → store-file-VJ6BI4II.js.map} +1 -1
- package/{chunk-5UFCF36O.js → store-indexdb-WLRSICCB.js} +7 -17
- package/store-indexdb-WLRSICCB.js.map +1 -0
- package/tests/fireproof/config.test.ts +14 -70
- package/tests/fireproof/database.test.ts +4 -4
- package/tests/fireproof/fireproof.test.ts +5 -5
- package/tests/fireproof/hello.test.ts +2 -2
- package/chunk-5UFCF36O.js.map +0 -1
- package/chunk-DG6XSV44.js.map +0 -1
- package/chunk-OWQAHX2V.js.map +0 -1
- package/chunk-PRQHQG4I.js +0 -39
- package/chunk-PRQHQG4I.js.map +0 -1
- package/chunk-VZGT7ZYP.js +0 -22
- package/chunk-VZGT7ZYP.js.map +0 -1
- package/node-sys-container-TTGEC66A.js +0 -29
- package/node-sys-container-TTGEC66A.js.map +0 -1
- package/sqlite-data-store-MA55LVQE.js +0 -120
- package/sqlite-data-store-MA55LVQE.js.map +0 -1
- package/sqlite-meta-store-UNQKVYRM.js +0 -137
- package/sqlite-meta-store-UNQKVYRM.js.map +0 -1
- package/sqlite-wal-store-KVUOC4PO.js +0 -123
- package/sqlite-wal-store-KVUOC4PO.js.map +0 -1
- package/store-indexdb-NG45BU3Q.js +0 -20
- package/store-indexdb-NG45BU3Q.js.map +0 -1
- package/store-sql-QVFNIGND.js +0 -344
- package/store-sql-QVFNIGND.js.map +0 -1
package/index.global.js
CHANGED
@@ -129,11 +129,11 @@ var fireproof = (() => {
|
|
129
129
|
if (hex) {
|
130
130
|
const inner = new Uint8Array(16);
|
131
131
|
for (let i = 0; i < 16; i += 4) {
|
132
|
-
const
|
133
|
-
inner[i + 0] =
|
134
|
-
inner[i + 1] =
|
135
|
-
inner[i + 2] =
|
136
|
-
inner[i + 3] =
|
132
|
+
const n = parseInt(hex.substring(2 * i, 2 * i + 8), 16);
|
133
|
+
inner[i + 0] = n >>> 24;
|
134
|
+
inner[i + 1] = n >>> 16;
|
135
|
+
inner[i + 2] = n >>> 8;
|
136
|
+
inner[i + 3] = n;
|
137
137
|
}
|
138
138
|
return new _UUID(inner);
|
139
139
|
} else {
|
@@ -180,16 +180,16 @@ var fireproof = (() => {
|
|
180
180
|
* subsumed under the variants `0b0` and `0b111`, respectively.
|
181
181
|
*/
|
182
182
|
getVariant() {
|
183
|
-
const
|
184
|
-
if (
|
183
|
+
const n = this.bytes[8] >>> 4;
|
184
|
+
if (n < 0) {
|
185
185
|
throw new Error("unreachable");
|
186
|
-
} else if (
|
186
|
+
} else if (n <= 7) {
|
187
187
|
return this.bytes.every((e) => e === 0) ? "NIL" : "VAR_0";
|
188
|
-
} else if (
|
188
|
+
} else if (n <= 11) {
|
189
189
|
return "VAR_10";
|
190
|
-
} else if (
|
190
|
+
} else if (n <= 13) {
|
191
191
|
return "VAR_110";
|
192
|
-
} else if (
|
192
|
+
} else if (n <= 15) {
|
193
193
|
return this.bytes.every((e) => e === 255) ? "MAX" : "VAR_RESERVED";
|
194
194
|
} else {
|
195
195
|
throw new Error("unreachable");
|
@@ -380,16 +380,16 @@ var fireproof = (() => {
|
|
380
380
|
throw TypeError(msg);
|
381
381
|
};
|
382
382
|
__defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
383
|
-
__spreadValues = (
|
384
|
-
for (var prop in
|
385
|
-
if (__hasOwnProp2.call(
|
386
|
-
__defNormalProp(
|
383
|
+
__spreadValues = (a, b) => {
|
384
|
+
for (var prop in b || (b = {}))
|
385
|
+
if (__hasOwnProp2.call(b, prop))
|
386
|
+
__defNormalProp(a, prop, b[prop]);
|
387
387
|
if (__getOwnPropSymbols)
|
388
|
-
for (var prop of __getOwnPropSymbols(
|
389
|
-
if (__propIsEnum.call(
|
390
|
-
__defNormalProp(
|
388
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
389
|
+
if (__propIsEnum.call(b, prop))
|
390
|
+
__defNormalProp(a, prop, b[prop]);
|
391
391
|
}
|
392
|
-
return
|
392
|
+
return a;
|
393
393
|
};
|
394
394
|
__accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
395
395
|
__privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
@@ -849,7 +849,7 @@ var fireproof = (() => {
|
|
849
849
|
"Any",
|
850
850
|
"Dur",
|
851
851
|
"Uint64"
|
852
|
-
].map((fn) => typeof obj[fn] === "function").reduce((
|
852
|
+
].map((fn) => typeof obj[fn] === "function").reduce((a, b) => a && b, true);
|
853
853
|
}
|
854
854
|
function resolveLogValue(val) {
|
855
855
|
const ret = {};
|
@@ -913,8 +913,8 @@ var fireproof = (() => {
|
|
913
913
|
}
|
914
914
|
this.forModules(
|
915
915
|
level,
|
916
|
-
(
|
917
|
-
this._modules.set(
|
916
|
+
(p) => {
|
917
|
+
this._modules.set(p, /* @__PURE__ */ new Set([...this._globalLevels, level]));
|
918
918
|
},
|
919
919
|
...modules
|
920
920
|
);
|
@@ -926,28 +926,28 @@ var fireproof = (() => {
|
|
926
926
|
}
|
927
927
|
this.forModules(
|
928
928
|
level,
|
929
|
-
(
|
930
|
-
this._modules.delete(
|
929
|
+
(p) => {
|
930
|
+
this._modules.delete(p);
|
931
931
|
},
|
932
932
|
...modules
|
933
933
|
);
|
934
934
|
}
|
935
935
|
forModules(level, fnAction, ...modules) {
|
936
|
-
for (const
|
937
|
-
if (typeof
|
936
|
+
for (const m of modules.flat()) {
|
937
|
+
if (typeof m !== "string") {
|
938
938
|
continue;
|
939
939
|
}
|
940
|
-
const parts =
|
941
|
-
for (const
|
942
|
-
fnAction(
|
940
|
+
const parts = m.split(",").map((s) => s.trim()).filter((s) => s.length);
|
941
|
+
for (const p of parts) {
|
942
|
+
fnAction(p);
|
943
943
|
}
|
944
944
|
}
|
945
945
|
}
|
946
946
|
setDebug(...modules) {
|
947
947
|
this.forModules(
|
948
948
|
"debug",
|
949
|
-
(
|
950
|
-
this._modules.set(
|
949
|
+
(p) => {
|
950
|
+
this._modules.set(p, /* @__PURE__ */ new Set([
|
951
951
|
...this._globalLevels,
|
952
952
|
"debug"
|
953
953
|
/* DEBUG */
|
@@ -1113,8 +1113,8 @@ var fireproof = (() => {
|
|
1113
1113
|
}
|
1114
1114
|
return this;
|
1115
1115
|
}
|
1116
|
-
WithLevel(
|
1117
|
-
this._attributes["level"] = logValue(
|
1116
|
+
WithLevel(l) {
|
1117
|
+
this._attributes["level"] = logValue(l);
|
1118
1118
|
return this;
|
1119
1119
|
}
|
1120
1120
|
Ref(key, action) {
|
@@ -1330,17 +1330,17 @@ var fireproof = (() => {
|
|
1330
1330
|
}
|
1331
1331
|
};
|
1332
1332
|
Result = class _Result {
|
1333
|
-
static Ok(
|
1334
|
-
return new ResultOK(
|
1333
|
+
static Ok(t) {
|
1334
|
+
return new ResultOK(t);
|
1335
1335
|
}
|
1336
|
-
static Err(
|
1337
|
-
if (typeof
|
1338
|
-
return new ResultError(new Error(
|
1336
|
+
static Err(t) {
|
1337
|
+
if (typeof t === "string") {
|
1338
|
+
return new ResultError(new Error(t));
|
1339
1339
|
}
|
1340
|
-
return new ResultError(
|
1340
|
+
return new ResultError(t);
|
1341
1341
|
}
|
1342
|
-
static Is(
|
1343
|
-
return
|
1342
|
+
static Is(t) {
|
1343
|
+
return t instanceof _Result;
|
1344
1344
|
}
|
1345
1345
|
isOk() {
|
1346
1346
|
return this.is_ok();
|
@@ -1356,9 +1356,9 @@ var fireproof = (() => {
|
|
1356
1356
|
}
|
1357
1357
|
};
|
1358
1358
|
ResultOK = class extends Result {
|
1359
|
-
constructor(
|
1359
|
+
constructor(t) {
|
1360
1360
|
super();
|
1361
|
-
this._t =
|
1361
|
+
this._t = t;
|
1362
1362
|
}
|
1363
1363
|
is_ok() {
|
1364
1364
|
return true;
|
@@ -1374,9 +1374,9 @@ var fireproof = (() => {
|
|
1374
1374
|
}
|
1375
1375
|
};
|
1376
1376
|
ResultError = class extends Result {
|
1377
|
-
constructor(
|
1377
|
+
constructor(t) {
|
1378
1378
|
super();
|
1379
|
-
this._error =
|
1379
|
+
this._error = t;
|
1380
1380
|
}
|
1381
1381
|
is_ok() {
|
1382
1382
|
return false;
|
@@ -1510,12 +1510,12 @@ var fireproof = (() => {
|
|
1510
1510
|
toHex: () => toHex,
|
1511
1511
|
toString: () => toString
|
1512
1512
|
});
|
1513
|
-
function toHex(
|
1514
|
-
return
|
1513
|
+
function toHex(d) {
|
1514
|
+
return d.reduce((hex, byte) => hex + byte.toString(16).padStart(2, "0"), "");
|
1515
1515
|
}
|
1516
1516
|
function fromHex(hex) {
|
1517
1517
|
const hexes = hex.match(/../g);
|
1518
|
-
return hexes != null ? new Uint8Array(hexes.map((
|
1518
|
+
return hexes != null ? new Uint8Array(hexes.map((b) => parseInt(b, 16))) : empty;
|
1519
1519
|
}
|
1520
1520
|
function equals(aa, bb) {
|
1521
1521
|
if (aa === bb)
|
@@ -1546,8 +1546,8 @@ var fireproof = (() => {
|
|
1546
1546
|
function fromString(str) {
|
1547
1547
|
return new TextEncoder().encode(str);
|
1548
1548
|
}
|
1549
|
-
function toString(
|
1550
|
-
return new TextDecoder().decode(
|
1549
|
+
function toString(b) {
|
1550
|
+
return new TextDecoder().decode(b);
|
1551
1551
|
}
|
1552
1552
|
var empty;
|
1553
1553
|
var init_bytes = __esm({
|
@@ -1995,16 +1995,16 @@ var fireproof = (() => {
|
|
1995
1995
|
return out;
|
1996
1996
|
}
|
1997
1997
|
function read(buf2, offset) {
|
1998
|
-
var res = 0, offset = offset || 0, shift = 0, counter = offset,
|
1998
|
+
var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf2.length;
|
1999
1999
|
do {
|
2000
|
-
if (counter >=
|
2000
|
+
if (counter >= l) {
|
2001
2001
|
read.bytes = 0;
|
2002
2002
|
throw new RangeError("Could not decode varint");
|
2003
2003
|
}
|
2004
|
-
|
2005
|
-
res += shift < 28 ? (
|
2004
|
+
b = buf2[counter++];
|
2005
|
+
res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift);
|
2006
2006
|
shift += 7;
|
2007
|
-
} while (
|
2007
|
+
} while (b >= MSB$1);
|
2008
2008
|
read.bytes = counter - offset;
|
2009
2009
|
return res;
|
2010
2010
|
}
|
@@ -2082,12 +2082,12 @@ var fireproof = (() => {
|
|
2082
2082
|
}
|
2083
2083
|
return new Digest(code9, size, digest3, bytes);
|
2084
2084
|
}
|
2085
|
-
function equals2(
|
2086
|
-
if (
|
2085
|
+
function equals2(a, b) {
|
2086
|
+
if (a === b) {
|
2087
2087
|
return true;
|
2088
2088
|
} else {
|
2089
|
-
const data =
|
2090
|
-
return
|
2089
|
+
const data = b;
|
2090
|
+
return a.code === data.code && a.size === data.size && data.bytes instanceof Uint8Array && equals(a.bytes, data.bytes);
|
2091
2091
|
}
|
2092
2092
|
}
|
2093
2093
|
var Digest;
|
@@ -2913,24 +2913,24 @@ var fireproof = (() => {
|
|
2913
2913
|
}
|
2914
2914
|
function utf8ToBytes(str) {
|
2915
2915
|
const out = [];
|
2916
|
-
let
|
2916
|
+
let p = 0;
|
2917
2917
|
for (let i = 0; i < str.length; i++) {
|
2918
|
-
let
|
2919
|
-
if (
|
2920
|
-
out[
|
2921
|
-
} else if (
|
2922
|
-
out[
|
2923
|
-
out[
|
2924
|
-
} else if ((
|
2925
|
-
|
2926
|
-
out[
|
2927
|
-
out[
|
2928
|
-
out[
|
2929
|
-
out[
|
2918
|
+
let c = str.charCodeAt(i);
|
2919
|
+
if (c < 128) {
|
2920
|
+
out[p++] = c;
|
2921
|
+
} else if (c < 2048) {
|
2922
|
+
out[p++] = c >> 6 | 192;
|
2923
|
+
out[p++] = c & 63 | 128;
|
2924
|
+
} else if ((c & 64512) === 55296 && i + 1 < str.length && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
2925
|
+
c = 65536 + ((c & 1023) << 10) + (str.charCodeAt(++i) & 1023);
|
2926
|
+
out[p++] = c >> 18 | 240;
|
2927
|
+
out[p++] = c >> 12 & 63 | 128;
|
2928
|
+
out[p++] = c >> 6 & 63 | 128;
|
2929
|
+
out[p++] = c & 63 | 128;
|
2930
2930
|
} else {
|
2931
|
-
out[
|
2932
|
-
out[
|
2933
|
-
out[
|
2931
|
+
out[p++] = c >> 12 | 224;
|
2932
|
+
out[p++] = c >> 6 & 63 | 128;
|
2933
|
+
out[p++] = c & 63 | 128;
|
2934
2934
|
}
|
2935
2935
|
}
|
2936
2936
|
return out;
|
@@ -3099,10 +3099,10 @@ var fireproof = (() => {
|
|
3099
3099
|
* @returns {Uint8Array}
|
3100
3100
|
*/
|
3101
3101
|
(chunks, length4) => {
|
3102
|
-
chunks = chunks.map((
|
3102
|
+
chunks = chunks.map((c) => c instanceof Uint8Array ? c : (
|
3103
3103
|
// eslint-disable-line operator-linebreak
|
3104
3104
|
// @ts-ignore
|
3105
|
-
globalThis.Buffer.from(
|
3105
|
+
globalThis.Buffer.from(c)
|
3106
3106
|
));
|
3107
3107
|
return asU8A(globalThis.Buffer.concat(chunks, length4));
|
3108
3108
|
}
|
@@ -3116,12 +3116,12 @@ var fireproof = (() => {
|
|
3116
3116
|
(chunks, length4) => {
|
3117
3117
|
const out = new Uint8Array(length4);
|
3118
3118
|
let off = 0;
|
3119
|
-
for (let
|
3120
|
-
if (off +
|
3121
|
-
|
3119
|
+
for (let b of chunks) {
|
3120
|
+
if (off + b.length > out.length) {
|
3121
|
+
b = b.subarray(0, out.length - off);
|
3122
3122
|
}
|
3123
|
-
out.set(
|
3124
|
-
off +=
|
3123
|
+
out.set(b, off);
|
3124
|
+
off += b.length;
|
3125
3125
|
}
|
3126
3126
|
return out;
|
3127
3127
|
}
|
@@ -3469,11 +3469,11 @@ var fireproof = (() => {
|
|
3469
3469
|
return toToken(data, pos, 5, readUint32(data, pos + 1, options));
|
3470
3470
|
}
|
3471
3471
|
function decodeBytes64(data, pos, _minor, options) {
|
3472
|
-
const
|
3473
|
-
if (typeof
|
3472
|
+
const l = readUint64(data, pos + 1, options);
|
3473
|
+
if (typeof l === "bigint") {
|
3474
3474
|
throw new Error(`${decodeErrPrefix} 64-bit integer bytes lengths not supported`);
|
3475
3475
|
}
|
3476
|
-
return toToken(data, pos, 9,
|
3476
|
+
return toToken(data, pos, 9, l);
|
3477
3477
|
}
|
3478
3478
|
function tokenBytes(token) {
|
3479
3479
|
if (token.encodedBytes === void 0) {
|
@@ -3529,11 +3529,11 @@ var fireproof = (() => {
|
|
3529
3529
|
return toToken2(data, pos, 5, readUint32(data, pos + 1, options), options);
|
3530
3530
|
}
|
3531
3531
|
function decodeString64(data, pos, _minor, options) {
|
3532
|
-
const
|
3533
|
-
if (typeof
|
3532
|
+
const l = readUint64(data, pos + 1, options);
|
3533
|
+
if (typeof l === "bigint") {
|
3534
3534
|
throw new Error(`${decodeErrPrefix} 64-bit integer string lengths not supported`);
|
3535
3535
|
}
|
3536
|
-
return toToken2(data, pos, 9,
|
3536
|
+
return toToken2(data, pos, 9, l, options);
|
3537
3537
|
}
|
3538
3538
|
var encodeString;
|
3539
3539
|
var init_string = __esm({
|
@@ -3565,11 +3565,11 @@ var fireproof = (() => {
|
|
3565
3565
|
return toToken3(data, pos, 5, readUint32(data, pos + 1, options));
|
3566
3566
|
}
|
3567
3567
|
function decodeArray64(data, pos, _minor, options) {
|
3568
|
-
const
|
3569
|
-
if (typeof
|
3568
|
+
const l = readUint64(data, pos + 1, options);
|
3569
|
+
if (typeof l === "bigint") {
|
3570
3570
|
throw new Error(`${decodeErrPrefix} 64-bit integer array lengths not supported`);
|
3571
3571
|
}
|
3572
|
-
return toToken3(data, pos, 9,
|
3572
|
+
return toToken3(data, pos, 9, l);
|
3573
3573
|
}
|
3574
3574
|
function decodeArrayIndefinite(data, pos, _minor, options) {
|
3575
3575
|
if (options.allowIndefinite === false) {
|
@@ -3610,11 +3610,11 @@ var fireproof = (() => {
|
|
3610
3610
|
return toToken4(data, pos, 5, readUint32(data, pos + 1, options));
|
3611
3611
|
}
|
3612
3612
|
function decodeMap64(data, pos, _minor, options) {
|
3613
|
-
const
|
3614
|
-
if (typeof
|
3613
|
+
const l = readUint64(data, pos + 1, options);
|
3614
|
+
if (typeof l === "bigint") {
|
3615
3615
|
throw new Error(`${decodeErrPrefix} 64-bit integer map lengths not supported`);
|
3616
3616
|
}
|
3617
|
-
return toToken4(data, pos, 9,
|
3617
|
+
return toToken4(data, pos, 9, l);
|
3618
3618
|
}
|
3619
3619
|
function decodeMapIndefinite(data, pos, _minor, options) {
|
3620
3620
|
if (options.allowIndefinite === false) {
|
@@ -4148,12 +4148,12 @@ var fireproof = (() => {
|
|
4148
4148
|
* @returns {boolean}
|
4149
4149
|
*/
|
4150
4150
|
includes(obj) {
|
4151
|
-
let
|
4151
|
+
let p = this;
|
4152
4152
|
do {
|
4153
|
-
if (
|
4153
|
+
if (p.obj === obj) {
|
4154
4154
|
return true;
|
4155
4155
|
}
|
4156
|
-
} while (
|
4156
|
+
} while (p = p.parent);
|
4157
4157
|
return false;
|
4158
4158
|
}
|
4159
4159
|
/**
|
@@ -4364,7 +4364,7 @@ var fireproof = (() => {
|
|
4364
4364
|
function tokenToMap(token, tokeniser, options) {
|
4365
4365
|
const useMaps = options.useMaps === true;
|
4366
4366
|
const obj = useMaps ? void 0 : {};
|
4367
|
-
const
|
4367
|
+
const m = useMaps ? /* @__PURE__ */ new Map() : void 0;
|
4368
4368
|
for (let i = 0; i < token.value; i++) {
|
4369
4369
|
const key = tokensToObject(tokeniser, options);
|
4370
4370
|
if (key === BREAK) {
|
@@ -4380,7 +4380,7 @@ var fireproof = (() => {
|
|
4380
4380
|
throw new Error(`${decodeErrPrefix} non-string keys not supported (got ${typeof key})`);
|
4381
4381
|
}
|
4382
4382
|
if (options.rejectDuplicateMapKeys === true) {
|
4383
|
-
if (useMaps &&
|
4383
|
+
if (useMaps && m.has(key) || !useMaps && key in obj) {
|
4384
4384
|
throw new Error(`${decodeErrPrefix} found repeat map key "${key}"`);
|
4385
4385
|
}
|
4386
4386
|
}
|
@@ -4389,12 +4389,12 @@ var fireproof = (() => {
|
|
4389
4389
|
throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no value], expected ${token.value})`);
|
4390
4390
|
}
|
4391
4391
|
if (useMaps) {
|
4392
|
-
|
4392
|
+
m.set(key, value);
|
4393
4393
|
} else {
|
4394
4394
|
obj[key] = value;
|
4395
4395
|
}
|
4396
4396
|
}
|
4397
|
-
return useMaps ?
|
4397
|
+
return useMaps ? m : obj;
|
4398
4398
|
}
|
4399
4399
|
function tokensToObject(tokeniser, options) {
|
4400
4400
|
if (tokeniser.done()) {
|
@@ -4622,114 +4622,35 @@ var fireproof = (() => {
|
|
4622
4622
|
}
|
4623
4623
|
});
|
4624
4624
|
|
4625
|
-
//
|
4626
|
-
|
4627
|
-
|
4628
|
-
const o = e[1] || e[0];
|
4629
|
-
if (globalThis.process?.env[o]) return { name: e[0].toLowerCase(), ...e[2] };
|
4630
|
-
}
|
4631
|
-
return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
|
4632
|
-
}
|
4633
|
-
function n(e) {
|
4634
|
-
return e ? e !== "false" : false;
|
4635
|
-
}
|
4636
|
-
function G() {
|
4637
|
-
const e = F.find((o) => o[0]);
|
4638
|
-
if (e) return { name: e[1] };
|
4639
|
-
}
|
4640
|
-
var import_meta, r, E, s, t, p, l, d, I, T, R, h, C, m, a, M, V, Y, _, y, W, c, w, A, L, D, O, S, N, u, b, F, P, K;
|
4641
|
-
var init_dist2 = __esm({
|
4642
|
-
"node_modules/.pnpm/std-env@3.7.0/node_modules/std-env/dist/index.mjs"() {
|
4643
|
-
"use strict";
|
4644
|
-
import_meta = {};
|
4645
|
-
r = /* @__PURE__ */ Object.create(null);
|
4646
|
-
E = (e) => globalThis.process?.env || import_meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis);
|
4647
|
-
s = new Proxy(r, { get(e, o) {
|
4648
|
-
return E()[o] ?? r[o];
|
4649
|
-
}, has(e, o) {
|
4650
|
-
const i = E();
|
4651
|
-
return o in i || o in r;
|
4652
|
-
}, set(e, o, i) {
|
4653
|
-
const g = E(true);
|
4654
|
-
return g[o] = i, true;
|
4655
|
-
}, deleteProperty(e, o) {
|
4656
|
-
if (!o) return false;
|
4657
|
-
const i = E(true);
|
4658
|
-
return delete i[o], true;
|
4659
|
-
}, ownKeys() {
|
4660
|
-
const e = E(true);
|
4661
|
-
return Object.keys(e);
|
4662
|
-
} });
|
4663
|
-
t = typeof process < "u" && process.env && "development" || "";
|
4664
|
-
p = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", { ci: true }], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", { ci: false }], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", { ci: false }], ["VERCEL", "VERCEL_ENV", { ci: false }], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", { ci: true }], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"]];
|
4665
|
-
l = B();
|
4666
|
-
d = l.name;
|
4667
|
-
I = globalThis.process?.platform || "";
|
4668
|
-
T = n(s.CI) || l.ci !== false;
|
4669
|
-
R = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
|
4670
|
-
h = n(s.DEBUG);
|
4671
|
-
C = t === "test" || n(s.TEST);
|
4672
|
-
m = n(s.MINIMAL) || T || C || !R;
|
4673
|
-
a = /^win/i.test(I);
|
4674
|
-
M = /^linux/i.test(I);
|
4675
|
-
V = /^darwin/i.test(I);
|
4676
|
-
Y = !n(s.NO_COLOR) && (n(s.FORCE_COLOR) || (R || a) && s.TERM !== "dumb" || T);
|
4677
|
-
_ = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
4678
|
-
y = Number(_?.split(".")[0]) || null;
|
4679
|
-
W = globalThis.process || /* @__PURE__ */ Object.create(null);
|
4680
|
-
c = { versions: {} };
|
4681
|
-
w = new Proxy(W, { get(e, o) {
|
4682
|
-
if (o === "env") return s;
|
4683
|
-
if (o in e) return e[o];
|
4684
|
-
if (o in c) return c[o];
|
4685
|
-
} });
|
4686
|
-
A = globalThis.process?.release?.name === "node";
|
4687
|
-
L = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
|
4688
|
-
D = !!globalThis.Deno;
|
4689
|
-
O = !!globalThis.fastly;
|
4690
|
-
S = !!globalThis.Netlify;
|
4691
|
-
N = !!globalThis.EdgeRuntime;
|
4692
|
-
u = globalThis.navigator?.userAgent === "Cloudflare-Workers";
|
4693
|
-
b = !!globalThis.__lagon__;
|
4694
|
-
F = [[S, "netlify"], [N, "edge-light"], [u, "workerd"], [O, "fastly"], [D, "deno"], [L, "bun"], [A, "node"], [b, "lagon"]];
|
4695
|
-
P = G();
|
4696
|
-
K = P?.name || "";
|
4697
|
-
}
|
4698
|
-
});
|
4699
|
-
|
4700
|
-
// src/runtime/node-sys-container.ts
|
4701
|
-
var node_sys_container_exports = {};
|
4702
|
-
__export(node_sys_container_exports, {
|
4703
|
-
createNodeSysContainer: () => createNodeSysContainer
|
4704
|
-
});
|
4705
|
-
async function createNodeSysContainer() {
|
4706
|
-
const nodePath = "node:path";
|
4707
|
-
const nodeOS = "node:os";
|
4708
|
-
const nodeURL = "node:url";
|
4709
|
-
const nodeFS = "node:fs";
|
4710
|
-
const fs = (await import(nodeFS)).promises;
|
4711
|
-
const path = await import(nodePath);
|
4712
|
-
return {
|
4713
|
-
state: "node",
|
4714
|
-
...path,
|
4715
|
-
...await import(nodeOS),
|
4716
|
-
...await import(nodeURL),
|
4717
|
-
...fs,
|
4718
|
-
join,
|
4719
|
-
stat: fs.stat,
|
4720
|
-
readdir: fs.readdir,
|
4721
|
-
readfile: fs.readFile,
|
4722
|
-
writefile: fs.writeFile
|
4723
|
-
};
|
4724
|
-
}
|
4725
|
-
var init_node_sys_container = __esm({
|
4726
|
-
"src/runtime/node-sys-container.ts"() {
|
4625
|
+
// src/runtime/store-file-not-impl.ts
|
4626
|
+
var require_store_file_not_impl = __commonJS({
|
4627
|
+
"src/runtime/store-file-not-impl.ts"() {
|
4727
4628
|
"use strict";
|
4728
|
-
|
4629
|
+
throw new Error("store-file not implemented");
|
4729
4630
|
}
|
4730
4631
|
});
|
4731
4632
|
|
4732
4633
|
// src/runtime/sys-container.ts
|
4634
|
+
function isSet(value, ref = globalThis) {
|
4635
|
+
const [head, ...tail] = value.split(".");
|
4636
|
+
if (["object", "function"].includes(typeof ref) && ref && ["object", "function"].includes(typeof ref[head]) && ref[head]) {
|
4637
|
+
if (tail.length <= 1) {
|
4638
|
+
return true;
|
4639
|
+
}
|
4640
|
+
return isSet(tail.join("."), ref[head]);
|
4641
|
+
}
|
4642
|
+
return false;
|
4643
|
+
}
|
4644
|
+
function runtimeFn() {
|
4645
|
+
const isNodeIsh = isSet("process.versions.node");
|
4646
|
+
const isDeno = isSet("Deno");
|
4647
|
+
return {
|
4648
|
+
isNodeIsh,
|
4649
|
+
isBrowser: !(isNodeIsh || isDeno),
|
4650
|
+
isDeno,
|
4651
|
+
isReactNative: false
|
4652
|
+
};
|
4653
|
+
}
|
4733
4654
|
function join(...paths) {
|
4734
4655
|
return paths.map((i) => i.replace(/\/+$/, "")).join("/");
|
4735
4656
|
}
|
@@ -4737,7 +4658,6 @@ var fireproof = (() => {
|
|
4737
4658
|
var init_sys_container = __esm({
|
4738
4659
|
"src/runtime/sys-container.ts"() {
|
4739
4660
|
"use strict";
|
4740
|
-
init_dist2();
|
4741
4661
|
init_dist();
|
4742
4662
|
init_cement();
|
4743
4663
|
init_types();
|
@@ -4790,15 +4710,16 @@ var fireproof = (() => {
|
|
4790
4710
|
this.logSeeded("homedir");
|
4791
4711
|
return throwFalsy(this.freight).homedir();
|
4792
4712
|
};
|
4713
|
+
this.runtime = runtimeFn;
|
4793
4714
|
this.env = envImpl2;
|
4794
4715
|
}
|
4795
4716
|
async start() {
|
4796
4717
|
await onceStart.once(async () => {
|
4797
4718
|
switch (this.freight.state) {
|
4798
4719
|
case "seeded":
|
4799
|
-
if (
|
4800
|
-
const { createNodeSysContainer
|
4801
|
-
this.freight = await
|
4720
|
+
if (this.runtime().isNodeIsh) {
|
4721
|
+
const { createNodeSysContainer } = await Promise.resolve().then(() => __toESM(require_store_file_not_impl(), 1));
|
4722
|
+
this.freight = await createNodeSysContainer();
|
4802
4723
|
} else {
|
4803
4724
|
this.freight.state = "browser";
|
4804
4725
|
}
|
@@ -4871,7 +4792,7 @@ var fireproof = (() => {
|
|
4871
4792
|
// src/runtime/data-dir.ts
|
4872
4793
|
function dataDir(name7, base4) {
|
4873
4794
|
if (!base4) {
|
4874
|
-
if (
|
4795
|
+
if (SysContainer.runtime().isNodeIsh || SysContainer.runtime().isDeno) {
|
4875
4796
|
base4 = SysContainer.env.get("FP_STORAGE_URL") || `file://${SysContainer.join(SysContainer.homedir(), ".fireproof")}`;
|
4876
4797
|
} else {
|
4877
4798
|
base4 = `indexdb://fp`;
|
@@ -4899,7 +4820,6 @@ var fireproof = (() => {
|
|
4899
4820
|
"src/runtime/data-dir.ts"() {
|
4900
4821
|
"use strict";
|
4901
4822
|
init_sys_container();
|
4902
|
-
init_dist2();
|
4903
4823
|
}
|
4904
4824
|
});
|
4905
4825
|
|
@@ -4915,7 +4835,7 @@ var fireproof = (() => {
|
|
4915
4835
|
return SysContainer.join(basePath);
|
4916
4836
|
}
|
4917
4837
|
function getFileName(url, key, logger) {
|
4918
|
-
switch (getStore(url, logger, (...
|
4838
|
+
switch (getStore(url, logger, (...a) => a.join("/"))) {
|
4919
4839
|
case "data":
|
4920
4840
|
return key + ".car";
|
4921
4841
|
case "meta":
|
@@ -4938,95 +4858,6 @@ var fireproof = (() => {
|
|
4938
4858
|
}
|
4939
4859
|
});
|
4940
4860
|
|
4941
|
-
// src/runtime/store-sql/types.ts
|
4942
|
-
var DefaultSQLTableNames;
|
4943
|
-
var init_types2 = __esm({
|
4944
|
-
"src/runtime/store-sql/types.ts"() {
|
4945
|
-
"use strict";
|
4946
|
-
DefaultSQLTableNames = {
|
4947
|
-
data: "Datas",
|
4948
|
-
meta: "Metas",
|
4949
|
-
wal: "Wals"
|
4950
|
-
};
|
4951
|
-
}
|
4952
|
-
});
|
4953
|
-
|
4954
|
-
// src/runtime/store-sql/ensurer.ts
|
4955
|
-
function sqlTableName(...names) {
|
4956
|
-
return names.map((name7) => name7.replace(/^[^a-zA-Z0-9]+/, "").replace(/[^a-zA-Z0-9]+/g, "_")).filter((i) => i.length).join("_");
|
4957
|
-
}
|
4958
|
-
function ensureTableNames(url, opts) {
|
4959
|
-
let isIndex = "";
|
4960
|
-
if (url.searchParams.has("index")) {
|
4961
|
-
isIndex = url.searchParams.get("index") || ".idx";
|
4962
|
-
}
|
4963
|
-
const ret = opts?.tableNames || DefaultSQLTableNames;
|
4964
|
-
if (isIndex.length) {
|
4965
|
-
return {
|
4966
|
-
data: sqlTableName(isIndex, ret.data),
|
4967
|
-
meta: sqlTableName(isIndex, ret.meta),
|
4968
|
-
wal: sqlTableName(isIndex, ret.wal)
|
4969
|
-
};
|
4970
|
-
}
|
4971
|
-
return {
|
4972
|
-
data: sqlTableName(ret.data),
|
4973
|
-
meta: sqlTableName(ret.meta),
|
4974
|
-
wal: sqlTableName(ret.wal)
|
4975
|
-
};
|
4976
|
-
}
|
4977
|
-
function ensureTextEncoder(opts) {
|
4978
|
-
return opts?.textEncoder || textEncoder2;
|
4979
|
-
}
|
4980
|
-
function ensureTextDecoder(opts) {
|
4981
|
-
return opts?.textDecoder || textDecoder2;
|
4982
|
-
}
|
4983
|
-
function url2sqlFlavor(url, logger) {
|
4984
|
-
const flavor = url.protocol.replace(/:.*$/, "");
|
4985
|
-
switch (flavor) {
|
4986
|
-
case "sqlite":
|
4987
|
-
case "mysql":
|
4988
|
-
case "postgres":
|
4989
|
-
return flavor;
|
4990
|
-
default:
|
4991
|
-
throw logger.Error().Str("flavor", flavor).Msg("unsupported protocol").AsError();
|
4992
|
-
}
|
4993
|
-
}
|
4994
|
-
function ensureSQLOpts(url, opts, componentName, ctx) {
|
4995
|
-
const logger = ensureLogger(opts, componentName, ctx);
|
4996
|
-
return {
|
4997
|
-
url,
|
4998
|
-
sqlFlavor: url2sqlFlavor(url, logger),
|
4999
|
-
tableNames: ensureTableNames(url, opts),
|
5000
|
-
logger,
|
5001
|
-
textEncoder: ensureTextEncoder(opts),
|
5002
|
-
textDecoder: ensureTextDecoder(opts)
|
5003
|
-
};
|
5004
|
-
}
|
5005
|
-
var textEncoder2, textDecoder2;
|
5006
|
-
var init_ensurer = __esm({
|
5007
|
-
"src/runtime/store-sql/ensurer.ts"() {
|
5008
|
-
"use strict";
|
5009
|
-
init_utils();
|
5010
|
-
init_types2();
|
5011
|
-
textEncoder2 = new TextEncoder();
|
5012
|
-
textDecoder2 = new TextDecoder();
|
5013
|
-
}
|
5014
|
-
});
|
5015
|
-
|
5016
|
-
// src/runtime/store-sql/index.ts
|
5017
|
-
var store_sql_exports = {};
|
5018
|
-
__export(store_sql_exports, {
|
5019
|
-
DefaultSQLTableNames: () => DefaultSQLTableNames,
|
5020
|
-
ensureSQLOpts: () => ensureSQLOpts
|
5021
|
-
});
|
5022
|
-
var init_store_sql = __esm({
|
5023
|
-
"src/runtime/store-sql/index.ts"() {
|
5024
|
-
"use strict";
|
5025
|
-
init_types2();
|
5026
|
-
init_ensurer();
|
5027
|
-
}
|
5028
|
-
});
|
5029
|
-
|
5030
4861
|
// src/runtime/crypto.ts
|
5031
4862
|
var crypto_exports = {};
|
5032
4863
|
__export(crypto_exports, {
|
@@ -5082,9 +4913,9 @@ var fireproof = (() => {
|
|
5082
4913
|
if (offset >= bytes.length) {
|
5083
4914
|
throw new Error("protobuf: unexpected end of data");
|
5084
4915
|
}
|
5085
|
-
const
|
5086
|
-
v += shift < 28 ? (
|
5087
|
-
if (
|
4916
|
+
const b = bytes[offset++];
|
4917
|
+
v += shift < 28 ? (b & 127) << shift : (b & 127) * 2 ** shift;
|
4918
|
+
if (b < 128) {
|
5088
4919
|
break;
|
5089
4920
|
}
|
5090
4921
|
}
|
@@ -5109,9 +4940,9 @@ var fireproof = (() => {
|
|
5109
4940
|
}
|
5110
4941
|
function decodeLink(bytes) {
|
5111
4942
|
const link2 = {};
|
5112
|
-
const
|
4943
|
+
const l = bytes.length;
|
5113
4944
|
let index2 = 0;
|
5114
|
-
while (index2 <
|
4945
|
+
while (index2 < l) {
|
5115
4946
|
let wireType, fieldNum;
|
5116
4947
|
[wireType, fieldNum, index2] = decodeKey(bytes, index2);
|
5117
4948
|
if (fieldNum === 1) {
|
@@ -5140,7 +4971,7 @@ var fireproof = (() => {
|
|
5140
4971
|
}
|
5141
4972
|
let byts;
|
5142
4973
|
[byts, index2] = decodeBytes(bytes, index2);
|
5143
|
-
link2.Name =
|
4974
|
+
link2.Name = textDecoder2.decode(byts);
|
5144
4975
|
} else if (fieldNum === 3) {
|
5145
4976
|
if (link2.Tsize !== void 0) {
|
5146
4977
|
throw new Error("protobuf: (PBLink) duplicate Tsize section");
|
@@ -5153,18 +4984,18 @@ var fireproof = (() => {
|
|
5153
4984
|
throw new Error(`protobuf: (PBLink) invalid fieldNumber, expected 1, 2 or 3, got ${fieldNum}`);
|
5154
4985
|
}
|
5155
4986
|
}
|
5156
|
-
if (index2 >
|
4987
|
+
if (index2 > l) {
|
5157
4988
|
throw new Error("protobuf: (PBLink) unexpected end of data");
|
5158
4989
|
}
|
5159
4990
|
return link2;
|
5160
4991
|
}
|
5161
4992
|
function decodeNode(bytes) {
|
5162
|
-
const
|
4993
|
+
const l = bytes.length;
|
5163
4994
|
let index2 = 0;
|
5164
4995
|
let links3 = void 0;
|
5165
4996
|
let linksBeforeData = false;
|
5166
4997
|
let data = void 0;
|
5167
|
-
while (index2 <
|
4998
|
+
while (index2 < l) {
|
5168
4999
|
let wireType, fieldNum;
|
5169
5000
|
[wireType, fieldNum, index2] = decodeKey(bytes, index2);
|
5170
5001
|
if (wireType !== 2) {
|
@@ -5191,7 +5022,7 @@ var fireproof = (() => {
|
|
5191
5022
|
throw new Error(`protobuf: (PBNode) invalid fieldNumber, expected 1 or 2, got ${fieldNum}`);
|
5192
5023
|
}
|
5193
5024
|
}
|
5194
|
-
if (index2 >
|
5025
|
+
if (index2 > l) {
|
5195
5026
|
throw new Error("protobuf: (PBNode) unexpected end of data");
|
5196
5027
|
}
|
5197
5028
|
const node = {};
|
@@ -5201,11 +5032,11 @@ var fireproof = (() => {
|
|
5201
5032
|
node.Links = links3 || [];
|
5202
5033
|
return node;
|
5203
5034
|
}
|
5204
|
-
var
|
5035
|
+
var textDecoder2;
|
5205
5036
|
var init_pb_decode = __esm({
|
5206
5037
|
"node_modules/.pnpm/@ipld+dag-pb@4.0.8/node_modules/@ipld/dag-pb/src/pb-decode.js"() {
|
5207
5038
|
"use strict";
|
5208
|
-
|
5039
|
+
textDecoder2 = new TextDecoder();
|
5209
5040
|
}
|
5210
5041
|
});
|
5211
5042
|
|
@@ -5223,7 +5054,7 @@ var fireproof = (() => {
|
|
5223
5054
|
bytes[i] = 24;
|
5224
5055
|
}
|
5225
5056
|
if (typeof link2.Name === "string") {
|
5226
|
-
const nameBytes =
|
5057
|
+
const nameBytes = textEncoder2.encode(link2.Name);
|
5227
5058
|
i -= nameBytes.length;
|
5228
5059
|
bytes.set(nameBytes, i);
|
5229
5060
|
i = encodeVarint(bytes, i, nameBytes.length) - 1;
|
@@ -5258,33 +5089,33 @@ var fireproof = (() => {
|
|
5258
5089
|
return bytes;
|
5259
5090
|
}
|
5260
5091
|
function sizeLink(link2) {
|
5261
|
-
let
|
5092
|
+
let n = 0;
|
5262
5093
|
if (link2.Hash) {
|
5263
|
-
const
|
5264
|
-
|
5094
|
+
const l = link2.Hash.length;
|
5095
|
+
n += 1 + l + sov(l);
|
5265
5096
|
}
|
5266
5097
|
if (typeof link2.Name === "string") {
|
5267
|
-
const
|
5268
|
-
|
5098
|
+
const l = textEncoder2.encode(link2.Name).length;
|
5099
|
+
n += 1 + l + sov(l);
|
5269
5100
|
}
|
5270
5101
|
if (typeof link2.Tsize === "number") {
|
5271
|
-
|
5102
|
+
n += 1 + sov(link2.Tsize);
|
5272
5103
|
}
|
5273
|
-
return
|
5104
|
+
return n;
|
5274
5105
|
}
|
5275
5106
|
function sizeNode(node) {
|
5276
|
-
let
|
5107
|
+
let n = 0;
|
5277
5108
|
if (node.Data) {
|
5278
|
-
const
|
5279
|
-
|
5109
|
+
const l = node.Data.length;
|
5110
|
+
n += 1 + l + sov(l);
|
5280
5111
|
}
|
5281
5112
|
if (node.Links) {
|
5282
5113
|
for (const link2 of node.Links) {
|
5283
|
-
const
|
5284
|
-
|
5114
|
+
const l = sizeLink(link2);
|
5115
|
+
n += 1 + l + sov(l);
|
5285
5116
|
}
|
5286
5117
|
}
|
5287
|
-
return
|
5118
|
+
return n;
|
5288
5119
|
}
|
5289
5120
|
function encodeVarint(bytes, offset, v) {
|
5290
5121
|
offset -= sov(v);
|
@@ -5307,26 +5138,26 @@ var fireproof = (() => {
|
|
5307
5138
|
return Math.floor((len64(x) + 6) / 7);
|
5308
5139
|
}
|
5309
5140
|
function len64(x) {
|
5310
|
-
let
|
5141
|
+
let n = 0;
|
5311
5142
|
if (x >= maxInt32) {
|
5312
5143
|
x = Math.floor(x / maxInt32);
|
5313
|
-
|
5144
|
+
n = 32;
|
5314
5145
|
}
|
5315
5146
|
if (x >= 1 << 16) {
|
5316
5147
|
x >>>= 16;
|
5317
|
-
|
5148
|
+
n += 16;
|
5318
5149
|
}
|
5319
5150
|
if (x >= 1 << 8) {
|
5320
5151
|
x >>>= 8;
|
5321
|
-
|
5152
|
+
n += 8;
|
5322
5153
|
}
|
5323
|
-
return
|
5154
|
+
return n + len8tab[x];
|
5324
5155
|
}
|
5325
|
-
var
|
5156
|
+
var textEncoder2, maxInt32, maxUInt32, len8tab;
|
5326
5157
|
var init_pb_encode = __esm({
|
5327
5158
|
"node_modules/.pnpm/@ipld+dag-pb@4.0.8/node_modules/@ipld/dag-pb/src/pb-encode.js"() {
|
5328
5159
|
"use strict";
|
5329
|
-
|
5160
|
+
textEncoder2 = new TextEncoder();
|
5330
5161
|
maxInt32 = 2 ** 32;
|
5331
5162
|
maxUInt32 = 2 ** 31;
|
5332
5163
|
len8tab = [
|
@@ -5591,25 +5422,25 @@ var fireproof = (() => {
|
|
5591
5422
|
});
|
5592
5423
|
|
5593
5424
|
// node_modules/.pnpm/@ipld+dag-pb@4.0.8/node_modules/@ipld/dag-pb/src/util.js
|
5594
|
-
function linkComparator(
|
5595
|
-
if (
|
5425
|
+
function linkComparator(a, b) {
|
5426
|
+
if (a === b) {
|
5596
5427
|
return 0;
|
5597
5428
|
}
|
5598
|
-
const abuf =
|
5599
|
-
const bbuf =
|
5429
|
+
const abuf = a.Name ? textEncoder3.encode(a.Name) : [];
|
5430
|
+
const bbuf = b.Name ? textEncoder3.encode(b.Name) : [];
|
5600
5431
|
let x = abuf.length;
|
5601
|
-
let
|
5602
|
-
for (let i = 0, len = Math.min(x,
|
5432
|
+
let y = bbuf.length;
|
5433
|
+
for (let i = 0, len = Math.min(x, y); i < len; ++i) {
|
5603
5434
|
if (abuf[i] !== bbuf[i]) {
|
5604
5435
|
x = abuf[i];
|
5605
|
-
|
5436
|
+
y = bbuf[i];
|
5606
5437
|
break;
|
5607
5438
|
}
|
5608
5439
|
}
|
5609
|
-
return x <
|
5440
|
+
return x < y ? -1 : y < x ? 1 : 0;
|
5610
5441
|
}
|
5611
5442
|
function hasOnlyProperties(node, properties) {
|
5612
|
-
return !Object.keys(node).some((
|
5443
|
+
return !Object.keys(node).some((p) => !properties.includes(p));
|
5613
5444
|
}
|
5614
5445
|
function asLink(link2) {
|
5615
5446
|
if (typeof link2.asCID === "object") {
|
@@ -5661,7 +5492,7 @@ var fireproof = (() => {
|
|
5661
5492
|
const pbn = {};
|
5662
5493
|
if (node.Data !== void 0) {
|
5663
5494
|
if (typeof node.Data === "string") {
|
5664
|
-
pbn.Data =
|
5495
|
+
pbn.Data = textEncoder3.encode(node.Data);
|
5665
5496
|
} else if (node.Data instanceof Uint8Array) {
|
5666
5497
|
pbn.Data = node.Data;
|
5667
5498
|
} else {
|
@@ -5723,14 +5554,14 @@ var fireproof = (() => {
|
|
5723
5554
|
}
|
5724
5555
|
}
|
5725
5556
|
}
|
5726
|
-
var pbNodeProperties, pbLinkProperties,
|
5557
|
+
var pbNodeProperties, pbLinkProperties, textEncoder3;
|
5727
5558
|
var init_util = __esm({
|
5728
5559
|
"node_modules/.pnpm/@ipld+dag-pb@4.0.8/node_modules/@ipld/dag-pb/src/util.js"() {
|
5729
5560
|
"use strict";
|
5730
5561
|
init_cid();
|
5731
5562
|
pbNodeProperties = ["Data", "Links"];
|
5732
5563
|
pbLinkProperties = ["Hash", "Name", "Tsize"];
|
5733
|
-
|
5564
|
+
textEncoder3 = new TextEncoder();
|
5734
5565
|
}
|
5735
5566
|
});
|
5736
5567
|
|
@@ -5739,16 +5570,16 @@ var fireproof = (() => {
|
|
5739
5570
|
validate(node);
|
5740
5571
|
const pbn = {};
|
5741
5572
|
if (node.Links) {
|
5742
|
-
pbn.Links = node.Links.map((
|
5573
|
+
pbn.Links = node.Links.map((l) => {
|
5743
5574
|
const link2 = {};
|
5744
|
-
if (
|
5745
|
-
link2.Hash =
|
5575
|
+
if (l.Hash) {
|
5576
|
+
link2.Hash = l.Hash.bytes;
|
5746
5577
|
}
|
5747
|
-
if (
|
5748
|
-
link2.Name =
|
5578
|
+
if (l.Name !== void 0) {
|
5579
|
+
link2.Name = l.Name;
|
5749
5580
|
}
|
5750
|
-
if (
|
5751
|
-
link2.Tsize =
|
5581
|
+
if (l.Tsize !== void 0) {
|
5582
|
+
link2.Tsize = l.Tsize;
|
5752
5583
|
}
|
5753
5584
|
return link2;
|
5754
5585
|
});
|
@@ -5765,20 +5596,20 @@ var fireproof = (() => {
|
|
5765
5596
|
node.Data = pbn.Data;
|
5766
5597
|
}
|
5767
5598
|
if (pbn.Links) {
|
5768
|
-
node.Links = pbn.Links.map((
|
5599
|
+
node.Links = pbn.Links.map((l) => {
|
5769
5600
|
const link2 = {};
|
5770
5601
|
try {
|
5771
|
-
link2.Hash = CID.decode(
|
5602
|
+
link2.Hash = CID.decode(l.Hash);
|
5772
5603
|
} catch (e) {
|
5773
5604
|
}
|
5774
5605
|
if (!link2.Hash) {
|
5775
5606
|
throw new Error("Invalid Hash field found in link, expected CID");
|
5776
5607
|
}
|
5777
|
-
if (
|
5778
|
-
link2.Name =
|
5608
|
+
if (l.Name !== void 0) {
|
5609
|
+
link2.Name = l.Name;
|
5779
5610
|
}
|
5780
|
-
if (
|
5781
|
-
link2.Tsize =
|
5611
|
+
if (l.Tsize !== void 0) {
|
5612
|
+
link2.Tsize = l.Tsize;
|
5782
5613
|
}
|
5783
5614
|
return link2;
|
5784
5615
|
});
|
@@ -5839,13 +5670,13 @@ var fireproof = (() => {
|
|
5839
5670
|
"use strict";
|
5840
5671
|
var base643 = exports2;
|
5841
5672
|
base643.length = function length4(string3) {
|
5842
|
-
var
|
5843
|
-
if (!
|
5673
|
+
var p = string3.length;
|
5674
|
+
if (!p)
|
5844
5675
|
return 0;
|
5845
|
-
var
|
5846
|
-
while (--
|
5847
|
-
++
|
5848
|
-
return Math.ceil(string3.length * 3) / 4 -
|
5676
|
+
var n = 0;
|
5677
|
+
while (--p % 4 > 1 && string3.charAt(p) === "=")
|
5678
|
+
++n;
|
5679
|
+
return Math.ceil(string3.length * 3) / 4 - n;
|
5849
5680
|
};
|
5850
5681
|
var b64 = new Array(64);
|
5851
5682
|
var s64 = new Array(123);
|
@@ -5854,23 +5685,23 @@ var fireproof = (() => {
|
|
5854
5685
|
var i;
|
5855
5686
|
base643.encode = function encode17(buffer2, start, end) {
|
5856
5687
|
var parts = null, chunk = [];
|
5857
|
-
var i2 = 0, j = 0,
|
5688
|
+
var i2 = 0, j = 0, t;
|
5858
5689
|
while (start < end) {
|
5859
|
-
var
|
5690
|
+
var b = buffer2[start++];
|
5860
5691
|
switch (j) {
|
5861
5692
|
case 0:
|
5862
|
-
chunk[i2++] = b64[
|
5863
|
-
|
5693
|
+
chunk[i2++] = b64[b >> 2];
|
5694
|
+
t = (b & 3) << 4;
|
5864
5695
|
j = 1;
|
5865
5696
|
break;
|
5866
5697
|
case 1:
|
5867
|
-
chunk[i2++] = b64[
|
5868
|
-
|
5698
|
+
chunk[i2++] = b64[t | b >> 4];
|
5699
|
+
t = (b & 15) << 2;
|
5869
5700
|
j = 2;
|
5870
5701
|
break;
|
5871
5702
|
case 2:
|
5872
|
-
chunk[i2++] = b64[
|
5873
|
-
chunk[i2++] = b64[
|
5703
|
+
chunk[i2++] = b64[t | b >> 6];
|
5704
|
+
chunk[i2++] = b64[b & 63];
|
5874
5705
|
j = 0;
|
5875
5706
|
break;
|
5876
5707
|
}
|
@@ -5880,7 +5711,7 @@ var fireproof = (() => {
|
|
5880
5711
|
}
|
5881
5712
|
}
|
5882
5713
|
if (j) {
|
5883
|
-
chunk[i2++] = b64[
|
5714
|
+
chunk[i2++] = b64[t];
|
5884
5715
|
chunk[i2++] = 61;
|
5885
5716
|
if (j === 1)
|
5886
5717
|
chunk[i2++] = 61;
|
@@ -5895,30 +5726,30 @@ var fireproof = (() => {
|
|
5895
5726
|
var invalidEncoding = "invalid encoding";
|
5896
5727
|
base643.decode = function decode20(string3, buffer2, offset) {
|
5897
5728
|
var start = offset;
|
5898
|
-
var j = 0,
|
5729
|
+
var j = 0, t;
|
5899
5730
|
for (var i2 = 0; i2 < string3.length; ) {
|
5900
|
-
var
|
5901
|
-
if (
|
5731
|
+
var c = string3.charCodeAt(i2++);
|
5732
|
+
if (c === 61 && j > 1)
|
5902
5733
|
break;
|
5903
|
-
if ((
|
5734
|
+
if ((c = s64[c]) === void 0)
|
5904
5735
|
throw Error(invalidEncoding);
|
5905
5736
|
switch (j) {
|
5906
5737
|
case 0:
|
5907
|
-
|
5738
|
+
t = c;
|
5908
5739
|
j = 1;
|
5909
5740
|
break;
|
5910
5741
|
case 1:
|
5911
|
-
buffer2[offset++] =
|
5912
|
-
|
5742
|
+
buffer2[offset++] = t << 2 | (c & 48) >> 4;
|
5743
|
+
t = c;
|
5913
5744
|
j = 2;
|
5914
5745
|
break;
|
5915
5746
|
case 2:
|
5916
|
-
buffer2[offset++] = (
|
5917
|
-
|
5747
|
+
buffer2[offset++] = (t & 15) << 4 | (c & 60) >> 2;
|
5748
|
+
t = c;
|
5918
5749
|
j = 3;
|
5919
5750
|
break;
|
5920
5751
|
case 3:
|
5921
|
-
buffer2[offset++] = (
|
5752
|
+
buffer2[offset++] = (t & 3) << 6 | c;
|
5922
5753
|
j = 0;
|
5923
5754
|
break;
|
5924
5755
|
}
|
@@ -6196,14 +6027,14 @@ var fireproof = (() => {
|
|
6196
6027
|
"use strict";
|
6197
6028
|
var utf84 = exports2;
|
6198
6029
|
utf84.length = function utf8_length(string3) {
|
6199
|
-
var len = 0,
|
6030
|
+
var len = 0, c = 0;
|
6200
6031
|
for (var i = 0; i < string3.length; ++i) {
|
6201
|
-
|
6202
|
-
if (
|
6032
|
+
c = string3.charCodeAt(i);
|
6033
|
+
if (c < 128)
|
6203
6034
|
len += 1;
|
6204
|
-
else if (
|
6035
|
+
else if (c < 2048)
|
6205
6036
|
len += 2;
|
6206
|
-
else if ((
|
6037
|
+
else if ((c & 64512) === 55296 && (string3.charCodeAt(i + 1) & 64512) === 56320) {
|
6207
6038
|
++i;
|
6208
6039
|
len += 4;
|
6209
6040
|
} else
|
@@ -6215,19 +6046,19 @@ var fireproof = (() => {
|
|
6215
6046
|
var len = end - start;
|
6216
6047
|
if (len < 1)
|
6217
6048
|
return "";
|
6218
|
-
var parts = null, chunk = [], i = 0,
|
6049
|
+
var parts = null, chunk = [], i = 0, t;
|
6219
6050
|
while (start < end) {
|
6220
|
-
|
6221
|
-
if (
|
6222
|
-
chunk[i++] =
|
6223
|
-
else if (
|
6224
|
-
chunk[i++] = (
|
6225
|
-
else if (
|
6226
|
-
|
6227
|
-
chunk[i++] = 55296 + (
|
6228
|
-
chunk[i++] = 56320 + (
|
6051
|
+
t = buffer2[start++];
|
6052
|
+
if (t < 128)
|
6053
|
+
chunk[i++] = t;
|
6054
|
+
else if (t > 191 && t < 224)
|
6055
|
+
chunk[i++] = (t & 31) << 6 | buffer2[start++] & 63;
|
6056
|
+
else if (t > 239 && t < 365) {
|
6057
|
+
t = ((t & 7) << 18 | (buffer2[start++] & 63) << 12 | (buffer2[start++] & 63) << 6 | buffer2[start++] & 63) - 65536;
|
6058
|
+
chunk[i++] = 55296 + (t >> 10);
|
6059
|
+
chunk[i++] = 56320 + (t & 1023);
|
6229
6060
|
} else
|
6230
|
-
chunk[i++] = (
|
6061
|
+
chunk[i++] = (t & 15) << 12 | (buffer2[start++] & 63) << 6 | buffer2[start++] & 63;
|
6231
6062
|
if (i > 8191) {
|
6232
6063
|
(parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
|
6233
6064
|
i = 0;
|
@@ -6434,7 +6265,7 @@ var fireproof = (() => {
|
|
6434
6265
|
* @param {string} prop Property name
|
6435
6266
|
* @returns {boolean} `true` if considered to be present, otherwise `false`
|
6436
6267
|
*/
|
6437
|
-
util.isSet = function
|
6268
|
+
util.isSet = function isSet2(obj, prop) {
|
6438
6269
|
var value = obj[prop];
|
6439
6270
|
if (value != null && obj.hasOwnProperty(prop))
|
6440
6271
|
return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
|
@@ -7191,12 +7022,12 @@ var fireproof = (() => {
|
|
7191
7022
|
$util = import_minimal.default.util;
|
7192
7023
|
$root = import_minimal.default.roots.unixfs || (import_minimal.default.roots.unixfs = {});
|
7193
7024
|
Data = $root.Data = (() => {
|
7194
|
-
function Data3(
|
7025
|
+
function Data3(p) {
|
7195
7026
|
this.blocksizes = [];
|
7196
|
-
if (
|
7197
|
-
for (var ks = Object.keys(
|
7198
|
-
if (
|
7199
|
-
this[ks[i]] =
|
7027
|
+
if (p) {
|
7028
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
7029
|
+
if (p[ks[i]] != null)
|
7030
|
+
this[ks[i]] = p[ks[i]];
|
7200
7031
|
}
|
7201
7032
|
}
|
7202
7033
|
Data3.prototype.Type = 0;
|
@@ -7207,240 +7038,240 @@ var fireproof = (() => {
|
|
7207
7038
|
Data3.prototype.fanout = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
|
7208
7039
|
Data3.prototype.mode = 0;
|
7209
7040
|
Data3.prototype.mtime = null;
|
7210
|
-
Data3.encode = function encode17(
|
7211
|
-
if (!
|
7212
|
-
|
7213
|
-
|
7214
|
-
if (
|
7215
|
-
|
7216
|
-
if (
|
7217
|
-
|
7218
|
-
if (
|
7219
|
-
for (var i = 0; i <
|
7220
|
-
|
7221
|
-
}
|
7222
|
-
if (
|
7223
|
-
|
7224
|
-
if (
|
7225
|
-
|
7226
|
-
if (
|
7227
|
-
|
7228
|
-
if (
|
7229
|
-
$root.UnixTime.encode(
|
7230
|
-
return
|
7041
|
+
Data3.encode = function encode17(m, w) {
|
7042
|
+
if (!w)
|
7043
|
+
w = $Writer.create();
|
7044
|
+
w.uint32(8).int32(m.Type);
|
7045
|
+
if (m.Data != null && Object.hasOwnProperty.call(m, "Data"))
|
7046
|
+
w.uint32(18).bytes(m.Data);
|
7047
|
+
if (m.filesize != null && Object.hasOwnProperty.call(m, "filesize"))
|
7048
|
+
w.uint32(24).uint64(m.filesize);
|
7049
|
+
if (m.blocksizes != null && m.blocksizes.length) {
|
7050
|
+
for (var i = 0; i < m.blocksizes.length; ++i)
|
7051
|
+
w.uint32(32).uint64(m.blocksizes[i]);
|
7052
|
+
}
|
7053
|
+
if (m.hashType != null && Object.hasOwnProperty.call(m, "hashType"))
|
7054
|
+
w.uint32(40).uint64(m.hashType);
|
7055
|
+
if (m.fanout != null && Object.hasOwnProperty.call(m, "fanout"))
|
7056
|
+
w.uint32(48).uint64(m.fanout);
|
7057
|
+
if (m.mode != null && Object.hasOwnProperty.call(m, "mode"))
|
7058
|
+
w.uint32(56).uint32(m.mode);
|
7059
|
+
if (m.mtime != null && Object.hasOwnProperty.call(m, "mtime"))
|
7060
|
+
$root.UnixTime.encode(m.mtime, w.uint32(66).fork()).ldelim();
|
7061
|
+
return w;
|
7231
7062
|
};
|
7232
|
-
Data3.decode = function decode20(
|
7233
|
-
if (!(
|
7234
|
-
|
7235
|
-
var
|
7236
|
-
while (
|
7237
|
-
var
|
7238
|
-
switch (
|
7063
|
+
Data3.decode = function decode20(r, l) {
|
7064
|
+
if (!(r instanceof $Reader))
|
7065
|
+
r = $Reader.create(r);
|
7066
|
+
var c = l === void 0 ? r.len : r.pos + l, m = new $root.Data();
|
7067
|
+
while (r.pos < c) {
|
7068
|
+
var t = r.uint32();
|
7069
|
+
switch (t >>> 3) {
|
7239
7070
|
case 1:
|
7240
|
-
|
7071
|
+
m.Type = r.int32();
|
7241
7072
|
break;
|
7242
7073
|
case 2:
|
7243
|
-
|
7074
|
+
m.Data = r.bytes();
|
7244
7075
|
break;
|
7245
7076
|
case 3:
|
7246
|
-
|
7077
|
+
m.filesize = r.uint64();
|
7247
7078
|
break;
|
7248
7079
|
case 4:
|
7249
|
-
if (!(
|
7250
|
-
|
7251
|
-
if ((
|
7252
|
-
var
|
7253
|
-
while (
|
7254
|
-
|
7080
|
+
if (!(m.blocksizes && m.blocksizes.length))
|
7081
|
+
m.blocksizes = [];
|
7082
|
+
if ((t & 7) === 2) {
|
7083
|
+
var c2 = r.uint32() + r.pos;
|
7084
|
+
while (r.pos < c2)
|
7085
|
+
m.blocksizes.push(r.uint64());
|
7255
7086
|
} else
|
7256
|
-
|
7087
|
+
m.blocksizes.push(r.uint64());
|
7257
7088
|
break;
|
7258
7089
|
case 5:
|
7259
|
-
|
7090
|
+
m.hashType = r.uint64();
|
7260
7091
|
break;
|
7261
7092
|
case 6:
|
7262
|
-
|
7093
|
+
m.fanout = r.uint64();
|
7263
7094
|
break;
|
7264
7095
|
case 7:
|
7265
|
-
|
7096
|
+
m.mode = r.uint32();
|
7266
7097
|
break;
|
7267
7098
|
case 8:
|
7268
|
-
|
7099
|
+
m.mtime = $root.UnixTime.decode(r, r.uint32());
|
7269
7100
|
break;
|
7270
7101
|
default:
|
7271
|
-
|
7102
|
+
r.skipType(t & 7);
|
7272
7103
|
break;
|
7273
7104
|
}
|
7274
7105
|
}
|
7275
|
-
if (!
|
7276
|
-
throw $util.ProtocolError("missing required 'Type'", { instance:
|
7277
|
-
return
|
7106
|
+
if (!m.hasOwnProperty("Type"))
|
7107
|
+
throw $util.ProtocolError("missing required 'Type'", { instance: m });
|
7108
|
+
return m;
|
7278
7109
|
};
|
7279
|
-
Data3.fromObject = function fromObject(
|
7280
|
-
if (
|
7281
|
-
return
|
7282
|
-
var
|
7283
|
-
switch (
|
7110
|
+
Data3.fromObject = function fromObject(d) {
|
7111
|
+
if (d instanceof $root.Data)
|
7112
|
+
return d;
|
7113
|
+
var m = new $root.Data();
|
7114
|
+
switch (d.Type) {
|
7284
7115
|
case "Raw":
|
7285
7116
|
case 0:
|
7286
|
-
|
7117
|
+
m.Type = 0;
|
7287
7118
|
break;
|
7288
7119
|
case "Directory":
|
7289
7120
|
case 1:
|
7290
|
-
|
7121
|
+
m.Type = 1;
|
7291
7122
|
break;
|
7292
7123
|
case "File":
|
7293
7124
|
case 2:
|
7294
|
-
|
7125
|
+
m.Type = 2;
|
7295
7126
|
break;
|
7296
7127
|
case "Metadata":
|
7297
7128
|
case 3:
|
7298
|
-
|
7129
|
+
m.Type = 3;
|
7299
7130
|
break;
|
7300
7131
|
case "Symlink":
|
7301
7132
|
case 4:
|
7302
|
-
|
7133
|
+
m.Type = 4;
|
7303
7134
|
break;
|
7304
7135
|
case "HAMTShard":
|
7305
7136
|
case 5:
|
7306
|
-
|
7137
|
+
m.Type = 5;
|
7307
7138
|
break;
|
7308
7139
|
}
|
7309
|
-
if (
|
7310
|
-
if (typeof
|
7311
|
-
$util.base64.decode(
|
7312
|
-
else if (
|
7313
|
-
|
7140
|
+
if (d.Data != null) {
|
7141
|
+
if (typeof d.Data === "string")
|
7142
|
+
$util.base64.decode(d.Data, m.Data = $util.newBuffer($util.base64.length(d.Data)), 0);
|
7143
|
+
else if (d.Data.length)
|
7144
|
+
m.Data = d.Data;
|
7314
7145
|
}
|
7315
|
-
if (
|
7146
|
+
if (d.filesize != null) {
|
7316
7147
|
if ($util.Long)
|
7317
|
-
(
|
7318
|
-
else if (typeof
|
7319
|
-
|
7320
|
-
else if (typeof
|
7321
|
-
|
7322
|
-
else if (typeof
|
7323
|
-
|
7324
|
-
}
|
7325
|
-
if (
|
7326
|
-
if (!Array.isArray(
|
7148
|
+
(m.filesize = $util.Long.fromValue(d.filesize)).unsigned = true;
|
7149
|
+
else if (typeof d.filesize === "string")
|
7150
|
+
m.filesize = parseInt(d.filesize, 10);
|
7151
|
+
else if (typeof d.filesize === "number")
|
7152
|
+
m.filesize = d.filesize;
|
7153
|
+
else if (typeof d.filesize === "object")
|
7154
|
+
m.filesize = new $util.LongBits(d.filesize.low >>> 0, d.filesize.high >>> 0).toNumber(true);
|
7155
|
+
}
|
7156
|
+
if (d.blocksizes) {
|
7157
|
+
if (!Array.isArray(d.blocksizes))
|
7327
7158
|
throw TypeError(".Data.blocksizes: array expected");
|
7328
|
-
|
7329
|
-
for (var i = 0; i <
|
7159
|
+
m.blocksizes = [];
|
7160
|
+
for (var i = 0; i < d.blocksizes.length; ++i) {
|
7330
7161
|
if ($util.Long)
|
7331
|
-
(
|
7332
|
-
else if (typeof
|
7333
|
-
|
7334
|
-
else if (typeof
|
7335
|
-
|
7336
|
-
else if (typeof
|
7337
|
-
|
7162
|
+
(m.blocksizes[i] = $util.Long.fromValue(d.blocksizes[i])).unsigned = true;
|
7163
|
+
else if (typeof d.blocksizes[i] === "string")
|
7164
|
+
m.blocksizes[i] = parseInt(d.blocksizes[i], 10);
|
7165
|
+
else if (typeof d.blocksizes[i] === "number")
|
7166
|
+
m.blocksizes[i] = d.blocksizes[i];
|
7167
|
+
else if (typeof d.blocksizes[i] === "object")
|
7168
|
+
m.blocksizes[i] = new $util.LongBits(d.blocksizes[i].low >>> 0, d.blocksizes[i].high >>> 0).toNumber(true);
|
7338
7169
|
}
|
7339
7170
|
}
|
7340
|
-
if (
|
7171
|
+
if (d.hashType != null) {
|
7341
7172
|
if ($util.Long)
|
7342
|
-
(
|
7343
|
-
else if (typeof
|
7344
|
-
|
7345
|
-
else if (typeof
|
7346
|
-
|
7347
|
-
else if (typeof
|
7348
|
-
|
7349
|
-
}
|
7350
|
-
if (
|
7173
|
+
(m.hashType = $util.Long.fromValue(d.hashType)).unsigned = true;
|
7174
|
+
else if (typeof d.hashType === "string")
|
7175
|
+
m.hashType = parseInt(d.hashType, 10);
|
7176
|
+
else if (typeof d.hashType === "number")
|
7177
|
+
m.hashType = d.hashType;
|
7178
|
+
else if (typeof d.hashType === "object")
|
7179
|
+
m.hashType = new $util.LongBits(d.hashType.low >>> 0, d.hashType.high >>> 0).toNumber(true);
|
7180
|
+
}
|
7181
|
+
if (d.fanout != null) {
|
7351
7182
|
if ($util.Long)
|
7352
|
-
(
|
7353
|
-
else if (typeof
|
7354
|
-
|
7355
|
-
else if (typeof
|
7356
|
-
|
7357
|
-
else if (typeof
|
7358
|
-
|
7359
|
-
}
|
7360
|
-
if (
|
7361
|
-
|
7362
|
-
}
|
7363
|
-
if (
|
7364
|
-
if (typeof
|
7183
|
+
(m.fanout = $util.Long.fromValue(d.fanout)).unsigned = true;
|
7184
|
+
else if (typeof d.fanout === "string")
|
7185
|
+
m.fanout = parseInt(d.fanout, 10);
|
7186
|
+
else if (typeof d.fanout === "number")
|
7187
|
+
m.fanout = d.fanout;
|
7188
|
+
else if (typeof d.fanout === "object")
|
7189
|
+
m.fanout = new $util.LongBits(d.fanout.low >>> 0, d.fanout.high >>> 0).toNumber(true);
|
7190
|
+
}
|
7191
|
+
if (d.mode != null) {
|
7192
|
+
m.mode = d.mode >>> 0;
|
7193
|
+
}
|
7194
|
+
if (d.mtime != null) {
|
7195
|
+
if (typeof d.mtime !== "object")
|
7365
7196
|
throw TypeError(".Data.mtime: object expected");
|
7366
|
-
|
7197
|
+
m.mtime = $root.UnixTime.fromObject(d.mtime);
|
7367
7198
|
}
|
7368
|
-
return
|
7199
|
+
return m;
|
7369
7200
|
};
|
7370
|
-
Data3.toObject = function toObject(
|
7201
|
+
Data3.toObject = function toObject(m, o) {
|
7371
7202
|
if (!o)
|
7372
7203
|
o = {};
|
7373
|
-
var
|
7204
|
+
var d = {};
|
7374
7205
|
if (o.arrays || o.defaults) {
|
7375
|
-
|
7206
|
+
d.blocksizes = [];
|
7376
7207
|
}
|
7377
7208
|
if (o.defaults) {
|
7378
|
-
|
7209
|
+
d.Type = o.enums === String ? "Raw" : 0;
|
7379
7210
|
if (o.bytes === String)
|
7380
|
-
|
7211
|
+
d.Data = "";
|
7381
7212
|
else {
|
7382
|
-
|
7213
|
+
d.Data = [];
|
7383
7214
|
if (o.bytes !== Array)
|
7384
|
-
|
7215
|
+
d.Data = $util.newBuffer(d.Data);
|
7385
7216
|
}
|
7386
7217
|
if ($util.Long) {
|
7387
|
-
var
|
7388
|
-
|
7218
|
+
var n = new $util.Long(0, 0, true);
|
7219
|
+
d.filesize = o.longs === String ? n.toString() : o.longs === Number ? n.toNumber() : n;
|
7389
7220
|
} else
|
7390
|
-
|
7221
|
+
d.filesize = o.longs === String ? "0" : 0;
|
7391
7222
|
if ($util.Long) {
|
7392
|
-
var
|
7393
|
-
|
7223
|
+
var n = new $util.Long(0, 0, true);
|
7224
|
+
d.hashType = o.longs === String ? n.toString() : o.longs === Number ? n.toNumber() : n;
|
7394
7225
|
} else
|
7395
|
-
|
7226
|
+
d.hashType = o.longs === String ? "0" : 0;
|
7396
7227
|
if ($util.Long) {
|
7397
|
-
var
|
7398
|
-
|
7228
|
+
var n = new $util.Long(0, 0, true);
|
7229
|
+
d.fanout = o.longs === String ? n.toString() : o.longs === Number ? n.toNumber() : n;
|
7399
7230
|
} else
|
7400
|
-
|
7401
|
-
|
7402
|
-
|
7231
|
+
d.fanout = o.longs === String ? "0" : 0;
|
7232
|
+
d.mode = 0;
|
7233
|
+
d.mtime = null;
|
7403
7234
|
}
|
7404
|
-
if (
|
7405
|
-
|
7235
|
+
if (m.Type != null && m.hasOwnProperty("Type")) {
|
7236
|
+
d.Type = o.enums === String ? $root.Data.DataType[m.Type] : m.Type;
|
7406
7237
|
}
|
7407
|
-
if (
|
7408
|
-
|
7238
|
+
if (m.Data != null && m.hasOwnProperty("Data")) {
|
7239
|
+
d.Data = o.bytes === String ? $util.base64.encode(m.Data, 0, m.Data.length) : o.bytes === Array ? Array.prototype.slice.call(m.Data) : m.Data;
|
7409
7240
|
}
|
7410
|
-
if (
|
7411
|
-
if (typeof
|
7412
|
-
|
7241
|
+
if (m.filesize != null && m.hasOwnProperty("filesize")) {
|
7242
|
+
if (typeof m.filesize === "number")
|
7243
|
+
d.filesize = o.longs === String ? String(m.filesize) : m.filesize;
|
7413
7244
|
else
|
7414
|
-
|
7245
|
+
d.filesize = o.longs === String ? $util.Long.prototype.toString.call(m.filesize) : o.longs === Number ? new $util.LongBits(m.filesize.low >>> 0, m.filesize.high >>> 0).toNumber(true) : m.filesize;
|
7415
7246
|
}
|
7416
|
-
if (
|
7417
|
-
|
7418
|
-
for (var j = 0; j <
|
7419
|
-
if (typeof
|
7420
|
-
|
7247
|
+
if (m.blocksizes && m.blocksizes.length) {
|
7248
|
+
d.blocksizes = [];
|
7249
|
+
for (var j = 0; j < m.blocksizes.length; ++j) {
|
7250
|
+
if (typeof m.blocksizes[j] === "number")
|
7251
|
+
d.blocksizes[j] = o.longs === String ? String(m.blocksizes[j]) : m.blocksizes[j];
|
7421
7252
|
else
|
7422
|
-
|
7253
|
+
d.blocksizes[j] = o.longs === String ? $util.Long.prototype.toString.call(m.blocksizes[j]) : o.longs === Number ? new $util.LongBits(m.blocksizes[j].low >>> 0, m.blocksizes[j].high >>> 0).toNumber(true) : m.blocksizes[j];
|
7423
7254
|
}
|
7424
7255
|
}
|
7425
|
-
if (
|
7426
|
-
if (typeof
|
7427
|
-
|
7256
|
+
if (m.hashType != null && m.hasOwnProperty("hashType")) {
|
7257
|
+
if (typeof m.hashType === "number")
|
7258
|
+
d.hashType = o.longs === String ? String(m.hashType) : m.hashType;
|
7428
7259
|
else
|
7429
|
-
|
7260
|
+
d.hashType = o.longs === String ? $util.Long.prototype.toString.call(m.hashType) : o.longs === Number ? new $util.LongBits(m.hashType.low >>> 0, m.hashType.high >>> 0).toNumber(true) : m.hashType;
|
7430
7261
|
}
|
7431
|
-
if (
|
7432
|
-
if (typeof
|
7433
|
-
|
7262
|
+
if (m.fanout != null && m.hasOwnProperty("fanout")) {
|
7263
|
+
if (typeof m.fanout === "number")
|
7264
|
+
d.fanout = o.longs === String ? String(m.fanout) : m.fanout;
|
7434
7265
|
else
|
7435
|
-
|
7266
|
+
d.fanout = o.longs === String ? $util.Long.prototype.toString.call(m.fanout) : o.longs === Number ? new $util.LongBits(m.fanout.low >>> 0, m.fanout.high >>> 0).toNumber(true) : m.fanout;
|
7436
7267
|
}
|
7437
|
-
if (
|
7438
|
-
|
7268
|
+
if (m.mode != null && m.hasOwnProperty("mode")) {
|
7269
|
+
d.mode = m.mode;
|
7439
7270
|
}
|
7440
|
-
if (
|
7441
|
-
|
7271
|
+
if (m.mtime != null && m.hasOwnProperty("mtime")) {
|
7272
|
+
d.mtime = $root.UnixTime.toObject(m.mtime, o);
|
7442
7273
|
}
|
7443
|
-
return
|
7274
|
+
return d;
|
7444
7275
|
};
|
7445
7276
|
Data3.prototype.toJSON = function toJSON2() {
|
7446
7277
|
return this.constructor.toObject(this, import_minimal.default.util.toJSONOptions);
|
@@ -7458,86 +7289,86 @@ var fireproof = (() => {
|
|
7458
7289
|
return Data3;
|
7459
7290
|
})();
|
7460
7291
|
UnixTime = $root.UnixTime = (() => {
|
7461
|
-
function UnixTime3(
|
7462
|
-
if (
|
7463
|
-
for (var ks = Object.keys(
|
7464
|
-
if (
|
7465
|
-
this[ks[i]] =
|
7292
|
+
function UnixTime3(p) {
|
7293
|
+
if (p) {
|
7294
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
7295
|
+
if (p[ks[i]] != null)
|
7296
|
+
this[ks[i]] = p[ks[i]];
|
7466
7297
|
}
|
7467
7298
|
}
|
7468
7299
|
UnixTime3.prototype.Seconds = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
|
7469
7300
|
UnixTime3.prototype.FractionalNanoseconds = 0;
|
7470
|
-
UnixTime3.encode = function encode17(
|
7471
|
-
if (!
|
7472
|
-
|
7473
|
-
|
7474
|
-
if (
|
7475
|
-
|
7476
|
-
return
|
7301
|
+
UnixTime3.encode = function encode17(m, w) {
|
7302
|
+
if (!w)
|
7303
|
+
w = $Writer.create();
|
7304
|
+
w.uint32(8).int64(m.Seconds);
|
7305
|
+
if (m.FractionalNanoseconds != null && Object.hasOwnProperty.call(m, "FractionalNanoseconds"))
|
7306
|
+
w.uint32(21).fixed32(m.FractionalNanoseconds);
|
7307
|
+
return w;
|
7477
7308
|
};
|
7478
|
-
UnixTime3.decode = function decode20(
|
7479
|
-
if (!(
|
7480
|
-
|
7481
|
-
var
|
7482
|
-
while (
|
7483
|
-
var
|
7484
|
-
switch (
|
7309
|
+
UnixTime3.decode = function decode20(r, l) {
|
7310
|
+
if (!(r instanceof $Reader))
|
7311
|
+
r = $Reader.create(r);
|
7312
|
+
var c = l === void 0 ? r.len : r.pos + l, m = new $root.UnixTime();
|
7313
|
+
while (r.pos < c) {
|
7314
|
+
var t = r.uint32();
|
7315
|
+
switch (t >>> 3) {
|
7485
7316
|
case 1:
|
7486
|
-
|
7317
|
+
m.Seconds = r.int64();
|
7487
7318
|
break;
|
7488
7319
|
case 2:
|
7489
|
-
|
7320
|
+
m.FractionalNanoseconds = r.fixed32();
|
7490
7321
|
break;
|
7491
7322
|
default:
|
7492
|
-
|
7323
|
+
r.skipType(t & 7);
|
7493
7324
|
break;
|
7494
7325
|
}
|
7495
7326
|
}
|
7496
|
-
if (!
|
7497
|
-
throw $util.ProtocolError("missing required 'Seconds'", { instance:
|
7498
|
-
return
|
7327
|
+
if (!m.hasOwnProperty("Seconds"))
|
7328
|
+
throw $util.ProtocolError("missing required 'Seconds'", { instance: m });
|
7329
|
+
return m;
|
7499
7330
|
};
|
7500
|
-
UnixTime3.fromObject = function fromObject(
|
7501
|
-
if (
|
7502
|
-
return
|
7503
|
-
var
|
7504
|
-
if (
|
7331
|
+
UnixTime3.fromObject = function fromObject(d) {
|
7332
|
+
if (d instanceof $root.UnixTime)
|
7333
|
+
return d;
|
7334
|
+
var m = new $root.UnixTime();
|
7335
|
+
if (d.Seconds != null) {
|
7505
7336
|
if ($util.Long)
|
7506
|
-
(
|
7507
|
-
else if (typeof
|
7508
|
-
|
7509
|
-
else if (typeof
|
7510
|
-
|
7511
|
-
else if (typeof
|
7512
|
-
|
7513
|
-
}
|
7514
|
-
if (
|
7515
|
-
|
7516
|
-
}
|
7517
|
-
return
|
7337
|
+
(m.Seconds = $util.Long.fromValue(d.Seconds)).unsigned = false;
|
7338
|
+
else if (typeof d.Seconds === "string")
|
7339
|
+
m.Seconds = parseInt(d.Seconds, 10);
|
7340
|
+
else if (typeof d.Seconds === "number")
|
7341
|
+
m.Seconds = d.Seconds;
|
7342
|
+
else if (typeof d.Seconds === "object")
|
7343
|
+
m.Seconds = new $util.LongBits(d.Seconds.low >>> 0, d.Seconds.high >>> 0).toNumber();
|
7344
|
+
}
|
7345
|
+
if (d.FractionalNanoseconds != null) {
|
7346
|
+
m.FractionalNanoseconds = d.FractionalNanoseconds >>> 0;
|
7347
|
+
}
|
7348
|
+
return m;
|
7518
7349
|
};
|
7519
|
-
UnixTime3.toObject = function toObject(
|
7350
|
+
UnixTime3.toObject = function toObject(m, o) {
|
7520
7351
|
if (!o)
|
7521
7352
|
o = {};
|
7522
|
-
var
|
7353
|
+
var d = {};
|
7523
7354
|
if (o.defaults) {
|
7524
7355
|
if ($util.Long) {
|
7525
|
-
var
|
7526
|
-
|
7356
|
+
var n = new $util.Long(0, 0, false);
|
7357
|
+
d.Seconds = o.longs === String ? n.toString() : o.longs === Number ? n.toNumber() : n;
|
7527
7358
|
} else
|
7528
|
-
|
7529
|
-
|
7359
|
+
d.Seconds = o.longs === String ? "0" : 0;
|
7360
|
+
d.FractionalNanoseconds = 0;
|
7530
7361
|
}
|
7531
|
-
if (
|
7532
|
-
if (typeof
|
7533
|
-
|
7362
|
+
if (m.Seconds != null && m.hasOwnProperty("Seconds")) {
|
7363
|
+
if (typeof m.Seconds === "number")
|
7364
|
+
d.Seconds = o.longs === String ? String(m.Seconds) : m.Seconds;
|
7534
7365
|
else
|
7535
|
-
|
7366
|
+
d.Seconds = o.longs === String ? $util.Long.prototype.toString.call(m.Seconds) : o.longs === Number ? new $util.LongBits(m.Seconds.low >>> 0, m.Seconds.high >>> 0).toNumber() : m.Seconds;
|
7536
7367
|
}
|
7537
|
-
if (
|
7538
|
-
|
7368
|
+
if (m.FractionalNanoseconds != null && m.hasOwnProperty("FractionalNanoseconds")) {
|
7369
|
+
d.FractionalNanoseconds = m.FractionalNanoseconds;
|
7539
7370
|
}
|
7540
|
-
return
|
7371
|
+
return d;
|
7541
7372
|
};
|
7542
7373
|
UnixTime3.prototype.toJSON = function toJSON2() {
|
7543
7374
|
return this.constructor.toObject(this, import_minimal.default.util.toJSONOptions);
|
@@ -7545,58 +7376,58 @@ var fireproof = (() => {
|
|
7545
7376
|
return UnixTime3;
|
7546
7377
|
})();
|
7547
7378
|
Metadata = $root.Metadata = (() => {
|
7548
|
-
function Metadata3(
|
7549
|
-
if (
|
7550
|
-
for (var ks = Object.keys(
|
7551
|
-
if (
|
7552
|
-
this[ks[i]] =
|
7379
|
+
function Metadata3(p) {
|
7380
|
+
if (p) {
|
7381
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
7382
|
+
if (p[ks[i]] != null)
|
7383
|
+
this[ks[i]] = p[ks[i]];
|
7553
7384
|
}
|
7554
7385
|
}
|
7555
7386
|
Metadata3.prototype.MimeType = "";
|
7556
|
-
Metadata3.encode = function encode17(
|
7557
|
-
if (!
|
7558
|
-
|
7559
|
-
if (
|
7560
|
-
|
7561
|
-
return
|
7387
|
+
Metadata3.encode = function encode17(m, w) {
|
7388
|
+
if (!w)
|
7389
|
+
w = $Writer.create();
|
7390
|
+
if (m.MimeType != null && Object.hasOwnProperty.call(m, "MimeType"))
|
7391
|
+
w.uint32(10).string(m.MimeType);
|
7392
|
+
return w;
|
7562
7393
|
};
|
7563
|
-
Metadata3.decode = function decode20(
|
7564
|
-
if (!(
|
7565
|
-
|
7566
|
-
var
|
7567
|
-
while (
|
7568
|
-
var
|
7569
|
-
switch (
|
7394
|
+
Metadata3.decode = function decode20(r, l) {
|
7395
|
+
if (!(r instanceof $Reader))
|
7396
|
+
r = $Reader.create(r);
|
7397
|
+
var c = l === void 0 ? r.len : r.pos + l, m = new $root.Metadata();
|
7398
|
+
while (r.pos < c) {
|
7399
|
+
var t = r.uint32();
|
7400
|
+
switch (t >>> 3) {
|
7570
7401
|
case 1:
|
7571
|
-
|
7402
|
+
m.MimeType = r.string();
|
7572
7403
|
break;
|
7573
7404
|
default:
|
7574
|
-
|
7405
|
+
r.skipType(t & 7);
|
7575
7406
|
break;
|
7576
7407
|
}
|
7577
7408
|
}
|
7578
|
-
return
|
7409
|
+
return m;
|
7579
7410
|
};
|
7580
|
-
Metadata3.fromObject = function fromObject(
|
7581
|
-
if (
|
7582
|
-
return
|
7583
|
-
var
|
7584
|
-
if (
|
7585
|
-
|
7586
|
-
}
|
7587
|
-
return
|
7411
|
+
Metadata3.fromObject = function fromObject(d) {
|
7412
|
+
if (d instanceof $root.Metadata)
|
7413
|
+
return d;
|
7414
|
+
var m = new $root.Metadata();
|
7415
|
+
if (d.MimeType != null) {
|
7416
|
+
m.MimeType = String(d.MimeType);
|
7417
|
+
}
|
7418
|
+
return m;
|
7588
7419
|
};
|
7589
|
-
Metadata3.toObject = function toObject(
|
7420
|
+
Metadata3.toObject = function toObject(m, o) {
|
7590
7421
|
if (!o)
|
7591
7422
|
o = {};
|
7592
|
-
var
|
7423
|
+
var d = {};
|
7593
7424
|
if (o.defaults) {
|
7594
|
-
|
7425
|
+
d.MimeType = "";
|
7595
7426
|
}
|
7596
|
-
if (
|
7597
|
-
|
7427
|
+
if (m.MimeType != null && m.hasOwnProperty("MimeType")) {
|
7428
|
+
d.MimeType = m.MimeType;
|
7598
7429
|
}
|
7599
|
-
return
|
7430
|
+
return d;
|
7600
7431
|
};
|
7601
7432
|
Metadata3.prototype.toJSON = function toJSON2() {
|
7602
7433
|
return this.constructor.toObject(this, import_minimal.default.util.toJSONOptions);
|
@@ -7837,20 +7668,20 @@ var fireproof = (() => {
|
|
7837
7668
|
},
|
7838
7669
|
entries3.map(encodeNamedLink)
|
7839
7670
|
);
|
7840
|
-
readFanout = (
|
7841
|
-
if (Math.log2(
|
7842
|
-
return
|
7671
|
+
readFanout = (n) => {
|
7672
|
+
if (Math.log2(n) % 1 === 0) {
|
7673
|
+
return n;
|
7843
7674
|
} else {
|
7844
7675
|
throw new TypeError(
|
7845
|
-
`Expected hamt size to be a power of two instead got ${
|
7676
|
+
`Expected hamt size to be a power of two instead got ${n}`
|
7846
7677
|
);
|
7847
7678
|
}
|
7848
7679
|
};
|
7849
|
-
readInt = (
|
7850
|
-
if (Number.isInteger(
|
7851
|
-
return
|
7680
|
+
readInt = (n) => {
|
7681
|
+
if (Number.isInteger(n)) {
|
7682
|
+
return n;
|
7852
7683
|
} else {
|
7853
|
-
throw new TypeError(`Expected an integer value instead got ${
|
7684
|
+
throw new TypeError(`Expected an integer value instead got ${n}`);
|
7854
7685
|
}
|
7855
7686
|
};
|
7856
7687
|
createSymlink = (path, metadata = BLANK) => ({
|
@@ -7949,14 +7780,14 @@ var fireproof = (() => {
|
|
7949
7780
|
decodeFileLinks = (blocksizes, links3) => {
|
7950
7781
|
const parts = [];
|
7951
7782
|
const length4 = blocksizes.length;
|
7952
|
-
let
|
7953
|
-
while (
|
7783
|
+
let n = 0;
|
7784
|
+
while (n < length4) {
|
7954
7785
|
parts.push(
|
7955
7786
|
/** @type {UnixFS.FileLink} */
|
7956
7787
|
{
|
7957
|
-
cid: links3[
|
7958
|
-
dagByteLength: links3[
|
7959
|
-
contentByteLength: blocksizes[
|
7788
|
+
cid: links3[n].Hash,
|
7789
|
+
dagByteLength: links3[n].Tsize || 0,
|
7790
|
+
contentByteLength: blocksizes[n]
|
7960
7791
|
}
|
7961
7792
|
);
|
7962
7793
|
}
|
@@ -8779,12 +8610,12 @@ var fireproof = (() => {
|
|
8779
8610
|
return buffer2;
|
8780
8611
|
}
|
8781
8612
|
};
|
8782
|
-
get4 = (buffer2,
|
8783
|
-
if (
|
8613
|
+
get4 = (buffer2, n) => {
|
8614
|
+
if (n < buffer2.byteLength) {
|
8784
8615
|
let offset = 0;
|
8785
8616
|
for (const segment of buffer2.segments) {
|
8786
|
-
if (
|
8787
|
-
return segment[
|
8617
|
+
if (n < offset + segment.byteLength) {
|
8618
|
+
return segment[n - offset];
|
8788
8619
|
} else {
|
8789
8620
|
offset += segment.byteLength;
|
8790
8621
|
}
|
@@ -8849,8 +8680,8 @@ var fireproof = (() => {
|
|
8849
8680
|
/**
|
8850
8681
|
* @param {number} n
|
8851
8682
|
*/
|
8852
|
-
get(
|
8853
|
-
return get4(this,
|
8683
|
+
get(n) {
|
8684
|
+
return get4(this, n);
|
8854
8685
|
}
|
8855
8686
|
/**
|
8856
8687
|
*
|
@@ -9274,9 +9105,9 @@ var fireproof = (() => {
|
|
9274
9105
|
cut
|
9275
9106
|
});
|
9276
9107
|
cut = ({ maxChunkSize }, { byteLength }, end) => {
|
9277
|
-
const
|
9278
|
-
const chunks = new Array(
|
9279
|
-
const lastChunkSize = end ? byteLength -
|
9108
|
+
const n = byteLength / maxChunkSize | 0;
|
9109
|
+
const chunks = new Array(n).fill(maxChunkSize);
|
9110
|
+
const lastChunkSize = end ? byteLength - n * maxChunkSize : 0;
|
9280
9111
|
if (lastChunkSize > 0) {
|
9281
9112
|
chunks.push(lastChunkSize);
|
9282
9113
|
}
|
@@ -9719,94 +9550,94 @@ var fireproof = (() => {
|
|
9719
9550
|
}
|
9720
9551
|
return true;
|
9721
9552
|
}
|
9722
|
-
function _x86Multiply(
|
9723
|
-
return (
|
9553
|
+
function _x86Multiply(m, n) {
|
9554
|
+
return (m & 65535) * n + (((m >>> 16) * n & 65535) << 16);
|
9724
9555
|
}
|
9725
|
-
function _x86Rotl(
|
9726
|
-
return
|
9556
|
+
function _x86Rotl(m, n) {
|
9557
|
+
return m << n | m >>> 32 - n;
|
9727
9558
|
}
|
9728
|
-
function _x86Fmix(
|
9729
|
-
|
9730
|
-
|
9731
|
-
|
9732
|
-
|
9733
|
-
|
9734
|
-
return
|
9559
|
+
function _x86Fmix(h) {
|
9560
|
+
h ^= h >>> 16;
|
9561
|
+
h = _x86Multiply(h, 2246822507);
|
9562
|
+
h ^= h >>> 13;
|
9563
|
+
h = _x86Multiply(h, 3266489909);
|
9564
|
+
h ^= h >>> 16;
|
9565
|
+
return h;
|
9735
9566
|
}
|
9736
|
-
function _x64Add(
|
9737
|
-
|
9738
|
-
|
9567
|
+
function _x64Add(m, n) {
|
9568
|
+
m = [m[0] >>> 16, m[0] & 65535, m[1] >>> 16, m[1] & 65535];
|
9569
|
+
n = [n[0] >>> 16, n[0] & 65535, n[1] >>> 16, n[1] & 65535];
|
9739
9570
|
var o = [0, 0, 0, 0];
|
9740
|
-
o[3] +=
|
9571
|
+
o[3] += m[3] + n[3];
|
9741
9572
|
o[2] += o[3] >>> 16;
|
9742
9573
|
o[3] &= 65535;
|
9743
|
-
o[2] +=
|
9574
|
+
o[2] += m[2] + n[2];
|
9744
9575
|
o[1] += o[2] >>> 16;
|
9745
9576
|
o[2] &= 65535;
|
9746
|
-
o[1] +=
|
9577
|
+
o[1] += m[1] + n[1];
|
9747
9578
|
o[0] += o[1] >>> 16;
|
9748
9579
|
o[1] &= 65535;
|
9749
|
-
o[0] +=
|
9580
|
+
o[0] += m[0] + n[0];
|
9750
9581
|
o[0] &= 65535;
|
9751
9582
|
return [o[0] << 16 | o[1], o[2] << 16 | o[3]];
|
9752
9583
|
}
|
9753
|
-
function _x64Multiply(
|
9754
|
-
|
9755
|
-
|
9584
|
+
function _x64Multiply(m, n) {
|
9585
|
+
m = [m[0] >>> 16, m[0] & 65535, m[1] >>> 16, m[1] & 65535];
|
9586
|
+
n = [n[0] >>> 16, n[0] & 65535, n[1] >>> 16, n[1] & 65535];
|
9756
9587
|
var o = [0, 0, 0, 0];
|
9757
|
-
o[3] +=
|
9588
|
+
o[3] += m[3] * n[3];
|
9758
9589
|
o[2] += o[3] >>> 16;
|
9759
9590
|
o[3] &= 65535;
|
9760
|
-
o[2] +=
|
9591
|
+
o[2] += m[2] * n[3];
|
9761
9592
|
o[1] += o[2] >>> 16;
|
9762
9593
|
o[2] &= 65535;
|
9763
|
-
o[2] +=
|
9594
|
+
o[2] += m[3] * n[2];
|
9764
9595
|
o[1] += o[2] >>> 16;
|
9765
9596
|
o[2] &= 65535;
|
9766
|
-
o[1] +=
|
9597
|
+
o[1] += m[1] * n[3];
|
9767
9598
|
o[0] += o[1] >>> 16;
|
9768
9599
|
o[1] &= 65535;
|
9769
|
-
o[1] +=
|
9600
|
+
o[1] += m[2] * n[2];
|
9770
9601
|
o[0] += o[1] >>> 16;
|
9771
9602
|
o[1] &= 65535;
|
9772
|
-
o[1] +=
|
9603
|
+
o[1] += m[3] * n[1];
|
9773
9604
|
o[0] += o[1] >>> 16;
|
9774
9605
|
o[1] &= 65535;
|
9775
|
-
o[0] +=
|
9606
|
+
o[0] += m[0] * n[3] + m[1] * n[2] + m[2] * n[1] + m[3] * n[0];
|
9776
9607
|
o[0] &= 65535;
|
9777
9608
|
return [o[0] << 16 | o[1], o[2] << 16 | o[3]];
|
9778
9609
|
}
|
9779
|
-
function _x64Rotl(
|
9780
|
-
|
9781
|
-
if (
|
9782
|
-
return [
|
9783
|
-
} else if (
|
9784
|
-
return [
|
9610
|
+
function _x64Rotl(m, n) {
|
9611
|
+
n %= 64;
|
9612
|
+
if (n === 32) {
|
9613
|
+
return [m[1], m[0]];
|
9614
|
+
} else if (n < 32) {
|
9615
|
+
return [m[0] << n | m[1] >>> 32 - n, m[1] << n | m[0] >>> 32 - n];
|
9785
9616
|
} else {
|
9786
|
-
|
9787
|
-
return [
|
9617
|
+
n -= 32;
|
9618
|
+
return [m[1] << n | m[0] >>> 32 - n, m[0] << n | m[1] >>> 32 - n];
|
9788
9619
|
}
|
9789
9620
|
}
|
9790
|
-
function _x64LeftShift(
|
9791
|
-
|
9792
|
-
if (
|
9793
|
-
return
|
9794
|
-
} else if (
|
9795
|
-
return [
|
9621
|
+
function _x64LeftShift(m, n) {
|
9622
|
+
n %= 64;
|
9623
|
+
if (n === 0) {
|
9624
|
+
return m;
|
9625
|
+
} else if (n < 32) {
|
9626
|
+
return [m[0] << n | m[1] >>> 32 - n, m[1] << n];
|
9796
9627
|
} else {
|
9797
|
-
return [
|
9628
|
+
return [m[1] << n - 32, 0];
|
9798
9629
|
}
|
9799
9630
|
}
|
9800
|
-
function _x64Xor(
|
9801
|
-
return [
|
9631
|
+
function _x64Xor(m, n) {
|
9632
|
+
return [m[0] ^ n[0], m[1] ^ n[1]];
|
9802
9633
|
}
|
9803
|
-
function _x64Fmix(
|
9804
|
-
|
9805
|
-
|
9806
|
-
|
9807
|
-
|
9808
|
-
|
9809
|
-
return
|
9634
|
+
function _x64Fmix(h) {
|
9635
|
+
h = _x64Xor(h, [0, h[0] >>> 1]);
|
9636
|
+
h = _x64Multiply(h, [4283543511, 3981806797]);
|
9637
|
+
h = _x64Xor(h, [0, h[0] >>> 1]);
|
9638
|
+
h = _x64Multiply(h, [3301882366, 444984403]);
|
9639
|
+
h = _x64Xor(h, [0, h[0] >>> 1]);
|
9640
|
+
return h;
|
9810
9641
|
}
|
9811
9642
|
library.x86.hash32 = function(bytes, seed) {
|
9812
9643
|
if (library.inputValidation && !_validBytes(bytes)) {
|
@@ -10407,7 +10238,7 @@ var fireproof = (() => {
|
|
10407
10238
|
}
|
10408
10239
|
try {
|
10409
10240
|
return assign2(err, props);
|
10410
|
-
} catch (
|
10241
|
+
} catch (_) {
|
10411
10242
|
props.message = err.message;
|
10412
10243
|
props.stack = err.stack;
|
10413
10244
|
const ErrClass = function() {
|
@@ -10668,9 +10499,9 @@ var fireproof = (() => {
|
|
10668
10499
|
return this.modeStack[this.modeStack.length - 1];
|
10669
10500
|
}
|
10670
10501
|
skipWhitespace() {
|
10671
|
-
let
|
10672
|
-
while (
|
10673
|
-
|
10502
|
+
let c = this.ch();
|
10503
|
+
while (c === 32 || c === 9 || c === 13 || c === 10) {
|
10504
|
+
c = this.data[++this._pos];
|
10674
10505
|
}
|
10675
10506
|
}
|
10676
10507
|
/**
|
@@ -10751,7 +10582,7 @@ var fireproof = (() => {
|
|
10751
10582
|
throw new Error(`${decodeErrPrefix} unexpected character at position ${this._pos}; this shouldn't happen`);
|
10752
10583
|
}
|
10753
10584
|
this._pos++;
|
10754
|
-
for (let i = this._pos,
|
10585
|
+
for (let i = this._pos, l = 0; i < this.data.length && l < 65536; i++, l++) {
|
10755
10586
|
const ch = this.data[i];
|
10756
10587
|
if (ch === 92 || ch < 32 || ch >= 128) {
|
10757
10588
|
break;
|
@@ -10759,7 +10590,7 @@ var fireproof = (() => {
|
|
10759
10590
|
if (ch === 34) {
|
10760
10591
|
const str = String.fromCharCode.apply(null, this.data.subarray(this._pos, i));
|
10761
10592
|
this._pos = i + 1;
|
10762
|
-
return new Token(Type.string, str,
|
10593
|
+
return new Token(Type.string, str, l);
|
10763
10594
|
}
|
10764
10595
|
}
|
10765
10596
|
const startPos = this._pos;
|
@@ -11250,14 +11081,14 @@ var fireproof = (() => {
|
|
11250
11081
|
|
11251
11082
|
// node_modules/.pnpm/multiformats@13.1.1/node_modules/multiformats/dist/src/codecs/json.js
|
11252
11083
|
function decode13(data) {
|
11253
|
-
return JSON.parse(
|
11084
|
+
return JSON.parse(textDecoder3.decode(data));
|
11254
11085
|
}
|
11255
|
-
var
|
11086
|
+
var textEncoder4, textDecoder3, code6;
|
11256
11087
|
var init_json2 = __esm({
|
11257
11088
|
"node_modules/.pnpm/multiformats@13.1.1/node_modules/multiformats/dist/src/codecs/json.js"() {
|
11258
11089
|
"use strict";
|
11259
|
-
|
11260
|
-
|
11090
|
+
textEncoder4 = new TextEncoder();
|
11091
|
+
textDecoder3 = new TextDecoder();
|
11261
11092
|
code6 = 512;
|
11262
11093
|
}
|
11263
11094
|
});
|
@@ -11767,14 +11598,14 @@ var fireproof = (() => {
|
|
11767
11598
|
// node_modules/.pnpm/protons-runtime@5.2.2/node_modules/protons-runtime/dist/src/utils/utf8.js
|
11768
11599
|
function length2(string3) {
|
11769
11600
|
let len = 0;
|
11770
|
-
let
|
11601
|
+
let c = 0;
|
11771
11602
|
for (let i = 0; i < string3.length; ++i) {
|
11772
|
-
|
11773
|
-
if (
|
11603
|
+
c = string3.charCodeAt(i);
|
11604
|
+
if (c < 128) {
|
11774
11605
|
len += 1;
|
11775
|
-
} else if (
|
11606
|
+
} else if (c < 2048) {
|
11776
11607
|
len += 2;
|
11777
|
-
} else if ((
|
11608
|
+
} else if ((c & 64512) === 55296 && (string3.charCodeAt(i + 1) & 64512) === 56320) {
|
11778
11609
|
++i;
|
11779
11610
|
len += 4;
|
11780
11611
|
} else {
|
@@ -11791,19 +11622,19 @@ var fireproof = (() => {
|
|
11791
11622
|
let parts;
|
11792
11623
|
const chunk = [];
|
11793
11624
|
let i = 0;
|
11794
|
-
let
|
11625
|
+
let t;
|
11795
11626
|
while (start < end) {
|
11796
|
-
|
11797
|
-
if (
|
11798
|
-
chunk[i++] =
|
11799
|
-
} else if (
|
11800
|
-
chunk[i++] = (
|
11801
|
-
} else if (
|
11802
|
-
|
11803
|
-
chunk[i++] = 55296 + (
|
11804
|
-
chunk[i++] = 56320 + (
|
11627
|
+
t = buffer2[start++];
|
11628
|
+
if (t < 128) {
|
11629
|
+
chunk[i++] = t;
|
11630
|
+
} else if (t > 191 && t < 224) {
|
11631
|
+
chunk[i++] = (t & 31) << 6 | buffer2[start++] & 63;
|
11632
|
+
} else if (t > 239 && t < 365) {
|
11633
|
+
t = ((t & 7) << 18 | (buffer2[start++] & 63) << 12 | (buffer2[start++] & 63) << 6 | buffer2[start++] & 63) - 65536;
|
11634
|
+
chunk[i++] = 55296 + (t >> 10);
|
11635
|
+
chunk[i++] = 56320 + (t & 1023);
|
11805
11636
|
} else {
|
11806
|
-
chunk[i++] = (
|
11637
|
+
chunk[i++] = (t & 15) << 12 | (buffer2[start++] & 63) << 6 | buffer2[start++] & 63;
|
11807
11638
|
}
|
11808
11639
|
if (i > 8191) {
|
11809
11640
|
(parts ?? (parts = [])).push(String.fromCharCode.apply(String, chunk));
|
@@ -12276,9 +12107,9 @@ var fireproof = (() => {
|
|
12276
12107
|
base256emoji: () => base256emoji
|
12277
12108
|
});
|
12278
12109
|
function encode12(data) {
|
12279
|
-
return data.reduce((
|
12280
|
-
|
12281
|
-
return
|
12110
|
+
return data.reduce((p, c) => {
|
12111
|
+
p += alphabetBytesToChars[c];
|
12112
|
+
return p;
|
12282
12113
|
}, "");
|
12283
12114
|
}
|
12284
12115
|
function decode14(str) {
|
@@ -12298,13 +12129,13 @@ var fireproof = (() => {
|
|
12298
12129
|
"use strict";
|
12299
12130
|
init_base();
|
12300
12131
|
alphabet = Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}");
|
12301
|
-
alphabetBytesToChars = alphabet.reduce((
|
12302
|
-
|
12303
|
-
return
|
12132
|
+
alphabetBytesToChars = alphabet.reduce((p, c, i) => {
|
12133
|
+
p[i] = c;
|
12134
|
+
return p;
|
12304
12135
|
}, []);
|
12305
|
-
alphabetCharsToBytes = alphabet.reduce((
|
12306
|
-
|
12307
|
-
return
|
12136
|
+
alphabetCharsToBytes = alphabet.reduce((p, c, i) => {
|
12137
|
+
p[c.codePointAt(0)] = i;
|
12138
|
+
return p;
|
12308
12139
|
}, []);
|
12309
12140
|
base256emoji = from({
|
12310
12141
|
prefix: "\u{1F680}",
|
@@ -12897,11 +12728,11 @@ var fireproof = (() => {
|
|
12897
12728
|
|
12898
12729
|
// node_modules/.pnpm/protons-runtime@5.2.2/node_modules/protons-runtime/dist/src/encode.js
|
12899
12730
|
function encodeMessage(message2, codec) {
|
12900
|
-
const
|
12901
|
-
codec.encode(message2,
|
12731
|
+
const w = createWriter2();
|
12732
|
+
codec.encode(message2, w, {
|
12902
12733
|
lengthDelimited: false
|
12903
12734
|
});
|
12904
|
-
return
|
12735
|
+
return w.finish();
|
12905
12736
|
}
|
12906
12737
|
var init_encode3 = __esm({
|
12907
12738
|
"node_modules/.pnpm/protons-runtime@5.2.2/node_modules/protons-runtime/dist/src/encode.js"() {
|
@@ -13016,46 +12847,46 @@ var fireproof = (() => {
|
|
13016
12847
|
let _codec;
|
13017
12848
|
Data3.codec = () => {
|
13018
12849
|
if (_codec == null) {
|
13019
|
-
_codec = message((obj,
|
12850
|
+
_codec = message((obj, w, opts = {}) => {
|
13020
12851
|
if (opts.lengthDelimited !== false) {
|
13021
|
-
|
12852
|
+
w.fork();
|
13022
12853
|
}
|
13023
12854
|
if (obj.Type != null) {
|
13024
|
-
|
13025
|
-
Data3.DataType.codec().encode(obj.Type,
|
12855
|
+
w.uint32(8);
|
12856
|
+
Data3.DataType.codec().encode(obj.Type, w);
|
13026
12857
|
}
|
13027
12858
|
if (obj.Data != null) {
|
13028
|
-
|
13029
|
-
|
12859
|
+
w.uint32(18);
|
12860
|
+
w.bytes(obj.Data);
|
13030
12861
|
}
|
13031
12862
|
if (obj.filesize != null) {
|
13032
|
-
|
13033
|
-
|
12863
|
+
w.uint32(24);
|
12864
|
+
w.uint64(obj.filesize);
|
13034
12865
|
}
|
13035
12866
|
if (obj.blocksizes != null) {
|
13036
12867
|
for (const value of obj.blocksizes) {
|
13037
|
-
|
13038
|
-
|
12868
|
+
w.uint32(32);
|
12869
|
+
w.uint64(value);
|
13039
12870
|
}
|
13040
12871
|
}
|
13041
12872
|
if (obj.hashType != null) {
|
13042
|
-
|
13043
|
-
|
12873
|
+
w.uint32(40);
|
12874
|
+
w.uint64(obj.hashType);
|
13044
12875
|
}
|
13045
12876
|
if (obj.fanout != null) {
|
13046
|
-
|
13047
|
-
|
12877
|
+
w.uint32(48);
|
12878
|
+
w.uint64(obj.fanout);
|
13048
12879
|
}
|
13049
12880
|
if (obj.mode != null) {
|
13050
|
-
|
13051
|
-
|
12881
|
+
w.uint32(56);
|
12882
|
+
w.uint32(obj.mode);
|
13052
12883
|
}
|
13053
12884
|
if (obj.mtime != null) {
|
13054
|
-
|
13055
|
-
UnixTime2.codec().encode(obj.mtime,
|
12885
|
+
w.uint32(66);
|
12886
|
+
UnixTime2.codec().encode(obj.mtime, w);
|
13056
12887
|
}
|
13057
12888
|
if (opts.lengthDelimited !== false) {
|
13058
|
-
|
12889
|
+
w.ldelim();
|
13059
12890
|
}
|
13060
12891
|
}, (reader, length4) => {
|
13061
12892
|
const obj = {
|
@@ -13110,20 +12941,20 @@ var fireproof = (() => {
|
|
13110
12941
|
let _codec;
|
13111
12942
|
UnixTime3.codec = () => {
|
13112
12943
|
if (_codec == null) {
|
13113
|
-
_codec = message((obj,
|
12944
|
+
_codec = message((obj, w, opts = {}) => {
|
13114
12945
|
if (opts.lengthDelimited !== false) {
|
13115
|
-
|
12946
|
+
w.fork();
|
13116
12947
|
}
|
13117
12948
|
if (obj.Seconds != null) {
|
13118
|
-
|
13119
|
-
|
12949
|
+
w.uint32(8);
|
12950
|
+
w.int64(obj.Seconds);
|
13120
12951
|
}
|
13121
12952
|
if (obj.FractionalNanoseconds != null) {
|
13122
|
-
|
13123
|
-
|
12953
|
+
w.uint32(21);
|
12954
|
+
w.fixed32(obj.FractionalNanoseconds);
|
13124
12955
|
}
|
13125
12956
|
if (opts.lengthDelimited !== false) {
|
13126
|
-
|
12957
|
+
w.ldelim();
|
13127
12958
|
}
|
13128
12959
|
}, (reader, length4) => {
|
13129
12960
|
const obj = {};
|
@@ -13158,16 +12989,16 @@ var fireproof = (() => {
|
|
13158
12989
|
let _codec;
|
13159
12990
|
Metadata3.codec = () => {
|
13160
12991
|
if (_codec == null) {
|
13161
|
-
_codec = message((obj,
|
12992
|
+
_codec = message((obj, w, opts = {}) => {
|
13162
12993
|
if (opts.lengthDelimited !== false) {
|
13163
|
-
|
12994
|
+
w.fork();
|
13164
12995
|
}
|
13165
12996
|
if (obj.MimeType != null) {
|
13166
|
-
|
13167
|
-
|
12997
|
+
w.uint32(10);
|
12998
|
+
w.string(obj.MimeType);
|
13168
12999
|
}
|
13169
13000
|
if (opts.lengthDelimited !== false) {
|
13170
|
-
|
13001
|
+
w.ldelim();
|
13171
13002
|
}
|
13172
13003
|
}, (reader, length4) => {
|
13173
13004
|
const obj = {};
|
@@ -13569,8 +13400,8 @@ var fireproof = (() => {
|
|
13569
13400
|
v = (v & 858993459) + (v >> 2 & 858993459);
|
13570
13401
|
return (v + (v >> 4) & 252645135) * 16843009 >> 24;
|
13571
13402
|
}
|
13572
|
-
function sortInternal(
|
13573
|
-
return
|
13403
|
+
function sortInternal(a, b) {
|
13404
|
+
return a[0] - b[0];
|
13574
13405
|
}
|
13575
13406
|
function valueOnly(elem) {
|
13576
13407
|
return elem[1];
|
@@ -13759,7 +13590,7 @@ var fireproof = (() => {
|
|
13759
13590
|
throw new Error("Unknown type, must be binary type");
|
13760
13591
|
};
|
13761
13592
|
fromString4 = (str) => new TextEncoder().encode(str);
|
13762
|
-
toString3 = (
|
13593
|
+
toString3 = (b) => new TextDecoder().decode(b);
|
13763
13594
|
}
|
13764
13595
|
});
|
13765
13596
|
|
@@ -14055,9 +13886,9 @@ var fireproof = (() => {
|
|
14055
13886
|
base256emoji: () => base256emoji2
|
14056
13887
|
});
|
14057
13888
|
function encode14(data) {
|
14058
|
-
return data.reduce((
|
14059
|
-
|
14060
|
-
return
|
13889
|
+
return data.reduce((p, c) => {
|
13890
|
+
p += alphabetBytesToChars2[c];
|
13891
|
+
return p;
|
14061
13892
|
}, "");
|
14062
13893
|
}
|
14063
13894
|
function decode16(str) {
|
@@ -14082,21 +13913,21 @@ var fireproof = (() => {
|
|
14082
13913
|
alphabet2 = Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}");
|
14083
13914
|
alphabetBytesToChars2 = /** @type {string[]} */
|
14084
13915
|
alphabet2.reduce(
|
14085
|
-
(
|
14086
|
-
|
14087
|
-
return
|
13916
|
+
(p, c, i) => {
|
13917
|
+
p[i] = c;
|
13918
|
+
return p;
|
14088
13919
|
},
|
14089
13920
|
/** @type {string[]} */
|
14090
13921
|
[]
|
14091
13922
|
);
|
14092
13923
|
alphabetCharsToBytes2 = /** @type {number[]} */
|
14093
13924
|
alphabet2.reduce(
|
14094
|
-
(
|
14095
|
-
|
13925
|
+
(p, c, i) => {
|
13926
|
+
p[
|
14096
13927
|
/** @type {number} */
|
14097
|
-
|
13928
|
+
c.codePointAt(0)
|
14098
13929
|
] = i;
|
14099
|
-
return
|
13930
|
+
return p;
|
14100
13931
|
},
|
14101
13932
|
/** @type {number[]} */
|
14102
13933
|
[]
|
@@ -14313,12 +14144,12 @@ var fireproof = (() => {
|
|
14313
14144
|
});
|
14314
14145
|
|
14315
14146
|
// node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/codecs/json.js
|
14316
|
-
var
|
14147
|
+
var textEncoder5, textDecoder4;
|
14317
14148
|
var init_json4 = __esm({
|
14318
14149
|
"node_modules/.pnpm/multiformats@12.1.3/node_modules/multiformats/src/codecs/json.js"() {
|
14319
14150
|
"use strict";
|
14320
|
-
|
14321
|
-
|
14151
|
+
textEncoder5 = new TextEncoder();
|
14152
|
+
textDecoder4 = new TextDecoder();
|
14322
14153
|
}
|
14323
14154
|
});
|
14324
14155
|
|
@@ -14348,16 +14179,16 @@ var fireproof = (() => {
|
|
14348
14179
|
return out;
|
14349
14180
|
}
|
14350
14181
|
function read4(buf2, offset) {
|
14351
|
-
var res = 0, offset = offset || 0, shift = 0, counter = offset,
|
14182
|
+
var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf2.length;
|
14352
14183
|
do {
|
14353
|
-
if (counter >=
|
14184
|
+
if (counter >= l) {
|
14354
14185
|
read4.bytes = 0;
|
14355
14186
|
throw new RangeError("Could not decode varint");
|
14356
14187
|
}
|
14357
|
-
|
14358
|
-
res += shift < 28 ? (
|
14188
|
+
b = buf2[counter++];
|
14189
|
+
res += shift < 28 ? (b & REST$12) << shift : (b & REST$12) * Math.pow(2, shift);
|
14359
14190
|
shift += 7;
|
14360
|
-
} while (
|
14191
|
+
} while (b >= MSB$12);
|
14361
14192
|
read4.bytes = counter - offset;
|
14362
14193
|
return res;
|
14363
14194
|
}
|
@@ -14442,15 +14273,15 @@ var fireproof = (() => {
|
|
14442
14273
|
}
|
14443
14274
|
return new Digest2(code9, size, digest3, bytes);
|
14444
14275
|
};
|
14445
|
-
equals4 = (
|
14446
|
-
if (
|
14276
|
+
equals4 = (a, b) => {
|
14277
|
+
if (a === b) {
|
14447
14278
|
return true;
|
14448
14279
|
} else {
|
14449
14280
|
const data = (
|
14450
14281
|
/** @type {{code?:unknown, size?:unknown, bytes?:unknown}} */
|
14451
|
-
|
14282
|
+
b
|
14452
14283
|
);
|
14453
|
-
return
|
14284
|
+
return a.code === data.code && a.size === data.size && data.bytes instanceof Uint8Array && equals3(a.bytes, data.bytes);
|
14454
14285
|
}
|
14455
14286
|
};
|
14456
14287
|
Digest2 = class {
|
@@ -15210,7 +15041,7 @@ var fireproof = (() => {
|
|
15210
15041
|
function exists(o) {
|
15211
15042
|
return Boolean(o);
|
15212
15043
|
}
|
15213
|
-
function mapNode(node,
|
15044
|
+
function mapNode(node, _) {
|
15214
15045
|
return node.key;
|
15215
15046
|
}
|
15216
15047
|
function reduceNodes(nodes) {
|
@@ -16342,12 +16173,12 @@ var fireproof = (() => {
|
|
16342
16173
|
};
|
16343
16174
|
duplexPipelineFn = (duplex) => {
|
16344
16175
|
return (source) => {
|
16345
|
-
const
|
16346
|
-
if (
|
16176
|
+
const p = duplex.sink(source);
|
16177
|
+
if (p?.then != null) {
|
16347
16178
|
const stream = pushable({
|
16348
16179
|
objectMode: true
|
16349
16180
|
});
|
16350
|
-
|
16181
|
+
p.then(() => {
|
16351
16182
|
stream.end();
|
16352
16183
|
}, (err) => {
|
16353
16184
|
stream.end(err);
|
@@ -16461,7 +16292,7 @@ var fireproof = (() => {
|
|
16461
16292
|
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
16462
16293
|
if (!handlers) return [];
|
16463
16294
|
if (handlers.fn) return [handlers.fn];
|
16464
|
-
for (var i = 0,
|
16295
|
+
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
|
16465
16296
|
ee[i] = handlers[i].fn;
|
16466
16297
|
}
|
16467
16298
|
return ee;
|
@@ -16715,7 +16546,7 @@ var fireproof = (() => {
|
|
16715
16546
|
this.#queue.push(element);
|
16716
16547
|
return;
|
16717
16548
|
}
|
16718
|
-
const index2 = lowerBound(this.#queue, element, (
|
16549
|
+
const index2 = lowerBound(this.#queue, element, (a, b) => b.priority - a.priority);
|
16719
16550
|
this.#queue.splice(index2, 0, element);
|
16720
16551
|
}
|
16721
16552
|
dequeue() {
|
@@ -16734,7 +16565,7 @@ var fireproof = (() => {
|
|
16734
16565
|
|
16735
16566
|
// node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/index.js
|
16736
16567
|
var PQueue;
|
16737
|
-
var
|
16568
|
+
var init_dist2 = __esm({
|
16738
16569
|
"node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/index.js"() {
|
16739
16570
|
"use strict";
|
16740
16571
|
init_eventemitter3();
|
@@ -17133,7 +16964,7 @@ var fireproof = (() => {
|
|
17133
16964
|
init_src18();
|
17134
16965
|
init_src16();
|
17135
16966
|
init_raw();
|
17136
|
-
|
16967
|
+
init_dist2();
|
17137
16968
|
init_src7();
|
17138
16969
|
init_extract_data_from_block();
|
17139
16970
|
init_validate_offset_and_length();
|
@@ -17555,21 +17386,11 @@ var fireproof = (() => {
|
|
17555
17386
|
}
|
17556
17387
|
});
|
17557
17388
|
|
17558
|
-
// src/runtime/store-sql/v0.19-sqlite/version.ts
|
17559
|
-
var SQLITE_VERSION;
|
17560
|
-
var init_version = __esm({
|
17561
|
-
"src/runtime/store-sql/v0.19-sqlite/version.ts"() {
|
17562
|
-
"use strict";
|
17563
|
-
SQLITE_VERSION = "v0.19-sqlite";
|
17564
|
-
}
|
17565
|
-
});
|
17566
|
-
|
17567
17389
|
// src/runtime/index.ts
|
17568
17390
|
var runtime_exports = {};
|
17569
17391
|
__export(runtime_exports, {
|
17570
17392
|
FILESTORE_VERSION: () => FILESTORE_VERSION,
|
17571
17393
|
INDEXDB_VERSION: () => INDEXDB_VERSION,
|
17572
|
-
SQLITE_VERSION: () => SQLITE_VERSION,
|
17573
17394
|
SysContainer: () => SysContainer,
|
17574
17395
|
crypto: () => crypto_exports,
|
17575
17396
|
dataDir: () => dataDir,
|
@@ -17577,8 +17398,7 @@ var fireproof = (() => {
|
|
17577
17398
|
files: () => files_exports,
|
17578
17399
|
getFileName: () => getFileName,
|
17579
17400
|
getPath: () => getPath,
|
17580
|
-
join: () => join
|
17581
|
-
sql: () => store_sql_exports
|
17401
|
+
join: () => join
|
17582
17402
|
});
|
17583
17403
|
var init_runtime = __esm({
|
17584
17404
|
"src/runtime/index.ts"() {
|
@@ -17586,12 +17406,10 @@ var fireproof = (() => {
|
|
17586
17406
|
init_sys_container();
|
17587
17407
|
init_data_dir();
|
17588
17408
|
init_store_file_utils();
|
17589
|
-
init_store_sql();
|
17590
17409
|
init_crypto();
|
17591
17410
|
init_files();
|
17592
17411
|
init_store_file_version();
|
17593
17412
|
init_store_indexdb_version();
|
17594
|
-
init_version();
|
17595
17413
|
}
|
17596
17414
|
});
|
17597
17415
|
|
@@ -17718,6 +17536,93 @@ var fireproof = (() => {
|
|
17718
17536
|
}
|
17719
17537
|
});
|
17720
17538
|
|
17539
|
+
// node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js
|
17540
|
+
var require_encode = __commonJS({
|
17541
|
+
"node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(exports2, module2) {
|
17542
|
+
"use strict";
|
17543
|
+
module2.exports = encode17;
|
17544
|
+
var MSB3 = 128;
|
17545
|
+
var REST3 = 127;
|
17546
|
+
var MSBALL3 = ~REST3;
|
17547
|
+
var INT3 = Math.pow(2, 31);
|
17548
|
+
function encode17(num, out, offset) {
|
17549
|
+
if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {
|
17550
|
+
encode17.bytes = 0;
|
17551
|
+
throw new RangeError("Could not encode varint");
|
17552
|
+
}
|
17553
|
+
out = out || [];
|
17554
|
+
offset = offset || 0;
|
17555
|
+
var oldOffset = offset;
|
17556
|
+
while (num >= INT3) {
|
17557
|
+
out[offset++] = num & 255 | MSB3;
|
17558
|
+
num /= 128;
|
17559
|
+
}
|
17560
|
+
while (num & MSBALL3) {
|
17561
|
+
out[offset++] = num & 255 | MSB3;
|
17562
|
+
num >>>= 7;
|
17563
|
+
}
|
17564
|
+
out[offset] = num | 0;
|
17565
|
+
encode17.bytes = offset - oldOffset + 1;
|
17566
|
+
return out;
|
17567
|
+
}
|
17568
|
+
}
|
17569
|
+
});
|
17570
|
+
|
17571
|
+
// node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js
|
17572
|
+
var require_decode = __commonJS({
|
17573
|
+
"node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(exports2, module2) {
|
17574
|
+
"use strict";
|
17575
|
+
module2.exports = read5;
|
17576
|
+
var MSB3 = 128;
|
17577
|
+
var REST3 = 127;
|
17578
|
+
function read5(buf2, offset) {
|
17579
|
+
var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf2.length;
|
17580
|
+
do {
|
17581
|
+
if (counter >= l || shift > 49) {
|
17582
|
+
read5.bytes = 0;
|
17583
|
+
throw new RangeError("Could not decode varint");
|
17584
|
+
}
|
17585
|
+
b = buf2[counter++];
|
17586
|
+
res += shift < 28 ? (b & REST3) << shift : (b & REST3) * Math.pow(2, shift);
|
17587
|
+
shift += 7;
|
17588
|
+
} while (b >= MSB3);
|
17589
|
+
read5.bytes = counter - offset;
|
17590
|
+
return res;
|
17591
|
+
}
|
17592
|
+
}
|
17593
|
+
});
|
17594
|
+
|
17595
|
+
// node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js
|
17596
|
+
var require_length = __commonJS({
|
17597
|
+
"node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(exports2, module2) {
|
17598
|
+
"use strict";
|
17599
|
+
var N13 = Math.pow(2, 7);
|
17600
|
+
var N23 = Math.pow(2, 14);
|
17601
|
+
var N33 = Math.pow(2, 21);
|
17602
|
+
var N43 = Math.pow(2, 28);
|
17603
|
+
var N53 = Math.pow(2, 35);
|
17604
|
+
var N63 = Math.pow(2, 42);
|
17605
|
+
var N73 = Math.pow(2, 49);
|
17606
|
+
var N83 = Math.pow(2, 56);
|
17607
|
+
var N93 = Math.pow(2, 63);
|
17608
|
+
module2.exports = function(value) {
|
17609
|
+
return value < N13 ? 1 : value < N23 ? 2 : value < N33 ? 3 : value < N43 ? 4 : value < N53 ? 5 : value < N63 ? 6 : value < N73 ? 7 : value < N83 ? 8 : value < N93 ? 9 : 10;
|
17610
|
+
};
|
17611
|
+
}
|
17612
|
+
});
|
17613
|
+
|
17614
|
+
// node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js
|
17615
|
+
var require_varint = __commonJS({
|
17616
|
+
"node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(exports2, module2) {
|
17617
|
+
"use strict";
|
17618
|
+
module2.exports = {
|
17619
|
+
encode: require_encode(),
|
17620
|
+
decode: require_decode(),
|
17621
|
+
encodingLength: require_length()
|
17622
|
+
};
|
17623
|
+
}
|
17624
|
+
});
|
17625
|
+
|
17721
17626
|
// node_modules/.pnpm/idb@8.0.0/node_modules/idb/build/index.js
|
17722
17627
|
function getIdbProxyableTypes() {
|
17723
17628
|
return idbProxyableTypes || (idbProxyableTypes = [
|
@@ -17891,7 +17796,7 @@ var fireproof = (() => {
|
|
17891
17796
|
var init_build = __esm({
|
17892
17797
|
"node_modules/.pnpm/idb@8.0.0/node_modules/idb/build/index.js"() {
|
17893
17798
|
"use strict";
|
17894
|
-
instanceOfAny = (object, constructors) => constructors.some((
|
17799
|
+
instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c);
|
17895
17800
|
transactionDoneMap = /* @__PURE__ */ new WeakMap();
|
17896
17801
|
transformCache = /* @__PURE__ */ new WeakMap();
|
17897
17802
|
reverseTransformCache = /* @__PURE__ */ new WeakMap();
|
@@ -17964,20 +17869,13 @@ var fireproof = (() => {
|
|
17964
17869
|
IndexDBMetaGateway: () => IndexDBMetaGateway,
|
17965
17870
|
IndexDBTestStore: () => IndexDBTestStore,
|
17966
17871
|
IndexDBWalGateway: () => IndexDBWalGateway,
|
17967
|
-
getIndexDBName: () => getIndexDBName
|
17968
|
-
guardVersion: () => guardVersion
|
17872
|
+
getIndexDBName: () => getIndexDBName
|
17969
17873
|
});
|
17970
17874
|
function ensureVersion(url) {
|
17971
17875
|
const ret = new URL(url.toString());
|
17972
17876
|
ret.searchParams.set("version", url.searchParams.get("version") || INDEXDB_VERSION);
|
17973
17877
|
return ret;
|
17974
17878
|
}
|
17975
|
-
function guardVersion(url) {
|
17976
|
-
if (!url.searchParams.has("version")) {
|
17977
|
-
return Result.Err(`missing version: ${url.toString()}`);
|
17978
|
-
}
|
17979
|
-
return Result.Ok(url);
|
17980
|
-
}
|
17981
17879
|
function sanitzeKey(key) {
|
17982
17880
|
if (key.length === 1) {
|
17983
17881
|
key = key[0];
|
@@ -18160,109 +18058,6 @@ var fireproof = (() => {
|
|
18160
18058
|
}
|
18161
18059
|
});
|
18162
18060
|
|
18163
|
-
// node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js
|
18164
|
-
var require_encode = __commonJS({
|
18165
|
-
"node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(exports2, module2) {
|
18166
|
-
"use strict";
|
18167
|
-
module2.exports = encode17;
|
18168
|
-
var MSB3 = 128;
|
18169
|
-
var REST3 = 127;
|
18170
|
-
var MSBALL3 = ~REST3;
|
18171
|
-
var INT3 = Math.pow(2, 31);
|
18172
|
-
function encode17(num, out, offset) {
|
18173
|
-
if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {
|
18174
|
-
encode17.bytes = 0;
|
18175
|
-
throw new RangeError("Could not encode varint");
|
18176
|
-
}
|
18177
|
-
out = out || [];
|
18178
|
-
offset = offset || 0;
|
18179
|
-
var oldOffset = offset;
|
18180
|
-
while (num >= INT3) {
|
18181
|
-
out[offset++] = num & 255 | MSB3;
|
18182
|
-
num /= 128;
|
18183
|
-
}
|
18184
|
-
while (num & MSBALL3) {
|
18185
|
-
out[offset++] = num & 255 | MSB3;
|
18186
|
-
num >>>= 7;
|
18187
|
-
}
|
18188
|
-
out[offset] = num | 0;
|
18189
|
-
encode17.bytes = offset - oldOffset + 1;
|
18190
|
-
return out;
|
18191
|
-
}
|
18192
|
-
}
|
18193
|
-
});
|
18194
|
-
|
18195
|
-
// node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js
|
18196
|
-
var require_decode = __commonJS({
|
18197
|
-
"node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(exports2, module2) {
|
18198
|
-
"use strict";
|
18199
|
-
module2.exports = read5;
|
18200
|
-
var MSB3 = 128;
|
18201
|
-
var REST3 = 127;
|
18202
|
-
function read5(buf2, offset) {
|
18203
|
-
var res = 0, offset = offset || 0, shift = 0, counter = offset, b2, l2 = buf2.length;
|
18204
|
-
do {
|
18205
|
-
if (counter >= l2 || shift > 49) {
|
18206
|
-
read5.bytes = 0;
|
18207
|
-
throw new RangeError("Could not decode varint");
|
18208
|
-
}
|
18209
|
-
b2 = buf2[counter++];
|
18210
|
-
res += shift < 28 ? (b2 & REST3) << shift : (b2 & REST3) * Math.pow(2, shift);
|
18211
|
-
shift += 7;
|
18212
|
-
} while (b2 >= MSB3);
|
18213
|
-
read5.bytes = counter - offset;
|
18214
|
-
return res;
|
18215
|
-
}
|
18216
|
-
}
|
18217
|
-
});
|
18218
|
-
|
18219
|
-
// node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js
|
18220
|
-
var require_length = __commonJS({
|
18221
|
-
"node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(exports2, module2) {
|
18222
|
-
"use strict";
|
18223
|
-
var N13 = Math.pow(2, 7);
|
18224
|
-
var N23 = Math.pow(2, 14);
|
18225
|
-
var N33 = Math.pow(2, 21);
|
18226
|
-
var N43 = Math.pow(2, 28);
|
18227
|
-
var N53 = Math.pow(2, 35);
|
18228
|
-
var N63 = Math.pow(2, 42);
|
18229
|
-
var N73 = Math.pow(2, 49);
|
18230
|
-
var N83 = Math.pow(2, 56);
|
18231
|
-
var N93 = Math.pow(2, 63);
|
18232
|
-
module2.exports = function(value) {
|
18233
|
-
return value < N13 ? 1 : value < N23 ? 2 : value < N33 ? 3 : value < N43 ? 4 : value < N53 ? 5 : value < N63 ? 6 : value < N73 ? 7 : value < N83 ? 8 : value < N93 ? 9 : 10;
|
18234
|
-
};
|
18235
|
-
}
|
18236
|
-
});
|
18237
|
-
|
18238
|
-
// node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js
|
18239
|
-
var require_varint = __commonJS({
|
18240
|
-
"node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(exports2, module2) {
|
18241
|
-
"use strict";
|
18242
|
-
module2.exports = {
|
18243
|
-
encode: require_encode(),
|
18244
|
-
decode: require_decode(),
|
18245
|
-
encodingLength: require_length()
|
18246
|
-
};
|
18247
|
-
}
|
18248
|
-
});
|
18249
|
-
|
18250
|
-
// src/runtime/store-file-not-impl.ts
|
18251
|
-
var require_store_file_not_impl = __commonJS({
|
18252
|
-
"src/runtime/store-file-not-impl.ts"() {
|
18253
|
-
"use strict";
|
18254
|
-
throw new Error("store-file not implemented");
|
18255
|
-
}
|
18256
|
-
});
|
18257
|
-
|
18258
|
-
// src/runtime/store-sql/not-impl.ts
|
18259
|
-
var require_not_impl = __commonJS({
|
18260
|
-
"src/runtime/store-sql/not-impl.ts"() {
|
18261
|
-
"use strict";
|
18262
|
-
throw new Error("store-sql not implemented");
|
18263
|
-
}
|
18264
|
-
});
|
18265
|
-
|
18266
18061
|
// node_modules/.pnpm/charwise@3.0.1/node_modules/charwise/codec/number.js
|
18267
18062
|
var require_number = __commonJS({
|
18268
18063
|
"node_modules/.pnpm/charwise@3.0.1/node_modules/charwise/codec/number.js"(exports2) {
|
@@ -18358,15 +18153,15 @@ var fireproof = (() => {
|
|
18358
18153
|
if (!Array.isArray(array)) {
|
18359
18154
|
throw new Error("can only encode arrays");
|
18360
18155
|
}
|
18361
|
-
var
|
18362
|
-
if (
|
18156
|
+
var l = array.length;
|
18157
|
+
if (l == 0) {
|
18363
18158
|
return "K!";
|
18364
18159
|
}
|
18365
|
-
var
|
18366
|
-
for (var i = 1; i <
|
18367
|
-
|
18160
|
+
var s = encodeItem(array[0]);
|
18161
|
+
for (var i = 1; i < l; i++) {
|
18162
|
+
s += '"' + encodeItem(array[i]);
|
18368
18163
|
}
|
18369
|
-
return "K" +
|
18164
|
+
return "K" + s + "!";
|
18370
18165
|
}
|
18371
18166
|
function encodeItem(item) {
|
18372
18167
|
if (typeof item === "object") {
|
@@ -18385,8 +18180,8 @@ var fireproof = (() => {
|
|
18385
18180
|
var pointers = [[]];
|
18386
18181
|
var array;
|
18387
18182
|
var depth = 0;
|
18388
|
-
var
|
18389
|
-
for (var i = 0; i <
|
18183
|
+
var l = items.length;
|
18184
|
+
for (var i = 0; i < l; i++) {
|
18390
18185
|
var item = items[i];
|
18391
18186
|
var itemLength = item.length;
|
18392
18187
|
var open3 = 0;
|
@@ -18427,48 +18222,48 @@ var fireproof = (() => {
|
|
18427
18222
|
"use strict";
|
18428
18223
|
var number = require_number();
|
18429
18224
|
var object = require_object();
|
18430
|
-
var flip = exports2.flip = function(
|
18431
|
-
var
|
18225
|
+
var flip = exports2.flip = function(n) {
|
18226
|
+
var s = n.toString();
|
18432
18227
|
var f = "";
|
18433
|
-
for (var i in
|
18434
|
-
f +=
|
18228
|
+
for (var i in s) {
|
18229
|
+
f += s[i] == "." ? "." : 9 - +s[i];
|
18435
18230
|
}
|
18436
18231
|
return f;
|
18437
18232
|
};
|
18438
18233
|
exports2.number = number;
|
18439
18234
|
exports2.string = {
|
18440
|
-
encode: function(
|
18441
|
-
if (!/\x00|\x01/.test(
|
18442
|
-
return "J" +
|
18235
|
+
encode: function(s) {
|
18236
|
+
if (!/\x00|\x01/.test(s))
|
18237
|
+
return "J" + s;
|
18443
18238
|
else {
|
18444
|
-
return "J" +
|
18239
|
+
return "J" + s.replace(/\x01/g, "").replace(/\x00/g, "");
|
18445
18240
|
}
|
18446
18241
|
},
|
18447
|
-
decode: function(
|
18448
|
-
if ("J" ===
|
18449
|
-
return
|
18242
|
+
decode: function(s) {
|
18243
|
+
if ("J" === s[0])
|
18244
|
+
return s.substring(1);
|
18450
18245
|
}
|
18451
18246
|
};
|
18452
|
-
exports2.encode = function(
|
18453
|
-
return exports2[typeof
|
18247
|
+
exports2.encode = function(t) {
|
18248
|
+
return exports2[typeof t].encode(t);
|
18454
18249
|
};
|
18455
|
-
exports2.decode = function(
|
18456
|
-
if (
|
18457
|
-
if (!decoders[
|
18458
|
-
throw new Error("no decoder for:" + JSON.stringify(
|
18459
|
-
return decoders[
|
18250
|
+
exports2.decode = function(s) {
|
18251
|
+
if (s === "") return s;
|
18252
|
+
if (!decoders[s[0]])
|
18253
|
+
throw new Error("no decoder for:" + JSON.stringify(s));
|
18254
|
+
return decoders[s[0]](s);
|
18460
18255
|
};
|
18461
18256
|
exports2.object = object.factory(exports2);
|
18462
18257
|
exports2.boolean = {
|
18463
|
-
encode: function(
|
18464
|
-
return
|
18258
|
+
encode: function(b) {
|
18259
|
+
return b ? "C" : "B";
|
18465
18260
|
},
|
18466
|
-
decode: function(
|
18467
|
-
return "C" ===
|
18261
|
+
decode: function(b) {
|
18262
|
+
return "C" === b;
|
18468
18263
|
}
|
18469
18264
|
};
|
18470
18265
|
exports2.undefined = {
|
18471
|
-
encode: function(
|
18266
|
+
encode: function(b) {
|
18472
18267
|
return "L";
|
18473
18268
|
},
|
18474
18269
|
decode: function() {
|
@@ -18508,6 +18303,7 @@ var fireproof = (() => {
|
|
18508
18303
|
Database: () => Database,
|
18509
18304
|
Index: () => Index,
|
18510
18305
|
PACKAGE_VERSION: () => PACKAGE_VERSION,
|
18306
|
+
Result: () => Result,
|
18511
18307
|
blockstore: () => blockstore_exports,
|
18512
18308
|
bs: () => blockstore_exports,
|
18513
18309
|
ensureLogger: () => ensureLogger,
|
@@ -18619,8 +18415,8 @@ var fireproof = (() => {
|
|
18619
18415
|
if (changed) {
|
18620
18416
|
return [...headmap.values()];
|
18621
18417
|
}
|
18622
|
-
for (const
|
18623
|
-
if (await contains(events,
|
18418
|
+
for (const p of head) {
|
18419
|
+
if (await contains(events, p, event)) {
|
18624
18420
|
return head;
|
18625
18421
|
}
|
18626
18422
|
}
|
@@ -18670,16 +18466,16 @@ var fireproof = (() => {
|
|
18670
18466
|
const { cid, value } = await decode5({ bytes, codec: src_exports, hasher: sha256 });
|
18671
18467
|
return new Block({ cid, value, bytes });
|
18672
18468
|
};
|
18673
|
-
var contains = async (events,
|
18674
|
-
if (
|
18675
|
-
const [{ value: aevent }, { value: bevent }] = await Promise.all([events.get(
|
18469
|
+
var contains = async (events, a, b) => {
|
18470
|
+
if (a.toString() === b.toString()) return true;
|
18471
|
+
const [{ value: aevent }, { value: bevent }] = await Promise.all([events.get(a), events.get(b)]);
|
18676
18472
|
const links3 = [...aevent.parents];
|
18677
18473
|
const seen = /* @__PURE__ */ new Set();
|
18678
18474
|
while (links3.length) {
|
18679
18475
|
const link2 = links3.shift();
|
18680
18476
|
if (!link2) break;
|
18681
|
-
if (link2.toString() ===
|
18682
|
-
if (bevent.parents.some((
|
18477
|
+
if (link2.toString() === b.toString()) return true;
|
18478
|
+
if (bevent.parents.some((p) => link2.toString() === p.toString())) continue;
|
18683
18479
|
if (seen.has(link2.toString())) continue;
|
18684
18480
|
seen.add(link2.toString());
|
18685
18481
|
const { value: event } = await events.get(link2);
|
@@ -18688,7 +18484,7 @@ var fireproof = (() => {
|
|
18688
18484
|
return false;
|
18689
18485
|
};
|
18690
18486
|
var vis = async function* (blocks, head, options = {}) {
|
18691
|
-
const renderNodeLabel = options.renderNodeLabel ?? ((
|
18487
|
+
const renderNodeLabel = options.renderNodeLabel ?? ((b) => shortLink(b.cid));
|
18692
18488
|
const events = new EventFetcher(blocks);
|
18693
18489
|
yield "digraph clock {";
|
18694
18490
|
yield ' node [shape=point fontname="Courier"]; head;';
|
@@ -18699,8 +18495,8 @@ var fireproof = (() => {
|
|
18699
18495
|
nodes.add(e.cid.toString());
|
18700
18496
|
yield ` node [shape=oval fontname="Courier"]; ${e.cid} [label="${renderNodeLabel(e)}"];`;
|
18701
18497
|
yield ` head -> ${e.cid};`;
|
18702
|
-
for (const
|
18703
|
-
yield ` ${e.cid} -> ${
|
18498
|
+
for (const p of e.value.parents) {
|
18499
|
+
yield ` ${e.cid} -> ${p};`;
|
18704
18500
|
}
|
18705
18501
|
links3.push(...e.value.parents);
|
18706
18502
|
}
|
@@ -18711,14 +18507,14 @@ var fireproof = (() => {
|
|
18711
18507
|
nodes.add(link2.toString());
|
18712
18508
|
const block = await events.get(link2);
|
18713
18509
|
yield ` node [shape=oval]; ${link2} [label="${renderNodeLabel(block)}" fontname="Courier"];`;
|
18714
|
-
for (const
|
18715
|
-
yield ` ${link2} -> ${
|
18510
|
+
for (const p of block.value.parents) {
|
18511
|
+
yield ` ${link2} -> ${p};`;
|
18716
18512
|
}
|
18717
18513
|
links3.push(...block.value.parents);
|
18718
18514
|
}
|
18719
18515
|
yield "}";
|
18720
18516
|
};
|
18721
|
-
var shortLink = (
|
18517
|
+
var shortLink = (l) => `${String(l).slice(0, 4)}..${String(l).slice(-4)}`;
|
18722
18518
|
|
18723
18519
|
// node_modules/.pnpm/@web3-storage+pail@0.6.0/node_modules/@web3-storage/pail/src/shard.js
|
18724
18520
|
init_block();
|
@@ -18822,7 +18618,7 @@ var fireproof = (() => {
|
|
18822
18618
|
entries3.push(newEntry);
|
18823
18619
|
return entries3;
|
18824
18620
|
};
|
18825
|
-
var isPrintableASCII = (
|
18621
|
+
var isPrintableASCII = (s) => /^[\x20-\x7E]*$/.test(s);
|
18826
18622
|
|
18827
18623
|
// node_modules/.pnpm/@web3-storage+pail@0.6.0/node_modules/@web3-storage/pail/src/index.js
|
18828
18624
|
var put = async (blocks, root2, key, value) => {
|
@@ -19063,7 +18859,7 @@ var fireproof = (() => {
|
|
19063
18859
|
*/
|
19064
18860
|
constructor(blocks) {
|
19065
18861
|
if (blocks) {
|
19066
|
-
this.#blocks = new Map(blocks.map((
|
18862
|
+
this.#blocks = new Map(blocks.map((b) => [b.cid.toString(), b.bytes]));
|
19067
18863
|
}
|
19068
18864
|
}
|
19069
18865
|
/** @type {API.BlockFetcher['get']} */
|
@@ -19350,24 +19146,24 @@ var fireproof = (() => {
|
|
19350
19146
|
throw new Error(`unknown operation: ${event2.data.type}`);
|
19351
19147
|
}
|
19352
19148
|
root2 = result2.root;
|
19353
|
-
for (const
|
19354
|
-
mblocks.putSync(
|
19355
|
-
additions.set(
|
19149
|
+
for (const a of result2.additions) {
|
19150
|
+
mblocks.putSync(a.cid, a.bytes);
|
19151
|
+
additions.set(a.cid.toString(), a);
|
19356
19152
|
}
|
19357
|
-
for (const
|
19358
|
-
removals.set(
|
19153
|
+
for (const r of result2.removals) {
|
19154
|
+
removals.set(r.cid.toString(), r);
|
19359
19155
|
}
|
19360
19156
|
}
|
19361
19157
|
const result = await put(blocks, root2, key, value);
|
19362
19158
|
if (result.root.toString() === root2.toString()) {
|
19363
19159
|
return { root: root2, additions: [], removals: [], head };
|
19364
19160
|
}
|
19365
|
-
for (const
|
19366
|
-
mblocks.putSync(
|
19367
|
-
additions.set(
|
19161
|
+
for (const a of result.additions) {
|
19162
|
+
mblocks.putSync(a.cid, a.bytes);
|
19163
|
+
additions.set(a.cid.toString(), a);
|
19368
19164
|
}
|
19369
|
-
for (const
|
19370
|
-
removals.set(
|
19165
|
+
for (const r of result.removals) {
|
19166
|
+
removals.set(r.cid.toString(), r);
|
19371
19167
|
}
|
19372
19168
|
const data = { type: "put", root: result.root, key, value };
|
19373
19169
|
const event = await EventBlock.create(data, head);
|
@@ -19421,12 +19217,12 @@ var fireproof = (() => {
|
|
19421
19217
|
throw new Error(`unknown operation: ${event.data.type}`);
|
19422
19218
|
}
|
19423
19219
|
root2 = result.root;
|
19424
|
-
for (const
|
19425
|
-
mblocks.putSync(
|
19426
|
-
additions.set(
|
19220
|
+
for (const a of result.additions) {
|
19221
|
+
mblocks.putSync(a.cid, a.bytes);
|
19222
|
+
additions.set(a.cid.toString(), a);
|
19427
19223
|
}
|
19428
|
-
for (const
|
19429
|
-
removals.set(
|
19224
|
+
for (const r of result.removals) {
|
19225
|
+
removals.set(r.cid.toString(), r);
|
19430
19226
|
}
|
19431
19227
|
}
|
19432
19228
|
for (const k of removals.keys()) {
|
@@ -19459,14 +19255,14 @@ var fireproof = (() => {
|
|
19459
19255
|
};
|
19460
19256
|
var findCommonAncestor = async (events, children) => {
|
19461
19257
|
if (!children.length) return;
|
19462
|
-
const candidates = children.map((
|
19258
|
+
const candidates = children.map((c) => [c]);
|
19463
19259
|
while (true) {
|
19464
19260
|
let changed = false;
|
19465
|
-
for (const
|
19466
|
-
const candidate = await findAncestorCandidate(events,
|
19261
|
+
for (const c of candidates) {
|
19262
|
+
const candidate = await findAncestorCandidate(events, c[c.length - 1]);
|
19467
19263
|
if (!candidate) continue;
|
19468
19264
|
changed = true;
|
19469
|
-
|
19265
|
+
c.push(candidate);
|
19470
19266
|
const ancestor = findCommonString(candidates);
|
19471
19267
|
if (ancestor) return ancestor;
|
19472
19268
|
}
|
@@ -19479,7 +19275,7 @@ var fireproof = (() => {
|
|
19479
19275
|
return event.parents.length === 1 ? event.parents[0] : findCommonAncestor(events, event.parents);
|
19480
19276
|
};
|
19481
19277
|
var findCommonString = (arrays) => {
|
19482
|
-
arrays = arrays.map((
|
19278
|
+
arrays = arrays.map((a) => [...a]);
|
19483
19279
|
for (const arr of arrays) {
|
19484
19280
|
for (const item of arr) {
|
19485
19281
|
let matched = true;
|
@@ -19497,7 +19293,7 @@ var fireproof = (() => {
|
|
19497
19293
|
return [];
|
19498
19294
|
}
|
19499
19295
|
const weights = /* @__PURE__ */ new Map();
|
19500
|
-
const all = await Promise.all(head.map((
|
19296
|
+
const all = await Promise.all(head.map((h) => findEvents(events, h, tail)));
|
19501
19297
|
for (const arr of all) {
|
19502
19298
|
for (const { event, depth } of arr) {
|
19503
19299
|
const info = weights.get(event.cid.toString());
|
@@ -19517,14 +19313,14 @@ var fireproof = (() => {
|
|
19517
19313
|
buckets.set(weight, [event]);
|
19518
19314
|
}
|
19519
19315
|
}
|
19520
|
-
return Array.from(buckets).sort((
|
19316
|
+
return Array.from(buckets).sort((a, b) => b[0] - a[0]).flatMap(([, es]) => es.sort((a, b) => String(a.cid) < String(b.cid) ? -1 : 1));
|
19521
19317
|
};
|
19522
19318
|
var findEvents = async (events, start, end, depth = 0) => {
|
19523
19319
|
const event = await events.get(start);
|
19524
19320
|
const acc = [{ event, depth }];
|
19525
19321
|
const { parents } = event.value;
|
19526
19322
|
if (parents.length === 1 && String(parents[0]) === String(end)) return acc;
|
19527
|
-
const rest = await Promise.all(parents.map((
|
19323
|
+
const rest = await Promise.all(parents.map((p) => findEvents(events, p, end, depth + 1)));
|
19528
19324
|
return acc.concat(...rest);
|
19529
19325
|
};
|
19530
19326
|
|
@@ -19579,23 +19375,23 @@ var fireproof = (() => {
|
|
19579
19375
|
const head = await advance(blocks, this.head, event.cid);
|
19580
19376
|
const additions = /* @__PURE__ */ new Map();
|
19581
19377
|
const removals = /* @__PURE__ */ new Map();
|
19582
|
-
for (const
|
19583
|
-
additions.set(
|
19378
|
+
for (const a of this.additions) {
|
19379
|
+
additions.set(a.cid.toString(), a);
|
19584
19380
|
}
|
19585
|
-
for (const
|
19586
|
-
removals.set(
|
19381
|
+
for (const r of this.removals) {
|
19382
|
+
removals.set(r.cid.toString(), r);
|
19587
19383
|
}
|
19588
|
-
for (const
|
19589
|
-
if (removals.has(
|
19590
|
-
removals.delete(
|
19384
|
+
for (const a of res.additions) {
|
19385
|
+
if (removals.has(a.cid.toString())) {
|
19386
|
+
removals.delete(a.cid.toString());
|
19591
19387
|
}
|
19592
|
-
additions.set(
|
19388
|
+
additions.set(a.cid.toString(), a);
|
19593
19389
|
}
|
19594
|
-
for (const
|
19595
|
-
if (additions.has(
|
19596
|
-
additions.delete(
|
19390
|
+
for (const r of res.removals) {
|
19391
|
+
if (additions.has(r.cid.toString())) {
|
19392
|
+
additions.delete(r.cid.toString());
|
19597
19393
|
} else {
|
19598
|
-
removals.set(
|
19394
|
+
removals.set(r.cid.toString(), r);
|
19599
19395
|
}
|
19600
19396
|
}
|
19601
19397
|
return {
|
@@ -19628,8 +19424,8 @@ var fireproof = (() => {
|
|
19628
19424
|
});
|
19629
19425
|
}
|
19630
19426
|
const { root: root2, additions, removals } = await root(blocks, head);
|
19631
|
-
for (const
|
19632
|
-
mblocks.putSync(
|
19427
|
+
for (const a of additions) {
|
19428
|
+
mblocks.putSync(a.cid, a.bytes);
|
19633
19429
|
}
|
19634
19430
|
const shards = new ShardFetcher(blocks);
|
19635
19431
|
const base4 = await shards.get(root2);
|
@@ -19845,7 +19641,7 @@ var fireproof = (() => {
|
|
19845
19641
|
init_data_dir();
|
19846
19642
|
init_files();
|
19847
19643
|
|
19848
|
-
// node_modules/.pnpm/yocto-queue@1.
|
19644
|
+
// node_modules/.pnpm/yocto-queue@1.1.1/node_modules/yocto-queue/index.js
|
19849
19645
|
var Node2 = class {
|
19850
19646
|
value;
|
19851
19647
|
next;
|
@@ -19880,6 +19676,12 @@ var fireproof = (() => {
|
|
19880
19676
|
this.#size--;
|
19881
19677
|
return current2.value;
|
19882
19678
|
}
|
19679
|
+
peek() {
|
19680
|
+
if (!this.#head) {
|
19681
|
+
return;
|
19682
|
+
}
|
19683
|
+
return this.#head.value;
|
19684
|
+
}
|
19883
19685
|
clear() {
|
19884
19686
|
this.#head = void 0;
|
19885
19687
|
this.#tail = void 0;
|
@@ -19897,28 +19699,22 @@ var fireproof = (() => {
|
|
19897
19699
|
}
|
19898
19700
|
};
|
19899
19701
|
|
19900
|
-
// node_modules/.pnpm/p-limit@
|
19901
|
-
var AsyncResource = {
|
19902
|
-
bind(fn, _type, thisArg) {
|
19903
|
-
return fn.bind(thisArg);
|
19904
|
-
}
|
19905
|
-
};
|
19906
|
-
|
19907
|
-
// node_modules/.pnpm/p-limit@5.0.0/node_modules/p-limit/index.js
|
19702
|
+
// node_modules/.pnpm/p-limit@6.1.0/node_modules/p-limit/index.js
|
19908
19703
|
function pLimit(concurrency) {
|
19909
|
-
|
19910
|
-
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
19911
|
-
}
|
19704
|
+
validateConcurrency(concurrency);
|
19912
19705
|
const queue = new Queue();
|
19913
19706
|
let activeCount = 0;
|
19914
|
-
const
|
19915
|
-
activeCount
|
19916
|
-
if (queue.size > 0) {
|
19707
|
+
const resumeNext = () => {
|
19708
|
+
if (activeCount < concurrency && queue.size > 0) {
|
19917
19709
|
queue.dequeue()();
|
19710
|
+
activeCount++;
|
19918
19711
|
}
|
19919
19712
|
};
|
19713
|
+
const next = () => {
|
19714
|
+
activeCount--;
|
19715
|
+
resumeNext();
|
19716
|
+
};
|
19920
19717
|
const run = async (function_, resolve7, arguments_) => {
|
19921
|
-
activeCount++;
|
19922
19718
|
const result = (async () => function_(...arguments_))();
|
19923
19719
|
resolve7(result);
|
19924
19720
|
try {
|
@@ -19928,13 +19724,15 @@ var fireproof = (() => {
|
|
19928
19724
|
next();
|
19929
19725
|
};
|
19930
19726
|
const enqueue2 = (function_, resolve7, arguments_) => {
|
19931
|
-
|
19932
|
-
|
19727
|
+
new Promise((internalResolve) => {
|
19728
|
+
queue.enqueue(internalResolve);
|
19729
|
+
}).then(
|
19730
|
+
run.bind(void 0, function_, resolve7, arguments_)
|
19933
19731
|
);
|
19934
19732
|
(async () => {
|
19935
19733
|
await Promise.resolve();
|
19936
|
-
if (activeCount < concurrency
|
19937
|
-
|
19734
|
+
if (activeCount < concurrency) {
|
19735
|
+
resumeNext();
|
19938
19736
|
}
|
19939
19737
|
})();
|
19940
19738
|
};
|
@@ -19952,10 +19750,27 @@ var fireproof = (() => {
|
|
19952
19750
|
value() {
|
19953
19751
|
queue.clear();
|
19954
19752
|
}
|
19753
|
+
},
|
19754
|
+
concurrency: {
|
19755
|
+
get: () => concurrency,
|
19756
|
+
set(newConcurrency) {
|
19757
|
+
validateConcurrency(newConcurrency);
|
19758
|
+
concurrency = newConcurrency;
|
19759
|
+
queueMicrotask(() => {
|
19760
|
+
while (activeCount < concurrency && queue.size > 0) {
|
19761
|
+
resumeNext();
|
19762
|
+
}
|
19763
|
+
});
|
19764
|
+
}
|
19955
19765
|
}
|
19956
19766
|
});
|
19957
19767
|
return generator;
|
19958
19768
|
}
|
19769
|
+
function validateConcurrency(concurrency) {
|
19770
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
19771
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
19772
|
+
}
|
19773
|
+
}
|
19959
19774
|
|
19960
19775
|
// src/blockstore/store.ts
|
19961
19776
|
init_src6();
|
@@ -19963,7 +19778,6 @@ var fireproof = (() => {
|
|
19963
19778
|
init_types();
|
19964
19779
|
init_gateway();
|
19965
19780
|
init_utils();
|
19966
|
-
init_store_indexdb();
|
19967
19781
|
|
19968
19782
|
// node_modules/.pnpm/@ipld+car@5.3.2/node_modules/@ipld/car/src/buffer-decoder.js
|
19969
19783
|
init_src2();
|
@@ -20566,11 +20380,11 @@ You can use close({ resize: true }) to resize header`);
|
|
20566
20380
|
}
|
20567
20381
|
have += chunk.length;
|
20568
20382
|
}
|
20569
|
-
currentChunk = new Uint8Array(bufa.reduce((
|
20383
|
+
currentChunk = new Uint8Array(bufa.reduce((p, c) => p + c.length, 0));
|
20570
20384
|
let off = 0;
|
20571
|
-
for (const
|
20572
|
-
currentChunk.set(
|
20573
|
-
off +=
|
20385
|
+
for (const b of bufa) {
|
20386
|
+
currentChunk.set(b, off);
|
20387
|
+
off += b.length;
|
20574
20388
|
}
|
20575
20389
|
offset = 0;
|
20576
20390
|
};
|
@@ -20655,7 +20469,7 @@ You can use close({ resize: true }) to resize header`);
|
|
20655
20469
|
constructor(header, blocks) {
|
20656
20470
|
this._header = header;
|
20657
20471
|
this._blocks = blocks;
|
20658
|
-
this._keys = blocks.map((
|
20472
|
+
this._keys = blocks.map((b) => b.cid.toString());
|
20659
20473
|
}
|
20660
20474
|
/**
|
20661
20475
|
* @property
|
@@ -20812,19 +20626,19 @@ You can use close({ resize: true }) to resize header`);
|
|
20812
20626
|
init_sha2_browser();
|
20813
20627
|
init_raw();
|
20814
20628
|
init_src2();
|
20815
|
-
async function encodeCarFile(roots,
|
20629
|
+
async function encodeCarFile(roots, t) {
|
20816
20630
|
let size = 0;
|
20817
20631
|
const headerSize = headerLength({ roots });
|
20818
20632
|
size += headerSize;
|
20819
|
-
for (const { cid, bytes } of
|
20633
|
+
for (const { cid, bytes } of t.entries()) {
|
20820
20634
|
size += blockLength({ cid, bytes });
|
20821
20635
|
}
|
20822
20636
|
const buffer2 = new Uint8Array(size);
|
20823
20637
|
const writer = createWriter3(buffer2, { headerSize });
|
20824
|
-
for (const
|
20825
|
-
writer.addRoot(
|
20638
|
+
for (const r of roots) {
|
20639
|
+
writer.addRoot(r);
|
20826
20640
|
}
|
20827
|
-
for (const { cid, bytes } of
|
20641
|
+
for (const { cid, bytes } of t.entries()) {
|
20828
20642
|
writer.write({ cid, bytes });
|
20829
20643
|
}
|
20830
20644
|
writer.close();
|
@@ -20874,10 +20688,10 @@ You can use close({ resize: true }) to resize header`);
|
|
20874
20688
|
return false;
|
20875
20689
|
};
|
20876
20690
|
};
|
20877
|
-
var simpleCompare = (
|
20878
|
-
if (
|
20691
|
+
var simpleCompare = (a, b) => {
|
20692
|
+
if (a === b)
|
20879
20693
|
return 0;
|
20880
|
-
if (
|
20694
|
+
if (a > b)
|
20881
20695
|
return 1;
|
20882
20696
|
return -1;
|
20883
20697
|
};
|
@@ -20907,9 +20721,9 @@ You can use close({ resize: true }) to resize header`);
|
|
20907
20721
|
throw new Error("Cannot add node without address");
|
20908
20722
|
}
|
20909
20723
|
if (node.address.then) {
|
20910
|
-
const
|
20911
|
-
this._cids.add(
|
20912
|
-
|
20724
|
+
const p = node.address.then((cid) => this._cids.add(cid.toString()));
|
20725
|
+
this._cids.add(p);
|
20726
|
+
p.then(() => this._cids.delete(p));
|
20913
20727
|
} else {
|
20914
20728
|
this._cids.add(node.address.toString());
|
20915
20729
|
}
|
@@ -21039,15 +20853,15 @@ You can use close({ resize: true }) to resize header`);
|
|
21039
20853
|
};
|
21040
20854
|
var stringKey = (key) => typeof key === "string" ? key : JSON.stringify(key);
|
21041
20855
|
function sortBulk(bulk, opts) {
|
21042
|
-
return bulk.sort(({ key:
|
20856
|
+
return bulk.sort(({ key: a }, { key: b }) => opts.compare(a, b));
|
21043
20857
|
}
|
21044
20858
|
async function filterLeftmostInserts(first, bulk, compare5) {
|
21045
20859
|
const inserts = [];
|
21046
|
-
for (const
|
21047
|
-
const { key, del: del2 } =
|
20860
|
+
for (const b of bulk) {
|
20861
|
+
const { key, del: del2 } = b;
|
21048
20862
|
if (compare5(key, first) < 0) {
|
21049
20863
|
if (!del2)
|
21050
|
-
inserts.push(
|
20864
|
+
inserts.push(b);
|
21051
20865
|
} else {
|
21052
20866
|
break;
|
21053
20867
|
}
|
@@ -21056,7 +20870,7 @@ You can use close({ resize: true }) to resize header`);
|
|
21056
20870
|
}
|
21057
20871
|
async function generateNewLeaves(inserts, opts, { chunker: chunker2, compare: compare5 }) {
|
21058
20872
|
return await Node3.from({
|
21059
|
-
entries: inserts.map((insert) => new opts.LeafEntryClass(insert, opts)).sort((
|
20873
|
+
entries: inserts.map((insert) => new opts.LeafEntryClass(insert, opts)).sort((a, b) => compare5(a.key, b.key)),
|
21060
20874
|
chunker: chunker2,
|
21061
20875
|
NodeClass: opts.LeafClass,
|
21062
20876
|
distance: 0,
|
@@ -21099,7 +20913,7 @@ You can use close({ resize: true }) to resize header`);
|
|
21099
20913
|
const newBranchEntries = [
|
21100
20914
|
firstRootEntry,
|
21101
20915
|
...branchEntries
|
21102
|
-
].sort(({ key:
|
20916
|
+
].sort(({ key: a }, { key: b }) => opts.compare(a, b));
|
21103
20917
|
let newBranches = await Node3.from({
|
21104
20918
|
...nodeOptions,
|
21105
20919
|
entries: newBranchEntries,
|
@@ -21109,13 +20923,13 @@ You can use close({ resize: true }) to resize header`);
|
|
21109
20923
|
});
|
21110
20924
|
let allBranches = [...newBranches];
|
21111
20925
|
while (newBranches.length > 1) {
|
21112
|
-
const newBranchEntries2 = await Promise.all(newBranches.map(async (
|
21113
|
-
key:
|
21114
|
-
address: await
|
20926
|
+
const newBranchEntries2 = await Promise.all(newBranches.map(async (l) => new opts.BranchEntryClass({
|
20927
|
+
key: l.key,
|
20928
|
+
address: await l.address
|
21115
20929
|
}, opts)));
|
21116
20930
|
newBranches = await Node3.from({
|
21117
20931
|
...nodeOptions,
|
21118
|
-
entries: newBranchEntries2.sort(({ key:
|
20932
|
+
entries: newBranchEntries2.sort(({ key: a }, { key: b }) => opts.compare(a, b)),
|
21119
20933
|
chunker: that.chunker,
|
21120
20934
|
NodeClass: opts.BranchClass,
|
21121
20935
|
distance: distance + 1
|
@@ -21125,12 +20939,12 @@ You can use close({ resize: true }) to resize header`);
|
|
21125
20939
|
...newBranches
|
21126
20940
|
];
|
21127
20941
|
}
|
21128
|
-
await Promise.all(allBranches.map(async (
|
21129
|
-
const block = await
|
21130
|
-
that.cache.set(
|
20942
|
+
await Promise.all(allBranches.map(async (m) => {
|
20943
|
+
const block = await m.encode();
|
20944
|
+
that.cache.set(m);
|
21131
20945
|
results.blocks.push({
|
21132
20946
|
block,
|
21133
|
-
node:
|
20947
|
+
node: m
|
21134
20948
|
});
|
21135
20949
|
}));
|
21136
20950
|
results.root = newBranches[0];
|
@@ -21254,8 +21068,8 @@ You can use close({ resize: true }) to resize header`);
|
|
21254
21068
|
}
|
21255
21069
|
let entries3 = [];
|
21256
21070
|
for (const [entry, keys2] of [...results.values()].reverse()) {
|
21257
|
-
const
|
21258
|
-
entries3.push(
|
21071
|
+
const p = this.getNode(await entry.address);
|
21072
|
+
entries3.push(p.then((node) => node._getEntries(keys2.reverse(), true, cids)));
|
21259
21073
|
}
|
21260
21074
|
entries3 = await Promise.all(entries3);
|
21261
21075
|
return entries3.flat();
|
@@ -21272,9 +21086,9 @@ You can use close({ resize: true }) to resize header`);
|
|
21272
21086
|
const { entries: entries3 } = this.entryList.findRange(start, end, this.compare);
|
21273
21087
|
if (this.isLeaf) {
|
21274
21088
|
return entries3.filter((entry) => {
|
21275
|
-
const
|
21089
|
+
const s = this.compare(start, entry.key);
|
21276
21090
|
const e = this.compare(end, entry.key);
|
21277
|
-
if (
|
21091
|
+
if (s <= 0 && e >= 0)
|
21278
21092
|
return true;
|
21279
21093
|
return false;
|
21280
21094
|
});
|
@@ -21326,12 +21140,12 @@ You can use close({ resize: true }) to resize header`);
|
|
21326
21140
|
return {
|
21327
21141
|
nodes,
|
21328
21142
|
previous,
|
21329
|
-
blocks: await Promise.all(nodes.map(async (
|
21330
|
-
const block = await
|
21331
|
-
this.cache.set(
|
21143
|
+
blocks: await Promise.all(nodes.map(async (n) => {
|
21144
|
+
const block = await n.encode();
|
21145
|
+
this.cache.set(n);
|
21332
21146
|
return {
|
21333
21147
|
block,
|
21334
|
-
node:
|
21148
|
+
node: n
|
21335
21149
|
};
|
21336
21150
|
})),
|
21337
21151
|
distance: 0
|
@@ -21372,7 +21186,7 @@ You can use close({ resize: true }) to resize header`);
|
|
21372
21186
|
entries3.splice(i - count++, 1);
|
21373
21187
|
}
|
21374
21188
|
const appends = Object.values(changes).map((obj) => new LeafEntryClass(obj, opts));
|
21375
|
-
entries3 = entries3.concat(appends).sort(({ key:
|
21189
|
+
entries3 = entries3.concat(appends).sort(({ key: a }, { key: b }) => opts.compare(a, b));
|
21376
21190
|
return {
|
21377
21191
|
entries: entries3,
|
21378
21192
|
previous
|
@@ -21382,16 +21196,16 @@ You can use close({ resize: true }) to resize header`);
|
|
21382
21196
|
const { BranchClass: BranchClass2, BranchEntryClass } = opts;
|
21383
21197
|
let distance = 0;
|
21384
21198
|
for (const [i, [entry, keys]] of results) {
|
21385
|
-
const
|
21199
|
+
const p = this.getNode(await entry.address).then((node) => node.transaction(keys.reverse(), {
|
21386
21200
|
...opts,
|
21387
21201
|
sorted: true
|
21388
|
-
})).then((
|
21202
|
+
})).then((r) => ({
|
21389
21203
|
entry,
|
21390
21204
|
keys,
|
21391
21205
|
distance,
|
21392
|
-
...
|
21206
|
+
...r
|
21393
21207
|
}));
|
21394
|
-
results.set(i,
|
21208
|
+
results.set(i, p);
|
21395
21209
|
}
|
21396
21210
|
let entries3 = [...this.entryList.entries];
|
21397
21211
|
const final = {
|
@@ -21399,13 +21213,13 @@ You can use close({ resize: true }) to resize header`);
|
|
21399
21213
|
blocks: [],
|
21400
21214
|
nodes: []
|
21401
21215
|
};
|
21402
|
-
for (const [i,
|
21216
|
+
for (const [i, p] of results) {
|
21403
21217
|
const {
|
21404
21218
|
nodes,
|
21405
21219
|
previous,
|
21406
21220
|
blocks,
|
21407
21221
|
distance: _distance
|
21408
|
-
} = await
|
21222
|
+
} = await p;
|
21409
21223
|
distance = _distance;
|
21410
21224
|
entries3[i] = nodes;
|
21411
21225
|
if (previous.length)
|
@@ -21437,13 +21251,13 @@ You can use close({ resize: true }) to resize header`);
|
|
21437
21251
|
distance
|
21438
21252
|
};
|
21439
21253
|
const newNodes = await _Node.from(_opts);
|
21440
|
-
await Promise.all(newNodes.map(async (
|
21441
|
-
const block = await
|
21254
|
+
await Promise.all(newNodes.map(async (n) => {
|
21255
|
+
const block = await n.encode();
|
21442
21256
|
final.blocks.push({
|
21443
21257
|
block,
|
21444
|
-
node:
|
21258
|
+
node: n
|
21445
21259
|
});
|
21446
|
-
this.cache.set(
|
21260
|
+
this.cache.set(n);
|
21447
21261
|
}));
|
21448
21262
|
final.nodes = newNodes;
|
21449
21263
|
return {
|
@@ -21462,7 +21276,7 @@ You can use close({ resize: true }) to resize header`);
|
|
21462
21276
|
const NodeClass = !mergeEntries[0].address ? LeafClass2 : BranchClass2;
|
21463
21277
|
const _opts = {
|
21464
21278
|
...nodeOptions,
|
21465
|
-
entries: mergeEntries.sort(({ key:
|
21279
|
+
entries: mergeEntries.sort(({ key: a }, { key: b }) => opts.compare(a, b)),
|
21466
21280
|
NodeClass,
|
21467
21281
|
distance
|
21468
21282
|
};
|
@@ -21507,15 +21321,15 @@ You can use close({ resize: true }) to resize header`);
|
|
21507
21321
|
return entries1.concat(entries22);
|
21508
21322
|
};
|
21509
21323
|
const processNodesAndCreateEntries = async (nodes, final2, opts2) => {
|
21510
|
-
return await Promise.all(nodes.map(async (
|
21324
|
+
return await Promise.all(nodes.map(async (l) => {
|
21511
21325
|
final2.blocks.push({
|
21512
|
-
block: await
|
21513
|
-
node:
|
21326
|
+
block: await l.encode(),
|
21327
|
+
node: l
|
21514
21328
|
});
|
21515
|
-
this.cache.set(
|
21329
|
+
this.cache.set(l);
|
21516
21330
|
return new BranchEntryClass({
|
21517
|
-
key:
|
21518
|
-
address: await
|
21331
|
+
key: l.key,
|
21332
|
+
address: await l.address
|
21519
21333
|
}, opts2);
|
21520
21334
|
}));
|
21521
21335
|
};
|
@@ -21539,7 +21353,7 @@ You can use close({ resize: true }) to resize header`);
|
|
21539
21353
|
const leftLeafEntries = await basicMerge(mergeLeftEntries, oldFront.entryList.entries);
|
21540
21354
|
const leftLeafNodes = await _Node.from({
|
21541
21355
|
...nodeOptions,
|
21542
|
-
entries: leftLeafEntries.sort(({ key:
|
21356
|
+
entries: leftLeafEntries.sort(({ key: a }, { key: b }) => opts.compare(a, b)),
|
21543
21357
|
NodeClass: LeafClass2,
|
21544
21358
|
distance
|
21545
21359
|
});
|
@@ -21551,7 +21365,7 @@ You can use close({ resize: true }) to resize header`);
|
|
21551
21365
|
} else {
|
21552
21366
|
const mergeLeftNodes = await _Node.from({
|
21553
21367
|
...nodeOptions,
|
21554
|
-
entries: mergeLeftEntries.sort(({ key:
|
21368
|
+
entries: mergeLeftEntries.sort(({ key: a }, { key: b }) => opts.compare(a, b)),
|
21555
21369
|
NodeClass: LeafClass2,
|
21556
21370
|
distance
|
21557
21371
|
});
|
@@ -21562,7 +21376,7 @@ You can use close({ resize: true }) to resize header`);
|
|
21562
21376
|
...oldFront.entryList.entries,
|
21563
21377
|
...mergeLeftBranchEntries,
|
21564
21378
|
...es
|
21565
|
-
].sort(({ key:
|
21379
|
+
].sort(({ key: a }, { key: b }) => opts.compare(a, b)),
|
21566
21380
|
NodeClass: BranchClass2,
|
21567
21381
|
distance
|
21568
21382
|
});
|
@@ -21758,7 +21572,7 @@ You can use close({ resize: true }) to resize header`);
|
|
21758
21572
|
};
|
21759
21573
|
|
21760
21574
|
// node_modules/.pnpm/prolly-trees@1.0.4/node_modules/prolly-trees/esm/src/cid-set.js
|
21761
|
-
var compare2 = ({ bytes:
|
21575
|
+
var compare2 = ({ bytes: a }, { bytes: b }) => binaryCompare(a, b);
|
21762
21576
|
var CIDEntry = class extends Entry {
|
21763
21577
|
constructor(cid) {
|
21764
21578
|
super({
|
@@ -21877,7 +21691,7 @@ You can use close({ resize: true }) to resize header`);
|
|
21877
21691
|
return (buffer2[offset] | buffer2[offset + 1] << 8 | buffer2[offset + 2] << 16) + buffer2[offset + 3] * 16777216;
|
21878
21692
|
};
|
21879
21693
|
const concat3 = (buffers) => {
|
21880
|
-
const uint8Arrays = buffers.map((
|
21694
|
+
const uint8Arrays = buffers.map((b) => b instanceof ArrayBuffer ? new Uint8Array(b) : b);
|
21881
21695
|
const totalLength = uint8Arrays.reduce((sum, arr) => sum + arr.length, 0);
|
21882
21696
|
const result = new Uint8Array(totalLength);
|
21883
21697
|
let offset = 0;
|
@@ -21981,7 +21795,7 @@ You can use close({ resize: true }) to resize header`);
|
|
21981
21795
|
if (unencrypted.cid.equals(root2)) eroot = block2.cid;
|
21982
21796
|
}
|
21983
21797
|
if (!eroot) throw logger.Error().Msg("cids does not include root").AsError();
|
21984
|
-
const list = [...set3].map((
|
21798
|
+
const list = [...set3].map((s) => CID.parse(s));
|
21985
21799
|
let last2;
|
21986
21800
|
for await (const node of create14({ list, get: get7, cache: cache3, chunker: chunker2, hasher, codec: src_exports })) {
|
21987
21801
|
const block2 = await node.block;
|
@@ -22051,20 +21865,20 @@ You can use close({ resize: true }) to resize header`);
|
|
22051
21865
|
}
|
22052
21866
|
return uint8Array;
|
22053
21867
|
}
|
22054
|
-
async function encryptedEncodeCarFile(logger, crypto2, key, rootCid,
|
21868
|
+
async function encryptedEncodeCarFile(logger, crypto2, key, rootCid, t) {
|
22055
21869
|
const encryptionKey = hexStringToUint8Array(key);
|
22056
21870
|
const encryptedBlocks = new MemoryBlockstore();
|
22057
21871
|
const cidsToEncrypt = [];
|
22058
|
-
for (const { cid, bytes } of
|
21872
|
+
for (const { cid, bytes } of t.entries()) {
|
22059
21873
|
cidsToEncrypt.push(cid);
|
22060
|
-
const g = await
|
21874
|
+
const g = await t.get(cid);
|
22061
21875
|
if (!g) throw logger.Error().Ref("cid", cid).Int("bytes", bytes.length).Msg("missing cid block").AsError();
|
22062
21876
|
}
|
22063
21877
|
let last2 = null;
|
22064
21878
|
const { encrypt } = makeEncDec(logger, crypto2, crypto2.randomBytes);
|
22065
21879
|
for await (const block of encrypt({
|
22066
21880
|
cids: cidsToEncrypt,
|
22067
|
-
get:
|
21881
|
+
get: t.get.bind(t),
|
22068
21882
|
key: encryptionKey,
|
22069
21883
|
hasher: sha256,
|
22070
21884
|
chunker,
|
@@ -22180,15 +21994,15 @@ You can use close({ resize: true }) to resize header`);
|
|
22180
21994
|
}
|
22181
21995
|
// TransactionMeta
|
22182
21996
|
async transaction(fn, _opts = {}) {
|
22183
|
-
const
|
22184
|
-
const done = await fn(
|
21997
|
+
const t = new CarTransaction(this);
|
21998
|
+
const done = await fn(t);
|
22185
21999
|
this.lastTxMeta = done;
|
22186
|
-
return { t
|
22000
|
+
return { t, meta: done };
|
22187
22001
|
}
|
22188
22002
|
async *entries() {
|
22189
22003
|
const seen = /* @__PURE__ */ new Set();
|
22190
|
-
for (const
|
22191
|
-
for await (const blk of
|
22004
|
+
for (const t of this.transactions) {
|
22005
|
+
for await (const blk of t.entries()) {
|
22192
22006
|
if (seen.has(blk.cid.toString())) continue;
|
22193
22007
|
seen.add(blk.cid.toString());
|
22194
22008
|
yield blk;
|
@@ -22226,14 +22040,14 @@ You can use close({ resize: true }) to resize header`);
|
|
22226
22040
|
return falsyToUndef(await this.loader.getBlock(cid));
|
22227
22041
|
}
|
22228
22042
|
async transaction(fn, opts = { noLoader: false }) {
|
22229
|
-
const { t
|
22230
|
-
const cars = await this.loader.commit(
|
22043
|
+
const { t, meta: done } = await super.transaction(fn);
|
22044
|
+
const cars = await this.loader.commit(t, done, opts);
|
22231
22045
|
if (this.ebOpts.autoCompact && this.loader.carLog.length > this.ebOpts.autoCompact) {
|
22232
22046
|
setTimeout(() => void this.compact(), 10);
|
22233
22047
|
}
|
22234
22048
|
if (cars) {
|
22235
|
-
this.transactions.delete(
|
22236
|
-
return { meta: done, cars, t
|
22049
|
+
this.transactions.delete(t);
|
22050
|
+
return { meta: done, cars, t };
|
22237
22051
|
}
|
22238
22052
|
throw this.logger.Error().Msg("failed to commit car files").AsError();
|
22239
22053
|
}
|
@@ -22270,8 +22084,8 @@ You can use close({ resize: true }) to resize header`);
|
|
22270
22084
|
for await (const blk of this.loader.entries(false)) {
|
22271
22085
|
blocks.loggedBlocks.putSync(blk.cid, blk.bytes);
|
22272
22086
|
}
|
22273
|
-
for (const
|
22274
|
-
for await (const blk of
|
22087
|
+
for (const t of this.transactions) {
|
22088
|
+
for await (const blk of t.entries()) {
|
22275
22089
|
blocks.loggedBlocks.putSync(blk.cid, blk.bytes);
|
22276
22090
|
}
|
22277
22091
|
}
|
@@ -22434,7 +22248,7 @@ You can use close({ resize: true }) to resize header`);
|
|
22434
22248
|
return;
|
22435
22249
|
}
|
22436
22250
|
const carHeader = await this.loadCarHeaderFromMeta(meta);
|
22437
|
-
carHeader.compact.map((
|
22251
|
+
carHeader.compact.map((c) => c.toString()).forEach(this.seenCompacted.add, this.seenCompacted);
|
22438
22252
|
await this.getMoreReaders(carHeader.cars.flat());
|
22439
22253
|
this.carLog = [...uniqueCids([meta.cars, ...this.carLog, ...carHeader.cars], this.seenCompacted)];
|
22440
22254
|
await this.ebOpts.applyMeta?.(carHeader.meta);
|
@@ -22456,15 +22270,15 @@ You can use close({ resize: true }) to resize header`);
|
|
22456
22270
|
}
|
22457
22271
|
return this.key || void 0;
|
22458
22272
|
}
|
22459
|
-
async commitFiles(
|
22460
|
-
return this.commitQueue.enqueue(() => this._commitInternalFiles(
|
22273
|
+
async commitFiles(t, done, opts = { noLoader: false, compact: false }) {
|
22274
|
+
return this.commitQueue.enqueue(() => this._commitInternalFiles(t, done, opts));
|
22461
22275
|
}
|
22462
22276
|
// can these skip the queue? or have a file queue?
|
22463
|
-
async _commitInternalFiles(
|
22277
|
+
async _commitInternalFiles(t, done, opts = { noLoader: false, compact: false }) {
|
22464
22278
|
await this.ready();
|
22465
22279
|
const { files: roots } = this.makeFileCarHeader(done);
|
22466
22280
|
const cids = [];
|
22467
|
-
const cars = await this.prepareCarFilesFiles(roots,
|
22281
|
+
const cars = await this.prepareCarFilesFiles(roots, t, !!opts.public);
|
22468
22282
|
for (const car of cars) {
|
22469
22283
|
const { cid, bytes } = car;
|
22470
22284
|
await (await this.fileStore()).save({ cid, bytes });
|
@@ -22476,11 +22290,11 @@ You can use close({ resize: true }) to resize header`);
|
|
22476
22290
|
async loadFileCar(cid, isPublic = false) {
|
22477
22291
|
return await this.storesLoadCar(cid, await this.fileStore(), this.remoteFileStore, isPublic);
|
22478
22292
|
}
|
22479
|
-
async commit(
|
22480
|
-
return this.commitQueue.enqueue(() => this._commitInternal(
|
22293
|
+
async commit(t, done, opts = { noLoader: false, compact: false }) {
|
22294
|
+
return this.commitQueue.enqueue(() => this._commitInternal(t, done, opts));
|
22481
22295
|
}
|
22482
|
-
async cacheTransaction(
|
22483
|
-
for await (const block of
|
22296
|
+
async cacheTransaction(t) {
|
22297
|
+
for await (const block of t.entries()) {
|
22484
22298
|
const sBlock = block.cid.toString();
|
22485
22299
|
if (!this.getBlockCache.has(sBlock)) {
|
22486
22300
|
this.getBlockCache.set(sBlock, block);
|
@@ -22497,42 +22311,42 @@ You can use close({ resize: true }) to resize header`);
|
|
22497
22311
|
}
|
22498
22312
|
}
|
22499
22313
|
}
|
22500
|
-
async _commitInternal(
|
22314
|
+
async _commitInternal(t, done, opts = { noLoader: false, compact: false }) {
|
22501
22315
|
await this.ready();
|
22502
22316
|
const fp = this.makeCarHeader(done, this.carLog, !!opts.compact);
|
22503
22317
|
const rootBlock = await encodeCarHeader(fp);
|
22504
|
-
const cars = await this.prepareCarFiles(rootBlock,
|
22318
|
+
const cars = await this.prepareCarFiles(rootBlock, t, !!opts.public);
|
22505
22319
|
const cids = [];
|
22506
22320
|
for (const car of cars) {
|
22507
22321
|
const { cid, bytes } = car;
|
22508
22322
|
await (await this.carStore()).save({ cid, bytes });
|
22509
22323
|
cids.push(cid);
|
22510
22324
|
}
|
22511
|
-
await this.cacheTransaction(
|
22325
|
+
await this.cacheTransaction(t);
|
22512
22326
|
const newDbMeta = { cars: cids, key: this.key || null };
|
22513
22327
|
await (await this.remoteWAL()).enqueue(newDbMeta, opts);
|
22514
22328
|
await (await this.metaStore()).save(newDbMeta);
|
22515
22329
|
await this.updateCarLog(cids, fp, !!opts.compact);
|
22516
22330
|
return cids;
|
22517
22331
|
}
|
22518
|
-
async prepareCarFilesFiles(roots,
|
22332
|
+
async prepareCarFilesFiles(roots, t, isPublic) {
|
22519
22333
|
const theKey = isPublic ? null : await this._getKey();
|
22520
|
-
const car = theKey && this.ebOpts.crypto ? await encryptedEncodeCarFile(this.logger, this.ebOpts.crypto, theKey, roots[0],
|
22334
|
+
const car = theKey && this.ebOpts.crypto ? await encryptedEncodeCarFile(this.logger, this.ebOpts.crypto, theKey, roots[0], t) : await encodeCarFile(roots, t);
|
22521
22335
|
return [car];
|
22522
22336
|
}
|
22523
|
-
async prepareCarFiles(rootBlock,
|
22337
|
+
async prepareCarFiles(rootBlock, t, isPublic) {
|
22524
22338
|
const theKey = isPublic ? void 0 : await this._getKey();
|
22525
22339
|
const carFiles = [];
|
22526
22340
|
const threshold = this.ebOpts.threshold || 1e3 * 1e3;
|
22527
|
-
let clonedt = new CarTransaction(
|
22341
|
+
let clonedt = new CarTransaction(t.parent, { add: false });
|
22528
22342
|
clonedt.putSync(rootBlock.cid, rootBlock.bytes);
|
22529
22343
|
let newsize = blockLength(toCIDBlock(rootBlock));
|
22530
22344
|
let cidRootBlock = rootBlock;
|
22531
|
-
for (const { cid, bytes } of
|
22345
|
+
for (const { cid, bytes } of t.entries()) {
|
22532
22346
|
newsize += blockLength(toCIDBlock({ cid, bytes }));
|
22533
22347
|
if (newsize >= threshold) {
|
22534
22348
|
carFiles.push(await this.createCarFile(theKey, cidRootBlock.cid, clonedt));
|
22535
|
-
clonedt = new CarTransaction(
|
22349
|
+
clonedt = new CarTransaction(t.parent, { add: false });
|
22536
22350
|
clonedt.putSync(cid, bytes);
|
22537
22351
|
cidRootBlock = { cid, bytes };
|
22538
22352
|
newsize = blockLength(toCIDBlock({ cid, bytes }));
|
@@ -22543,9 +22357,9 @@ You can use close({ resize: true }) to resize header`);
|
|
22543
22357
|
carFiles.push(await this.createCarFile(theKey, cidRootBlock.cid, clonedt));
|
22544
22358
|
return carFiles;
|
22545
22359
|
}
|
22546
|
-
async createCarFile(theKey, cid,
|
22360
|
+
async createCarFile(theKey, cid, t) {
|
22547
22361
|
try {
|
22548
|
-
return theKey && this.ebOpts.crypto ? await encryptedEncodeCarFile(this.logger, this.ebOpts.crypto, theKey, cid,
|
22362
|
+
return theKey && this.ebOpts.crypto ? await encryptedEncodeCarFile(this.logger, this.ebOpts.crypto, theKey, cid, t) : await encodeCarFile([cid], t);
|
22549
22363
|
} catch (e) {
|
22550
22364
|
console.error("error creating car file", e);
|
22551
22365
|
throw e;
|
@@ -22563,7 +22377,7 @@ You can use close({ resize: true }) to resize header`);
|
|
22563
22377
|
async updateCarLog(cids, fp, compact) {
|
22564
22378
|
if (compact) {
|
22565
22379
|
const previousCompactCid = fp.compact[fp.compact.length - 1];
|
22566
|
-
fp.compact.map((
|
22380
|
+
fp.compact.map((c) => c.toString()).forEach(this.seenCompacted.add, this.seenCompacted);
|
22567
22381
|
this.carLog = [...uniqueCids([...this.carLog, ...fp.cars, cids], this.seenCompacted)];
|
22568
22382
|
await this.removeCidsForCompact(previousCompactCid[0]);
|
22569
22383
|
} else {
|
@@ -22748,7 +22562,7 @@ You can use close({ resize: true }) to resize header`);
|
|
22748
22562
|
const data = encoder2.encode(key);
|
22749
22563
|
const hashBuffer = await this.ebOpts.crypto.digestSHA256(data);
|
22750
22564
|
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
22751
|
-
this.keyId = hashArray.map((
|
22565
|
+
this.keyId = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
22752
22566
|
}
|
22753
22567
|
async getMoreReaders(cids) {
|
22754
22568
|
const limit = pLimit(5);
|
@@ -22758,6 +22572,12 @@ You can use close({ resize: true }) to resize header`);
|
|
22758
22572
|
};
|
22759
22573
|
|
22760
22574
|
// src/blockstore/store.ts
|
22575
|
+
function guardVersion(url) {
|
22576
|
+
if (!url.searchParams.has("version")) {
|
22577
|
+
return Result.Err(`missing version: ${url.toString()}`);
|
22578
|
+
}
|
22579
|
+
return Result.Ok(url);
|
22580
|
+
}
|
22761
22581
|
var VersionedStore = class {
|
22762
22582
|
constructor(name7, url, logger) {
|
22763
22583
|
this._onStarted = [];
|
@@ -22773,8 +22593,8 @@ You can use close({ resize: true }) to resize header`);
|
|
22773
22593
|
this._onClosed.push(fn);
|
22774
22594
|
}
|
22775
22595
|
};
|
22776
|
-
var
|
22777
|
-
var
|
22596
|
+
var textEncoder6 = new TextEncoder();
|
22597
|
+
var textDecoder5 = new TextDecoder();
|
22778
22598
|
var MetaStore = class extends VersionedStore {
|
22779
22599
|
constructor(name7, url, logger, gateway) {
|
22780
22600
|
super(name7, url, ensureLogger(logger, "MetaStore", {}));
|
@@ -22803,17 +22623,17 @@ You can use close({ resize: true }) to resize header`);
|
|
22803
22623
|
this.logger.Debug().Str("branch", branch || "").Msg("loading");
|
22804
22624
|
const url = await this.gateway.buildUrl(this.url, branch || "main");
|
22805
22625
|
if (url.isErr()) {
|
22806
|
-
throw this.logger.Error().
|
22626
|
+
throw this.logger.Error().Result("buidUrl", url).Str("branch", branch || "").Url(this.url).Msg("got error from gateway.buildUrl").AsError();
|
22807
22627
|
}
|
22808
22628
|
const bytes = await this.gateway.get(url.Ok());
|
22809
22629
|
if (bytes.isErr()) {
|
22810
22630
|
if (isNotFoundError(bytes)) {
|
22811
22631
|
return void 0;
|
22812
22632
|
}
|
22813
|
-
throw this.logger.Error().
|
22633
|
+
throw this.logger.Error().Url(url.Ok()).Result("bytes:", bytes).Msg("gateway get").AsError();
|
22814
22634
|
}
|
22815
22635
|
try {
|
22816
|
-
return [this.parseHeader(
|
22636
|
+
return [this.parseHeader(textDecoder5.decode(bytes.Ok()))];
|
22817
22637
|
} catch (e) {
|
22818
22638
|
throw this.logger.Error().Err(e).Msg("parseHeader").AsError();
|
22819
22639
|
}
|
@@ -22825,7 +22645,7 @@ You can use close({ resize: true }) to resize header`);
|
|
22825
22645
|
if (url.isErr()) {
|
22826
22646
|
throw this.logger.Error().Err(url.Err()).Str("branch", branch).Url(this.url).Msg("got error from gateway.buildUrl").AsError();
|
22827
22647
|
}
|
22828
|
-
const res = await this.gateway.put(url.Ok(),
|
22648
|
+
const res = await this.gateway.put(url.Ok(), textEncoder6.encode(bytes));
|
22829
22649
|
if (res.isErr()) {
|
22830
22650
|
throw this.logger.Error().Err(res.Err()).Msg("got error from gateway.put").AsError();
|
22831
22651
|
}
|
@@ -22856,13 +22676,13 @@ You can use close({ resize: true }) to resize header`);
|
|
22856
22676
|
this.logger.Debug().Msg("starting-gateway");
|
22857
22677
|
const res = await this.gateway.start(this.url);
|
22858
22678
|
if (res.isErr()) {
|
22859
|
-
this.logger.Error().
|
22679
|
+
this.logger.Error().Result("gw-start", res).Msg("started-gateway");
|
22860
22680
|
return res;
|
22861
22681
|
}
|
22862
22682
|
this._onStarted.forEach((fn) => fn());
|
22863
22683
|
const version = guardVersion(this.url);
|
22864
22684
|
if (version.isErr()) {
|
22865
|
-
this.logger.Error().
|
22685
|
+
this.logger.Error().Result("version", version).Msg("guardVersion");
|
22866
22686
|
await this.close();
|
22867
22687
|
return version;
|
22868
22688
|
}
|
@@ -23012,7 +22832,7 @@ You can use close({ resize: true }) to resize header`);
|
|
23012
22832
|
}
|
23013
22833
|
try {
|
23014
22834
|
const res = await Promise.allSettled(uploads);
|
23015
|
-
const errors = res.filter((
|
22835
|
+
const errors = res.filter((r) => r.status === "rejected");
|
23016
22836
|
if (errors.length) {
|
23017
22837
|
throw this.logger.Error().Any(
|
23018
22838
|
"errors",
|
@@ -23065,7 +22885,7 @@ You can use close({ resize: true }) to resize header`);
|
|
23065
22885
|
throw this.logger.Error().Err(bytes.Err()).Msg("error get").AsError();
|
23066
22886
|
}
|
23067
22887
|
try {
|
23068
|
-
return bytes && parse2(
|
22888
|
+
return bytes && parse2(textDecoder5.decode(bytes.Ok()));
|
23069
22889
|
} catch (e) {
|
23070
22890
|
throw this.logger.Error().Err(e).Msg("error parse").AsError();
|
23071
22891
|
}
|
@@ -23081,7 +22901,7 @@ You can use close({ resize: true }) to resize header`);
|
|
23081
22901
|
} catch (e) {
|
23082
22902
|
throw this.logger.Error().Err(e).Any("state", state).Msg("error format").AsError();
|
23083
22903
|
}
|
23084
|
-
const res = await this.gateway.put(filepath.Ok(),
|
22904
|
+
const res = await this.gateway.put(filepath.Ok(), textEncoder6.encode(encoded));
|
23085
22905
|
if (res.isErr()) {
|
23086
22906
|
throw this.logger.Error().Err(res.Err()).Str("filePath", filepath.Ok().toString()).Msg("error saving").AsError();
|
23087
22907
|
}
|
@@ -23133,17 +22953,26 @@ You can use close({ resize: true }) to resize header`);
|
|
23133
22953
|
return toURL(optURL || obuUrl || dataDir(loader.name, storeOpts.stores?.base), storeOpts.isIndex);
|
23134
22954
|
}
|
23135
22955
|
function registerStoreProtocol(item) {
|
23136
|
-
|
23137
|
-
|
22956
|
+
let protocol = item.protocol;
|
22957
|
+
if (!protocol.endsWith(":")) {
|
22958
|
+
protocol += ":";
|
22959
|
+
}
|
22960
|
+
if (storeFactory.has(protocol)) {
|
22961
|
+
if (!item.overrideBaseURL && storeFactory.get(protocol) !== item) {
|
22962
|
+
const logger = ensureLogger({}, "registerStoreProtocol", { protocol });
|
22963
|
+
logger.Warn().Msg(`protocol ${protocol} already registered`);
|
22964
|
+
return () => {
|
22965
|
+
};
|
22966
|
+
}
|
23138
22967
|
}
|
23139
22968
|
if (item.overrideBaseURL) {
|
23140
22969
|
Array.from(storeFactory.values()).forEach((items) => {
|
23141
22970
|
items.overrideBaseURL = void 0;
|
23142
22971
|
});
|
23143
22972
|
}
|
23144
|
-
storeFactory.set(
|
22973
|
+
storeFactory.set(protocol, item);
|
23145
22974
|
return () => {
|
23146
|
-
storeFactory.delete(
|
22975
|
+
storeFactory.delete(protocol);
|
23147
22976
|
};
|
23148
22977
|
}
|
23149
22978
|
function runStoreFactory(url, logger, run) {
|
@@ -23169,7 +22998,10 @@ You can use close({ resize: true }) to resize header`);
|
|
23169
22998
|
return onceDataStoreFactory.get(url.toString()).once(async () => {
|
23170
22999
|
const gateway = await loadDataGateway(url, logger);
|
23171
23000
|
const store = new DataStore(loader.name, url, loader.logger, gateway);
|
23172
|
-
await store.start();
|
23001
|
+
const ret = await store.start();
|
23002
|
+
if (ret.isErr()) {
|
23003
|
+
throw logger.Error().Result("start", ret).Msg("start failed").AsError();
|
23004
|
+
}
|
23173
23005
|
logger.Debug().Str("prepared", store.url.toString()).Msg("produced");
|
23174
23006
|
return store;
|
23175
23007
|
});
|
@@ -23190,7 +23022,10 @@ You can use close({ resize: true }) to resize header`);
|
|
23190
23022
|
logger.Debug().Str("protocol", url.protocol).Msg("pre-protocol switch");
|
23191
23023
|
const gateway = await loadMetaGateway(url, logger);
|
23192
23024
|
const store = new MetaStore(loader.name, url, loader.logger, gateway);
|
23193
|
-
await store.start();
|
23025
|
+
const ret = await store.start();
|
23026
|
+
if (ret.isErr()) {
|
23027
|
+
throw logger.Error().Result("start", ret).Msg("start failed").AsError();
|
23028
|
+
}
|
23194
23029
|
return store;
|
23195
23030
|
});
|
23196
23031
|
}
|
@@ -23210,7 +23045,10 @@ You can use close({ resize: true }) to resize header`);
|
|
23210
23045
|
const gateway = await loadWalGateway(url, logger);
|
23211
23046
|
logger.Debug().Str("prepared", url.toString()).Msg("produced");
|
23212
23047
|
const store = new RemoteWAL(loader, url, loader.logger, gateway);
|
23213
|
-
await store.start();
|
23048
|
+
const ret = await store.start();
|
23049
|
+
if (ret.isErr()) {
|
23050
|
+
throw logger.Error().Result("start", ret).Msg("start failed").AsError();
|
23051
|
+
}
|
23214
23052
|
return store;
|
23215
23053
|
});
|
23216
23054
|
}
|
@@ -23280,25 +23118,6 @@ You can use close({ resize: true }) to resize header`);
|
|
23280
23118
|
return new IndexDBTestStore2(logger);
|
23281
23119
|
}
|
23282
23120
|
});
|
23283
|
-
registerStoreProtocol({
|
23284
|
-
protocol: "sqlite:",
|
23285
|
-
data: async (logger) => {
|
23286
|
-
const { SQLDataGateway } = await Promise.resolve().then(() => __toESM(require_not_impl(), 1));
|
23287
|
-
return new SQLDataGateway(logger);
|
23288
|
-
},
|
23289
|
-
meta: async (logger) => {
|
23290
|
-
const { SQLMetaGateway } = await Promise.resolve().then(() => __toESM(require_not_impl(), 1));
|
23291
|
-
return new SQLMetaGateway(logger);
|
23292
|
-
},
|
23293
|
-
wal: async (logger) => {
|
23294
|
-
const { SQLWalGateway } = await Promise.resolve().then(() => __toESM(require_not_impl(), 1));
|
23295
|
-
return new SQLWalGateway(logger);
|
23296
|
-
},
|
23297
|
-
test: async (logger) => {
|
23298
|
-
const { SQLTestStore } = await Promise.resolve().then(() => __toESM(require_not_impl(), 1));
|
23299
|
-
return new SQLTestStore(logger);
|
23300
|
-
}
|
23301
|
-
});
|
23302
23121
|
|
23303
23122
|
// src/blockstore/index.ts
|
23304
23123
|
init_gateway();
|
@@ -23367,7 +23186,7 @@ You can use close({ resize: true }) to resize header`);
|
|
23367
23186
|
async function processFileset(logger, store, blocks, files, publicFiles = false) {
|
23368
23187
|
const dbBlockstore = blocks.parent;
|
23369
23188
|
if (!dbBlockstore.loader) throw logger.Error().Msg("Missing loader, database name is required").AsError();
|
23370
|
-
const
|
23189
|
+
const t = new CarTransaction(dbBlockstore);
|
23371
23190
|
const didPut = [];
|
23372
23191
|
for (const filename in files) {
|
23373
23192
|
if (File === files[filename].constructor) {
|
@@ -23375,7 +23194,7 @@ You can use close({ resize: true }) to resize header`);
|
|
23375
23194
|
const { cid, blocks: fileBlocks } = await store.encodeFile(file);
|
23376
23195
|
didPut.push(filename);
|
23377
23196
|
for (const block of fileBlocks) {
|
23378
|
-
|
23197
|
+
t.putSync(block.cid, block.bytes);
|
23379
23198
|
}
|
23380
23199
|
files[filename] = { cid, type: file.type, size: file.size };
|
23381
23200
|
} else {
|
@@ -23386,7 +23205,7 @@ You can use close({ resize: true }) to resize header`);
|
|
23386
23205
|
}
|
23387
23206
|
}
|
23388
23207
|
if (didPut.length) {
|
23389
|
-
const car = await dbBlockstore.loader.commitFiles(
|
23208
|
+
const car = await dbBlockstore.loader.commitFiles(t, { files }, {
|
23390
23209
|
public: publicFiles
|
23391
23210
|
});
|
23392
23211
|
if (car) {
|
@@ -23472,7 +23291,7 @@ You can use close({ resize: true }) to resize header`);
|
|
23472
23291
|
}
|
23473
23292
|
async function gatherUpdates(blocks, eventsFetcher, head, since, updates = [], keys, didLinks, limit, logger) {
|
23474
23293
|
if (limit <= 0) return updates;
|
23475
|
-
const sHead = head.map((
|
23294
|
+
const sHead = head.map((l) => l.toString());
|
23476
23295
|
for (const link2 of since) {
|
23477
23296
|
if (sHead.includes(link2.toString())) {
|
23478
23297
|
return updates;
|
@@ -23679,7 +23498,7 @@ You can use close({ resize: true }) to resize header`);
|
|
23679
23498
|
};
|
23680
23499
|
var create15 = ({ get: get7, cache: cache3, chunker: chunker2, list, codec, hasher, sorted, compare: compare5, ...opts }) => {
|
23681
23500
|
if (!sorted)
|
23682
|
-
list = list.sort(({ key:
|
23501
|
+
list = list.sort(({ key: a }, { key: b }) => compare5(a, b));
|
23683
23502
|
const getNode = createGetNode2(get7, cache3, chunker2, codec, hasher, compare5, opts);
|
23684
23503
|
const _opts = {
|
23685
23504
|
list,
|
@@ -23750,9 +23569,9 @@ You can use close({ resize: true }) to resize header`);
|
|
23750
23569
|
}
|
23751
23570
|
|
23752
23571
|
// node_modules/.pnpm/prolly-trees@1.0.4/node_modules/prolly-trees/esm/src/db-index.js
|
23753
|
-
var compare3 = (
|
23754
|
-
const [aKey, aRef] =
|
23755
|
-
const [bKey, bRef] =
|
23572
|
+
var compare3 = (a, b) => {
|
23573
|
+
const [aKey, aRef] = a;
|
23574
|
+
const [bKey, bRef] = b;
|
23756
23575
|
const comp = simpleCompare(aKey, bKey);
|
23757
23576
|
if (comp !== 0)
|
23758
23577
|
return comp;
|
@@ -23882,9 +23701,9 @@ You can use close({ resize: true }) to resize header`);
|
|
23882
23701
|
if (aRef === Infinity) return 1;
|
23883
23702
|
return simpleCompare(aRef, bRef);
|
23884
23703
|
}
|
23885
|
-
function compare4(
|
23886
|
-
const [aKey, aRef] =
|
23887
|
-
const [bKey, bRef] =
|
23704
|
+
function compare4(a, b) {
|
23705
|
+
const [aKey, aRef] = a;
|
23706
|
+
const [bKey, bRef] = b;
|
23888
23707
|
const comp = simpleCompare(aKey, bKey);
|
23889
23708
|
if (comp !== 0) return comp;
|
23890
23709
|
return refCompare2(aRef, bRef);
|
@@ -24033,7 +23852,7 @@ You can use close({ resize: true }) to resize header`);
|
|
24033
23852
|
this.name = name7;
|
24034
23853
|
try {
|
24035
23854
|
if (meta) {
|
24036
|
-
if (this.indexHead && this.indexHead.map((
|
23855
|
+
if (this.indexHead && this.indexHead.map((c) => c.toString()).join() !== meta.head.map((c) => c.toString()).join()) {
|
24037
23856
|
throw this.logger.Error().Msg("cannot apply different head meta").AsError();
|
24038
23857
|
}
|
24039
23858
|
if (this.mapFnString) {
|
@@ -24209,7 +24028,7 @@ You can use close({ resize: true }) to resize header`);
|
|
24209
24028
|
const allUpdates = [];
|
24210
24029
|
try {
|
24211
24030
|
while (queue.length > 0) {
|
24212
|
-
queue.sort((
|
24031
|
+
queue.sort((a, b) => b.updates ? 1 : -1);
|
24213
24032
|
const task = queue.shift();
|
24214
24033
|
if (!task) continue;
|
24215
24034
|
await worker(task.newHead, task.prevHead, task.updates !== null).catch((e) => {
|
@@ -24218,7 +24037,7 @@ You can use close({ resize: true }) to resize header`);
|
|
24218
24037
|
if (task.updates) {
|
24219
24038
|
allUpdates.push(...task.updates);
|
24220
24039
|
}
|
24221
|
-
if (!queue.some((
|
24040
|
+
if (!queue.some((t) => t.updates) || task.updates) {
|
24222
24041
|
const allTasksHaveUpdates = queue.every((task2) => task2.updates !== null);
|
24223
24042
|
yield { updates: allUpdates, all: allTasksHaveUpdates };
|
24224
24043
|
allUpdates.length = 0;
|
@@ -24336,7 +24155,7 @@ You can use close({ resize: true }) to resize header`);
|
|
24336
24155
|
}
|
24337
24156
|
};
|
24338
24157
|
function sortClockHead(clockHead) {
|
24339
|
-
return clockHead.sort((
|
24158
|
+
return clockHead.sort((a, b) => a.toString().localeCompare(b.toString()));
|
24340
24159
|
}
|
24341
24160
|
async function validateBlocks(logger, newHead, blockstore) {
|
24342
24161
|
if (!blockstore) throw logger.Error().Msg("missing blockstore");
|
@@ -24521,9 +24340,9 @@ You can use close({ resize: true }) to resize header`);
|
|
24521
24340
|
});
|
24522
24341
|
}
|
24523
24342
|
async get(id) {
|
24524
|
-
this.logger.
|
24343
|
+
if (!id) throw this.logger.Error().Str("db", this.name).Msg(`Doc id is required`).AsError();
|
24525
24344
|
await this.ready();
|
24526
|
-
this.logger.Debug().Str("id", id).Msg("get
|
24345
|
+
this.logger.Debug().Str("id", id).Msg("get");
|
24527
24346
|
const got = await this._crdt.get(id).catch((e) => {
|
24528
24347
|
throw new NotFoundError(`Not found: ${id} - ${e.message}`);
|
24529
24348
|
});
|
@@ -24532,9 +24351,8 @@ You can use close({ resize: true }) to resize header`);
|
|
24532
24351
|
return { ...doc, _id: id };
|
24533
24352
|
}
|
24534
24353
|
async put(doc) {
|
24535
|
-
this.logger.Debug().Str("id", doc._id).Msg("put-pre-ready");
|
24536
24354
|
await this.ready();
|
24537
|
-
this.logger.Debug().Str("id", doc._id).Msg("put
|
24355
|
+
this.logger.Debug().Str("id", doc._id).Msg("put");
|
24538
24356
|
const { _id, ...value } = doc;
|
24539
24357
|
const docId = _id || uuidv7();
|
24540
24358
|
const result = await this._writeQueue.push({
|
@@ -24544,36 +24362,40 @@ You can use close({ resize: true }) to resize header`);
|
|
24544
24362
|
_id: docId
|
24545
24363
|
}
|
24546
24364
|
});
|
24547
|
-
return { id: docId, clock: result?.head };
|
24365
|
+
return { id: docId, clock: result?.head, name: this.name };
|
24548
24366
|
}
|
24549
24367
|
async del(id) {
|
24550
24368
|
await this.ready();
|
24369
|
+
this.logger.Debug().Str("id", id).Msg("del");
|
24551
24370
|
const result = await this._writeQueue.push({ id, del: true });
|
24552
|
-
return { id, clock: result?.head };
|
24371
|
+
return { id, clock: result?.head, name: this.name };
|
24553
24372
|
}
|
24554
24373
|
async changes(since = [], opts = {}) {
|
24555
24374
|
await this.ready();
|
24375
|
+
this.logger.Debug().Any("since", since).Any("opts", opts).Msg("changes");
|
24556
24376
|
const { result, head } = await this._crdt.changes(since, opts);
|
24557
24377
|
const rows = result.map(({ id: key, value, del: del2, clock }) => ({
|
24558
24378
|
key,
|
24559
24379
|
value: del2 ? { _id: key, _deleted: true } : { _id: key, ...value },
|
24560
24380
|
clock
|
24561
24381
|
}));
|
24562
|
-
return { rows, clock: head };
|
24382
|
+
return { rows, clock: head, name: this.name };
|
24563
24383
|
}
|
24564
24384
|
async allDocs(opts = {}) {
|
24565
24385
|
await this.ready();
|
24386
|
+
this.logger.Debug().Msg("allDocs");
|
24566
24387
|
const { result, head } = await this._crdt.allDocs();
|
24567
24388
|
const rows = result.map(({ id: key, value, del: del2 }) => ({
|
24568
24389
|
key,
|
24569
24390
|
value: del2 ? { _id: key, _deleted: true } : { _id: key, ...value }
|
24570
24391
|
}));
|
24571
|
-
return { rows, clock: head };
|
24392
|
+
return { rows, clock: head, name: this.name };
|
24572
24393
|
}
|
24573
24394
|
async allDocuments() {
|
24574
24395
|
return this.allDocs();
|
24575
24396
|
}
|
24576
24397
|
subscribe(listener, updates) {
|
24398
|
+
this.logger.Debug().Bool("updates", updates).Msg("subscribe");
|
24577
24399
|
if (updates) {
|
24578
24400
|
if (!this._listening) {
|
24579
24401
|
this._listening = true;
|
@@ -24595,6 +24417,7 @@ You can use close({ resize: true }) to resize header`);
|
|
24595
24417
|
// todo if we add this onto dbs in fireproof.ts then we can make index.ts a separate package
|
24596
24418
|
async query(field, opts = {}) {
|
24597
24419
|
await this.ready();
|
24420
|
+
this.logger.Debug().Any("field", field).Any("opts", opts).Msg("query");
|
24598
24421
|
const _crdt = this._crdt;
|
24599
24422
|
const idx = typeof field === "string" ? index({ _crdt }, field) : index({ _crdt }, makeName(field.toString()), field);
|
24600
24423
|
return await idx.query(opts);
|
@@ -24627,7 +24450,7 @@ You can use close({ resize: true }) to resize header`);
|
|
24627
24450
|
};
|
24628
24451
|
function toSortedArray(set3) {
|
24629
24452
|
if (!set3) return [];
|
24630
|
-
return Object.entries(set3).sort(([
|
24453
|
+
return Object.entries(set3).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => ({ [k]: v }));
|
24631
24454
|
}
|
24632
24455
|
function fireproof(name7, opts) {
|
24633
24456
|
const key = JSON.stringify(
|
@@ -24670,7 +24493,7 @@ You can use close({ resize: true }) to resize header`);
|
|
24670
24493
|
|
24671
24494
|
// src/version.ts
|
24672
24495
|
var PACKAGE_VERSION = Object.keys({
|
24673
|
-
"0.
|
24496
|
+
"0.19.8-dev-getid": "xxxx"
|
24674
24497
|
})[0];
|
24675
24498
|
return __toCommonJS(src_exports5);
|
24676
24499
|
})();
|