@octane-xplat/calendar 0.18.0 → 0.20.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 +3 -23
- package/package.json +86 -93
- package/src/calendar.macos.ts +255 -11
- package/src/calendar.ts +389 -258
- package/src/calendar.web.ts +11 -9
- package/src/calendar.windows.ts +12 -10
- package/src/types.ts +69 -31
- package/types/generated/.tsrx-typegen-manifest.json +0 -6
- package/types/generated/calendar.d.ts +1 -0
- package/types/generated/types.d.ts +38 -0
- package/LICENSE +0 -21
- package/types/generated/calendar.linux.d.ts +0 -1
- package/types/generated/calendar.macos.d.ts +0 -2
- package/types/generated/calendar.web.d.ts +0 -2
- package/types/generated/calendar.windows.d.ts +0 -2
- package/types/generated/index.macos.d.ts +0 -2
- package/types/generated/index.web.d.ts +0 -2
package/src/calendar.web.ts
CHANGED
|
@@ -4,17 +4,19 @@ import type { Calendar, PermissionResult } from './types'
|
|
|
4
4
|
|
|
5
5
|
const unsupported = () => Promise.reject(new Error('unsupported: no calendar API on web'))
|
|
6
6
|
|
|
7
|
+
/** Calendar service — EventKit/CalendarContract. */
|
|
7
8
|
export const calendar: Calendar = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
supported: false,
|
|
10
|
+
ensure: async (): Promise<PermissionResult> => 'unsupported',
|
|
11
|
+
getCalendars: unsupported,
|
|
12
|
+
getDefaultCalendar: unsupported,
|
|
13
|
+
getEvents: unsupported,
|
|
14
|
+
getEvent: unsupported,
|
|
15
|
+
createEvent: unsupported,
|
|
16
|
+
updateEvent: unsupported,
|
|
17
|
+
deleteEvent: unsupported,
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
const permissionOwners = ((globalThis as any).__xplatPermissionOwners ??= {})
|
|
21
|
+
|
|
20
22
|
permissionOwners.calendar = () => calendar.ensure()
|
package/src/calendar.windows.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { Calendar, PermissionResult } from './types'
|
|
2
2
|
|
|
3
|
-
const unsupported = () =>
|
|
3
|
+
const unsupported = () =>
|
|
4
|
+
Promise.reject(new Error('unsupported: calendar is not wired on this platform'))
|
|
4
5
|
|
|
6
|
+
/** Calendar service — EventKit/CalendarContract. */
|
|
5
7
|
export const calendar: Calendar = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
supported: false,
|
|
9
|
+
ensure: async (): Promise<PermissionResult> => 'unsupported',
|
|
10
|
+
getCalendars: unsupported,
|
|
11
|
+
getDefaultCalendar: unsupported,
|
|
12
|
+
getEvents: unsupported,
|
|
13
|
+
getEvent: unsupported,
|
|
14
|
+
createEvent: unsupported,
|
|
15
|
+
updateEvent: unsupported,
|
|
16
|
+
deleteEvent: unsupported,
|
|
15
17
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,46 +1,84 @@
|
|
|
1
|
+
/** Coarse permission answer; 'unsupported' means the platform has no
|
|
2
|
+
* calendar/permission path. */
|
|
1
3
|
export type PermissionResult = 'granted' | 'denied' | 'unsupported'
|
|
2
4
|
|
|
5
|
+
/** One calendar account-local store. */
|
|
3
6
|
export interface CalendarInfo {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/** Store-assigned id — pass to getEvents/createEvent. */
|
|
8
|
+
id: string
|
|
9
|
+
/** Display name. */
|
|
10
|
+
title: string
|
|
11
|
+
/** Display color (CSS color where the store exposes one). */
|
|
12
|
+
color?: string
|
|
13
|
+
/** Originating account/source name (iCloud, local, Exchange, …). */
|
|
14
|
+
source?: string
|
|
15
|
+
/** False for read-only stores (subscribed/Birthdays calendars). */
|
|
16
|
+
allowsModifications?: boolean
|
|
17
|
+
/** The store's default calendar. */
|
|
18
|
+
isPrimary?: boolean
|
|
10
19
|
}
|
|
11
20
|
|
|
21
|
+
/** A stored calendar event. */
|
|
12
22
|
export interface CalendarEvent {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
/** Store-assigned id — pass to getEvent/updateEvent/deleteEvent. */
|
|
24
|
+
id: string
|
|
25
|
+
/** The owning CalendarInfo.id; absent where the store doesn't report it. */
|
|
26
|
+
calendarId?: string
|
|
27
|
+
/** Display title. */
|
|
28
|
+
title: string
|
|
29
|
+
/** Start instant. */
|
|
30
|
+
startDate: Date
|
|
31
|
+
/** End instant. */
|
|
32
|
+
endDate: Date
|
|
33
|
+
/** All-day flag; all-day dates are date-only values. */
|
|
34
|
+
allDay?: boolean
|
|
35
|
+
/** Free-text location. */
|
|
36
|
+
location?: string
|
|
37
|
+
/** Free-text notes. */
|
|
38
|
+
notes?: string
|
|
39
|
+
/** IANA time-zone name when the store records one. */
|
|
40
|
+
timeZone?: string
|
|
22
41
|
}
|
|
23
42
|
|
|
43
|
+
/** Event fields for createEvent/updateEvent — no store ids. */
|
|
24
44
|
export interface NewEvent {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
/** Display title. */
|
|
46
|
+
title: string
|
|
47
|
+
/** Start instant. */
|
|
48
|
+
startDate: Date
|
|
49
|
+
/** End instant. */
|
|
50
|
+
endDate: Date
|
|
51
|
+
/** All-day flag. */
|
|
52
|
+
allDay?: boolean
|
|
53
|
+
/** Free-text location. */
|
|
54
|
+
location?: string
|
|
55
|
+
/** Free-text notes. */
|
|
56
|
+
notes?: string
|
|
57
|
+
/** IANA time-zone name. */
|
|
58
|
+
timeZone?: string
|
|
32
59
|
}
|
|
33
60
|
|
|
61
|
+
/** EventCalendar/EventKit calendar façade; false `supported` off mobile. */
|
|
34
62
|
export interface Calendar {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
63
|
+
/** Synchronous fast check — a calendar backend exists. */
|
|
64
|
+
readonly supported: boolean
|
|
65
|
+
/** Ensure calendar permission, prompting if needed. */
|
|
66
|
+
ensure(): Promise<PermissionResult>
|
|
67
|
+
/** Every calendar store visible to the app. */
|
|
68
|
+
getCalendars(): Promise<CalendarInfo[]>
|
|
69
|
+
/** The store's default calendar, or null when none is writable. */
|
|
70
|
+
getDefaultCalendar(): Promise<CalendarInfo | null>
|
|
71
|
+
/** Events overlapping the range, optionally limited to calendar ids. */
|
|
72
|
+
getEvents(startDate: Date, endDate: Date, calendarIds?: string[]): Promise<CalendarEvent[]>
|
|
73
|
+
/** One event by id, or null. */
|
|
74
|
+
getEvent(id: string): Promise<CalendarEvent | null>
|
|
75
|
+
/** Insert an event; resolves the store-assigned event id. Pass
|
|
76
|
+
* undefined calendarId for the default calendar. */
|
|
77
|
+
createEvent(calendarId: string | undefined, event: NewEvent): Promise<string>
|
|
78
|
+
/** Patch fields of an existing event; resolves the event id. */
|
|
79
|
+
updateEvent(id: string, patch: Partial<NewEvent>): Promise<string>
|
|
80
|
+
/** Remove an event by id. */
|
|
81
|
+
deleteEvent(id: string): Promise<void>
|
|
44
82
|
}
|
|
45
83
|
|
|
46
84
|
export declare const calendar: Calendar
|
|
@@ -1,41 +1,79 @@
|
|
|
1
|
+
/** Coarse permission answer; 'unsupported' means the platform has no
|
|
2
|
+
* calendar/permission path. */
|
|
1
3
|
export type PermissionResult = 'granted' | 'denied' | 'unsupported';
|
|
4
|
+
/** One calendar account-local store. */
|
|
2
5
|
export interface CalendarInfo {
|
|
6
|
+
/** Store-assigned id — pass to getEvents/createEvent. */
|
|
3
7
|
id: string;
|
|
8
|
+
/** Display name. */
|
|
4
9
|
title: string;
|
|
10
|
+
/** Display color (CSS color where the store exposes one). */
|
|
5
11
|
color?: string;
|
|
12
|
+
/** Originating account/source name (iCloud, local, Exchange, …). */
|
|
6
13
|
source?: string;
|
|
14
|
+
/** False for read-only stores (subscribed/Birthdays calendars). */
|
|
7
15
|
allowsModifications?: boolean;
|
|
16
|
+
/** The store's default calendar. */
|
|
8
17
|
isPrimary?: boolean;
|
|
9
18
|
}
|
|
19
|
+
/** A stored calendar event. */
|
|
10
20
|
export interface CalendarEvent {
|
|
21
|
+
/** Store-assigned id — pass to getEvent/updateEvent/deleteEvent. */
|
|
11
22
|
id: string;
|
|
23
|
+
/** The owning CalendarInfo.id; absent where the store doesn't report it. */
|
|
12
24
|
calendarId?: string;
|
|
25
|
+
/** Display title. */
|
|
13
26
|
title: string;
|
|
27
|
+
/** Start instant. */
|
|
14
28
|
startDate: Date;
|
|
29
|
+
/** End instant. */
|
|
15
30
|
endDate: Date;
|
|
31
|
+
/** All-day flag; all-day dates are date-only values. */
|
|
16
32
|
allDay?: boolean;
|
|
33
|
+
/** Free-text location. */
|
|
17
34
|
location?: string;
|
|
35
|
+
/** Free-text notes. */
|
|
18
36
|
notes?: string;
|
|
37
|
+
/** IANA time-zone name when the store records one. */
|
|
19
38
|
timeZone?: string;
|
|
20
39
|
}
|
|
40
|
+
/** Event fields for createEvent/updateEvent — no store ids. */
|
|
21
41
|
export interface NewEvent {
|
|
42
|
+
/** Display title. */
|
|
22
43
|
title: string;
|
|
44
|
+
/** Start instant. */
|
|
23
45
|
startDate: Date;
|
|
46
|
+
/** End instant. */
|
|
24
47
|
endDate: Date;
|
|
48
|
+
/** All-day flag. */
|
|
25
49
|
allDay?: boolean;
|
|
50
|
+
/** Free-text location. */
|
|
26
51
|
location?: string;
|
|
52
|
+
/** Free-text notes. */
|
|
27
53
|
notes?: string;
|
|
54
|
+
/** IANA time-zone name. */
|
|
28
55
|
timeZone?: string;
|
|
29
56
|
}
|
|
57
|
+
/** EventCalendar/EventKit calendar façade; false `supported` off mobile. */
|
|
30
58
|
export interface Calendar {
|
|
59
|
+
/** Synchronous fast check — a calendar backend exists. */
|
|
31
60
|
readonly supported: boolean;
|
|
61
|
+
/** Ensure calendar permission, prompting if needed. */
|
|
32
62
|
ensure(): Promise<PermissionResult>;
|
|
63
|
+
/** Every calendar store visible to the app. */
|
|
33
64
|
getCalendars(): Promise<CalendarInfo[]>;
|
|
65
|
+
/** The store's default calendar, or null when none is writable. */
|
|
34
66
|
getDefaultCalendar(): Promise<CalendarInfo | null>;
|
|
67
|
+
/** Events overlapping the range, optionally limited to calendar ids. */
|
|
35
68
|
getEvents(startDate: Date, endDate: Date, calendarIds?: string[]): Promise<CalendarEvent[]>;
|
|
69
|
+
/** One event by id, or null. */
|
|
36
70
|
getEvent(id: string): Promise<CalendarEvent | null>;
|
|
71
|
+
/** Insert an event; resolves the store-assigned event id. Pass
|
|
72
|
+
* undefined calendarId for the default calendar. */
|
|
37
73
|
createEvent(calendarId: string | undefined, event: NewEvent): Promise<string>;
|
|
74
|
+
/** Patch fields of an existing event; resolves the event id. */
|
|
38
75
|
updateEvent(id: string, patch: Partial<NewEvent>): Promise<string>;
|
|
76
|
+
/** Remove an event by id. */
|
|
39
77
|
deleteEvent(id: string): Promise<void>;
|
|
40
78
|
}
|
|
41
79
|
export declare const calendar: Calendar;
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Alec Larson
|
|
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
|
|
13
|
-
all 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
|
|
21
|
-
THE SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { calendar } from './calendar.web.js';
|