@miguelarios/cal-mcp 0.9.0 → 0.11.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/CHANGELOG.md +14 -0
- package/README.md +32 -26
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -1
- package/dist/main.js.map +1 -1
- package/dist/services/CalDavService.d.ts +1 -1
- package/dist/services/CalDavService.d.ts.map +1 -1
- package/dist/services/CalDavService.js +21 -12
- package/dist/services/CalDavService.js.map +1 -1
- package/dist/tools/calendarTools.d.ts.map +1 -1
- package/dist/tools/calendarTools.js +74 -60
- package/dist/tools/calendarTools.js.map +1 -1
- package/package.json +3 -5
- package/cal-mcp-tools.json +0 -322
- package/dist/ical.d.ts +0 -101
- package/dist/ical.d.ts.map +0 -1
- package/dist/ical.js +0 -563
- package/dist/ical.js.map +0 -1
package/dist/ical.js
DELETED
|
@@ -1,563 +0,0 @@
|
|
|
1
|
-
import { formatInTimezone } from "@miguelarios/pim-core";
|
|
2
|
-
import ical, { ICalAlarmType, ICalEventStatus, ICalEventTransparency } from "ical-generator";
|
|
3
|
-
import nodeIcal from "node-ical";
|
|
4
|
-
// Validate an RRULE string per RFC 5545. Accepts either the raw rule
|
|
5
|
-
// ("FREQ=WEEKLY;BYDAY=MO") or a prefixed form ("RRULE:FREQ=WEEKLY;BYDAY=MO").
|
|
6
|
-
// Returns the normalized raw rule (no RRULE: prefix), or null if invalid.
|
|
7
|
-
export function normalizeRecurrenceRule(rule) {
|
|
8
|
-
if (typeof rule !== "string")
|
|
9
|
-
return null;
|
|
10
|
-
let trimmed = rule.trim();
|
|
11
|
-
if (!trimmed)
|
|
12
|
-
return null;
|
|
13
|
-
if (/^RRULE:/i.test(trimmed))
|
|
14
|
-
trimmed = trimmed.slice(6).trim();
|
|
15
|
-
// Must contain FREQ= with a valid frequency
|
|
16
|
-
const freqMatch = trimmed.match(/(?:^|;)FREQ=([A-Z]+)(?:;|$)/);
|
|
17
|
-
if (!freqMatch)
|
|
18
|
-
return null;
|
|
19
|
-
const validFreqs = ["SECONDLY", "MINUTELY", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "YEARLY"];
|
|
20
|
-
if (!validFreqs.includes(freqMatch[1]))
|
|
21
|
-
return null;
|
|
22
|
-
// Disallow whitespace and CRLF inside — any would break the ICS line
|
|
23
|
-
if (/[\r\n]/.test(trimmed))
|
|
24
|
-
return null;
|
|
25
|
-
return trimmed;
|
|
26
|
-
}
|
|
27
|
-
const CUTYPE_MAP = {
|
|
28
|
-
INDIVIDUAL: "person",
|
|
29
|
-
ROOM: "room",
|
|
30
|
-
RESOURCE: "resource",
|
|
31
|
-
GROUP: "group",
|
|
32
|
-
};
|
|
33
|
-
function parseDurationToSeconds(duration) {
|
|
34
|
-
const negative = duration.startsWith("-");
|
|
35
|
-
const match = duration.match(/P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?/);
|
|
36
|
-
if (!match)
|
|
37
|
-
return 0;
|
|
38
|
-
const days = Number.parseInt(match[1] || "0", 10);
|
|
39
|
-
const hours = Number.parseInt(match[2] || "0", 10);
|
|
40
|
-
const minutes = Number.parseInt(match[3] || "0", 10);
|
|
41
|
-
const seconds = Number.parseInt(match[4] || "0", 10);
|
|
42
|
-
const total = days * 86400 + hours * 3600 + minutes * 60 + seconds;
|
|
43
|
-
return negative ? -total : total;
|
|
44
|
-
}
|
|
45
|
-
function formatTriggerHuman(seconds) {
|
|
46
|
-
if (seconds === 0)
|
|
47
|
-
return "At time of event";
|
|
48
|
-
const abs = Math.abs(seconds);
|
|
49
|
-
const suffix = seconds < 0 ? "before" : "after";
|
|
50
|
-
const parts = [];
|
|
51
|
-
const days = Math.floor(abs / 86400);
|
|
52
|
-
const hours = Math.floor((abs % 86400) / 3600);
|
|
53
|
-
const minutes = Math.floor((abs % 3600) / 60);
|
|
54
|
-
if (days > 0)
|
|
55
|
-
parts.push(`${days} ${days === 1 ? "day" : "days"}`);
|
|
56
|
-
if (hours > 0)
|
|
57
|
-
parts.push(`${hours} ${hours === 1 ? "hour" : "hours"}`);
|
|
58
|
-
if (minutes > 0)
|
|
59
|
-
parts.push(`${minutes} ${minutes === 1 ? "minute" : "minutes"}`);
|
|
60
|
-
if (parts.length === 0) {
|
|
61
|
-
const secs = abs;
|
|
62
|
-
parts.push(`${secs} ${secs === 1 ? "second" : "seconds"}`);
|
|
63
|
-
}
|
|
64
|
-
return `${parts.join(", ")} ${suffix}`;
|
|
65
|
-
}
|
|
66
|
-
// node-ical + rrule store DTSTART as "wall-clock reinterpreted as UTC" and strip
|
|
67
|
-
// the TZID before passing to rrule. As a result, rrule.between() returns UTC
|
|
68
|
-
// timestamps that do not represent the correct moment of the wall-clock time in
|
|
69
|
-
// the original tzid, and the offset is also not DST-aware. We recompute UTC
|
|
70
|
-
// per-occurrence: take the wall-clock time-of-day from DTSTART (in tzid) and
|
|
71
|
-
// resolve it against each occurrence's date using Intl.
|
|
72
|
-
function getTzOffsetMs(instantMs, tzid) {
|
|
73
|
-
const fmt = new Intl.DateTimeFormat("en-US", {
|
|
74
|
-
timeZone: tzid,
|
|
75
|
-
timeZoneName: "shortOffset",
|
|
76
|
-
});
|
|
77
|
-
const parts = fmt.formatToParts(new Date(instantMs));
|
|
78
|
-
const name = parts.find((p) => p.type === "timeZoneName")?.value ?? "GMT+0";
|
|
79
|
-
const m = name.match(/GMT([+-])(\d{1,2})(?::?(\d{2}))?/);
|
|
80
|
-
if (!m)
|
|
81
|
-
return 0;
|
|
82
|
-
const sign = m[1] === "-" ? -1 : 1;
|
|
83
|
-
const hh = Number.parseInt(m[2], 10);
|
|
84
|
-
const mm = m[3] ? Number.parseInt(m[3], 10) : 0;
|
|
85
|
-
return sign * (hh * 3600000 + mm * 60000);
|
|
86
|
-
}
|
|
87
|
-
function wallClockInTzToUtc(year, month1, day, hour, minute, second, tzid) {
|
|
88
|
-
const guess = Date.UTC(year, month1 - 1, day, hour, minute, second);
|
|
89
|
-
const offsetMs = getTzOffsetMs(guess, tzid);
|
|
90
|
-
return new Date(guess - offsetMs);
|
|
91
|
-
}
|
|
92
|
-
function extractWallClockInTz(instant, tzid) {
|
|
93
|
-
const fmt = new Intl.DateTimeFormat("en-US", {
|
|
94
|
-
timeZone: tzid,
|
|
95
|
-
hour: "2-digit",
|
|
96
|
-
minute: "2-digit",
|
|
97
|
-
second: "2-digit",
|
|
98
|
-
hour12: false,
|
|
99
|
-
});
|
|
100
|
-
const parts = Object.fromEntries(fmt.formatToParts(instant).map((p) => [p.type, p.value]));
|
|
101
|
-
const hourRaw = parts.hour === "24" ? "0" : parts.hour;
|
|
102
|
-
return {
|
|
103
|
-
hour: Number.parseInt(hourRaw, 10),
|
|
104
|
-
minute: Number.parseInt(parts.minute, 10),
|
|
105
|
-
second: Number.parseInt(parts.second, 10),
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
function correctOccurrenceUtc(rawOcc, dtstart, tzid) {
|
|
109
|
-
if (!tzid)
|
|
110
|
-
return rawOcc;
|
|
111
|
-
const wall = extractWallClockInTz(dtstart, tzid);
|
|
112
|
-
return wallClockInTzToUtc(rawOcc.getUTCFullYear(), rawOcc.getUTCMonth() + 1, rawOcc.getUTCDate(), wall.hour, wall.minute, wall.second, tzid);
|
|
113
|
-
}
|
|
114
|
-
// Extract the raw wall-clock time-of-day and tzid from a VEVENT's DTSTART line
|
|
115
|
-
// in the raw ICS, keyed by UID. This bypasses node-ical's TZID interpretation,
|
|
116
|
-
// which differs across Node builds/container tzdata and produces wrong UTC
|
|
117
|
-
// instants for recurring events when resolution fails silently.
|
|
118
|
-
export function extractDtstartWallClockFromIcs(icsContent, uid) {
|
|
119
|
-
if (!icsContent || !uid)
|
|
120
|
-
return null;
|
|
121
|
-
// Unfold ICS line folding (RFC 5545: continuation lines start with space/tab)
|
|
122
|
-
const unfolded = icsContent.replace(/\r?\n[ \t]/g, "");
|
|
123
|
-
// Find each VEVENT block and match the one whose UID equals the target.
|
|
124
|
-
// Escape regex metacharacters in uid for safety.
|
|
125
|
-
const escapedUid = uid.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
126
|
-
const veventRe = /BEGIN:VEVENT\r?\n[\s\S]*?END:VEVENT/g;
|
|
127
|
-
const uidLineRe = new RegExp(`^UID:${escapedUid}\\s*$`, "m");
|
|
128
|
-
const blocks = unfolded.match(veventRe) ?? [];
|
|
129
|
-
const block = blocks.find((b) => uidLineRe.test(b));
|
|
130
|
-
if (!block)
|
|
131
|
-
return null;
|
|
132
|
-
// DTSTART line, with optional TZID param. Match only the first (master) DTSTART
|
|
133
|
-
// — exception VEVENTs have RECURRENCE-ID but still just one DTSTART each.
|
|
134
|
-
const m = block.match(/^DTSTART(?:;[^:\r\n]*?TZID=([^:;\r\n]+))?[^:\r\n]*:(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})/m);
|
|
135
|
-
if (!m)
|
|
136
|
-
return null;
|
|
137
|
-
return {
|
|
138
|
-
tzid: m[1],
|
|
139
|
-
hour: Number.parseInt(m[5], 10),
|
|
140
|
-
minute: Number.parseInt(m[6], 10),
|
|
141
|
-
second: Number.parseInt(m[7], 10),
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
// Extract EXDATE UTC instants from a VEVENT in the raw ICS, resolving each one
|
|
145
|
-
// through the same wallClockInTzToUtc pipeline as occurrence expansion so the
|
|
146
|
-
// returned millis align exactly with occurrence millis (enabling Set lookup).
|
|
147
|
-
// Handles: EXDATE with TZID, UTC (Z-suffixed), floating, VALUE=DATE (all-day),
|
|
148
|
-
// comma-separated values, and multiple EXDATE lines per VEVENT.
|
|
149
|
-
export function extractExdatesFromIcs(icsContent, uid) {
|
|
150
|
-
const result = new Set();
|
|
151
|
-
if (!icsContent || !uid)
|
|
152
|
-
return result;
|
|
153
|
-
const unfolded = icsContent.replace(/\r?\n[ \t]/g, "");
|
|
154
|
-
const escapedUid = uid.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
155
|
-
const veventRe = /BEGIN:VEVENT\r?\n[\s\S]*?END:VEVENT/g;
|
|
156
|
-
const uidLineRe = new RegExp(`^UID:${escapedUid}\\s*$`, "m");
|
|
157
|
-
const blocks = unfolded.match(veventRe) ?? [];
|
|
158
|
-
const block = blocks.find((b) => uidLineRe.test(b));
|
|
159
|
-
if (!block)
|
|
160
|
-
return result;
|
|
161
|
-
const exdateLineRe = /^EXDATE(?:;([^:\r\n]+))?:([^\r\n]+)/gm;
|
|
162
|
-
for (const match of block.matchAll(exdateLineRe)) {
|
|
163
|
-
const paramsStr = match[1] ?? "";
|
|
164
|
-
const valuesStr = match[2];
|
|
165
|
-
const tzidMatch = paramsStr.match(/TZID=([^;]+)/);
|
|
166
|
-
const isDateOnly = /VALUE=DATE(?!-TIME)/.test(paramsStr);
|
|
167
|
-
const tzid = tzidMatch?.[1];
|
|
168
|
-
for (const raw of valuesStr.split(",")) {
|
|
169
|
-
const v = raw.trim();
|
|
170
|
-
if (!v)
|
|
171
|
-
continue;
|
|
172
|
-
if (isDateOnly) {
|
|
173
|
-
const m = v.match(/^(\d{4})(\d{2})(\d{2})$/);
|
|
174
|
-
if (!m)
|
|
175
|
-
continue;
|
|
176
|
-
// All-day: UTC midnight matches how node-ical/rrule represent all-day occurrences
|
|
177
|
-
const ms = Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3]));
|
|
178
|
-
result.add(ms);
|
|
179
|
-
continue;
|
|
180
|
-
}
|
|
181
|
-
const m = v.match(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(Z)?$/);
|
|
182
|
-
if (!m)
|
|
183
|
-
continue;
|
|
184
|
-
const [, y, mo, d, h, mi, s, z] = m;
|
|
185
|
-
if (z === "Z") {
|
|
186
|
-
result.add(Date.UTC(+y, +mo - 1, +d, +h, +mi, +s));
|
|
187
|
-
}
|
|
188
|
-
else if (tzid) {
|
|
189
|
-
result.add(wallClockInTzToUtc(+y, +mo, +d, +h, +mi, +s, tzid).getTime());
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
// Floating time (no TZID, no Z) — treat wall-clock as UTC to match
|
|
193
|
-
// rrule's internal representation. Rare in practice.
|
|
194
|
-
result.add(Date.UTC(+y, +mo - 1, +d, +h, +mi, +s));
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return result;
|
|
199
|
-
}
|
|
200
|
-
function parseAlarm(alarm) {
|
|
201
|
-
const raw = alarm.trigger;
|
|
202
|
-
// Absolute trigger: node-ical returns an object with params.VALUE = "DATE-TIME" and a val string
|
|
203
|
-
if (raw !== null && typeof raw === "object") {
|
|
204
|
-
const obj = raw;
|
|
205
|
-
const val = obj.val ?? "";
|
|
206
|
-
const date = new Date(val.replace(/(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z?/, "$1-$2-$3T$4:$5:$6Z"));
|
|
207
|
-
return {
|
|
208
|
-
type: "absolute",
|
|
209
|
-
trigger: date.toISOString(),
|
|
210
|
-
trigger_human: date.toISOString(),
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
const trigger = String(raw);
|
|
214
|
-
// Relative trigger: duration string like -PT15M
|
|
215
|
-
const seconds = parseDurationToSeconds(trigger);
|
|
216
|
-
return {
|
|
217
|
-
type: "relative",
|
|
218
|
-
trigger: seconds,
|
|
219
|
-
trigger_human: formatTriggerHuman(seconds),
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
export function parseIcsEvents(icsContent, range, timezone) {
|
|
223
|
-
if (!icsContent.trim())
|
|
224
|
-
return [];
|
|
225
|
-
const formatTime = (isoString) => {
|
|
226
|
-
return timezone ? formatInTimezone(isoString, timezone) : isoString;
|
|
227
|
-
};
|
|
228
|
-
const parsed = nodeIcal.parseICS(icsContent);
|
|
229
|
-
const events = [];
|
|
230
|
-
for (const component of Object.values(parsed)) {
|
|
231
|
-
if (component.type !== "VEVENT")
|
|
232
|
-
continue;
|
|
233
|
-
const vevent = component;
|
|
234
|
-
const attendees = [];
|
|
235
|
-
if (vevent.attendee) {
|
|
236
|
-
const attendeeList = Array.isArray(vevent.attendee) ? vevent.attendee : [vevent.attendee];
|
|
237
|
-
for (const att of attendeeList) {
|
|
238
|
-
// RFC 5545: the mailto: URI scheme is case-insensitive. ical-generator
|
|
239
|
-
// emits uppercase "MAILTO:" which leaked past a case-sensitive strip.
|
|
240
|
-
const email = typeof att === "string"
|
|
241
|
-
? att.replace(/^mailto:/i, "")
|
|
242
|
-
: (att.val || "").replace(/^mailto:/i, "");
|
|
243
|
-
const name = typeof att === "string" ? null : (att.params?.CN ?? null);
|
|
244
|
-
const status = typeof att === "string" ? null : (att.params?.PARTSTAT?.toLowerCase() ?? null);
|
|
245
|
-
const role = typeof att === "string" ? null : (att.params?.ROLE?.toLowerCase() ?? null);
|
|
246
|
-
const cutype = typeof att === "string" ? "unknown" : (CUTYPE_MAP[att.params?.CUTYPE ?? ""] ?? "unknown");
|
|
247
|
-
attendees.push({ email, name, status, role, type: cutype });
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
let organizer = null;
|
|
251
|
-
if (vevent.organizer) {
|
|
252
|
-
const org = vevent.organizer;
|
|
253
|
-
organizer = {
|
|
254
|
-
email: (typeof org === "string" ? org : org.val || "").replace(/^mailto:/i, ""),
|
|
255
|
-
name: typeof org === "string" ? null : (org.params?.CN ?? null),
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
// Map transparency to availability
|
|
259
|
-
const rawTransparency = vevent.transparency?.toUpperCase();
|
|
260
|
-
let availability = null;
|
|
261
|
-
if (rawTransparency === "OPAQUE")
|
|
262
|
-
availability = "busy";
|
|
263
|
-
else if (rawTransparency === "TRANSPARENT")
|
|
264
|
-
availability = "free";
|
|
265
|
-
// Detect all-day: node-ical sets datetype to "date" for VALUE=DATE
|
|
266
|
-
const allDay = vevent.datetype === "date";
|
|
267
|
-
// Extract VALARM alarms
|
|
268
|
-
const alarms = [];
|
|
269
|
-
if (vevent.alarms) {
|
|
270
|
-
for (const alarm of vevent.alarms) {
|
|
271
|
-
alarms.push(parseAlarm(alarm));
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
// Parse CATEGORIES
|
|
275
|
-
const rawCategories = vevent.categories;
|
|
276
|
-
let categories = [];
|
|
277
|
-
if (rawCategories) {
|
|
278
|
-
if (Array.isArray(rawCategories)) {
|
|
279
|
-
categories = rawCategories.flatMap((c) => (Array.isArray(c) ? c : [c]));
|
|
280
|
-
}
|
|
281
|
-
else if (typeof rawCategories === "string") {
|
|
282
|
-
categories = [rawCategories];
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
// Parse GEO — node-ical silently coerces GEO:; (empty) to {lat:0, lon:0},
|
|
286
|
-
// so reject the 0,0 sentinel to avoid false positives from malformed values.
|
|
287
|
-
const rawGeo = vevent.geo;
|
|
288
|
-
let geo = null;
|
|
289
|
-
if (rawGeo &&
|
|
290
|
-
typeof rawGeo.lat === "number" &&
|
|
291
|
-
typeof rawGeo.lon === "number" &&
|
|
292
|
-
!Number.isNaN(rawGeo.lat) &&
|
|
293
|
-
!Number.isNaN(rawGeo.lon) &&
|
|
294
|
-
(rawGeo.lat !== 0 || rawGeo.lon !== 0)) {
|
|
295
|
-
geo = { latitude: rawGeo.lat, longitude: rawGeo.lon };
|
|
296
|
-
}
|
|
297
|
-
// Build base properties shared by all occurrences
|
|
298
|
-
const baseProps = {
|
|
299
|
-
uid: vevent.uid || "",
|
|
300
|
-
title: vevent.summary || "",
|
|
301
|
-
all_day: allDay,
|
|
302
|
-
location: vevent.location ?? null,
|
|
303
|
-
description: vevent.description ?? null,
|
|
304
|
-
status: vevent.status ? vevent.status.toLowerCase() : null,
|
|
305
|
-
availability,
|
|
306
|
-
url: vevent.url ?? null,
|
|
307
|
-
attendees: attendees.length > 0 ? attendees : [],
|
|
308
|
-
organizer: organizer ?? null,
|
|
309
|
-
recurrence_rule: vevent.rrule?.toString() ?? null,
|
|
310
|
-
created: vevent.created ? formatTime(new Date(vevent.created).toISOString()) : null,
|
|
311
|
-
last_modified: vevent.lastmodified
|
|
312
|
-
? formatTime(new Date(vevent.lastmodified).toISOString())
|
|
313
|
-
: null,
|
|
314
|
-
is_recurring: !!vevent.rrule,
|
|
315
|
-
alarms,
|
|
316
|
-
categories,
|
|
317
|
-
geo,
|
|
318
|
-
};
|
|
319
|
-
// Expand recurring events into occurrences within the requested range
|
|
320
|
-
if (vevent.rrule && range && typeof vevent.rrule.between === "function") {
|
|
321
|
-
const originalStart = new Date(vevent.start);
|
|
322
|
-
const originalEnd = new Date(vevent.end);
|
|
323
|
-
const duration = originalEnd.getTime() - originalStart.getTime();
|
|
324
|
-
// Prefer the raw DTSTART from the ICS so TZID resolution is deterministic
|
|
325
|
-
// across Node builds/container tzdata. Fall back to node-ical's parsed
|
|
326
|
-
// tz only if the raw extraction fails (e.g., unusual ICS shape).
|
|
327
|
-
const raw = extractDtstartWallClockFromIcs(icsContent, vevent.uid || "");
|
|
328
|
-
const tzid = raw?.tzid ?? vevent.start.tz;
|
|
329
|
-
const exdateMs = extractExdatesFromIcs(icsContent, vevent.uid || "");
|
|
330
|
-
const occurrences = vevent.rrule.between(new Date(range.start), new Date(range.end), true);
|
|
331
|
-
for (const rawOcc of occurrences) {
|
|
332
|
-
const occStart = raw?.tzid
|
|
333
|
-
? wallClockInTzToUtc(rawOcc.getUTCFullYear(), rawOcc.getUTCMonth() + 1, rawOcc.getUTCDate(), raw.hour, raw.minute, raw.second, raw.tzid)
|
|
334
|
-
: correctOccurrenceUtc(rawOcc, originalStart, tzid);
|
|
335
|
-
// Skip cancelled occurrences (EXDATE). Compared on exact UTC millis
|
|
336
|
-
// because EXDATEs are resolved through the same pipeline above.
|
|
337
|
-
if (exdateMs.has(occStart.getTime()))
|
|
338
|
-
continue;
|
|
339
|
-
const occEnd = new Date(occStart.getTime() + duration);
|
|
340
|
-
events.push({
|
|
341
|
-
...baseProps,
|
|
342
|
-
start: formatTime(occStart.toISOString()),
|
|
343
|
-
end: formatTime(occEnd.toISOString()),
|
|
344
|
-
occurrence_date: formatTime(occStart.toISOString()),
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
else {
|
|
349
|
-
// Non-recurring, or no range provided — return as-is
|
|
350
|
-
// Detect RECURRENCE-ID for exception VEVENTs (node-ical exposes it as a Date)
|
|
351
|
-
const recurrenceId = vevent.recurrenceid;
|
|
352
|
-
const occDate = recurrenceId ? formatTime(new Date(recurrenceId).toISOString()) : null;
|
|
353
|
-
events.push({
|
|
354
|
-
...baseProps,
|
|
355
|
-
start: vevent.start ? formatTime(new Date(vevent.start).toISOString()) : "",
|
|
356
|
-
end: vevent.end ? formatTime(new Date(vevent.end).toISOString()) : "",
|
|
357
|
-
occurrence_date: occDate,
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
return events;
|
|
362
|
-
}
|
|
363
|
-
export function generateEventIcs(props) {
|
|
364
|
-
const calendar = ical({ name: "cal-mcp" });
|
|
365
|
-
const eventOptions = {
|
|
366
|
-
start: new Date(props.start),
|
|
367
|
-
end: new Date(props.end),
|
|
368
|
-
summary: props.title,
|
|
369
|
-
};
|
|
370
|
-
if (props.all_day)
|
|
371
|
-
eventOptions.allDay = true;
|
|
372
|
-
if (props.location)
|
|
373
|
-
eventOptions.location = props.location;
|
|
374
|
-
if (props.description)
|
|
375
|
-
eventOptions.description = props.description;
|
|
376
|
-
const event = calendar.createEvent(eventOptions);
|
|
377
|
-
event.status(ICalEventStatus.CONFIRMED);
|
|
378
|
-
if (props.uid) {
|
|
379
|
-
event.uid(props.uid);
|
|
380
|
-
}
|
|
381
|
-
if (props.timezone) {
|
|
382
|
-
event.timezone(props.timezone);
|
|
383
|
-
}
|
|
384
|
-
if (props.availability === "free") {
|
|
385
|
-
event.transparency(ICalEventTransparency.TRANSPARENT);
|
|
386
|
-
}
|
|
387
|
-
else if (props.availability === "busy") {
|
|
388
|
-
event.transparency(ICalEventTransparency.OPAQUE);
|
|
389
|
-
}
|
|
390
|
-
if (props.organizer) {
|
|
391
|
-
// ical-generator requires a non-empty CN; fall back to the email local-part.
|
|
392
|
-
const name = props.organizer.name && props.organizer.name.trim().length > 0
|
|
393
|
-
? props.organizer.name
|
|
394
|
-
: props.organizer.email.split("@")[0];
|
|
395
|
-
event.organizer({ email: props.organizer.email, name });
|
|
396
|
-
}
|
|
397
|
-
if (props.attendees) {
|
|
398
|
-
for (const att of props.attendees) {
|
|
399
|
-
// No CN is sent — display name is resolved server-side from the
|
|
400
|
-
// invitee's address book (standard CalDAV behavior).
|
|
401
|
-
event.createAttendee({ email: att.email });
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
if (props.alarms) {
|
|
405
|
-
for (const alarm of props.alarms) {
|
|
406
|
-
if (alarm.type === "relative" && typeof alarm.trigger === "number") {
|
|
407
|
-
event.createAlarm({
|
|
408
|
-
type: ICalAlarmType.display,
|
|
409
|
-
triggerBefore: Math.abs(alarm.trigger),
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
else if (alarm.type === "absolute" && typeof alarm.trigger === "string") {
|
|
413
|
-
event.createAlarm({
|
|
414
|
-
type: ICalAlarmType.display,
|
|
415
|
-
trigger: new Date(alarm.trigger),
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
let icsString = calendar.toString();
|
|
421
|
-
if (props.categories && props.categories.length > 0) {
|
|
422
|
-
const categoriesLine = `CATEGORIES:${props.categories.join(",")}`;
|
|
423
|
-
icsString = icsString.replace("END:VEVENT", `${categoriesLine}\r\nEND:VEVENT`);
|
|
424
|
-
}
|
|
425
|
-
if (props.recurrence_rule) {
|
|
426
|
-
const normalized = normalizeRecurrenceRule(props.recurrence_rule);
|
|
427
|
-
if (!normalized) {
|
|
428
|
-
throw new Error(`Invalid recurrence_rule: ${props.recurrence_rule}`);
|
|
429
|
-
}
|
|
430
|
-
const rruleLine = `RRULE:${normalized}`;
|
|
431
|
-
icsString = icsString.replace("END:VEVENT", `${rruleLine}\r\nEND:VEVENT`);
|
|
432
|
-
}
|
|
433
|
-
return icsString;
|
|
434
|
-
}
|
|
435
|
-
export function createExceptionVevent(masterIcs, occurrenceDate, overrides, allDay) {
|
|
436
|
-
// Parse master to extract base properties
|
|
437
|
-
const masterEvents = parseIcsEvents(masterIcs);
|
|
438
|
-
const master = masterEvents[0];
|
|
439
|
-
if (!master)
|
|
440
|
-
throw new Error("Could not parse master event from ICS");
|
|
441
|
-
const uid = master.uid;
|
|
442
|
-
const date = new Date(occurrenceDate);
|
|
443
|
-
// Format dates for iCal
|
|
444
|
-
const formatIcalDate = (iso, isAllDay) => {
|
|
445
|
-
const d = new Date(iso);
|
|
446
|
-
if (isAllDay)
|
|
447
|
-
return d.toISOString().slice(0, 10).replace(/-/g, "");
|
|
448
|
-
return d
|
|
449
|
-
.toISOString()
|
|
450
|
-
.replace(/[-:]/g, "")
|
|
451
|
-
.replace(/\.\d{3}/, "");
|
|
452
|
-
};
|
|
453
|
-
// Determine effective values (override or inherit)
|
|
454
|
-
const title = overrides.title ?? master.title;
|
|
455
|
-
const location = overrides.location ?? master.location;
|
|
456
|
-
const description = overrides.description ?? master.description;
|
|
457
|
-
const isAllDay = overrides.all_day ?? allDay;
|
|
458
|
-
// For start/end: default to the occurrence's original time (not master's DTSTART)
|
|
459
|
-
const occDuration = new Date(master.end).getTime() - new Date(master.start).getTime();
|
|
460
|
-
const defaultStart = occurrenceDate;
|
|
461
|
-
const defaultEnd = new Date(date.getTime() + occDuration).toISOString();
|
|
462
|
-
const effectiveStart = overrides.start ?? defaultStart;
|
|
463
|
-
const effectiveEnd = overrides.end ?? defaultEnd;
|
|
464
|
-
// Build RECURRENCE-ID line
|
|
465
|
-
const recurrenceId = isAllDay
|
|
466
|
-
? `RECURRENCE-ID;VALUE=DATE:${formatIcalDate(occurrenceDate, true)}`
|
|
467
|
-
: `RECURRENCE-ID:${formatIcalDate(occurrenceDate, false)}`;
|
|
468
|
-
// Build DTSTART/DTEND lines
|
|
469
|
-
const dtstart = isAllDay
|
|
470
|
-
? `DTSTART;VALUE=DATE:${formatIcalDate(effectiveStart, true)}`
|
|
471
|
-
: `DTSTART:${formatIcalDate(effectiveStart, false)}`;
|
|
472
|
-
const dtend = isAllDay
|
|
473
|
-
? `DTEND;VALUE=DATE:${formatIcalDate(effectiveEnd, true)}`
|
|
474
|
-
: `DTEND:${formatIcalDate(effectiveEnd, false)}`;
|
|
475
|
-
// Extract SEQUENCE from master (default 0), increment
|
|
476
|
-
const seqMatch = masterIcs.match(/SEQUENCE:(\d+)/);
|
|
477
|
-
const sequence = (seqMatch ? Number.parseInt(seqMatch[1], 10) : 0) + 1;
|
|
478
|
-
const lines = [
|
|
479
|
-
"BEGIN:VEVENT",
|
|
480
|
-
`UID:${uid}`,
|
|
481
|
-
recurrenceId,
|
|
482
|
-
dtstart,
|
|
483
|
-
dtend,
|
|
484
|
-
`SEQUENCE:${sequence}`,
|
|
485
|
-
`SUMMARY:${title}`,
|
|
486
|
-
];
|
|
487
|
-
if (location)
|
|
488
|
-
lines.push(`LOCATION:${location}`);
|
|
489
|
-
if (description)
|
|
490
|
-
lines.push(`DESCRIPTION:${description}`);
|
|
491
|
-
// ORGANIZER — required by RFC 5545 when ATTENDEE is present, and strict
|
|
492
|
-
// CalDAV servers (SOGo/mailbox.org) reject PUTs without it with 412.
|
|
493
|
-
// Prefer explicit override, then master's existing organizer, then caller-
|
|
494
|
-
// supplied fallback (tool layer passes the account owner).
|
|
495
|
-
const organizer = overrides.organizer ?? master.organizer ?? null;
|
|
496
|
-
if (organizer) {
|
|
497
|
-
const name = organizer.name && organizer.name.trim().length > 0
|
|
498
|
-
? organizer.name
|
|
499
|
-
: organizer.email.split("@")[0];
|
|
500
|
-
lines.push(`ORGANIZER;CN="${name}":mailto:${organizer.email}`);
|
|
501
|
-
}
|
|
502
|
-
// Attendees
|
|
503
|
-
const attendees = overrides.attendees ?? master.attendees;
|
|
504
|
-
if (attendees) {
|
|
505
|
-
for (const att of attendees) {
|
|
506
|
-
// No CN emitted — display name is resolved server-side.
|
|
507
|
-
lines.push(`ATTENDEE:mailto:${att.email}`);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
// Categories
|
|
511
|
-
const categories = overrides.categories ?? master.categories;
|
|
512
|
-
if (categories && categories.length > 0) {
|
|
513
|
-
lines.push(`CATEGORIES:${categories.join(",")}`);
|
|
514
|
-
}
|
|
515
|
-
// TRANSP — preserve master's availability unless overridden.
|
|
516
|
-
const availability = overrides.availability ?? master.availability;
|
|
517
|
-
if (availability === "free") {
|
|
518
|
-
lines.push("TRANSP:TRANSPARENT");
|
|
519
|
-
}
|
|
520
|
-
else if (availability === "busy") {
|
|
521
|
-
lines.push("TRANSP:OPAQUE");
|
|
522
|
-
}
|
|
523
|
-
lines.push("STATUS:CONFIRMED");
|
|
524
|
-
lines.push("END:VEVENT");
|
|
525
|
-
return lines.join("\r\n");
|
|
526
|
-
}
|
|
527
|
-
export function combineIcsComponents(masterIcs, exceptionVevent) {
|
|
528
|
-
let ics = masterIcs;
|
|
529
|
-
// Extract RECURRENCE-ID from the new exception to find existing match
|
|
530
|
-
const recIdMatch = exceptionVevent.match(/RECURRENCE-ID[^:]*:(.+)/);
|
|
531
|
-
if (recIdMatch) {
|
|
532
|
-
const recIdValue = recIdMatch[1].trim();
|
|
533
|
-
// Remove any existing exception VEVENT with the same RECURRENCE-ID
|
|
534
|
-
// Match from BEGIN:VEVENT through END:VEVENT that contains this RECURRENCE-ID
|
|
535
|
-
const regex = new RegExp(`BEGIN:VEVENT\\r?\\n(?:(?!BEGIN:VEVENT)[\\s\\S])*?RECURRENCE-ID[^:]*:${recIdValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}[\\s\\S]*?END:VEVENT\\r?\\n?`);
|
|
536
|
-
ics = ics.replace(regex, "");
|
|
537
|
-
}
|
|
538
|
-
// Insert exception VEVENT before END:VCALENDAR
|
|
539
|
-
return ics.replace("END:VCALENDAR", `${exceptionVevent}\r\nEND:VCALENDAR`);
|
|
540
|
-
}
|
|
541
|
-
export function addExdateToIcs(icsContent, occurrenceDate, allDay) {
|
|
542
|
-
// Format the EXDATE value
|
|
543
|
-
const date = new Date(occurrenceDate);
|
|
544
|
-
let exdateLine;
|
|
545
|
-
if (allDay) {
|
|
546
|
-
const dateStr = date.toISOString().slice(0, 10).replace(/-/g, "");
|
|
547
|
-
exdateLine = `EXDATE;VALUE=DATE:${dateStr}`;
|
|
548
|
-
}
|
|
549
|
-
else {
|
|
550
|
-
const dtStr = date
|
|
551
|
-
.toISOString()
|
|
552
|
-
.replace(/[-:]/g, "")
|
|
553
|
-
.replace(/\.\d{3}/, "");
|
|
554
|
-
exdateLine = `EXDATE:${dtStr}`;
|
|
555
|
-
}
|
|
556
|
-
// Check for existing EXDATE with same date (idempotency)
|
|
557
|
-
if (icsContent.includes(exdateLine)) {
|
|
558
|
-
return icsContent;
|
|
559
|
-
}
|
|
560
|
-
// Insert before the first END:VEVENT
|
|
561
|
-
return icsContent.replace("END:VEVENT", `${exdateLine}\r\nEND:VEVENT`);
|
|
562
|
-
}
|
|
563
|
-
//# sourceMappingURL=ical.js.map
|
package/dist/ical.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ical.js","sourceRoot":"","sources":["../src/ical.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,IAAI,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,QAAQ,MAAM,WAAW,CAAC;AAmEjC,qEAAqE;AACrE,8EAA8E;AAC9E,0EAA0E;AAC1E,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC1C,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,EA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