@fireproof/core 0.19.114 → 0.19.116-dev-vendor

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/{chunk-JO62JMEP.js → chunk-2D2X6HIB.js} +1 -1
  2. package/chunk-2D2X6HIB.js.map +1 -0
  3. package/{chunk-UUOLR3GZ.js → chunk-WVN66YAN.js} +2 -2
  4. package/deno.json +3 -8
  5. package/{gateway-UT5GFV5R.js → gateway-3WGEEKVQ.js} +3 -3
  6. package/index.cjs +40 -30
  7. package/index.cjs.map +1 -1
  8. package/index.d.cts +6 -6
  9. package/index.d.ts +6 -6
  10. package/index.js +40 -31
  11. package/index.js.map +1 -1
  12. package/{key-bag-file-GTGVZHHM.js → key-bag-file-CBCAWTVG.js} +3 -3
  13. package/{key-bag-indexdb-NZMTNJLK.js → key-bag-indexdb-RTSMSGM7.js} +3 -3
  14. package/metafile-cjs.json +1 -1
  15. package/metafile-esm.json +1 -1
  16. package/package.json +4 -9
  17. package/react/index.cjs.map +1 -1
  18. package/react/index.d.cts +2 -2
  19. package/react/index.d.ts +2 -2
  20. package/react/index.js.map +1 -1
  21. package/react/metafile-cjs.json +1 -1
  22. package/react/metafile-esm.json +1 -1
  23. package/tests/blockstore/fragment-gateway.test.ts +1 -1
  24. package/tests/blockstore/keyed-crypto.test.ts +2 -2
  25. package/tests/blockstore/loader.test.ts +3 -3
  26. package/tests/blockstore/store.test.ts +1 -1
  27. package/tests/blockstore/transaction.test.ts +1 -1
  28. package/tests/fireproof/config.test.ts +1 -1
  29. package/tests/fireproof/crdt.test.ts +1 -1
  30. package/tests/fireproof/indexer.test.ts +1 -1
  31. package/tests/fireproof/utils.test.ts +1 -1
  32. package/{utils-5UEZAKVP.js → utils-XESRUKDJ.js} +3 -3
  33. package/web/gateway-impl.cjs.map +1 -1
  34. package/web/gateway-impl.js.map +1 -1
  35. package/web/metafile-cjs.json +1 -1
  36. package/web/metafile-esm.json +1 -1
  37. package/chunk-JO62JMEP.js.map +0 -1
  38. package/index.global.js +0 -149
  39. package/index.global.js.map +0 -1
  40. package/metafile-iife.json +0 -1
  41. /package/{chunk-UUOLR3GZ.js.map → chunk-WVN66YAN.js.map} +0 -0
  42. /package/{gateway-UT5GFV5R.js.map → gateway-3WGEEKVQ.js.map} +0 -0
  43. /package/{key-bag-file-GTGVZHHM.js.map → key-bag-file-CBCAWTVG.js.map} +0 -0
  44. /package/{key-bag-indexdb-NZMTNJLK.js.map → key-bag-indexdb-RTSMSGM7.js.map} +0 -0
  45. /package/{utils-5UEZAKVP.js.map → utils-XESRUKDJ.js.map} +0 -0
package/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { Future, Logger, URI, Result, CoerceURI, ResolveOnce, ResolveSeq, CryptoRuntime, CTCryptoKey, EnvFactoryOpts, Env, runtimeFn } from '@adviser/cement';
2
2
  export { Logger, Result } from '@adviser/cement';
3
- import { EventLink } from '@web3-storage/pail/clock/api';
4
- import { Operation } from '@web3-storage/pail/crdt/api';
3
+ import { EventLink } from '@fireproof/vendor/@web3-storage/pail/clock/api';
4
+ import { Operation } from '@fireproof/vendor/@web3-storage/pail/crdt/api';
5
5
  import { ByteView, ArrayBufferView, Version, Block as Block$1, Link, CID, BlockView, MultihashHasher } from 'multiformats';
