@fireproof/core 0.19.8-dev-alldocs → 0.19.8-dev-cra

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/{chunk-DG6XSV44.js → chunk-BNL4PVBF.js} +25 -81
  2. package/chunk-BNL4PVBF.js.map +1 -0
  3. package/{chunk-OWQAHX2V.js → chunk-JW2QT6BF.js} +24 -4
  4. package/chunk-JW2QT6BF.js.map +1 -0
  5. package/index.cjs +443 -1300
  6. package/index.cjs.map +1 -1
  7. package/index.d.cts +156 -167
  8. package/index.d.ts +156 -167
  9. package/index.global.js +1036 -1214
  10. package/index.global.js.map +1 -1
  11. package/index.js +64 -59
  12. package/index.js.map +1 -1
  13. package/metafile-cjs.json +1 -1
  14. package/metafile-esm.json +1 -1
  15. package/metafile-iife.json +1 -1
  16. package/node-sys-container-MIEX6ELJ.js +29 -0
  17. package/node-sys-container-MIEX6ELJ.js.map +1 -0
  18. package/package.json +3 -2
  19. package/{store-file-WD746RSY.js → store-file-VJ6BI4II.js} +6 -8
  20. package/{store-file-WD746RSY.js.map → store-file-VJ6BI4II.js.map} +1 -1
  21. package/{chunk-5UFCF36O.js → store-indexdb-WLRSICCB.js} +7 -17
  22. package/store-indexdb-WLRSICCB.js.map +1 -0
  23. package/tests/fireproof/config.test.ts +14 -70
  24. package/tests/fireproof/database.test.ts +4 -4
  25. package/tests/fireproof/fireproof.test.ts +5 -5
  26. package/tests/fireproof/hello.test.ts +2 -2
  27. package/chunk-5UFCF36O.js.map +0 -1
  28. package/chunk-DG6XSV44.js.map +0 -1
  29. package/chunk-OWQAHX2V.js.map +0 -1
  30. package/chunk-PRQHQG4I.js +0 -39
  31. package/chunk-PRQHQG4I.js.map +0 -1
  32. package/chunk-VZGT7ZYP.js +0 -22
  33. package/chunk-VZGT7ZYP.js.map +0 -1
  34. package/node-sys-container-TTGEC66A.js +0 -29
  35. package/node-sys-container-TTGEC66A.js.map +0 -1
  36. package/sqlite-data-store-MA55LVQE.js +0 -120
  37. package/sqlite-data-store-MA55LVQE.js.map +0 -1
  38. package/sqlite-meta-store-UNQKVYRM.js +0 -137
  39. package/sqlite-meta-store-UNQKVYRM.js.map +0 -1
  40. package/sqlite-wal-store-KVUOC4PO.js +0 -123
  41. package/sqlite-wal-store-KVUOC4PO.js.map +0 -1
  42. package/store-indexdb-NG45BU3Q.js +0 -20
  43. package/store-indexdb-NG45BU3Q.js.map +0 -1
  44. package/store-sql-QVFNIGND.js +0 -344
  45. package/store-sql-QVFNIGND.js.map +0 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Result, Logger, ResolveOnce, EnvImpl } from '@adviser/cement';
2
- export { Logger } from '@adviser/cement';
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';
5
5
  import { Version, Block, Link } from 'multiformats';
@@ -9,8 +9,7 @@ import { MemoryBlockstore } from '@web3-storage/pail/block';
9
9
  import { BlockFetcher as BlockFetcher$1 } from '@web3-storage/pail/api';
10
10
  import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
11
11
  import { EventBlock } from '@web3-storage/pail/clock';
12
- import { PathLike, MakeDirectoryOptions, Stats, ObjectEncodingOptions, Dirent } from 'node:fs';
13
- import { RunResult } from 'better-sqlite3';
12
+ import { PathLike, MakeDirectoryOptions, Stats, ObjectEncodingOptions, Dirent } from 'fs';
14
13
 
