skedyul 0.1.27 → 0.1.29
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/dist/types.d.ts +44 -0
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -132,12 +132,56 @@ export interface WebhookContext {
|
|
|
132
132
|
env: Record<string, string | undefined>;
|
|
133
133
|
}
|
|
134
134
|
export type WebhookHandler = (request: WebhookRequest, context: WebhookContext) => Promise<WebhookResponse> | WebhookResponse;
|
|
135
|
+
export interface WebhookLifecycleContext {
|
|
136
|
+
/** The Skedyul-generated webhook URL for this webhook */
|
|
137
|
+
webhookUrl: string;
|
|
138
|
+
/** Environment variables available during lifecycle operation */
|
|
139
|
+
env: Record<string, string | undefined>;
|
|
140
|
+
}
|
|
141
|
+
export interface CommunicationChannelLifecycleContext extends WebhookLifecycleContext {
|
|
142
|
+
/** The communication channel being configured */
|
|
143
|
+
communicationChannel: {
|
|
144
|
+
id: string;
|
|
145
|
+
/** The identifier value (e.g., phone number like "+15551234567") */
|
|
146
|
+
identifierValue: string;
|
|
147
|
+
/** The channel handle (e.g., "sms") */
|
|
148
|
+
handle: string;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export interface WebhookLifecycleResult {
|
|
152
|
+
/** External ID from the provider (e.g., Twilio phone number SID) */
|
|
153
|
+
externalId: string;
|
|
154
|
+
/** Optional message describing what was configured */
|
|
155
|
+
message?: string;
|
|
156
|
+
/** Optional metadata from the provider */
|
|
157
|
+
metadata?: Record<string, unknown>;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Lifecycle hook for webhook operations.
|
|
161
|
+
* Return null if the API doesn't support programmatic management
|
|
162
|
+
* (user must configure manually).
|
|
163
|
+
*/
|
|
164
|
+
export type WebhookLifecycleHook<TContext = WebhookLifecycleContext> = (context: TContext) => Promise<WebhookLifecycleResult | null | undefined> | WebhookLifecycleResult | null | undefined;
|
|
135
165
|
export interface WebhookDefinition {
|
|
136
166
|
name: string;
|
|
137
167
|
description: string;
|
|
138
168
|
/** HTTP methods this webhook accepts. Defaults to ['POST'] */
|
|
139
169
|
methods?: ('GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH')[];
|
|
140
170
|
handler: WebhookHandler;
|
|
171
|
+
/** Called when the app is installed to a workplace. Return null if manual setup required. */
|
|
172
|
+
onAppInstalled?: WebhookLifecycleHook;
|
|
173
|
+
/** Called when the app is uninstalled from a workplace. Return null if manual cleanup required. */
|
|
174
|
+
onAppUninstalled?: WebhookLifecycleHook;
|
|
175
|
+
/** Called when a new app version is provisioned. Return null if manual setup required. */
|
|
176
|
+
onAppVersionProvisioned?: WebhookLifecycleHook;
|
|
177
|
+
/** Called when an app version is deprovisioned. Return null if manual cleanup required. */
|
|
178
|
+
onAppVersionDeprovisioned?: WebhookLifecycleHook;
|
|
179
|
+
/** Called when a communication channel is created. Return null if manual setup required. */
|
|
180
|
+
onCommunicationChannelCreated?: WebhookLifecycleHook<CommunicationChannelLifecycleContext>;
|
|
181
|
+
/** Called when a communication channel is updated. Return null if manual update required. */
|
|
182
|
+
onCommunicationChannelUpdated?: WebhookLifecycleHook<CommunicationChannelLifecycleContext>;
|
|
183
|
+
/** Called when a communication channel is deleted. Return null if manual cleanup required. */
|
|
184
|
+
onCommunicationChannelDeleted?: WebhookLifecycleHook<CommunicationChannelLifecycleContext>;
|
|
141
185
|
}
|
|
142
186
|
export type WebhookRegistry = Record<string, WebhookDefinition>;
|
|
143
187
|
export type WebhookName<T extends WebhookRegistry> = Extract<keyof T, string>;
|