@fireproof/core 0.19.121 → 0.20.0-dev-preview-05

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. package/README.md +13 -12
  2. package/deno/index.d.ts +7 -0
  3. package/deno/index.js +66 -0
  4. package/deno/index.js.map +1 -0
  5. package/deno/metafile-esm.json +1 -0
  6. package/deno.json +2 -3
  7. package/index.cjs +1827 -1059
  8. package/index.cjs.map +1 -1
  9. package/index.d.cts +747 -334
  10. package/index.d.ts +747 -334
  11. package/index.js +1800 -1034
  12. package/index.js.map +1 -1
  13. package/metafile-cjs.json +1 -1
  14. package/metafile-esm.json +1 -1
  15. package/node/index.cjs +16 -293
  16. package/node/index.cjs.map +1 -1
  17. package/node/index.d.cts +4 -40
  18. package/node/index.d.ts +4 -40
  19. package/node/index.js +22 -237
  20. package/node/index.js.map +1 -1
  21. package/node/metafile-cjs.json +1 -1
  22. package/node/metafile-esm.json +1 -1
  23. package/package.json +14 -6
  24. package/react/index.cjs +22 -22
  25. package/react/index.cjs.map +1 -1
  26. package/react/index.d.cts +7 -7
  27. package/react/index.d.ts +7 -7
  28. package/react/index.js +22 -22
  29. package/react/index.js.map +1 -1
  30. package/react/metafile-cjs.json +1 -1
  31. package/react/metafile-esm.json +1 -1
  32. package/tests/blockstore/fp-envelope.test.ts-off +65 -0
  33. package/tests/blockstore/interceptor-gateway.test.ts +122 -0
  34. package/tests/blockstore/keyed-crypto-indexdb-file.test.ts +130 -0
  35. package/tests/blockstore/keyed-crypto.test.ts +73 -118
  36. package/tests/blockstore/loader.test.ts +18 -9
  37. package/tests/blockstore/store.test.ts +40 -31
  38. package/tests/blockstore/transaction.test.ts +14 -13
  39. package/tests/fireproof/all-gateway.test.ts +286 -216
  40. package/tests/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.ts +324 -316
  41. package/tests/fireproof/crdt.test.ts +78 -19
  42. package/tests/fireproof/fireproof.test.ts +111 -92
  43. package/tests/fireproof/hello.test.ts +21 -17
  44. package/tests/fireproof/indexer.test.ts +74 -50
  45. package/tests/fireproof/{database.test.ts → ledger.test.ts} +241 -45
  46. package/tests/fireproof/multiple-ledger.test.ts +2 -2
  47. package/tests/fireproof/utils.test.ts +47 -6
  48. package/tests/gateway/file/loader-config.test.ts +307 -0
  49. package/tests/gateway/fp-envelope-serialize.test.ts +256 -0
  50. package/tests/gateway/indexdb/loader-config.test.ts +79 -0
  51. package/tests/helpers.ts +44 -17
  52. package/tests/react/useFireproof.test.tsx +2 -2
  53. package/tests/www/gallery.html +2 -2
  54. package/tests/www/todo-aws.html +1 -1
  55. package/tests/www/todo-ipfs.html +1 -1
  56. package/tests/www/todo-local.html +1 -1
  57. package/tests/www/todo.html +25 -4
  58. package/web/index.cjs +102 -116
  59. package/web/index.cjs.map +1 -1
  60. package/web/index.d.cts +15 -29
  61. package/web/index.d.ts +15 -29
  62. package/web/index.js +91 -105
  63. package/web/index.js.map +1 -1
  64. package/web/metafile-cjs.json +1 -1
  65. package/web/metafile-esm.json +1 -1
  66. package/node/chunk-4A4RAVNS.js +0 -17
  67. package/node/chunk-4A4RAVNS.js.map +0 -1
  68. package/node/mem-filesystem-LPPT7QV5.js +0 -40
  69. package/node/mem-filesystem-LPPT7QV5.js.map +0 -1
  70. package/tests/fireproof/config.test.ts +0 -163
  71. /package/tests/blockstore/{fragment-gateway.test.ts → fragment-gateway.test.ts-off} +0 -0
package/index.d.ts CHANGED
@@ -1,15 +1,14 @@
1
- import { Future, Logger, ResolveOnce, URI, Result, ResolveSeq, CoerceURI, CryptoRuntime, CTCryptoKey, EnvFactoryOpts, Env, runtimeFn } from '@adviser/cement';
2
- export { Logger, Result } from '@adviser/cement';
1
+ import { Logger, Future, ResolveOnce, URI, Result, ResolveSeq, CoerceURI, CryptoRuntime, CTCryptoKey, EnvFactoryOpts, Env, runtimeFn } from '@adviser/cement';
3
2
  import { EventLink } from '@fireproof/vendor/@web3-storage/pail/clock/api';
4
3
  import { Operation } from '@fireproof/vendor/@web3-storage/pail/crdt/api';
5
- import { ByteView, ArrayBufferView, Version, Block as Block$1, Link, CID, BlockView, MultihashHasher } from 'multiformats';
4
+ import { ByteView, ArrayBufferView, Version, Block as Block$1, CID, Link, BlockView, MultihashHasher } from 'multiformats';
6
5
  import { MemoryBlockstore } from '@fireproof/vendor/@web3-storage/pail/block';
7
6
  import { BlockFetcher as BlockFetcher$1 } from '@fireproof/vendor/@web3-storage/pail/api';
8
- import { CarReader } from '@fireproof/vendor/@ipld/car/reader';
9
7
  import { EventBlock } from '@fireproof/vendor/@web3-storage/pail/clock';
10
- import { PathLike, MakeDirectoryOptions, Stats } from 'fs';
8
+ import { CarReader } from '@fireproof/vendor/@ipld/car';
11
9
  import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
12
10
  import { SuperThis as SuperThis$1 } from '@fireproof/core';
11
+ import { CarReader as CarReader$1 } from '@fireproof/vendor/@ipld/car/reader';
13
12
  import { Block as Block$2 } from 'multiformats/block';
14
13
 
15
14
  interface BlockEncoder<Code extends number, T> {
@@ -33,6 +32,63 @@ declare namespace codecInterface {
33
32
  export { codecInterface_ArrayBufferView as ArrayBufferView, type codecInterface_BlockCodec as BlockCodec, type codecInterface_BlockDecoder as BlockDecoder, type codecInterface_BlockEncoder as BlockEncoder, codecInterface_ByteView as ByteView };
34
33
  }
35
34
 
35
+ type BlockFetcher = BlockFetcher$1;
36
+ interface CarTransactionOpts {
37
+ readonly add: boolean;
38
+ readonly noLoader: boolean;
39
+ }
40
+ interface CarTransactionOpts {
41
+ readonly add: boolean;
42
+ readonly noLoader: boolean;
43
+ }
44
+ declare class CarTransaction extends MemoryBlockstore implements CarMakeable {
45
+ readonly parent: BaseBlockstore;
46
+ constructor(parent: BaseBlockstore, opts?: CarTransactionOpts);
47
+ get<T, C extends number, A extends number, V extends Version>(cid: AnyLink): Promise<Block$1<T, C, A, V> | undefined>;
48
+ superGet(cid: AnyLink): Promise<AnyBlock | undefined>;
49
+ }
50
+ declare class BaseBlockstore implements BlockFetcher {
51
+ readonly transactions: Set<CarTransaction>;
52
+ readonly ebOpts: BlockstoreRuntime;
53
+ readonly sthis: SuperThis;
54
+ readonly loader: Loadable;
55
+ ready(): Promise<void>;
56
+ close(): Promise<void>;
57
+ destroy(): Promise<void>;
58
+ compact(): Promise<void>;
59
+ readonly logger: Logger;
60
+ constructor(ebOpts: BlockstoreOpts);
61
+ get<T, C extends number, A extends number, V extends Version>(cid: AnyAnyLink): Promise<Block$1<T, C, A, V> | undefined>;
62
+ put(cid: AnyAnyLink, block: Uint8Array): Promise<void>;
63
+ lastTxMeta?: unknown;
64
+ transaction<M extends TransactionMeta>(fn: (t: CarTransaction) => Promise<M>, _opts?: CarTransactionOpts): Promise<TransactionWrapper<M>>;
65
+ openTransaction(opts?: CarTransactionOpts): CarTransaction;
66
+ commitTransaction<M extends TransactionMeta>(t: CarTransaction, done: M, opts: CarTransactionOpts): Promise<TransactionWrapper<M>>;
67
+ entries(): AsyncIterableIterator<AnyBlock>;
68
+ }
69
+ declare class EncryptedBlockstore extends BaseBlockstore {
70
+ ready(): Promise<void>;
71
+ close(): Promise<void>;
72
+ destroy(): Promise<void>;
73
+ compacting: boolean;
74
+ readonly logger: Logger;
75
+ constructor(sthis: SuperThis, ebOpts: BlockstoreOpts);
76
+ get<T, C extends number, A extends number, V extends Version>(cid: AnyAnyLink): Promise<Block$1<T, C, A, V> | undefined>;
77
+ transaction<M extends TransactionMeta>(fn: (t: CarTransaction) => Promise<M>, opts?: {
78
+ noLoader: boolean;
79
+ }): Promise<TransactionWrapper<M>>;
80
+ getFile(car: AnyLink, cid: AnyLink): Promise<Uint8Array>;
81
+ compact(): Promise<void>;
82
+ defaultCompact(blocks: CompactionFetcher, logger: Logger): Promise<TransactionMeta>;
83
+ entries(): AsyncIterableIterator<AnyBlock>;
84
+ }
85
+ declare class CompactionFetcher implements BlockFetcher {
86
+ readonly blockstore: EncryptedBlockstore;
87
+ readonly loggedBlocks: CarTransaction;
88
+ constructor(blocks: EncryptedBlockstore);
89
+ get<T, C extends number, A extends number, V extends Version>(cid: AnyLink): Promise<Block$1<T, C, A, V> | undefined>;
90
+ }
91
+
36
92
  type QueueFunction<T = void> = () => Promise<T>;
37
93
  declare class CommitQueue<T = void> {
38
94
  readonly queue: QueueFunction<void>[];
@@ -89,6 +145,7 @@ interface KeyBagProviderFactoryItem {
89
145
  }
90
146
  declare function registerKeyBagProviderFactory(item: KeyBagProviderFactoryItem): void;
91
147
  declare function defaultKeyBagUrl(sthis: SuperThis): URI;
148
+ declare function defaultKeyBagOpts(sthis: SuperThis, kbo?: Partial<KeyBagOpts>): KeyBagRuntime;
92
149
  declare function getKeyBag(sthis: SuperThis, kbo?: Partial<KeyBagOpts>): Promise<KeyBag>;
93
150
 
94
151
  type keyBag_KeyBackProviderFactory = KeyBackProviderFactory;
@@ -100,11 +157,12 @@ type keyBag_KeyBagProvider = KeyBagProvider;
100
157
  type keyBag_KeyBagProviderFactoryItem = KeyBagProviderFactoryItem;
101
158
  type keyBag_KeyBagRuntime = KeyBagRuntime;
102
159
  type keyBag_KeyItem = KeyItem;
160
+ declare const keyBag_defaultKeyBagOpts: typeof defaultKeyBagOpts;
103
161
  declare const keyBag_defaultKeyBagUrl: typeof defaultKeyBagUrl;
104
162
  declare const keyBag_getKeyBag: typeof getKeyBag;
105
163
  declare const keyBag_registerKeyBagProviderFactory: typeof registerKeyBagProviderFactory;
106
164
  declare namespace keyBag {
107
- 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, type keyBag_KeyBagRuntime as KeyBagRuntime, type keyBag_KeyItem as KeyItem, keyBag_defaultKeyBagUrl as defaultKeyBagUrl, keyBag_getKeyBag as getKeyBag, keyBag_registerKeyBagProviderFactory as registerKeyBagProviderFactory };
165
+ 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, type keyBag_KeyBagRuntime as KeyBagRuntime, type keyBag_KeyItem as KeyItem, keyBag_defaultKeyBagOpts as defaultKeyBagOpts, keyBag_defaultKeyBagUrl as defaultKeyBagUrl, keyBag_getKeyBag as getKeyBag, keyBag_registerKeyBagProviderFactory as registerKeyBagProviderFactory };
108
166
  }
109
167
 
