slotlock 0.6.1 → 0.6.3

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +13 -6
  3. package/SECURITY.md +15 -4
  4. package/agent-server.js +1 -5
  5. package/agent-store-backend.d.ts +5 -6
  6. package/agent-store-backend.js +41 -67
  7. package/api-keys.js +1 -1
  8. package/application-api.d.ts +3 -3
  9. package/application-api.js +16 -24
  10. package/assistant.d.ts +18 -27
  11. package/assistant.js +36 -53
  12. package/booking-rules.d.ts +30 -41
  13. package/booking-rules.js +17 -25
  14. package/change-watch.d.ts +1 -0
  15. package/change-watch.js +1 -1
  16. package/cli.js +3 -4
  17. package/config.d.ts +17 -2
  18. package/config.js +44 -6
  19. package/dashboard.js +14 -1
  20. package/ddl.d.ts +20 -27
  21. package/ddl.js +166 -108
  22. package/engine.d.ts +6 -9
  23. package/engine.js +5 -9
  24. package/event-feed.d.ts +23 -31
  25. package/event-feed.js +30 -45
  26. package/event-schema.js +6 -9
  27. package/hooks.d.ts +2 -4
  28. package/hooks.js +2 -4
  29. package/ical-worker-thread.js +3 -4
  30. package/ical-worker.d.ts +8 -10
  31. package/ical-worker.js +7 -9
  32. package/interop.js +1 -4
  33. package/maintenance.d.ts +14 -10
  34. package/maintenance.js +43 -26
  35. package/mcp-app.d.ts +7 -9
  36. package/mcp-app.js +7 -9
  37. package/mcp-modern.d.ts +14 -16
  38. package/mcp-modern.js +23 -27
  39. package/metrics.js +0 -1
  40. package/node-server.d.ts +9 -9
  41. package/node-server.js +25 -34
  42. package/package-version.js +2 -4
  43. package/package.json +1 -1
  44. package/rate-limit.d.ts +6 -1
  45. package/rate-limit.js +24 -8
  46. package/rest-api.d.ts +13 -14
  47. package/rest-api.js +11 -12
  48. package/rules.d.ts +6 -7
  49. package/rules.js +30 -42
  50. package/self-host.d.ts +16 -2
  51. package/self-host.js +42 -21
  52. package/slotlock.manifest.json +1 -1
  53. package/store.d.ts +109 -161
  54. package/store.js +253 -371
  55. package/sync.d.ts +44 -59
  56. package/sync.js +325 -469
  57. package/timezone.d.ts +25 -33
  58. package/timezone.js +37 -52
  59. package/types.d.ts +35 -56
  60. package/webhooks.d.ts +22 -25
  61. package/webhooks.js +35 -40
  62. package/weekly-hours.d.ts +3 -0
  63. package/weekly-hours.js +1 -1
