@kubun/connector-google-calendar 0.17.0 → 0.17.1
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/provider.d.ts +1 -0
- package/lib/provider.js +25 -6
- package/package.json +2 -2
package/lib/provider.d.ts
CHANGED
package/lib/provider.js
CHANGED
|
@@ -79,7 +79,12 @@ export function createGoogleCalendarProvider(config) {
|
|
|
79
79
|
const fetchFn = config.fetch ?? globalThis.fetch;
|
|
80
80
|
const excludeSet = new Set(config.excludeCalendars ?? []);
|
|
81
81
|
async function* fetchAllEntities(params) {
|
|
82
|
-
|
|
82
|
+
// Reuse a window frozen by a prior sync (carried in an expired checkpoint on
|
|
83
|
+
// the 410 resync path, or a re-driven initial) instead of recomputing from
|
|
84
|
+
// `now`; only a genuine first sync computes it fresh.
|
|
85
|
+
const prior = params.checkpoint;
|
|
86
|
+
const windowStart = prior?.windowStart ?? computeTimeMin(params.boundary);
|
|
87
|
+
const timeMin = windowStart;
|
|
83
88
|
// Phase 1: fetch all calendars (collect all pages first, then yield single batch)
|
|
84
89
|
const allCalendars = [];
|
|
85
90
|
let calendarListSyncToken;
|
|
@@ -128,7 +133,10 @@ export function createGoogleCalendarProvider(config) {
|
|
|
128
133
|
[calendar.id]: {
|
|
129
134
|
eventsSyncToken: page.nextSyncToken
|
|
130
135
|
}
|
|
131
|
-
}
|
|
136
|
+
},
|
|
137
|
+
...windowStart != null ? {
|
|
138
|
+
windowStart
|
|
139
|
+
} : {}
|
|
132
140
|
} : undefined;
|
|
133
141
|
// Split items: cancelled → deleted, others → entities
|
|
134
142
|
const activeItems = page.items.filter((e)=>e.status !== 'cancelled');
|
|
@@ -160,13 +168,18 @@ export function createGoogleCalendarProvider(config) {
|
|
|
160
168
|
hasMore: false,
|
|
161
169
|
checkpoint: {
|
|
162
170
|
calendarListSyncToken,
|
|
163
|
-
calendars: calendarTokens
|
|
171
|
+
calendars: calendarTokens,
|
|
172
|
+
...windowStart != null ? {
|
|
173
|
+
windowStart
|
|
174
|
+
} : {}
|
|
164
175
|
}
|
|
165
176
|
};
|
|
166
177
|
}
|
|
167
178
|
}
|
|
168
179
|
async function* fetchIncrementalEntities(params, checkpoint) {
|
|
169
|
-
|
|
180
|
+
// Carry the frozen window forward; new calendars are floored by it (not `now`).
|
|
181
|
+
const windowStart = checkpoint.windowStart ?? computeTimeMin(params.boundary);
|
|
182
|
+
const timeMin = windowStart;
|
|
170
183
|
// Phase 1: fetch calendar list changes using stored syncToken
|
|
171
184
|
const activeCalendars = [];
|
|
172
185
|
const deletedCalendarIDs = [];
|
|
@@ -248,7 +261,10 @@ export function createGoogleCalendarProvider(config) {
|
|
|
248
261
|
[calendarID]: {
|
|
249
262
|
eventsSyncToken: page.nextSyncToken
|
|
250
263
|
}
|
|
251
|
-
}
|
|
264
|
+
},
|
|
265
|
+
...windowStart != null ? {
|
|
266
|
+
windowStart
|
|
267
|
+
} : {}
|
|
252
268
|
} : undefined;
|
|
253
269
|
// Split items: cancelled → deleted, others → entities
|
|
254
270
|
const activeItems = page.items.filter((e)=>e.status !== 'cancelled');
|
|
@@ -279,7 +295,10 @@ export function createGoogleCalendarProvider(config) {
|
|
|
279
295
|
hasMore: false,
|
|
280
296
|
checkpoint: {
|
|
281
297
|
calendarListSyncToken: newCalendarListSyncToken,
|
|
282
|
-
calendars: updatedCalendarTokens
|
|
298
|
+
calendars: updatedCalendarTokens,
|
|
299
|
+
...windowStart != null ? {
|
|
300
|
+
windowStart
|
|
301
|
+
} : {}
|
|
283
302
|
}
|
|
284
303
|
};
|
|
285
304
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubun/connector-google-calendar",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"license": "see LICENSE.md",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"LICENSE.md"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@kubun/connector": "^0.17.
|
|
18
|
+
"@kubun/connector": "^0.17.1",
|
|
19
19
|
"@kubun/credential-types": "^0.17.0",
|
|
20
20
|
"@kubun/models": "^0.17.0",
|
|
21
21
|
"@kubun/protocol": "^0.17.0",
|