@fireproof/core 0.19.121-dev → 0.20.0-dev-preview-05
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +13 -12
- package/deno/index.d.ts +7 -0
- package/deno/index.js +66 -0
- package/deno/index.js.map +1 -0
- package/deno/metafile-esm.json +1 -0
- package/deno.json +3 -4
- package/index.cjs +1797 -1431
- package/index.cjs.map +1 -1
- package/index.d.cts +760 -381
- package/index.d.ts +760 -381
- package/index.js +1976 -913
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/node/{node-filesystem.cjs → index.cjs} +17 -6
- package/node/index.cjs.map +1 -0
- package/node/index.d.cts +7 -0
- package/node/index.d.ts +7 -0
- package/node/{node-filesystem.js → index.js} +25 -5
- package/node/index.js.map +1 -0
- package/node/metafile-cjs.json +1 -1
- package/node/metafile-esm.json +1 -1
- package/package.json +27 -17
- package/react/index.cjs +22 -22
- package/react/index.cjs.map +1 -1
- package/react/index.d.cts +7 -7
- package/react/index.d.ts +7 -7
- package/react/index.js +22 -22
- package/react/index.js.map +1 -1
- package/react/metafile-cjs.json +1 -1
- package/react/metafile-esm.json +1 -1
- package/tests/blockstore/fp-envelope.test.ts-off +65 -0
- package/tests/blockstore/interceptor-gateway.test.ts +122 -0
- package/tests/blockstore/keyed-crypto-indexdb-file.test.ts +130 -0
- package/tests/blockstore/keyed-crypto.test.ts +75 -118
- package/tests/blockstore/loader.test.ts +18 -9
- package/tests/blockstore/store.test.ts +40 -31
- package/tests/blockstore/transaction.test.ts +14 -13
- package/tests/fireproof/all-gateway.test.ts +286 -216
- package/tests/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.ts +324 -316
- package/tests/fireproof/crdt.test.ts +78 -19
- package/tests/fireproof/fireproof.test.ts +111 -92
- package/tests/fireproof/hello.test.ts +21 -17
- package/tests/fireproof/indexer.test.ts +74 -50
- package/tests/fireproof/{database.test.ts → ledger.test.ts} +241 -45
- package/tests/fireproof/multiple-ledger.test.ts +2 -2
- package/tests/fireproof/utils.test.ts +47 -6
- package/tests/gateway/file/loader-config.test.ts +307 -0
- package/tests/gateway/fp-envelope-serialize.test.ts +256 -0
- package/tests/gateway/indexdb/loader-config.test.ts +79 -0
- package/tests/helpers.ts +44 -17
- package/tests/react/useFireproof.test.tsx +2 -2
- package/tests/www/gallery.html +2 -2
- package/tests/www/todo-aws.html +1 -1
- package/tests/www/todo-ipfs.html +1 -1
- package/tests/www/todo-local.html +1 -1
- package/tests/www/todo.html +25 -4
- package/web/index.cjs +218 -0
- package/web/index.cjs.map +1 -0
- package/web/index.d.cts +30 -0
- package/web/index.d.ts +30 -0
- package/web/index.js +195 -0
- package/web/index.js.map +1 -0
- package/web/metafile-cjs.json +1 -1
- package/web/metafile-esm.json +1 -1
- package/chunk-7EWIAXTM.js +0 -7
- package/chunk-7EWIAXTM.js.map +0 -1
- package/chunk-F4FC6B2T.js +0 -63
- package/chunk-F4FC6B2T.js.map +0 -1
- package/chunk-PZ5AY32C.js +0 -10
- package/chunk-PZ5AY32C.js.map +0 -1
- package/chunk-RXC4JGJT.js +0 -301
- package/chunk-RXC4JGJT.js.map +0 -1
- package/gateway-C62S56GY.js +0 -66
- package/gateway-C62S56GY.js.map +0 -1
- package/gateway-VVS4QWDA.js +0 -145
- package/gateway-VVS4QWDA.js.map +0 -1
- package/key-bag-file-PWZ3QE7B.js +0 -55
- package/key-bag-file-PWZ3QE7B.js.map +0 -1
- package/key-bag-indexdb-SYG3YD4D.js +0 -51
- package/key-bag-indexdb-SYG3YD4D.js.map +0 -1
- package/node/chunk-4A4RAVNS.js +0 -17
- package/node/chunk-4A4RAVNS.js.map +0 -1
- package/node/mem-filesystem.cjs +0 -72
- package/node/mem-filesystem.cjs.map +0 -1
- package/node/mem-filesystem.d.cts +0 -25
- package/node/mem-filesystem.d.ts +0 -25
- package/node/mem-filesystem.js +0 -40
- package/node/mem-filesystem.js.map +0 -1
- package/node/node-filesystem.cjs.map +0 -1
- package/node/node-filesystem.d.cts +0 -35
- package/node/node-filesystem.d.ts +0 -35
- package/node/node-filesystem.js.map +0 -1
- package/tests/fireproof/config.test.ts +0 -172
- package/utils-ZVVGAXFE.js +0 -13
- package/utils-ZVVGAXFE.js.map +0 -1
- package/web/gateway-impl.cjs +0 -183
- package/web/gateway-impl.cjs.map +0 -1
- package/web/gateway-impl.d.cts +0 -31
- package/web/gateway-impl.d.ts +0 -31
- package/web/gateway-impl.js +0 -162
- package/web/gateway-impl.js.map +0 -1
- /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,
|
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,
|
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
|
-
import { IDBPDatabase } from 'idb';
|
10
7
|
import { EventBlock } from '@fireproof/vendor/@web3-storage/pail/clock';
|
11
|
-
import {
|
8
|
+
import { CarReader } from '@fireproof/vendor/@ipld/car';
|
12
9
|
import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
|
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>[];
|
@@ -43,53 +99,6 @@ declare class CommitQueue<T = void> {
|
|
43
99
|
processNext(): void;
|
44
100
|
}
|
45
101
|
|
46
|
-
declare function onSuperThis(fn: (sthis: SuperThis) => void): () => void;
|
47
|
-
declare function ensureSuperThis(osthis?: Partial<SuperThisOpts>): SuperThis;
|
48
|
-
declare function ensureSuperLog(sthis: SuperThis, componentName: string, ctx?: Record<string, unknown>): SuperThis;
|
49
|
-
declare function ensureLogger(sthis: SuperThis, componentName: string, ctx?: Record<string, unknown>): Logger;
|
50
|
-
type Joiner = (...toJoin: string[]) => string;
|
51
|
-
interface Store {
|
52
|
-
readonly store: StoreType;
|
53
|
-
readonly name: string;
|
54
|
-
}
|
55
|
-
declare function getStore(url: URI, sthis: SuperThis, joiner: Joiner): Store;
|
56
|
-
declare function getKey(url: URI, logger: Logger): string;
|
57
|
-
declare function getName(sthis: SuperThis, url: URI): string;
|
58
|
-
declare function exceptionWrapper<T, E extends Error>(fn: () => Promise<Result<T, E>>): Promise<Result<T, E>>;
|
59
|
-
declare class NotFoundError extends Error {
|
60
|
-
readonly code = "ENOENT";
|
61
|
-
}
|
62
|
-
declare function isNotFoundError(e: Error | Result<unknown> | unknown): e is NotFoundError;
|
63
|
-
declare function dataDir(sthis: SuperThis, name?: string, base?: CoerceURI): URI;
|
64
|
-
declare function UInt8ArrayEqual(a: Uint8Array, b: Uint8Array): boolean;
|
65
|
-
|
66
|
-
interface KeyBagCtx {
|
67
|
-
readonly dirName: string;
|
68
|
-
readonly sysFS: SysFileSystem;
|
69
|
-
readonly fName: string;
|
70
|
-
}
|
71
|
-
declare class KeyBagProviderFile implements KeyBagProvider {
|
72
|
-
_prepare(id: string): Promise<KeyBagCtx>;
|
73
|
-
private readonly url;
|
74
|
-
readonly logger: Logger;
|
75
|
-
readonly sthis: SuperThis;
|
76
|
-
constructor(url: URI, sthis: SuperThis);
|
77
|
-
get(id: string): Promise<KeyItem | undefined>;
|
78
|
-
set(id: string, item: KeyItem): Promise<void>;
|
79
|
-
}
|
80
|
-
|
81
|
-
declare class KeyBagProviderIndexDB implements KeyBagProvider {
|
82
|
-
readonly _db: ResolveOnce<IDBPDatabase<unknown>>;
|
83
|
-
readonly dbName: string;
|
84
|
-
readonly url: URI;
|
85
|
-
readonly logger: Logger;
|
86
|
-
readonly sthis: SuperThis;
|
87
|
-
constructor(url: URI, sthis: SuperThis);
|
88
|
-
_prepare(): Promise<IDBPDatabase<unknown>>;
|
89
|
-
get(id: string): Promise<KeyItem | undefined>;
|
90
|
-
set(id: string, item: KeyItem): Promise<void>;
|
91
|
-
}
|
92
|
-
|
93
102
|
declare class KeyBag {
|
94
103
|
readonly rt: KeyBagRuntime;
|
95
104
|
readonly logger: Logger;
|
@@ -136,6 +145,7 @@ interface KeyBagProviderFactoryItem {
|
|
136
145
|
}
|
137
146
|
declare function registerKeyBagProviderFactory(item: KeyBagProviderFactoryItem): void;
|
138
147
|
declare function defaultKeyBagUrl(sthis: SuperThis): URI;
|
148
|
+
declare function defaultKeyBagOpts(sthis: SuperThis, kbo?: Partial<KeyBagOpts>): KeyBagRuntime;
|
139
149
|
declare function getKeyBag(sthis: SuperThis, kbo?: Partial<KeyBagOpts>): Promise<KeyBag>;
|
140
150
|
|
141
151
|
type keyBag_KeyBackProviderFactory = KeyBackProviderFactory;
|
@@ -145,17 +155,14 @@ type keyBag_KeyBagFile = KeyBagFile;
|
|
145
155
|
type keyBag_KeyBagOpts = KeyBagOpts;
|
146
156
|
type keyBag_KeyBagProvider = KeyBagProvider;
|
147
157
|
type keyBag_KeyBagProviderFactoryItem = KeyBagProviderFactoryItem;
|
148
|
-
type keyBag_KeyBagProviderFile = KeyBagProviderFile;
|
149
|
-
declare const keyBag_KeyBagProviderFile: typeof KeyBagProviderFile;
|
150
|
-
type keyBag_KeyBagProviderIndexDB = KeyBagProviderIndexDB;
|
151
|
-
declare const keyBag_KeyBagProviderIndexDB: typeof KeyBagProviderIndexDB;
|
152
158
|
type keyBag_KeyBagRuntime = KeyBagRuntime;
|
153
159
|
type keyBag_KeyItem = KeyItem;
|
160
|
+
declare const keyBag_defaultKeyBagOpts: typeof defaultKeyBagOpts;
|
154
161
|
declare const keyBag_defaultKeyBagUrl: typeof defaultKeyBagUrl;
|
155
162
|
declare const keyBag_getKeyBag: typeof getKeyBag;
|
156
163
|
declare const keyBag_registerKeyBagProviderFactory: typeof registerKeyBagProviderFactory;
|
157
164
|
declare namespace keyBag {
|
158
|
-
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,
|
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 };
|
159
166
|
}
|
160
167
|
|
161
168
|
declare class TaskManager {
|
@@ -165,110 +172,127 @@ declare class TaskManager {
|
|
165
172
|
readonly logger: Logger;
|
166
173
|
readonly callback: (dbMeta: DbMeta) => Promise<void>;
|
167
174
|
constructor(sthis: SuperThis, callback: (dbMeta: DbMeta) => Promise<void>);
|
168
|
-
handleEvent(cid: CarClockLink, parents:
|
175
|
+
handleEvent(cid: CarClockLink, parents: CarClockHead, dbMeta: DbMeta): Promise<void>;
|
169
176
|
private processQueue;
|
170
177
|
}
|
171
178
|
|
172
|
-
declare
|
179
|
+
declare function onSuperThis(fn: (sthis: SuperThis) => void): () => void;
|
180
|
+
declare function ensureSuperThis(osthis?: Partial<SuperThisOpts>): SuperThis;
|
181
|
+
declare function ensureSuperLog(sthis: SuperThis, componentName: string, ctx?: Record<string, unknown>): SuperThis;
|
182
|
+
declare function ensureLogger(sthis: SuperThis, componentName: string, ctx?: Record<string, unknown>): Logger;
|
183
|
+
type Joiner = (...toJoin: string[]) => string;
|
184
|
+
interface Store {
|
185
|
+
readonly store: StoreType;
|
173
186
|
readonly name: string;
|
174
|
-
readonly ebOpts: BlockstoreRuntime;
|
175
|
-
readonly commitQueue: CommitQueue<CarGroup>;
|
176
|
-
readonly isCompacting = false;
|
177
|
-
readonly carReaders: Map<string, Promise<CarReader>>;
|
178
|
-
readonly seenCompacted: Set<string>;
|
179
|
-
readonly processedCars: Set<string>;
|
180
|
-
readonly sthis: SuperThis;
|
181
|
-
readonly taskManager?: TaskManager;
|
182
|
-
carLog: CarLog;
|
183
|
-
remoteMetaStore?: MetaStore;
|
184
|
-
remoteCarStore?: DataStore;
|
185
|
-
remoteFileStore?: DataStore;
|
186
|
-
private getBlockCache;
|
187
|
-
private seenMeta;
|
188
|
-
private writeLimit;
|
189
|
-
keyBag(): Promise<KeyBag>;
|
190
|
-
carStore(): Promise<DataStore>;
|
191
|
-
fileStore(): Promise<DataStore>;
|
192
|
-
WALStore(): Promise<WALStore>;
|
193
|
-
metaStore(): Promise<MetaStore>;
|
194
|
-
readonly onceReady: ResolveOnce<void>;
|
195
|
-
ready(): Promise<void>;
|
196
|
-
close(): Promise<void>;
|
197
|
-
destroy(): Promise<void>;
|
198
|
-
readonly logger: Logger;
|
199
|
-
constructor(name: string, ebOpts: BlockstoreOpts, sthis: SuperThis);
|
200
|
-
handleDbMetasFromStore(metas: DbMeta[]): Promise<void>;
|
201
|
-
mergeDbMetaIntoClock(meta: DbMeta): Promise<void>;
|
202
|
-
loadCarHeaderFromMeta<T>({ cars: cids }: DbMeta): Promise<CarHeader<T>>;
|
203
|
-
commitFiles(t: CarTransaction, done: TransactionMeta): Promise<CarGroup>;
|
204
|
-
loadFileCar(cid: AnyLink): Promise<CarReader>;
|
205
|
-
commit<T = TransactionMeta>(t: CarTransaction, done: T, opts?: CommitOpts): Promise<CarGroup>;
|
206
|
-
updateCarLog<T>(cids: CarGroup, fp: CarHeader<T>, compact: boolean): Promise<void>;
|
207
|
-
cacheTransaction(t: CarTransaction): Promise<void>;
|
208
|
-
cacheCarReader(carCidStr: string, reader: CarReader): Promise<void>;
|
209
|
-
removeCidsForCompact(cid: AnyLink): Promise<void>;
|
210
|
-
entries(cache?: boolean): AsyncIterableIterator<AnyBlock>;
|
211
|
-
getBlock(cid: AnyLink): Promise<AnyBlock | Falsy>;
|
212
|
-
loadCar(cid: AnyLink): Promise<CarReader>;
|
213
|
-
makeDecoderAndCarReader(cid: AnyLink, local: DataStore, remote?: DataStore): Promise<CarReader>;
|
214
|
-
protected storesLoadCar(cid: AnyLink, local: DataStore, remote?: DataStore): Promise<CarReader>;
|
215
|
-
protected getMoreReaders(cids: AnyLink[]): Promise<void>;
|
216
187
|
}
|
188
|
+
declare function getStore(url: URI, sthis: SuperThis, joiner: Joiner): Store;
|
189
|
+
declare function getKey(url: URI, logger: Logger): string;
|
190
|
+
declare function getName(sthis: SuperThis, url: URI): string;
|
191
|
+
declare function exceptionWrapper<T, E extends Error>(fn: () => Promise<Result<T, E>>): Promise<Result<T, E>>;
|
192
|
+
declare class NotFoundError extends Error {
|
193
|
+
readonly code = "ENOENT";
|
194
|
+
}
|
195
|
+
declare function isNotFoundError(e: Error | Result<unknown> | unknown): e is NotFoundError;
|
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>>;
|
217
201
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
202
|
+
declare enum FPEnvelopeType {
|
203
|
+
CAR = "car",
|
204
|
+
FILE = "file",
|
205
|
+
META = "meta",
|
206
|
+
WAL = "wal"
|
222
207
|
}
|
223
|
-
|
224
|
-
readonly
|
225
|
-
|
226
|
-
get<T, C extends number, A extends number, V extends Version>(cid: AnyLink): Promise<Block$1<T, C, A, V> | undefined>;
|
227
|
-
superGet(cid: AnyLink): Promise<AnyBlock | undefined>;
|
208
|
+
interface FPEnvelope<T> {
|
209
|
+
readonly type: FPEnvelopeType;
|
210
|
+
readonly payload: T;
|
228
211
|
}
|
229
|
-
|
230
|
-
readonly
|
231
|
-
readonly ebOpts: BlockstoreRuntime;
|
232
|
-
readonly sthis: SuperThis;
|
233
|
-
readonly loader?: Loader;
|
234
|
-
readonly name?: string;
|
235
|
-
ready(): Promise<void>;
|
236
|
-
close(): Promise<void>;
|
237
|
-
destroy(): Promise<void>;
|
238
|
-
compact(): Promise<void>;
|
239
|
-
readonly logger: Logger;
|
240
|
-
constructor(ebOpts?: BlockstoreOpts);
|
241
|
-
get<T, C extends number, A extends number, V extends Version>(cid: AnyAnyLink): Promise<Block$1<T, C, A, V> | undefined>;
|
242
|
-
put(cid: AnyAnyLink, block: Uint8Array): Promise<void>;
|
243
|
-
lastTxMeta?: unknown;
|
244
|
-
transaction<M extends TransactionMeta>(fn: (t: CarTransaction) => Promise<M>, _opts?: CarTransactionOpts): Promise<TransactionWrapper<M>>;
|
245
|
-
openTransaction(opts?: CarTransactionOpts): CarTransaction;
|
246
|
-
commitTransaction<M extends TransactionMeta>(t: CarTransaction, done: M, opts: CarTransactionOpts): Promise<TransactionWrapper<M>>;
|
247
|
-
entries(): AsyncIterableIterator<AnyBlock>;
|
212
|
+
interface FPEnvelopeCar extends FPEnvelope<Uint8Array> {
|
213
|
+
readonly type: FPEnvelopeType.CAR;
|
248
214
|
}
|
249
|
-
|
250
|
-
readonly
|
251
|
-
readonly loader: Loader;
|
252
|
-
ready(): Promise<void>;
|
253
|
-
close(): Promise<void>;
|
254
|
-
destroy(): Promise<void>;
|
255
|
-
compacting: boolean;
|
256
|
-
readonly logger: Logger;
|
257
|
-
constructor(sthis: SuperThis, ebOpts: BlockstoreOpts);
|
258
|
-
get<T, C extends number, A extends number, V extends Version>(cid: AnyAnyLink): Promise<Block$1<T, C, A, V> | undefined>;
|
259
|
-
transaction<M extends TransactionMeta>(fn: (t: CarTransaction) => Promise<M>, opts?: {
|
260
|
-
noLoader: boolean;
|
261
|
-
}): Promise<TransactionWrapper<M>>;
|
262
|
-
getFile(car: AnyLink, cid: AnyLink): Promise<Uint8Array>;
|
263
|
-
compact(): Promise<void>;
|
264
|
-
defaultCompact(blocks: CompactionFetcher, logger: Logger): Promise<TransactionMeta>;
|
265
|
-
entries(): AsyncIterableIterator<AnyBlock>;
|
215
|
+
interface FPEnvelopeFile extends FPEnvelope<Uint8Array> {
|
216
|
+
readonly type: FPEnvelopeType.FILE;
|
266
217
|
}
|
267
|
-
|
268
|
-
readonly
|
269
|
-
|
270
|
-
|
271
|
-
|
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>>;
|
272
296
|
}
|
273
297
|
|
274
298
|
type AnyLink = Link<unknown, number, number, Version>;
|
@@ -368,20 +392,43 @@ interface StoreFactory {
|
|
368
392
|
}>;
|
369
393
|
decodeFile?: (blocks: unknown, cid: AnyLink, meta: DocFileMeta) => Promise<File>;
|
370
394
|
}
|
371
|
-
interface
|
372
|
-
readonly
|
373
|
-
readonly
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
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;
|
380
427
|
}
|
381
428
|
interface StoreRuntime {
|
382
|
-
makeMetaStore(
|
383
|
-
makeDataStore(
|
384
|
-
makeWALStore(
|
429
|
+
makeMetaStore(sfi: StoreFactoryItem): Promise<MetaStore>;
|
430
|
+
makeDataStore(sfi: StoreFactoryItem): Promise<DataStore>;
|
431
|
+
makeWALStore(sfi: StoreFactoryItem): Promise<WALStore>;
|
385
432
|
encodeFile(blob: BlobLike): Promise<{
|
386
433
|
cid: AnyLink;
|
387
434
|
blocks: AnyBlock[];
|
@@ -394,24 +441,22 @@ interface CommitOpts {
|
|
394
441
|
}
|
395
442
|
interface DbMeta {
|
396
443
|
readonly cars: CarGroup;
|
397
|
-
key?: string;
|
398
444
|
}
|
399
445
|
type LoadHandler = (dbMetas: DbMeta[]) => Promise<void>;
|
446
|
+
interface RefLoadable {
|
447
|
+
readonly loader: Loadable;
|
448
|
+
}
|
449
|
+
interface RefBlockstore {
|
450
|
+
readonly blockstore: RefLoadable;
|
451
|
+
}
|
400
452
|
interface Connection {
|
401
|
-
readonly loader?: Loadable;
|
402
453
|
readonly loaded: Promise<void>;
|
403
|
-
|
404
|
-
connectMeta_X({ loader }: {
|
405
|
-
loader?: Loadable;
|
406
|
-
}): void;
|
407
|
-
connectStorage_X({ loader }: {
|
408
|
-
loader?: Loadable;
|
409
|
-
}): void;
|
454
|
+
connectStorage(ref: RefLoadable | RefBlockstore): void;
|
410
455
|
}
|
411
456
|
interface BaseStore {
|
412
457
|
readonly storeType: StoreType;
|
458
|
+
readonly realGateway: SerdeGateway;
|
413
459
|
url(): URI;
|
414
|
-
readonly name: string;
|
415
460
|
onStarted(fn: () => void): void;
|
416
461
|
onClosed(fn: () => void): void;
|
417
462
|
keyedCrypto(): Promise<KeyedCrypto>;
|
@@ -420,14 +465,17 @@ interface BaseStore {
|
|
420
465
|
readonly ready?: () => Promise<void>;
|
421
466
|
start(): Promise<Result<URI>>;
|
422
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;
|
423
475
|
interface MetaStore extends BaseStore {
|
424
476
|
readonly storeType: "meta";
|
425
477
|
load(branch?: string): Promise<DbMeta[] | Falsy>;
|
426
478
|
save(meta: DbMeta, branch?: string): Promise<Result<void>>;
|
427
|
-
handleByteHeads(byteHeads: Uint8Array, branch?: string): Promise<{
|
428
|
-
eventCid: CarClockLink;
|
429
|
-
dbMeta: DbMeta;
|
430
|
-
}[]>;
|
431
479
|
}
|
432
480
|
interface DataSaveOpts {
|
433
481
|
readonly public: boolean;
|
@@ -439,9 +487,9 @@ interface DataStore extends BaseStore {
|
|
439
487
|
remove(cid: AnyLink): Promise<Result<void>>;
|
440
488
|
}
|
441
489
|
interface WALState {
|
442
|
-
operations: DbMeta[];
|
443
|
-
noLoaderOps: DbMeta[];
|
444
|
-
fileOperations: {
|
490
|
+
readonly operations: DbMeta[];
|
491
|
+
readonly noLoaderOps: DbMeta[];
|
492
|
+
readonly fileOperations: {
|
445
493
|
readonly cid: AnyLink;
|
446
494
|
readonly public: boolean;
|
447
495
|
}[];
|
@@ -461,253 +509,402 @@ type CompactFetcher = BlockFetcher & {
|
|
461
509
|
readonly loggedBlocks: CarTransaction;
|
462
510
|
};
|
463
511
|
type CompactFn = (blocks: CompactFetcher) => Promise<TransactionMeta>;
|
464
|
-
|
512
|
+
interface StoreRuntimeUrls {
|
513
|
+
readonly meta: URI;
|
514
|
+
readonly data: URI;
|
515
|
+
readonly wal: URI;
|
516
|
+
}
|
517
|
+
interface BlockstoreParams {
|
465
518
|
readonly logger: Logger;
|
466
519
|
readonly applyMeta: (meta: TransactionMeta, snap?: boolean) => Promise<void>;
|
467
520
|
readonly compact: CompactFn;
|
468
521
|
readonly autoCompact: number;
|
469
522
|
readonly crypto: CryptoRuntime;
|
470
|
-
readonly store: StoreOpts;
|
471
|
-
readonly keyBag: KeyBagOpts;
|
472
523
|
readonly public: boolean;
|
473
524
|
readonly meta: DbMeta;
|
474
|
-
readonly name: string;
|
475
525
|
readonly threshold: number;
|
476
|
-
|
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
|
+
};
|
477
537
|
interface BlockstoreRuntime {
|
478
538
|
readonly logger: Logger;
|
479
539
|
readonly applyMeta: (meta: TransactionMeta, snap?: boolean) => Promise<void>;
|
480
540
|
readonly compact: CompactFn;
|
481
541
|
readonly autoCompact: number;
|
482
542
|
readonly crypto: CryptoRuntime;
|
483
|
-
readonly store: StoreOpts;
|
484
543
|
readonly storeRuntime: StoreRuntime;
|
485
|
-
readonly keyBag:
|
544
|
+
readonly keyBag: KeyBagRuntime;
|
545
|
+
readonly storeUrls: StoreURIs;
|
546
|
+
readonly gatewayInterceptor?: SerdeGatewayInterceptor;
|
486
547
|
readonly meta?: DbMeta;
|
487
|
-
readonly name?: string;
|
488
548
|
readonly threshold: number;
|
489
549
|
}
|
490
550
|
interface Loadable {
|
491
|
-
readonly name: string;
|
492
551
|
readonly sthis: SuperThis;
|
493
552
|
readonly ebOpts: BlockstoreRuntime;
|
494
|
-
remoteCarStore?: DataStore;
|
495
|
-
carStore(): Promise<DataStore>;
|
496
553
|
carLog: CarLog;
|
497
554
|
remoteMetaStore?: MetaStore;
|
498
555
|
remoteFileStore?: DataStore;
|
499
|
-
|
556
|
+
remoteCarStore?: DataStore;
|
557
|
+
readonly taskManager: TaskManager;
|
500
558
|
ready(): Promise<void>;
|
501
559
|
close(): Promise<void>;
|
560
|
+
keyBag(): Promise<KeyBag>;
|
561
|
+
metaStore(): Promise<MetaStore>;
|
502
562
|
fileStore(): Promise<DataStore>;
|
503
563
|
WALStore(): Promise<WALStore>;
|
564
|
+
carStore(): Promise<DataStore>;
|
504
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>;
|
505
573
|
}
|
506
|
-
|
507
|
-
dbMeta: Uint8Array;
|
508
|
-
}
|
574
|
+
interface DbMetaBinary {
|
575
|
+
readonly dbMeta: Uint8Array;
|
576
|
+
}
|
577
|
+
type DbMetaEventBlock = EventBlock<DbMetaBinary>;
|
509
578
|
type CarClockLink = Link<DbMetaEventBlock, number, number, Version>;
|
510
579
|
type CarClockHead = CarClockLink[];
|
511
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
|
+
|
512
591
|
interface GatewayOpts {
|
513
592
|
readonly gateway: Gateway;
|
514
593
|
}
|
515
594
|
type GetResult = Result<Uint8Array, NotFoundError | Error>;
|
516
|
-
type VoidResult = Result<void>;
|
517
|
-
interface TestGateway {
|
518
|
-
get(url: URI, key: string): Promise<Uint8Array>;
|
519
|
-
}
|
520
|
-
type UnsubscribeResult = Result<() => void>;
|
521
595
|
interface Gateway {
|
522
|
-
buildUrl(baseUrl: URI, key: string): Promise<Result<URI>>;
|
523
|
-
start(baseUrl: URI): Promise<Result<URI>>;
|
524
|
-
close(baseUrl: URI): Promise<VoidResult>;
|
525
|
-
destroy(baseUrl: URI): Promise<VoidResult>;
|
526
|
-
put(url: URI, body: Uint8Array): Promise<VoidResult>;
|
527
|
-
get(url: URI): Promise<GetResult>;
|
528
|
-
delete(url: URI): Promise<VoidResult>;
|
529
|
-
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>>;
|
530
605
|
}
|
531
606
|
|
532
|
-
|
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>>;
|
630
|
+
}
|
631
|
+
|
632
|
+
declare function createDbMetaEvent(sthis: SuperThis, dbMeta: DbMeta, parents: CarClockHead): Promise<DbMetaEvent>;
|
633
|
+
|
634
|
+
interface SerdeGatewayFactoryItem {
|
533
635
|
readonly protocol: string;
|
534
|
-
readonly
|
535
|
-
|
536
|
-
|
537
|
-
readonly test: (sthis: SuperThis) => Promise<TestGateway>;
|
636
|
+
readonly isDefault?: boolean;
|
637
|
+
defaultURI(sthis: SuperThis): URI;
|
638
|
+
serdegateway(sthis: SuperThis): Promise<SerdeGateway>;
|
538
639
|
}
|
539
|
-
|
540
|
-
|
541
|
-
readonly
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
declare function
|
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;
|
550
651
|
|
551
|
-
declare class
|
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>;
|
552
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>;
|
553
681
|
readonly logger: Logger;
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
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>;
|
567
699
|
}
|
568
700
|
|
569
|
-
|
570
|
-
|
571
|
-
readonly loader?: Loader;
|
572
|
-
readonly ebOpts: BlockstoreRuntime;
|
573
|
-
};
|
574
|
-
readonly name?: string;
|
575
|
-
}
|
701
|
+
declare function parseCarFile<T>(reader: CarReader$1, logger: Logger): Promise<CarHeader<T>>;
|
702
|
+
|
576
703
|
declare abstract class ConnectionBase implements Connection {
|
577
|
-
loader
|
704
|
+
private loader?;
|
578
705
|
taskManager?: TaskManager;
|
579
706
|
loaded: Promise<void>;
|
580
707
|
readonly url: URI;
|
581
708
|
readonly logger: Logger;
|
582
709
|
constructor(url: URI, logger: Logger);
|
583
710
|
refresh(): Promise<void>;
|
584
|
-
|
585
|
-
|
586
|
-
}): Promise<void>;
|
587
|
-
connectMeta_X({ loader }: {
|
588
|
-
loader?: Loadable;
|
589
|
-
}): Promise<void>;
|
711
|
+
connect(refl: RefLoadable | RefBlockstore): Promise<void>;
|
712
|
+
connectMeta(refl: RefLoadable | RefBlockstore): Promise<void>;
|
590
713
|
abstract onConnect(): Promise<void>;
|
591
|
-
|
592
|
-
loader?: Loadable;
|
593
|
-
}): Promise<void>;
|
714
|
+
connectStorage(refl: RefLoadable | RefBlockstore): Promise<void>;
|
594
715
|
}
|
595
716
|
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
type index$
|
602
|
-
type index$
|
603
|
-
|
604
|
-
type index$
|
605
|
-
type index$
|
606
|
-
type index$
|
607
|
-
type index$
|
608
|
-
|
609
|
-
type index$
|
610
|
-
type index$
|
611
|
-
type index$
|
612
|
-
|
613
|
-
type index$
|
614
|
-
type index$
|
615
|
-
type index$
|
616
|
-
type index$
|
617
|
-
type index$
|
618
|
-
type index$
|
619
|
-
type index$
|
620
|
-
|
621
|
-
type index$
|
622
|
-
type index$
|
623
|
-
|
624
|
-
type index$
|
625
|
-
type index$
|
626
|
-
|
627
|
-
type index$
|
628
|
-
type index$
|
629
|
-
declare const index$
|
630
|
-
type index$
|
631
|
-
type index$
|
632
|
-
type index$
|
633
|
-
|
634
|
-
type index$
|
635
|
-
type index$
|
636
|
-
|
637
|
-
|
638
|
-
type index$
|
639
|
-
type index$
|
640
|
-
declare const index$
|
641
|
-
type index$
|
642
|
-
|
643
|
-
type index$
|
644
|
-
type index$
|
645
|
-
type index$
|
646
|
-
|
647
|
-
type index$
|
648
|
-
type index$
|
649
|
-
|
650
|
-
type index$
|
651
|
-
type index$
|
652
|
-
type index$
|
653
|
-
type index$
|
654
|
-
|
655
|
-
type index$
|
656
|
-
|
657
|
-
type index$
|
658
|
-
type index$
|
659
|
-
type index$
|
660
|
-
type index$
|
661
|
-
type index$
|
662
|
-
type index$
|
663
|
-
type index$
|
664
|
-
|
665
|
-
type index$
|
666
|
-
type index$
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
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 };
|
679
841
|
}
|
680
842
|
|
681
843
|
type Falsy = false | null | undefined;
|
682
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
|
+
}
|
683
864
|
declare function throwFalsy<T>(value: T | Falsy): T;
|
684
865
|
declare function falsyToUndef<T>(value: T | Falsy): T | undefined;
|
685
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
|
+
}
|
686
883
|
interface SysFileSystem {
|
687
884
|
start(): Promise<SysFileSystem>;
|
688
|
-
mkdir(path:
|
885
|
+
mkdir(path: string, options?: {
|
689
886
|
recursive: boolean;
|
690
887
|
}): Promise<string | undefined>;
|
691
|
-
readdir(path:
|
692
|
-
rm(path:
|
888
|
+
readdir(path: string): Promise<string[]>;
|
889
|
+
rm(path: string, options?: {
|
693
890
|
recursive: boolean;
|
694
891
|
}): Promise<void>;
|
695
|
-
copyFile(source:
|
696
|
-
readfile(path:
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
stat(path: PathLike): Promise<Stats>;
|
701
|
-
unlink(path: PathLike): Promise<void>;
|
702
|
-
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>;
|
703
897
|
}
|
704
898
|
interface PathOps {
|
705
899
|
join(...args: string[]): string;
|
706
900
|
dirname(path: string): string;
|
901
|
+
basename(path: string): string;
|
707
902
|
}
|
903
|
+
type ToUInt8 = Uint8Array | Result<Uint8Array>;
|
904
|
+
type PromiseToUInt8 = ToUInt8 | Promise<Uint8Array> | Promise<Result<Uint8Array>>;
|
708
905
|
interface TextEndeCoder {
|
709
906
|
encode(input: string): Uint8Array;
|
710
|
-
decode(input:
|
907
|
+
decode(input: ToUInt8): string;
|
711
908
|
}
|
712
909
|
interface SuperThisOpts {
|
713
910
|
readonly logger: Logger;
|
@@ -724,12 +921,14 @@ interface SuperThis {
|
|
724
921
|
readonly pathOps: PathOps;
|
725
922
|
readonly ctx: Record<string, unknown>;
|
726
923
|
readonly txt: TextEndeCoder;
|
727
|
-
|
924
|
+
timeOrderedNextId(time?: number): {
|
728
925
|
str: string;
|
729
|
-
|
926
|
+
toString: () => string;
|
730
927
|
};
|
731
|
-
|
928
|
+
nextId(bytes?: number): {
|
732
929
|
str: string;
|
930
|
+
bin: Uint8Array;
|
931
|
+
toString: () => string;
|
733
932
|
};
|
734
933
|
start(): Promise<void>;
|
735
934
|
clone(override: Partial<SuperThisOpts>): SuperThis;
|
@@ -737,10 +936,13 @@ interface SuperThis {
|
|
737
936
|
interface ConfigOpts extends Partial<SuperThisOpts> {
|
738
937
|
readonly public?: boolean;
|
739
938
|
readonly meta?: DbMeta;
|
740
|
-
readonly
|
939
|
+
readonly writeQueue?: Partial<WriteQueueParams>;
|
940
|
+
readonly gatewayInterceptor?: SerdeGatewayInterceptor;
|
741
941
|
readonly autoCompact?: number;
|
742
|
-
readonly
|
942
|
+
readonly storeUrls?: StoreUrlsOpts;
|
943
|
+
readonly storeEnDe?: StoreEnDeFile;
|
743
944
|
readonly threshold?: number;
|
945
|
+
readonly keyBag?: Partial<KeyBagOpts>;
|
744
946
|
}
|
745
947
|
type ClockLink = EventLink<Operation>;
|
746
948
|
type ClockHead = ClockLink[];
|
@@ -863,6 +1065,11 @@ interface DocResponse {
|
|
863
1065
|
readonly clock: ClockHead;
|
864
1066
|
readonly name?: string;
|
865
1067
|
}
|
1068
|
+
interface BulkResponse {
|
1069
|
+
readonly ids: string[];
|
1070
|
+
readonly clock: ClockHead;
|
1071
|
+
readonly name?: string;
|
1072
|
+
}
|
866
1073
|
type UpdateListenerFn<T extends DocTypes> = (docs: DocWithId<T>[]) => Promise<void> | void;
|
867
1074
|
type NoUpdateListenerFn = () => Promise<void> | void;
|
868
1075
|
type ListenerFn<T extends DocTypes> = UpdateListenerFn<T> | NoUpdateListenerFn;
|
@@ -874,7 +1081,13 @@ interface CRDTEntry {
|
|
874
1081
|
|
875
1082
|
interface WriteQueue<T extends DocTypes> {
|
876
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;
|
877
1089
|
}
|
1090
|
+
declare function defaultWriteQueueOpts(opts?: Partial<WriteQueueParams>): WriteQueueParams;
|
878
1091
|
|
879
1092
|
declare class IndexTree<K extends IndexKeyType, R extends DocFragment> {
|
880
1093
|
cid?: AnyLink;
|
@@ -910,13 +1123,11 @@ interface ProllyNode<K extends IndexKeyType, T extends DocFragment> extends Prol
|
|
910
1123
|
readonly block: Promise<Block$1>;
|
911
1124
|
}
|
912
1125
|
|
913
|
-
declare function index$
|
914
|
-
_crdt: CRDT<T> | CRDT<NonNullable<unknown>>;
|
915
|
-
}, 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>;
|
916
1127
|
declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFragment = T> {
|
917
1128
|
readonly blockstore: BaseBlockstore;
|
918
1129
|
readonly crdt: CRDT<T>;
|
919
|
-
name: string;
|
1130
|
+
readonly name: string;
|
920
1131
|
mapFn?: MapFn<T>;
|
921
1132
|
mapFnString: string;
|
922
1133
|
byKey: IndexTree<K, R>;
|
@@ -925,8 +1136,6 @@ declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFra
|
|
925
1136
|
includeDocsDefault: boolean;
|
926
1137
|
initError?: Error;
|
927
1138
|
ready(): Promise<void>;
|
928
|
-
close(): Promise<void>;
|
929
|
-
destroy(): Promise<void>;
|
930
1139
|
readonly logger: Logger;
|
931
1140
|
constructor(sthis: SuperThis, crdt: CRDT<T> | CRDT<NonNullable<unknown>>, name: string, mapFn?: MapFn<T>, meta?: IdxMeta);
|
932
1141
|
applyMapFn(name: string, mapFn?: MapFn<T>, meta?: IdxMeta): void;
|
@@ -972,16 +1181,18 @@ declare class CRDTClock<T extends DocTypes> {
|
|
972
1181
|
int_applyHead(newHead: ClockHead, prevHead: ClockHead, localUpdates: boolean): Promise<void>;
|
973
1182
|
}
|
974
1183
|
|
1184
|
+
interface HasCRDT<T extends DocTypes> {
|
1185
|
+
readonly crdt: CRDT<T> | CRDT<NonNullable<unknown>>;
|
1186
|
+
}
|
975
1187
|
declare class CRDT<T extends DocTypes> {
|
976
|
-
readonly
|
977
|
-
readonly opts: ConfigOpts;
|
1188
|
+
readonly opts: LedgerOpts;
|
978
1189
|
readonly blockstore: BaseBlockstore;
|
979
1190
|
readonly indexBlockstore: BaseBlockstore;
|
980
1191
|
readonly indexers: Map<string, Index<IndexKeyType, NonNullable<unknown>>>;
|
981
1192
|
readonly clock: CRDTClock<T>;
|
982
1193
|
readonly logger: Logger;
|
983
1194
|
readonly sthis: SuperThis;
|
984
|
-
constructor(sthis: SuperThis,
|
1195
|
+
constructor(sthis: SuperThis, opts: LedgerOpts);
|
985
1196
|
bulk(updates: DocUpdate<T>[]): Promise<CRDTMeta>;
|
986
1197
|
readonly onceReady: ResolveOnce<void>;
|
987
1198
|
ready(): Promise<void>;
|
@@ -1001,25 +1212,97 @@ declare class CRDT<T extends DocTypes> {
|
|
1001
1212
|
compact(): Promise<void>;
|
1002
1213
|
}
|
1003
1214
|
|
1004
|
-
declare
|
1005
|
-
|
1215
|
+
declare function keyConfigOpts(sthis: SuperThis, name?: string, opts?: ConfigOpts): string;
|
1216
|
+
interface LedgerOpts {
|
1006
1217
|
readonly name?: string;
|
1007
|
-
readonly
|
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;
|
1008
1284
|
_listening: boolean;
|
1009
1285
|
readonly _listeners: Set<ListenerFn<DT>>;
|
1010
1286
|
readonly _noupdate_listeners: Set<ListenerFn<DT>>;
|
1011
|
-
readonly
|
1287
|
+
readonly crdt: CRDT<DT>;
|
1012
1288
|
readonly _writeQueue: WriteQueue<DT>;
|
1013
|
-
readonly
|
1289
|
+
readonly shells: Set<LedgerShell<DT>>;
|
1290
|
+
addShell(shell: LedgerShell<DT>): void;
|
1291
|
+
readonly _onClosedFns: Set<() => void>;
|
1292
|
+
onClosed(fn: () => void): void;
|
1014
1293
|
close(): Promise<void>;
|
1294
|
+
shellClose(db: LedgerShell<DT>): Promise<void>;
|
1015
1295
|
destroy(): Promise<void>;
|
1016
1296
|
readonly _ready: ResolveOnce<void>;
|
1017
1297
|
ready(): Promise<void>;
|
1018
1298
|
readonly logger: Logger;
|
1019
1299
|
readonly sthis: SuperThis;
|
1020
|
-
|
1300
|
+
readonly id: string;
|
1301
|
+
constructor(sthis: SuperThis, opts: LedgerOpts);
|
1302
|
+
get name(): string;
|
1021
1303
|
get<T extends DocTypes>(id: string): Promise<DocWithId<T>>;
|
1022
1304
|
put<T extends DocTypes>(doc: DocSet<T>): Promise<DocResponse>;
|
1305
|
+
bulk<T extends DocTypes>(docs: DocSet<T>[]): Promise<BulkResponse>;
|
1023
1306
|
del(id: string): Promise<DocResponse>;
|
1024
1307
|
changes<T extends DocTypes>(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse<T>>;
|
1025
1308
|
allDocs<T extends DocTypes>(opts?: AllDocsQueryOpts): Promise<AllDocsResponse<T>>;
|
@@ -1036,12 +1319,11 @@ declare class Database<DT extends DocTypes = NonNullable<unknown>> implements Co
|
|
1036
1319
|
_notify(updates: DocUpdate<NonNullable<unknown>>[]): Promise<void>;
|
1037
1320
|
_no_update_notify(): Promise<void>;
|
1038
1321
|
}
|
1039
|
-
declare function
|
1322
|
+
declare function toStoreURIRuntime(sthis: SuperThis, name?: string, sopts?: StoreUrlsOpts): StoreURIRuntime;
|
1323
|
+
declare function fireproof(name: string, opts?: ConfigOpts): Ledger;
|
1040
1324
|
|
1041
|
-
declare function
|
1042
|
-
|
1043
|
-
declare function getPath(url: URI, sthis: SuperThis): string;
|
1044
|
-
declare function getFileName(url: URI, sthis: SuperThis): string;
|
1325
|
+
declare function getPath(url: URI, sthis: SuperThis$1): string;
|
1326
|
+
declare function getFileName(url: URI, sthis: SuperThis$1): string;
|
1045
1327
|
|
1046
1328
|
declare function encodeFile(blob: BlobLike): Promise<{
|
1047
1329
|
cid: AnyLink;
|
@@ -1116,9 +1398,94 @@ declare namespace block {
|
|
1116
1398
|
export { block_Block as Block, block_create as create, block_createUnsafe as createUnsafe, block_decode as decode, block_encode as encode };
|
1117
1399
|
}
|
1118
1400
|
|
1119
|
-
declare const index$
|
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;
|
1120
1487
|
declare namespace index$1 {
|
1121
|
-
export { index$
|
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 };
|
1122
1489
|
}
|
1123
1490
|
|
1124
1491
|
declare const FILESTORE_VERSION = "v0.19-file";
|
@@ -1127,16 +1494,28 @@ declare const INDEXDB_VERSION = "v0.19-indexdb";
|
|
1127
1494
|
|
1128
1495
|
declare const index_FILESTORE_VERSION: typeof FILESTORE_VERSION;
|
1129
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;
|
1130
1508
|
declare const index_files: typeof files;
|
1131
1509
|
declare const index_getFileName: typeof getFileName;
|
1132
|
-
declare const
|
1510
|
+
declare const index_getKeyBag: typeof getKeyBag;
|
1133
1511
|
declare const index_getPath: typeof getPath;
|
1512
|
+
declare const index_registerKeyBagProviderFactory: typeof registerKeyBagProviderFactory;
|
1134
1513
|
declare const index_runtimeFn: typeof runtimeFn;
|
1135
1514
|
declare namespace index {
|
1136
|
-
export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXDB_VERSION as INDEXDB_VERSION, index_files as files, index_getFileName as getFileName,
|
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 };
|
1137
1516
|
}
|
1138
1517
|
|
1139
1518
|
declare const PACKAGE_VERSION: string;
|
1140
1519
|
|
1141
|
-
export { type AllDocsQueryOpts, type AllDocsResponse, CRDT, type CRDTEntry, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, type
|
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 };
|
1142
1521
|
declare module '@fireproof/core'
|