things-api 0.16.0 → 0.17.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 +1 -1
- package/dist/cli/commands/repeat-flags.d.ts +3 -3
- package/dist/cli/commands/repeat-flags.js +90 -33
- package/dist/cli/commands/repeat-flags.js.map +1 -1
- package/dist/cli/commands/writes.js +59 -5
- package/dist/cli/commands/writes.js.map +1 -1
- package/dist/cli/help.js +9 -2
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/interrupt.d.ts +42 -0
- package/dist/cli/interrupt.js +105 -0
- package/dist/cli/interrupt.js.map +1 -0
- package/dist/cli/main.js +5 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/client.js +3 -0
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +39 -0
- package/dist/config.js +16 -1
- package/dist/config.js.map +1 -1
- package/dist/contracts.d.ts +9 -2
- package/dist/contracts.js +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/model/occurrences.d.ts +14 -1
- package/dist/model/occurrences.js +20 -4
- package/dist/model/occurrences.js.map +1 -1
- package/dist/model/recurrence.d.ts +60 -9
- package/dist/model/recurrence.js +76 -19
- package/dist/model/recurrence.js.map +1 -1
- package/dist/paths.d.ts +8 -0
- package/dist/paths.js +10 -0
- package/dist/paths.js.map +1 -1
- package/dist/sync-health.js +2 -1
- package/dist/sync-health.js.map +1 -1
- package/dist/trace/tracer.d.ts +87 -0
- package/dist/trace/tracer.js +167 -0
- package/dist/trace/tracer.js.map +1 -0
- package/dist/write/clear-reminder.js +24 -21
- package/dist/write/clear-reminder.js.map +1 -1
- package/dist/write/commands.js +50 -45
- package/dist/write/commands.js.map +1 -1
- package/dist/write/completion-context.d.ts +57 -0
- package/dist/write/completion-context.js +49 -0
- package/dist/write/completion-context.js.map +1 -0
- package/dist/write/failure-hints.d.ts +10 -1
- package/dist/write/failure-hints.js +8 -0
- package/dist/write/failure-hints.js.map +1 -1
- package/dist/write/guards.d.ts +1 -1
- package/dist/write/guards.js +10 -0
- package/dist/write/guards.js.map +1 -1
- package/dist/write/operations.d.ts +12 -3
- package/dist/write/pipeline.d.ts +39 -0
- package/dist/write/pipeline.js +230 -17
- package/dist/write/pipeline.js.map +1 -1
- package/dist/write/pre-state.d.ts +1 -1
- package/dist/write/pre-state.js +2 -2
- package/dist/write/pre-state.js.map +1 -1
- package/dist/write/promote-clone.js +260 -13
- package/dist/write/promote-clone.js.map +1 -1
- package/dist/write/repeat-anchor.d.ts +110 -0
- package/dist/write/repeat-anchor.js +238 -0
- package/dist/write/repeat-anchor.js.map +1 -0
- package/dist/write/repeat-asserts.d.ts +28 -0
- package/dist/write/repeat-asserts.js +169 -0
- package/dist/write/repeat-asserts.js.map +1 -0
- package/dist/write/repeat-rule.js +27 -12
- package/dist/write/repeat-rule.js.map +1 -1
- package/dist/write/vectors/session-reachability.d.ts +78 -0
- package/dist/write/vectors/session-reachability.js +103 -0
- package/dist/write/vectors/session-reachability.js.map +1 -0
- package/dist/write/vectors/simulator.js +68 -29
- package/dist/write/vectors/simulator.js.map +1 -1
- package/dist/write/vectors/types.d.ts +117 -10
- package/dist/write/vectors/ui-recipes.d.ts +8 -0
- package/dist/write/vectors/ui-recipes.js +120 -22
- package/dist/write/vectors/ui-recipes.js.map +1 -1
- package/dist/write/vectors/ui.d.ts +79 -13
- package/dist/write/vectors/ui.js +415 -59
- package/dist/write/vectors/ui.js.map +1 -1
- package/dist/write/verify/delta.d.ts +12 -14
- package/dist/write/verify/delta.js +35 -34
- package/dist/write/verify/delta.js.map +1 -1
- package/package.json +1 -1
- package/schema/envelope.schema.json +22 -0
- package/skills/things-cli/SKILL.md +5 -2
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The FIXED-recurrence DEFAULT-anchor law + the weekly-weekday derivation the
|
|
3
|
+
* promote verbs use (issue #476; evidence: docs/lab/anch2-next-field.md +
|
|
4
|
+
* anch1-repeat-anchor.md, golden-v2 / Things 3.22.12).
|
|
5
|
+
*
|
|
6
|
+
* DEFAULT LAW (ANCH1, still valid as the DEFAULT). Left untouched, the Repeat
|
|
7
|
+
* dialog's "Next:" field defaults the first occurrence to the next calendar match
|
|
8
|
+
* ON OR AFTER TODAY (interval-independent), and a weekday-less weekly rule
|
|
9
|
+
* defaults to SUNDAY. ANCH2 then showed the "Next:" field is EDITABLE and honored
|
|
10
|
+
* (docs/lab/anch2-next-field.md) — so the promote verbs DRIVE it with the item's
|
|
11
|
+
* scheduled date rather than refuse a wrong-phase series. This module no longer
|
|
12
|
+
* carries a phase-refusal (the ANCH1 `H-REPEAT-ANCHOR` premise — "no drivable
|
|
13
|
+
* first-occurrence control" — was false).
|
|
14
|
+
*
|
|
15
|
+
* What it still provides:
|
|
16
|
+
* 1. {@link deriveWeeklyWeekdays} — when a weekly rule omits `weekdays` but a
|
|
17
|
+
* concrete anchor date is known, derive the recurring weekday FROM that date
|
|
18
|
+
* so the series fires on the intended weekday (not the app's Sunday default).
|
|
19
|
+
* Driving "Next:" fixes the FIRST occurrence; this fixes the recurring day.
|
|
20
|
+
* 2. {@link fixedSpawnPlan} — the DEFAULT spawn shape (used by the simulator
|
|
21
|
+
* when no explicit first occurrence is requested): first occurrence = next
|
|
22
|
+
* match ≥ today, an instance spawns only when today is itself an occurrence.
|
|
23
|
+
*
|
|
24
|
+
* Daily/weekly follow the probed default law; monthly/yearly keep the caller's
|
|
25
|
+
* today+interval model for the default (their default-anchor law is unprobed).
|
|
26
|
+
*/
|
|
27
|
+
import { addDaysIso } from "../model/dates.js";
|
|
28
|
+
import { WD_TO_WEEKDAY, WEEKDAY_TO_WD } from "./repeat-rule.js";
|
|
29
|
+
/** True iff `v` is a concrete `YYYY-MM-DD` date (not a list keyword / undefined). */
|
|
30
|
+
export function isIsoDate(v) {
|
|
31
|
+
return typeof v === "string" && /^\d{4}-\d{2}-\d{2}$/.test(v);
|
|
32
|
+
}
|
|
33
|
+
/** Weekday of an ISO date, 0 = Sunday … 6 = Saturday (evaluated at UTC noon, tz-invariant). */
|
|
34
|
+
export function weekdayOfIso(iso) {
|
|
35
|
+
const [y, m, d] = iso.split("-").map(Number);
|
|
36
|
+
return new Date(Date.UTC(y, m - 1, d, 12)).getUTCDay();
|
|
37
|
+
}
|
|
38
|
+
/** Whole days from `a` to `b` (b − a); negative when b precedes a. */
|
|
39
|
+
function daysBetweenIso(a, b) {
|
|
40
|
+
const [ay, am, ad] = a.split("-").map(Number);
|
|
41
|
+
const [by, bm, bd] = b.split("-").map(Number);
|
|
42
|
+
return Math.round((Date.UTC(by, bm - 1, bd) - Date.UTC(ay, am - 1, ad)) / 86_400_000);
|
|
43
|
+
}
|
|
44
|
+
/** The smallest date on or after `todayIso` whose weekday is `wd` (0 = Sunday). */
|
|
45
|
+
function nextWeekdayOnOrAfter(todayIso, wd) {
|
|
46
|
+
const delta = (((wd - weekdayOfIso(todayIso)) % 7) + 7) % 7;
|
|
47
|
+
return addDaysIso(todayIso, delta);
|
|
48
|
+
}
|
|
49
|
+
/** The Sunday that starts the week containing `iso` (the app's weeks start Sunday). */
|
|
50
|
+
function weekAnchorSunday(iso) {
|
|
51
|
+
return addDaysIso(iso, -weekdayOfIso(iso));
|
|
52
|
+
}
|
|
53
|
+
/** A true modulo (result always in [0, n)). */
|
|
54
|
+
function mod(x, n) {
|
|
55
|
+
return ((x % n) + n) % n;
|
|
56
|
+
}
|
|
57
|
+
/** The rule's effective weekday numbers (explicit set, else the app's Sunday default). */
|
|
58
|
+
function effectiveWds(rule) {
|
|
59
|
+
return rule.weekdays !== undefined && rule.weekdays.length > 0
|
|
60
|
+
? rule.weekdays.map((w) => WEEKDAY_TO_WD[w])
|
|
61
|
+
: [0];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Whether `d` is on the active-week grid of a weekly rule anchored at `firstOcc`
|
|
65
|
+
* (weeks fire every `interval` weeks from the anchor's Sunday-week). Weekday match
|
|
66
|
+
* is checked separately.
|
|
67
|
+
*/
|
|
68
|
+
function weeklyActiveWeek(firstOcc, d, interval) {
|
|
69
|
+
const weeks = daysBetweenIso(weekAnchorSunday(firstOcc), weekAnchorSunday(d)) / 7;
|
|
70
|
+
return mod(weeks, interval) === 0;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* When a WEEKLY rule omits its weekday set but a concrete anchor date is known,
|
|
74
|
+
* the weekday to drive explicitly (so the series fires on the anchor date's
|
|
75
|
+
* weekday, not the app's Sunday default). Returns `undefined` when nothing should
|
|
76
|
+
* change (non-weekly, weekdays already given, or no concrete anchor date).
|
|
77
|
+
*/
|
|
78
|
+
export function deriveWeeklyWeekdays(rule, anchorIso) {
|
|
79
|
+
if (rule.afterCompletion === true)
|
|
80
|
+
return undefined;
|
|
81
|
+
if (rule.frequency !== "weekly")
|
|
82
|
+
return undefined;
|
|
83
|
+
if (rule.weekdays !== undefined)
|
|
84
|
+
return undefined;
|
|
85
|
+
if (!isIsoDate(anchorIso))
|
|
86
|
+
return undefined;
|
|
87
|
+
return [WD_TO_WEEKDAY[weekdayOfIso(anchorIso)]];
|
|
88
|
+
}
|
|
89
|
+
/** The 1-based day-of-month of an ISO date. */
|
|
90
|
+
function dayOfMonthIso(iso) {
|
|
91
|
+
return Number(iso.split("-")[2]);
|
|
92
|
+
}
|
|
93
|
+
/** The 1-based month of an ISO date. */
|
|
94
|
+
function monthOfIso(iso) {
|
|
95
|
+
return Number(iso.split("-")[1]);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* When a MONTHLY rule omits its day anchor but a concrete first-occurrence date
|
|
99
|
+
* is known, the day-of-month anchor to drive EXPLICITLY (so the series recurs on
|
|
100
|
+
* that day, not the Repeat dialog's untouched default). Returns `undefined` when
|
|
101
|
+
* nothing should change (non-monthly, an explicit anchor already given, or no
|
|
102
|
+
* concrete date). Mirrors {@link deriveWeeklyWeekdays} for the monthly unit —
|
|
103
|
+
* the same day-of-month the read-path decoder / composeOffsets derives from the
|
|
104
|
+
* occurrence date, so the derived anchor is byte-consistent with the rule blob.
|
|
105
|
+
*/
|
|
106
|
+
export function deriveMonthlyAnchor(rule, anchorIso) {
|
|
107
|
+
if (rule.afterCompletion === true)
|
|
108
|
+
return undefined;
|
|
109
|
+
if (rule.frequency !== "monthly")
|
|
110
|
+
return undefined;
|
|
111
|
+
if (rule.monthly !== undefined)
|
|
112
|
+
return undefined;
|
|
113
|
+
if (!isIsoDate(anchorIso))
|
|
114
|
+
return undefined;
|
|
115
|
+
return { day: dayOfMonthIso(anchorIso) };
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* When a YEARLY rule omits its month+day anchor but a concrete first-occurrence
|
|
119
|
+
* date is known, the {month, day} anchor to drive EXPLICITLY (so the series recurs
|
|
120
|
+
* on that month/day, not the dialog's untouched January-1 default — the ANCH2-c /
|
|
121
|
+
* issue #493 anchor-drop). Returns `undefined` when nothing should change
|
|
122
|
+
* (non-yearly, an explicit anchor already given, or no concrete date).
|
|
123
|
+
*/
|
|
124
|
+
export function deriveYearlyAnchor(rule, anchorIso) {
|
|
125
|
+
if (rule.afterCompletion === true)
|
|
126
|
+
return undefined;
|
|
127
|
+
if (rule.frequency !== "yearly")
|
|
128
|
+
return undefined;
|
|
129
|
+
if (rule.yearly !== undefined)
|
|
130
|
+
return undefined;
|
|
131
|
+
if (!isIsoDate(anchorIso))
|
|
132
|
+
return undefined;
|
|
133
|
+
return { month: monthOfIso(anchorIso), day: dayOfMonthIso(anchorIso) };
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The date to drive into the Repeat dialog's "Next:" field for a rule whose
|
|
137
|
+
* `next` is the scheduled START (`--when`). A DEADLINED rule anchors on the
|
|
138
|
+
* DEADLINE — the dialog's "Next:" is the next deadline and the instance START =
|
|
139
|
+
* deadline − startDaysEarlier — so it is driven with `next + startDaysEarlier` and
|
|
140
|
+
* the app back-shifts the start to `next` (YANCH1 #493, golden-v3 probe: Next
|
|
141
|
+
* driven to a date with start-N lands the instance start N days earlier). A
|
|
142
|
+
* non-deadlined rule (or one with no concrete `next`) drives `next` verbatim.
|
|
143
|
+
* Returns `undefined` when `next` is absent/non-concrete.
|
|
144
|
+
*/
|
|
145
|
+
export function deadlineDriveNext(p) {
|
|
146
|
+
if (!isIsoDate(p.next))
|
|
147
|
+
return undefined;
|
|
148
|
+
const shift = p.deadline === true || (p.startDaysEarlier ?? 0) > 0 ? (p.startDaysEarlier ?? 0) : 0;
|
|
149
|
+
return addDaysIso(p.next, shift);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The calendar-anchor fields to drive EXPLICITLY for a fixed weekly/monthly/yearly
|
|
153
|
+
* rule when the caller supplied a concrete first-occurrence date but NO explicit
|
|
154
|
+
* anchor — each derived from that date by the SAME refIso law composeOffsets uses
|
|
155
|
+
* (weekly → weekday, monthly → day-of-month, yearly → month+day). Driving the
|
|
156
|
+
* anchor pop-ups makes the series RECUR on the intended calendar placement;
|
|
157
|
+
* leaving the anchor to the "Next:" first-occurrence field alone fixes only the
|
|
158
|
+
* FIRST occurrence and leaves the dialog's untouched default as the recurring rule
|
|
159
|
+
* (weekly → Sunday, monthly → 1st, yearly → January 1 — ANCH2 cell c / issue
|
|
160
|
+
* #493). Returns only the fields that need driving; an explicit anchor, an
|
|
161
|
+
* after-completion rule, daily, or no concrete date yields an empty patch. This
|
|
162
|
+
* completes the derive-and-drive family the weekly weekday-derivation began
|
|
163
|
+
* post-ANCH1 (decisions.md).
|
|
164
|
+
*/
|
|
165
|
+
export function deriveFixedAnchor(rule, anchorIso) {
|
|
166
|
+
const weekdays = deriveWeeklyWeekdays(rule, anchorIso);
|
|
167
|
+
const monthly = deriveMonthlyAnchor(rule, anchorIso);
|
|
168
|
+
const yearly = deriveYearlyAnchor(rule, anchorIso);
|
|
169
|
+
return {
|
|
170
|
+
...(weekdays !== undefined && { weekdays }),
|
|
171
|
+
...(monthly !== undefined && { monthly }),
|
|
172
|
+
...(yearly !== undefined && { yearly }),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The app's first occurrence of a FIXED daily/weekly rule = the next calendar
|
|
177
|
+
* match on or after today. `null` for after-completion (no calendar) or an
|
|
178
|
+
* unguarded frequency (monthly/yearly). Weekly uses `weekdays` (caller should
|
|
179
|
+
* pass the DERIVED set); with no weekdays it falls back to the app's Sunday default.
|
|
180
|
+
*/
|
|
181
|
+
export function fixedFirstOccurrence(rule, todayIso) {
|
|
182
|
+
if (rule.afterCompletion === true)
|
|
183
|
+
return null;
|
|
184
|
+
if (rule.frequency === "daily")
|
|
185
|
+
return todayIso; // every day is an occurrence
|
|
186
|
+
if (rule.frequency === "weekly") {
|
|
187
|
+
let best = null;
|
|
188
|
+
for (const wd of effectiveWds(rule)) {
|
|
189
|
+
const cand = nextWeekdayOnOrAfter(todayIso, wd);
|
|
190
|
+
if (best === null || daysBetweenIso(cand, best) > 0)
|
|
191
|
+
best = cand;
|
|
192
|
+
}
|
|
193
|
+
return best;
|
|
194
|
+
}
|
|
195
|
+
return null; // monthly/yearly: default anchor law unprobed — not guarded
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The smallest occurrence STRICTLY AFTER today (the template's cursor,
|
|
199
|
+
* rt1_nextInstanceStartDate). Daily/weekly only. Returns `null` for other
|
|
200
|
+
* frequencies / after-completion.
|
|
201
|
+
*/
|
|
202
|
+
export function nextFixedOccurrenceAfter(rule, todayIso) {
|
|
203
|
+
if (rule.afterCompletion === true)
|
|
204
|
+
return null;
|
|
205
|
+
if (rule.frequency === "daily")
|
|
206
|
+
return addDaysIso(todayIso, Math.max(1, rule.interval));
|
|
207
|
+
if (rule.frequency === "weekly") {
|
|
208
|
+
const first = fixedFirstOccurrence(rule, todayIso);
|
|
209
|
+
if (first === null)
|
|
210
|
+
return null;
|
|
211
|
+
const wds = effectiveWds(rule);
|
|
212
|
+
const interval = Math.max(1, rule.interval);
|
|
213
|
+
let d = addDaysIso(todayIso, 1);
|
|
214
|
+
for (let i = 0; i < (interval + 2) * 7; i++) {
|
|
215
|
+
if (wds.includes(weekdayOfIso(d)) && weeklyActiveWeek(first, d, interval))
|
|
216
|
+
return d;
|
|
217
|
+
d = addDaysIso(d, 1);
|
|
218
|
+
}
|
|
219
|
+
return first; // unreachable in practice
|
|
220
|
+
}
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
export function fixedSpawnPlan(rule, todayIso) {
|
|
224
|
+
const first = fixedFirstOccurrence(rule, todayIso);
|
|
225
|
+
if (first === null) {
|
|
226
|
+
// Not a guarded frequency — degenerate plan (caller handles monthly/yearly).
|
|
227
|
+
return { refIso: todayIso, instanceStartIso: todayIso, cursorIso: todayIso, instanceCount: 1 };
|
|
228
|
+
}
|
|
229
|
+
const isToday = first === todayIso;
|
|
230
|
+
const cursor = isToday ? (nextFixedOccurrenceAfter(rule, todayIso) ?? first) : first;
|
|
231
|
+
return {
|
|
232
|
+
refIso: first,
|
|
233
|
+
instanceStartIso: isToday ? todayIso : null,
|
|
234
|
+
cursorIso: cursor,
|
|
235
|
+
instanceCount: isToday ? 1 : 0,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=repeat-anchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeat-anchor.js","sourceRoot":"","sources":["../../src/write/repeat-anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,UAAU,EAAgB,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEhE,qFAAqF;AACrF,MAAM,UAAU,SAAS,CAAC,CAAU;IAClC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,+FAA+F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gBAAE,OAAO,CAAC,CAAC;YACpF,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,KAAK,CAAC,CAAC,0BAA0B;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAgBD,MAAM,UAAU,cAAc,CAC5B,IAAuF,EACvF,QAAiB;IAEjB,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACnD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,6EAA6E;QAC7E,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;IACjG,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,KAAK,QAAQ,CAAC;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACrF,OAAO;QACL,MAAM,EAAE,KAAK;QACb,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;QAC3C,SAAS,EAAE,MAAM;QACjB,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RepeatRuleParams } from "./operations.ts";
|
|
2
|
+
import type { FieldAssertion } from "./verify/delta.ts";
|
|
3
|
+
/** The full requested-rule vocabulary minus the target uuid. */
|
|
4
|
+
export type RuleFields = Omit<RepeatRuleParams, "uuid">;
|
|
5
|
+
export interface RuleAssertOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Include the ANCH2 first-occurrence cursor assertion (`repeating.nextOccurrence`
|
|
8
|
+
* = rt1_nextInstanceStartDate) when `next` is requested. TRUE for
|
|
9
|
+
* reschedule-repeat — the cursor is driven into the EXISTING template in place
|
|
10
|
+
* with an on-rule `--when`, so a wrong-anchor drive is caught. FALSE for
|
|
11
|
+
* make-repeating / add-repeating: the cursor is the first RULE-ALIGNED occurrence
|
|
12
|
+
* ≥ today (ANCH1 spawn law), which coincides with the requested `--when` only
|
|
13
|
+
* when that date is on-rule AND future — an overdue seed or an off-rule `--when`
|
|
14
|
+
* makes the cursor legitimately differ. Those verbs instead verify (a) the rule
|
|
15
|
+
* BLOB anchor at full fidelity — the calendar anchor is asserted whether it was
|
|
16
|
+
* given explicitly or DERIVED from `--when` (YANCH1 #493: this is what catches a
|
|
17
|
+
* dropped January-1 / Sunday / 1st-of-month anchor), and (b) the driven FIRST
|
|
18
|
+
* occurrence (rt1_instanceCreationStartDate, verbatim even off-rule) through the
|
|
19
|
+
* dedicated post-drive check in promote-clone.ts — not the cursor.
|
|
20
|
+
*/
|
|
21
|
+
includeCursor: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Build the full-fidelity expected-rule assertion set for a validated rule-params
|
|
25
|
+
* bag. The base three (type/unit/interval) are always emitted; every other field
|
|
26
|
+
* contributes only when requested (requested-fields-only law).
|
|
27
|
+
*/
|
|
28
|
+
export declare function expectedRuleAssertions(params: RuleFields, opts: RuleAssertOptions): FieldAssertion[];
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FULL-FIDELITY expected-rule assertions for the rule-writing verbs
|
|
3
|
+
* (reschedule-repeat, make-repeating, add-repeating; to-do AND project).
|
|
4
|
+
*
|
|
5
|
+
* The idempotency precheck (pipeline.ts step 5a½) and the post-drive verify both
|
|
6
|
+
* ride the SAME {@link FieldAssertion} set an op's `expectedDelta` produces. When
|
|
7
|
+
* that set asserted only unit+interval (the RSIM5-era shallow subset), a
|
|
8
|
+
* reschedule that changed ONLY the monthly anchor / deadline offset / ends bound
|
|
9
|
+
* read back "already satisfied" and was skipped with a false idempotent-no-op —
|
|
10
|
+
* issue #491. This builder closes that class by construction: it maps the COMPLETE
|
|
11
|
+
* requested vocabulary onto assertions over the DECODED rule (decodeRecurrenceRule
|
|
12
|
+
* shapes) + the template's deadline column, never a raw blob/string compare.
|
|
13
|
+
*
|
|
14
|
+
* Two laws:
|
|
15
|
+
* 1. REQUESTED-FIELDS-ONLY. Only fields the caller actually set contribute an
|
|
16
|
+
* assertion; the three base fields (type/unit/interval) are always asserted
|
|
17
|
+
* (frequency+interval are required; the rule TYPE is meaningful even when
|
|
18
|
+
* `afterCompletion` is defaulted). A bare `{frequency, interval}` reschedule
|
|
19
|
+
* therefore never fails on an untouched anchor/ends/deadline — those keep
|
|
20
|
+
* their existing don't-care semantics.
|
|
21
|
+
* 2. EXHAUSTIVE MAP. {@link RULE_ASSERT_MAP} is a `Record` over every key of the
|
|
22
|
+
* rule vocabulary; each key is either an assert-producer or an explicit skip
|
|
23
|
+
* carrying a written reason. Adding a field to {@link RepeatRuleParams} breaks
|
|
24
|
+
* compilation here until it is consciously handled — a multi-consumer
|
|
25
|
+
* vocabulary must never be hand-enumerated per consumer (decisions.md).
|
|
26
|
+
*/
|
|
27
|
+
import { anchorKeyOfOffsets, decodeOffsetEntry } from "../model/recurrence.js";
|
|
28
|
+
import { composeRepeatRuleSpec } from "./recurrence-rule-blob.js";
|
|
29
|
+
/** A never-used anchor reference: every anchor path that reaches the key builder
|
|
30
|
+
* carries an EXPLICIT anchor (weekdays/monthly/yearly present), so composeOffsets
|
|
31
|
+
* never falls back to deriving one from this date. */
|
|
32
|
+
const ANCHOR_DUMMY_REF = "2000-01-01";
|
|
33
|
+
/**
|
|
34
|
+
* The canonical, order-insensitive anchor key the DECODED rule would carry for
|
|
35
|
+
* these requested params — computed by composing the numeric offsets exactly as a
|
|
36
|
+
* write would and round-tripping them through the SAME per-offset decode the read
|
|
37
|
+
* path uses, so the expected key is byte-consistent with the observed one.
|
|
38
|
+
*/
|
|
39
|
+
function expectedAnchorKey(p) {
|
|
40
|
+
const spec = composeRepeatRuleSpec({ uuid: "", ...p }, ANCHOR_DUMMY_REF, 0);
|
|
41
|
+
return anchorKeyOfOffsets((spec.of ?? []).map((o) => decodeOffsetEntry(o)));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The Ends bound, per the RRX1 laws: ends-after sets the `rc` occurrence-count
|
|
45
|
+
* total and OMITS the end date; ends-on-date sets `ed` and no count; never = both
|
|
46
|
+
* null. Every arm asserts BOTH columns so a reschedule from one bound kind to
|
|
47
|
+
* another is fully discriminated (e.g. after→on-date must clear the count).
|
|
48
|
+
*/
|
|
49
|
+
function endsAsserts(ends) {
|
|
50
|
+
switch (ends.kind) {
|
|
51
|
+
case "never":
|
|
52
|
+
return [
|
|
53
|
+
{ field: "repeating.rule.endDate", equals: null },
|
|
54
|
+
{ field: "repeating.rule.occurrenceCount", equals: null },
|
|
55
|
+
];
|
|
56
|
+
case "on-date":
|
|
57
|
+
return [
|
|
58
|
+
{ field: "repeating.rule.endDate", equals: ends.date },
|
|
59
|
+
{ field: "repeating.rule.occurrenceCount", equals: null },
|
|
60
|
+
];
|
|
61
|
+
case "after":
|
|
62
|
+
return [
|
|
63
|
+
{ field: "repeating.rule.occurrenceCount", equals: ends.count },
|
|
64
|
+
{ field: "repeating.rule.endDate", equals: null },
|
|
65
|
+
];
|
|
66
|
+
default: {
|
|
67
|
+
const exhaustive = ends;
|
|
68
|
+
throw new Error(`unknown ends bound ${JSON.stringify(exhaustive)}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* EXHAUSTIVE over every key of the rule vocabulary. The mapped-type key set (`-?`
|
|
74
|
+
* makes each required) is what makes a newly added {@link RepeatRuleParams} field
|
|
75
|
+
* a COMPILE error until it earns an entry here.
|
|
76
|
+
*/
|
|
77
|
+
const RULE_ASSERT_MAP = {
|
|
78
|
+
frequency: {
|
|
79
|
+
kind: "assert",
|
|
80
|
+
always: true,
|
|
81
|
+
build: (p) => [{ field: "repeating.rule.unit", equals: p.frequency }],
|
|
82
|
+
},
|
|
83
|
+
interval: {
|
|
84
|
+
kind: "assert",
|
|
85
|
+
always: true,
|
|
86
|
+
build: (p) => [{ field: "repeating.rule.interval", equals: p.interval }],
|
|
87
|
+
},
|
|
88
|
+
afterCompletion: {
|
|
89
|
+
kind: "assert",
|
|
90
|
+
// The rule TYPE is always meaningful (an absent flag ⇒ a fixed schedule); a
|
|
91
|
+
// fixed→after-completion conversion leaves unit+interval unchanged, so without
|
|
92
|
+
// this the precheck could not tell the target had not yet been reached.
|
|
93
|
+
always: true,
|
|
94
|
+
build: (p) => [
|
|
95
|
+
{
|
|
96
|
+
field: "repeating.rule.type",
|
|
97
|
+
equals: p.afterCompletion === true ? "after-completion" : "fixed",
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
weekdays: {
|
|
102
|
+
kind: "assert",
|
|
103
|
+
build: (p) => [{ field: "repeating.rule.anchorKey", equals: expectedAnchorKey(p) }],
|
|
104
|
+
},
|
|
105
|
+
monthly: {
|
|
106
|
+
kind: "assert",
|
|
107
|
+
build: (p) => [{ field: "repeating.rule.anchorKey", equals: expectedAnchorKey(p) }],
|
|
108
|
+
},
|
|
109
|
+
yearly: {
|
|
110
|
+
kind: "assert",
|
|
111
|
+
build: (p) => [{ field: "repeating.rule.anchorKey", equals: expectedAnchorKey(p) }],
|
|
112
|
+
},
|
|
113
|
+
ends: {
|
|
114
|
+
kind: "assert",
|
|
115
|
+
build: (p) => (p.ends === undefined ? [] : endsAsserts(p.ends)),
|
|
116
|
+
},
|
|
117
|
+
deadline: {
|
|
118
|
+
kind: "assert",
|
|
119
|
+
// A start-offset request also asserts a deadline: startDaysEarlier implies one
|
|
120
|
+
// (assertRepeatRule refuses startDaysEarlier with deadline:false).
|
|
121
|
+
when: (p) => p.deadline !== undefined || (p.startDaysEarlier ?? 0) > 0,
|
|
122
|
+
build: (p) => [
|
|
123
|
+
{
|
|
124
|
+
field: "repeating.deadlined",
|
|
125
|
+
equals: p.deadline === true || (p.startDaysEarlier ?? 0) > 0,
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
startDaysEarlier: {
|
|
130
|
+
kind: "assert",
|
|
131
|
+
// ts = −startDaysEarlier on the decoded rule (a deadline-relative start offset).
|
|
132
|
+
build: (p) => [{ field: "repeating.rule.startOffsetDays", equals: -(p.startDaysEarlier ?? 0) }],
|
|
133
|
+
},
|
|
134
|
+
next: {
|
|
135
|
+
kind: "assert",
|
|
136
|
+
// The ANCH2 first-occurrence CURSOR (rt1_nextInstanceStartDate → nextOccurrence)
|
|
137
|
+
// — the first RULE-ALIGNED occurrence, which equals the requested `--when` only
|
|
138
|
+
// when that date is itself on-rule AND future. Gated by
|
|
139
|
+
// RuleAssertOptions.includeCursor (reschedule only) — see expectedRuleAssertions.
|
|
140
|
+
build: (p) => p.next === undefined ? [] : [{ field: "repeating.nextOccurrence", equals: p.next }],
|
|
141
|
+
},
|
|
142
|
+
reminder: {
|
|
143
|
+
kind: "skip",
|
|
144
|
+
reason: "not stored in the recurrence-rule blob (rt1_recurrenceRule) — 'Add reminders' sets a " +
|
|
145
|
+
"time-of-day on the SPAWNED INSTANCES, not on the rule (RRX1/ANCH2). It has no decoded-rule " +
|
|
146
|
+
"field to compare against, so it is verified through the instance reminder-byte path, not here.",
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Build the full-fidelity expected-rule assertion set for a validated rule-params
|
|
151
|
+
* bag. The base three (type/unit/interval) are always emitted; every other field
|
|
152
|
+
* contributes only when requested (requested-fields-only law).
|
|
153
|
+
*/
|
|
154
|
+
export function expectedRuleAssertions(params, opts) {
|
|
155
|
+
const out = [];
|
|
156
|
+
for (const key of Object.keys(RULE_ASSERT_MAP)) {
|
|
157
|
+
// The cursor is a reschedule-only expectation (see RuleAssertOptions).
|
|
158
|
+
if (key === "next" && !opts.includeCursor)
|
|
159
|
+
continue;
|
|
160
|
+
const spec = RULE_ASSERT_MAP[key];
|
|
161
|
+
if (spec.kind === "skip")
|
|
162
|
+
continue;
|
|
163
|
+
const present = spec.when !== undefined ? spec.when(params) : params[key] !== undefined;
|
|
164
|
+
if (present || spec.always === true)
|
|
165
|
+
out.push(...spec.build(params));
|
|
166
|
+
}
|
|
167
|
+
return out;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=repeat-asserts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeat-asserts.js","sourceRoot":"","sources":["../../src/write/repeat-asserts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AA0BlE;;sDAEsD;AACtD,MAAM,gBAAgB,GAAG,YAAuB,CAAC;AAEjD;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,CAAa;IACtC,MAAM,IAAI,GAAG,qBAAqB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;IAC5E,OAAO,kBAAkB,CACvB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAA4B,CAAC,CAAC,CAC5E,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,IAAgB;IACnC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO;gBACL,EAAE,KAAK,EAAE,wBAAwB,EAAE,MAAM,EAAE,IAAI,EAAE;gBACjD,EAAE,KAAK,EAAE,gCAAgC,EAAE,MAAM,EAAE,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,SAAS,CAAC;QACxF,IAAI,OAAO,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -95,6 +95,18 @@ export function assertRepeatRule(params) {
|
|
|
95
95
|
params.yearly !== undefined) {
|
|
96
96
|
throw new RangeError("an after-completion rule has no calendar day — remove weekdays/monthly/yearly, or drop afterCompletion for a fixed schedule");
|
|
97
97
|
}
|
|
98
|
+
// ANCH1 (issue #476, golden-v2/3.22.12): an after-completion repeat can't be
|
|
99
|
+
// given an end bound through this path — after-completion mode does not expose
|
|
100
|
+
// the Ends control the fixed schedule does, so BOTH an end date and an
|
|
101
|
+
// occurrence count fail to apply (an ends-on-date drive dies looking for the
|
|
102
|
+
// "on date" option; an ends-after drive silently fails to set the count).
|
|
103
|
+
// Refuse it BEFORE any mutation rather than letting the GUI drive die and roll
|
|
104
|
+
// back. `never` (the default, no bound) is fine.
|
|
105
|
+
if (params.ends !== undefined && params.ends.kind !== "never") {
|
|
106
|
+
throw new RangeError("an after-completion repeat can't be given an end bound through this command — create it " +
|
|
107
|
+
"without an end (it repeats until you stop it), or use a fixed schedule (drop " +
|
|
108
|
+
"afterCompletion) to end on a date or after a number of times");
|
|
109
|
+
}
|
|
98
110
|
}
|
|
99
111
|
if (params.weekdays !== undefined) {
|
|
100
112
|
if (params.frequency !== "weekly") {
|
|
@@ -133,16 +145,19 @@ export function assertRepeatRule(params) {
|
|
|
133
145
|
if (!/^\d{1,2}:\d{2}$/.test(params.reminder)) {
|
|
134
146
|
throw new RangeError(`invalid reminder ${JSON.stringify(params.reminder)} — expected HH:mm`);
|
|
135
147
|
}
|
|
136
|
-
//
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
140
|
-
//
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
148
|
+
// ANCH2 (docs/lab/anch2-next-field.md): the reminder-time AXDateTimeArea IS
|
|
149
|
+
// drivable — UIC6-g's "ignores programmatic time entry" was a targeting
|
|
150
|
+
// artifact (the old set-datetime primitive wrote into the "first" date area,
|
|
151
|
+
// never the reminder). With deterministic targeting the picker commits the
|
|
152
|
+
// requested time exactly (probes: 09:00, 14:30), so --reminder is honored.
|
|
153
|
+
}
|
|
154
|
+
if (params.next !== undefined) {
|
|
155
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(params.next)) {
|
|
156
|
+
throw new RangeError(`invalid next ${JSON.stringify(params.next)} — expected YYYY-MM-DD`);
|
|
157
|
+
}
|
|
158
|
+
if (params.afterCompletion === true) {
|
|
159
|
+
throw new RangeError("a first-occurrence date (next/--when) does not apply to an after-completion repeat — it has no calendar");
|
|
160
|
+
}
|
|
146
161
|
}
|
|
147
162
|
if (params.startDaysEarlier !== undefined) {
|
|
148
163
|
if (!Number.isInteger(params.startDaysEarlier) || params.startDaysEarlier < 0) {
|
|
@@ -156,13 +171,13 @@ export function assertRepeatRule(params) {
|
|
|
156
171
|
/** The mutually-exclusive Ends bound of a decoded rule, or null if inexpressible. */
|
|
157
172
|
function endsOf(rule) {
|
|
158
173
|
const hasDate = rule.endDate !== null;
|
|
159
|
-
const hasCount = rule.
|
|
174
|
+
const hasCount = rule.occurrenceCount !== null;
|
|
160
175
|
if (hasDate && hasCount)
|
|
161
176
|
return null; // dialog's Ends is single-choice
|
|
162
177
|
if (hasDate)
|
|
163
178
|
return { ends: { kind: "on-date", date: rule.endDate } };
|
|
164
179
|
if (hasCount)
|
|
165
|
-
return { ends: { kind: "after", count: rule.
|
|
180
|
+
return { ends: { kind: "after", count: rule.occurrenceCount } };
|
|
166
181
|
return { ends: { kind: "never" } };
|
|
167
182
|
}
|
|
168
183
|
function monthlyAnchorOf(offset) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repeat-rule.js","s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