@fireproof/core 0.19.101 → 0.19.103
Sign up to get free protection for your applications and to get access to all the features.
- package/{chunk-3EB3ENHT.js → chunk-OFGPKRCM.js} +25 -54
- package/chunk-OFGPKRCM.js.map +1 -0
- package/chunk-WS3YRPIA.js +75 -0
- package/chunk-WS3YRPIA.js.map +1 -0
- package/{gateway-GK5QZ6KP.js → gateway-5FCWPX5W.js} +12 -13
- package/gateway-5FCWPX5W.js.map +1 -0
- package/{gateway-TQTGDRCN.js → gateway-H7UD6TNB.js} +8 -9
- package/gateway-H7UD6TNB.js.map +1 -0
- package/index.cjs +1571 -1992
- package/index.cjs.map +1 -1
- package/index.d.cts +117 -257
- package/index.d.ts +117 -257
- package/index.global.js +12280 -12741
- package/index.global.js.map +1 -1
- package/index.js +1463 -1790
- package/index.js.map +1 -1
- package/{key-bag-file-VOSSK46F.js → key-bag-file-WADZBHYG.js} +3 -4
- package/{key-bag-file-VOSSK46F.js.map → key-bag-file-WADZBHYG.js.map} +1 -1
- package/{key-bag-indexdb-AXTQOSMC.js → key-bag-indexdb-PGVAI3FJ.js} +3 -4
- package/{key-bag-indexdb-AXTQOSMC.js.map → key-bag-indexdb-PGVAI3FJ.js.map} +1 -1
- package/mem-filesystem-YPPJV7Q2.js +41 -0
- package/mem-filesystem-YPPJV7Q2.js.map +1 -0
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/metafile-iife.json +1 -1
- package/{node-filesystem-CFRXFSO7.js → node-filesystem-INX4ZTHE.js} +9 -6
- package/node-filesystem-INX4ZTHE.js.map +1 -0
- package/package.json +1 -1
- package/tests/blockstore/keyed-crypto.test.ts +227 -63
- package/tests/blockstore/loader.test.ts +11 -19
- package/tests/blockstore/store.test.ts +19 -23
- package/tests/blockstore/transaction.test.ts +12 -12
- package/tests/fireproof/all-gateway.test.ts +193 -201
- package/tests/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.ts +316 -324
- package/tests/fireproof/config.test.ts +172 -0
- package/tests/fireproof/crdt.test.ts +16 -67
- package/tests/fireproof/database.test.ts +21 -183
- package/tests/fireproof/fireproof.test.ts +74 -83
- package/tests/fireproof/hello.test.ts +14 -18
- package/tests/fireproof/indexer.test.ts +43 -53
- package/tests/fireproof/utils.test.ts +6 -18
- package/tests/helpers.ts +9 -27
- package/tests/react/useFireproof.test.tsx +1 -1
- package/{utils-STA2C35G.js → utils-QO2HIWGI.js} +3 -4
- package/chunk-3EB3ENHT.js.map +0 -1
- package/chunk-HQ7D3PEU.js +0 -61
- package/chunk-HQ7D3PEU.js.map +0 -1
- package/chunk-PZ5AY32C.js +0 -10
- package/deno-filesystem-Q2IJ7YDR.js +0 -57
- package/deno-filesystem-Q2IJ7YDR.js.map +0 -1
- package/gateway-GK5QZ6KP.js.map +0 -1
- package/gateway-TQTGDRCN.js.map +0 -1
- package/key-bag-memory-LWE6ARPX.js +0 -29
- package/key-bag-memory-LWE6ARPX.js.map +0 -1
- package/node-filesystem-CFRXFSO7.js.map +0 -1
- package/tests/blockstore/keyed-crypto-indexdb-file.test.ts +0 -129
- package/tests/gateway/file/loader-config.test.ts +0 -303
- package/tests/gateway/indexdb/loader-config.test.ts +0 -75
- package/utils-STA2C35G.js.map +0 -1
- /package/tests/fireproof/{fireproof.fixture.ts → fireproof.test.fixture.ts} +0 -0
- /package/{chunk-PZ5AY32C.js.map → utils-QO2HIWGI.js.map} +0 -0
package/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Future, Logger, URI, Result, ResolveOnce, ResolveSeq,
|
1
|
+
import { Future, Logger, URI, Result, CoerceURI, ResolveOnce, ResolveSeq, CryptoRuntime, CTCryptoKey, EnvFactoryOpts, Env, runtimeFn } from '@adviser/cement';
|
2
2
|
export { Logger, Result } from '@adviser/cement';
|
3
3
|
import { EventLink } from '@web3-storage/pail/clock/api';
|
4
4
|
import { Operation } from '@web3-storage/pail/crdt/api';
|
@@ -8,6 +8,7 @@ import { BlockFetcher as BlockFetcher$1 } from '@web3-storage/pail/api';
|
|
8
8
|
import { CarReader } from '@ipld/car';
|
9
9
|
import { IDBPDatabase } from 'idb';
|
10
10
|
import { EventBlock } from '@web3-storage/pail/clock';
|
11
|
+
import { PathLike, MakeDirectoryOptions, Stats } from 'fs';
|
11
12
|
import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
|
12
13
|
import { Block as Block$2 } from 'multiformats/block';
|
13
14
|
|
@@ -58,6 +59,7 @@ declare class NotFoundError extends Error {
|
|
58
59
|
readonly code = "ENOENT";
|
59
60
|
}
|
60
61
|
declare function isNotFoundError(e: Error | Result<unknown> | unknown): e is NotFoundError;
|
62
|
+
declare function dataDir(sthis: SuperThis, name?: string, base?: CoerceURI): URI;
|
61
63
|
declare function UInt8ArrayEqual(a: Uint8Array, b: Uint8Array): boolean;
|
62
64
|
|
63
65
|
interface KeyBagCtx {
|
@@ -132,7 +134,6 @@ interface KeyBagProviderFactoryItem {
|
|
132
134
|
readonly factory: KeyBackProviderFactory;
|
133
135
|
}
|
134
136
|
declare function registerKeyBagProviderFactory(item: KeyBagProviderFactoryItem): void;
|
135
|
-
declare function defaultKeyBagOpts(sthis: SuperThis, kbo?: Partial<KeyBagOpts>): KeyBagRuntime;
|
136
137
|
declare function getKeyBag(sthis: SuperThis, kbo?: Partial<KeyBagOpts>): Promise<KeyBag>;
|
137
138
|
|
138
139
|
type keyBag_KeyBackProviderFactory = KeyBackProviderFactory;
|
@@ -148,11 +149,10 @@ type keyBag_KeyBagProviderIndexDB = KeyBagProviderIndexDB;
|
|
148
149
|
declare const keyBag_KeyBagProviderIndexDB: typeof KeyBagProviderIndexDB;
|
149
150
|
type keyBag_KeyBagRuntime = KeyBagRuntime;
|
150
151
|
type keyBag_KeyItem = KeyItem;
|
151
|
-
declare const keyBag_defaultKeyBagOpts: typeof defaultKeyBagOpts;
|
152
152
|
declare const keyBag_getKeyBag: typeof getKeyBag;
|
153
153
|
declare const keyBag_registerKeyBagProviderFactory: typeof registerKeyBagProviderFactory;
|
154
154
|
declare namespace keyBag {
|
155
|
-
export { type keyBag_KeyBackProviderFactory as KeyBackProviderFactory, keyBag_KeyBag as KeyBag, type keyBag_KeyBagFile as KeyBagFile, type keyBag_KeyBagOpts as KeyBagOpts, type keyBag_KeyBagProvider as KeyBagProvider, type keyBag_KeyBagProviderFactoryItem as KeyBagProviderFactoryItem, keyBag_KeyBagProviderFile as KeyBagProviderFile, keyBag_KeyBagProviderIndexDB as KeyBagProviderIndexDB, type keyBag_KeyBagRuntime as KeyBagRuntime, type keyBag_KeyItem as KeyItem,
|
155
|
+
export { type keyBag_KeyBackProviderFactory as KeyBackProviderFactory, keyBag_KeyBag as KeyBag, type keyBag_KeyBagFile as KeyBagFile, type keyBag_KeyBagOpts as KeyBagOpts, type keyBag_KeyBagProvider as KeyBagProvider, type keyBag_KeyBagProviderFactoryItem as KeyBagProviderFactoryItem, keyBag_KeyBagProviderFile as KeyBagProviderFile, keyBag_KeyBagProviderIndexDB as KeyBagProviderIndexDB, type keyBag_KeyBagRuntime as KeyBagRuntime, type keyBag_KeyItem as KeyItem, keyBag_getKeyBag as getKeyBag, keyBag_registerKeyBagProviderFactory as registerKeyBagProviderFactory };
|
156
156
|
}
|
157
157
|
|
158
158
|
declare class TaskManager {
|
@@ -167,6 +167,7 @@ declare class TaskManager {
|
|
167
167
|
}
|
168
168
|
|
169
169
|
declare class Loader implements Loadable {
|
170
|
+
readonly name: string;
|
170
171
|
readonly ebOpts: BlockstoreRuntime;
|
171
172
|
readonly commitQueue: CommitQueue<CarGroup>;
|
172
173
|
readonly isCompacting = false;
|
@@ -174,7 +175,7 @@ declare class Loader implements Loadable {
|
|
174
175
|
readonly seenCompacted: Set<string>;
|
175
176
|
readonly processedCars: Set<string>;
|
176
177
|
readonly sthis: SuperThis;
|
177
|
-
readonly taskManager
|
178
|
+
readonly taskManager?: TaskManager;
|
178
179
|
carLog: CarLog;
|
179
180
|
remoteMetaStore?: MetaStore;
|
180
181
|
remoteCarStore?: DataStore;
|
@@ -182,21 +183,17 @@ declare class Loader implements Loadable {
|
|
182
183
|
private getBlockCache;
|
183
184
|
private seenMeta;
|
184
185
|
private writeLimit;
|
185
|
-
|
186
|
+
keyBag(): Promise<KeyBag>;
|
186
187
|
carStore(): Promise<DataStore>;
|
187
|
-
readonly _fileStore: ResolveOnce<DataStore, void>;
|
188
188
|
fileStore(): Promise<DataStore>;
|
189
|
-
readonly _WALStore: ResolveOnce<WALStore, void>;
|
190
189
|
WALStore(): Promise<WALStore>;
|
191
|
-
readonly _metaStore: ResolveOnce<MetaStore, void>;
|
192
190
|
metaStore(): Promise<MetaStore>;
|
193
|
-
keyBag(): Promise<KeyBag>;
|
194
191
|
readonly onceReady: ResolveOnce<void>;
|
195
192
|
ready(): Promise<void>;
|
196
193
|
close(): Promise<void>;
|
197
194
|
destroy(): Promise<void>;
|
198
195
|
readonly logger: Logger;
|
199
|
-
constructor(
|
196
|
+
constructor(name: string, ebOpts: BlockstoreOpts, sthis: SuperThis);
|
200
197
|
handleDbMetasFromStore(metas: DbMeta[]): Promise<void>;
|
201
198
|
mergeDbMetaIntoClock(meta: DbMeta): Promise<void>;
|
202
199
|
loadCarHeaderFromMeta<T>({ cars: cids }: DbMeta): Promise<CarHeader<T>>;
|
@@ -231,12 +228,13 @@ declare class BaseBlockstore implements BlockFetcher {
|
|
231
228
|
readonly ebOpts: BlockstoreRuntime;
|
232
229
|
readonly sthis: SuperThis;
|
233
230
|
readonly loader?: Loader;
|
231
|
+
readonly name?: string;
|
234
232
|
ready(): Promise<void>;
|
235
233
|
close(): Promise<void>;
|
236
234
|
destroy(): Promise<void>;
|
237
235
|
compact(): Promise<void>;
|
238
236
|
readonly logger: Logger;
|
239
|
-
constructor(ebOpts
|
237
|
+
constructor(ebOpts?: BlockstoreOpts);
|
240
238
|
get<T, C extends number, A extends number, V extends Version>(cid: AnyAnyLink): Promise<Block$1<T, C, A, V> | undefined>;
|
241
239
|
put(cid: AnyAnyLink, block: Uint8Array): Promise<void>;
|
242
240
|
lastTxMeta?: unknown;
|
@@ -246,6 +244,7 @@ declare class BaseBlockstore implements BlockFetcher {
|
|
246
244
|
entries(): AsyncIterableIterator<AnyBlock>;
|
247
245
|
}
|
248
246
|
declare class EncryptedBlockstore extends BaseBlockstore {
|
247
|
+
readonly name: string;
|
249
248
|
readonly loader: Loader;
|
250
249
|
ready(): Promise<void>;
|
251
250
|
close(): Promise<void>;
|
@@ -269,26 +268,6 @@ declare class CompactionFetcher implements BlockFetcher {
|
|
269
268
|
get<T, C extends number, A extends number, V extends Version>(cid: AnyLink): Promise<Block$1<T, C, A, V> | undefined>;
|
270
269
|
}
|
271
270
|
|
272
|
-
interface GatewayOpts {
|
273
|
-
readonly gateway: Gateway;
|
274
|
-
}
|
275
|
-
type GetResult = Result<Uint8Array, NotFoundError | Error>;
|
276
|
-
type VoidResult = Result<void>;
|
277
|
-
interface TestGateway {
|
278
|
-
get(url: URI, key: string): Promise<Uint8Array>;
|
279
|
-
}
|
280
|
-
type UnsubscribeResult = Result<() => void>;
|
281
|
-
interface Gateway {
|
282
|
-
buildUrl(baseUrl: URI, key: string): Promise<Result<URI>>;
|
283
|
-
start(baseUrl: URI): Promise<Result<URI>>;
|
284
|
-
close(baseUrl: URI): Promise<VoidResult>;
|
285
|
-
destroy(baseUrl: URI): Promise<VoidResult>;
|
286
|
-
put(url: URI, body: Uint8Array): Promise<VoidResult>;
|
287
|
-
get(url: URI): Promise<GetResult>;
|
288
|
-
delete(url: URI): Promise<VoidResult>;
|
289
|
-
subscribe?(url: URI, callback: (meta: Uint8Array) => void): Promise<UnsubscribeResult>;
|
290
|
-
}
|
291
|
-
|
292
271
|
type AnyLink = Link<unknown, number, number, Version>;
|
293
272
|
type CarGroup = AnyLink[];
|
294
273
|
type CarLog = CarGroup[];
|
@@ -386,42 +365,20 @@ interface StoreFactory {
|
|
386
365
|
}>;
|
387
366
|
decodeFile?: (blocks: unknown, cid: AnyLink, meta: DocFileMeta) => Promise<File>;
|
388
367
|
}
|
389
|
-
interface
|
390
|
-
readonly
|
391
|
-
readonly
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
}>;
|
399
|
-
readonly decodeFile: (blocks: unknown, cid: AnyLink, meta: DocFileMeta) => Promise<File>;
|
400
|
-
}
|
401
|
-
interface StoreUrlsOpts {
|
402
|
-
readonly base?: CoerceURI;
|
403
|
-
readonly data?: Partial<StoreUrls>;
|
404
|
-
readonly idx?: Partial<StoreUrls>;
|
405
|
-
}
|
406
|
-
interface StoreURIs {
|
407
|
-
readonly meta: URI;
|
408
|
-
readonly data: URI;
|
409
|
-
readonly file: URI;
|
410
|
-
readonly wal: URI;
|
411
|
-
}
|
412
|
-
interface StoreURIRuntime {
|
413
|
-
readonly data: StoreURIs;
|
414
|
-
readonly idx: StoreURIs;
|
415
|
-
}
|
416
|
-
interface StoreFactoryItem {
|
417
|
-
readonly sthis: SuperThis;
|
418
|
-
readonly url: URI;
|
419
|
-
readonly keybag: KeyBag;
|
368
|
+
interface StoreOpts extends StoreFactory {
|
369
|
+
readonly isIndex?: string;
|
370
|
+
readonly stores?: {
|
371
|
+
readonly base?: CoerceURI;
|
372
|
+
readonly meta?: CoerceURI;
|
373
|
+
readonly data?: CoerceURI;
|
374
|
+
readonly index?: CoerceURI;
|
375
|
+
readonly wal?: CoerceURI;
|
376
|
+
};
|
420
377
|
}
|
421
378
|
interface StoreRuntime {
|
422
|
-
makeMetaStore(
|
423
|
-
makeDataStore(
|
424
|
-
makeWALStore(
|
379
|
+
makeMetaStore(loader: Loadable): Promise<MetaStore>;
|
380
|
+
makeDataStore(loader: Loadable): Promise<DataStore>;
|
381
|
+
makeWALStore(loader: Loadable): Promise<WALStore>;
|
425
382
|
encodeFile(blob: BlobLike): Promise<{
|
426
383
|
cid: AnyLink;
|
427
384
|
blocks: AnyBlock[];
|
@@ -449,7 +406,6 @@ interface Connection {
|
|
449
406
|
}
|
450
407
|
interface BaseStore {
|
451
408
|
readonly storeType: StoreType;
|
452
|
-
readonly realGateway: Gateway;
|
453
409
|
url(): URI;
|
454
410
|
readonly name: string;
|
455
411
|
onStarted(fn: () => void): void;
|
@@ -460,16 +416,14 @@ interface BaseStore {
|
|
460
416
|
readonly ready?: () => Promise<void>;
|
461
417
|
start(): Promise<Result<URI>>;
|
462
418
|
}
|
463
|
-
interface DbMetaEvent {
|
464
|
-
readonly eventCid: CarClockLink;
|
465
|
-
readonly parents: string[];
|
466
|
-
readonly dbMeta: DbMeta;
|
467
|
-
}
|
468
419
|
interface MetaStore extends BaseStore {
|
469
420
|
readonly storeType: "meta";
|
470
421
|
load(branch?: string): Promise<DbMeta[] | Falsy>;
|
471
422
|
save(meta: DbMeta, branch?: string): Promise<Result<void>>;
|
472
|
-
handleByteHeads(byteHeads: Uint8Array, branch?: string): Promise<
|
423
|
+
handleByteHeads(byteHeads: Uint8Array, branch?: string): Promise<{
|
424
|
+
eventCid: CarClockLink;
|
425
|
+
dbMeta: DbMeta;
|
426
|
+
}[]>;
|
473
427
|
}
|
474
428
|
interface DataSaveOpts {
|
475
429
|
readonly public: boolean;
|
@@ -503,53 +457,46 @@ type CompactFetcher = BlockFetcher & {
|
|
503
457
|
readonly loggedBlocks: CarTransaction;
|
504
458
|
};
|
505
459
|
type CompactFn = (blocks: CompactFetcher) => Promise<TransactionMeta>;
|
506
|
-
interface StoreRuntimeUrls {
|
507
|
-
readonly meta: URI;
|
508
|
-
readonly data: URI;
|
509
|
-
readonly wal: URI;
|
510
|
-
}
|
511
460
|
type BlockstoreOpts = Partial<{
|
512
461
|
readonly logger: Logger;
|
513
462
|
readonly applyMeta: (meta: TransactionMeta, snap?: boolean) => Promise<void>;
|
514
463
|
readonly compact: CompactFn;
|
515
464
|
readonly autoCompact: number;
|
516
465
|
readonly crypto: CryptoRuntime;
|
466
|
+
readonly store: StoreOpts;
|
467
|
+
readonly keyBag: KeyBagOpts;
|
517
468
|
readonly public: boolean;
|
518
469
|
readonly meta: DbMeta;
|
470
|
+
readonly name: string;
|
519
471
|
readonly threshold: number;
|
520
|
-
|
521
|
-
}> & {
|
522
|
-
readonly keyBag: KeyBagRuntime;
|
523
|
-
readonly storeUrls: StoreURIs;
|
524
|
-
readonly storeRuntime: StoreRuntime;
|
525
|
-
};
|
472
|
+
}>;
|
526
473
|
interface BlockstoreRuntime {
|
527
474
|
readonly logger: Logger;
|
528
475
|
readonly applyMeta: (meta: TransactionMeta, snap?: boolean) => Promise<void>;
|
529
476
|
readonly compact: CompactFn;
|
530
477
|
readonly autoCompact: number;
|
531
478
|
readonly crypto: CryptoRuntime;
|
479
|
+
readonly store: StoreOpts;
|
532
480
|
readonly storeRuntime: StoreRuntime;
|
533
|
-
readonly keyBag:
|
534
|
-
readonly storeUrls: StoreURIs;
|
481
|
+
readonly keyBag: Partial<KeyBagOpts>;
|
535
482
|
readonly meta?: DbMeta;
|
483
|
+
readonly name?: string;
|
536
484
|
readonly threshold: number;
|
537
485
|
}
|
538
486
|
interface Loadable {
|
487
|
+
readonly name: string;
|
539
488
|
readonly sthis: SuperThis;
|
540
489
|
readonly ebOpts: BlockstoreRuntime;
|
490
|
+
remoteCarStore?: DataStore;
|
491
|
+
carStore(): Promise<DataStore>;
|
541
492
|
carLog: CarLog;
|
542
493
|
remoteMetaStore?: MetaStore;
|
543
494
|
remoteFileStore?: DataStore;
|
544
|
-
|
545
|
-
readonly taskManager: TaskManager;
|
495
|
+
taskManager?: TaskManager;
|
546
496
|
ready(): Promise<void>;
|
547
497
|
close(): Promise<void>;
|
548
|
-
keyBag(): Promise<KeyBag>;
|
549
|
-
metaStore(): Promise<MetaStore>;
|
550
498
|
fileStore(): Promise<DataStore>;
|
551
499
|
WALStore(): Promise<WALStore>;
|
552
|
-
carStore(): Promise<DataStore>;
|
553
500
|
handleDbMetasFromStore(metas: DbMeta[]): Promise<void>;
|
554
501
|
}
|
555
502
|
type DbMetaEventBlock = EventBlock<{
|
@@ -558,17 +505,44 @@ type DbMetaEventBlock = EventBlock<{
|
|
558
505
|
type CarClockLink = Link<DbMetaEventBlock, number, number, Version>;
|
559
506
|
type CarClockHead = CarClockLink[];
|
560
507
|
|
561
|
-
interface
|
508
|
+
interface GatewayOpts {
|
562
509
|
readonly gateway: Gateway;
|
563
|
-
readonly test: TestGateway;
|
564
510
|
}
|
565
|
-
|
566
|
-
|
511
|
+
type GetResult = Result<Uint8Array, NotFoundError | Error>;
|
512
|
+
type VoidResult = Result<void>;
|
513
|
+
interface TestGateway {
|
514
|
+
get(url: URI, key: string): Promise<Uint8Array>;
|
515
|
+
}
|
516
|
+
type UnsubscribeResult = Result<() => void>;
|
517
|
+
interface Gateway {
|
518
|
+
buildUrl(baseUrl: URI, key: string): Promise<Result<URI>>;
|
519
|
+
start(baseUrl: URI): Promise<Result<URI>>;
|
520
|
+
close(baseUrl: URI): Promise<VoidResult>;
|
521
|
+
destroy(baseUrl: URI): Promise<VoidResult>;
|
522
|
+
put(url: URI, body: Uint8Array): Promise<VoidResult>;
|
523
|
+
get(url: URI): Promise<GetResult>;
|
524
|
+
delete(url: URI): Promise<VoidResult>;
|
525
|
+
subscribe?(url: URI, callback: (meta: Uint8Array) => void): Promise<UnsubscribeResult>;
|
526
|
+
}
|
527
|
+
|
528
|
+
interface GatewayFactoryItem {
|
529
|
+
readonly protocol: string;
|
530
|
+
readonly overrideBaseURL?: string;
|
531
|
+
readonly overrideRegistration?: boolean;
|
532
|
+
readonly gateway: (sthis: SuperThis) => Promise<Gateway>;
|
533
|
+
readonly test: (sthis: SuperThis) => Promise<TestGateway>;
|
534
|
+
}
|
535
|
+
interface GatewayReady {
|
536
|
+
readonly gateway: Gateway;
|
537
|
+
readonly test: TestGateway;
|
567
538
|
}
|
568
|
-
declare function
|
539
|
+
declare function getGatewayFromURL(url: URI, sthis: SuperThis): Promise<GatewayReady | undefined>;
|
540
|
+
declare function registerStoreProtocol(item: GatewayFactoryItem): () => void;
|
569
541
|
declare function testStoreFactory(url: URI, sthis: SuperThis): Promise<TestGateway>;
|
570
|
-
declare function
|
571
|
-
|
542
|
+
declare function ensureStart<T>(store: T & {
|
543
|
+
start: () => Promise<Result<URI>>;
|
544
|
+
}, logger: Logger): Promise<T>;
|
545
|
+
declare function toStoreRuntime(opts: StoreOpts, sthis: SuperThis): StoreRuntime;
|
572
546
|
|
573
547
|
declare class FragmentGateway implements Gateway {
|
574
548
|
readonly sthis: SuperThis;
|
@@ -588,20 +562,13 @@ declare class FragmentGateway implements Gateway {
|
|
588
562
|
delete(url: URI): Promise<VoidResult>;
|
589
563
|
}
|
590
564
|
|
591
|
-
interface
|
592
|
-
readonly
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
readonly
|
565
|
+
interface Connectable {
|
566
|
+
readonly blockstore: {
|
567
|
+
readonly loader?: Loader;
|
568
|
+
readonly ebOpts: BlockstoreRuntime;
|
569
|
+
};
|
570
|
+
readonly name?: string;
|
597
571
|
}
|
598
|
-
declare function getDefaultURI(sthis: SuperThis, protocol?: string): URI;
|
599
|
-
declare function registerStoreProtocol(item: GatewayFactoryItem): () => void;
|
600
|
-
declare function getGatewayFactoryItem(protocol: string): GatewayFactoryItem | undefined;
|
601
|
-
declare function fileGatewayFactoryItem(): GatewayFactoryItem;
|
602
|
-
|
603
|
-
declare function parseCarFile<T>(reader: CarReader, logger: Logger): Promise<CarHeader<T>>;
|
604
|
-
|
605
572
|
declare abstract class ConnectionBase implements Connection {
|
606
573
|
loader?: Loadable;
|
607
574
|
taskManager?: TaskManager;
|
@@ -622,6 +589,8 @@ declare abstract class ConnectionBase implements Connection {
|
|
622
589
|
}): Promise<void>;
|
623
590
|
}
|
624
591
|
|
592
|
+
declare function parseCarFile<T>(reader: CarReader, logger: Logger): Promise<CarHeader<T>>;
|
593
|
+
|
625
594
|
declare function setCryptoKeyFromGatewayMetaPayload(uri: URI, sthis: SuperThis, data: Uint8Array): Promise<Result<DbMeta | undefined>>;
|
626
595
|
declare function addCryptoKeyToGatewayMetaPayload(uri: URI, sthis: SuperThis, body: Uint8Array): Promise<Result<Uint8Array>>;
|
627
596
|
|
@@ -654,13 +623,13 @@ type index$3_CompactFetcher = CompactFetcher;
|
|
654
623
|
type index$3_CompactFn = CompactFn;
|
655
624
|
type index$3_CompactionFetcher = CompactionFetcher;
|
656
625
|
declare const index$3_CompactionFetcher: typeof CompactionFetcher;
|
626
|
+
type index$3_Connectable = Connectable;
|
657
627
|
type index$3_Connection = Connection;
|
658
628
|
type index$3_ConnectionBase = ConnectionBase;
|
659
629
|
declare const index$3_ConnectionBase: typeof ConnectionBase;
|
660
630
|
type index$3_DataSaveOpts = DataSaveOpts;
|
661
631
|
type index$3_DataStore = DataStore;
|
662
632
|
type index$3_DbMeta = DbMeta;
|
663
|
-
type index$3_DbMetaEvent = DbMetaEvent;
|
664
633
|
type index$3_DbMetaEventBlock = DbMetaEventBlock;
|
665
634
|
type index$3_EncryptedBlock = EncryptedBlock;
|
666
635
|
type index$3_EncryptedBlockstore = EncryptedBlockstore;
|
@@ -682,15 +651,9 @@ type index$3_Loadable = Loadable;
|
|
682
651
|
type index$3_Loader = Loader;
|
683
652
|
declare const index$3_Loader: typeof Loader;
|
684
653
|
type index$3_MetaStore = MetaStore;
|
685
|
-
type index$3_StoreEnDeFile = StoreEnDeFile;
|
686
654
|
type index$3_StoreFactory = StoreFactory;
|
687
|
-
type index$
|
655
|
+
type index$3_StoreOpts = StoreOpts;
|
688
656
|
type index$3_StoreRuntime = StoreRuntime;
|
689
|
-
type index$3_StoreRuntimeUrls = StoreRuntimeUrls;
|
690
|
-
type index$3_StoreURIRuntime = StoreURIRuntime;
|
691
|
-
type index$3_StoreURIs = StoreURIs;
|
692
|
-
type index$3_StoreUrls = StoreUrls;
|
693
|
-
type index$3_StoreUrlsOpts = StoreUrlsOpts;
|
694
657
|
type index$3_TestGateway = TestGateway;
|
695
658
|
type index$3_TransactionMeta = TransactionMeta;
|
696
659
|
type index$3_TransactionWrapper<M extends TransactionMeta> = TransactionWrapper<M>;
|
@@ -699,11 +662,8 @@ type index$3_VoidResult = VoidResult;
|
|
699
662
|
type index$3_WALState = WALState;
|
700
663
|
type index$3_WALStore = WALStore;
|
701
664
|
declare const index$3_addCryptoKeyToGatewayMetaPayload: typeof addCryptoKeyToGatewayMetaPayload;
|
702
|
-
declare const index$
|
703
|
-
declare const index$
|
704
|
-
declare const index$3_getDefaultURI: typeof getDefaultURI;
|
705
|
-
declare const index$3_getGatewayFactoryItem: typeof getGatewayFactoryItem;
|
706
|
-
declare const index$3_getStartedGateway: typeof getStartedGateway;
|
665
|
+
declare const index$3_ensureStart: typeof ensureStart;
|
666
|
+
declare const index$3_getGatewayFromURL: typeof getGatewayFromURL;
|
707
667
|
declare const index$3_parseCarFile: typeof parseCarFile;
|
708
668
|
declare const index$3_registerStoreProtocol: typeof registerStoreProtocol;
|
709
669
|
declare const index$3_setCryptoKeyFromGatewayMetaPayload: typeof setCryptoKeyFromGatewayMetaPayload;
|
@@ -711,66 +671,35 @@ declare const index$3_testStoreFactory: typeof testStoreFactory;
|
|
711
671
|
declare const index$3_toCIDBlock: typeof toCIDBlock;
|
712
672
|
declare const index$3_toStoreRuntime: typeof toStoreRuntime;
|
713
673
|
declare namespace index$3 {
|
714
|
-
export { type index$3_AnyAnyBlock as AnyAnyBlock, type index$3_AnyAnyLink as AnyAnyLink, type index$3_AnyBlock as AnyBlock, type index$3_AnyDecodedBlock as AnyDecodedBlock, type index$3_AnyLink as AnyLink, type index$3_AnyLinkFn as AnyLinkFn, index$3_BaseBlockstore as BaseBlockstore, type index$3_BaseStore as BaseStore, type index$3_BlobLike as BlobLike, type index$3_BlockFetcher as BlockFetcher, type index$3_BlockstoreOpts as BlockstoreOpts, type index$3_BlockstoreRuntime as BlockstoreRuntime, type index$3_BytesWithIv as BytesWithIv, type index$3_CIDBlock as CIDBlock, type index$3_CarClockHead as CarClockHead, type index$3_CarClockLink as CarClockLink, type index$3_CarGroup as CarGroup, type index$3_CarHeader as CarHeader, type index$3_CarLog as CarLog, type index$3_CarMakeable as CarMakeable, index$3_CarTransaction as CarTransaction, type index$3_CodecOpts as CodecOpts, type index$3_CommitOpts as CommitOpts, type index$3_CompactFetcher as CompactFetcher, type index$3_CompactFn as CompactFn, index$3_CompactionFetcher as CompactionFetcher, type index$3_Connection as Connection, index$3_ConnectionBase as ConnectionBase, type index$3_DataSaveOpts as DataSaveOpts, type index$3_DataStore as DataStore, type index$3_DbMeta as DbMeta, type index$
|
674
|
+
export { type index$3_AnyAnyBlock as AnyAnyBlock, type index$3_AnyAnyLink as AnyAnyLink, type index$3_AnyBlock as AnyBlock, type index$3_AnyDecodedBlock as AnyDecodedBlock, type index$3_AnyLink as AnyLink, type index$3_AnyLinkFn as AnyLinkFn, index$3_BaseBlockstore as BaseBlockstore, type index$3_BaseStore as BaseStore, type index$3_BlobLike as BlobLike, type index$3_BlockFetcher as BlockFetcher, type index$3_BlockstoreOpts as BlockstoreOpts, type index$3_BlockstoreRuntime as BlockstoreRuntime, type index$3_BytesWithIv as BytesWithIv, type index$3_CIDBlock as CIDBlock, type index$3_CarClockHead as CarClockHead, type index$3_CarClockLink as CarClockLink, type index$3_CarGroup as CarGroup, type index$3_CarHeader as CarHeader, type index$3_CarLog as CarLog, type index$3_CarMakeable as CarMakeable, index$3_CarTransaction as CarTransaction, type index$3_CodecOpts as CodecOpts, type index$3_CommitOpts as CommitOpts, type index$3_CompactFetcher as CompactFetcher, type index$3_CompactFn as CompactFn, index$3_CompactionFetcher as CompactionFetcher, type index$3_Connectable as Connectable, type index$3_Connection as Connection, index$3_ConnectionBase as ConnectionBase, type index$3_DataSaveOpts as DataSaveOpts, type index$3_DataStore as DataStore, type index$3_DbMeta as DbMeta, type index$3_DbMetaEventBlock as DbMetaEventBlock, type index$3_EncryptedBlock as EncryptedBlock, index$3_EncryptedBlockstore as EncryptedBlockstore, index$3_FragmentGateway as FragmentGateway, type index$3_Gateway as Gateway, type index$3_GatewayFactoryItem as GatewayFactoryItem, type index$3_GatewayOpts as GatewayOpts, type index$3_GetResult as GetResult, type index$3_IvAndBytes as IvAndBytes, type index$3_IvKeyIdData as IvKeyIdData, type index$3_KeyMaterial as KeyMaterial, type index$3_KeyWithFingerExtract as KeyWithFingerExtract, type index$3_KeyWithFingerPrint as KeyWithFingerPrint, type index$3_KeyedCrypto as KeyedCrypto, type index$3_LoadHandler as LoadHandler, type index$3_Loadable as Loadable, index$3_Loader as Loader, type index$3_MetaStore as MetaStore, type index$3_StoreFactory as StoreFactory, type index$3_StoreOpts as StoreOpts, type index$3_StoreRuntime as StoreRuntime, type index$3_TestGateway as TestGateway, type index$3_TransactionMeta as TransactionMeta, type index$3_TransactionWrapper as TransactionWrapper, type index$3_UnsubscribeResult as UnsubscribeResult, type index$3_VoidResult as VoidResult, type index$3_WALState as WALState, type index$3_WALStore as WALStore, index$3_addCryptoKeyToGatewayMetaPayload as addCryptoKeyToGatewayMetaPayload, index$3_ensureStart as ensureStart, index$3_getGatewayFromURL as getGatewayFromURL, index$3_parseCarFile as parseCarFile, index$3_registerStoreProtocol as registerStoreProtocol, index$3_setCryptoKeyFromGatewayMetaPayload as setCryptoKeyFromGatewayMetaPayload, index$3_testStoreFactory as testStoreFactory, index$3_toCIDBlock as toCIDBlock, index$3_toStoreRuntime as toStoreRuntime };
|
715
675
|
}
|
716
676
|
|
717
677
|
type Falsy = false | null | undefined;
|
718
678
|
declare function isFalsy(value: unknown): value is Falsy;
|
719
|
-
declare enum PARAM {
|
720
|
-
SUFFIX = "suffix",
|
721
|
-
URL_GEN = "urlGen",
|
722
|
-
STORE_KEY = "storekey",
|
723
|
-
STORE = "store",
|
724
|
-
KEY = "key",
|
725
|
-
INDEX = "index",
|
726
|
-
NAME = "name",
|
727
|
-
VERSION = "version",
|
728
|
-
FRAG_SIZE = "fragSize",
|
729
|
-
IV_VERIFY = "ivVerify",
|
730
|
-
IV_HASH = "ivHash",
|
731
|
-
FRAG_FID = "fid",
|
732
|
-
FRAG_OFS = "ofs",
|
733
|
-
FRAG_LEN = "len",
|
734
|
-
FRAG_HEAD = "headerSize"
|
735
|
-
}
|
736
679
|
declare function throwFalsy<T>(value: T | Falsy): T;
|
737
680
|
declare function falsyToUndef<T>(value: T | Falsy): T | undefined;
|
738
681
|
type StoreType = "data" | "wal" | "meta";
|
739
|
-
interface FPStats {
|
740
|
-
isFile(): boolean;
|
741
|
-
isDirectory(): boolean;
|
742
|
-
isBlockDevice(): boolean;
|
743
|
-
isCharacterDevice(): boolean;
|
744
|
-
isSymbolicLink(): boolean;
|
745
|
-
isFIFO(): boolean;
|
746
|
-
isSocket(): boolean;
|
747
|
-
uid: number | Falsy;
|
748
|
-
gid: number | Falsy;
|
749
|
-
size: number | Falsy;
|
750
|
-
atime: Date | Falsy;
|
751
|
-
mtime: Date | Falsy;
|
752
|
-
ctime: Date | Falsy;
|
753
|
-
birthtime: Date | Falsy;
|
754
|
-
}
|
755
682
|
interface SysFileSystem {
|
756
683
|
start(): Promise<SysFileSystem>;
|
757
|
-
mkdir(path:
|
684
|
+
mkdir(path: PathLike, options?: {
|
758
685
|
recursive: boolean;
|
759
686
|
}): Promise<string | undefined>;
|
760
|
-
readdir(path:
|
761
|
-
rm(path:
|
687
|
+
readdir(path: PathLike, options?: unknown): Promise<string[]>;
|
688
|
+
rm(path: PathLike, options?: MakeDirectoryOptions & {
|
762
689
|
recursive: boolean;
|
763
690
|
}): Promise<void>;
|
764
|
-
copyFile(source:
|
765
|
-
readfile(path:
|
766
|
-
|
767
|
-
|
768
|
-
|
691
|
+
copyFile(source: PathLike, destination: PathLike): Promise<void>;
|
692
|
+
readfile(path: PathLike, options?: {
|
693
|
+
encoding: BufferEncoding;
|
694
|
+
flag?: string;
|
695
|
+
}): Promise<Uint8Array>;
|
696
|
+
stat(path: PathLike): Promise<Stats>;
|
697
|
+
unlink(path: PathLike): Promise<void>;
|
698
|
+
writefile(path: PathLike, data: Uint8Array | string): Promise<void>;
|
769
699
|
}
|
770
700
|
interface PathOps {
|
771
701
|
join(...args: string[]): string;
|
772
702
|
dirname(path: string): string;
|
773
|
-
basename(path: string): string;
|
774
703
|
}
|
775
704
|
interface TextEndeCoder {
|
776
705
|
encode(input: string): Uint8Array;
|
@@ -790,14 +719,12 @@ interface SuperThis {
|
|
790
719
|
readonly pathOps: PathOps;
|
791
720
|
readonly ctx: Record<string, unknown>;
|
792
721
|
readonly txt: TextEndeCoder;
|
793
|
-
timeOrderedNextId(time?: number): {
|
794
|
-
str: string;
|
795
|
-
toString: () => string;
|
796
|
-
};
|
797
722
|
nextId(bytes?: number): {
|
798
723
|
str: string;
|
799
724
|
bin: Uint8Array;
|
800
|
-
|
725
|
+
};
|
726
|
+
timeOrderedNextId(time?: number): {
|
727
|
+
str: string;
|
801
728
|
};
|
802
729
|
start(): Promise<void>;
|
803
730
|
clone(override: Partial<SuperThisOpts>): SuperThis;
|
@@ -805,11 +732,10 @@ interface SuperThis {
|
|
805
732
|
interface ConfigOpts extends Partial<SuperThisOpts> {
|
806
733
|
readonly public?: boolean;
|
807
734
|
readonly meta?: DbMeta;
|
735
|
+
readonly persistIndexes?: boolean;
|
808
736
|
readonly autoCompact?: number;
|
809
|
-
readonly
|
810
|
-
readonly storeEnDe?: StoreEnDeFile;
|
737
|
+
readonly store?: StoreOpts;
|
811
738
|
readonly threshold?: number;
|
812
|
-
readonly keyBag?: Partial<KeyBagOpts>;
|
813
739
|
}
|
814
740
|
type ClockLink = EventLink<Operation>;
|
815
741
|
type ClockHead = ClockLink[];
|
@@ -979,11 +905,13 @@ interface ProllyNode<K extends IndexKeyType, T extends DocFragment> extends Prol
|
|
979
905
|
readonly block: Promise<Block$1>;
|
980
906
|
}
|
981
907
|
|
982
|
-
declare function index$2<K extends IndexKeyType = string, T extends DocTypes = NonNullable<unknown>, R extends DocFragment = T>(
|
908
|
+
declare function index$2<K extends IndexKeyType = string, T extends DocTypes = NonNullable<unknown>, R extends DocFragment = T>(sthis: SuperThis, { _crdt }: {
|
909
|
+
_crdt: CRDT<T> | CRDT<NonNullable<unknown>>;
|
910
|
+
}, name: string, mapFn?: MapFn<T>, meta?: IdxMeta): Index<K, T, R>;
|
983
911
|
declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFragment = T> {
|
984
912
|
readonly blockstore: BaseBlockstore;
|
985
913
|
readonly crdt: CRDT<T>;
|
986
|
-
|
914
|
+
name: string;
|
987
915
|
mapFn?: MapFn<T>;
|
988
916
|
mapFnString: string;
|
989
917
|
byKey: IndexTree<K, R>;
|
@@ -992,6 +920,8 @@ declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFra
|
|
992
920
|
includeDocsDefault: boolean;
|
993
921
|
initError?: Error;
|
994
922
|
ready(): Promise<void>;
|
923
|
+
close(): Promise<void>;
|
924
|
+
destroy(): Promise<void>;
|
995
925
|
readonly logger: Logger;
|
996
926
|
constructor(sthis: SuperThis, crdt: CRDT<T> | CRDT<NonNullable<unknown>>, name: string, mapFn?: MapFn<T>, meta?: IdxMeta);
|
997
927
|
applyMapFn(name: string, mapFn?: MapFn<T>, meta?: IdxMeta): void;
|
@@ -1037,18 +967,16 @@ declare class CRDTClock<T extends DocTypes> {
|
|
1037
967
|
int_applyHead(newHead: ClockHead, prevHead: ClockHead, localUpdates: boolean): Promise<void>;
|
1038
968
|
}
|
1039
969
|
|
1040
|
-
interface HasCRDT<T extends DocTypes> {
|
1041
|
-
readonly crdt: CRDT<T> | CRDT<NonNullable<unknown>>;
|
1042
|
-
}
|
1043
970
|
declare class CRDT<T extends DocTypes> {
|
1044
|
-
readonly
|
971
|
+
readonly name?: string;
|
972
|
+
readonly opts: ConfigOpts;
|
1045
973
|
readonly blockstore: BaseBlockstore;
|
1046
974
|
readonly indexBlockstore: BaseBlockstore;
|
1047
975
|
readonly indexers: Map<string, Index<IndexKeyType, NonNullable<unknown>>>;
|
1048
976
|
readonly clock: CRDTClock<T>;
|
1049
977
|
readonly logger: Logger;
|
1050
978
|
readonly sthis: SuperThis;
|
1051
|
-
constructor(sthis: SuperThis, opts
|
979
|
+
constructor(sthis: SuperThis, name?: string, opts?: ConfigOpts);
|
1052
980
|
bulk(updates: DocUpdate<T>[]): Promise<CRDTMeta>;
|
1053
981
|
readonly onceReady: ResolveOnce<void>;
|
1054
982
|
ready(): Promise<void>;
|
@@ -1068,90 +996,23 @@ declare class CRDT<T extends DocTypes> {
|
|
1068
996
|
compact(): Promise<void>;
|
1069
997
|
}
|
1070
998
|
|
1071
|
-
declare
|
1072
|
-
|
999
|
+
declare class Database<DT extends DocTypes = NonNullable<unknown>> implements Connectable {
|
1000
|
+
static databases: Map<string, Database>;
|
1073
1001
|
readonly name?: string;
|
1074
|
-
readonly
|
1075
|
-
readonly storeUrls: StoreURIRuntime;
|
1076
|
-
readonly storeEnDe: StoreEnDeFile;
|
1077
|
-
readonly keyBag: KeyBagRuntime;
|
1078
|
-
}
|
1079
|
-
interface Database<DT extends DocTypes = NonNullable<unknown>> extends HasCRDT<DT> {
|
1080
|
-
readonly logger: Logger;
|
1081
|
-
readonly sthis: SuperThis;
|
1082
|
-
readonly id: string;
|
1083
|
-
name(): string;
|
1084
|
-
onClosed(fn: () => void): void;
|
1085
|
-
close(): Promise<void>;
|
1086
|
-
destroy(): Promise<void>;
|
1087
|
-
ready(): Promise<void>;
|
1088
|
-
get<T extends DocTypes>(id: string): Promise<DocWithId<T>>;
|
1089
|
-
put<T extends DocTypes>(doc: DocSet<T>): Promise<DocResponse>;
|
1090
|
-
del(id: string): Promise<DocResponse>;
|
1091
|
-
changes<T extends DocTypes>(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse<T>>;
|
1092
|
-
allDocs<T extends DocTypes>(opts?: AllDocsQueryOpts): Promise<AllDocsResponse<T>>;
|
1093
|
-
allDocuments<T extends DocTypes>(): Promise<{
|
1094
|
-
rows: {
|
1095
|
-
key: string;
|
1096
|
-
value: DocWithId<T>;
|
1097
|
-
}[];
|
1098
|
-
clock: ClockHead;
|
1099
|
-
}>;
|
1100
|
-
subscribe<T extends DocTypes>(listener: ListenerFn<T>, updates?: boolean): () => void;
|
1101
|
-
query<K extends IndexKeyType, T extends DocTypes, R extends DocFragment = T>(field: string | MapFn<T>, opts?: QueryOpts<K>): Promise<IndexRows<K, T, R>>;
|
1102
|
-
compact(): Promise<void>;
|
1103
|
-
}
|
1104
|
-
declare function isDatabase<T extends DocTypes = NonNullable<unknown>>(db: unknown): db is Database<T>;
|
1105
|
-
declare function DatabaseFactory<T extends DocTypes = NonNullable<unknown>>(name: string | undefined, opts?: ConfigOpts): Database<T>;
|
1106
|
-
declare class DatabaseShell<DT extends DocTypes = NonNullable<unknown>> implements Database<DT> {
|
1107
|
-
readonly ref: DatabaseImpl<DT>;
|
1108
|
-
constructor(ref: DatabaseImpl<DT>);
|
1109
|
-
get id(): string;
|
1110
|
-
get logger(): Logger;
|
1111
|
-
get sthis(): SuperThis;
|
1112
|
-
get crdt(): CRDT<DT>;
|
1113
|
-
name(): string;
|
1114
|
-
onClosed(fn: () => void): void;
|
1115
|
-
close(): Promise<void>;
|
1116
|
-
destroy(): Promise<void>;
|
1117
|
-
ready(): Promise<void>;
|
1118
|
-
get<T extends DocTypes>(id: string): Promise<DocWithId<T>>;
|
1119
|
-
put<T extends DocTypes>(doc: DocSet<T>): Promise<DocResponse>;
|
1120
|
-
del(id: string): Promise<DocResponse>;
|
1121
|
-
changes<T extends DocTypes>(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse<T>>;
|
1122
|
-
allDocs<T extends DocTypes>(opts?: AllDocsQueryOpts): Promise<AllDocsResponse<T>>;
|
1123
|
-
allDocuments<T extends DocTypes>(): Promise<{
|
1124
|
-
rows: {
|
1125
|
-
key: string;
|
1126
|
-
value: DocWithId<T>;
|
1127
|
-
}[];
|
1128
|
-
clock: ClockHead;
|
1129
|
-
}>;
|
1130
|
-
subscribe<T extends DocTypes>(listener: ListenerFn<T>, updates?: boolean): () => void;
|
1131
|
-
query<K extends IndexKeyType, T extends DocTypes, R extends DocFragment = T>(field: string | MapFn<T>, opts?: QueryOpts<K>): Promise<IndexRows<K, T, R>>;
|
1132
|
-
compact(): Promise<void>;
|
1133
|
-
}
|
1134
|
-
declare class DatabaseImpl<DT extends DocTypes = NonNullable<unknown>> implements Database<DT> {
|
1135
|
-
readonly opts: DatabaseOpts;
|
1002
|
+
readonly opts: ConfigOpts;
|
1136
1003
|
_listening: boolean;
|
1137
1004
|
readonly _listeners: Set<ListenerFn<DT>>;
|
1138
1005
|
readonly _noupdate_listeners: Set<ListenerFn<DT>>;
|
1139
|
-
readonly
|
1006
|
+
readonly _crdt: CRDT<DT>;
|
1140
1007
|
readonly _writeQueue: WriteQueue<DT>;
|
1141
|
-
readonly
|
1142
|
-
addShell(shell: DatabaseShell<DT>): void;
|
1143
|
-
readonly _onClosedFns: Set<() => void>;
|
1144
|
-
onClosed(fn: () => void): void;
|
1008
|
+
readonly blockstore: BaseBlockstore;
|
1145
1009
|
close(): Promise<void>;
|
1146
|
-
shellClose(db: DatabaseShell<DT>): Promise<void>;
|
1147
1010
|
destroy(): Promise<void>;
|
1148
1011
|
readonly _ready: ResolveOnce<void>;
|
1149
1012
|
ready(): Promise<void>;
|
1150
1013
|
readonly logger: Logger;
|
1151
1014
|
readonly sthis: SuperThis;
|
1152
|
-
|
1153
|
-
constructor(sthis: SuperThis, opts: DatabaseOpts);
|
1154
|
-
name(): string;
|
1015
|
+
constructor(name?: string, opts?: ConfigOpts);
|
1155
1016
|
get<T extends DocTypes>(id: string): Promise<DocWithId<T>>;
|
1156
1017
|
put<T extends DocTypes>(doc: DocSet<T>): Promise<DocResponse>;
|
1157
1018
|
del(id: string): Promise<DocResponse>;
|
@@ -1170,7 +1031,6 @@ declare class DatabaseImpl<DT extends DocTypes = NonNullable<unknown>> implement
|
|
1170
1031
|
_notify(updates: DocUpdate<NonNullable<unknown>>[]): Promise<void>;
|
1171
1032
|
_no_update_notify(): Promise<void>;
|
1172
1033
|
}
|
1173
|
-
declare function toStoreURIRuntime(sthis: SuperThis, name?: string, sopts?: StoreUrlsOpts): StoreURIRuntime;
|
1174
1034
|
declare function fireproof(name: string, opts?: ConfigOpts): Database;
|
1175
1035
|
|
1176
1036
|
declare function getFileSystem(url: URI): Promise<SysFileSystem>;
|
@@ -1274,5 +1134,5 @@ declare namespace index {
|
|
1274
1134
|
|
1275
1135
|
declare const PACKAGE_VERSION: string;
|
1276
1136
|
|
1277
|
-
export { type AllDocsQueryOpts, type AllDocsResponse, CRDT, type CRDTEntry, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, type
|
1137
|
+
export { type AllDocsQueryOpts, type AllDocsResponse, CRDT, type CRDTEntry, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, type Connectable, Database, type DocBase, type DocFileMeta, type DocFiles, type DocFragment, type DocLiteral, type DocObject, type DocRecord, type DocResponse, type DocSet, type DocTypes, type DocUpdate, type DocValue, type DocWithId, type Falsy, type FileTransactionMeta, type IdxMeta, type IdxMetaMap, Index, type IndexKey, type IndexKeyType, type IndexRow, type IndexRows, type IndexTransactionMeta, type IndexUpdate, type IndexUpdateString, type Joiner, type KeyLiteral, type ListenerFn, type MapFn, type MetaType, type NoUpdateListenerFn, NotFoundError, PACKAGE_VERSION, type PathOps, type QueryOpts, type Store, type StoreType, type SuperThis, type SuperThisOpts, type SysFileSystem, type TextEndeCoder, UInt8ArrayEqual, type UnknownDoc, type UpdateListenerFn, index$3 as blockstore, index$3 as bs, dataDir, ensureLogger, ensureSuperLog, ensureSuperThis, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$2 as index, isFalsy, isNotFoundError, index as rt, index as runtime, throwFalsy };
|
1278
1138
|
declare module '@fireproof/core'
|