@fireproof/core 0.17.4 → 0.17.5
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -2
- package/dist/browser/fireproof.global.js +32 -80
- package/dist/browser/fireproof.global.js.map +1 -1
- package/dist/browser/metafile-iife.json +1 -1
- package/dist/memory/fireproof.global.js +32 -80
- package/dist/memory/fireproof.global.js.map +1 -1
- package/dist/memory/metafile-iife.json +1 -1
- package/dist/node/fireproof.global.js +32 -80
- package/dist/node/fireproof.global.js.map +1 -1
- package/dist/node/metafile-iife.json +1 -1
- package/package.json +3 -3
@@ -4082,7 +4082,7 @@ var Fireproof = (() => {
|
|
4082
4082
|
};
|
4083
4083
|
var parse = (source, base4) => CID.parse(source, base4);
|
4084
4084
|
|
4085
|
-
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.
|
4085
|
+
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.2/node_modules/@web3-storage/pail/src/block.js
|
4086
4086
|
var MemoryBlockstore = class {
|
4087
4087
|
/** @type {Map<string, Uint8Array>} */
|
4088
4088
|
#blocks = /* @__PURE__ */ new Map();
|
@@ -4129,6 +4129,22 @@ var Fireproof = (() => {
|
|
4129
4129
|
}
|
4130
4130
|
}
|
4131
4131
|
};
|
4132
|
+
var MultiBlockFetcher = class {
|
4133
|
+
/** @type {API.BlockFetcher[]} */
|
4134
|
+
#fetchers;
|
4135
|
+
/** @param {API.BlockFetcher[]} fetchers */
|
4136
|
+
constructor(...fetchers) {
|
4137
|
+
this.#fetchers = fetchers;
|
4138
|
+
}
|
4139
|
+
/** @type {API.BlockFetcher['get']} */
|
4140
|
+
async get(link2) {
|
4141
|
+
for (const f of this.#fetchers) {
|
4142
|
+
const v = await f.get(link2);
|
4143
|
+
if (v)
|
4144
|
+
return v;
|
4145
|
+
}
|
4146
|
+
}
|
4147
|
+
};
|
4132
4148
|
|
4133
4149
|
// ../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js
|
4134
4150
|
var Node = class {
|
@@ -9952,7 +9968,7 @@ You can use close({ resize: true }) to resize header`);
|
|
9952
9968
|
}
|
9953
9969
|
return bytes;
|
9954
9970
|
}
|
9955
|
-
var PACKAGE_VERSION = "0.17.
|
9971
|
+
var PACKAGE_VERSION = "0.17.4";
|
9956
9972
|
var match = PACKAGE_VERSION.match(/^([^.]*\.[^.]*)/);
|
9957
9973
|
if (!match)
|
9958
9974
|
throw new Error("invalid version: " + PACKAGE_VERSION);
|
@@ -10678,7 +10694,7 @@ You can use close({ resize: true }) to resize header`);
|
|
10678
10694
|
}));
|
10679
10695
|
|
10680
10696
|
// ../encrypted-blockstore/dist/lib/store-web.js
|
10681
|
-
var PACKAGE_VERSION2 = "0.17.
|
10697
|
+
var PACKAGE_VERSION2 = "0.17.4";
|
10682
10698
|
var match2 = PACKAGE_VERSION2.match(/^([^.]*\.[^.]*)/);
|
10683
10699
|
if (!match2)
|
10684
10700
|
throw new Error("invalid version: " + PACKAGE_VERSION2);
|
@@ -10976,7 +10992,7 @@ You can use close({ resize: true }) to resize header`);
|
|
10976
10992
|
makeRemoteWAL
|
10977
10993
|
};
|
10978
10994
|
|
10979
|
-
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.
|
10995
|
+
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.2/node_modules/@web3-storage/pail/src/clock/index.js
|
10980
10996
|
var advance = async (blocks, head, event) => {
|
10981
10997
|
const events = new EventFetcher(blocks);
|
10982
10998
|
const headmap = new Map(head.map((cid) => [cid.toString(), cid]));
|
@@ -11102,7 +11118,7 @@ You can use close({ resize: true }) to resize header`);
|
|
11102
11118
|
};
|
11103
11119
|
var shortLink = (l) => `${String(l).slice(0, 4)}..${String(l).slice(-4)}`;
|
11104
11120
|
|
11105
|
-
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.
|
11121
|
+
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.2/node_modules/@web3-storage/pail/src/shard.js
|
11106
11122
|
var MaxKeyLength = 64;
|
11107
11123
|
var MaxShardSize = 512 * 1024;
|
11108
11124
|
var CID_TAG2 = new Token(Type.tag, 42);
|
@@ -11234,7 +11250,7 @@ You can use close({ resize: true }) to resize header`);
|
|
11234
11250
|
}
|
11235
11251
|
};
|
11236
11252
|
|
11237
|
-
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.
|
11253
|
+
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.2/node_modules/@web3-storage/pail/src/index.js
|
11238
11254
|
var put = async (blocks, root2, key, value) => {
|
11239
11255
|
const shards = new ShardFetcher(blocks);
|
11240
11256
|
const rshard = await shards.get(root2);
|
@@ -11437,71 +11453,7 @@ You can use close({ resize: true }) to resize header`);
|
|
11437
11453
|
return [shard];
|
11438
11454
|
};
|
11439
11455
|
|
11440
|
-
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.
|
11441
|
-
var MemoryBlockstore2 = class {
|
11442
|
-
/** @type {Map<string, Uint8Array>} */
|
11443
|
-
#blocks = /* @__PURE__ */ new Map();
|
11444
|
-
/**
|
11445
|
-
* @param {Array<import('multiformats').Block>} [blocks]
|
11446
|
-
*/
|
11447
|
-
constructor(blocks) {
|
11448
|
-
if (blocks) {
|
11449
|
-
this.#blocks = new Map(blocks.map((b) => [b.cid.toString(), b.bytes]));
|
11450
|
-
}
|
11451
|
-
}
|
11452
|
-
/** @type {API.BlockFetcher['get']} */
|
11453
|
-
async get(cid) {
|
11454
|
-
const bytes = this.#blocks.get(cid.toString());
|
11455
|
-
if (!bytes)
|
11456
|
-
return;
|
11457
|
-
return { cid, bytes };
|
11458
|
-
}
|
11459
|
-
/**
|
11460
|
-
* @param {API.UnknownLink} cid
|
11461
|
-
* @param {Uint8Array} bytes
|
11462
|
-
*/
|
11463
|
-
async put(cid, bytes) {
|
11464
|
-
this.#blocks.set(cid.toString(), bytes);
|
11465
|
-
}
|
11466
|
-
/**
|
11467
|
-
* @param {API.UnknownLink} cid
|
11468
|
-
* @param {Uint8Array} bytes
|
11469
|
-
*/
|
11470
|
-
putSync(cid, bytes) {
|
11471
|
-
this.#blocks.set(cid.toString(), bytes);
|
11472
|
-
}
|
11473
|
-
/** @param {API.UnknownLink} cid */
|
11474
|
-
async delete(cid) {
|
11475
|
-
this.#blocks.delete(cid.toString());
|
11476
|
-
}
|
11477
|
-
/** @param {API.UnknownLink} cid */
|
11478
|
-
deleteSync(cid) {
|
11479
|
-
this.#blocks.delete(cid.toString());
|
11480
|
-
}
|
11481
|
-
*entries() {
|
11482
|
-
for (const [str, bytes] of this.#blocks) {
|
11483
|
-
yield { cid: parse(str), bytes };
|
11484
|
-
}
|
11485
|
-
}
|
11486
|
-
};
|
11487
|
-
var MultiBlockFetcher = class {
|
11488
|
-
/** @type {API.BlockFetcher[]} */
|
11489
|
-
#fetchers;
|
11490
|
-
/** @param {API.BlockFetcher[]} fetchers */
|
11491
|
-
constructor(...fetchers) {
|
11492
|
-
this.#fetchers = fetchers;
|
11493
|
-
}
|
11494
|
-
/** @type {API.BlockFetcher['get']} */
|
11495
|
-
async get(link2) {
|
11496
|
-
for (const f of this.#fetchers) {
|
11497
|
-
const v = await f.get(link2);
|
11498
|
-
if (v)
|
11499
|
-
return v;
|
11500
|
-
}
|
11501
|
-
}
|
11502
|
-
};
|
11503
|
-
|
11504
|
-
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.1/node_modules/@web3-storage/pail/src/batch/shard.js
|
11456
|
+
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.2/node_modules/@web3-storage/pail/src/batch/shard.js
|
11505
11457
|
var ShardLinkByteLength = 36;
|
11506
11458
|
var CID_TAG3 = new Token(Type.tag, 42);
|
11507
11459
|
var create8 = (init2) => ({
|
@@ -11548,7 +11500,7 @@ You can use close({ resize: true }) to resize header`);
|
|
11548
11500
|
return tokensToLength(tokens);
|
11549
11501
|
};
|
11550
11502
|
|
11551
|
-
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.
|
11503
|
+
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.2/node_modules/@web3-storage/pail/src/batch/index.js
|
11552
11504
|
var Batcher = class _Batcher {
|
11553
11505
|
#committed = false;
|
11554
11506
|
/**
|
@@ -11730,9 +11682,9 @@ You can use close({ resize: true }) to resize header`);
|
|
11730
11682
|
static code = "ERR_BATCH_COMMITTED";
|
11731
11683
|
};
|
11732
11684
|
|
11733
|
-
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.
|
11685
|
+
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.2/node_modules/@web3-storage/pail/src/crdt/index.js
|
11734
11686
|
var put3 = async (blocks, head, key, value) => {
|
11735
|
-
const mblocks = new
|
11687
|
+
const mblocks = new MemoryBlockstore();
|
11736
11688
|
blocks = new MultiBlockFetcher(mblocks, blocks);
|
11737
11689
|
if (!head.length) {
|
11738
11690
|
const shard = await ShardBlock.create();
|
@@ -11816,7 +11768,7 @@ You can use close({ resize: true }) to resize header`);
|
|
11816
11768
|
var root = async (blocks, head) => {
|
11817
11769
|
if (!head.length)
|
11818
11770
|
throw new Error("cannot determine root of headless clock");
|
11819
|
-
const mblocks = new
|
11771
|
+
const mblocks = new MemoryBlockstore();
|
11820
11772
|
blocks = new MultiBlockFetcher(mblocks, blocks);
|
11821
11773
|
const events = new EventFetcher(blocks);
|
11822
11774
|
if (head.length === 1) {
|
@@ -11875,7 +11827,7 @@ You can use close({ resize: true }) to resize header`);
|
|
11875
11827
|
return;
|
11876
11828
|
const result = await root(blocks, head);
|
11877
11829
|
if (result.additions.length) {
|
11878
|
-
blocks = new MultiBlockFetcher(new
|
11830
|
+
blocks = new MultiBlockFetcher(new MemoryBlockstore(result.additions), blocks);
|
11879
11831
|
}
|
11880
11832
|
return get2(blocks, result.root, key);
|
11881
11833
|
};
|
@@ -11884,7 +11836,7 @@ You can use close({ resize: true }) to resize header`);
|
|
11884
11836
|
return;
|
11885
11837
|
const result = await root(blocks, head);
|
11886
11838
|
if (result.additions.length) {
|
11887
|
-
blocks = new MultiBlockFetcher(new
|
11839
|
+
blocks = new MultiBlockFetcher(new MemoryBlockstore(result.additions), blocks);
|
11888
11840
|
}
|
11889
11841
|
yield* entries(blocks, result.root, options);
|
11890
11842
|
};
|
@@ -11968,7 +11920,7 @@ You can use close({ resize: true }) to resize header`);
|
|
11968
11920
|
return acc.concat(...rest);
|
11969
11921
|
};
|
11970
11922
|
|
11971
|
-
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.
|
11923
|
+
// ../../node_modules/.pnpm/@web3-storage+pail@0.4.2/node_modules/@web3-storage/pail/src/crdt/batch/index.js
|
11972
11924
|
var Batcher2 = class _Batcher {
|
11973
11925
|
#committed = false;
|
11974
11926
|
/**
|
@@ -12013,7 +11965,7 @@ You can use close({ resize: true }) to resize header`);
|
|
12013
11965
|
const res = await commit(this);
|
12014
11966
|
const data = { type: "batch", ops: this.ops, root: res.root };
|
12015
11967
|
const event = await EventBlock.create(data, this.head);
|
12016
|
-
const mblocks = new
|
11968
|
+
const mblocks = new MemoryBlockstore();
|
12017
11969
|
const blocks = new MultiBlockFetcher(mblocks, this.blocks);
|
12018
11970
|
mblocks.putSync(event.cid, event.bytes);
|
12019
11971
|
const head = await advance(blocks, this.head, event.cid);
|
@@ -12053,7 +12005,7 @@ You can use close({ resize: true }) to resize header`);
|
|
12053
12005
|
* @param {string} init.prefix
|
12054
12006
|
*/
|
12055
12007
|
static async create({ blocks, head, prefix }) {
|
12056
|
-
const mblocks = new
|
12008
|
+
const mblocks = new MemoryBlockstore();
|
12057
12009
|
blocks = new MultiBlockFetcher(mblocks, blocks);
|
12058
12010
|
if (!head.length) {
|
12059
12011
|
const base5 = await ShardBlock.create();
|