@contractspec/example.calendar-google 1.57.0 → 1.59.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.
- package/.turbo/turbo-build.log +34 -33
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +25 -0
- package/dist/browser/docs/calendar-google.docblock.js +45 -0
- package/dist/browser/docs/index.js +45 -0
- package/dist/browser/example.js +33 -0
- package/dist/browser/index.js +164 -0
- package/dist/browser/run.js +89 -0
- package/dist/browser/sync.js +87 -0
- package/dist/docs/calendar-google.docblock.d.ts +2 -1
- package/dist/docs/calendar-google.docblock.d.ts.map +1 -0
- package/dist/docs/calendar-google.docblock.js +25 -28
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +46 -1
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +32 -42
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +164 -4
- package/dist/node/docs/calendar-google.docblock.js +45 -0
- package/dist/node/docs/index.js +45 -0
- package/dist/node/example.js +33 -0
- package/dist/node/index.js +164 -0
- package/dist/node/run.js +89 -0
- package/dist/node/sync.js +87 -0
- package/dist/run.d.ts +2 -1
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +86 -8
- package/dist/sync.d.ts +8 -12
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +70 -74
- package/package.json +69 -26
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -33
- package/dist/docs/calendar-google.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/run.js.map +0 -1
- package/dist/sync.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
package/dist/example.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'calendar-google',\n version: '1.0.0',\n title: 'Google Calendar',\n description:\n 'List upcoming events and create a new event using the Google Calendar provider.',\n kind: 'integration',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.integrations'],\n tags: ['calendar', 'google-calendar', 'integrations'],\n },\n docs: {\n rootDocId: 'docs.examples.calendar-google',\n usageDocId: 'docs.examples.calendar-google.usage',\n },\n entrypoints: {\n packageName: '@contractspec/example.calendar-google',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['markdown', 'specs'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,yBAAyB;EAClC,MAAM;GAAC;GAAY;GAAmB;GAAe;EACtD;CACD,MAAM;EACJ,WAAW;EACX,YAAY;EACb;CACD,aAAa;EACX,aAAa;EACb,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,YAAY,QAAQ;GAAE;EACxD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC"}
|
package/dist/run.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","names":[],"sources":["../src/run.ts"],"sourcesContent":["import { runCalendarSyncFromEnv } from './sync';\n\nrunCalendarSyncFromEnv()\n .then((result) => {\n console.log(JSON.stringify(result, null, 2));\n })\n .catch((error) => {\n console.error(error);\n process.exitCode = 1;\n });\n"],"mappings":";;;AAEA,wBAAwB,CACrB,MAAM,WAAW;AAChB,SAAQ,IAAI,KAAK,UAAU,QAAQ,MAAM,EAAE,CAAC;EAC5C,CACD,OAAO,UAAU;AAChB,SAAQ,MAAM,MAAM;AACpB,SAAQ,WAAW;EACnB"}
|
package/dist/sync.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","names":[],"sources":["../src/sync.ts"],"sourcesContent":["import { google } from 'googleapis';\nimport { GoogleCalendarProvider } from '@contractspec/integration.providers-impls/impls/google-calendar';\nimport type {\n CalendarEvent,\n CalendarEventInput,\n CalendarListEventsQuery,\n CalendarProvider,\n} from '@contractspec/integration.providers-impls/calendar';\n\nexport interface CalendarSyncOutput {\n created?: CalendarEvent | CalendarEventInput;\n upcoming: CalendarEvent[] | CalendarEventInput[];\n}\n\nexport async function runCalendarSyncFromEnv(): Promise<CalendarSyncOutput> {\n const calendarId = resolveCalendarId();\n const dryRun = process.env.CONTRACTSPEC_CALENDAR_DRY_RUN === 'true';\n const eventInput = buildSampleEvent(calendarId);\n const listQuery = buildUpcomingQuery(calendarId);\n\n if (dryRun) {\n return { created: eventInput, upcoming: [eventInput] };\n }\n\n const provider = createProviderFromEnv(calendarId);\n const created = await provider.createEvent(eventInput);\n const upcoming = await provider.listEvents(listQuery);\n return { created, upcoming: upcoming.events };\n}\n\nexport function buildSampleEvent(calendarId: string): CalendarEventInput {\n const start = new Date();\n const end = new Date(start.getTime() + 30 * 60 * 1000);\n return {\n calendarId,\n title: 'Product sync review',\n description: 'Review onboarding friction and sync action items.',\n location: 'Zoom',\n start,\n end,\n conference: { create: true, type: 'google_meet' },\n attendees: [{ email: 'teammate@example.com', name: 'Teammate' }],\n reminders: [{ method: 'popup', minutesBeforeStart: 10 }],\n metadata: { source: 'contractspec-example' },\n };\n}\n\nexport function buildUpcomingQuery(\n calendarId: string\n): CalendarListEventsQuery {\n const now = new Date();\n const inSevenDays = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000);\n return {\n calendarId,\n timeMin: now,\n timeMax: inSevenDays,\n maxResults: 5,\n };\n}\n\nexport function createProviderFromEnv(calendarId: string): CalendarProvider {\n const auth = createGoogleAuthFromEnv();\n return new GoogleCalendarProvider({ auth, calendarId });\n}\n\nfunction createGoogleAuthFromEnv() {\n const clientId = requireEnv('GOOGLE_CLIENT_ID');\n const clientSecret = requireEnv('GOOGLE_CLIENT_SECRET');\n const refreshToken = requireEnv('GOOGLE_REFRESH_TOKEN');\n const redirectUri =\n process.env.GOOGLE_REDIRECT_URI ??\n 'https://developers.google.com/oauthplayground';\n const oauth = new google.auth.OAuth2(clientId, clientSecret, redirectUri);\n oauth.setCredentials({ refresh_token: refreshToken });\n return oauth;\n}\n\nfunction resolveCalendarId(): string {\n return process.env.GOOGLE_CALENDAR_ID ?? 'primary';\n}\n\nfunction requireEnv(key: string): string {\n const value = process.env[key];\n if (!value) {\n throw new Error(buildMissingEnvMessage(key));\n }\n return value;\n}\n\nfunction buildMissingEnvMessage(key: string): string {\n if (key !== 'GOOGLE_REFRESH_TOKEN') {\n return `Missing required env var: ${key}`;\n }\n return [\n `Missing required env var: ${key}`,\n 'Get a refresh token with OAuth Playground:',\n '1) Open https://developers.google.com/oauthplayground',\n '2) Click the gear icon and enable \"Use your own OAuth credentials\"',\n '3) Enter GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET',\n '4) Authorize scope https://www.googleapis.com/auth/calendar',\n '5) Exchange for tokens and copy the refresh token',\n 'Then export GOOGLE_REFRESH_TOKEN and rerun the script.',\n ].join('\\n');\n}\n"],"mappings":";;;;AAcA,eAAsB,yBAAsD;CAC1E,MAAM,aAAa,mBAAmB;CACtC,MAAM,SAAS,QAAQ,IAAI,kCAAkC;CAC7D,MAAM,aAAa,iBAAiB,WAAW;CAC/C,MAAM,YAAY,mBAAmB,WAAW;AAEhD,KAAI,OACF,QAAO;EAAE,SAAS;EAAY,UAAU,CAAC,WAAW;EAAE;CAGxD,MAAM,WAAW,sBAAsB,WAAW;AAGlD,QAAO;EAAE,SAFO,MAAM,SAAS,YAAY,WAAW;EAEpC,WADD,MAAM,SAAS,WAAW,UAAU,EAChB;EAAQ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