@fireproof/core 0.15.1 → 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +232 -0
 - package/README.md +16 -7
 - package/dist/browser/fireproof.cjs +626 -21124
 - package/dist/browser/fireproof.cjs.map +1 -7
 - package/dist/browser/fireproof.d.cts +286 -0
 - package/dist/browser/fireproof.d.ts +286 -0
 - package/dist/browser/{fireproof.iife.js → fireproof.global.js} +12710 -13071
 - package/dist/browser/fireproof.global.js.map +1 -0
 - package/dist/browser/fireproof.js +1114 -0
 - package/dist/browser/fireproof.js.map +1 -0
 - package/dist/browser/metafile-cjs.json +1 -0
 - package/dist/browser/metafile-esm.json +1 -0
 - package/dist/browser/metafile-iife.json +1 -0
 - package/dist/memory/fireproof.cjs +1143 -0
 - package/dist/memory/fireproof.cjs.map +1 -0
 - package/dist/memory/fireproof.d.cts +286 -0
 - package/dist/memory/fireproof.d.ts +286 -0
 - package/dist/memory/fireproof.global.js +21282 -0
 - package/dist/memory/fireproof.global.js.map +1 -0
 - package/dist/memory/fireproof.js +1114 -0
 - package/dist/memory/fireproof.js.map +1 -0
 - package/dist/memory/metafile-cjs.json +1 -0
 - package/dist/memory/metafile-esm.json +1 -0
 - package/dist/memory/metafile-iife.json +1 -0
 - package/dist/node/fireproof.cjs +614 -30532
 - package/dist/node/fireproof.cjs.map +1 -7
 - package/dist/node/fireproof.d.cts +286 -0
 - package/dist/node/fireproof.d.ts +286 -0
 - package/dist/node/fireproof.global.js +21338 -0
 - package/dist/node/fireproof.global.js.map +1 -0
 - package/dist/node/fireproof.js +1114 -0
 - package/dist/node/fireproof.js.map +1 -0
 - package/dist/node/metafile-cjs.json +1 -0
 - package/dist/node/metafile-esm.json +1 -0
 - package/dist/node/metafile-iife.json +1 -0
 - package/package.json +56 -50
 - package/dist/browser/fireproof.esm.js +0 -21635
 - package/dist/browser/fireproof.esm.js.map +0 -7
 - package/dist/browser/fireproof.iife.js.map +0 -7
 - package/dist/memory/fireproof.esm.js +0 -21349
 - package/dist/memory/fireproof.esm.js.map +0 -7
 - package/dist/node/fireproof.esm.js +0 -31055
 - package/dist/node/fireproof.esm.js.map +0 -7
 - package/dist/types/apply-head-queue.d.ts +0 -15
 - package/dist/types/commit-queue.d.ts +0 -6
 - package/dist/types/crdt-clock.d.ts +0 -20
 - package/dist/types/crdt-helpers.d.ts +0 -19
 - package/dist/types/crdt.d.ts +0 -28
 - package/dist/types/crypto-ipld.d.ts +0 -20
 - package/dist/types/crypto-node.d.ts +0 -4
 - package/dist/types/crypto-web.d.ts +0 -4
 - package/dist/types/database.d.ts +0 -48
 - package/dist/types/encrypt-helpers.d.ts +0 -8
 - package/dist/types/encrypted-block.d.ts +0 -44
 - package/dist/types/files.d.ts +0 -12
 - package/dist/types/fireproof.d.ts +0 -7
 - package/dist/types/index.d.ts +0 -31
 - package/dist/types/indexer-helpers.d.ts +0 -57
 - package/dist/types/loader-helpers.d.ts +0 -5
 - package/dist/types/loader.d.ts +0 -62
 - package/dist/types/loaders.d.ts +0 -51
 - package/dist/types/remote-wal.d.ts +0 -26
 - package/dist/types/store-browser.d.ts +0 -24
 - package/dist/types/store-fs.d.ts +0 -26
 - package/dist/types/store-memory.d.ts +0 -24
 - package/dist/types/store.d.ts +0 -28
 - package/dist/types/transaction.d.ts +0 -50
 - package/dist/types/types.d.ts +0 -170
 - package/dist/types/version.d.ts +0 -1
 - package/dist/types/write-queue.d.ts +0 -7
 
| 
         @@ -1,15 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { ClockHead, DocUpdate } from './types';
         
     | 
| 
       2 
     | 
    
         
            -
            type ApplyHeadWorkerFunction = (newHead: ClockHead, prevHead: ClockHead) => Promise<void>;
         
     | 
| 
       3 
     | 
    
         
            -
            type ApplyHeadTask = {
         
     | 
| 
       4 
     | 
    
         
            -
                newHead: ClockHead;
         
     | 
| 
       5 
     | 
    
         
            -
                prevHead: ClockHead;
         
     | 
| 
       6 
     | 
    
         
            -
                updates: DocUpdate[] | null;
         
     | 
| 
       7 
     | 
    
         
            -
            };
         
     | 
| 
       8 
     | 
    
         
            -
            export type ApplyHeadQueue = {
         
     | 
| 
       9 
     | 
    
         
            -
                push(task: ApplyHeadTask): AsyncGenerator<{
         
     | 
| 
       10 
     | 
    
         
            -
                    updates: DocUpdate[];
         
     | 
| 
       11 
     | 
    
         
            -
                    all: boolean;
         
     | 
| 
       12 
     | 
    
         
            -
                }, void, unknown>;
         
     | 
| 
       13 
     | 
    
         
            -
            };
         
     | 
| 
       14 
     | 
    
         
            -
            export declare function applyHeadQueue(worker: ApplyHeadWorkerFunction): ApplyHeadQueue;
         
     | 
| 
       15 
     | 
    
         
            -
            export {};
         
     | 
| 
         @@ -1,20 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { TransactionBlockstore } from './transaction';
         
     | 
| 
       2 
     | 
    
         
            -
            import type { DocUpdate, ClockHead } from './types';
         
     | 
| 
       3 
     | 
    
         
            -
            import { ApplyHeadQueue } from './apply-head-queue';
         
     | 
| 
       4 
     | 
    
         
            -
            export declare class CRDTClock {
         
     | 
| 
       5 
     | 
    
         
            -
                head: ClockHead;
         
     | 
| 
       6 
     | 
    
         
            -
                zoomers: Set<() => void>;
         
     | 
| 
       7 
     | 
    
         
            -
                watchers: Set<(updates: DocUpdate[]) => void>;
         
     | 
| 
       8 
     | 
    
         
            -
                emptyWatchers: Set<() => void>;
         
     | 
| 
       9 
     | 
    
         
            -
                blocks: TransactionBlockstore | null;
         
     | 
| 
       10 
     | 
    
         
            -
                applyHeadQueue: ApplyHeadQueue;
         
     | 
| 
       11 
     | 
    
         
            -
                constructor();
         
     | 
| 
       12 
     | 
    
         
            -
                setHead(head: ClockHead): void;
         
     | 
| 
       13 
     | 
    
         
            -
                applyHead(newHead: ClockHead, prevHead: ClockHead, updates?: DocUpdate[] | null): Promise<void>;
         
     | 
| 
       14 
     | 
    
         
            -
                processUpdates(updatesAcc: DocUpdate[], all: boolean, prevHead: ClockHead): Promise<void>;
         
     | 
| 
       15 
     | 
    
         
            -
                notifyWatchers(updates: DocUpdate[]): void;
         
     | 
| 
       16 
     | 
    
         
            -
                onTick(fn: (updates: DocUpdate[]) => void): void;
         
     | 
| 
       17 
     | 
    
         
            -
                onTock(fn: () => void): void;
         
     | 
| 
       18 
     | 
    
         
            -
                onZoom(fn: () => void): void;
         
     | 
| 
       19 
     | 
    
         
            -
                int_applyHead(newHead: ClockHead, prevHead: ClockHead): Promise<void>;
         
     | 
| 
       20 
     | 
    
         
            -
            }
         
     | 
| 
         @@ -1,19 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { Block } from 'multiformats/block';
         
     | 
| 
       2 
     | 
    
         
            -
            import { LoggingFetcher, Transaction } from './transaction';
         
     | 
| 
       3 
     | 
    
         
            -
            import type { TransactionBlockstore } from './transaction';
         
     | 
| 
       4 
     | 
    
         
            -
            import type { DocUpdate, ClockHead, AnyLink, DocValue, BulkResult, ChangesOptions, BlockFetcher } from './types';
         
     | 
