@octane-xplat/calendar 0.19.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 +2 -37
- package/package.json +5 -5
- package/src/calendar.macos.ts +223 -208
- package/src/calendar.ts +386 -341
- package/src/calendar.web.ts +10 -9
- package/src/calendar.windows.ts +10 -10
- package/src/types.ts +63 -63
- package/types/generated/.tsrx-typegen-manifest.json +0 -6
- package/types/generated/calendar.linux.d.ts +0 -1
- package/types/generated/calendar.macos.d.ts +0 -3
- package/types/generated/calendar.web.d.ts +0 -3
- package/types/generated/calendar.windows.d.ts +0 -3
- package/types/generated/index.macos.d.ts +0 -2
- package/types/generated/index.web.d.ts +0 -2
package/src/calendar.web.ts
CHANGED
|
@@ -6,16 +6,17 @@ const unsupported = () => Promise.reject(new Error('unsupported: no calendar API
|
|
|
6
6
|
|
|
7
7
|
/** Calendar service — EventKit/CalendarContract. */
|
|
8
8
|
export const calendar: Calendar = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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,
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const permissionOwners = ((globalThis as any).__xplatPermissionOwners ??= {})
|
|
21
|
+
|
|
21
22
|
permissionOwners.calendar = () => calendar.ensure()
|
package/src/calendar.windows.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { Calendar, PermissionResult } from './types'
|
|
2
2
|
|
|
3
3
|
const unsupported = () =>
|
|
4
|
-
|
|
4
|
+
Promise.reject(new Error('unsupported: calendar is not wired on this platform'))
|
|
5
5
|
|
|
6
6
|
/** Calendar service — EventKit/CalendarContract. */
|
|
7
7
|
export const calendar: Calendar = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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,
|
|
17
17
|
}
|
package/src/types.ts
CHANGED
|
@@ -4,81 +4,81 @@ export type PermissionResult = 'granted' | 'denied' | 'unsupported'
|
|
|
4
4
|
|
|
5
5
|
/** One calendar account-local store. */
|
|
6
6
|
export interface CalendarInfo {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/** A stored calendar event. */
|
|
22
22
|
export interface CalendarEvent {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/** Event fields for createEvent/updateEvent — no store ids. */
|
|
44
44
|
export interface NewEvent {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/** EventCalendar/EventKit calendar façade; false `supported` off mobile. */
|
|
62
62
|
export interface Calendar {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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>
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export declare const calendar: Calendar
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { calendar } from './calendar.web.js';
|