6
- import { MemoryBlockstore } from '@web3-storage/pail/block';
7
- import { BlockFetcher as BlockFetcher$1 } from '@web3-storage/pail/api';
8
- import { CarReader } from '@ipld/car/reader';
6
+ import { MemoryBlockstore } from '@fireproof/vendor/@web3-storage/pail/block';
7
+ import { BlockFetcher as BlockFetcher$1 } from '@fireproof/vendor/@web3-storage/pail/api';
8
+ import { CarReader } from '@fireproof/vendor/@ipld/car/reader';
9
9
  import { IDBPDatabase } from 'idb';
10
- import { EventBlock } from '@web3-storage/pail/clock';
10
+ import { EventBlock } from '@fireproof/vendor/@web3-storage/pail/clock';
11
11
  import { PathLike, MakeDirectoryOptions, Stats } from 'fs';
12
12
  import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
13
13
  import { Block as Block$2 } from 'multiformats/block';
package/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { Future, Logger, URI, Result, CoerceURI, ResolveOnce, ResolveSeq, CryptoRuntime, CTCryptoKey, EnvFactoryOpts, Env, runtimeFn } from '@adviser/cement';
2
2
  export { Logger, Result } from '@adviser/cement';
3
- import { EventLink } from '@web3-storage/pail/clock/api';
4
- import { Operation } from '@web3-storage/pail/crdt/api';
3
+ import { EventLink } from '@fireproof/vendor/@web3-storage/pail/clock/api';
4
+ import { Operation } from '@fireproof/vendor/@web3-storage/pail/crdt/api';
5
5
  import { ByteView, ArrayBufferView, Version, Block as Block$1, Link, CID, BlockView, MultihashHasher } from 'multiformats';
6
- import { MemoryBlockstore } from '@web3-storage/pail/block';
7
- import { BlockFetcher as BlockFetcher$1 } from '@web3-storage/pail/api';
8
- import { CarReader } from '@ipld/car/reader';
6
+ import { MemoryBlockstore } from '@fireproof/vendor/@web3-storage/pail/block';
7
+ import { BlockFetcher as BlockFetcher$1 } from '@fireproof/vendor/@web3-storage/pail/api';
8
+ import { CarReader } from '@fireproof/vendor/@ipld/car/reader';
9
9
  import { IDBPDatabase } from 'idb';
10
- import { EventBlock } from '@web3-storage/pail/clock';
10
+ import { EventBlock } from '@fireproof/vendor/@web3-storage/pail/clock';
11
11
  import { PathLike, MakeDirectoryOptions, Stats } from 'fs';
12
12
  import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
13
13
  import { Block as Block$2 } from 'multiformats/block';
package/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  getFileName,
6
6
  getFileSystem,
7
7
  getPath
8
- } from "./chunk-UUOLR3GZ.js";
8
+ } from "./chunk-WVN66YAN.js";
9
9
  import {
10
10
  NotFoundError,
11
11
  Result,
@@ -19,7 +19,7 @@ import {
19
19
  getName,
20
20
  getStore,
21
21
  isNotFoundError
22
- } from "./chunk-JO62JMEP.js";
22
+ } from "./chunk-2D2X6HIB.js";
23
23
  import {
24
24
  __export
25
25
  } from "./chunk-PZ5AY32C.js";
