@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
@@ -16,16 +16,76 @@
16
16
  * `@jam-overture/loom/signals/postgres` is where a deployment picks it up, exactly
17
17
  * as the store and the journal do it.
18
18
  */
19
+ export * from "./acted.js";
20
+ export * from "./action-change.js";
21
+ export * from "./action.js";
22
+ export * from "./agenda.js";
23
+ export * from "./arrivals.js";
24
+ export * from "./arriving.js";
25
+ export * from "./audiences.js";
19
26
  export * from "./broadcast.js";
27
+ export * from "./change.js";
20
28
  export * from "./collect.js";
29
+ export * from "./conversion.js";
30
+ export * from "./copy-change.js";
31
+ export * from "./copy.js";
21
32
  export * from "./deliver.js";
33
+ export * from "./deployment-change.js";
34
+ export * from "./deployment.js";
35
+ export * from "./door.js";
36
+ export * from "./expire.js";
22
37
  export * from "./fold.js";
38
+ export * from "./form-action.js";
39
+ export * from "./form-copy.js";
40
+ export * from "./forms.js";
41
+ export * from "./frontier.js";
42
+ export * from "./funnel-change.js";
43
+ export * from "./funnel-hours.js";
44
+ export * from "./funnel.js";
45
+ export * from "./health.js";
23
46
  export * from "./ingest.js";
47
+ export * from "./inside.js";
24
48
  export * from "./intake.js";
25
49
  export * from "./journal.js";
50
+ export * from "./library-action.js";
51
+ export * from "./library-agenda-change.js";
52
+ export * from "./library-agenda.js";
53
+ export * from "./library-change.js";
54
+ export * from "./library-copy-change.js";
55
+ export * from "./library-pace.js";
56
+ export * from "./library-reach-change.js";
57
+ export * from "./library-reach.js";
58
+ export * from "./library-senders-change.js";
59
+ export * from "./library-senders-reach-change.js";
60
+ export * from "./library-senders-reach.js";
61
+ export * from "./library-senders.js";
62
+ export * from "./library-word-reach-change.js";
63
+ export * from "./library.js";
26
64
  export * from "./memory.js";
65
+ export * from "./notice.js";
66
+ export * from "./pace-change.js";
67
+ export * from "./pace.js";
68
+ export * from "./page-views.js";
69
+ export * from "./part-pace.js";
70
+ export * from "./parts.js";
71
+ export * from "./progress.js";
72
+ export * from "./ratios.js";
73
+ export * from "./reach.js";
74
+ export * from "./readership.js";
75
+ export * from "./readable.js";
76
+ export * from "./region-pages.js";
77
+ export * from "./region.js";
78
+ export * from "./retention.js";
79
+ export * from "./rhythm.js";
27
80
  export * from "./rollup.js";
28
81
  export * from "./signal.js";
82
+ export * from "./silence-census.js";
83
+ export * from "./silences.js";
29
84
  export * from "./tally.js";
85
+ export * from "./unread.js";
30
86
  export * from "./view.js";
87
+ export * from "./window-agenda.js";
88
+ export * from "./window-figures.js";
89
+ export * from "./window-funnels.js";
90
+ export * from "./window.js";
31
91
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,8 @@
1
1
  import { type Result } from "../result.js";
2
2
  import type { ReaderSignalJournal, ReaderSignalStoreError } from "./journal.js";
3
+ import { type ReaderRegion, type ReaderRegionStore } from "./region.js";
3
4
  import { type ReaderSignalParseError } from "./signal.js";
