@interop/wallet-core 0.90.0 → 0.91.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.
Files changed (88) hide show
  1. package/dist/clientAnnex/grantRevocation.d.ts +9 -4
  2. package/dist/clientAnnex/grantRevocation.d.ts.map +1 -1
  3. package/dist/clientAnnex/grantRevocation.js +8 -4
  4. package/dist/clientAnnex/grantRevocation.js.map +1 -1
  5. package/dist/clientAnnex/index.d.ts +1 -1
  6. package/dist/clientAnnex/index.d.ts.map +1 -1
  7. package/dist/clientAnnex/index.js +1 -1
  8. package/dist/clientAnnex/index.js.map +1 -1
  9. package/dist/clientAnnex/ladder.d.ts +11 -13
  10. package/dist/clientAnnex/ladder.d.ts.map +1 -1
  11. package/dist/clientAnnex/ladder.js +71 -75
  12. package/dist/clientAnnex/ladder.js.map +1 -1
  13. package/dist/clientAnnex/ladderAnchored.d.ts +7 -58
  14. package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
  15. package/dist/clientAnnex/ladderAnchored.js +9 -72
  16. package/dist/clientAnnex/ladderAnchored.js.map +1 -1
  17. package/dist/clientAnnex/log.d.ts +4 -2
  18. package/dist/clientAnnex/log.d.ts.map +1 -1
  19. package/dist/clientAnnex/log.js +12 -2
  20. package/dist/clientAnnex/log.js.map +1 -1
  21. package/dist/clientAnnex/recoveryLadderAnchored.d.ts +53 -17
  22. package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
  23. package/dist/clientAnnex/recoveryLadderAnchored.js +52 -24
  24. package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
  25. package/dist/clientAnnex/selfEnroll.d.ts +3 -8
  26. package/dist/clientAnnex/selfEnroll.d.ts.map +1 -1
  27. package/dist/clientAnnex/selfEnroll.js +2 -1
  28. package/dist/clientAnnex/selfEnroll.js.map +1 -1
  29. package/dist/recovery/continuation.d.ts +13 -6
  30. package/dist/recovery/continuation.d.ts.map +1 -1
  31. package/dist/recovery/continuation.js +14 -2
  32. package/dist/recovery/continuation.js.map +1 -1
  33. package/dist/recovery/recoveryWebvh.d.ts +17 -4
  34. package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
  35. package/dist/recovery/recoveryWebvh.js +14 -1
  36. package/dist/recovery/recoveryWebvh.js.map +1 -1
  37. package/dist/sync/contactsConflict.d.ts +9 -9
  38. package/dist/sync/contactsConflict.js +9 -9
  39. package/dist/sync/engine.d.ts +3 -3
  40. package/dist/sync/engine.js +3 -3
  41. package/dist/sync/engine.js.map +1 -1
  42. package/dist/sync/index.d.ts +3 -3
  43. package/dist/sync/index.d.ts.map +1 -1
  44. package/dist/sync/index.js +2 -2
  45. package/dist/sync/pull.d.ts +5 -5
  46. package/dist/sync/pull.js +5 -5
  47. package/dist/sync/push.d.ts +7 -6
  48. package/dist/sync/push.d.ts.map +1 -1
  49. package/dist/sync/push.js +65 -59
  50. package/dist/sync/push.js.map +1 -1
  51. package/dist/sync/remint.d.ts +37 -33
  52. package/dist/sync/remint.d.ts.map +1 -1
  53. package/dist/sync/remint.js +70 -64
  54. package/dist/sync/remint.js.map +1 -1
  55. package/dist/sync/types.d.ts +88 -83
  56. package/dist/sync/types.d.ts.map +1 -1
  57. package/dist/sync/types.js +12 -12
  58. package/dist/unlock/standingWebvh.d.ts.map +1 -1
  59. package/dist/unlock/standingWebvh.js +3 -1
  60. package/dist/unlock/standingWebvh.js.map +1 -1
  61. package/dist/webvh/accountEntry.d.ts +10 -1
  62. package/dist/webvh/accountEntry.d.ts.map +1 -1
  63. package/dist/webvh/accountEntry.js +23 -1
  64. package/dist/webvh/accountEntry.js.map +1 -1
  65. package/dist/webvh/builtOnHead.d.ts +79 -0
  66. package/dist/webvh/builtOnHead.d.ts.map +1 -0
  67. package/dist/webvh/builtOnHead.js +77 -0
  68. package/dist/webvh/builtOnHead.js.map +1 -0
  69. package/dist/webvh/didWebvh.d.ts +14 -6
  70. package/dist/webvh/didWebvh.d.ts.map +1 -1
  71. package/dist/webvh/didWebvh.js +5 -2
  72. package/dist/webvh/didWebvh.js.map +1 -1
  73. package/dist/webvh/enrollClient.d.ts +4 -1
  74. package/dist/webvh/enrollClient.d.ts.map +1 -1
  75. package/dist/webvh/enrollClient.js +38 -8
  76. package/dist/webvh/enrollClient.js.map +1 -1
  77. package/dist/webvh/index.d.ts +2 -0
  78. package/dist/webvh/index.d.ts.map +1 -1
  79. package/dist/webvh/index.js +1 -0
  80. package/dist/webvh/index.js.map +1 -1
  81. package/dist/webvh/revokeClient.d.ts.map +1 -1
  82. package/dist/webvh/revokeClient.js +4 -6
  83. package/dist/webvh/revokeClient.js.map +1 -1
  84. package/dist/webvh/verifyLog.d.ts +5 -1
  85. package/dist/webvh/verifyLog.d.ts.map +1 -1
  86. package/dist/webvh/verifyLog.js +4 -2
  87. package/dist/webvh/verifyLog.js.map +1 -1
  88. package/package.json +1 -1