15
14
  interface GatewayOpts {
16
15
  readonly gateway: Gateway;
@@ -284,18 +283,75 @@ interface TransactionWrapper<M extends TransactionMeta> {
284
283
  t: CarTransaction;
285
284
  }
286
285
  type TransactionMeta = unknown;
286
+ interface FPJsonWebKey {
287
+ alg?: string;
288
+ crv?: string;
289
+ d?: string;
290
+ dp?: string;
291
+ dq?: string;
292
+ e?: string;
293
+ ext?: boolean;
294
+ k?: string;
295
+ key_ops?: string[];
296
+ kty?: string;
297
+ n?: string;
298
+ oth?: RsaOtherPrimesInfo[];
299
+ p?: string;
300
+ q?: string;
301
+ qi?: string;
302
+ use?: string;
303
+ x?: string;
304
+ y?: string;
305
+ }
306
+ type FPKeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
307
+ type FPKeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey";
308
+ interface FPAlgorithm {
309
+ name: string;
310
+ }
311
+ type FPAlgorithmIdentifier = FPAlgorithm | string;
312
+ interface FPRsaHashedImportParams extends FPAlgorithm {
313
+ hash: FPAlgorithmIdentifier;
314
+ }
315
+ type FPNamedCurve = string;
316
+ interface FPEcKeyImportParams extends FPAlgorithm {
317
+ namedCurve: FPNamedCurve;
318
+ }
319
+ interface FPHmacImportParams extends FPAlgorithm {
320
+ hash: FPAlgorithmIdentifier;
321
+ length?: number;
322
+ }
323
+ interface FPAesKeyAlgorithm extends FPAlgorithm {
324
+ length: number;
325
+ }
326
+ type FPKeyType = "private" | "public" | "secret";
327
+ interface FPCryptoKey {
328
+ readonly algorithm: FPAlgorithm;
329
+ readonly extractable: boolean;
330
+ readonly type: FPKeyType;
331
+ readonly usages: FPKeyUsage[];
332
+ }
333
+ interface FPArrayBufferTypes {
334
+ ArrayBuffer: ArrayBuffer;
335
+ }
336
+ type FPArrayBufferLike = FPArrayBufferTypes[keyof FPArrayBufferTypes];
337
+ interface FPArrayBufferView {
338
+ buffer: FPArrayBufferLike;
339
+ byteLength: number;
340
+ byteOffset: number;
341
+ }
342
+ type FPBufferSource = FPArrayBufferView | ArrayBuffer;
287
343
  interface CryptoOpts {
288
- readonly importKey: typeof crypto.subtle.importKey;
344
+ importKey(format: FPKeyFormat, keyData: FPJsonWebKey | FPBufferSource, algorithm: FPAlgorithmIdentifier | FPRsaHashedImportParams | FPEcKeyImportParams | FPHmacImportParams | FPAesKeyAlgorithm, extractable: boolean, keyUsages: FPKeyUsage[]): Promise<FPCryptoKey>;
289
345
  readonly decrypt: (algo: {
290
346
  name: string;
291
347
  iv: Uint8Array;
292
348
  tagLength: number;
293
- }, key: CryptoKey, data: Uint8Array) => Promise<ArrayBuffer>;
349
+ }, key: FPCryptoKey, data: Uint8Array) => Promise<ArrayBuffer>;
294
350
  readonly encrypt: (algo: {
295
351
  name: string;
296
352
  iv: Uint8Array;
297
353
  tagLength: number;
298
- }, key: CryptoKey, data: Uint8Array) => Promise<ArrayBuffer>;
354
+ }, key: FPCryptoKey, data: Uint8Array) => Promise<ArrayBuffer>;
299
355
  readonly digestSHA256: (data: Uint8Array) => Promise<ArrayBuffer>;
300
356
  readonly randomBytes: (size: number) => Uint8Array;
301
357
  }
