Premium

Two-way Google Calendar synchronization

Pull Google Calendar changes, reconcile them with local events, and plan or apply writes through a customer-authorized adapter. WTS does not operate a synchronization or credential-storage service.

Two-way Google Calendar synchronization — Screenshot of actual package adapter results using local test responses. The result table is application-owned, not a built-in screen or a live provider connection. Preview build: @wts-calendar/core@1.1.0 (unpublished).
Screenshot of actual package adapter results using local test responses. The result table is application-owned, not a built-in screen or a live provider connection. Preview build: @wts-calendar/core@1.1.0 (unpublished).

What you configure

createGoogleCalendarAdapter
Provide a calendarId, runtime access-token provider, and time zone.
cursor / remoteBase
Retain the sync cursor and the prior remote snapshot for incremental synchronization.
synchronize
Choose reconciliation policy and explicitly enable push when writes are intended.

Integration code example

  1. Verify the WTS entitlement and obtain separate provider authorization appropriate to the intended read/write operations.
  2. Pull a bounded initial range, retain IDs and version metadata, then inspect the reconciliation plan.
  3. Resolve conflicts before pushing and keep the returned cursor and remote base for subsequent cycles.

Copy this TypeScript into your application, not the browser console. Replace YOUR_WTS_LICENSE_KEY with an entitlement issued for your deployment origin. A WTS license is not a Google, Microsoft or CalDAV credential. These examples are documentation only and never execute on this page.

Install command
npm install @wts-calendar/core
TypeScript integration
import { verifyCalendarLicense } from '@wts-calendar/core';
import { PremiumCalendarInteroperability } from '@wts-calendar/core/premium-interoperability';
import type {
  CalendarSynchronizationRequest,
  CalendarInteropMutation,
} from '@wts-calendar/core/premium-interoperability';
const license = await verifyCalendarLicense('YOUR_WTS_LICENSE_KEY');
const interoperability = new PremiumCalendarInteroperability({ license });

// Call after your application obtains an authorized session.
export function connectGoogle(getAccessToken: () => string | Promise<string>) {
  const adapter = interoperability.createGoogleCalendarAdapter({
    calendarId: 'primary',
    accessToken: getAccessToken,
    timeZone: 'UTC',
  });
  return {
    // Initial sync: omit cursor. For deltas, supply the retained remoteBase snapshot.
    preview: (request: CalendarSynchronizationRequest) =>
      interoperability.synchronize(adapter, {
        ...request,
        conflictPolicy: 'manual',
        push: false,
      }),
    // Call only after the user resolves conflicts and approves the mutation plan.
    commit: (mutations: readonly CalendarInteropMutation[], signal?: AbortSignal) =>
      adapter.push(mutations, signal ? { signal } : {}),
  };
}

// Example call in your session handler (do not use the WTS key as an OAuth token):
// const connection = connectGoogle(getAccessToken);
// const plan = await connection.preview({
//   start: '2026-09-01T00:00:00Z', end: '2026-10-01T00:00:00Z',
//   base: lastCommonEvents, local: currentEvents,
// });
// Show plan.reconciliation.conflicts and plan.mutations in your UI.
// After approval, await connection.commit(approvedMutations).
// Pull again and retain the fresh remote IDs/ETags, cursor and common base.

Application responsibilities

Supply getAccessToken from your own OAuth connection. Use a read/write calendar grant, keep access tokens in memory, and handle expiration or revocation. Never put a client secret or refresh token into browser code.

Start with the last common event base and current local events. On incremental pulls, retain the complete remoteBase snapshot as well as the cursor. A delta response alone is not a full snapshot.

Preview does not write to the provider. Resolve every manual conflict before committing reviewed mutations; catch network and ETag conflict errors and refresh instead of blindly overwriting. Re-pull after successful writes before updating sync state.

The package does not schedule background sync, obtain OAuth consent, or persist session state. Disconnect and abort pending requests when the user signs out.

Behavior and lifecycle

  • Incremental pulls include remote deletions, and writes use conditional ETags when available.
  • Synchronization defaults to planning without push so the application can inspect conflicts first.

Limits and responsibilities

  • A WTS license is not a Google API key or OAuth token.
  • Credentials, cursor persistence, scheduling sync cycles, and unattended token refresh remain customer-controlled.
Premium

Enable this capability

Optional module
@wts-calendar/core/premium-interoperability
Signed entitlement
premium-interoperability

Request the required features and deployment origins by email. Pricing and terms are confirmed privately. A WTS license is separate from provider credentials; do not send passwords or production access tokens.

Email for a license key →

This public guide does not execute Premium modules or collect license tokens.