@fireproof/core 0.13.2 → 0.13.4-dev
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/fireproof.cjs +4 -28
- package/dist/browser/fireproof.cjs.map +4 -4
- package/dist/browser/fireproof.esm.js +4 -28
- package/dist/browser/fireproof.esm.js.map +4 -4
- package/dist/browser/fireproof.iife.js +4 -28
- package/dist/browser/fireproof.iife.js.map +4 -4
- package/dist/node/fireproof.cjs +4 -49
- package/dist/node/fireproof.cjs.map +4 -4
- package/dist/node/fireproof.esm.js +4 -49
- package/dist/node/fireproof.esm.js.map +4 -4
- package/dist/types/database.d.ts +0 -1
- package/dist/types/fireproof.d.ts +3 -2
- package/dist/types/loader.d.ts +10 -12
- package/dist/types/loaders.d.ts +3 -6
- package/dist/types/remote-wal.d.ts +25 -0
- package/dist/types/store-browser.d.ts +2 -1
- package/dist/types/store-fs.d.ts +2 -1
- package/dist/types/store.d.ts +1 -24
- package/dist/types/types.d.ts +0 -25
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/connect-ipfs-account.d.ts +0 -48
- package/dist/types/connect-ipfs-helpers.d.ts +0 -31
- package/dist/types/connect-ipfs.d.ts +0 -27
- package/dist/types/connect-s3.d.ts +0 -11
- package/dist/types/connect.d.ts +0 -39
- package/dist/types/connection.d.ts +0 -15
- package/dist/types/store-remote.d.ts +0 -27
package/dist/types/database.d.ts
CHANGED
@@ -20,7 +20,6 @@ export declare class Database {
|
|
20
20
|
rows: import("./types").IndexRow[];
|
21
21
|
}>;
|
22
22
|
compact(): Promise<void>;
|
23
|
-
connect(schemaName?: string): import("./connect-ipfs").ConnectIPFS;
|
24
23
|
getDashboardURL(compact?: boolean): Promise<URL>;
|
25
24
|
openDashboard(): void;
|
26
25
|
_notify(updates: DocUpdate[]): Promise<void>;
|
package/dist/types/loader.d.ts
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
import { CarReader } from '@ipld/car';
|
2
|
-
import { RemoteDataStore, RemoteMetaStore } from './store-remote';
|
3
2
|
import { DataStore, MetaStore, RemoteWAL } from './store-browser';
|
4
|
-
import type { DataStore as AbstractDataStore } from './store';
|
3
|
+
import type { DataStore as AbstractDataStore, MetaStore as AbstractMetaStore } from './store';
|
5
4
|
import type { Transaction } from './transaction';
|
6
5
|
import type { AnyBlock, AnyCarHeader, AnyLink, BulkResult, CarLoaderHeader, CommitOpts, DbMeta, FileCarHeader, FileResult, FireproofOptions } from './types';
|
7
|
-
import type { Connection } from './connection';
|
8
6
|
import { type IndexerResult } from './loaders';
|
9
7
|
export declare function cidListIncludes(list: AnyLink[], cid: AnyLink): boolean;
|
10
8
|
export declare function toHexString(byteArray: Uint8Array): string;
|
@@ -12,11 +10,11 @@ export declare abstract class Loader {
|
|
12
10
|
name: string;
|
13
11
|
opts: FireproofOptions;
|
14
12
|
remoteMetaLoading: Promise<void> | undefined;
|
15
|
-
remoteMetaStore:
|
16
|
-
remoteCarStore:
|
17
|
-
remoteWAL: RemoteWAL
|
18
|
-
metaStore: MetaStore
|
19
|
-
carStore: DataStore
|
13
|
+
remoteMetaStore: AbstractMetaStore | undefined;
|
14
|
+
remoteCarStore: AbstractDataStore | undefined;
|
15
|
+
remoteWAL: RemoteWAL;
|
16
|
+
metaStore: MetaStore;
|
17
|
+
carStore: DataStore;
|
20
18
|
carLog: AnyLink[];
|
21
19
|
carReaders: Map<string, Promise<CarReader>>;
|
22
20
|
ready: Promise<void>;
|
@@ -26,9 +24,6 @@ export declare abstract class Loader {
|
|
26
24
|
static defaultHeader: AnyCarHeader;
|
27
25
|
abstract defaultHeader: AnyCarHeader;
|
28
26
|
constructor(name: string, opts?: FireproofOptions);
|
29
|
-
_connectRemoteMeta(connection: Connection): Connection;
|
30
|
-
_connectRemoteStorage(connection: Connection): Connection;
|
31
|
-
connectRemote(connection: Connection, storageConnection?: Connection): Connection;
|
32
27
|
snapToCar(carCid: AnyLink | string): Promise<void>;
|
33
28
|
handleDbMetasFromStore(metas: DbMeta[]): Promise<void>;
|
34
29
|
mergeDbMetaIntoClock(meta: DbMeta): Promise<void>;
|
@@ -40,7 +35,6 @@ export declare abstract class Loader {
|
|
40
35
|
commit(t: Transaction, done: IndexerResult | BulkResult | FileResult, opts?: CommitOpts): Promise<AnyLink>;
|
41
36
|
_commitInternal(t: Transaction, done: IndexerResult | BulkResult | FileResult, opts?: CommitOpts): Promise<AnyLink>;
|
42
37
|
getBlock(cid: AnyLink): Promise<AnyBlock | undefined>;
|
43
|
-
protected initializeStores(): Promise<void>;
|
44
38
|
protected abstract makeCarHeader(_result: BulkResult | IndexerResult | FileResult, _cars: AnyLink[], _compact: boolean): AnyCarHeader | FileCarHeader;
|
45
39
|
protected loadCar(cid: AnyLink): Promise<CarReader>;
|
46
40
|
protected storesLoadCar(cid: AnyLink, local: AbstractDataStore, remote?: AbstractDataStore, publicFiles?: boolean): Promise<CarReader>;
|
@@ -48,3 +42,7 @@ export declare abstract class Loader {
|
|
48
42
|
protected setKey(key: string): Promise<void>;
|
49
43
|
protected getMoreReaders(cids: AnyLink[]): Promise<void>;
|
50
44
|
}
|
45
|
+
export interface Connection {
|
46
|
+
loader: Loader;
|
47
|
+
loaded: Promise<void>;
|
48
|
+
}
|
package/dist/types/loaders.d.ts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
import type { CarReader } from '@ipld/car';
|
2
2
|
import type { AnyLink, BulkResult, CarCommit, DbCarHeader, FileCarHeader, FileResult, FireproofOptions, IdxCarHeader, IdxMeta, IdxMetaMap } from './types';
|
3
|
-
import type { Connection } from './connection';
|
4
3
|
import type { CRDT } from './crdt';
|
5
4
|
import type { CRDTClock } from './crdt-clock';
|
6
5
|
import { Loader } from './loader';
|
7
|
-
import {
|
6
|
+
import type { DataStore as AbstractDataStore } from './store';
|
8
7
|
import { DataStore } from './store-browser';
|
9
8
|
export declare class IdxLoader extends Loader {
|
10
9
|
crdt: CRDT;
|
@@ -35,11 +34,9 @@ export declare class DbLoader extends Loader {
|
|
35
34
|
head: never[];
|
36
35
|
};
|
37
36
|
clock: CRDTClock;
|
38
|
-
remoteFileStore:
|
39
|
-
fileStore: DataStore
|
37
|
+
remoteFileStore: AbstractDataStore | undefined;
|
38
|
+
fileStore: DataStore;
|
40
39
|
constructor(name: string, clock: CRDTClock, opts?: FireproofOptions);
|
41
|
-
protected initializeStores(): Promise<void>;
|
42
|
-
_connectRemoteStorage(connection: Connection): Connection;
|
43
40
|
loadFileCar(cid: AnyLink, isPublic?: boolean): Promise<CarReader>;
|
44
41
|
protected _applyCarHeader(carHeader: DbCarHeader, snap?: boolean): Promise<void>;
|
45
42
|
protected makeCarHeader(result: BulkResult | FileResult, cars: AnyLink[], compact?: boolean): DbCarHeader | FileCarHeader;
|
@@ -0,0 +1,25 @@
|
|
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
|
+
constructor(loader: Loader);
|
19
|
+
enqueue(dbMeta: DbMeta, opts: CommitOpts): Promise<void>;
|
20
|
+
enqueueFile(fileCid: AnyLink, publicFile?: boolean): Promise<void>;
|
21
|
+
_process(): Promise<void>;
|
22
|
+
_int_process(): Promise<void>;
|
23
|
+
abstract load(branch?: string): Promise<WALState | null>;
|
24
|
+
abstract save(state: WALState, branch?: string): Promise<void>;
|
25
|
+
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { IDBPDatabase } from 'idb';
|
2
2
|
import { AnyBlock, AnyLink, DbMeta } from './types';
|
3
|
-
import { DataStore as DataStoreBase, MetaStore as MetaStoreBase
|
3
|
+
import { DataStore as DataStoreBase, MetaStore as MetaStoreBase } from './store';
|
4
|
+
import { RemoteWAL as RemoteWALBase, WALState } from './remote-wal';
|
4
5
|
export declare class DataStore extends DataStoreBase {
|
5
6
|
tag: string;
|
6
7
|
idb: IDBPDatabase<unknown> | null;
|
package/dist/types/store-fs.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { AnyBlock, AnyLink, DbMeta } from './types';
|
2
|
-
import { MetaStore as MetaStoreBase, DataStore as DataStoreBase
|
2
|
+
import { MetaStore as MetaStoreBase, DataStore as DataStoreBase } from './store';
|
3
|
+
import { RemoteWAL as RemoteWALBase, WALState } from './remote-wal';
|
3
4
|
export declare class RemoteWAL extends RemoteWALBase {
|
4
5
|
filePathForBranch(branch: string): string;
|
5
6
|
load(branch?: string): Promise<WALState | null>;
|
package/dist/types/store.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ToString } from '@ipld/dag-json';
|
2
|
-
import { AnyBlock, AnyLink,
|
2
|
+
import { AnyBlock, AnyLink, DbMeta } from './types';
|
3
3
|
import type { Loader } from './loader';
|
4
4
|
export declare const STORAGE_VERSION: string;
|
5
5
|
declare abstract class VersionedStore {
|
@@ -14,29 +14,6 @@ export declare abstract class MetaStore extends VersionedStore {
|
|
14
14
|
abstract load(branch?: string): Promise<DbMeta[] | null>;
|
15
15
|
abstract save(dbMeta: DbMeta, branch?: string): Promise<DbMeta[] | null>;
|
16
16
|
}
|
17
|
-
export type WALState = {
|
18
|
-
operations: DbMeta[];
|
19
|
-
noLoaderOps: DbMeta[];
|
20
|
-
fileOperations: {
|
21
|
-
cid: AnyLink;
|
22
|
-
public: boolean;
|
23
|
-
}[];
|
24
|
-
};
|
25
|
-
export declare abstract class RemoteWAL {
|
26
|
-
tag: string;
|
27
|
-
STORAGE_VERSION: string;
|
28
|
-
loader: Loader;
|
29
|
-
ready: Promise<void>;
|
30
|
-
walState: WALState;
|
31
|
-
processing: Promise<void> | undefined;
|
32
|
-
constructor(loader: Loader);
|
33
|
-
enqueue(dbMeta: DbMeta, opts: CommitOpts): Promise<void>;
|
34
|
-
enqueueFile(fileCid: AnyLink, publicFile?: boolean): Promise<void>;
|
35
|
-
_process(): Promise<void>;
|
36
|
-
_int_process(): Promise<void>;
|
37
|
-
abstract load(branch?: string): Promise<WALState | null>;
|
38
|
-
abstract save(state: WALState, branch?: string): Promise<void>;
|
39
|
-
}
|
40
17
|
type DataSaveOpts = {
|
41
18
|
public?: boolean;
|
42
19
|
};
|
package/dist/types/types.d.ts
CHANGED
@@ -151,32 +151,7 @@ export interface CarMakeable {
|
|
151
151
|
get(cid: AnyLink): Promise<AnyBlock | undefined>
|
152
152
|
}
|
153
153
|
|
154
|
-
export type UploadMetaFnParams = {
|
155
|
-
name: string,
|
156
|
-
branch: string,
|
157
|
-
}
|
158
|
-
|
159
|
-
export type UploadDataFnParams = {
|
160
|
-
type: 'data' | 'file',
|
161
|
-
name: string,
|
162
|
-
car: string,
|
163
|
-
size: string
|
164
|
-
}
|
165
|
-
|
166
|
-
export type DownloadFnParamTypes = 'data' | 'file'
|
167
|
-
|
168
|
-
export type DownloadDataFnParams = {
|
169
|
-
type: DownloadFnParamTypes,
|
170
|
-
name: string,
|
171
|
-
car: string,
|
172
|
-
}
|
173
|
-
|
174
|
-
export type DownloadMetaFnParams = {
|
175
|
-
name: string,
|
176
|
-
branch: string,
|
177
|
-
}
|
178
154
|
|
179
|
-
export type LoadHandler = (dbMetas: DbMeta[]) => Promise<void>
|
180
155
|
|
181
156
|
export type ChangesOptions = {
|
182
157
|
dirty?: boolean
|
package/dist/types/version.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export declare const PACKAGE_VERSION = "0.13.
|
1
|
+
export declare const PACKAGE_VERSION = "0.13.4-dev";
|
package/package.json
CHANGED
@@ -1,48 +0,0 @@
|
|
1
|
-
import type { Client } from '@web3-storage/w3up-client';
|
2
|
-
import { Database } from './database';
|
3
|
-
import { ConnectIPFSParams } from './connect-ipfs';
|
4
|
-
import { DatabaseConnectIPFS } from './connect-ipfs-helpers';
|
5
|
-
type ClockSpaceDoc = {
|
6
|
-
type: 'clock-space';
|
7
|
-
clockName: `_clock/${string}/${string}`;
|
8
|
-
with: `did:${string}:${string}`;
|
9
|
-
accountSpace: `did:${string}:${string}`;
|
10
|
-
issuer: `did:key:${string}`;
|
11
|
-
created: number;
|
12
|
-
name: string;
|
13
|
-
email: `${string}@${string}` | null;
|
14
|
-
ua: string;
|
15
|
-
schema: string;
|
16
|
-
};
|
17
|
-
type SpaceDelegationDoc = {
|
18
|
-
_id: `delegation/${string}/${string}`;
|
19
|
-
type: 'member-delegation';
|
20
|
-
audience: `did:key:${string}`;
|
21
|
-
with: `did:${string}:${string}`;
|
22
|
-
schema: string;
|
23
|
-
status: 'pending' | 'applied';
|
24
|
-
delegation?: Uint8Array;
|
25
|
-
};
|
26
|
-
export declare class AccountConnectIPFS extends DatabaseConnectIPFS {
|
27
|
-
accountDb: Database;
|
28
|
-
client: Client | null;
|
29
|
-
email: `${string}@${string}` | null;
|
30
|
-
constructor();
|
31
|
-
accountEmail(): Promise<`${string}@${string}` | undefined>;
|
32
|
-
authorize(email: `${string}@${string}`): Promise<void>;
|
33
|
-
initializeClient(): Promise<void>;
|
34
|
-
authorizedClient(): Promise<Client>;
|
35
|
-
clockSpaceDIDForDb(): `did:${string}:${string}`;
|
36
|
-
connectClient(): Promise<Client>;
|
37
|
-
bestSpace(client: Client): import("@web3-storage/w3up-client/dist/src/space").Space | undefined;
|
38
|
-
encodeSpaceName(params: ConnectIPFSParams): `_clock/${string}/${string}`;
|
39
|
-
authorizedClockSpace(params: ConnectIPFSParams): Promise<`did:${string}:${string}`>;
|
40
|
-
createNewSpace(params: ConnectIPFSParams): Promise<`did:${string}:${string}`>;
|
41
|
-
joinExistingSpace(doc: ClockSpaceDoc): Promise<`did:${string}:${string}`>;
|
42
|
-
joinSchema(schema: string, agentDID: `did:key:${string}`): Promise<void>;
|
43
|
-
waitForAccess(clockDoc: ClockSpaceDoc, agentDID: `did:key:${string}`): Promise<unknown>;
|
44
|
-
applyDelegation(doc: SpaceDelegationDoc): Promise<void>;
|
45
|
-
serviceAccessRequests(): Promise<() => void>;
|
46
|
-
delegateAccess(clockDoc: ClockSpaceDoc | SpaceDelegationDoc, memberDid: `did:key:${string}`): Promise<void>;
|
47
|
-
}
|
48
|
-
export {};
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import type { Client } from '@web3-storage/w3up-client';
|
2
|
-
import type { DownloadDataFnParams, DownloadMetaFnParams, UploadDataFnParams, UploadMetaFnParams } from './types';
|
3
|
-
import { Connection } from './connection';
|
4
|
-
import { MemoryBlockstore } from '@alanshaw/pail/block';
|
5
|
-
import { Proof } from '@ucanto/interface';
|
6
|
-
import { CarClockHead } from './connect-ipfs';
|
7
|
-
export declare abstract class AbstractConnectIPFS extends Connection {
|
8
|
-
eventBlocks: MemoryBlockstore;
|
9
|
-
parents: CarClockHead;
|
10
|
-
abstract authorizedClient(): Promise<Client>;
|
11
|
-
abstract clockProofsForDb(): Promise<Proof[]>;
|
12
|
-
abstract clockSpaceDIDForDb(): `did:${string}:${string}`;
|
13
|
-
issuer(client: Client): import("@ucanto/interface").Signer<`did:key:${string}`, import("@ucanto/interface").SigAlg>;
|
14
|
-
dataDownload(params: DownloadDataFnParams): Promise<Uint8Array>;
|
15
|
-
dataUpload(bytes: Uint8Array, params: UploadDataFnParams, opts: {
|
16
|
-
public?: boolean;
|
17
|
-
}): Promise<import("@web3-storage/w3up-client/dist/src/types").AnyLink>;
|
18
|
-
metaDownload(params: DownloadMetaFnParams): Promise<Uint8Array[]>;
|
19
|
-
metaUpload(bytes: Uint8Array, params: UploadMetaFnParams): Promise<Uint8Array[]>;
|
20
|
-
fetchAndUpdateHead(remoteHead: CarClockHead): Promise<Uint8Array[]>;
|
21
|
-
}
|
22
|
-
export declare abstract class DatabaseConnectIPFS extends AbstractConnectIPFS {
|
23
|
-
activated: boolean | null;
|
24
|
-
authorizing: Promise<void>;
|
25
|
-
authorizingComplete: () => void;
|
26
|
-
authorizingFailed: (reason: string) => void;
|
27
|
-
constructor();
|
28
|
-
startBackgroundSync(): Promise<void>;
|
29
|
-
abstract initializeClient(): Promise<void>;
|
30
|
-
clockProofsForDb(): Promise<any[]>;
|
31
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import type { Link } from 'multiformats';
|
2
|
-
import { EventView } from '@alanshaw/pail/clock';
|
3
|
-
import { AccountConnectIPFS } from './connect-ipfs-account';
|
4
|
-
import { DatabaseConnectIPFS } from './connect-ipfs-helpers';
|
5
|
-
export type CarClockHead = Link<EventView<{
|
6
|
-
dbMeta: Uint8Array;
|
7
|
-
}>, number, number, 1>[];
|
8
|
-
export type ConnectIPFSParams = {
|
9
|
-
name: string;
|
10
|
-
schema: string;
|
11
|
-
};
|
12
|
-
export type ConnectIPFSCallbacks = {
|
13
|
-
resolve: (clockSpaceDID: `did:${string}:${string}`) => void;
|
14
|
-
reject: (reason: string) => void;
|
15
|
-
};
|
16
|
-
export declare class ConnectIPFS extends DatabaseConnectIPFS {
|
17
|
-
accountConnection: AccountConnectIPFS;
|
18
|
-
authorized: boolean | null;
|
19
|
-
params: ConnectIPFSParams;
|
20
|
-
clockSpaceDID: `did:${string}:${string}`;
|
21
|
-
constructor(params: ConnectIPFSParams);
|
22
|
-
authorize(email: `${string}@${string}`): Promise<void>;
|
23
|
-
accountEmail(): Promise<`${string}@${string}` | undefined>;
|
24
|
-
authorizedClient(): Promise<import("@web3-storage/w3up-client/dist/src").Client>;
|
25
|
-
clockSpaceDIDForDb(): `did:${string}:${string}`;
|
26
|
-
initializeClient(): Promise<void>;
|
27
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { DownloadMetaFnParams, DownloadDataFnParams, UploadMetaFnParams, UploadDataFnParams } from './types';
|
2
|
-
import { Connection } from './connection';
|
3
|
-
export declare class ConnectS3 extends Connection {
|
4
|
-
uploadUrl: URL;
|
5
|
-
downloadUrl: URL;
|
6
|
-
constructor(upload: string, download: string);
|
7
|
-
dataUpload(bytes: Uint8Array, params: UploadDataFnParams): Promise<void>;
|
8
|
-
metaUpload(bytes: Uint8Array, params: UploadMetaFnParams): Promise<null>;
|
9
|
-
dataDownload(params: DownloadDataFnParams): Promise<Uint8Array | null>;
|
10
|
-
metaDownload(params: DownloadMetaFnParams): Promise<Uint8Array[] | null>;
|
11
|
-
}
|
package/dist/types/connect.d.ts
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
import { ConnectS3 } from './connect-s3';
|
2
|
-
import { ConnectIPFS } from './connect-ipfs';
|
3
|
-
import { Connection } from './connection';
|
4
|
-
import { Database } from './database';
|
5
|
-
import type { DbLoader } from './loaders';
|
6
|
-
import { UploadDataFnParams, UploadMetaFnParams, DownloadDataFnParams, DownloadMetaFnParams, AnyLink } from './types';
|
7
|
-
type RawConnectionParams = {
|
8
|
-
metaUpload: (bytes: Uint8Array, params: UploadMetaFnParams) => Promise<Uint8Array[] | null>;
|
9
|
-
dataUpload: (bytes: Uint8Array, params: UploadDataFnParams) => Promise<void | AnyLink>;
|
10
|
-
metaDownload: (params: DownloadMetaFnParams) => Promise<Uint8Array[] | null>;
|
11
|
-
dataDownload: (params: DownloadDataFnParams) => Promise<Uint8Array | null>;
|
12
|
-
};
|
13
|
-
declare class ConnectRaw extends Connection {
|
14
|
-
constructor({ metaUpload, metaDownload, dataUpload, dataDownload }: RawConnectionParams);
|
15
|
-
}
|
16
|
-
export declare const connect: {
|
17
|
-
s3: ({ _crdt: { blocks: { loader } } }: {
|
18
|
-
_crdt: {
|
19
|
-
blocks: {
|
20
|
-
loader: DbLoader;
|
21
|
-
};
|
22
|
-
};
|
23
|
-
}, { upload, download }: {
|
24
|
-
upload: string;
|
25
|
-
download: string;
|
26
|
-
}) => ConnectS3;
|
27
|
-
raw: ({ _crdt: { blocks: { loader } } }: {
|
28
|
-
_crdt: {
|
29
|
-
blocks: {
|
30
|
-
loader: DbLoader;
|
31
|
-
};
|
32
|
-
};
|
33
|
-
}, params: RawConnectionParams) => ConnectRaw;
|
34
|
-
ipfs: (db: Database, schemaName?: string) => ConnectIPFS;
|
35
|
-
hybrid: (db: Database, schemaName?: string) => ConnectIPFS;
|
36
|
-
};
|
37
|
-
export declare function validateDataParams(params: DownloadDataFnParams | UploadDataFnParams): void;
|
38
|
-
export declare function validateMetaParams(params: DownloadMetaFnParams | UploadMetaFnParams): void;
|
39
|
-
export {};
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { Loader } from './loader';
|
2
|
-
import { UploadMetaFnParams, UploadDataFnParams, AnyLink, DownloadMetaFnParams, DownloadDataFnParams } from './types';
|
3
|
-
export declare abstract class Connection {
|
4
|
-
ready: Promise<any>;
|
5
|
-
loaded: Promise<any>;
|
6
|
-
abstract metaUpload(bytes: Uint8Array, params: UploadMetaFnParams): Promise<Uint8Array[] | null>;
|
7
|
-
abstract dataUpload(bytes: Uint8Array, params: UploadDataFnParams, opts?: {
|
8
|
-
public?: boolean;
|
9
|
-
}): Promise<void | AnyLink>;
|
10
|
-
abstract metaDownload(params: DownloadMetaFnParams): Promise<Uint8Array[] | null>;
|
11
|
-
abstract dataDownload(params: DownloadDataFnParams): Promise<Uint8Array | null>;
|
12
|
-
constructor();
|
13
|
-
loader?: Loader | null;
|
14
|
-
refresh(): Promise<void>;
|
15
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { AnyBlock, AnyLink, DbMeta, DownloadFnParamTypes, LoadHandler } from './types';
|
2
|
-
import { Connection } from './connection';
|
3
|
-
import { DataStore as DataStoreBase, MetaStore as MetaStoreBase } from './store';
|
4
|
-
import type { Loader } from './loader';
|
5
|
-
export declare class RemoteDataStore extends DataStoreBase {
|
6
|
-
tag: string;
|
7
|
-
connection: Connection;
|
8
|
-
type: DownloadFnParamTypes;
|
9
|
-
constructor(loader: Loader, connection: Connection, type?: DownloadFnParamTypes);
|
10
|
-
prefix(): string;
|
11
|
-
load(carCid: AnyLink): Promise<AnyBlock>;
|
12
|
-
save(car: AnyBlock, opts?: {
|
13
|
-
public?: boolean;
|
14
|
-
}): Promise<void | AnyLink>;
|
15
|
-
remove(_cid: AnyLink): Promise<void>;
|
16
|
-
}
|
17
|
-
export declare class RemoteMetaStore extends MetaStoreBase {
|
18
|
-
tag: string;
|
19
|
-
connection: Connection;
|
20
|
-
subscribers: Map<string, LoadHandler[]>;
|
21
|
-
constructor(name: string, connection: Connection);
|
22
|
-
onLoad(branch: string, loadHandler: LoadHandler): () => void;
|
23
|
-
prefix(): string;
|
24
|
-
load(branch?: string): Promise<DbMeta[] | null>;
|
25
|
-
save(meta: DbMeta, branch?: string): Promise<DbMeta[] | null>;
|
26
|
-
dbMetasForByteHeads(byteHeads: Uint8Array[]): DbMeta[];
|
27
|
-
}
|