@optimystic/db-core 1.0.0-beta.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/dist/src/cluster/structs.d.ts +62 -16
  2. package/dist/src/cluster/structs.d.ts.map +1 -1
  3. package/dist/src/cluster/structs.js +5 -3
  4. package/dist/src/cluster/structs.js.map +1 -1
  5. package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.d.ts +2 -1
  6. package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.d.ts.map +1 -1
  7. package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.js +10 -3
  8. package/dist/src/cohort-topic/antidos/bootstrap-evidence-envelope.js.map +1 -1
  9. package/dist/src/cohort-topic/wire/codec.d.ts.map +1 -1
  10. package/dist/src/cohort-topic/wire/codec.js +8 -2
  11. package/dist/src/cohort-topic/wire/codec.js.map +1 -1
  12. package/dist/src/collection/collection.d.ts +467 -35
  13. package/dist/src/collection/collection.d.ts.map +1 -1
  14. package/dist/src/collection/collection.js +879 -149
  15. package/dist/src/collection/collection.js.map +1 -1
  16. package/dist/src/collection/struct.d.ts +109 -4
  17. package/dist/src/collection/struct.d.ts.map +1 -1
  18. package/dist/src/collection/struct.js +88 -1
  19. package/dist/src/collection/struct.js.map +1 -1
  20. package/dist/src/collections/diary/diary.d.ts +6 -2
  21. package/dist/src/collections/diary/diary.d.ts.map +1 -1
  22. package/dist/src/collections/diary/diary.js +5 -2
  23. package/dist/src/collections/diary/diary.js.map +1 -1
  24. package/dist/src/collections/tree/struct.d.ts +192 -5
  25. package/dist/src/collections/tree/struct.d.ts.map +1 -1
  26. package/dist/src/collections/tree/struct.js +134 -0
  27. package/dist/src/collections/tree/struct.js.map +1 -1
  28. package/dist/src/collections/tree/tree.d.ts +13 -3
  29. package/dist/src/collections/tree/tree.d.ts.map +1 -1
  30. package/dist/src/collections/tree/tree.js +109 -6
  31. package/dist/src/collections/tree/tree.js.map +1 -1
  32. package/dist/src/index.d.ts +2 -1
  33. package/dist/src/index.d.ts.map +1 -1
  34. package/dist/src/index.js +2 -1
  35. package/dist/src/index.js.map +1 -1
  36. package/dist/src/logger-registry.d.ts +57 -0
  37. package/dist/src/logger-registry.d.ts.map +1 -0
  38. package/dist/src/logger-registry.js +168 -0
  39. package/dist/src/logger-registry.js.map +1 -0
  40. package/dist/src/logger.d.ts.map +1 -1
  41. package/dist/src/logger.js +3 -0
  42. package/dist/src/logger.js.map +1 -1
  43. package/dist/src/matchmaking/wire.d.ts.map +1 -1
  44. package/dist/src/matchmaking/wire.js +8 -2
  45. package/dist/src/matchmaking/wire.js.map +1 -1
  46. package/dist/src/network/durability.d.ts +45 -0
  47. package/dist/src/network/durability.d.ts.map +1 -0
  48. package/dist/src/network/durability.js +114 -0
  49. package/dist/src/network/durability.js.map +1 -0
  50. package/dist/src/network/i-key-network.d.ts +14 -6
  51. package/dist/src/network/i-key-network.d.ts.map +1 -1
  52. package/dist/src/network/index.d.ts +3 -0
  53. package/dist/src/network/index.d.ts.map +1 -1
  54. package/dist/src/network/index.js +3 -0
  55. package/dist/src/network/index.js.map +1 -1
  56. package/dist/src/network/lineage.d.ts +39 -0
  57. package/dist/src/network/lineage.d.ts.map +1 -0
  58. package/dist/src/network/lineage.js +61 -0
  59. package/dist/src/network/lineage.js.map +1 -0
  60. package/dist/src/network/routing-key.d.ts +24 -0
  61. package/dist/src/network/routing-key.d.ts.map +1 -0
  62. package/dist/src/network/routing-key.js +9 -0
  63. package/dist/src/network/routing-key.js.map +1 -0
  64. package/dist/src/network/stale-failure.d.ts +5 -1
  65. package/dist/src/network/stale-failure.d.ts.map +1 -1
  66. package/dist/src/network/stale-failure.js +5 -1
  67. package/dist/src/network/stale-failure.js.map +1 -1
  68. package/dist/src/network/struct.d.ts +151 -8
  69. package/dist/src/network/struct.d.ts.map +1 -1
  70. package/dist/src/network/struct.js.map +1 -1
  71. package/dist/src/reactivity/wire.d.ts.map +1 -1
  72. package/dist/src/reactivity/wire.js +8 -2
  73. package/dist/src/reactivity/wire.js.map +1 -1
  74. package/dist/src/testing/test-transactor.d.ts +64 -7
  75. package/dist/src/testing/test-transactor.d.ts.map +1 -1
  76. package/dist/src/testing/test-transactor.js +150 -23
  77. package/dist/src/testing/test-transactor.js.map +1 -1
  78. package/dist/src/transaction/coordinator.d.ts +141 -21
  79. package/dist/src/transaction/coordinator.d.ts.map +1 -1
  80. package/dist/src/transaction/coordinator.js +408 -122
  81. package/dist/src/transaction/coordinator.js.map +1 -1
  82. package/dist/src/transaction/errors.d.ts +39 -10
  83. package/dist/src/transaction/errors.d.ts.map +1 -1
  84. package/dist/src/transaction/errors.js +34 -9
  85. package/dist/src/transaction/errors.js.map +1 -1
  86. package/dist/src/transaction/index.d.ts +1 -0
  87. package/dist/src/transaction/index.d.ts.map +1 -1
  88. package/dist/src/transaction/index.js.map +1 -1
  89. package/dist/src/transactor/block-floors.d.ts +78 -0
  90. package/dist/src/transactor/block-floors.d.ts.map +1 -0
  91. package/dist/src/transactor/block-floors.js +62 -0
  92. package/dist/src/transactor/block-floors.js.map +1 -0
  93. package/dist/src/transactor/change-notifier.d.ts +43 -0
  94. package/dist/src/transactor/change-notifier.d.ts.map +1 -1
  95. package/dist/src/transactor/change-notifier.js +3 -0
  96. package/dist/src/transactor/change-notifier.js.map +1 -1
  97. package/dist/src/transactor/index.d.ts +1 -0
  98. package/dist/src/transactor/index.d.ts.map +1 -1
  99. package/dist/src/transactor/index.js +1 -0
  100. package/dist/src/transactor/index.js.map +1 -1
  101. package/dist/src/transactor/network-transactor.d.ts +43 -6
  102. package/dist/src/transactor/network-transactor.d.ts.map +1 -1
  103. package/dist/src/transactor/network-transactor.js +279 -81
  104. package/dist/src/transactor/network-transactor.js.map +1 -1
  105. package/dist/src/transactor/transactor-source.d.ts +94 -4
  106. package/dist/src/transactor/transactor-source.d.ts.map +1 -1
  107. package/dist/src/transactor/transactor-source.js +120 -42
  108. package/dist/src/transactor/transactor-source.js.map +1 -1
  109. package/dist/src/transactor/transactor.d.ts +14 -1
  110. package/dist/src/transactor/transactor.d.ts.map +1 -1
  111. package/dist/src/transform/atomic.d.ts.map +1 -1
  112. package/dist/src/transform/atomic.js +12 -9
  113. package/dist/src/transform/atomic.js.map +1 -1
  114. package/dist/src/transform/base-pins.d.ts +50 -17
  115. package/dist/src/transform/base-pins.d.ts.map +1 -1
  116. package/dist/src/transform/base-pins.js +58 -11
  117. package/dist/src/transform/base-pins.js.map +1 -1
  118. package/dist/src/transform/cache-source.d.ts +75 -11
  119. package/dist/src/transform/cache-source.d.ts.map +1 -1
  120. package/dist/src/transform/cache-source.js +162 -36
  121. package/dist/src/transform/cache-source.js.map +1 -1
  122. package/dist/src/transform/digest.d.ts +8 -1
  123. package/dist/src/transform/digest.d.ts.map +1 -1
  124. package/dist/src/transform/digest.js +19 -9
  125. package/dist/src/transform/digest.js.map +1 -1
  126. package/dist/src/transform/helpers.d.ts +6 -2
  127. package/dist/src/transform/helpers.d.ts.map +1 -1
  128. package/dist/src/transform/helpers.js +8 -3
  129. package/dist/src/transform/helpers.js.map +1 -1
  130. package/dist/src/transform/tracker.d.ts +94 -14
  131. package/dist/src/transform/tracker.d.ts.map +1 -1
  132. package/dist/src/transform/tracker.js +222 -68
  133. package/dist/src/transform/tracker.js.map +1 -1
  134. package/dist/src/utility/structural-equals.d.ts +38 -0
  135. package/dist/src/utility/structural-equals.d.ts.map +1 -0
  136. package/dist/src/utility/structural-equals.js +77 -0
  137. package/dist/src/utility/structural-equals.js.map +1 -0
  138. package/package.json +2 -2
  139. package/src/cluster/structs.ts +298 -255
  140. package/src/cohort-topic/antidos/bootstrap-evidence-envelope.ts +260 -253
  141. package/src/cohort-topic/wire/codec.ts +222 -216
  142. package/src/collection/collection.ts +996 -158
  143. package/src/collection/struct.ts +99 -4
  144. package/src/collections/diary/diary.ts +71 -68
  145. package/src/collections/tree/struct.ts +248 -26
  146. package/src/collections/tree/tree.ts +130 -9
  147. package/src/index.ts +2 -1
  148. package/src/logger-registry.ts +224 -0
  149. package/src/logger.ts +4 -0
  150. package/src/matchmaking/wire.ts +8 -2
  151. package/src/network/durability.ts +123 -0
  152. package/src/network/i-key-network.ts +60 -52
  153. package/src/network/index.ts +10 -7
  154. package/src/network/lineage.ts +80 -0
  155. package/src/network/routing-key.ts +27 -0
  156. package/src/network/stale-failure.ts +5 -1
  157. package/src/network/struct.ts +156 -8
  158. package/src/reactivity/wire.ts +230 -224
  159. package/src/testing/test-transactor.ts +152 -24
  160. package/src/transaction/coordinator.ts +470 -131
  161. package/src/transaction/errors.ts +34 -9
  162. package/src/transaction/index.ts +1 -0
  163. package/src/transactor/block-floors.ts +105 -0
  164. package/src/transactor/change-notifier.ts +129 -80
  165. package/src/transactor/index.ts +1 -0
  166. package/src/transactor/network-transactor.ts +297 -84
  167. package/src/transactor/transactor-source.ts +131 -42
  168. package/src/transactor/transactor.ts +13 -1
  169. package/src/transform/atomic.ts +25 -22
  170. package/src/transform/base-pins.ts +76 -18
  171. package/src/transform/cache-source.ts +327 -194
  172. package/src/transform/digest.ts +21 -10
  173. package/src/transform/helpers.ts +8 -3
  174. package/src/transform/tracker.ts +423 -270
  175. package/src/utility/structural-equals.ts +72 -0
  176. package/dist/src/utility/block-id-to-bytes.d.ts +0 -3
  177. package/dist/src/utility/block-id-to-bytes.d.ts.map +0 -1
  178. package/dist/src/utility/block-id-to-bytes.js +0 -7
  179. package/dist/src/utility/block-id-to-bytes.js.map +0 -1
  180. package/src/utility/block-id-to-bytes.ts +0 -8