@@ -210,6 +210,18 @@ export async function removeRecoveryKey({ idStore, signer, recovery, ladderSeed,
210
210
  * never-published CLIENT's committed hashes, inert orphans in
211
211
  * `nextKeyHashes` exactly as on the self-enrollment seam (keys of a lost
212
212
  * random seed; nothing can reveal them)
213
+ * @param [options.resume] {object} `{ builtOnHead: { scid, versionId } }`
214
+ * -- the resume marker the torn run's pending record recorded, the head
215
+ * the seam handed it. Supplied, each attempt's first read is refused with
216
+ * `BuiltOnHeadNotReachedError` unless the served log carries that SCID and
217
+ * an entry with that `versionId`, as the transient continuation's resume
218
+ * is. The chain-head pin covers the same fork only once it has advanced
219
+ * past the reveal entry, and a tab death between the publish and the
220
+ * pin's advance leaves the pin one entry short, so the marker is what
221
+ * refuses a served log truncated to the pre-reveal head, where the
222
+ * completion check would otherwise build a second reveal entry. Both
223
+ * members must be non-empty strings; a malformed marker is refused with a
224
+ * `TypeError` before any read
213
225
  * @param [options.expectedDid] {string} the account DID the log must resolve
214
226
  * to, where the recovering flow already knows it. Every read both entries
215
227
  * are built on is checked against the store's own chain-head pin (a served
@@ -247,7 +259,7 @@ export async function recoverWebvhClient(options) {
247
259
  signingKeyMultibase: options.newClientKeys.signingKeyMultibase,
248
260
  keyAgreementKeyMultibase: options.newClientKeys.keyAgreementKeyMultibase
249
261
  });
250
- const { newClientKeys, newClientUpdateSeeds, onCommitted, expectedDid, ...shared } = options;
262
+ const { newClientKeys, newClientUpdateSeeds, onCommitted, resume, expectedDid, ...shared } = options;
251
263
  // One run outside the conflict retry: a lost compare-and-swap re-enters
252
264
  // the body under the same run, and the emitter reports each stage once.
253
265
  const events = ceremonyEvents({
@@ -281,6 +293,7 @@ export async function recoverWebvhClient(options) {
281
293
  });
282
294
  return { methods, ...relations };
283
295
  },
296
+ ...(resume !== undefined ? { builtOnHead: resume.builtOnHead } : {}),
284
297
  ...(expectedDid !== undefined ? { expectedDid } : {}),
285
298
  events
286
299
  })), spendOutcome);
