@jam-overture/loom 0.2.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/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/data/adapter.d.ts +9 -1
- package/dist/data/adapter.js +2 -0
- package/dist/data/resolve.d.ts +1 -1
- 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/render/addressed.d.ts +35 -0
- package/dist/render/addressed.js +79 -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 +2 -0
- package/dist/render/index.js +2 -0
- package/dist/render/render.d.ts +11 -0
- package/dist/render/render.js +192 -46
- package/dist/render/request.d.ts +8 -1
- package/dist/render/request.js +1 -0
- package/dist/runtime/auto-apply-ceiling.d.ts +54 -0
- package/dist/runtime/auto-apply-ceiling.js +66 -0
- package/dist/runtime/gate.js +69 -10
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/nesting.d.ts +13 -1
- package/dist/runtime/nesting.js +41 -24
- package/dist/runtime/policy-change.js +8 -2
- package/dist/runtime/policy-log.d.ts +5 -5
- package/dist/runtime/policy.d.ts +8 -6
- package/dist/runtime/policy.js +5 -2
- package/dist/runtime/repointing.js +0 -0
- package/dist/sdk/definition.d.ts +65 -6
- package/dist/sdk/definition.js +44 -0
- package/dist/sdk/registry.d.ts +17 -1
- package/dist/sdk/registry.js +39 -0
- 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/agenda.d.ts +585 -0
- package/dist/signals/agenda.js +295 -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/broadcast.d.ts +25 -15
- package/dist/signals/broadcast.js +209 -36
- package/dist/signals/collect.d.ts +137 -43
- package/dist/signals/collect.js +103 -36
- package/dist/signals/conversion.d.ts +348 -0
- package/dist/signals/conversion.js +235 -0
- package/dist/signals/correlated.contract.d.ts +24 -0
- package/dist/signals/correlated.contract.js +94 -0
- package/dist/signals/counters.d.ts +51 -0
- package/dist/signals/counters.js +58 -0
- package/dist/signals/deployment-change.d.ts +28 -4
- package/dist/signals/deployment-change.js +57 -16
- package/dist/signals/deployment.d.ts +18 -5
- package/dist/signals/deployment.js +37 -11
- package/dist/signals/door.d.ts +34 -12
- package/dist/signals/door.js +37 -13
- package/dist/signals/expire.d.ts +192 -0
- package/dist/signals/expire.js +213 -0
- package/dist/signals/frontier.d.ts +268 -0
- package/dist/signals/frontier.js +145 -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 +60 -0
- package/dist/signals/funnel.js +35 -20
- package/dist/signals/health.d.ts +201 -4
- package/dist/signals/health.js +214 -2
- package/dist/signals/index.d.ts +19 -0
- package/dist/signals/index.js +19 -0
- 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 +112 -9
- package/dist/signals/kept.contract.d.ts +22 -0
- package/dist/signals/kept.contract.js +111 -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-reach-change.d.ts +10 -0
- package/dist/signals/library-reach-change.js +11 -3
- 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.js +2 -6
- package/dist/signals/memory.js +142 -1
- package/dist/signals/migrate.d.ts +6 -5
- package/dist/signals/migrate.js +150 -6
- package/dist/signals/notice.d.ts +88 -33
- package/dist/signals/notice.js +38 -16
- package/dist/signals/part-pace.d.ts +378 -0
- package/dist/signals/part-pace.js +333 -0
- package/dist/signals/parts.d.ts +25 -15
- package/dist/signals/parts.js +32 -73
- package/dist/signals/postgres.js +400 -26
- package/dist/signals/region.d.ts +1 -1
- package/dist/signals/retention.d.ts +43 -21
- package/dist/signals/retention.js +25 -8
- package/dist/signals/rhythm.d.ts +302 -0
- package/dist/signals/rhythm.js +262 -0
- package/dist/signals/rollup.d.ts +127 -1
- package/dist/signals/rollup.js +211 -24
- package/dist/signals/schema.d.ts +640 -3
- package/dist/signals/schema.js +239 -3
- package/dist/signals/silences.d.ts +310 -11
- package/dist/signals/silences.js +243 -0
- package/dist/signals/subtrees.d.ts +123 -0
- package/dist/signals/subtrees.js +102 -0
- package/dist/signals/tally.d.ts +125 -4
- 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-funnels.d.ts +88 -0
- package/dist/signals/window-funnels.js +47 -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 +11 -0
- package/dist/store/index.js +11 -0
- package/dist/store/migrate.d.ts +26 -0
- package/dist/store/migrate.js +64 -0
- package/dist/store/postgres-audience.d.ts +14 -0
- package/dist/store/postgres-audience.js +272 -0
- package/dist/store/postgres.d.ts +1 -0
- package/dist/store/postgres.js +1 -0
- package/dist/store/schema.d.ts +312 -0
- package/dist/store/schema.js +77 -0
- package/dist/store/source.d.ts +57 -1
- package/dist/store/source.js +65 -1
- package/dist/submit/resolve.d.ts +1 -1
- package/dist/telemetry/index.d.ts +1 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/journal.d.ts +32 -0
- package/dist/telemetry/memory.js +10 -1
- package/dist/telemetry/postgres.js +18 -2
- package/dist/telemetry/window.d.ts +135 -0
- package/dist/telemetry/window.js +101 -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 +1 -0
- package/dist/testing/contracts.js +1 -0
- package/dist/testing/journal-contract.js +158 -5
- package/dist/theme/contrast.d.ts +19 -14
- package/dist/theme/contrast.js +181 -17
- package/dist/tree/apply.js +13 -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/package.json +39 -96
- package/dist/runtime/inverse-interpreter.d.ts +0 -90
- package/dist/runtime/inverse-interpreter.js +0 -56
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { arrivalRangeBefore, hourlySeriesOf, readReaderArrivals, } from "./arrivals.js";
|
|
2
|
+
import { ratioOf } from "./ratios.js";
|
|
3
|
+
import { ok } from "../result.js";
|
|
4
|
+
import { DELEGATED_READER_SIGNAL_KINDS } from "./kinds.js";
|
|
5
|
+
export const ACTED_KINDS = DELEGATED_READER_SIGNAL_KINDS;
|
|
6
|
+
/** Whether a signal kind is one this counter holds. */
|
|
7
|
+
export const isActedKind = (kind) => ACTED_KINDS.includes(kind);
|
|
8
|
+
/**
|
|
9
|
+
* The counter a kind is counted in.
|
|
10
|
+
*
|
|
11
|
+
* `disclosed` is openings, which is the same choice the portal's goal figure
|
|
12
|
+
* makes (0350 clause 4) — published here so the rule is spelled once, in the
|
|
13
|
+
* lane that owns the counters, rather than in each surface that reads them.
|
|
14
|
+
*
|
|
15
|
+
* It takes the counters rather than a row, so the one spelling serves a stored
|
|
16
|
+
* hour and a sum of them alike.
|
|
17
|
+
*/
|
|
18
|
+
export const actedCountOf = (counts, kind) => {
|
|
19
|
+
switch (kind) {
|
|
20
|
+
case "activated":
|
|
21
|
+
return counts.activations;
|
|
22
|
+
case "disclosed":
|
|
23
|
+
return counts.opens;
|
|
24
|
+
case "completed":
|
|
25
|
+
return counts.completions;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The hours of a range, as the counter answers for them.
|
|
30
|
+
*
|
|
31
|
+
* Rows are summed into their hour, so a scope holding several revisions or
|
|
32
|
+
* parts adds — **occurrences add** (unlike the distinct counts this table
|
|
33
|
+
* deliberately does not hold). A caller wanting one part asks the store for
|
|
34
|
+
* one.
|
|
35
|
+
*
|
|
36
|
+
* Rows outside the range are ignored rather than refused, for the reason
|
|
37
|
+
* `arrivalSeriesOf` ignores them: a wider read is what {@link actedChangeOf}
|
|
38
|
+
* narrows twice.
|
|
39
|
+
*/
|
|
40
|
+
export const actedSeriesOf = (stored, range, options = {}) => {
|
|
41
|
+
const kind = options.kind ?? "activated";
|
|
42
|
+
const filled = hourlySeriesOf(stored.hours, stored.begins, range, (row) => actedCountOf(row, kind), options);
|
|
43
|
+
return {
|
|
44
|
+
range,
|
|
45
|
+
kind,
|
|
46
|
+
hours: filled.hours,
|
|
47
|
+
count: filled.total,
|
|
48
|
+
...(stored.begins === undefined ? {} : { begins: stored.begins }),
|
|
49
|
+
clipped: filled.clipped,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Both figures and the quotient, from one read spanning both periods.
|
|
54
|
+
*
|
|
55
|
+
* The read has to span both, which is what {@link readReaderActed} is for: the
|
|
56
|
+
* obvious caller reads the range on the screen and reports an earlier period
|
|
57
|
+
* that is empty **because it was not read** (0356).
|
|
58
|
+
*/
|
|
59
|
+
export const actedChangeOf = (stored, range, options = {}) => {
|
|
60
|
+
const before = arrivalRangeBefore(range);
|
|
61
|
+
const now = actedSeriesOf(stored, range, options);
|
|
62
|
+
const earlier = actedSeriesOf(stored, before, options);
|
|
63
|
+
const was = stored.begins === undefined || stored.begins > before.from ? null : earlier.count;
|
|
64
|
+
return {
|
|
65
|
+
range,
|
|
66
|
+
before,
|
|
67
|
+
kind: now.kind,
|
|
68
|
+
count: now.count,
|
|
69
|
+
was,
|
|
70
|
+
ratio: ratioOf(was, now.count),
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* The chart, the range's figure and the change on the period before it, in one
|
|
75
|
+
* call against a counter handle.
|
|
76
|
+
*
|
|
77
|
+
* It exists for the reason `readReaderArrivals` does: the composition has a
|
|
78
|
+
* wrong version that type-checks, and it reads as *every press you have is new*
|
|
79
|
+
* on a screen, from a store that holds the right answer. The store handle is
|
|
80
|
+
* narrowed to the one method, so a reading cannot reach a counter it was not
|
|
81
|
+
* asked about.
|
|
82
|
+
*/
|
|
83
|
+
export const readReaderActed = async (store, request) => {
|
|
84
|
+
const { range, now, kind, ...narrowing } = request;
|
|
85
|
+
const read = await store.acted({
|
|
86
|
+
...narrowing,
|
|
87
|
+
from: arrivalRangeBefore(range).from,
|
|
88
|
+
to: range.to,
|
|
89
|
+
});
|
|
90
|
+
if (!read.ok)
|
|
91
|
+
return read;
|
|
92
|
+
const options = {
|
|
93
|
+
...(now === undefined ? {} : { now }),
|
|
94
|
+
...(kind === undefined ? {} : { kind }),
|
|
95
|
+
};
|
|
96
|
+
return ok({
|
|
97
|
+
series: actedSeriesOf(read.value, range, options),
|
|
98
|
+
change: actedChangeOf(read.value, range, options),
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Per hundred, with the multiplication first: `(count / views) * 100` of seven
|
|
103
|
+
* in two hundred is 3.5000000000000004, and a figure a surface rounds is still
|
|
104
|
+
* a figure a test has to spell that way.
|
|
105
|
+
*/
|
|
106
|
+
const per100 = (count, views) => views === null || views === 0 ? null : (count * 100) / views;
|
|
107
|
+
/**
|
|
108
|
+
* The figure, the chart, the denominator and the trend, from two reads of one
|
|
109
|
+
* store over one range.
|
|
110
|
+
*
|
|
111
|
+
* **One range, taken once, passed to both halves.** A caller composing this
|
|
112
|
+
* itself has to get the same range into two reads and the same period before it
|
|
113
|
+
* into two comparisons; the failure is a rate whose numerator and denominator
|
|
114
|
+
* describe different stretches of time, which is a number nobody can tell is
|
|
115
|
+
* wrong by looking at it.
|
|
116
|
+
*/
|
|
117
|
+
export const readReaderActedRate = async (store, request) => {
|
|
118
|
+
const acted = await readReaderActed(store, request);
|
|
119
|
+
if (!acted.ok)
|
|
120
|
+
return acted;
|
|
121
|
+
const { kind: _kind, nodeId: _nodeId, ...arrivalRequest } = request;
|
|
122
|
+
const arrivals = await readReaderArrivals(store, arrivalRequest);
|
|
123
|
+
if (!arrivals.ok)
|
|
124
|
+
return arrivals;
|
|
125
|
+
const now = per100(acted.value.change.count, arrivals.value.change.views);
|
|
126
|
+
const was = acted.value.change.was === null
|
|
127
|
+
? null
|
|
128
|
+
: per100(acted.value.change.was, arrivals.value.change.was);
|
|
129
|
+
return ok({
|
|
130
|
+
acted: acted.value,
|
|
131
|
+
arrivals: arrivals.value,
|
|
132
|
+
rate: { per100: now, was, ratio: ratioOf(was, now) },
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=acted.js.map
|