slotlock 0.1.1 → 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.
Files changed (56) hide show
  1. package/CHANGELOG.md +455 -0
  2. package/CONTRIBUTING.md +55 -19
  3. package/GOVERNANCE.md +4 -2
  4. package/MAINTAINERS.md +3 -2
  5. package/NOTICE +4 -4
  6. package/README.md +403 -103
  7. package/SECURITY.md +70 -5
  8. package/SPEC.md +161 -21
  9. package/agent-server.d.ts +76 -10
  10. package/agent-server.js +381 -146
  11. package/agent-store-backend.d.ts +22 -0
  12. package/agent-store-backend.js +598 -24
  13. package/api-keys.d.ts +22 -7
  14. package/api-keys.js +38 -8
  15. package/application-api.d.ts +67 -0
  16. package/application-api.js +552 -0
  17. package/config.d.ts +93 -0
  18. package/config.js +192 -0
  19. package/dashboard.d.ts +10 -1
  20. package/dashboard.js +23 -5
  21. package/ddl.d.ts +47 -4
  22. package/ddl.js +679 -25
  23. package/engine.js +20 -6
  24. package/event-schema.d.ts +59 -0
  25. package/event-schema.js +85 -0
  26. package/hooks.d.ts +7 -0
  27. package/hooks.js +13 -0
  28. package/ical-worker-thread.js +4 -2
  29. package/ical-worker.d.ts +8 -5
  30. package/ical-worker.js +9 -2
  31. package/index.d.ts +12 -8
  32. package/index.js +7 -5
  33. package/maintenance.d.ts +67 -0
  34. package/maintenance.js +213 -0
  35. package/node-server.d.ts +9 -1
  36. package/node-server.js +127 -6
  37. package/openapi.json +6024 -0
  38. package/package.json +3 -2
  39. package/rate-limit.d.ts +71 -0
  40. package/rate-limit.js +718 -0
  41. package/rest-api.d.ts +33 -18
  42. package/rest-api.js +141 -63
  43. package/rules.d.ts +19 -0
  44. package/rules.js +38 -7
  45. package/self-host.d.ts +26 -9
  46. package/self-host.js +427 -47
  47. package/slotlock-manifest.schema.json +6 -1
  48. package/slotlock.manifest.json +7 -2
  49. package/store.d.ts +359 -27
  50. package/store.js +2077 -296
  51. package/sync.d.ts +43 -2
  52. package/sync.js +1950 -277
  53. package/timezone.d.ts +77 -3
  54. package/timezone.js +265 -21
  55. package/types.d.ts +217 -10
  56. package/weekly-hours.js +2 -2
package/sync.d.ts CHANGED
@@ -89,13 +89,19 @@ export declare class CalendarContractError extends Error {
89
89
  export declare class CalendarExpansionLimitError extends CalendarContractError {
90
90
  constructor();
91
91
  }
92
+ /**
93
+ * Why Slotlock refuses `rule`, in words, or null when it expands it: not RFC 5545 §3.3.10 as
94
+ * canonicalRecurrenceRule reads it, or a shape ical.js expands wrongly (recurShapeProblem).
95
+ */
96
+ export declare function recurrenceRuleProblem(rule: string): string | null;
92
97
  /**
93
98
  * A recurrence rule as RFC 5545 §3.3.10 writes it, in ical.js's canonical spelling, or `null`.
94
99
  * ical.js accepts more than it should: it drops unknown parts, lets a repeated part replace the
95
100
  * first, reads `COUNT=3X` as 3 and `COUNT=0` as no count at all. So every part must be one RFC 5545
96
101
  * names, appear once and match its grammar, with FREQ present and never UNTIL and COUNT together,
97
102
  * and the parts RFC 5545 forbids for a frequency (BYWEEKNO but YEARLY, BYYEARDAY with DAILY, WEEKLY
98
- * or MONTHLY, BYMONTHDAY with WEEKLY, a numbered BYDAY but MONTHLY or YEARLY) are refused.
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).
99
105
  */
100
106
  export declare function canonicalRecurrenceRule(rule: string): string | null;
101
107
  /**
@@ -142,8 +148,34 @@ export declare function icalendarPropertyHead(line: string, params: Record<strin
142
148
  parameters: number;
143
149
  end: number;
144
150
  };
145
- /** Parse VEVENTs with the standards library; event content is deliberately discarded. */
151
+ /**
152
+ * 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.
156
+ */
146
157
  export declare function parseICalendarChanges(input: string, calendarTimezone?: string, expansionWindow?: ICalendarExpansionWindow): ExternalCalendarChange[];
158
+ /** A series a feed holds that Slotlock refused to read, by its UID. */
159
+ export interface ICalendarSeriesRefusal {
160
+ uid: string;
161
+ code: CalendarContractError['code'];
162
+ /** Set when the series needs more work than Slotlock spends (CalendarExpansionLimitError). */
163
+ limit?: true;
164
+ }
165
+ /** What parseICalendarFeed read: every series it could, and the ones it refused. */
166
+ export interface ICalendarFeedRead {
167
+ changes: ExternalCalendarChange[];
168
+ /** Their time is not known: treat it as busy, or the feed's coverage as incomplete. */
169
+ refused: ICalendarSeriesRefusal[];
170
+ }
171
+ /**
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.
177
+ */
178
+ export declare function parseICalendarFeed(input: string, calendarTimezone?: string, expansionWindow?: ICalendarExpansionWindow): ICalendarFeedRead;
147
179
  /** Deterministic RFC 5545 + iTIP payload, validated by the installed ical.js implementation. */
148
180
  export declare function emitITipCalendar(input: ICalendarEvent, method: ITipMethod): string;
149
181
  /** Backwards-compatible feed helper. Cancellation maps to iTIP CANCEL. */
@@ -178,4 +210,13 @@ export declare function expandCalendarEventSeries(input: CalendarEventContent, w
178
210
  /** Refuse (CalendarExpansionLimitError) instead of searching from the start without a cursor. */
179
211
  resumeOnly?: boolean;
180
212
  }): CalendarSeriesExpansion;
213
+ /**
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.
220
+ */
221
+ export declare function storedCalendarEventProblem(event: CalendarEventContent): string | null;
181
222
  export {};