@kubun/connector-google-calendar 0.17.3 → 0.17.4
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/lib/api.d.ts +6 -4
- package/lib/index.d.ts +1 -1
- package/lib/provider.js +4 -4
- package/package.json +1 -1
package/lib/api.d.ts
CHANGED
|
@@ -44,12 +44,13 @@ export declare function buildCalendarListURL(params: {
|
|
|
44
44
|
syncToken?: string;
|
|
45
45
|
pageToken?: string;
|
|
46
46
|
}): string;
|
|
47
|
-
export
|
|
47
|
+
export type BuildEventsListURLParams = {
|
|
48
48
|
calendarID: string;
|
|
49
49
|
syncToken?: string;
|
|
50
50
|
pageToken?: string;
|
|
51
51
|
timeMin?: string;
|
|
52
|
-
}
|
|
52
|
+
};
|
|
53
|
+
export declare function buildEventsListURL(params: BuildEventsListURLParams): string;
|
|
53
54
|
export declare function mapCalendarToEntity(calendar: GoogleCalendarResource, accountKey?: string): EntityRecord;
|
|
54
55
|
export declare function mapEventToEntity(event: GoogleEventResource, calendarID: string): EntityRecord;
|
|
55
56
|
export declare function buildEventFromParams(params: Record<string, unknown>, options?: {
|
|
@@ -80,14 +81,15 @@ export declare function getEventWithETag(config: {
|
|
|
80
81
|
record: EntityRecord;
|
|
81
82
|
etag?: string;
|
|
82
83
|
}>;
|
|
83
|
-
export
|
|
84
|
+
export type CreateEventParams = {
|
|
84
85
|
accessToken: string;
|
|
85
86
|
calendarID: string;
|
|
86
87
|
params: Record<string, unknown>;
|
|
87
88
|
/** The provider event id to insert under (see `deriveEventID`); takes precedence over `params.id`. */
|
|
88
89
|
eventID?: string;
|
|
89
90
|
fetch?: typeof globalThis.fetch;
|
|
90
|
-
}
|
|
91
|
+
};
|
|
92
|
+
export declare function createEvent(config: CreateEventParams): Promise<EntityRecord>;
|
|
91
93
|
export declare function updateEvent(config: {
|
|
92
94
|
accessToken: string;
|
|
93
95
|
calendarID: string;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createGoogleCalendarActionHandler, type GoogleCalendarActionHandlerConfig, } from './actions.js';
|
|
2
|
-
export { buildCalendarListURL, buildEventFromParams, buildEventsListURL, createEvent, type GoogleCalendarListResponse, type GoogleCalendarResource, type GoogleEventDateTime, type GoogleEventResource, type GoogleEventsListResponse, mapCalendarToEntity, mapEventToEntity, updateEvent, } from './api.js';
|
|
2
|
+
export { type BuildEventsListURLParams, buildCalendarListURL, buildEventFromParams, buildEventsListURL, type CreateEventParams, createEvent, type GoogleCalendarListResponse, type GoogleCalendarResource, type GoogleEventDateTime, type GoogleEventResource, type GoogleEventsListResponse, mapCalendarToEntity, mapEventToEntity, updateEvent, } from './api.js';
|
|
3
3
|
export { type CreateGoogleCalendarConnectorOptions, createGoogleCalendarConnector, } from './connector.js';
|
|
4
4
|
export { GoogleCalendarError, type GoogleCalendarErrorCode, type GoogleCalendarErrorOptions, GoogleCalendarEventConflict, } from './errors.js';
|
|
5
5
|
export { deriveEventID } from './event-id.js';
|
package/lib/provider.js
CHANGED
|
@@ -68,7 +68,7 @@ export function createGoogleCalendarProvider(config) {
|
|
|
68
68
|
const prior = params.checkpoint;
|
|
69
69
|
const windowStart = prior?.windowStart ?? computeTimeMin(params.boundary);
|
|
70
70
|
const timeMin = windowStart;
|
|
71
|
-
//
|
|
71
|
+
// Fetch all calendars (collect all pages first, then yield single batch)
|
|
72
72
|
const allCalendars = [];
|
|
73
73
|
let calendarListSyncToken;
|
|
74
74
|
for await (const page of fetchAllCalendars({
|
|
@@ -95,7 +95,7 @@ export function createGoogleCalendarProvider(config) {
|
|
|
95
95
|
})),
|
|
96
96
|
hasMore: true
|
|
97
97
|
};
|
|
98
|
-
//
|
|
98
|
+
// Fetch events per calendar
|
|
99
99
|
const calendarTokens = {};
|
|
100
100
|
let eventBatchYielded = false;
|
|
101
101
|
for (const [i, calendar] of allCalendars.entries()){
|
|
@@ -172,7 +172,7 @@ export function createGoogleCalendarProvider(config) {
|
|
|
172
172
|
// Carry the frozen window forward; new calendars are floored by it (not `now`).
|
|
173
173
|
const windowStart = checkpoint.windowStart ?? computeTimeMin(params.boundary);
|
|
174
174
|
const timeMin = windowStart;
|
|
175
|
-
//
|
|
175
|
+
// Fetch calendar list changes using stored syncToken
|
|
176
176
|
const activeCalendars = [];
|
|
177
177
|
const deletedCalendarIDs = [];
|
|
178
178
|
let newCalendarListSyncToken;
|
|
@@ -208,7 +208,7 @@ export function createGoogleCalendarProvider(config) {
|
|
|
208
208
|
})),
|
|
209
209
|
hasMore: true
|
|
210
210
|
};
|
|
211
|
-
//
|
|
211
|
+
// Determine the set of calendars to sync events for
|
|
212
212
|
// Start from the previous calendar set, remove deleted, add newly discovered active ones
|
|
213
213
|
const prevCalendarTokens = {
|
|
214
214
|
...checkpoint.calendars
|