botinabox 2.11.0 → 2.12.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.
@@ -33,7 +33,19 @@ export declare class GoogleCalendarConnector implements Connector<CalendarEventR
33
33
  sync(options?: SyncOptions): Promise<SyncResult<CalendarEventRecord>>;
34
34
  /** Incremental sync using Calendar syncToken. */
35
35
  private syncIncremental;
36
- /** Full sync using timeMin. */
36
+ /**
37
+ * Full sync — paginates through every event for the calendar to obtain a
38
+ * `nextSyncToken`. Google only emits `nextSyncToken` on the final page of a
39
+ * query that contains none of `timeMin`, `timeMax`, `orderBy`, `q`,
40
+ * `updatedMin`, `eventTypes`, `iCalUID`, `showDeleted`, or
41
+ * `showHiddenInvitations`. This implementation therefore omits all of those
42
+ * parameters and drains pagination to completion regardless of `options.limit`
43
+ * or `options.since` — a partial first sync would never mint a usable cursor,
44
+ * which would break every subsequent `syncIncremental` call.
45
+ *
46
+ * `options.limit` and `options.since` are intentionally ignored on full sync.
47
+ * Use `syncIncremental` (via `options.cursor`) for bounded follow-up syncs.
48
+ */
37
49
  private syncFull;
38
50
  private ensureConnected;
39
51
  private mapEvent;
@@ -156,22 +156,30 @@ var GoogleCalendarConnector = class {
156
156
  errors
157
157
  };
158
158
  }
159
- /** Full sync using timeMin. */
159
+ /**
160
+ * Full sync — paginates through every event for the calendar to obtain a
161
+ * `nextSyncToken`. Google only emits `nextSyncToken` on the final page of a
162
+ * query that contains none of `timeMin`, `timeMax`, `orderBy`, `q`,
163
+ * `updatedMin`, `eventTypes`, `iCalUID`, `showDeleted`, or
164
+ * `showHiddenInvitations`. This implementation therefore omits all of those
165
+ * parameters and drains pagination to completion regardless of `options.limit`
166
+ * or `options.since` — a partial first sync would never mint a usable cursor,
167
+ * which would break every subsequent `syncIncremental` call.
168
+ *
169
+ * `options.limit` and `options.since` are intentionally ignored on full sync.
170
+ * Use `syncIncremental` (via `options.cursor`) for bounded follow-up syncs.
171
+ */
160
172
  async syncFull(options) {
161
173
  const calendarId = options?.filters?.calendarId ?? "primary";
162
174
  const records = [];
163
175
  const errors = [];
164
- const maxResults = options?.limit ?? 250;
165
- const timeMin = options?.since ? new Date(options.since).toISOString() : new Date(Date.now() - 30 * 24 * 60 * 60 * 1e3).toISOString();
166
176
  let pageToken;
167
177
  let nextSyncToken;
168
178
  do {
169
179
  const res = await this.calendar.events.list({
170
180
  calendarId,
171
- timeMin,
172
181
  singleEvents: true,
173
- orderBy: "startTime",
174
- maxResults: Math.min(maxResults - records.length, 250),
182
+ maxResults: 250,
175
183
  ...pageToken ? { pageToken } : {}
176
184
  });
177
185
  for (const event of res.data.items ?? []) {
@@ -180,15 +188,14 @@ var GoogleCalendarConnector = class {
180
188
  } catch (err) {
181
189
  errors.push({ id: event.id, error: errorMessage(err) });
182
190
  }
183
- if (records.length >= maxResults) break;
184
191
  }
185
192
  pageToken = res.data.nextPageToken ?? void 0;
186
193
  nextSyncToken = res.data.nextSyncToken ?? void 0;
187
- } while (pageToken && records.length < maxResults);
194
+ } while (pageToken);
188
195
  return {
189
196
  records,
190
197
  cursor: nextSyncToken,
191
- hasMore: !!pageToken,
198
+ hasMore: false,
192
199
  errors
193
200
  };
194
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "botinabox",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "Bot in a Box — framework for building multi-agent bots",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",