110
168
  declare class TaskManager {
@@ -114,112 +172,10 @@ declare class TaskManager {
114
172
  readonly logger: Logger;
115
173
  readonly callback: (dbMeta: DbMeta) => Promise<void>;
116
174
  constructor(sthis: SuperThis, callback: (dbMeta: DbMeta) => Promise<void>);
117
- handleEvent(cid: CarClockLink, parents: string[], dbMeta: DbMeta): Promise<void>;
175
+ handleEvent(cid: CarClockLink, parents: CarClockHead, dbMeta: DbMeta): Promise<void>;
118
176
  private processQueue;
119
177
  }
120
178
 
121
- declare class Loader implements Loadable {
122
- readonly name: string;
123
- readonly ebOpts: BlockstoreRuntime;
124
- readonly commitQueue: CommitQueue<CarGroup>;
125
- readonly isCompacting = false;
126
- readonly carReaders: Map<string, Promise<CarReader>>;
127
- readonly seenCompacted: Set<string>;
128
- readonly processedCars: Set<string>;
129
- readonly sthis: SuperThis;
130
- readonly taskManager?: TaskManager;
131
- carLog: CarLog;
132
- remoteMetaStore?: MetaStore;
133
- remoteCarStore?: DataStore;
134
- remoteFileStore?: DataStore;
135
- private getBlockCache;
136
- private seenMeta;
137
- private writeLimit;
138
- keyBag(): Promise<KeyBag>;
139
- carStore(): Promise<DataStore>;
140
- fileStore(): Promise<DataStore>;
141
- WALStore(): Promise<WALStore>;
142
- metaStore(): Promise<MetaStore>;
143
- readonly onceReady: ResolveOnce<void>;
144
- ready(): Promise<void>;
145
- close(): Promise<void>;
146
- destroy(): Promise<void>;
147
- readonly logger: Logger;
148
- constructor(name: string, ebOpts: BlockstoreOpts, sthis: SuperThis);
149
- handleDbMetasFromStore(metas: DbMeta[]): Promise<void>;
150
- mergeDbMetaIntoClock(meta: DbMeta): Promise<void>;
151
- loadCarHeaderFromMeta<T>({ cars: cids }: DbMeta): Promise<CarHeader<T>>;
152
- commitFiles(t: CarTransaction, done: TransactionMeta): Promise<CarGroup>;
153
- loadFileCar(cid: AnyLink): Promise<CarReader>;
154
- commit<T = TransactionMeta>(t: CarTransaction, done: T, opts?: CommitOpts): Promise<CarGroup>;
155
- updateCarLog<T>(cids: CarGroup, fp: CarHeader<T>, compact: boolean): Promise<void>;
156
- cacheTransaction(t: CarTransaction): Promise<void>;
157
- cacheCarReader(carCidStr: string, reader: CarReader): Promise<void>;
158
- removeCidsForCompact(cid: AnyLink): Promise<void>;
159
- entries(cache?: boolean): AsyncIterableIterator<AnyBlock>;
160
- getBlock(cid: AnyLink): Promise<AnyBlock | Falsy>;
161
- loadCar(cid: AnyLink): Promise<CarReader>;
162
- makeDecoderAndCarReader(cid: AnyLink, local: DataStore, remote?: DataStore): Promise<CarReader>;
163
- protected storesLoadCar(cid: AnyLink, local: DataStore, remote?: DataStore): Promise<CarReader>;
164
- protected getMoreReaders(cids: AnyLink[]): Promise<void>;
165
- }
166
-
167
- type BlockFetcher = BlockFetcher$1;
168
- interface CarTransactionOpts {
169
- readonly add: boolean;
170
- readonly noLoader: boolean;
171
- }
172
- declare class CarTransaction extends MemoryBlockstore implements CarMakeable {
173
- readonly parent: BaseBlockstore;
174
- constructor(parent: BaseBlockstore, opts?: CarTransactionOpts);
175
- get<T, C extends number, A extends number, V extends Version>(cid: AnyLink): Promise<Block$1<T, C, A, V> | undefined>;
176
- superGet(cid: AnyLink): Promise<AnyBlock | undefined>;
177
- }
178
- declare class BaseBlockstore implements BlockFetcher {
179
- readonly transactions: Set<CarTransaction>;
180
- readonly ebOpts: BlockstoreRuntime;
181
- readonly sthis: SuperThis;
182
- readonly loader?: Loader;
183
- readonly name?: string;
184
- ready(): Promise<void>;
185
- close(): Promise<void>;
186
- destroy(): Promise<void>;
187
- compact(): Promise<void>;
188
- readonly logger: Logger;
189
- constructor(ebOpts?: BlockstoreOpts);
190
- get<T, C extends number, A extends number, V extends Version>(cid: AnyAnyLink): Promise<Block$1<T, C, A, V> | undefined>;
191
- put(cid: AnyAnyLink, block: Uint8Array): Promise<void>;
192
- lastTxMeta?: unknown;
193
- transaction<M extends TransactionMeta>(fn: (t: CarTransaction) => Promise<M>, _opts?: CarTransactionOpts): Promise<TransactionWrapper<M>>;
194
- openTransaction(opts?: CarTransactionOpts): CarTransaction;
195
- commitTransaction<M extends TransactionMeta>(t: CarTransaction, done: M, opts: CarTransactionOpts): Promise<TransactionWrapper<M>>;
196
- entries(): AsyncIterableIterator<AnyBlock>;
197
- }
198
- declare class EncryptedBlockstore extends BaseBlockstore {
199
- readonly name: string;
200
- readonly loader: Loader;
201
- ready(): Promise<void>;
202
- close(): Promise<void>;
203
- destroy(): Promise<void>;
204
- compacting: boolean;
205
- readonly logger: Logger;
206
- constructor(sthis: SuperThis, ebOpts: BlockstoreOpts);
207
- get<T, C extends number, A extends number, V extends Version>(cid: AnyAnyLink): Promise<Block$1<T, C, A, V> | undefined>;
208
- transaction<M extends TransactionMeta>(fn: (t: CarTransaction) => Promise<M>, opts?: {
209
- noLoader: boolean;
210
- }): Promise<TransactionWrapper<M>>;
211
- getFile(car: AnyLink, cid: AnyLink): Promise<Uint8Array>;
212
- compact(): Promise<void>;
213
- defaultCompact(blocks: CompactionFetcher, logger: Logger): Promise<TransactionMeta>;
214
- entries(): AsyncIterableIterator<AnyBlock>;
215
- }
216
- declare class CompactionFetcher implements BlockFetcher {
217
- readonly blockstore: EncryptedBlockstore;
218
- readonly loggedBlocks: CarTransaction;
219
- constructor(blocks: EncryptedBlockstore);
220
- get<T, C extends number, A extends number, V extends Version>(cid: AnyLink): Promise<Block$1<T, C, A, V> | undefined>;
221
- }
222
-
223
179
  declare function onSuperThis(fn: (sthis: SuperThis) => void): () => void;
224
180
  declare function ensureSuperThis(osthis?: Partial<SuperThisOpts>): SuperThis;
225
181
  declare function ensureSuperLog(sthis: SuperThis, componentName: string, ctx?: Record<string, unknown>): SuperThis;
@@ -237,8 +193,107 @@ declare class NotFoundError extends Error {
237
193
  readonly code = "ENOENT";
238
194
  }
239
195
  declare function isNotFoundError(e: Error | Result<unknown> | unknown): e is NotFoundError;
240
- declare function dataDir(sthis: SuperThis, name?: string, base?: CoerceURI): URI;
241
196
  declare function UInt8ArrayEqual(a: Uint8Array, b: Uint8Array): boolean;
197
+ declare function inplaceFilter<T>(i: T[], pred: (i: T, idx: number) => boolean): T[];
198
+ declare function toSortedArray(set?: Record<string, unknown>): Record<string, unknown>[];
199
+ declare function coerceIntoUint8(raw: ToUInt8): Result<Uint8Array>;
200
+ declare function coercePromiseIntoUint8(raw: PromiseToUInt8): Promise<Result<Uint8Array>>;
201
+
202
+ declare enum FPEnvelopeType {
203
+ CAR = "car",
204
+ FILE = "file",
205
+ META = "meta",
206
+ WAL = "wal"
207
+ }
208
+ interface FPEnvelope<T> {
209
+ readonly type: FPEnvelopeType;
210
+ readonly payload: T;
211
+ }
212
+ interface FPEnvelopeCar extends FPEnvelope<Uint8Array> {
213
+ readonly type: FPEnvelopeType.CAR;
214
+ }
215
+ interface FPEnvelopeFile extends FPEnvelope<Uint8Array> {
216
+ readonly type: FPEnvelopeType.FILE;
217
+ }
218
+ interface FPEnvelopeMeta extends FPEnvelope<DbMetaEvent[]> {
219
+ readonly type: FPEnvelopeType.META;
220
+ }
221
+ interface FPWALCarsOps {
222
+ readonly cars: CID[];
223
+ }
224
+ interface FPEnvelopeWAL extends FPEnvelope<WALState> {
225
+ readonly type: FPEnvelopeType.WAL;
226
+ }
227
+ declare function Car2FPMsg(fpcar: Uint8Array): Result<FPEnvelopeCar>;
228
+ declare function File2FPMsg(fpfile: Uint8Array): Result<FPEnvelopeFile>;
229
+
230
+ interface SerdeGatewayOpts {
231
+ readonly gateway: SerdeGateway;
232
+ }
233
+ type SerdeGetResult<S> = Result<FPEnvelope<S>, NotFoundError | Error>;
234
+ type VoidResult = Result<void>;
235
+ type UnsubscribeResult = Result<() => void>;
236
+ interface SerdeGateway {
237
+ buildUrl(sthis: SuperThis, baseUrl: URI, key: string, loader?: Loadable): Promise<Result<URI>>;
238
+ start(sthis: SuperThis, baseUrl: URI, loader?: Loadable): Promise<Result<URI>>;
239
+ close(sthis: SuperThis, baseUrl: URI, loader?: Loadable): Promise<VoidResult>;
240
+ put<T>(sthis: SuperThis, url: URI, body: FPEnvelope<T>, loader?: Loadable): Promise<VoidResult>;
241
+ get<S>(sthis: SuperThis, url: URI, loader?: Loadable): Promise<SerdeGetResult<S>>;
242
+ delete(sthis: SuperThis, url: URI, loader?: Loadable): Promise<VoidResult>;
243
+ subscribe?(sthis: SuperThis, url: URI, callback: (meta: FPEnvelopeMeta) => Promise<void>, loader?: Loadable): Promise<UnsubscribeResult>;
244
+ getPlain(sthis: SuperThis, url: URI, key: string, loader?: Loadable): Promise<Result<Uint8Array>>;
245
+ destroy(sthis: SuperThis, baseUrl: URI, loader?: Loadable): Promise<VoidResult>;
246
+ }
247
+ interface SerdeGatewayReturn<O, T> {
248
+ readonly op: O;
249
+ readonly value?: T;
250
+ readonly stop?: boolean;
251
+ }
252
+ interface SerdeGatewayBuildUrlOp {
253
+ readonly url: URI;
254
+ readonly key: string;
255
+ }
256
+ type SerdeGatewayBuildUrlReturn = SerdeGatewayReturn<SerdeGatewayBuildUrlOp, Result<URI>>;
257
+ interface SerdeGatewayStartOp {
258
+ readonly url: URI;
259
+ }
260
+ type SerdeGatewayStartReturn = SerdeGatewayReturn<SerdeGatewayStartOp, Result<URI>>;
261
+ interface SerdeGatewayCloseOp {
262
+ readonly url: URI;
263
+ }
264
+ type SerdeGatewayCloseReturn = SerdeGatewayReturn<SerdeGatewayCloseOp, VoidResult>;
265
+ interface SerdeGatewayDestroyOp {
266
+ readonly url: URI;
267
+ }
268
+ type SerdeGatewayDestroyReturn = SerdeGatewayReturn<SerdeGatewayDestroyOp, VoidResult>;
269
+ interface SerdeGatewayPutOp<T> {
270
+ readonly url: URI;
271
+ readonly body: FPEnvelope<T>;
272
+ }
273
+ type SerdeGatewayPutReturn<T> = SerdeGatewayReturn<SerdeGatewayPutOp<T>, VoidResult>;
274
+ interface SerdeGatewayGetOp {
275
+ readonly url: URI;
276
+ }
277
+ type SerdeGatewayGetReturn<S> = SerdeGatewayReturn<SerdeGatewayGetOp, SerdeGetResult<S>>;
278
+ interface SerdeGatewayDeleteOp {
279
+ readonly url: URI;
280
+ }
281
+ type SerdeGatewayDeleteReturn = SerdeGatewayReturn<SerdeGatewayDeleteOp, VoidResult>;
282
+ interface SerdeGatewaySubscribeOp {
283
+ readonly url: URI;
284
+ readonly callback: (meta: FPEnvelopeMeta) => Promise<void>;
285
+ }
286
+ type SerdeGatewaySubscribeReturn = SerdeGatewayReturn<SerdeGatewaySubscribeOp, UnsubscribeResult>;
287
+ interface SerdeGatewayInterceptor {
288
+ buildUrl(sthis: SuperThis, baseUrl: URI, key: string, loader: Loadable): Promise<Result<SerdeGatewayBuildUrlReturn>>;
289
+ start(sthis: SuperThis, baseUrl: URI, loader: Loadable): Promise<Result<SerdeGatewayStartReturn>>;
290
+ close(sthis: SuperThis, baseUrl: URI, loader: Loadable): Promise<Result<SerdeGatewayCloseReturn>>;
291
+ delete(sthis: SuperThis, baseUrl: URI, loader: Loadable): Promise<Result<SerdeGatewayDeleteReturn>>;
292
+ destroy(sthis: SuperThis, baseUrl: URI, loader: Loadable): Promise<Result<SerdeGatewayDestroyReturn>>;
293
+ put<T>(sthis: SuperThis, url: URI, body: FPEnvelope<T>, loader: Loadable): Promise<Result<SerdeGatewayPutReturn<T>>>;
294
+ get<S>(sthis: SuperThis, url: URI, loader: Loadable): Promise<Result<SerdeGatewayGetReturn<S>>>;
295
+ subscribe(sthis: SuperThis, url: URI, callback: (meta: FPEnvelopeMeta) => Promise<void>, loader: Loadable): Promise<Result<SerdeGatewaySubscribeReturn>>;
296
+ }
242
297
 
243
298
  type AnyLink = Link<unknown, number, number, Version>;
244
299
  type CarGroup = AnyLink[];
@@ -337,20 +392,43 @@ interface StoreFactory {
337
392
  }>;
338
393
  decodeFile?: (blocks: unknown, cid: AnyLink, meta: DocFileMeta) => Promise<File>;
339
394
  }