5
+ import type { ReaderOpeningCounter } from "./tally.js";
4
6
  /**
5
7
  * The doorway a browser's batches come through.
6
8
  *
@@ -27,6 +29,59 @@ export declare const MAX_BATCHES_PER_DELIVERY = 50;
27
29
  export type IngestOutcome = {
28
30
  readonly batches: number;
29
31
  readonly signals: number;
32
+ /**
33
+ * Page views this delivery opened, which is what the exact counter moved by.
34
+ *
35
+ * Zero unless the caller keeps that counter and the delivery actually opened
36
+ * something — most deliveries of a page view are the middle of one.
37
+ */
38
+ readonly opened: number;
39
+ /**
40
+ * Page views counted against a region, which is zero unless the caller said
41
+ * where the delivery came from and the delivery opened a page view.
42
+ */
43
+ readonly regions: number;
44
+ /**
45
+ * Why a counter did not move, when a store refused it.
46
+ *
47
+ * Present and the delivery still stands: the batch is already kept, and a
48
+ * sender told to retry would deliver it twice, which is the one failure in
49
+ * this subsystem that cannot be undone (0158). So a lost count is a counter
50
+ * that did not move, reported here rather than raised — the same trade a sink
51
+ * makes when a browser refuses a beacon.
52
+ */
53
+ readonly openingError?: ReaderSignalStoreError;
54
+ readonly regionError?: ReaderSignalStoreError;
55
+ };
56
+ /** Where a delivery came from, and the buckets to count it in. */
57
+ export type RegionCounter = {
58
+ readonly store: ReaderRegionStore;
59
+ readonly region: ReaderRegion;
60
+ };
61
+ /**
62
+ * What this delivery is counted into, besides being buffered.
63
+ *
64
+ * Both of these are read from the request rather than from the batch — the
65
+ * framework has no request and no opinion about which header a platform writes
66
+ * — and both are counted once per page view rather than once per delivery. What
67
+ * the framework owns is that arithmetic: against a counter, never onto the
68
+ * batch that is about to be buffered.
69
+ *
70
+ * Absent means a caller that keeps neither, which is a supported deployment and
71
+ * not a misconfigured one: a buffer and a rollup answer every question except
72
+ * *how many readers* and *from where*.
73
+ */
74
+ export type DoorCounters = {
75
+ /** When, as an instant every counter this delivery moves is stamped with. The caller's clock. */
76
+ readonly at: string;
77
+ /** Where the delivery came from. Absent on a deployment that does not count regions. */
78
+ readonly region?: RegionCounter;
79
+ /**
80
+ * How many page views began. No switch guards it where it is wired, because a
81
+ * count of page views of a revision names nowhere and nobody — it is the
82
+ * denominator everything else is a rate against.
83
+ */
84
+ readonly openings?: ReaderOpeningCounter;
30
85
  };
