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;
        observeOnly?: 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.

    observeOnly?: boolean

    True when the channel is being observed because the user composed a Plot thread INTO it (via onCreateLink), not because they explicitly enabled it. The connector should register webhooks / mark the channel observed so inbound events (replies, reactions) on the composed thread sync back — but must NOT backfill history. Only go-forward events matter; pulling the channel's existing content would be surprising for a channel the user only posted one thread into.

    Connectors whose onChannelEnabled already skips historical backfill can ignore this flag. Connectors that initial-sync on enable MUST short- circuit that backfill when observeOnly is true (still set up webhooks and any go-forward state).