package/sync.d.ts CHANGED
@@ -35,20 +35,17 @@ export interface ICalendarExpansionWindow {
35
35
  /** The most text one feed may be, in UTF-8 bytes. */
36
36
  export declare const MAX_ICAL_INPUT_BYTES = 2000000;
37
37
  /**
38
- * The ical.js release a series cursor holds the iterator state of. A cursor is ical.js's own
39
- * RecurIterator and RecurExpansion state, which only that release is known to continue exactly, so
40
- * a cursor another release wrote is ignored and the series searched from its start. A test pins this
41
- * to the installed package: upgrading ical.js means checking the state these cursors keep again.
38
+ * The ical.js release whose RecurIterator/RecurExpansion state a series cursor holds; only that
39
+ * release is known to continue it exactly, so a cursor another release wrote is ignored. A test
40
+ * pins this to the installed package: upgrading ical.js means rechecking cursor state.
42
41
  */
43
42
  export declare const ICAL_JS_VERSION = "2.2.1";
44
- /** The shape of the cursor this code writes and reads. */
45
43
  declare const SERIES_CURSOR_FORMAT = 1;
46
44
  /** A time's fields as ical.js holds them: year, month, day, hour, minute, second, a date or not. */
47
45
  type CursorTime = [number, number, number, number, number, number, boolean];
48
46
  /**
49
- * Where one expansion of a stored series stopped, as plain JSON a store keeps beside it: ical.js's
50
- * iterator state just before the first occurrence the next window may need, so the next expansion
51
- * continues there rather than searching again from the series' start.
47
+ * Where one expansion of a stored series stopped, as plain JSON stored beside it: ical.js's
48
+ * iterator state just before the first occurrence the next window may need.
52
49
  */
53
50
  export interface CalendarSeriesCursor {
54
51
  readonly v: typeof SERIES_CURSOR_FORMAT;
@@ -82,8 +79,7 @@ export declare class CalendarContractError extends Error {
82
79
  constructor(code: 'invalid_external_identity' | 'invalid_external_interval' | 'invalid_icalendar');
83
80
  }
84
81
  /**
85
- * A calendar that needs more work than Slotlock does to read or expand it: steps, time, a step or a
86
- * span longer than a century, or more occurrences, exceptions or dates than it keeps. Still
82
+ * A calendar that needs more work than Slotlock does to read or expand it. Still
87
83
  * `invalid_icalendar` to callers; the horizon roll counts these and skips the series.
88
84
  */
89
85
  export declare class CalendarExpansionLimitError extends CalendarContractError {
@@ -95,33 +91,28 @@ export declare class CalendarExpansionLimitError extends CalendarContractError {
95
91
  */
96
92
  export declare function recurrenceRuleProblem(rule: string): string | null;
97
93
  /**
98
- * A recurrence rule as RFC 5545 §3.3.10 writes it, in ical.js's canonical spelling, or `null`.
99
- * ical.js accepts more than it should: it drops unknown parts, lets a repeated part replace the
100
- * first, reads `COUNT=3X` as 3 and `COUNT=0` as no count at all. So every part must be one RFC 5545
101
- * names, appear once and match its grammar, with FREQ present and never UNTIL and COUNT together,
102
- * and the parts RFC 5545 forbids for a frequency (BYWEEKNO but YEARLY, BYYEARDAY with DAILY, WEEKLY
103
- * or MONTHLY, BYMONTHDAY with WEEKLY, a numbered BYDAY but MONTHLY or YEARLY) are refused. The
104
- * numeric BY lists come back in ascending order (sortRuleParts).
94
+ * A recurrence rule in ical.js's canonical spelling, or `null`. ical.js is too lenient (it drops
95
+ * unknown parts, lets a repeated part win, reads `COUNT=3X` as 3 and `COUNT=0` as none), so every
96
+ * part must be RFC 5545's, appear once and match its grammar, with FREQ present, never UNTIL with
97
+ * COUNT, and no part RFC 5545 forbids for the frequency. Numeric BY lists come back sorted
98
+ * (sortRuleParts).
105
99
  */
106
100
  export declare function canonicalRecurrenceRule(rule: string): string | null;
107
101
  /**
108
- * A rule Slotlock books from an agent: valid as RFC 5545 writes it, daily or less often, and able to
109
- * occur. ical.js searches day by day (or faster) for a DAILY, HOURLY, MINUTELY or SECONDLY rule's
110
- * next occurrence with no limit, so one that can never occur (`BYMONTH=2;BYMONTHDAY=30`), or a
111
- * sub-daily one that rarely does, holds the process forever.
102
+ * A rule Slotlock books from an agent: valid, daily or less often, and able to occur. ical.js
103
+ * searches sub-daily rules step by step with no limit, so one that never occurs
104
+ * (`BYMONTH=2;BYMONTHDAY=30`) would hold the process forever.
112
105
  */
113
106
  export declare function isBookableRecurrenceRule(rule: string): boolean;
114
107
  /** Validate, clone and bound trusted event content before persistence or serialization. */
115
108
  export declare function normalizeCalendarEventContent(input: CalendarEventContent): CalendarEventContent;
116
109
  export declare function normalizeExternalCalendarChange(input: ExternalCalendarChangeInput): ExternalCalendarChange;
117
110
  /**
118
- * Each line of `input` as ical.js 2.2.1's parser takes it, with the parameters it reads there: the
119
- * lines as parse._eachLine unfolds them, read with the design set ical.js picks at the first BEGIN,
120
- * and for a BEGIN line the component it begins. Ends at a line before that BEGIN, where ical.js
121
- * throws. ical.js changes its design set in one other place: a VCARD component's first property
122
- * (unless it is VERSION:4.0) moves it to vCard 3's for the rest of the feed. This does not follow
123
- * that move; boundPropertyHeads refuses a feed with a VCARD instead. With `limits`, a line's count
124
- * stops once it is past them. Exported for the tests, which hold it to ical.js's own reading.
111
+ * Each line of `input` as ical.js 2.2.1's parser takes it, with the parameters it reads there
112
+ * (parse._eachLine, with the design set picked at the first BEGIN), and for a BEGIN line the
113
+ * component. Stops before the first BEGIN, where ical.js throws. Does not follow a VCARD's switch
114
+ * to vCard 3 (boundPropertyHeads refuses those). With `limits`, a line's count stops once past
115
+ * them. Exported for the tests.
125
116
  */
126
117
  export declare function icalendarPropertyHeads(input: string, limits?: HeadLimits): Generator<{
127
118
  line: string;
@@ -135,12 +126,11 @@ interface HeadLimits {
135
126
  end: number;
136
127
  }
137
128
  /**
138
- * How many parameters ical.js 2.2.1 reads on one unfolded line and where it stops reading them
139
- * (parse._handleContentLine, then parse._parseParameters, step for step): a `"` opens a quoted value
140
- * only straight after `=`, a quoted value of a parameter that takes several (MEMBER, DELEGATED-TO)
141
- * goes on past `","`, and a `:` ends the parameters only where ical.js looks for one. ical.js throws
142
- * where this stops early (an empty name, an unclosed quote), and stops once past `limits` if given.
143
- * Exported for the tests, which hold it to ical.js's own count.
129
+ * How many parameters ical.js 2.2.1 reads on one unfolded line and where it stops
130
+ * (parse._handleContentLine, then _parseParameters, step for step): a `"` opens a quoted value only
131
+ * right after `=`, a multi-valued parameter (MEMBER, DELEGATED-TO) continues past `","`, and `:`
132
+ * ends the parameters only where ical.js looks for one. Stops early where ical.js throws, and past
133
+ * `limits` if given. Exported for the tests.
144
134
  */
145
135
  export declare function icalendarPropertyHead(line: string, params: Record<string, {
146
136
  multiValue?: string;
@@ -150,9 +140,9 @@ export declare function icalendarPropertyHead(line: string, params: Record<strin
150
140
  };
151
141
  /**
152
142
  * Parse VEVENTs with the standards library; event content is deliberately discarded. All or
153
- * nothing: a series Slotlock cannot read refuses the whole calendar, so a caller that reads the
154
- * result as the calendar's busy time never takes a refused series' time as free. To keep the rest
155
- * of a calendar when one series is refused, use parseICalendarFeed.
143
+ * nothing: a series Slotlock cannot read refuses the whole calendar, so a caller reading the result
144
+ * as busy time never takes its time as free. parseICalendarFeed keeps the rest of the calendar
145
+ * instead.
156
146
  */
157
147
  export declare function parseICalendarChanges(input: string, calendarTimezone?: string, expansionWindow?: ICalendarExpansionWindow): ExternalCalendarChange[];
158
148
  /** A series a feed holds that Slotlock refused to read, by its UID. */
@@ -169,11 +159,10 @@ export interface ICalendarFeedRead {
169
159
  refused: ICalendarSeriesRefusal[];
170
160
  }
171
161
  /**
172
- * parseICalendarChanges, refusing one series at a time: a series Slotlock cannot read (a rule
173
- * shape ical.js expands wrongly, an event whose end the clocks move before its start, DTEND with
174
- * DURATION, or one that needs more than its budget) is named in `refused` and the rest of the
175
- * calendar is read. A calendar that is not one (its size, its time zones, a missing UID, a window
176
- * past 367 days) is still refused whole, with CalendarContractError.
162
+ * parseICalendarChanges, refusing one series at a time: a series Slotlock cannot read (a
163
+ * misexpanded rule shape, an end the clocks move before its start, DTEND with DURATION, or over
164
+ * budget) is named in `refused` and the rest is read. A calendar that is not one (size, time zones,
165
+ * a missing UID, a window over 367 days) is still refused whole, with CalendarContractError.
177
166
  */
178
167
  export declare function parseICalendarFeed(input: string, calendarTimezone?: string, expansionWindow?: ICalendarExpansionWindow): ICalendarFeedRead;
179
168
  /** Deterministic RFC 5545 + iTIP payload, validated by the installed ical.js implementation. */
@@ -181,10 +170,9 @@ export declare function emitITipCalendar(input: ICalendarEvent, method: ITipMeth
181
170
  /** Backwards-compatible feed helper. Cancellation maps to iTIP CANCEL. */
182
171
  export declare function emitICalendar(input: ICalendarEvent): string;
183
172
  /**
184
- * Parse full, trusted event content. This is intentionally a different API from
185
- * parseICalendarChanges, whose return shape can never carry summaries, participants or notes.
186
- * All-day (DATE) events are converted to local-midnight bounds in the calendar's timezone: the
187
- * `calendarTimezone` argument, else the feed's X-WR-TIMEZONE; with neither they are refused.
173
+ * Parse full, trusted event content: deliberately a different API from parseICalendarChanges, whose
174
+ * result can never carry summaries, participants or notes. All-day events become local-midnight
175
+ * bounds in `calendarTimezone`, else X-WR-TIMEZONE; with neither they are refused.
188
176
  */
189
177
  export declare function parseTrustedICalendarEvents(input: string, calendarTimezone?: string): TrustedICalendarEvent[];
190
178
  /**
@@ -193,16 +181,16 @@ export declare function parseTrustedICalendarEvents(input: string, calendarTimez
193
181
  */
194
182
  export declare function expandCalendarEventOccurrences(input: CalendarEventContent, window: ICalendarExpansionWindow): CalendarEventOccurrence[];
195
183
  /**
196
- * The same expansion for a stored series as maintenance rolls it, within FEED_LIMITS: twice what it
197
- * was written within, so a series accepted once keeps rolling as its search grows.
184
+ * The same expansion for a stored series as maintenance rolls it, within FEED_LIMITS (more than a
185
+ * write gets), so a series accepted once keeps rolling as its search grows.
198
186
  */
199
187
  export declare function expandStoredCalendarEventOccurrences(input: CalendarEventContent, window: ICalendarExpansionWindow): CalendarEventOccurrence[];
200
188
  /**
201
- * Expand a stored series, resuming from the cursor its last expansion left when that cursor can
202
- * vouch for everything it skips, and leave a cursor for the next. Within FEED_LIMITS as maintenance
203
- * rolls it (`stored`), or EVENT_LIMITS as it is written. Whatever a cursor cannot serve (another
204
- * rule, start, zone or ical.js; a window starting before it; a longer event or an exception that
205
- * could reach the window from before it; anything malformed) is searched from the series' start.
189
+ * Expand a stored series, resuming from its last cursor when that cursor can vouch for everything
190
+ * it skips, and leave a cursor for the next. Within FEED_LIMITS when maintenance rolls it
191
+ * (`stored`), else EVENT_LIMITS. Anything a cursor cannot serve (other rule, start, zone or
192
+ * ical.js; a window before it; something that could reach the window from before it; malformed) is
193
+ * searched from the start.
206
194
  */
207
195
  export declare function expandCalendarEventSeries(input: CalendarEventContent, window: ICalendarExpansionWindow, options: {
208
196
  cursor: unknown;
@@ -211,12 +199,9 @@ export declare function expandCalendarEventSeries(input: CalendarEventContent, w
211
199
  resumeOnly?: boolean;
212
200
  }): CalendarSeriesExpansion;
213
201
  /**
214
- * Why this Slotlock refuses an event an earlier one stored, in words, or null when it expands it.
215
- * Maintenance counts such a series as refused on every roll and leaves it its old coverage: a rule
216
- * shape ical.js expands wrongly (recurrenceRuleProblem), COUNT with a yearly day some years lack, a
217
- * rule it no longer stores at all, or exceptions that name no occurrence (searched from the series'
218
- * start to the last of them, within a roll's budget). It writes nothing, so it can be run over
219
- * stored events before an upgrade.
202
+ * Why this Slotlock refuses an event an earlier one stored, or null. Maintenance counts such a
203
+ * series as refused on every roll and leaves its old coverage. Writes nothing, so it can be run
204
+ * over stored events before an upgrade.
220
205
  */
221
206
  export declare function storedCalendarEventProblem(event: CalendarEventContent): string | null;
222
207
  export {};