| 
       5 
     | 
    
         
            -
            export declare function applyBulkUpdateToCrdt(tblocks: Transaction, head: ClockHead, updates: DocUpdate[], options?: object): Promise<BulkResult>;
         
     | 
| 
       6 
     | 
    
         
            -
            export declare function getValueFromCrdt(blocks: TransactionBlockstore, head: ClockHead, key: string): Promise<DocValue>;
         
     | 
| 
       7 
     | 
    
         
            -
            export declare function readFiles(blocks: TransactionBlockstore | LoggingFetcher, { doc }: DocValue): void;
         
     | 
| 
       8 
     | 
    
         
            -
            export declare function clockChangesSince(blocks: TransactionBlockstore | LoggingFetcher, head: ClockHead, since: ClockHead, opts: ChangesOptions): Promise<{
         
     | 
| 
       9 
     | 
    
         
            -
                result: DocUpdate[];
         
     | 
| 
       10 
     | 
    
         
            -
                head: ClockHead;
         
     | 
| 
       11 
     | 
    
         
            -
            }>;
         
     | 
| 
       12 
     | 
    
         
            -
            export declare function getAllEntries(blocks: TransactionBlockstore | LoggingFetcher, head: ClockHead): AsyncGenerator<DocUpdate, void, unknown>;
         
     | 
| 
       13 
     | 
    
         
            -
            export declare function clockVis(blocks: TransactionBlockstore, head: ClockHead): AsyncGenerator<string, void, unknown>;
         
     | 
| 
       14 
     | 
    
         
            -
            export declare function doCompact(blocks: TransactionBlockstore, head: ClockHead): Promise<AnyLink | undefined>;
         
     | 
| 
       15 
     | 
    
         
            -
            export declare function getThatBlock({ bytes }: {
         
     | 
| 
       16 
     | 
    
         
            -
                cid: string;
         
     | 
| 
       17 
     | 
    
         
            -
                bytes: string;
         
     | 
| 
       18 
     | 
    
         
            -
            }): Promise<Block<unknown, 113, 18, 1>>;
         
     | 
| 
       19 
     | 
    
         
            -
            export declare function getBlock(blocks: BlockFetcher, cidString: string): Promise<Block<unknown, 113, 18, 1>>;
         
     | 
    
        package/dist/types/crdt.d.ts
    DELETED
    
    | 
         @@ -1,28 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { TransactionBlockstore, IndexBlockstore } from './transaction';
         
     | 
| 
       2 
     | 
    
         
            -
            import type { DocUpdate, BulkResult, ClockHead, FireproofOptions, ChangesOptions } from './types';
         
     | 
| 
       3 
     | 
    
         
            -
            import type { Index } from './index';
         
     | 
| 
       4 
     | 
    
         
            -
            import { CRDTClock } from './crdt-clock';
         
     | 
| 
       5 
     | 
    
         
            -
            export declare class CRDT {
         
     | 
| 
       6 
     | 
    
         
            -
                name: string | null;
         
     | 
| 
       7 
     | 
    
         
            -
                opts: FireproofOptions;
         
     | 
| 
       8 
     | 
    
         
            -
                ready: Promise<void>;
         
     | 
| 
       9 
     | 
    
         
            -
                blocks: TransactionBlockstore;
         
     | 
| 
       10 
     | 
    
         
            -
                indexBlocks: IndexBlockstore;
         
     | 
| 
       11 
     | 
    
         
            -
                indexers: Map<string, Index>;
         
     | 
| 
       12 
     | 
    
         
            -
                clock: CRDTClock;
         
     | 
| 
       13 
     | 
    
         
            -
                constructor(name?: string, opts?: FireproofOptions);
         
     | 
| 
       14 
     | 
    
         
            -
                bulk(updates: DocUpdate[], options?: object): Promise<BulkResult>;
         
     | 
| 
       15 
     | 
    
         
            -
                allDocs(): Promise<{
         
     | 
| 
       16 
     | 
    
         
            -
                    result: DocUpdate[];
         
     | 
| 
       17 
     | 
    
         
            -
                    head: ClockHead;
         
     | 
| 
       18 
     | 
    
         
            -
                }>;
         
     | 
| 
       19 
     | 
    
         
            -
                vis(): Promise<string>;
         
     | 
| 
       20 
     | 
    
         
            -
                getBlock(cidString: string): Promise<import("multiformats/dist/types/src/block").Block<unknown, 113, 18, 1>>;
         
     | 
| 
       21 
     | 
    
         
            -
                getThatBlock(): Promise<import("multiformats/dist/types/src/block").Block<unknown, 113, 18, 1>>;
         
     | 
| 
       22 
     | 
    
         
            -
                get(key: string): Promise<import("./types").DocValue | null>;
         
     | 
| 
       23 
     | 
    
         
            -
                changes(since?: ClockHead, opts?: ChangesOptions): Promise<{
         
     | 
| 
       24 
     | 
    
         
            -
                    result: DocUpdate[];
         
     | 
| 
       25 
     | 
    
         
            -
                    head: ClockHead;
         
     | 
| 
       26 
     | 
    
         
            -
                }>;
         
     | 
| 
       27 
     | 
    
         
            -
                compact(): Promise<void>;
         
     | 
| 
       28 
     | 
    
         
            -
            }
         
     | 
| 
         @@ -1,20 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import type { AnyBlock, AnyLink } from './types.js';
         
     | 
| 
       2 
     | 
    
         
            -
            import type { MultihashHasher } from 'multiformats';
         
     | 
| 
       3 
     | 
    
         
            -
            declare const encrypt: ({ get, cids, hasher, key, cache, chunker, root }: {
         
     | 
| 
       4 
     | 
    
         
            -
                get: (cid: AnyLink) => Promise<AnyBlock | undefined>;
         
     | 
| 
       5 
     | 
    
         
            -
                key: ArrayBuffer;
         
     | 
| 
       6 
     | 
    
         
            -
                cids: AnyLink[];
         
     | 
| 
       7 
     | 
    
         
            -
                hasher: MultihashHasher<number>;
         
     | 
| 
       8 
     | 
    
         
            -
                chunker: (bytes: Uint8Array) => AsyncGenerator<Uint8Array>;
         
     | 
| 
       9 
     | 
    
         
            -
                cache: (cid: AnyLink) => Promise<AnyBlock>;
         
     | 
| 
       10 
     | 
    
         
            -
                root: AnyLink;
         
     | 
| 
       11 
     | 
    
         
            -
            }) => AsyncGenerator<any, void, unknown>;
         
     | 
| 
       12 
     | 
    
         
            -
            declare const decrypt: ({ root, get, key, cache, chunker, hasher }: {
         
     | 
| 
       13 
     | 
    
         
            -
                root: AnyLink;
         
     | 
| 
       14 
     | 
    
         
            -
                get: (cid: AnyLink) => Promise<AnyBlock | undefined>;
         
     | 
| 
       15 
     | 
    
         
            -
                key: ArrayBuffer;
         
     | 
| 
       16 
     | 
    
         
            -
                cache: (cid: AnyLink) => Promise<AnyBlock>;
         
     | 
| 
       17 
     | 
    
         
            -
                chunker: (bytes: Uint8Array) => AsyncGenerator<Uint8Array>;
         
     | 
| 
       18 
     | 
    
         
            -
                hasher: MultihashHasher<number>;
         
     | 
| 
       19 
     | 
    
         
            -
            }) => AsyncGenerator<AnyBlock, void, undefined>;
         
     | 
| 
       20 
     | 
    
         
            -
            export { encrypt, decrypt };
         
     | 
    
        package/dist/types/database.d.ts
    DELETED
    
    | 
         @@ -1,48 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { WriteQueue } from './write-queue';
         
     | 
| 
       2 
     | 
    
         
            -
            import { CRDT } from './crdt';
         
     | 
| 
       3 
     | 
    
         
            -
            import type { DocUpdate, ClockHead, Doc, FireproofOptions, MapFn, QueryOpts, ChangesOptions } from './types';
         
     | 
| 
       4 
     | 
    
         
            -
            import { DbResponse, ChangesResponse } from './types';
         
     | 
| 
       5 
     | 
    
         
            -
            type DbName = string | null;
         
     | 
