@jam-overture/loom 0.1.0 → 0.2.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 (290) hide show
  1. package/README.md +3 -1
  2. package/dist/application/application.d.ts +109 -0
  3. package/dist/application/application.js +97 -0
  4. package/dist/application/memory.d.ts +20 -0
  5. package/dist/application/memory.js +79 -0
  6. package/dist/application/store.d.ts +101 -0
  7. package/dist/application/store.js +25 -0
  8. package/dist/audience/audience.d.ts +36 -0
  9. package/dist/audience/audience.js +41 -0
  10. package/dist/cli/templates.js +19 -0
  11. package/dist/data/plan.js +0 -0
  12. package/dist/data/resolution.d.ts +23 -1
  13. package/dist/data/resolve.d.ts +30 -3
  14. package/dist/data/resolve.js +11 -3
  15. package/dist/ids.d.ts +10 -0
  16. package/dist/ids.js +11 -1
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +1 -0
  19. package/dist/patch.d.ts +54 -0
  20. package/dist/patch.js +44 -0
  21. package/dist/project/closing.d.ts +51 -0
  22. package/dist/project/closing.js +53 -0
  23. package/dist/project/memory.d.ts +20 -0
  24. package/dist/project/memory.js +97 -0
  25. package/dist/project/project.d.ts +90 -0
  26. package/dist/project/project.js +91 -0
  27. package/dist/project/store.d.ts +135 -0
  28. package/dist/project/store.js +41 -0
  29. package/dist/registered.d.ts +64 -0
  30. package/dist/registered.js +118 -0
  31. package/dist/render/behaviour-adjust.d.ts +11 -19
  32. package/dist/render/behaviour-adjust.js +75 -21
  33. package/dist/render/behaviour-present.d.ts +8 -0
  34. package/dist/render/behaviour-present.js +57 -6
  35. package/dist/render/behaviour.d.ts +98 -17
  36. package/dist/render/behaviour.js +91 -26
  37. package/dist/render/control-name.d.ts +68 -0
  38. package/dist/render/control-name.js +37 -0
  39. package/dist/render/diagnostics.d.ts +72 -0
  40. package/dist/render/diagnostics.js +7 -0
  41. package/dist/render/index.d.ts +2 -0
  42. package/dist/render/index.js +2 -0
  43. package/dist/render/reads.d.ts +11 -0
  44. package/dist/render/reads.js +12 -1
  45. package/dist/render/render.js +102 -7
  46. package/dist/render/slots.d.ts +52 -0
  47. package/dist/render/slots.js +24 -0
  48. package/dist/render/theme.d.ts +54 -1
  49. package/dist/render/theme.js +23 -1
  50. package/dist/render/unshown.d.ts +152 -0
  51. package/dist/render/unshown.js +80 -0
  52. package/dist/runtime/analysis.d.ts +94 -9
  53. package/dist/runtime/analysis.js +54 -9
  54. package/dist/runtime/assessment.d.ts +36 -2
  55. package/dist/runtime/assessment.js +27 -2
  56. package/dist/runtime/checks.d.ts +148 -0
  57. package/dist/runtime/checks.js +112 -0
  58. package/dist/runtime/disposition.d.ts +96 -0
  59. package/dist/runtime/disposition.js +46 -0
  60. package/dist/runtime/gate.js +22 -0
  61. package/dist/runtime/index.d.ts +3 -0
  62. package/dist/runtime/index.js +3 -0
  63. package/dist/runtime/irreversibility.d.ts +64 -0
  64. package/dist/runtime/irreversibility.js +45 -0
  65. package/dist/runtime/pipeline.d.ts +43 -0
  66. package/dist/runtime/pipeline.js +10 -2
  67. package/dist/runtime/policy-change.d.ts +93 -0
  68. package/dist/runtime/policy-change.js +299 -0
  69. package/dist/runtime/policy-log.d.ts +406 -0
  70. package/dist/runtime/policy-log.js +285 -0
  71. package/dist/runtime/reversibility.d.ts +11 -9
  72. package/dist/runtime/stakes.d.ts +129 -1
  73. package/dist/runtime/stakes.js +240 -26
  74. package/dist/runtime/vocabulary.d.ts +164 -7
  75. package/dist/runtime/vocabulary.js +181 -8
  76. package/dist/sdk/audit.d.ts +174 -3
  77. package/dist/sdk/audit.js +176 -17
  78. package/dist/sdk/catalogue.d.ts +9 -1
  79. package/dist/sdk/conformance.d.ts +37 -3
  80. package/dist/sdk/conformance.js +25 -4
  81. package/dist/sdk/definition.d.ts +65 -0
  82. package/dist/sdk/definition.js +22 -0
  83. package/dist/sdk/registry.d.ts +29 -2
  84. package/dist/sdk/registry.js +63 -1
  85. package/dist/signals/action-change.d.ts +507 -0
  86. package/dist/signals/action-change.js +265 -0
  87. package/dist/signals/action.d.ts +331 -0
  88. package/dist/signals/action.js +182 -0
  89. package/dist/signals/applied-window.contract.d.ts +23 -0
  90. package/dist/signals/applied-window.contract.js +160 -0
  91. package/dist/signals/arriving.d.ts +210 -0
  92. package/dist/signals/arriving.js +133 -0
  93. package/dist/signals/audiences.d.ts +528 -0
  94. package/dist/signals/audiences.js +255 -0
  95. package/dist/signals/broadcast.d.ts +8 -2
  96. package/dist/signals/broadcast.js +58 -8
  97. package/dist/signals/change.d.ts +378 -0
  98. package/dist/signals/change.js +327 -0
  99. package/dist/signals/collect.d.ts +41 -0
  100. package/dist/signals/collect.js +88 -7
  101. package/dist/signals/copy-change.d.ts +553 -0
  102. package/dist/signals/copy-change.js +377 -0
  103. package/dist/signals/copy.d.ts +337 -0
  104. package/dist/signals/copy.js +211 -0
  105. package/dist/signals/counters.d.ts +46 -0
  106. package/dist/signals/counters.js +102 -0
  107. package/dist/signals/deliver.d.ts +23 -4
  108. package/dist/signals/deliver.js +34 -6
  109. package/dist/signals/deployment-change.d.ts +371 -0
  110. package/dist/signals/deployment-change.js +268 -0
  111. package/dist/signals/deployment.d.ts +265 -0
  112. package/dist/signals/deployment.js +152 -0
  113. package/dist/signals/door.d.ts +92 -0
  114. package/dist/signals/door.js +53 -0
  115. package/dist/signals/fold.d.ts +10 -0
  116. package/dist/signals/fold.js +5 -1
  117. package/dist/signals/form-action.d.ts +302 -0
  118. package/dist/signals/form-action.js +169 -0
  119. package/dist/signals/form-copy.d.ts +523 -0
  120. package/dist/signals/form-copy.js +346 -0
  121. package/dist/signals/forms.d.ts +247 -0
  122. package/dist/signals/forms.js +147 -0
  123. package/dist/signals/funnel-change.d.ts +548 -0
  124. package/dist/signals/funnel-change.js +361 -0
  125. package/dist/signals/funnel.d.ts +532 -0
  126. package/dist/signals/funnel.js +216 -0
  127. package/dist/signals/health.d.ts +497 -0
  128. package/dist/signals/health.js +361 -0
  129. package/dist/signals/index.d.ts +41 -0
  130. package/dist/signals/index.js +41 -0
  131. package/dist/signals/ingest.d.ts +56 -1
  132. package/dist/signals/ingest.js +91 -1
  133. package/dist/signals/journal.d.ts +11 -0
  134. package/dist/signals/kinds.d.ts +8 -6
  135. package/dist/signals/kinds.js +14 -6
  136. package/dist/signals/library-action.d.ts +430 -0
  137. package/dist/signals/library-action.js +336 -0
  138. package/dist/signals/library-change.d.ts +477 -0
  139. package/dist/signals/library-change.js +335 -0
  140. package/dist/signals/library-copy-change.d.ts +498 -0
  141. package/dist/signals/library-copy-change.js +476 -0
  142. package/dist/signals/library-pace.d.ts +319 -0
  143. package/dist/signals/library-pace.js +305 -0
  144. package/dist/signals/library-reach-change.d.ts +636 -0
  145. package/dist/signals/library-reach-change.js +534 -0
  146. package/dist/signals/library-reach.d.ts +377 -0
  147. package/dist/signals/library-reach.js +227 -0
  148. package/dist/signals/library-word-reach-change.d.ts +567 -0
  149. package/dist/signals/library-word-reach-change.js +568 -0
  150. package/dist/signals/library.d.ts +306 -0
  151. package/dist/signals/library.js +178 -0
  152. package/dist/signals/memory.d.ts +9 -0
  153. package/dist/signals/memory.js +105 -14
  154. package/dist/signals/migrate.d.ts +17 -2
  155. package/dist/signals/migrate.js +122 -5
  156. package/dist/signals/notice.d.ts +334 -0
  157. package/dist/signals/notice.js +228 -0
  158. package/dist/signals/pace-change.d.ts +501 -0
  159. package/dist/signals/pace-change.js +310 -0
  160. package/dist/signals/pace.d.ts +296 -0
  161. package/dist/signals/pace.js +291 -0
  162. package/dist/signals/page-views.d.ts +365 -0
  163. package/dist/signals/page-views.js +218 -0
  164. package/dist/signals/parts.d.ts +344 -0
  165. package/dist/signals/parts.js +273 -0
  166. package/dist/signals/postgres.d.ts +16 -2
  167. package/dist/signals/postgres.js +390 -87
  168. package/dist/signals/progress.d.ts +212 -0
  169. package/dist/signals/progress.js +150 -0
  170. package/dist/signals/ratios.d.ts +108 -0
  171. package/dist/signals/ratios.js +40 -0
  172. package/dist/signals/reach.d.ts +309 -0
  173. package/dist/signals/reach.js +93 -0
  174. package/dist/signals/readable.d.ts +34 -0
  175. package/dist/signals/readable.js +34 -0
  176. package/dist/signals/readership.d.ts +381 -0
  177. package/dist/signals/readership.js +308 -0
  178. package/dist/signals/region-pages.d.ts +173 -0
  179. package/dist/signals/region-pages.js +62 -0
  180. package/dist/signals/region.d.ts +287 -0
  181. package/dist/signals/region.js +198 -0
  182. package/dist/signals/retention.d.ts +141 -0
  183. package/dist/signals/retention.js +58 -0
  184. package/dist/signals/rollup.d.ts +67 -3
  185. package/dist/signals/rollup.js +0 -0
  186. package/dist/signals/schema.d.ts +432 -1
  187. package/dist/signals/schema.js +157 -3
  188. package/dist/signals/signal.d.ts +237 -11
  189. package/dist/signals/signal.js +70 -10
  190. package/dist/signals/silence-census.d.ts +205 -0
  191. package/dist/signals/silence-census.js +87 -0
  192. package/dist/signals/silences.d.ts +848 -0
  193. package/dist/signals/silences.js +753 -0
  194. package/dist/signals/tally.d.ts +140 -11
  195. package/dist/signals/window-figures.d.ts +148 -0
  196. package/dist/signals/window-figures.js +42 -0
  197. package/dist/signals/window.d.ts +866 -0
  198. package/dist/signals/window.js +693 -0
  199. package/dist/signals/words.d.ts +24 -0
  200. package/dist/signals/words.js +24 -0
  201. package/dist/store/index.d.ts +19 -0
  202. package/dist/store/index.js +19 -0
  203. package/dist/store/memory.d.ts +2 -1
  204. package/dist/store/memory.js +48 -12
  205. package/dist/store/migrate.d.ts +80 -0
  206. package/dist/store/migrate.js +259 -7
  207. package/dist/store/postgres-applications.d.ts +4 -0
  208. package/dist/store/postgres-applications.js +197 -0
  209. package/dist/store/postgres-holds.d.ts +10 -1
  210. package/dist/store/postgres-holds.js +116 -101
  211. package/dist/store/postgres-policy-log.d.ts +14 -0
  212. package/dist/store/postgres-policy-log.js +240 -0
  213. package/dist/store/postgres-projects.d.ts +4 -0
  214. package/dist/store/postgres-projects.js +217 -0
  215. package/dist/store/postgres.d.ts +16 -1
  216. package/dist/store/postgres.js +59 -9
  217. package/dist/store/replay.d.ts +102 -1
  218. package/dist/store/replay.js +190 -19
  219. package/dist/store/reseed.d.ts +238 -0
  220. package/dist/store/reseed.js +308 -0
  221. package/dist/store/schema.d.ts +450 -2
  222. package/dist/store/schema.js +141 -5
  223. package/dist/store/store.d.ts +29 -6
  224. package/dist/submit/resolve.js +2 -1
  225. package/dist/telemetry/calibration.d.ts +25 -0
  226. package/dist/telemetry/calibration.js +27 -1
  227. package/dist/telemetry/event.d.ts +391 -33
  228. package/dist/telemetry/event.js +84 -20
  229. package/dist/telemetry/index.d.ts +1 -0
  230. package/dist/telemetry/index.js +1 -0
  231. package/dist/telemetry/journal.d.ts +72 -3
  232. package/dist/telemetry/journal.js +9 -0
  233. package/dist/telemetry/lookup.d.ts +27 -0
  234. package/dist/telemetry/lookup.js +18 -0
  235. package/dist/telemetry/memory.js +23 -0
  236. package/dist/telemetry/migrate.js +22 -1
  237. package/dist/telemetry/postgres.d.ts +10 -1
  238. package/dist/telemetry/postgres.js +172 -90
  239. package/dist/telemetry/remeasure.d.ts +78 -0
  240. package/dist/telemetry/remeasure.js +83 -0
  241. package/dist/telemetry/retention.d.ts +2 -2
  242. package/dist/telemetry/schema.d.ts +17 -0
  243. package/dist/telemetry/schema.js +27 -1
  244. package/dist/telemetry/sink.d.ts +2 -2
  245. package/dist/testing/application-contract.d.ts +14 -0
  246. package/dist/testing/application-contract.js +270 -0
  247. package/dist/testing/contracts.d.ts +12 -7
  248. package/dist/testing/contracts.js +12 -7
  249. package/dist/testing/definitions.d.ts +78 -0
  250. package/dist/testing/definitions.js +134 -9
  251. package/dist/testing/doubles.d.ts +103 -0
  252. package/dist/testing/doubles.js +143 -0
  253. package/dist/testing/index.d.ts +2 -2
  254. package/dist/testing/index.js +2 -2
  255. package/dist/testing/journal-contract.js +140 -2
  256. package/dist/testing/model-contract.d.ts +110 -0
  257. package/dist/testing/model-contract.js +150 -0
  258. package/dist/testing/policy-log-contract.d.ts +26 -0
  259. package/dist/testing/policy-log-contract.js +344 -0
  260. package/dist/testing/project-contract.d.ts +14 -0
  261. package/dist/testing/project-contract.js +266 -0
  262. package/dist/testing/reader-signal-contract.d.ts +27 -2
  263. package/dist/testing/reader-signal-contract.js +475 -5
  264. package/dist/testing/store-contract.d.ts +7 -1
  265. package/dist/testing/store-contract.js +84 -3
  266. package/dist/theme/apply.d.ts +20 -1
  267. package/dist/theme/apply.js +5 -3
  268. package/dist/theme/derive.d.ts +22 -0
  269. package/dist/theme/derive.js +54 -1
  270. package/dist/theme/library.js +1 -1
  271. package/dist/theme/measure.d.ts +34 -0
  272. package/dist/theme/measure.js +30 -1
  273. package/dist/theme/palettes.js +7 -7
  274. package/dist/theme/ramp.d.ts +64 -0
  275. package/dist/theme/ramp.js +114 -0
  276. package/dist/theme/registry.d.ts +9 -0
  277. package/dist/theme/registry.js +11 -1
  278. package/dist/theme/separation.d.ts +97 -3
  279. package/dist/theme/separation.js +75 -0
  280. package/dist/tree/compare.d.ts +9 -0
  281. package/dist/tree/compare.js +18 -0
  282. package/dist/write/computed.d.ts +60 -0
  283. package/dist/write/computed.js +61 -0
  284. package/dist/write/held.d.ts +59 -0
  285. package/dist/write/index.d.ts +5 -2
  286. package/dist/write/index.js +5 -2
  287. package/dist/write/reseed.d.ts +151 -0
  288. package/dist/write/reseed.js +184 -0
  289. package/dist/write/revert.js +2 -16
  290. package/package.json +98 -19
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Judge one sweep's own evidence against the ceiling its deployment publishes.
3
+ *
4
+ * The retention is taken whole — the same `Pick` of the notice the reader's
5
+ * sentence is built from (0320) — so the ceiling judged here is the ceiling
6
+ * published, by construction rather than by a reviewer.
7
+ *
8
+ * **An unstated interval wins over everything else**, including a buffer months
9
+ * behind. It is not that the buffer is fine; it is that no ceiling was
10
+ * published, so a run has no claim of its deployment's to measure. The operator
11
+ * hears about an unstated schedule from the setting, which is where the remedy
12
+ * is.
13
+ *
14
+ * **A delivery received in the future is kept, by the same subtraction rather
15
+ * than by a special case** — a negative age is never longer than a positive
16
+ * ceiling, which is how the stall check answers a clock that disagrees with
17
+ * itself (0274).
18
+ */
19
+ export const retentionPromiseOf = (outcome, retention) => {
20
+ if (retention.sweep.state !== "stated")
21
+ return { state: "unpromised" };
22
+ const { goneWithinMs } = retention.sweep;
23
+ if (outcome.outcome === "refused" || outcome.outcome === "unavailable") {
24
+ return { state: "unread" };
25
+ }
26
+ if (outcome.outcome === "nothing-ripe")
27
+ return { state: "unripe" };
28
+ const { oldestMs } = outcome.summary;
29
+ if (!Number.isFinite(oldestMs))
30
+ return { state: "unread" };
31
+ return oldestMs > goneWithinMs
32
+ ? { state: "broken", oldestMs, goneWithinMs, byMs: oldestMs - goneWithinMs }
33
+ : { state: "kept", oldestMs, goneWithinMs };
34
+ };
35
+ /**
36
+ * One line for the operator who runs the sweep, because they are the only
37
+ * person who can close the gap.
38
+ *
39
+ * Milliseconds, as the settings an operator typed are in: a line that rounded
40
+ * to minutes would not tell somebody who wrote an interval in the wrong units
41
+ * which units it wanted.
42
+ */
43
+ export const describeRetentionPromise = (promise) => {
44
+ switch (promise.state) {
45
+ case "unpromised":
46
+ return "readers are promised no ceiling on how long a delivery lives, so there is none for this run to keep";
47
+ case "unread":
48
+ return "no delivery was read, so nothing here says whether the ceiling readers are promised is being kept";
49
+ case "unripe":
50
+ return "nothing in the buffer is old enough to count, so no delivery is past the ceiling readers are promised";
51
+ case "kept":
52
+ return `the oldest delivery waiting is ${promise.oldestMs}ms old, and readers are promised one is gone within ${promise.goneWithinMs}ms of arriving`;
53
+ case "broken":
54
+ return (`the oldest delivery waiting is ${promise.oldestMs}ms old and readers are promised one is gone within ${promise.goneWithinMs}ms of arriving, ` +
55
+ `so that promise has been false for ${promise.byMs}ms: this deployment is sweeping less often than it stated, or not at all`);
56
+ }
57
+ };
58
+ //# sourceMappingURL=retention.js.map
@@ -1,5 +1,6 @@
1
1
  import type { NodeId, TreeId } from "../ids.js";
