import type { CalendarConnectionClient, CancelEventsScriptInput, CancelEventsScriptOutput, CreateEventsScriptInput, CreateEventsScriptOutput, UpdateEventsScriptInput, UpdateEventsScriptOutput, CreateSchedulingLinkScriptInput, CreateSchedulingLinkScriptOutput, UpdateSchedulingLinkScriptInput, UpdateSchedulingLinkScriptOutput, DeleteSchedulingLinksScriptInput, DeleteSchedulingLinksScriptOutput, ListCalendarsScriptInput, ListCalendarsScriptOutput } from "./calendar.generated.js"; import { type OAuthConfiguration } from "./oauth.js"; import { type ConnectionClients } from "./providers.generated.js"; /** A setup requirement. The property name in a workflow supplies its key. */ export type WorkflowConnection = { type: TProvider; oauth?: OAuthConfiguration; calendar?: CalendarConnectionOptions; }; export type CalendarConnectionOptions = { targets: Record; }; export type WorkflowConnectionDeclarations = Readonly>; /** A named target bound to its workflow's Calendar connection, not a provider ID. */ export type CalendarTriggerTarget = Pick & { readonly connectionKey: TKey; }; type CalendarTargets> = { readonly [TTarget in keyof TOptions["targets"]]: { readonly target: TTarget; } & TBinding; }; /** Declaration-time target references. No provider clients or credentials are available here. */ export type WorkflowTriggerConnections = { readonly [TKey in WorkflowConnectionKeys]: TConnections[TKey] extends { calendar: infer TOptions extends CalendarConnectionOptions; } ? { readonly targets: CalendarTargets; } : never; }; /** Serialized connection requirement sent in the workflow manifest. */ export type WorkflowConnectionRequirement = WorkflowConnection & { key: string; }; /** Declared property names belonging to one provider. */ export type WorkflowConnectionKeys = Extract<{ [TKey in keyof TConnections]: TConnections[TKey]["type"] extends TProvider ? TKey : never; }[keyof TConnections], string>; /** Requirements are declarations, not credentials or permission grants. */ export declare const connections: { oauth(options: OAuthConfiguration): WorkflowConnection<"oauth">; calendar: (options: TOptions & Record, never>) => Omit, "calendar"> & { calendar: TOptions; }; mail: () => WorkflowConnection<"mail">; slack: () => WorkflowConnection<"slack">; googleDriveOauth: () => WorkflowConnection<"googleDriveOauth">; discord: () => WorkflowConnection<"discord">; cursor: () => WorkflowConnection<"cursor">; box: () => WorkflowConnection<"box">; confluence: () => WorkflowConnection<"confluence">; googleDrive: () => WorkflowConnection<"googleDrive">; salesforce: () => WorkflowConnection<"salesforce">; }; export type { OAuthConfiguration } from "./oauth.js"; export type OAuthConnection = { accessToken(): Promise; }; type WorkflowConnectionClients = ConnectionClients & { oauth: OAuthConnection; }; /** Write groups require one calendar returned by listCalendars, never implicit fan-out. */ type CalendarWriteTarget = { [TKey in keyof TOptions["targets"]]: TOptions["targets"][TKey]["permissions"] extends "read_write" ? { target: TKey; calendarKey: string; } | (TOptions["targets"][TKey]["multiple"] extends false ? { target: TKey; } : never) : never; }[keyof TOptions["targets"]]; type CalendarWorkflowClient = Omit & { readonly targets: CalendarTargets; listCalendars>(args: Omit & { calendars: ListCalendarsScriptInput["calendars"] & { target: TKey; }; }): Promise>; createEvents(args: Omit & { events: Array & { calendar: CalendarWriteTarget; }>; }): Promise; updateEvents(args: Omit & { calendar: CalendarWriteTarget; }): Promise; cancelEvents(args: Omit & { calendar: CalendarWriteTarget; }): Promise; createSchedulingLink(args: Omit & { bookingCalendar: CalendarWriteTarget; }): Promise; updateSchedulingLink(args: Omit & { calendar: CalendarWriteTarget; patch?: Omit, "bookingCalendar"> & { bookingCalendar?: CalendarWriteTarget; }; }): Promise; deleteSchedulingLinks(args: Omit & { calendar: CalendarWriteTarget; }): Promise; }; export type WorkflowConnections = { readonly [TKey in keyof TConnections]: TConnections[TKey] extends { calendar: infer TOptions extends CalendarConnectionOptions; } ? CalendarWorkflowClient : WorkflowConnectionClients[Extract]; }; //# sourceMappingURL=connections.d.ts.map