@@ -1 +1 @@
1
- {"version":3,"file":"recoveryWebvh.js","sourceRoot":"","sources":["../../src/recovery/recoveryWebvh.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,sBAAsB,CAAA;AAM7B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG9E,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,YAAY,EACb,MAAM,mBAAmB,CAAA;AAQ1B,0EAA0E;AAC1E,0DAA0D;AAC1D,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAC/B,4BAA4B,EAC5B,YAAY,EACZ,6BAA6B,EAC9B,MAAM,mBAAmB,CAAA;AAQ1B;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,WAAW;IACX,iBAAiB;IACjB,iBAAiB;CACT,CAAA;AAQV;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,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CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,MAAM;KACP,CAAC,CACH,EACH,YAAY,CACb,CAAA;IACD,uEAAuE;IACvE,gDAAgD;IAChD,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IACjD,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -5,9 +5,9 @@
5
5
  * The last-write-wins conflict rule for the mutable `contacts` head
6
6
  * collection. Every other synced collection is immutable and content-addressed,
7
7
  * so a write-write conflict is impossible there. A contact head document is
8
- * genuinely overwritten in place under a stable row id, so two replicas CAN
9
- * race on the same row -- and a remote-master-always default would silently
10
- * drop one side's edit.
8
+ * genuinely overwritten in place under a stable resource id, so two replicas
9
+ * CAN race on the same resource -- and a remote-master-always default would
10
+ * silently drop one side's edit.
11
11
  *
12
12
  * The rule lives here rather than in `@interop/social-core` because deciding
13
13
  * it means DECRYPTING both sides: a head payload rides inside an encrypted
@@ -59,7 +59,7 @@ import { type ContactHeadPayload } from '@interop/social-core';
59
59
  */
60
60
  export type ContactConflictWinner = 'remote' | 'local';
61
61
  /**
62
- * Recovers a validated head payload from a stored row body: decrypts an
62
+ * Recovers a validated head payload from a stored body: decrypts an
63
63
  * envelope, passes plaintext through, and resolves `undefined` when the
64
64
  * payload (and so the fields the rule compares) cannot be reached.
65
65
  *
@@ -69,13 +69,13 @@ export type ContactConflictWinner = 'remote' | 'local';
69
69
  * side leaves the reachable local body to win. Neither side is ever compared on
70
70
  * a body it could not open.
71
71
  *
72
- * The decrypt is addressed with the row's own id, and an envelope sealed for
72
+ * The decrypt is addressed with the resource's own id, and an envelope sealed for
73
73
  * another resource is refused with an `IntegrityError` rather than read as one
74
74
  * more unreachable side. That refusal is rethrown, out of the resolver and into
75
75
  * the replication cycle. See the module doc.
76
76
  *
77
77
  * @param options {object}
78
- * @param options.id {string} the contact head row's resource id, the id the
78
+ * @param options.id {string} the contact head's resource id, the id the
79
79
  * stored envelope must be sealed for
80
80
  * @param options.data {Json} the stored body: an encrypted envelope or a
81
81
  * plaintext payload
@@ -94,10 +94,10 @@ export declare function contactHeadPayloadOf({ id, data, cipher }: {
94
94
  * Decides a contact-head conflict. See the module doc for the fail-safe rule.
95
95
  *
96
96
  * @param options {object}
97
- * @param options.id {string} the contested row's resource id, which both
97
+ * @param options.id {string} the contested resource's id, which both
98
98
  * sides' envelopes must be sealed for
99
- * @param options.remote {Json} the remote (master) row body
100
- * @param options.local {Json} the local row body
99
+ * @param options.remote {Json} the remote (master) body
100
+ * @param options.local {Json} the local resource replica's body
101
101
  * @param [options.cipher] {DocCipher} the collection's document cipher
102
102
  * @param [options.remoteDeleted] {boolean} the remote side is a tombstone
103
103
  * @param [options.localDeleted] {boolean} the local side is a tombstone
@@ -5,9 +5,9 @@
5
5
  * The last-write-wins conflict rule for the mutable `contacts` head
6
6
  * collection. Every other synced collection is immutable and content-addressed,
7
7
  * so a write-write conflict is impossible there. A contact head document is
8
- * genuinely overwritten in place under a stable row id, so two replicas CAN
9
- * race on the same row -- and a remote-master-always default would silently
10
- * drop one side's edit.
8
+ * genuinely overwritten in place under a stable resource id, so two replicas
9
+ * CAN race on the same resource -- and a remote-master-always default would
10
+ * silently drop one side's edit.
11
11
  *
12
12
  * The rule lives here rather than in `@interop/social-core` because deciding
13
13
  * it means DECRYPTING both sides: a head payload rides inside an encrypted
@@ -55,7 +55,7 @@
55
55
  import { isEncryptedEnvelope, isIntegrityError } from '@interop/was-client/sync';
56
56
  import { isContactHeadPayload, remotePayloadWins } from '@interop/social-core';
57
57
  /**
58
- * Recovers a validated head payload from a stored row body: decrypts an
58
+ * Recovers a validated head payload from a stored body: decrypts an
59
59
  * envelope, passes plaintext through, and resolves `undefined` when the
60
60
  * payload (and so the fields the rule compares) cannot be reached.
61
61
  *
@@ -65,13 +65,13 @@ import { isContactHeadPayload, remotePayloadWins } from '@interop/social-core';
65
65
  * side leaves the reachable local body to win. Neither side is ever compared on
66
66
  * a body it could not open.
67
67
  *
68
- * The decrypt is addressed with the row's own id, and an envelope sealed for
68
+ * The decrypt is addressed with the resource's own id, and an envelope sealed for
69
69
  * another resource is refused with an `IntegrityError` rather than read as one
70
70
  * more unreachable side. That refusal is rethrown, out of the resolver and into
71
71
  * the replication cycle. See the module doc.
72
72
  *
73
73
  * @param options {object}
74
- * @param options.id {string} the contact head row's resource id, the id the
74
+ * @param options.id {string} the contact head's resource id, the id the
75
75
  * stored envelope must be sealed for
76
76
  * @param options.data {Json} the stored body: an encrypted envelope or a
77
77
  * plaintext payload
@@ -106,10 +106,10 @@ export async function contactHeadPayloadOf({ id, data, cipher }) {
106
106
  * Decides a contact-head conflict. See the module doc for the fail-safe rule.
107
107
  *
108
108
  * @param options {object}
109
- * @param options.id {string} the contested row's resource id, which both
109
+ * @param options.id {string} the contested resource's id, which both
110
110
  * sides' envelopes must be sealed for
111
- * @param options.remote {Json} the remote (master) row body
112
- * @param options.local {Json} the local row body
111
+ * @param options.remote {Json} the remote (master) body
112
+ * @param options.local {Json} the local resource replica's body
113
113
  * @param [options.cipher] {DocCipher} the collection's document cipher
114
114
  * @param [options.remoteDeleted] {boolean} the remote side is a tombstone
115
115
  * @param [options.localDeleted] {boolean} the local side is a tombstone
@@ -84,8 +84,8 @@ export interface SyncEngineDeps {
84
84
  * provisioning and the migration sweep, so no pending envelope sealed under
85
85
  * a losing epoch reaches the push: the consumer builds its cipher from the
86
86
  * descriptor provisioning settled on and runs `remintPendingEnvelopes`
87
- * (`remint.ts`) with it. The re-mint decides per row from the envelope
88
- * itself, so in the settled case the call is free. A lazy minter, whose
87
+ * (`remint.ts`) with it. The re-mint decides per resource replica from the
88
+ * envelope itself, so in the settled case the call is free. A lazy minter, whose
89
89
  * envelopes are always minted under the settled descriptor, leaves it
90
90
  * absent.
91
91
  */
@@ -168,7 +168,7 @@ export declare class SyncEngine {
168
168
  invalidateProvisioning(): void;
169
169
  /**
170
170
  * Stops the engine: aborts any in-flight cycle (the injected signal unwinds
171
- * pull/push between pages/rows), cancels a pending retry, and resets to idle.
171
+ * pull/push between pages and resource replicas), cancels a pending retry, and resets to idle.
172
172
  * The caller drops the cached agents/ciphers so key material does not outlive
173
173
  * the unlocked session.
174
174
  */
@@ -68,7 +68,7 @@ export class SyncEngine {
68
68
  }
69
69
  /**
70
70
  * Stops the engine: aborts any in-flight cycle (the injected signal unwinds
71
- * pull/push between pages/rows), cancels a pending retry, and resets to idle.
71
+ * pull/push between pages and resource replicas), cancels a pending retry, and resets to idle.
72
72
  * The caller drops the cached agents/ciphers so key material does not outlive
73
73
  * the unlocked session.
74
74
  */
@@ -177,8 +177,8 @@ export class SyncEngine {
177
177
  if (signal.aborted) {
178
178
  return;
179
179
  }
180
- // A resolved last-write-wins conflict may leave a row dirty (local-wins
181
- // re-encrypt); rerun this run so the re-push settles instead of waiting for
180
+ // A resolved last-write-wins conflict may leave a resource replica dirty
181
+ // (local-wins re-encrypt); rerun this run so the re-push settles instead of waiting for
182
182
  // the next external trigger. Idempotent once the conflict clears.
183
183
  if (conflictsResolved > 0) {
184
184
  this.rerunRequested = true;
@@ -1 +1 @@
1
- {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/sync/engine.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,kBAAkB,GAAG,GAAG,CAAA;AAC9B,MAAM,qBAAqB,GAAG,KAAK,CAAA;AACnC,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAmHnC,SAAS,eAAe,CAAC,EAAc,EAAE,OAAe;IACtD,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IACrC,OAAO,GAAG,EAAE,CAAC,YAAY,CAA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E;YACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;YACvB,KAAK,IAAI,CAAC,IAAI,EAAE,CAAA;QAClB,CAAC,EAAE,KAAK,CAAC,CAAA;IACX,CAAC;IAEO,UAAU;QAChB,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;YAC9B,IAAI,CAAC,WAAW,EAAE,CAAA;YAClB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;QACzB,CAAC;IACH,CAAC;IAEO,SAAS,CAAC,MAAkB;QAClC,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC3B,OAAM;QACR,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,CAAA;IACpC,CAAC;CACF"}
@@ -18,8 +18,8 @@
18
18
  * `isSyncNotFoundError` / `isUnknownEpochError`) and the `SyncStatus`
19
19
  * vocabulary ship from `@interop/was-client/sync` too. They are imported
20
20
  * from there rather than re-exported here: one owner per name.
21
- * - `SyncStore` / `SyncedRow` / `ProjectionAction` / `ResolveConflict` are the
22
- * replica-side persistence seam.
21
+ * - `SyncStore` / `SyncedResourceReplica` / `ProjectionAction` /
22
+ * `ResolveConflict` are the replica-side persistence seam.
23
23
  * - `runPull` / `projectionForDoc`, `runPush`, and `SyncEngine` are the pull,
24
24
  * push, and orchestration algorithms.
25
25
  * - `remintPendingEnvelopes` is the create-loss re-mint for an eager-minting
@@ -38,7 +38,7 @@
38
38
  */
39
39
  export { UnknownEpochError, WasSyncConflictError, WasSyncNotFoundError } from '@interop/was-client/sync';
40
40
  export type { Json, SyncCheckpoint, WireDoc, MasterState, WriteAck, WasSyncPort, DocCipher } from '@interop/was-client/sync';
41
- export type { SyncStore, SyncedRow, ProjectionAction, ResolveConflict } from './types.js';
41
+ export type { SyncStore, SyncedResourceReplica, ProjectionAction, ResolveConflict } from './types.js';
42
42
  export { runPull, projectionForDoc } from './pull.js';
43
43
  export { runPush } from './push.js';
44
44
  export { remintPendingEnvelopes } from './remint.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,0BAA0B,CAAA;AACjC,YAAY,EACV,IAAI,EACJ,cAAc,EACd,OAAO,EACP,WAAW,EACX,QAAQ,EACR,WAAW,EACX,SAAS,EACV,MAAM,0BAA0B,CAAA;AAEjC,YAAY,EACV,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAE5D,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,0BAA0B,CAAA;AACjC,YAAY,EACV,IAAI,EACJ,cAAc,EACd,OAAO,EACP,WAAW,EACX,QAAQ,EACR,WAAW,EACX,SAAS,EACV,MAAM,0BAA0B,CAAA;AAEjC,YAAY,EACV,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EAChB,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAE5D,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA"}
@@ -18,8 +18,8 @@
18
18
  * `isSyncNotFoundError` / `isUnknownEpochError`) and the `SyncStatus`
19
19
  * vocabulary ship from `@interop/was-client/sync` too. They are imported
20
20
  * from there rather than re-exported here: one owner per name.
21
- * - `SyncStore` / `SyncedRow` / `ProjectionAction` / `ResolveConflict` are the
22
- * replica-side persistence seam.
21
+ * - `SyncStore` / `SyncedResourceReplica` / `ProjectionAction` /
22
+ * `ResolveConflict` are the replica-side persistence seam.
23
23
  * - `runPull` / `projectionForDoc`, `runPush`, and `SyncEngine` are the pull,
24
24
  * push, and orchestration algorithms.
25
25
  * - `remintPendingEnvelopes` is the create-loss re-mint for an eager-minting
@@ -7,7 +7,7 @@ import type { Json, ProjectionAction, SyncStore, WasSyncPort, WireDoc } from './
7
7
  *
8
8
  * Decryption runs here, outside the store transaction, so a slow/failing decrypt
9
9
  * never holds the store's write lock. A document whose body cannot be decrypted
10
- * (legacy plaintext row, corrupt/foreign envelope, key mismatch) is skipped with
10
+ * (legacy plaintext body, corrupt/foreign envelope, key mismatch) is skipped with
11
11
  * a `none` projection rather than throwing: the body is still stored and the
12
12
  * checkpoint advances past it, so one poison document can never permanently
13
13
  * wedge the feed for the whole replica. A document that decrypts but fails the
@@ -15,17 +15,17 @@ import type { Json, ProjectionAction, SyncStore, WasSyncPort, WireDoc } from './
15
15
  * possibly a buggy or schema-incompatible writer) is skipped the same way:
16
16
  * stored, checkpoint advanced, never projected.
17
17
  *
18
- * The decrypt is addressed: the feed row's own `id` goes to `decryptDoc`, and
18
+ * The decrypt is addressed: the feed document's own `id` goes to `decryptDoc`, and
19
19
  * the cipher refuses an envelope sealed for some other resource with was-
20
20
  * client's `IntegrityError`. That refusal has two causes and the reader
21
21
  * cannot tell them apart: a host that moved one resource's stored envelope
22
- * under another resource's id, and a row minted by a writer that predates
23
- * addressed sealing (the legacy contacts rows
22
+ * under another resource's id, and a document minted by a writer that
23
+ * predates addressed sealing (the legacy contacts documents
24
24
  * `docs/cross-replica-sync-compatibility.md` records as a stated loss, which
25
25
  * every fresh replica bootstrap re-reads). It is logged apart from the
26
26
  * ordinary undecryptable skip so a caller can count it, but the benign cause
27
27
  * is the common one and an alert on it needs a rate rather than a single
28
- * event. The projection outcome is the same `none`: the row is not applied,
28
+ * event. The projection outcome is the same `none`: the document is not applied,
29
29
  * the body is still stored, and the checkpoint advances past it.
30
30
  *
31
31
  * @param doc {WireDoc}
package/dist/sync/pull.js CHANGED
@@ -41,7 +41,7 @@ import { log } from '../log.js';
41
41
  *
42
42
  * Decryption runs here, outside the store transaction, so a slow/failing decrypt
43
43
  * never holds the store's write lock. A document whose body cannot be decrypted
44
- * (legacy plaintext row, corrupt/foreign envelope, key mismatch) is skipped with
44
+ * (legacy plaintext body, corrupt/foreign envelope, key mismatch) is skipped with
45
45
  * a `none` projection rather than throwing: the body is still stored and the
46
46
  * checkpoint advances past it, so one poison document can never permanently
47
47
  * wedge the feed for the whole replica. A document that decrypts but fails the
@@ -49,17 +49,17 @@ import { log } from '../log.js';
49
49
  * possibly a buggy or schema-incompatible writer) is skipped the same way:
50
50
  * stored, checkpoint advanced, never projected.
51
51
  *
52
- * The decrypt is addressed: the feed row's own `id` goes to `decryptDoc`, and
52
+ * The decrypt is addressed: the feed document's own `id` goes to `decryptDoc`, and
53
53
  * the cipher refuses an envelope sealed for some other resource with was-
54
54
  * client's `IntegrityError`. That refusal has two causes and the reader
55
55
  * cannot tell them apart: a host that moved one resource's stored envelope
56
- * under another resource's id, and a row minted by a writer that predates
57
- * addressed sealing (the legacy contacts rows
56
+ * under another resource's id, and a document minted by a writer that
57
+ * predates addressed sealing (the legacy contacts documents
58
58
  * `docs/cross-replica-sync-compatibility.md` records as a stated loss, which
59
59
  * every fresh replica bootstrap re-reads). It is logged apart from the
60
60
  * ordinary undecryptable skip so a caller can count it, but the benign cause
61
61
  * is the common one and an alert on it needs a rate rather than a single
62
- * event. The projection outcome is the same `none`: the row is not applied,
62
+ * event. The projection outcome is the same `none`: the document is not applied,
63
63
  * the body is still stored, and the checkpoint advances past it.
64
64
  *
65
65
  * @param doc {WireDoc}
@@ -1,9 +1,10 @@
1
1
  import type { ResolveConflict, SyncStore, WasSyncPort } from './types.js';
2
2
  /**
3
- * Pushes every dirty row for one feed, sequentially (bounds sockets/CPU, and
4
- * keeps conflict reconciliation deterministic). Honors `signal` between rows.
5
- * A non-conflict error from any row propagates so the engine aborts the cycle
6
- * and backs off; already-pushed rows in the batch stay settled.
3
+ * Pushes every dirty resource replica for one feed, sequentially (bounds
4
+ * sockets/CPU, and keeps conflict reconciliation deterministic). Honors
5
+ * `signal` between resource replicas. A non-conflict error from any resource
6
+ * replica propagates so the engine aborts the cycle and backs off;
7
+ * already-pushed resource replicas in the batch stay settled.
7
8
  *
8
9
  * @param options {object}
9
10
  * @param options.port {WasSyncPort}
@@ -12,8 +13,8 @@ import type { ResolveConflict, SyncStore, WasSyncPort } from './types.js';
12
13
  * @param [options.writerId] {string} this writer's attribution label, sent
13
14
  * as `Writer-Id` on every write and delete; absent sends none
14
15
  * @param [options.signal] {AbortSignal}
15
- * @returns {Promise<{ pushed: number; conflictsResolved: number }>} dirty rows
16
- * processed this cycle, and how many invoked the LWW resolver (a positive
16
+ * @returns {Promise<{ pushed: number; conflictsResolved: number }>} dirty
17
+ * resource replicas processed this cycle, and how many invoked the LWW resolver (a positive
17
18
  * count means the caller should rerun so a local-wins re-push settles)
18
19
  */
19
20
  export declare function runPush({ port, store, resolveConflict, writerId, signal }: {
@@ -1 +1 @@
1
- {"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/sync/push.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAQ,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAqM/E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,OAAO,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,eAAe,EACf,QAAQ,EACR,MAAM,EACP,EAAE;IACD,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,SAAS,CAAA;IAChB,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC,CAyBzD"}
1
+ {"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/sync/push.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAQ,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AA0M/E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,OAAO,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,eAAe,EACf,QAAQ,EACR,MAAM,EACP,EAAE;IACD,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,SAAS,CAAA;IAChB,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC,CAyBzD"}
package/dist/sync/push.js CHANGED
@@ -2,23 +2,23 @@
2
2
  * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
3
  */
4
4
  /**
5
- * The push side of the WAS replication engine core: fan each dirty local row out
6
- * to a conditional WAS write, then reconcile per the content-addressed conflict
7
- * table.
5
+ * The push side of the WAS replication engine core: fan each dirty local
6
+ * resource replica out to a conditional WAS write, then reconcile per the
7
+ * content-addressed conflict table.
8
8
  *
9
- * On a content-addressed collection an id's `data` never mutates, so a live row
10
- * only ever pushes as a create (`If-None-Match: *`) and a tombstone as a delete;
11
- * there is no update path. A mutable (last-write-wins) collection pushes a live
12
- * row as a create while never-acked (`version 0`) and as an in-place update
13
- * (`If-Match`) once acked, and settles a `412` through its injected
14
- * {@link ResolveConflict} policy.
9
+ * On a content-addressed collection an id's `data` never mutates, so a live
10
+ * resource replica only ever pushes as a create (`If-None-Match: *`) and a
11
+ * tombstone as a delete; there is no update path. A mutable (last-write-wins)
12
+ * collection pushes a live resource replica as a create while never-acked
13
+ * (`version 0`) and as an in-place update (`If-Match`) once acked, and settles
14
+ * a `412` through its injected {@link ResolveConflict} policy.
15
15
  *
16
16
  * This loop covers the CONTENT sub-resource only (`data` / `version`, at
17
17
  * `PUT/DELETE /:id`). It does not drive the independently-versioned METADATA
18
18
  * sub-resource (`custom` / `metaVersion`, at `PUT /:id/meta`): a replica that
19
19
  * syncs user-writable metadata (the web wallet's RxDB driver, via
20
- * `WasSyncPort.putMeta`) keeps that half in its own push handler. It is left out
21
- * of this core deliberately -- none of the wallet Space collections
20
+ * `WasSyncPort.putMeta`) keeps that half in its own push handler. It is left
21
+ * out of this core deliberately -- none of the wallet Space collections
22
22
  * (`private-credentials`, `public-credentials`, `wallet-activity`, `contacts`,
23
23
  * `contacts-history`) versions its metadata independently of its content, so
24
24
  * folding a `putMeta` diff into this loop would add an untested code path with
@@ -34,14 +34,15 @@
34
34
  */
35
35
  import { isSyncConflictError, isSyncNotFoundError } from '@interop/was-client/sync';
36
36
  /**
37
- * Pushes a dirty live row. A never-acked row (`version 0`) is a create
38
- * (`PUT /:id` with `If-None-Match: *`); an acked row (`version > 0`) is an
39
- * in-place update (`If-Match` over its stored `etag`, echoed back verbatim --
40
- * absent only against a backend that never returned one) -- reachable only on
41
- * a mutable collection, since a content-addressed row never mutates in place.
42
- * On success the acked `version` / `etag` are recorded and the row goes clean
43
- * -- unless a local write landed while the write was in flight, which the
44
- * row's `revision` token detects (see {@link SyncStore.markPushed}) so the
37
+ * Pushes a dirty live resource replica. A never-acked resource replica
38
+ * (`version 0`) is a create (`PUT /:id` with `If-None-Match: *`); an acked
39
+ * resource replica (`version > 0`) is an in-place update (`If-Match` over its
40
+ * stored `etag`, echoed back verbatim -- absent only against a backend that
41
+ * never returned one) -- reachable only on a mutable collection, since a
42
+ * content-addressed resource replica never mutates in place. On success the
43
+ * acked `version` / `etag` are recorded and the resource replica goes clean --
44
+ * unless a local write landed while the write was in flight, which the resource
45
+ * replica's `revision` token detects (see {@link SyncStore.markPushed}) so the
45
46
  * newer write stays dirty for the rerun cycle.
46
47
  *
47
48
  * A `412` is settled by the collection's policy:
@@ -53,19 +54,21 @@ import { isSyncConflictError, isSyncNotFoundError } from '@interop/was-client/sy
53
54
  * absent/tombstone -> deletion wins, adopt the tombstone and delete the
54
55
  * projection (a later re-add re-encrypts to a fresh id, so nothing is blocked).
55
56
  */
56
- async function pushUpsert({ port, store, row, resolveConflict, writerId }) {
57
+ async function pushUpsert({ port, store, replica, resolveConflict, writerId }) {
57
58
  try {
58
59
  const ack = await port.putContent({
59
- id: row.id,
60
- data: row.data ?? null,
61
- ...(row.version > 0 ? { ifMatch: row.etag } : { ifNoneMatch: true }),
60
+ id: replica.id,
61
+ data: replica.data ?? null,
62
+ ...(replica.version > 0
63
+ ? { ifMatch: replica.etag }
64
+ : { ifNoneMatch: true }),
62
65
  ...(writerId !== undefined && { writerId })
63
66
  });
64
67
  await store.markPushed({
65
- id: row.id,
68
+ id: replica.id,
66
69
  version: ack.version,
67
70
  etag: ack.etag,
68
- ...(row.revision !== undefined && { revision: row.revision })
71
+ ...(replica.revision !== undefined && { revision: replica.revision })
69
72
  });
70
73
  return { conflictResolved: false };
71
74
  }
@@ -75,26 +78,27 @@ async function pushUpsert({ port, store, row, resolveConflict, writerId }) {
75
78
  }
76
79
  if (resolveConflict) {
77
80
  await resolveConflict({
78
- id: row.id,
79
- version: row.version,
80
- data: row.data
81
+ id: replica.id,
82
+ version: replica.version,
83
+ data: replica.data
81
84
  });
82
- // The resolver may have left the row dirty (local-wins re-encrypt); the
83
- // caller reruns so the re-push settles within the same sync run.
85
+ // The resolver may have left the resource replica dirty (local-wins
86
+ // re-encrypt); the caller reruns so the re-push settles within the same
87
+ // sync run.
84
88
  return { conflictResolved: true };
85
89
  }
86
- const master = await port.get({ id: row.id });
90
+ const master = await port.get({ id: replica.id });
87
91
  // An absent or tombstoned resource surfaces as `get` resolving null.
88
92
  if (master === null) {
89
93
  await store.adoptLatest({
90
- id: row.id,
94
+ id: replica.id,
91
95
  latest: null,
92
96
  projection: { kind: 'delete' }
93
97
  });
94
98
  }
95
99
  else {
96
100
  await store.adoptLatest({
97
- id: row.id,
101
+ id: replica.id,
98
102
  latest: master,
99
103
  projection: { kind: 'none' }
100
104
  });
@@ -136,51 +140,53 @@ async function tryDelete({ port, store, id, ifMatch, revision, writerId }) {
136
140
  }
137
141
  }
138
142
  /**
139
- * Pushes a dirty tombstone. `DELETE /:id` with `If-Match` over the row's stored
140
- * `etag` when the row was ever acked (`version > 0`), unconditional otherwise:
143
+ * Pushes a dirty tombstone. `DELETE /:id` with `If-Match` over the resource
144
+ * replica's stored `etag` when the resource replica was ever acked (`version >
145
+ * 0`), unconditional otherwise:
141
146
  * - `204` / `404` -> settled (clean).
142
147
  * - `412` then master absent/tombstone -> delete/delete race, settled.
143
148
  * - `412` then master live -> retry once with the master's fresh `etag`; a
144
- * second `412` leaves the row dirty for the next cycle (the next pull
145
- * refreshes its `version` / `etag` via the dirty-deleted-vs-live rule, so the
146
- * retry's `If-Match` becomes current).
149
+ * second `412` leaves the resource replica dirty for the next cycle (the next
150
+ * pull refreshes its `version` / `etag` via the dirty-deleted-vs-live rule,
151
+ * so the retry's `If-Match` becomes current).
147
152
  */
148
- async function pushDelete({ port, store, row, writerId }) {
149
- const revisionAck = row.revision !== undefined ? { revision: row.revision } : {};
150
- const firstIfMatch = row.version > 0 ? row.etag : undefined;
153
+ async function pushDelete({ port, store, replica, writerId }) {
154
+ const revisionAck = replica.revision !== undefined ? { revision: replica.revision } : {};
155
+ const firstIfMatch = replica.version > 0 ? replica.etag : undefined;
151
156
  if (await tryDelete({
152
157
  port,
153
158
  store,
154
- id: row.id,
159
+ id: replica.id,
155
160
  ifMatch: firstIfMatch,
156
161
  writerId,
157
162
  ...revisionAck
158
163
  })) {
159
164
  return;
160
165
  }
161
- const master = await port.get({ id: row.id });
166
+ const master = await port.get({ id: replica.id });
162
167
  if (master === null) {
163
168
  // delete/delete race -- the resource is already a tombstone / absent.
164
- await store.markDeletedPushed({ id: row.id, ...revisionAck });
169
+ await store.markDeletedPushed({ id: replica.id, ...revisionAck });
165
170
  return;
166
171
  }
167
- // Second attempt with the master's current etag. If it too hits 412 we
168
- // simply leave the row dirty (tryDelete returned false and made no store
169
- // write).
172
+ // Second attempt with the master's current etag. If it too hits 412 we simply
173
+ // leave the resource replica dirty (tryDelete returned false and made no
174
+ // store write).
170
175
  await tryDelete({
171
176
  port,
172
177
  store,
173
- id: row.id,
178
+ id: replica.id,
174
179
  ifMatch: master.etag,
175
180
  writerId,
176
181
  ...revisionAck
177
182
  });
178
183
  }
179
184
  /**
180
- * Pushes every dirty row for one feed, sequentially (bounds sockets/CPU, and
181
- * keeps conflict reconciliation deterministic). Honors `signal` between rows.
182
- * A non-conflict error from any row propagates so the engine aborts the cycle
183
- * and backs off; already-pushed rows in the batch stay settled.
185
+ * Pushes every dirty resource replica for one feed, sequentially (bounds
186
+ * sockets/CPU, and keeps conflict reconciliation deterministic). Honors
187
+ * `signal` between resource replicas. A non-conflict error from any resource
188
+ * replica propagates so the engine aborts the cycle and backs off;
189
+ * already-pushed resource replicas in the batch stay settled.
184
190
  *
185
191
  * @param options {object}
186
192
  * @param options.port {WasSyncPort}
@@ -189,26 +195,26 @@ async function pushDelete({ port, store, row, writerId }) {
189
195
  * @param [options.writerId] {string} this writer's attribution label, sent
190
196
  * as `Writer-Id` on every write and delete; absent sends none
191
197
  * @param [options.signal] {AbortSignal}
192
- * @returns {Promise<{ pushed: number; conflictsResolved: number }>} dirty rows
193
- * processed this cycle, and how many invoked the LWW resolver (a positive
198
+ * @returns {Promise<{ pushed: number; conflictsResolved: number }>} dirty
199
+ * resource replicas processed this cycle, and how many invoked the LWW resolver (a positive
194
200
  * count means the caller should rerun so a local-wins re-push settles)
195
201
  */
196
202
  export async function runPush({ port, store, resolveConflict, writerId, signal }) {
197
- const rows = await store.getDirtyRows();
203
+ const replicas = await store.getDirtyResourceReplicas();
198
204
  let pushed = 0;
199
205
  let conflictsResolved = 0;
200
- for (const row of rows) {
206
+ for (const replica of replicas) {
201
207
  if (signal?.aborted) {
202
208
  break;
203
209
  }
204
- if (row.deleted) {
205
- await pushDelete({ port, store, row, writerId });
210
+ if (replica.deleted) {
211
+ await pushDelete({ port, store, replica, writerId });
206
212
  }
207
213
  else {
208
214
  const { conflictResolved } = await pushUpsert({
209
215
  port,
210
216
  store,
211
- row,
217
+ replica,
212
218
  resolveConflict,
213
219
  writerId
214
220
  });