@fireproof/core 0.19.9-dev-frag → 0.19.11-dev-dryrun2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +27 -0
- package/{chunk-YS4GL6OK.js → chunk-OFGPKRCM.js} +30 -6
- package/chunk-OFGPKRCM.js.map +1 -0
- package/{chunk-JO5AVWG7.js → chunk-WS3YRPIA.js} +14 -6
- package/chunk-WS3YRPIA.js.map +1 -0
- package/deno.json +20 -0
- package/{gateway-YSNUK2L3.js → gateway-5FCWPX5W.js} +4 -5
- package/{gateway-YSNUK2L3.js.map → gateway-5FCWPX5W.js.map} +1 -1
- package/{gateway-IZRHJWPE.js → gateway-H7UD6TNB.js} +3 -4
- package/gateway-H7UD6TNB.js.map +1 -0
- package/index.cjs +468 -338
- package/index.cjs.map +1 -1
- package/index.d.cts +80 -52
- package/index.d.ts +80 -52
- package/index.global.js +21378 -15079
- package/index.global.js.map +1 -1
- package/index.js +389 -293
- package/index.js.map +1 -1
- package/{key-bag-file-NMEBFSPM.js → key-bag-file-WADZBHYG.js} +3 -3
- package/{key-bag-indexdb-X5V6GNBZ.js → key-bag-indexdb-PGVAI3FJ.js} +3 -3
- package/key-bag-indexdb-PGVAI3FJ.js.map +1 -0
- package/{mem-filesystem-B6C6QOIP.js → mem-filesystem-YPPJV7Q2.js} +3 -3
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/metafile-iife.json +1 -1
- package/{node-filesystem-5JLBSHKQ.js → node-filesystem-INX4ZTHE.js} +8 -4
- package/node-filesystem-INX4ZTHE.js.map +1 -0
- package/package.json +8 -5
- package/tests/blockstore/keyed-crypto.test.ts +34 -4
- package/tests/blockstore/store.test.ts +18 -13
- package/tests/fireproof/all-gateway.test.ts +394 -0
- package/tests/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.car +0 -0
- package/tests/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.ts +316 -0
- package/tests/fireproof/fireproof.test.ts +18 -18
- package/tests/fireproof/hello.test.ts +33 -19
- package/tests/fireproof/utils.test.ts +19 -0
- package/tests/helpers.ts +7 -4
- package/tests/www/todo-local.html +1 -1
- package/tests/www/todo.html +12 -15
- package/{utils-IZPK4QS7.js → utils-QO2HIWGI.js} +3 -3
- package/chunk-JO5AVWG7.js.map +0 -1
- package/chunk-YS4GL6OK.js.map +0 -1
- package/gateway-IZRHJWPE.js.map +0 -1
- package/key-bag-indexdb-X5V6GNBZ.js.map +0 -1
- package/node-filesystem-5JLBSHKQ.js.map +0 -1
- /package/{key-bag-file-NMEBFSPM.js.map → key-bag-file-WADZBHYG.js.map} +0 -0
- /package/{mem-filesystem-B6C6QOIP.js.map → mem-filesystem-YPPJV7Q2.js.map} +0 -0
- /package/{utils-IZPK4QS7.js.map → utils-QO2HIWGI.js.map} +0 -0
package/index.d.cts
CHANGED
@@ -1,17 +1,15 @@
|
|
1
|
-
import
|
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
|
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
|
-
|
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
|
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
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
readonly
|
154
|
-
|
155
|
-
|
156
|
-
|
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
|
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<
|
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
|
-
|
402
|
-
|
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;
|
@@ -420,7 +441,7 @@ interface WALState {
|
|
420
441
|
}
|
421
442
|
interface WALStore extends BaseStore {
|
422
443
|
readonly storeType: "wal";
|
423
|
-
ready
|
444
|
+
ready(): Promise<void>;
|
424
445
|
readonly processing?: Promise<void> | undefined;
|
425
446
|
readonly processQueue: CommitQueue<void>;
|
426
447
|
process(): Promise<void>;
|
@@ -466,14 +487,20 @@ interface Loadable {
|
|
466
487
|
remoteCarStore?: DataStore;
|
467
488
|
carStore(): Promise<DataStore>;
|
468
489
|
carLog: CarLog;
|
469
|
-
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;
|
@@ -483,6 +510,7 @@ type VoidResult = Result<void>;
|
|
483
510
|
interface TestGateway {
|
484
511
|
get(url: URI, key: string): Promise<Uint8Array>;
|
485
512
|
}
|
513
|
+
type UnsubscribeResult = Result<() => void>;
|
486
514
|
interface Gateway {
|
487
515
|
buildUrl(baseUrl: URI, key: string): Promise<Result<URI>>;
|
488
516
|
start(baseUrl: URI): Promise<Result<URI>>;
|
@@ -491,6 +519,7 @@ interface Gateway {
|
|
491
519
|
put(url: URI, body: Uint8Array): Promise<VoidResult>;
|
492
520
|
get(url: URI): Promise<GetResult>;
|
493
521
|
delete(url: URI): Promise<VoidResult>;
|
522
|
+
subscribe?(url: URI, callback: (meta: Uint8Array) => void): Promise<UnsubscribeResult>;
|
494
523
|
}
|
495
524
|
|
496
525
|
interface GatewayFactoryItem {
|
@@ -526,21 +555,10 @@ declare class FragmentGateway implements Gateway {
|
|
526
555
|
close(url: URI): Promise<VoidResult>;
|
527
556
|
put(url: URI, body: Uint8Array): Promise<VoidResult>;
|
528
557
|
get(url: URI): Promise<GetResult>;
|
558
|
+
subscribe(url: URI, callback: (msg: Uint8Array) => void): Promise<UnsubscribeResult>;
|
529
559
|
delete(url: URI): Promise<VoidResult>;
|
530
560
|
}
|
531
561
|
|
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
562
|
interface Connectable {
|
545
563
|
readonly blockstore: {
|
546
564
|
readonly loader?: Loader;
|
@@ -549,8 +567,6 @@ interface Connectable {
|
|
549
567
|
readonly name?: string;
|
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,25 +648,27 @@ 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;
|
638
654
|
type index$3_TestGateway = TestGateway;
|
639
655
|
type index$3_TransactionMeta = TransactionMeta;
|
640
656
|
type index$3_TransactionWrapper<M extends TransactionMeta> = TransactionWrapper<M>;
|
657
|
+
type index$3_UnsubscribeResult = UnsubscribeResult;
|
641
658
|
type index$3_VoidResult = VoidResult;
|
642
659
|
type index$3_WALState = WALState;
|
643
660
|
type index$3_WALStore = WALStore;
|
661
|
+
declare const index$3_addCryptoKeyToGatewayMetaPayload: typeof addCryptoKeyToGatewayMetaPayload;
|
644
662
|
declare const index$3_ensureStart: typeof ensureStart;
|
645
663
|
declare const index$3_getGatewayFromURL: typeof getGatewayFromURL;
|
646
664
|
declare const index$3_parseCarFile: typeof parseCarFile;
|
647
665
|
declare const index$3_registerStoreProtocol: typeof registerStoreProtocol;
|
666
|
+
declare const index$3_setCryptoKeyFromGatewayMetaPayload: typeof setCryptoKeyFromGatewayMetaPayload;
|
648
667
|
declare const index$3_testStoreFactory: typeof testStoreFactory;
|
649
668
|
declare const index$3_toCIDBlock: typeof toCIDBlock;
|
650
669
|
declare const index$3_toStoreRuntime: typeof toStoreRuntime;
|
651
670
|
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$
|
671
|
+
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 };
|
653
672
|
}
|
654
673
|
|
655
674
|
type Falsy = false | null | undefined;
|
@@ -701,6 +720,9 @@ interface SuperThis {
|
|
701
720
|
str: string;
|
702
721
|
bin: Uint8Array;
|
703
722
|
};
|
723
|
+
timeOrderedNextId(time?: number): {
|
724
|
+
str: string;
|
725
|
+
};
|
704
726
|
start(): Promise<void>;
|
705
727
|
clone(override: Partial<SuperThisOpts>): SuperThis;
|
706
728
|
}
|
@@ -836,6 +858,11 @@ interface DocResponse {
|
|
836
858
|
type UpdateListenerFn<T extends DocTypes> = (docs: DocWithId<T>[]) => Promise<void> | void;
|
837
859
|
type NoUpdateListenerFn = () => Promise<void> | void;
|
838
860
|
type ListenerFn<T extends DocTypes> = UpdateListenerFn<T> | NoUpdateListenerFn;
|
861
|
+
interface CRDTEntry {
|
862
|
+
data: string;
|
863
|
+
parents: string[];
|
864
|
+
cid: string;
|
865
|
+
}
|
839
866
|
|
840
867
|
interface WriteQueue<T extends DocTypes> {
|
841
868
|
push(task: DocUpdate<T>): Promise<MetaType>;
|
@@ -921,7 +948,7 @@ declare class CRDTClock<T extends DocTypes> {
|
|
921
948
|
readonly emptyWatchers: Set<() => void>;
|
922
949
|
readonly blockstore: BaseBlockstore;
|
923
950
|
readonly applyHeadQueue: ApplyHeadQueue<T>;
|
924
|
-
readonly _ready: ResolveOnce<void
|
951
|
+
readonly _ready: ResolveOnce<void>;
|
925
952
|
ready(): Promise<void>;
|
926
953
|
close(): Promise<void>;
|
927
954
|
readonly logger: Logger;
|
@@ -941,13 +968,13 @@ declare class CRDT<T extends DocTypes> {
|
|
941
968
|
readonly opts: ConfigOpts;
|
942
969
|
readonly blockstore: BaseBlockstore;
|
943
970
|
readonly indexBlockstore: BaseBlockstore;
|
944
|
-
readonly indexers: Map<string, Index<IndexKeyType,
|
971
|
+
readonly indexers: Map<string, Index<IndexKeyType, NonNullable<unknown>>>;
|
945
972
|
readonly clock: CRDTClock<T>;
|
946
973
|
readonly logger: Logger;
|
947
974
|
readonly sthis: SuperThis;
|
948
975
|
constructor(sthis: SuperThis, name?: string, opts?: ConfigOpts);
|
949
976
|
bulk(updates: DocUpdate<T>[]): Promise<CRDTMeta>;
|
950
|
-
readonly onceReady: ResolveOnce<void
|
977
|
+
readonly onceReady: ResolveOnce<void>;
|
951
978
|
ready(): Promise<void>;
|
952
979
|
close(): Promise<void>;
|
953
980
|
destroy(): Promise<void>;
|
@@ -966,7 +993,7 @@ declare class CRDT<T extends DocTypes> {
|
|
966
993
|
}
|
967
994
|
|
968
995
|
declare class Database<DT extends DocTypes = NonNullable<unknown>> implements Connectable {
|
969
|
-
static databases: Map<string, Database
|
996
|
+
static databases: Map<string, Database>;
|
970
997
|
readonly name?: string;
|
971
998
|
readonly opts: ConfigOpts;
|
972
999
|
_listening: boolean;
|
@@ -977,7 +1004,7 @@ declare class Database<DT extends DocTypes = NonNullable<unknown>> implements Co
|
|
977
1004
|
readonly blockstore: BaseBlockstore;
|
978
1005
|
close(): Promise<void>;
|
979
1006
|
destroy(): Promise<void>;
|
980
|
-
readonly _ready: ResolveOnce<void
|
1007
|
+
readonly _ready: ResolveOnce<void>;
|
981
1008
|
ready(): Promise<void>;
|
982
1009
|
readonly logger: Logger;
|
983
1010
|
readonly sthis: SuperThis;
|
@@ -1095,12 +1122,13 @@ declare const index_files: typeof files;
|
|
1095
1122
|
declare const index_getFileName: typeof getFileName;
|
1096
1123
|
declare const index_getFileSystem: typeof getFileSystem;
|
1097
1124
|
declare const index_getPath: typeof getPath;
|
1125
|
+
declare const index_runtimeFn: typeof runtimeFn;
|
1098
1126
|
declare const index_toArrayBuffer: typeof toArrayBuffer;
|
1099
1127
|
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 };
|
1128
|
+
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
1129
|
}
|
1102
1130
|
|
1103
1131
|
declare const PACKAGE_VERSION: string;
|
1104
1132
|
|
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,
|
1133
|
+
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
1134
|
declare module '@fireproof/core'
|