@@ -445,6 +501,7 @@ declare function toURL(pathOrUrl: string | URL, isIndex?: string): URL;
445
501
  interface StoreFactoryItem {
446
502
  readonly protocol: string;
447
503
  readonly overrideBaseURL?: string;
504
+ readonly overrideRegistration?: boolean;
448
505
  readonly data: (logger: Logger) => Promise<Gateway>;
449
506
  readonly meta: (logger: Logger) => Promise<Gateway>;
450
507
  readonly wal: (logger: Logger) => Promise<Gateway>;
@@ -456,67 +513,67 @@ declare function toStoreRuntime(opts: StoreOpts, ilogger: Logger): StoreRuntime;
456
513
 
457
514
  declare function parseCarFile<T>(reader: CarReader, logger: Logger): Promise<CarHeader<T>>;
458
515
 
459
- type index$3_AnyAnyLink = AnyAnyLink;
460
- type index$3_AnyBlock = AnyBlock;
461
- type index$3_AnyLink = AnyLink;
462
- type index$3_BaseBlockstore = BaseBlockstore;
463
- declare const index$3_BaseBlockstore: typeof BaseBlockstore;
464
- type index$3_BlobLike = BlobLike;
465
- type index$3_BlockFetcher = BlockFetcher;
466
- type index$3_CarClockHead = CarClockHead;
467
- type index$3_CarGroup = CarGroup;
468
- type index$3_CarTransaction = CarTransaction;
469
- declare const index$3_CarTransaction: typeof CarTransaction;
470
- type index$3_CommitOpts = CommitOpts;
471
- type index$3_CompactionFetcher = CompactionFetcher;
472
- declare const index$3_CompactionFetcher: typeof CompactionFetcher;
473
- type index$3_ConnectREST = ConnectREST;
474
- declare const index$3_ConnectREST: typeof ConnectREST;
475
- type index$3_Connectable = Connectable;
476
- type index$3_Connection = Connection;
477
- type index$3_ConnectionBase = ConnectionBase;
478
- declare const index$3_ConnectionBase: typeof ConnectionBase;
479
- type index$3_CryptoOpts = CryptoOpts;
480
- type index$3_DataSaveOpts = DataSaveOpts;
481
- type index$3_DataStore = DataStore;
482
- declare const index$3_DataStore: typeof DataStore;
483
- type index$3_DbMeta = DbMeta;
484
- type index$3_DbMetaEventBlock = DbMetaEventBlock;
485
- type index$3_DownloadDataFnParams = DownloadDataFnParams;
486
- type index$3_DownloadMetaFnParams = DownloadMetaFnParams;
487
- type index$3_EncryptedBlockstore = EncryptedBlockstore;
488
- declare const index$3_EncryptedBlockstore: typeof EncryptedBlockstore;
489
- type index$3_Gateway = Gateway;
490
- type index$3_GatewayOpts = GatewayOpts;
491
- type index$3_GetResult = GetResult;
492
- type index$3_Loadable = Loadable;
493
- declare const index$3_Loadable: typeof Loadable;
494
- type index$3_Loader = Loader;
495
- declare const index$3_Loader: typeof Loader;
496
- type index$3_MetaStore = MetaStore;
497
- declare const index$3_MetaStore: typeof MetaStore;
498
- type index$3_NotFoundError = NotFoundError;
499
- declare const index$3_NotFoundError: typeof NotFoundError;
500
- type index$3_RemoteWAL = RemoteWAL;
501
- declare const index$3_RemoteWAL: typeof RemoteWAL;
502
- type index$3_StoreFactory = StoreFactory;
503
- type index$3_StoreFactoryItem = StoreFactoryItem;
504
- type index$3_StoreOpts = StoreOpts;
505
- type index$3_StoreRuntime = StoreRuntime;
506
- type index$3_TestStore = TestStore;
507
- type index$3_TransactionMeta = TransactionMeta;
508
- type index$3_UploadDataFnParams = UploadDataFnParams;
509
- type index$3_UploadMetaFnParams = UploadMetaFnParams;
510
- type index$3_VoidResult = VoidResult;
511
- type index$3_WALState = WALState;
512
- declare const index$3_isNotFoundError: typeof isNotFoundError;
513
- declare const index$3_parseCarFile: typeof parseCarFile;
514
- declare const index$3_registerStoreProtocol: typeof registerStoreProtocol;
515
- declare const index$3_testStoreFactory: typeof testStoreFactory;
516
- declare const index$3_toStoreRuntime: typeof toStoreRuntime;
517
- declare const index$3_toURL: typeof toURL;
518
- declare namespace index$3 {
519
- export { type index$3_AnyAnyLink as AnyAnyLink, type index$3_AnyBlock as AnyBlock, type index$3_AnyLink as AnyLink, index$3_BaseBlockstore as BaseBlockstore, type index$3_BlobLike as BlobLike, type index$3_BlockFetcher as BlockFetcher, type index$3_CarClockHead as CarClockHead, type index$3_CarGroup as CarGroup, index$3_CarTransaction as CarTransaction, type index$3_CommitOpts as CommitOpts, index$3_CompactionFetcher as CompactionFetcher, index$3_ConnectREST as ConnectREST, type index$3_Connectable as Connectable, type index$3_Connection as Connection, index$3_ConnectionBase as ConnectionBase, type index$3_CryptoOpts as CryptoOpts, type index$3_DataSaveOpts as DataSaveOpts, index$3_DataStore as DataStore, type index$3_DbMeta as DbMeta, type index$3_DbMetaEventBlock as DbMetaEventBlock, type index$3_DownloadDataFnParams as DownloadDataFnParams, type index$3_DownloadMetaFnParams as DownloadMetaFnParams, index$3_EncryptedBlockstore as EncryptedBlockstore, type index$3_Gateway as Gateway, type index$3_GatewayOpts as GatewayOpts, type index$3_GetResult as GetResult, index$3_Loadable as Loadable, index$3_Loader as Loader, index$3_MetaStore as MetaStore, index$3_NotFoundError as NotFoundError, index$3_RemoteWAL as RemoteWAL, type index$3_StoreFactory as StoreFactory, type index$3_StoreFactoryItem as StoreFactoryItem, type index$3_StoreOpts as StoreOpts, type index$3_StoreRuntime as StoreRuntime, type index$3_TestStore as TestStore, type index$3_TransactionMeta as TransactionMeta, type index$3_UploadDataFnParams as UploadDataFnParams, type index$3_UploadMetaFnParams as UploadMetaFnParams, type index$3_VoidResult as VoidResult, type index$3_WALState as WALState, index$3_isNotFoundError as isNotFoundError, index$3_parseCarFile as parseCarFile, index$3_registerStoreProtocol as registerStoreProtocol, index$3_testStoreFactory as testStoreFactory, index$3_toStoreRuntime as toStoreRuntime, index$3_toURL as toURL };
516
+ type index$2_AnyAnyLink = AnyAnyLink;
517
+ type index$2_AnyBlock = AnyBlock;
518
+ type index$2_AnyLink = AnyLink;
519
+ type index$2_BaseBlockstore = BaseBlockstore;
520
+ declare const index$2_BaseBlockstore: typeof BaseBlockstore;
521
+ type index$2_BlobLike = BlobLike;
522
+ type index$2_BlockFetcher = BlockFetcher;
523
+ type index$2_CarClockHead = CarClockHead;
524
+ type index$2_CarGroup = CarGroup;
525
+ type index$2_CarTransaction = CarTransaction;
526
+ declare const index$2_CarTransaction: typeof CarTransaction;
527
+ type index$2_CommitOpts = CommitOpts;
528
+ type index$2_CompactionFetcher = CompactionFetcher;
529
+ declare const index$2_CompactionFetcher: typeof CompactionFetcher;
530
+ type index$2_ConnectREST = ConnectREST;
531
+ declare const index$2_ConnectREST: typeof ConnectREST;
532
+ type index$2_Connectable = Connectable;
533
+ type index$2_Connection = Connection;
534
+ type index$2_ConnectionBase = ConnectionBase;
535
+ declare const index$2_ConnectionBase: typeof ConnectionBase;
536
+ type index$2_CryptoOpts = CryptoOpts;
537
+ type index$2_DataSaveOpts = DataSaveOpts;
538
+ type index$2_DataStore = DataStore;
539
+ declare const index$2_DataStore: typeof DataStore;
540
+ type index$2_DbMeta = DbMeta;
541
+ type index$2_DbMetaEventBlock = DbMetaEventBlock;
542
+ type index$2_DownloadDataFnParams = DownloadDataFnParams;
543
+ type index$2_DownloadMetaFnParams = DownloadMetaFnParams;
544
+ type index$2_EncryptedBlockstore = EncryptedBlockstore;
545
+ declare const index$2_EncryptedBlockstore: typeof EncryptedBlockstore;
546
+ type index$2_Gateway = Gateway;
547
+ type index$2_GatewayOpts = GatewayOpts;
548
+ type index$2_GetResult = GetResult;
549
+ type index$2_Loadable = Loadable;
550
+ declare const index$2_Loadable: typeof Loadable;
551
+ type index$2_Loader = Loader;
552
+ declare const index$2_Loader: typeof Loader;
553
+ type index$2_MetaStore = MetaStore;
554
+ declare const index$2_MetaStore: typeof MetaStore;
555
+ type index$2_NotFoundError = NotFoundError;
556
+ declare const index$2_NotFoundError: typeof NotFoundError;
557
+ type index$2_RemoteWAL = RemoteWAL;
558
+ declare const index$2_RemoteWAL: typeof RemoteWAL;
559
+ type index$2_StoreFactory = StoreFactory;
560
+ type index$2_StoreFactoryItem = StoreFactoryItem;
561
+ type index$2_StoreOpts = StoreOpts;
562
+ type index$2_StoreRuntime = StoreRuntime;
563
+ type index$2_TestStore = TestStore;
564
+ type index$2_TransactionMeta = TransactionMeta;
565
+ type index$2_UploadDataFnParams = UploadDataFnParams;
566
+ type index$2_UploadMetaFnParams = UploadMetaFnParams;
567
+ type index$2_VoidResult = VoidResult;
568
+ type index$2_WALState = WALState;
569
+ declare const index$2_isNotFoundError: typeof isNotFoundError;
570
+ declare const index$2_parseCarFile: typeof parseCarFile;
571
+ declare const index$2_registerStoreProtocol: typeof registerStoreProtocol;
572
+ declare const index$2_testStoreFactory: typeof testStoreFactory;
573
+ declare const index$2_toStoreRuntime: typeof toStoreRuntime;
574
+ declare const index$2_toURL: typeof toURL;
575
+ declare namespace index$2 {
576
+ export { type index$2_AnyAnyLink as AnyAnyLink, type index$2_AnyBlock as AnyBlock, type index$2_AnyLink as AnyLink, index$2_BaseBlockstore as BaseBlockstore, type index$2_BlobLike as BlobLike, type index$2_BlockFetcher as BlockFetcher, type index$2_CarClockHead as CarClockHead, type index$2_CarGroup as CarGroup, index$2_CarTransaction as CarTransaction, type index$2_CommitOpts as CommitOpts, index$2_CompactionFetcher as CompactionFetcher, index$2_ConnectREST as ConnectREST, type index$2_Connectable as Connectable, type index$2_Connection as Connection, index$2_ConnectionBase as ConnectionBase, type index$2_CryptoOpts as CryptoOpts, type index$2_DataSaveOpts as DataSaveOpts, index$2_DataStore as DataStore, type index$2_DbMeta as DbMeta, type index$2_DbMetaEventBlock as DbMetaEventBlock, type index$2_DownloadDataFnParams as DownloadDataFnParams, type index$2_DownloadMetaFnParams as DownloadMetaFnParams, index$2_EncryptedBlockstore as EncryptedBlockstore, type index$2_Gateway as Gateway, type index$2_GatewayOpts as GatewayOpts, type index$2_GetResult as GetResult, index$2_Loadable as Loadable, index$2_Loader as Loader, index$2_MetaStore as MetaStore, index$2_NotFoundError as NotFoundError, index$2_RemoteWAL as RemoteWAL, type index$2_StoreFactory as StoreFactory, type index$2_StoreFactoryItem as StoreFactoryItem, type index$2_StoreOpts as StoreOpts, type index$2_StoreRuntime as StoreRuntime, type index$2_TestStore as TestStore, type index$2_TransactionMeta as TransactionMeta, type index$2_UploadDataFnParams as UploadDataFnParams, type index$2_UploadMetaFnParams as UploadMetaFnParams, type index$2_VoidResult as VoidResult, type index$2_WALState as WALState, index$2_isNotFoundError as isNotFoundError, index$2_parseCarFile as parseCarFile, index$2_registerStoreProtocol as registerStoreProtocol, index$2_testStoreFactory as testStoreFactory, index$2_toStoreRuntime as toStoreRuntime, index$2_toURL as toURL };
520
577
  }
521
578
 
522
579
  type Falsy = false | null | undefined;
@@ -600,7 +657,7 @@ interface IndexTransactionMeta {
600
657
  interface FileTransactionMeta {
601
658
  readonly files?: AnyLink[];
602
659
  }
603
- type MetaType$1 = CRDTMeta | IndexTransactionMeta | FileTransactionMeta;
660
+ type MetaType = CRDTMeta | IndexTransactionMeta | FileTransactionMeta;
604
661
  interface IdxMeta {
605
662
  readonly byId: AnyLink;
606
663
  readonly byKey: AnyLink;
@@ -625,6 +682,14 @@ interface AllDocsQueryOpts extends QueryOpts<string> {
625
682
  readonly keys?: string[];
626
683
  prefix?: string;
627
684
  }
685
+ interface AllDocsResponse<T extends DocTypes> {
686
+ readonly rows: {
687
+ readonly key: string;
688
+ readonly value: DocWithId<T>;
689
+ }[];
690
+ readonly clock: ClockHead;
691
+ readonly name?: string;
692
+ }
628
693
  type EmitFn = (k: IndexKeyType, v?: DocFragment) => void;
629
694
  type MapFn<T extends DocTypes> = (doc: DocWithId<T>, emit: EmitFn) => DocFragment | unknown;
630
695
  interface ChangesOptions {
@@ -639,17 +704,19 @@ interface ChangesResponseRow<T extends DocTypes> {
639
704
  interface ChangesResponse<T extends DocTypes> {
640
705
  readonly clock: ClockHead;
641
706
  readonly rows: ChangesResponseRow<T>[];
707
+ readonly name?: string;
642
708
  }
643
- interface DbResponse {
709
+ interface DocResponse {
644
710
  readonly id: string;
645
711
  readonly clock: ClockHead;
712
+ readonly name?: string;
646
713
  }
647
714
  type UpdateListenerFn<T extends DocTypes> = (docs: DocWithId<T>[]) => Promise<void> | void;
648
715
  type NoUpdateListenerFn = () => Promise<void> | void;
649
716
  type ListenerFn<T extends DocTypes> = UpdateListenerFn<T> | NoUpdateListenerFn;
650
717
 
651
718
  interface WriteQueue<T extends DocTypes> {
652
- push(task: DocUpdate<T>): Promise<MetaType$1>;
719
+ push(task: DocUpdate<T>): Promise<MetaType>;
653
720
  }
654
721
 
655
722
  declare class IndexTree<K extends IndexKeyType, R extends DocFragment> {
@@ -686,7 +753,7 @@ interface ProllyNode<K extends IndexKeyType, T extends DocFragment> extends Prol
686
753
  readonly block: Promise<Block>;
687
754
  }
688
755
 
689
- declare function index$2<K extends IndexKeyType = string, T extends DocTypes = NonNullable<unknown>, R extends DocFragment = T>({ _crdt }: {
756
+ declare function index$1<K extends IndexKeyType = string, T extends DocTypes = NonNullable<unknown>, R extends DocFragment = T>({ _crdt }: {
690
757
  _crdt: CRDT<T> | CRDT<NonNullable<unknown>>;
691
758
  }, name: string, mapFn?: MapFn<T>, meta?: IdxMeta): Index<K, T, R>;
692
759
  declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFragment = T> {
@@ -792,16 +859,10 @@ declare class Database<DT extends DocTypes = NonNullable<unknown>> implements Co
792
859
  readonly logger: Logger;
793
860
  constructor(name?: string, opts?: ConfigOpts);
794
861
  get<T extends DocTypes>(id: string): Promise<DocWithId<T>>;
795
- put<T extends DocTypes>(doc: DocSet<T>): Promise<DbResponse>;
796
- del(id: string): Promise<DbResponse>;
862
+ put<T extends DocTypes>(doc: DocSet<T>): Promise<DocResponse>;
863
+ del(id: string): Promise<DocResponse>;
797
864
  changes<T extends DocTypes>(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse<T>>;
798
- allDocs<T extends DocTypes>(opts?: AllDocsQueryOpts): Promise<{
799
- rows: {
800
- key: string;
801
- value: DocWithId<T>;
802
- }[];
803
- clock: ClockHead;
804
- }>;
865
+ allDocs<T extends DocTypes>(opts?: AllDocsQueryOpts): Promise<AllDocsResponse<T>>;
805
866
  allDocuments<T extends DocTypes>(): Promise<{
806
867
  rows: {
807
868
  key: string;
@@ -817,6 +878,13 @@ declare class Database<DT extends DocTypes = NonNullable<unknown>> implements Co
817
878
  }
818
879
  declare function fireproof(name: string, opts?: ConfigOpts): Database;
819
880
 
881
+ interface Runtime {
882
+ isNodeIsh: boolean;
883
+ isBrowser: boolean;
884
+ isDeno: boolean;
885
+ isReactNative: boolean;
886
+ }
887
+ declare function runtimeFn(): Runtime;
820
888
  interface NodeMap {
821
889
  state: "seeded" | "browser" | "node";
822
890
  join: (...args: string[]) => string;
@@ -871,6 +939,7 @@ declare class sysContainer {
871
939
  join(...args: string[]): string;
872
940
  homedir: () => string;
873
941
  logSeeded(method: string): void;
942
+ readonly runtime: typeof runtimeFn;
874
943
  readonly env: EnvImpl;
875
944
  }
876
945
  declare const SysContainer: sysContainer;
@@ -892,90 +961,11 @@ declare function getPath(url: URL, logger: Logger): Promise<string>;
892
961
  declare function getFileName(url: URL, key: string, logger: Logger): string;
893
962
  declare function ensureIndexName(url: URL, name: string): string;
894
963
 
895
- interface DBConnection {
896
- connect(): Promise<void>;
897
- readonly opts: SQLOpts;
898
- }
899
- interface SQLStore<IType, KType, OType = IType[]> {
900
- readonly dbConn: DBConnection;
901
- start(url: URL): Promise<void>;
902
- insert(url: URL, ose: IType): Promise<RunResult>;
903
- select(url: URL, car: KType): Promise<OType>;
904
- delete(url: URL, car: KType): Promise<RunResult>;
905
- close(url: URL): Promise<Result<void>>;
906
- destroy(url: URL): Promise<Result<void>>;
907
- }
908
- interface SQLTableNames {
909
- readonly data: string;
910
- readonly meta: string;
911
- readonly wal: string;
912
- }
913
- declare const DefaultSQLTableNames: SQLTableNames;
914
- interface SQLOpts {
915
- readonly url: URL;
916
- readonly sqlFlavor: "sqlite" | "mysql" | "postgres";
917
- readonly tableNames: SQLTableNames;
918
- readonly logger: Logger;
919
- readonly textEncoder: TextEncoder;
920
- readonly textDecoder: TextDecoder;
921
- }
922
- interface WalKey {
923
- readonly name: string;
924
- readonly branch: string;
925
- }
926
- interface WalRecord extends WalKey {
927
- readonly state: Uint8Array;
928
- readonly updated_at: Date;
929
- }
930
- type WalSQLStore = SQLStore<WalRecord, WalKey>;
931
- interface MetaType {
932
- readonly name: string;
933
- readonly branch: string;
934
- readonly meta: Uint8Array;
935
- }
936
- interface MetaRecordKey {
937
- readonly name: string;
938
- readonly branch: string;
939
- }
940
- interface MetaRecord extends MetaRecordKey {
941
- readonly meta: Uint8Array;
942
- readonly updated_at: Date;
943
- }
944
- type MetaSQLStore = SQLStore<MetaRecord, MetaRecordKey>;
945
- interface DataRecord {
946
- readonly name: string;
947
- readonly car: string;
948
- readonly data: Uint8Array;
949
- readonly updated_at: Date;
950
- }
951
- type DataSQLStore = SQLStore<DataRecord, string>;
952
-
953
- declare function ensureSQLOpts(url: URL, opts: Partial<SQLOpts>, componentName: string, ctx?: Record<string, unknown>): SQLOpts;
954
-
955
- type index$1_DBConnection = DBConnection;
956
- type index$1_DataRecord = DataRecord;
957
- type index$1_DataSQLStore = DataSQLStore;
958
- declare const index$1_DefaultSQLTableNames: typeof DefaultSQLTableNames;
959
- type index$1_MetaRecord = MetaRecord;
960
- type index$1_MetaRecordKey = MetaRecordKey;
961
- type index$1_MetaSQLStore = MetaSQLStore;
962
- type index$1_MetaType = MetaType;
963
- type index$1_SQLOpts = SQLOpts;
964
- type index$1_SQLStore<IType, KType, OType = IType[]> = SQLStore<IType, KType, OType>;
965
- type index$1_SQLTableNames = SQLTableNames;
966
- type index$1_WalKey = WalKey;
967
- type index$1_WalRecord = WalRecord;
968
- type index$1_WalSQLStore = WalSQLStore;
969
- declare const index$1_ensureSQLOpts: typeof ensureSQLOpts;
970
- declare namespace index$1 {
971
- export { type index$1_DBConnection as DBConnection, type index$1_DataRecord as DataRecord, type index$1_DataSQLStore as DataSQLStore, index$1_DefaultSQLTableNames as DefaultSQLTableNames, type index$1_MetaRecord as MetaRecord, type index$1_MetaRecordKey as MetaRecordKey, type index$1_MetaSQLStore as MetaSQLStore, type index$1_MetaType as MetaType, type index$1_SQLOpts as SQLOpts, type index$1_SQLStore as SQLStore, type index$1_SQLTableNames as SQLTableNames, type index$1_WalKey as WalKey, type index$1_WalRecord as WalRecord, type index$1_WalSQLStore as WalSQLStore, index$1_ensureSQLOpts as ensureSQLOpts };
972
- }
973
-
974
964
  declare function toCryptoOpts(cryptoOpts?: Partial<CryptoOpts>): CryptoOpts;
975
965
 
976
- declare const crypto$1_toCryptoOpts: typeof toCryptoOpts;
977
- declare namespace crypto$1 {
978
- export { crypto$1_toCryptoOpts as toCryptoOpts };
966
+ declare const crypto_toCryptoOpts: typeof toCryptoOpts;
967
+ declare namespace crypto {
968
+ export { crypto_toCryptoOpts as toCryptoOpts };
979
969
  }
980
970
 
981
971
  declare function encodeFile(blob: BlobLike): Promise<{
@@ -994,13 +984,12 @@ declare const FILESTORE_VERSION = "v0.19-file";
994
984
 
995
985
  declare const INDEXDB_VERSION = "v0.19-indexdb";
996
986
 
997
- declare const SQLITE_VERSION = "v0.19-sqlite";
998
-
999
987
  declare const index_FILESTORE_VERSION: typeof FILESTORE_VERSION;
1000
988
  declare const index_INDEXDB_VERSION: typeof INDEXDB_VERSION;
1001
989
  type index_NodeMap = NodeMap;
1002
- declare const index_SQLITE_VERSION: typeof SQLITE_VERSION;
990
+ type index_Runtime = Runtime;
1003
991
  declare const index_SysContainer: typeof SysContainer;
992
+ declare const index_crypto: typeof crypto;
1004
993
  declare const index_dataDir: typeof dataDir;
1005
994
  declare const index_ensureIndexName: typeof ensureIndexName;
1006
995
  declare const index_files: typeof files;
@@ -1008,10 +997,10 @@ declare const index_getFileName: typeof getFileName;
1008
997
  declare const index_getPath: typeof getPath;
1009
998
  declare const index_join: typeof join;
1010
999
  declare namespace index {
1011
- export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXDB_VERSION as INDEXDB_VERSION, type index_NodeMap as NodeMap, index_SQLITE_VERSION as SQLITE_VERSION, index_SysContainer as SysContainer, crypto$1 as crypto, index_dataDir as dataDir, index_ensureIndexName as ensureIndexName, index_files as files, index_getFileName as getFileName, index_getPath as getPath, index_join as join, index$1 as sql };
1000
+ export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXDB_VERSION as INDEXDB_VERSION, type index_NodeMap as NodeMap, type index_Runtime as Runtime, index_SysContainer as SysContainer, index_crypto as crypto, index_dataDir as dataDir, index_ensureIndexName as ensureIndexName, index_files as files, index_getFileName as getFileName, index_getPath as getPath, index_join as join };
1012
1001
  }
1013
1002
 
1014
1003
  declare const PACKAGE_VERSION: string;
1015
1004
 
1016
- export { type AllDocsQueryOpts, CRDT, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, Database, type DbResponse, type DocBase, type DocFileMeta, type DocFiles, type DocFragment, type DocLiteral, type DocObject, type DocRecord, 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 LoggerOpts, type MapFn, type MetaType$1 as MetaType, type NoUpdateListenerFn, PACKAGE_VERSION, type QueryOpts, type UnknownDoc, type UpdateListenerFn, index$3 as blockstore, index$3 as bs, ensureLogger, exception2Result, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$2 as index, isFalsy, index as rt, index as runtime, throwFalsy };
1005
+ export { type AllDocsQueryOpts, type AllDocsResponse, CRDT, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, Database, type DocBase, type DocFileMeta, type DocFiles, type DocFragment, type DocLiteral, type DocObject, type DocRecord, type DocResponse, type DocSet, type DocTypes, type DocUpdate, type DocValue, type DocWithId, type Falsy, type FileTransactionMeta, type IdxMeta, type IdxMetaMap, Index, type IndexKey, type IndexKeyType, type IndexRow, type IndexRows, type IndexTransactionMeta, type IndexUpdate, type IndexUpdateString, type Joiner, type KeyLiteral, type ListenerFn, type LoggerOpts, type MapFn, type MetaType, type NoUpdateListenerFn, PACKAGE_VERSION, type QueryOpts, type UnknownDoc, type UpdateListenerFn, index$2 as blockstore, index$2 as bs, ensureLogger, exception2Result, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$1 as index, isFalsy, index as rt, index as runtime, throwFalsy };
1017
1006
  declare module '@fireproof/core'