@miguelarios/cal-mcp 0.20.0 → 1.0.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 +51 -0
- package/LICENSE +21 -0
- package/README.md +8 -3
- package/dist/main.d.ts +2 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/providers/CalendarBackend.d.ts +94 -0
- package/dist/providers/CalendarBackend.d.ts.map +1 -0
- package/dist/providers/CalendarBackend.js +2 -0
- package/dist/providers/CalendarBackend.js.map +1 -0
- package/dist/providers/types.d.ts +98 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +2 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/services/CalDavService.d.ts +40 -92
- package/dist/services/CalDavService.d.ts.map +1 -1
- package/dist/services/CalDavService.js +210 -64
- package/dist/services/CalDavService.js.map +1 -1
- package/dist/services/sharing.d.ts +39 -0
- package/dist/services/sharing.d.ts.map +1 -0
- package/dist/services/sharing.js +253 -0
- package/dist/services/sharing.js.map +1 -0
- package/dist/services/urlCache.d.ts +1 -1
- package/dist/services/urlCache.js +2 -2
- package/dist/services/urlCache.js.map +1 -1
- package/dist/tools/calendarManagementTools.d.ts +3 -3
- package/dist/tools/calendarManagementTools.d.ts.map +1 -1
- package/dist/tools/calendarManagementTools.js +108 -33
- package/dist/tools/calendarManagementTools.js.map +1 -1
- package/dist/tools/calendarSchemas.d.ts +67 -45
- package/dist/tools/calendarSchemas.d.ts.map +1 -1
- package/dist/tools/calendarSchemas.js +35 -14
- package/dist/tools/calendarSchemas.js.map +1 -1
- package/dist/tools/calendarTools.d.ts +2 -2
- package/dist/tools/calendarTools.d.ts.map +1 -1
- package/dist/tools/calendarTools.js +160 -112
- package/dist/tools/calendarTools.js.map +1 -1
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.0 (2026-10-18)
|
|
4
|
+
|
|
5
|
+
First stable release. The public contract, and what a minor or patch may change from here, is in [`docs/versioning.md`](../../docs/versioning.md).
|
|
6
|
+
|
|
7
|
+
- **Breaking: requires Node.js 22.12.0 or newer** (was 20.19.0). Node 20 reached end of life in April 2026, and raising the floor after 1.0 would need a major release (#150).
|
|
8
|
+
- **Breaking: errors use pim-core's `ErrorCode` values**, the same vocabulary as card-mcp and email-mcp (#150). The `message` and `retryable` fields are unchanged.
|
|
9
|
+
|
|
10
|
+
| Was | Now |
|
|
11
|
+
|---|---|
|
|
12
|
+
| `validation_error` | `VALIDATION_FAILED`, or `INVALID_ICS` when `import_ics` content does not parse or has no events |
|
|
13
|
+
| `not_found` | `CALENDAR_NOT_FOUND` or `EVENT_NOT_FOUND` |
|
|
14
|
+
| `backend_error` | `WRITE_FAILED`, `OPERATION_FAILED`, `CONNECTION_FAILED`, `CONNECTION_TIMEOUT`, `AUTH_FAILED` or `INTERNAL_ERROR` |
|
|
15
|
+
|
|
16
|
+
- Caller mistakes that reached the server as `backend_error` are now caught first and reported as such: an unparseable or inverted `start`/`end` on `list_events`, `search_events` and `find_free_slots`, an unparseable date on `create_event` / `create_events_batch` (`VALIDATION_FAILED`), and unparseable `import_ics` content (`INVALID_ICS`).
|
|
17
|
+
- **`delete_event` with `span: "this"` no longer corrupts the series on an unparseable `occurrenceDate`.** It wrote `EXDATE:NaN-aNNaN…` into the event and reported success; it now fails with `VALIDATION_FAILED` before anything is written, as does `update_event` with `span: "this"`.
|
|
18
|
+
- **Breaking: every tool parameter and output field is camelCase**, like card-mcp and email-mcp (#150). Tool names and enum values are unchanged (`list_events`, `span: "this"`, `access: "read-write"`).
|
|
19
|
+
|
|
20
|
+
| Was | Now |
|
|
21
|
+
|---|---|
|
|
22
|
+
| `all_day` | `allDay` |
|
|
23
|
+
| `calendar_id` | `calendarId` |
|
|
24
|
+
| `can_be_published` | `canBePublished` |
|
|
25
|
+
| `can_be_shared` | `canBeShared` |
|
|
26
|
+
| `detail_level` | `detailLevel` |
|
|
27
|
+
| `display_name` | `displayName` |
|
|
28
|
+
| `exclude_calendars` | `excludeCalendars` |
|
|
29
|
+
| `ics_content` | `icsContent` |
|
|
30
|
+
| `ignore_tentative` | `ignoreTentative` |
|
|
31
|
+
| `include_all_day_as_busy` | `includeAllDayAsBusy` |
|
|
32
|
+
| `is_recurring` | `isRecurring` |
|
|
33
|
+
| `last_modified` | `lastModified` |
|
|
34
|
+
| `occurrence_date` | `occurrenceDate` |
|
|
35
|
+
| `preferred_end` | `preferredEnd` |
|
|
36
|
+
| `preferred_start` | `preferredStart` |
|
|
37
|
+
| `read_only` | `readOnly` |
|
|
38
|
+
| `recurrence_rule` | `recurrenceRule` |
|
|
39
|
+
| `target_calendar` | `targetCalendar` |
|
|
40
|
+
| `trigger_human` | `triggerHuman` |
|
|
41
|
+
| `unavailable_providers` | `unavailableProviders` |
|
|
42
|
+
- A CalDAV read's HTTP error is classified by its status rather than by words in the server's reply: a 500 whose page said "connection" was a retryable `CONNECTION_FAILED` (pim-core).
|
|
43
|
+
- Bumped `@miguelarios/pim-core` to `^1.0.0`. cal-mcp needs it: it returns core's renamed `/ics` fields as they are, so with a 0.x core its events would fail validation.
|
|
44
|
+
|
|
45
|
+
## 0.21.0 (2026-10-18)
|
|
46
|
+
|
|
47
|
+
- **Calendar sharing** (#47): `get_calendar_sharing` (who a calendar is shared with, at what access, and whether they accepted), `share_calendar` and `unshare_calendar` (both ask for confirmation). Reads CalendarServer sharing (mailbox.org / Open-Xchange, Apple), Nextcloud's ownCloud sharing, or WebDAV resource sharing, and writes in the dialect the server answered with. On Nextcloud the sharee is a principal such as `principals/users/bob`. See `docs/tools/cal-mcp.md`.
|
|
48
|
+
- **One unreachable provider no longer fails every all-calendars read** (#127). `list_calendars`, and `list_events` / `search_events` / `get_today_events` without a calendar, return the reachable providers' results plus `unavailable_providers: [{ provider, error }]`. `get_free_busy` and `find_free_slots` across all calendars still fail, now naming the provider, because skipping one would report its busy time as free.
|
|
49
|
+
- `list_calendars` works on servers that send a numeric `getctag` (#94).
|
|
50
|
+
- Recurring events from Nextcloud report `is_recurring` correctly, and moved occurrences carry the series rule (pim-core 0.16.0, #99).
|
|
51
|
+
- An unreachable server is reported as retryable, naming the cause (`fetch failed (EHOSTUNREACH)`).
|
|
52
|
+
- Bumped `@miguelarios/pim-core` to `^0.16.0`. Requires Node.js 20.19.0 or newer.
|
|
53
|
+
|
|
3
54
|
## 0.20.0 (2026-10-07)
|
|
4
55
|
|
|
5
56
|
- Runs over Streamable HTTP as well as stdio: set `PIM_MCP_TRANSPORT=http` (see the README's "Over Streamable HTTP"). stdio stays the default and is unchanged on the wire.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Miguel Rios
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@ Every tool declares a `title`, all four behaviour annotations, and an `outputSch
|
|
|
9
9
|
|
|
10
10
|
`delete_event` asks the user to confirm whenever it removes the calendar object — `span: "all"`, and `span: "this"` on a non-recurring event. Excluding one occurrence of a recurring event is recoverable and is not gated. `delete_calendar` always asks, and so does an `update_event` with `span: "future"` that would drop per-occurrence changes. Set `PIM_MCP_CONFIRM=off` to skip confirmation in headless use.
|
|
11
11
|
|
|
12
|
+
Requires Node.js **22.12.0 or newer**.
|
|
13
|
+
|
|
12
14
|
## Usage
|
|
13
15
|
|
|
14
16
|
```bash
|
|
@@ -51,14 +53,14 @@ docker run -d --name cal-mcp --restart unless-stopped --user node \
|
|
|
51
53
|
--env-file cal.env \
|
|
52
54
|
-e PIM_MCP_TRANSPORT=http -e PIM_MCP_HTTP_HOST=0.0.0.0 \
|
|
53
55
|
-p 127.0.0.1:3002:3000 -v cal-mcp-home:/home/node \
|
|
54
|
-
node:22-alpine npx -y @miguelarios/cal-mcp@0.
|
|
56
|
+
node:22-alpine npx -y @miguelarios/cal-mcp@1.0.0
|
|
55
57
|
```
|
|
56
58
|
|
|
57
59
|
See the [Docker guide](https://github.com/miguelarios/pim-agents/blob/main/docs/docker.md) for the env file, stdio use from a desktop client, Docker Compose, and exposing a server safely, and the [README](https://github.com/miguelarios/pim-agents/blob/main/README.md#over-streamable-http) for every HTTP setting.
|
|
58
60
|
|
|
59
|
-
## Tools (
|
|
61
|
+
## Tools (19)
|
|
60
62
|
|
|
61
|
-
See [docs/tools/cal-mcp.md](
|
|
63
|
+
See [docs/tools/cal-mcp.md](https://github.com/miguelarios/pim-agents/blob/main/docs/tools/cal-mcp.md) for full parameter and output details.
|
|
62
64
|
|
|
63
65
|
| Tool | Description |
|
|
64
66
|
|------|-------------|
|
|
@@ -78,6 +80,9 @@ See [docs/tools/cal-mcp.md](../../docs/tools/cal-mcp.md) for full parameter and
|
|
|
78
80
|
| `create_calendar` | Create a calendar collection |
|
|
79
81
|
| `update_calendar` | Rename or recolour a calendar |
|
|
80
82
|
| `delete_calendar` | Delete a calendar and every event in it |
|
|
83
|
+
| `get_calendar_sharing` | Who a calendar is shared with, at what access, and whether they accepted |
|
|
84
|
+
| `share_calendar` | Share a calendar with a person or group, read or read-write |
|
|
85
|
+
| `unshare_calendar` | Stop sharing a calendar with someone |
|
|
81
86
|
|
|
82
87
|
## License
|
|
83
88
|
|
package/dist/main.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
2
|
-
import {
|
|
2
|
+
import type { IcsCalendarBackend } from "./providers/CalendarBackend.js";
|
|
3
3
|
/**
|
|
4
4
|
* Builds one server instance around a shared service. Called per connection on
|
|
5
5
|
* stdio and per request over HTTP, so it must not open connections or install
|
|
6
6
|
* process handlers of its own.
|
|
7
7
|
*/
|
|
8
|
-
export declare function createServer(service:
|
|
8
|
+
export declare function createServer(service: IcsCalendarBackend): McpServer;
|
|
9
9
|
export declare function startServer(): Promise<void>;
|
|
10
10
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAQzE;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,kBAAkB,GAAG,SAAS,CAcnE;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAajD"}
|
package/dist/main.js
CHANGED
|
@@ -15,7 +15,7 @@ const { version } = require("../package.json");
|
|
|
15
15
|
export function createServer(service) {
|
|
16
16
|
const server = new McpServer({ name: "@miguelarios/cal-mcp", title: "CalDAV Calendars", version }, {
|
|
17
17
|
capabilities: { tools: { listChanged: false } },
|
|
18
|
-
instructions: "Read and manage CalDAV calendars across every configured provider. Calendar IDs are provider-prefixed (e.g. mailbox/Work) — call list_calendars first. delete_event asks the user to confirm whenever it removes the calendar object; excluding one occurrence of a recurring event does not. delete_calendar asks the user to confirm too, since it removes every event in the calendar. Renaming a calendar with update_calendar changes its ID.",
|
|
18
|
+
instructions: "Read and manage CalDAV calendars across every configured provider. Calendar IDs are provider-prefixed (e.g. mailbox/Work) — call list_calendars first. delete_event asks the user to confirm whenever it removes the calendar object; excluding one occurrence of a recurring event does not. delete_calendar asks the user to confirm too, since it removes every event in the calendar. share_calendar and unshare_calendar also ask: sharing usually emails the sharee an invitation. Renaming a calendar with update_calendar changes its ID.",
|
|
19
19
|
cacheHints: { "tools/list": TOOL_LIST_CACHE_HINT },
|
|
20
20
|
});
|
|
21
21
|
registerTools(server, [...CALENDAR_TOOLS, ...CALENDAR_MANAGEMENT_TOOLS], service);
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../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YAAY,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IAE7E,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE;QAChC,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { CalendarSharing, ShareAccess } from "../services/sharing.js";
|
|
2
|
+
/**
|
|
3
|
+
* What the calendar tools need from a backend, as an interface rather than the
|
|
4
|
+
* concrete CalDavService (#42). See
|
|
5
|
+
* docs/superpowers/specs/2026-10-18-multi-provider-backends-design.md.
|
|
6
|
+
*
|
|
7
|
+
* Two layers, because the tool layer is not protocol-neutral yet:
|
|
8
|
+
*
|
|
9
|
+
* - `CalendarBackend` is what any provider can implement: calendars, events by
|
|
10
|
+
* ID, ranges, free/busy and collection management, in this package's own
|
|
11
|
+
* data shapes. Calendar IDs are `<provider>/<calendar>`; the provider prefix
|
|
12
|
+
* picks the account.
|
|
13
|
+
* - `IcsCalendarBackend` adds the iCalendar-level operations the tools use
|
|
14
|
+
* today to create events and to edit recurring series (overrides, EXDATEs,
|
|
15
|
+
* splitting a series), by rewriting the stored VCALENDAR themselves. A
|
|
16
|
+
* provider whose API does not take iCalendar (Google Calendar, Microsoft
|
|
17
|
+
* Graph) cannot implement these. Replacing them with semantic operations,
|
|
18
|
+
* with the recurrence logic moved below this interface, is phase 2 of the
|
|
19
|
+
* design.
|
|
20
|
+
*/
|
|
21
|
+
import type { CalendarCollection, CalendarInfo, CalendarObjectMeta, EventFull, EventSummary, FindFreeSlotsOptions, FreeBusyOptions, FreeBusyResult, FreeSlot, ReachableCalendars } from "./types.js";
|
|
22
|
+
export interface CalendarBackend {
|
|
23
|
+
/** Every calendar on every configured provider. Throws if any provider cannot be listed. */
|
|
24
|
+
listCalendars(): Promise<CalendarInfo[]>;
|
|
25
|
+
/**
|
|
26
|
+
* The calendars of every provider that answers, and which did not (#127).
|
|
27
|
+
* Throws only when none answers. For listings; availability uses listCalendars.
|
|
28
|
+
*/
|
|
29
|
+
listReachableCalendars(): Promise<ReachableCalendars>;
|
|
30
|
+
/** The configured provider IDs: the prefix half of every calendar ID. */
|
|
31
|
+
listProviders(): string[];
|
|
32
|
+
/** The account's own address on the calendar's provider (used as ORGANIZER). */
|
|
33
|
+
getAccountEmail(calendarId: string): string;
|
|
34
|
+
listEvents(calendarId: string, start: string, end: string): Promise<EventSummary[]>;
|
|
35
|
+
listEventsFull(calendarId: string, start: string, end: string): Promise<EventFull[]>;
|
|
36
|
+
/** The master, or with `occurrenceDate` one occurrence as it will happen. */
|
|
37
|
+
getEvent(calendarId: string, uid: string, occurrenceDate?: string): Promise<EventFull>;
|
|
38
|
+
/**
|
|
39
|
+
* The event plus an opaque version handle. `meta.url` locates the stored
|
|
40
|
+
* object and `meta.etag` guards a later write; both are the backend's own,
|
|
41
|
+
* and callers only pass them back.
|
|
42
|
+
*/
|
|
43
|
+
getEventWithMeta(calendarId: string, uid: string): Promise<{
|
|
44
|
+
event: EventFull;
|
|
45
|
+
meta: CalendarObjectMeta;
|
|
46
|
+
}>;
|
|
47
|
+
/** Removes the whole stored event (every occurrence of a series). */
|
|
48
|
+
deleteEvent(calendarId: string, uid: string, meta?: CalendarObjectMeta): Promise<void>;
|
|
49
|
+
/** Moves an event to another calendar on the same account. */
|
|
50
|
+
moveEvent(calendarId: string, uid: string, targetCalendarId: string, meta?: CalendarObjectMeta): Promise<EventFull>;
|
|
51
|
+
getFreeBusy(calendarIds: string[], start: string, end: string, options?: FreeBusyOptions): Promise<FreeBusyResult>;
|
|
52
|
+
findFreeSlots(calendarIds: string[], start: string, end: string, durationMinutes: number, options?: FindFreeSlotsOptions): Promise<FreeSlot[]>;
|
|
53
|
+
findCalendarEntry(calendarId: string): Promise<CalendarCollection>;
|
|
54
|
+
/** Number of stored events (a series counts once), or undefined when the provider will not say. */
|
|
55
|
+
countCalendarObjects(calendarId: string): Promise<number | undefined>;
|
|
56
|
+
createCalendar(opts: {
|
|
57
|
+
provider?: string;
|
|
58
|
+
displayName: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
color?: string;
|
|
61
|
+
timezone?: string;
|
|
62
|
+
order?: number;
|
|
63
|
+
slug?: string;
|
|
64
|
+
}): Promise<CalendarCollection>;
|
|
65
|
+
updateCalendarMeta(calendarId: string, opts: {
|
|
66
|
+
displayName?: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
color?: string;
|
|
69
|
+
timezone?: string;
|
|
70
|
+
order?: number;
|
|
71
|
+
}): Promise<CalendarCollection>;
|
|
72
|
+
deleteCalendar(calendarId: string): Promise<CalendarCollection>;
|
|
73
|
+
/** Who a calendar is shared with, at what access, in the provider's own sharee form. */
|
|
74
|
+
getCalendarSharing(calendarId: string): Promise<CalendarSharing>;
|
|
75
|
+
/** Grants (`access` given) or revokes (`access` null) a sharee's access, then re-reads. */
|
|
76
|
+
changeCalendarShare(calendarId: string, sharee: string, access: ShareAccess | null, summary?: string): Promise<CalendarSharing>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The iCalendar-level operations, for a backend that stores VCALENDAR objects
|
|
80
|
+
* (CalDAV). Phase 2 of the design replaces these with semantic event writes.
|
|
81
|
+
*/
|
|
82
|
+
export interface IcsCalendarBackend extends CalendarBackend {
|
|
83
|
+
/** The stored VCALENDAR text of one event object, with its location and version. */
|
|
84
|
+
fetchRawCalendarObject(calendarId: string, uid: string): Promise<{
|
|
85
|
+
data: string;
|
|
86
|
+
url: string;
|
|
87
|
+
etag: string;
|
|
88
|
+
}>;
|
|
89
|
+
/** Stores a new event object from VCALENDAR text. */
|
|
90
|
+
createEvent(calendarId: string, icalString: string, uid: string): Promise<EventFull>;
|
|
91
|
+
/** Replaces an event object with VCALENDAR text, guarded by `meta.etag` when given. */
|
|
92
|
+
updateEvent(calendarId: string, uid: string, icalString: string, meta?: CalendarObjectMeta): Promise<EventFull>;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=CalendarBackend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarBackend.d.ts","sourceRoot":"","sources":["../../src/providers/CalendarBackend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC3E;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,QAAQ,EACR,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,eAAe;IAE9B,4FAA4F;IAC5F,aAAa,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IACzC;;;OAGG;IACH,sBAAsB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACtD,yEAAyE;IACzE,aAAa,IAAI,MAAM,EAAE,CAAC;IAC1B,gFAAgF;IAChF,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAG5C,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IACpF,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACrF,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,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EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,kBAAkB,GACxB,OAAO,CAAC,SAAS,CAAC,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarBackend.js","sourceRoot":"","sources":["../../src/providers/CalendarBackend.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The data shapes every calendar backend speaks, independent of protocol.
|
|
3
|
+
* They used to live in CalDavService.ts and are still re-exported from there.
|
|
4
|
+
*/
|
|
5
|
+
import type { FreeBusyPeriod, ParsedAlarm } from "@miguelarios/pim-core/ics";
|
|
6
|
+
export interface CalendarInfo {
|
|
7
|
+
calendarId: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
color: string | null;
|
|
10
|
+
description: string | null;
|
|
11
|
+
/** IANA zone the calendar defaults to (`calendar-timezone`), when the provider reports one. */
|
|
12
|
+
timezone: string | null;
|
|
13
|
+
/** Sort position among the account's calendars (Apple `calendar-order`), when reported. */
|
|
14
|
+
order: number | null;
|
|
15
|
+
source: string;
|
|
16
|
+
readOnly: boolean;
|
|
17
|
+
url: string;
|
|
18
|
+
ctag?: string;
|
|
19
|
+
}
|
|
20
|
+
/** A calendar collection as the management tools name it. */
|
|
21
|
+
export interface CalendarCollection {
|
|
22
|
+
calendarId: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
url: string;
|
|
25
|
+
provider: string;
|
|
26
|
+
}
|
|
27
|
+
export interface EventSummary {
|
|
28
|
+
uid: string;
|
|
29
|
+
calendarId: string;
|
|
30
|
+
title: string;
|
|
31
|
+
start: string;
|
|
32
|
+
end: string;
|
|
33
|
+
allDay: boolean;
|
|
34
|
+
location: string | null;
|
|
35
|
+
status: string | null;
|
|
36
|
+
isRecurring: boolean;
|
|
37
|
+
occurrenceDate: string | null;
|
|
38
|
+
}
|
|
39
|
+
export interface EventFull extends EventSummary {
|
|
40
|
+
description: string | null;
|
|
41
|
+
url: string | null;
|
|
42
|
+
availability: string | null;
|
|
43
|
+
attendees: Array<{
|
|
44
|
+
name: string | null;
|
|
45
|
+
email: string;
|
|
46
|
+
status: string | null;
|
|
47
|
+
role: string | null;
|
|
48
|
+
type: string;
|
|
49
|
+
}>;
|
|
50
|
+
organizer: {
|
|
51
|
+
name: string | null;
|
|
52
|
+
email: string;
|
|
53
|
+
} | null;
|
|
54
|
+
recurrenceRule: string | null;
|
|
55
|
+
created: string | null;
|
|
56
|
+
lastModified: string | null;
|
|
57
|
+
alarms: ParsedAlarm[];
|
|
58
|
+
categories: string[];
|
|
59
|
+
geo: {
|
|
60
|
+
latitude: number;
|
|
61
|
+
longitude: number;
|
|
62
|
+
} | null;
|
|
63
|
+
}
|
|
64
|
+
export interface FreeSlot {
|
|
65
|
+
start: string;
|
|
66
|
+
end: string;
|
|
67
|
+
duration: number;
|
|
68
|
+
}
|
|
69
|
+
export interface FindFreeSlotsOptions {
|
|
70
|
+
ignoreTentative?: boolean;
|
|
71
|
+
preferredStart?: string;
|
|
72
|
+
preferredEnd?: string;
|
|
73
|
+
excludeCalendars?: string[];
|
|
74
|
+
includeAllDayAsBusy?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface CalendarObjectMeta {
|
|
77
|
+
url: string;
|
|
78
|
+
etag?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface FreeBusyOptions {
|
|
81
|
+
ignoreTentative?: boolean;
|
|
82
|
+
includeAllDayAsBusy?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** Where a calendar's busy periods came from. */
|
|
85
|
+
export type FreeBusySource = "server" | "computed";
|
|
86
|
+
export interface FreeBusyResult {
|
|
87
|
+
busy: FreeBusyPeriod[];
|
|
88
|
+
sources: Record<string, FreeBusySource>;
|
|
89
|
+
}
|
|
90
|
+
export interface UnavailableProvider {
|
|
91
|
+
provider: string;
|
|
92
|
+
error: string;
|
|
93
|
+
}
|
|
94
|
+
export interface ReachableCalendars {
|
|
95
|
+
calendars: CalendarInfo[];
|
|
96
|
+
unavailable: UnavailableProvider[];
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7E,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,+FAA+F;IAC/F,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,2FAA2F;IAC3F,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,6DAA6D;AAC7D,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM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AAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,iDAAiD;AACjD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEnD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,WAAW,EAAE,mBAAmB,EAAE,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,89 +1,9 @@
|
|
|
1
1
|
import { type CalDavConfig } from "@miguelarios/pim-core";
|
|
2
|
-
import { type FreeBusyPeriod
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
description: string | null;
|
|
8
|
-
/** IANA zone the calendar defaults to (`calendar-timezone`), when the provider reports one. */
|
|
9
|
-
timezone: string | null;
|
|
10
|
-
/** Sort position among the account's calendars (Apple `calendar-order`), when reported. */
|
|
11
|
-
order: number | null;
|
|
12
|
-
source: string;
|
|
13
|
-
read_only: boolean;
|
|
14
|
-
url: string;
|
|
15
|
-
ctag?: string;
|
|
16
|
-
}
|
|
17
|
-
/** A calendar collection as the management tools name it. */
|
|
18
|
-
export interface CalendarCollection {
|
|
19
|
-
calendar_id: string;
|
|
20
|
-
display_name: string;
|
|
21
|
-
url: string;
|
|
22
|
-
provider: string;
|
|
23
|
-
}
|
|
24
|
-
export interface EventSummary {
|
|
25
|
-
uid: string;
|
|
26
|
-
calendar_id: string;
|
|
27
|
-
title: string;
|
|
28
|
-
start: string;
|
|
29
|
-
end: string;
|
|
30
|
-
all_day: boolean;
|
|
31
|
-
location: string | null;
|
|
32
|
-
status: string | null;
|
|
33
|
-
is_recurring: boolean;
|
|
34
|
-
occurrence_date: string | null;
|
|
35
|
-
}
|
|
36
|
-
export interface EventFull extends EventSummary {
|
|
37
|
-
description: string | null;
|
|
38
|
-
url: string | null;
|
|
39
|
-
availability: string | null;
|
|
40
|
-
attendees: Array<{
|
|
41
|
-
name: string | null;
|
|
42
|
-
email: string;
|
|
43
|
-
status: string | null;
|
|
44
|
-
role: string | null;
|
|
45
|
-
type: string;
|
|
46
|
-
}>;
|
|
47
|
-
organizer: {
|
|
48
|
-
name: string | null;
|
|
49
|
-
email: string;
|
|
50
|
-
} | null;
|
|
51
|
-
recurrence_rule: string | null;
|
|
52
|
-
created: string | null;
|
|
53
|
-
last_modified: string | null;
|
|
54
|
-
alarms: ParsedAlarm[];
|
|
55
|
-
categories: string[];
|
|
56
|
-
geo: {
|
|
57
|
-
latitude: number;
|
|
58
|
-
longitude: number;
|
|
59
|
-
} | null;
|
|
60
|
-
}
|
|
61
|
-
export interface FreeSlot {
|
|
62
|
-
start: string;
|
|
63
|
-
end: string;
|
|
64
|
-
duration: number;
|
|
65
|
-
}
|
|
66
|
-
export interface FindFreeSlotsOptions {
|
|
67
|
-
ignoreTentative?: boolean;
|
|
68
|
-
preferredStart?: string;
|
|
69
|
-
preferredEnd?: string;
|
|
70
|
-
excludeCalendars?: string[];
|
|
71
|
-
includeAllDayAsBusy?: boolean;
|
|
72
|
-
}
|
|
73
|
-
export interface CalendarObjectMeta {
|
|
74
|
-
url: string;
|
|
75
|
-
etag?: string;
|
|
76
|
-
}
|
|
77
|
-
export interface FreeBusyOptions {
|
|
78
|
-
ignoreTentative?: boolean;
|
|
79
|
-
includeAllDayAsBusy?: boolean;
|
|
80
|
-
}
|
|
81
|
-
/** Where a calendar's busy periods came from. */
|
|
82
|
-
export type FreeBusySource = "server" | "computed";
|
|
83
|
-
export interface FreeBusyResult {
|
|
84
|
-
busy: FreeBusyPeriod[];
|
|
85
|
-
sources: Record<string, FreeBusySource>;
|
|
86
|
-
}
|
|
2
|
+
import { type FreeBusyPeriod } from "@miguelarios/pim-core/ics";
|
|
3
|
+
import type { IcsCalendarBackend } from "../providers/CalendarBackend.js";
|
|
4
|
+
import type { CalendarCollection, CalendarInfo, CalendarObjectMeta, EventFull, EventSummary, FindFreeSlotsOptions, FreeBusyOptions, FreeBusyResult, FreeSlot, ReachableCalendars } from "../providers/types.js";
|
|
5
|
+
import { type CalendarSharing, type ShareAccess } from "./sharing.js";
|
|
6
|
+
export type { CalendarInfo, CalendarCollection, EventSummary, EventFull, FreeSlot, FindFreeSlotsOptions, CalendarObjectMeta, FreeBusyOptions, FreeBusySource, FreeBusyResult, ReachableCalendars, UnavailableProvider, } from "../providers/types.js";
|
|
87
7
|
/**
|
|
88
8
|
* Merges overlapping or touching periods of the same type; output is sorted
|
|
89
9
|
* by start. Periods are visited in start order, so by the time one is
|
|
@@ -107,7 +27,7 @@ export declare function drainDebugTimings(): Array<{
|
|
|
107
27
|
ms: number;
|
|
108
28
|
count?: number;
|
|
109
29
|
}>;
|
|
110
|
-
export declare class CalDavService {
|
|
30
|
+
export declare class CalDavService implements IcsCalendarBackend {
|
|
111
31
|
private accounts;
|
|
112
32
|
private clients;
|
|
113
33
|
private calendarsCache;
|
|
@@ -121,8 +41,22 @@ export declare class CalDavService {
|
|
|
121
41
|
private hasWritePrivilege;
|
|
122
42
|
private fetchPrivileges;
|
|
123
43
|
getAccountEmail(calendarId: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Every calendar on every provider, or an error naming the first provider
|
|
46
|
+
* that could not be listed. For callers that must not act on a partial
|
|
47
|
+
* view — free/busy and free slots, where a missing provider's busy time
|
|
48
|
+
* would read as free.
|
|
49
|
+
*/
|
|
124
50
|
listCalendars(): Promise<CalendarInfo[]>;
|
|
125
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* The calendars of every provider that answers, plus which ones did not and
|
|
53
|
+
* why (#127). One unreachable provider — a LAN server seen from off that
|
|
54
|
+
* network — no longer hides the others. Only when none answers does this
|
|
55
|
+
* throw, so a single-provider setup fails exactly as before.
|
|
56
|
+
*/
|
|
57
|
+
listReachableCalendars(): Promise<ReachableCalendars>;
|
|
58
|
+
private listProviderCalendars;
|
|
59
|
+
/** The configured provider IDs — the prefix half of every `calendarId`. */
|
|
126
60
|
listProviders(): string[];
|
|
127
61
|
/**
|
|
128
62
|
* Picks the account a new calendar is created on.
|
|
@@ -134,10 +68,24 @@ export declare class CalDavService {
|
|
|
134
68
|
*/
|
|
135
69
|
private resolveProvider;
|
|
136
70
|
/**
|
|
137
|
-
* Resolves a
|
|
71
|
+
* Resolves a calendarId to the entry it names, so a caller can say what it
|
|
138
72
|
* is about to act on rather than echoing back the string it was handed.
|
|
139
73
|
*/
|
|
140
74
|
findCalendarEntry(calendarId: string): Promise<CalendarCollection>;
|
|
75
|
+
/**
|
|
76
|
+
* One authenticated request to a calendar collection. Sharing uses raw
|
|
77
|
+
* requests rather than tsdav: tsdav's XML handling drops namespace prefixes,
|
|
78
|
+
* which collides `D:invite` with `CS:invite` (see sharing.ts).
|
|
79
|
+
*/
|
|
80
|
+
private collectionRequest;
|
|
81
|
+
/** Who a calendar is shared with, and at what access (#47). */
|
|
82
|
+
getCalendarSharing(calendarId: string): Promise<CalendarSharing>;
|
|
83
|
+
/**
|
|
84
|
+
* Grants (`access` given) or revokes (`access` null) a sharee's access, in
|
|
85
|
+
* whichever sharing dialect the server answered the read with, then returns
|
|
86
|
+
* the calendar's sharing as the server now reports it.
|
|
87
|
+
*/
|
|
88
|
+
changeCalendarShare(calendarId: string, sharee: string, access: ShareAccess | null, summary?: string): Promise<CalendarSharing>;
|
|
141
89
|
/**
|
|
142
90
|
* Counts the objects in a calendar with a single depth-1 PROPFIND asking only
|
|
143
91
|
* for etags — no ICS bodies cross the wire. Counts calendar *objects*, so a
|
|
@@ -175,7 +123,7 @@ export declare class CalDavService {
|
|
|
175
123
|
/**
|
|
176
124
|
* Updates a calendar's display name, description and/or colour via PROPPATCH.
|
|
177
125
|
*
|
|
178
|
-
* Renaming changes the calendar's identity: `
|
|
126
|
+
* Renaming changes the calendar's identity: `calendarId` is
|
|
179
127
|
* `provider/DisplayName`, so the old ID stops resolving and the *new* one
|
|
180
128
|
* comes back in the result. The collection URL is untouched — display name
|
|
181
129
|
* and slug are allowed to drift, exactly as in every CalDAV client.
|
|
@@ -199,17 +147,17 @@ export declare class CalDavService {
|
|
|
199
147
|
* exactly as `list_events` would expand it. That covers a plain rule-generated
|
|
200
148
|
* occurrence and an override VEVENT alike: the override's fields (moved time,
|
|
201
149
|
* changed title) come back in place of the master's, which is what a caller
|
|
202
|
-
* holding an `
|
|
150
|
+
* holding an `occurrenceDate` from `list_events` needs (#39).
|
|
203
151
|
*/
|
|
204
152
|
private readEvent;
|
|
205
153
|
/**
|
|
206
154
|
* Expands the series over a two-day window around `occurrenceDate` and keeps
|
|
207
|
-
* the instance whose `
|
|
155
|
+
* the instance whose `occurrenceDate` is exactly that instant. The expansion
|
|
208
156
|
* filters on the rule-generated slot (the RECURRENCE-ID), not on an
|
|
209
157
|
* override's own DTSTART, so a moved override is found by its slot like any
|
|
210
158
|
* other occurrence. The window exists because the range is half-open
|
|
211
159
|
* `[start, end)`: a zero-width range would exclude the target itself. The
|
|
212
|
-
* exact match on `
|
|
160
|
+
* exact match on `occurrenceDate` then keeps the neighbours out.
|
|
213
161
|
*/
|
|
214
162
|
private pickOccurrence;
|
|
215
163
|
getEvent(calendarId: string, uid: string, occurrenceDate?: string): Promise<EventFull>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalDavService.d.ts","sourceRoot":"","sources":["../../src/services/CalDavService.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"CalDavService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