| 
       6 
     | 
    
         
            -
            export declare class Database {
         
     | 
| 
       7 
     | 
    
         
            -
                static databases: Map<string, Database>;
         
     | 
| 
       8 
     | 
    
         
            -
                name: DbName;
         
     | 
| 
       9 
     | 
    
         
            -
                opts: FireproofOptions;
         
     | 
| 
       10 
     | 
    
         
            -
                _listening: boolean;
         
     | 
| 
       11 
     | 
    
         
            -
                _listeners: Set<ListenerFn>;
         
     | 
| 
       12 
     | 
    
         
            -
                _noupdate_listeners: Set<ListenerFn>;
         
     | 
| 
       13 
     | 
    
         
            -
                _crdt: CRDT;
         
     | 
| 
       14 
     | 
    
         
            -
                _writeQueue: WriteQueue;
         
     | 
| 
       15 
     | 
    
         
            -
                constructor(name?: string, opts?: FireproofOptions);
         
     | 
| 
       16 
     | 
    
         
            -
                get(id: string): Promise<Doc>;
         
     | 
| 
       17 
     | 
    
         
            -
                put(doc: Doc): Promise<DbResponse>;
         
     | 
| 
       18 
     | 
    
         
            -
                del(id: string): Promise<DbResponse>;
         
     | 
| 
       19 
     | 
    
         
            -
                changes(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse>;
         
     | 
| 
       20 
     | 
    
         
            -
                allDocs(): Promise<{
         
     | 
| 
       21 
     | 
    
         
            -
                    rows: {
         
     | 
| 
       22 
     | 
    
         
            -
                        key: string;
         
     | 
| 
       23 
     | 
    
         
            -
                        value: Doc;
         
     | 
| 
       24 
     | 
    
         
            -
                    }[];
         
     | 
| 
       25 
     | 
    
         
            -
                    clock: ClockHead;
         
     | 
| 
       26 
     | 
    
         
            -
                }>;
         
     | 
| 
       27 
     | 
    
         
            -
                allDocuments(): Promise<{
         
     | 
| 
       28 
     | 
    
         
            -
                    rows: {
         
     | 
| 
       29 
     | 
    
         
            -
                        key: string;
         
     | 
| 
       30 
     | 
    
         
            -
                        value: Doc;
         
     | 
| 
       31 
     | 
    
         
            -
                    }[];
         
     | 
| 
       32 
     | 
    
         
            -
                    clock: ClockHead;
         
     | 
| 
       33 
     | 
    
         
            -
                }>;
         
     | 
| 
       34 
     | 
    
         
            -
                subscribe(listener: ListenerFn | NoUpdateListenerFn, updates?: boolean): () => void;
         
     | 
| 
       35 
     | 
    
         
            -
                query(field: string | MapFn, opts?: QueryOpts): Promise<{
         
     | 
| 
       36 
     | 
    
         
            -
                    rows: import("./types").IndexRow[];
         
     | 
| 
       37 
     | 
    
         
            -
                }>;
         
     | 
| 
       38 
     | 
    
         
            -
                compact(): Promise<void>;
         
     | 
| 
       39 
     | 
    
         
            -
                getDashboardURL(compact?: boolean): Promise<URL>;
         
     | 
| 
       40 
     | 
    
         
            -
                openDashboard(): void;
         
     | 
| 
       41 
     | 
    
         
            -
                _notify(updates: DocUpdate[]): Promise<void>;
         
     | 
| 
       42 
     | 
    
         
            -
                _no_update_notify(): Promise<void>;
         
     | 
| 
       43 
     | 
    
         
            -
            }
         
     | 
| 
       44 
     | 
    
         
            -
            type UpdateListenerFn = (docs: Doc[]) => Promise<void> | void;
         
     | 
| 
       45 
     | 
    
         
            -
            type NoUpdateListenerFn = () => Promise<void> | void;
         
     | 
| 
       46 
     | 
    
         
            -
            type ListenerFn = UpdateListenerFn | NoUpdateListenerFn;
         
     | 
| 
       47 
     | 
    
         
            -
            export declare function fireproof(name: string, opts?: FireproofOptions): Database;
         
     | 
| 
       48 
     | 
    
         
            -
            export {};
         
     | 
| 
         @@ -1,8 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import type { CarReader } from '@ipld/car';
         
     | 
| 
       2 
     | 
    
         
            -
            import type { AnyBlock, CarMakeable, AnyLink } from './types';
         
     | 
| 
       3 
     | 
    
         
            -
            import { MemoryBlockstore } from '@alanshaw/pail/block';
         
     | 
| 
       4 
     | 
    
         
            -
            export declare function encryptedEncodeCarFile(key: string, rootCid: AnyLink, t: CarMakeable): Promise<AnyBlock>;
         
     | 
| 
       5 
     | 
    
         
            -
            export declare function decodeEncryptedCar(key: string, reader: CarReader): Promise<{
         
     | 
| 
       6 
     | 
    
         
            -
                blocks: MemoryBlockstore;
         
     | 
| 
       7 
     | 
    
         
            -
                root: AnyLink;
         
     | 
| 
       8 
     | 
    
         
            -
            }>;
         
     | 
| 
         @@ -1,44 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import type { AnyLink } from './types';
         
     | 
| 
       2 
     | 
    
         
            -
            declare const encode: ({ iv, bytes }: {
         
     | 
| 
       3 
     | 
    
         
            -
                iv: Uint8Array;
         
     | 
| 
       4 
     | 
    
         
            -
                bytes: Uint8Array;
         
     | 
| 
       5 
     | 
    
         
            -
            }) => Uint8Array;
         
     | 
| 
       6 
     | 
    
         
            -
            declare const decode: (bytes: Uint8Array) => {
         
     | 
| 
       7 
     | 
    
         
            -
                iv: Uint8Array;
         
     | 
| 
       8 
     | 
    
         
            -
                bytes: Uint8Array;
         
     | 
| 
       9 
     | 
    
         
            -
            };
         
     | 
| 
       10 
     | 
    
         
            -
            declare const code: number;
         
     | 
| 
       11 
     | 
    
         
            -
            declare const decrypt: ({ key, value }: {
         
     | 
| 
       12 
     | 
    
         
            -
                key: ArrayBuffer;
         
     | 
| 
       13 
     | 
    
         
            -
                value: {
         
     | 
| 
       14 
     | 
    
         
            -
                    bytes: Uint8Array;
         
     | 
| 
       15 
     | 
    
         
            -
                    iv: Uint8Array;
         
     | 
| 
       16 
     | 
    
         
            -
                };
         
     | 
| 
       17 
     | 
    
         
            -
            }) => Promise<{
         
     | 
| 
       18 
     | 
    
         
            -
                cid: AnyLink;
         
     | 
| 
       19 
     | 
    
         
            -
                bytes: Uint8Array;
         
     | 
| 
       20 
     | 
    
         
            -
            }>;
         
     | 
| 
       21 
     | 
    
         
            -
            declare const encrypt: ({ key, cid, bytes }: {
         
     | 
| 
       22 
     | 
    
         
            -
                key: ArrayBuffer;
         
     | 
| 
       23 
     | 
    
         
            -
                cid: AnyLink;
         
     | 
| 
       24 
     | 
    
         
            -
                bytes: Uint8Array;
         
     | 
| 
       25 
     | 
    
         
            -
            }) => Promise<{
         
     | 
| 
       26 
     | 
    
         
            -
                value: {
         
     | 
| 
       27 
     | 
    
         
            -
                    bytes: Uint8Array;
         
     | 
| 
       28 
     | 
    
         
            -
                    iv: Uint8Array;
         
     | 
| 
       29 
     | 
    
         
            -
                };
         
     | 
| 
       30 
     | 
    
         
            -
            }>;
         
     | 
| 
       31 
     | 
    
         
            -
            declare const cryptoFn: (key: Uint8Array) => {
         
     | 
| 
       32 
     | 
    
         
            -
                encrypt: (opts: any) => Promise<{
         
     | 
| 
       33 
     | 
    
         
            -
                    value: {
         
     | 
| 
       34 
     | 
    
         
            -
                        bytes: Uint8Array;
         
     | 
| 
       35 
     | 
    
         
            -
                        iv: Uint8Array;
         
     | 
| 
       36 
     | 
    
         
            -
                    };
         
     | 
| 
       37 
     | 
    
         
            -
                }>;
         
     | 
| 
       38 
     | 
    
         
            -
                decrypt: (opts: any) => Promise<{
         
     | 
| 
       39 
     | 
    
         
            -
                    cid: AnyLink;
         
     | 
| 
       40 
     | 
    
         
            -
                    bytes: Uint8Array;
         
     | 
| 
       41 
     | 
    
         
            -
                }>;
         
     | 
| 
       42 
     | 
    
         
            -
            };
         
     | 
| 
       43 
     | 
    
         
            -
            declare const name = "jchris@encrypted-block:aes-gcm";
         
     | 
| 
       44 
     | 
    
         
            -
            export { encode, decode, code, name, encrypt, decrypt, cryptoFn as crypto };
         
     | 
    
        package/dist/types/files.d.ts
    DELETED
    
    | 
         @@ -1,12 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { AnyBlock, AnyLink, DocFileMeta } from './types';
         
     | 
| 
       2 
     | 
    
         
            -
            export declare function encodeFile(blob: BlobLike): Promise<{
         
     | 
| 
       3 
     | 
    
         
            -
                cid: AnyLink;
         
     | 
| 
       4 
     | 
    
         
            -
                blocks: AnyBlock[];
         
     | 
| 
       5 
     | 
    
         
            -
            }>;
         
     | 
| 
       6 
     | 
    
         
            -
            export declare function decodeFile(blocks: unknown, cid: AnyLink, meta: DocFileMeta): Promise<File>;
         
     | 
| 
       7 
     | 
    
         
            -
            export interface BlobLike {
         
     | 
| 
       8 
     | 
    
         
            -
                /**
         
     | 
| 
       9 
     | 
    
         
            -
                 * Returns a ReadableStream which yields the Blob data.
         
     | 
| 
       10 
     | 
    
         
            -
                 */
         
     | 
| 
       11 
     | 
    
         
            -
                stream: () => ReadableStream;
         
     | 
| 
       12 
     | 
    
         
            -
            }
         
     | 
    
        package/dist/types/index.d.ts
    DELETED
    
    | 
         @@ -1,31 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import type { ClockHead, MapFn, QueryOpts, IdxMeta } from './types';
         
     | 
| 
       2 
     | 
    
         
            -
            import { IndexBlockstore } from './transaction';
         
     | 
| 
       3 
     | 
    
         
            -
            import { IndexTree } from './indexer-helpers';
         
     | 
| 
       4 
     | 
    
         
            -
            import { CRDT } from './crdt';
         
     | 
| 
       5 
     | 
    
         
            -
            export declare function index({ _crdt }: {
         
     | 
| 
       6 
     | 
    
         
            -
                _crdt: CRDT;
         
     | 
| 
       7 
     | 
    
         
            -
            }, name: string, mapFn?: MapFn, meta?: IdxMeta): Index;
         
     | 
| 
       8 
     | 
    
         
            -
            export declare class Index {
         
     | 
| 
       9 
     | 
    
         
            -
                blocks: IndexBlockstore;
         
     | 
| 
       10 
     | 
    
         
            -
                crdt: CRDT;
         
     | 
| 
       11 
     | 
    
         
            -
                name: string | null;
         
     | 
| 
       12 
     | 
    
         
            -
                mapFn: MapFn | null;
         
     | 
| 
       13 
     | 
    
         
            -
                mapFnString: string;
         
     | 
| 
       14 
     | 
    
         
            -
                byKey: IndexTree;
         
     | 
| 
       15 
     | 
    
         
            -
                byId: IndexTree;
         
     | 
| 
       16 
     | 
    
         
            -
                indexHead: ClockHead | undefined;
         
     | 
| 
       17 
     | 
    
         
            -
                includeDocsDefault: boolean;
         
     | 
| 
       18 
     | 
    
         
            -
                initError: Error | null;
         
     | 
| 
       19 
     | 
    
         
            -
                ready: Promise<void>;
         
     | 
| 
       20 
     | 
    
         
            -
                constructor(crdt: CRDT, name: string, mapFn?: MapFn, meta?: IdxMeta);
         
     | 
| 
       21 
     | 
    
         
            -
                applyMapFn(name: string, mapFn?: MapFn, meta?: IdxMeta): void;
         
     | 
| 
       22 
     | 
    
         
            -
                query(opts?: QueryOpts): Promise<{
         
     | 
| 
       23 
     | 
    
         
            -
                    rows: import("./types").IndexRow[];
         
     | 
| 
       24 
     | 
    
         
            -
                }>;
         
     | 
| 
       25 
     | 
    
         
            -
                _resetIndex(): void;
         
     | 
| 
       26 
     | 
    
         
            -
                _hydrateIndex(): Promise<void>;
         
     | 
| 
       27 
     | 
    
         
            -
                _updateIndex(): Promise<(IdxMeta & import("./types").CarCommit) | {
         
     | 
| 
       28 
     | 
    
         
            -
                    byId: IndexTree;
         
     | 
| 
       29 
     | 
    
         
            -
                    byKey: IndexTree;
         
     | 
| 
       30 
     | 
    
         
            -
                }>;
         
     | 
| 
       31 
     | 
    
         
            -
            }
         
     | 
| 
         @@ -1,57 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import type { Block, Link } from 'multiformats';
         
     | 
| 
       2 
     | 
    
         
            -
            import { ProllyNode as BaseNode } from 'prolly-trees/base';
         
     | 
| 
       3 
     | 
    
         
            -
            import { AnyLink, DocUpdate, MapFn, DocFragment, BlockFetcher, IndexKey, IndexUpdate, QueryOpts, IndexRow } from './types';
         
     | 
| 
       4 
     | 
    
         
            -
            import { Transaction } from './transaction';
         
     | 
| 
       5 
     | 
    
         
            -
            import { CRDT } from './crdt';
         
     | 
| 
       6 
     | 
    
         
            -
            export declare class IndexTree {
         
     | 
| 
       7 
     | 
    
         
            -
                cid: AnyLink | null;
         
     | 
| 
       8 
     | 
    
         
            -
                root: ProllyNode | null;
         
     | 
| 
       9 
     | 
    
         
            -
            }
         
     | 
| 
       10 
     | 
    
         
            -
            export declare const byKeyOpts: StaticProllyOptions;
         
     | 
| 
       11 
     | 
    
         
            -
            export declare const byIdOpts: StaticProllyOptions;
         
     | 
| 
       12 
     | 
    
         
            -
            export declare function indexEntriesForChanges(changes: DocUpdate[], mapFn: MapFn): {
         
     | 
| 
       13 
     | 
    
         
            -
                key: [string, string];
         
     | 
| 
       14 
     | 
    
         
            -
                value: DocFragment;
         
     | 
| 
       15 
     | 
    
         
            -
            }[];
         
     | 
| 
       16 
     | 
    
         
            -
            export declare function bulkIndex(tblocks: Transaction, inIndex: IndexTree, indexEntries: IndexUpdate[], opts: StaticProllyOptions): Promise<IndexTree>;
         
     | 
| 
       17 
     | 
    
         
            -
            export declare function loadIndex(tblocks: BlockFetcher, cid: AnyLink, opts: StaticProllyOptions): Promise<ProllyNode>;
         
     | 
| 
       18 
     | 
    
         
            -
            export declare function applyQuery(crdt: CRDT, resp: {
         
     | 
| 
       19 
     | 
    
         
            -
                result: IndexRow[];
         
     | 
| 
       20 
     | 
    
         
            -
            }, query: QueryOpts): Promise<{
         
     | 
| 
       21 
     | 
    
         
            -
                rows: IndexRow[];
         
     | 
| 
       22 
     | 
    
         
            -
            }>;
         
     | 
| 
       23 
     | 
    
         
            -
            export declare function encodeRange(range: [DocFragment, DocFragment]): [IndexKey, IndexKey];
         
     | 
| 
       24 
     | 
    
         
            -
            export declare function encodeKey(key: DocFragment): string;
         
     | 
| 
       25 
     | 
    
         
            -
            interface ProllyNode extends BaseNode {
         
     | 
| 
       26 
     | 
    
         
            -
                getAllEntries(): PromiseLike<{
         
     | 
| 
       27 
     | 
    
         
            -
                    [x: string]: any;
         
     | 
| 
       28 
     | 
    
         
            -
                    result: IndexRow[];
         
     | 
| 
       29 
     | 
    
         
            -
                }>;
         
     | 
| 
       30 
     | 
    
         
            -
                getMany(removeIds: string[]): Promise<{
         
     | 
| 
       31 
     | 
    
         
            -
                    [x: string]: any;
         
     | 
| 
       32 
     | 
    
         
            -
                    result: IndexKey[];
         
     | 
| 
       33 
     | 
    
         
            -
                }>;
         
     | 
| 
       34 
     | 
    
         
            -
                range(a: IndexKey, b: IndexKey): Promise<{
         
     | 
| 
       35 
     | 
    
         
            -
                    result: IndexRow[];
         
     | 
| 
       36 
     | 
    
         
            -
                }>;
         
     | 
| 
       37 
     | 
    
         
            -
                get(key: string): Promise<{
         
     | 
| 
       38 
     | 
    
         
            -
                    result: IndexRow[];
         
     | 
| 
       39 
     | 
    
         
            -
                }>;
         
     | 
| 
       40 
     | 
    
         
            -
                bulk(bulk: IndexUpdate[]): PromiseLike<{
         
     | 
| 
       41 
     | 
    
         
            -
                    root: ProllyNode | null;
         
     | 
| 
       42 
     | 
    
         
            -
                    blocks: Block[];
         
     | 
| 
       43 
     | 
    
         
            -
                }>;
         
     | 
| 
       44 
     | 
    
         
            -
                address: Promise<Link>;
         
     | 
| 
       45 
     | 
    
         
            -
                distance: number;
         
     | 
| 
       46 
     | 
    
         
            -
                compare: (a: any, b: any) => number;
         
     | 
| 
       47 
     | 
    
         
            -
                cache: any;
         
     | 
| 
       48 
     | 
    
         
            -
                block: Promise<Block>;
         
     | 
| 
       49 
     | 
    
         
            -
            }
         
     | 
| 
       50 
     | 
    
         
            -
            interface StaticProllyOptions {
         
     | 
| 
       51 
     | 
    
         
            -
                cache: any;
         
     | 
| 
       52 
     | 
    
         
            -
                chunker: (entry: any, distance: number) => boolean;
         
     | 
| 
       53 
     | 
    
         
            -
                codec: any;
         
     | 
| 
       54 
     | 
    
         
            -
                hasher: any;
         
     | 
| 
       55 
     | 
    
         
            -
                compare: (a: any, b: any) => number;
         
     | 
| 
       56 
     | 
    
         
            -
            }
         
     | 
| 
       57 
     | 
    
         
            -
            export {};
         
     | 
| 
         @@ -1,5 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { CarReader } from '@ipld/car';
         
     | 
| 
       2 
     | 
    
         
            -
            import { AnyBlock, AnyCarHeader, AnyLink, CarMakeable } from './types';
         
     | 
| 
       3 
     | 
    
         
            -
            export declare function encodeCarFile(roots: AnyLink[], t: CarMakeable): Promise<AnyBlock>;
         
     | 
| 
       4 
     | 
    
         
            -
            export declare function encodeCarHeader(fp: AnyCarHeader): Promise<AnyBlock>;
         
     | 
| 
       5 
     | 
    
         
            -
            export declare function parseCarFile(reader: CarReader): Promise<AnyCarHeader>;
         
     | 
    
        package/dist/types/loader.d.ts
    DELETED
    
    | 
         @@ -1,62 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { CarReader } from '@ipld/car';
         
     | 
| 
       2 
     | 
    
         
            -
            import { DataStore, MetaStore, RemoteWAL } from './store-browser';
         
     | 
| 
       3 
     | 
    
         
            -
            import { DataStore as AbstractDataStore, MetaStore as AbstractMetaStore } from './store';
         
     | 
| 
       4 
     | 
    
         
            -
            import type { Transaction } from './transaction';
         
     | 
| 
       5 
     | 
    
         
            -
            import type { AnyBlock, AnyCarHeader, AnyLink, BulkResult, CarLoaderHeader, CommitOpts, DbMeta, FileCarHeader, FileResult, FireproofOptions } from './types';
         
     | 
| 
       6 
     | 
    
         
            -
            import { type IndexerResult } from './loaders';
         
     | 
| 
       7 
     | 
    
         
            -
            import { CommitQueue } from './commit-queue';
         
     | 
| 
       8 
     | 
    
         
            -
            export declare function cidListIncludes(list: AnyLink[], cid: AnyLink): boolean;
         
     | 
| 
       9 
     | 
    
         
            -
            export declare function uniqueCids(list: AnyLink[], remove?: Set<string>): AnyLink[];
         
     | 
| 
       10 
     | 
    
         
            -
            export declare function toHexString(byteArray: Uint8Array): string;
         
     | 
| 
       11 
     | 
    
         
            -
            declare abstract class AbstractRemoteMetaStore extends AbstractMetaStore {
         
     | 
| 
       12 
     | 
    
         
            -
                abstract handleByteHeads(byteHeads: Uint8Array[], branch?: string): Promise<DbMeta[]>;
         
     | 
| 
       13 
     | 
    
         
            -
            }
         
     | 
| 
       14 
     | 
    
         
            -
            export declare abstract class Loader {
         
     | 
| 
       15 
     | 
    
         
            -
                name: string;
         
     | 
| 
       16 
     | 
    
         
            -
                opts: FireproofOptions;
         
     | 
| 
       17 
     | 
    
         
            -
                commitQueue: CommitQueue<AnyLink>;
         
     | 
| 
       18 
     | 
    
         
            -
                isCompacting: boolean;
         
     | 
| 
       19 
     | 
    
         
            -
                isWriting: boolean;
         
     | 
| 
       20 
     | 
    
         
            -
                remoteMetaLoading: Promise<void> | undefined;
         
     | 
| 
       21 
     | 
    
         
            -
                remoteMetaStore: AbstractRemoteMetaStore | undefined;
         
     | 
| 
       22 
     | 
    
         
            -
                remoteCarStore: AbstractDataStore | undefined;
         
     | 
| 
       23 
     | 
    
         
            -
                remoteWAL: RemoteWAL;
         
     | 
| 
       24 
     | 
    
         
            -
                metaStore: MetaStore;
         
     | 
| 
       25 
     | 
    
         
            -
                carStore: DataStore;
         
     | 
| 
       26 
     | 
    
         
            -
                carLog: AnyLink[];
         
     | 
| 
       27 
     | 
    
         
            -
                carReaders: Map<string, Promise<CarReader>>;
         
     | 
| 
       28 
     | 
    
         
            -
                ready: Promise<void>;
         
     | 
| 
       29 
     | 
    
         
            -
                key: string | undefined;
         
     | 
| 
       30 
     | 
    
         
            -
                keyId: string | undefined;
         
     | 
| 
       31 
     | 
    
         
            -
                seenCompacted: Set<string>;
         
     | 
| 
       32 
     | 
    
         
            -
                private getBlockCache;
         
     | 
| 
       33 
     | 
    
         
            -
                private seenMeta;
         
     | 
| 
       34 
     | 
    
         
            -
                static defaultHeader: AnyCarHeader;
         
     | 
| 
       35 
     | 
    
         
            -
                abstract defaultHeader: AnyCarHeader;
         
     | 
| 
       36 
     | 
    
         
            -
                constructor(name: string, opts?: FireproofOptions);
         
     | 
| 
       37 
     | 
    
         
            -
                snapToCar(carCid: AnyLink | string): Promise<void>;
         
     | 
| 
       38 
     | 
    
         
            -
                _readyForMerge(): Promise<void>;
         
     | 
| 
       39 
     | 
    
         
            -
                _setWaitForWrite(_writing: () => Promise<void>): Promise<void>;
         
     | 
| 
       40 
     | 
    
         
            -
                handleDbMetasFromStore(metas: DbMeta[]): Promise<void>;
         
     | 
| 
       41 
     | 
    
         
            -
                mergeDbMetaIntoClock(meta: DbMeta): Promise<void>;
         
     | 
| 
       42 
     | 
    
         
            -
                protected ingestKeyFromMeta(meta: DbMeta): Promise<void>;
         
     | 
| 
       43 
     | 
    
         
            -
                loadCarHeaderFromMeta({ car: cid }: DbMeta): Promise<CarLoaderHeader>;
         
     | 
| 
       44 
     | 
    
         
            -
                protected abstract _applyCarHeader(_carHeader: CarLoaderHeader, snap?: boolean): Promise<void>;
         
     | 
| 
       45 
     | 
    
         
            -
                _getKey(): Promise<string | undefined>;
         
     | 
| 
       46 
     | 
    
         
            -
                commit(t: Transaction, done: IndexerResult | BulkResult | FileResult, opts?: CommitOpts): Promise<AnyLink>;
         
     | 
| 
       47 
     | 
    
         
            -
                _commitInternal(t: Transaction, done: IndexerResult | BulkResult | FileResult, opts?: CommitOpts): Promise<AnyLink>;
         
     | 
| 
       48 
     | 
    
         
            -
                flushCars(): Promise<void>;
         
     | 
| 
       49 
     | 
    
         
            -
                entries(): AsyncIterableIterator<AnyBlock>;
         
     | 
| 
       50 
     | 
    
         
            -
                getBlock(cid: AnyLink): Promise<AnyBlock | undefined>;
         
     | 
| 
       51 
     | 
    
         
            -
                protected abstract makeCarHeader(_result: BulkResult | IndexerResult | FileResult, _cars: AnyLink[], _compact: boolean): AnyCarHeader | FileCarHeader;
         
     | 
| 
       52 
     | 
    
         
            -
                protected loadCar(cid: AnyLink): Promise<CarReader>;
         
     | 
| 
       53 
     | 
    
         
            -
                protected storesLoadCar(cid: AnyLink, local: AbstractDataStore, remote?: AbstractDataStore, publicFiles?: boolean): Promise<CarReader>;
         
     | 
| 
       54 
     | 
    
         
            -
                protected ensureDecryptedReader(reader: CarReader): Promise<CarReader>;
         
     | 
| 
       55 
     | 
    
         
            -
                protected setKey(key: string): Promise<void>;
         
     | 
| 
       56 
     | 
    
         
            -
                protected getMoreReaders(cids: AnyLink[]): Promise<void>;
         
     | 
| 
       57 
     | 
    
         
            -
            }
         
     | 
| 
       58 
     | 
    
         
            -
            export interface Connection {
         
     | 
| 
       59 
     | 
    
         
            -
                loader: Loader;
         
     | 
| 
       60 
     | 
    
         
            -
                loaded: Promise<void>;
         
     | 
| 
       61 
     | 
    
         
            -
            }
         
     | 
| 
       62 
     | 
    
         
            -
            export {};
         
     | 
    
        package/dist/types/loaders.d.ts
    DELETED
    
    | 
         @@ -1,51 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import type { CarReader } from '@ipld/car';
         
     | 
| 
       2 
     | 
    
         
            -
            import type { AnyLink, BulkResult, CarCommit, DbCarHeader, FileCarHeader, FileResult, FireproofOptions, IdxCarHeader, IdxMeta, IdxMetaMap } from './types';
         
     | 
| 
       3 
     | 
    
         
            -
            import type { CRDT } from './crdt';
         
     | 
| 
       4 
     | 
    
         
            -
            import type { CRDTClock } from './crdt-clock';
         
     | 
| 
       5 
     | 
    
         
            -
            import { Loader } from './loader';
         
     | 
| 
       6 
     | 
    
         
            -
            import type { DataStore as AbstractDataStore } from './store';
         
     | 
| 
       7 
     | 
    
         
            -
            import { DataStore } from './store-browser';
         
     | 
| 
       8 
     | 
    
         
            -
            import { TransactionBlockstore } from './transaction';
         
     | 
| 
       9 
     | 
    
         
            -
            export declare class IdxLoader extends Loader {
         
     | 
| 
       10 
     | 
    
         
            -
                crdt: CRDT;
         
     | 
| 
       11 
     | 
    
         
            -
                static defaultHeader: {
         
     | 
| 
       12 
     | 
    
         
            -
                    cars: never[];
         
     | 
| 
       13 
     | 
    
         
            -
                    compact: never[];
         
     | 
| 
       14 
     | 
    
         
            -
                    indexes: Map<string, IdxMeta>;
         
     | 
| 
       15 
     | 
    
         
            -
                };
         
     | 
| 
       16 
     | 
    
         
            -
                defaultHeader: {
         
     | 
| 
       17 
     | 
    
         
            -
                    cars: never[];
         
     | 
| 
       18 
     | 
    
         
            -
                    compact: never[];
         
     | 
| 
       19 
     | 
    
         
            -
                    indexes: Map<string, IdxMeta>;
         
     | 
| 
       20 
     | 
    
         
            -
                };
         
     | 
| 
       21 
     | 
    
         
            -
                constructor(name: string, crdt: CRDT, opts?: FireproofOptions);
         
     | 
| 
       22 
     | 
    
         
            -
                _applyCarHeader(header: IdxCarHeader): Promise<void>;
         
     | 
| 
       23 
     | 
    
         
            -
                protected makeCarHeader({ indexes }: IndexerResult, cars: AnyLink[], compact?: boolean): IdxCarHeader;
         
     | 
| 
       24 
     | 
    
         
            -
            }
         
     | 
| 
       25 
     | 
    
         
            -
            export type IndexerResult = CarCommit & IdxMetaMap;
         
     | 
| 
       26 
     | 
    
         
            -
            export declare class DbLoader extends Loader {
         
     | 
| 
       27 
     | 
    
         
            -
                static defaultHeader: {
         
     | 
| 
       28 
     | 
    
         
            -
                    cars: never[];
         
     | 
| 
       29 
     | 
    
         
            -
                    compact: never[];
         
     | 
| 
       30 
     | 
    
         
            -
                    head: never[];
         
     | 
| 
       31 
     | 
    
         
            -
                };
         
     | 
| 
       32 
     | 
    
         
            -
                defaultHeader: {
         
     | 
| 
       33 
     | 
    
         
            -
                    cars: never[];
         
     | 
| 
       34 
     | 
    
         
            -
                    compact: never[];
         
     | 
| 
       35 
     | 
    
         
            -
                    head: never[];
         
     | 
| 
       36 
     | 
    
         
            -
                };
         
     | 
| 
       37 
     | 
    
         
            -
                clock: CRDTClock;
         
     | 
| 
       38 
     | 
    
         
            -
                awaitingCompact: boolean;
         
     | 
| 
       39 
     | 
    
         
            -
                compacting: Promise<AnyLink | void>;
         
     | 
| 
       40 
     | 
    
         
            -
                writing: Promise<BulkResult | void>;
         
     | 
| 
       41 
     | 
    
         
            -
                remoteFileStore: AbstractDataStore | undefined;
         
     | 
| 
       42 
     | 
    
         
            -
                fileStore: DataStore;
         
     | 
| 
       43 
     | 
    
         
            -
                constructor(name: string, clock: CRDTClock, opts?: FireproofOptions);
         
     | 
| 
       44 
     | 
    
         
            -
                _readyForMerge(): Promise<void>;
         
     | 
| 
       45 
     | 
    
         
            -
                _setWaitForWrite(_writingFn: () => Promise<any>): Promise<void>;
         
     | 
| 
       46 
     | 
    
         
            -
                compact(blocks: TransactionBlockstore): Promise<void>;
         
     | 
| 
       47 
     | 
    
         
            -
                loadFileCar(cid: AnyLink, isPublic?: boolean): Promise<CarReader>;
         
     | 
| 
       48 
     | 
    
         
            -
                protected _applyCarHeader(carHeader: DbCarHeader, snap?: boolean): Promise<void>;
         
     | 
| 
       49 
     | 
    
         
            -
                protected makeCarHeader(result: BulkResult | FileResult, cars: AnyLink[], compact?: boolean): DbCarHeader | FileCarHeader;
         
     | 
| 
       50 
     | 
    
         
            -
            }
         
     | 
| 
       51 
     | 
    
         
            -
            export declare function isFileResult(result: IndexerResult | BulkResult | FileResult): result is FileResult;
         
     | 
| 
         @@ -1,26 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { AnyLink, CommitOpts, DbMeta } from './types';
         
     | 
| 
       2 
     | 
    
         
            -
            import { type Loader } from './loader';
         
     | 
| 
       3 
     | 
    
         
            -
            export type WALState = {
         
     | 
| 
       4 
     | 
    
         
            -
                operations: DbMeta[];
         
     | 
| 
       5 
     | 
    
         
            -
                noLoaderOps: DbMeta[];
         
     | 
| 
       6 
     | 
    
         
            -
                fileOperations: {
         
     | 
| 
       7 
     | 
    
         
            -
                    cid: AnyLink;
         
     | 
| 
       8 
     | 
    
         
            -
                    public: boolean;
         
     | 
| 
       9 
     | 
    
         
            -
                }[];
         
     | 
| 
       10 
     | 
    
         
            -
            };
         
     | 
| 
       11 
     | 
    
         
            -
            export declare abstract class RemoteWAL {
         
     | 
| 
       12 
     | 
    
         
            -
                tag: string;
         
     | 
| 
       13 
     | 
    
         
            -
                STORAGE_VERSION: string;
         
     | 
| 
       14 
     | 
    
         
            -
                loader: Loader;
         
     | 
| 
       15 
     | 
    
         
            -
                ready: Promise<void>;
         
     | 
| 
       16 
     | 
    
         
            -
                walState: WALState;
         
     | 
| 
       17 
     | 
    
         
            -
                processing: Promise<void> | undefined;
         
     | 
| 
       18 
     | 
    
         
            -
                private processQueue;
         
     | 
| 
       19 
     | 
    
         
            -
                constructor(loader: Loader);
         
     | 
| 
       20 
     | 
    
         
            -
                enqueue(dbMeta: DbMeta, opts: CommitOpts): Promise<void>;
         
     | 
| 
       21 
     | 
    
         
            -
                enqueueFile(fileCid: AnyLink, publicFile?: boolean): Promise<void>;
         
     | 
| 
       22 
     | 
    
         
            -
                _process(): Promise<void>;
         
     | 
| 
       23 
     | 
    
         
            -
                _doProcess(): Promise<void>;
         
     | 
| 
       24 
     | 
    
         
            -
                abstract load(branch?: string): Promise<WALState | null>;
         
     | 
| 
       25 
     | 
    
         
            -
                abstract save(state: WALState, branch?: string): Promise<void>;
         
     | 
| 
       26 
     | 
    
         
            -
            }
         
     | 
| 
         @@ -1,24 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { IDBPDatabase } from 'idb';
         
     | 
| 
       2 
     | 
    
         
            -
            import { AnyBlock, AnyLink, DbMeta } from './types';
         
     | 
| 
       3 
     | 
    
         
            -
            import { DataStore as DataStoreBase, MetaStore as MetaStoreBase } from './store';
         
     | 
| 
       4 
     | 
    
         
            -
            import { RemoteWAL as RemoteWALBase, WALState } from './remote-wal';
         
     | 
| 
       5 
     | 
    
         
            -
            export declare class DataStore extends DataStoreBase {
         
     | 
| 
       6 
     | 
    
         
            -
                tag: string;
         
     | 
| 
       7 
     | 
    
         
            -
                idb: IDBPDatabase<unknown> | null;
         
     | 
| 
       8 
     | 
    
         
            -
                _withDB(dbWorkFun: (arg0: any) => any): Promise<any>;
         
     | 
| 
       9 
     | 
    
         
            -
                load(cid: AnyLink): Promise<AnyBlock>;
         
     | 
| 
       10 
     | 
    
         
            -
                save(car: AnyBlock): Promise<void>;
         
     | 
| 
       11 
     | 
    
         
            -
                remove(cid: AnyLink): Promise<void>;
         
     | 
| 
       12 
     | 
    
         
            -
            }
         
     | 
| 
       13 
     | 
    
         
            -
            export declare class RemoteWAL extends RemoteWALBase {
         
     | 
| 
       14 
     | 
    
         
            -
                tag: string;
         
     | 
| 
       15 
     | 
    
         
            -
                headerKey(branch: string): string;
         
     | 
| 
       16 
     | 
    
         
            -
                load(branch?: string): Promise<WALState | null>;
         
     | 
| 
       17 
     | 
    
         
            -
                save(state: WALState, branch?: string): Promise<void>;
         
     | 
| 
       18 
     | 
    
         
            -
            }
         
     | 
| 
       19 
     | 
    
         
            -
            export declare class MetaStore extends MetaStoreBase {
         
     | 
| 
       20 
     | 
    
         
            -
                tag: string;
         
     | 
| 
       21 
     | 
    
         
            -
                headerKey(branch: string): string;
         
     | 
| 
       22 
     | 
    
         
            -
                load(branch?: string): Promise<DbMeta[] | null>;
         
     | 
| 
       23 
     | 
    
         
            -
                save(meta: DbMeta, branch?: string): Promise<null>;
         
     | 
| 
       24 
     | 
    
         
            -
            }
         
     | 
    
        package/dist/types/store-fs.d.ts
    DELETED
    
    | 
         @@ -1,26 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import type { AnyBlock, AnyLink, DbMeta } from './types';
         
     | 
| 
       2 
     | 
    
         
            -
            import { MetaStore as MetaStoreBase, DataStore as DataStoreBase } from './store';
         
     | 
| 
       3 
     | 
    
         
            -
            import { RemoteWAL as RemoteWALBase, WALState } from './remote-wal';
         
     | 
| 
       4 
     | 
    
         
            -
            export declare class RemoteWAL extends RemoteWALBase {
         
     | 
| 
       5 
     | 
    
         
            -
                filePathForBranch(branch: string): string;
         
     | 
| 
       6 
     | 
    
         
            -
                load(branch?: string): Promise<WALState | null>;
         
     | 
| 
       7 
     | 
    
         
            -
                save(state: WALState, branch?: string): Promise<void>;
         
     | 
| 
       8 
     | 
    
         
            -
            }
         
     | 
| 
       9 
     | 
    
         
            -
            export declare class MetaStore extends MetaStoreBase {
         
     | 
| 
       10 
     | 
    
         
            -
                tag: string;
         
     | 
| 
       11 
     | 
    
         
            -
                static dataDir: string;
         
     | 
| 
       12 
     | 
    
         
            -
                filePathForBranch(branch: string): string;
         
     | 
| 
       13 
     | 
    
         
            -
                load(branch?: string): Promise<DbMeta[] | null>;
         
     | 
| 
       14 
     | 
    
         
            -
                save(meta: DbMeta, branch?: string): Promise<null>;
         
     | 
| 
       15 
     | 
    
         
            -
            }
         
     | 
| 
       16 
     | 
    
         
            -
            export declare const testConfig: {
         
     | 
| 
       17 
     | 
    
         
            -
                dataDir: string;
         
     | 
| 
       18 
     | 
    
         
            -
            };
         
     | 
| 
       19 
     | 
    
         
            -
            export declare class DataStore extends DataStoreBase {
         
     | 
| 
       20 
     | 
    
         
            -
                tag: string;
         
     | 
| 
       21 
     | 
    
         
            -
                static dataDir: string;
         
     | 
| 
       22 
     | 
    
         
            -
                save(car: AnyBlock): Promise<void>;
         
     | 
| 
       23 
     | 
    
         
            -
                private cidPath;
         
     | 
| 
       24 
     | 
    
         
            -
                load(cid: AnyLink): Promise<AnyBlock>;
         
     | 
| 
       25 
     | 
    
         
            -
                remove(cid: AnyLink): Promise<void>;
         
     | 
| 
       26 
     | 
    
         
            -
            }
         
     | 
| 
         @@ -1,24 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { AnyBlock, AnyLink, DbMeta } from './types';
         
     | 
| 
       2 
     | 
    
         
            -
            import { DataStore as DataStoreBase, MetaStore as MetaStoreBase } from './store';
         
     | 
| 
       3 
     | 
    
         
            -
            import { RemoteWAL as RemoteWALBase, WALState } from './remote-wal';
         
     | 
| 
       4 
     | 
    
         
            -
            export declare class DataStore extends DataStoreBase {
         
     | 
| 
       5 
     | 
    
         
            -
                tag: string;
         
     | 
| 
       6 
     | 
    
         
            -
                store: Map<string, Uint8Array>;
         
     | 
| 
       7 
     | 
    
         
            -
                load(cid: AnyLink): Promise<AnyBlock>;
         
     | 
| 
       8 
     | 
    
         
            -
                save(car: AnyBlock): Promise<void>;
         
     | 
| 
       9 
     | 
    
         
            -
                remove(cid: AnyLink): Promise<void>;
         
     | 
| 
       10 
     | 
    
         
            -
            }
         
     | 
| 
       11 
     | 
    
         
            -
            export declare class MetaStore extends MetaStoreBase {
         
     | 
| 
       12 
     | 
    
         
            -
                tag: string;
         
     | 
| 
       13 
     | 
    
         
            -
                store: Map<string, string>;
         
     | 
| 
       14 
     | 
    
         
            -
                headerKey(branch: string): string;
         
     | 
| 
       15 
     | 
    
         
            -
                load(branch?: string): Promise<DbMeta[] | null>;
         
     | 
| 
       16 
     | 
    
         
            -
                save(meta: DbMeta, branch?: string): Promise<null>;
         
     | 
| 
       17 
     | 
    
         
            -
            }
         
     | 
| 
       18 
     | 
    
         
            -
            export declare class RemoteWAL extends RemoteWALBase {
         
     | 
| 
       19 
     | 
    
         
            -
                tag: string;
         
     | 
| 
       20 
     | 
    
         
            -
                store: Map<string, string>;
         
     | 
| 
       21 
     | 
    
         
            -
                headerKey(branch: string): string;
         
     | 
| 
       22 
     | 
    
         
            -
                load(branch?: string): Promise<WALState | null>;
         
     | 
| 
       23 
     | 
    
         
            -
                save(state: WALState, branch?: string): Promise<void>;
         
     | 
| 
       24 
     | 
    
         
            -
            }
         
     | 
    
        package/dist/types/store.d.ts
    DELETED
    
    | 
         @@ -1,28 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { ToString } from '@ipld/dag-json';
         
     | 
| 
       2 
     | 
    
         
            -
            import { AnyBlock, AnyLink, DbMeta } from './types';
         
     | 
| 
       3 
     | 
    
         
            -
            export declare const STORAGE_VERSION: string;
         
     | 
| 
       4 
     | 
    
         
            -
            declare abstract class VersionedStore {
         
     | 
| 
       5 
     | 
    
         
            -
                STORAGE_VERSION: string;
         
     | 
| 
       6 
     | 
    
         
            -
                name: string;
         
     | 
| 
       7 
     | 
    
         
            -
                constructor(name: string);
         
     | 
| 
       8 
     | 
    
         
            -
            }
         
     | 
| 
       9 
     | 
    
         
            -
            export declare abstract class MetaStore extends VersionedStore {
         
     | 
| 
       10 
     | 
    
         
            -
                tag: string;
         
     | 
| 
       11 
     | 
    
         
            -
                makeHeader({ car, key }: DbMeta): ToString<DbMeta>;
         
     | 
| 
       12 
     | 
    
         
            -
                parseHeader(headerData: ToString<DbMeta>): DbMeta;
         
     | 
| 
       13 
     | 
    
         
            -
                abstract load(branch?: string): Promise<DbMeta[] | null>;
         
     | 
| 
       14 
     | 
    
         
            -
                abstract save(dbMeta: DbMeta, branch?: string): Promise<DbMeta[] | null>;
         
     | 
| 
       15 
     | 
    
         
            -
            }
         
     | 
| 
       16 
     | 
    
         
            -
            type DataSaveOpts = {
         
     | 
| 
       17 
     | 
    
         
            -
                public?: boolean;
         
     | 
| 
       18 
     | 
    
         
            -
            };
         
     | 
| 
       19 
     | 
    
         
            -
            export declare abstract class DataStore {
         
     | 
| 
       20 
     | 
    
         
            -
                tag: string;
         
     | 
| 
       21 
     | 
    
         
            -
                STORAGE_VERSION: string;
         
     | 
| 
       22 
     | 
    
         
            -
                name: string;
         
     | 
| 
       23 
     | 
    
         
            -
                constructor(name: string);
         
     | 
| 
       24 
     | 
    
         
            -
                abstract load(cid: AnyLink): Promise<AnyBlock>;
         
     | 
| 
       25 
     | 
    
         
            -
                abstract save(car: AnyBlock, opts?: DataSaveOpts): Promise<void | AnyLink>;
         
     | 
| 
       26 
     | 
    
         
            -
                abstract remove(cid: AnyLink): Promise<void>;
         
     | 
| 
       27 
     | 
    
         
            -
            }
         
     | 
| 
       28 
     | 
    
         
            -
            export {};
         
     | 
| 
         @@ -1,50 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { MemoryBlockstore } from '@alanshaw/pail/block';
         
     | 
| 
       2 
     | 
    
         
            -
            import { BlockFetcher, AnyBlock, AnyLink, BulkResult, ClockHead, IdxMeta, CarCommit, CarMakeable, FireproofOptions } from './types';
         
     | 
| 
       3 
     | 
    
         
            -
            import { DbLoader, IdxLoader } from './loaders';
         
     | 
| 
       4 
     | 
    
         
            -
            import { CRDT } from './crdt';
         
     | 
| 
       5 
     | 
    
         
            -
            import { CRDTClock } from './crdt-clock';
         
     | 
| 
       6 
     | 
    
         
            -
            export declare class Transaction extends MemoryBlockstore implements CarMakeable {
         
     | 
| 
       7 
     | 
    
         
            -
                parent: FireproofBlockstore;
         
     | 
| 
       8 
     | 
    
         
            -
                constructor(parent: FireproofBlockstore);
         
     | 
| 
       9 
     | 
    
         
            -
                get(cid: AnyLink): Promise<AnyBlock | undefined>;
         
     | 
| 
       10 
     | 
    
         
            -
                superGet(cid: AnyLink): Promise<AnyBlock | undefined>;
         
     | 
| 
       11 
     | 
    
         
            -
            }
         
     | 
| 
       12 
     | 
    
         
            -
            declare abstract class FireproofBlockstore implements BlockFetcher {
         
     | 
| 
       13 
     | 
    
         
            -
                ready: Promise<void>;
         
     | 
| 
       14 
     | 
    
         
            -
                name: string | null;
         
     | 
| 
       15 
     | 
    
         
            -
                loader: DbLoader | IdxLoader | null;
         
     | 
| 
       16 
     | 
    
         
            -
                opts: FireproofOptions;
         
     | 
| 
       17 
     | 
    
         
            -
                transactions: Set<Transaction>;
         
     | 
| 
       18 
     | 
    
         
            -
                constructor(name: string | null, loader?: DbLoader | IdxLoader, opts?: FireproofOptions);
         
     | 
| 
       19 
     | 
    
         
            -
                abstract transaction(fn: (t: Transaction) => Promise<IdxMeta | BulkResult>, indexes?: Map<string, IdxMeta>, opts?: {
         
     | 
| 
       20 
     | 
    
         
            -
                    noLoader: boolean;
         
     | 
| 
       21 
     | 
    
         
            -
                }): Promise<BulkResultCar | IdxMetaCar>;
         
     | 
| 
       22 
     | 
    
         
            -
                put(): Promise<void>;
         
     | 
| 
       23 
     | 
    
         
            -
                get(cid: AnyLink): Promise<AnyBlock | undefined>;
         
     | 
| 
       24 
     | 
    
         
            -
                commitCompaction(t: Transaction, head: ClockHead): Promise<AnyLink>;
         
     | 
| 
       25 
     | 
    
         
            -
                entries(): AsyncIterableIterator<AnyBlock>;
         
     | 
| 
       26 
     | 
    
         
            -
                protected executeTransaction<T, R>(fn: (t: Transaction) => Promise<T>, commitHandler: (t: Transaction, done: T) => Promise<{
         
     | 
| 
       27 
     | 
    
         
            -
                    car?: AnyLink;
         
     | 
| 
       28 
     | 
    
         
            -
                    done: R;
         
     | 
| 
       29 
     | 
    
         
            -
                }>): Promise<R>;
         
     | 
| 
       30 
     | 
    
         
            -
            }
         
     | 
| 
       31 
     | 
    
         
            -
            export declare class IndexBlockstore extends FireproofBlockstore {
         
     | 
| 
       32 
     | 
    
         
            -
                constructor(name: string | null, crdt: CRDT, opts?: FireproofOptions);
         
     | 
| 
       33 
     | 
    
         
            -
                transaction(fn: (t: Transaction) => Promise<IdxMeta>, indexes: Map<string, IdxMeta>): Promise<IdxMetaCar>;
         
     | 
| 
       34 
     | 
    
         
            -
            }
         
     | 
| 
       35 
     | 
    
         
            -
            export declare class TransactionBlockstore extends FireproofBlockstore {
         
     | 
| 
       36 
     | 
    
         
            -
                constructor(name: string | null, clock: CRDTClock, opts?: FireproofOptions);
         
     | 
| 
       37 
     | 
    
         
            -
                transaction(fn: (t: Transaction) => Promise<BulkResult>, _indexes?: undefined, opts?: {
         
     | 
| 
       38 
     | 
    
         
            -
                    noLoader: boolean;
         
     | 
| 
       39 
     | 
    
         
            -
                }): Promise<BulkResultCar>;
         
     | 
| 
       40 
     | 
    
         
            -
            }
         
     | 
| 
       41 
     | 
    
         
            -
            type IdxMetaCar = IdxMeta & CarCommit;
         
     | 
| 
       42 
     | 
    
         
            -
            type BulkResultCar = BulkResult & CarCommit;
         
     | 
| 
       43 
     | 
    
         
            -
            export declare class LoggingFetcher implements BlockFetcher {
         
     | 
| 
       44 
     | 
    
         
            -
                blocks: TransactionBlockstore;
         
     | 
| 
       45 
     | 
    
         
            -
                loader: DbLoader | IdxLoader | null;
         
     | 
| 
       46 
     | 
    
         
            -
                loggedBlocks: Transaction;
         
     | 
| 
       47 
     | 
    
         
            -
                constructor(blocks: TransactionBlockstore);
         
     | 
| 
       48 
     | 
    
         
            -
                get(cid: AnyLink): Promise<AnyBlock | undefined>;
         
     | 
| 
       49 
     | 
    
         
            -
            }
         
     | 
| 
       50 
     | 
    
         
            -
            export {};
         
     |