340
- interface StoreOpts extends StoreFactory {
341
- readonly isIndex?: string;
342
- readonly stores?: {
343
- readonly base?: CoerceURI;
344
- readonly meta?: CoerceURI;
345
- readonly data?: CoerceURI;
346
- readonly index?: CoerceURI;
347
- readonly wal?: CoerceURI;
348
- };
395
+ interface StoreUrls {
396
+ readonly meta: CoerceURI;
397
+ readonly data: CoerceURI;
398
+ readonly wal: CoerceURI;
399
+ }
400
+ interface StoreEnDeFile {
401
+ readonly encodeFile: (blob: BlobLike) => Promise<{
402
+ cid: AnyLink;
403
+ blocks: AnyBlock[];
404
+ }>;
405
+ readonly decodeFile: (blocks: unknown, cid: AnyLink, meta: DocFileMeta) => Promise<File>;
406
+ }
407
+ interface StoreUrlsOpts {
408
+ readonly base?: CoerceURI;
409
+ readonly data?: Partial<StoreUrls>;
410
+ readonly idx?: Partial<StoreUrls>;
411
+ }
412
+ interface StoreURIs {
413
+ readonly meta: URI;
414
+ readonly data: URI;
415
+ readonly file: URI;
416
+ readonly wal: URI;
417
+ }
418
+ interface StoreURIRuntime {
419
+ readonly data: StoreURIs;
420
+ readonly idx: StoreURIs;
421
+ }
422
+ interface StoreFactoryItem {
423
+ readonly sthis: SuperThis;
424
+ readonly url: URI;
425
+ readonly gatewayInterceptor?: SerdeGatewayInterceptor;
426
+ readonly loader: Loadable;
349
427
  }
350
428
  interface StoreRuntime {
351
- makeMetaStore(loader: Loadable): Promise<MetaStore>;
352
- makeDataStore(loader: Loadable): Promise<DataStore>;
353
- makeWALStore(loader: Loadable): Promise<WALStore>;
429
+ makeMetaStore(sfi: StoreFactoryItem): Promise<MetaStore>;
430
+ makeDataStore(sfi: StoreFactoryItem): Promise<DataStore>;
431
+ makeWALStore(sfi: StoreFactoryItem): Promise<WALStore>;
354
432
  encodeFile(blob: BlobLike): Promise<{
355
433
  cid: AnyLink;
356
434
  blocks: AnyBlock[];
@@ -363,24 +441,22 @@ interface CommitOpts {
363
441
  }
364
442
  interface DbMeta {
365
443
  readonly cars: CarGroup;
366
- key?: string;
367
444
  }
368
445
  type LoadHandler = (dbMetas: DbMeta[]) => Promise<void>;
446
+ interface RefLoadable {
447
+ readonly loader: Loadable;
448
+ }
449
+ interface RefBlockstore {
450
+ readonly blockstore: RefLoadable;
451
+ }
369
452
  interface Connection {
370
- readonly loader?: Loadable;
371
453
  readonly loaded: Promise<void>;
372
- dashboardUrl?: URI;
373
- connectMeta_X({ loader }: {
374
- loader?: Loadable;
375
- }): void;
376
- connectStorage_X({ loader }: {
377
- loader?: Loadable;
378
- }): void;
454
+ connectStorage(ref: RefLoadable | RefBlockstore): void;
379
455
  }
380
456
  interface BaseStore {
381
457
  readonly storeType: StoreType;
458
+ readonly realGateway: SerdeGateway;
382
459
  url(): URI;
383
- readonly name: string;
384
460
  onStarted(fn: () => void): void;
385
461
  onClosed(fn: () => void): void;
386
462
  keyedCrypto(): Promise<KeyedCrypto>;
@@ -389,14 +465,17 @@ interface BaseStore {
389
465
  readonly ready?: () => Promise<void>;
390
466
  start(): Promise<Result<URI>>;
391
467
  }
468
+ interface DbMetaEvent {
469
+ readonly eventCid: CarClockLink;
470
+ readonly parents: CarClockHead;
471
+ readonly dbMeta: DbMeta;
472
+ }
473
+ declare function DbMetaEventEqual(a: DbMetaEvent, b: DbMetaEvent): boolean;
474
+ declare function DbMetaEventsEqual(a: DbMetaEvent[], b: DbMetaEvent[]): boolean;
392
475
  interface MetaStore extends BaseStore {
393
476
  readonly storeType: "meta";
394
477
  load(branch?: string): Promise<DbMeta[] | Falsy>;
395
478
  save(meta: DbMeta, branch?: string): Promise<Result<void>>;
396
- handleByteHeads(byteHeads: Uint8Array, branch?: string): Promise<{
397
- eventCid: CarClockLink;
398
- dbMeta: DbMeta;
399
- }[]>;
400
479
  }
401
480
  interface DataSaveOpts {
402
481
  readonly public: boolean;
@@ -408,9 +487,9 @@ interface DataStore extends BaseStore {
408
487
  remove(cid: AnyLink): Promise<Result<void>>;
409
488
  }
410
489
  interface WALState {
411
- operations: DbMeta[];
412
- noLoaderOps: DbMeta[];
413
- fileOperations: {
490
+ readonly operations: DbMeta[];
491
+ readonly noLoaderOps: DbMeta[];
492
+ readonly fileOperations: {
414
493
  readonly cid: AnyLink;
415
494
  readonly public: boolean;
416
495
  }[];
@@ -430,253 +509,402 @@ type CompactFetcher = BlockFetcher & {
430
509
  readonly loggedBlocks: CarTransaction;
431
510
  };
432
511
  type CompactFn = (blocks: CompactFetcher) => Promise<TransactionMeta>;
433
- type BlockstoreOpts = Partial<{
512
+ interface StoreRuntimeUrls {
513
+ readonly meta: URI;
514
+ readonly data: URI;
515
+ readonly wal: URI;
516
+ }
517
+ interface BlockstoreParams {
434
518
  readonly logger: Logger;
435
519
  readonly applyMeta: (meta: TransactionMeta, snap?: boolean) => Promise<void>;
436
520
  readonly compact: CompactFn;
437
521
  readonly autoCompact: number;
438
522
  readonly crypto: CryptoRuntime;
439
- readonly store: StoreOpts;
440
- readonly keyBag: KeyBagOpts;
441
523
  readonly public: boolean;
442
524
  readonly meta: DbMeta;
443
- readonly name: string;
444
525
  readonly threshold: number;
445
- }>;
526
+ readonly gatewayInterceptor?: SerdeGatewayInterceptor;
527
+ readonly storeEnDeFile: Partial<StoreEnDeFile>;
528
+ readonly keyBag: KeyBagRuntime;
529
+ readonly storeUrls: StoreURIs;
530
+ readonly storeRuntime: StoreRuntime;
531
+ }
532
+ type BlockstoreOpts = Partial<BlockstoreParams> & {
533
+ readonly keyBag: KeyBagRuntime;
534
+ readonly storeUrls: StoreURIs;
535
+ readonly storeRuntime: StoreRuntime;
536
+ };
446
537
  interface BlockstoreRuntime {
447
538
  readonly logger: Logger;
448
539
  readonly applyMeta: (meta: TransactionMeta, snap?: boolean) => Promise<void>;
449
540
  readonly compact: CompactFn;
450
541
  readonly autoCompact: number;
451
542
  readonly crypto: CryptoRuntime;
452
- readonly store: StoreOpts;
453
543
  readonly storeRuntime: StoreRuntime;
454
- readonly keyBag: Partial<KeyBagOpts>;
544
+ readonly keyBag: KeyBagRuntime;
545
+ readonly storeUrls: StoreURIs;
546
+ readonly gatewayInterceptor?: SerdeGatewayInterceptor;
455
547
  readonly meta?: DbMeta;
456
- readonly name?: string;
457
548
  readonly threshold: number;
458
549
  }
459
550
  interface Loadable {
460
- readonly name: string;
461
551
  readonly sthis: SuperThis;
462
552
  readonly ebOpts: BlockstoreRuntime;
463
- remoteCarStore?: DataStore;
464
- carStore(): Promise<DataStore>;
465
553
  carLog: CarLog;
466
554
  remoteMetaStore?: MetaStore;
467
555
  remoteFileStore?: DataStore;
468
- taskManager?: TaskManager;
556
+ remoteCarStore?: DataStore;
557
+ readonly taskManager: TaskManager;
469
558
  ready(): Promise<void>;
470
559
  close(): Promise<void>;
560
+ keyBag(): Promise<KeyBag>;
561
+ metaStore(): Promise<MetaStore>;
471
562
  fileStore(): Promise<DataStore>;
472
563
  WALStore(): Promise<WALStore>;
564
+ carStore(): Promise<DataStore>;
473
565
  handleDbMetasFromStore(metas: DbMeta[]): Promise<void>;
566
+ commit<T = TransactionMeta>(t: CarTransaction, done: T, opts: CommitOpts): Promise<CarGroup>;
567
+ destroy(): Promise<void>;
568
+ getBlock(cid: AnyLink): Promise<AnyBlock | Falsy>;
569
+ loadFileCar(cid: AnyLink): Promise<CarReader>;
570
+ loadCar(cid: AnyLink): Promise<CarReader>;
571
+ commitFiles(t: CarTransaction, done: TransactionMeta): Promise<CarGroup>;
572
+ entries(cache?: boolean): AsyncIterableIterator<AnyBlock>;
474
573
  }
475
- type DbMetaEventBlock = EventBlock<{
476
- dbMeta: Uint8Array;
477
- }>;
574
+ interface DbMetaBinary {
575
+ readonly dbMeta: Uint8Array;
576
+ }
577
+ type DbMetaEventBlock = EventBlock<DbMetaBinary>;
478
578
  type CarClockLink = Link<DbMetaEventBlock, number, number, Version>;
479
579
  type CarClockHead = CarClockLink[];
480
580
 
581
+ interface SerdeGatewayInstances {
582
+ readonly gateway: SerdeGateway;
583
+ }
584
+ interface GatewayReady extends SerdeGatewayInstances {
585
+ readonly url: URI;
586
+ }
587
+ declare function getStartedGateway(sthis: SuperThis, url: URI): Promise<Result<GatewayReady>>;
588
+ declare function ensureStoreEnDeFile(ende?: Partial<StoreEnDeFile>): StoreEnDeFile;
589
+ declare function toStoreRuntime(sthis: SuperThis, endeOpts?: Partial<StoreEnDeFile>): StoreRuntime;
590
+
481
591
  interface GatewayOpts {
482
592
  readonly gateway: Gateway;
483
593
  }
484
594
  type GetResult = Result<Uint8Array, NotFoundError | Error>;
485
- type VoidResult = Result<void>;
486
- interface TestGateway {
487
- get(url: URI, key: string): Promise<Uint8Array>;
488
- }
489
- type UnsubscribeResult = Result<() => void>;
490
595
  interface Gateway {
491
- buildUrl(baseUrl: URI, key: string): Promise<Result<URI>>;
492
- start(baseUrl: URI): Promise<Result<URI>>;
493
- close(baseUrl: URI): Promise<VoidResult>;
494
- destroy(baseUrl: URI): Promise<VoidResult>;
495
- put(url: URI, body: Uint8Array): Promise<VoidResult>;
496
- get(url: URI): Promise<GetResult>;
497
- delete(url: URI): Promise<VoidResult>;
498
- subscribe?(url: URI, callback: (meta: Uint8Array) => void): Promise<UnsubscribeResult>;
596
+ buildUrl(baseUrl: URI, key: string, sthis: SuperThis$1): Promise<Result<URI>>;
597
+ start(baseUrl: URI, sthis: SuperThis$1): Promise<Result<URI>>;
598
+ close(baseUrl: URI, sthis: SuperThis$1): Promise<VoidResult>;
599
+ destroy(baseUrl: URI, sthis: SuperThis$1): Promise<VoidResult>;
600
+ put(url: URI, body: Uint8Array, sthis: SuperThis$1): Promise<VoidResult>;
601
+ get(url: URI, sthis: SuperThis$1): Promise<GetResult>;
602
+ delete(url: URI, sthis: SuperThis$1): Promise<VoidResult>;
603
+ subscribe?(url: URI, callback: (meta: Uint8Array) => void, sthis: SuperThis$1): Promise<UnsubscribeResult>;
604
+ getPlain(url: URI, key: string, sthis: SuperThis$1): Promise<Result<Uint8Array>>;
605
+ }
606
+
607
+ declare class PassThroughGateway implements SerdeGatewayInterceptor {
608
+ buildUrl(sthis: SuperThis, url: URI, key: string): Promise<Result<SerdeGatewayBuildUrlReturn>>;
609
+ start(sthis: SuperThis, url: URI): Promise<Result<SerdeGatewayStartReturn>>;
610
+ close(sthis: SuperThis, url: URI): Promise<Result<SerdeGatewayCloseReturn>>;
611
+ delete(sthis: SuperThis, url: URI): Promise<Result<SerdeGatewayDeleteReturn>>;
612
+ destroy(sthis: SuperThis, url: URI): Promise<Result<SerdeGatewayDestroyReturn>>;
613
+ put<T>(sthis: SuperThis, url: URI, body: FPEnvelope<T>): Promise<Result<SerdeGatewayPutReturn<T>>>;
614
+ get<S>(sthis: SuperThis, url: URI): Promise<Result<SerdeGatewayGetReturn<S>>>;
615
+ subscribe(sthis: SuperThis, url: URI, callback: (meta: FPEnvelopeMeta) => Promise<void>): Promise<Result<SerdeGatewaySubscribeReturn>>;
616
+ }
617
+ declare class InterceptorGateway implements SerdeGateway {
618
+ readonly innerGW: SerdeGateway;
619
+ readonly interceptor: SerdeGatewayInterceptor;
620
+ constructor(sthis: SuperThis, innerGW: SerdeGateway, interceptor: SerdeGatewayInterceptor | undefined);
621
+ buildUrl(sthis: SuperThis, baseUrl: URI, key: string, loader: Loadable): Promise<Result<URI>>;
622
+ destroy(sthis: SuperThis, iurl: URI, loader: Loadable): Promise<Result<void>>;
623
+ start(sthis: SuperThis, url: URI, loader: Loadable): Promise<Result<URI>>;
624
+ close(sthis: SuperThis, url: URI, loader: Loadable): Promise<VoidResult>;
625
+ put<T>(sthis: SuperThis, url: URI, fpEnv: FPEnvelope<T>, loader: Loadable): Promise<VoidResult>;
626
+ get<S>(sthis: SuperThis, url: URI, loader: Loadable): Promise<SerdeGetResult<S>>;
627
+ subscribe(sthis: SuperThis, url: URI, callback: (msg: FPEnvelopeMeta) => Promise<void>, loader: Loadable): Promise<UnsubscribeResult>;
628
+ delete(sthis: SuperThis, url: URI, loader: Loadable): Promise<VoidResult>;
629
+ getPlain(sthis: SuperThis, url: URI, key: string, loader?: Loadable): Promise<Result<Uint8Array>>;
499
630
  }
500
631
 
501
- interface GatewayFactoryItem {
632
+ declare function createDbMetaEvent(sthis: SuperThis, dbMeta: DbMeta, parents: CarClockHead): Promise<DbMetaEvent>;
633
+
634
+ interface SerdeGatewayFactoryItem {
502
635
  readonly protocol: string;
503
- readonly overrideBaseURL?: string;
504
- readonly overrideRegistration?: boolean;
505
- readonly gateway: (sthis: SuperThis) => Promise<Gateway>;
506
- readonly test: (sthis: SuperThis) => Promise<TestGateway>;
636
+ readonly isDefault?: boolean;
637
+ defaultURI(sthis: SuperThis): URI;
638
+ serdegateway(sthis: SuperThis): Promise<SerdeGateway>;
507
639
  }
508
- interface GatewayReady {
509
- readonly gateway: Gateway;
510
- readonly test: TestGateway;
511
- }
512
- declare function getGatewayFromURL(url: URI, sthis: SuperThis): Promise<GatewayReady | undefined>;
513
- declare function registerStoreProtocol(item: GatewayFactoryItem): () => void;
514
- declare function testStoreFactory(url: URI, sthis: SuperThis): Promise<TestGateway>;
515
- declare function ensureStart<T>(store: T & {
516
- start: () => Promise<Result<URI>>;
517
- }, logger: Logger): Promise<T>;
518
- declare function toStoreRuntime(opts: StoreOpts, sthis: SuperThis): StoreRuntime;
640
+ declare function getDefaultURI(sthis: SuperThis, protocol?: string): URI;
641
+ interface SerdeOrGatewayFactoryItem {
642
+ readonly protocol: string;
643
+ readonly isDefault?: boolean;
644
+ readonly defaultURI: (sthis: SuperThis) => URI;
645
+ readonly serdegateway?: (sthis: SuperThis) => Promise<SerdeGateway>;
646
+ readonly gateway?: (sthis: SuperThis) => Promise<Gateway>;
647
+ }
648
+ declare function registerStoreProtocol(item: SerdeOrGatewayFactoryItem): () => void;
649
+ declare function getGatewayFactoryItem(protocol: string): SerdeGatewayFactoryItem | undefined;
650
+ declare function defaultGatewayFactoryItem(): SerdeGatewayFactoryItem;
519
651
 
520
- declare class FragmentGateway implements Gateway {
652
+ declare class Loader implements Loadable {
653
+ readonly ebOpts: BlockstoreRuntime;
654
+ readonly commitQueue: CommitQueue<CarGroup>;
655
+ readonly isCompacting = false;
656
+ readonly carReaders: Map<string, Promise<CarReader$1>>;
657
+ readonly seenCompacted: Set<string>;
658
+ readonly processedCars: Set<string>;
521
659
  readonly sthis: SuperThis;
660
+ readonly taskManager: TaskManager;
661
+ carLog: CarLog;
662
+ remoteMetaStore?: MetaStore;
663
+ remoteCarStore?: DataStore;
664
+ remoteFileStore?: DataStore;
665
+ private getBlockCache;
666
+ private seenMeta;
667
+ private writeLimit;
668
+ private readonly _carStore;
669
+ carStore(): Promise<DataStore>;
670
+ private readonly _fileStore;
671
+ fileStore(): Promise<DataStore>;
672
+ private readonly _WALStore;
673
+ WALStore(): Promise<WALStore>;
674
+ private readonly _metaStore;
675
+ metaStore(): Promise<MetaStore>;
676
+ keyBag(): Promise<KeyBag>;
677
+ private readonly onceReady;
678
+ ready(): Promise<void>;
679
+ close(): Promise<void>;
680
+ destroy(): Promise<void>;
522
681
  readonly logger: Logger;
523
- readonly fidLength = 4;
524
- readonly innerGW: Gateway;
525
- headerSize: number;
526
- constructor(sthis: SuperThis, innerGW: Gateway);
527
- slicer(url: URI, body: Uint8Array): Promise<VoidResult>[];
528
- buildUrl(baseUrl: URI, key: string): Promise<Result<URI>>;
529
- destroy(iurl: URI): Promise<Result<void>>;
530
- start(url: URI): Promise<Result<URI>>;
531
- close(url: URI): Promise<VoidResult>;
532
- put(url: URI, body: Uint8Array): Promise<VoidResult>;
533
- get(url: URI): Promise<GetResult>;
534
- subscribe(url: URI, callback: (msg: Uint8Array) => void): Promise<UnsubscribeResult>;
535
- delete(url: URI): Promise<VoidResult>;
682
+ constructor(sthis: SuperThis, ebOpts: BlockstoreOpts);
683
+ handleDbMetasFromStore(metas: DbMeta[]): Promise<void>;
684
+ mergeDbMetaIntoClock(meta: DbMeta): Promise<void>;
685
+ loadCarHeaderFromMeta<T>({ cars: cids }: DbMeta): Promise<CarHeader<T>>;
686
+ commitFiles(t: CarTransaction, done: TransactionMeta): Promise<CarGroup>;
687
+ loadFileCar(cid: AnyLink): Promise<CarReader$1>;
688
+ commit<T = TransactionMeta>(t: CarTransaction, done: T, opts?: CommitOpts): Promise<CarGroup>;
689
+ updateCarLog<T>(cids: CarGroup, fp: CarHeader<T>, compact: boolean): Promise<void>;
690
+ cacheTransaction(t: CarTransaction): Promise<void>;
691
+ cacheCarReader(carCidStr: string, reader: CarReader$1): Promise<void>;
692
+ removeCidsForCompact(cid: AnyLink): Promise<void>;
693
+ entries(cache?: boolean): AsyncIterableIterator<AnyBlock>;
694
+ getBlock(cid: AnyLink): Promise<AnyBlock | Falsy>;
695
+ loadCar(cid: AnyLink): Promise<CarReader$1>;
696
+ makeDecoderAndCarReader(cid: AnyLink, local: DataStore, remote?: DataStore): Promise<CarReader$1>;
697
+ protected storesLoadCar(cid: AnyLink, local: DataStore, remote?: DataStore): Promise<CarReader$1>;
698
+ protected getMoreReaders(cids: AnyLink[]): Promise<void>;
536
699
  }
537
700
 
538
- interface Connectable {
539
- readonly blockstore: {
540
- readonly loader?: Loader;
541
- readonly ebOpts: BlockstoreRuntime;
542
- };
543
- readonly name?: string;
544
- }
701
+ declare function parseCarFile<T>(reader: CarReader$1, logger: Logger): Promise<CarHeader<T>>;
702
+
545
703
  declare abstract class ConnectionBase implements Connection {
546
- loader?: Loadable;
704
+ private loader?;
547
705
  taskManager?: TaskManager;
548
706
  loaded: Promise<void>;
549
707
  readonly url: URI;
550
708
  readonly logger: Logger;
551
709
  constructor(url: URI, logger: Logger);
552
710
  refresh(): Promise<void>;
553
- connect_X({ loader }: {
554
- readonly loader?: Loadable;
555
- }): Promise<void>;
556
- connectMeta_X({ loader }: {
557
- loader?: Loadable;
558
- }): Promise<void>;
711
+ connect(refl: RefLoadable | RefBlockstore): Promise<void>;
712
+ connectMeta(refl: RefLoadable | RefBlockstore): Promise<void>;
559
713
  abstract onConnect(): Promise<void>;
560
- connectStorage_X({ loader }: {
561
- loader?: Loadable;
562
- }): Promise<void>;
714
+ connectStorage(refl: RefLoadable | RefBlockstore): Promise<void>;
563
715
  }
564
716
 
565
- declare function parseCarFile<T>(reader: CarReader, logger: Logger): Promise<CarHeader<T>>;
566
-
567
- declare function setCryptoKeyFromGatewayMetaPayload(uri: URI, sthis: SuperThis, data: Uint8Array): Promise<Result<DbMeta | undefined>>;
568
- declare function addCryptoKeyToGatewayMetaPayload(uri: URI, sthis: SuperThis, body: Uint8Array): Promise<Result<Uint8Array>>;
569
-
570
- type index$3_AnyAnyBlock = AnyAnyBlock;
571
- type index$3_AnyAnyLink = AnyAnyLink;
572
- type index$3_AnyBlock = AnyBlock;
573
- type index$3_AnyDecodedBlock = AnyDecodedBlock;
574
- type index$3_AnyLink = AnyLink;
575
- type index$3_AnyLinkFn = AnyLinkFn;
576
- type index$3_BaseBlockstore = BaseBlockstore;
577
- declare const index$3_BaseBlockstore: typeof BaseBlockstore;
578
- type index$3_BaseStore = BaseStore;
579
- type index$3_BlobLike = BlobLike;
580
- type index$3_BlockFetcher = BlockFetcher;
581
- type index$3_BlockstoreOpts = BlockstoreOpts;
582
- type index$3_BlockstoreRuntime = BlockstoreRuntime;
583
- type index$3_BytesWithIv = BytesWithIv;
584
- type index$3_CIDBlock = CIDBlock;
585
- type index$3_CarClockHead = CarClockHead;
586
- type index$3_CarClockLink = CarClockLink;
587
- type index$3_CarGroup = CarGroup;
588
- type index$3_CarHeader<T> = CarHeader<T>;
589
- type index$3_CarLog = CarLog;
590
- type index$3_CarMakeable = CarMakeable;
591
- type index$3_CarTransaction = CarTransaction;
592
- declare const index$3_CarTransaction: typeof CarTransaction;
593
- type index$3_CodecOpts = CodecOpts;
594
- type index$3_CommitOpts = CommitOpts;
595
- type index$3_CompactFetcher = CompactFetcher;
596
- type index$3_CompactFn = CompactFn;
597
- type index$3_CompactionFetcher = CompactionFetcher;
598
- declare const index$3_CompactionFetcher: typeof CompactionFetcher;
599
- type index$3_Connectable = Connectable;
600
- type index$3_Connection = Connection;
601
- type index$3_ConnectionBase = ConnectionBase;
602
- declare const index$3_ConnectionBase: typeof ConnectionBase;
603
- type index$3_DataSaveOpts = DataSaveOpts;
604
- type index$3_DataStore = DataStore;
605
- type index$3_DbMeta = DbMeta;
606
- type index$3_DbMetaEventBlock = DbMetaEventBlock;
607
- type index$3_EncryptedBlock = EncryptedBlock;
608
- type index$3_EncryptedBlockstore = EncryptedBlockstore;
609
- declare const index$3_EncryptedBlockstore: typeof EncryptedBlockstore;
610
- type index$3_FragmentGateway = FragmentGateway;
611
- declare const index$3_FragmentGateway: typeof FragmentGateway;
612
- type index$3_Gateway = Gateway;
613
- type index$3_GatewayFactoryItem = GatewayFactoryItem;
614
- type index$3_GatewayOpts = GatewayOpts;
615
- type index$3_GetResult = GetResult;
616
- type index$3_IvAndBytes = IvAndBytes;
617
- type index$3_IvKeyIdData = IvKeyIdData;
618
- type index$3_KeyMaterial = KeyMaterial;
619
- type index$3_KeyWithFingerExtract = KeyWithFingerExtract;
620
- type index$3_KeyWithFingerPrint = KeyWithFingerPrint;
621
- type index$3_KeyedCrypto = KeyedCrypto;
622
- type index$3_LoadHandler = LoadHandler;
623
- type index$3_Loadable = Loadable;
624
- type index$3_Loader = Loader;
625
- declare const index$3_Loader: typeof Loader;
626
- type index$3_MetaStore = MetaStore;
627
- type index$3_StoreFactory = StoreFactory;
628
- type index$3_StoreOpts = StoreOpts;
629
- type index$3_StoreRuntime = StoreRuntime;
630
- type index$3_TestGateway = TestGateway;
631
- type index$3_TransactionMeta = TransactionMeta;
632
- type index$3_TransactionWrapper<M extends TransactionMeta> = TransactionWrapper<M>;
633
- type index$3_UnsubscribeResult = UnsubscribeResult;
634
- type index$3_VoidResult = VoidResult;
635
- type index$3_WALState = WALState;
636
- type index$3_WALStore = WALStore;
637
- declare const index$3_addCryptoKeyToGatewayMetaPayload: typeof addCryptoKeyToGatewayMetaPayload;
638
- declare const index$3_ensureStart: typeof ensureStart;
639
- declare const index$3_getGatewayFromURL: typeof getGatewayFromURL;
640
- declare const index$3_parseCarFile: typeof parseCarFile;
641
- declare const index$3_registerStoreProtocol: typeof registerStoreProtocol;
642
- declare const index$3_setCryptoKeyFromGatewayMetaPayload: typeof setCryptoKeyFromGatewayMetaPayload;
643
- declare const index$3_testStoreFactory: typeof testStoreFactory;
644
- declare const index$3_toCIDBlock: typeof toCIDBlock;
645
- declare const index$3_toStoreRuntime: typeof toStoreRuntime;
646
- declare namespace index$3 {
647
- 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_UnsubscribeResult as UnsubscribeResult, 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 };
717
+ type index$5_AnyAnyBlock = AnyAnyBlock;
718
+ type index$5_AnyAnyLink = AnyAnyLink;
719
+ type index$5_AnyBlock = AnyBlock;
720
+ type index$5_AnyDecodedBlock = AnyDecodedBlock;
721
+ type index$5_AnyLink = AnyLink;
722
+ type index$5_AnyLinkFn = AnyLinkFn;
723
+ type index$5_BaseBlockstore = BaseBlockstore;
724
+ declare const index$5_BaseBlockstore: typeof BaseBlockstore;
725
+ type index$5_BaseStore = BaseStore;
726
+ type index$5_BlobLike = BlobLike;
727
+ type index$5_BlockFetcher = BlockFetcher;
728
+ type index$5_BlockstoreOpts = BlockstoreOpts;
729
+ type index$5_BlockstoreParams = BlockstoreParams;
730
+ type index$5_BlockstoreRuntime = BlockstoreRuntime;
731
+ type index$5_BytesWithIv = BytesWithIv;
732
+ type index$5_CIDBlock = CIDBlock;
733
+ declare const index$5_Car2FPMsg: typeof Car2FPMsg;
734
+ type index$5_CarClockHead = CarClockHead;
735
+ type index$5_CarClockLink = CarClockLink;
736
+ type index$5_CarGroup = CarGroup;
737
+ type index$5_CarHeader<T> = CarHeader<T>;
738
+ type index$5_CarLog = CarLog;
739
+ type index$5_CarMakeable = CarMakeable;
740
+ type index$5_CarTransaction = CarTransaction;
741
+ declare const index$5_CarTransaction: typeof CarTransaction;
742
+ type index$5_CodecOpts = CodecOpts;
743
+ type index$5_CommitOpts = CommitOpts;
744
+ type index$5_CompactFetcher = CompactFetcher;
745
+ type index$5_CompactFn = CompactFn;
746
+ type index$5_CompactionFetcher = CompactionFetcher;
747
+ declare const index$5_CompactionFetcher: typeof CompactionFetcher;
748
+ type index$5_Connection = Connection;
749
+ type index$5_ConnectionBase = ConnectionBase;
750
+ declare const index$5_ConnectionBase: typeof ConnectionBase;
751
+ type index$5_DataSaveOpts = DataSaveOpts;
752
+ type index$5_DataStore = DataStore;
753
+ type index$5_DbMeta = DbMeta;
754
+ type index$5_DbMetaBinary = DbMetaBinary;
755
+ type index$5_DbMetaEvent = DbMetaEvent;
756
+ type index$5_DbMetaEventBlock = DbMetaEventBlock;
757
+ declare const index$5_DbMetaEventEqual: typeof DbMetaEventEqual;
758
+ declare const index$5_DbMetaEventsEqual: typeof DbMetaEventsEqual;
759
+ type index$5_EncryptedBlock = EncryptedBlock;
760
+ type index$5_EncryptedBlockstore = EncryptedBlockstore;
761
+ declare const index$5_EncryptedBlockstore: typeof EncryptedBlockstore;
762
+ type index$5_FPEnvelope<T> = FPEnvelope<T>;
763
+ type index$5_FPEnvelopeCar = FPEnvelopeCar;
764
+ type index$5_FPEnvelopeFile = FPEnvelopeFile;
765
+ type index$5_FPEnvelopeMeta = FPEnvelopeMeta;
766
+ type index$5_FPEnvelopeType = FPEnvelopeType;
767
+ declare const index$5_FPEnvelopeType: typeof FPEnvelopeType;
768
+ type index$5_FPEnvelopeWAL = FPEnvelopeWAL;
769
+ type index$5_FPWALCarsOps = FPWALCarsOps;
770
+ declare const index$5_File2FPMsg: typeof File2FPMsg;
771
+ type index$5_Gateway = Gateway;
772
+ type index$5_GatewayOpts = GatewayOpts;
773
+ type index$5_GetResult = GetResult;
774
+ type index$5_InterceptorGateway = InterceptorGateway;
775
+ declare const index$5_InterceptorGateway: typeof InterceptorGateway;
776
+ type index$5_IvAndBytes = IvAndBytes;
777
+ type index$5_IvKeyIdData = IvKeyIdData;
778
+ type index$5_KeyMaterial = KeyMaterial;
779
+ type index$5_KeyWithFingerExtract = KeyWithFingerExtract;
780
+ type index$5_KeyWithFingerPrint = KeyWithFingerPrint;
781
+ type index$5_KeyedCrypto = KeyedCrypto;
782
+ type index$5_LoadHandler = LoadHandler;
783
+ type index$5_Loadable = Loadable;
784
+ type index$5_Loader = Loader;
785
+ declare const index$5_Loader: typeof Loader;
786
+ type index$5_MetaStore = MetaStore;
787
+ type index$5_PassThroughGateway = PassThroughGateway;
788
+ declare const index$5_PassThroughGateway: typeof PassThroughGateway;
789
+ type index$5_RefBlockstore = RefBlockstore;
790
+ type index$5_RefLoadable = RefLoadable;
791
+ type index$5_SerdeGateway = SerdeGateway;
792
+ type index$5_SerdeGatewayBuildUrlOp = SerdeGatewayBuildUrlOp;
793
+ type index$5_SerdeGatewayBuildUrlReturn = SerdeGatewayBuildUrlReturn;
794
+ type index$5_SerdeGatewayCloseOp = SerdeGatewayCloseOp;
795
+ type index$5_SerdeGatewayCloseReturn = SerdeGatewayCloseReturn;
796
+ type index$5_SerdeGatewayDeleteOp = SerdeGatewayDeleteOp;
797
+ type index$5_SerdeGatewayDeleteReturn = SerdeGatewayDeleteReturn;
798
+ type index$5_SerdeGatewayDestroyOp = SerdeGatewayDestroyOp;
799
+ type index$5_SerdeGatewayDestroyReturn = SerdeGatewayDestroyReturn;
800
+ type index$5_SerdeGatewayFactoryItem = SerdeGatewayFactoryItem;
801
+ type index$5_SerdeGatewayGetOp = SerdeGatewayGetOp;
802
+ type index$5_SerdeGatewayGetReturn<S> = SerdeGatewayGetReturn<S>;
803
+ type index$5_SerdeGatewayInterceptor = SerdeGatewayInterceptor;
804
+ type index$5_SerdeGatewayOpts = SerdeGatewayOpts;
805
+ type index$5_SerdeGatewayPutOp<T> = SerdeGatewayPutOp<T>;
806
+ type index$5_SerdeGatewayPutReturn<T> = SerdeGatewayPutReturn<T>;
807
+ type index$5_SerdeGatewayReturn<O, T> = SerdeGatewayReturn<O, T>;
808
+ type index$5_SerdeGatewayStartOp = SerdeGatewayStartOp;
809
+ type index$5_SerdeGatewayStartReturn = SerdeGatewayStartReturn;
810
+ type index$5_SerdeGatewaySubscribeOp = SerdeGatewaySubscribeOp;
811
+ type index$5_SerdeGatewaySubscribeReturn = SerdeGatewaySubscribeReturn;
812
+ type index$5_SerdeGetResult<S> = SerdeGetResult<S>;
813
+ type index$5_SerdeOrGatewayFactoryItem = SerdeOrGatewayFactoryItem;
814
+ type index$5_StoreEnDeFile = StoreEnDeFile;
815
+ type index$5_StoreFactory = StoreFactory;
816
+ type index$5_StoreFactoryItem = StoreFactoryItem;
817
+ type index$5_StoreRuntime = StoreRuntime;
818
+ type index$5_StoreRuntimeUrls = StoreRuntimeUrls;
819
+ type index$5_StoreURIRuntime = StoreURIRuntime;
820
+ type index$5_StoreURIs = StoreURIs;
821
+ type index$5_StoreUrls = StoreUrls;
822
+ type index$5_StoreUrlsOpts = StoreUrlsOpts;
823
+ type index$5_TransactionMeta = TransactionMeta;
824
+ type index$5_TransactionWrapper<M extends TransactionMeta> = TransactionWrapper<M>;
825
+ type index$5_UnsubscribeResult = UnsubscribeResult;
826
+ type index$5_VoidResult = VoidResult;
827
+ type index$5_WALState = WALState;
828
+ type index$5_WALStore = WALStore;
829
+ declare const index$5_createDbMetaEvent: typeof createDbMetaEvent;
830
+ declare const index$5_defaultGatewayFactoryItem: typeof defaultGatewayFactoryItem;
831
+ declare const index$5_ensureStoreEnDeFile: typeof ensureStoreEnDeFile;
832
+ declare const index$5_getDefaultURI: typeof getDefaultURI;
833
+ declare const index$5_getGatewayFactoryItem: typeof getGatewayFactoryItem;
834
+ declare const index$5_getStartedGateway: typeof getStartedGateway;
835
+ declare const index$5_parseCarFile: typeof parseCarFile;
836
+ declare const index$5_registerStoreProtocol: typeof registerStoreProtocol;
837
+ declare const index$5_toCIDBlock: typeof toCIDBlock;
838
+ declare const index$5_toStoreRuntime: typeof toStoreRuntime;
839
+ declare namespace index$5 {
840
+ export { type index$5_AnyAnyBlock as AnyAnyBlock, type index$5_AnyAnyLink as AnyAnyLink, type index$5_AnyBlock as AnyBlock, type index$5_AnyDecodedBlock as AnyDecodedBlock, type index$5_AnyLink as AnyLink, type index$5_AnyLinkFn as AnyLinkFn, index$5_BaseBlockstore as BaseBlockstore, type index$5_BaseStore as BaseStore, type index$5_BlobLike as BlobLike, type index$5_BlockFetcher as BlockFetcher, type index$5_BlockstoreOpts as BlockstoreOpts, type index$5_BlockstoreParams as BlockstoreParams, type index$5_BlockstoreRuntime as BlockstoreRuntime, type index$5_BytesWithIv as BytesWithIv, type index$5_CIDBlock as CIDBlock, index$5_Car2FPMsg as Car2FPMsg, type index$5_CarClockHead as CarClockHead, type index$5_CarClockLink as CarClockLink, type index$5_CarGroup as CarGroup, type index$5_CarHeader as CarHeader, type index$5_CarLog as CarLog, type index$5_CarMakeable as CarMakeable, index$5_CarTransaction as CarTransaction, type index$5_CodecOpts as CodecOpts, type index$5_CommitOpts as CommitOpts, type index$5_CompactFetcher as CompactFetcher, type index$5_CompactFn as CompactFn, index$5_CompactionFetcher as CompactionFetcher, type index$5_Connection as Connection, index$5_ConnectionBase as ConnectionBase, type index$5_DataSaveOpts as DataSaveOpts, type index$5_DataStore as DataStore, type index$5_DbMeta as DbMeta, type index$5_DbMetaBinary as DbMetaBinary, type index$5_DbMetaEvent as DbMetaEvent, type index$5_DbMetaEventBlock as DbMetaEventBlock, index$5_DbMetaEventEqual as DbMetaEventEqual, index$5_DbMetaEventsEqual as DbMetaEventsEqual, type index$5_EncryptedBlock as EncryptedBlock, index$5_EncryptedBlockstore as EncryptedBlockstore, type index$5_FPEnvelope as FPEnvelope, type index$5_FPEnvelopeCar as FPEnvelopeCar, type index$5_FPEnvelopeFile as FPEnvelopeFile, type index$5_FPEnvelopeMeta as FPEnvelopeMeta, index$5_FPEnvelopeType as FPEnvelopeType, type index$5_FPEnvelopeWAL as FPEnvelopeWAL, type index$5_FPWALCarsOps as FPWALCarsOps, index$5_File2FPMsg as File2FPMsg, type index$5_Gateway as Gateway, type index$5_GatewayOpts as GatewayOpts, type index$5_GetResult as GetResult, index$5_InterceptorGateway as InterceptorGateway, type index$5_IvAndBytes as IvAndBytes, type index$5_IvKeyIdData as IvKeyIdData, type index$5_KeyMaterial as KeyMaterial, type index$5_KeyWithFingerExtract as KeyWithFingerExtract, type index$5_KeyWithFingerPrint as KeyWithFingerPrint, type index$5_KeyedCrypto as KeyedCrypto, type index$5_LoadHandler as LoadHandler, type index$5_Loadable as Loadable, index$5_Loader as Loader, type index$5_MetaStore as MetaStore, index$5_PassThroughGateway as PassThroughGateway, type index$5_RefBlockstore as RefBlockstore, type index$5_RefLoadable as RefLoadable, type index$5_SerdeGateway as SerdeGateway, type index$5_SerdeGatewayBuildUrlOp as SerdeGatewayBuildUrlOp, type index$5_SerdeGatewayBuildUrlReturn as SerdeGatewayBuildUrlReturn, type index$5_SerdeGatewayCloseOp as SerdeGatewayCloseOp, type index$5_SerdeGatewayCloseReturn as SerdeGatewayCloseReturn, type index$5_SerdeGatewayDeleteOp as SerdeGatewayDeleteOp, type index$5_SerdeGatewayDeleteReturn as SerdeGatewayDeleteReturn, type index$5_SerdeGatewayDestroyOp as SerdeGatewayDestroyOp, type index$5_SerdeGatewayDestroyReturn as SerdeGatewayDestroyReturn, type index$5_SerdeGatewayFactoryItem as SerdeGatewayFactoryItem, type index$5_SerdeGatewayGetOp as SerdeGatewayGetOp, type index$5_SerdeGatewayGetReturn as SerdeGatewayGetReturn, type index$5_SerdeGatewayInterceptor as SerdeGatewayInterceptor, type index$5_SerdeGatewayOpts as SerdeGatewayOpts, type index$5_SerdeGatewayPutOp as SerdeGatewayPutOp, type index$5_SerdeGatewayPutReturn as SerdeGatewayPutReturn, type index$5_SerdeGatewayReturn as SerdeGatewayReturn, type index$5_SerdeGatewayStartOp as SerdeGatewayStartOp, type index$5_SerdeGatewayStartReturn as SerdeGatewayStartReturn, type index$5_SerdeGatewaySubscribeOp as SerdeGatewaySubscribeOp, type index$5_SerdeGatewaySubscribeReturn as SerdeGatewaySubscribeReturn, type index$5_SerdeGetResult as SerdeGetResult, type index$5_SerdeOrGatewayFactoryItem as SerdeOrGatewayFactoryItem, type index$5_StoreEnDeFile as StoreEnDeFile, type index$5_StoreFactory as StoreFactory, type index$5_StoreFactoryItem as StoreFactoryItem, type index$5_StoreRuntime as StoreRuntime, type index$5_StoreRuntimeUrls as StoreRuntimeUrls, type index$5_StoreURIRuntime as StoreURIRuntime, type index$5_StoreURIs as StoreURIs, type index$5_StoreUrls as StoreUrls, type index$5_StoreUrlsOpts as StoreUrlsOpts, type index$5_TransactionMeta as TransactionMeta, type index$5_TransactionWrapper as TransactionWrapper, type index$5_UnsubscribeResult as UnsubscribeResult, type index$5_VoidResult as VoidResult, type index$5_WALState as WALState, type index$5_WALStore as WALStore, index$5_createDbMetaEvent as createDbMetaEvent, index$5_defaultGatewayFactoryItem as defaultGatewayFactoryItem, index$5_ensureStoreEnDeFile as ensureStoreEnDeFile, index$5_getDefaultURI as getDefaultURI, index$5_getGatewayFactoryItem as getGatewayFactoryItem, index$5_getStartedGateway as getStartedGateway, index$5_parseCarFile as parseCarFile, index$5_registerStoreProtocol as registerStoreProtocol, index$5_toCIDBlock as toCIDBlock, index$5_toStoreRuntime as toStoreRuntime };
648
841
  }
649
842
 
650
843
  type Falsy = false | null | undefined;
651
844
  declare function isFalsy(value: unknown): value is Falsy;
845
+ declare enum PARAM {
846
+ SUFFIX = "suffix",
847
+ URL_GEN = "urlGen",
848
+ STORE_KEY = "storekey",
849
+ STORE = "store",
850
+ KEY = "key",
851
+ INDEX = "index",
852
+ NAME = "name",
853
+ VERSION = "version",
854
+ RUNTIME = "runtime",
855
+ FRAG_SIZE = "fragSize",
856
+ IV_VERIFY = "ivVerify",
857
+ IV_HASH = "ivHash",
858
+ FRAG_FID = "fid",
859
+ FRAG_OFS = "ofs",
860
+ FRAG_LEN = "len",
861
+ FRAG_HEAD = "headerSize",
862
+ EXTRACTKEY = "extractKey"
863
+ }
652
864
  declare function throwFalsy<T>(value: T | Falsy): T;
653
865
  declare function falsyToUndef<T>(value: T | Falsy): T | undefined;
654
866
  type StoreType = "data" | "wal" | "meta";
867
+ interface FPStats {
868
+ isFile(): boolean;
869
+ isDirectory(): boolean;
870
+ isBlockDevice(): boolean;
871
+ isCharacterDevice(): boolean;
872
+ isSymbolicLink(): boolean;
873
+ isFIFO(): boolean;
874
+ isSocket(): boolean;
875
+ uid: number | Falsy;
876
+ gid: number | Falsy;
877
+ size: number | Falsy;
878
+ atime: Date | Falsy;
879
+ mtime: Date | Falsy;
880
+ ctime: Date | Falsy;
881
+ birthtime: Date | Falsy;
882
+ }
655
883
  interface SysFileSystem {
656
884
  start(): Promise<SysFileSystem>;
657
- mkdir(path: PathLike, options?: {
885
+ mkdir(path: string, options?: {
658
886
  recursive: boolean;
659
887
  }): Promise<string | undefined>;
660
- readdir(path: PathLike, options?: unknown): Promise<string[]>;
661
- rm(path: PathLike, options?: MakeDirectoryOptions & {
888
+ readdir(path: string): Promise<string[]>;
889
+ rm(path: string, options?: {
662
890
  recursive: boolean;
663
891
  }): Promise<void>;
664
- copyFile(source: PathLike, destination: PathLike): Promise<void>;
665
- readfile(path: PathLike, options?: {
666
- encoding: BufferEncoding;
667
- flag?: string;
668
- }): Promise<Uint8Array>;
669
- stat(path: PathLike): Promise<Stats>;
670
- unlink(path: PathLike): Promise<void>;
671
- writefile(path: PathLike, data: Uint8Array | string): Promise<void>;
892
+ copyFile(source: string, destination: string): Promise<void>;
893
+ readfile(path: string): Promise<Uint8Array>;
894
+ stat(path: string): Promise<FPStats>;
895
+ unlink(path: string): Promise<void>;
896
+ writefile(path: string, data: Uint8Array | string): Promise<void>;
672
897
  }
673
898
  interface PathOps {
674
899
  join(...args: string[]): string;
675
900
  dirname(path: string): string;
901
+ basename(path: string): string;
676
902
  }
903
+ type ToUInt8 = Uint8Array | Result<Uint8Array>;
904
+ type PromiseToUInt8 = ToUInt8 | Promise<Uint8Array> | Promise<Result<Uint8Array>>;
677
905
  interface TextEndeCoder {
678
906
  encode(input: string): Uint8Array;
679
- decode(input: Uint8Array): string;
907
+ decode(input: ToUInt8): string;
680
908
  }
681
909
  interface SuperThisOpts {
682
910
  readonly logger: Logger;
@@ -693,12 +921,14 @@ interface SuperThis {
693
921
  readonly pathOps: PathOps;
694
922
  readonly ctx: Record<string, unknown>;
695
923
  readonly txt: TextEndeCoder;
696
- nextId(bytes?: number): {
924
+ timeOrderedNextId(time?: number): {
697
925
  str: string;
698
- bin: Uint8Array;
926
+ toString: () => string;
699
927
  };
700
- timeOrderedNextId(time?: number): {
928
+ nextId(bytes?: number): {
701
929
  str: string;
930
+ bin: Uint8Array;
931
+ toString: () => string;
702
932
  };
703
933
  start(): Promise<void>;
704
934
  clone(override: Partial<SuperThisOpts>): SuperThis;
@@ -706,10 +936,13 @@ interface SuperThis {
706
936
  interface ConfigOpts extends Partial<SuperThisOpts> {
707
937
  readonly public?: boolean;
708
938
  readonly meta?: DbMeta;
709
- readonly persistIndexes?: boolean;
939
+ readonly writeQueue?: Partial<WriteQueueParams>;
940
+ readonly gatewayInterceptor?: SerdeGatewayInterceptor;
710
941
  readonly autoCompact?: number;
711
- readonly store?: StoreOpts;
942
+ readonly storeUrls?: StoreUrlsOpts;
943
+ readonly storeEnDe?: StoreEnDeFile;
712
944
  readonly threshold?: number;
945
+ readonly keyBag?: Partial<KeyBagOpts>;
713
946
  }
714
947
  type ClockLink = EventLink<Operation>;
715
948
  type ClockHead = ClockLink[];
@@ -832,6 +1065,11 @@ interface DocResponse {
832
1065
  readonly clock: ClockHead;
833
1066
  readonly name?: string;
834
1067
  }
1068
+ interface BulkResponse {
1069
+ readonly ids: string[];
1070
+ readonly clock: ClockHead;
1071
+ readonly name?: string;
1072
+ }
835
1073
  type UpdateListenerFn<T extends DocTypes> = (docs: DocWithId<T>[]) => Promise<void> | void;
836
1074
  type NoUpdateListenerFn = () => Promise<void> | void;
837
1075
  type ListenerFn<T extends DocTypes> = UpdateListenerFn<T> | NoUpdateListenerFn;
@@ -843,7 +1081,13 @@ interface CRDTEntry {
843
1081
 
844
1082
  interface WriteQueue<T extends DocTypes> {
845
1083
  push(task: DocUpdate<T>): Promise<MetaType>;
1084
+ bulk(tasks: DocUpdate<T>[]): Promise<MetaType>;
1085
+ close(): Promise<void>;
1086
+ }
1087
+ interface WriteQueueParams {
1088
+ readonly chunkSize: number;
846
1089
  }
1090
+ declare function defaultWriteQueueOpts(opts?: Partial<WriteQueueParams>): WriteQueueParams;
847
1091
 
848
1092
  declare class IndexTree<K extends IndexKeyType, R extends DocFragment> {
849
1093
  cid?: AnyLink;
@@ -879,13 +1123,11 @@ interface ProllyNode<K extends IndexKeyType, T extends DocFragment> extends Prol
879
1123
  readonly block: Promise<Block$1>;
880
1124
  }
881
1125
 
882
- declare function index$2<K extends IndexKeyType = string, T extends DocTypes = NonNullable<unknown>, R extends DocFragment = T>(sthis: SuperThis, { _crdt }: {
883
- _crdt: CRDT<T> | CRDT<NonNullable<unknown>>;
884
- }, name: string, mapFn?: MapFn<T>, meta?: IdxMeta): Index<K, T, R>;
1126
+ declare function index$4<K extends IndexKeyType = string, T extends DocTypes = NonNullable<unknown>, R extends DocFragment = T>(refDb: HasCRDT<T>, name: string, mapFn?: MapFn<T>, meta?: IdxMeta): Index<K, T, R>;
885
1127
  declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFragment = T> {
886
1128
  readonly blockstore: BaseBlockstore;
887
1129
  readonly crdt: CRDT<T>;
888
- name: string;
1130
+ readonly name: string;
889
1131
  mapFn?: MapFn<T>;
890
1132
  mapFnString: string;
891
1133
  byKey: IndexTree<K, R>;
@@ -894,8 +1136,6 @@ declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFra
894
1136
  includeDocsDefault: boolean;
895
1137
  initError?: Error;
896
1138
  ready(): Promise<void>;
897
- close(): Promise<void>;
898
- destroy(): Promise<void>;
899
1139
  readonly logger: Logger;
900
1140
  constructor(sthis: SuperThis, crdt: CRDT<T> | CRDT<NonNullable<unknown>>, name: string, mapFn?: MapFn<T>, meta?: IdxMeta);
901
1141
  applyMapFn(name: string, mapFn?: MapFn<T>, meta?: IdxMeta): void;
@@ -941,16 +1181,18 @@ declare class CRDTClock<T extends DocTypes> {
941
1181
  int_applyHead(newHead: ClockHead, prevHead: ClockHead, localUpdates: boolean): Promise<void>;
942
1182
  }
943
1183
 
1184
+ interface HasCRDT<T extends DocTypes> {
1185
+ readonly crdt: CRDT<T> | CRDT<NonNullable<unknown>>;
1186
+ }
944
1187
  declare class CRDT<T extends DocTypes> {
945
- readonly name?: string;
946
- readonly opts: ConfigOpts;
1188
+ readonly opts: LedgerOpts;
947
1189
  readonly blockstore: BaseBlockstore;
948
1190
  readonly indexBlockstore: BaseBlockstore;
949
1191
  readonly indexers: Map<string, Index<IndexKeyType, NonNullable<unknown>>>;
950
1192
  readonly clock: CRDTClock<T>;
951
1193
  readonly logger: Logger;
952
1194
  readonly sthis: SuperThis;
953
- constructor(sthis: SuperThis, name?: string, opts?: ConfigOpts);
1195
+ constructor(sthis: SuperThis, opts: LedgerOpts);
954
1196
  bulk(updates: DocUpdate<T>[]): Promise<CRDTMeta>;
955
1197
  readonly onceReady: ResolveOnce<void>;
956
1198
  ready(): Promise<void>;
@@ -970,25 +1212,97 @@ declare class CRDT<T extends DocTypes> {
970
1212
  compact(): Promise<void>;
971
1213
  }
972
1214
 
973
- declare class Database<DT extends DocTypes = NonNullable<unknown>> implements Connectable {
974
- static databases: Map<string, Database>;
1215
+ declare function keyConfigOpts(sthis: SuperThis, name?: string, opts?: ConfigOpts): string;
1216
+ interface LedgerOpts {
975
1217
  readonly name?: string;
976
- readonly opts: ConfigOpts;
1218
+ readonly meta?: DbMeta;
1219
+ readonly gatewayInterceptor?: SerdeGatewayInterceptor;
1220
+ readonly writeQueue: WriteQueueParams;
1221
+ readonly storeUrls: StoreURIRuntime;
1222
+ readonly storeEnDe: StoreEnDeFile;
1223
+ readonly keyBag: KeyBagRuntime;
1224
+ }
1225
+ interface Ledger<DT extends DocTypes = NonNullable<unknown>> extends HasCRDT<DT> {
1226
+ readonly logger: Logger;
1227
+ readonly sthis: SuperThis;
1228
+ readonly id: string;
1229
+ readonly name: string;
1230
+ onClosed(fn: () => void): void;
1231
+ close(): Promise<void>;
1232
+ destroy(): Promise<void>;
1233
+ ready(): Promise<void>;
1234
+ get<T extends DocTypes>(id: string): Promise<DocWithId<T>>;
1235
+ put<T extends DocTypes>(doc: DocSet<T>): Promise<DocResponse>;
1236
+ bulk<T extends DocTypes>(docs: DocSet<T>[]): Promise<BulkResponse>;
1237
+ del(id: string): Promise<DocResponse>;
1238
+ changes<T extends DocTypes>(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse<T>>;
1239
+ allDocs<T extends DocTypes>(opts?: AllDocsQueryOpts): Promise<AllDocsResponse<T>>;
1240
+ allDocuments<T extends DocTypes>(): Promise<{
1241
+ rows: {
1242
+ key: string;
1243
+ value: DocWithId<T>;
1244
+ }[];
1245
+ clock: ClockHead;
1246
+ }>;
1247
+ subscribe<T extends DocTypes>(listener: ListenerFn<T>, updates?: boolean): () => void;
1248
+ query<K extends IndexKeyType, T extends DocTypes, R extends DocFragment = T>(field: string | MapFn<T>, opts?: QueryOpts<K>): Promise<IndexRows<K, T, R>>;
1249
+ compact(): Promise<void>;
1250
+ }
1251
+ declare function isLedger<T extends DocTypes = NonNullable<unknown>>(db: unknown): db is Ledger<T>;
1252
+ declare function LedgerFactory<T extends DocTypes = NonNullable<unknown>>(name: string | undefined, opts?: ConfigOpts): Ledger<T>;
1253
+ declare class LedgerShell<DT extends DocTypes = NonNullable<unknown>> implements Ledger<DT> {
1254
+ readonly ref: LedgerImpl<DT>;
1255
+ constructor(ref: LedgerImpl<DT>);
1256
+ get id(): string;
1257
+ get logger(): Logger;
1258
+ get sthis(): SuperThis;
1259
+ get crdt(): CRDT<DT>;
1260
+ get name(): string;
1261
+ onClosed(fn: () => void): void;
1262
+ close(): Promise<void>;
1263
+ destroy(): Promise<void>;
1264
+ ready(): Promise<void>;
1265
+ get<T extends DocTypes>(id: string): Promise<DocWithId<T>>;
1266
+ put<T extends DocTypes>(doc: DocSet<T>): Promise<DocResponse>;
1267
+ bulk<T extends DocTypes>(docs: DocSet<T>[]): Promise<BulkResponse>;
1268
+ del(id: string): Promise<DocResponse>;
1269
+ changes<T extends DocTypes>(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse<T>>;
1270
+ allDocs<T extends DocTypes>(opts?: AllDocsQueryOpts): Promise<AllDocsResponse<T>>;
1271
+ allDocuments<T extends DocTypes>(): Promise<{
1272
+ rows: {
1273
+ key: string;
1274
+ value: DocWithId<T>;
1275
+ }[];
1276
+ clock: ClockHead;
1277
+ }>;
1278
+ subscribe<T extends DocTypes>(listener: ListenerFn<T>, updates?: boolean): () => void;
1279
+ query<K extends IndexKeyType, T extends DocTypes, R extends DocFragment = T>(field: string | MapFn<T>, opts?: QueryOpts<K>): Promise<IndexRows<K, T, R>>;
1280
+ compact(): Promise<void>;
1281
+ }
1282
+ declare class LedgerImpl<DT extends DocTypes = NonNullable<unknown>> implements Ledger<DT> {
1283
+ readonly opts: LedgerOpts;
977
1284
  _listening: boolean;
978
1285
  readonly _listeners: Set<ListenerFn<DT>>;
979
1286
  readonly _noupdate_listeners: Set<ListenerFn<DT>>;
980
- readonly _crdt: CRDT<DT>;
1287
+ readonly crdt: CRDT<DT>;
981
1288
  readonly _writeQueue: WriteQueue<DT>;
982
- readonly blockstore: BaseBlockstore;
1289
+ readonly shells: Set<LedgerShell<DT>>;
1290
+ addShell(shell: LedgerShell<DT>): void;
1291
+ readonly _onClosedFns: Set<() => void>;
1292
+ onClosed(fn: () => void): void;
983
1293
  close(): Promise<void>;
1294
+ shellClose(db: LedgerShell<DT>): Promise<void>;
984
1295
  destroy(): Promise<void>;
985
1296
  readonly _ready: ResolveOnce<void>;
986
1297
  ready(): Promise<void>;
987
1298
  readonly logger: Logger;
988
1299
  readonly sthis: SuperThis;
989
- constructor(name?: string, opts?: ConfigOpts);
1300
+ readonly id: string;
1301
+ constructor(sthis: SuperThis, opts: LedgerOpts);
1302
+ get name(): string;
990
1303
  get<T extends DocTypes>(id: string): Promise<DocWithId<T>>;
991
1304
  put<T extends DocTypes>(doc: DocSet<T>): Promise<DocResponse>;
1305
+ bulk<T extends DocTypes>(docs: DocSet<T>[]): Promise<BulkResponse>;
992
1306
  del(id: string): Promise<DocResponse>;
993
1307
  changes<T extends DocTypes>(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse<T>>;
994
1308
  allDocs<T extends DocTypes>(opts?: AllDocsQueryOpts): Promise<AllDocsResponse<T>>;
@@ -1005,7 +1319,8 @@ declare class Database<DT extends DocTypes = NonNullable<unknown>> implements Co
1005
1319
  _notify(updates: DocUpdate<NonNullable<unknown>>[]): Promise<void>;
1006
1320
  _no_update_notify(): Promise<void>;
1007
1321
  }
1008
- declare function fireproof(name: string, opts?: ConfigOpts): Database;
1322
+ declare function toStoreURIRuntime(sthis: SuperThis, name?: string, sopts?: StoreUrlsOpts): StoreURIRuntime;
1323
+ declare function fireproof(name: string, opts?: ConfigOpts): Ledger;
1009
1324
 
1010
1325
  declare function getPath(url: URI, sthis: SuperThis$1): string;
1011
1326
  declare function getFileName(url: URI, sthis: SuperThis$1): string;
@@ -1083,9 +1398,94 @@ declare namespace block {
1083
1398
  export { block_Block as Block, block_create as create, block_createUnsafe as createUnsafe, block_decode as decode, block_encode as encode };
1084
1399
  }
1085
1400
 
1086
- declare const index$1_block: typeof block;
1401
+ declare const index$3_block: typeof block;
1402
+ declare namespace index$3 {
1403
+ export { index$3_block as block, codecInterface as codec };
1404
+ }
1405
+
1406
+ interface SerializedMeta {
1407
+ readonly data: string;
1408
+ readonly parents: string[];
1409
+ readonly cid: string;
1410
+ }
1411
+ type CAREncodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise<Result<Uint8Array>>;
1412
+ type FILEEncodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise<Result<Uint8Array>>;
1413
+ type METAEncodeEnvelope = (sthis: SuperThis, payload: SerializedMeta[]) => Promise<Result<Uint8Array>>;
1414
+ type WALEncodeEnvelope = (sthis: SuperThis, payload: SerializedWAL) => Promise<Result<Uint8Array>>;
1415
+ interface Encoder {
1416
+ readonly car: CAREncodeEnvelope;
1417
+ readonly file: FILEEncodeEnvelope;
1418
+ readonly meta: METAEncodeEnvelope;
1419
+ readonly wal: WALEncodeEnvelope;
1420
+ }
1421
+ declare function fpSerialize<T>(sthis: SuperThis, env: FPEnvelope<T>, pencoder?: Partial<Encoder>): Promise<Result<Uint8Array>>;
1422
+ type linkOrCid = {
1423
+ "/": string;
1424
+ } | string;
1425
+ interface SerializedWAL {
1426
+ readonly fileOperations?: {
1427
+ cid: linkOrCid;
1428
+ public: boolean;
1429
+ }[];
1430
+ readonly noLoaderOps?: {
1431
+ cars: linkOrCid[];
1432
+ }[];
1433
+ readonly operations?: {
1434
+ cars: linkOrCid[];
1435
+ }[];
1436
+ }
1437
+ type CARDecodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise<Result<Uint8Array>>;
1438
+ type FILEDecodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise<Result<Uint8Array>>;
1439
+ type METADecodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise<Result<SerializedMeta[]>>;
1440
+ type WALDecodeEnvelope = (sthis: SuperThis, payload: Uint8Array) => Promise<Result<SerializedWAL>>;
1441
+ interface Decoder {
1442
+ readonly car: CARDecodeEnvelope;
1443
+ readonly file: FILEDecodeEnvelope;
1444
+ readonly meta: METADecodeEnvelope;
1445
+ readonly wal: WALDecodeEnvelope;
1446
+ }
1447
+ declare function fpDeserialize<S>(sthis: SuperThis, url: URI, intoRaw: PromiseToUInt8, pdecoder?: Partial<Decoder>): Promise<Result<FPEnvelope<S>>>;
1448
+
1449
+ interface KeyBagCtx {
1450
+ readonly dirName: string;
1451
+ readonly sysFS: SysFileSystem;
1452
+ readonly fName: string;
1453
+ }
1454
+ declare class KeyBagProviderFile implements KeyBagProvider {
1455
+ _prepare(id: string): Promise<KeyBagCtx>;
1456
+ private readonly url;
1457
+ readonly logger: Logger;
1458
+ readonly sthis: SuperThis;
1459
+ constructor(url: URI, sthis: SuperThis);
1460
+ get(id: string): Promise<KeyItem | undefined>;
1461
+ set(id: string, item: KeyItem): Promise<void>;
1462
+ }
1463
+
1464
+ declare function sysFileSystemFactory(uri: URI): Promise<SysFileSystem>;
1465
+
1466
+ type index$2_KeyBagProviderFile = KeyBagProviderFile;
1467
+ declare const index$2_KeyBagProviderFile: typeof KeyBagProviderFile;
1468
+ declare const index$2_sysFileSystemFactory: typeof sysFileSystemFactory;
1469
+ declare namespace index$2 {
1470
+ export { index$2_KeyBagProviderFile as KeyBagProviderFile, index$2_sysFileSystemFactory as sysFileSystemFactory };
1471
+ }
1472
+
1473
+ type index$1_CARDecodeEnvelope = CARDecodeEnvelope;
1474
+ type index$1_CAREncodeEnvelope = CAREncodeEnvelope;
1475
+ type index$1_Decoder = Decoder;
1476
+ type index$1_Encoder = Encoder;
1477
+ type index$1_FILEDecodeEnvelope = FILEDecodeEnvelope;
1478
+ type index$1_FILEEncodeEnvelope = FILEEncodeEnvelope;
1479
+ type index$1_METADecodeEnvelope = METADecodeEnvelope;
1480
+ type index$1_METAEncodeEnvelope = METAEncodeEnvelope;
1481
+ type index$1_SerializedMeta = SerializedMeta;
1482
+ type index$1_SerializedWAL = SerializedWAL;
1483
+ type index$1_WALDecodeEnvelope = WALDecodeEnvelope;
1484
+ type index$1_WALEncodeEnvelope = WALEncodeEnvelope;
1485
+ declare const index$1_fpDeserialize: typeof fpDeserialize;
1486
+ declare const index$1_fpSerialize: typeof fpSerialize;
1087
1487
  declare namespace index$1 {
1088
- export { index$1_block as block, codecInterface as codec };
1488
+ export { type index$1_CARDecodeEnvelope as CARDecodeEnvelope, type index$1_CAREncodeEnvelope as CAREncodeEnvelope, type index$1_Decoder as Decoder, type index$1_Encoder as Encoder, type index$1_FILEDecodeEnvelope as FILEDecodeEnvelope, type index$1_FILEEncodeEnvelope as FILEEncodeEnvelope, type index$1_METADecodeEnvelope as METADecodeEnvelope, type index$1_METAEncodeEnvelope as METAEncodeEnvelope, type index$1_SerializedMeta as SerializedMeta, type index$1_SerializedWAL as SerializedWAL, type index$1_WALDecodeEnvelope as WALDecodeEnvelope, type index$1_WALEncodeEnvelope as WALEncodeEnvelope, index$2 as file, index$1_fpDeserialize as fpDeserialize, index$1_fpSerialize as fpSerialize };
1089
1489
  }
1090
1490
 
1091
1491
  declare const FILESTORE_VERSION = "v0.19-file";
@@ -1094,15 +1494,28 @@ declare const INDEXDB_VERSION = "v0.19-indexdb";
1094
1494
 
1095
1495
  declare const index_FILESTORE_VERSION: typeof FILESTORE_VERSION;
1096
1496
  declare const index_INDEXDB_VERSION: typeof INDEXDB_VERSION;
1497
+ type index_KeyBackProviderFactory = KeyBackProviderFactory;
1498
+ type index_KeyBag = KeyBag;
1499
+ declare const index_KeyBag: typeof KeyBag;
1500
+ type index_KeyBagFile = KeyBagFile;
1501
+ type index_KeyBagOpts = KeyBagOpts;
1502
+ type index_KeyBagProvider = KeyBagProvider;
1503
+ type index_KeyBagProviderFactoryItem = KeyBagProviderFactoryItem;
1504
+ type index_KeyBagRuntime = KeyBagRuntime;
1505
+ type index_KeyItem = KeyItem;
1506
+ declare const index_defaultKeyBagOpts: typeof defaultKeyBagOpts;
1507
+ declare const index_defaultKeyBagUrl: typeof defaultKeyBagUrl;
1097
1508
  declare const index_files: typeof files;
1098
1509
  declare const index_getFileName: typeof getFileName;
1510
+ declare const index_getKeyBag: typeof getKeyBag;
1099
1511
  declare const index_getPath: typeof getPath;
1512
+ declare const index_registerKeyBagProviderFactory: typeof registerKeyBagProviderFactory;
1100
1513
  declare const index_runtimeFn: typeof runtimeFn;
1101
1514
  declare namespace index {
1102
- export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXDB_VERSION as INDEXDB_VERSION, index_files as files, index_getFileName as getFileName, index_getPath as getPath, keyBag as kb, keyedCrypto as kc, index$1 as mf, index_runtimeFn as runtimeFn };
1515
+ export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXDB_VERSION as INDEXDB_VERSION, type index_KeyBackProviderFactory as KeyBackProviderFactory, index_KeyBag as KeyBag, type index_KeyBagFile as KeyBagFile, type index_KeyBagOpts as KeyBagOpts, type index_KeyBagProvider as KeyBagProvider, type index_KeyBagProviderFactoryItem as KeyBagProviderFactoryItem, type index_KeyBagRuntime as KeyBagRuntime, type index_KeyItem as KeyItem, index_defaultKeyBagOpts as defaultKeyBagOpts, index_defaultKeyBagUrl as defaultKeyBagUrl, index_files as files, index_getFileName as getFileName, index_getKeyBag as getKeyBag, index_getPath as getPath, index$1 as gw, keyBag as kb, keyedCrypto as kc, index$3 as mf, index_registerKeyBagProviderFactory as registerKeyBagProviderFactory, index_runtimeFn as runtimeFn };
1103
1516
  }
1104
1517
 
1105
1518
  declare const PACKAGE_VERSION: string;
1106
1519
 
1107
- 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, onSuperThis, index as rt, index as runtime, throwFalsy };
1520
+ export { type AllDocsQueryOpts, type AllDocsResponse, type BulkResponse, CRDT, type CRDTEntry, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, type DbMeta, 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 FPStats, type Falsy, type FileTransactionMeta, type HasCRDT, type IdxMeta, type IdxMetaMap, Index, type IndexKey, type IndexKeyType, type IndexRow, type IndexRows, type IndexTransactionMeta, type IndexUpdate, type IndexUpdateString, type Joiner, type KeyLiteral, type Ledger, LedgerFactory, type LedgerOpts, LedgerShell, type ListenerFn, type MapFn, type MetaType, type NoUpdateListenerFn, NotFoundError, PACKAGE_VERSION, PARAM, type PathOps, type PromiseToUInt8, type QueryOpts, type Store, type StoreType, type SuperThis, type SuperThisOpts, type SysFileSystem, type TextEndeCoder, type ToUInt8, UInt8ArrayEqual, type UnknownDoc, type UpdateListenerFn, index$5 as blockstore, index$5 as bs, coerceIntoUint8, coercePromiseIntoUint8, defaultWriteQueueOpts, ensureLogger, ensureSuperLog, ensureSuperThis, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$4 as index, inplaceFilter, isFalsy, isLedger, isNotFoundError, keyConfigOpts, onSuperThis, index as rt, index as runtime, throwFalsy, toSortedArray, toStoreURIRuntime };
1108
1521
  declare module '@fireproof/core'