ducjs 3.5.1 → 4.0.0
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/dist/ducjs_wasm.d.ts +162 -42
- package/dist/ducjs_wasm.js +794 -87
- package/dist/ducjs_wasm_bg.wasm +0 -0
- package/dist/ducjs_wasm_bg.wasm.d.ts +39 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/lazy-files.d.ts +1 -0
- package/dist/lazy-files.js +4 -2
- package/dist/opfs-import.d.ts +12 -0
- package/dist/opfs-import.js +113 -0
- package/dist/opfs.d.ts +36 -0
- package/dist/opfs.js +218 -0
- package/dist/parse.d.ts +1 -1
- package/dist/parse.js +3 -42
- package/dist/restore-parsed.d.ts +7 -0
- package/dist/restore-parsed.js +23 -0
- package/dist/serialize.d.ts +1 -0
- package/dist/serialize.js +17 -20
- package/dist/types/elements/typeChecks.js +7 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/bounds.d.ts +1 -2
- package/dist/utils/math/algebra/ga.d.ts +1 -2
- package/dist/utils/math/index.d.ts +3 -3
- package/dist/utils/math/index.js +1 -1
- package/dist/utils/version.d.ts +1 -1
- package/dist/utils/version.js +3 -1
- package/dist/version-control.d.ts +15 -36
- package/dist/version-control.js +15 -55
- package/dist/wasi.d.ts +29 -0
- package/dist/wasi.js +266 -0
- package/dist/wasm.d.ts +19 -4
- package/dist/wasm.js +20 -4
- package/package.json +8 -2
package/dist/ducjs_wasm.d.ts
CHANGED
|
@@ -5,11 +5,18 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export function parseDuc(buf: Uint8Array): any;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Parse a `.duc` file lazily — returns everything EXCEPT external file data blobs.
|
|
9
|
+
*/
|
|
10
|
+
export function parseDucLazy(buf: Uint8Array): any;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the current version-control schema version defined in Rust.
|
|
9
13
|
*
|
|
10
|
-
*
|
|
14
|
+
* TypeScript should use this as the source of truth instead of hardcoding
|
|
15
|
+
* its own constant. When this value is bumped in Rust, the version control
|
|
16
|
+
* system will automatically handle migration bookkeeping (closing old chains,
|
|
17
|
+
* recording migrations) the next time a checkpoint or delta is created.
|
|
11
18
|
*/
|
|
12
|
-
export function
|
|
19
|
+
export function getCurrentSchemaVersion(): number;
|
|
13
20
|
/**
|
|
14
21
|
* Compute a checkpoint-relative binary diff changeset using bsdiff.
|
|
15
22
|
*
|
|
@@ -21,12 +28,6 @@ export function restoreCheckpoint(duc_buf: Uint8Array, checkpoint_id: string): a
|
|
|
21
28
|
* offsets, which is critical for SQLite databases.
|
|
22
29
|
*/
|
|
23
30
|
export function createDeltaChangeset(base_state: Uint8Array, current_state: Uint8Array): Uint8Array;
|
|
24
|
-
/**
|
|
25
|
-
* Fetch a single external file from a `.duc` buffer by file ID.
|
|
26
|
-
*
|
|
27
|
-
* Returns the file entry as a JS object, or `undefined` if not found.
|
|
28
|
-
*/
|
|
29
|
-
export function getExternalFile(buf: Uint8Array, file_id: string): any;
|
|
30
31
|
/**
|
|
31
32
|
* Apply a changeset to reconstruct document state.
|
|
32
33
|
*
|
|
@@ -38,63 +39,179 @@ export function getExternalFile(buf: Uint8Array, file_id: string): any;
|
|
|
38
39
|
*/
|
|
39
40
|
export function applyDeltaChangeset(base_state: Uint8Array, changeset: Uint8Array): Uint8Array;
|
|
40
41
|
/**
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
export function listExternalFiles(buf: Uint8Array): any;
|
|
44
|
-
/**
|
|
45
|
-
* Read the full VersionGraph from a `.duc` file buffer.
|
|
46
|
-
*
|
|
47
|
-
* Returns a JS object matching the `VersionGraph` TypeScript interface,
|
|
48
|
-
* or `undefined` if no version graph exists.
|
|
42
|
+
* Serialize a JS object (ExportedDataState) into `.duc` bytes (Uint8Array).
|
|
49
43
|
*/
|
|
50
|
-
export function
|
|
44
|
+
export function serializeDuc(data: any): Uint8Array;
|
|
51
45
|
/**
|
|
52
|
-
*
|
|
46
|
+
* Fetch a single external file from a `.duc` buffer by file ID.
|
|
53
47
|
*
|
|
54
|
-
* Returns a
|
|
48
|
+
* Returns the file's binary data as a Uint8Array, or `undefined` if not found.
|
|
55
49
|
*/
|
|
56
|
-
export function
|
|
50
|
+
export function getExternalFile(buf: Uint8Array, file_id: string): any;
|
|
57
51
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* Use `getExternalFile()` or `listExternalFiles()` for on-demand access.
|
|
52
|
+
* List metadata for all external files (without loading the heavy data blobs).
|
|
61
53
|
*/
|
|
62
|
-
export function
|
|
54
|
+
export function listExternalFiles(buf: Uint8Array): any;
|
|
63
55
|
/**
|
|
64
56
|
* Restore the document state at `version_number` from a `.duc` file buffer.
|
|
65
|
-
*
|
|
66
|
-
* The `.duc` file is a SQLite database — this function opens it and queries
|
|
67
|
-
* the `checkpoints` / `deltas` tables directly for version restoration.
|
|
68
|
-
*
|
|
69
|
-
* Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
|
|
70
57
|
*/
|
|
71
58
|
export function restoreVersion(duc_buf: Uint8Array, version_number: number): any;
|
|
72
59
|
/**
|
|
73
|
-
*
|
|
60
|
+
* Restore a specific checkpoint by its ID from a `.duc` file buffer.
|
|
74
61
|
*/
|
|
75
|
-
export function
|
|
62
|
+
export function restoreCheckpoint(duc_buf: Uint8Array, checkpoint_id: string): any;
|
|
76
63
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* TypeScript should use this as the source of truth instead of hardcoding
|
|
80
|
-
* its own constant. When this value is bumped in Rust, the version control
|
|
81
|
-
* system will automatically handle migration bookkeeping (closing old chains,
|
|
82
|
-
* recording migrations) the next time a checkpoint or delta is created.
|
|
64
|
+
* List all versions (checkpoints + deltas) from a `.duc` file buffer.
|
|
83
65
|
*/
|
|
84
|
-
export function
|
|
66
|
+
export function listVersions(duc_buf: Uint8Array): any;
|
|
67
|
+
/**
|
|
68
|
+
* Read the full VersionGraph from a `.duc` file buffer.
|
|
69
|
+
*/
|
|
70
|
+
export function readVersionGraph(duc_buf: Uint8Array): any;
|
|
85
71
|
/**
|
|
86
72
|
* Revert the document to a specific version, removing all newer versions.
|
|
87
|
-
*
|
|
88
|
-
* Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
|
|
89
73
|
*/
|
|
90
74
|
export function revertToVersion(duc_buf: Uint8Array, target_version: number): any;
|
|
75
|
+
export class DucOpfsDocument {
|
|
76
|
+
private constructor();
|
|
77
|
+
free(): void;
|
|
78
|
+
[Symbol.dispose](): void;
|
|
79
|
+
static openInPool(name: string, namespace: string): Promise<DucOpfsDocument>;
|
|
80
|
+
/**
|
|
81
|
+
* Read a chunk from the SQLite database backing this OPFS document.
|
|
82
|
+
*
|
|
83
|
+
* Call [`checkpointWal`] first so the main database file contains all
|
|
84
|
+
* committed data. JavaScript can gzip successive chunks without loading
|
|
85
|
+
* the whole database into WASM memory.
|
|
86
|
+
*/
|
|
87
|
+
exportDbChunk(offset_bytes: number, length: number): Promise<Uint8Array>;
|
|
88
|
+
static listOpfsDatabases(): Promise<any>;
|
|
89
|
+
static deleteOpfsDatabase(name: string): Promise<boolean>;
|
|
90
|
+
static listOpfsDatabasesInPool(namespace: string): Promise<any>;
|
|
91
|
+
static deleteOpfsDatabaseInPool(name: string, namespace: string): Promise<boolean>;
|
|
92
|
+
/**
|
|
93
|
+
* Open or create a persistent OPFS-backed DUC SQLite document.
|
|
94
|
+
*
|
|
95
|
+
* This must run from a Dedicated Worker because the OPFS SAH-pool VFS uses
|
|
96
|
+
* FileSystemSyncAccessHandle.
|
|
97
|
+
*/
|
|
98
|
+
static open(name: string): Promise<DucOpfsDocument>;
|
|
99
|
+
/**
|
|
100
|
+
* Return the filename used to open this document.
|
|
101
|
+
*/
|
|
102
|
+
getFilename(): string;
|
|
103
|
+
/**
|
|
104
|
+
* Execute an arbitrary SQL batch (e.g. `VACUUM INTO 'export.sqlite'`).
|
|
105
|
+
*/
|
|
106
|
+
executeBatch(sql: string): void;
|
|
107
|
+
listVersions(): any;
|
|
108
|
+
/**
|
|
109
|
+
* Flush the WAL journal into the main database file.
|
|
110
|
+
*
|
|
111
|
+
* After calling this, the OPFS file backing this document contains
|
|
112
|
+
* all committed data. JavaScript can then read the file directly
|
|
113
|
+
* from OPFS in chunks and gzip-compress it.
|
|
114
|
+
*/
|
|
115
|
+
checkpointWal(): void;
|
|
116
|
+
/**
|
|
117
|
+
* Return the estimated database file size in bytes
|
|
118
|
+
* (`page_count × page_size`). Call [`checkpoint_wal`] first for
|
|
119
|
+
* an accurate value.
|
|
120
|
+
*/
|
|
121
|
+
getDbSizeBytes(): number;
|
|
122
|
+
readVersionGraph(): any;
|
|
123
|
+
listExternalFiles(): any;
|
|
124
|
+
readDocumentState(): any;
|
|
125
|
+
writeDocumentState(data: any): void;
|
|
126
|
+
readCheckpointDataChunk(checkpoint_id: string, chunk_index: number): any;
|
|
127
|
+
readDeltaChangesetChunk(delta_id: string, chunk_index: number): any;
|
|
128
|
+
writeCheckpointDataChunk(checkpoint_id: string, chunk_index: number, offset_bytes: number, data: Uint8Array): void;
|
|
129
|
+
writeDeltaChangesetChunk(delta_id: string, chunk_index: number, offset_bytes: number, data: Uint8Array): void;
|
|
130
|
+
clearCheckpointDataChunks(checkpoint_id: string): void;
|
|
131
|
+
clearDeltaChangesetChunks(delta_id: string): void;
|
|
132
|
+
readExternalFileRevisionChunk(revision_id: string, chunk_index: number): any;
|
|
133
|
+
/**
|
|
134
|
+
* Read a bounded byte range, including from legacy one-row BLOB revisions.
|
|
135
|
+
*/
|
|
136
|
+
readExternalFileRevisionRange(revision_id: string, offset_bytes: number, length_bytes: number): any;
|
|
137
|
+
/**
|
|
138
|
+
* Read a bounded batch of external-file chunks with one SQL query and one
|
|
139
|
+
* JS/WASM call. Batches are capped at 4 chunks to bound peak memory.
|
|
140
|
+
*/
|
|
141
|
+
readExternalFileRevisionChunks(revision_id: string, start_chunk_index: number, max_chunks: number): Array<any>;
|
|
142
|
+
writeExternalFileRevisionChunk(revision_id: string, chunk_index: number, offset_bytes: number, data: Uint8Array): void;
|
|
143
|
+
clearExternalFileRevisionChunks(revision_id: string): void;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Incrementally replaces one OPFS database without retaining the imported
|
|
147
|
+
* SQLite payload in WASM memory.
|
|
148
|
+
*/
|
|
149
|
+
export class DucOpfsImporter {
|
|
150
|
+
private constructor();
|
|
151
|
+
free(): void;
|
|
152
|
+
[Symbol.dispose](): void;
|
|
153
|
+
static beginInPool(name: string, namespace: string): Promise<DucOpfsImporter>;
|
|
154
|
+
/**
|
|
155
|
+
* Begin replacing `name`. Any prior database with the same closed name is
|
|
156
|
+
* released back to the SAH pool before the new import claims a slot.
|
|
157
|
+
*/
|
|
158
|
+
static begin(name: string): Promise<DucOpfsImporter>;
|
|
159
|
+
/**
|
|
160
|
+
* Write the next decompressed SQLite chunk.
|
|
161
|
+
*/
|
|
162
|
+
writeChunk(data: Uint8Array): void;
|
|
163
|
+
getBytesWritten(): number;
|
|
164
|
+
/**
|
|
165
|
+
* Delete a partial import. Safe to call after a failed stream read.
|
|
166
|
+
*/
|
|
167
|
+
abort(): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Flush the imported database and make it ready for SQLite to open.
|
|
170
|
+
*/
|
|
171
|
+
finish(): number;
|
|
172
|
+
}
|
|
91
173
|
|
|
92
174
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
93
175
|
|
|
94
176
|
export interface InitOutput {
|
|
95
177
|
readonly memory: WebAssembly.Memory;
|
|
178
|
+
readonly __wbg_ducopfsdocument_free: (a: number, b: number) => void;
|
|
179
|
+
readonly __wbg_ducopfsimporter_free: (a: number, b: number) => void;
|
|
96
180
|
readonly applyDeltaChangeset: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
97
181
|
readonly createDeltaChangeset: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
182
|
+
readonly ducopfsdocument_checkpointWal: (a: number) => [number, number];
|
|
183
|
+
readonly ducopfsdocument_clearCheckpointDataChunks: (a: number, b: number, c: number) => [number, number];
|
|
184
|
+
readonly ducopfsdocument_clearDeltaChangesetChunks: (a: number, b: number, c: number) => [number, number];
|
|
185
|
+
readonly ducopfsdocument_clearExternalFileRevisionChunks: (a: number, b: number, c: number) => [number, number];
|
|
186
|
+
readonly ducopfsdocument_deleteOpfsDatabase: (a: number, b: number) => any;
|
|
187
|
+
readonly ducopfsdocument_deleteOpfsDatabaseInPool: (a: number, b: number, c: number, d: number) => any;
|
|
188
|
+
readonly ducopfsdocument_executeBatch: (a: number, b: number, c: number) => [number, number];
|
|
189
|
+
readonly ducopfsdocument_exportDbChunk: (a: number, b: number, c: number) => any;
|
|
190
|
+
readonly ducopfsdocument_getDbSizeBytes: (a: number) => [number, number, number];
|
|
191
|
+
readonly ducopfsdocument_getFilename: (a: number) => [number, number];
|
|
192
|
+
readonly ducopfsdocument_listExternalFiles: (a: number) => [number, number, number];
|
|
193
|
+
readonly ducopfsdocument_listOpfsDatabases: () => any;
|
|
194
|
+
readonly ducopfsdocument_listOpfsDatabasesInPool: (a: number, b: number) => any;
|
|
195
|
+
readonly ducopfsdocument_listVersions: (a: number) => [number, number, number];
|
|
196
|
+
readonly ducopfsdocument_open: (a: number, b: number) => any;
|
|
197
|
+
readonly ducopfsdocument_openInPool: (a: number, b: number, c: number, d: number) => any;
|
|
198
|
+
readonly ducopfsdocument_readCheckpointDataChunk: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
199
|
+
readonly ducopfsdocument_readDeltaChangesetChunk: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
200
|
+
readonly ducopfsdocument_readDocumentState: (a: number) => [number, number, number];
|
|
201
|
+
readonly ducopfsdocument_readExternalFileRevisionChunk: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
202
|
+
readonly ducopfsdocument_readExternalFileRevisionChunks: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
203
|
+
readonly ducopfsdocument_readExternalFileRevisionRange: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
204
|
+
readonly ducopfsdocument_readVersionGraph: (a: number) => [number, number, number];
|
|
205
|
+
readonly ducopfsdocument_writeCheckpointDataChunk: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
206
|
+
readonly ducopfsdocument_writeDeltaChangesetChunk: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
207
|
+
readonly ducopfsdocument_writeDocumentState: (a: number, b: any) => [number, number];
|
|
208
|
+
readonly ducopfsdocument_writeExternalFileRevisionChunk: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
209
|
+
readonly ducopfsimporter_abort: (a: number) => [number, number, number];
|
|
210
|
+
readonly ducopfsimporter_begin: (a: number, b: number) => any;
|
|
211
|
+
readonly ducopfsimporter_beginInPool: (a: number, b: number, c: number, d: number) => any;
|
|
212
|
+
readonly ducopfsimporter_finish: (a: number) => [number, number, number];
|
|
213
|
+
readonly ducopfsimporter_getBytesWritten: (a: number) => number;
|
|
214
|
+
readonly ducopfsimporter_writeChunk: (a: number, b: number, c: number) => [number, number];
|
|
98
215
|
readonly getCurrentSchemaVersion: () => number;
|
|
99
216
|
readonly getExternalFile: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
100
217
|
readonly listExternalFiles: (a: number, b: number) => [number, number, number];
|
|
@@ -121,8 +238,11 @@ export interface InitOutput {
|
|
|
121
238
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
122
239
|
readonly __externref_table_alloc: () => number;
|
|
123
240
|
readonly __wbindgen_export_4: WebAssembly.Table;
|
|
124
|
-
readonly
|
|
241
|
+
readonly __wbindgen_export_5: WebAssembly.Table;
|
|
125
242
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
243
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
244
|
+
readonly closure99_externref_shim: (a: number, b: number, c: any) => void;
|
|
245
|
+
readonly closure80_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
126
246
|
readonly __wbindgen_start: () => void;
|
|
127
247
|
}
|
|
128
248
|
|