Creating Plot Twists
    Preparing search index...

    Type Alias SyncContext

    Context passed to onChannelEnabled with plan-based sync hints. Connectors can use these hints to limit initial sync scope.

    type SyncContext = {
        syncHistoryMin?: Date;
        recovering?: boolean;
    }
    Index

    Properties

    syncHistoryMin?: Date

    Earliest date to include in initial sync, based on the user's plan.

    Non-calendar connectors should use this as their date filter (timeMin, created.gte, etc.) during initial sync. Calendar connectors should ignore this for API queries (to avoid missing recurring events) — the API layer filters non-recurring items automatically.

    Undefined when no limit applies.

    recovering?: boolean

    True when this is a recovery dispatch after the connection's auth was restored (the user re-authorized a previously-broken connection).

    The framework calls onChannelEnabled again for every channel that was already enabled at the time of re-auth so the connector can recover from the auth gap. Connectors should:

    1. Drop any persisted incremental sync cursors / sync tokens so the next sync re-walks history (the cursor may be stale or invalid — Google Calendar invalidates syncTokens after ~7 days).
    2. Re-register webhooks (any prior subscription may have been invalidated during the auth outage).
    3. Treat this as a backfill that walks history but does NOT spam notifications — set unread: false and archived: false on items as you would during initial sync.

    Most connectors can take the same code path as a fresh onChannelEnabled for recovering: true as long as that path overwrites stored state rather than appending to it.