2
2
  import type { PrimitiveType } from "../primitive-type.js";
3
+ import type { RevisionViews } from "./page-views.js";
3
4
  import type { ReaderSignalBatch, ReaderSignalKind } from "./signal.js";
4
5
  /**
5
6
  * Many views, folded into the durable artefact: per-node-per-revision counters,
@@ -25,9 +26,10 @@ import type { ReaderSignalBatch, ReaderSignalKind } from "./signal.js";
25
26
  * One node at one revision, as every view of it added up.
26
27
  *
27
28
  * The counters divide into two kinds and the distinction is the whole reason
28
- * this is not just `fold.ts` over more input. `dwellMs`, `activations`, `opens`
29
- * and `closes` are **occurrences** — they sum, and one enthusiastic reader can
30
- * be most of them. `views`, `reached` and `engaged` are **views** — they count
29
+ * this is not just `fold.ts` over more input. `dwellMs`, `activations`, `opens`,
30
+ * `closes` and `completions` are **occurrences** — they sum, and one
31
+ * enthusiastic reader can be most of them. `views`, `reached` and `engaged` are
32
+ * **views** — they count
31
33
  * distinct page views, so they are the ones a rate may be taken of, and they are
32
34
  * only available because a batch carries a view key.
33
35
  *
@@ -71,6 +73,20 @@ export type ReaderTally = {
71
73
  readonly activations: number;
72
74
  readonly opens: number;
73
75
  readonly closes: number;
76
+ /**
77
+ * Times a form inside this node was submitted and the browser let it go.
78
+ *
79
+ * The conversion counter, and the only one that is about a reader finishing
80
+ * rather than a reader looking. It is an occurrence rather than a view count
81
+ * for the same reason `activations` is: a reader who submits twice did two
82
+ * things, and *how many views converted* is a `FunnelPair` ending in
83
+ * `completed`, which is one row and already answerable.
84
+ *
85
+ * Filed against the node the form is — `loom.form` is addressed, so usually
86
+ * the form itself — never the band above it. The band's number is `engaged`,
87
+ * credited from the ancestry the signal carries (0167, 0211).
88
+ */
89
+ readonly completions: number;
74
90
  };