@@ -144,10 +144,10 @@ async function createUnsafe({
144
144
  // src/crdt-helpers.ts
145
145
  import { parse as parse3 } from "multiformats/link";
146
146
  import { sha256 as hasher5 } from "multiformats/hashes/sha2";
147
- import * as codec from "@ipld/dag-cbor";
148
- import { put, get, entries, root } from "@web3-storage/pail/crdt";
149
- import { EventFetcher, vis } from "@web3-storage/pail/clock";
150
- import * as Batch from "@web3-storage/pail/crdt/batch";
147
+ import * as codec from "@fireproof/vendor/@ipld/dag-cbor";
148
+ import { put, get, entries, root } from "@fireproof/vendor/@web3-storage/pail/crdt";
149
+ import { EventFetcher, vis } from "@fireproof/vendor/@web3-storage/pail/clock";
150
+ import * as Batch from "@fireproof/vendor/@web3-storage/pail/crdt/batch";
151
151
 
152
152
  // src/blockstore/index.ts
153
153
  var blockstore_exports = {};
@@ -188,7 +188,7 @@ import * as UnixFS from "@ipld/unixfs";
188
188
  import * as raw from "multiformats/codecs/raw";
189
189
  import { withMaxChunkSize } from "@ipld/unixfs/file/chunker/fixed";
190
190
  import { withWidth } from "@ipld/unixfs/file/layout/balanced";
191
- import { exporter } from "ipfs-unixfs-exporter";
191
+ import { exporter } from "@fireproof/vendor/ipfs-unixfs-exporter";
192
192
  var queuingStrategy = UnixFS.withCapacity();
193
193
  var settings = UnixFS.configure({
194
194
  fileChunkEncoder: raw,
@@ -250,7 +250,7 @@ var UnixFSFileBuilder = class {
250
250
  };
251
251
 
252
252
  // src/blockstore/store.ts
253
- import { format as format2, parse as parse2 } from "@ipld/dag-json";
253
+ import { format as format2, parse as parse2 } from "@fireproof/vendor/@ipld/dag-json";
254
254
  import { exception2Result, ResolveOnce as ResolveOnce3, Result as Result5 } from "@adviser/cement";
255
255
 
256
256
  // src/types.ts
@@ -272,12 +272,12 @@ function falsyToUndef(value) {
272
272
 
273
273
  // src/blockstore/loader.ts
274
274
  import pLimit from "p-limit";
275
- import { CarReader } from "@ipld/car/reader";
275
+ import { CarReader } from "@fireproof/vendor/@ipld/car/reader";
276
276
  import { ResolveOnce as ResolveOnce2 } from "@adviser/cement";
277
277
 
278
278
  // src/blockstore/loader-helpers.ts
279
279
  import { sha256 as hasher } from "multiformats/hashes/sha2";
280
- import * as dagCodec from "@ipld/dag-cbor";
280
+ import * as dagCodec from "@fireproof/vendor/@ipld/dag-cbor";
281
281
  async function parseCarFile(reader, logger) {
282
282
  const roots = await reader.getRoots();
283
283
  const header = await reader.get(roots[0]);
@@ -291,7 +291,7 @@ async function parseCarFile(reader, logger) {
291
291
  }
292
292
 
293
293
  // src/blockstore/transaction.ts
294
- import { MemoryBlockstore } from "@web3-storage/pail/block";
294
+ import { MemoryBlockstore } from "@fireproof/vendor/@web3-storage/pail/block";
295
295
  import { toCryptoRuntime } from "@adviser/cement";
296
296
  var CarTransaction = class extends MemoryBlockstore {
297
297
  constructor(parent, opts = { add: true, noLoader: false }) {
@@ -683,14 +683,14 @@ var keyBagProviderFactories = new Map(
683
683
  {
684
684
  protocol: "file:",
685
685
  factory: async (url, sthis) => {
686
- const { KeyBagProviderFile } = await import("./key-bag-file-GTGVZHHM.js");
686
+ const { KeyBagProviderFile } = await import("./key-bag-file-CBCAWTVG.js");
687
687
  return new KeyBagProviderFile(url, sthis);
688
688
  }
689
689
  },
690
690
  {
691
691
  protocol: "indexdb:",
692
692
  factory: async (url, sthis) => {
693
- const { KeyBagProviderIndexDB } = await import("./key-bag-indexdb-NZMTNJLK.js");
693
+ const { KeyBagProviderIndexDB } = await import("./key-bag-indexdb-RTSMSGM7.js");
694
694
  return new KeyBagProviderIndexDB(url, sthis);
695
695
  }
696
696
  }
@@ -761,9 +761,9 @@ async function getKeyBag(sthis, kbo = {}) {
761
761
  }
762
762
 
763
763
  // src/blockstore/commitor.ts
764
- import * as CBW from "@ipld/car/buffer-writer";
764
+ import * as CBW from "@fireproof/vendor/@ipld/car/buffer-writer";
765
765
  import { sha256 as hasher2 } from "multiformats/hashes/sha2";
766
- import * as dagCodec2 from "@ipld/dag-cbor";
766
+ import * as dagCodec2 from "@fireproof/vendor/@ipld/dag-cbor";
767
767
  async function encodeCarFile(roots, t, codec3) {
768
768
  let size = 0;
769
769
  const headerSize = CBW.headerLength({ roots });
@@ -868,6 +868,7 @@ import { sha256 as hasher3 } from "multiformats/hashes/sha2";
868
868
  // src/blockstore/task-manager.ts
869
869
  var TaskManager = class {
870
870
  constructor(sthis, callback) {
871
+ // we need to remove the events after some time
871
872
  this.eventsWeHandled = /* @__PURE__ */ new Set();
872
873
  this.queue = [];
873
874
  this.isProcessing = false;
@@ -888,6 +889,7 @@ var TaskManager = class {
888
889
  const filteredQueue = this.queue.filter(({ cid }) => !this.eventsWeHandled.has(cid));
889
890
  const first = filteredQueue[0];
890
891
  if (!first) {
892
+ this.isProcessing = false;
891
893
  return;
892
894
  }
893
895
  try {
@@ -1262,7 +1264,7 @@ __export(keyed_crypto_exports, {
1262
1264
  });
1263
1265
  import { base58btc as base58btc2 } from "multiformats/bases/base58";
1264
1266
  import { sha256 as hasher4 } from "multiformats/hashes/sha2";
1265
- import * as CBOR from "cborg";
1267
+ import * as CBOR from "@fireproof/vendor/cborg";
1266
1268
  var generateIV = {
1267
1269
  random: {
1268
1270
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -1429,7 +1431,7 @@ async function keyedCryptoFactory(url, kb, sthis) {
1429
1431
  // src/blockstore/fragment-gateway.ts
1430
1432
  import { Result as Result3 } from "@adviser/cement";
1431
1433
  import { base58btc as base58btc3 } from "multiformats/bases/base58";
1432
- import { encode as encode3, decode as decode3 } from "cborg";
1434
+ import { encode as encode3, decode as decode3 } from "@fireproof/vendor/cborg";
1433
1435
  function getFragSize(url) {
1434
1436
  const fragSize = url.getParam("fragSize");
1435
1437
  let ret = 0;
@@ -1581,25 +1583,32 @@ var FragmentGateway = class {
1581
1583
  };
1582
1584
 
1583
1585
  // src/blockstore/meta-key-helper.ts
1584
- import { format, parse } from "@ipld/dag-json";
1585
- import { EventBlock, decodeEventBlock } from "@web3-storage/pail/clock";
1586
+ import { format, parse } from "@fireproof/vendor/@ipld/dag-json";
1587
+ import { EventBlock, decodeEventBlock } from "@fireproof/vendor/@web3-storage/pail/clock";
1586
1588
  import { CID as CID2 } from "multiformats";
1587
1589
  import { base64pad } from "multiformats/bases/base64";
1588
1590
  import { Result as Result4 } from "@adviser/cement";
1589
1591
  async function decodeGatewayMetaBytesToDbMeta(sthis, byteHeads) {
1590
1592
  const crdtEntries = JSON.parse(sthis.txt.decode(byteHeads));
1591
- if (!crdtEntries.length) {
1592
- sthis.logger.Debug().Any("byteHeads", byteHeads).Msg("No CRDT entries found");
1593
+ if (!Array.isArray(crdtEntries)) {
1594
+ sthis.logger.Debug().Str("crdtEntries", JSON.stringify(crdtEntries)).Msg("No data in CRDT entries");
1593
1595
  return [];
1594
1596
  }
1595
- if (!crdtEntries.map) {
1596
- sthis.logger.Debug().Str("crdtEntries", JSON.stringify(crdtEntries)).Msg("No data in CRDT entries");
1597
+ if (!crdtEntries.length) {
1598
+ sthis.logger.Debug().Any("byteHeads", byteHeads).Msg("No CRDT entries found");
1597
1599
  return [];
1598
1600
  }
1601
+ const logger = ensureLogger(sthis, "decodeGatewayMetaBytesToDbMeta");
1599
1602
  return Promise.all(
1600
1603
  crdtEntries.map(async (crdtEntry) => {
1601
1604
  const eventBlock = await decodeEventBlock(base64pad.decode(crdtEntry.data));
1602
1605
  const dbMeta = parse(sthis.txt.decode(eventBlock.value.data.dbMeta));
1606
+ logger.Debug().Any("crdtEntry", {
1607
+ crdtEntry,
1608
+ eventBlock,
1609
+ dbMeta,
1610
+ dbMetaStrings: dbMeta.cars.map((car) => car.toString())
1611
+ }).Msg("CRDT entry");
1603
1612
  return {
1604
1613
  eventCid: eventBlock.cid,
1605
1614
  parents: crdtEntry.parents,
@@ -2234,11 +2243,11 @@ function toStoreRuntime(opts, sthis) {
2234
2243
  registerStoreProtocol({
2235
2244
  protocol: "file:",
2236
2245
  gateway: async (sthis) => {
2237
- const { FileGateway } = await import("./gateway-UT5GFV5R.js");
2246
+ const { FileGateway } = await import("./gateway-3WGEEKVQ.js");
2238
2247
  return new FileGateway(sthis);
2239
2248
  },
2240
2249
  test: async (sthis) => {
2241
- const { FileTestStore } = await import("./gateway-UT5GFV5R.js");
2250
+ const { FileTestStore } = await import("./gateway-3WGEEKVQ.js");
2242
2251
  return new FileTestStore(sthis);
2243
2252
  }
2244
2253
  });
@@ -2304,8 +2313,8 @@ var ConnectionBase = class {
2304
2313
  });
2305
2314
  this.loader.remoteMetaStore = remote;
2306
2315
  this.loaded = this.loader.ready().then(async () => {
2307
- remote.load().then(async () => {
2308
- (await throwFalsy(this.loader).WALStore()).process();
2316
+ return remote.load().then(async () => {
2317
+ return (await throwFalsy(this.loader).WALStore()).process();
2309
2318
  });
2310
2319
  });
2311
2320
  }
@@ -2624,7 +2633,7 @@ async function getBlock(blocks, cidString) {
2624
2633
 
2625
2634
  // src/indexer-helpers.ts
2626
2635
  import { sha256 as hasher6 } from "multiformats/hashes/sha2";
2627
- import * as codec2 from "@ipld/dag-cbor";
2636
+ import * as codec2 from "@fireproof/vendor/@ipld/dag-cbor";
2628
2637
  import charwise from "charwise";
2629
2638
  import * as DbIndex from "prolly-trees/db-index";
2630
2639
  import { bf, simpleCompare } from "prolly-trees/utils";
@@ -2950,8 +2959,8 @@ var Index = class {
2950
2959
  };
2951
2960
 
2952
2961
  // src/crdt-clock.ts
2953
- import { advance } from "@web3-storage/pail/clock";
2954
- import { root as root2 } from "@web3-storage/pail/crdt";
2962
+ import { advance } from "@fireproof/vendor/@web3-storage/pail/clock";
2963
+ import { root as root2 } from "@fireproof/vendor/@web3-storage/pail/crdt";
2955
2964
  import { ResolveOnce as ResolveOnce4 } from "@adviser/cement";
2956
2965
 
2957
2966
  // src/apply-head-queue.ts
@@ -3453,7 +3462,7 @@ var INDEXDB_VERSION = "v0.19-indexdb";
3453
3462
 
3454
3463
  // src/version.ts
3455
3464
  var PACKAGE_VERSION = Object.keys({
3456
- "0.19.114": "xxxx"
3465
+ "0.19.116-dev-vendor": "xxxx"
3457
3466
  })[0];
3458
3467
  export {
3459
3468
  CRDT,