@fireproof/core 0.18.0 → 0.19.5-dev
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +29 -15
- package/chunk-7OGPZSGT.js +39 -0
- package/chunk-7OGPZSGT.js.map +1 -0
- package/chunk-H3A2HMMM.js +164 -0
- package/chunk-H3A2HMMM.js.map +1 -0
- package/chunk-HCXR2M5B.js +202 -0
- package/chunk-HCXR2M5B.js.map +1 -0
- package/chunk-QHSXUST7.js +208 -0
- package/chunk-QHSXUST7.js.map +1 -0
- package/chunk-VZGT7ZYP.js +22 -0
- package/chunk-VZGT7ZYP.js.map +1 -0
- package/index.cjs +4649 -0
- package/index.cjs.map +1 -0
- package/index.d.cts +911 -0
- package/index.d.ts +911 -0
- package/index.js +2923 -0
- package/index.js.map +1 -0
- package/metafile-cjs.json +1 -0
- package/metafile-esm.json +1 -0
- package/node-sys-container-E7LADX2Z.js +29 -0
- package/node-sys-container-E7LADX2Z.js.map +1 -0
- package/package.json +23 -109
- package/sqlite-data-store-YS4U7AQ4.js +120 -0
- package/sqlite-data-store-YS4U7AQ4.js.map +1 -0
- package/sqlite-meta-store-FJZSZG4R.js +137 -0
- package/sqlite-meta-store-FJZSZG4R.js.map +1 -0
- package/sqlite-wal-store-6JZ4URNS.js +123 -0
- package/sqlite-wal-store-6JZ4URNS.js.map +1 -0
- package/store-file-HMHPQTUV.js +193 -0
- package/store-file-HMHPQTUV.js.map +1 -0
- package/store-indexdb-MRVZG4OG.js +20 -0
- package/store-indexdb-MRVZG4OG.js.map +1 -0
- package/store-sql-5XMJ5OWJ.js +406 -0
- package/store-sql-5XMJ5OWJ.js.map +1 -0
- package/dist/browser/fireproof.cjs +0 -1172
- package/dist/browser/fireproof.cjs.map +0 -1
- package/dist/browser/fireproof.d.cts +0 -268
- package/dist/browser/fireproof.d.ts +0 -268
- package/dist/browser/fireproof.global.js +0 -24178
- package/dist/browser/fireproof.global.js.map +0 -1
- package/dist/browser/fireproof.js +0 -1147
- package/dist/browser/fireproof.js.map +0 -1
- package/dist/browser/metafile-cjs.json +0 -1
- package/dist/browser/metafile-esm.json +0 -1
- package/dist/browser/metafile-iife.json +0 -1
- package/dist/memory/fireproof.cjs +0 -1172
- package/dist/memory/fireproof.cjs.map +0 -1
- package/dist/memory/fireproof.d.cts +0 -268
- package/dist/memory/fireproof.d.ts +0 -268
- package/dist/memory/fireproof.global.js +0 -24178
- package/dist/memory/fireproof.global.js.map +0 -1
- package/dist/memory/fireproof.js +0 -1147
- package/dist/memory/fireproof.js.map +0 -1
- package/dist/memory/metafile-cjs.json +0 -1
- package/dist/memory/metafile-esm.json +0 -1
- package/dist/memory/metafile-iife.json +0 -1
- package/dist/node/fireproof.cjs +0 -1172
- package/dist/node/fireproof.cjs.map +0 -1
- package/dist/node/fireproof.d.cts +0 -268
- package/dist/node/fireproof.d.ts +0 -268
- package/dist/node/fireproof.global.js +0 -38540
- package/dist/node/fireproof.global.js.map +0 -1
- package/dist/node/fireproof.js +0 -1138
- package/dist/node/fireproof.js.map +0 -1
- package/dist/node/metafile-cjs.json +0 -1
- package/dist/node/metafile-esm.json +0 -1
- package/dist/node/metafile-iife.json +0 -1
package/dist/node/fireproof.d.ts
DELETED
@@ -1,268 +0,0 @@
|
|
1
|
-
import { Link, Block } from 'multiformats';
|
2
|
-
import { EventLink } from '@web3-storage/pail/clock/api';
|
3
|
-
import { Operation } from '@web3-storage/pail/crdt/api';
|
4
|
-
import { DbMeta, CryptoOpts, StoreOpts, EncryptedBlockstore, TransactionMeta } from '@fireproof/encrypted-blockstore';
|
5
|
-
import { ProllyNode as ProllyNode$1 } from 'prolly-trees/db-index';
|
6
|
-
|
7
|
-
type ConfigOpts = {
|
8
|
-
public?: boolean;
|
9
|
-
meta?: DbMeta;
|
10
|
-
persistIndexes?: boolean;
|
11
|
-
autoCompact?: number;
|
12
|
-
crypto?: CryptoOpts;
|
13
|
-
store?: StoreOpts;
|
14
|
-
};
|
15
|
-
type ClockLink = EventLink<Operation>;
|
16
|
-
type ClockHead = ClockLink[];
|
17
|
-
type DocFragment = Uint8Array | string | number | boolean | null | AnyLink | DocFragment[] | {
|
18
|
-
[key: string]: DocFragment;
|
19
|
-
};
|
20
|
-
type DocRecord<T> = {
|
21
|
-
[K in keyof T]: DocFragment;
|
22
|
-
};
|
23
|
-
type DocFiles = Record<string, DocFileMeta | File>;
|
24
|
-
type DocBase = {
|
25
|
-
_id?: string;
|
26
|
-
_files?: DocFiles;
|
27
|
-
_publicFiles?: DocFiles;
|
28
|
-
};
|
29
|
-
type Doc<T extends DocRecord<T> = {}> = DocBase & T;
|
30
|
-
type DocFileMeta = {
|
31
|
-
type: string;
|
32
|
-
size: number;
|
33
|
-
cid: AnyLink;
|
34
|
-
car?: AnyLink;
|
35
|
-
url?: string;
|
36
|
-
file?: () => Promise<File>;
|
37
|
-
};
|
38
|
-
type DocUpdate = {
|
39
|
-
key: string;
|
40
|
-
value?: Record<string, any>;
|
41
|
-
del?: boolean;
|
42
|
-
clock?: AnyLink;
|
43
|
-
};
|
44
|
-
type DocValue = {
|
45
|
-
doc?: DocBase;
|
46
|
-
del?: boolean;
|
47
|
-
cid?: AnyLink;
|
48
|
-
};
|
49
|
-
type IndexKey = [string, string] | string;
|
50
|
-
type IndexUpdate = {
|
51
|
-
key: IndexKey;
|
52
|
-
value?: DocFragment;
|
53
|
-
del?: boolean;
|
54
|
-
};
|
55
|
-
type IndexRow<T extends DocRecord<T> = {}> = {
|
56
|
-
id: string;
|
57
|
-
key: IndexKey;
|
58
|
-
row?: DocFragment;
|
59
|
-
doc?: Doc<T> | null;
|
60
|
-
value?: DocFragment;
|
61
|
-
del?: boolean;
|
62
|
-
};
|
63
|
-
type CRDTMeta = {
|
64
|
-
head: ClockHead;
|
65
|
-
};
|
66
|
-
type IdxMeta = {
|
67
|
-
byId: AnyLink;
|
68
|
-
byKey: AnyLink;
|
69
|
-
map: string;
|
70
|
-
name: string;
|
71
|
-
head: ClockHead;
|
72
|
-
};
|
73
|
-
type IdxMetaMap = {
|
74
|
-
indexes: Map<string, IdxMeta>;
|
75
|
-
};
|
76
|
-
type QueryOpts = {
|
77
|
-
descending?: boolean;
|
78
|
-
limit?: number;
|
79
|
-
includeDocs?: boolean;
|
80
|
-
range?: [IndexKey, IndexKey];
|
81
|
-
key?: DocFragment;
|
82
|
-
keys?: DocFragment[];
|
83
|
-
prefix?: DocFragment | [DocFragment];
|
84
|
-
};
|
85
|
-
type AnyLink = Link<unknown, number, number, 1 | 0>;
|
86
|
-
type AnyBlock = {
|
87
|
-
cid: AnyLink;
|
88
|
-
bytes: Uint8Array;
|
89
|
-
};
|
90
|
-
type AnyDecodedBlock = {
|
91
|
-
cid: AnyLink;
|
92
|
-
bytes: Uint8Array;
|
93
|
-
value: any;
|
94
|
-
};
|
95
|
-
type EmitFn = (k: DocFragment, v?: DocFragment) => void;
|
96
|
-
type MapFn = <T extends DocRecord<T> = {}>(doc: Doc<T>, emit: EmitFn) => DocFragment | void;
|
97
|
-
type ChangesOptions = {
|
98
|
-
dirty?: boolean;
|
99
|
-
limit?: number;
|
100
|
-
};
|
101
|
-
type ChangesResponse<T extends DocRecord<T> = {}> = {
|
102
|
-
clock: ClockHead;
|
103
|
-
rows: {
|
104
|
-
key: string;
|
105
|
-
value: Doc<T>;
|
106
|
-
}[];
|
107
|
-
};
|
108
|
-
type DbResponse = {
|
109
|
-
id: string;
|
110
|
-
clock: ClockHead;
|
111
|
-
};
|
112
|
-
|
113
|
-
type WriteQueue = {
|
114
|
-
push(task: DocUpdate): Promise<CRDTMeta>;
|
115
|
-
};
|
116
|
-
|
117
|
-
declare class IndexTree {
|
118
|
-
cid: AnyLink | null;
|
119
|
-
root: ProllyNode | null;
|
120
|
-
}
|
121
|
-
interface ProllyNode extends ProllyNode$1 {
|
122
|
-
getAllEntries<T extends DocRecord<T> = {}>(): PromiseLike<{
|
123
|
-
[x: string]: any;
|
124
|
-
result: IndexRow<T>[];
|
125
|
-
}>;
|
126
|
-
getMany(removeIds: string[]): Promise<{
|
127
|
-
[x: string]: any;
|
128
|
-
result: IndexKey[];
|
129
|
-
}>;
|
130
|
-
range<T extends DocRecord<T> = {}>(a: IndexKey, b: IndexKey): Promise<{
|
131
|
-
result: IndexRow<T>[];
|
132
|
-
}>;
|
133
|
-
get<T extends DocRecord<T> = {}>(key: string): Promise<{
|
134
|
-
result: IndexRow<T>[];
|
135
|
-
}>;
|
136
|
-
bulk(bulk: IndexUpdate[]): PromiseLike<{
|
137
|
-
root: ProllyNode | null;
|
138
|
-
blocks: Block[];
|
139
|
-
}>;
|
140
|
-
address: Promise<Link>;
|
141
|
-
distance: number;
|
142
|
-
compare: (a: any, b: any) => number;
|
143
|
-
cache: any;
|
144
|
-
block: Promise<Block>;
|
145
|
-
}
|
146
|
-
|
147
|
-
declare class Index {
|
148
|
-
blockstore: EncryptedBlockstore;
|
149
|
-
crdt: CRDT;
|
150
|
-
name: string | null;
|
151
|
-
mapFn: MapFn | null;
|
152
|
-
mapFnString: string;
|
153
|
-
byKey: IndexTree;
|
154
|
-
byId: IndexTree;
|
155
|
-
indexHead: ClockHead | undefined;
|
156
|
-
includeDocsDefault: boolean;
|
157
|
-
initError: Error | null;
|
158
|
-
ready: Promise<void>;
|
159
|
-
constructor(crdt: CRDT, name: string, mapFn?: MapFn, meta?: IdxMeta);
|
160
|
-
applyMapFn<T extends DocRecord<T> = {}>(name: string, mapFn?: MapFn, meta?: IdxMeta): void;
|
161
|
-
query<T extends DocRecord<T> = {}>(opts?: QueryOpts): Promise<{
|
162
|
-
rows: IndexRow<T>[];
|
163
|
-
}>;
|
164
|
-
_resetIndex(): void;
|
165
|
-
_hydrateIndex(): Promise<void>;
|
166
|
-
_updateIndex(): Promise<TransactionMeta>;
|
167
|
-
}
|
168
|
-
|
169
|
-
type ApplyHeadTask = {
|
170
|
-
newHead: ClockHead;
|
171
|
-
prevHead: ClockHead;
|
172
|
-
updates: DocUpdate[] | null;
|
173
|
-
};
|
174
|
-
type ApplyHeadQueue = {
|
175
|
-
push(task: ApplyHeadTask): AsyncGenerator<{
|
176
|
-
updates: DocUpdate[];
|
177
|
-
all: boolean;
|
178
|
-
}, void, unknown>;
|
179
|
-
size(): number;
|
180
|
-
};
|
181
|
-
|
182
|
-
declare class CRDTClock {
|
183
|
-
head: ClockHead;
|
184
|
-
zoomers: Set<() => void>;
|
185
|
-
watchers: Set<(updates: DocUpdate[]) => void>;
|
186
|
-
emptyWatchers: Set<() => void>;
|
187
|
-
blockstore: EncryptedBlockstore | null;
|
188
|
-
applyHeadQueue: ApplyHeadQueue;
|
189
|
-
constructor();
|
190
|
-
setHead(head: ClockHead): void;
|
191
|
-
applyHead(newHead: ClockHead, prevHead: ClockHead, updates?: DocUpdate[] | null): Promise<void>;
|
192
|
-
processUpdates(updatesAcc: DocUpdate[], all: boolean, prevHead: ClockHead): Promise<void>;
|
193
|
-
notifyWatchers(updates: DocUpdate[]): void;
|
194
|
-
onTick(fn: (updates: DocUpdate[]) => void): void;
|
195
|
-
onTock(fn: () => void): void;
|
196
|
-
onZoom(fn: () => void): void;
|
197
|
-
int_applyHead(newHead: ClockHead, prevHead: ClockHead, localUpdates: boolean): Promise<void>;
|
198
|
-
}
|
199
|
-
|
200
|
-
declare class CRDT {
|
201
|
-
name: string | null;
|
202
|
-
opts: ConfigOpts;
|
203
|
-
ready: Promise<void>;
|
204
|
-
blockstore: EncryptedBlockstore;
|
205
|
-
indexBlockstore: EncryptedBlockstore;
|
206
|
-
indexers: Map<string, Index>;
|
207
|
-
clock: CRDTClock;
|
208
|
-
constructor(name?: string, opts?: ConfigOpts);
|
209
|
-
bulk(updates: DocUpdate[]): Promise<CRDTMeta>;
|
210
|
-
allDocs(): Promise<{
|
211
|
-
result: DocUpdate[];
|
212
|
-
head: ClockHead;
|
213
|
-
}>;
|
214
|
-
vis(): Promise<string>;
|
215
|
-
getBlock(cidString: string): Promise<Block>;
|
216
|
-
get(key: string): Promise<DocValue | null>;
|
217
|
-
changes(since?: ClockHead, opts?: ChangesOptions): Promise<{
|
218
|
-
result: DocUpdate[];
|
219
|
-
head: ClockHead;
|
220
|
-
}>;
|
221
|
-
compact(): Promise<void>;
|
222
|
-
}
|
223
|
-
|
224
|
-
type DbName = string | null;
|
225
|
-
declare class Database {
|
226
|
-
static databases: Map<string, Database>;
|
227
|
-
name: DbName;
|
228
|
-
opts: ConfigOpts;
|
229
|
-
_listening: boolean;
|
230
|
-
_listeners: Set<ListenerFn>;
|
231
|
-
_noupdate_listeners: Set<ListenerFn>;
|
232
|
-
_crdt: CRDT;
|
233
|
-
_writeQueue: WriteQueue;
|
234
|
-
blockstore: EncryptedBlockstore;
|
235
|
-
constructor(name?: string, opts?: ConfigOpts);
|
236
|
-
get<T extends DocRecord<T> = {}>(id: string): Promise<Doc<T>>;
|
237
|
-
put<T extends DocRecord<T> = {}>(doc: Doc<T>): Promise<DbResponse>;
|
238
|
-
del(id: string): Promise<DbResponse>;
|
239
|
-
changes<T extends DocRecord<T> = {}>(since?: ClockHead, opts?: ChangesOptions): Promise<ChangesResponse<T>>;
|
240
|
-
allDocs<T extends DocRecord<T> = {}>(): Promise<{
|
241
|
-
rows: {
|
242
|
-
key: string;
|
243
|
-
value: Doc<T>;
|
244
|
-
}[];
|
245
|
-
clock: ClockHead;
|
246
|
-
}>;
|
247
|
-
allDocuments<T extends DocRecord<T> = {}>(): Promise<{
|
248
|
-
rows: {
|
249
|
-
key: string;
|
250
|
-
value: Doc<T>;
|
251
|
-
}[];
|
252
|
-
clock: ClockHead;
|
253
|
-
}>;
|
254
|
-
subscribe(listener: ListenerFn | NoUpdateListenerFn, updates?: boolean): () => void;
|
255
|
-
query<T extends DocRecord<T> = {}>(field: string | MapFn, opts?: QueryOpts): Promise<{
|
256
|
-
rows: IndexRow<T>[];
|
257
|
-
}>;
|
258
|
-
compact(): Promise<void>;
|
259
|
-
_notify(updates: DocUpdate[]): Promise<void>;
|
260
|
-
_no_update_notify(): Promise<void>;
|
261
|
-
}
|
262
|
-
type UpdateListenerFn = <T extends DocRecord<T>>(docs: Doc<T>[]) => Promise<void> | void;
|
263
|
-
type NoUpdateListenerFn = () => Promise<void> | void;
|
264
|
-
type ListenerFn = UpdateListenerFn | NoUpdateListenerFn;
|
265
|
-
declare function fireproof(name: string, opts?: ConfigOpts): Database;
|
266
|
-
|
267
|
-
export { type AnyBlock, type AnyDecodedBlock, type AnyLink, type CRDTMeta, type ChangesOptions, type ChangesResponse, type ClockHead, type ClockLink, type ConfigOpts, Database, type DbResponse, type Doc, type DocBase, type DocFileMeta, type DocFiles, type DocFragment, type DocRecord, type DocUpdate, type DocValue, type IdxMeta, type IdxMetaMap, type IndexKey, type IndexRow, type IndexUpdate, type MapFn, type QueryOpts, fireproof };
|
268
|
-
declare module '@fireproof/core'
|