@jam-overture/loom 0.1.0 → 0.3.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 (414) 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/audience/compose.d.ts +112 -0
  11. package/dist/audience/compose.js +134 -0
  12. package/dist/audience/memory.d.ts +14 -0
  13. package/dist/audience/memory.js +71 -0
  14. package/dist/audience/overlay-store.d.ts +343 -0
  15. package/dist/audience/overlay-store.js +217 -0
  16. package/dist/audience/rule.d.ts +121 -0
  17. package/dist/audience/rule.js +78 -0
  18. package/dist/cli/index.d.ts +3 -4
  19. package/dist/cli/index.js +3 -4
  20. package/dist/cli/templates.js +19 -0
  21. package/dist/data/adapter.d.ts +9 -1
  22. package/dist/data/adapter.js +2 -0
  23. package/dist/data/plan.js +0 -0
  24. package/dist/data/resolution.d.ts +23 -1
  25. package/dist/data/resolve.d.ts +31 -4
  26. package/dist/data/resolve.js +11 -3
  27. package/dist/ids.d.ts +10 -0
  28. package/dist/ids.js +11 -1
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +1 -0
  31. package/dist/interpretation/anthropic.d.ts +1 -1
  32. package/dist/interpretation/anthropic.js +2 -22
  33. package/dist/interpretation/client.d.ts +1 -1
  34. package/dist/interpretation/materialize.js +67 -22
  35. package/dist/interpretation/openai-compatible.d.ts +36 -0
  36. package/dist/interpretation/openai-compatible.js +79 -0
  37. package/dist/interpretation/status.d.ts +19 -0
  38. package/dist/interpretation/status.js +26 -0
  39. package/dist/live/index.d.ts +73 -0
  40. package/dist/live/index.js +73 -0
  41. package/dist/live/pages.d.ts +187 -0
  42. package/dist/live/pages.js +161 -0
  43. package/dist/live/pull.d.ts +147 -0
  44. package/dist/live/pull.js +398 -0
  45. package/dist/live/pulling.d.ts +79 -0
  46. package/dist/live/pulling.js +117 -0
  47. package/dist/live/window.d.ts +129 -0
  48. package/dist/live/window.js +132 -0
  49. package/dist/patch.d.ts +54 -0
  50. package/dist/patch.js +44 -0
  51. package/dist/project/closing.d.ts +51 -0
  52. package/dist/project/closing.js +53 -0
  53. package/dist/project/memory.d.ts +20 -0
  54. package/dist/project/memory.js +97 -0
  55. package/dist/project/project.d.ts +90 -0
  56. package/dist/project/project.js +91 -0
  57. package/dist/project/store.d.ts +135 -0
  58. package/dist/project/store.js +41 -0
  59. package/dist/registered.d.ts +64 -0
  60. package/dist/registered.js +118 -0
  61. package/dist/render/addressed.d.ts +35 -0
  62. package/dist/render/addressed.js +79 -0
  63. package/dist/render/behaviour-adjust.d.ts +11 -19
  64. package/dist/render/behaviour-adjust.js +75 -21
  65. package/dist/render/behaviour-present.d.ts +8 -0
  66. package/dist/render/behaviour-present.js +57 -6
  67. package/dist/render/behaviour.d.ts +98 -17
  68. package/dist/render/behaviour.js +91 -26
  69. package/dist/render/control-name.d.ts +68 -0
  70. package/dist/render/control-name.js +37 -0
  71. package/dist/render/diagnostics.d.ts +72 -0
  72. package/dist/render/diagnostics.js +7 -0
  73. package/dist/render/document-theme.d.ts +70 -0
  74. package/dist/render/document-theme.js +139 -0
  75. package/dist/render/editable.d.ts +15 -1
  76. package/dist/render/editable.js +13 -1
  77. package/dist/render/expected.d.ts +98 -0
  78. package/dist/render/expected.js +88 -0
  79. package/dist/render/index.d.ts +4 -0
  80. package/dist/render/index.js +4 -0
  81. package/dist/render/reads.d.ts +11 -0
  82. package/dist/render/reads.js +12 -1
  83. package/dist/render/render.d.ts +11 -0
  84. package/dist/render/render.js +294 -53
  85. package/dist/render/request.d.ts +8 -1
  86. package/dist/render/request.js +1 -0
  87. package/dist/render/slots.d.ts +52 -0
  88. package/dist/render/slots.js +24 -0
  89. package/dist/render/theme.d.ts +54 -1
  90. package/dist/render/theme.js +23 -1
  91. package/dist/render/unshown.d.ts +152 -0
  92. package/dist/render/unshown.js +80 -0
  93. package/dist/runtime/analysis.d.ts +94 -9
  94. package/dist/runtime/analysis.js +54 -9
  95. package/dist/runtime/assessment.d.ts +36 -2
  96. package/dist/runtime/assessment.js +27 -2
  97. package/dist/runtime/auto-apply-ceiling.d.ts +54 -0
  98. package/dist/runtime/auto-apply-ceiling.js +66 -0
  99. package/dist/runtime/checks.d.ts +148 -0
  100. package/dist/runtime/checks.js +112 -0
  101. package/dist/runtime/disposition.d.ts +96 -0
  102. package/dist/runtime/disposition.js +46 -0
  103. package/dist/runtime/gate.js +91 -10
  104. package/dist/runtime/index.d.ts +4 -0
  105. package/dist/runtime/index.js +4 -0
  106. package/dist/runtime/irreversibility.d.ts +64 -0
  107. package/dist/runtime/irreversibility.js +45 -0
  108. package/dist/runtime/nesting.d.ts +13 -1
  109. package/dist/runtime/nesting.js +41 -24
  110. package/dist/runtime/pipeline.d.ts +43 -0
  111. package/dist/runtime/pipeline.js +10 -2
  112. package/dist/runtime/policy-change.d.ts +93 -0
  113. package/dist/runtime/policy-change.js +305 -0
  114. package/dist/runtime/policy-log.d.ts +406 -0
  115. package/dist/runtime/policy-log.js +285 -0
  116. package/dist/runtime/policy.d.ts +8 -6
  117. package/dist/runtime/policy.js +5 -2
  118. package/dist/runtime/repointing.js +0 -0
  119. package/dist/runtime/reversibility.d.ts +11 -9
  120. package/dist/runtime/stakes.d.ts +129 -1
  121. package/dist/runtime/stakes.js +240 -26
  122. package/dist/runtime/vocabulary.d.ts +164 -7
  123. package/dist/runtime/vocabulary.js +181 -8
  124. package/dist/sdk/audit.d.ts +174 -3
  125. package/dist/sdk/audit.js +176 -17
  126. package/dist/sdk/catalogue.d.ts +9 -1
  127. package/dist/sdk/conformance.d.ts +37 -3
  128. package/dist/sdk/conformance.js +25 -4
  129. package/dist/sdk/definition.d.ts +129 -5
  130. package/dist/sdk/definition.js +66 -0
  131. package/dist/sdk/registry.d.ts +45 -2
  132. package/dist/sdk/registry.js +102 -1
  133. package/dist/signals/acted.contract.d.ts +21 -0
  134. package/dist/signals/acted.contract.js +236 -0
  135. package/dist/signals/acted.d.ts +359 -0
  136. package/dist/signals/acted.js +135 -0
  137. package/dist/signals/action-change.d.ts +507 -0
  138. package/dist/signals/action-change.js +265 -0
  139. package/dist/signals/action.d.ts +331 -0
  140. package/dist/signals/action.js +182 -0
  141. package/dist/signals/agenda.d.ts +585 -0
  142. package/dist/signals/agenda.js +295 -0
  143. package/dist/signals/applied-window.contract.d.ts +23 -0
  144. package/dist/signals/applied-window.contract.js +160 -0
  145. package/dist/signals/arrivals.contract.d.ts +21 -0
  146. package/dist/signals/arrivals.contract.js +180 -0
  147. package/dist/signals/arrivals.d.ts +375 -0
  148. package/dist/signals/arrivals.js +254 -0
  149. package/dist/signals/arriving.d.ts +210 -0
  150. package/dist/signals/arriving.js +133 -0
  151. package/dist/signals/audiences.d.ts +528 -0
  152. package/dist/signals/audiences.js +255 -0
  153. package/dist/signals/broadcast.d.ts +33 -17
  154. package/dist/signals/broadcast.js +255 -32
  155. package/dist/signals/change.d.ts +378 -0
  156. package/dist/signals/change.js +327 -0
  157. package/dist/signals/collect.d.ts +169 -34
  158. package/dist/signals/collect.js +186 -38
  159. package/dist/signals/conversion.d.ts +348 -0
  160. package/dist/signals/conversion.js +235 -0
  161. package/dist/signals/copy-change.d.ts +553 -0
  162. package/dist/signals/copy-change.js +377 -0
  163. package/dist/signals/copy.d.ts +337 -0
  164. package/dist/signals/copy.js +211 -0
  165. package/dist/signals/correlated.contract.d.ts +24 -0
  166. package/dist/signals/correlated.contract.js +94 -0
  167. package/dist/signals/counters.d.ts +97 -0
  168. package/dist/signals/counters.js +160 -0
  169. package/dist/signals/deliver.d.ts +23 -4
  170. package/dist/signals/deliver.js +34 -6
  171. package/dist/signals/deployment-change.d.ts +395 -0
  172. package/dist/signals/deployment-change.js +309 -0
  173. package/dist/signals/deployment.d.ts +278 -0
  174. package/dist/signals/deployment.js +178 -0
  175. package/dist/signals/door.d.ts +114 -0
  176. package/dist/signals/door.js +77 -0
  177. package/dist/signals/expire.d.ts +192 -0
  178. package/dist/signals/expire.js +213 -0
  179. package/dist/signals/fold.d.ts +10 -0
  180. package/dist/signals/fold.js +5 -1
  181. package/dist/signals/form-action.d.ts +302 -0
  182. package/dist/signals/form-action.js +169 -0
  183. package/dist/signals/form-copy.d.ts +523 -0
  184. package/dist/signals/form-copy.js +346 -0
  185. package/dist/signals/forms.d.ts +247 -0
  186. package/dist/signals/forms.js +147 -0
  187. package/dist/signals/frontier.d.ts +268 -0
  188. package/dist/signals/frontier.js +145 -0
  189. package/dist/signals/funnel-change.d.ts +548 -0
  190. package/dist/signals/funnel-change.js +361 -0
  191. package/dist/signals/funnel-hours.contract.d.ts +21 -0
  192. package/dist/signals/funnel-hours.contract.js +221 -0
  193. package/dist/signals/funnel-hours.d.ts +293 -0
  194. package/dist/signals/funnel-hours.js +99 -0
  195. package/dist/signals/funnel.d.ts +592 -0
  196. package/dist/signals/funnel.js +231 -0
  197. package/dist/signals/health.d.ts +694 -0
  198. package/dist/signals/health.js +573 -0
  199. package/dist/signals/index.d.ts +60 -0
  200. package/dist/signals/index.js +60 -0
  201. package/dist/signals/ingest.d.ts +56 -1
  202. package/dist/signals/ingest.js +91 -1
  203. package/dist/signals/inside.d.ts +190 -0
  204. package/dist/signals/inside.js +263 -0
  205. package/dist/signals/join.d.ts +56 -0
  206. package/dist/signals/join.js +60 -0
  207. package/dist/signals/journal.d.ts +123 -9
  208. package/dist/signals/kept.contract.d.ts +22 -0
  209. package/dist/signals/kept.contract.js +111 -0
  210. package/dist/signals/kinds.d.ts +8 -6
  211. package/dist/signals/kinds.js +14 -6
  212. package/dist/signals/library-action.d.ts +430 -0
  213. package/dist/signals/library-action.js +336 -0
  214. package/dist/signals/library-agenda-change.d.ts +324 -0
  215. package/dist/signals/library-agenda-change.js +199 -0
  216. package/dist/signals/library-agenda.d.ts +258 -0
  217. package/dist/signals/library-agenda.js +167 -0
  218. package/dist/signals/library-change.d.ts +477 -0
  219. package/dist/signals/library-change.js +335 -0
  220. package/dist/signals/library-copy-change.d.ts +498 -0
  221. package/dist/signals/library-copy-change.js +476 -0
  222. package/dist/signals/library-pace.d.ts +319 -0
  223. package/dist/signals/library-pace.js +305 -0
  224. package/dist/signals/library-reach-change.d.ts +646 -0
  225. package/dist/signals/library-reach-change.js +542 -0
  226. package/dist/signals/library-reach.d.ts +377 -0
  227. package/dist/signals/library-reach.js +227 -0
  228. package/dist/signals/library-senders-change.d.ts +457 -0
  229. package/dist/signals/library-senders-change.js +367 -0
  230. package/dist/signals/library-senders-reach-change.d.ts +486 -0
  231. package/dist/signals/library-senders-reach-change.js +538 -0
  232. package/dist/signals/library-senders-reach.d.ts +340 -0
  233. package/dist/signals/library-senders-reach.js +252 -0
  234. package/dist/signals/library-senders.d.ts +271 -0
  235. package/dist/signals/library-senders.js +180 -0
  236. package/dist/signals/library-word-reach-change.d.ts +567 -0
  237. package/dist/signals/library-word-reach-change.js +564 -0
  238. package/dist/signals/library.d.ts +306 -0
  239. package/dist/signals/library.js +178 -0
  240. package/dist/signals/memory.d.ts +9 -0
  241. package/dist/signals/memory.js +246 -14
  242. package/dist/signals/migrate.d.ts +20 -4
  243. package/dist/signals/migrate.js +269 -8
  244. package/dist/signals/notice.d.ts +389 -0
  245. package/dist/signals/notice.js +250 -0
  246. package/dist/signals/pace-change.d.ts +501 -0
  247. package/dist/signals/pace-change.js +310 -0
  248. package/dist/signals/pace.d.ts +296 -0
  249. package/dist/signals/pace.js +291 -0
  250. package/dist/signals/page-views.d.ts +365 -0
  251. package/dist/signals/page-views.js +218 -0
  252. package/dist/signals/part-pace.d.ts +378 -0
  253. package/dist/signals/part-pace.js +333 -0
  254. package/dist/signals/parts.d.ts +354 -0
  255. package/dist/signals/parts.js +232 -0
  256. package/dist/signals/postgres.d.ts +16 -2
  257. package/dist/signals/postgres.js +753 -76
  258. package/dist/signals/progress.d.ts +212 -0
  259. package/dist/signals/progress.js +150 -0
  260. package/dist/signals/ratios.d.ts +108 -0
  261. package/dist/signals/ratios.js +40 -0
  262. package/dist/signals/reach.d.ts +309 -0
  263. package/dist/signals/reach.js +93 -0
  264. package/dist/signals/readable.d.ts +34 -0
  265. package/dist/signals/readable.js +34 -0
  266. package/dist/signals/readership.d.ts +381 -0
  267. package/dist/signals/readership.js +308 -0
  268. package/dist/signals/region-pages.d.ts +173 -0
  269. package/dist/signals/region-pages.js +62 -0
  270. package/dist/signals/region.d.ts +287 -0
  271. package/dist/signals/region.js +198 -0
  272. package/dist/signals/retention.d.ts +163 -0
  273. package/dist/signals/retention.js +75 -0
  274. package/dist/signals/rhythm.d.ts +302 -0
  275. package/dist/signals/rhythm.js +262 -0
  276. package/dist/signals/rollup.d.ts +194 -4
  277. package/dist/signals/rollup.js +0 -0
  278. package/dist/signals/schema.d.ts +1069 -1
  279. package/dist/signals/schema.js +393 -3
  280. package/dist/signals/signal.d.ts +237 -11
  281. package/dist/signals/signal.js +70 -10
  282. package/dist/signals/silence-census.d.ts +205 -0
  283. package/dist/signals/silence-census.js +87 -0
  284. package/dist/signals/silences.d.ts +1147 -0
  285. package/dist/signals/silences.js +996 -0
  286. package/dist/signals/subtrees.d.ts +123 -0
  287. package/dist/signals/subtrees.js +102 -0
  288. package/dist/signals/tally.d.ts +262 -12
  289. package/dist/signals/unread.d.ts +292 -0
  290. package/dist/signals/unread.js +137 -0
  291. package/dist/signals/window-agenda.d.ts +276 -0
  292. package/dist/signals/window-agenda.js +83 -0
  293. package/dist/signals/window-figures.d.ts +148 -0
  294. package/dist/signals/window-figures.js +42 -0
  295. package/dist/signals/window-funnels.d.ts +88 -0
  296. package/dist/signals/window-funnels.js +47 -0
  297. package/dist/signals/window.d.ts +866 -0
  298. package/dist/signals/window.js +693 -0
  299. package/dist/signals/words.d.ts +24 -0
  300. package/dist/signals/words.js +24 -0
  301. package/dist/store/cache.d.ts +101 -0
  302. package/dist/store/cache.js +149 -0
  303. package/dist/store/history.d.ts +82 -0
  304. package/dist/store/history.js +36 -0
  305. package/dist/store/index.d.ts +30 -0
  306. package/dist/store/index.js +30 -0
  307. package/dist/store/memory.d.ts +2 -1
  308. package/dist/store/memory.js +48 -12
  309. package/dist/store/migrate.d.ts +106 -0
  310. package/dist/store/migrate.js +323 -7
  311. package/dist/store/postgres-applications.d.ts +4 -0
  312. package/dist/store/postgres-applications.js +197 -0
  313. package/dist/store/postgres-audience.d.ts +14 -0
  314. package/dist/store/postgres-audience.js +272 -0
  315. package/dist/store/postgres-holds.d.ts +10 -1
  316. package/dist/store/postgres-holds.js +116 -101
  317. package/dist/store/postgres-policy-log.d.ts +14 -0
  318. package/dist/store/postgres-policy-log.js +240 -0
  319. package/dist/store/postgres-projects.d.ts +4 -0
  320. package/dist/store/postgres-projects.js +217 -0
  321. package/dist/store/postgres.d.ts +17 -1
  322. package/dist/store/postgres.js +60 -9
  323. package/dist/store/replay.d.ts +102 -1
  324. package/dist/store/replay.js +190 -19
  325. package/dist/store/reseed.d.ts +238 -0
  326. package/dist/store/reseed.js +308 -0
  327. package/dist/store/schema.d.ts +762 -2
  328. package/dist/store/schema.js +218 -5
  329. package/dist/store/source.d.ts +57 -1
  330. package/dist/store/source.js +65 -1
  331. package/dist/store/store.d.ts +29 -6
  332. package/dist/submit/resolve.d.ts +1 -1
  333. package/dist/submit/resolve.js +2 -1
  334. package/dist/telemetry/calibration.d.ts +25 -0
  335. package/dist/telemetry/calibration.js +27 -1
  336. package/dist/telemetry/event.d.ts +391 -33
  337. package/dist/telemetry/event.js +84 -20
  338. package/dist/telemetry/index.d.ts +2 -0
  339. package/dist/telemetry/index.js +2 -0
  340. package/dist/telemetry/journal.d.ts +104 -3
  341. package/dist/telemetry/journal.js +9 -0
  342. package/dist/telemetry/lookup.d.ts +27 -0
  343. package/dist/telemetry/lookup.js +18 -0
  344. package/dist/telemetry/memory.js +33 -1
  345. package/dist/telemetry/migrate.js +22 -1
  346. package/dist/telemetry/postgres.d.ts +10 -1
  347. package/dist/telemetry/postgres.js +188 -90
  348. package/dist/telemetry/remeasure.d.ts +78 -0
  349. package/dist/telemetry/remeasure.js +83 -0
  350. package/dist/telemetry/retention.d.ts +2 -2
  351. package/dist/telemetry/schema.d.ts +17 -0
  352. package/dist/telemetry/schema.js +27 -1
  353. package/dist/telemetry/sink.d.ts +2 -2
  354. package/dist/telemetry/window.d.ts +135 -0
  355. package/dist/telemetry/window.js +101 -0
  356. package/dist/testing/application-contract.d.ts +14 -0
  357. package/dist/testing/application-contract.js +270 -0
  358. package/dist/testing/audience-overlay-contract.d.ts +31 -0
  359. package/dist/testing/audience-overlay-contract.js +354 -0
  360. package/dist/testing/contracts.d.ts +13 -7
  361. package/dist/testing/contracts.js +13 -7
  362. package/dist/testing/definitions.d.ts +78 -0
  363. package/dist/testing/definitions.js +134 -9
  364. package/dist/testing/doubles.d.ts +103 -0
  365. package/dist/testing/doubles.js +143 -0
  366. package/dist/testing/index.d.ts +2 -2
  367. package/dist/testing/index.js +2 -2
  368. package/dist/testing/journal-contract.js +297 -6
  369. package/dist/testing/model-contract.d.ts +110 -0
  370. package/dist/testing/model-contract.js +150 -0
  371. package/dist/testing/policy-log-contract.d.ts +26 -0
  372. package/dist/testing/policy-log-contract.js +344 -0
  373. package/dist/testing/project-contract.d.ts +14 -0
  374. package/dist/testing/project-contract.js +266 -0
  375. package/dist/testing/reader-signal-contract.d.ts +27 -2
  376. package/dist/testing/reader-signal-contract.js +475 -5
  377. package/dist/testing/store-contract.d.ts +7 -1
  378. package/dist/testing/store-contract.js +84 -3
  379. package/dist/theme/apply.d.ts +20 -1
  380. package/dist/theme/apply.js +5 -3
  381. package/dist/theme/contrast.d.ts +19 -14
  382. package/dist/theme/contrast.js +181 -17
  383. package/dist/theme/derive.d.ts +22 -0
  384. package/dist/theme/derive.js +54 -1
  385. package/dist/theme/library.js +1 -1
  386. package/dist/theme/measure.d.ts +34 -0
  387. package/dist/theme/measure.js +30 -1
  388. package/dist/theme/palettes.js +7 -7
  389. package/dist/theme/ramp.d.ts +64 -0
  390. package/dist/theme/ramp.js +114 -0
  391. package/dist/theme/registry.d.ts +9 -0
  392. package/dist/theme/registry.js +11 -1
  393. package/dist/theme/separation.d.ts +97 -3
  394. package/dist/theme/separation.js +75 -0
  395. package/dist/tree/apply.js +13 -0
  396. package/dist/tree/compare.d.ts +9 -0
  397. package/dist/tree/compare.js +18 -0
  398. package/dist/tree/mutation.d.ts +18 -0
  399. package/dist/tree/mutation.js +24 -12
  400. package/dist/tree/navigation.d.ts +5 -0
  401. package/dist/tree/navigation.js +32 -10
  402. package/dist/tree/outline.d.ts +7 -0
  403. package/dist/tree/outline.js +9 -5
  404. package/dist/write/computed.d.ts +60 -0
  405. package/dist/write/computed.js +61 -0
  406. package/dist/write/held.d.ts +59 -0
  407. package/dist/write/index.d.ts +5 -2
  408. package/dist/write/index.js +5 -2
  409. package/dist/write/reseed.d.ts +151 -0
  410. package/dist/write/reseed.js +184 -0
  411. package/dist/write/revert.js +2 -16
  412. package/package.json +25 -3
  413. package/dist/runtime/inverse-interpreter.d.ts +0 -90
  414. package/dist/runtime/inverse-interpreter.js +0 -56