75
91
  /** One end of a funnel: a node, and what a reader has to have done to it. */
76
92
  export type FunnelEnd = {
@@ -109,6 +125,19 @@ export type Rollup = {
109
125
  readonly funnels: readonly FunnelAnswer[];
110
126
  /** Distinct page views seen, across every tree and revision in the input. */
111
127
  readonly views: number;
128
+ /**
129
+ * The same page views, per tree and revision — one appearance each, in this
130
+ * window.
131
+ *
132
+ * Held apart from `views` because it is the number the durable page-view
133
+ * counter keeps, and it is only worth keeping beside the exact count of page
134
+ * views that *began*: the difference between the two is the straddle that
135
+ * makes a distinct count added across windows generous, measured rather than
136
+ * bounded (0147). A revision whose batches carried no view key is absent
137
+ * rather than nought — there is nothing to compare, and a zero row would read
138
+ * as *no readers* rather than as *nobody minted a key*.
139
+ */
140
+ readonly appearances: readonly RevisionViews[];
112
141
  /**
113
142
  * Batches that carried no view key.
114
143
  *
@@ -120,6 +149,31 @@ export type Rollup = {
120
149
  * totals, instead of showing a rate that is quietly wrong.
121
150
  */
122
151
  readonly uncorrelated: number;
152
+ /**
153
+ * Batches this fold refused as a repeat of one it had already folded.
154
+ *
155
+ * A sender may deliver the same batch twice — a host's retry queue draining
156
+ * after an outage is the case `MAX_BATCHES_PER_DELIVERY` exists to allow, and
157
+ * an edge network replaying a `POST` is the case nobody writes. What that
158
+ * costs is **asymmetric and therefore invisible**: `views`, `reached`,
159
+ * `engaged` and `appearances` are sets of view keys, so a repeat adds the key
160
+ * it already holds and moves nothing, while `dwellMs`, `activations`, `opens`,
161
+ * `closes` and `completions` are occurrences and double. Every rate this
162
+ * subsystem publishes divides the second kind by the first, so a repeat does
163
+ * not look like noise — it looks like a reader who was twice as interested,
164
+ * and the cost of it is permanent (0158).
165
+ *
166
+ * So a batch identical to one already folded in this window is folded once and
167
+ * counted here. **Only where it carries a view key**: without one, two
168
+ * identical batches are as likely to be two readers in the same millisecond as
169
+ * one batch arriving twice, and dropping a reader to avoid a repeat is the
170
+ * worse of the two mistakes.
171
+ *
172
+ * Reported rather than silent, because the number is a fact about a
173
+ * deployment's senders and not about its readers: a window with repeats in it
174
+ * every run is a retry loop somebody should find.
175
+ */
176
+ readonly redelivered: number;
123
177
  };
124
178
  export declare const EMPTY_ROLLUP: Rollup;
125
179
  export type RollupOptions = {
@@ -137,6 +191,16 @@ export type RollupOptions = {
137
191
  * section" means nothing once a proposal has moved it, and adding two revisions
138
192
  * of a node together is exactly the mistake that makes *before versus after a
139
193
  * change* unreadable.
194
+ *
195
+ * **A batch delivered twice is folded once**, where it carries a view key, and
196
+ * the repeats are reported as {@link Rollup.redelivered}. The guarantee is
197
+ * exactly as wide as the window: two deliveries of one batch that land either
198
+ * side of a collection boundary are two windows' input and are counted twice,
199
+ * bounded by *(retry delay ÷ window length)* — the same shape of bound already
200
+ * stated for the page views that straddle one (0147), and shrinking with the
201
+ * same setting. The one-operation rule is untouched (0158): applying one
202
+ * window's rollup twice still doubles it, because that is two runs rather than
203
+ * two batches, and nothing here can see the other run.
140
204
  */
141
205
  export declare const rollUp: (batches: readonly ReaderSignalBatch[], options?: RollupOptions) => Rollup;
142
206
  //# sourceMappingURL=rollup.d.ts.map
Binary file
@@ -1,11 +1,24 @@
1
1
  /**
2
- * Three tables: the buffer batches wait in, and the two counters that outlive
2
+ * Five tables: the buffer batches wait in, and the four counters that outlive
3
3
  * them.
4
4
  *
5
5
  * The split is 0146's — raw signals are short-lived and aggregates are durable
6
6
  * — and it is in the schema rather than in a policy because a single table
7
7
  * would make the retention rule a `DELETE` somebody has to remember to write
8
8
  * correctly forever.
9
+ *
10
+ * All five carry `application_id` (0269), led by it in every key and every
11
+ * index, on the same terms as the store's four: a reader is filed against the
12
+ * application whose page they read, and no reading here spans two.
13
+ *
14
+ * All five then carry `audience_id` immediately after it
15
+ * ([0284](../../decisions/0284-a-signal-names-the-audience-it-was-collected-under-and-the-predicate-stays-in-the-control-plane.md)),
16
+ * which is the second of the two migrations
17
+ * [0273](../../decisions/0273-the-reader-tables-take-the-application-now-and-the-audience-when-it-is-ratified.md)
18
+ * chose to take rather than wait for. The two dimensions differ in kind, and
19
+ * the difference is why one is a handle's scope and the other is a column: no
20
+ * reading spans two applications, where comparing two audiences is the whole
21
+ * point of serving two.
9
22
  */
10
23
  /**
11
24
  * The buffer.
@@ -41,6 +54,40 @@ export declare const loomReaderSignals: import("drizzle-orm/pg-core").PgTableWit
41
54
  identity: undefined;
42
55
  generated: undefined;
43
56
  }, {}, {}>;
57
+ applicationId: import("drizzle-orm/pg-core").PgColumn<{
58
+ name: "application_id";
59
+ tableName: "loom_reader_signals";
60
+ dataType: "string";
61
+ columnType: "PgText";
62
+ data: string;
63
+ driverParam: string;
64
+ notNull: true;
65
+ hasDefault: true;
66
+ isPrimaryKey: false;
67
+ isAutoincrement: false;
68
+ hasRuntimeDefault: false;
69
+ enumValues: [string, ...string[]];
70
+ baseColumn: never;
71
+ identity: undefined;
72
+ generated: undefined;
73
+ }, {}, {}>;
74
+ audienceId: import("drizzle-orm/pg-core").PgColumn<{
75
+ name: "audience_id";
76
+ tableName: "loom_reader_signals";
77
+ dataType: "string";
78
+ columnType: "PgText";
79
+ data: string;
80
+ driverParam: string;
81
+ notNull: true;
82
+ hasDefault: true;
83
+ isPrimaryKey: false;
84
+ isAutoincrement: false;
85
+ hasRuntimeDefault: false;
86
+ enumValues: [string, ...string[]];
87
+ baseColumn: never;
88
+ identity: undefined;
89
+ generated: undefined;
90
+ }, {}, {}>;
44
91
  treeId: import("drizzle-orm/pg-core").PgColumn<{
45
92
  name: "tree_id";
46
93
  tableName: "loom_reader_signals";
@@ -157,6 +204,40 @@ export declare const loomReaderTallies: import("drizzle-orm/pg-core").PgTableWit
157
204
  name: "loom_reader_tallies";
158
205
  schema: undefined;
159
206
  columns: {
207
+ applicationId: import("drizzle-orm/pg-core").PgColumn<{
208
+ name: "application_id";
209
+ tableName: "loom_reader_tallies";
210
+ dataType: "string";
211
+ columnType: "PgText";
212
+ data: string;
213
+ driverParam: string;
214
+ notNull: true;
215
+ hasDefault: true;
216
+ isPrimaryKey: false;
217
+ isAutoincrement: false;
218
+ hasRuntimeDefault: false;
219
+ enumValues: [string, ...string[]];
220
+ baseColumn: never;
221
+ identity: undefined;
222
+ generated: undefined;
223
+ }, {}, {}>;
224
+ audienceId: import("drizzle-orm/pg-core").PgColumn<{
225
+ name: "audience_id";
226
+ tableName: "loom_reader_tallies";
227
+ dataType: "string";
228
+ columnType: "PgText";
229
+ data: string;
230
+ driverParam: string;
231
+ notNull: true;
232
+ hasDefault: true;
233
+ isPrimaryKey: false;
234
+ isAutoincrement: false;
235
+ hasRuntimeDefault: false;
236
+ enumValues: [string, ...string[]];
237
+ baseColumn: never;
238
+ identity: undefined;
239
+ generated: undefined;
240
+ }, {}, {}>;
160
241
  treeId: import("drizzle-orm/pg-core").PgColumn<{
161
242
  name: "tree_id";
162
243
  tableName: "loom_reader_tallies";
@@ -344,6 +425,23 @@ export declare const loomReaderTallies: import("drizzle-orm/pg-core").PgTableWit
344
425
  identity: undefined;
345
426
  generated: undefined;
346
427
  }, {}, {}>;
428
+ completions: import("drizzle-orm/pg-core").PgColumn<{
429
+ name: "completions";
430
+ tableName: "loom_reader_tallies";
431
+ dataType: "number";
432
+ columnType: "PgBigInt53";
433
+ data: number;
434
+ driverParam: string | number;
435
+ notNull: true;
436
+ hasDefault: true;
437
+ isPrimaryKey: false;
438
+ isAutoincrement: false;
439
+ hasRuntimeDefault: false;
440
+ enumValues: undefined;
441
+ baseColumn: never;
442
+ identity: undefined;
443
+ generated: undefined;
444
+ }, {}, {}>;
347
445
  updatedAt: import("drizzle-orm/pg-core").PgColumn<{
348
446
  name: "updated_at";
349
447
  tableName: "loom_reader_tallies";
@@ -375,6 +473,40 @@ export declare const loomReaderFunnels: import("drizzle-orm/pg-core").PgTableWit
375
473
  name: "loom_reader_funnels";
376
474
  schema: undefined;
377
475
  columns: {
476
+ applicationId: import("drizzle-orm/pg-core").PgColumn<{
477
+ name: "application_id";
478
+ tableName: "loom_reader_funnels";
479
+ dataType: "string";
480
+ columnType: "PgText";
481
+ data: string;
482
+ driverParam: string;
483
+ notNull: true;
484
+ hasDefault: true;
485
+ isPrimaryKey: false;
486
+ isAutoincrement: false;
487
+ hasRuntimeDefault: false;
488
+ enumValues: [string, ...string[]];
489
+ baseColumn: never;
490
+ identity: undefined;
491
+ generated: undefined;
492
+ }, {}, {}>;
493
+ audienceId: import("drizzle-orm/pg-core").PgColumn<{
494
+ name: "audience_id";
495
+ tableName: "loom_reader_funnels";
496
+ dataType: "string";
497
+ columnType: "PgText";
498
+ data: string;
499
+ driverParam: string;
500
+ notNull: true;
501
+ hasDefault: true;
502
+ isPrimaryKey: false;
503
+ isAutoincrement: false;
504
+ hasRuntimeDefault: false;
505
+ enumValues: [string, ...string[]];
506
+ baseColumn: never;
507
+ identity: undefined;
508
+ generated: undefined;
509
+ }, {}, {}>;
378
510
  treeId: import("drizzle-orm/pg-core").PgColumn<{
379
511
  name: "tree_id";
380
512
  tableName: "loom_reader_funnels";
@@ -531,4 +663,303 @@ export declare const loomReaderFunnels: import("drizzle-orm/pg-core").PgTableWit
531
663
  };
532
664
  dialect: "pg";
533
665
  }>;
666
+ /**
667
+ * One region at one revision, as page views that began there.
668
+ *
669
+ * The narrowest table in the subsystem, and the narrowness is the point: a tree,
670
+ * a revision, a country and a number. There is no view key, no address, no
671
+ * digest of one and no per-arrival row, so there is nothing here to join against
672
+ * — which is what makes a region safe to keep for as long as the counters it
673
+ * sits beside.
674
+ *
675
+ * Written on the request path rather than by a rollup, because the request is
676
+ * the only place the region was ever knowable, and `views` counts openings so
677
+ * that a long visit is not a large number.
678
+ */
679
+ export declare const loomReaderRegions: import("drizzle-orm/pg-core").PgTableWithColumns<{
680
+ name: "loom_reader_regions";
681
+ schema: undefined;
682
+ columns: {
683
+ applicationId: import("drizzle-orm/pg-core").PgColumn<{
684
+ name: "application_id";
685
+ tableName: "loom_reader_regions";
686
+ dataType: "string";
687
+ columnType: "PgText";
688
+ data: string;
689
+ driverParam: string;
690
+ notNull: true;
691
+ hasDefault: true;
692
+ isPrimaryKey: false;
693
+ isAutoincrement: false;
694
+ hasRuntimeDefault: false;
695
+ enumValues: [string, ...string[]];
696
+ baseColumn: never;
697
+ identity: undefined;
698
+ generated: undefined;
699
+ }, {}, {}>;
700
+ audienceId: import("drizzle-orm/pg-core").PgColumn<{
701
+ name: "audience_id";
702
+ tableName: "loom_reader_regions";
703
+ dataType: "string";
704
+ columnType: "PgText";
705
+ data: string;
706
+ driverParam: string;
707
+ notNull: true;
708
+ hasDefault: true;
709
+ isPrimaryKey: false;
710
+ isAutoincrement: false;
711
+ hasRuntimeDefault: false;
712
+ enumValues: [string, ...string[]];
713
+ baseColumn: never;
714
+ identity: undefined;
715
+ generated: undefined;
716
+ }, {}, {}>;
717
+ treeId: import("drizzle-orm/pg-core").PgColumn<{
718
+ name: "tree_id";
719
+ tableName: "loom_reader_regions";
720
+ dataType: "string";
721
+ columnType: "PgText";
722
+ data: string;
723
+ driverParam: string;
724
+ notNull: true;
725
+ hasDefault: false;
726
+ isPrimaryKey: false;
727
+ isAutoincrement: false;
728
+ hasRuntimeDefault: false;
729
+ enumValues: [string, ...string[]];
730
+ baseColumn: never;
731
+ identity: undefined;
732
+ generated: undefined;
733
+ }, {}, {}>;
734
+ revision: import("drizzle-orm/pg-core").PgColumn<{
735
+ name: "revision";
736
+ tableName: "loom_reader_regions";
737
+ dataType: "number";
738
+ columnType: "PgInteger";
739
+ data: number;
740
+ driverParam: string | number;
741
+ notNull: true;
742
+ hasDefault: false;
743
+ isPrimaryKey: false;
744
+ isAutoincrement: false;
745
+ hasRuntimeDefault: false;
746
+ enumValues: undefined;
747
+ baseColumn: never;
748
+ identity: undefined;
749
+ generated: undefined;
750
+ }, {}, {}>;
751
+ region: import("drizzle-orm/pg-core").PgColumn<{
752
+ name: "region";
753
+ tableName: "loom_reader_regions";
754
+ dataType: "string";
755
+ columnType: "PgText";
756
+ data: string;
757
+ driverParam: string;
758
+ notNull: true;
759
+ hasDefault: false;
760
+ isPrimaryKey: false;
761
+ isAutoincrement: false;
762
+ hasRuntimeDefault: false;
763
+ enumValues: [string, ...string[]];
764
+ baseColumn: never;
765
+ identity: undefined;
766
+ generated: undefined;
767
+ }, {}, {}>;
768
+ views: import("drizzle-orm/pg-core").PgColumn<{
769
+ name: "views";
770
+ tableName: "loom_reader_regions";
771
+ dataType: "number";
772
+ columnType: "PgBigInt53";
773
+ data: number;
774
+ driverParam: string | number;
775
+ notNull: true;
776
+ hasDefault: false;
777
+ isPrimaryKey: false;
778
+ isAutoincrement: false;
779
+ hasRuntimeDefault: false;
780
+ enumValues: undefined;
781
+ baseColumn: never;
782
+ identity: undefined;
783
+ generated: undefined;
784
+ }, {}, {}>;
785
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
786
+ name: "updated_at";
787
+ tableName: "loom_reader_regions";
788
+ dataType: "date";
789
+ columnType: "PgTimestamp";
790
+ data: Date;
791
+ driverParam: string;
792
+ notNull: true;
793
+ hasDefault: false;
794
+ isPrimaryKey: false;
795
+ isAutoincrement: false;
796
+ hasRuntimeDefault: false;
797
+ enumValues: undefined;
798
+ baseColumn: never;
799
+ identity: undefined;
800
+ generated: undefined;
801
+ }, {}, {}>;
802
+ };
803
+ dialect: "pg";
804
+ }>;
805
+ /**
806
+ * One revision's page views, counted from both ends.
807
+ *
808
+ * Two columns rather than two tables, because they are two counts of the same
809
+ * page views and the only question anybody asks of them is their difference:
810
+ * `opened` is written at the door, once per page view that began, and
811
+ * `appearances` by each rollup that saw that page view in its window. Keeping
812
+ * them in one row makes the subtraction a column expression instead of a join,
813
+ * and makes it impossible for a reading to find one and not the other.
814
+ *
815
+ * Both default to nought because either side may create the row, and nought is
816
+ * the true answer for the column that has not been written yet rather than a
817
+ * missing one.
818
+ *
819
+ * As narrow as the regions table and for the same reason: a tree, a revision
820
+ * and two numbers. No view key, no region, nothing per arrival, nothing to join.
821
+ */
822
+ export declare const loomReaderPageViews: import("drizzle-orm/pg-core").PgTableWithColumns<{
823
+ name: "loom_reader_page_views";
824
+ schema: undefined;
825
+ columns: {
826
+ applicationId: import("drizzle-orm/pg-core").PgColumn<{
827
+ name: "application_id";
828
+ tableName: "loom_reader_page_views";
829
+ dataType: "string";
830
+ columnType: "PgText";
831
+ data: string;
832
+ driverParam: string;
833
+ notNull: true;
834
+ hasDefault: true;
835
+ isPrimaryKey: false;
836
+ isAutoincrement: false;
837
+ hasRuntimeDefault: false;
838
+ enumValues: [string, ...string[]];
839
+ baseColumn: never;
840
+ identity: undefined;
841
+ generated: undefined;
842
+ }, {}, {}>;
843
+ audienceId: import("drizzle-orm/pg-core").PgColumn<{
844
+ name: "audience_id";
845
+ tableName: "loom_reader_page_views";
846
+ dataType: "string";
847
+ columnType: "PgText";
848
+ data: string;
849
+ driverParam: string;
850
+ notNull: true;
851
+ hasDefault: true;
852
+ isPrimaryKey: false;
853
+ isAutoincrement: false;
854
+ hasRuntimeDefault: false;
855
+ enumValues: [string, ...string[]];
856
+ baseColumn: never;
857
+ identity: undefined;
858
+ generated: undefined;
859
+ }, {}, {}>;
860
+ treeId: import("drizzle-orm/pg-core").PgColumn<{
861
+ name: "tree_id";
862
+ tableName: "loom_reader_page_views";
863
+ dataType: "string";
864
+ columnType: "PgText";
865
+ data: string;
866
+ driverParam: string;
867
+ notNull: true;
868
+ hasDefault: false;
869
+ isPrimaryKey: false;
870
+ isAutoincrement: false;
871
+ hasRuntimeDefault: false;
872
+ enumValues: [string, ...string[]];
873
+ baseColumn: never;
874
+ identity: undefined;
875
+ generated: undefined;
876
+ }, {}, {}>;
877
+ revision: import("drizzle-orm/pg-core").PgColumn<{
878
+ name: "revision";
879
+ tableName: "loom_reader_page_views";
880
+ dataType: "number";
881
+ columnType: "PgInteger";
882
+ data: number;
883
+ driverParam: string | number;
884
+ notNull: true;
885
+ hasDefault: false;
886
+ isPrimaryKey: false;
887
+ isAutoincrement: false;
888
+ hasRuntimeDefault: false;
889
+ enumValues: undefined;
890
+ baseColumn: never;
891
+ identity: undefined;
892
+ generated: undefined;
893
+ }, {}, {}>;
894
+ opened: import("drizzle-orm/pg-core").PgColumn<{
895
+ name: "opened";
896
+ tableName: "loom_reader_page_views";
897
+ dataType: "number";
898
+ columnType: "PgBigInt53";
899
+ data: number;
900
+ driverParam: string | number;
901
+ notNull: true;
902
+ hasDefault: true;
903
+ isPrimaryKey: false;
904
+ isAutoincrement: false;
905
+ hasRuntimeDefault: false;
906
+ enumValues: undefined;
907
+ baseColumn: never;
908
+ identity: undefined;
909
+ generated: undefined;
910
+ }, {}, {}>;
911
+ appearances: import("drizzle-orm/pg-core").PgColumn<{
912
+ name: "appearances";
913
+ tableName: "loom_reader_page_views";
914
+ dataType: "number";
915
+ columnType: "PgBigInt53";
916
+ data: number;
917
+ driverParam: string | number;
918
+ notNull: true;
919
+ hasDefault: true;
920
+ isPrimaryKey: false;
921
+ isAutoincrement: false;
922
+ hasRuntimeDefault: false;
923
+ enumValues: undefined;
924
+ baseColumn: never;
925
+ identity: undefined;
926
+ generated: undefined;
927
+ }, {}, {}>;
928
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
929
+ name: "updated_at";
930
+ tableName: "loom_reader_page_views";
931
+ dataType: "date";
932
+ columnType: "PgTimestamp";
933
+ data: Date;
934
+ driverParam: string;
935
+ notNull: true;
936
+ hasDefault: false;
937
+ isPrimaryKey: false;
938
+ isAutoincrement: false;
939
+ hasRuntimeDefault: false;
940
+ enumValues: undefined;
941
+ baseColumn: never;
942
+ identity: undefined;
943
+ generated: undefined;
944
+ }, {}, {}>;
945
+ foldedAt: import("drizzle-orm/pg-core").PgColumn<{
946
+ name: "folded_at";
947
+ tableName: "loom_reader_page_views";
948
+ dataType: "date";
949
+ columnType: "PgTimestamp";
950
+ data: Date;
951
+ driverParam: string;
952
+ notNull: false;
953
+ hasDefault: false;
954
+ isPrimaryKey: false;
955
+ isAutoincrement: false;
956
+ hasRuntimeDefault: false;
957
+ enumValues: undefined;
958
+ baseColumn: never;
959
+ identity: undefined;
960
+ generated: undefined;
961
+ }, {}, {}>;
962
+ };
963
+ dialect: "pg";
964
+ }>;
534
965
  //# sourceMappingURL=schema.d.ts.map