@@ -1,7 +1,10 @@
1
1
  export * from "./i-key-network.js";
2
2
  export * from "./i-peer-network.js";
3
+ export * from "./durability.js";
3
4
  export * from "./i-repo.js";
5
+ export * from "./lineage.js";
4
6
  export * from "./repo-protocol.js";
7
+ export * from "./routing-key.js";
5
8
  export * from "./stale-failure.js";
6
9
  export * from "./struct.js";
7
10
  export * from "./types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/network/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/network/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -1,7 +1,10 @@
1
1
  export * from "./i-key-network.js";
2
2
  export * from "./i-peer-network.js";
3
+ export * from "./durability.js";
3
4
  export * from "./i-repo.js";
5
+ export * from "./lineage.js";
4
6
  export * from "./repo-protocol.js";
7
+ export * from "./routing-key.js";
5
8
  export * from "./stale-failure.js";
6
9
  export * from "./struct.js";
7
10
  export * from "./types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/network/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/network/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { ActionRev } from "../collection/action.js";
2
+ import type { BlockLineage, WriteDurability } from "./struct.js";
3
+ /** One cohort member's answer to {@link BlockGets.lineageOf} for one block. A member that could not
4
+ * be asked, or predates the question, is listed with `unknown` — it still counts as a member. */
5
+ export type MemberLineage = {
6
+ peerId: string;
7
+ lineage: BlockLineage;
8
+ /** The newest revision the member holds for the block, as it reported it. */
9
+ latest?: ActionRev;
10
+ };
11
+ /** A block's cohort-level lineage answer, with who holds the write when the answer is `contains`. */
12
+ export type CohortLineage = {
13
+ lineage: BlockLineage;
14
+ durability?: WriteDurability;
15
+ };
16
+ /**
17
+ * The single rule for turning a cohort's per-member lineage answers into one answer for the block.
18
+ *
19
+ * A member can only vouch for history it derived itself, so a member that took a later revision as
20
+ * a replica answers `unknown` even when that replica was built from the write. Such a member is
21
+ * counted WITH a member that did answer when the two hold the same latest revision under the same
22
+ * action: a revision's content is what the cohort agreed on at commit, so two members holding the
23
+ * same one hold the same lineage.
24
+ *
25
+ * - `contains` — a strict majority of the cohort holds content built from the write, the same bar
26
+ * a commit must meet to be acknowledged. Fewer than that is `unknown`, not a smaller `contains`:
27
+ * the write may yet spread from the members that hold it, or be overwritten by the ones that do
28
+ * not, and the writer must not be told either.
29
+ * - `excludes` — at least one member proves it, and EVERY member is accounted for as excluding it
30
+ * or not having reached it. One unaccounted member could be where the write survives.
31
+ * - `behind` — every member answered that it has not reached the revision.
32
+ * - `unknown` — anything else, including members that contradict each other (one proves the write
33
+ * is in its content, another that it is not): the block's content has forked, which is a fault
34
+ * this answer must not paper over in either direction.
35
+ *
36
+ * An empty cohort is `unknown`.
37
+ */
38
+ export declare function judgeCohortLineage(members: readonly MemberLineage[]): CohortLineage;
39
+ //# sourceMappingURL=lineage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lineage.d.ts","sourceRoot":"","sources":["../../../src/network/lineage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEjE;kGACkG;AAClG,MAAM,MAAM,aAAa,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,CAAC;IACtB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,qGAAqG;AACrG,MAAM,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,aAAa,CA+BnF"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * The single rule for turning a cohort's per-member lineage answers into one answer for the block.
3
+ *
4
+ * A member can only vouch for history it derived itself, so a member that took a later revision as
5
+ * a replica answers `unknown` even when that replica was built from the write. Such a member is
6
+ * counted WITH a member that did answer when the two hold the same latest revision under the same
7
+ * action: a revision's content is what the cohort agreed on at commit, so two members holding the
8
+ * same one hold the same lineage.
9
+ *
10
+ * - `contains` — a strict majority of the cohort holds content built from the write, the same bar
11
+ * a commit must meet to be acknowledged. Fewer than that is `unknown`, not a smaller `contains`:
12
+ * the write may yet spread from the members that hold it, or be overwritten by the ones that do
13
+ * not, and the writer must not be told either.
14
+ * - `excludes` — at least one member proves it, and EVERY member is accounted for as excluding it
15
+ * or not having reached it. One unaccounted member could be where the write survives.
16
+ * - `behind` — every member answered that it has not reached the revision.
17
+ * - `unknown` — anything else, including members that contradict each other (one proves the write
18
+ * is in its content, another that it is not): the block's content has forked, which is a fault
19
+ * this answer must not paper over in either direction.
20
+ *
21
+ * An empty cohort is `unknown`.
22
+ */
23
+ export function judgeCohortLineage(members) {
24
+ const provers = members.filter(m => m.lineage === 'contains');
25
+ const refuters = members.filter(m => m.lineage === 'excludes');
26
+ if (members.length === 0 || (provers.length > 0 && refuters.length > 0)) {
27
+ return { lineage: 'unknown' };
28
+ }
29
+ if (provers.length > 0) {
30
+ const holders = withSameLatest(members, provers);
31
+ if (holders.length * 2 <= members.length) {
32
+ return { lineage: 'unknown' };
33
+ }
34
+ const held = new Set(holders.map(m => m.peerId));
35
+ const unconfirmed = members.filter(m => !held.has(m.peerId)).map(m => m.peerId);
36
+ return {
37
+ lineage: 'contains',
38
+ durability: {
39
+ quorum: unconfirmed.length === 0 ? 'full' : 'majority',
40
+ confirmed: holders.length,
41
+ cohort: members.length,
42
+ unconfirmed,
43
+ cohortPeerIds: members.map(m => m.peerId)
44
+ }
45
+ };
46
+ }
47
+ if (refuters.length > 0) {
48
+ const excluding = new Set(withSameLatest(members, refuters).map(m => m.peerId));
49
+ return members.every(m => excluding.has(m.peerId) || m.lineage === 'behind')
50
+ ? { lineage: 'excludes' }
51
+ : { lineage: 'unknown' };
52
+ }
53
+ return { lineage: members.every(m => m.lineage === 'behind') ? 'behind' : 'unknown' };
54
+ }
55
+ /** `decided`, plus every `unknown` member holding the same latest revision as one of them. */
56
+ function withSameLatest(members, decided) {
57
+ const sameRevision = (a, b) => a !== undefined && b !== undefined && a.rev === b.rev && a.actionId === b.actionId;
58
+ return members.filter(m => decided.includes(m)
59
+ || (m.lineage === 'unknown' && decided.some(d => sameRevision(d.latest, m.latest))));
60
+ }
61
+ //# sourceMappingURL=lineage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lineage.js","sourceRoot":"","sources":["../../../src/network/lineage.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAiC;IACnE,MAAM,OAAO,GAAG,OAAO,C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C,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvF,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { BlockId } from "../blocks/structs.js";
2
+ declare const routingKeyBrand: unique symbol;
3
+ /**
4
+ * The bytes a block is routed on — what `IKeyNetwork.findCluster` and `IKeyNetwork.findCoordinator`
5
+ * are handed for that block.
6
+ *
7
+ * Branded so the only way to obtain one is {@link routingKeyForBlock}. Every party that asks "who is
8
+ * responsible for this block" (the writer's `NetworkTransactor`, a coordinator's responsibility check,
9
+ * a cohort member re-deriving its cluster, `RepoService`'s redirect check) must land on the same ring
10
+ * position, and they only do if they hand the key network the same bytes. When the writer pre-hashed
11
+ * the id and the servers did not, every network wider than one cohort sent writers to the wrong
12
+ * machines — and no fixture was wide enough to notice, because a cohort holding every peer is the same
13
+ * set from any coordinate.
14
+ */
15
+ export type RoutingKey = Uint8Array & {
16
+ readonly [routingKeyBrand]: true;
17
+ };
18
+ /**
19
+ * A block's routing key: the raw utf8 bytes of its id. Deliberately NOT hashed here — the key network
20
+ * hashes the key once into a ring coordinate, and that is the only hash between a block id and its cohort.
21
+ */
22
+ export declare function routingKeyForBlock(blockId: BlockId): RoutingKey;
23
+ export {};
24
+ //# sourceMappingURL=routing-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing-key.d.ts","sourceRoot":"","sources":["../../../src/network/routing-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,CAAC,MAAM,eAAe,EAAE,OAAO,MAAM,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAI3E;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAE/D"}
@@ -0,0 +1,9 @@
1
+ const utf8 = new TextEncoder();
2
+ /**
3
+ * A block's routing key: the raw utf8 bytes of its id. Deliberately NOT hashed here — the key network
4
+ * hashes the key once into a ring coordinate, and that is the only hash between a block id and its cohort.
5
+ */
6
+ export function routingKeyForBlock(blockId) {
7
+ return utf8.encode(blockId);
8
+ }
9
+ //# sourceMappingURL=routing-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing-key.js","sourceRoot":"","sources":["../../../src/network/routing-key.ts"],"names":[],"mappings":"AAkBA,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;AAE/B;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IAClD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAe,CAAC;AAC3C,CAAC"}
@@ -45,7 +45,11 @@ export declare function highestStaleAt(candidates: readonly StaleFailure['staleA
45
45
  * Deliberately `===` only. At `latest.rev > rev` this returns false even for our own action: the
46
46
  * follow-on commit is refused as stale anyway (`StorageRepo.commit`'s `missedCommits` branch), so
47
47
  * approving would only defer the refusal by a round trip, and `latest` alone can no longer name
48
- * who holds `rev` — that needs the revision index (see `IRevisionActionReader`).
48
+ * who holds `rev` — that needs the revision index (see `IRevisionActionReader`). Nor would the
49
+ * index settle what the writer actually needs to know there, which is whether the content now held
50
+ * was BUILT FROM its revision; that is a separate question with its own answer
51
+ * (`IBlockStorage.lineageOf`, asked by the writer through `ITransactor.getLineage` once its re-send
52
+ * has been refused), not a widening of this one.
49
53
  *
50
54
  * Every revision-vs-action check calls this: the pend tier (`StorageRepo.pend`,
51
55
  * `ClusterMember.validatePendOperations`, `CoordinatorRepo.classifyStaleRejection`) and the commit
@@ -1 +1 @@
1
- {"version":3,"file":"stale-failure.d.ts","sourceRoot":"","sources":["../../../src/network/stale-failure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAEhE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,SAAS,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,YAAY,CAAC,SAAS,CAAC,CAQtG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEjH"}
1
+ {"version":3,"file":"stale-failure.d.ts","sourceRoot":"","sources":["../../../src/network/stale-failure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAEhE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,SAAS,YAAY,CAAC,SAAS,CAAC,EAAE,GAAG,YAAY,CAAC,SAAS,CAAC,CAQtG;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEjH"}
@@ -53,7 +53,11 @@ export function highestStaleAt(candidates) {
53
53
  * Deliberately `===` only. At `latest.rev > rev` this returns false even for our own action: the
54
54
  * follow-on commit is refused as stale anyway (`StorageRepo.commit`'s `missedCommits` branch), so
55
55
  * approving would only defer the refusal by a round trip, and `latest` alone can no longer name
56
- * who holds `rev` — that needs the revision index (see `IRevisionActionReader`).
56
+ * who holds `rev` — that needs the revision index (see `IRevisionActionReader`). Nor would the
57
+ * index settle what the writer actually needs to know there, which is whether the content now held
58
+ * was BUILT FROM its revision; that is a separate question with its own answer
59
+ * (`IBlockStorage.lineageOf`, asked by the writer through `ITransactor.getLineage` once its re-send
60
+ * has been refused), not a widening of this one.
57
61
  *
58
62
  * Every revision-vs-action check calls this: the pend tier (`StorageRepo.pend`,
59
63
  * `ClusterMember.validatePendOperations`, `CoordinatorRepo.classifyStaleRejection`) and the commit
@@ -1 +1 @@
1
- {"version":3,"file":"stale-failure.js","sourceRoot":"","sources":["../../../src/network/stale-failure.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAqB;IACtD,OAAO,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACxF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,cAAc,CAAC,UAA8C;IAC5E,IAAI,IAA6B,CAAC;IAClC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACpC,IAAI,SAAS,KAAK,SAAS,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACjF,IAAI,GAAG,SAAS,CAAC;QAClB,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,aAAa,CAAC,MAA6B,EAAE,GAAuB,EAAE,QAAkB;IACvG,OAAO,MAAM,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,IAAI,MAAM,CAAC,GAAG,KAAK,GAAG,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;AACxG,CAAC"}
1
+ {"version":3,"file":"stale-failure.js","sourceRoot":"","sources":["../../../src/network/stale-failure.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAqB;IACtD,OAAO,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACxF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,cAAc,CAAC,UAA8C;IAC5E,IAAI,IAA6B,CAAC;IAClC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACpC,IAAI,SAAS,KAAK,SAAS,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACjF,IAAI,GAAG,SAAS,CAAC;QAClB,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,aAAa,CAAC,MAA6B,EAAE,GAAuB,EAAE,QAAkB;IACvG,OAAO,MAAM,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,IAAI,MAAM,CAAC,GAAG,KAAK,GAAG,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;AACxG,CAAC"}
@@ -29,11 +29,14 @@ export type PendRequest = ActionTransforms & {
29
29
  * 'r' is return, which fails but returns the pending ActionIds and their transforms */
30
30
  policy: 'c' | 'f' | 'r';
31
31
  /**
32
- * Present only on the multi-collection path (`TransactionCoordinator.pendCollection`): the
33
- * transaction to re-execute plus the hash of ALL operations across all blocks it must produce.
34
- * Absent on the single-collection `Collection.sync` path, which carries bare transforms and is
35
- * therefore not re-checkable — see `ClusterConsensusConfig.unvalidatablePendPolicy` for what a
36
- * validating receiver does with that shape. ONE optional pair, deliberately: "transaction
32
+ * Present only on a validated multi-collection pend (`TransactionCoordinator.pendCollection`
33
+ * under its default `pendValidation: 'transaction'`): the transaction to re-execute plus the
34
+ * hash of ALL operations across all blocks it must produce. Absent on every pend that carries
35
+ * bare transforms and is therefore not re-checkable — the single-collection `Collection.sync`
36
+ * path, and a coordinator built with `pendValidation: 'none'` (the Quereus adapter's legacy
37
+ * multi-tree commit, which has no statements to re-execute) — see
38
+ * `ClusterConsensusConfig.unvalidatablePendPolicy` for what a validating receiver does with
39
+ * that shape. ONE optional pair, deliberately: "transaction
37
40
  * without its hash" (or the reverse) was a state the old two independent optional fields
38
41
  * permitted and no producer ever created — and a receiver whose guard required both could be
39
42
  * talked out of validating by a sender that omitted one.
@@ -47,25 +50,99 @@ export type PendRequest = ActionTransforms & {
47
50
  /** For multi-collection transactions: supercluster nominees for consensus */
48
51
  superclusterNominees?: PeerId[];
49
52
  /**
50
- * Aged, advisory retry priority for the *single-collection* pend path (default 0 when absent).
51
- * The multi-collection path instead carries priority on the transaction inside
53
+ * Aged, advisory retry priority for a pend that carries no transaction (default 0 when absent).
54
+ * A validated multi-collection pend instead carries priority on the transaction inside
52
55
  * {@link PendRequest.validation} ({@link Transaction.priority}); this top-level field is the
53
- * carrier for a `Collection.sync` pend, which has no transaction. A cluster member reads whichever is present as the first
56
+ * carrier for every pend without one — a `Collection.sync` pend, and an unvalidated
57
+ * coordinator pend (`pendValidation: 'none'`). A cluster member reads whichever is present as the first
54
58
  * `resolveRace` tiebreak. FAIRNESS-ONLY: it rides inside the signed cluster `message` (so it is
55
59
  * integrity-protected in transit) but MUST NOT affect the operations hash, stale-read checks, or
56
60
  * validity — a stale pend is still rejected regardless of priority.
57
61
  */
58
62
  priority?: number;
63
+ /**
64
+ * Per block, the committed revision of the base the author's update operations were computed
65
+ * against (`Tracker.stagedBaseRevs`). Present for a block whose transform is update-only and
66
+ * whose base the author knows; never for an inserted or deleted block (base-independent), and
67
+ * absent for a block the author did not read through a source that reports revisions. Omitted
68
+ * entirely when empty (`baseRevsField`): the request is hashed verbatim into every cohort
69
+ * signature preimage, so a pend that declares nothing must serialize exactly as it did before
70
+ * the field existed. Action-wide here; the transactor narrows it to each per-coordinator batch's
71
+ * own block ids at send time, exactly as it narrows {@link CommitRequest.blockDigests}.
72
+ *
73
+ * Storage keeps it beside the pending record (`BlockMetadata.pendingBases` in db-p2p), so every
74
+ * later step that applies the record can refuse to apply it to a different version of the block
75
+ * — including the read-driven promotion in `StorageRepo.get`, which has no commit message to
76
+ * consult. The commit's own `blockDigests[id].baseRev` is now the fallback for a record whose
77
+ * pend named no base, not the primary check.
78
+ */
79
+ baseRevs?: BlockBaseRevs;
59
80
  };
60
81
  export type BlockActionStatus = ActionBlocks & {
61
82
  statuses: ('pending' | 'committed' | 'checkpointed' | 'aborted' | 'committed-invalidated')[];
62
83
  };
84
+ /** How widely a successful write is known to be held at the moment it was acknowledged. */
85
+ export type DurabilityQuorum =
86
+ /** Every member of the resolved cohort confirmed it holds the revision. */
87
+ 'full'
88
+ /** A strict majority confirmed — the acknowledgement bar — but at least one member did not.
89
+ * Also the class of a torn action whose cohort confirmed everything it was asked for
90
+ * (`withTornBlocks` clamps `full` down to this; `torn` then names the blocks, and `unconfirmed`
91
+ * may be empty). */
92
+ | 'majority'
93
+ /** The cohort resolved, and it is this node alone. Nobody else holds the revision yet. */
94
+ | 'local'
95
+ /** The cohort did NOT resolve: the lookup threw, or named nobody, or named a single peer that
96
+ * is not this node. The write is on this node's storage and the network was never consulted.
97
+ * Deliberately NOT `local`: a genuine cohort of one is a correct, complete write, whereas this
98
+ * is a write whose correct destination is unknown. */
99
+ | 'unrouted';
100
+ /** What the answering layer knows about who holds a successful write. Each layer refines it:
101
+ * `StorageRepo` answers for itself alone, `CoordinatorRepo` answers for the cohort the write ran
102
+ * on, and `NetworkTransactor` merges the per-coordinator answers into one action-level answer.
103
+ * Never a policy input — read it to DISPLAY or to REPAIR, never to decide acceptance.
104
+ *
105
+ * The only "this write is completely saved" test is `isFullyDurable` (`network/durability.ts`);
106
+ * do not compare `quorum` by hand, because a `full` cohort report can still sit on an action that
107
+ * abandoned blocks (`torn`). */
108
+ export type WriteDurability = {
109
+ readonly quorum: DurabilityQuorum;
110
+ /** Cohort members confirmed to hold the write, including this node when it holds it.
111
+ * For a commit this means "reported that its storage durably holds the revision"; for a pend
112
+ * it means "accepted the pending record". The two are NOT comparable — a pend confers no
113
+ * storage durability (see the note in `CoordinatorRepo.pendThroughCluster`). */
114
+ readonly confirmed: number;
115
+ /** Size of the cohort the write ran on. Zero exactly when `quorum` is 'unrouted'. */
116
+ readonly cohort: number;
117
+ /** Cohort members that did not confirm, by peer-id string. Empty when `quorum` is 'full'.
118
+ * ABSENT (not empty) when the answering layer could not name the cohort — an empty array
119
+ * here means "named the cohort, nobody is missing". */
120
+ readonly unconfirmed?: readonly string[];
121
+ /** The cohort the write ran on, by peer-id string. Absent where the answering layer has no
122
+ * cohort view at all (a bare `StorageRepo` verdict). */
123
+ readonly cohortPeerIds?: readonly string[];
124
+ /** Present only on an action-level result assembled from MORE THAN ONE distinct coordinator
125
+ * answer: the other answers. Identical answers are collapsed (`mergeDurability`), so a healthy
126
+ * single-cohort commit has none; one cohort answering differently for two batches appears
127
+ * twice. The scalar fields above always describe the WEAKEST answer, so a consumer that reads
128
+ * only them is reading the binding constraint and is never over-optimistic. */
129
+ readonly otherCohorts?: readonly WriteDurability[];
130
+ /** Blocks this action wrote that are NOT committed — a torn sweep abandoned and cancelled them
131
+ * (`NetworkTransactor.cancelAbandonedSweepBlocks`). Action-level commit results only.
132
+ * These blocks NEVER heal by replication: their transform is gone, and only the writer
133
+ * re-driving the action puts them back. */
134
+ readonly torn?: readonly BlockId[];
135
+ };
63
136
  export type PendSuccess = {
64
137
  success: true;
65
138
  /** List of already pending actions that were found on blocks touched by this pend */
66
139
  pending: ActionPending[];
67
140
  /** The affected blocks */
68
141
  blockIds: BlockId[];
142
+ /** Who accepted the pending record. REQUIRED, not optional: an absent field would read as plain
143
+ * success, which is exactly the ambiguity this field exists to remove (a solo write, a write
144
+ * whose cohort never resolved, and a quorum write all used to answer `{ success: true }`). */
145
+ durability: WriteDurability;
69
146
  };
70
147
  export type StaleFailure = {
71
148
  success: false;
@@ -115,6 +192,11 @@ export type BlockContentDigest = {
115
192
  /** Per-block content declarations riding on a commit. Optional per id: a block the client cannot
116
193
  * digest without a network read is simply omitted, and falls back to corroboration downstream. */
117
194
  export type BlockContentDigests = Record<BlockId, BlockContentDigest>;
195
+ /** Per block, the committed revision its update operations were computed against — the shape
196
+ * `Tracker.stagedBaseRevs` produces and {@link PendRequest.baseRevs} carries. Optional per id: an
197
+ * inserted or deleted block is base-independent and never named; a block updated without a known
198
+ * base is simply omitted. */
199
+ export type BlockBaseRevs = Record<BlockId, number>;
118
200
  export type CommitRequest = ActionBlocks & {
119
201
  /** The header block of the collection, present only when this commit creates the collection
120
202
  * (the header is a fresh insert). Collection-identifying metadata, not an ordering signal —
@@ -158,6 +240,11 @@ export type CommitSuccess = {
158
240
  success: true;
159
241
  /** If present, the identified collection acts as the coordinator for the multi-collection transaction */
160
242
  coordinatorId?: CollectionId;
243
+ /** Who holds the committed revision. REQUIRED for the same reason as {@link PendSuccess.durability}:
244
+ * a quorum commit, a solo commit, a commit whose cohort lookup failed, and a torn multi-block
245
+ * commit all answered `{ success: true }` before this field existed, and a writer could not tell
246
+ * them apart (GitHub #19). Test it through `isFullyDurable`, never by comparing `quorum`. */
247
+ durability: WriteDurability;
161
248
  };
162
249
  export type BlockActionState = {
163
250
  /** The latest action that has been committed */
@@ -168,6 +255,59 @@ export type BlockActionState = {
168
255
  export type BlockGets = {
169
256
  blockIds: BlockId[];
170
257
  context?: ActionContext;
258
+ /** Per block, the lowest revision the ASKER can accept for it — its floor. Omit a block that
259
+ * has none; omit the field entirely when no block does.
260
+ *
261
+ * A floor is knowledge only the asker holds: a collection that walked the log entry
262
+ * "action A, committed at revision r, changed block X" knows a read of X at a context at or
263
+ * above `r` must come back materialized at `r` or later, while the repo answering may honestly
264
+ * believe its older copy is current. `TransactorSource.tryGet` fills this from the collection's
265
+ * `BlockFloors`; `NetworkTransactor.get` treats an answer under a block's floor as NOT answered,
266
+ * so it earns the same second-chance round against a different coordinator that `unavailable`
267
+ * and `unconfirmedAheadRev` earn.
268
+ *
269
+ * CLIENT-SIDE HINT, never on the wire: `NetworkTransactor.get` builds its own
270
+ * `{ blockIds, context }` for each downstream `IRepo.get`, so this field reaches no peer and no
271
+ * coordinator's freshness decision. An `ITransactor` that ignores it (`TestTransactor`, the
272
+ * reference peer's) stays correct, because the reader-side check that actually enforces the
273
+ * floor runs on the merged answer either way (`TransactorSource` / `BlockFloorCheck`).
274
+ *
275
+ * NOTE: the retry `NetworkTransactor.get` runs is per BATCH, not per block, so one below-floor
276
+ * block re-asks every block that shared its coordinator. Costs nothing today — `tryGet` asks
277
+ * for one block per request, so this map never holds more than one entry — but a read source
278
+ * that batches would pay it. Split the retry payload down to the failing block ids then. */
279
+ floors?: Record<BlockId, number>;
280
+ /** Ask the answering repo whether each block's CURRENT content was built from this committed
281
+ * action at this revision; it answers per block in {@link GetBlockResult.lineage}. On the wire,
282
+ * unlike `floors`. A repo that predates the field leaves `lineage` absent, which every consumer
283
+ * reads as `unknown`. Asked only by a writer deciding whether its own superseded write is saved
284
+ * (`ITransactor.getLineage`); an ordinary read never sets it. */
285
+ lineageOf?: ActionRev;
286
+ };
287
+ /**
288
+ * Whether a block's current content was BUILT FROM a given committed `(actionId, rev)` — the
289
+ * write's transform is part of what the block holds now, even though later actions have since
290
+ * taken later revisions.
291
+ *
292
+ * - `contains` — it was. Holding that exact revision as the latest counts.
293
+ * - `excludes` — it provably was not: another action holds that revision of the block, or the
294
+ * block's history spans that revision without it. Nothing can land the write there any more.
295
+ * - `behind` — the block has not reached that revision (or does not exist). The write is not
296
+ * there, and could only get there through one of its own pending records.
297
+ * - `unknown` — not established either way.
298
+ *
299
+ * One repo answers from its own records only ({@link GetBlockResult.lineage}); a transactor
300
+ * answers for the block's cohort ({@link ActionLineage}).
301
+ */
302
+ export type BlockLineage = 'contains' | 'excludes' | 'behind' | 'unknown';
303
+ /** A cohort-level answer to "is this committed write part of what these blocks hold now?" — see
304
+ * `ITransactor.getLineage`. */
305
+ export type ActionLineage = {
306
+ /** One answer per requested block id, in request order. */
307
+ blocks: BlockLineage[];
308
+ /** Who holds the write, present exactly when EVERY block answered `contains`: the weakest
309
+ * block's cohort report, by the same rule a commit's durability is merged. */
310
+ durability?: WriteDurability;
171
311
  };
172
312
  /** Why a repo could not establish whether a block exists. Present ONLY when the repo
173
313
  * knows its own answer is a guess; an absent field is an authoritative answer. */
@@ -231,6 +371,9 @@ export type GetBlockResult = {
231
371
  * the content here is real, it may just be behind. Absent = confirmed, so every
232
372
  * producer that omits it keeps its meaning. */
233
373
  unconfirmedAheadRev?: number;
374
+ /** This repo's answer to {@link BlockGets.lineageOf}, from its OWN records only — no cohort
375
+ * view. Absent when the question was not asked, or the repo predates it. */
376
+ lineage?: BlockLineage;
234
377
  };
235
378
  /**
236
379
  * Thrown by a block read when the responsible repo could not determine whether the
@@ -1 +1 @@
1
- {"version":3,"file":"struct.d.ts","sourceRoot":"","sources":["../../../src/network/struct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ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ACrC,CAAC;CACD;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAC5B;IAA2B;IAAhD,YAAqB,OAAgB,EAAW,UAAkB;QACjE,KAAK,CAAC,SAAS,OAAO,4CAA4C,UAAU,wDAAwD,CAAC,CAAC;QADlH,YAAO,GAAP,OAAO,CAAS;QAAW,eAAU,GAAV,UAAU,CAAQ;QAEjE,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACvC,CAAC;CACD"}
1
+ {"version":3,"file":"struct.js","sourceRoot":"","sources":["../../../src/network/struct.ts"],"names":[],"mappings":"AA8ZA;;;;;GAKG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC1B;IAA2B;IAAhD,YAAqB,OAAgB,EAAW,MAA8B;QAC7E,KAAK,CAAC,SAAS,OAAO,oBAAoB,MAAM,mDAAmD,CAAC,CAAC;QADjF,YAAO,GAAP,OAAO,CAAS;QAAW,WAAM,GAAN,MAAM,CAAwB;QAE7E,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACrC,CAAC;CACD;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAC5B;IAA2B;IAAhD,YAAqB,OAAgB,EAAW,UAAkB;QACjE,KAAK,CAAC,SAAS,OAAO,4CAA4C,UAAU,wDAAwD,CAAC,CAAC;QADlH,YAAO,GAAP,OAAO,CAAS;QAAW,eAAU,GAAV,UAAU,CAAQ;QAEjE,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACvC,CAAC;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../../src/reactivity/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAsBH,+EAA+E;AAC/E,eAAO,MAAM,mCAAmC,QAAY,CAAC;AAI7D,6FAA6F;AAC7F,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,YAAY,CAAC;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AAM,CAAC;IACf,eAAe;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,GAAG,EAAE,MAAM,CAAC;IACZ,oFAAoF;IACpF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,iGAAiG;IACjG,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAgBD,+FAA+F;AAC/F,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAanF;AAED,4GAA4G;AAC5G,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,qBAAqB,GAAG,UAAU,CAEpF;AAED,qGAAqG;AACrG,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,GAAE,MAA4C,GAAG,qBAAqB,CAE1I;AAyBD,wFAAwF;AACxF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CA4BrE;AAED,sHAAsH;AACtH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE,CAKxF;AAED,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,cAAc,EAAE,eAAe,GAAE,MAAkC,GAAG,UAAU,CAEzH;AAED,6DAA6D;AAC7D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,cAAc,CAEhG"}
@@ -24,7 +24,10 @@
24
24
  import { decodeCohortMessage, encodeCohortMessage, DEFAULT_MAX_MESSAGE_BYTES, } from "../cohort-topic/wire/codec.js";
25
25
  import { asObject, b64urlField, failWire as fail, reqBool, reqFiniteNumber, reqIntInRange, reqString, reqStringArray, requireV1, } from "./wire-validate.js";
26
26
  const utf8Encoder = new TextEncoder();
27
- const utf8Decoder = new TextDecoder("utf-8", { fatal: true });
27
+ // Built on first use, not at module load: Hermes (React Native) has no native `TextDecoder`, so a
28
+ // module-scope construction fails the import itself whenever it runs ahead of the host's polyfill.
29
+ let utf8DecoderInstance;
30
+ const utf8Decoder = () => utf8DecoderInstance ??= new TextDecoder("utf-8", { fatal: true });
28
31
  /** Ceiling for an opaque subscribe app payload, guarding decode allocation. */
29
32
  export const DEFAULT_MAX_SUBSCRIBE_PAYLOAD_BYTES = 64 * 1024;
30
33
  // --- validation helpers ---
@@ -66,9 +69,12 @@ function parseJsonBytes(bytes, maxBytes, what) {
66
69
  if (bytes.length > maxBytes) {
67
70
  fail(`${what}: payload ${bytes.length} exceeds max ${maxBytes} bytes`);
68
71
  }
72
+ // Fetched outside the try, so a missing `TextDecoder` polyfill surfaces as itself rather than as
73
+ // "not valid UTF-8".
74
+ const decoder = utf8Decoder();
69
75
  let text;
70
76
  try {
71
- text = utf8Decoder.decode(bytes);
77
+ text = decoder.decode(bytes);
72
78
  }
73
79
  catch {
74
80
  fail(`${what}: payload is not valid UTF-8`);
@@ -1 +1 @@
1
- {"version":3,"file":"wire.js","sourceRoot":"","sources":["../../../src/reactivity/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,QAAQ,EACR,WAAW,EACX,QAAQ,IAAI,IAAI,EAChB,OAAO,EACP,eAAe,EACf,aAAa,EACb,SAAS,EACT,cAAc,EACd,SAAS,GACT,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAE9D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mCAAmC,GAAG,EAAE,GA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