31
86
  export type IngestError = {
32
87
  readonly code: "invalid-delivery";
@@ -47,5 +102,5 @@ export declare const describeIngestError: (error: IngestError) => string;
47
102
  * neither is something a browser can be asked to work out. It also means the
48
103
  * refusal is actionable: one index, one reason.
49
104
  */
50
- export declare const ingestReaderSignals: (journal: ReaderSignalJournal, input: unknown) => Promise<Result<IngestOutcome, IngestError>>;
105
+ export declare const ingestReaderSignals: (journal: ReaderSignalJournal, input: unknown, counters?: DoorCounters) => Promise<Result<IngestOutcome, IngestError>>;
51
106
  //# sourceMappingURL=ingest.d.ts.map
@@ -1,4 +1,7 @@
1
+ import { DEFAULT_AUDIENCE_ID } from "../audience/audience.js";
1
2
  import { err, ok } from "../result.js";
3
+ import { openingsOf } from "./page-views.js";
4
+ import { regionCountsOf } from "./region.js";
2
5
  import { parseReaderSignalBatch } from "./signal.js";
3
6
  /**
4
7
  * The doorway a browser's batches come through.
@@ -39,6 +42,35 @@ export const describeIngestError = (error) => {
39
42
  * saves every caller an envelope.
40
43
  */
41
44
  const deliveryOf = (input) => (Array.isArray(input) ? input : [input]);
45
+ /**
46
+ * What one counter contributed to the outcome: the page views it moved by, or
47
+ * why it did not move.
48
+ *
49
+ * A refused write reports nought rather than the number it would have added, so
50
+ * a caller adding up what it was told is adding up what is actually stored.
51
+ */
52
+ const moved = (counts, kept) => kept !== undefined && !kept.ok
53
+ ? { views: 0, error: kept.error }
54
+ : { views: counts.reduce((total, count) => total + count.views, 0) };
55
+ /**
56
+ * A delivery's batches, by the audience each was served under (0284).
57
+ *
58
+ * `ReaderSignalBatch.audience` is what the sender said and may be absent, so it
59
+ * is resolved here the way the buffer resolves it — one spelling of *this batch
60
+ * named no audience* rather than two.
61
+ */
62
+ const byAudience = (batches) => {
63
+ const grouped = new Map();
64
+ for (const batch of batches) {
65
+ const audience = batch.audience ?? DEFAULT_AUDIENCE_ID;
66
+ const group = grouped.get(audience);
67
+ if (group === undefined)
68
+ grouped.set(audience, [batch]);
69
+ else
70
+ group.push(batch);
71
+ }
72
+ return grouped;
73
+ };
42
74
  /**
43
75
  * Parse a delivery and keep it.
44
76
  *
@@ -47,7 +79,7 @@ const deliveryOf = (input) => (Array.isArray(input) ? input : [input]);
47
79
  * neither is something a browser can be asked to work out. It also means the
48
80
  * refusal is actionable: one index, one reason.
49
81
  */
50
- export const ingestReaderSignals = async (journal, input) => {
82
+ export const ingestReaderSignals = async (journal, input, counters) => {
51
83
  const delivery = deliveryOf(input);
52
84
  if (delivery.length > MAX_BATCHES_PER_DELIVERY) {
53
85
  return err({ code: "too-many", limit: MAX_BATCHES_PER_DELIVERY, given: delivery.length });
@@ -62,9 +94,67 @@ export const ingestReaderSignals = async (journal, input) => {
62
94
  const received = await journal.receive(batches);
63
95
  if (!received.ok)
64
96
  return err(received.error);
97
+ /**
98
+ * After the buffer accepted it, never before. A page view counted for a
99
+ * delivery the journal then refused would be a reader who arrived and read
100
+ * nothing — every other counter about that page view is missing, and the only
101
+ * numbers that moved are the two about them having turned up.
102
+ *
103
+ * **One walk for both counters.** The openings are found once and a region is
104
+ * a stamp on them, so the two can never disagree about how many readers
105
+ * arrived (`page-views.ts`).
106
+ */
107
+ /**
108
+ * **Per audience, because a counter row belongs to one** (0284).
109
+ *
110
+ * A delivery is normally one page's worth and so one audience's, but nothing
111
+ * in the wire format says it has to be — and filing two audiences' arrivals
112
+ * under one would be the same unrecoverable addition at the door that
113
+ * `collect.ts` avoids at the fold. The walk is still one walk **per
114
+ * audience**, which is what keeps a region a stamp on an opening somebody
115
+ * already counted rather than a second opinion about how many arrived.
116
+ */
117
+ const arrivals = counters === undefined
118
+ ? []
119
+ : [...byAudience(batches)].map(([audience, group]) => {
120
+ const openings = openingsOf(group);
121
+ return {
122
+ audience,
123
+ counting: counters.openings === undefined ? [] : openings,
124
+ counted: counters.region === undefined
125
+ ? []
126
+ : regionCountsOf(openings, counters.region.region),
127
+ };
128
+ });
129
+ const counting = arrivals.flatMap((arrival) => arrival.counting);
130
+ const counted = arrivals.flatMap((arrival) => arrival.counted);
131
+ /**
132
+ * The first failure of each counter is the one reported, and the audiences
133
+ * after it are not attempted: the outcome has room for one error per counter,
134
+ * and a door that went on writing after a store said it was unavailable would
135
+ * be reporting a number it has no reason to believe.
136
+ */
137
+ let openingsKept;
138
+ let regionsKept;
139
+ for (const arrival of arrivals) {
140
+ if (counters?.openings !== undefined &&
141
+ arrival.counting.length > 0 &&
142
+ openingsKept?.ok !== false) {
143
+ openingsKept = await counters.openings.opened(arrival.counting, counters.at, arrival.audience);
144
+ }
145
+ if (counters?.region !== undefined && arrival.counted.length > 0 && regionsKept?.ok !== false) {
146
+ regionsKept = await counters.region.store.count(arrival.counted, counters.at, arrival.audience);
147
+ }
148
+ }
149
+ const opened = moved(counting, openingsKept);
150
+ const regions = moved(counted, regionsKept);
65
151
  return ok({
66
152
  batches: batches.length,
67
153
  signals: batches.reduce((count, batch) => count + batch.signals.length, 0),
154
+ opened: opened.views,
155
+ regions: regions.views,
156
+ ...(opened.error === undefined ? {} : { openingError: opened.error }),
157
+ ...(regions.error === undefined ? {} : { regionError: regions.error }),
68
158
  });
69
159
  };
70
160
  //# sourceMappingURL=ingest.js.map
@@ -0,0 +1,190 @@
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 { NodeCopy } from "../sdk/copy.js";
6
+ import type { LoomTree } from "../tree/tree.js";
7
+ import { type ActedCounts, type ActedKind, type StoredActed } from "./acted.js";
8
+ import type { ArrivalRange } from "./arrivals.js";
9
+ import type { PartDeclarations } from "./parts.js";
10
+ /**
11
+ * One part of the page, what readers did to it, and what they did inside it.
12
+ *
13
+ * The three facts about where it sits are here rather than left to a caller
14
+ * because they are what the answer means: *forty presses inside this* is a
15
+ * sentence about a region of a page, and a list that did not say which regions
16
+ * contain which others would be forty presses counted as many times as a
17
+ * caller added rows together.
18
+ */
19
+ export type InsidePart = {
20
+ readonly nodeId: NodeId;
21
+ readonly type: PrimitiveType;
22
+ /** What part it plays (0114), or `null` where its type declared none. */
23
+ readonly role: PrimitiveRole | null;
24
+ /** Depth in the tree, counting every node; 0 at the root. */
25
+ readonly depth: number;
26
+ /**
27
+ * The nearest **addressed** ancestor, which is what `within` names (0167),
28
+ * and `null` at the outermost part.
29
+ *
30
+ * Not the tree parent. A slot is a node with children and is never a part —
31
+ * no signal can name one, because only an element carries the identity
32
+ * attributes a broadcaster reads — so the part immediately containing an
33
+ * element is the nearest *element* above it, with any slots between them
34
+ * passed through. A reading keyed on the tree parent would hang a band off a
35
+ * node that appears nowhere in its own list.
36
+ */
37
+ readonly withinId: NodeId | null;
38
+ /** What readers did to this part itself, in the range. */
39
+ readonly own: ActedCounts;
40
+ /**
41
+ * What readers did to this part and to every part inside it, in the range.
42
+ *
43
+ * Each action is in exactly one part's `own` and in the `inside` of each of
44
+ * that part's ancestors, so this adds **down** a tree and never across one:
45
+ * two siblings' `inside` may be added, a part's and its child's may not.
46
+ */
47
+ readonly inside: ActedCounts;
48
+ /** Addressed nodes in its subtree, itself included — so 1 for a part with no parts in it. */
49
+ readonly parts: number;
50
+ /**
51
+ * The words this part says itself: its declared copy props, and the text
52
+ * handed to it directly or through a slot.
53
+ *
54
+ * Its own, never its subtree's, exactly as `PartReading.copy` is and by the
55
+ * same function — so *a reader pressed `Get started`* is a sentence a surface
56
+ * can write, and a caller adding two parts' words together reads no headline
57
+ * twice.
58
+ */
59
+ readonly copy: NodeCopy;
60
+ };
61
+ /**
62
+ * What a range of the hourly counter says about the shape of one revision of
63
+ * one page.
64
+ */
65
+ export type InsideReading = {
66
+ readonly treeId: TreeId;
67
+ readonly revision: number;
68
+ readonly range: ArrivalRange;
69
+ /** Every addressed node, in reading order, so a row is always preceded by the row it is inside. */
70
+ readonly parts: readonly InsidePart[];
71
+ /**
72
+ * Everything readers did on this page in the range.
73
+ *
74
+ * The sum of every part's `own`. A tree's root is always an element
75
+ * (`tree.ts`), so this is also the root's own `inside` — and it is computed
76
+ * the other way deliberately: the two routes to one number share no
77
+ * arithmetic, so a test that holds them equal is a check on the accumulation
78
+ * that the accumulation cannot pass by being consistently wrong.
79
+ */
80
+ readonly total: ActedCounts;
81
+ /**
82
+ * Every audience whose rows were summed into this reading.
83
+ *
84
+ * A census rather than a refusal (0297): the figures here are occurrences, so
85
+ * two forms of a page add honestly, and what a caller needs is to know that
86
+ * two were added. More than one member means this answer is about a page
87
+ * served in two forms; narrow the read if that is not what was wanted.
88
+ */
89
+ readonly audiences: readonly AudienceId[];
90
+ /** Rows summed into the reading. */
91
+ readonly counted: number;
92
+ /**
93
+ * Rows filed under another tree or another revision, and ignored.
94
+ *
95
+ * `parts.ts`' reason, sharpened by the ancestry: a node's place in the page
96
+ * is a fact about one revision, so a row from another one would be credited
97
+ * to whatever happens to contain that node now.
98
+ */
99
+ readonly foreign: number;
100
+ /**
101
+ * Rows of this tree and revision whose hour falls outside the range, and
102
+ * ignored.
103
+ *
104
+ * Ignored rather than refused, because a wider read is the ordinary way a
105
+ * caller gets a range and the period before it from one call
106
+ * (`actedSeriesOf`). Counted separately from `foreign` so *you passed last
107
+ * month's rows* and *you passed another page's* are two different sentences.
108
+ */
109
+ readonly outside: number;
110
+ /**
111
+ * Nodes named by a row this revision does not contain.
112
+ *
113
+ * The alarm `parts.ts` carries, and it matters more here: an orphaned row is
114
+ * an action that happened on the page and is in **no** part's `inside`, so
115
+ * the totals under-report by exactly what this names. A non-empty list says
116
+ * the tree and the rows do not belong together.
117
+ */
118
+ readonly orphaned: readonly NodeId[];
119
+ /**
120
+ * The first hour this scope ever counted an action in, carried through from
121
+ * the store.
122
+ *
123
+ * Absent means nothing has ever been counted here, which is a different
124
+ * sentence from *nobody did anything inside anything in the range you asked
125
+ * about* (0309, 0347).
126
+ */
127
+ readonly begins?: number;
128
+ };
129
+ /**
130
+ * Join a range of the hourly counter to the tree and registry it was filed
131
+ * against, and read it as the page's own shape.
132
+ *
133
+ * **One read in, one reading out, and that is a guard rather than an
134
+ * ergonomic.** `parts.ts` can refuse a tally handed in twice because a tally is
135
+ * one row per part; an hour's counter legitimately has many rows per part, so a
136
+ * duplicate here is invisible and would inflate every ancestor of it. Taking a
137
+ * single {@link StoredActed} is what makes *a caller passed the same rows
138
+ * twice* unspellable instead of undetectable (0158).
139
+ *
140
+ * Linear in the parts and in the rows: the rows are bucketed once, the parts are
141
+ * walked once to find each one's nearest addressed ancestor, and the subtree
142
+ * totals are accumulated in one pass back up the same list. The reading the
143
+ * ledger's bound exists for (rule 4) is not allowed to walk a part's ancestors
144
+ * per part.
145
+ */
146
+ export declare const insideReadingOf: (tree: LoomTree, stored: StoredActed, declarations: PartDeclarations, range: ArrivalRange) => InsideReading;
147
+ /**
148
+ * The parts readers acted on most in the range, most first.
149
+ *
150
+ * **By what readers did to the part itself**, never by what they did inside it:
151
+ * ordering by `inside` ranks every page by its outermost part, because an
152
+ * ancestor's total is never below its descendant's. The question this answers is
153
+ * *what did readers press*, and the answer to that is a button.
154
+ *
155
+ * One kind, for `actedSeriesOf`' reason — a list with presses and sends added
156
+ * together is a list of two different things — and parts nobody did anything to
157
+ * are absent rather than listed as noughts: the universe of parts that *could*
158
+ * have been pressed is not something a tree can say today, so a list padded with
159
+ * every heading on the page would read as a claim this reading cannot make.
160
+ * {@link InsideReading.parts} holds the whole page for a caller that wants it.
161
+ *
162
+ * Ties keep reading order, so a page with ten parts at one press each is drawn
163
+ * in the order it is written rather than in the order a sort happened to leave
164
+ * them.
165
+ */
166
+ export declare const actedMostIn: (reading: InsideReading, kind: ActedKind, limit?: number) => readonly InsidePart[];
167
+ /**
168
+ * The share of everything readers did on the page, in one kind, that happened
169
+ * inside one part — between 0 and 1.
170
+ *
171
+ * *Sixty-two per cent of the presses on this page were in the pricing band* is
172
+ * the sentence, and it is exact rather than estimated: the numerator and the
173
+ * denominator are counts of the same occurrences over the same rows, and each
174
+ * occurrence is in both or in neither.
175
+ *
176
+ * `null` where readers did nothing of that kind on the page at all. A nought
177
+ * there would read as *this part gets none of them*, which is a claim about the
178
+ * part, and what is true is that there are none to share out.
179
+ */
180
+ export declare const insideShareIn: (reading: InsideReading, part: InsidePart, kind: ActedKind) => number | null;
181
+ /**
182
+ * What readers did inside a part but not to the part itself.
183
+ *
184
+ * The figure that says whether a band is a thing readers use or a thing that
185
+ * holds things readers use — and the one a surface would otherwise get by
186
+ * subtracting two numbers it was handed, which is the subtraction that is wrong
187
+ * if either of them is the other kind's.
188
+ */
189
+ export declare const beneathOf: (part: InsidePart, kind: ActedKind) => number;
190
+ //# sourceMappingURL=inside.d.ts.map