@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,123 @@
|
|
|
1
|
+
import type { PartReading, PartStanding } from "./parts.js";
|
|
2
|
+
/**
|
|
3
|
+
* The shape of a page's parts, as three projections every reading of the
|
|
4
|
+
* frontier needs and none of them should spell twice.
|
|
5
|
+
*
|
|
6
|
+
* A reading of a page is a pre-order list of addressed nodes carrying a depth
|
|
7
|
+
* ([`parts.ts`](parts.ts)), so *what is inside this part* is a contiguous run
|
|
8
|
+
* and *what did the readers below it report* is a difference of two prefix
|
|
9
|
+
* counts. Both are one pass over the page and neither walks a part's ancestors,
|
|
10
|
+
* which is the quadratic shape rule 4 of
|
|
11
|
+
* [`docs/signals.md`](../../docs/signals.md) keeps out of these readings.
|
|
12
|
+
*
|
|
13
|
+
* **Internal to `src/signals/`, and deliberately not re-exported from
|
|
14
|
+
* [`index.ts`](index.ts).** It publishes no answer about a deployment; it is the
|
|
15
|
+
* one spelling of a projection that [`frontier.ts`](frontier.ts), the census in
|
|
16
|
+
* [`library-senders.ts`](library-senders.ts), the comparison in
|
|
17
|
+
* [`library-senders-change.ts`](library-senders-change.ts) and the
|
|
18
|
+
* reader-weighted reading in
|
|
19
|
+
* [`library-senders-reach.ts`](library-senders-reach.ts) all need. Two
|
|
20
|
+
* spellings that agree
|
|
21
|
+
* today are how the two came to disagree about which parts a reader was below
|
|
22
|
+
* — the failure `parts.ts` names about `spokenFor` and the counter keys.
|
|
23
|
+
*
|
|
24
|
+
* Pure: no store, no clock, no DOM, and nothing here survives into a browser
|
|
25
|
+
* bundle.
|
|
26
|
+
*/
|
|
27
|
+
/** Where each part sits, from one pre-order pass over a stack of open parts. */
|
|
28
|
+
export type PartExtents = {
|
|
29
|
+
/**
|
|
30
|
+
* The index of the part each part sits inside, and `null` at an outermost
|
|
31
|
+
* part.
|
|
32
|
+
*
|
|
33
|
+
* Taken by index rather than by id so that a container's standing is read off
|
|
34
|
+
* the row itself. An id would be a second place where two parts sharing one —
|
|
35
|
+
* which a tree does not do, and which a reading cannot check — became a wrong
|
|
36
|
+
* answer instead of an impossible one.
|
|
37
|
+
*/
|
|
38
|
+
readonly containers: readonly (number | null)[];
|
|
39
|
+
/** The exclusive end of each part's subtree; `parts.length` for a part the page ends inside. */
|
|
40
|
+
readonly ends: readonly number[];
|
|
41
|
+
};
|
|
42
|
+
/** Each part's container and the end of its subtree, in one pass. */
|
|
43
|
+
export declare const extentsOf: (parts: readonly PartReading[]) => PartExtents;
|
|
44
|
+
/** Prefix counts, so a subtree's standings are two subtractions rather than a scan. */
|
|
45
|
+
export declare const prefixOf: (parts: readonly PartReading[], standing: PartStanding) => readonly number[];
|
|
46
|
+
/** The count over the half-open range `[from, to)` of a prefix built by {@link prefixOf}. */
|
|
47
|
+
export declare const between: (counts: readonly number[], from: number, to: number) => number;
|
|
48
|
+
/**
|
|
49
|
+
* What a placement is, as far as a silent sender can be seen on it.
|
|
50
|
+
*
|
|
51
|
+
* The five states are exclusive and exhaustive over a page's parts, and the
|
|
52
|
+
* order below is the order they are decided in: whether anything stands inside
|
|
53
|
+
* it, then whether anything inside it reported reach, then what it said about
|
|
54
|
+
* itself.
|
|
55
|
+
*/
|
|
56
|
+
export type SenderState =
|
|
57
|
+
/** Nothing stands inside it, so nothing could ever witness it (0393). */
|
|
58
|
+
"leaf"
|
|
59
|
+
/** Parts stand inside it and none of them reported reach in this window. */
|
|
60
|
+
| "unwitnessed"
|
|
61
|
+
/** Something below it reported reach, and it reported coming into view itself. */
|
|
62
|
+
| "reporting"
|
|
63
|
+
/** Something below it reported reach and it said nothing, which is the defect (0382). */
|
|
64
|
+
| "silent"
|
|
65
|
+
/**
|
|
66
|
+
* Something below it reported reach and it reported something that was not a
|
|
67
|
+
* view.
|
|
68
|
+
*
|
|
69
|
+
* Plausibly the same defect and never claimed as it, because `unknown` is the
|
|
70
|
+
* absence of a claim (0282).
|
|
71
|
+
*/
|
|
72
|
+
| "indeterminate";
|
|
73
|
+
/** Whether the defect could be seen at a placement in this state. */
|
|
74
|
+
export declare const witnessedState: (state: SenderState) => boolean;
|
|
75
|
+
/** One part with what its placement is, which is what a census and a comparison both count. */
|
|
76
|
+
export type PartSender = {
|
|
77
|
+
readonly part: PartReading;
|
|
78
|
+
readonly state: SenderState;
|
|
79
|
+
/**
|
|
80
|
+
* The most reach any part **strictly inside** it reported, which is what a
|
|
81
|
+
* reader-weighted reading of the defect weighs a placement by.
|
|
82
|
+
*
|
|
83
|
+
* It is nought exactly where {@link witnessedState} is false, and that is one
|
|
84
|
+
* fact rather than two agreeing ones: a part is `read` precisely when its
|
|
85
|
+
* counters report reach above nought, so *something below it reported reach*
|
|
86
|
+
* and *the most reach below it is above nought* are the same predicate read
|
|
87
|
+
* two ways. A reading that worked its own version of it out beside the state
|
|
88
|
+
* is the drift this module exists to prevent.
|
|
89
|
+
*
|
|
90
|
+
* **The maximum and never the sum.** `reached` counts distinct page views per
|
|
91
|
+
* part, so adding a subtree's counters multiplies one reader by how finely
|
|
92
|
+
* the page was built — the distinctness trap
|
|
93
|
+
* [`parts.ts`](parts.ts) already keeps out of a role row. The largest single
|
|
94
|
+
* part's count is a **floor** on the page views that got inside, which is the
|
|
95
|
+
* direction a census of a quiet deployment is allowed to be wrong in (0212).
|
|
96
|
+
*
|
|
97
|
+
* Raw, in the page's own counters: putting it on the scale a door counts in
|
|
98
|
+
* is the caller's, because the door is a fact about the page and not about the
|
|
99
|
+
* tree.
|
|
100
|
+
*/
|
|
101
|
+
readonly insideReach: number;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Each part of a page with the state its placement is in, in one pass.
|
|
105
|
+
*
|
|
106
|
+
* The **one** spelling of 0382's rule — *skipped, with reach reported below it*
|
|
107
|
+
* — shared by the census ([`library-senders.ts`](library-senders.ts)), by the
|
|
108
|
+
* comparison of two windows
|
|
109
|
+
* ([`library-senders-change.ts`](library-senders-change.ts)) and by the
|
|
110
|
+
* reader-weighted reading of the same defect
|
|
111
|
+
* ([`library-senders-reach.ts`](library-senders-reach.ts)). Two spellings of
|
|
112
|
+
* it that agreed today is what this module exists to prevent, and a census and a
|
|
113
|
+
* comparison disagreeing about which placements were silent is the shape of that
|
|
114
|
+
* failure a surface could not notice.
|
|
115
|
+
*
|
|
116
|
+
* Carries the part rather than an index, so that no caller reads a parallel
|
|
117
|
+
* array back by position — and carries {@link PartSender.insideReach} beside the
|
|
118
|
+
* state for the same reason, since the weight a reader-weighted reading puts on
|
|
119
|
+
* a placement and the predicate that says the defect is visible there are one
|
|
120
|
+
* fact about the subtree.
|
|
121
|
+
*/
|
|
122
|
+
export declare const senderStatesOf: (parts: readonly PartReading[]) => readonly PartSender[];
|
|
123
|
+
//# sourceMappingURL=subtrees.d.ts.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/** Each part's container and the end of its subtree, in one pass. */
|
|
2
|
+
export const extentsOf = (parts) => {
|
|
3
|
+
const total = parts.length;
|
|
4
|
+
const containers = [];
|
|
5
|
+
const ends = new Array(total).fill(total);
|
|
6
|
+
const open = [];
|
|
7
|
+
for (const [at, part] of parts.entries()) {
|
|
8
|
+
for (;;) {
|
|
9
|
+
const top = open.at(-1);
|
|
10
|
+
if (top === undefined)
|
|
11
|
+
break;
|
|
12
|
+
const above = parts[top];
|
|
13
|
+
if (above === undefined || above.depth < part.depth)
|
|
14
|
+
break;
|
|
15
|
+
ends[top] = at;
|
|
16
|
+
open.pop();
|
|
17
|
+
}
|
|
18
|
+
containers.push(open.at(-1) ?? null);
|
|
19
|
+
open.push(at);
|
|
20
|
+
}
|
|
21
|
+
return { containers, ends };
|
|
22
|
+
};
|
|
23
|
+
/** Prefix counts, so a subtree's standings are two subtractions rather than a scan. */
|
|
24
|
+
export const prefixOf = (parts, standing) => {
|
|
25
|
+
const counts = [0];
|
|
26
|
+
for (const part of parts)
|
|
27
|
+
counts.push((counts.at(-1) ?? 0) + (part.standing === standing ? 1 : 0));
|
|
28
|
+
return counts;
|
|
29
|
+
};
|
|
30
|
+
/** The count over the half-open range `[from, to)` of a prefix built by {@link prefixOf}. */
|
|
31
|
+
export const between = (counts, from, to) => (counts[to] ?? 0) - (counts[from] ?? 0);
|
|
32
|
+
/** Whether the defect could be seen at a placement in this state. */
|
|
33
|
+
export const witnessedState = (state) => state === "reporting" || state === "silent" || state === "indeterminate";
|
|
34
|
+
const stateOf = (part, beneath, readBelow) => {
|
|
35
|
+
if (beneath === 0)
|
|
36
|
+
return "leaf";
|
|
37
|
+
if (readBelow === 0)
|
|
38
|
+
return "unwitnessed";
|
|
39
|
+
switch (part.standing) {
|
|
40
|
+
case "read":
|
|
41
|
+
return "reporting";
|
|
42
|
+
case "skipped":
|
|
43
|
+
return "silent";
|
|
44
|
+
case "unknown":
|
|
45
|
+
return "indeterminate";
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The most reach reported inside each part, in one pass over the page.
|
|
50
|
+
*
|
|
51
|
+
* Walked **backwards**, which is what makes it one pass: a pre-order list puts
|
|
52
|
+
* every part after the part that contains it, so by the time an index is read
|
|
53
|
+
* its own subtree has already been folded into it and the answer can be handed
|
|
54
|
+
* up to its container. A maximum does not subtract, so the prefix counts
|
|
55
|
+
* {@link prefixOf} builds cannot serve and a forward walk would have to look
|
|
56
|
+
* down each subtree — the per-part descent rule 4 of
|
|
57
|
+
* [`docs/signals.md`](../../docs/signals.md) keeps out of these readings.
|
|
58
|
+
*/
|
|
59
|
+
const reachInsideOf = (parts, containers) => {
|
|
60
|
+
const inside = new Array(parts.length).fill(0);
|
|
61
|
+
for (let at = parts.length - 1; at >= 0; at -= 1) {
|
|
62
|
+
const container = containers[at];
|
|
63
|
+
if (container === null || container === undefined)
|
|
64
|
+
continue;
|
|
65
|
+
const own = parts[at]?.counters?.reached ?? 0;
|
|
66
|
+
inside[container] = Math.max(inside[container] ?? 0, own, inside[at] ?? 0);
|
|
67
|
+
}
|
|
68
|
+
return inside;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Each part of a page with the state its placement is in, in one pass.
|
|
72
|
+
*
|
|
73
|
+
* The **one** spelling of 0382's rule — *skipped, with reach reported below it*
|
|
74
|
+
* — shared by the census ([`library-senders.ts`](library-senders.ts)), by the
|
|
75
|
+
* comparison of two windows
|
|
76
|
+
* ([`library-senders-change.ts`](library-senders-change.ts)) and by the
|
|
77
|
+
* reader-weighted reading of the same defect
|
|
78
|
+
* ([`library-senders-reach.ts`](library-senders-reach.ts)). Two spellings of
|
|
79
|
+
* it that agreed today is what this module exists to prevent, and a census and a
|
|
80
|
+
* comparison disagreeing about which placements were silent is the shape of that
|
|
81
|
+
* failure a surface could not notice.
|
|
82
|
+
*
|
|
83
|
+
* Carries the part rather than an index, so that no caller reads a parallel
|
|
84
|
+
* array back by position — and carries {@link PartSender.insideReach} beside the
|
|
85
|
+
* state for the same reason, since the weight a reader-weighted reading puts on
|
|
86
|
+
* a placement and the predicate that says the defect is visible there are one
|
|
87
|
+
* fact about the subtree.
|
|
88
|
+
*/
|
|
89
|
+
export const senderStatesOf = (parts) => {
|
|
90
|
+
const { containers, ends } = extentsOf(parts);
|
|
91
|
+
const reads = prefixOf(parts, "read");
|
|
92
|
+
const inside = reachInsideOf(parts, containers);
|
|
93
|
+
return parts.map((part, at) => {
|
|
94
|
+
const end = ends[at] ?? parts.length;
|
|
95
|
+
return {
|
|
96
|
+
part,
|
|
97
|
+
state: stateOf(part, end - at - 1, between(reads, at + 1, end)),
|
|
98
|
+
insideReach: inside[at] ?? 0,
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=subtrees.js.map
|
package/dist/signals/tally.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AudienceId } from "../audience/audience.js";
|
|
2
|
+
import type { NodeId, TreeId } from "../ids.js";
|
|
2
3
|
import type { Result } from "../result.js";
|
|
3
|
-
import type {
|
|
4
|
+
import type { ActedHourCount, StoredActed } from "./acted.js";
|
|
5
|
+
import type { FunnelHourCount, StoredFunnelHours } from "./funnel-hours.js";
|
|
6
|
+
import type { StoredArrivals } from "./arrivals.js";
|
|
4
7
|
import type { ReaderSignalStoreError } from "./journal.js";
|
|
8
|
+
import type { RevisionViews, StoredPageViews } from "./page-views.js";
|
|
9
|
+
import type { FunnelAnswer, FunnelPair, ReaderTally } from "./rollup.js";
|
|
5
10
|
/**
|
|
6
11
|
* Where the counters live once the batches they came from are gone.
|
|
7
12
|
*
|
|
@@ -24,18 +29,49 @@ import type { ReaderSignalStoreError } from "./journal.js";
|
|
|
24
29
|
* the alternative is keeping view keys in durable storage — which is the thing
|
|
25
30
|
* 0146 refuses. A deployment that wants the bound small makes the rollup window
|
|
26
31
|
* long relative to a page view, which is the default.
|
|
32
|
+
*
|
|
33
|
+
* **The bound is now also a measurement, and that is the one thing here that has
|
|
34
|
+
* changed since 0147.** Page views are counted a second time at the door, where
|
|
35
|
+
* an opening is a single event rather than a distinct count
|
|
36
|
+
* ([`page-views.ts`](page-views.ts)), so the difference between the two numbers
|
|
37
|
+
* is the straddle — per revision, in the rows, for as long as the counters live.
|
|
38
|
+
* It does not make a tally exact. It makes a deployment able to say by how much
|
|
39
|
+
* it is not.
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* One node's line as the store keeps it, which is a tally plus the audience it
|
|
43
|
+
* was collected under and when it last changed.
|
|
44
|
+
*
|
|
45
|
+
* `audienceId` is on the stored row and not on `ReaderTally` deliberately
|
|
46
|
+
* (0284). A rollup folds one audience's window, so the counters it produces are
|
|
47
|
+
* already all one audience's and a field on each would be the same value
|
|
48
|
+
* repeated; a row read back may sit beside another audience's, so it has to say
|
|
49
|
+
* which it is. It is also what lets a screen compare two without a reading
|
|
50
|
+
* having to remember what it asked for.
|
|
27
51
|
*/
|
|
28
|
-
/** One node's line as the store keeps it, which is a tally plus when it last changed. */
|
|
29
52
|
export type StoredTally = ReaderTally & {
|
|
53
|
+
readonly audienceId: AudienceId;
|
|
30
54
|
readonly updatedAt: string;
|
|
31
55
|
};
|
|
32
|
-
/** One funnel answer as the store keeps it. */
|
|
56
|
+
/** One funnel answer as the store keeps it. See `StoredTally.audienceId`. */
|
|
33
57
|
export type StoredFunnel = FunnelAnswer & {
|
|
58
|
+
readonly audienceId: AudienceId;
|
|
34
59
|
readonly updatedAt: string;
|
|
35
60
|
};
|
|
36
61
|
export type TallyReadRequest = {
|
|
37
62
|
/** Absent reads every tree the handle can see, which is the scope rule (0020). */
|
|
38
63
|
readonly treeId?: TreeId;
|
|
64
|
+
/**
|
|
65
|
+
* Absent reads every audience (0284).
|
|
66
|
+
*
|
|
67
|
+
* A filter rather than a requirement, on the terms `revision` below is one:
|
|
68
|
+
* comparing two audiences is the point of serving two, so a reading that
|
|
69
|
+
* could not span them would make the comparison the measurement rests on
|
|
70
|
+
* unreadable (0263). Each row names its own audience, so a caller that wants them
|
|
71
|
+
* apart groups rather than summing — and a caller that sums two has asked
|
|
72
|
+
* for one number about two populations.
|
|
73
|
+
*/
|
|
74
|
+
readonly audience?: AudienceId | undefined;
|
|
39
75
|
/**
|
|
40
76
|
* Absent reads every revision.
|
|
41
77
|
*
|
|
@@ -46,6 +82,44 @@ export type TallyReadRequest = {
|
|
|
46
82
|
*/
|
|
47
83
|
readonly revision?: number;
|
|
48
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* The one write the door makes into the durable counters.
|
|
87
|
+
*
|
|
88
|
+
* Narrow on purpose. Everything else here is written by a rollup over a window
|
|
89
|
+
* of the buffer; the number of page views that *began* cannot be, because by
|
|
90
|
+
* the time a window is folded nothing knows which of its views were already
|
|
91
|
+
* underway (0214). So the intake writes that one counter, and it is handed an
|
|
92
|
+
* interface that can do nothing else — a door that could read a deployment's
|
|
93
|
+
* tallies is a public endpoint one query away from serving them.
|
|
94
|
+
*/
|
|
95
|
+
export interface ReaderOpeningCounter {
|
|
96
|
+
/**
|
|
97
|
+
* Add the page views a delivery opened, creating rows that do not exist yet.
|
|
98
|
+
*
|
|
99
|
+
* Additive like everything else in this file, and for the sharpest reason of
|
|
100
|
+
* any of them: every call is one delivery's worth of arrivals, so a store
|
|
101
|
+
* that replaced would report the last reader rather than the readership.
|
|
102
|
+
*
|
|
103
|
+
* **It writes two rows for every opening: the revision's total and the hour
|
|
104
|
+
* it arrived in** (`arrivals.ts`), in one atomic write. One call rather than
|
|
105
|
+
* two because the two numbers are the same arrivals counted under two keys,
|
|
106
|
+
* and a door that could move one without the other would be a deployment
|
|
107
|
+
* whose hourly chart does not sum to its own page-view count — for ever,
|
|
108
|
+
* invisibly, with no way to tell which of the two is the wrong one. `at` is
|
|
109
|
+
* the hour, so the second row needs nothing this call did not already have.
|
|
110
|
+
*/
|
|
111
|
+
readonly opened: (openings: readonly RevisionViews[], at: string,
|
|
112
|
+
/**
|
|
113
|
+
* The audience the delivery was served under (0284). Omitted is
|
|
114
|
+
* `aud_everyone`, so a door that serves one form of every page calls this
|
|
115
|
+
* exactly as it did.
|
|
116
|
+
*
|
|
117
|
+
* One audience per call rather than one per opening, because a delivery is
|
|
118
|
+
* one page view of one form of one page — the same reason the batch carries
|
|
119
|
+
* it and a signal does not.
|
|
120
|
+
*/
|
|
121
|
+
audience?: AudienceId) => Promise<Result<void, ReaderSignalStoreError>>;
|
|
122
|
+
}
|
|
49
123
|
/**
|
|
50
124
|
* Counters are not paged.
|
|
51
125
|
*
|
|
@@ -54,17 +128,193 @@ export type TallyReadRequest = {
|
|
|
54
128
|
* Paging them would be a cursor every caller has to carry for a result that
|
|
55
129
|
* fits in a response.
|
|
56
130
|
*/
|
|
57
|
-
|
|
131
|
+
/**
|
|
132
|
+
* One fold's output, as a caller hands it over.
|
|
133
|
+
*
|
|
134
|
+
* Every row in it belongs to one audience, which is what keeps `ReaderTally`
|
|
135
|
+
* free of the dimension (0284): a window holding two audiences is folded once
|
|
136
|
+
* per audience, and each fold produces one of these.
|
|
137
|
+
*/
|
|
138
|
+
export type AppliedCounters = {
|
|
139
|
+
readonly tallies: readonly ReaderTally[];
|
|
140
|
+
readonly funnels: readonly FunnelAnswer[];
|
|
58
141
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
142
|
+
* The window's page views, per revision, for the counter the exact count
|
|
143
|
+
* is compared against.
|
|
144
|
+
*
|
|
145
|
+
* Optional, and absent is not none: a caller applying counters it
|
|
146
|
+
* composed itself — a backfill, a fixture, a test — has no window to
|
|
147
|
+
* report, and a nought written there would read as *no page views* and
|
|
148
|
+
* make a reading claim the node counters were exact.
|
|
149
|
+
*/
|
|
150
|
+
readonly appearances?: readonly RevisionViews[];
|
|
151
|
+
/**
|
|
152
|
+
* The same window's occurrences of the three delegated kinds, filed under the
|
|
153
|
+
* hour the door received them in (`acted.ts`).
|
|
154
|
+
*
|
|
155
|
+
* Optional on the same terms as `appearances`, and absent is not none: a
|
|
156
|
+
* caller composing counters by hand has no receive instants to file them
|
|
157
|
+
* under, and rows of noughts would claim that readers did nothing in an hour
|
|
158
|
+
* nothing was measured in.
|
|
159
|
+
*
|
|
160
|
+
* **Written in the same transaction as the tallies it slices**, because the
|
|
161
|
+
* two numbers a reading divides have to describe the same window — and
|
|
162
|
+
* because the hours of a part are expected to sum to the part's own counters
|
|
163
|
+
* for every window folded since the table existed.
|
|
62
164
|
*/
|
|
63
|
-
readonly
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
165
|
+
readonly acted?: readonly ActedHourCount[];
|
|
166
|
+
/**
|
|
167
|
+
* The same window's funnel answers, cut into the hours the views in each of
|
|
168
|
+
* them entered the funnel (`funnel-hours.ts`).
|
|
169
|
+
*
|
|
170
|
+
* Optional on the same terms as the two above, and absent is not none: a
|
|
171
|
+
* caller composing counters by hand has no receive instants to file a cohort
|
|
172
|
+
* under, and rows of noughts would claim that nobody entered a funnel in an
|
|
173
|
+
* hour nothing was measured in.
|
|
174
|
+
*
|
|
175
|
+
* **Written in the same transaction as the answers it slices**, because the
|
|
176
|
+
* hours of a pair are expected to sum to the pair's own row for every window
|
|
177
|
+
* folded since the table existed — and a slice that moved while the row it
|
|
178
|
+
* slices did not is a chart that cannot be reconciled with the figure beside
|
|
179
|
+
* it.
|
|
180
|
+
*/
|
|
181
|
+
readonly funnelHours?: readonly FunnelHourCount[];
|
|
182
|
+
};
|
|
183
|
+
/** One audience's share of a window, which is what {@link ReaderTallyStore.applyWindow} takes a list of. */
|
|
184
|
+
export type AudienceCounters = AppliedCounters & {
|
|
185
|
+
/** The audience this fold was taken over (0284). Omitted is `aud_everyone`. */
|
|
186
|
+
readonly audience?: AudienceId | undefined;
|
|
187
|
+
};
|
|
188
|
+
export interface ReaderTallyStore extends ReaderOpeningCounter {
|
|
189
|
+
/**
|
|
190
|
+
* Add a whole window's counters to what is already there, every audience in
|
|
191
|
+
* it, in one atomic write — creating rows that do not exist yet.
|
|
192
|
+
*
|
|
193
|
+
* **This is the method a collection run calls, and the atomicity is the
|
|
194
|
+
* reason it exists rather than a property it happens to have.**
|
|
195
|
+
*
|
|
196
|
+
* A window holds whatever arrived in it, so a deployment serving two forms of
|
|
197
|
+
* a page holds two audiences interleaved and is folded once per audience
|
|
198
|
+
* (0284). Writing those folds as separate calls leaves a state between them
|
|
199
|
+
* where some are durable and the rest are not — and because counting and
|
|
200
|
+
* forgetting are one operation (`collect.ts`), the buffer still holds the
|
|
201
|
+
* window, so the next run folds it again and **adds the already-durable
|
|
202
|
+
* audiences a second time.** Of a tally's nine counters, `views`, `reached`
|
|
203
|
+
* and `engaged` are distinct counts and would move little; `dwellMs`,
|
|
204
|
+
* `activations`, `opens`, `closes` and `completions` are occurrences and
|
|
205
|
+
* would double, which every rate in this subsystem divides by the first kind
|
|
206
|
+
* — so the damage is invisible, permanent (0158) and looks like a readership
|
|
207
|
+
* twice as interested as it was (0316).
|
|
208
|
+
*
|
|
209
|
+
* So the window is one write or it is none. A store that cannot be atomic
|
|
210
|
+
* over several audiences cannot be correct here, which is why this is a
|
|
211
|
+
* required method rather than a capability a caller probes for.
|
|
212
|
+
*
|
|
213
|
+
* Two entries naming one audience are added together, not refused: the
|
|
214
|
+
* guarantee is the same one `counters.ts` gives for two rows naming one
|
|
215
|
+
* counter, and it is here so that the two shipped stores cannot disagree
|
|
216
|
+
* about it.
|
|
217
|
+
*/
|
|
218
|
+
readonly applyWindow: (window: readonly AudienceCounters[], at: string) => Promise<Result<void, ReaderSignalStoreError>>;
|
|
219
|
+
/**
|
|
220
|
+
* One audience's counters, which is {@link applyWindow} over a single entry
|
|
221
|
+
* and is implemented as exactly that in both shipped stores — so the two
|
|
222
|
+
* cannot drift on the half that matters.
|
|
223
|
+
*
|
|
224
|
+
* Kept because a caller composing counters by hand — a backfill, a fixture, a
|
|
225
|
+
* migration — has one audience and no window, and should not have to wrap it
|
|
226
|
+
* in a list to say so.
|
|
227
|
+
*/
|
|
228
|
+
readonly apply: (counters: AppliedCounters, at: string,
|
|
229
|
+
/**
|
|
230
|
+
* The audience whose counters these are (0284). Omitted is `aud_everyone`.
|
|
231
|
+
*/
|
|
232
|
+
audience?: AudienceId) => Promise<Result<void, ReaderSignalStoreError>>;
|
|
67
233
|
readonly tallies: (request?: TallyReadRequest) => Promise<Result<readonly StoredTally[], ReaderSignalStoreError>>;
|
|
68
234
|
readonly funnels: (request?: TallyReadRequest) => Promise<Result<readonly StoredFunnel[], ReaderSignalStoreError>>;
|
|
235
|
+
/**
|
|
236
|
+
* How many page views there were, which is the denominator every rate on a
|
|
237
|
+
* screen needs and the only row here written from two sides.
|
|
238
|
+
*/
|
|
239
|
+
readonly pageViews: (request?: TallyReadRequest) => Promise<Result<readonly StoredPageViews[], ReaderSignalStoreError>>;
|
|
240
|
+
/**
|
|
241
|
+
* The same page views, by the hour they began in, over a range (`arrivals.ts`).
|
|
242
|
+
*
|
|
243
|
+
* The one read here that takes a stretch of time, because it is the one
|
|
244
|
+
* counter that has one. It answers two things in a call — the hours in the
|
|
245
|
+
* range, and the first hour this scope ever counted — so that a surface
|
|
246
|
+
* drawing a chart over a range the deployment is younger than can say so
|
|
247
|
+
* instead of drawing it empty.
|
|
248
|
+
*/
|
|
249
|
+
readonly arrivals: (request?: ArrivalReadRequest) => Promise<Result<StoredArrivals, ReaderSignalStoreError>>;
|
|
250
|
+
/**
|
|
251
|
+
* What readers did, per part, by the hour they did it in, over a range
|
|
252
|
+
* (`acted.ts`).
|
|
253
|
+
*
|
|
254
|
+
* The second read here that takes a stretch of time, and the second that
|
|
255
|
+
* answers two things in a call — the rows in the range, and the first hour
|
|
256
|
+
* this scope ever counted — so a goal's figure over thirty days on a
|
|
257
|
+
* deployment that has counted for a week says so instead of drawing a fall.
|
|
258
|
+
*/
|
|
259
|
+
readonly acted: (request?: ActedReadRequest) => Promise<Result<StoredActed, ReaderSignalStoreError>>;
|
|
260
|
+
/**
|
|
261
|
+
* A funnel pair's answers, by the hour the readers in each entered it, over a
|
|
262
|
+
* range (`funnel-hours.ts`).
|
|
263
|
+
*
|
|
264
|
+
* The third read here that takes a stretch of time, and the third that
|
|
265
|
+
* answers two things in a call — the rows in the range, and the first hour
|
|
266
|
+
* this scope ever counted — so a step compared over two fortnights on a
|
|
267
|
+
* deployment that has counted for a week says so rather than reporting that
|
|
268
|
+
* the step was invented this morning.
|
|
269
|
+
*
|
|
270
|
+
* **The pair narrows it like a part narrows the read above**, and for a
|
|
271
|
+
* sharper reason than cost: `reached` is a distinct count of page views, so
|
|
272
|
+
* rows of two pairs sharing a first end hold the same view twice and a figure
|
|
273
|
+
* summed across them counts that reader once per question. A caller reads one
|
|
274
|
+
* pair, or groups what it got by the pair on each row.
|
|
275
|
+
*/
|
|
276
|
+
readonly funnelHours: (request?: FunnelHourReadRequest) => Promise<Result<StoredFunnelHours, ReaderSignalStoreError>>;
|
|
69
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* A counter read, narrowed to a stretch of time.
|
|
280
|
+
*
|
|
281
|
+
* The three optional narrowings every counter read takes, and the range. Both
|
|
282
|
+
* ends are optional and absent is *unbounded on that side*: a surface asking
|
|
283
|
+
* when counting began passes neither, and a chart passes both. Hours are
|
|
284
|
+
* matched by the instant they began, which is the rule `ArrivalRange` states —
|
|
285
|
+
* a bucket belongs to the range its start falls in.
|
|
286
|
+
*/
|
|
287
|
+
export type ArrivalReadRequest = TallyReadRequest & {
|
|
288
|
+
/** Inclusive. Absent reads from the first hour the scope has. */
|
|
289
|
+
readonly from?: number;
|
|
290
|
+
/** Exclusive. Absent reads to the last hour the scope has. */
|
|
291
|
+
readonly to?: number;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* The same read, narrowed to one part as well.
|
|
295
|
+
*
|
|
296
|
+
* A goal is a kind on a part (0350), so the reading that serves one names the
|
|
297
|
+
* part and the store answers it from an index rather than by reading the rest
|
|
298
|
+
* of the page. Absent reads every part the narrowing holds, which is *what
|
|
299
|
+
* readers did on this page* — the bars the wireframe puts in the `By page`
|
|
300
|
+
* drawer.
|
|
301
|
+
*/
|
|
302
|
+
export type ActedReadRequest = ArrivalReadRequest & {
|
|
303
|
+
readonly nodeId?: NodeId;
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* The same read, narrowed to one funnel as well.
|
|
307
|
+
*
|
|
308
|
+
* A pair is two ends a deployment wrote down (0418), and the store answers it
|
|
309
|
+
* from an index rather than by reading the other questions the deployment
|
|
310
|
+
* asks. Absent reads every pair the narrowing holds, which is the honest shape
|
|
311
|
+
* for an operator listing what a window held — and the shape a figure must
|
|
312
|
+
* **not** be summed over, for the reason {@link ReaderTallyStore.funnelHours}
|
|
313
|
+
* gives. `pages` on the pair is ignored: a scope decides which rows are
|
|
314
|
+
* written and is not part of what a row means, so it cannot narrow a read of
|
|
315
|
+
* one (0418).
|
|
316
|
+
*/
|
|
317
|
+
export type FunnelHourReadRequest = ArrivalReadRequest & {
|
|
318
|
+
readonly pair?: FunnelPair;
|
|
319
|
+
};
|
|
70
320
|
//# sourceMappingURL=tally.d.ts.map
|