@fireproof/core 0.13.1 → 0.13.3-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/crdt-clock.d.ts +1 -1
- 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 -23
- package/dist/types/types.d.ts +6 -26
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -2
- package/dist/types/connect-s3.d.ts +0 -11
- package/dist/types/connect-web3.d.ts +0 -75
- package/dist/types/connect.d.ts +0 -38
- package/dist/types/connection.d.ts +0 -15
- package/dist/types/store-remote.d.ts +0 -27
@@ -6,7 +6,7 @@ export declare class CRDTClock {
|
|
6
6
|
watchers: Set<((updates: DocUpdate[]) => void)>;
|
7
7
|
blocks: TransactionBlockstore | null;
|
8
8
|
setHead(head: ClockHead): void;
|
9
|
-
applyHead(tblocks: Transaction | null, newHead: ClockHead, prevHead: ClockHead, updates?: DocUpdate[]): Promise<void>;
|
9
|
+
applyHead(tblocks: Transaction | null, newHead: ClockHead, prevHead: ClockHead, updates?: DocUpdate[] | null): Promise<void>;
|
10
10
|
onTick(fn: (updates: DocUpdate[]) => void): void;
|
11
11
|
onZoom(fn: () => void): void;
|
12
12
|
}
|
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-web3").ConnectWeb3;
|
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): 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,28 +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
|
-
fileOperations: {
|
20
|
-
cid: AnyLink;
|
21
|
-
public: boolean;
|
22
|
-
}[];
|
23
|
-
};
|
24
|
-
export declare abstract class RemoteWAL {
|
25
|
-
tag: string;
|
26
|
-
STORAGE_VERSION: string;
|
27
|
-
loader: Loader;
|
28
|
-
ready: Promise<void>;
|
29
|
-
walState: WALState;
|
30
|
-
processing: Promise<void> | undefined;
|
31
|
-
constructor(loader: Loader);
|
32
|
-
enqueue(dbMeta: DbMeta, opts: CommitOpts): Promise<void>;
|
33
|
-
enqueueFile(fileCid: AnyLink, publicFile?: boolean): Promise<void>;
|
34
|
-
_process(): Promise<void>;
|
35
|
-
_int_process(): Promise<void>;
|
36
|
-
abstract load(branch?: string): Promise<WALState | null>;
|
37
|
-
abstract save(state: WALState, branch?: string): Promise<void>;
|
38
|
-
}
|
39
17
|
type DataSaveOpts = {
|
40
18
|
public?: boolean;
|
41
19
|
};
|
package/dist/types/types.d.ts
CHANGED
@@ -16,8 +16,12 @@ export type ClockHead = ClockLink[]
|
|
16
16
|
|
17
17
|
export type DocFragment = Uint8Array | string | number | boolean | null | DocFragment[] | { [key: string]: DocFragment }
|
18
18
|
|
19
|
-
export type Doc = DocBody &
|
19
|
+
export type Doc = DocBody & DocBase
|
20
|
+
|
21
|
+
export type DocBase = {
|
20
22
|
_id?: string
|
23
|
+
_files?: DocFiles
|
24
|
+
_publicFiles?: DocFiles
|
21
25
|
}
|
22
26
|
|
23
27
|
export type DocFileMeta = {
|
@@ -73,6 +77,7 @@ export type IndexUpdate = {
|
|
73
77
|
export type IndexRow = {
|
74
78
|
id: string
|
75
79
|
key: IndexKey
|
80
|
+
row?: DocFragment
|
76
81
|
doc?: Doc | null
|
77
82
|
value?: DocFragment
|
78
83
|
del?: boolean
|
@@ -146,32 +151,7 @@ export interface CarMakeable {
|
|
146
151
|
get(cid: AnyLink): Promise<AnyBlock | undefined>
|
147
152
|
}
|
148
153
|
|
149
|
-
export type UploadMetaFnParams = {
|
150
|
-
name: string,
|
151
|
-
branch: string,
|
152
|
-
}
|
153
|
-
|
154
|
-
export type UploadDataFnParams = {
|
155
|
-
type: 'data' | 'file',
|
156
|
-
name: string,
|
157
|
-
car: string,
|
158
|
-
size: string
|
159
|
-
}
|
160
|
-
|
161
|
-
export type DownloadFnParamTypes = 'data' | 'file'
|
162
|
-
|
163
|
-
export type DownloadDataFnParams = {
|
164
|
-
type: DownloadFnParamTypes,
|
165
|
-
name: string,
|
166
|
-
car: string,
|
167
|
-
}
|
168
|
-
|
169
|
-
export type DownloadMetaFnParams = {
|
170
|
-
name: string,
|
171
|
-
branch: string,
|
172
|
-
}
|
173
154
|
|
174
|
-
export type LoadHandler = (dbMetas: DbMeta[]) => Promise<void>
|
175
155
|
|
176
156
|
export type ChangesOptions = {
|
177
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.3-dev";
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fireproof/core",
|
3
|
-
"version": "0.13.
|
3
|
+
"version": "0.13.3-dev",
|
4
4
|
"description": "Live database for the web",
|
5
5
|
"main": "./dist/browser/fireproof.cjs",
|
6
6
|
"module": "./dist/browser/fireproof.esm.js",
|
@@ -28,7 +28,6 @@
|
|
28
28
|
],
|
29
29
|
"type": "module",
|
30
30
|
"scripts": {
|
31
|
-
|
32
31
|
"prepublishOnly": "cp ../../README.md . && npm run build:all",
|
33
32
|
"postpublish": "rm README.md",
|
34
33
|
"clean": "rm -rf dist/*",
|
@@ -125,6 +124,7 @@
|
|
125
124
|
"@ipld/unixfs": "^2.1.1",
|
126
125
|
"@peculiar/webcrypto": "^1.4.3",
|
127
126
|
"@ucanto/core": "^8.2.0",
|
127
|
+
"@ucanto/interface": "^8.1.0",
|
128
128
|
"@web3-storage/clock": "^0.3.0",
|
129
129
|
"@web3-storage/w3up-client": "^8.0.1",
|
130
130
|
"charwise": "^3.0.1",
|
@@ -132,6 +132,7 @@
|
|
132
132
|
"idb": "^7.1.1",
|
133
133
|
"ipfs-unixfs-exporter": "^13.1.7",
|
134
134
|
"multiformats": "^12.0.1",
|
135
|
+
"p-limit": "^4.0.0",
|
135
136
|
"prolly-trees": "^1.0.4",
|
136
137
|
"uuidv7": "^0.6.2"
|
137
138
|
}
|
@@ -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>;
|
10
|
-
metaDownload(params: DownloadMetaFnParams): Promise<Uint8Array[] | null>;
|
11
|
-
}
|
@@ -1,75 +0,0 @@
|
|
1
|
-
import type { Client } from '@web3-storage/w3up-client';
|
2
|
-
import type { Link } from 'multiformats';
|
3
|
-
import type { DownloadDataFnParams, DownloadMetaFnParams, IndexRow, MapFn, UploadDataFnParams, UploadMetaFnParams } from './types';
|
4
|
-
import { Connection } from './connection';
|
5
|
-
import { EventView } from '@alanshaw/pail/clock';
|
6
|
-
import { MemoryBlockstore } from '@alanshaw/pail/block';
|
7
|
-
import { Database } from './database';
|
8
|
-
import { Loader } from './loader';
|
9
|
-
type CarClockHead = Link<EventView<{
|
10
|
-
dbMeta: Uint8Array;
|
11
|
-
}>, number, number, 1>[];
|
12
|
-
type ConnectWeb3Params = {
|
13
|
-
name: string;
|
14
|
-
schema: string;
|
15
|
-
};
|
16
|
-
type ReuseWeb3Params = {
|
17
|
-
did: `did:${string}:${string}`;
|
18
|
-
connection: ConnectWeb3;
|
19
|
-
};
|
20
|
-
export declare class ConnectWeb3 extends Connection {
|
21
|
-
params: ConnectWeb3Params;
|
22
|
-
ready: Promise<void>;
|
23
|
-
connected: Promise<void>;
|
24
|
-
client: Client | null;
|
25
|
-
clockSpaceDID: `did:${string}:${string}` | null;
|
26
|
-
clockProofs: any[];
|
27
|
-
parents: CarClockHead;
|
28
|
-
eventBlocks: MemoryBlockstore;
|
29
|
-
accountDb: Database | null;
|
30
|
-
accountConnection: ConnectWeb3 | null;
|
31
|
-
inner: boolean;
|
32
|
-
loader: Loader | null;
|
33
|
-
accessIndexFn: MapFn;
|
34
|
-
pendingWithIdxFn: MapFn;
|
35
|
-
ownerIdxFn: MapFn;
|
36
|
-
authorized: boolean | null;
|
37
|
-
authDone?: (value: void | PromiseLike<void>) => void;
|
38
|
-
authReady: Promise<void>;
|
39
|
-
constructor(params: ConnectWeb3Params, _database?: Database, _reuseParams?: ReuseWeb3Params);
|
40
|
-
authorize(email: `${string}@${string}`): Promise<void>;
|
41
|
-
shareToken(): Promise<`did:key:${string}`>;
|
42
|
-
shareWith(shareToken: `did:key:${string}`): Promise<import("@web3-storage/w3up-client/dist/src/types").AnyLink>;
|
43
|
-
joinShared(cid: string, name?: string, schemaName?: string): Promise<{
|
44
|
-
database: Database;
|
45
|
-
connection: ConnectWeb3;
|
46
|
-
}>;
|
47
|
-
initializeClient(): Promise<void>;
|
48
|
-
_onAuthorized(): Promise<void>;
|
49
|
-
connectedClientForDb(): Promise<Client>;
|
50
|
-
clockProofsForDb(): Promise<any[]>;
|
51
|
-
clockSpaceDIDForDb(): `did:${string}:${string}`;
|
52
|
-
startBackgroundSync(): Promise<void>;
|
53
|
-
serviceAccessRequests(): Promise<void>;
|
54
|
-
waitForAccess(clockSpaceDID: `did:${string}:${string}`, agentDID: `did:key:${string}`): Promise<void>;
|
55
|
-
provisionClockSpace(): Promise<void>;
|
56
|
-
handleExistingSpace(rows: IndexRow[], client: Client, thisAgentDID: `did:key:${string}`): Promise<void>;
|
57
|
-
joinExistingSpace(client: Client, clockSpaceDID: `did:${string}:${string}`, thisAgentDID: `did:key:${string}`): Promise<void>;
|
58
|
-
handleRequestAccess(clockSpaceDID: `did:${string}:${string}`, thisAgentDID: `did:key:${string}`): Promise<void>;
|
59
|
-
handleCreateNewSpace(client: Client): Promise<void>;
|
60
|
-
encodeSpaceName(): `_clock/${string}/${string}`;
|
61
|
-
decodeSpaceName(spaceName: `_clock/${string}/${string}`): {
|
62
|
-
schema: string;
|
63
|
-
name: string;
|
64
|
-
};
|
65
|
-
dataDownload(params: DownloadDataFnParams): Promise<Uint8Array>;
|
66
|
-
dataUpload(bytes: Uint8Array, params: UploadDataFnParams, opts: {
|
67
|
-
public?: boolean;
|
68
|
-
}): Promise<import("@web3-storage/w3up-client/dist/src/types").AnyLink>;
|
69
|
-
metaDownload(params: DownloadMetaFnParams): Promise<Uint8Array[]>;
|
70
|
-
metaUpload(bytes: Uint8Array, params: UploadMetaFnParams): Promise<Uint8Array[]>;
|
71
|
-
fetchAndUpdateHead(remoteHead: CarClockHead): Promise<Uint8Array[]>;
|
72
|
-
connectClient(): Promise<Client>;
|
73
|
-
bestSpace(client: Client): import("@web3-storage/w3up-client/dist/src/space").Space | undefined;
|
74
|
-
}
|
75
|
-
export {};
|
package/dist/types/connect.d.ts
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
import { ConnectS3 } from './connect-s3';
|
2
|
-
import { ConnectWeb3 } from './connect-web3';
|
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
|
-
web3: (db: Database, schemaName?: string) => ConnectWeb3;
|
35
|
-
};
|
36
|
-
export declare function validateDataParams(params: DownloadDataFnParams | UploadDataFnParams): void;
|
37
|
-
export declare function validateMetaParams(params: DownloadMetaFnParams | UploadMetaFnParams): void;
|
38
|
-
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
|
-
}
|