@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,538 @@
|
|
|
1
|
+
import { everyMemberOf } from "../closed-set.js";
|
|
2
|
+
import { PRIMITIVE_ROLES } from "../role.js";
|
|
3
|
+
import { inFormOrder } from "./audiences.js";
|
|
4
|
+
import { atDoorScale } from "./door.js";
|
|
5
|
+
import { partsByNodeIn } from "./library-change.js";
|
|
6
|
+
import { inUnscaledSideOrder, librarySideOf, readerShareCauseOf, weightMovedOver, } from "./library-reach-change.js";
|
|
7
|
+
import { kindKeyOf } from "./library.js";
|
|
8
|
+
import { senderStatesOf, witnessedState } from "./subtrees.js";
|
|
9
|
+
export const SENDER_REACH_CHANGE_SILENCES = everyMemberOf()([
|
|
10
|
+
"unplaced",
|
|
11
|
+
"unpaired",
|
|
12
|
+
"unwitnessable",
|
|
13
|
+
"uncheckable",
|
|
14
|
+
"unclaimable",
|
|
15
|
+
"unscaled",
|
|
16
|
+
"unopened",
|
|
17
|
+
"uncounted",
|
|
18
|
+
]);
|
|
19
|
+
/** One line per silence, for a surface saying why a kind has no before and after. */
|
|
20
|
+
export const describeSenderReachChangeSilence = (silence) => {
|
|
21
|
+
switch (silence) {
|
|
22
|
+
case "unplaced":
|
|
23
|
+
return "nothing in the pages read, in either window, is of this kind";
|
|
24
|
+
case "unpaired":
|
|
25
|
+
return "no place this kind of part stands is in both windows";
|
|
26
|
+
case "unwitnessable":
|
|
27
|
+
return "no place it stands in both windows has anything inside it on both sides";
|
|
28
|
+
case "uncheckable":
|
|
29
|
+
return "no place it stands in both windows could be checked in both";
|
|
30
|
+
case "unclaimable":
|
|
31
|
+
return "every place that could be checked in both reported something other than a view in one of them";
|
|
32
|
+
case "unscaled":
|
|
33
|
+
return "a page it stands on has no page views counted at the door in one of the two windows";
|
|
34
|
+
case "unopened":
|
|
35
|
+
return "a page it stands on has a row and nothing has said a page view began";
|
|
36
|
+
case "uncounted":
|
|
37
|
+
return "a page it stands on has readers in one window whose reading has not been counted yet";
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export const SENDER_REACH_CAUSES = everyMemberOf()([
|
|
41
|
+
"senders",
|
|
42
|
+
"readers",
|
|
43
|
+
"either",
|
|
44
|
+
"together",
|
|
45
|
+
]);
|
|
46
|
+
/** One line per cause, for a surface saying what moved a component's measured share. */
|
|
47
|
+
export const describeSenderReachCause = (cause) => {
|
|
48
|
+
switch (cause) {
|
|
49
|
+
case "senders":
|
|
50
|
+
return "the places that report themselves changed, and that alone would have moved it";
|
|
51
|
+
case "readers":
|
|
52
|
+
return "the readers went to different places inside it, and that alone would have moved it";
|
|
53
|
+
case "either":
|
|
54
|
+
return "either would have moved it on its own";
|
|
55
|
+
case "together":
|
|
56
|
+
return "neither would have moved it alone and the two together did";
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const tallying = (kind) => ({
|
|
60
|
+
kind,
|
|
61
|
+
role: null,
|
|
62
|
+
places: 0,
|
|
63
|
+
gained: 0,
|
|
64
|
+
lost: 0,
|
|
65
|
+
checkableWas: 0,
|
|
66
|
+
checkableNow: 0,
|
|
67
|
+
inhabited: 0,
|
|
68
|
+
checkable: 0,
|
|
69
|
+
indeterminate: 0,
|
|
70
|
+
comparable: 0,
|
|
71
|
+
repaired: 0,
|
|
72
|
+
wentSilent: 0,
|
|
73
|
+
keptSilent: 0,
|
|
74
|
+
keptReporting: 0,
|
|
75
|
+
pages: new Set(),
|
|
76
|
+
insideWas: 0,
|
|
77
|
+
insideNow: 0,
|
|
78
|
+
unreportedWas: 0,
|
|
79
|
+
unreportedNow: 0,
|
|
80
|
+
reportedWas: 0,
|
|
81
|
+
reportedNow: 0,
|
|
82
|
+
heldReading: 0,
|
|
83
|
+
heldSenders: 0,
|
|
84
|
+
weights: [],
|
|
85
|
+
driftWas: 0,
|
|
86
|
+
driftNow: 0,
|
|
87
|
+
pendingWas: 0,
|
|
88
|
+
pendingNow: 0,
|
|
89
|
+
unreconciled: 0,
|
|
90
|
+
blocked: null,
|
|
91
|
+
});
|
|
92
|
+
/** The two keys one placement is counted under, which is the pair of questions this answers. */
|
|
93
|
+
const keysOf = (part) => [
|
|
94
|
+
{ by: "type", type: part.type },
|
|
95
|
+
{ by: "role", role: part.role },
|
|
96
|
+
];
|
|
97
|
+
const rowFor = (rows, kind) => {
|
|
98
|
+
const key = kindKeyOf(kind);
|
|
99
|
+
const row = rows.get(key) ?? tallying(kind);
|
|
100
|
+
rows.set(key, row);
|
|
101
|
+
return row;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* One paired place's contribution, which is a place count before it is a weight
|
|
105
|
+
* and nothing at all unless both windows could see the defect there.
|
|
106
|
+
*
|
|
107
|
+
* **The transitions are counted before the door is asked**, so that the place
|
|
108
|
+
* counts on this row are the comparison of places' own counts and not a subset
|
|
109
|
+
* of them: the door is a fact about a page's readers and says nothing about
|
|
110
|
+
* whether a place reported itself (0394). What the door blocks is the weighing.
|
|
111
|
+
*/
|
|
112
|
+
const add = (into, at, doors, form) => {
|
|
113
|
+
const checkableWas = witnessedState(at.was.state);
|
|
114
|
+
const checkableNow = witnessedState(at.now.state);
|
|
115
|
+
into.places += 1;
|
|
116
|
+
into.checkableWas += checkableWas ? 1 : 0;
|
|
117
|
+
into.checkableNow += checkableNow ? 1 : 0;
|
|
118
|
+
into.inhabited += at.was.state !== "leaf" && at.now.state !== "leaf" ? 1 : 0;
|
|
119
|
+
if (!checkableWas || !checkableNow)
|
|
120
|
+
return;
|
|
121
|
+
into.checkable += 1;
|
|
122
|
+
if (at.was.state === "indeterminate" || at.now.state === "indeterminate") {
|
|
123
|
+
into.indeterminate += 1;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const silentWas = at.was.state === "silent";
|
|
127
|
+
const silentNow = at.now.state === "silent";
|
|
128
|
+
into.comparable += 1;
|
|
129
|
+
into.pages.add(form);
|
|
130
|
+
if (silentWas && !silentNow)
|
|
131
|
+
into.repaired += 1;
|
|
132
|
+
else if (!silentWas && silentNow)
|
|
133
|
+
into.wentSilent += 1;
|
|
134
|
+
else if (silentWas)
|
|
135
|
+
into.keptSilent += 1;
|
|
136
|
+
else
|
|
137
|
+
into.keptReporting += 1;
|
|
138
|
+
if (doors.was.silence !== null || doors.now.silence !== null) {
|
|
139
|
+
into.blocked ??= doors.was.silence ?? doors.now.silence;
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* `insideReach × counted ÷ appearances`, in the published order, so that a
|
|
144
|
+
* surface drawing one window's reading beside this one's `silentShareNow` is
|
|
145
|
+
* drawing the same number (0256).
|
|
146
|
+
*/
|
|
147
|
+
const was = atDoorScale(at.was.insideReach, doors.was);
|
|
148
|
+
const now = atDoorScale(at.now.insideReach, doors.now);
|
|
149
|
+
into.insideWas += was;
|
|
150
|
+
into.insideNow += now;
|
|
151
|
+
into.unreportedWas += silentWas ? was : 0;
|
|
152
|
+
into.unreportedNow += silentNow ? now : 0;
|
|
153
|
+
into.reportedWas += silentWas ? 0 : was;
|
|
154
|
+
into.reportedNow += silentNow ? 0 : now;
|
|
155
|
+
/** The other side's states against this side's weights, which is the whole of a counterfactual. */
|
|
156
|
+
into.heldReading += silentNow ? was : 0;
|
|
157
|
+
into.heldSenders += silentWas ? now : 0;
|
|
158
|
+
into.weights.push({ was, now });
|
|
159
|
+
into.driftWas += doors.was.drift;
|
|
160
|
+
into.driftNow += doors.now.drift;
|
|
161
|
+
into.pendingWas += doors.was.pending;
|
|
162
|
+
into.pendingNow += doors.now.pending;
|
|
163
|
+
into.unreconciled +=
|
|
164
|
+
at.was.insideReach > doors.was.appearances || at.now.insideReach > doors.now.appearances ? 1 : 0;
|
|
165
|
+
};
|
|
166
|
+
/** The kind-level reason a page's reason causes, which is the same state at the other subject. */
|
|
167
|
+
const SENDER_REACH_CHANGE_OF_REACH = Object.freeze({
|
|
168
|
+
unmeasured: "unscaled",
|
|
169
|
+
unopened: "unopened",
|
|
170
|
+
uncounted: "uncounted",
|
|
171
|
+
});
|
|
172
|
+
/**
|
|
173
|
+
* The silence, with the reasons tried in the order they have to be tried in.
|
|
174
|
+
*
|
|
175
|
+
* The comparison of places' own reasons first and in its own order — nothing of
|
|
176
|
+
* the kind, nothing held still, nothing inside, nothing checkable, nothing
|
|
177
|
+
* claimed — because each of them is a better answer than anything about a door.
|
|
178
|
+
* The door last, because a kind no window could witness has no weight whether or
|
|
179
|
+
* not its pages could be scaled (0394). The split of the empty population into
|
|
180
|
+
* the structural half and the measurement half is the places comparison's rule
|
|
181
|
+
* read here unchanged, including its asymmetry: `unwitnessable` only where no
|
|
182
|
+
* paired place has anything inside it on both sides (0414).
|
|
183
|
+
*/
|
|
184
|
+
const silenceOf = (of) => {
|
|
185
|
+
if (of.places + of.gained + of.lost === 0)
|
|
186
|
+
return "unplaced";
|
|
187
|
+
if (of.places === 0)
|
|
188
|
+
return "unpaired";
|
|
189
|
+
if (of.checkable === 0)
|
|
190
|
+
return of.inhabited === 0 ? "unwitnessable" : "uncheckable";
|
|
191
|
+
if (of.comparable === 0)
|
|
192
|
+
return "unclaimable";
|
|
193
|
+
return of.blocked === null ? null : SENDER_REACH_CHANGE_OF_REACH[of.blocked];
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* The verdict, off the two shares and never off the two counts of places.
|
|
197
|
+
*
|
|
198
|
+
* The opposite of the places comparison's rule and for the opposite reason:
|
|
199
|
+
* there one denominator serves both sides, so the sign of a subtraction of two
|
|
200
|
+
* whole numbers is the whole answer. Here the two denominators are two windows'
|
|
201
|
+
* readings, so the shares are the only comparable pair (0394).
|
|
202
|
+
*
|
|
203
|
+
* `still-silent` is read off the **reporting** weight rather than off the share
|
|
204
|
+
* being 1, because a sum of positive terms is nought exactly when it has no
|
|
205
|
+
* terms and a share of 1 is a float.
|
|
206
|
+
*/
|
|
207
|
+
const movementOf = (of, silence, shareWas, shareNow) => {
|
|
208
|
+
if (silence !== null)
|
|
209
|
+
return "unknown";
|
|
210
|
+
if (of.reportedWas === 0 && of.reportedNow === 0)
|
|
211
|
+
return "still-silent";
|
|
212
|
+
if (shareNow < shareWas)
|
|
213
|
+
return "repaired";
|
|
214
|
+
if (shareNow > shareWas)
|
|
215
|
+
return "regressed";
|
|
216
|
+
return "held";
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* The sufficiency verdict, named at this reading's subject.
|
|
220
|
+
*
|
|
221
|
+
* The rule itself is the one a comparison of a kind's reach publishes and is
|
|
222
|
+
* **not** written again: its first counterfactual is the one that holds the
|
|
223
|
+
* weights still, which is this reading's senders moving alone, and its second
|
|
224
|
+
* holds the per-place quantity still, which is this reading's readers moving
|
|
225
|
+
* alone. The two names cross, and the table below is where they cross once
|
|
226
|
+
* rather than at a call site.
|
|
227
|
+
*/
|
|
228
|
+
const CAUSE_OF_SHARE = Object.freeze({
|
|
229
|
+
readers: "senders",
|
|
230
|
+
pages: "readers",
|
|
231
|
+
either: "either",
|
|
232
|
+
together: "together",
|
|
233
|
+
});
|
|
234
|
+
const causeOf = (shareWas, shareNow, held) => {
|
|
235
|
+
const cause = readerShareCauseOf(shareWas, shareNow, held.reading, held.senders);
|
|
236
|
+
return cause === null ? null : CAUSE_OF_SHARE[cause];
|
|
237
|
+
};
|
|
238
|
+
const rowOf = (of) => {
|
|
239
|
+
const silence = silenceOf(of);
|
|
240
|
+
const measured = silence === null;
|
|
241
|
+
const shareWas = of.unreportedWas / of.insideWas;
|
|
242
|
+
const shareNow = of.unreportedNow / of.insideNow;
|
|
243
|
+
const ifReadingHeld = of.heldReading / of.insideWas;
|
|
244
|
+
const ifSendersHeld = of.heldSenders / of.insideNow;
|
|
245
|
+
return {
|
|
246
|
+
kind: of.kind,
|
|
247
|
+
role: of.kind.by === "type" ? of.role : null,
|
|
248
|
+
places: of.places,
|
|
249
|
+
gained: of.gained,
|
|
250
|
+
lost: of.lost,
|
|
251
|
+
checkableWas: of.checkableWas,
|
|
252
|
+
checkableNow: of.checkableNow,
|
|
253
|
+
inhabited: of.inhabited,
|
|
254
|
+
checkable: of.checkable,
|
|
255
|
+
indeterminate: of.indeterminate,
|
|
256
|
+
comparable: of.comparable,
|
|
257
|
+
repaired: of.repaired,
|
|
258
|
+
wentSilent: of.wentSilent,
|
|
259
|
+
keptSilent: of.keptSilent,
|
|
260
|
+
keptReporting: of.keptReporting,
|
|
261
|
+
pages: of.pages.size,
|
|
262
|
+
insideWas: measured ? of.insideWas : null,
|
|
263
|
+
insideNow: measured ? of.insideNow : null,
|
|
264
|
+
unreportedWas: measured ? of.unreportedWas : null,
|
|
265
|
+
unreportedNow: measured ? of.unreportedNow : null,
|
|
266
|
+
silentShareWas: measured ? shareWas : null,
|
|
267
|
+
silentShareNow: measured ? shareNow : null,
|
|
268
|
+
readingsRecovered: measured ? (shareWas - shareNow) * of.insideNow : null,
|
|
269
|
+
ifReadingHeld: measured ? ifReadingHeld : null,
|
|
270
|
+
ifSendersHeld: measured ? ifSendersHeld : null,
|
|
271
|
+
movement: movementOf(of, silence, shareWas, shareNow),
|
|
272
|
+
cause: measured
|
|
273
|
+
? causeOf(shareWas, shareNow, { reading: ifReadingHeld, senders: ifSendersHeld })
|
|
274
|
+
: null,
|
|
275
|
+
weightMoved: measured
|
|
276
|
+
? weightMovedOver(of.weights, { was: of.insideWas, now: of.insideNow })
|
|
277
|
+
: null,
|
|
278
|
+
driftWas: of.driftWas,
|
|
279
|
+
driftNow: of.driftNow,
|
|
280
|
+
pendingWas: of.pendingWas,
|
|
281
|
+
pendingNow: of.pendingNow,
|
|
282
|
+
unreconciled: of.unreconciled,
|
|
283
|
+
exact: measured &&
|
|
284
|
+
of.driftWas === 0 &&
|
|
285
|
+
of.driftNow === 0 &&
|
|
286
|
+
of.pendingWas === 0 &&
|
|
287
|
+
of.pendingNow === 0 &&
|
|
288
|
+
of.unreconciled === 0,
|
|
289
|
+
silence,
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
/** The name a row is ordered by, which is the key's own and never the row's position. */
|
|
293
|
+
const nameOf = (kind) => (kind.by === "type" ? kind.type : (kind.role ?? ""));
|
|
294
|
+
/**
|
|
295
|
+
* The kind to look at first, which is the ranking rule spelled once.
|
|
296
|
+
*
|
|
297
|
+
* Most readings lost first, then the higher silent share now, then by name — so
|
|
298
|
+
* a kind with no figures at all sorts after every kind that has them, and two
|
|
299
|
+
* kinds that lost the same do not reorder on a refresh.
|
|
300
|
+
*/
|
|
301
|
+
const worseOf = (one, other) => (one.readingsRecovered ?? Number.POSITIVE_INFINITY) -
|
|
302
|
+
(other.readingsRecovered ?? Number.POSITIVE_INFINITY) ||
|
|
303
|
+
(other.silentShareNow ?? -1) - (one.silentShareNow ?? -1) ||
|
|
304
|
+
nameOf(one.kind).localeCompare(nameOf(other.kind));
|
|
305
|
+
/** The states of one window's parts, by node, which is what a paired place is read off. */
|
|
306
|
+
const sendersByNodeIn = (parts) => new Map(senderStatesOf(parts).map((at) => [at.part.nodeId, at]));
|
|
307
|
+
/**
|
|
308
|
+
* A part's placement, or the state that contributes nothing.
|
|
309
|
+
*
|
|
310
|
+
* Unreachable on a reading built by the published rule — the map is built from
|
|
311
|
+
* the same parts it is read with — and it is a fallback rather than a throw
|
|
312
|
+
* because a page whose nodes are not unique would otherwise take a whole
|
|
313
|
+
* deployment's comparison down to report one malformed tree. A place nothing
|
|
314
|
+
* stands inside is in no transition and carries no weight, which is the honest
|
|
315
|
+
* reading of a part this pass cannot find.
|
|
316
|
+
*/
|
|
317
|
+
const senderOf = (states, part) => states.get(part.nodeId) ?? { part, state: "leaf", insideReach: 0 };
|
|
318
|
+
/**
|
|
319
|
+
* What a change did to what a deployment's silent components cost the readers
|
|
320
|
+
* who got inside them.
|
|
321
|
+
*
|
|
322
|
+
* Takes each window as its readings and the whole window of door rows a
|
|
323
|
+
* deployment holds for it, because the weights need a door on both sides: the
|
|
324
|
+
* pages are paired by the published rule and each side's terms are put on its
|
|
325
|
+
* own door's scale (0266, 0256).
|
|
326
|
+
*
|
|
327
|
+
* The labels are the caller's. Two readings of one window come back as every
|
|
328
|
+
* place held, both shares identical and nothing recovered; a caller holding the
|
|
329
|
+
* two sides backwards gets a comparison with every movement reversed rather
|
|
330
|
+
* than a refusal, exactly as every other before-and-after reading here does.
|
|
331
|
+
*
|
|
332
|
+
* Linear in the parts of the readings times the rows, with one pass per window
|
|
333
|
+
* that fills both groupings.
|
|
334
|
+
*/
|
|
335
|
+
export const librarySendersReachChangeOf = (was, now) => {
|
|
336
|
+
const earlier = librarySideOf(was);
|
|
337
|
+
const later = librarySideOf(now);
|
|
338
|
+
const rows = new Map();
|
|
339
|
+
const roleWas = new Map();
|
|
340
|
+
const roleNow = new Map();
|
|
341
|
+
const ambiguous = new Map([...earlier.pages.ambiguous, ...later.pages.ambiguous]);
|
|
342
|
+
const unscaled = [];
|
|
343
|
+
let pages = 0;
|
|
344
|
+
let pagesGained = 0;
|
|
345
|
+
let pagesLost = 0;
|
|
346
|
+
let republished = 0;
|
|
347
|
+
let placements = 0;
|
|
348
|
+
let gained = 0;
|
|
349
|
+
let lost = 0;
|
|
350
|
+
let recast = 0;
|
|
351
|
+
let arrivalsWas = 0;
|
|
352
|
+
let arrivalsNow = 0;
|
|
353
|
+
let scaled = 0;
|
|
354
|
+
/**
|
|
355
|
+
* Every role in the vocabulary gets a row whether or not anything plays it, as
|
|
356
|
+
* a census's role rows do: a role nothing in the library plays is a fact about
|
|
357
|
+
* the library, and a surface that had to tell a missing row from an empty one
|
|
358
|
+
* would be reading the vocabulary itself.
|
|
359
|
+
*/
|
|
360
|
+
for (const role of [...PRIMITIVE_ROLES, null])
|
|
361
|
+
rowFor(rows, { by: "role", role });
|
|
362
|
+
for (const [form, reading] of earlier.pages.byForm) {
|
|
363
|
+
if (ambiguous.has(form))
|
|
364
|
+
continue;
|
|
365
|
+
for (const part of reading.parts) {
|
|
366
|
+
roleWas.set(part.type, part.role);
|
|
367
|
+
rowFor(rows, { by: "type", type: part.type }).role = part.role;
|
|
368
|
+
}
|
|
369
|
+
if (later.pages.byForm.has(form))
|
|
370
|
+
continue;
|
|
371
|
+
pagesLost += 1;
|
|
372
|
+
for (const part of reading.parts) {
|
|
373
|
+
lost += 1;
|
|
374
|
+
for (const kind of keysOf(part))
|
|
375
|
+
rowFor(rows, kind).lost += 1;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
for (const [form, reading] of later.pages.byForm) {
|
|
379
|
+
if (ambiguous.has(form))
|
|
380
|
+
continue;
|
|
381
|
+
for (const part of reading.parts) {
|
|
382
|
+
roleNow.set(part.type, part.role);
|
|
383
|
+
rowFor(rows, { by: "type", type: part.type }).role = part.role;
|
|
384
|
+
}
|
|
385
|
+
if (earlier.pages.byForm.has(form))
|
|
386
|
+
continue;
|
|
387
|
+
pagesGained += 1;
|
|
388
|
+
for (const part of reading.parts) {
|
|
389
|
+
gained += 1;
|
|
390
|
+
for (const kind of keysOf(part))
|
|
391
|
+
rowFor(rows, kind).gained += 1;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
for (const [form, before] of earlier.pages.byForm) {
|
|
395
|
+
const after = later.pages.byForm.get(form);
|
|
396
|
+
const scaledWas = earlier.scaled.get(form);
|
|
397
|
+
const scaledNow = later.scaled.get(form);
|
|
398
|
+
if (after === undefined || scaledWas === undefined || scaledNow === undefined)
|
|
399
|
+
continue;
|
|
400
|
+
if (ambiguous.has(form))
|
|
401
|
+
continue;
|
|
402
|
+
const beforeParts = partsByNodeIn(before);
|
|
403
|
+
const afterParts = partsByNodeIn(after);
|
|
404
|
+
const beforeStates = sendersByNodeIn(before.parts);
|
|
405
|
+
const afterStates = sendersByNodeIn(after.parts);
|
|
406
|
+
const doors = { was: scaledWas.door, now: scaledNow.door };
|
|
407
|
+
pages += 1;
|
|
408
|
+
republished += before.revision === after.revision ? 0 : 1;
|
|
409
|
+
arrivalsWas += doors.was.opened;
|
|
410
|
+
arrivalsNow += doors.now.opened;
|
|
411
|
+
if (doors.was.silence === null && doors.now.silence === null)
|
|
412
|
+
scaled += 1;
|
|
413
|
+
/**
|
|
414
|
+
* A page the door cannot scale is listed once per side it is unscalable on,
|
|
415
|
+
* and only where the defect could be seen on it in both windows: a page
|
|
416
|
+
* nothing was read under is not a page whose readers could not be counted,
|
|
417
|
+
* and listing it would put the commonest healthy state on the one list here
|
|
418
|
+
* that is meant to be empty.
|
|
419
|
+
*/
|
|
420
|
+
const witnessed = before.parts.some((part) => {
|
|
421
|
+
const mine = beforeStates.get(part.nodeId);
|
|
422
|
+
const theirs = afterStates.get(part.nodeId);
|
|
423
|
+
return (mine !== undefined &&
|
|
424
|
+
theirs !== undefined &&
|
|
425
|
+
witnessedState(mine.state) &&
|
|
426
|
+
witnessedState(theirs.state));
|
|
427
|
+
});
|
|
428
|
+
if (witnessed) {
|
|
429
|
+
if (doors.was.silence !== null) {
|
|
430
|
+
unscaled.push({
|
|
431
|
+
treeId: before.treeId,
|
|
432
|
+
revision: before.revision,
|
|
433
|
+
audienceId: before.audienceId,
|
|
434
|
+
against: after.revision,
|
|
435
|
+
side: "was",
|
|
436
|
+
silence: doors.was.silence,
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
if (doors.now.silence !== null) {
|
|
440
|
+
unscaled.push({
|
|
441
|
+
treeId: after.treeId,
|
|
442
|
+
revision: after.revision,
|
|
443
|
+
audienceId: after.audienceId,
|
|
444
|
+
against: before.revision,
|
|
445
|
+
side: "now",
|
|
446
|
+
silence: doors.now.silence,
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
for (const part of before.parts) {
|
|
451
|
+
const counterpart = afterParts.get(part.nodeId);
|
|
452
|
+
if (counterpart === undefined) {
|
|
453
|
+
lost += 1;
|
|
454
|
+
for (const kind of keysOf(part))
|
|
455
|
+
rowFor(rows, kind).lost += 1;
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
if (part.type === counterpart.type) {
|
|
459
|
+
placements += 1;
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
recast += 1;
|
|
463
|
+
lost += 1;
|
|
464
|
+
gained += 1;
|
|
465
|
+
rowFor(rows, { by: "type", type: part.type }).lost += 1;
|
|
466
|
+
rowFor(rows, { by: "type", type: counterpart.type }).gained += 1;
|
|
467
|
+
}
|
|
468
|
+
if (part.role !== counterpart.role) {
|
|
469
|
+
rowFor(rows, { by: "role", role: part.role }).lost += 1;
|
|
470
|
+
rowFor(rows, { by: "role", role: counterpart.role }).gained += 1;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* A place is paired under a key only where it is of that kind on both
|
|
474
|
+
* sides, which is the places comparison's rule and where the two keys
|
|
475
|
+
* answer differently: a node recast into another type is a place one kind
|
|
476
|
+
* left and another took, while the role rows hold it still wherever the
|
|
477
|
+
* two types play the same part (0266).
|
|
478
|
+
*/
|
|
479
|
+
const sameType = part.type === counterpart.type ? [{ by: "type", type: part.type }] : [];
|
|
480
|
+
const sameRole = part.role === counterpart.role ? [{ by: "role", role: part.role }] : [];
|
|
481
|
+
const paired = {
|
|
482
|
+
treeId: before.treeId,
|
|
483
|
+
was: senderOf(beforeStates, part),
|
|
484
|
+
now: senderOf(afterStates, counterpart),
|
|
485
|
+
};
|
|
486
|
+
for (const kind of [...sameType, ...sameRole])
|
|
487
|
+
add(rowFor(rows, kind), paired, doors, form);
|
|
488
|
+
}
|
|
489
|
+
for (const part of after.parts) {
|
|
490
|
+
if (beforeParts.has(part.nodeId))
|
|
491
|
+
continue;
|
|
492
|
+
gained += 1;
|
|
493
|
+
for (const kind of keysOf(part))
|
|
494
|
+
rowFor(rows, kind).gained += 1;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
const built = [...rows.values()].map(rowOf);
|
|
498
|
+
const byType = built.filter((row) => row.kind.by === "type").sort(worseOf);
|
|
499
|
+
const disagreed = [...roleNow.keys()]
|
|
500
|
+
.filter((type) => roleWas.has(type) && roleWas.get(type) !== roleNow.get(type))
|
|
501
|
+
.sort((one, other) => one.localeCompare(other));
|
|
502
|
+
const totalOf = (figure) => byType.reduce((total, row) => total + figure(row), 0);
|
|
503
|
+
return {
|
|
504
|
+
byType,
|
|
505
|
+
byRole: built.filter((row) => row.kind.by === "role").sort(worseOf),
|
|
506
|
+
pages,
|
|
507
|
+
pagesGained,
|
|
508
|
+
pagesLost,
|
|
509
|
+
audiences: { was: earlier.pages.audiences, now: later.pages.audiences },
|
|
510
|
+
republished,
|
|
511
|
+
placements,
|
|
512
|
+
gained,
|
|
513
|
+
lost,
|
|
514
|
+
recast,
|
|
515
|
+
inhabited: totalOf((row) => row.inhabited),
|
|
516
|
+
checkable: totalOf((row) => row.checkable),
|
|
517
|
+
comparable: totalOf((row) => row.comparable),
|
|
518
|
+
repaired: totalOf((row) => row.repaired),
|
|
519
|
+
wentSilent: totalOf((row) => row.wentSilent),
|
|
520
|
+
keptSilent: totalOf((row) => row.keptSilent),
|
|
521
|
+
keptReporting: totalOf((row) => row.keptReporting),
|
|
522
|
+
indeterminate: totalOf((row) => row.indeterminate),
|
|
523
|
+
arrivalsWas,
|
|
524
|
+
arrivalsNow,
|
|
525
|
+
scaled,
|
|
526
|
+
unscaled: [...unscaled].sort(inUnscaledSideOrder),
|
|
527
|
+
mostRecovered: byType
|
|
528
|
+
.filter((row) => (row.readingsRecovered ?? 0) > 0)
|
|
529
|
+
.sort((one, other) => (other.readingsRecovered ?? 0) - (one.readingsRecovered ?? 0) ||
|
|
530
|
+
nameOf(one.kind).localeCompare(nameOf(other.kind)))[0] ?? null,
|
|
531
|
+
mostCostly: byType.find((row) => (row.readingsRecovered ?? 0) < 0) ?? null,
|
|
532
|
+
ambiguous: [...ambiguous.values()].sort(inFormOrder),
|
|
533
|
+
duplicated: earlier.pages.duplicated + later.pages.duplicated,
|
|
534
|
+
duplicatedRows: earlier.duplicatedRows + later.duplicatedRows,
|
|
535
|
+
roleDisagreed: disagreed,
|
|
536
|
+
};
|
|
537
|
+
};
|
|
538
|
+
//# sourceMappingURL=library-senders-reach-change.js.map
|