@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.
@@ -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
- 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,
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()
@@ -1,17 +1,17 @@
1
1
  import type { Calendar, PermissionResult } from './types'
2
2
 
3
3
  const unsupported = () =>
4
- Promise.reject(new Error('unsupported: calendar is not wired on this platform'))
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
- 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,
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
- /** 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
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
- /** 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
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
- /** 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
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
- /** 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>
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
@@ -2,13 +2,7 @@
2
2
  "version": 1,
3
3
  "files": [
4
4
  "calendar.d.ts",
5
- "calendar.linux.d.ts",
6
- "calendar.macos.d.ts",
7
- "calendar.web.d.ts",
8
- "calendar.windows.d.ts",
9
5
  "index.d.ts",
10
- "index.macos.d.ts",
11
- "index.web.d.ts",
12
6
  "types.d.ts"
13
7
  ]
14
8
  }
@@ -1 +0,0 @@
1
- export { calendar } from './calendar.web.js';
@@ -1,3 +0,0 @@
1
- import type { Calendar } from './types.js';
2
- /** Calendar service — EventKit/CalendarContract. */
3
- export declare const calendar: Calendar;
@@ -1,3 +0,0 @@
1
- import type { Calendar } from './types.js';
2
- /** Calendar service — EventKit/CalendarContract. */
3
- export declare const calendar: Calendar;
@@ -1,3 +0,0 @@
1
- import type { Calendar } from './types.js';
2
- /** Calendar service — EventKit/CalendarContract. */
3
- export declare const calendar: Calendar;
@@ -1,2 +0,0 @@
1
- export * from './types.js';
2
- export { calendar } from './calendar.macos.js';
@@ -1,2 +0,0 @@
1
- export * from './types.js';
2
- export { calendar } from './calendar.web.js';