@@ -0,0 +1,477 @@
1
+ import type { AudienceId } from "../audience/audience.js";
2
+ import type { NodeId, TreeId } from "../ids.js";
3
+ import type { PrimitiveType } from "../primitive-type.js";
4
+ import { type PrimitiveRole } from "../role.js";
5
+ import { type ComparedPopulations, type PageForm } from "./audiences.js";
6
+ import { type KindKey } from "./library.js";
7
+ import type { PageReading, PartReading } from "./parts.js";
8
+ /**
9
+ * What a change did to a kind of part, everywhere it stands.
10
+ *
11
+ * Three readings of a library answer about **one window**: the places a kind
12
+ * stands and how many were reached ([`library.ts`](library.ts)), the share of
13
+ * the readers who met it that read it ([`library-reach.ts`](library-reach.ts)),
14
+ * and the share of those readers that acted inside it
15
+ * ([`library-action.ts`](library-action.ts)). Six comparisons answer about
16
+ * **two** windows — where reading stops, the words readers reached, whether
17
+ * they had time for them, who they were, what they did, and the pair a change
18
+ * dissolved — and every one of them is asked of **one page**.
19
+ *
20
+ * So the question an author who changed a *component* has could not be asked.
21
+ * *I rewrote the testimonial band last week; is it read now?* is a question
22
+ * about a kind of part across forty pages, and the only thing available was two
23
+ * censuses on two screens and a person subtracting one share from the other —
24
+ * which is the subtraction this module exists to refuse, because the two
25
+ * censuses are taken over **different sets of places**. A page published in
26
+ * between adds a placement; a page that expired takes one away; and a share of
27
+ * places moves with both while no reader does anything differently.
28
+ *
29
+ * It is the **seventeenth** thing taken out of what this subsystem already
30
+ * knows rather than collected: **nothing is added to a payload, a browser, a
31
+ * column, a store or the vocabulary of kinds**, and the broadcaster is not
32
+ * touched.
33
+ *
34
+ * ## The places are held still, which is the whole of the method
35
+ *
36
+ * Every figure here is taken over the placements that stand in **both**
37
+ * windows: the same node of the same page, of the same kind on both sides. A
38
+ * placement only one side bears is counted in {@link KindChange.gained} or
39
+ * {@link KindChange.lost} and is in no share, which is
40
+ * [0239](../../decisions/0239-a-change-is-read-against-the-words-both-revisions-say-and-a-floor-costs-the-page-total-and-not-the-passage.md)'s
41
+ * rule at another unit — a change is read against the words both revisions say,
42
+ * and a change to a library is read against the places both windows bore.
43
+ *
44
+ * What that buys is the thing no other comparison in this subsystem has, and it
45
+ * is worth being plain about. Every one of the six compares **shares**, because
46
+ * a count of readers is inflated by its own window's straddle
47
+ * ([0147](../../decisions/0147-a-rollup-is-added-to-what-is-stored-and-a-distinct-view-count-is-therefore-approximate.md))
48
+ * and nothing divides out between two windows. Here the denominator is a count
49
+ * of **places**: it has no reader in it, no rollup window in it, and — once the
50
+ * places are held still — it is *the same number on both sides*. So the
51
+ * movement can be published as a count of places that changed hands, the
52
+ * verdict is the sign of a subtraction of two whole numbers, and no threshold
53
+ * decides anything.
54
+ *
55
+ * ## What that count is still confounded by, said before the figure is read
56
+ *
57
+ * A placement stands as `read` when **at least one** reader reached it (0212,
58
+ * [0235](../../decisions/0235-how-much-of-a-page-gets-read-is-a-share-of-words-that-partition-it-and-the-typical-reader-is-a-ceiling.md)),
59
+ * so a quiet window skips more places than a busy one with no reader behaving
60
+ * differently. That is not an error to be corrected — *at least one* is what
61
+ * makes a census of places answerable without counting a reader — but it is a
62
+ * term in every transition here, and a comparison is the first reading in which
63
+ * it can be mistaken for a finding.
64
+ *
65
+ * So the two windows' page views travel **on the reading**, as
66
+ * {@link LibraryChange.viewsWas} and {@link LibraryChange.viewsNow}, and they
67
+ * are floors rather than counts (`PageReading.views`). A comparison across two
68
+ * windows of very different size is a comparison whose transitions carry the
69
+ * difference in traffic, and these are the two numbers that say so. Nothing
70
+ * here withholds a figure for it and nothing scales one: a floor on the views
71
+ * of a window is not a correction, and a reading that pretended it was one
72
+ * would be worse than the caveat.
73
+ *
74
+ * **The reader-weighted question is a different one and is not answered here.**
75
+ * *Of the readers who met your testimonial band, the share that read it has
76
+ * gone from four in ten to seven* needs the door on both sides, is a weighted
77
+ * mean whose weights move when the pages' traffic moves, and belongs beside
78
+ * `library-reach.ts` rather than inside this type — 0256's own refusal, for its
79
+ * own reason: one type carrying a sound figure and a corrected one with nothing
80
+ * but prose to tell them apart is a type a surface reads past. It is filed.
81
+ *
82
+ * ## The two keys answer differently about one change, which is why there are two
83
+ *
84
+ * A node whose **type** changed is not one placement that moved; it is a place
85
+ * one kind left and another took ({@link LibraryChange.recast}). The type rows
86
+ * say exactly that, because a type is the thing an author replaces.
87
+ *
88
+ * The role rows do not, and they are right not to: a part's role is what it
89
+ * plays for a reader (0114), so a testimonial swapped for a card that plays the
90
+ * same part is, to a reader, the same place still standing — and the place is
91
+ * therefore held still in the role row and compared. The two readings of one
92
+ * change are not a disagreement to resolve; they are the two questions a
93
+ * deployment has, and the role one is thin today for the reason every role
94
+ * figure in this subsystem is thin (0212).
95
+ *
96
+ * ## What it refuses to compare
97
+ *
98
+ * **Words.** A placement's words are its own and add across places (0212), so
99
+ * *this kind said four thousand words and readers reached three hundred* is
100
+ * sound in one window. Across two it is not: a paired placement is paired by
101
+ * node and the revision may have moved underneath it, so the two sides' words
102
+ * are two different sentences and their shares are not a before and an after.
103
+ * 0239 solved exactly this for one page, by reading a change against the words
104
+ * both revisions say; the library-scale version of that is a second unit and is
105
+ * filed rather than shipped with a caveat.
106
+ *
107
+ * **Occurrences.** `activations`, `opens`, `closes` and `completions` are counts
108
+ * of things that happened, so they scale with how many readers there were: a
109
+ * press count that doubled in a window that doubled is three sentences about
110
+ * traffic wearing one about reading ([`change.ts`](change.ts)). The share of
111
+ * readers who *acted* is the figure that answers it, and it is the reader-
112
+ * weighted question above.
113
+ *
114
+ * **Anything added across kinds.** There is no reading-wide share and no
115
+ * reading-wide movement, for the reason a census has none (0257): a figure over
116
+ * every kind at once counts a page once per element node, so it measures how
117
+ * finely the pages were written as much as how they are read.
118
+ *
119
+ * ## The one lie a comparison of two libraries can be told
120
+ *
121
+ * Two revisions of one tree on **one** side. A census keeps them apart on
122
+ * purpose — two live versions of a page are two pages
123
+ * ([0250](../../decisions/0250-a-deployment-is-ordered-by-readers-lost-at-the-doors-scale-and-a-page-the-door-cannot-scale-is-out-of-the-order.md),
124
+ * 0257) — but a comparison pairs by **page**, and a page that is two revisions
125
+ * in one window has no single counterpart in the other. Picking one would be a
126
+ * number nobody could account for, so the tree is excluded and named in
127
+ * {@link LibraryChange.ambiguous}. The same reading handed in twice is the
128
+ * ordinary double count and is dropped (0158: counting a window and forgetting
129
+ * it are one operation).
130
+ *
131
+ * Pure. It reaches no store, no clock and no DOM, it is linear in the parts of
132
+ * the readings handed to it, and nothing in it survives into a browser bundle.
133
+ */
134
+ /** Why a kind of part has no before and after. */
135
+ export type KindChangeSilence =
136
+ /**
137
+ * It stands in both windows, and no place of it can be spoken for on both
138
+ * sides.
139
+ *
140
+ * Every paired placement is `unknown` in one window or the other — a page
141
+ * neither window measured, or one window that measured it and one that did
142
+ * not. The places are still counted in {@link KindChange.places}; what is
143
+ * withheld is the comparison, because a standing of `unknown` is *nothing can
144
+ * be said* and never *nobody read it* (0212).
145
+ */
146
+ "unread"
147
+ /**
148
+ * Nothing in the pages read, on either side, is of this kind.
149
+ *
150
+ * Only ever a role row, and the reason a role row exists for every member of
151
+ * the vocabulary: *nothing in this library is a heading* is a fact about the
152
+ * library rather than a missing row. A type row cannot be in this state,
153
+ * because a type row exists only where a part of that type stands on one side
154
+ * or the other.
155
+ */
156
+ | "unplaced"
157
+ /**
158
+ * It stands in both windows and in no place that is in both.
159
+ *
160
+ * Every placement was gained or lost: the pages it stood on are gone and it
161
+ * is somewhere else now, or the nodes were rewritten. There is nothing held
162
+ * still, so there is nothing to compare — and that is an answer about the
163
+ * **library** rather than about its readers, which
164
+ * {@link KindChange.gained} and {@link KindChange.lost} are the size of.
165
+ *
166
+ * Kept apart from `unread` because the instructions are opposite: this one
167
+ * says the places moved, and the other says nobody has been seen in them.
168
+ */
169
+ | "unpaired";
170
+ export declare const KIND_CHANGE_SILENCES: readonly KindChangeSilence[];
171
+ /** One line per silence, for a surface saying why a kind has no before and after. */
172
+ export declare const describeKindChangeSilence: (silence: KindChangeSilence) => string;
173
+ /**
174
+ * What happened to a kind of part between the two windows.
175
+ *
176
+ * The verdict is the sign of `tookUp − fellAway`, which is a subtraction of two
177
+ * counts of **places** and needs no threshold and no share: the denominator is
178
+ * the same set of places on both sides, so a movement is places changing hands
179
+ * and nothing else. Every other comparison in this subsystem has to compare two
180
+ * shares instead, because its denominator is a count of readers that moved too.
181
+ */
182
+ export type KindMovement =
183
+ /** More places of it are read now than were, which is the sentence a change to a primitive is made for. */
184
+ "taken-up"
185
+ /** Fewer are. */
186
+ | "abandoned"
187
+ /**
188
+ * Exactly as many are, which includes places trading places: two taken up and
189
+ * two fallen away is `held`, and the two counts are published so that a
190
+ * surface can say so.
191
+ */
192
+ | "held"
193
+ /**
194
+ * No place of it was read in either window.
195
+ *
196
+ * Kept apart from `held` for the reason a comparison of what readers did
197
+ * keeps `still-untouched` from it (0251): *skipped everywhere, and still
198
+ * skipped everywhere* is the one state here that is an instruction. There is
199
+ * deliberately no sibling for *read everywhere and still read everywhere* —
200
+ * that is `held` at a share of one, and it asks nobody to do anything.
201
+ */
202
+ | "still-unread"
203
+ /** {@link KindChange.silence} says why nothing can be said. */
204
+ | "unknown";
205
+ export declare const KIND_MOVEMENTS: readonly KindMovement[];
206
+ /** One line per movement, for a surface putting a kind's before and after in front of a person. */
207
+ export declare const describeKindMovement: (movement: KindMovement) => string;
208
+ /**
209
+ * One kind of part, held against itself across two windows.
210
+ *
211
+ * The same shape for a type row and a role row, because they are one comparison
212
+ * asked of two keys — and the two give different answers about a node whose type
213
+ * changed, which is the point of asking both. See the module documentation.
214
+ */
215
+ export type KindChange = {
216
+ readonly kind: KindKey;
217
+ /**
218
+ * What part a type plays (0114), or `null`. Always `null` on a role row, which
219
+ * carries it as its key.
220
+ *
221
+ * The later window's answer where it stands there, so that a surface reading a
222
+ * row and the role beside it is reading today's library.
223
+ */
224
+ readonly role: PrimitiveRole | null;
225
+ /** Places of this kind that stand in both windows: the same node of the same page, of this kind on both sides. */
226
+ readonly places: number;
227
+ /** Places of it in the later window with no counterpart in the earlier one. */
228
+ readonly gained: number;
229
+ /** Places of it in the earlier window with no counterpart in the later one. */
230
+ readonly lost: number;
231
+ /**
232
+ * Of {@link places}, those with a verdict on **both** sides, which is the
233
+ * denominator of both shares.
234
+ *
235
+ * One number and not two, which is the whole of why the two shares are
236
+ * comparable: a place nothing can be said about in either window is in neither
237
+ * term, so the two sides are read over exactly the same set of places.
238
+ */
239
+ readonly comparable: number;
240
+ /** Comparable places skipped in the earlier window and read in the later one. */
241
+ readonly tookUp: number;
242
+ /** Comparable places read in the earlier window and skipped in the later one. */
243
+ readonly fellAway: number;
244
+ /** Comparable places read in both. */
245
+ readonly keptRead: number;
246
+ /** Comparable places skipped in both. */
247
+ readonly keptSkipped: number;
248
+ /**
249
+ * The share of {@link comparable} places that was read in the earlier window;
250
+ * `null` where {@link silence} says why not.
251
+ *
252
+ * *At least one reader reached it*, which is what a standing of `read` means
253
+ * and not what a person reads the word as (0235). Places and never people: see
254
+ * the module documentation and `library.ts`, where the same figure is taken of
255
+ * one window.
256
+ */
257
+ readonly readShareWas: number | null;
258
+ /** The same share in the later window, over the same places. */
259
+ readonly readShareNow: number | null;
260
+ readonly movement: KindMovement;
261
+ /**
262
+ * Why the two shares are not there, and `null` where they are.
263
+ *
264
+ * About the comparison and not about the row: {@link places},
265
+ * {@link gained} and {@link lost} are counts of parts of trees and are true
266
+ * whatever any window measured, which is how a census publishes a standing
267
+ * beside a withheld share (0212).
268
+ */
269
+ readonly silence: KindChangeSilence | null;
270
+ };
271
+ /** What a change did to a deployment's library, by kind of part. */
272
+ export type LibraryChange = {
273
+ /**
274
+ * Every type that stands in either window, most places fallen away first.
275
+ *
276
+ * Then the lower read share in the later window, then by type, so two kinds
277
+ * that lost the same number of places do not reorder on a refresh.
278
+ */
279
+ readonly byType: readonly KindChange[];
280
+ /**
281
+ * Every role in the vocabulary that stands in either window, then the row for
282
+ * parts whose type declared none, in the same order as {@link byType}.
283
+ *
284
+ * Thin today for the reason every role figure in this subsystem is thin:
285
+ * nothing in `src/primitives/` declares one, so nearly every part is in the
286
+ * `null` row — and in this reading that row is the one that treats a node
287
+ * whose type changed as a place still standing. The join is at read time
288
+ * (0212), so the day a role is declared these rows start answering without a
289
+ * migration.
290
+ */
291
+ readonly byRole: readonly KindChange[];
292
+ /** Forms read in both windows: a page in one of its forms, never a revision. */
293
+ readonly pages: number;
294
+ /** Forms read in the later window only, which is not pages published. */
295
+ readonly pagesGained: number;
296
+ /** Of {@link pagesGained}, forms whose page the earlier window already held. */
297
+ readonly formsGained: number;
298
+ /** Forms read in the earlier window only, which is not pages withdrawn. */
299
+ readonly pagesLost: number;
300
+ /** Of {@link pagesLost}, forms whose page the later window still holds. */
301
+ readonly formsLost: number;
302
+ /** The audiences each window's forms named, published and never refused. */
303
+ readonly audiences: ComparedPopulations;
304
+ /**
305
+ * Paired pages whose revision moved between the windows.
306
+ *
307
+ * The comparison still stands — a placement is paired by node, and whether
308
+ * readers reached it is a fact about the place either way — but it says that
309
+ * the pages changed as well as the window, which is the difference between
310
+ * *your readers behave differently* and *you changed your pages*. A reading
311
+ * where this is nought is two windows of one library.
312
+ */
313
+ readonly republished: number;
314
+ /** Places that stand in both windows, which is the sum of every type row's {@link KindChange.places}. */
315
+ readonly placements: number;
316
+ /** Places in the later window only. */
317
+ readonly gained: number;
318
+ /** Places in the earlier window only. */
319
+ readonly lost: number;
320
+ /**
321
+ * Paired nodes whose primitive type changed.
322
+ *
323
+ * A place one kind left and another took, counted in the first's {@link
324
+ * KindChange.lost} and the second's {@link KindChange.gained} — and held
325
+ * still in the role rows where the two types play the same part. Not an
326
+ * alarm: it is the commonest change an author makes to a library.
327
+ */
328
+ readonly recast: number;
329
+ /**
330
+ * A floor on the page views of the earlier window, added over the paired
331
+ * pages.
332
+ *
333
+ * `PageReading.views` is the largest `views` any one part of a page reports,
334
+ * which is a floor and not a count (0147). Published because every transition
335
+ * in this reading is confounded by it: a quieter window skips more places with
336
+ * no reader behaving differently, and these two numbers are what let somebody
337
+ * see that before reading a movement as a finding.
338
+ *
339
+ * Not a count of readers, and not addable into one: a reader who read two
340
+ * pages is two page views here.
341
+ */
342
+ readonly viewsWas: number;
343
+ /** The same floor for the later window, over the same pages. */
344
+ readonly viewsNow: number;
345
+ /**
346
+ * The type that lost its reading in the most places, which is the kind to look
347
+ * at first.
348
+ *
349
+ * By the **count** of places and not by the share, for the reason a page's
350
+ * falls are ranked by the readers they lose (0221) and a census's kinds by the
351
+ * places they are skipped in (0257): a kind that lost its one and only place
352
+ * is a perfect rate and a smaller problem than one that lost seven of nine.
353
+ * `null` where nothing anywhere fell away.
354
+ *
355
+ * A type and never a role, because a type is the thing an author can replace.
356
+ */
357
+ readonly mostAbandoned: KindChange | null;
358
+ /** The type that gained its reading in the most places, by the same rule. */
359
+ readonly mostTakenUp: KindChange | null;
360
+ /**
361
+ * Forms read at two revisions in one window, which are in nothing above.
362
+ *
363
+ * A page that is two live revisions in one window has no single counterpart in
364
+ * the other, and the comparison pairs by page in its form. See the module
365
+ * documentation: excluded and named rather than picked between.
366
+ *
367
+ * A **form** and not a tree, because a page served in two forms (0263) is two
368
+ * paired pages here: one of them held at two revisions says nothing about the
369
+ * other, and a screen naming the exclusion needs to say which form it was.
370
+ */
371
+ readonly ambiguous: readonly PageForm[];
372
+ /**
373
+ * Readings of a revision beyond the first, on either side, which were dropped.
374
+ *
375
+ * A caller that concatenated two reads of one window holds a page twice, and a
376
+ * page twice is the one way a census — or a comparison of two — can lie about
377
+ * how much of a library there is (0158).
378
+ */
379
+ readonly duplicated: number;
380
+ /**
381
+ * Types the two windows disagree about the role of, where the later window's
382
+ * answer stands.
383
+ *
384
+ * A type plays one part (0114), so a disagreement is not a change a deployment
385
+ * made: it is two readings joined against two different registries, held
386
+ * against each other. Every role row below is then about neither.
387
+ */
388
+ readonly roleDisagreed: readonly PrimitiveType[];
389
+ };
390
+ /**
391
+ * One window's pages, by tree, with the two ways a window can hold a page twice
392
+ * counted apart.
393
+ *
394
+ * Published because the pairing is the method rather than a detail of it: a
395
+ * reader-weighted comparison of the same kinds (0279) pairs its pages by exactly
396
+ * this rule, and a second hand-written copy of it would be two spellings of one
397
+ * rule that agree today — which is what moved the counter tables' upsert keys
398
+ * into `counters.ts` and the door's scale into `door.ts`.
399
+ */
400
+ export type PairedWindow = {
401
+ /**
402
+ * The window's readings, one per form, keyed by the published form rule.
403
+ *
404
+ * Keyed by the **form** and not by the tree, because two forms of one page
405
+ * (0263) share a tree and have separate counterparts in the other window.
406
+ * Keyed by a tree, the second form of a page at one revision was dropped as
407
+ * the first one handed in twice, which is the double count nothing can notice
408
+ * afterwards (0158), and two forms at two revisions gated **both** out as
409
+ * ambiguous.
410
+ */
411
+ readonly byForm: ReadonlyMap<string, PageReading>;
412
+ /**
413
+ * Forms held at two revisions, which have no single counterpart in the other
414
+ * window.
415
+ *
416
+ * A map rather than a set so that the form can be published back to a surface
417
+ * that has to name the page it excluded: the key is opaque and a screen needs
418
+ * the tree and the audience.
419
+ */
420
+ readonly ambiguous: ReadonlyMap<string, PageForm>;
421
+ /** The same revision of the same form handed in again. */
422
+ readonly duplicated: number;
423
+ /**
424
+ * The audiences this window's forms named, in a stable order.
425
+ *
426
+ * `[]` is *no form here named one*, which is every window written before the
427
+ * column existed (0284) and every one a test builds by hand. Two members is
428
+ * a deployment serving two forms of at least one of its pages (0263) and is
429
+ * not a fault: the pairing is by form, so the two never meet inside a figure.
430
+ */
431
+ readonly audiences: readonly AudienceId[];
432
+ /**
433
+ * The pages behind this window's forms, which two forms of one page share.
434
+ *
435
+ * What makes *a form the other window does not hold* answerable as either a
436
+ * page published or a page that began being served in a second form (0295).
437
+ * Ambiguous forms are in it: the question is what the window held, not what
438
+ * was comparable.
439
+ */
440
+ readonly pagesHeld: ReadonlySet<TreeId>;
441
+ };
442
+ /**
443
+ * One window's readings keyed by page in its form, with a form held at two
444
+ * revisions kept apart from the same revision handed in twice.
445
+ *
446
+ * The first has no single counterpart in the other window and is excluded and
447
+ * named; the second is the ordinary double count and is dropped (0158). **Both
448
+ * are decided per form**, so a page served in two forms is two paired pages and
449
+ * one of them being ambiguous leaves the other standing.
450
+ */
451
+ export declare const pairedWindowOf: (readings: readonly PageReading[]) => PairedWindow;
452
+ /**
453
+ * One reading's parts by node, which is what a placement is paired on.
454
+ *
455
+ * Published with {@link pairedWindowOf} and for the same reason: pairing by node
456
+ * rather than by position is what makes a comparison about the part and not
457
+ * about where it sits (0224).
458
+ */
459
+ export declare const partsByNodeIn: (reading: PageReading) => ReadonlyMap<NodeId, PartReading>;
460
+ /**
461
+ * What a change did to a kind of part, across every page it stands on.
462
+ *
463
+ * Takes the two windows' readings rather than two `LibraryReading`s, and the
464
+ * reason is the method: a census publishes a kind's places added up, and the
465
+ * places have to be **paired** before anything can be held still. Two censuses
466
+ * cannot be subtracted, which is what this module is for.
467
+ *
468
+ * The labels are the caller's. Two readings of one window and one library come
469
+ * back as every place held and nothing gained or lost; a caller who holds the
470
+ * two sides backwards gets a comparison with every movement reversed rather than
471
+ * a refusal, exactly as a before-and-after reading of one page does.
472
+ *
473
+ * Linear in the parts handed in, with one pass per window that fills both
474
+ * groupings.
475
+ */
476
+ export declare const libraryChangeOf: (was: readonly PageReading[], now: readonly PageReading[]) => LibraryChange;
477
+ //# sourceMappingURL=library-change.d.ts.map