@automerge/subduction 0.10.2 → 0.11.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 +296 -132
- package/dist/cjs/web.cjs +297 -133
- package/dist/esm/wasm-base64.js +1 -1
- package/dist/iife/index.js +296 -133
- package/dist/index.d.ts +110 -40
- package/dist/subduction.wasm +0 -0
- package/dist/wasm_bindgen/bundler/subduction_wasm.d.ts +110 -40
- package/dist/wasm_bindgen/bundler/subduction_wasm.js +1 -1
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.js +300 -129
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm.d.ts +28 -19
- package/dist/wasm_bindgen/nodejs/subduction_wasm.cjs +305 -133
- package/dist/wasm_bindgen/nodejs/subduction_wasm.d.ts +110 -40
- package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm.d.ts +28 -19
- package/dist/wasm_bindgen/web/subduction_wasm.d.ts +138 -59
- package/dist/wasm_bindgen/web/subduction_wasm.js +304 -133
- package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm.d.ts +28 -19
- package/package.json +1 -1
- /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-c507f5285f2927a0 → sedimentree_wasm-8e1863d4f7634be2}/inline0.js +0 -0
- /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-c507f5285f2927a0 → sedimentree_wasm-8e1863d4f7634be2}/inline1.js +0 -0
- /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-c507f5285f2927a0 → sedimentree_wasm-8e1863d4f7634be2}/inline2.js +0 -0
- /package/dist/wasm_bindgen/bundler/snippets/{subduction_wasm-ec51bcf335db35bd → subduction_wasm-98b1f8c21c19bd5c}/inline0.js +0 -0
- /package/dist/wasm_bindgen/bundler/snippets/{subduction_wasm-ec51bcf335db35bd → subduction_wasm-98b1f8c21c19bd5c}/inline1.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-c507f5285f2927a0 → sedimentree_wasm-8e1863d4f7634be2}/inline0.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-c507f5285f2927a0 → sedimentree_wasm-8e1863d4f7634be2}/inline1.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-c507f5285f2927a0 → sedimentree_wasm-8e1863d4f7634be2}/inline2.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{subduction_wasm-ec51bcf335db35bd → subduction_wasm-98b1f8c21c19bd5c}/inline0.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{subduction_wasm-ec51bcf335db35bd → subduction_wasm-98b1f8c21c19bd5c}/inline1.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-c507f5285f2927a0 → sedimentree_wasm-8e1863d4f7634be2}/inline0.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-c507f5285f2927a0 → sedimentree_wasm-8e1863d4f7634be2}/inline1.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-c507f5285f2927a0 → sedimentree_wasm-8e1863d4f7634be2}/inline2.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{subduction_wasm-ec51bcf335db35bd → subduction_wasm-98b1f8c21c19bd5c}/inline0.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{subduction_wasm-ec51bcf335db35bd → subduction_wasm-98b1f8c21c19bd5c}/inline1.js +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -36,23 +36,23 @@ export interface SedimentreeStorage {
|
|
|
36
36
|
loadAllSedimentreeIds(): Promise<SedimentreeId[]>;
|
|
37
37
|
|
|
38
38
|
// Compound storage for commits (signed data + blob stored together)
|
|
39
|
-
saveCommit(sedimentreeId: SedimentreeId,
|
|
40
|
-
loadCommit(sedimentreeId: SedimentreeId,
|
|
41
|
-
|
|
39
|
+
saveCommit(sedimentreeId: SedimentreeId, commitId: CommitId, signedCommit: SignedLooseCommit, blob: Uint8Array): Promise<void>;
|
|
40
|
+
loadCommit(sedimentreeId: SedimentreeId, commitId: CommitId): Promise<CommitWithBlob | null>;
|
|
41
|
+
listCommitIds(sedimentreeId: SedimentreeId): Promise<CommitId[]>;
|
|
42
42
|
loadAllCommits(sedimentreeId: SedimentreeId): Promise<CommitWithBlob[]>;
|
|
43
|
-
deleteCommit(sedimentreeId: SedimentreeId,
|
|
43
|
+
deleteCommit(sedimentreeId: SedimentreeId, commitId: CommitId): Promise<void>;
|
|
44
44
|
deleteAllCommits(sedimentreeId: SedimentreeId): Promise<void>;
|
|
45
45
|
|
|
46
46
|
// Compound storage for fragments (signed data + blob stored together)
|
|
47
|
-
saveFragment(sedimentreeId: SedimentreeId,
|
|
48
|
-
loadFragment(sedimentreeId: SedimentreeId,
|
|
49
|
-
|
|
47
|
+
saveFragment(sedimentreeId: SedimentreeId, fragmentHead: CommitId, signedFragment: SignedFragment, blob: Uint8Array): Promise<void>;
|
|
48
|
+
loadFragment(sedimentreeId: SedimentreeId, fragmentHead: CommitId): Promise<FragmentWithBlob | null>;
|
|
49
|
+
listFragmentIds(sedimentreeId: SedimentreeId): Promise<CommitId[]>;
|
|
50
50
|
loadAllFragments(sedimentreeId: SedimentreeId): Promise<FragmentWithBlob[]>;
|
|
51
|
-
deleteFragment(sedimentreeId: SedimentreeId,
|
|
51
|
+
deleteFragment(sedimentreeId: SedimentreeId, fragmentHead: CommitId): Promise<void>;
|
|
52
52
|
deleteAllFragments(sedimentreeId: SedimentreeId): Promise<void>;
|
|
53
53
|
|
|
54
54
|
// Batch save: write all commits + fragments in a single storage transaction.
|
|
55
|
-
saveBatchAll(sedimentreeId: SedimentreeId, commits: Array<{
|
|
55
|
+
saveBatchAll(sedimentreeId: SedimentreeId, commits: Array<{commitId: CommitId, signedCommit: SignedLooseCommit, blob: Uint8Array}>, fragments: Array<{fragmentHead: CommitId, signedFragment: SignedFragment, blob: Uint8Array}>): Promise<number>;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
|
|
@@ -298,6 +298,63 @@ export class CallError {
|
|
|
298
298
|
[Symbol.dispose](): void;
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
+
/**
|
|
302
|
+
* A user-supplied opaque identifier for a loose commit.
|
|
303
|
+
*
|
|
304
|
+
* Unlike [`Digest`](crate::digest::WasmDigest), which is a content hash
|
|
305
|
+
* computed by the system, `CommitId` is provided by the caller at construction
|
|
306
|
+
* time. This is the identity used for DAG traversal, fragment boundaries,
|
|
307
|
+
* and sync.
|
|
308
|
+
*/
|
|
309
|
+
export class CommitId {
|
|
310
|
+
free(): void;
|
|
311
|
+
[Symbol.dispose](): void;
|
|
312
|
+
/**
|
|
313
|
+
* Upcasts; to the JS-import type for [`WasmCommitId`].
|
|
314
|
+
*/
|
|
315
|
+
__wasm_refgen_toWasmCommitId(): CommitId;
|
|
316
|
+
/**
|
|
317
|
+
* Creates a new commit identifier from its Base58 string representation.
|
|
318
|
+
*
|
|
319
|
+
* # Errors
|
|
320
|
+
*
|
|
321
|
+
* Returns an error if the string cannot be decoded or is not 32 bytes.
|
|
322
|
+
*/
|
|
323
|
+
static fromBase58(s: string): CommitId;
|
|
324
|
+
/**
|
|
325
|
+
* Creates a new commit identifier from its byte representation.
|
|
326
|
+
*
|
|
327
|
+
* # Errors
|
|
328
|
+
*
|
|
329
|
+
* Returns an error if the byte slice is not exactly 32 bytes.
|
|
330
|
+
*/
|
|
331
|
+
static fromBytes(bytes: Uint8Array): CommitId;
|
|
332
|
+
/**
|
|
333
|
+
* Creates a new commit identifier from its hexadecimal string representation.
|
|
334
|
+
*
|
|
335
|
+
* # Errors
|
|
336
|
+
*
|
|
337
|
+
* Returns an error if the string is not valid hex or not 32 bytes.
|
|
338
|
+
*/
|
|
339
|
+
static fromHexString(s: string): CommitId;
|
|
340
|
+
/**
|
|
341
|
+
* Creates a new commit identifier from its byte representation.
|
|
342
|
+
*
|
|
343
|
+
* # Errors
|
|
344
|
+
*
|
|
345
|
+
* Returns an error if the byte slice is not exactly 32 bytes.
|
|
346
|
+
*/
|
|
347
|
+
constructor(bytes: Uint8Array);
|
|
348
|
+
/**
|
|
349
|
+
* Returns the byte representation of the commit identifier.
|
|
350
|
+
*/
|
|
351
|
+
toBytes(): Uint8Array;
|
|
352
|
+
/**
|
|
353
|
+
* Returns the hexadecimal string representation.
|
|
354
|
+
*/
|
|
355
|
+
toHexString(): string;
|
|
356
|
+
}
|
|
357
|
+
|
|
301
358
|
/**
|
|
302
359
|
* A commit stored with its associated blob.
|
|
303
360
|
*/
|
|
@@ -418,19 +475,19 @@ export class Fragment {
|
|
|
418
475
|
/**
|
|
419
476
|
* Create a new fragment from the given sedimentree ID, head, boundary, checkpoints, and blob metadata.
|
|
420
477
|
*/
|
|
421
|
-
constructor(sedimentree_id: SedimentreeId, head:
|
|
478
|
+
constructor(sedimentree_id: SedimentreeId, head: CommitId, boundary: CommitId[], checkpoints: CommitId[], blob_meta: BlobMeta);
|
|
422
479
|
/**
|
|
423
480
|
* Get the blob metadata of the fragment.
|
|
424
481
|
*/
|
|
425
482
|
readonly blobMeta: BlobMeta;
|
|
426
483
|
/**
|
|
427
|
-
* Get the boundary
|
|
484
|
+
* Get the boundary commit identifiers of the fragment.
|
|
428
485
|
*/
|
|
429
|
-
readonly boundary:
|
|
486
|
+
readonly boundary: CommitId[];
|
|
430
487
|
/**
|
|
431
|
-
* Get the head
|
|
488
|
+
* Get the head commit identifier of the fragment.
|
|
432
489
|
*/
|
|
433
|
-
readonly head:
|
|
490
|
+
readonly head: CommitId;
|
|
434
491
|
}
|
|
435
492
|
|
|
436
493
|
/**
|
|
@@ -440,17 +497,17 @@ export class FragmentRequested {
|
|
|
440
497
|
free(): void;
|
|
441
498
|
[Symbol.dispose](): void;
|
|
442
499
|
/**
|
|
443
|
-
* Create a new fragment request from the given
|
|
500
|
+
* Create a new fragment request from the given commit ID.
|
|
444
501
|
*/
|
|
445
|
-
constructor(
|
|
502
|
+
constructor(commit_id: CommitId, depth: Depth);
|
|
446
503
|
/**
|
|
447
504
|
* Get the depth of the requested fragment.
|
|
448
505
|
*/
|
|
449
506
|
readonly depth: Depth;
|
|
450
507
|
/**
|
|
451
|
-
* Get the
|
|
508
|
+
* Get the head commit identifier of the requested fragment.
|
|
452
509
|
*/
|
|
453
|
-
readonly head:
|
|
510
|
+
readonly head: CommitId;
|
|
454
511
|
}
|
|
455
512
|
|
|
456
513
|
/**
|
|
@@ -512,21 +569,25 @@ export class LooseCommit {
|
|
|
512
569
|
*/
|
|
513
570
|
__wasm_refgen_toWasmLooseCommit(): LooseCommit;
|
|
514
571
|
/**
|
|
515
|
-
* Create a new `LooseCommit` from the given sedimentree ID, parents, and blob metadata.
|
|
572
|
+
* Create a new `LooseCommit` from the given sedimentree ID, head, parents, and blob metadata.
|
|
516
573
|
*/
|
|
517
|
-
constructor(sedimentree_id: SedimentreeId, parents:
|
|
574
|
+
constructor(sedimentree_id: SedimentreeId, head: CommitId, parents: CommitId[], blob_meta: BlobMeta);
|
|
518
575
|
/**
|
|
519
576
|
* Get the blob metadata of the commit.
|
|
520
577
|
*/
|
|
521
578
|
readonly blobMeta: BlobMeta;
|
|
522
579
|
/**
|
|
523
|
-
* Get the
|
|
580
|
+
* Get the commit's head identifier.
|
|
581
|
+
*/
|
|
582
|
+
readonly commitId: CommitId;
|
|
583
|
+
/**
|
|
584
|
+
* Get the digest of the commit (content hash).
|
|
524
585
|
*/
|
|
525
586
|
readonly digest: Digest;
|
|
526
587
|
/**
|
|
527
|
-
* Get the parent
|
|
588
|
+
* Get the parent commit identifiers.
|
|
528
589
|
*/
|
|
529
|
-
readonly parents:
|
|
590
|
+
readonly parents: CommitId[];
|
|
530
591
|
}
|
|
531
592
|
|
|
532
593
|
/**
|
|
@@ -610,25 +671,25 @@ export class MemoryStorage {
|
|
|
610
671
|
*/
|
|
611
672
|
deleteAllFragments(sedimentree_id: SedimentreeId): Promise<any>;
|
|
612
673
|
/**
|
|
613
|
-
* Delete a commit by
|
|
674
|
+
* Delete a single commit by its ID.
|
|
614
675
|
*/
|
|
615
|
-
deleteCommit(sedimentree_id: SedimentreeId,
|
|
676
|
+
deleteCommit(sedimentree_id: SedimentreeId, commit_id: CommitId): Promise<any>;
|
|
616
677
|
/**
|
|
617
|
-
* Delete a fragment by
|
|
678
|
+
* Delete a fragment by its identifier.
|
|
618
679
|
*/
|
|
619
|
-
deleteFragment(sedimentree_id: SedimentreeId,
|
|
680
|
+
deleteFragment(sedimentree_id: SedimentreeId, fragment_head: CommitId): Promise<any>;
|
|
620
681
|
/**
|
|
621
682
|
* Delete a sedimentree ID.
|
|
622
683
|
*/
|
|
623
684
|
deleteSedimentreeId(sedimentree_id: SedimentreeId): Promise<any>;
|
|
624
685
|
/**
|
|
625
|
-
* List all commit
|
|
686
|
+
* List all commit IDs for a sedimentree.
|
|
626
687
|
*/
|
|
627
|
-
|
|
688
|
+
listCommitIds(sedimentree_id: SedimentreeId): Promise<any>;
|
|
628
689
|
/**
|
|
629
|
-
* List all fragment
|
|
690
|
+
* List all fragment IDs for a sedimentree.
|
|
630
691
|
*/
|
|
631
|
-
|
|
692
|
+
listFragmentIds(sedimentree_id: SedimentreeId): Promise<any>;
|
|
632
693
|
/**
|
|
633
694
|
* Load all commits for a sedimentree, returning `CommitWithBlob[]`.
|
|
634
695
|
*/
|
|
@@ -642,13 +703,13 @@ export class MemoryStorage {
|
|
|
642
703
|
*/
|
|
643
704
|
loadAllSedimentreeIds(): Promise<any>;
|
|
644
705
|
/**
|
|
645
|
-
* Load a commit by
|
|
706
|
+
* Load a single commit by its ID, returning `CommitWithBlob` or null.
|
|
646
707
|
*/
|
|
647
|
-
loadCommit(sedimentree_id: SedimentreeId,
|
|
708
|
+
loadCommit(sedimentree_id: SedimentreeId, commit_id: CommitId): Promise<any>;
|
|
648
709
|
/**
|
|
649
|
-
* Load a fragment by
|
|
710
|
+
* Load a fragment by its identifier, returning `FragmentWithBlob` or null.
|
|
650
711
|
*/
|
|
651
|
-
loadFragment(sedimentree_id: SedimentreeId,
|
|
712
|
+
loadFragment(sedimentree_id: SedimentreeId, fragment_head: CommitId): Promise<any>;
|
|
652
713
|
/**
|
|
653
714
|
* Create a new in-memory storage instance.
|
|
654
715
|
*/
|
|
@@ -659,12 +720,21 @@ export class MemoryStorage {
|
|
|
659
720
|
saveBatchAll(sedimentree_id: SedimentreeId, commits: Array<any>, fragments: Array<any>): Promise<any>;
|
|
660
721
|
/**
|
|
661
722
|
* Save a commit with its blob.
|
|
723
|
+
*
|
|
724
|
+
* The `commit_id` parameter must match the `head()` embedded in
|
|
725
|
+
* the signed commit payload. Returns an error if they differ.
|
|
726
|
+
*
|
|
727
|
+
* # Errors
|
|
728
|
+
*
|
|
729
|
+
* Returns a JS error if:
|
|
730
|
+
* - The signed payload cannot be decoded
|
|
731
|
+
* - The `commit_id` does not match the embedded `head()`
|
|
662
732
|
*/
|
|
663
|
-
saveCommit(sedimentree_id: SedimentreeId,
|
|
733
|
+
saveCommit(sedimentree_id: SedimentreeId, commit_id: CommitId, signed_commit: SignedLooseCommit, blob: Uint8Array): Promise<any>;
|
|
664
734
|
/**
|
|
665
735
|
* Save a fragment with its blob.
|
|
666
736
|
*/
|
|
667
|
-
saveFragment(sedimentree_id: SedimentreeId,
|
|
737
|
+
saveFragment(sedimentree_id: SedimentreeId, _fragment_head: CommitId, signed_fragment: SignedFragment, blob: Uint8Array): Promise<any>;
|
|
668
738
|
/**
|
|
669
739
|
* Save a sedimentree ID.
|
|
670
740
|
*/
|
|
@@ -974,7 +1044,7 @@ export class Subduction {
|
|
|
974
1044
|
*
|
|
975
1045
|
* Returns a [`WasmWriteError`] if storage, networking, or policy fail.
|
|
976
1046
|
*/
|
|
977
|
-
addCommit(id: SedimentreeId, parents:
|
|
1047
|
+
addCommit(id: SedimentreeId, head: CommitId, parents: CommitId[], blob: Uint8Array): Promise<FragmentRequested | undefined>;
|
|
978
1048
|
/**
|
|
979
1049
|
* Onboard an authenticated transport: add it and sync all sedimentrees.
|
|
980
1050
|
*
|
|
@@ -1006,7 +1076,7 @@ export class Subduction {
|
|
|
1006
1076
|
*
|
|
1007
1077
|
* Returns a [`WasmWriteError`] if storage, networking, or policy fail.
|
|
1008
1078
|
*/
|
|
1009
|
-
addFragment(id: SedimentreeId, head:
|
|
1079
|
+
addFragment(id: SedimentreeId, head: CommitId, boundary: CommitId[], checkpoints: CommitId[], blob: Uint8Array): Promise<void>;
|
|
1010
1080
|
/**
|
|
1011
1081
|
* Add a Sedimentree.
|
|
1012
1082
|
*
|
|
@@ -1602,7 +1672,7 @@ export class SyncStats {
|
|
|
1602
1672
|
/**
|
|
1603
1673
|
* The remote peer's heads for this sedimentree.
|
|
1604
1674
|
*/
|
|
1605
|
-
readonly remoteHeads:
|
|
1675
|
+
readonly remoteHeads: CommitId[];
|
|
1606
1676
|
/**
|
|
1607
1677
|
* Total items received (commits + fragments).
|
|
1608
1678
|
*/
|
package/dist/subduction.wasm
CHANGED
|
Binary file
|
|
@@ -36,23 +36,23 @@ export interface SedimentreeStorage {
|
|
|
36
36
|
loadAllSedimentreeIds(): Promise<SedimentreeId[]>;
|
|
37
37
|
|
|
38
38
|
// Compound storage for commits (signed data + blob stored together)
|
|
39
|
-
saveCommit(sedimentreeId: SedimentreeId,
|
|
40
|
-
loadCommit(sedimentreeId: SedimentreeId,
|
|
41
|
-
|
|
39
|
+
saveCommit(sedimentreeId: SedimentreeId, commitId: CommitId, signedCommit: SignedLooseCommit, blob: Uint8Array): Promise<void>;
|
|
40
|
+
loadCommit(sedimentreeId: SedimentreeId, commitId: CommitId): Promise<CommitWithBlob | null>;
|
|
41
|
+
listCommitIds(sedimentreeId: SedimentreeId): Promise<CommitId[]>;
|
|
42
42
|
loadAllCommits(sedimentreeId: SedimentreeId): Promise<CommitWithBlob[]>;
|
|
43
|
-
deleteCommit(sedimentreeId: SedimentreeId,
|
|
43
|
+
deleteCommit(sedimentreeId: SedimentreeId, commitId: CommitId): Promise<void>;
|
|
44
44
|
deleteAllCommits(sedimentreeId: SedimentreeId): Promise<void>;
|
|
45
45
|
|
|
46
46
|
// Compound storage for fragments (signed data + blob stored together)
|
|
47
|
-
saveFragment(sedimentreeId: SedimentreeId,
|
|
48
|
-
loadFragment(sedimentreeId: SedimentreeId,
|
|
49
|
-
|
|
47
|
+
saveFragment(sedimentreeId: SedimentreeId, fragmentHead: CommitId, signedFragment: SignedFragment, blob: Uint8Array): Promise<void>;
|
|
48
|
+
loadFragment(sedimentreeId: SedimentreeId, fragmentHead: CommitId): Promise<FragmentWithBlob | null>;
|
|
49
|
+
listFragmentIds(sedimentreeId: SedimentreeId): Promise<CommitId[]>;
|
|
50
50
|
loadAllFragments(sedimentreeId: SedimentreeId): Promise<FragmentWithBlob[]>;
|
|
51
|
-
deleteFragment(sedimentreeId: SedimentreeId,
|
|
51
|
+
deleteFragment(sedimentreeId: SedimentreeId, fragmentHead: CommitId): Promise<void>;
|
|
52
52
|
deleteAllFragments(sedimentreeId: SedimentreeId): Promise<void>;
|
|
53
53
|
|
|
54
54
|
// Batch save: write all commits + fragments in a single storage transaction.
|
|
55
|
-
saveBatchAll(sedimentreeId: SedimentreeId, commits: Array<{
|
|
55
|
+
saveBatchAll(sedimentreeId: SedimentreeId, commits: Array<{commitId: CommitId, signedCommit: SignedLooseCommit, blob: Uint8Array}>, fragments: Array<{fragmentHead: CommitId, signedFragment: SignedFragment, blob: Uint8Array}>): Promise<number>;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
|
|
@@ -298,6 +298,63 @@ export class CallError {
|
|
|
298
298
|
[Symbol.dispose](): void;
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
+
/**
|
|
302
|
+
* A user-supplied opaque identifier for a loose commit.
|
|
303
|
+
*
|
|
304
|
+
* Unlike [`Digest`](crate::digest::WasmDigest), which is a content hash
|
|
305
|
+
* computed by the system, `CommitId` is provided by the caller at construction
|
|
306
|
+
* time. This is the identity used for DAG traversal, fragment boundaries,
|
|
307
|
+
* and sync.
|
|
308
|
+
*/
|
|
309
|
+
export class CommitId {
|
|
310
|
+
free(): void;
|
|
311
|
+
[Symbol.dispose](): void;
|
|
312
|
+
/**
|
|
313
|
+
* Upcasts; to the JS-import type for [`WasmCommitId`].
|
|
314
|
+
*/
|
|
315
|
+
__wasm_refgen_toWasmCommitId(): CommitId;
|
|
316
|
+
/**
|
|
317
|
+
* Creates a new commit identifier from its Base58 string representation.
|
|
318
|
+
*
|
|
319
|
+
* # Errors
|
|
320
|
+
*
|
|
321
|
+
* Returns an error if the string cannot be decoded or is not 32 bytes.
|
|
322
|
+
*/
|
|
323
|
+
static fromBase58(s: string): CommitId;
|
|
324
|
+
/**
|
|
325
|
+
* Creates a new commit identifier from its byte representation.
|
|
326
|
+
*
|
|
327
|
+
* # Errors
|
|
328
|
+
*
|
|
329
|
+
* Returns an error if the byte slice is not exactly 32 bytes.
|
|
330
|
+
*/
|
|
331
|
+
static fromBytes(bytes: Uint8Array): CommitId;
|
|
332
|
+
/**
|
|
333
|
+
* Creates a new commit identifier from its hexadecimal string representation.
|
|
334
|
+
*
|
|
335
|
+
* # Errors
|
|
336
|
+
*
|
|
337
|
+
* Returns an error if the string is not valid hex or not 32 bytes.
|
|
338
|
+
*/
|
|
339
|
+
static fromHexString(s: string): CommitId;
|
|
340
|
+
/**
|
|
341
|
+
* Creates a new commit identifier from its byte representation.
|
|
342
|
+
*
|
|
343
|
+
* # Errors
|
|
344
|
+
*
|
|
345
|
+
* Returns an error if the byte slice is not exactly 32 bytes.
|
|
346
|
+
*/
|
|
347
|
+
constructor(bytes: Uint8Array);
|
|
348
|
+
/**
|
|
349
|
+
* Returns the byte representation of the commit identifier.
|
|
350
|
+
*/
|
|
351
|
+
toBytes(): Uint8Array;
|
|
352
|
+
/**
|
|
353
|
+
* Returns the hexadecimal string representation.
|
|
354
|
+
*/
|
|
355
|
+
toHexString(): string;
|
|
356
|
+
}
|
|
357
|
+
|
|
301
358
|
/**
|
|
302
359
|
* A commit stored with its associated blob.
|
|
303
360
|
*/
|
|
@@ -418,19 +475,19 @@ export class Fragment {
|
|
|
418
475
|
/**
|
|
419
476
|
* Create a new fragment from the given sedimentree ID, head, boundary, checkpoints, and blob metadata.
|
|
420
477
|
*/
|
|
421
|
-
constructor(sedimentree_id: SedimentreeId, head:
|
|
478
|
+
constructor(sedimentree_id: SedimentreeId, head: CommitId, boundary: CommitId[], checkpoints: CommitId[], blob_meta: BlobMeta);
|
|
422
479
|
/**
|
|
423
480
|
* Get the blob metadata of the fragment.
|
|
424
481
|
*/
|
|
425
482
|
readonly blobMeta: BlobMeta;
|
|
426
483
|
/**
|
|
427
|
-
* Get the boundary
|
|
484
|
+
* Get the boundary commit identifiers of the fragment.
|
|
428
485
|
*/
|
|
429
|
-
readonly boundary:
|
|
486
|
+
readonly boundary: CommitId[];
|
|
430
487
|
/**
|
|
431
|
-
* Get the head
|
|
488
|
+
* Get the head commit identifier of the fragment.
|
|
432
489
|
*/
|
|
433
|
-
readonly head:
|
|
490
|
+
readonly head: CommitId;
|
|
434
491
|
}
|
|
435
492
|
|
|
436
493
|
/**
|
|
@@ -440,17 +497,17 @@ export class FragmentRequested {
|
|
|
440
497
|
free(): void;
|
|
441
498
|
[Symbol.dispose](): void;
|
|
442
499
|
/**
|
|
443
|
-
* Create a new fragment request from the given
|
|
500
|
+
* Create a new fragment request from the given commit ID.
|
|
444
501
|
*/
|
|
445
|
-
constructor(
|
|
502
|
+
constructor(commit_id: CommitId, depth: Depth);
|
|
446
503
|
/**
|
|
447
504
|
* Get the depth of the requested fragment.
|
|
448
505
|
*/
|
|
449
506
|
readonly depth: Depth;
|
|
450
507
|
/**
|
|
451
|
-
* Get the
|
|
508
|
+
* Get the head commit identifier of the requested fragment.
|
|
452
509
|
*/
|
|
453
|
-
readonly head:
|
|
510
|
+
readonly head: CommitId;
|
|
454
511
|
}
|
|
455
512
|
|
|
456
513
|
/**
|
|
@@ -512,21 +569,25 @@ export class LooseCommit {
|
|
|
512
569
|
*/
|
|
513
570
|
__wasm_refgen_toWasmLooseCommit(): LooseCommit;
|
|
514
571
|
/**
|
|
515
|
-
* Create a new `LooseCommit` from the given sedimentree ID, parents, and blob metadata.
|
|
572
|
+
* Create a new `LooseCommit` from the given sedimentree ID, head, parents, and blob metadata.
|
|
516
573
|
*/
|
|
517
|
-
constructor(sedimentree_id: SedimentreeId, parents:
|
|
574
|
+
constructor(sedimentree_id: SedimentreeId, head: CommitId, parents: CommitId[], blob_meta: BlobMeta);
|
|
518
575
|
/**
|
|
519
576
|
* Get the blob metadata of the commit.
|
|
520
577
|
*/
|
|
521
578
|
readonly blobMeta: BlobMeta;
|
|
522
579
|
/**
|
|
523
|
-
* Get the
|
|
580
|
+
* Get the commit's head identifier.
|
|
581
|
+
*/
|
|
582
|
+
readonly commitId: CommitId;
|
|
583
|
+
/**
|
|
584
|
+
* Get the digest of the commit (content hash).
|
|
524
585
|
*/
|
|
525
586
|
readonly digest: Digest;
|
|
526
587
|
/**
|
|
527
|
-
* Get the parent
|
|
588
|
+
* Get the parent commit identifiers.
|
|
528
589
|
*/
|
|
529
|
-
readonly parents:
|
|
590
|
+
readonly parents: CommitId[];
|
|
530
591
|
}
|
|
531
592
|
|
|
532
593
|
/**
|
|
@@ -610,25 +671,25 @@ export class MemoryStorage {
|
|
|
610
671
|
*/
|
|
611
672
|
deleteAllFragments(sedimentree_id: SedimentreeId): Promise<any>;
|
|
612
673
|
/**
|
|
613
|
-
* Delete a commit by
|
|
674
|
+
* Delete a single commit by its ID.
|
|
614
675
|
*/
|
|
615
|
-
deleteCommit(sedimentree_id: SedimentreeId,
|
|
676
|
+
deleteCommit(sedimentree_id: SedimentreeId, commit_id: CommitId): Promise<any>;
|
|
616
677
|
/**
|
|
617
|
-
* Delete a fragment by
|
|
678
|
+
* Delete a fragment by its identifier.
|
|
618
679
|
*/
|
|
619
|
-
deleteFragment(sedimentree_id: SedimentreeId,
|
|
680
|
+
deleteFragment(sedimentree_id: SedimentreeId, fragment_head: CommitId): Promise<any>;
|
|
620
681
|
/**
|
|
621
682
|
* Delete a sedimentree ID.
|
|
622
683
|
*/
|
|
623
684
|
deleteSedimentreeId(sedimentree_id: SedimentreeId): Promise<any>;
|
|
624
685
|
/**
|
|
625
|
-
* List all commit
|
|
686
|
+
* List all commit IDs for a sedimentree.
|
|
626
687
|
*/
|
|
627
|
-
|
|
688
|
+
listCommitIds(sedimentree_id: SedimentreeId): Promise<any>;
|
|
628
689
|
/**
|
|
629
|
-
* List all fragment
|
|
690
|
+
* List all fragment IDs for a sedimentree.
|
|
630
691
|
*/
|
|
631
|
-
|
|
692
|
+
listFragmentIds(sedimentree_id: SedimentreeId): Promise<any>;
|
|
632
693
|
/**
|
|
633
694
|
* Load all commits for a sedimentree, returning `CommitWithBlob[]`.
|
|
634
695
|
*/
|
|
@@ -642,13 +703,13 @@ export class MemoryStorage {
|
|
|
642
703
|
*/
|
|
643
704
|
loadAllSedimentreeIds(): Promise<any>;
|
|
644
705
|
/**
|
|
645
|
-
* Load a commit by
|
|
706
|
+
* Load a single commit by its ID, returning `CommitWithBlob` or null.
|
|
646
707
|
*/
|
|
647
|
-
loadCommit(sedimentree_id: SedimentreeId,
|
|
708
|
+
loadCommit(sedimentree_id: SedimentreeId, commit_id: CommitId): Promise<any>;
|
|
648
709
|
/**
|
|
649
|
-
* Load a fragment by
|
|
710
|
+
* Load a fragment by its identifier, returning `FragmentWithBlob` or null.
|
|
650
711
|
*/
|
|
651
|
-
loadFragment(sedimentree_id: SedimentreeId,
|
|
712
|
+
loadFragment(sedimentree_id: SedimentreeId, fragment_head: CommitId): Promise<any>;
|
|
652
713
|
/**
|
|
653
714
|
* Create a new in-memory storage instance.
|
|
654
715
|
*/
|
|
@@ -659,12 +720,21 @@ export class MemoryStorage {
|
|
|
659
720
|
saveBatchAll(sedimentree_id: SedimentreeId, commits: Array<any>, fragments: Array<any>): Promise<any>;
|
|
660
721
|
/**
|
|
661
722
|
* Save a commit with its blob.
|
|
723
|
+
*
|
|
724
|
+
* The `commit_id` parameter must match the `head()` embedded in
|
|
725
|
+
* the signed commit payload. Returns an error if they differ.
|
|
726
|
+
*
|
|
727
|
+
* # Errors
|
|
728
|
+
*
|
|
729
|
+
* Returns a JS error if:
|
|
730
|
+
* - The signed payload cannot be decoded
|
|
731
|
+
* - The `commit_id` does not match the embedded `head()`
|
|
662
732
|
*/
|
|
663
|
-
saveCommit(sedimentree_id: SedimentreeId,
|
|
733
|
+
saveCommit(sedimentree_id: SedimentreeId, commit_id: CommitId, signed_commit: SignedLooseCommit, blob: Uint8Array): Promise<any>;
|
|
664
734
|
/**
|
|
665
735
|
* Save a fragment with its blob.
|
|
666
736
|
*/
|
|
667
|
-
saveFragment(sedimentree_id: SedimentreeId,
|
|
737
|
+
saveFragment(sedimentree_id: SedimentreeId, _fragment_head: CommitId, signed_fragment: SignedFragment, blob: Uint8Array): Promise<any>;
|
|
668
738
|
/**
|
|
669
739
|
* Save a sedimentree ID.
|
|
670
740
|
*/
|
|
@@ -974,7 +1044,7 @@ export class Subduction {
|
|
|
974
1044
|
*
|
|
975
1045
|
* Returns a [`WasmWriteError`] if storage, networking, or policy fail.
|
|
976
1046
|
*/
|
|
977
|
-
addCommit(id: SedimentreeId, parents:
|
|
1047
|
+
addCommit(id: SedimentreeId, head: CommitId, parents: CommitId[], blob: Uint8Array): Promise<FragmentRequested | undefined>;
|
|
978
1048
|
/**
|
|
979
1049
|
* Onboard an authenticated transport: add it and sync all sedimentrees.
|
|
980
1050
|
*
|
|
@@ -1006,7 +1076,7 @@ export class Subduction {
|
|
|
1006
1076
|
*
|
|
1007
1077
|
* Returns a [`WasmWriteError`] if storage, networking, or policy fail.
|
|
1008
1078
|
*/
|
|
1009
|
-
addFragment(id: SedimentreeId, head:
|
|
1079
|
+
addFragment(id: SedimentreeId, head: CommitId, boundary: CommitId[], checkpoints: CommitId[], blob: Uint8Array): Promise<void>;
|
|
1010
1080
|
/**
|
|
1011
1081
|
* Add a Sedimentree.
|
|
1012
1082
|
*
|
|
@@ -1602,7 +1672,7 @@ export class SyncStats {
|
|
|
1602
1672
|
/**
|
|
1603
1673
|
* The remote peer's heads for this sedimentree.
|
|
1604
1674
|
*/
|
|
1605
|
-
readonly remoteHeads:
|
|
1675
|
+
readonly remoteHeads: CommitId[];
|
|
1606
1676
|
/**
|
|
1607
1677
|
* Total items received (commits + fragments).
|
|
1608
1678
|
*/
|
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./subduction_wasm_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
AuthenticatedLongPoll, AuthenticatedTransport, AuthenticatedWebSocket, BatchSyncRequest, BatchSyncResponse, BlobMeta, CallError, CommitWithBlob, Depth, Digest, Fragment, FragmentRequested, FragmentWithBlob, FragmentsArray, HashMetric, LooseCommit, MemorySigner, MemoryStorage, MessagePortTransport, Nonce, PeerBatchSyncResult, PeerId, PeerResultMap, RequestId, Sedimentree, SedimentreeId, SedimentreeIdsArray, SignedFragment, SignedLooseCommit, Subduction, SubductionHttpLongPoll, SubductionLongPoll, SubductionWebSocket, SyncMessage, SyncStats, Topic, WebCryptoSigner, makeMessagePortTransport, start
|
|
8
|
+
AuthenticatedLongPoll, AuthenticatedTransport, AuthenticatedWebSocket, BatchSyncRequest, BatchSyncResponse, BlobMeta, CallError, CommitId, CommitWithBlob, Depth, Digest, Fragment, FragmentRequested, FragmentWithBlob, FragmentsArray, HashMetric, LooseCommit, MemorySigner, MemoryStorage, MessagePortTransport, Nonce, PeerBatchSyncResult, PeerId, PeerResultMap, RequestId, Sedimentree, SedimentreeId, SedimentreeIdsArray, SignedFragment, SignedLooseCommit, Subduction, SubductionHttpLongPoll, SubductionLongPoll, SubductionWebSocket, SyncMessage, SyncStats, Topic, WebCryptoSigner, makeMessagePortTransport, start
|
|
9
9
|
} from "./subduction_wasm_bg.js";
|