@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.
- package/README.md +3 -1
- package/dist/application/application.d.ts +109 -0
- package/dist/application/application.js +97 -0
- package/dist/application/memory.d.ts +20 -0
- package/dist/application/memory.js +79 -0
- package/dist/application/store.d.ts +101 -0
- package/dist/application/store.js +25 -0
- package/dist/audience/audience.d.ts +36 -0
- package/dist/audience/audience.js +41 -0
- package/dist/audience/compose.d.ts +112 -0
- package/dist/audience/compose.js +134 -0
- package/dist/audience/memory.d.ts +14 -0
- package/dist/audience/memory.js +71 -0
- package/dist/audience/overlay-store.d.ts +343 -0
- package/dist/audience/overlay-store.js +217 -0
- package/dist/audience/rule.d.ts +121 -0
- package/dist/audience/rule.js +78 -0
- package/dist/cli/index.d.ts +3 -4
- package/dist/cli/index.js +3 -4
- package/dist/cli/templates.js +19 -0
- package/dist/data/adapter.d.ts +9 -1
- package/dist/data/adapter.js +2 -0
- package/dist/data/plan.js +0 -0
- package/dist/data/resolution.d.ts +23 -1
- package/dist/data/resolve.d.ts +31 -4
- package/dist/data/resolve.js +11 -3
- package/dist/ids.d.ts +10 -0
- package/dist/ids.js +11 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interpretation/anthropic.d.ts +1 -1
- package/dist/interpretation/anthropic.js +2 -22
- package/dist/interpretation/client.d.ts +1 -1
- package/dist/interpretation/materialize.js +67 -22
- package/dist/interpretation/openai-compatible.d.ts +36 -0
- package/dist/interpretation/openai-compatible.js +79 -0
- package/dist/interpretation/status.d.ts +19 -0
- package/dist/interpretation/status.js +26 -0
- package/dist/live/index.d.ts +73 -0
- package/dist/live/index.js +73 -0
- package/dist/live/pages.d.ts +187 -0
- package/dist/live/pages.js +161 -0
- package/dist/live/pull.d.ts +147 -0
- package/dist/live/pull.js +398 -0
- package/dist/live/pulling.d.ts +79 -0
- package/dist/live/pulling.js +117 -0
- package/dist/live/window.d.ts +129 -0
- package/dist/live/window.js +132 -0
- package/dist/patch.d.ts +54 -0
- package/dist/patch.js +44 -0
- package/dist/project/closing.d.ts +51 -0
- package/dist/project/closing.js +53 -0
- package/dist/project/memory.d.ts +20 -0
- package/dist/project/memory.js +97 -0
- package/dist/project/project.d.ts +90 -0
- package/dist/project/project.js +91 -0
- package/dist/project/store.d.ts +135 -0
- package/dist/project/store.js +41 -0
- package/dist/registered.d.ts +64 -0
- package/dist/registered.js +118 -0
- package/dist/render/addressed.d.ts +35 -0
- package/dist/render/addressed.js +79 -0
- package/dist/render/behaviour-adjust.d.ts +11 -19
- package/dist/render/behaviour-adjust.js +75 -21
- package/dist/render/behaviour-present.d.ts +8 -0
- package/dist/render/behaviour-present.js +57 -6
- package/dist/render/behaviour.d.ts +98 -17
- package/dist/render/behaviour.js +91 -26
- package/dist/render/control-name.d.ts +68 -0
- package/dist/render/control-name.js +37 -0
- package/dist/render/diagnostics.d.ts +72 -0
- package/dist/render/diagnostics.js +7 -0
- package/dist/render/document-theme.d.ts +70 -0
- package/dist/render/document-theme.js +139 -0
- package/dist/render/editable.d.ts +15 -1
- package/dist/render/editable.js +13 -1
- package/dist/render/expected.d.ts +98 -0
- package/dist/render/expected.js +88 -0
- package/dist/render/index.d.ts +4 -0
- package/dist/render/index.js +4 -0
- package/dist/render/reads.d.ts +11 -0
- package/dist/render/reads.js +12 -1
- package/dist/render/render.d.ts +11 -0
- package/dist/render/render.js +294 -53
- package/dist/render/request.d.ts +8 -1
- package/dist/render/request.js +1 -0
- package/dist/render/slots.d.ts +52 -0
- package/dist/render/slots.js +24 -0
- package/dist/render/theme.d.ts +54 -1
- package/dist/render/theme.js +23 -1
- package/dist/render/unshown.d.ts +152 -0
- package/dist/render/unshown.js +80 -0
- package/dist/runtime/analysis.d.ts +94 -9
- package/dist/runtime/analysis.js +54 -9
- package/dist/runtime/assessment.d.ts +36 -2
- package/dist/runtime/assessment.js +27 -2
- package/dist/runtime/auto-apply-ceiling.d.ts +54 -0
- package/dist/runtime/auto-apply-ceiling.js +66 -0
- package/dist/runtime/checks.d.ts +148 -0
- package/dist/runtime/checks.js +112 -0
- package/dist/runtime/disposition.d.ts +96 -0
- package/dist/runtime/disposition.js +46 -0
- package/dist/runtime/gate.js +91 -10
- package/dist/runtime/index.d.ts +4 -0
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/irreversibility.d.ts +64 -0
- package/dist/runtime/irreversibility.js +45 -0
- package/dist/runtime/nesting.d.ts +13 -1
- package/dist/runtime/nesting.js +41 -24
- package/dist/runtime/pipeline.d.ts +43 -0
- package/dist/runtime/pipeline.js +10 -2
- package/dist/runtime/policy-change.d.ts +93 -0
- package/dist/runtime/policy-change.js +305 -0
- package/dist/runtime/policy-log.d.ts +406 -0
- package/dist/runtime/policy-log.js +285 -0
- package/dist/runtime/policy.d.ts +8 -6
- package/dist/runtime/policy.js +5 -2
- package/dist/runtime/repointing.js +0 -0
- package/dist/runtime/reversibility.d.ts +11 -9
- package/dist/runtime/stakes.d.ts +129 -1
- package/dist/runtime/stakes.js +240 -26
- package/dist/runtime/vocabulary.d.ts +164 -7
- package/dist/runtime/vocabulary.js +181 -8
- package/dist/sdk/audit.d.ts +174 -3
- package/dist/sdk/audit.js +176 -17
- package/dist/sdk/catalogue.d.ts +9 -1
- package/dist/sdk/conformance.d.ts +37 -3
- package/dist/sdk/conformance.js +25 -4
- package/dist/sdk/definition.d.ts +129 -5
- package/dist/sdk/definition.js +66 -0
- package/dist/sdk/registry.d.ts +45 -2
- package/dist/sdk/registry.js +102 -1
- package/dist/signals/acted.contract.d.ts +21 -0
- package/dist/signals/acted.contract.js +236 -0
- package/dist/signals/acted.d.ts +359 -0
- package/dist/signals/acted.js +135 -0
- package/dist/signals/action-change.d.ts +507 -0
- package/dist/signals/action-change.js +265 -0
- package/dist/signals/action.d.ts +331 -0
- package/dist/signals/action.js +182 -0
- package/dist/signals/agenda.d.ts +585 -0
- package/dist/signals/agenda.js +295 -0
- package/dist/signals/applied-window.contract.d.ts +23 -0
- package/dist/signals/applied-window.contract.js +160 -0
- package/dist/signals/arrivals.contract.d.ts +21 -0
- package/dist/signals/arrivals.contract.js +180 -0
- package/dist/signals/arrivals.d.ts +375 -0
- package/dist/signals/arrivals.js +254 -0
- package/dist/signals/arriving.d.ts +210 -0
- package/dist/signals/arriving.js +133 -0
- package/dist/signals/audiences.d.ts +528 -0
- package/dist/signals/audiences.js +255 -0
- package/dist/signals/broadcast.d.ts +33 -17
- package/dist/signals/broadcast.js +255 -32
- package/dist/signals/change.d.ts +378 -0
- package/dist/signals/change.js +327 -0
- package/dist/signals/collect.d.ts +169 -34
- package/dist/signals/collect.js +186 -38
- package/dist/signals/conversion.d.ts +348 -0
- package/dist/signals/conversion.js +235 -0
- package/dist/signals/copy-change.d.ts +553 -0
- package/dist/signals/copy-change.js +377 -0
- package/dist/signals/copy.d.ts +337 -0
- package/dist/signals/copy.js +211 -0
- package/dist/signals/correlated.contract.d.ts +24 -0
- package/dist/signals/correlated.contract.js +94 -0
- package/dist/signals/counters.d.ts +97 -0
- package/dist/signals/counters.js +160 -0
- package/dist/signals/deliver.d.ts +23 -4
- package/dist/signals/deliver.js +34 -6
- package/dist/signals/deployment-change.d.ts +395 -0
- package/dist/signals/deployment-change.js +309 -0
- package/dist/signals/deployment.d.ts +278 -0
- package/dist/signals/deployment.js +178 -0
- package/dist/signals/door.d.ts +114 -0
- package/dist/signals/door.js +77 -0
- package/dist/signals/expire.d.ts +192 -0
- package/dist/signals/expire.js +213 -0
- package/dist/signals/fold.d.ts +10 -0
- package/dist/signals/fold.js +5 -1
- package/dist/signals/form-action.d.ts +302 -0
- package/dist/signals/form-action.js +169 -0
- package/dist/signals/form-copy.d.ts +523 -0
- package/dist/signals/form-copy.js +346 -0
- package/dist/signals/forms.d.ts +247 -0
- package/dist/signals/forms.js +147 -0
- package/dist/signals/frontier.d.ts +268 -0
- package/dist/signals/frontier.js +145 -0
- package/dist/signals/funnel-change.d.ts +548 -0
- package/dist/signals/funnel-change.js +361 -0
- package/dist/signals/funnel-hours.contract.d.ts +21 -0
- package/dist/signals/funnel-hours.contract.js +221 -0
- package/dist/signals/funnel-hours.d.ts +293 -0
- package/dist/signals/funnel-hours.js +99 -0
- package/dist/signals/funnel.d.ts +592 -0
- package/dist/signals/funnel.js +231 -0
- package/dist/signals/health.d.ts +694 -0
- package/dist/signals/health.js +573 -0
- package/dist/signals/index.d.ts +60 -0
- package/dist/signals/index.js +60 -0
- package/dist/signals/ingest.d.ts +56 -1
- package/dist/signals/ingest.js +91 -1
- package/dist/signals/inside.d.ts +190 -0
- package/dist/signals/inside.js +263 -0
- package/dist/signals/join.d.ts +56 -0
- package/dist/signals/join.js +60 -0
- package/dist/signals/journal.d.ts +123 -9
- package/dist/signals/kept.contract.d.ts +22 -0
- package/dist/signals/kept.contract.js +111 -0
- package/dist/signals/kinds.d.ts +8 -6
- package/dist/signals/kinds.js +14 -6
- package/dist/signals/library-action.d.ts +430 -0
- package/dist/signals/library-action.js +336 -0
- package/dist/signals/library-agenda-change.d.ts +324 -0
- package/dist/signals/library-agenda-change.js +199 -0
- package/dist/signals/library-agenda.d.ts +258 -0
- package/dist/signals/library-agenda.js +167 -0
- package/dist/signals/library-change.d.ts +477 -0
- package/dist/signals/library-change.js +335 -0
- package/dist/signals/library-copy-change.d.ts +498 -0
- package/dist/signals/library-copy-change.js +476 -0
- package/dist/signals/library-pace.d.ts +319 -0
- package/dist/signals/library-pace.js +305 -0
- package/dist/signals/library-reach-change.d.ts +646 -0
- package/dist/signals/library-reach-change.js +542 -0
- package/dist/signals/library-reach.d.ts +377 -0
- package/dist/signals/library-reach.js +227 -0
- package/dist/signals/library-senders-change.d.ts +457 -0
- package/dist/signals/library-senders-change.js +367 -0
- package/dist/signals/library-senders-reach-change.d.ts +486 -0
- package/dist/signals/library-senders-reach-change.js +538 -0
- package/dist/signals/library-senders-reach.d.ts +340 -0
- package/dist/signals/library-senders-reach.js +252 -0
- package/dist/signals/library-senders.d.ts +271 -0
- package/dist/signals/library-senders.js +180 -0
- package/dist/signals/library-word-reach-change.d.ts +567 -0
- package/dist/signals/library-word-reach-change.js +564 -0
- package/dist/signals/library.d.ts +306 -0
- package/dist/signals/library.js +178 -0
- package/dist/signals/memory.d.ts +9 -0
- package/dist/signals/memory.js +246 -14
- package/dist/signals/migrate.d.ts +20 -4
- package/dist/signals/migrate.js +269 -8
- package/dist/signals/notice.d.ts +389 -0
- package/dist/signals/notice.js +250 -0
- package/dist/signals/pace-change.d.ts +501 -0
- package/dist/signals/pace-change.js +310 -0
- package/dist/signals/pace.d.ts +296 -0
- package/dist/signals/pace.js +291 -0
- package/dist/signals/page-views.d.ts +365 -0
- package/dist/signals/page-views.js +218 -0
- package/dist/signals/part-pace.d.ts +378 -0
- package/dist/signals/part-pace.js +333 -0
- package/dist/signals/parts.d.ts +354 -0
- package/dist/signals/parts.js +232 -0
- package/dist/signals/postgres.d.ts +16 -2
- package/dist/signals/postgres.js +753 -76
- package/dist/signals/progress.d.ts +212 -0
- package/dist/signals/progress.js +150 -0
- package/dist/signals/ratios.d.ts +108 -0
- package/dist/signals/ratios.js +40 -0
- package/dist/signals/reach.d.ts +309 -0
- package/dist/signals/reach.js +93 -0
- package/dist/signals/readable.d.ts +34 -0
- package/dist/signals/readable.js +34 -0
- package/dist/signals/readership.d.ts +381 -0
- package/dist/signals/readership.js +308 -0
- package/dist/signals/region-pages.d.ts +173 -0
- package/dist/signals/region-pages.js +62 -0
- package/dist/signals/region.d.ts +287 -0
- package/dist/signals/region.js +198 -0
- package/dist/signals/retention.d.ts +163 -0
- package/dist/signals/retention.js +75 -0
- package/dist/signals/rhythm.d.ts +302 -0
- package/dist/signals/rhythm.js +262 -0
- package/dist/signals/rollup.d.ts +194 -4
- package/dist/signals/rollup.js +0 -0
- package/dist/signals/schema.d.ts +1069 -1
- package/dist/signals/schema.js +393 -3
- package/dist/signals/signal.d.ts +237 -11
- package/dist/signals/signal.js +70 -10
- package/dist/signals/silence-census.d.ts +205 -0
- package/dist/signals/silence-census.js +87 -0
- package/dist/signals/silences.d.ts +1147 -0
- package/dist/signals/silences.js +996 -0
- package/dist/signals/subtrees.d.ts +123 -0
- package/dist/signals/subtrees.js +102 -0
- package/dist/signals/tally.d.ts +262 -12
- package/dist/signals/unread.d.ts +292 -0
- package/dist/signals/unread.js +137 -0
- package/dist/signals/window-agenda.d.ts +276 -0
- package/dist/signals/window-agenda.js +83 -0
- package/dist/signals/window-figures.d.ts +148 -0
- package/dist/signals/window-figures.js +42 -0
- package/dist/signals/window-funnels.d.ts +88 -0
- package/dist/signals/window-funnels.js +47 -0
- package/dist/signals/window.d.ts +866 -0
- package/dist/signals/window.js +693 -0
- package/dist/signals/words.d.ts +24 -0
- package/dist/signals/words.js +24 -0
- package/dist/store/cache.d.ts +101 -0
- package/dist/store/cache.js +149 -0
- package/dist/store/history.d.ts +82 -0
- package/dist/store/history.js +36 -0
- package/dist/store/index.d.ts +30 -0
- package/dist/store/index.js +30 -0
- package/dist/store/memory.d.ts +2 -1
- package/dist/store/memory.js +48 -12
- package/dist/store/migrate.d.ts +106 -0
- package/dist/store/migrate.js +323 -7
- package/dist/store/postgres-applications.d.ts +4 -0
- package/dist/store/postgres-applications.js +197 -0
- package/dist/store/postgres-audience.d.ts +14 -0
- package/dist/store/postgres-audience.js +272 -0
- package/dist/store/postgres-holds.d.ts +10 -1
- package/dist/store/postgres-holds.js +116 -101
- package/dist/store/postgres-policy-log.d.ts +14 -0
- package/dist/store/postgres-policy-log.js +240 -0
- package/dist/store/postgres-projects.d.ts +4 -0
- package/dist/store/postgres-projects.js +217 -0
- package/dist/store/postgres.d.ts +17 -1
- package/dist/store/postgres.js +60 -9
- package/dist/store/replay.d.ts +102 -1
- package/dist/store/replay.js +190 -19
- package/dist/store/reseed.d.ts +238 -0
- package/dist/store/reseed.js +308 -0
- package/dist/store/schema.d.ts +762 -2
- package/dist/store/schema.js +218 -5
- package/dist/store/source.d.ts +57 -1
- package/dist/store/source.js +65 -1
- package/dist/store/store.d.ts +29 -6
- package/dist/submit/resolve.d.ts +1 -1
- package/dist/submit/resolve.js +2 -1
- package/dist/telemetry/calibration.d.ts +25 -0
- package/dist/telemetry/calibration.js +27 -1
- package/dist/telemetry/event.d.ts +391 -33
- package/dist/telemetry/event.js +84 -20
- package/dist/telemetry/index.d.ts +2 -0
- package/dist/telemetry/index.js +2 -0
- package/dist/telemetry/journal.d.ts +104 -3
- package/dist/telemetry/journal.js +9 -0
- package/dist/telemetry/lookup.d.ts +27 -0
- package/dist/telemetry/lookup.js +18 -0
- package/dist/telemetry/memory.js +33 -1
- package/dist/telemetry/migrate.js +22 -1
- package/dist/telemetry/postgres.d.ts +10 -1
- package/dist/telemetry/postgres.js +188 -90
- package/dist/telemetry/remeasure.d.ts +78 -0
- package/dist/telemetry/remeasure.js +83 -0
- package/dist/telemetry/retention.d.ts +2 -2
- package/dist/telemetry/schema.d.ts +17 -0
- package/dist/telemetry/schema.js +27 -1
- package/dist/telemetry/sink.d.ts +2 -2
- package/dist/telemetry/window.d.ts +135 -0
- package/dist/telemetry/window.js +101 -0
- package/dist/testing/application-contract.d.ts +14 -0
- package/dist/testing/application-contract.js +270 -0
- package/dist/testing/audience-overlay-contract.d.ts +31 -0
- package/dist/testing/audience-overlay-contract.js +354 -0
- package/dist/testing/contracts.d.ts +13 -7
- package/dist/testing/contracts.js +13 -7
- package/dist/testing/definitions.d.ts +78 -0
- package/dist/testing/definitions.js +134 -9
- package/dist/testing/doubles.d.ts +103 -0
- package/dist/testing/doubles.js +143 -0
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +2 -2
- package/dist/testing/journal-contract.js +297 -6
- package/dist/testing/model-contract.d.ts +110 -0
- package/dist/testing/model-contract.js +150 -0
- package/dist/testing/policy-log-contract.d.ts +26 -0
- package/dist/testing/policy-log-contract.js +344 -0
- package/dist/testing/project-contract.d.ts +14 -0
- package/dist/testing/project-contract.js +266 -0
- package/dist/testing/reader-signal-contract.d.ts +27 -2
- package/dist/testing/reader-signal-contract.js +475 -5
- package/dist/testing/store-contract.d.ts +7 -1
- package/dist/testing/store-contract.js +84 -3
- package/dist/theme/apply.d.ts +20 -1
- package/dist/theme/apply.js +5 -3
- package/dist/theme/contrast.d.ts +19 -14
- package/dist/theme/contrast.js +181 -17
- package/dist/theme/derive.d.ts +22 -0
- package/dist/theme/derive.js +54 -1
- package/dist/theme/library.js +1 -1
- package/dist/theme/measure.d.ts +34 -0
- package/dist/theme/measure.js +30 -1
- package/dist/theme/palettes.js +7 -7
- package/dist/theme/ramp.d.ts +64 -0
- package/dist/theme/ramp.js +114 -0
- package/dist/theme/registry.d.ts +9 -0
- package/dist/theme/registry.js +11 -1
- package/dist/theme/separation.d.ts +97 -3
- package/dist/theme/separation.js +75 -0
- package/dist/tree/apply.js +13 -0
- package/dist/tree/compare.d.ts +9 -0
- package/dist/tree/compare.js +18 -0
- package/dist/tree/mutation.d.ts +18 -0
- package/dist/tree/mutation.js +24 -12
- package/dist/tree/navigation.d.ts +5 -0
- package/dist/tree/navigation.js +32 -10
- package/dist/tree/outline.d.ts +7 -0
- package/dist/tree/outline.js +9 -5
- package/dist/write/computed.d.ts +60 -0
- package/dist/write/computed.js +61 -0
- package/dist/write/held.d.ts +59 -0
- package/dist/write/index.d.ts +5 -2
- package/dist/write/index.js +5 -2
- package/dist/write/reseed.d.ts +151 -0
- package/dist/write/reseed.js +184 -0
- package/dist/write/revert.js +2 -16
- package/package.json +25 -3
- package/dist/runtime/inverse-interpreter.d.ts +0 -90
- package/dist/runtime/inverse-interpreter.js +0 -56
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { clampLimit } from "../paging.js";
|
|
3
|
+
import { systemClock } from "../runtime/events.js";
|
|
4
|
+
/**
|
|
5
|
+
* The one operation that deletes a delivery.
|
|
6
|
+
*
|
|
7
|
+
* `collect.ts` used to be this as well: counting a ripe prefix and deleting it
|
|
8
|
+
* were one call, because a delivery existed for as long as it took rollup to
|
|
9
|
+
* read it and no longer (0146). On 5 November the maintainer settled that
|
|
10
|
+
* individual reader events are **kept for thirty days by default**, so that an
|
|
11
|
+
* operator can look at the deliveries behind a counter rather than only at the
|
|
12
|
+
* counter ([0349](../../decisions/0349-a-projects-reader-events-are-kept-thirty-days-by-default-and-the-tallies-stay-the-durable-record.md)),
|
|
13
|
+
* and the two halves of that one call became two operations with two windows
|
|
14
|
+
* ([0351](../../decisions/0351-a-counted-delivery-is-kept-for-a-stated-window-rather-than-deleted-by-the-fold.md)).
|
|
15
|
+
*
|
|
16
|
+
* This is the second half. It deletes and counts nothing, exactly as
|
|
17
|
+
* `collect.ts` counts and deletes nothing.
|
|
18
|
+
*
|
|
19
|
+
* ## The one rule, and it is not negotiable
|
|
20
|
+
*
|
|
21
|
+
* **Nothing is deleted that no fold has counted.** A delivery deleted before it
|
|
22
|
+
* was counted is gone from the counters too, and the counters are the durable
|
|
23
|
+
* record (0349) — a day of readers that nothing can reconstruct, because the
|
|
24
|
+
* rows that would say what they did are the rows that were deleted. So the cut
|
|
25
|
+
* is the lesser of two positions: the age the deployment keeps events for, and
|
|
26
|
+
* the oldest delivery the fold has not stamped.
|
|
27
|
+
*
|
|
28
|
+
* That means a deployment whose collection cron has stopped **stops expiring**
|
|
29
|
+
* rather than deleting uncounted deliveries, and says so
|
|
30
|
+
* ({@link ExpiryStop}). It is the same sentence the fix-list makes one level
|
|
31
|
+
* up — *while nothing is arriving, no reading is evidence* (0347) — about this
|
|
32
|
+
* table: while nothing is counting, nothing may be deleted.
|
|
33
|
+
*
|
|
34
|
+
* ## What it is not
|
|
35
|
+
*
|
|
36
|
+
* Not a scheduler, for the reason `collect.ts` is not one: when a deployment
|
|
37
|
+
* deletes is an operational choice, and a framework that quietly swept a host's
|
|
38
|
+
* data on a timer it chose would be making it. A host calls this beside
|
|
39
|
+
* {@link collectReaderSignals} from a cron route, a deploy hook or by hand —
|
|
40
|
+
* **counting first**, so that one run's fold makes its own window expirable
|
|
41
|
+
* rather than waiting for the next.
|
|
42
|
+
*
|
|
43
|
+
* Not idempotence-sensitive, which is the one way it is easier than collection.
|
|
44
|
+
* Deleting a prefix twice removes it once; there is no additive counter behind
|
|
45
|
+
* it and no `redelivered` to report. A run that deletes nothing is the ordinary
|
|
46
|
+
* answer on a deployment inside its window.
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Thirty days, the maintainer's number, and the default of a setting rather
|
|
50
|
+
* than a constant (0349). Rule 5 of `docs/signals.md` is what makes it one.
|
|
51
|
+
*
|
|
52
|
+
* **It is longer than anything in this subsystem has been, and the cost is
|
|
53
|
+
* stated rather than buried.** A delivery carries an opaque `view` key, which
|
|
54
|
+
* is what correlates one page view's signals with each other and with nothing
|
|
55
|
+
* else (0146). While a counted delivery was deleted within the hour, the
|
|
56
|
+
* argument for that key rested partly on how briefly it lived; it now lives for
|
|
57
|
+
* as long as this window. What has not changed is what the key *is* — random
|
|
58
|
+
* per page view, derived from nothing about the reader, never sent back to a
|
|
59
|
+
* browser, and correlating nothing across two page views — so a row thirty days
|
|
60
|
+
* old identifies exactly nobody, which is the property the rule actually
|
|
61
|
+
* depends on. What has changed is that the window in which one page view's
|
|
62
|
+
* signals can be read together is thirty days rather than an hour, and 0349
|
|
63
|
+
* decided it knowing that.
|
|
64
|
+
*
|
|
65
|
+
* Shorter is cheaper and keeps less: a deployment with heavy traffic states a
|
|
66
|
+
* week and loses only the ability to inspect deliveries older than a week,
|
|
67
|
+
* because the counters keep answering over all time. Longer is what rule 5 made
|
|
68
|
+
* configurable in the first place.
|
|
69
|
+
*/
|
|
70
|
+
export const DEFAULT_READER_EVENT_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
|
|
71
|
+
/**
|
|
72
|
+
* A minute, which is the collection window's floor and is the same mistake.
|
|
73
|
+
*
|
|
74
|
+
* It is not that a shorter window is unsafe — the rule above makes any window
|
|
75
|
+
* safe, because an uncounted delivery is never deleted whatever this says. It
|
|
76
|
+
* is that the ordinary way a window is written wrongly is a units mistake:
|
|
77
|
+
* `keptMs: 30` reads as thirty days and means thirty milliseconds, and a
|
|
78
|
+
* deployment that typed it would publish *a delivery is gone within a second*
|
|
79
|
+
* to every reader of its privacy page.
|
|
80
|
+
*/
|
|
81
|
+
export const MIN_READER_EVENT_RETENTION_MS = 60 * 1000;
|
|
82
|
+
export const readerEventRetentionSchema = z.object({
|
|
83
|
+
keptMs: z.number().int().min(MIN_READER_EVENT_RETENTION_MS),
|
|
84
|
+
});
|
|
85
|
+
/** How much of the oldest end one run will look at, as collection bounds its own scan. */
|
|
86
|
+
export const DEFAULT_EXPIRY_SCAN = 5_000;
|
|
87
|
+
export const MAX_EXPIRY_SCAN = 50_000;
|
|
88
|
+
/** Read in pages like every other log walk (0026), so memory is bounded by the page. */
|
|
89
|
+
const SCAN_PAGE = 500;
|
|
90
|
+
/** Past the window **and** counted. Both, which is the rule at the top of this file. */
|
|
91
|
+
const expirable = (batch, horizon) => batch.receivedAt < horizon && batch.foldedAt !== undefined;
|
|
92
|
+
export const expiryPlanOf = (scanned, horizon) => {
|
|
93
|
+
const ceiling = scanned.findIndex((batch) => !expirable(batch, horizon));
|
|
94
|
+
const going = ceiling === -1 ? scanned : scanned.slice(0, ceiling);
|
|
95
|
+
const held = ceiling === -1 ? undefined : scanned[ceiling];
|
|
96
|
+
const last = going.at(-1);
|
|
97
|
+
return {
|
|
98
|
+
before: last === undefined ? null : last.seq + 1,
|
|
99
|
+
waiting: scanned.length - going.length,
|
|
100
|
+
stopped: held === undefined ? "end" : held.receivedAt < horizon ? "uncounted" : "young",
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
/** The instant a delivery is old enough to go. `null` where the clock could not be read. */
|
|
104
|
+
export const keptHorizonOf = (configured, now) => {
|
|
105
|
+
const instant = Date.parse(now);
|
|
106
|
+
return Number.isFinite(instant) ? new Date(instant - configured.keptMs).toISOString() : null;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* The oldest end of the table, forward, stopping at the first row that may not
|
|
110
|
+
* go.
|
|
111
|
+
*
|
|
112
|
+
* Every row from there on is kept by this run, and `expiryPlanOf` needs only
|
|
113
|
+
* the first of them to know where the prefix ends — so reading further would be
|
|
114
|
+
* reading the kept window to throw it away.
|
|
115
|
+
*
|
|
116
|
+
* **Counted and uncounted together**, unlike collection's scan, because the
|
|
117
|
+
* uncounted row is half of what this is looking for: a scan that filtered it
|
|
118
|
+
* out would delete straight through the gap it exists to stop at.
|
|
119
|
+
*/
|
|
120
|
+
const scanFrom = async (journal, horizon, scanLimit) => {
|
|
121
|
+
const collected = [];
|
|
122
|
+
let cursor;
|
|
123
|
+
while (collected.length < scanLimit) {
|
|
124
|
+
const page = await journal.read({
|
|
125
|
+
direction: "newer",
|
|
126
|
+
limit: Math.min(SCAN_PAGE, scanLimit - collected.length),
|
|
127
|
+
...(cursor ? { cursor } : {}),
|
|
128
|
+
});
|
|
129
|
+
if (!page.ok)
|
|
130
|
+
return { ok: false, error: page.error };
|
|
131
|
+
collected.push(...page.value.batches);
|
|
132
|
+
if (page.value.batches.some((batch) => !expirable(batch, horizon))) {
|
|
133
|
+
return { ok: true, batches: collected, full: false };
|
|
134
|
+
}
|
|
135
|
+
if (page.value.newer === null)
|
|
136
|
+
return { ok: true, batches: collected, full: false };
|
|
137
|
+
cursor = page.value.newer;
|
|
138
|
+
}
|
|
139
|
+
return { ok: true, batches: collected, full: true };
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Delete the deliveries this deployment no longer keeps.
|
|
143
|
+
*
|
|
144
|
+
* Called beside {@link collectReaderSignals} and after it, so that a run's own
|
|
145
|
+
* fold makes its own window expirable. Nothing here counts, writes a counter or
|
|
146
|
+
* reads a tally: the counters already hold everything these rows said, which is
|
|
147
|
+
* what makes deleting them safe and is the whole of 0349's second clause.
|
|
148
|
+
*/
|
|
149
|
+
export const expireReaderEvents = async (journal, request = {}) => {
|
|
150
|
+
const configured = readerEventRetentionSchema.safeParse({
|
|
151
|
+
keptMs: request.keptMs ?? DEFAULT_READER_EVENT_RETENTION_MS,
|
|
152
|
+
});
|
|
153
|
+
if (!configured.success) {
|
|
154
|
+
return { outcome: "refused", reason: configured.error.issues[0]?.message ?? "invalid window" };
|
|
155
|
+
}
|
|
156
|
+
const now = (request.clock ?? systemClock).now();
|
|
157
|
+
const horizon = keptHorizonOf(configured.data, now);
|
|
158
|
+
if (horizon === null)
|
|
159
|
+
return { outcome: "refused", reason: `the clock read "${now}"` };
|
|
160
|
+
const scanned = await scanFrom(journal, horizon, clampLimit(request.scanLimit, { fallback: DEFAULT_EXPIRY_SCAN, max: MAX_EXPIRY_SCAN }));
|
|
161
|
+
if (!scanned.ok)
|
|
162
|
+
return { outcome: "unavailable", error: scanned.error };
|
|
163
|
+
const plan = expiryPlanOf(scanned.batches, horizon);
|
|
164
|
+
const oldest = scanned.batches[0];
|
|
165
|
+
/**
|
|
166
|
+
* The age of the oldest row the scan read, which is the oldest row there is:
|
|
167
|
+
* the scan runs from the oldest end. Absent only where it read nothing.
|
|
168
|
+
*/
|
|
169
|
+
const oldestMs = oldest === undefined ? null : Date.parse(now) - Date.parse(oldest.receivedAt);
|
|
170
|
+
if (plan.before === null) {
|
|
171
|
+
return {
|
|
172
|
+
outcome: "nothing-expired",
|
|
173
|
+
waiting: plan.waiting,
|
|
174
|
+
oldestMs,
|
|
175
|
+
stopped: plan.stopped,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
const forgotten = await journal.forget({ before: plan.before });
|
|
179
|
+
if (!forgotten.ok)
|
|
180
|
+
return { outcome: "unavailable", error: forgotten.error };
|
|
181
|
+
return {
|
|
182
|
+
outcome: "expired",
|
|
183
|
+
removed: forgotten.value.removed,
|
|
184
|
+
/** A plan with a position has a first row, so the age is a number here. */
|
|
185
|
+
oldestMs: oldestMs ?? Number.NaN,
|
|
186
|
+
stopped: plan.stopped,
|
|
187
|
+
more: scanned.full,
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
const deliveries = (count) => `${count} ${count === 1 ? "delivery" : "deliveries"}`;
|
|
191
|
+
/**
|
|
192
|
+
* Said only where it changes what an operator should do, which is the one
|
|
193
|
+
* state where the remedy is somebody else's: the fold's.
|
|
194
|
+
*/
|
|
195
|
+
const held = (stopped) => stopped === "uncounted"
|
|
196
|
+
? " — the next one is past the window and uncounted, so collection has stopped and nothing further may go"
|
|
197
|
+
: "";
|
|
198
|
+
/** One line for an operator, because an outcome nobody can read is one nobody acts on. */
|
|
199
|
+
export const describeExpiry = (outcome) => {
|
|
200
|
+
switch (outcome.outcome) {
|
|
201
|
+
case "expired":
|
|
202
|
+
return `deleted ${deliveries(outcome.removed)}${held(outcome.stopped)}${outcome.more ? " — more is waiting" : ""}`;
|
|
203
|
+
case "nothing-expired":
|
|
204
|
+
return outcome.oldestMs === null
|
|
205
|
+
? "nothing is kept, so nothing is old enough to delete"
|
|
206
|
+
: `nothing is old enough to delete, ${deliveries(outcome.waiting)} kept and the oldest ${outcome.oldestMs}ms old${held(outcome.stopped)}`;
|
|
207
|
+
case "refused":
|
|
208
|
+
return `expiry refused: ${outcome.reason}`;
|
|
209
|
+
case "unavailable":
|
|
210
|
+
return `expiry could not run: ${outcome.error.detail}`;
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
//# sourceMappingURL=expire.js.map
|
package/dist/signals/fold.d.ts
CHANGED
|
@@ -50,6 +50,14 @@ export type ReaderReadings = {
|
|
|
50
50
|
readonly activations: Readonly<Record<NodeId, number>>;
|
|
51
51
|
readonly opens: Readonly<Record<NodeId, number>>;
|
|
52
52
|
readonly closes: Readonly<Record<NodeId, number>>;
|
|
53
|
+
/**
|
|
54
|
+
* Times a form inside the node was submitted and the browser let it go.
|
|
55
|
+
*
|
|
56
|
+
* Filed against the node the signal names, which for the starter library's
|
|
57
|
+
* `loom.form` is the form itself. The band it was the end of is in
|
|
58
|
+
* `engagements`, like every other delegated kind.
|
|
59
|
+
*/
|
|
60
|
+
readonly completions: Readonly<Record<NodeId, number>>;
|
|
53
61
|
/**
|
|
54
62
|
* Times a reader used something *inside* the node — pressed, followed, filled,
|
|
55
63
|
* opened or closed, at any depth.
|
|
@@ -97,6 +105,8 @@ export type NodeReading = {
|
|
|
97
105
|
readonly activations: number;
|
|
98
106
|
readonly opens: number;
|
|
99
107
|
readonly closes: number;
|
|
108
|
+
/** Times a form inside it was submitted and the browser let it go. */
|
|
109
|
+
readonly completions: number;
|
|
100
110
|
/** Times a reader used something inside it, at any depth. */
|
|
101
111
|
readonly engagements: number;
|
|
102
112
|
};
|
package/dist/signals/fold.js
CHANGED
|
@@ -4,6 +4,7 @@ export const EMPTY_READINGS = {
|
|
|
4
4
|
activations: {},
|
|
5
5
|
opens: {},
|
|
6
6
|
closes: {},
|
|
7
|
+
completions: {},
|
|
7
8
|
engagements: {},
|
|
8
9
|
types: {},
|
|
9
10
|
batches: 0,
|
|
@@ -14,7 +15,8 @@ const bumped = (counts, nodeId, by) => ({ ...counts, [nodeId]: (counts[nodeId] ?
|
|
|
14
15
|
* The regions a delegated signal says it happened inside, and their types, which
|
|
15
16
|
* a reading knows exactly as it knows the node's own.
|
|
16
17
|
*/
|
|
17
|
-
const withinOf = (signal) => (signal.kind === "activated" || signal.kind === "disclosed"
|
|
18
|
+
const withinOf = (signal) => (signal.kind === "activated" || signal.kind === "disclosed" || signal.kind === "completed") &&
|
|
19
|
+
signal.within !== undefined
|
|
18
20
|
? signal.within
|
|
19
21
|
: [];
|
|
20
22
|
/** Every node a signal mentions is one this reading now knows the type of. */
|
|
@@ -29,6 +31,7 @@ const foldSignal = (readings, signal) => {
|
|
|
29
31
|
activations: signal.kind === "activated" ? bumped(readings.activations, nodeId, 1) : readings.activations,
|
|
30
32
|
opens: signal.kind === "disclosed" && signal.open ? bumped(readings.opens, nodeId, 1) : readings.opens,
|
|
31
33
|
closes: signal.kind === "disclosed" && !signal.open ? bumped(readings.closes, nodeId, 1) : readings.closes,
|
|
34
|
+
completions: signal.kind === "completed" ? bumped(readings.completions, nodeId, 1) : readings.completions,
|
|
32
35
|
types: {
|
|
33
36
|
...readings.types,
|
|
34
37
|
...Object.fromEntries(within.map((region) => [region.nodeId, region.type])),
|
|
@@ -69,6 +72,7 @@ export const nodeReadingsOf = (readings) => Object.keys(readings.types)
|
|
|
69
72
|
activations: readings.activations[nodeId] ?? 0,
|
|
70
73
|
opens: readings.opens[nodeId] ?? 0,
|
|
71
74
|
closes: readings.closes[nodeId] ?? 0,
|
|
75
|
+
completions: readings.completions[nodeId] ?? 0,
|
|
72
76
|
engagements: readings.engagements[nodeId] ?? 0,
|
|
73
77
|
};
|
|
74
78
|
})
|
|
@@ -0,0 +1,302 @@
|
|
|
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 PageAction, type PartAction } from "./action.js";
|
|
6
|
+
import { type FormPairRefusal } from "./audiences.js";
|
|
7
|
+
import type { PageReading } from "./parts.js";
|
|
8
|
+
/**
|
|
9
|
+
* What readers *do* inside a page, form by form.
|
|
10
|
+
*
|
|
11
|
+
* The second of the two comparisons [0302](../../decisions/0302-two-forms-of-one-page-are-compared-at-each-forms-own-share-and-neither-side-is-earlier.md)
|
|
12
|
+
* named and did not build. `formComparisonOf` holds two forms of one page
|
|
13
|
+
* against each other on each part's **reach** — did this audience's readers
|
|
14
|
+
* get here. This one asks the next question of the same pair: having got here,
|
|
15
|
+
* did they *do* anything. *The riders open the size guide twice as often as
|
|
16
|
+
* the skiers, and neither of them touches the finance band.*
|
|
17
|
+
*
|
|
18
|
+
* Nothing is collected for it. Two readings go in and a comparison comes out,
|
|
19
|
+
* which makes it the thirty-fourth thing taken out of the server-side join
|
|
20
|
+
* rather than added to a payload, a browser, a column or the vocabulary of
|
|
21
|
+
* kinds.
|
|
22
|
+
*
|
|
23
|
+
* ## What it borrows, and the reason borrowing is the unit
|
|
24
|
+
*
|
|
25
|
+
* The five states in which two readings are **not** two forms of one page are
|
|
26
|
+
* `FormPairRefusal` in [`audiences.ts`](audiences.ts), imported here and in
|
|
27
|
+
* `forms.ts` rather than spelled twice. That is not tidying: 0302's six clauses
|
|
28
|
+
* are about the **pair** — one tree, one revision, two provable populations,
|
|
29
|
+
* neither of them earlier — and a second reading of the same pair restates none
|
|
30
|
+
* of them. A rule written in two places is a rule one of its copies will
|
|
31
|
+
* disagree with, which is what `readingKeyOf` and `formKeyOf` exist to stop one
|
|
32
|
+
* level up, and this is the same argument at the comparison.
|
|
33
|
+
*
|
|
34
|
+
* So what is this module's own is one figure and the two things that figure
|
|
35
|
+
* cannot survive.
|
|
36
|
+
*
|
|
37
|
+
* ## The figure, and why this reading has a page-level one where its sibling does not
|
|
38
|
+
*
|
|
39
|
+
* The comparable figure is {@link PartAction.share} — `within ÷ reached`, the
|
|
40
|
+
* readers who reached a part and did something strictly inside it (0167, 0242).
|
|
41
|
+
* Both terms are distinct page-view counts off **one row**, so the straddle
|
|
42
|
+
* over-count (0147) is very nearly common to the numerator and the denominator
|
|
43
|
+
* and divides out before the two populations meet, exactly as a reach share
|
|
44
|
+
* does in `forms.ts` and a fall does in `progress.ts` (0221).
|
|
45
|
+
*
|
|
46
|
+
* **And here the page as a whole has an honest figure, where the reach
|
|
47
|
+
* comparison refuses one.** 0302 clause 5 refuses a page-level verdict for two
|
|
48
|
+
* reasons: a mean over parts charges one reader once per part they got through,
|
|
49
|
+
* and two forms do not have the same parts, so two such means have two
|
|
50
|
+
* denominators that are not the same page. Neither reaches the root.
|
|
51
|
+
* {@link PageAction.whole} is **one part's own row** — every action anywhere on
|
|
52
|
+
* the page is strictly inside the root (0242) — so *three in ten skiers did
|
|
53
|
+
* something on this page and one in ten riders did* is one division per side
|
|
54
|
+
* and no addition at all. {@link FormActionComparison.whole} is that row, held
|
|
55
|
+
* against itself across the two forms, and it is the only page-level claim
|
|
56
|
+
* either form comparison makes.
|
|
57
|
+
*
|
|
58
|
+
* It is kept out of {@link FormActionComparison.sharpest} because the page
|
|
59
|
+
* contains every part it would outrank, which is how `pageActionOf` treats it
|
|
60
|
+
* for `mostIgnored` and `pageReadingOf` before that. It stays **inside**
|
|
61
|
+
* {@link FormActionComparison.counted}, because that is a census of the shared
|
|
62
|
+
* parts and a census that leaves one out does not account for the page.
|
|
63
|
+
*
|
|
64
|
+
* ## The two states the figure cannot survive
|
|
65
|
+
*
|
|
66
|
+
* **A leaf has no inside**, so `engaged` is structurally nought on it and a
|
|
67
|
+
* share built from that nought is a filing rule misread as a finding about
|
|
68
|
+
* readers (0167, 0242). `PartAction.share` is already withheld there, and on a
|
|
69
|
+
* part with no row and on a part whose `reached` is nought — the three states
|
|
70
|
+
* its standing calls `unknown`. So the withholding rule here is **one check
|
|
71
|
+
* where `forms.ts` needs two**: a withheld share and an unknown standing are
|
|
72
|
+
* the same fact said twice and never disagree, which `action.ts` guarantees and
|
|
73
|
+
* this module relies on rather than re-deriving.
|
|
74
|
+
*
|
|
75
|
+
* **A sender that does not walk** is the other, and it is this reading's own
|
|
76
|
+
* silence. A press is filed against the control and credited to its addressed
|
|
77
|
+
* ancestors from the ancestry the signal carries (0167), so a window whose
|
|
78
|
+
* delegated signals have no `within` reports occurrences and credits no reader
|
|
79
|
+
* with acting inside anything: every share on that side is a **nought that is a
|
|
80
|
+
* filing artefact**, not a reader who did nothing. Subtracting the other form's
|
|
81
|
+
* real share against it would publish that form's whole share as a difference
|
|
82
|
+
* between two populations — which is the rule 0282 already applies to an
|
|
83
|
+
* unknown standing, reaching a second state by the same argument. So
|
|
84
|
+
* {@link ComparedFormAction.gap} is withheld on **every** shared part where
|
|
85
|
+
* either side is unwalked, the parts fall into `unknown`, and
|
|
86
|
+
* {@link FormActionSilence.unwalked} says which state the reading is in.
|
|
87
|
+
*
|
|
88
|
+
* That withholding is **`pageActionOf`'s own** since 0304 — 0303 spelled it
|
|
89
|
+
* here, in a second clause of `gapOf`, and the rule moved down to the reading
|
|
90
|
+
* that can see the fault once the before-and-after needed it too. Nothing about
|
|
91
|
+
* this reading's answer changed, which is what its suite asserts.
|
|
92
|
+
*
|
|
93
|
+
* Pure, linear in the parts of the two readings, and reaches no store, clock or
|
|
94
|
+
* DOM. A caller checks `PageReading.orphaned` on both readings before trusting
|
|
95
|
+
* either, exactly as it must before trusting either on its own.
|
|
96
|
+
*/
|
|
97
|
+
/** Why a comparison of what two forms' readers did answered nothing, or less than all of it. */
|
|
98
|
+
export type FormActionSilence =
|
|
99
|
+
/**
|
|
100
|
+
* The five states in which two readings are not two forms of one page.
|
|
101
|
+
*
|
|
102
|
+
* Imported from {@link FormPairRefusal} rather than restated, for the reason
|
|
103
|
+
* the module documentation gives: every one of them is a fact about the pair
|
|
104
|
+
* and none of them is about the counter.
|
|
105
|
+
*/
|
|
106
|
+
FormPairRefusal
|
|
107
|
+
/**
|
|
108
|
+
* One of the two windows holds uses and credits no reader with acting inside
|
|
109
|
+
* anything.
|
|
110
|
+
*
|
|
111
|
+
* `PageAction.unwalked` on either side: a sender whose delegated signals
|
|
112
|
+
* carry no `within` (0167), a server synthesising batches, a fixture
|
|
113
|
+
* replayed. Every share on that side is a nought that is a filing artefact,
|
|
114
|
+
* so every gap across it would be the other form's whole share reported as a
|
|
115
|
+
* difference between two populations.
|
|
116
|
+
*
|
|
117
|
+
* **The figures are withheld as well as the state named.** The spurious
|
|
118
|
+
* nought would be read as *this audience does nothing on your page*, which is
|
|
119
|
+
* the most confident wrong sentence this reading could print. That was argued
|
|
120
|
+
* here first (0303), with `ActionChangeSilence.unwalked` left naming the state
|
|
121
|
+
* alone, and settled for both by moving the rule into the reading (0304), so
|
|
122
|
+
* the two no longer differ. The census of what each form has still answers,
|
|
123
|
+
* because which parts a form carries is a fact about the deltas and about no
|
|
124
|
+
* counter.
|
|
125
|
+
*
|
|
126
|
+
* Checked before `nothing-measured`, and **a single
|
|
127
|
+
* window can reach both**, so the order is a decision rather than reading
|
|
128
|
+
* order: a side with no page views and occurrences filed against its parts is
|
|
129
|
+
* a sender that is not one, and *this window does not report where actions
|
|
130
|
+
* happened* is the sharper of the two things to say about it.
|
|
131
|
+
*/
|
|
132
|
+
| "unwalked"
|
|
133
|
+
/**
|
|
134
|
+
* One of the two windows held no page views.
|
|
135
|
+
*
|
|
136
|
+
* Every standing on that side is `unknown` (0242), so there is no share to
|
|
137
|
+
* compare and every gap is already withheld. **The census still answers**,
|
|
138
|
+
* which is what this member has in common with its spelling everywhere else:
|
|
139
|
+
* *the pro form has three bands the free form does not, and nothing has been
|
|
140
|
+
* measured on either* is a sentence worth printing.
|
|
141
|
+
*/
|
|
142
|
+
| "nothing-measured";
|
|
143
|
+
/** The closed set, for a surface that has to account for every absent figure. */
|
|
144
|
+
export declare const FORM_ACTION_SILENCES: readonly FormActionSilence[];
|
|
145
|
+
/** One line per silence, for a surface saying why a figure is not there. */
|
|
146
|
+
export declare const describeFormActionSilence: (silence: FormActionSilence) => string;
|
|
147
|
+
/** One side of the comparison, as the reading of what its readers did leaves it. */
|
|
148
|
+
export type FormActionSide = {
|
|
149
|
+
readonly treeId: TreeId;
|
|
150
|
+
readonly revision: number;
|
|
151
|
+
/** `null` where the window named none, or named two with neither asked for. */
|
|
152
|
+
readonly audienceId: AudienceId | null;
|
|
153
|
+
/**
|
|
154
|
+
* That side's page-view floor, carried through unchanged.
|
|
155
|
+
*
|
|
156
|
+
* A floor rather than a count, for the reason `parts.ts` gives: distinct view
|
|
157
|
+
* counts cannot be added across rows (0147), so the largest row is the most
|
|
158
|
+
* that can be said from counters alone. Nothing here divides by it — every
|
|
159
|
+
* share in this reading is off one row — and it is carried so a surface can
|
|
160
|
+
* say how big each population was beside what it did.
|
|
161
|
+
*/
|
|
162
|
+
readonly views: number;
|
|
163
|
+
/** Element nodes this form has, which two forms of one page need not share. */
|
|
164
|
+
readonly parts: number;
|
|
165
|
+
/** Parts with no element parts under them, whose share is withheld structurally. */
|
|
166
|
+
readonly leaves: number;
|
|
167
|
+
/** Whether this side holds uses and credits them to nobody (0167). */
|
|
168
|
+
readonly unwalked: boolean;
|
|
169
|
+
};
|
|
170
|
+
/** A part exactly one of the two forms has, with the form that has it named. */
|
|
171
|
+
export type PartActionOfForm = {
|
|
172
|
+
readonly nodeId: NodeId;
|
|
173
|
+
readonly type: PrimitiveType;
|
|
174
|
+
readonly role: PrimitiveRole | null;
|
|
175
|
+
/** The form this part is in. The other form does not have this node at all. */
|
|
176
|
+
readonly audienceId: AudienceId;
|
|
177
|
+
readonly side: PartAction;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* A part both forms have, as each form's own readers used it.
|
|
181
|
+
*
|
|
182
|
+
* Each side is the whole {@link PartAction} rather than a narrowed copy of it,
|
|
183
|
+
* because that reading already withholds its share in exactly the states where
|
|
184
|
+
* a share is not a measurement, and a second type restating three of its fields
|
|
185
|
+
* would be a second place to get that wrong.
|
|
186
|
+
*/
|
|
187
|
+
export type ComparedFormAction = {
|
|
188
|
+
readonly nodeId: NodeId;
|
|
189
|
+
/** The type {@link FormActionComparison.one} gives it; `disagreed` names the pair if the other differs. */
|
|
190
|
+
readonly type: PrimitiveType;
|
|
191
|
+
readonly role: PrimitiveRole | null;
|
|
192
|
+
readonly one: PartAction;
|
|
193
|
+
readonly other: PartAction;
|
|
194
|
+
/**
|
|
195
|
+
* The form whose readers acted inside it more often, or `null` where no claim
|
|
196
|
+
* stands.
|
|
197
|
+
*
|
|
198
|
+
* `null` with a {@link ComparedFormAction.gap} of nought is the two forms
|
|
199
|
+
* acting alike; `null` with a `gap` of `null` is nothing being sayable. The
|
|
200
|
+
* two are a long way apart and are deliberately not one value.
|
|
201
|
+
*/
|
|
202
|
+
readonly favours: AudienceId | null;
|
|
203
|
+
/**
|
|
204
|
+
* The distance between the two shares, which is never signed.
|
|
205
|
+
*
|
|
206
|
+
* `|one.share − other.share|`, with the direction in
|
|
207
|
+
* {@link ComparedFormAction.favours} rather than in the sign — because a sign
|
|
208
|
+
* is read against an order, and the order here is the alphabet of two
|
|
209
|
+
* audience names and means nothing (0302).
|
|
210
|
+
*
|
|
211
|
+
* `null` where either side withholds its share — a leaf, a part with no row,
|
|
212
|
+
* a part nobody reached — **and on every part of a pair where either side is
|
|
213
|
+
* unwalked**, where the noughts are a filing artefact rather than readers who
|
|
214
|
+
* did nothing.
|
|
215
|
+
*/
|
|
216
|
+
readonly gap: number | null;
|
|
217
|
+
};
|
|
218
|
+
/** How the shared parts fell, as a count over one set and never a mean. */
|
|
219
|
+
export type FormActionsCounted = {
|
|
220
|
+
/** Parts {@link FormActionComparison.one}'s readers acted inside more often. */
|
|
221
|
+
readonly one: number;
|
|
222
|
+
/** Parts {@link FormActionComparison.other}'s readers acted inside more often. */
|
|
223
|
+
readonly other: number;
|
|
224
|
+
/** Parts the two forms acted inside alike. */
|
|
225
|
+
readonly alike: number;
|
|
226
|
+
/** Parts where one side or the other cannot say. */
|
|
227
|
+
readonly unknown: number;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* What two forms' readers did inside one page, held against each other.
|
|
231
|
+
*
|
|
232
|
+
* There is no `treeId` or `revision` at the top, where every reading of one
|
|
233
|
+
* page has one, for the reason 0302 gives: this is a reading of two sides
|
|
234
|
+
* rather than of one page, and the two refusals that matter most are exactly
|
|
235
|
+
* the two where picking one side's would be picking one of two answers.
|
|
236
|
+
*/
|
|
237
|
+
export type FormActionComparison = {
|
|
238
|
+
/** The side whose audience id sorts lower, or the first argument where no pair of names stands. */
|
|
239
|
+
readonly one: FormActionSide;
|
|
240
|
+
readonly other: FormActionSide;
|
|
241
|
+
/** The two readings this comparison was taken from, so nothing downstream derives them twice. */
|
|
242
|
+
readonly readings: {
|
|
243
|
+
readonly one: PageAction;
|
|
244
|
+
readonly other: PageAction;
|
|
245
|
+
};
|
|
246
|
+
/** Parts both forms have, in the reading order of {@link FormActionComparison.one}. */
|
|
247
|
+
readonly compared: readonly ComparedFormAction[];
|
|
248
|
+
/** Parts exactly one form has, by audience and then by node. */
|
|
249
|
+
readonly onlyIn: readonly PartActionOfForm[];
|
|
250
|
+
/**
|
|
251
|
+
* Shared nodes the two forms give different primitive types.
|
|
252
|
+
*
|
|
253
|
+
* Reported and not dropped, as `FormComparison.disagreed` is: the two shares
|
|
254
|
+
* are each their own form's and stay comparable, while a pair that is a band
|
|
255
|
+
* on one side and a card on the other is a fact about the deltas nobody would
|
|
256
|
+
* otherwise see.
|
|
257
|
+
*/
|
|
258
|
+
readonly disagreed: readonly NodeId[];
|
|
259
|
+
/**
|
|
260
|
+
* Shared nodes one form gives an inside and the other does not.
|
|
261
|
+
*
|
|
262
|
+
* The diagnosis this reading needs and its sibling does not. A share is
|
|
263
|
+
* withheld on a leaf for a structural reason, so a part the deltas filled for
|
|
264
|
+
* one audience and left bare for the other has a share on one side and none
|
|
265
|
+
* on the other — and the pair lands in `unknown` with nothing saying why.
|
|
266
|
+
* *The riders' version of this band has nothing in it* is the answer, and it
|
|
267
|
+
* is a fact about the deltas rather than about either readership.
|
|
268
|
+
*/
|
|
269
|
+
readonly insideDisagreed: readonly NodeId[];
|
|
270
|
+
readonly counted: FormActionsCounted;
|
|
271
|
+
/**
|
|
272
|
+
* The root, held against itself across the two forms.
|
|
273
|
+
*
|
|
274
|
+
* The one page-level claim either form comparison makes, and it is a division
|
|
275
|
+
* rather than an addition: see the module documentation. `null` where the
|
|
276
|
+
* revision's root is not an element part of both forms.
|
|
277
|
+
*/
|
|
278
|
+
readonly whole: ComparedFormAction | null;
|
|
279
|
+
/**
|
|
280
|
+
* The shared part with the widest gap, by node id where two tie.
|
|
281
|
+
*
|
|
282
|
+
* The page itself is never it, because it contains every part it would
|
|
283
|
+
* outrank. `null` where nothing can say.
|
|
284
|
+
*/
|
|
285
|
+
readonly sharpest: ComparedFormAction | null;
|
|
286
|
+
readonly silence: FormActionSilence | null;
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Hold what two forms' readers did against each other.
|
|
290
|
+
*
|
|
291
|
+
* Takes two page readings, each of one audience, of one tree at one revision,
|
|
292
|
+
* and derives what readers did on each — handed two readings rather than two
|
|
293
|
+
* finished `PageAction`s for the reason `actionChangeOf` is: one input per side
|
|
294
|
+
* cannot be a mismatched pair, and the two it derives travel on the comparison
|
|
295
|
+
* so nothing downstream pays for them twice.
|
|
296
|
+
*
|
|
297
|
+
* The labels are not `was` and `now` and the order of the arguments does not
|
|
298
|
+
* reach the answer: see `formPairOf`, and {@link FormActionSilence} for the
|
|
299
|
+
* seven states in which there is no figure.
|
|
300
|
+
*/
|
|
301
|
+
export declare const formActionComparisonOf: (one: PageReading, other: PageReading) => FormActionComparison;
|
|
302
|
+
//# sourceMappingURL=form-action.d.ts.map
|