@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,218 @@
|
|
|
1
|
+
import { audienceScopeOf, audiencesIn } from "./audiences.js";
|
|
2
|
+
/**
|
|
3
|
+
* The page views a delivery opened, per revision, deduplicated by view key.
|
|
4
|
+
*
|
|
5
|
+
* The dedup inside the delivery is load-bearing rather than defensive: a sender
|
|
6
|
+
* draining a queue after an outage posts what it has, which may include an
|
|
7
|
+
* opening batch it already sent and could not confirm, and a page view counted
|
|
8
|
+
* twice cannot be uncounted
|
|
9
|
+
* ([0158](../../decisions/0158-counting-a-window-of-reader-signals-and-forgetting-it-are-one-operation.md)).
|
|
10
|
+
* Keys are compared rather than batches, so one opening delivered twice is one
|
|
11
|
+
* page view and two page views opened in one delivery are two.
|
|
12
|
+
*
|
|
13
|
+
* A batch that opened nothing adds nothing, and a sender that never says adds
|
|
14
|
+
* nothing at all — a batch synthesised on a server or replayed from a fixture
|
|
15
|
+
* is not an arrival, exactly as it is not a view (0146). The parser has already
|
|
16
|
+
* refused a batch that claims an opening and names no page view, so a key is
|
|
17
|
+
* always there to compare when the claim is.
|
|
18
|
+
*
|
|
19
|
+
* Pure, and shared: the region counter stamps a country onto these rows rather
|
|
20
|
+
* than walking the delivery itself, which is what keeps the two counters from
|
|
21
|
+
* disagreeing about how many readers arrived.
|
|
22
|
+
*/
|
|
23
|
+
export const openingsOf = (batches) => {
|
|
24
|
+
const opened = new Map();
|
|
25
|
+
for (const batch of batches) {
|
|
26
|
+
if (batch.first !== true || batch.view === undefined)
|
|
27
|
+
continue;
|
|
28
|
+
const key = `${batch.treeId} ${batch.revision}`;
|
|
29
|
+
const existing = opened.get(key);
|
|
30
|
+
if (existing === undefined) {
|
|
31
|
+
opened.set(key, {
|
|
32
|
+
treeId: batch.treeId,
|
|
33
|
+
revision: batch.revision,
|
|
34
|
+
views: new Set([batch.view]),
|
|
35
|
+
});
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
existing.views.add(batch.view);
|
|
39
|
+
}
|
|
40
|
+
return [...opened.values()].map(({ treeId, revision, views }) => ({
|
|
41
|
+
treeId,
|
|
42
|
+
revision,
|
|
43
|
+
views: views.size,
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
const readingOf = (row) => {
|
|
47
|
+
const audiences = audiencesIn([row]);
|
|
48
|
+
return {
|
|
49
|
+
...row,
|
|
50
|
+
/** One row's own form, and `null` where the row named none (0299). */
|
|
51
|
+
audienceId: audiences[0] ?? null,
|
|
52
|
+
audiences,
|
|
53
|
+
drift: Math.max(0, row.appearances - row.opened),
|
|
54
|
+
pending: Math.max(0, row.opened - row.appearances),
|
|
55
|
+
inflation: row.opened === 0 ? null : Math.max(0, row.appearances - row.opened) / row.opened,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Rows from the store, read as something a screen may show.
|
|
60
|
+
*
|
|
61
|
+
* **Totalled from the rows and never from the totals.** `drift` on the whole
|
|
62
|
+
* reading is the sum of each revision's drift, not the difference of the two
|
|
63
|
+
* sums: a revision mid-collection has openings the rollups have not reached,
|
|
64
|
+
* and subtracting in the aggregate would let that cancel another revision's
|
|
65
|
+
* straddles and report a page as more exact than any part of it is.
|
|
66
|
+
*
|
|
67
|
+
* Unlike a region reading this withholds nothing, groups nothing, and hides
|
|
68
|
+
* nothing. Every row is already an aggregate about a revision of a tree.
|
|
69
|
+
*/
|
|
70
|
+
export const pageViewReadingOf = (rows) => {
|
|
71
|
+
const revisions = rows
|
|
72
|
+
.map(readingOf)
|
|
73
|
+
.sort((one, other) => one.treeId.localeCompare(other.treeId) || other.revision - one.revision);
|
|
74
|
+
const total = (of) => revisions.reduce((sum, row) => sum + of(row), 0);
|
|
75
|
+
const opened = total((row) => row.opened);
|
|
76
|
+
const drift = total((row) => row.drift);
|
|
77
|
+
return {
|
|
78
|
+
opened,
|
|
79
|
+
appearances: total((row) => row.appearances),
|
|
80
|
+
drift,
|
|
81
|
+
pending: total((row) => row.pending),
|
|
82
|
+
inflation: opened === 0 ? null : drift / opened,
|
|
83
|
+
revisions,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* The newest instant either writer moved one of these rows.
|
|
88
|
+
*
|
|
89
|
+
* A reading's own figure is as fresh as the freshest row under it, so this is a
|
|
90
|
+
* maximum. Compared by parsed instant rather than by string order, because two
|
|
91
|
+
* stores may write the same instant in two spellings and only one of them sorts.
|
|
92
|
+
*/
|
|
93
|
+
const movedLast = (rows) => {
|
|
94
|
+
let latest = rows[0]?.updatedAt ?? "";
|
|
95
|
+
for (const row of rows) {
|
|
96
|
+
if (Date.parse(row.updatedAt) > Date.parse(latest))
|
|
97
|
+
latest = row.updatedAt;
|
|
98
|
+
}
|
|
99
|
+
return latest;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* The oldest fold attested by one of these rows, or absent where none attests
|
|
103
|
+
* one.
|
|
104
|
+
*
|
|
105
|
+
* A `folded_at` nothing can read attests no fold, which is how a stall reading
|
|
106
|
+
* already treats one (0274): it is skipped rather than kept as the oldest, so
|
|
107
|
+
* one unreadable instant cannot make a deployment's whole collection look
|
|
108
|
+
* unattested.
|
|
109
|
+
*/
|
|
110
|
+
const foldWaitedOn = (rows) => {
|
|
111
|
+
let oldest;
|
|
112
|
+
for (const row of rows) {
|
|
113
|
+
const at = row.foldedAt;
|
|
114
|
+
if (at === undefined || Number.isNaN(Date.parse(at)))
|
|
115
|
+
continue;
|
|
116
|
+
if (oldest === undefined || Date.parse(at) < Date.parse(oldest))
|
|
117
|
+
oldest = at;
|
|
118
|
+
}
|
|
119
|
+
return oldest;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* One revision's door rows, added into one reading.
|
|
123
|
+
*
|
|
124
|
+
* **The arithmetic is the reading's own, taken over the rows rather than
|
|
125
|
+
* written again.** `opened` and `appearances` are counts and add; `drift` and
|
|
126
|
+
* `pending` are added *per row and never taken from the two sums*, because a
|
|
127
|
+
* form mid-collection has openings no fold has reached and subtracting in the
|
|
128
|
+
* aggregate would let that cancel another form's straddles — which is the rule
|
|
129
|
+
* {@link pageViewReadingOf} already states for revisions and holds for forms of
|
|
130
|
+
* one revision for the same reason; and `inflation` is a ratio, so it is
|
|
131
|
+
* recomputed from the summed drift and the summed openings rather than averaged
|
|
132
|
+
* over the forms. Handing the rows to {@link pageViewReadingOf} is what keeps
|
|
133
|
+
* those four from being a second spelling of one rule.
|
|
134
|
+
*/
|
|
135
|
+
const summedOf = (where, audience, rows) => {
|
|
136
|
+
if (rows.length === 0)
|
|
137
|
+
return null;
|
|
138
|
+
const { opened, appearances, drift, pending, inflation } = pageViewReadingOf(rows);
|
|
139
|
+
const waiting = rows.filter((row) => row.opened > row.appearances);
|
|
140
|
+
const folded = foldWaitedOn(waiting.length > 0 ? waiting : rows);
|
|
141
|
+
return {
|
|
142
|
+
treeId: where.treeId,
|
|
143
|
+
revision: where.revision,
|
|
144
|
+
audienceId: audience,
|
|
145
|
+
audiences: audiencesIn(rows),
|
|
146
|
+
opened,
|
|
147
|
+
appearances,
|
|
148
|
+
drift,
|
|
149
|
+
pending,
|
|
150
|
+
inflation,
|
|
151
|
+
updatedAt: movedLast(rows),
|
|
152
|
+
...(folded === undefined ? {} : { foldedAt: folded }),
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Read one revision's door out of a window of rows.
|
|
157
|
+
*
|
|
158
|
+
* Linear in the rows, with one pass and one map.
|
|
159
|
+
*/
|
|
160
|
+
export const pageViewsFor = (where, rows) => {
|
|
161
|
+
const here = rows.filter((row) => row.treeId === where.treeId && row.revision === where.revision);
|
|
162
|
+
/**
|
|
163
|
+
* Taken from `audienceScopeOf` rather than spelled here, which is the fourth
|
|
164
|
+
* and last of the readings that pick a page's rows out of a window to read
|
|
165
|
+
* the rule from one place (0300). It was spelled here because this one was
|
|
166
|
+
* being rewritten the same night the rule was published (0299).
|
|
167
|
+
*
|
|
168
|
+
* **The door is the one of the four that answers `mixed` by summing**, and
|
|
169
|
+
* that is why the branch is written out rather than left to fall past a
|
|
170
|
+
* `null`: arrivals are counted once per page view and a reader who arrived
|
|
171
|
+
* arrived once whichever form they were served, so two forms' doors add to
|
|
172
|
+
* one deployment's arrivals (0297, 0299). A page reading and a funnel reading
|
|
173
|
+
* refuse the same window, because a node counter filed under two forms is one
|
|
174
|
+
* number about two pages (0290). Two opposite answers to one case is the
|
|
175
|
+
* reason the case is worth a member.
|
|
176
|
+
*/
|
|
177
|
+
const scope = audienceScopeOf(audiencesIn(here), where.audienceId ?? undefined);
|
|
178
|
+
const matching = scope.reading === "mixed" || scope.audienceId === null
|
|
179
|
+
? here
|
|
180
|
+
: here.filter((row) => row.audienceId === scope.audienceId);
|
|
181
|
+
/**
|
|
182
|
+
* Keyed by the audience, which is what the store keeps one row per (0284):
|
|
183
|
+
* two forms' doors are two rows and one arrival count, and keying them by the
|
|
184
|
+
* revision alone dropped the second as a repeat of the first (0299).
|
|
185
|
+
*/
|
|
186
|
+
const first = new Map();
|
|
187
|
+
for (const row of matching) {
|
|
188
|
+
if (!first.has(row.audienceId))
|
|
189
|
+
first.set(row.audienceId, row);
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
/**
|
|
193
|
+
* The audience published is the one the **asking** named and never
|
|
194
|
+
* `scope.audienceId`, which fills a single-membered census in. A window
|
|
195
|
+
* holding one form today is not a reading of one form (0297, 0299), and the
|
|
196
|
+
* scope collapses *asked for* and *the only one there* into one member
|
|
197
|
+
* because the two readings that refuse want them handled alike. This one
|
|
198
|
+
* publishes the field, so it wants them apart.
|
|
199
|
+
*/
|
|
200
|
+
measured: summedOf(where, where.audienceId ?? null, [...first.values()]),
|
|
201
|
+
foreign: rows.length - here.length,
|
|
202
|
+
otherAudience: here.length - matching.length,
|
|
203
|
+
duplicated: matching.length - first.size,
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* The straddle correction for one revision of one page: `drift ÷ opened` off
|
|
208
|
+
* that page's own door — its own form's row where the asking names an audience,
|
|
209
|
+
* and the sum of every form's where it names none (0299).
|
|
210
|
+
*
|
|
211
|
+
* The number `PaceOptions.inflation` wants, published so that a consumer
|
|
212
|
+
* holding a window of counters over several pages does not write the matching
|
|
213
|
+
* itself. `null` where there is no row for the revision, or where nothing has
|
|
214
|
+
* opened — which is *the question has no answer* rather than *the answer is
|
|
215
|
+
* nought*, and is the reason this is not simply `0`.
|
|
216
|
+
*/
|
|
217
|
+
export const inflationFor = (where, rows) => pageViewsFor(where, rows).measured?.inflation ?? null;
|
|
218
|
+
//# sourceMappingURL=page-views.js.map
|
|
@@ -0,0 +1,378 @@
|
|
|
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 { KindPaceSilence, LibraryPaceOptions } from "./library-pace.js";
|
|
6
|
+
import type { UnscaledPage } from "./library-reach.js";
|
|
7
|
+
import { type PaceSilence, type PaceStanding } from "./pace.js";
|
|
8
|
+
import { type StoredPageViews } from "./page-views.js";
|
|
9
|
+
import type { PageReading } from "./parts.js";
|
|
10
|
+
import type { ReachSilence } from "./reach.js";
|
|
11
|
+
/**
|
|
12
|
+
* Whether the readers who reach **one part** have time for what it says, across
|
|
13
|
+
* every page it stands on.
|
|
14
|
+
*
|
|
15
|
+
* A goal is a kind of signal on a part
|
|
16
|
+
* ([0350](../../decisions/0350-a-project-sets-goals-from-signals-already-collected-and-one-of-them-is-primary.md)):
|
|
17
|
+
* one node id, counted on the pages a project named or on every page that has
|
|
18
|
+
* it. Every figure a goal has is therefore keyed on a part across pages — and
|
|
19
|
+
* **the one a screen has been waiting for since 8 November is how long readers
|
|
20
|
+
* stay on it**, which `docs/portal.md` records twice as *waiting on time on a
|
|
21
|
+
* part being counted per reader*.
|
|
22
|
+
*
|
|
23
|
+
* The time was already in the rows. A tally carries `dwellMs` beside `reached`
|
|
24
|
+
* for every part of every revision, and [`pace.ts`](pace.ts) has divided the
|
|
25
|
+
* two for a part of **one** page since it landed. What was unaskable is the
|
|
26
|
+
* same question of a part that stands on nine pages: a goal's part has nine
|
|
27
|
+
* rows, nine word counts and nine doors, and nothing added them up. So this is
|
|
28
|
+
* the join, and it is the **twenty-third** thing taken out of what this
|
|
29
|
+
* subsystem already knows rather than collected: no payload field, no counter,
|
|
30
|
+
* no column, no byte on any wire and nothing in a browser.
|
|
31
|
+
*
|
|
32
|
+
* ## It is `library-pace.ts`' arithmetic keyed on a node instead of a kind
|
|
33
|
+
*
|
|
34
|
+
* [`library-pace.ts`](library-pace.ts) answers the same question of a *kind* of
|
|
35
|
+
* part (0325) and this one shares its terms exactly, deliberately and by
|
|
36
|
+
* reading its published pieces rather than by respelling them: a pooled
|
|
37
|
+
* quotient of two reader-millisecond sums, `dwellMs` added as the rows hold it
|
|
38
|
+
* and `readers × wordsWithin × msPerWord` as the denominator, each page's
|
|
39
|
+
* readers put on its **own** door's scale before two pages are added (0250),
|
|
40
|
+
* the verdict taken by {@link paceStandingOf} so that a floor can hold up
|
|
41
|
+
* anything but `skimmed`, and a page the door cannot scale kept rather than
|
|
42
|
+
* refused, because the missing correction only ever moves a pace towards the
|
|
43
|
+
* safe verdict.
|
|
44
|
+
*
|
|
45
|
+
* **A goal's part is not a kind of part**, which is why this is a reading and
|
|
46
|
+
* not a row of that one. A kind pools every placement of a type; a goal names
|
|
47
|
+
* one node, and the type row a screen could have read instead holds the
|
|
48
|
+
* forty-nine other sections of the deployment. Nothing in the library readings
|
|
49
|
+
* can narrow to a node, and a surface narrowing one by hand would be dividing
|
|
50
|
+
* two columns with none of the five rules above applied to them.
|
|
51
|
+
*
|
|
52
|
+
* ## Nothing nests, and that is the whole of what this reading does not need
|
|
53
|
+
*
|
|
54
|
+
* A kind's pace carries a nesting rule, because a stack inside a stack would
|
|
55
|
+
* put one page's words into one row twice. **A node id stands at most once in a
|
|
56
|
+
* revision**, so there is nothing here for an outer placement to stand for: one
|
|
57
|
+
* reading contributes one placement or none, every term is a sum over distinct
|
|
58
|
+
* pages, and the only way a page can enter twice is a caller handing the same
|
|
59
|
+
* reading in twice — which is what {@link PartPace.duplicated} counts and the
|
|
60
|
+
* one error that would be permanent if it were let through (0158).
|
|
61
|
+
*
|
|
62
|
+
* ## Which page it is skimmed on is the same rows, kept rather than summed away
|
|
63
|
+
*
|
|
64
|
+
* The pooled quotient is one number about nine pages, and `standings` says *and
|
|
65
|
+
* skimmed on two of them* without saying which two. The per-page rows were
|
|
66
|
+
* always there — the loop reads each page's own pace, its own words and its own
|
|
67
|
+
* door, and threw them away — so publishing them costs an array and no further
|
|
68
|
+
* arithmetic
|
|
69
|
+
* ([0390](../../decisions/0390-a-parts-pages-are-a-second-order-ranked-on-the-reading-time-its-readers-did-not-have.md)).
|
|
70
|
+
*
|
|
71
|
+
* The decision in it is the **order**, and it is this subsystem's ordinary one:
|
|
72
|
+
* the pages are ranked on the reading time their readers did not have, a
|
|
73
|
+
* magnitude in reader-milliseconds, rather than on the pace, a rate. A page one
|
|
74
|
+
* reader hurried past has the worst rate in the deployment and is not the page
|
|
75
|
+
* to go to (0250, 0377).
|
|
76
|
+
*
|
|
77
|
+
* ## The silences are a kind's four, as values
|
|
78
|
+
*
|
|
79
|
+
* {@link KindPaceSilence} unchanged, and reused rather than respelled for the
|
|
80
|
+
* reason `library-pace.ts` reuses a census's two (0256): *it stands nowhere*,
|
|
81
|
+
* *nowhere it stands was read*, *its words could not be counted* and *it says
|
|
82
|
+
* nothing that takes time* are the same four states of the same quotient, and a
|
|
83
|
+
* twenty-third silence vocabulary naming them again would give a screen two
|
|
84
|
+
* names for one state and two mappings to keep in step. What is part-shaped is
|
|
85
|
+
* the **sentence**, which {@link describePartPaceSilence} says; the meaning a
|
|
86
|
+
* window publishes is `meaningOfKindPaceSilence` and stays one function.
|
|
87
|
+
*
|
|
88
|
+
* Pure. It reaches no store, no clock and no DOM, it is linear in the parts of
|
|
89
|
+
* the readings times the rows handed in, and nothing in it survives into a
|
|
90
|
+
* browser bundle.
|
|
91
|
+
*/
|
|
92
|
+
/** One line per silence, for a surface saying why one part has no pace. */
|
|
93
|
+
export declare const describePartPaceSilence: (silence: KindPaceSilence) => string;
|
|
94
|
+
/**
|
|
95
|
+
* One page a part stands on, with that page's own figures.
|
|
96
|
+
*
|
|
97
|
+
* {@link PartPace} answers *how long do readers stay on this part* with one
|
|
98
|
+
* pooled quotient over every page it stands on, and publishes `standings` —
|
|
99
|
+
* so a screen can say *paced across your pages and skimmed on two of them* and
|
|
100
|
+
* **cannot say which two**. These are the two rows, and nothing extra was
|
|
101
|
+
* computed to get them: `partPaceOf` already reads each page's own pace, its
|
|
102
|
+
* own words and its own door, and summed them away
|
|
103
|
+
* ([0390](../../decisions/0390-a-parts-pages-are-a-second-order-ranked-on-the-reading-time-its-readers-did-not-have.md)).
|
|
104
|
+
*
|
|
105
|
+
* Every figure here is the one the page's own reading holds, at that page's own
|
|
106
|
+
* door scale (0250) — not a share of the figure above it. The terms that add do
|
|
107
|
+
* add: `ranked`'s `readers`, `dwellMs` and `needMs` are exactly
|
|
108
|
+
* {@link PartPace}'s three, which is the only thing tying this breakdown to the
|
|
109
|
+
* figure it breaks down.
|
|
110
|
+
*/
|
|
111
|
+
export type PacedPlace = {
|
|
112
|
+
readonly treeId: TreeId;
|
|
113
|
+
readonly revision: number;
|
|
114
|
+
/** The audience this page's counters are of, as the reading has it; `null` where nothing said. */
|
|
115
|
+
readonly audienceId: AudienceId | null;
|
|
116
|
+
/**
|
|
117
|
+
* Page views that reached the part here, at this page's own door scale.
|
|
118
|
+
*
|
|
119
|
+
* **Not a count of people and deliberately not rounded into one** (0256), for
|
|
120
|
+
* the reason {@link PartPace.readers} is not: it is a scaled page-view count,
|
|
121
|
+
* and two pages' are added without either being rounded first.
|
|
122
|
+
*/
|
|
123
|
+
readonly readers: number;
|
|
124
|
+
/** Time on screen here, summed across every view in the window, exactly as the rows hold it. */
|
|
125
|
+
readonly dwellMs: number;
|
|
126
|
+
/** The words this placement puts on screen: its own and its subtree's, which is the denominator's input. */
|
|
127
|
+
readonly wordsWithin: number;
|
|
128
|
+
/** Whether {@link wordsWithin} is a floor rather than a count, because something in it declares no `copy` (0122). */
|
|
129
|
+
readonly floored: boolean;
|
|
130
|
+
/** Whether the part is this page's root, so its words are every word the page says. */
|
|
131
|
+
readonly whole: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Why no straddle correction was applied to this page's readers, and `null`
|
|
134
|
+
* where one was.
|
|
135
|
+
*
|
|
136
|
+
* A page the door cannot scale is kept rather than refused, and the
|
|
137
|
+
* correction it is missing only ever moves its pace **down**, towards the one
|
|
138
|
+
* safe verdict — so this row can rank too low and never too high.
|
|
139
|
+
*/
|
|
140
|
+
readonly unscaled: ReachSilence | null;
|
|
141
|
+
/** `readers × wordsWithin × msPerWord`: the time its words take the readers who reached it here. `null` under a silence. */
|
|
142
|
+
readonly needMs: number | null;
|
|
143
|
+
/** `dwellMs ÷ readers`: the time the typical reader who reached it here had. `null` under a silence. */
|
|
144
|
+
readonly spentMs: number | null;
|
|
145
|
+
/**
|
|
146
|
+
* `needMs − dwellMs` where positive: the reading time this page's readers did
|
|
147
|
+
* not have. The ranking key of {@link PartPace.ranked}, and `null` under a
|
|
148
|
+
* silence.
|
|
149
|
+
*
|
|
150
|
+
* **It does not add**, and it is the one term here that does not: the rows'
|
|
151
|
+
* `shortMs` sum to at least {@link PartPace.shortMs} and are equal to it only
|
|
152
|
+
* where no page had time to spare, because a page whose readers lingered pays
|
|
153
|
+
* for a page whose readers skimmed in the pooled figure and pays for nothing
|
|
154
|
+
* here. Both figures are true and the difference is the whole reason this
|
|
155
|
+
* breakdown is worth drawing — but a surface adding these rows up has
|
|
156
|
+
* published a number the reading above it contradicts.
|
|
157
|
+
*/
|
|
158
|
+
readonly shortMs: number | null;
|
|
159
|
+
/** `dwellMs ÷ needMs`. `1` is exactly time enough. `null` under a silence. */
|
|
160
|
+
readonly pace: number | null;
|
|
161
|
+
/** This page's own verdict, by `paceStandingOf` — so one page can be `skimmed` while the part is `paced`. */
|
|
162
|
+
readonly standing: PaceStanding;
|
|
163
|
+
/** Why this page has no figures, and `null` where it has them. */
|
|
164
|
+
readonly silence: PaceSilence | null;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* A placement with figures of its own, which is every row of
|
|
168
|
+
* {@link PartPace.ranked} and no row of {@link PartPace.unranked}.
|
|
169
|
+
*
|
|
170
|
+
* Published as a type of its own so a screen drawing the order does not
|
|
171
|
+
* null-check four fields that an ordered row cannot be missing: a row is in
|
|
172
|
+
* `ranked` *because* it has a reading time to be short of.
|
|
173
|
+
*/
|
|
174
|
+
export type MeasuredPlace = PacedPlace & {
|
|
175
|
+
readonly needMs: number;
|
|
176
|
+
readonly spentMs: number;
|
|
177
|
+
readonly shortMs: number;
|
|
178
|
+
readonly pace: number;
|
|
179
|
+
readonly silence: null;
|
|
180
|
+
};
|
|
181
|
+
/** One part, against the time its readers had for what it says, across the pages it stands on. */
|
|
182
|
+
export type PartPace = {
|
|
183
|
+
readonly nodeId: NodeId;
|
|
184
|
+
/**
|
|
185
|
+
* What the part is, as the **first** reading holding it has it, and `null`
|
|
186
|
+
* where no reading holds it at all.
|
|
187
|
+
*
|
|
188
|
+
* First rather than commonest, which is the rule the library readings take
|
|
189
|
+
* about a type's role: a disagreement is reported rather than voted on.
|
|
190
|
+
*/
|
|
191
|
+
readonly type: PrimitiveType | null;
|
|
192
|
+
/** What part it plays (0114), as the same reading has it; `null` where its type declared none. */
|
|
193
|
+
readonly role: PrimitiveRole | null;
|
|
194
|
+
/**
|
|
195
|
+
* Types a later reading had this node as, where the first reading's answer
|
|
196
|
+
* stands.
|
|
197
|
+
*
|
|
198
|
+
* Empty is the ordinary state and the healthy one. A node id standing as two
|
|
199
|
+
* different primitives on two pages means the two halves of every sum here
|
|
200
|
+
* are about two different things, which a screen naming one of them would
|
|
201
|
+
* never show — so it is published rather than resolved, in the shape
|
|
202
|
+
* `LibraryPace.roleDisagreed` uses for the neighbouring disagreement.
|
|
203
|
+
*/
|
|
204
|
+
readonly typeDisagreed: readonly PrimitiveType[];
|
|
205
|
+
/** Readings that hold the part at all, after duplicates are dropped. */
|
|
206
|
+
readonly placements: number;
|
|
207
|
+
/** Placements in the figures: reached, and saying something counted. */
|
|
208
|
+
readonly counted: number;
|
|
209
|
+
/** Why the rest have no pace of their own. The counts add to `placements − counted`. */
|
|
210
|
+
readonly silences: Readonly<Record<PaceSilence, number>>;
|
|
211
|
+
/**
|
|
212
|
+
* Every placement by its own page's verdict, which is the census view of the
|
|
213
|
+
* same set.
|
|
214
|
+
*
|
|
215
|
+
* The counts add to {@link placements}, and `unknown` is a placement with no
|
|
216
|
+
* pace of its own *or* one whose words are a floor.
|
|
217
|
+
*/
|
|
218
|
+
readonly standings: Readonly<Record<PaceStanding, number>>;
|
|
219
|
+
/** Revisions bearing a counted placement. */
|
|
220
|
+
readonly pages: number;
|
|
221
|
+
/** Distinct trees across them, which is pages rather than versions of pages. */
|
|
222
|
+
readonly trees: number;
|
|
223
|
+
/** Counted placements whose words are a floor, because a type in them declares no `copy` (0122). */
|
|
224
|
+
readonly floored: number;
|
|
225
|
+
/**
|
|
226
|
+
* Counted placements that are their page's root.
|
|
227
|
+
*
|
|
228
|
+
* A goal on a page's outermost part is a goal on the whole page, and its
|
|
229
|
+
* words are every word the page says — worth a screen knowing before it reads
|
|
230
|
+
* a pace as being about a band.
|
|
231
|
+
*/
|
|
232
|
+
readonly whole: number;
|
|
233
|
+
/**
|
|
234
|
+
* Page views that reached a counted placement, at each page's own door scale,
|
|
235
|
+
* counted once per page it stands on.
|
|
236
|
+
*
|
|
237
|
+
* **Not a count of people and deliberately not rounded into one** (0256): a
|
|
238
|
+
* reader who met the part on two pages is two of them. `null` under a
|
|
239
|
+
* silence.
|
|
240
|
+
*/
|
|
241
|
+
readonly readers: number | null;
|
|
242
|
+
/**
|
|
243
|
+
* Time on screen across the counted placements, added, exactly as the rows
|
|
244
|
+
* hold it.
|
|
245
|
+
*
|
|
246
|
+
* Sound without a correction: a page view a rollup counted twice carries one
|
|
247
|
+
* page view's dwell, so the straddle correction divides out of the numerator
|
|
248
|
+
* and the whole of it is in the readers.
|
|
249
|
+
*/
|
|
250
|
+
readonly dwellMs: number;
|
|
251
|
+
/**
|
|
252
|
+
* The time its words take the readers who reached it: `readers × wordsWithin
|
|
253
|
+
* × msPerWord`, added over the counted placements.
|
|
254
|
+
*
|
|
255
|
+
* The denominator, in the same reader-milliseconds {@link dwellMs} is in, and
|
|
256
|
+
* each page's own words — the same part can say more on one page than on
|
|
257
|
+
* another, and a sum of paces would have let the quiet page outvote the busy
|
|
258
|
+
* one. `null` under a silence.
|
|
259
|
+
*/
|
|
260
|
+
readonly needMs: number | null;
|
|
261
|
+
/**
|
|
262
|
+
* `dwellMs ÷ readers`: **the time the typical reader who reached this part
|
|
263
|
+
* had there**, which is the figure a goal's screen asks for.
|
|
264
|
+
*
|
|
265
|
+
* `null` under a silence, which is the state a screen draws instead of a
|
|
266
|
+
* nought: *nobody was seen on it* and *they had no time on it* are different
|
|
267
|
+
* answers.
|
|
268
|
+
*/
|
|
269
|
+
readonly spentMs: number | null;
|
|
270
|
+
/**
|
|
271
|
+
* `needMs − dwellMs` where positive: the reading time its readers did not
|
|
272
|
+
* have. Nought where they had enough, `null` under a silence.
|
|
273
|
+
*
|
|
274
|
+
* Taken over the pooled sums, so a page whose readers lingered pays for a page
|
|
275
|
+
* whose readers skimmed. The per-page figures on {@link PartPace.ranked} are
|
|
276
|
+
* each page's own and are **not** addable to this one; see
|
|
277
|
+
* {@link PacedPlace.shortMs}.
|
|
278
|
+
*/
|
|
279
|
+
readonly shortMs: number | null;
|
|
280
|
+
/** `dwellMs ÷ needMs`. `1` is exactly time enough. `null` under a silence. */
|
|
281
|
+
readonly pace: number | null;
|
|
282
|
+
/** The verdict, by `paceStandingOf` — so a floor can hold up anything but `skimmed`. */
|
|
283
|
+
readonly standing: PaceStanding;
|
|
284
|
+
/** Why there is no verdict, and `null` where there is one. */
|
|
285
|
+
readonly silence: KindPaceSilence | null;
|
|
286
|
+
/**
|
|
287
|
+
* Of {@link readers}, those on a page the door could not scale, so no
|
|
288
|
+
* straddle correction was applied to them.
|
|
289
|
+
*
|
|
290
|
+
* It biases the pace **down**, towards `skimmed`, which is why those pages
|
|
291
|
+
* are kept rather than withheld.
|
|
292
|
+
*/
|
|
293
|
+
readonly unscaled: number;
|
|
294
|
+
/**
|
|
295
|
+
* The pages bearing a counted placement that the door could not scale, by
|
|
296
|
+
* tree and newest revision first.
|
|
297
|
+
*
|
|
298
|
+
* The actionable half of the figure above: one of these pages is why. Empty
|
|
299
|
+
* is the healthy state.
|
|
300
|
+
*/
|
|
301
|
+
readonly unscaledPages: readonly UnscaledPage[];
|
|
302
|
+
/**
|
|
303
|
+
* Readings of a revision beyond the first, which were dropped.
|
|
304
|
+
*
|
|
305
|
+
* A caller that concatenated two reads holds one page twice, and a page twice
|
|
306
|
+
* doubles both terms of the quotient while looking like twice the evidence.
|
|
307
|
+
*/
|
|
308
|
+
readonly duplicated: number;
|
|
309
|
+
/** Door rows for one revision beyond the first, which were ignored. */
|
|
310
|
+
readonly duplicatedRows: number;
|
|
311
|
+
/**
|
|
312
|
+
* Every page the part is **counted** on, by the reading time its readers did
|
|
313
|
+
* not have, most first (0390).
|
|
314
|
+
*
|
|
315
|
+
* Then the lower pace, then by tree id and newest revision first, so two
|
|
316
|
+
* pages that cost the same do not reorder on a refresh. The key is
|
|
317
|
+
* {@link PacedPlace.shortMs}, which is a magnitude in reader-milliseconds
|
|
318
|
+
* rather than a rate: *which page is this part skimmed on* asked of a pace
|
|
319
|
+
* would put a page one reader hurried past above a page four hundred readers
|
|
320
|
+
* skimmed, and the second is the page to go to.
|
|
321
|
+
*
|
|
322
|
+
* `ranked.length` is {@link counted}, and the rows' `readers`, `dwellMs` and
|
|
323
|
+
* `needMs` add to {@link PartPace.readers}, {@link PartPace.dwellMs} and
|
|
324
|
+
* {@link PartPace.needMs} exactly — wherever those three are published. A
|
|
325
|
+
* part whose pooled pace is withheld keeps its rows, because the pages are
|
|
326
|
+
* then the only thing on the reading that says where to go and look.
|
|
327
|
+
*
|
|
328
|
+
* Each row's {@link PacedPlace.standing} is its page's own verdict and agrees
|
|
329
|
+
* with {@link standings} by construction; its {@link PacedPlace.shortMs} is
|
|
330
|
+
* its page's own and is the one term that does not add.
|
|
331
|
+
*/
|
|
332
|
+
readonly ranked: readonly MeasuredPlace[];
|
|
333
|
+
/**
|
|
334
|
+
* Every other page it stands on, by tree id and newest revision first.
|
|
335
|
+
*
|
|
336
|
+
* A placement with no figures of its own, each carrying the
|
|
337
|
+
* {@link PacedPlace.silence} saying why — and **none of its terms is in the
|
|
338
|
+
* sums above**, which is not a rounding: a `wordless` placement can hold real
|
|
339
|
+
* time on screen that no quotient can use, and adding it to `dwellMs` would
|
|
340
|
+
* put time in a numerator whose denominator refused it.
|
|
341
|
+
*
|
|
342
|
+
* `ranked.length + unranked.length` is {@link placements}.
|
|
343
|
+
*/
|
|
344
|
+
readonly unranked: readonly PacedPlace[];
|
|
345
|
+
/**
|
|
346
|
+
* The head of the order: the one page of this part to go and look at.
|
|
347
|
+
*
|
|
348
|
+
* `null` where no page is counted, which is exactly where {@link silence} is
|
|
349
|
+
* not.
|
|
350
|
+
*/
|
|
351
|
+
readonly worst: MeasuredPlace | null;
|
|
352
|
+
/** The costing rate that was applied, which is the default unless one was given. */
|
|
353
|
+
readonly wordsPerMinute: number;
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* Whether the readers who reach one part have time for what it says.
|
|
357
|
+
*
|
|
358
|
+
* Takes the node, the readings of the pages it is counted on, and the whole
|
|
359
|
+
* window of page-view rows a deployment holds — each page's own row is picked
|
|
360
|
+
* out of them by the published matching rule (`pageViewsFor`) rather than by a
|
|
361
|
+
* hand-written copy of it, because the pairing is the part of every join here
|
|
362
|
+
* that fails quietly when it is got wrong.
|
|
363
|
+
*
|
|
364
|
+
* **Which readings are handed in is the caller's answer to *which pages*.** A
|
|
365
|
+
* goal naming pages hands in those pages' readings; a goal naming none hands in
|
|
366
|
+
* every page it can read, and a reading with no row for the node contributes
|
|
367
|
+
* nothing but a count. Narrowing here rather than inside would have made this
|
|
368
|
+
* function hold the goal vocabulary, which is the portal's and not this
|
|
369
|
+
* subsystem's (0350).
|
|
370
|
+
*
|
|
371
|
+
* There is **no `inflation` option**, for the reason `libraryPaceOf` has none:
|
|
372
|
+
* one scalar over nine pages with nine straddle rates would be a correction
|
|
373
|
+
* nobody measured, so each page's own is read off its own door row.
|
|
374
|
+
*
|
|
375
|
+
* Linear in the parts of the readings times the rows.
|
|
376
|
+
*/
|
|
377
|
+
export declare const partPaceOf: (nodeId: NodeId, readings: readonly PageReading[], rows: readonly StoredPageViews[], options?: LibraryPaceOptions) => PartPace;
|
|
378
|
+
//# sourceMappingURL=part-pace.d.ts.map
|