@fireproof/core 0.19.9-dev-frag → 0.19.11-dev-dryrun

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/README.md +27 -0
  2. package/{chunk-YS4GL6OK.js → chunk-MAK4D54P.js} +20 -6
  3. package/chunk-MAK4D54P.js.map +1 -0
  4. package/{chunk-JO5AVWG7.js → chunk-XINRLWR3.js} +14 -6
  5. package/chunk-XINRLWR3.js.map +1 -0
  6. package/deno.json +20 -0
  7. package/{gateway-IZRHJWPE.js → gateway-7OM6OSYK.js} +3 -4
  8. package/gateway-7OM6OSYK.js.map +1 -0
  9. package/{gateway-YSNUK2L3.js → gateway-VWWKLHUI.js} +4 -5
  10. package/{gateway-YSNUK2L3.js.map → gateway-VWWKLHUI.js.map} +1 -1
  11. package/index.cjs +549 -372
  12. package/index.cjs.map +1 -1
  13. package/index.d.cts +75 -51
  14. package/index.d.ts +75 -51
  15. package/index.global.js +21461 -15114
  16. package/index.global.js.map +1 -1
  17. package/index.js +465 -313
  18. package/index.js.map +1 -1
  19. package/{key-bag-file-NMEBFSPM.js → key-bag-file-DFMW6ZM6.js} +3 -3
  20. package/{key-bag-indexdb-X5V6GNBZ.js → key-bag-indexdb-R2RWGSQ4.js} +3 -3
  21. package/key-bag-indexdb-R2RWGSQ4.js.map +1 -0
  22. package/{mem-filesystem-B6C6QOIP.js → mem-filesystem-BZQZLUR6.js} +3 -3
  23. package/metafile-cjs.json +1 -1
  24. package/metafile-esm.json +1 -1
  25. package/metafile-iife.json +1 -1
  26. package/{node-filesystem-5JLBSHKQ.js → node-filesystem-7YZR3POJ.js} +8 -4
  27. package/node-filesystem-7YZR3POJ.js.map +1 -0
  28. package/package.json +8 -5
  29. package/tests/blockstore/keyed-crypto.test.ts +34 -4
  30. package/tests/blockstore/store.test.ts +18 -13
  31. package/tests/fireproof/all-gateway.test.ts +395 -0
  32. package/tests/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.car +0 -0
  33. package/tests/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.js +316 -0
  34. package/tests/fireproof/convert_uint8.py +27 -0
  35. package/tests/fireproof/fireproof.test.ts +18 -18
  36. package/tests/fireproof/hello.test.ts +33 -19
  37. package/tests/helpers.ts +7 -4
  38. package/{utils-IZPK4QS7.js → utils-AISQB3PB.js} +3 -3
  39. package/chunk-JO5AVWG7.js.map +0 -1
  40. package/chunk-YS4GL6OK.js.map +0 -1
  41. package/gateway-IZRHJWPE.js.map +0 -1
  42. package/key-bag-indexdb-X5V6GNBZ.js.map +0 -1
  43. package/node-filesystem-5JLBSHKQ.js.map +0 -1
  44. /package/{key-bag-file-NMEBFSPM.js.map → key-bag-file-DFMW6ZM6.js.map} +0 -0
  45. /package/{mem-filesystem-B6C6QOIP.js.map → mem-filesystem-BZQZLUR6.js.map} +0 -0
  46. /package/{utils-IZPK4QS7.js.map → utils-AISQB3PB.js.map} +0 -0
package/index.d.ts CHANGED
@@ -1,17 +1,15 @@
1
- import * as _adviser_cement from '@adviser/cement';
2
- import { Logger, URI, Result, CoerceURI, ResolveOnce, ResolveSeq, CryptoRuntime, Future, CTCryptoKey, EnvFactoryOpts, Env } from '@adviser/cement';
1
+ import { Future, Logger, URI, Result, CoerceURI, ResolveOnce, ResolveSeq, CryptoRuntime, CTCryptoKey, EnvFactoryOpts, Env, runtimeFn } from '@adviser/cement';
3
2
  export { Logger, Result } from '@adviser/cement';
4
3
  import { EventLink } from '@web3-storage/pail/clock/api';
5
4
  import { Operation } from '@web3-storage/pail/crdt/api';
6
5
  import { ByteView, ArrayBufferView, Version, Block as Block$1, Link, CID, BlockView, MultihashHasher } from 'multiformats';
7
6
  import { MemoryBlockstore } from '@web3-storage/pail/block';
