@automerge/sedimentree 0.8.2 → 0.9.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/cjs/wasm-base64.cjs +1 -1
- package/dist/cjs/web-bindings.cjs +345 -80
- package/dist/cjs/web.cjs +346 -81
- package/dist/esm/wasm-base64.js +1 -1
- package/dist/iife/index.js +345 -81
- package/dist/index.d.ts +107 -33
- package/dist/sedimentree.wasm +0 -0
- package/dist/wasm_bindgen/bundler/sedimentree_wasm.d.ts +107 -33
- package/dist/wasm_bindgen/bundler/sedimentree_wasm.js +1 -1
- package/dist/wasm_bindgen/bundler/sedimentree_wasm_bg.js +360 -81
- package/dist/wasm_bindgen/bundler/sedimentree_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/bundler/sedimentree_wasm_bg.wasm.d.ts +26 -16
- package/dist/wasm_bindgen/nodejs/sedimentree_wasm.cjs +361 -81
- package/dist/wasm_bindgen/nodejs/sedimentree_wasm.d.ts +107 -33
- package/dist/wasm_bindgen/nodejs/sedimentree_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/nodejs/sedimentree_wasm_bg.wasm.d.ts +26 -16
- package/dist/wasm_bindgen/web/sedimentree_wasm.d.ts +133 -49
- package/dist/wasm_bindgen/web/sedimentree_wasm.js +360 -81
- package/dist/wasm_bindgen/web/sedimentree_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/web/sedimentree_wasm_bg.wasm.d.ts +26 -16
- package/package.json +1 -1
- /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-75027ecce41278de → sedimentree_wasm-8e1863d4f7634be2}/inline0.js +0 -0
- /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-75027ecce41278de → sedimentree_wasm-8e1863d4f7634be2}/inline1.js +0 -0
- /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-75027ecce41278de → sedimentree_wasm-8e1863d4f7634be2}/inline2.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-75027ecce41278de → sedimentree_wasm-8e1863d4f7634be2}/inline0.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-75027ecce41278de → sedimentree_wasm-8e1863d4f7634be2}/inline1.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-75027ecce41278de → sedimentree_wasm-8e1863d4f7634be2}/inline2.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-75027ecce41278de → sedimentree_wasm-8e1863d4f7634be2}/inline0.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-75027ecce41278de → sedimentree_wasm-8e1863d4f7634be2}/inline1.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-75027ecce41278de → sedimentree_wasm-8e1863d4f7634be2}/inline2.js +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -7,23 +7,23 @@ export interface SedimentreeStorage {
|
|
|
7
7
|
loadAllSedimentreeIds(): Promise<SedimentreeId[]>;
|
|
8
8
|
|
|
9
9
|
// Compound storage for commits (signed data + blob stored together)
|
|
10
|
-
saveCommit(sedimentreeId: SedimentreeId,
|
|
11
|
-
loadCommit(sedimentreeId: SedimentreeId,
|
|
12
|
-
|
|
10
|
+
saveCommit(sedimentreeId: SedimentreeId, commitId: CommitId, signedCommit: SignedLooseCommit, blob: Uint8Array): Promise<void>;
|
|
11
|
+
loadCommit(sedimentreeId: SedimentreeId, commitId: CommitId): Promise<CommitWithBlob | null>;
|
|
12
|
+
listCommitIds(sedimentreeId: SedimentreeId): Promise<CommitId[]>;
|
|
13
13
|
loadAllCommits(sedimentreeId: SedimentreeId): Promise<CommitWithBlob[]>;
|
|
14
|
-
deleteCommit(sedimentreeId: SedimentreeId,
|
|
14
|
+
deleteCommit(sedimentreeId: SedimentreeId, commitId: CommitId): Promise<void>;
|
|
15
15
|
deleteAllCommits(sedimentreeId: SedimentreeId): Promise<void>;
|
|
16
16
|
|
|
17
17
|
// Compound storage for fragments (signed data + blob stored together)
|
|
18
|
-
saveFragment(sedimentreeId: SedimentreeId,
|
|
19
|
-
loadFragment(sedimentreeId: SedimentreeId,
|
|
20
|
-
|
|
18
|
+
saveFragment(sedimentreeId: SedimentreeId, fragmentHead: CommitId, signedFragment: SignedFragment, blob: Uint8Array): Promise<void>;
|
|
19
|
+
loadFragment(sedimentreeId: SedimentreeId, fragmentHead: CommitId): Promise<FragmentWithBlob | null>;
|
|
20
|
+
listFragmentIds(sedimentreeId: SedimentreeId): Promise<CommitId[]>;
|
|
21
21
|
loadAllFragments(sedimentreeId: SedimentreeId): Promise<FragmentWithBlob[]>;
|
|
22
|
-
deleteFragment(sedimentreeId: SedimentreeId,
|
|
22
|
+
deleteFragment(sedimentreeId: SedimentreeId, fragmentHead: CommitId): Promise<void>;
|
|
23
23
|
deleteAllFragments(sedimentreeId: SedimentreeId): Promise<void>;
|
|
24
24
|
|
|
25
25
|
// Batch save: write all commits + fragments in a single storage transaction.
|
|
26
|
-
saveBatchAll(sedimentreeId: SedimentreeId, commits: Array<{
|
|
26
|
+
saveBatchAll(sedimentreeId: SedimentreeId, commits: Array<{commitId: CommitId, signedCommit: SignedLooseCommit, blob: Uint8Array}>, fragments: Array<{fragmentHead: CommitId, signedFragment: SignedFragment, blob: Uint8Array}>): Promise<number>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
|
|
@@ -55,6 +55,63 @@ export class BlobMeta {
|
|
|
55
55
|
readonly sizeBytes: bigint;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* A user-supplied opaque identifier for a loose commit.
|
|
60
|
+
*
|
|
61
|
+
* Unlike [`Digest`](crate::digest::WasmDigest), which is a content hash
|
|
62
|
+
* computed by the system, `CommitId` is provided by the caller at construction
|
|
63
|
+
* time. This is the identity used for DAG traversal, fragment boundaries,
|
|
64
|
+
* and sync.
|
|
65
|
+
*/
|
|
66
|
+
export class CommitId {
|
|
67
|
+
free(): void;
|
|
68
|
+
[Symbol.dispose](): void;
|
|
69
|
+
/**
|
|
70
|
+
* Upcasts; to the JS-import type for [`WasmCommitId`].
|
|
71
|
+
*/
|
|
72
|
+
__wasm_refgen_toWasmCommitId(): CommitId;
|
|
73
|
+
/**
|
|
74
|
+
* Creates a new commit identifier from its Base58 string representation.
|
|
75
|
+
*
|
|
76
|
+
* # Errors
|
|
77
|
+
*
|
|
78
|
+
* Returns an error if the string cannot be decoded or is not 32 bytes.
|
|
79
|
+
*/
|
|
80
|
+
static fromBase58(s: string): CommitId;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a new commit identifier from its byte representation.
|
|
83
|
+
*
|
|
84
|
+
* # Errors
|
|
85
|
+
*
|
|
86
|
+
* Returns an error if the byte slice is not exactly 32 bytes.
|
|
87
|
+
*/
|
|
88
|
+
static fromBytes(bytes: Uint8Array): CommitId;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a new commit identifier from its hexadecimal string representation.
|
|
91
|
+
*
|
|
92
|
+
* # Errors
|
|
93
|
+
*
|
|
94
|
+
* Returns an error if the string is not valid hex or not 32 bytes.
|
|
95
|
+
*/
|
|
96
|
+
static fromHexString(s: string): CommitId;
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new commit identifier from its byte representation.
|
|
99
|
+
*
|
|
100
|
+
* # Errors
|
|
101
|
+
*
|
|
102
|
+
* Returns an error if the byte slice is not exactly 32 bytes.
|
|
103
|
+
*/
|
|
104
|
+
constructor(bytes: Uint8Array);
|
|
105
|
+
/**
|
|
106
|
+
* Returns the byte representation of the commit identifier.
|
|
107
|
+
*/
|
|
108
|
+
toBytes(): Uint8Array;
|
|
109
|
+
/**
|
|
110
|
+
* Returns the hexadecimal string representation.
|
|
111
|
+
*/
|
|
112
|
+
toHexString(): string;
|
|
113
|
+
}
|
|
114
|
+
|
|
58
115
|
/**
|
|
59
116
|
* A commit stored with its associated blob.
|
|
60
117
|
*/
|
|
@@ -175,19 +232,19 @@ export class Fragment {
|
|
|
175
232
|
/**
|
|
176
233
|
* Create a new fragment from the given sedimentree ID, head, boundary, checkpoints, and blob metadata.
|
|
177
234
|
*/
|
|
178
|
-
constructor(sedimentree_id: SedimentreeId, head:
|
|
235
|
+
constructor(sedimentree_id: SedimentreeId, head: CommitId, boundary: CommitId[], checkpoints: CommitId[], blob_meta: BlobMeta);
|
|
179
236
|
/**
|
|
180
237
|
* Get the blob metadata of the fragment.
|
|
181
238
|
*/
|
|
182
239
|
readonly blobMeta: BlobMeta;
|
|
183
240
|
/**
|
|
184
|
-
* Get the boundary
|
|
241
|
+
* Get the boundary commit identifiers of the fragment.
|
|
185
242
|
*/
|
|
186
|
-
readonly boundary:
|
|
243
|
+
readonly boundary: CommitId[];
|
|
187
244
|
/**
|
|
188
|
-
* Get the head
|
|
245
|
+
* Get the head commit identifier of the fragment.
|
|
189
246
|
*/
|
|
190
|
-
readonly head:
|
|
247
|
+
readonly head: CommitId;
|
|
191
248
|
}
|
|
192
249
|
|
|
193
250
|
/**
|
|
@@ -235,21 +292,25 @@ export class LooseCommit {
|
|
|
235
292
|
*/
|
|
236
293
|
__wasm_refgen_toWasmLooseCommit(): LooseCommit;
|
|
237
294
|
/**
|
|
238
|
-
* Create a new `LooseCommit` from the given sedimentree ID, parents, and blob metadata.
|
|
295
|
+
* Create a new `LooseCommit` from the given sedimentree ID, head, parents, and blob metadata.
|
|
239
296
|
*/
|
|
240
|
-
constructor(sedimentree_id: SedimentreeId, parents:
|
|
297
|
+
constructor(sedimentree_id: SedimentreeId, head: CommitId, parents: CommitId[], blob_meta: BlobMeta);
|
|
241
298
|
/**
|
|
242
299
|
* Get the blob metadata of the commit.
|
|
243
300
|
*/
|
|
244
301
|
readonly blobMeta: BlobMeta;
|
|
245
302
|
/**
|
|
246
|
-
* Get the
|
|
303
|
+
* Get the commit's head identifier.
|
|
304
|
+
*/
|
|
305
|
+
readonly commitId: CommitId;
|
|
306
|
+
/**
|
|
307
|
+
* Get the digest of the commit (content hash).
|
|
247
308
|
*/
|
|
248
309
|
readonly digest: Digest;
|
|
249
310
|
/**
|
|
250
|
-
* Get the parent
|
|
311
|
+
* Get the parent commit identifiers.
|
|
251
312
|
*/
|
|
252
|
-
readonly parents:
|
|
313
|
+
readonly parents: CommitId[];
|
|
253
314
|
}
|
|
254
315
|
|
|
255
316
|
/**
|
|
@@ -269,25 +330,25 @@ export class MemoryStorage {
|
|
|
269
330
|
*/
|
|
270
331
|
deleteAllFragments(sedimentree_id: SedimentreeId): Promise<any>;
|
|
271
332
|
/**
|
|
272
|
-
* Delete a commit by
|
|
333
|
+
* Delete a single commit by its ID.
|
|
273
334
|
*/
|
|
274
|
-
deleteCommit(sedimentree_id: SedimentreeId,
|
|
335
|
+
deleteCommit(sedimentree_id: SedimentreeId, commit_id: CommitId): Promise<any>;
|
|
275
336
|
/**
|
|
276
|
-
* Delete a fragment by
|
|
337
|
+
* Delete a fragment by its identifier.
|
|
277
338
|
*/
|
|
278
|
-
deleteFragment(sedimentree_id: SedimentreeId,
|
|
339
|
+
deleteFragment(sedimentree_id: SedimentreeId, fragment_head: CommitId): Promise<any>;
|
|
279
340
|
/**
|
|
280
341
|
* Delete a sedimentree ID.
|
|
281
342
|
*/
|
|
282
343
|
deleteSedimentreeId(sedimentree_id: SedimentreeId): Promise<any>;
|
|
283
344
|
/**
|
|
284
|
-
* List all commit
|
|
345
|
+
* List all commit IDs for a sedimentree.
|
|
285
346
|
*/
|
|
286
|
-
|
|
347
|
+
listCommitIds(sedimentree_id: SedimentreeId): Promise<any>;
|
|
287
348
|
/**
|
|
288
|
-
* List all fragment
|
|
349
|
+
* List all fragment IDs for a sedimentree.
|
|
289
350
|
*/
|
|
290
|
-
|
|
351
|
+
listFragmentIds(sedimentree_id: SedimentreeId): Promise<any>;
|
|
291
352
|
/**
|
|
292
353
|
* Load all commits for a sedimentree, returning `CommitWithBlob[]`.
|
|
293
354
|
*/
|
|
@@ -301,25 +362,38 @@ export class MemoryStorage {
|
|
|
301
362
|
*/
|
|
302
363
|
loadAllSedimentreeIds(): Promise<any>;
|
|
303
364
|
/**
|
|
304
|
-
* Load a commit by
|
|
365
|
+
* Load a single commit by its ID, returning `CommitWithBlob` or null.
|
|
305
366
|
*/
|
|
306
|
-
loadCommit(sedimentree_id: SedimentreeId,
|
|
367
|
+
loadCommit(sedimentree_id: SedimentreeId, commit_id: CommitId): Promise<any>;
|
|
307
368
|
/**
|
|
308
|
-
* Load a fragment by
|
|
369
|
+
* Load a fragment by its identifier, returning `FragmentWithBlob` or null.
|
|
309
370
|
*/
|
|
310
|
-
loadFragment(sedimentree_id: SedimentreeId,
|
|
371
|
+
loadFragment(sedimentree_id: SedimentreeId, fragment_head: CommitId): Promise<any>;
|
|
311
372
|
/**
|
|
312
373
|
* Create a new in-memory storage instance.
|
|
313
374
|
*/
|
|
314
375
|
constructor();
|
|
376
|
+
/**
|
|
377
|
+
* Save commits and fragments in a single batch.
|
|
378
|
+
*/
|
|
379
|
+
saveBatchAll(sedimentree_id: SedimentreeId, commits: Array<any>, fragments: Array<any>): Promise<any>;
|
|
315
380
|
/**
|
|
316
381
|
* Save a commit with its blob.
|
|
382
|
+
*
|
|
383
|
+
* The `commit_id` parameter must match the `head()` embedded in
|
|
384
|
+
* the signed commit payload. Returns an error if they differ.
|
|
385
|
+
*
|
|
386
|
+
* # Errors
|
|
387
|
+
*
|
|
388
|
+
* Returns a JS error if:
|
|
389
|
+
* - The signed payload cannot be decoded
|
|
390
|
+
* - The `commit_id` does not match the embedded `head()`
|
|
317
391
|
*/
|
|
318
|
-
saveCommit(sedimentree_id: SedimentreeId,
|
|
392
|
+
saveCommit(sedimentree_id: SedimentreeId, commit_id: CommitId, signed_commit: SignedLooseCommit, blob: Uint8Array): Promise<any>;
|
|
319
393
|
/**
|
|
320
394
|
* Save a fragment with its blob.
|
|
321
395
|
*/
|
|
322
|
-
saveFragment(sedimentree_id: SedimentreeId,
|
|
396
|
+
saveFragment(sedimentree_id: SedimentreeId, _fragment_head: CommitId, signed_fragment: SignedFragment, blob: Uint8Array): Promise<any>;
|
|
323
397
|
/**
|
|
324
398
|
* Save a sedimentree ID.
|
|
325
399
|
*/
|
package/dist/sedimentree.wasm
CHANGED
|
Binary file
|
|
@@ -7,23 +7,23 @@ export interface SedimentreeStorage {
|
|
|
7
7
|
loadAllSedimentreeIds(): Promise<SedimentreeId[]>;
|
|
8
8
|
|
|
9
9
|
// Compound storage for commits (signed data + blob stored together)
|
|
10
|
-
saveCommit(sedimentreeId: SedimentreeId,
|
|
11
|
-
loadCommit(sedimentreeId: SedimentreeId,
|
|
12
|
-
|
|
10
|
+
saveCommit(sedimentreeId: SedimentreeId, commitId: CommitId, signedCommit: SignedLooseCommit, blob: Uint8Array): Promise<void>;
|
|
11
|
+
loadCommit(sedimentreeId: SedimentreeId, commitId: CommitId): Promise<CommitWithBlob | null>;
|
|
12
|
+
listCommitIds(sedimentreeId: SedimentreeId): Promise<CommitId[]>;
|
|
13
13
|
loadAllCommits(sedimentreeId: SedimentreeId): Promise<CommitWithBlob[]>;
|
|
14
|
-
deleteCommit(sedimentreeId: SedimentreeId,
|
|
14
|
+
deleteCommit(sedimentreeId: SedimentreeId, commitId: CommitId): Promise<void>;
|
|
15
15
|
deleteAllCommits(sedimentreeId: SedimentreeId): Promise<void>;
|
|
16
16
|
|
|
17
17
|
// Compound storage for fragments (signed data + blob stored together)
|
|
18
|
-
saveFragment(sedimentreeId: SedimentreeId,
|
|
19
|
-
loadFragment(sedimentreeId: SedimentreeId,
|
|
20
|
-
|
|
18
|
+
saveFragment(sedimentreeId: SedimentreeId, fragmentHead: CommitId, signedFragment: SignedFragment, blob: Uint8Array): Promise<void>;
|
|
19
|
+
loadFragment(sedimentreeId: SedimentreeId, fragmentHead: CommitId): Promise<FragmentWithBlob | null>;
|
|
20
|
+
listFragmentIds(sedimentreeId: SedimentreeId): Promise<CommitId[]>;
|
|
21
21
|
loadAllFragments(sedimentreeId: SedimentreeId): Promise<FragmentWithBlob[]>;
|
|
22
|
-
deleteFragment(sedimentreeId: SedimentreeId,
|
|
22
|
+
deleteFragment(sedimentreeId: SedimentreeId, fragmentHead: CommitId): Promise<void>;
|
|
23
23
|
deleteAllFragments(sedimentreeId: SedimentreeId): Promise<void>;
|
|
24
24
|
|
|
25
25
|
// Batch save: write all commits + fragments in a single storage transaction.
|
|
26
|
-
saveBatchAll(sedimentreeId: SedimentreeId, commits: Array<{
|
|
26
|
+
saveBatchAll(sedimentreeId: SedimentreeId, commits: Array<{commitId: CommitId, signedCommit: SignedLooseCommit, blob: Uint8Array}>, fragments: Array<{fragmentHead: CommitId, signedFragment: SignedFragment, blob: Uint8Array}>): Promise<number>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
|
|
@@ -55,6 +55,63 @@ export class BlobMeta {
|
|
|
55
55
|
readonly sizeBytes: bigint;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* A user-supplied opaque identifier for a loose commit.
|
|
60
|
+
*
|
|
61
|
+
* Unlike [`Digest`](crate::digest::WasmDigest), which is a content hash
|
|
62
|
+
* computed by the system, `CommitId` is provided by the caller at construction
|
|
63
|
+
* time. This is the identity used for DAG traversal, fragment boundaries,
|
|
64
|
+
* and sync.
|
|
65
|
+
*/
|
|
66
|
+
export class CommitId {
|
|
67
|
+
free(): void;
|
|
68
|
+
[Symbol.dispose](): void;
|
|
69
|
+
/**
|
|
70
|
+
* Upcasts; to the JS-import type for [`WasmCommitId`].
|
|
71
|
+
*/
|
|
72
|
+
__wasm_refgen_toWasmCommitId(): CommitId;
|
|
73
|
+
/**
|
|
74
|
+
* Creates a new commit identifier from its Base58 string representation.
|
|
75
|
+
*
|
|
76
|
+
* # Errors
|
|
77
|
+
*
|
|
78
|
+
* Returns an error if the string cannot be decoded or is not 32 bytes.
|
|
79
|
+
*/
|
|
80
|
+
static fromBase58(s: string): CommitId;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a new commit identifier from its byte representation.
|
|
83
|
+
*
|
|
84
|
+
* # Errors
|
|
85
|
+
*
|
|
86
|
+
* Returns an error if the byte slice is not exactly 32 bytes.
|
|
87
|
+
*/
|
|
88
|
+
static fromBytes(bytes: Uint8Array): CommitId;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a new commit identifier from its hexadecimal string representation.
|
|
91
|
+
*
|
|
92
|
+
* # Errors
|
|
93
|
+
*
|
|
94
|
+
* Returns an error if the string is not valid hex or not 32 bytes.
|
|
95
|
+
*/
|
|
96
|
+
static fromHexString(s: string): CommitId;
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new commit identifier from its byte representation.
|
|
99
|
+
*
|
|
100
|
+
* # Errors
|
|
101
|
+
*
|
|
102
|
+
* Returns an error if the byte slice is not exactly 32 bytes.
|
|
103
|
+
*/
|
|
104
|
+
constructor(bytes: Uint8Array);
|
|
105
|
+
/**
|
|
106
|
+
* Returns the byte representation of the commit identifier.
|
|
107
|
+
*/
|
|
108
|
+
toBytes(): Uint8Array;
|
|
109
|
+
/**
|
|
110
|
+
* Returns the hexadecimal string representation.
|
|
111
|
+
*/
|
|
112
|
+
toHexString(): string;
|
|
113
|
+
}
|
|
114
|
+
|
|
58
115
|
/**
|
|
59
116
|
* A commit stored with its associated blob.
|
|
60
117
|
*/
|
|
@@ -175,19 +232,19 @@ export class Fragment {
|
|
|
175
232
|
/**
|
|
176
233
|
* Create a new fragment from the given sedimentree ID, head, boundary, checkpoints, and blob metadata.
|
|
177
234
|
*/
|
|
178
|
-
constructor(sedimentree_id: SedimentreeId, head:
|
|
235
|
+
constructor(sedimentree_id: SedimentreeId, head: CommitId, boundary: CommitId[], checkpoints: CommitId[], blob_meta: BlobMeta);
|
|
179
236
|
/**
|
|
180
237
|
* Get the blob metadata of the fragment.
|
|
181
238
|
*/
|
|
182
239
|
readonly blobMeta: BlobMeta;
|
|
183
240
|
/**
|
|
184
|
-
* Get the boundary
|
|
241
|
+
* Get the boundary commit identifiers of the fragment.
|
|
185
242
|
*/
|
|
186
|
-
readonly boundary:
|
|
243
|
+
readonly boundary: CommitId[];
|
|
187
244
|
/**
|
|
188
|
-
* Get the head
|
|
245
|
+
* Get the head commit identifier of the fragment.
|
|
189
246
|
*/
|
|
190
|
-
readonly head:
|
|
247
|
+
readonly head: CommitId;
|
|
191
248
|
}
|
|
192
249
|
|
|
193
250
|
/**
|
|
@@ -235,21 +292,25 @@ export class LooseCommit {
|
|
|
235
292
|
*/
|
|
236
293
|
__wasm_refgen_toWasmLooseCommit(): LooseCommit;
|
|
237
294
|
/**
|
|
238
|
-
* Create a new `LooseCommit` from the given sedimentree ID, parents, and blob metadata.
|
|
295
|
+
* Create a new `LooseCommit` from the given sedimentree ID, head, parents, and blob metadata.
|
|
239
296
|
*/
|
|
240
|
-
constructor(sedimentree_id: SedimentreeId, parents:
|
|
297
|
+
constructor(sedimentree_id: SedimentreeId, head: CommitId, parents: CommitId[], blob_meta: BlobMeta);
|
|
241
298
|
/**
|
|
242
299
|
* Get the blob metadata of the commit.
|
|
243
300
|
*/
|
|
244
301
|
readonly blobMeta: BlobMeta;
|
|
245
302
|
/**
|
|
246
|
-
* Get the
|
|
303
|
+
* Get the commit's head identifier.
|
|
304
|
+
*/
|
|
305
|
+
readonly commitId: CommitId;
|
|
306
|
+
/**
|
|
307
|
+
* Get the digest of the commit (content hash).
|
|
247
308
|
*/
|
|
248
309
|
readonly digest: Digest;
|
|
249
310
|
/**
|
|
250
|
-
* Get the parent
|
|
311
|
+
* Get the parent commit identifiers.
|
|
251
312
|
*/
|
|
252
|
-
readonly parents:
|
|
313
|
+
readonly parents: CommitId[];
|
|
253
314
|
}
|
|
254
315
|
|
|
255
316
|
/**
|
|
@@ -269,25 +330,25 @@ export class MemoryStorage {
|
|
|
269
330
|
*/
|
|
270
331
|
deleteAllFragments(sedimentree_id: SedimentreeId): Promise<any>;
|
|
271
332
|
/**
|
|
272
|
-
* Delete a commit by
|
|
333
|
+
* Delete a single commit by its ID.
|
|
273
334
|
*/
|
|
274
|
-
deleteCommit(sedimentree_id: SedimentreeId,
|
|
335
|
+
deleteCommit(sedimentree_id: SedimentreeId, commit_id: CommitId): Promise<any>;
|
|
275
336
|
/**
|
|
276
|
-
* Delete a fragment by
|
|
337
|
+
* Delete a fragment by its identifier.
|
|
277
338
|
*/
|
|
278
|
-
deleteFragment(sedimentree_id: SedimentreeId,
|
|
339
|
+
deleteFragment(sedimentree_id: SedimentreeId, fragment_head: CommitId): Promise<any>;
|
|
279
340
|
/**
|
|
280
341
|
* Delete a sedimentree ID.
|
|
281
342
|
*/
|
|
282
343
|
deleteSedimentreeId(sedimentree_id: SedimentreeId): Promise<any>;
|
|
283
344
|
/**
|
|
284
|
-
* List all commit
|
|
345
|
+
* List all commit IDs for a sedimentree.
|
|
285
346
|
*/
|
|
286
|
-
|
|
347
|
+
listCommitIds(sedimentree_id: SedimentreeId): Promise<any>;
|
|
287
348
|
/**
|
|
288
|
-
* List all fragment
|
|
349
|
+
* List all fragment IDs for a sedimentree.
|
|
289
350
|
*/
|
|
290
|
-
|
|
351
|
+
listFragmentIds(sedimentree_id: SedimentreeId): Promise<any>;
|
|
291
352
|
/**
|
|
292
353
|
* Load all commits for a sedimentree, returning `CommitWithBlob[]`.
|
|
293
354
|
*/
|
|
@@ -301,25 +362,38 @@ export class MemoryStorage {
|
|
|
301
362
|
*/
|
|
302
363
|
loadAllSedimentreeIds(): Promise<any>;
|
|
303
364
|
/**
|
|
304
|
-
* Load a commit by
|
|
365
|
+
* Load a single commit by its ID, returning `CommitWithBlob` or null.
|
|
305
366
|
*/
|
|
306
|
-
loadCommit(sedimentree_id: SedimentreeId,
|
|
367
|
+
loadCommit(sedimentree_id: SedimentreeId, commit_id: CommitId): Promise<any>;
|
|
307
368
|
/**
|
|
308
|
-
* Load a fragment by
|
|
369
|
+
* Load a fragment by its identifier, returning `FragmentWithBlob` or null.
|
|
309
370
|
*/
|
|
310
|
-
loadFragment(sedimentree_id: SedimentreeId,
|
|
371
|
+
loadFragment(sedimentree_id: SedimentreeId, fragment_head: CommitId): Promise<any>;
|
|
311
372
|
/**
|
|
312
373
|
* Create a new in-memory storage instance.
|
|
313
374
|
*/
|
|
314
375
|
constructor();
|
|
376
|
+
/**
|
|
377
|
+
* Save commits and fragments in a single batch.
|
|
378
|
+
*/
|
|
379
|
+
saveBatchAll(sedimentree_id: SedimentreeId, commits: Array<any>, fragments: Array<any>): Promise<any>;
|
|
315
380
|
/**
|
|
316
381
|
* Save a commit with its blob.
|
|
382
|
+
*
|
|
383
|
+
* The `commit_id` parameter must match the `head()` embedded in
|
|
384
|
+
* the signed commit payload. Returns an error if they differ.
|
|
385
|
+
*
|
|
386
|
+
* # Errors
|
|
387
|
+
*
|
|
388
|
+
* Returns a JS error if:
|
|
389
|
+
* - The signed payload cannot be decoded
|
|
390
|
+
* - The `commit_id` does not match the embedded `head()`
|
|
317
391
|
*/
|
|
318
|
-
saveCommit(sedimentree_id: SedimentreeId,
|
|
392
|
+
saveCommit(sedimentree_id: SedimentreeId, commit_id: CommitId, signed_commit: SignedLooseCommit, blob: Uint8Array): Promise<any>;
|
|
319
393
|
/**
|
|
320
394
|
* Save a fragment with its blob.
|
|
321
395
|
*/
|
|
322
|
-
saveFragment(sedimentree_id: SedimentreeId,
|
|
396
|
+
saveFragment(sedimentree_id: SedimentreeId, _fragment_head: CommitId, signed_fragment: SignedFragment, blob: Uint8Array): Promise<any>;
|
|
323
397
|
/**
|
|
324
398
|
* Save a sedimentree ID.
|
|
325
399
|
*/
|
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./sedimentree_wasm_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
BlobMeta, CommitWithBlob, Depth, Digest, Fragment, FragmentWithBlob, FragmentsArray, LooseCommit, MemoryStorage, Sedimentree, SedimentreeId, SedimentreeIdsArray, SignedFragment, SignedLooseCommit
|
|
8
|
+
BlobMeta, CommitId, CommitWithBlob, Depth, Digest, Fragment, FragmentWithBlob, FragmentsArray, LooseCommit, MemoryStorage, Sedimentree, SedimentreeId, SedimentreeIdsArray, SignedFragment, SignedLooseCommit
|
|
9
9
|
} from "./sedimentree_wasm_bg.js";
|