@fireproof/core 0.20.0-dev-preview-41 → 0.20.0-dev-preview-51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deno.json +3 -2
- package/index.cjs +576 -342
- package/index.cjs.map +1 -1
- package/index.d.cts +210 -101
- package/index.d.ts +210 -101
- package/index.js +597 -362
- package/index.js.map +1 -1
- package/indexeddb/index.cjs.map +1 -1
- package/indexeddb/index.js.map +1 -1
- package/indexeddb/metafile-cjs.json +1 -1
- package/indexeddb/metafile-esm.json +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +6 -4
- package/react/index.cjs.map +1 -1
- package/react/index.d.cts +3 -3
- package/react/index.d.ts +3 -3
- package/react/metafile-cjs.json +1 -1
- package/react/metafile-esm.json +1 -1
- package/tests/blockstore/interceptor-gateway.test.ts +11 -1
- package/tests/blockstore/keyed-crypto.test.ts +24 -23
- package/tests/blockstore/loader.test.ts +2 -2
- package/tests/blockstore/store.test.ts +8 -9
- package/tests/fireproof/all-gateway.test.ts +4 -4
- package/tests/fireproof/attachable.test.ts +295 -21
- package/tests/fireproof/crdt.test.ts +52 -13
- package/tests/fireproof/database.test.ts +79 -25
- package/tests/fireproof/fireproof.test.ts +24 -19
- package/tests/fireproof/stable-cid.test.ts +69 -0
- package/tests/fireproof/utils.test.ts +17 -7
- package/tests/gateway/file/loader-config.test.ts +8 -8
- package/tests/gateway/fp-envelope-serialize.test.ts +8 -8
- package/tests/gateway/indexeddb/loader-config.test.ts +2 -2
- package/tests/helpers.ts +8 -7
- package/tests/react/useFireproof.test.tsx +19 -13
package/index.d.cts
CHANGED
@@ -1,36 +1,13 @@
|
|
1
|
-
import { Logger, Future, Result, ResolveOnce, URI, ResolveSeq, CoerceURI, CryptoRuntime, CTCryptoKey, EnvFactoryOpts, Env, runtimeFn } from '@adviser/cement';
|
1
|
+
import { Logger, Future, Result, ResolveOnce, URI, ResolveSeq, CoerceURI, CryptoRuntime, CTCryptoKey, LRUSet, EnvFactoryOpts, Env, runtimeFn } from '@adviser/cement';
|
2
2
|
import { EventLink } from '@fireproof/vendor/@web3-storage/pail/clock/api';
|
3
3
|
import { Operation } from '@fireproof/vendor/@web3-storage/pail/crdt/api';
|
4
|
-
import {
|
4
|
+
import { Version, Block as Block$1, UnknownLink, CID, ByteView, ArrayBufferView, Link, MultihashHasher, BlockView } from 'multiformats';
|
5
5
|
import { BlockFetcher as BlockFetcher$1 } from '@fireproof/vendor/@web3-storage/pail/api';
|
6
6
|
import { EventBlock } from '@fireproof/vendor/@web3-storage/pail/clock';
|
7
|
-
import { CarReader } from '@ipld/car';
|
8
7
|
import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
|
9
|
-
import { CarReader as CarReader$1 } from '@ipld/car/reader';
|
10
8
|
import { SuperThis as SuperThis$1 } from '@fireproof/core';
|
11
9
|
import { Block as Block$2 } from 'multiformats/block';
|
12
10
|
|
13
|
-
interface BlockEncoder<Code extends number, T> {
|
14
|
-
name: string;
|
15
|
-
code: Code;
|
16
|
-
encode(data: T): ByteView<T> | PromiseLike<ByteView<T>>;
|
17
|
-
}
|
18
|
-
interface BlockDecoder<Code extends number, T> {
|
19
|
-
code: Code;
|
20
|
-
decode(bytes: ByteView<T> | ArrayBufferView<T>): T | PromiseLike<T>;
|
21
|
-
}
|
22
|
-
interface BlockCodec<Code extends number, T> extends BlockEncoder<Code, T>, BlockDecoder<Code, T> {
|
23
|
-
}
|
24
|
-
|
25
|
-
declare const codecInterface_ArrayBufferView: typeof ArrayBufferView;
|
26
|
-
type codecInterface_BlockCodec<Code extends number, T> = BlockCodec<Code, T>;
|
27
|
-
type codecInterface_BlockDecoder<Code extends number, T> = BlockDecoder<Code, T>;
|
28
|
-
type codecInterface_BlockEncoder<Code extends number, T> = BlockEncoder<Code, T>;
|
29
|
-
declare const codecInterface_ByteView: typeof ByteView;
|
30
|
-
declare namespace codecInterface {
|
31
|
-
export { codecInterface_ArrayBufferView as ArrayBufferView, type codecInterface_BlockCodec as BlockCodec, type codecInterface_BlockDecoder as BlockDecoder, type codecInterface_BlockEncoder as BlockEncoder, codecInterface_ByteView as ByteView };
|
32
|
-
}
|
33
|
-
|
34
11
|
type BlockFetcher = BlockFetcher$1;
|
35
12
|
interface CarTransactionOpts {
|
36
13
|
readonly add: boolean;
|
@@ -44,6 +21,7 @@ declare class CarTransactionImpl implements CarMakeable, CarTransaction {
|
|
44
21
|
superGet(cid: AnyLink): Promise<AnyBlock | undefined>;
|
45
22
|
put(cid: AnyLink, block: Uint8Array): Promise<void>;
|
46
23
|
putSync(cid: UnknownLink, bytes: Uint8Array<ArrayBufferLike>): void;
|
24
|
+
unshift(cid: UnknownLink, bytes: Uint8Array<ArrayBufferLike>): void;
|
47
25
|
entries(): AsyncIterableIterator<AnyBlock>;
|
48
26
|
}
|
49
27
|
declare class BaseBlockstoreImpl implements BlockFetcher {
|
@@ -201,13 +179,18 @@ declare namespace keyBag {
|
|
201
179
|
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_KeysItem as KeysItem, type keyBag_V1StorageKeyItem as V1StorageKeyItem, type keyBag_V2StorageKeyItem as V2StorageKeyItem, keyBag_defaultKeyBagOpts as defaultKeyBagOpts, keyBag_defaultKeyBagUrl as defaultKeyBagUrl, keyBag_getKeyBag as getKeyBag, keyBag_keysByFingerprint as keysByFingerprint, keyBag_registerKeyBagProviderFactory as registerKeyBagProviderFactory, keyBag_toKeyWithFingerPrint as toKeyWithFingerPrint };
|
202
180
|
}
|
203
181
|
|
182
|
+
interface TaskManagerParams {
|
183
|
+
readonly removeAfter: number;
|
184
|
+
readonly retryTimeout: number;
|
185
|
+
}
|
204
186
|
declare class TaskManager {
|
205
187
|
private readonly eventsWeHandled;
|
206
188
|
private queue;
|
207
189
|
private isProcessing;
|
208
190
|
readonly logger: Logger;
|
191
|
+
readonly params: TaskManagerParams;
|
209
192
|
readonly callback: (dbMeta: DbMeta, store: ActiveStore) => Promise<void>;
|
210
|
-
constructor(sthis: SuperThis, callback: (dbMeta: DbMeta, store: ActiveStore) => Promise<void
|
193
|
+
constructor(sthis: SuperThis, callback: (dbMeta: DbMeta, store: ActiveStore) => Promise<void>, params: TaskManagerParams);
|
211
194
|
handleEvent(cid: CarClockLink, parents: CarClockHead, dbMeta: DbMeta, store: ActiveStore): Promise<void>;
|
212
195
|
private processQueue;
|
213
196
|
}
|
@@ -218,7 +201,8 @@ declare function ensureSuperLog(sthis: SuperThis, componentName: string, ctx?: R
|
|
218
201
|
declare function ensureLogger(sthis: SuperThis, componentName: string, ctx?: Record<string, unknown>): Logger;
|
219
202
|
type Joiner = (...toJoin: string[]) => string;
|
220
203
|
interface Store {
|
221
|
-
readonly
|
204
|
+
readonly pathPart: "data" | "wal" | "meta";
|
205
|
+
readonly fromUrl: StoreType;
|
222
206
|
readonly name: string;
|
223
207
|
}
|
224
208
|
declare function getStore(url: URI, sthis: SuperThis, joiner: Joiner): Store;
|
@@ -235,6 +219,11 @@ declare function toSortedArray(set?: Record<string, unknown>): Record<string, un
|
|
235
219
|
declare function coerceIntoUint8(raw: ToUInt8): Result<Uint8Array>;
|
236
220
|
declare function coercePromiseIntoUint8(raw: PromiseToUInt8): Promise<Result<Uint8Array>>;
|
237
221
|
declare function makeName(fnString: string): string;
|
222
|
+
declare function storeType2DataMetaWal(store: StoreType): "data" | "wal" | "meta";
|
223
|
+
declare function ensureURIDefaults(sthis: SuperThis, name: string, curi: CoerceURI | undefined, uri: URI, store: StoreType, ctx?: Partial<{
|
224
|
+
readonly idx: boolean;
|
225
|
+
readonly file: boolean;
|
226
|
+
}>): URI;
|
238
227
|
|
239
228
|
declare const FPEnvelopeTypes: {
|
240
229
|
readonly CAR: "car";
|
@@ -390,9 +379,56 @@ declare class Context {
|
|
390
379
|
delete(key: string): void;
|
391
380
|
}
|
392
381
|
|
382
|
+
interface BlockEncoder<Code extends number, T> {
|
383
|
+
readonly name: string;
|
384
|
+
readonly code: Code;
|
385
|
+
bytesToHash?(data: T): ByteView<unknown>;
|
386
|
+
encode(data: T): ByteView<T>;
|
387
|
+
}
|
388
|
+
interface AsyncBlockEncoder<Code extends number, T> {
|
389
|
+
readonly name: string;
|
390
|
+
readonly code: Code;
|
391
|
+
bytesToHash?(data: T): Promise<ByteView<unknown>>;
|
392
|
+
encode(data: T): PromiseLike<ByteView<T>>;
|
393
|
+
}
|
394
|
+
interface BlockDecoder<Code extends number, T> {
|
395
|
+
readonly code: Code;
|
396
|
+
valueToHashBytes?(value: T): ByteView<unknown>;
|
397
|
+
decode(bytes: ByteView<unknown>): T;
|
398
|
+
}
|
399
|
+
interface AsyncBlockDecoder<Code extends number, T> {
|
400
|
+
readonly code: Code;
|
401
|
+
valueToHashBytes?(value: T): Promise<ByteView<unknown>>;
|
402
|
+
decode(bytes: ByteView<unknown>): PromiseLike<T>;
|
403
|
+
}
|
404
|
+
interface BlockCodec<Code extends number, E, D> extends BlockEncoder<Code, E>, BlockDecoder<Code, D> {
|
405
|
+
}
|
406
|
+
interface AsyncBlockCodec<Code extends number, E, D> extends AsyncBlockEncoder<Code, E>, AsyncBlockDecoder<Code, D> {
|
407
|
+
}
|
408
|
+
|
409
|
+
declare const codecInterface_ArrayBufferView: typeof ArrayBufferView;
|
410
|
+
type codecInterface_AsyncBlockCodec<Code extends number, E, D> = AsyncBlockCodec<Code, E, D>;
|
411
|
+
type codecInterface_AsyncBlockDecoder<Code extends number, T> = AsyncBlockDecoder<Code, T>;
|
412
|
+
type codecInterface_AsyncBlockEncoder<Code extends number, T> = AsyncBlockEncoder<Code, T>;
|
413
|
+
type codecInterface_BlockCodec<Code extends number, E, D> = BlockCodec<Code, E, D>;
|
414
|
+
type codecInterface_BlockDecoder<Code extends number, T> = BlockDecoder<Code, T>;
|
415
|
+
type codecInterface_BlockEncoder<Code extends number, T> = BlockEncoder<Code, T>;
|
416
|
+
declare const codecInterface_ByteView: typeof ByteView;
|
417
|
+
declare namespace codecInterface {
|
418
|
+
export { codecInterface_ArrayBufferView as ArrayBufferView, type codecInterface_AsyncBlockCodec as AsyncBlockCodec, type codecInterface_AsyncBlockDecoder as AsyncBlockDecoder, type codecInterface_AsyncBlockEncoder as AsyncBlockEncoder, type codecInterface_BlockCodec as BlockCodec, type codecInterface_BlockDecoder as BlockDecoder, type codecInterface_BlockEncoder as BlockEncoder, codecInterface_ByteView as ByteView };
|
419
|
+
}
|
420
|
+
|
393
421
|
type AnyLink = Link<unknown, number, number, Version>;
|
394
422
|
type CarGroup = AnyLink[];
|
395
|
-
type
|
423
|
+
type FroozenCarLog = CarGroup[];
|
424
|
+
declare class CarLog {
|
425
|
+
readonly _logs: CarGroup[];
|
426
|
+
get length(): number;
|
427
|
+
last(): AnyLink[];
|
428
|
+
xunshift(logs: CarGroup): void;
|
429
|
+
update(logs: FroozenCarLog): void;
|
430
|
+
asArray(): FroozenCarLog;
|
431
|
+
}
|
396
432
|
type AnyAnyLink = Link<unknown, number, number, Version>;
|
397
433
|
type AnyLinkFn = (cid: AnyLink) => Promise<AnyBlock | undefined>;
|
398
434
|
interface AnyBlock {
|
@@ -433,8 +469,8 @@ interface CarMakeable {
|
|
433
469
|
get(cid: AnyLink): Promise<AnyBlock | undefined>;
|
434
470
|
}
|
435
471
|
interface CarHeader<T> {
|
436
|
-
readonly cars:
|
437
|
-
readonly compact:
|
472
|
+
readonly cars: FroozenCarLog;
|
473
|
+
readonly compact: FroozenCarLog;
|
438
474
|
readonly meta: T;
|
439
475
|
}
|
440
476
|
interface TransactionWrapper<M extends TransactionMeta> {
|
@@ -481,7 +517,7 @@ interface CryptoAction {
|
|
481
517
|
iv: Uint8Array;
|
482
518
|
tagLength: number;
|
483
519
|
};
|
484
|
-
codec(iv?: Uint8Array, codecOpts?: Partial<CodecOpts>):
|
520
|
+
codec(iv?: Uint8Array, codecOpts?: Partial<CodecOpts>): AsyncBlockCodec<24, Uint8Array, IvKeyIdData>;
|
485
521
|
_decrypt(data: IvAndKeyAndBytes): Promise<Uint8Array>;
|
486
522
|
_encrypt(data: BytesAndKeyWithIv): Promise<Uint8Array>;
|
487
523
|
}
|
@@ -489,9 +525,6 @@ interface BlobLike {
|
|
489
525
|
stream: () => ReadableStream;
|
490
526
|
}
|
491
527
|
interface StoreFactory {
|
492
|
-
makeMetaStore?: (loader: Loadable) => Promise<MetaStore>;
|
493
|
-
makeDataStore?: (loader: Loadable) => Promise<DataStore>;
|
494
|
-
makeWALStore?: (loader: Loadable) => Promise<WALStore>;
|
495
528
|
encodeFile?: (blob: BlobLike) => Promise<{
|
496
529
|
cid: AnyLink;
|
497
530
|
blocks: AnyBlock[];
|
@@ -500,7 +533,8 @@ interface StoreFactory {
|
|
500
533
|
}
|
501
534
|
interface StoreUrls {
|
502
535
|
readonly meta: CoerceURI;
|
503
|
-
readonly
|
536
|
+
readonly car: CoerceURI;
|
537
|
+
readonly file: CoerceURI;
|
504
538
|
readonly wal: CoerceURI;
|
505
539
|
}
|
506
540
|
interface StoreEnDeFile {
|
@@ -546,8 +580,8 @@ interface CommitOpts {
|
|
546
580
|
readonly compact?: boolean;
|
547
581
|
}
|
548
582
|
interface WriteableDataAndMetaStore {
|
549
|
-
file:
|
550
|
-
car:
|
583
|
+
file: FileStore;
|
584
|
+
car: CarStore;
|
551
585
|
meta: MetaStore;
|
552
586
|
}
|
553
587
|
type DataAndMetaStore = Readonly<WriteableDataAndMetaStore>;
|
@@ -599,8 +633,14 @@ interface MetaStore extends BaseStore {
|
|
599
633
|
interface DataSaveOpts {
|
600
634
|
readonly public: boolean;
|
601
635
|
}
|
602
|
-
interface
|
603
|
-
readonly storeType: "
|
636
|
+
interface CarStore extends BaseStore {
|
637
|
+
readonly storeType: "car";
|
638
|
+
load(cid: AnyLink): Promise<AnyBlock>;
|
639
|
+
save(car: AnyBlock, opts?: DataSaveOpts): Promise<void>;
|
640
|
+
remove(cid: AnyLink): Promise<Result<void>>;
|
641
|
+
}
|
642
|
+
interface FileStore extends BaseStore {
|
643
|
+
readonly storeType: "file";
|
604
644
|
load(cid: AnyLink): Promise<AnyBlock>;
|
605
645
|
save(car: AnyBlock, opts?: DataSaveOpts): Promise<void>;
|
606
646
|
remove(cid: AnyLink): Promise<Result<void>>;
|
@@ -647,6 +687,7 @@ interface BlockstoreParams {
|
|
647
687
|
readonly keyBag: KeyBagRuntime;
|
648
688
|
readonly storeUrls: StoreURIs;
|
649
689
|
readonly storeRuntime: StoreRuntime;
|
690
|
+
readonly taskManager: TaskManagerParams;
|
650
691
|
}
|
651
692
|
type BlockstoreOpts = Partial<BlockstoreParams> & {
|
652
693
|
readonly keyBag: KeyBagRuntime;
|
@@ -663,6 +704,7 @@ interface BlockstoreRuntime {
|
|
663
704
|
readonly keyBag: KeyBagRuntime;
|
664
705
|
readonly storeUrls: StoreURIs;
|
665
706
|
readonly gatewayInterceptor?: SerdeGatewayInterceptor;
|
707
|
+
readonly taskManager: TaskManagerParams;
|
666
708
|
readonly meta?: DbMeta;
|
667
709
|
readonly threshold: number;
|
668
710
|
}
|
@@ -673,50 +715,79 @@ interface AttachedStores {
|
|
673
715
|
local(): LocalActiveStore;
|
674
716
|
forRemotes(actionFn: (store: ActiveStore) => Promise<unknown>): Promise<void>;
|
675
717
|
remotes(): ActiveStore[];
|
676
|
-
activate(store: DataAndMetaStore): ActiveStore;
|
718
|
+
activate(store: DataAndMetaStore | CoerceURI): ActiveStore;
|
677
719
|
attach(attached: Attachable): Promise<Attached>;
|
678
720
|
detach(): Promise<void>;
|
679
721
|
}
|
680
|
-
interface
|
681
|
-
local():
|
682
|
-
remotes():
|
683
|
-
}
|
684
|
-
interface
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
722
|
+
interface BaseAttachedStores {
|
723
|
+
local(): BaseStore;
|
724
|
+
remotes(): BaseStore[];
|
725
|
+
}
|
726
|
+
interface CarAttachedStores extends BaseAttachedStores {
|
727
|
+
local(): CarStore;
|
728
|
+
remotes(): CarStore[];
|
729
|
+
}
|
730
|
+
declare abstract class BaseActiveStore {
|
731
|
+
abstract readonly ref: ActiveStore;
|
732
|
+
abstract readonly active: BaseStore;
|
733
|
+
abstract local(): BaseStore;
|
734
|
+
abstract remotes(): BaseStore[];
|
735
|
+
protected abstract readonly xattached: BaseAttachedStores;
|
736
|
+
}
|
737
|
+
interface FileAttachedStores extends BaseAttachedStores {
|
738
|
+
local(): FileStore;
|
739
|
+
remotes(): FileStore[];
|
740
|
+
}
|
741
|
+
declare abstract class CarActiveStore extends BaseActiveStore {
|
742
|
+
protected abstract readonly xattached: CarAttachedStores;
|
743
|
+
abstract local(): CarStore;
|
744
|
+
abstract remotes(): CarStore[];
|
745
|
+
}
|
746
|
+
declare abstract class FileActiveStore extends BaseActiveStore {
|
747
|
+
protected abstract readonly xattached: FileAttachedStores;
|
748
|
+
abstract local(): FileStore;
|
749
|
+
abstract remotes(): FileStore[];
|
750
|
+
}
|
751
|
+
type CIDActiveStore = CarActiveStore | FileActiveStore;
|
752
|
+
interface MetaAttachedStores extends BaseAttachedStores {
|
690
753
|
local(): MetaStore;
|
691
754
|
remotes(): MetaStore[];
|
692
755
|
}
|
693
|
-
|
694
|
-
readonly
|
695
|
-
|
696
|
-
|
756
|
+
declare abstract class MetaActiveStore extends BaseActiveStore {
|
757
|
+
protected abstract readonly xattached: MetaAttachedStores;
|
758
|
+
abstract local(): MetaStore;
|
759
|
+
abstract remotes(): MetaStore[];
|
697
760
|
}
|
698
|
-
interface WALAttachedStores {
|
761
|
+
interface WALAttachedStores extends BaseAttachedStores {
|
699
762
|
local(): WALStore;
|
700
763
|
remotes(): WALStore[];
|
701
764
|
}
|
702
|
-
|
703
|
-
readonly
|
704
|
-
|
705
|
-
|
765
|
+
declare abstract class WALActiveStore extends BaseActiveStore {
|
766
|
+
protected abstract readonly xattached: WALAttachedStores;
|
767
|
+
abstract local(): WALStore;
|
768
|
+
abstract remotes(): WALStore[];
|
706
769
|
}
|
707
770
|
interface ActiveStore {
|
708
771
|
readonly active: DataAndMetaAndWalStore;
|
709
772
|
baseStores(): BaseStore[];
|
710
|
-
carStore():
|
711
|
-
fileStore():
|
773
|
+
carStore(): CarActiveStore;
|
774
|
+
fileStore(): FileActiveStore;
|
712
775
|
metaStore(): MetaActiveStore;
|
713
776
|
walStore(): WALActiveStore;
|
714
|
-
|
777
|
+
local(): LocalActiveStore;
|
778
|
+
remotes(): ActiveStore[];
|
779
|
+
readonly xattached: AttachedStores;
|
780
|
+
}
|
781
|
+
interface CarCacheItem {
|
782
|
+
readonly type: "car" | "block";
|
783
|
+
readonly cid: AnyLink;
|
784
|
+
readonly blocks: AnyBlock[];
|
785
|
+
readonly roots: CID[];
|
715
786
|
}
|
716
787
|
interface Loadable {
|
717
788
|
readonly sthis: SuperThis;
|
718
789
|
readonly ebOpts: BlockstoreRuntime;
|
719
|
-
carLog: CarLog;
|
790
|
+
readonly carLog: CarLog;
|
720
791
|
readonly attachedStores: AttachedStores;
|
721
792
|
attach(attached: Attachable): Promise<Attached>;
|
722
793
|
readonly taskManager: TaskManager;
|
@@ -727,8 +798,8 @@ interface Loadable {
|
|
727
798
|
commit<T = TransactionMeta>(t: CarTransaction, done: T, opts: CommitOpts): Promise<CarGroup>;
|
728
799
|
destroy(): Promise<void>;
|
729
800
|
getBlock(cid: AnyLink, store: ActiveStore): Promise<AnyBlock | Falsy>;
|
730
|
-
loadFileCar(cid: AnyLink, store: ActiveStore): Promise<
|
731
|
-
loadCar(cid: AnyLink, store: ActiveStore): Promise<
|
801
|
+
loadFileCar(cid: AnyLink, store: ActiveStore): Promise<CarCacheItem>;
|
802
|
+
loadCar(cid: AnyLink, store: ActiveStore): Promise<CarCacheItem>;
|
732
803
|
commitFiles(t: CarTransaction, done: TransactionMeta): Promise<CarGroup>;
|
733
804
|
entries(cache?: boolean): AsyncIterableIterator<AnyBlock>;
|
734
805
|
}
|
@@ -826,45 +897,43 @@ declare class AttachedRemotesImpl implements AttachedStores {
|
|
826
897
|
|
827
898
|
declare class Loader implements Loadable {
|
828
899
|
readonly ebOpts: BlockstoreRuntime;
|
900
|
+
readonly logger: Logger;
|
829
901
|
readonly commitQueue: CommitQueue<CarGroup>;
|
830
|
-
|
831
|
-
readonly
|
832
|
-
readonly
|
833
|
-
readonly
|
902
|
+
isCompacting: boolean;
|
903
|
+
private readonly cidCache;
|
904
|
+
private readonly maxConcurrentCarReader;
|
905
|
+
private readonly maxConcurrentWrite;
|
906
|
+
readonly seenCompacted: LRUSet<string>;
|
834
907
|
readonly sthis: SuperThis;
|
835
908
|
readonly taskManager: TaskManager;
|
836
|
-
carLog: CarLog;
|
909
|
+
readonly carLog: CarLog;
|
837
910
|
readonly attachedStores: AttachedStores;
|
838
911
|
attach(attached: Attachable): Promise<Attached>;
|
839
|
-
private getBlockCache;
|
840
912
|
private seenMeta;
|
841
|
-
private writeLimit;
|
842
913
|
keyBag(): Promise<KeyBag>;
|
843
914
|
private readonly onceReady;
|
844
915
|
ready(): Promise<void>;
|
845
916
|
close(): Promise<void>;
|
846
917
|
destroy(): Promise<void>;
|
847
|
-
readonly logger: Logger;
|
848
918
|
constructor(sthis: SuperThis, ebOpts: BlockstoreOpts);
|
849
919
|
handleDbMetasFromStore(metas: DbMeta[], activeStore: ActiveStore): Promise<void>;
|
850
920
|
mergeDbMetaIntoClock(meta: DbMeta, activeStore: ActiveStore): Promise<void>;
|
851
921
|
loadCarHeaderFromMeta<T>(dbm: DbMeta, astore: ActiveStore): Promise<CarHeader<T>>;
|
852
922
|
commitFiles(t: CarTransaction, done: TransactionMeta): Promise<CarGroup>;
|
853
|
-
loadFileCar(cid: AnyLink, store: ActiveStore): Promise<
|
923
|
+
loadFileCar(cid: AnyLink, store: ActiveStore): Promise<CarCacheItem>;
|
854
924
|
commit<T = TransactionMeta>(t: CarTransaction, done: T, opts?: CommitOpts): Promise<CarGroup>;
|
855
|
-
updateCarLog<T>(cids: CarGroup,
|
925
|
+
updateCarLog<T>(cids: CarGroup, cHeader: CarHeader<T>, compact: boolean): Promise<void>;
|
856
926
|
cacheTransaction(t: CarTransaction): Promise<void>;
|
857
|
-
cacheCarReader(carCidStr: string, reader: CarReader$1): Promise<void>;
|
858
927
|
removeCidsForCompact(cid: AnyLink, store: ActiveStore): Promise<void>;
|
859
|
-
entries(
|
928
|
+
entries(): AsyncIterableIterator<AnyBlock>;
|
860
929
|
getBlock(cid: AnyLink, store: ActiveStore): Promise<AnyBlock | Falsy>;
|
861
|
-
loadCar(cid: AnyLink, store: ActiveStore): Promise<
|
862
|
-
makeDecoderAndCarReader
|
863
|
-
protected storesLoadCar(
|
930
|
+
loadCar(cid: AnyLink, store: ActiveStore): Promise<CarCacheItem>;
|
931
|
+
private makeDecoderAndCarReader;
|
932
|
+
protected storesLoadCar(carCid: AnyLink, store: CIDActiveStore): Promise<CarCacheItem>;
|
864
933
|
protected getMoreReaders(cids: AnyLink[], store: ActiveStore): Promise<void>;
|
865
934
|
}
|
866
935
|
|
867
|
-
declare function parseCarFile<T>(reader:
|
936
|
+
declare function parseCarFile<T>(reader: CarCacheItem, logger: Logger): Promise<CarHeader<T>>;
|
868
937
|
|
869
938
|
type index$5_ActiveStore = ActiveStore;
|
870
939
|
type index$5_AnyAnyBlock = AnyAnyBlock;
|
@@ -876,6 +945,9 @@ type index$5_AnyLinkFn = AnyLinkFn;
|
|
876
945
|
type index$5_AttachedRemotesImpl = AttachedRemotesImpl;
|
877
946
|
declare const index$5_AttachedRemotesImpl: typeof AttachedRemotesImpl;
|
878
947
|
type index$5_AttachedStores = AttachedStores;
|
948
|
+
type index$5_BaseActiveStore = BaseActiveStore;
|
949
|
+
declare const index$5_BaseActiveStore: typeof BaseActiveStore;
|
950
|
+
type index$5_BaseAttachedStores = BaseAttachedStores;
|
879
951
|
type index$5_BaseBlockstoreImpl = BaseBlockstoreImpl;
|
880
952
|
declare const index$5_BaseBlockstoreImpl: typeof BaseBlockstoreImpl;
|
881
953
|
type index$5_BaseStore = BaseStore;
|
@@ -885,14 +957,21 @@ type index$5_BlockstoreOpts = BlockstoreOpts;
|
|
885
957
|
type index$5_BlockstoreParams = BlockstoreParams;
|
886
958
|
type index$5_BlockstoreRuntime = BlockstoreRuntime;
|
887
959
|
type index$5_BytesAndKeyWithIv = BytesAndKeyWithIv;
|
960
|
+
type index$5_CIDActiveStore = CIDActiveStore;
|
888
961
|
type index$5_CIDBlock = CIDBlock;
|
889
962
|
declare const index$5_Car2FPMsg: typeof Car2FPMsg;
|
963
|
+
type index$5_CarActiveStore = CarActiveStore;
|
964
|
+
declare const index$5_CarActiveStore: typeof CarActiveStore;
|
965
|
+
type index$5_CarAttachedStores = CarAttachedStores;
|
966
|
+
type index$5_CarCacheItem = CarCacheItem;
|
890
967
|
type index$5_CarClockHead = CarClockHead;
|
891
968
|
type index$5_CarClockLink = CarClockLink;
|
892
969
|
type index$5_CarGroup = CarGroup;
|
893
970
|
type index$5_CarHeader<T> = CarHeader<T>;
|
894
971
|
type index$5_CarLog = CarLog;
|
972
|
+
declare const index$5_CarLog: typeof CarLog;
|
895
973
|
type index$5_CarMakeable = CarMakeable;
|
974
|
+
type index$5_CarStore = CarStore;
|
896
975
|
type index$5_CarTransactionImpl = CarTransactionImpl;
|
897
976
|
declare const index$5_CarTransactionImpl: typeof CarTransactionImpl;
|
898
977
|
type index$5_CarTransactionOpts = CarTransactionOpts;
|
@@ -904,12 +983,9 @@ type index$5_CompactionFetcher = CompactionFetcher;
|
|
904
983
|
declare const index$5_CompactionFetcher: typeof CompactionFetcher;
|
905
984
|
type index$5_Connection = Connection;
|
906
985
|
type index$5_CryptoAction = CryptoAction;
|
907
|
-
type index$5_DataActiveStore = DataActiveStore;
|
908
986
|
type index$5_DataAndMetaAndWalStore = DataAndMetaAndWalStore;
|
909
987
|
type index$5_DataAndMetaStore = DataAndMetaStore;
|
910
|
-
type index$5_DataAttachedStores = DataAttachedStores;
|
911
988
|
type index$5_DataSaveOpts = DataSaveOpts;
|
912
|
-
type index$5_DataStore = DataStore;
|
913
989
|
type index$5_DbMeta = DbMeta;
|
914
990
|
type index$5_DbMetaBinary = DbMetaBinary;
|
915
991
|
type index$5_DbMetaEvent = DbMetaEvent;
|
@@ -928,6 +1004,11 @@ declare const index$5_FPEnvelopeTypes: typeof FPEnvelopeTypes;
|
|
928
1004
|
type index$5_FPEnvelopeWAL = FPEnvelopeWAL;
|
929
1005
|
type index$5_FPWALCarsOps = FPWALCarsOps;
|
930
1006
|
declare const index$5_File2FPMsg: typeof File2FPMsg;
|
1007
|
+
type index$5_FileActiveStore = FileActiveStore;
|
1008
|
+
declare const index$5_FileActiveStore: typeof FileActiveStore;
|
1009
|
+
type index$5_FileAttachedStores = FileAttachedStores;
|
1010
|
+
type index$5_FileStore = FileStore;
|
1011
|
+
type index$5_FroozenCarLog = FroozenCarLog;
|
931
1012
|
type index$5_Gateway = Gateway;
|
932
1013
|
type index$5_GatewayOpts = GatewayOpts;
|
933
1014
|
type index$5_GetResult = GetResult;
|
@@ -946,6 +1027,7 @@ declare const index$5_Loader: typeof Loader;
|
|
946
1027
|
type index$5_LocalActiveStore = LocalActiveStore;
|
947
1028
|
type index$5_LocalDataAndMetaAndWalStore = LocalDataAndMetaAndWalStore;
|
948
1029
|
type index$5_MetaActiveStore = MetaActiveStore;
|
1030
|
+
declare const index$5_MetaActiveStore: typeof MetaActiveStore;
|
949
1031
|
type index$5_MetaAttachedStores = MetaAttachedStores;
|
950
1032
|
type index$5_MetaStore = MetaStore;
|
951
1033
|
type index$5_PassThroughGateway = PassThroughGateway;
|
@@ -985,12 +1067,16 @@ type index$5_StoreURIRuntime = StoreURIRuntime;
|
|
985
1067
|
type index$5_StoreURIs = StoreURIs;
|
986
1068
|
type index$5_StoreUrls = StoreUrls;
|
987
1069
|
type index$5_StoreUrlsOpts = StoreUrlsOpts;
|
1070
|
+
type index$5_TaskManager = TaskManager;
|
1071
|
+
declare const index$5_TaskManager: typeof TaskManager;
|
1072
|
+
type index$5_TaskManagerParams = TaskManagerParams;
|
988
1073
|
type index$5_TransactionMeta = TransactionMeta;
|
989
1074
|
type index$5_TransactionWrapper<M extends TransactionMeta> = TransactionWrapper<M>;
|
990
1075
|
type index$5_UnsubscribeResult = UnsubscribeResult;
|
991
1076
|
type index$5_UrlAndInterceptor = UrlAndInterceptor;
|
992
1077
|
type index$5_VoidResult = VoidResult;
|
993
1078
|
type index$5_WALActiveStore = WALActiveStore;
|
1079
|
+
declare const index$5_WALActiveStore: typeof WALActiveStore;
|
994
1080
|
type index$5_WALAttachedStores = WALAttachedStores;
|
995
1081
|
type index$5_WALState = WALState;
|
996
1082
|
type index$5_WALStore = WALStore;
|
@@ -1008,7 +1094,7 @@ declare const index$5_registerStoreProtocol: typeof registerStoreProtocol;
|
|
1008
1094
|
declare const index$5_toCIDBlock: typeof toCIDBlock;
|
1009
1095
|
declare const index$5_toStoreRuntime: typeof toStoreRuntime;
|
1010
1096
|
declare namespace index$5 {
|
1011
|
-
export { type index$5_ActiveStore as ActiveStore, 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_AttachedRemotesImpl as AttachedRemotesImpl, type index$5_AttachedStores as AttachedStores, index$5_BaseBlockstoreImpl as BaseBlockstoreImpl, 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_BytesAndKeyWithIv as BytesAndKeyWithIv, 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,
|
1097
|
+
export { type index$5_ActiveStore as ActiveStore, 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_AttachedRemotesImpl as AttachedRemotesImpl, type index$5_AttachedStores as AttachedStores, index$5_BaseActiveStore as BaseActiveStore, type index$5_BaseAttachedStores as BaseAttachedStores, index$5_BaseBlockstoreImpl as BaseBlockstoreImpl, 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_BytesAndKeyWithIv as BytesAndKeyWithIv, type index$5_CIDActiveStore as CIDActiveStore, type index$5_CIDBlock as CIDBlock, index$5_Car2FPMsg as Car2FPMsg, index$5_CarActiveStore as CarActiveStore, type index$5_CarAttachedStores as CarAttachedStores, type index$5_CarCacheItem as CarCacheItem, type index$5_CarClockHead as CarClockHead, type index$5_CarClockLink as CarClockLink, type index$5_CarGroup as CarGroup, type index$5_CarHeader as CarHeader, index$5_CarLog as CarLog, type index$5_CarMakeable as CarMakeable, type index$5_CarStore as CarStore, index$5_CarTransactionImpl as CarTransactionImpl, type index$5_CarTransactionOpts as CarTransactionOpts, 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, type index$5_CryptoAction as CryptoAction, type index$5_DataAndMetaAndWalStore as DataAndMetaAndWalStore, type index$5_DataAndMetaStore as DataAndMetaStore, type index$5_DataSaveOpts as DataSaveOpts, 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, type index$5_FPEnvelopeType as FPEnvelopeType, index$5_FPEnvelopeTypes as FPEnvelopeTypes, type index$5_FPEnvelopeWAL as FPEnvelopeWAL, type index$5_FPWALCarsOps as FPWALCarsOps, index$5_File2FPMsg as File2FPMsg, index$5_FileActiveStore as FileActiveStore, type index$5_FileAttachedStores as FileAttachedStores, type index$5_FileStore as FileStore, type index$5_FroozenCarLog as FroozenCarLog, 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_IvAndKeyAndBytes as IvAndKeyAndBytes, type index$5_IvKeyIdData as IvKeyIdData, type index$5_KeyMaterial as KeyMaterial, type index$5_KeyUpsertResult as KeyUpsertResult, type index$5_KeyWithFingerPrint as KeyWithFingerPrint, type index$5_KeysByFingerprint as KeysByFingerprint, type index$5_LoadHandler as LoadHandler, type index$5_Loadable as Loadable, index$5_Loader as Loader, type index$5_LocalActiveStore as LocalActiveStore, type index$5_LocalDataAndMetaAndWalStore as LocalDataAndMetaAndWalStore, index$5_MetaActiveStore as MetaActiveStore, type index$5_MetaAttachedStores as MetaAttachedStores, 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_SerdeGatewayCtx as SerdeGatewayCtx, 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, index$5_TaskManager as TaskManager, type index$5_TaskManagerParams as TaskManagerParams, type index$5_TransactionMeta as TransactionMeta, type index$5_TransactionWrapper as TransactionWrapper, type index$5_UnsubscribeResult as UnsubscribeResult, type index$5_UrlAndInterceptor as UrlAndInterceptor, type index$5_VoidResult as VoidResult, index$5_WALActiveStore as WALActiveStore, type index$5_WALAttachedStores as WALAttachedStores, type index$5_WALState as WALState, type index$5_WALStore as WALStore, type index$5_WriteableDataAndMetaAndWalStore as WriteableDataAndMetaAndWalStore, type index$5_WriteableDataAndMetaStore as WriteableDataAndMetaStore, index$5_createAttachedStores as createAttachedStores, 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 };
|
1012
1098
|
}
|
1013
1099
|
|
1014
1100
|
interface WriteQueueParams {
|
@@ -1093,11 +1179,16 @@ declare const PARAM: {
|
|
1093
1179
|
FRAG_HEAD: string;
|
1094
1180
|
EXTRACTKEY: string;
|
1095
1181
|
SELF_REFLECT: string;
|
1182
|
+
CAR_PARALLEL: string;
|
1183
|
+
CAR_CACHE_SIZE: string;
|
1184
|
+
CAR_COMPACT_CACHE_SIZE: string;
|
1185
|
+
CAR_META_CACHE_SIZE: string;
|
1186
|
+
GENESIS_CID: string;
|
1096
1187
|
};
|
1097
1188
|
type PARAMS = (typeof PARAM)[keyof typeof PARAM];
|
1098
1189
|
declare function throwFalsy<T>(value: T | Falsy): T;
|
1099
1190
|
declare function falsyToUndef<T>(value: T | Falsy): T | undefined;
|
1100
|
-
type StoreType = "
|
1191
|
+
type StoreType = "car" | "file" | "wal" | "meta";
|
1101
1192
|
interface FPStats {
|
1102
1193
|
isFile(): boolean;
|
1103
1194
|
isDirectory(): boolean;
|
@@ -1327,6 +1418,7 @@ interface CarTransaction {
|
|
1327
1418
|
readonly parent: BaseBlockstore;
|
1328
1419
|
get<T, C extends number, A extends number, V extends Version>(cid: AnyLink): Promise<Block$1<T, C, A, V> | undefined>;
|
1329
1420
|
superGet(cid: AnyLink): Promise<AnyBlock | undefined>;
|
1421
|
+
unshift(cid: UnknownLink, bytes: Uint8Array<ArrayBufferLike>): void;
|
1330
1422
|
putSync(cid: UnknownLink, bytes: Uint8Array<ArrayBufferLike>): void;
|
1331
1423
|
put(cid: UnknownLink, bytes: Uint8Array<ArrayBufferLike>): Promise<void>;
|
1332
1424
|
entries(): AsyncIterableIterator<AnyBlock>;
|
@@ -1412,8 +1504,8 @@ interface Attachable {
|
|
1412
1504
|
}
|
1413
1505
|
declare class DataAndMetaAndWalAndBaseStore implements DataAndMetaAndWalStore {
|
1414
1506
|
readonly wal?: WALStore | undefined;
|
1415
|
-
readonly file:
|
1416
|
-
readonly car:
|
1507
|
+
readonly file: FileStore;
|
1508
|
+
readonly car: CarStore;
|
1417
1509
|
readonly meta: MetaStore;
|
1418
1510
|
readonly baseStores: BaseStore[];
|
1419
1511
|
constructor(dam: DataAndMetaAndWalStore);
|
@@ -1572,6 +1664,7 @@ declare class CRDTImpl implements CRDT {
|
|
1572
1664
|
readonly crdt: CRDT;
|
1573
1665
|
constructor(sthis: SuperThis, opts: LedgerOpts);
|
1574
1666
|
bulk<T extends DocTypes>(updates: DocUpdate<T>[]): Promise<CRDTMeta>;
|
1667
|
+
_bulk<T extends DocTypes>(updates: DocUpdate<T>[]): Promise<CRDTMeta>;
|
1575
1668
|
readonly onceReady: ResolveOnce<void>;
|
1576
1669
|
ready(): Promise<void>;
|
1577
1670
|
close(): Promise<void>;
|
@@ -1605,15 +1698,17 @@ declare namespace files {
|
|
1605
1698
|
export { files_decodeFile as decodeFile, files_encodeFile as encodeFile };
|
1606
1699
|
}
|
1607
1700
|
|
1608
|
-
declare class BlockIvKeyIdCodec implements
|
1609
|
-
readonly code =
|
1701
|
+
declare class BlockIvKeyIdCodec implements AsyncBlockCodec<24, Uint8Array, IvKeyIdData> {
|
1702
|
+
readonly code = 24;
|
1610
1703
|
readonly name = "Fireproof@encrypted-block:aes-gcm";
|
1611
1704
|
readonly ko: CryptoAction;
|
1612
1705
|
readonly iv?: Uint8Array;
|
1613
1706
|
readonly opts: Partial<CodecOpts>;
|
1614
1707
|
constructor(ko: CryptoAction, iv?: Uint8Array, opts?: CodecOpts);
|
1708
|
+
valueToHashBytes(value: IvKeyIdData): Promise<ByteView<unknown>>;
|
1709
|
+
bytesToHash(data: Uint8Array): Promise<ByteView<unknown>>;
|
1615
1710
|
encode(data: Uint8Array): Promise<Uint8Array>;
|
1616
|
-
decode(abytes: Uint8Array | ArrayBuffer): Promise<
|
1711
|
+
decode(abytes: Uint8Array | ArrayBuffer): Promise<IvKeyIdData>;
|
1617
1712
|
}
|
1618
1713
|
declare function keyedCryptoFactory(url: URI, kb: KeyBag, sthis: SuperThis): Promise<CryptoAction>;
|
1619
1714
|
|
@@ -1626,17 +1721,27 @@ declare namespace keyedCrypto {
|
|
1626
1721
|
|
1627
1722
|
declare const Block: typeof Block$2;
|
1628
1723
|
interface DecodeInput<T, Code extends number, Alg extends number> {
|
1629
|
-
bytes: ByteView<
|
1630
|
-
codec: BlockDecoder<Code, T>;
|
1631
|
-
hasher: MultihashHasher<Alg>;
|
1724
|
+
readonly bytes: ByteView<unknown>;
|
1725
|
+
readonly codec: BlockDecoder<Code, T>;
|
1726
|
+
readonly hasher: MultihashHasher<Alg>;
|
1727
|
+
}
|
1728
|
+
interface AsyncDecodeInput<T, Code extends number, Alg extends number> {
|
1729
|
+
readonly bytes: ByteView<unknown>;
|
1730
|
+
readonly codec: AsyncBlockDecoder<Code, T>;
|
1731
|
+
readonly hasher: MultihashHasher<Alg>;
|
1632
1732
|
}
|
1633
|
-
declare function decode<T, Code extends number, Alg extends number>({ bytes, codec, hasher, }: DecodeInput<T, Code, Alg>): Promise<BlockView<T, Code, Alg>>;
|
1733
|
+
declare function decode<T, Code extends number, Alg extends number>({ bytes, codec, hasher, }: AsyncDecodeInput<T, Code, Alg> | DecodeInput<T, Code, Alg>): Promise<BlockView<T, Code, Alg>>;
|
1634
1734
|
interface EncodeInput<T, Code extends number, Alg extends number> {
|
1635
|
-
value: T;
|
1636
|
-
codec: BlockEncoder<Code, T>;
|
1637
|
-
hasher: MultihashHasher<Alg>;
|
1735
|
+
readonly value: T;
|
1736
|
+
readonly codec: BlockEncoder<Code, T>;
|
1737
|
+
readonly hasher: MultihashHasher<Alg>;
|
1738
|
+
}
|
1739
|
+
interface AsyncEncodeInput<T, Code extends number, Alg extends number> {
|
1740
|
+
readonly value: T;
|
1741
|
+
readonly codec: AsyncBlockEncoder<Code, T>;
|
1742
|
+
readonly hasher: MultihashHasher<Alg>;
|
1638
1743
|
}
|
1639
|
-
declare function encode<T, Code extends number, Alg extends number>({ value, codec, hasher, }: EncodeInput<T, Code, Alg>): Promise<BlockView<T, Code, Alg>>;
|
1744
|
+
declare function encode<T, Code extends number, Alg extends number>({ value, codec, hasher, }: AsyncEncodeInput<T, Code, Alg> | EncodeInput<T, Code, Alg>): Promise<BlockView<T, Code, Alg>>;
|
1640
1745
|
interface CreateInput<T, Code extends number, Alg extends number, V extends Version> {
|
1641
1746
|
bytes: ByteView<T>;
|
1642
1747
|
cid: Link<T, Code, Alg, V>;
|
@@ -1657,13 +1762,17 @@ type CreateUnsafeInput<T, Code extends number, Alg extends number, V extends Ver
|
|
1657
1762
|
};
|
1658
1763
|
declare function createUnsafe<T, Code extends number, Alg extends number, V extends Version>({ bytes, cid, value: maybeValue, codec, }: CreateUnsafeInput<T, Code, Alg, V>): Promise<BlockView<T, Code, Alg, V>>;
|
1659
1764
|
|
1765
|
+
type block_AsyncDecodeInput<T, Code extends number, Alg extends number> = AsyncDecodeInput<T, Code, Alg>;
|
1766
|
+
type block_AsyncEncodeInput<T, Code extends number, Alg extends number> = AsyncEncodeInput<T, Code, Alg>;
|
1660
1767
|
declare const block_Block: typeof Block;
|
1768
|
+
type block_DecodeInput<T, Code extends number, Alg extends number> = DecodeInput<T, Code, Alg>;
|
1769
|
+
type block_EncodeInput<T, Code extends number, Alg extends number> = EncodeInput<T, Code, Alg>;
|
1661
1770
|
declare const block_create: typeof create;
|
1662
1771
|
declare const block_createUnsafe: typeof createUnsafe;
|
1663
1772
|
declare const block_decode: typeof decode;
|
1664
1773
|
declare const block_encode: typeof encode;
|
1665
1774
|
declare namespace block {
|
1666
|
-
export { block_Block as Block, block_create as create, block_createUnsafe as createUnsafe, block_decode as decode, block_encode as encode };
|
1775
|
+
export { type block_AsyncDecodeInput as AsyncDecodeInput, type block_AsyncEncodeInput as AsyncEncodeInput, block_Block as Block, type block_DecodeInput as DecodeInput, type block_EncodeInput as EncodeInput, block_create as create, block_createUnsafe as createUnsafe, block_decode as decode, block_encode as encode };
|
1667
1776
|
}
|
1668
1777
|
|
1669
1778
|
declare const index$3_block: typeof block;
|
@@ -1786,5 +1895,5 @@ declare namespace index {
|
|
1786
1895
|
|
1787
1896
|
declare const PACKAGE_VERSION: string;
|
1788
1897
|
|
1789
|
-
export { type AllDocsQueryOpts, type AllDocsResponse, type Attachable, type Attached, type BaseBlockstore, type BulkResponse, type CRDT, type CRDTClock, type CRDTEntry, CRDTImpl, type CRDTMeta, type CarTransaction, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type CoerceURIandInterceptor, type ConfigOpts, DataAndMetaAndWalAndBaseStore, type Database, DatabaseImpl, 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 GatewayUrls, type GatewayUrlsParam, type HasCRDT, type HasLogger, type HasSuperThis, 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 PARAMS, type PathOps, type PromiseToUInt8, type QueryOpts, type ReadyCloseDestroy, type RefLedger, type Store, type StoreType, type SuperThis, type SuperThisOpts, type SysFileSystem, type TextEndeCoder, type ToUInt8, UInt8ArrayEqual, type UnReg, type UnknownDoc, type UpdateListenerFn, type VoidFn, type WriteQueue, 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, isDatabase, isFalsy, isLedger, isNotFoundError, keyConfigOpts, makeName, onSuperThis, index as rt, index as runtime, throwFalsy, toSortedArray, toStoreURIRuntime };
|
1898
|
+
export { type AllDocsQueryOpts, type AllDocsResponse, type Attachable, type Attached, type BaseBlockstore, type BulkResponse, type CRDT, type CRDTClock, type CRDTEntry, CRDTImpl, type CRDTMeta, type CarTransaction, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type CoerceURIandInterceptor, type ConfigOpts, DataAndMetaAndWalAndBaseStore, type Database, DatabaseImpl, 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 GatewayUrls, type GatewayUrlsParam, type HasCRDT, type HasLogger, type HasSuperThis, 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 PARAMS, type PathOps, type PromiseToUInt8, type QueryOpts, type ReadyCloseDestroy, type RefLedger, type Store, type StoreType, type SuperThis, type SuperThisOpts, type SysFileSystem, type TextEndeCoder, type ToUInt8, UInt8ArrayEqual, type UnReg, type UnknownDoc, type UpdateListenerFn, type VoidFn, type WriteQueue, index$5 as blockstore, index$5 as bs, coerceIntoUint8, coercePromiseIntoUint8, defaultWriteQueueOpts, ensureLogger, ensureSuperLog, ensureSuperThis, ensureURIDefaults, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$4 as index, inplaceFilter, isDatabase, isFalsy, isLedger, isNotFoundError, keyConfigOpts, makeName, onSuperThis, index as rt, index as runtime, storeType2DataMetaWal, throwFalsy, toSortedArray, toStoreURIRuntime };
|
1790
1899
|
declare module '@fireproof/core'
|