8
7
  import { BlockFetcher as BlockFetcher$1 } from '@web3-storage/pail/api';
9
- import * as _ipld_car_dist_src_reader_browser_js from '@ipld/car/dist/src/reader-browser.js';
10
- import { IDBPDatabase } from 'idb';
11
8
  import { CarReader } from '@ipld/car';
9
+ import { IDBPDatabase } from 'idb';
10
+ import { EventBlock } from '@web3-storage/pail/clock';
12
11
  import { PathLike, MakeDirectoryOptions, Stats } from 'fs';
13
12
  import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
14
- import { EventBlock } from '@web3-storage/pail/clock';
15
13
  import { Block as Block$2 } from 'multiformats/block';
16
14
 
17
15
  interface BlockEncoder<Code extends number, T> {
@@ -35,6 +33,16 @@ declare namespace codecInterface {
35
33
  export { codecInterface_ArrayBufferView as ArrayBufferView, type codecInterface_BlockCodec as BlockCodec, type codecInterface_BlockDecoder as BlockDecoder, type codecInterface_BlockEncoder as BlockEncoder, codecInterface_ByteView as ByteView };
36
34
  }
37
35
 
36
+ type QueueFunction<T = void> = () => Promise<T>;
37
+ declare class CommitQueue<T = void> {
38
+ readonly queue: QueueFunction<void>[];
39
+ processing: boolean;
40
+ readonly _waitIdleItems: Set<Future<void>>;
41
+ waitIdle(): Promise<void>;
42
+ enqueue(fn: QueueFunction<T>): Promise<T>;
43
+ processNext(): void;
44
+ }
45
+
38
46
  declare function ensureSuperThis(osthis?: Partial<SuperThisOpts>): SuperThis;
39
47
  declare function ensureSuperLog(sthis: SuperThis, componentName: string, ctx?: Record<string, unknown>): SuperThis;
40
48
  declare function ensureLogger(sthis: SuperThis, componentName: string, ctx?: Record<string, unknown>): Logger;
@@ -46,7 +54,6 @@ interface Store {
46
54
  declare function getStore(url: URI, sthis: SuperThis, joiner: Joiner): Store;
47
55
  declare function getKey(url: URI, logger: Logger): string;
48
56
  declare function getName(sthis: SuperThis, url: URI): string;
49
- declare function exception2Result<T = void>(fn: () => Promise<T>): Promise<Result<T>>;
50
57
  declare function exceptionWrapper<T, E extends Error>(fn: () => Promise<Result<T, E>>): Promise<Result<T, E>>;
51
58
  declare class NotFoundError extends Error {
52
59
  readonly code = "ENOENT";
@@ -71,7 +78,7 @@ declare class KeyBagProviderFile implements KeyBagProvider {
71
78
  }
72
79
 
73
80
  declare class KeyBagProviderIndexDB implements KeyBagProvider {
74
- readonly _db: ResolveOnce<IDBPDatabase<unknown>, void>;
81
+ readonly _db: ResolveOnce<IDBPDatabase<unknown>>;
75
82
  readonly dbName: string;
76
83
  readonly url: URI;
77
84
  readonly logger: Logger;
@@ -86,12 +93,14 @@ declare class KeyBag {
86
93
  readonly rt: KeyBagRuntime;
87
94
  readonly logger: Logger;
88
95
  constructor(rt: KeyBagRuntime);
89
- subtleKey(key: string): Promise<_adviser_cement.CTCryptoKey>;
96
+ readonly _warnOnce: ResolveOnce<void>;
97
+ subtleKey(key: string): Promise<CryptoKey>;
90
98
  ensureKeyFromUrl(url: URI, keyFactory: () => string): Promise<Result<URI>>;
91
99
  toKeyWithFingerPrint(keyStr: string): Promise<Result<KeyWithFingerPrint>>;
92
- readonly _seq: ResolveSeq<Result<KeyWithFingerPrint, Error>, void>;
100
+ readonly _seq: ResolveSeq<Result<KeyWithFingerPrint>>;
93
101
  setNamedKey(name: string, key: string): Promise<Result<KeyWithFingerPrint>>;
94
102
  _setNamedKey(name: string, key: string): Promise<Result<KeyWithFingerPrint>>;
103
+ getNamedExtractableKey(name: string, failIfNotFound?: boolean): Promise<Result<KeyWithFingerExtract>>;
95
104
  getNamedKey(name: string, failIfNotFound?: boolean): Promise<Result<KeyWithFingerPrint>>;
96
105
  }
97
106
  interface KeyItem {
@@ -146,14 +155,15 @@ declare namespace keyBag {
146
155
  export { type keyBag_KeyBackProviderFactory as KeyBackProviderFactory, keyBag_KeyBag as KeyBag, type keyBag_KeyBagFile as KeyBagFile, type keyBag_KeyBagOpts as KeyBagOpts, type keyBag_KeyBagProvider as KeyBagProvider, type keyBag_KeyBagProviderFactoryItem as KeyBagProviderFactoryItem, keyBag_KeyBagProviderFile as KeyBagProviderFile, keyBag_KeyBagProviderIndexDB as KeyBagProviderIndexDB, type keyBag_KeyBagRuntime as KeyBagRuntime, type keyBag_KeyItem as KeyItem, keyBag_getKeyBag as getKeyBag, keyBag_registerKeyBagProviderFactory as registerKeyBagProviderFactory };
147
156
  }
148
157
 
149
- type QueueFunction<T = void> = () => Promise<T>;
150
- declare class CommitQueue<T = void> {
151
- readonly queue: QueueFunction<void>[];
152
- processing: boolean;
153
- readonly _waitIdleItems: Set<Future<void>>;
154
- waitIdle(): Promise<void>;
155
- enqueue(fn: QueueFunction<T>): Promise<T>;
156
- processNext(): void;
158
+ declare class TaskManager {
159
+ private readonly eventsWeHandled;
160
+ private queue;
161
+ private isProcessing;
162
+ readonly logger: Logger;
163
+ readonly callback: (dbMeta: DbMeta) => Promise<void>;
164
+ constructor(sthis: SuperThis, callback: (dbMeta: DbMeta) => Promise<void>);
165
+ handleEvent(cid: CarClockLink, parents: string[], dbMeta: DbMeta): Promise<void>;
166
+ private processQueue;
157
167
  }
158
168
 
159
169
  declare class Loader implements Loadable {
@@ -165,7 +175,9 @@ declare class Loader implements Loadable {
165
175
  readonly seenCompacted: Set<string>;
166
176
  readonly processedCars: Set<string>;
167
177
  readonly sthis: SuperThis;
178
+ readonly taskManager?: TaskManager;
168
179
  carLog: CarLog;
180
+ remoteMetaStore?: MetaStore;
169
181
  remoteCarStore?: DataStore;
170
182
  remoteFileStore?: DataStore;
171
183
  private getBlockCache;
@@ -176,7 +188,7 @@ declare class Loader implements Loadable {
176
188
  fileStore(): Promise<DataStore>;
177
189
  WALStore(): Promise<WALStore>;
178
190
  metaStore(): Promise<MetaStore>;
179
- readonly onceReady: ResolveOnce<void, void>;
191
+ readonly onceReady: ResolveOnce<void>;
180
192
  ready(): Promise<void>;
181
193
  close(): Promise<void>;
182
194
  destroy(): Promise<void>;
@@ -195,7 +207,7 @@ declare class Loader implements Loadable {
195
207
  entries(cache?: boolean): AsyncIterableIterator<AnyBlock>;
196
208
  getBlock(cid: AnyLink): Promise<AnyBlock | Falsy>;
197
209
  loadCar(cid: AnyLink): Promise<CarReader>;
198
- makeDecoderAndCarReader(cid: AnyLink, local: DataStore, remote?: DataStore): Promise<_ipld_car_dist_src_reader_browser_js.CarReader>;
210
+ makeDecoderAndCarReader(cid: AnyLink, local: DataStore, remote?: DataStore): Promise<CarReader>;
199
211
  protected storesLoadCar(cid: AnyLink, local: DataStore, remote?: DataStore): Promise<CarReader>;
200
212
  protected getMoreReaders(cids: AnyLink[]): Promise<void>;
201
213
  }
@@ -307,10 +319,17 @@ type TransactionMeta = unknown;
307
319
  interface EncryptedBlock {
308
320
  readonly value: IvAndBytes;
309
321
  }
322
+ interface KeyMaterial {
323
+ readonly key: Uint8Array;
324
+ readonly keyStr: string;
325
+ }
310
326
  interface KeyWithFingerPrint {
311
327
  readonly fingerPrint: string;
312
328
  readonly key: CTCryptoKey;
313
329
  }
330
+ interface KeyWithFingerExtract extends KeyWithFingerPrint {
331
+ extract(): Promise<KeyMaterial>;
332
+ }
314
333
  interface CodecOpts {
315
334
  readonly ivCalc: "random" | "hash";
316
335
  readonly noIVVerify: boolean;
@@ -369,6 +388,7 @@ interface CommitOpts {
369
388
  }
370
389
  interface DbMeta {
371
390
  readonly cars: CarGroup;
391
+ key?: string;
372
392
  }
373
393
  type LoadHandler = (dbMetas: DbMeta[]) => Promise<void>;
374
394
  interface Connection {
@@ -397,9 +417,10 @@ interface MetaStore extends BaseStore {
397
417
  readonly storeType: "meta";
398
418
  load(branch?: string): Promise<DbMeta[] | Falsy>;
399
419
  save(meta: DbMeta, branch?: string): Promise<Result<void>>;
400
- }
401
- interface RemoteMetaStore extends MetaStore {
402
- handleByteHeads(byteHeads: Uint8Array[], branch?: string): Promise<DbMeta[]>;
420
+ handleByteHeads(byteHeads: Uint8Array, branch?: string): Promise<{
421
+ eventCid: CarClockLink;
422
+ dbMeta: DbMeta;
423
+ }[]>;
403
424
  }
404
425
  interface DataSaveOpts {
405
426
  readonly public: boolean;
@@ -466,14 +487,20 @@ interface Loadable {
466
487
  remoteCarStore?: DataStore;
467
488
  carStore(): Promise<DataStore>;
468
489
  carLog: CarLog;
469
- remoteMetaStore?: RemoteMetaStore;
490
+ remoteMetaStore?: MetaStore;
470
491
  remoteFileStore?: DataStore;
492
+ taskManager?: TaskManager;
471
493
  ready(): Promise<void>;
472
494
  close(): Promise<void>;
473
495
  fileStore(): Promise<DataStore>;
474
496
  WALStore(): Promise<WALStore>;
475
497
  handleDbMetasFromStore(metas: DbMeta[]): Promise<void>;
476
498
  }
499
+ type DbMetaEventBlock = EventBlock<{
500
+ dbMeta: Uint8Array;
501
+ }>;
502
+ type CarClockLink = Link<DbMetaEventBlock, number, number, Version>;
503
+ type CarClockHead = CarClockLink[];
477
504
 
478
505
  interface GatewayOpts {
479
506
  readonly gateway: Gateway;
@@ -491,6 +518,7 @@ interface Gateway {
491
518
  put(url: URI, body: Uint8Array): Promise<VoidResult>;
492
519
  get(url: URI): Promise<GetResult>;
493
520
  delete(url: URI): Promise<VoidResult>;
521
+ subscribe?(url: URI, callback: (meta: Uint8Array) => void): Promise<VoidResult>;
494
522
  }
495
523
 
496
524
  interface GatewayFactoryItem {
@@ -526,31 +554,19 @@ declare class FragmentGateway implements Gateway {
526
554
  close(url: URI): Promise<VoidResult>;
527
555
  put(url: URI, body: Uint8Array): Promise<VoidResult>;
528
556
  get(url: URI): Promise<GetResult>;
557
+ subscribe(url: URI, callback: (msg: Uint8Array) => void): Promise<VoidResult>;
529
558
  delete(url: URI): Promise<VoidResult>;
530
559
  }
531
560
 
532
- declare class TaskManager {
533
- private readonly eventsWeHandled;
534
- private readonly loader;
535
- private queue;
536
- private isProcessing;
537
- readonly logger: Logger;
538
- constructor(loader: Loadable);
539
- handleEvent(eventBlock: DbMetaEventBlock): Promise<void>;
540
- private processQueue;
541
- }
542
-
543
- type CarClockHead = Link<DbMetaEventBlock, number, number, Version>[];
544
561
  interface Connectable {
545
562
  readonly blockstore: {
546
563
  readonly loader?: Loader;
547
564
  readonly ebOpts: BlockstoreRuntime;
548
565
  };
549
566
  readonly name?: string;
567
+ readonly sthis: SuperThis;
550
568
  }
551
569
  declare abstract class ConnectionBase implements Connection {
552
- readonly eventBlocks: MemoryBlockstore;
553
- parents: CarClockHead;
554
570
  loader?: Loadable;
555
571
  taskManager?: TaskManager;
556
572
  loaded: Promise<void>;
@@ -568,15 +584,13 @@ declare abstract class ConnectionBase implements Connection {
568
584
  connectStorage_X({ loader }: {
569
585
  loader?: Loadable;
570
586
  }): Promise<void>;
571
- createEventBlock(bytes: Uint8Array): Promise<DbMetaEventBlock>;
572
- decodeEventBlock(bytes: Uint8Array): Promise<DbMetaEventBlock>;
573
587
  }
574
- type DbMetaEventBlock = EventBlock<{
575
- dbMeta: Uint8Array;
576
- }>;
577
588
 
578
589
  declare function parseCarFile<T>(reader: CarReader, logger: Logger): Promise<CarHeader<T>>;
579
590
 
591
+ declare function setCryptoKeyFromGatewayMetaPayload(uri: URI, sthis: SuperThis, data: Uint8Array): Promise<Result<DbMeta | undefined>>;
592
+ declare function addCryptoKeyToGatewayMetaPayload(uri: URI, sthis: SuperThis, body: Uint8Array): Promise<Result<Uint8Array>>;
593
+
580
594
  type index$3_AnyAnyBlock = AnyAnyBlock;
581
595
  type index$3_AnyAnyLink = AnyAnyLink;
582
596
  type index$3_AnyBlock = AnyBlock;
@@ -593,6 +607,7 @@ type index$3_BlockstoreRuntime = BlockstoreRuntime;
593
607
  type index$3_BytesWithIv = BytesWithIv;
594
608
  type index$3_CIDBlock = CIDBlock;
595
609
  type index$3_CarClockHead = CarClockHead;
610
+ type index$3_CarClockLink = CarClockLink;
596
611
  type index$3_CarGroup = CarGroup;
597
612
  type index$3_CarHeader<T> = CarHeader<T>;
598
613
  type index$3_CarLog = CarLog;
@@ -624,6 +639,8 @@ type index$3_GatewayOpts = GatewayOpts;
624
639
  type index$3_GetResult = GetResult;
625
640
  type index$3_IvAndBytes = IvAndBytes;
626
641
  type index$3_IvKeyIdData = IvKeyIdData;
642
+ type index$3_KeyMaterial = KeyMaterial;
643
+ type index$3_KeyWithFingerExtract = KeyWithFingerExtract;
627
644
  type index$3_KeyWithFingerPrint = KeyWithFingerPrint;
628
645
  type index$3_KeyedCrypto = KeyedCrypto;
629
646
  type index$3_LoadHandler = LoadHandler;
@@ -631,7 +648,6 @@ type index$3_Loadable = Loadable;
631
648
  type index$3_Loader = Loader;
632
649
  declare const index$3_Loader: typeof Loader;
633
650
  type index$3_MetaStore = MetaStore;
634
- type index$3_RemoteMetaStore = RemoteMetaStore;
635
651
  type index$3_StoreFactory = StoreFactory;
636
652
  type index$3_StoreOpts = StoreOpts;
637
653
  type index$3_StoreRuntime = StoreRuntime;
@@ -641,15 +657,17 @@ type index$3_TransactionWrapper<M extends TransactionMeta> = TransactionWrapper<
641
657
  type index$3_VoidResult = VoidResult;
642
658
  type index$3_WALState = WALState;
643
659
  type index$3_WALStore = WALStore;
660
+ declare const index$3_addCryptoKeyToGatewayMetaPayload: typeof addCryptoKeyToGatewayMetaPayload;
644
661
  declare const index$3_ensureStart: typeof ensureStart;
645
662
  declare const index$3_getGatewayFromURL: typeof getGatewayFromURL;
646
663
  declare const index$3_parseCarFile: typeof parseCarFile;
647
664
  declare const index$3_registerStoreProtocol: typeof registerStoreProtocol;
665
+ declare const index$3_setCryptoKeyFromGatewayMetaPayload: typeof setCryptoKeyFromGatewayMetaPayload;
648
666
  declare const index$3_testStoreFactory: typeof testStoreFactory;
649
667
  declare const index$3_toCIDBlock: typeof toCIDBlock;
650
668
  declare const index$3_toStoreRuntime: typeof toStoreRuntime;
651
669
  declare namespace index$3 {
652
- export { type index$3_AnyAnyBlock as AnyAnyBlock, type index$3_AnyAnyLink as AnyAnyLink, type index$3_AnyBlock as AnyBlock, type index$3_AnyDecodedBlock as AnyDecodedBlock, type index$3_AnyLink as AnyLink, type index$3_AnyLinkFn as AnyLinkFn, index$3_BaseBlockstore as BaseBlockstore, type index$3_BaseStore as BaseStore, type index$3_BlobLike as BlobLike, type index$3_BlockFetcher as BlockFetcher, type index$3_BlockstoreOpts as BlockstoreOpts, type index$3_BlockstoreRuntime as BlockstoreRuntime, type index$3_BytesWithIv as BytesWithIv, type index$3_CIDBlock as CIDBlock, type index$3_CarClockHead as CarClockHead, type index$3_CarGroup as CarGroup, type index$3_CarHeader as CarHeader, type index$3_CarLog as CarLog, type index$3_CarMakeable as CarMakeable, index$3_CarTransaction as CarTransaction, type index$3_CodecOpts as CodecOpts, type index$3_CommitOpts as CommitOpts, type index$3_CompactFetcher as CompactFetcher, type index$3_CompactFn as CompactFn, index$3_CompactionFetcher as CompactionFetcher, type index$3_Connectable as Connectable, type index$3_Connection as Connection, index$3_ConnectionBase as ConnectionBase, type index$3_DataSaveOpts as DataSaveOpts, type index$3_DataStore as DataStore, type index$3_DbMeta as DbMeta, type index$3_DbMetaEventBlock as DbMetaEventBlock, type index$3_EncryptedBlock as EncryptedBlock, index$3_EncryptedBlockstore as EncryptedBlockstore, index$3_FragmentGateway as FragmentGateway, type index$3_Gateway as Gateway, type index$3_GatewayFactoryItem as GatewayFactoryItem, type index$3_GatewayOpts as GatewayOpts, type index$3_GetResult as GetResult, type index$3_IvAndBytes as IvAndBytes, type index$3_IvKeyIdData as IvKeyIdData, type index$3_KeyWithFingerPrint as KeyWithFingerPrint, type index$3_KeyedCrypto as KeyedCrypto, type index$3_LoadHandler as LoadHandler, type index$3_Loadable as Loadable, index$3_Loader as Loader, type index$3_MetaStore as MetaStore, type index$3_RemoteMetaStore as RemoteMetaStore, type index$3_StoreFactory as StoreFactory, type index$3_StoreOpts as StoreOpts, type index$3_StoreRuntime as StoreRuntime, type index$3_TestGateway as TestGateway, type index$3_TransactionMeta as TransactionMeta, type index$3_TransactionWrapper as TransactionWrapper, type index$3_VoidResult as VoidResult, type index$3_WALState as WALState, type index$3_WALStore as WALStore, index$3_ensureStart as ensureStart, index$3_getGatewayFromURL as getGatewayFromURL, index$3_parseCarFile as parseCarFile, index$3_registerStoreProtocol as registerStoreProtocol, index$3_testStoreFactory as testStoreFactory, index$3_toCIDBlock as toCIDBlock, index$3_toStoreRuntime as toStoreRuntime };
670
+ export { type index$3_AnyAnyBlock as AnyAnyBlock, type index$3_AnyAnyLink as AnyAnyLink, type index$3_AnyBlock as AnyBlock, type index$3_AnyDecodedBlock as AnyDecodedBlock, type index$3_AnyLink as AnyLink, type index$3_AnyLinkFn as AnyLinkFn, index$3_BaseBlockstore as BaseBlockstore, type index$3_BaseStore as BaseStore, type index$3_BlobLike as BlobLike, type index$3_BlockFetcher as BlockFetcher, type index$3_BlockstoreOpts as BlockstoreOpts, type index$3_BlockstoreRuntime as BlockstoreRuntime, type index$3_BytesWithIv as BytesWithIv, type index$3_CIDBlock as CIDBlock, type index$3_CarClockHead as CarClockHead, type index$3_CarClockLink as CarClockLink, type index$3_CarGroup as CarGroup, type index$3_CarHeader as CarHeader, type index$3_CarLog as CarLog, type index$3_CarMakeable as CarMakeable, index$3_CarTransaction as CarTransaction, type index$3_CodecOpts as CodecOpts, type index$3_CommitOpts as CommitOpts, type index$3_CompactFetcher as CompactFetcher, type index$3_CompactFn as CompactFn, index$3_CompactionFetcher as CompactionFetcher, type index$3_Connectable as Connectable, type index$3_Connection as Connection, index$3_ConnectionBase as ConnectionBase, type index$3_DataSaveOpts as DataSaveOpts, type index$3_DataStore as DataStore, type index$3_DbMeta as DbMeta, type index$3_DbMetaEventBlock as DbMetaEventBlock, type index$3_EncryptedBlock as EncryptedBlock, index$3_EncryptedBlockstore as EncryptedBlockstore, index$3_FragmentGateway as FragmentGateway, type index$3_Gateway as Gateway, type index$3_GatewayFactoryItem as GatewayFactoryItem, type index$3_GatewayOpts as GatewayOpts, type index$3_GetResult as GetResult, type index$3_IvAndBytes as IvAndBytes, type index$3_IvKeyIdData as IvKeyIdData, type index$3_KeyMaterial as KeyMaterial, type index$3_KeyWithFingerExtract as KeyWithFingerExtract, type index$3_KeyWithFingerPrint as KeyWithFingerPrint, type index$3_KeyedCrypto as KeyedCrypto, type index$3_LoadHandler as LoadHandler, type index$3_Loadable as Loadable, index$3_Loader as Loader, type index$3_MetaStore as MetaStore, type index$3_StoreFactory as StoreFactory, type index$3_StoreOpts as StoreOpts, type index$3_StoreRuntime as StoreRuntime, type index$3_TestGateway as TestGateway, type index$3_TransactionMeta as TransactionMeta, type index$3_TransactionWrapper as TransactionWrapper, type index$3_VoidResult as VoidResult, type index$3_WALState as WALState, type index$3_WALStore as WALStore, index$3_addCryptoKeyToGatewayMetaPayload as addCryptoKeyToGatewayMetaPayload, index$3_ensureStart as ensureStart, index$3_getGatewayFromURL as getGatewayFromURL, index$3_parseCarFile as parseCarFile, index$3_registerStoreProtocol as registerStoreProtocol, index$3_setCryptoKeyFromGatewayMetaPayload as setCryptoKeyFromGatewayMetaPayload, index$3_testStoreFactory as testStoreFactory, index$3_toCIDBlock as toCIDBlock, index$3_toStoreRuntime as toStoreRuntime };
653
671
  }
654
672
 
655
673
  type Falsy = false | null | undefined;
@@ -836,6 +854,11 @@ interface DocResponse {
836
854
  type UpdateListenerFn<T extends DocTypes> = (docs: DocWithId<T>[]) => Promise<void> | void;
837
855
  type NoUpdateListenerFn = () => Promise<void> | void;
838
856
  type ListenerFn<T extends DocTypes> = UpdateListenerFn<T> | NoUpdateListenerFn;
857
+ interface CRDTEntry {
858
+ data: string;
859
+ parents: string[];
860
+ cid: string;
861
+ }
839
862
 
840
863
  interface WriteQueue<T extends DocTypes> {
841
864
  push(task: DocUpdate<T>): Promise<MetaType>;
@@ -921,7 +944,7 @@ declare class CRDTClock<T extends DocTypes> {
921
944
  readonly emptyWatchers: Set<() => void>;
922
945
  readonly blockstore: BaseBlockstore;
923
946
  readonly applyHeadQueue: ApplyHeadQueue<T>;
924
- readonly _ready: ResolveOnce<void, void>;
947
+ readonly _ready: ResolveOnce<void>;
925
948
  ready(): Promise<void>;
926
949
  close(): Promise<void>;
927
950
  readonly logger: Logger;
@@ -941,13 +964,13 @@ declare class CRDT<T extends DocTypes> {
941
964
  readonly opts: ConfigOpts;
942
965
  readonly blockstore: BaseBlockstore;
943
966
  readonly indexBlockstore: BaseBlockstore;
944
- readonly indexers: Map<string, Index<IndexKeyType, {}, {}>>;
967
+ readonly indexers: Map<string, Index<IndexKeyType, NonNullable<unknown>>>;
945
968
  readonly clock: CRDTClock<T>;
946
969
  readonly logger: Logger;
947
970
  readonly sthis: SuperThis;
948
971
  constructor(sthis: SuperThis, name?: string, opts?: ConfigOpts);
949
972
  bulk(updates: DocUpdate<T>[]): Promise<CRDTMeta>;
950
- readonly onceReady: ResolveOnce<void, void>;
973
+ readonly onceReady: ResolveOnce<void>;
951
974
  ready(): Promise<void>;
952
975
  close(): Promise<void>;
953
976
  destroy(): Promise<void>;
@@ -966,7 +989,7 @@ declare class CRDT<T extends DocTypes> {
966
989
  }
967
990
 
968
991
  declare class Database<DT extends DocTypes = NonNullable<unknown>> implements Connectable {
969
- static databases: Map<string, Database<{}>>;
992
+ static databases: Map<string, Database>;
970
993
  readonly name?: string;
971
994
  readonly opts: ConfigOpts;
972
995
  _listening: boolean;
@@ -977,7 +1000,7 @@ declare class Database<DT extends DocTypes = NonNullable<unknown>> implements Co
977
1000
  readonly blockstore: BaseBlockstore;
978
1001
  close(): Promise<void>;
979
1002
  destroy(): Promise<void>;
980
- readonly _ready: ResolveOnce<void, void>;
1003
+ readonly _ready: ResolveOnce<void>;
981
1004
  ready(): Promise<void>;
982
1005
  readonly logger: Logger;
983
1006
  readonly sthis: SuperThis;
@@ -1095,12 +1118,13 @@ declare const index_files: typeof files;
1095
1118
  declare const index_getFileName: typeof getFileName;
1096
1119
  declare const index_getFileSystem: typeof getFileSystem;
1097
1120
  declare const index_getPath: typeof getPath;
1121
+ declare const index_runtimeFn: typeof runtimeFn;
1098
1122
  declare const index_toArrayBuffer: typeof toArrayBuffer;
1099
1123
  declare namespace index {
1100
- export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXDB_VERSION as INDEXDB_VERSION, index_files as files, index_getFileName as getFileName, index_getFileSystem as getFileSystem, index_getPath as getPath, keyBag as kb, keyedCrypto as kc, index$1 as mf, index_toArrayBuffer as toArrayBuffer };
1124
+ export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXDB_VERSION as INDEXDB_VERSION, index_files as files, index_getFileName as getFileName, index_getFileSystem as getFileSystem, index_getPath as getPath, keyBag as kb, keyedCrypto as kc, index$1 as mf, index_runtimeFn as runtimeFn, index_toArrayBuffer as toArrayBuffer };
1101
1125
  }
1102
1126
 
1103
1127
  declare const PACKAGE_VERSION: string;
1104
1128
 
1105
- export { type AllDocsQueryOpts, type AllDocsResponse, CRDT, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, Database, type DocBase, type DocFileMeta, type DocFiles, type DocFragment, type DocLiteral, type DocObject, type DocRecord, type DocResponse, type DocSet, type DocTypes, type DocUpdate, type DocValue, type DocWithId, type Falsy, type FileTransactionMeta, type IdxMeta, type IdxMetaMap, Index, type IndexKey, type IndexKeyType, type IndexRow, type IndexRows, type IndexTransactionMeta, type IndexUpdate, type IndexUpdateString, type Joiner, type KeyLiteral, type ListenerFn, type MapFn, type MetaType, type NoUpdateListenerFn, NotFoundError, PACKAGE_VERSION, type PathOps, type QueryOpts, type Store, type StoreType, type SuperThis, type SuperThisOpts, type SysFileSystem, type TextEndeCoder, UInt8ArrayEqual, type UnknownDoc, type UpdateListenerFn, index$3 as blockstore, index$3 as bs, dataDir, ensureLogger, ensureSuperLog, ensureSuperThis, exception2Result, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$2 as index, isFalsy, isNotFoundError, index as rt, index as runtime, throwFalsy };
1129
+ export { type AllDocsQueryOpts, type AllDocsResponse, CRDT, type CRDTEntry, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, type Connectable, Database, type DocBase, type DocFileMeta, type DocFiles, type DocFragment, type DocLiteral, type DocObject, type DocRecord, type DocResponse, type DocSet, type DocTypes, type DocUpdate, type DocValue, type DocWithId, type Falsy, type FileTransactionMeta, type IdxMeta, type IdxMetaMap, Index, type IndexKey, type IndexKeyType, type IndexRow, type IndexRows, type IndexTransactionMeta, type IndexUpdate, type IndexUpdateString, type Joiner, type KeyLiteral, type ListenerFn, type MapFn, type MetaType, type NoUpdateListenerFn, NotFoundError, PACKAGE_VERSION, type PathOps, type QueryOpts, type Store, type StoreType, type SuperThis, type SuperThisOpts, type SysFileSystem, type TextEndeCoder, UInt8ArrayEqual, type UnknownDoc, type UpdateListenerFn, index$3 as blockstore, index$3 as bs, dataDir, ensureLogger, ensureSuperLog, ensureSuperThis, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$2 as index, isFalsy, isNotFoundError, index as rt, index as runtime, throwFalsy };
1106
1130
  declare module '@fireproof/core'