@automate.ax/integration-contracts 0.144.2 → 0.145.1

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.
@@ -0,0 +1,502 @@
1
+ import { encodableSchema, type Encodable } from "@automate.ax/codec"
2
+ import * as z from "zod"
3
+
4
+ export const CALCOM_WEBHOOK_TRIGGER_TYPES = [
5
+ "AFTER_GUESTS_CAL_VIDEO_NO_SHOW",
6
+ "AFTER_HOSTS_CAL_VIDEO_NO_SHOW",
7
+ "BOOKING_CANCELLED",
8
+ "BOOKING_CREATED",
9
+ "BOOKING_LOCATION_UPDATED",
10
+ "BOOKING_NO_SHOW_UPDATED",
11
+ "BOOKING_PAID",
12
+ "BOOKING_PAYMENT_INITIATED",
13
+ "BOOKING_REASSIGNED",
14
+ "BOOKING_REJECTED",
15
+ "BOOKING_REQUESTED",
16
+ "BOOKING_RESCHEDULED",
17
+ "CALENDAR_ENTRY_REJECTED",
18
+ "DELEGATION_CREDENTIAL_ERROR",
19
+ "DELEGATION_CREDENTIAL_ROTATION_REQUIRED",
20
+ "DELEGATION_CREDENTIAL_SECRET_ROTATED",
21
+ "DELEGATION_CREDENTIAL_SECRET_ROTATION_FAILED",
22
+ "FORM_SUBMITTED",
23
+ "FORM_SUBMITTED_NO_EVENT",
24
+ "INSTANT_MEETING",
25
+ "INSTANT_MEETING_ACCEPTED",
26
+ "MEETING_ENDED",
27
+ "MEETING_STARTED",
28
+ "OOO_CREATED",
29
+ "RECORDING_READY",
30
+ "RECORDING_TRANSCRIPTION_GENERATED",
31
+ "ROUTING_FORM_FALLBACK_HIT",
32
+ "WRONG_ASSIGNMENT_REPORT",
33
+ ] as const
34
+
35
+ export type CalcomWebhookTriggerType =
36
+ (typeof CALCOM_WEBHOOK_TRIGGER_TYPES)[number]
37
+
38
+ const CALCOM_WEBHOOK_TRIGGER_TYPE_SET = new Set<string>(
39
+ CALCOM_WEBHOOK_TRIGGER_TYPES,
40
+ )
41
+
42
+ const CALCOM_PERSON_SCHEMA = z.looseObject({
43
+ email: z.email(),
44
+ id: z.number().int().optional(),
45
+ language: z.looseObject({ locale: z.string() }),
46
+ name: z.string(),
47
+ phoneNumber: z.string().nullable().optional(),
48
+ timeZone: z.string(),
49
+ username: z.string().nullable().optional(),
50
+ utcOffset: z.number().optional(),
51
+ })
52
+ const CALCOM_OUT_OF_OFFICE_COVER_SCHEMA = z.looseObject({
53
+ email: z.email().optional(),
54
+ id: z.number().int(),
55
+ name: z.string().nullable().optional(),
56
+ timeZone: z.string().optional(),
57
+ username: z.string().nullable().optional(),
58
+ })
59
+ const CALCOM_OUT_OF_OFFICE_USER_SCHEMA = CALCOM_PERSON_SCHEMA.extend({
60
+ id: z.number().int(),
61
+ name: z.string().nullable(),
62
+ timeZone: z.string(),
63
+ username: z.string().nullable(),
64
+ })
65
+ const ENCODABLE_RECORD_SCHEMA = z.record(z.string(), encodableSchema)
66
+ const BOOKING_PAYLOAD_SCHEMA = z.looseObject({
67
+ additionalNotes: z.string().optional(),
68
+ attendees: CALCOM_PERSON_SCHEMA.array(),
69
+ bookingId: z.number().int(),
70
+ customInputs: ENCODABLE_RECORD_SCHEMA.nullable().optional(),
71
+ description: z.string(),
72
+ endTime: z.string(),
73
+ eventDescription: z.string().nullable().optional(),
74
+ eventTitle: z.string().optional(),
75
+ eventTypeId: z.number().int().nullable().optional(),
76
+ location: encodableSchema.optional(),
77
+ metadata: ENCODABLE_RECORD_SCHEMA.optional(),
78
+ organizer: CALCOM_PERSON_SCHEMA,
79
+ responses: ENCODABLE_RECORD_SCHEMA.nullable().optional(),
80
+ startTime: z.string(),
81
+ status: z.string(),
82
+ title: z.string(),
83
+ type: z.string(),
84
+ uid: z.string(),
85
+ })
86
+ const BOOKING_PAYLOAD_WITH_ICS_SCHEMA = BOOKING_PAYLOAD_SCHEMA.extend({
87
+ attendeeIcsContent: z.string().optional(),
88
+ organizerIcsContent: z.string().optional(),
89
+ })
90
+ const FORM_SUBMISSION_PAYLOAD_SCHEMA = z.looseObject({
91
+ formId: z.string(),
92
+ formName: z.string(),
93
+ responses: ENCODABLE_RECORD_SCHEMA,
94
+ teamId: z.number().int().nullable().optional(),
95
+ })
96
+ const DELEGATION_CREDENTIAL_SCHEMA = z.looseObject({
97
+ domain: z.string(),
98
+ id: z.string(),
99
+ organizationId: z.number().int(),
100
+ secretExpiresAt: z.iso.datetime({ offset: true }),
101
+ workspacePlatform: z.string(),
102
+ })
103
+ const CAL_VIDEO_NO_SHOW_SCHEMA = z.looseObject({
104
+ attendees: CALCOM_PERSON_SCHEMA.array(),
105
+ bookingId: z.number().int(),
106
+ bookingUid: z.string(),
107
+ endTime: z.string(),
108
+ message: z.string(),
109
+ participants: encodableSchema.array(),
110
+ startTime: z.string(),
111
+ title: z.string(),
112
+ webhook: z.looseObject({
113
+ id: z.union([z.number(), z.string()]),
114
+ subscriberUrl: z.url(),
115
+ time: z.number(),
116
+ timeUnit: z.string(),
117
+ }),
118
+ })
119
+ const CALCOM_MEETING_EVENT_SCHEMA = z.looseObject({
120
+ attendees: CALCOM_PERSON_SCHEMA.array(),
121
+ createdAt: z.iso.datetime({ offset: true }),
122
+ endTime: z.string(),
123
+ id: z.number().int(),
124
+ startTime: z.string(),
125
+ title: z.string(),
126
+ uid: z.string(),
127
+ })
128
+ const CALCOM_PAYLOAD_SCHEMAS = {
129
+ AFTER_GUESTS_CAL_VIDEO_NO_SHOW: CAL_VIDEO_NO_SHOW_SCHEMA,
130
+ AFTER_HOSTS_CAL_VIDEO_NO_SHOW: CAL_VIDEO_NO_SHOW_SCHEMA.extend({
131
+ hostEmail: z.email(),
132
+ noShowHost: z.boolean(),
133
+ }),
134
+ BOOKING_CANCELLED: BOOKING_PAYLOAD_WITH_ICS_SCHEMA.extend({
135
+ cancelledBy: z.string().optional(),
136
+ cancellationReason: z.string().optional(),
137
+ requestReschedule: z.boolean(),
138
+ }),
139
+ BOOKING_CREATED: BOOKING_PAYLOAD_WITH_ICS_SCHEMA,
140
+ BOOKING_LOCATION_UPDATED: BOOKING_PAYLOAD_SCHEMA.extend({
141
+ previousLocation: encodableSchema,
142
+ }),
143
+ BOOKING_NO_SHOW_UPDATED: z.looseObject({
144
+ attendees: z.looseObject({ email: z.email(), noShow: z.boolean() }).array(),
145
+ bookingId: z.number().int().optional(),
146
+ bookingUid: z.string(),
147
+ message: z.string(),
148
+ }),
149
+ BOOKING_PAID: BOOKING_PAYLOAD_WITH_ICS_SCHEMA.extend({
150
+ paymentData: ENCODABLE_RECORD_SCHEMA.optional(),
151
+ paymentId: z.number().int().optional(),
152
+ }),
153
+ BOOKING_PAYMENT_INITIATED: BOOKING_PAYLOAD_SCHEMA.extend({
154
+ paymentData: ENCODABLE_RECORD_SCHEMA.optional(),
155
+ paymentId: z.number().int().optional(),
156
+ }),
157
+ BOOKING_REASSIGNED: BOOKING_PAYLOAD_WITH_ICS_SCHEMA.extend({
158
+ addedHostUserIds: z.number().int().array(),
159
+ removedHostUserIds: z.number().int().array(),
160
+ }),
161
+ BOOKING_REJECTED: BOOKING_PAYLOAD_SCHEMA.extend({
162
+ rejectionReason: z.string().optional(),
163
+ }),
164
+ BOOKING_REQUESTED: BOOKING_PAYLOAD_SCHEMA.extend({
165
+ requiresConfirmation: z.boolean(),
166
+ }),
167
+ BOOKING_RESCHEDULED: BOOKING_PAYLOAD_WITH_ICS_SCHEMA.extend({
168
+ rescheduleId: z.number().int().optional(),
169
+ rescheduleEndTime: z.string().optional(),
170
+ rescheduleStartTime: z.string().optional(),
171
+ rescheduleUid: z.string().optional(),
172
+ rescheduledBy: z.string().optional(),
173
+ }),
174
+ CALENDAR_ENTRY_REJECTED: z.looseObject({}),
175
+ DELEGATION_CREDENTIAL_ERROR: z.looseObject({
176
+ credential: z.looseObject({
177
+ appId: z.string(),
178
+ delegationCredentialId: z.string(),
179
+ id: z.number().int(),
180
+ type: z.string(),
181
+ }),
182
+ error: z.looseObject({ message: z.string(), type: z.string() }),
183
+ user: z.looseObject({
184
+ email: z.email(),
185
+ id: z.number().int(),
186
+ organizationId: z.number().int(),
187
+ }),
188
+ }),
189
+ DELEGATION_CREDENTIAL_ROTATION_REQUIRED: z.looseObject({
190
+ delegationCredential: DELEGATION_CREDENTIAL_SCHEMA,
191
+ }),
192
+ DELEGATION_CREDENTIAL_SECRET_ROTATED: z.looseObject({
193
+ delegationCredential: DELEGATION_CREDENTIAL_SCHEMA,
194
+ }),
195
+ DELEGATION_CREDENTIAL_SECRET_ROTATION_FAILED: z.looseObject({
196
+ delegationCredential: DELEGATION_CREDENTIAL_SCHEMA,
197
+ error: z.looseObject({
198
+ code: z.enum(["SECRET_MINT_FAILED", "SECRET_PROMOTION_FAILED"]),
199
+ message: z.string(),
200
+ }),
201
+ }),
202
+ FORM_SUBMITTED: FORM_SUBMISSION_PAYLOAD_SCHEMA,
203
+ FORM_SUBMITTED_NO_EVENT: FORM_SUBMISSION_PAYLOAD_SCHEMA.extend({
204
+ redirect: ENCODABLE_RECORD_SCHEMA.optional(),
205
+ responseId: z.number().int().optional(),
206
+ }),
207
+ INSTANT_MEETING: z.looseObject({
208
+ connectAndJoinUrl: z.url(),
209
+ customInputs: ENCODABLE_RECORD_SCHEMA,
210
+ eventTypeId: z.number().int(),
211
+ eventTypeTitle: z.string(),
212
+ responses: ENCODABLE_RECORD_SCHEMA,
213
+ uid: z.string(),
214
+ }),
215
+ INSTANT_MEETING_ACCEPTED: z.looseObject({
216
+ attendees: CALCOM_PERSON_SCHEMA.array(),
217
+ bookingId: z.number().int(),
218
+ bookingUid: z.string(),
219
+ endTime: z.string(),
220
+ eventTypeId: z.number().int(),
221
+ organizer: CALCOM_PERSON_SCHEMA,
222
+ startTime: z.string(),
223
+ status: z.string(),
224
+ title: z.string(),
225
+ }),
226
+ OOO_CREATED: z.looseObject({
227
+ oooEntry: z.looseObject({
228
+ createdAt: z.iso.datetime({ offset: true }),
229
+ end: z.string(),
230
+ id: z.number().int(),
231
+ notes: z.string().nullable(),
232
+ reason: z.looseObject({
233
+ emoji: z.string().optional(),
234
+ reason: z.string().optional(),
235
+ }),
236
+ reasonId: z.number().int(),
237
+ start: z.string(),
238
+ toUser: CALCOM_OUT_OF_OFFICE_COVER_SCHEMA.nullable(),
239
+ updatedAt: z.iso.datetime({ offset: true }),
240
+ user: CALCOM_OUT_OF_OFFICE_USER_SCHEMA,
241
+ uuid: z.string(),
242
+ }),
243
+ }),
244
+ RECORDING_READY: BOOKING_PAYLOAD_SCHEMA.pick({
245
+ attendees: true,
246
+ endTime: true,
247
+ organizer: true,
248
+ startTime: true,
249
+ title: true,
250
+ uid: true,
251
+ }).extend({ downloadLink: z.url() }),
252
+ RECORDING_TRANSCRIPTION_GENERATED: BOOKING_PAYLOAD_SCHEMA.pick({
253
+ attendees: true,
254
+ endTime: true,
255
+ organizer: true,
256
+ startTime: true,
257
+ title: true,
258
+ uid: true,
259
+ }).extend({
260
+ downloadLinks: z
261
+ .looseObject({
262
+ recording: z.url().optional(),
263
+ transcription: z
264
+ .looseObject({ format: z.string(), link: z.url() })
265
+ .array()
266
+ .optional(),
267
+ })
268
+ .optional(),
269
+ }),
270
+ ROUTING_FORM_FALLBACK_HIT: FORM_SUBMISSION_PAYLOAD_SCHEMA,
271
+ WRONG_ASSIGNMENT_REPORT: z.looseObject({
272
+ booking: z.looseObject({
273
+ endTime: z.string(),
274
+ id: z.number().int(),
275
+ startTime: z.string(),
276
+ status: z.string(),
277
+ title: z.string(),
278
+ uid: z.string(),
279
+ }),
280
+ report: z.looseObject({
281
+ additionalNotes: z.string().nullable(),
282
+ correctAssignee: z.string().nullable(),
283
+ firstAssignmentReason: z.string().nullable(),
284
+ guest: z.string().nullable(),
285
+ host: z.looseObject({
286
+ email: z.email().nullable(),
287
+ name: z.string().nullable(),
288
+ }),
289
+ reportedBy: z.looseObject({
290
+ email: z.email(),
291
+ id: z.number().int(),
292
+ name: z.string().nullable(),
293
+ }),
294
+ routingReason: z.string().nullable().optional(),
295
+ }),
296
+ }),
297
+ } as const satisfies Record<
298
+ Exclude<CalcomWebhookTriggerType, "MEETING_ENDED" | "MEETING_STARTED">,
299
+ z.ZodType
300
+ >
301
+
302
+ type CalcomWrappedTriggerType = keyof typeof CALCOM_PAYLOAD_SCHEMAS
303
+
304
+ /** Payload selected by one wrapped Cal.com webhook type. */
305
+ type CalcomPayload<TType extends CalcomWrappedTriggerType> = z.output<
306
+ (typeof CALCOM_PAYLOAD_SCHEMAS)[TType]
307
+ > & { readonly [key: string]: Encodable }
308
+
309
+ /** Shared flat payload used by Cal.com meeting lifecycle webhooks. */
310
+ type CalcomMeetingPayload = z.output<typeof CALCOM_MEETING_EVENT_SCHEMA> & {
311
+ readonly [key: string]: Encodable
312
+ }
313
+
314
+ /** Common person shape in Cal.com webhook payloads. */
315
+ export type CalcomWebhookPerson = z.output<typeof CALCOM_PERSON_SCHEMA> & {
316
+ readonly [key: string]: Encodable
317
+ }
318
+
319
+ /** JSON-safe Cal.com webhook event narrowed by its exact provider type. */
320
+ export type CalcomEvent<
321
+ TType extends CalcomWebhookTriggerType = CalcomWebhookTriggerType,
322
+ > = TType extends "MEETING_ENDED" | "MEETING_STARTED"
323
+ ? CalcomMeetingPayload & { triggerEvent: TType }
324
+ : TType extends CalcomWrappedTriggerType
325
+ ? {
326
+ readonly [key: string]: Encodable
327
+ createdAt: string
328
+ payload: CalcomPayload<TType>
329
+ triggerEvent: TType
330
+ }
331
+ : never
332
+
333
+ export const CALCOM_TRIGGER_CONFIG_SCHEMA = z.object({})
334
+
335
+ export const CALCOM_EVENT_SCHEMA: z.ZodType<CalcomEvent> =
336
+ z.custom<CalcomEvent>((value) => {
337
+ if (
338
+ typeof value !== "object" ||
339
+ value === null ||
340
+ !("triggerEvent" in value) ||
341
+ typeof value.triggerEvent !== "string" ||
342
+ !isCalcomWebhookTriggerType(value.triggerEvent)
343
+ ) {
344
+ return false
345
+ }
346
+ return calcomSemanticEventSchema(value.triggerEvent).safeParse(value)
347
+ .success
348
+ })
349
+
350
+ /**
351
+ * Builds a schema narrowed to one exact Cal.com webhook trigger.
352
+ *
353
+ * @param type Exact Cal.com provider event type.
354
+ */
355
+ export function calcomSemanticEventSchema<
356
+ TType extends CalcomWebhookTriggerType,
357
+ >(type: TType): z.ZodType<CalcomEvent<TType>> {
358
+ if (type === "MEETING_ENDED" || type === "MEETING_STARTED") {
359
+ const schema = CALCOM_MEETING_EVENT_SCHEMA.extend({
360
+ triggerEvent: z.literal(type),
361
+ })
362
+ return z.custom<CalcomEvent<TType>>(
363
+ (value) => schema.safeParse(value).success,
364
+ )
365
+ }
366
+ if (isCalcomWrappedTriggerType(type)) {
367
+ const schema = z.looseObject({
368
+ createdAt: z.iso.datetime({ offset: true }),
369
+ payload: CALCOM_PAYLOAD_SCHEMAS[type],
370
+ triggerEvent: z.literal(type),
371
+ })
372
+ return z.custom<CalcomEvent<TType>>(
373
+ (value) => schema.safeParse(value).success,
374
+ )
375
+ }
376
+ return z.never()
377
+ }
378
+
379
+ /**
380
+ * Returns whether a string is a supported Cal.com webhook type.
381
+ *
382
+ * @param value Candidate provider event type.
383
+ */
384
+ function isCalcomWebhookTriggerType(
385
+ value: string,
386
+ ): value is CalcomWebhookTriggerType {
387
+ return CALCOM_WEBHOOK_TRIGGER_TYPE_SET.has(value)
388
+ }
389
+
390
+ /**
391
+ * Returns whether a Cal.com webhook carries its data under `payload`.
392
+ *
393
+ * @param type Supported Cal.com webhook type.
394
+ */
395
+ function isCalcomWrappedTriggerType(
396
+ type: CalcomWebhookTriggerType,
397
+ ): type is CalcomWrappedTriggerType {
398
+ return Object.hasOwn(CALCOM_PAYLOAD_SCHEMAS, type)
399
+ }
400
+
401
+ type CalcomTriggerContract<TEvent> = {
402
+ readonly configSchema: typeof CALCOM_TRIGGER_CONFIG_SCHEMA
403
+ readonly eventSchema: z.ZodType<TEvent>
404
+ }
405
+
406
+ export const CALCOM_EVENT_TYPE_MAP = {
407
+ AFTER_GUESTS_CAL_VIDEO_NO_SHOW: "calcom.afterGuestsCalVideoNoShow",
408
+ AFTER_HOSTS_CAL_VIDEO_NO_SHOW: "calcom.afterHostsCalVideoNoShow",
409
+ BOOKING_CANCELLED: "calcom.booking.cancelled",
410
+ BOOKING_CREATED: "calcom.booking.created",
411
+ BOOKING_LOCATION_UPDATED: "calcom.booking.locationUpdated",
412
+ BOOKING_NO_SHOW_UPDATED: "calcom.booking.noShowUpdated",
413
+ BOOKING_PAID: "calcom.booking.paid",
414
+ BOOKING_PAYMENT_INITIATED: "calcom.booking.paymentInitiated",
415
+ BOOKING_REASSIGNED: "calcom.booking.reassigned",
416
+ BOOKING_REJECTED: "calcom.booking.rejected",
417
+ BOOKING_REQUESTED: "calcom.booking.requested",
418
+ BOOKING_RESCHEDULED: "calcom.booking.rescheduled",
419
+ CALENDAR_ENTRY_REJECTED: "calcom.calendarEntryRejected",
420
+ DELEGATION_CREDENTIAL_ERROR: "calcom.delegationCredential.error",
421
+ DELEGATION_CREDENTIAL_ROTATION_REQUIRED:
422
+ "calcom.delegationCredential.rotationRequired",
423
+ DELEGATION_CREDENTIAL_SECRET_ROTATED:
424
+ "calcom.delegationCredential.secretRotated",
425
+ DELEGATION_CREDENTIAL_SECRET_ROTATION_FAILED:
426
+ "calcom.delegationCredential.secretRotationFailed",
427
+ FORM_SUBMITTED: "calcom.form.submitted",
428
+ FORM_SUBMITTED_NO_EVENT: "calcom.form.submittedWithoutEvent",
429
+ INSTANT_MEETING: "calcom.instantMeeting.created",
430
+ INSTANT_MEETING_ACCEPTED: "calcom.instantMeeting.accepted",
431
+ MEETING_ENDED: "calcom.meeting.ended",
432
+ MEETING_STARTED: "calcom.meeting.started",
433
+ OOO_CREATED: "calcom.outOfOffice.created",
434
+ RECORDING_READY: "calcom.recording.ready",
435
+ RECORDING_TRANSCRIPTION_GENERATED: "calcom.recording.transcriptionGenerated",
436
+ ROUTING_FORM_FALLBACK_HIT: "calcom.routingForm.fallbackHit",
437
+ WRONG_ASSIGNMENT_REPORT: "calcom.wrongAssignmentReported",
438
+ } as const satisfies Record<CalcomWebhookTriggerType, string>
439
+
440
+ /** Exact provider-to-platform trigger contract map. */
441
+ type CalcomSemanticContracts = {
442
+ readonly [TType in CalcomWebhookTriggerType as (typeof CALCOM_EVENT_TYPE_MAP)[TType]]: CalcomTriggerContract<
443
+ CalcomEvent<TType>
444
+ >
445
+ } & { readonly "calcom.event": CalcomTriggerContract<CalcomEvent> }
446
+
447
+ export const calcomTriggerContracts: CalcomSemanticContracts = {
448
+ "calcom.afterGuestsCalVideoNoShow": contract(
449
+ "AFTER_GUESTS_CAL_VIDEO_NO_SHOW",
450
+ ),
451
+ "calcom.afterHostsCalVideoNoShow": contract("AFTER_HOSTS_CAL_VIDEO_NO_SHOW"),
452
+ "calcom.booking.cancelled": contract("BOOKING_CANCELLED"),
453
+ "calcom.booking.created": contract("BOOKING_CREATED"),
454
+ "calcom.booking.locationUpdated": contract("BOOKING_LOCATION_UPDATED"),
455
+ "calcom.booking.noShowUpdated": contract("BOOKING_NO_SHOW_UPDATED"),
456
+ "calcom.booking.paid": contract("BOOKING_PAID"),
457
+ "calcom.booking.paymentInitiated": contract("BOOKING_PAYMENT_INITIATED"),
458
+ "calcom.booking.reassigned": contract("BOOKING_REASSIGNED"),
459
+ "calcom.booking.rejected": contract("BOOKING_REJECTED"),
460
+ "calcom.booking.requested": contract("BOOKING_REQUESTED"),
461
+ "calcom.booking.rescheduled": contract("BOOKING_RESCHEDULED"),
462
+ "calcom.calendarEntryRejected": contract("CALENDAR_ENTRY_REJECTED"),
463
+ "calcom.delegationCredential.error": contract("DELEGATION_CREDENTIAL_ERROR"),
464
+ "calcom.delegationCredential.rotationRequired": contract(
465
+ "DELEGATION_CREDENTIAL_ROTATION_REQUIRED",
466
+ ),
467
+ "calcom.delegationCredential.secretRotated": contract(
468
+ "DELEGATION_CREDENTIAL_SECRET_ROTATED",
469
+ ),
470
+ "calcom.delegationCredential.secretRotationFailed": contract(
471
+ "DELEGATION_CREDENTIAL_SECRET_ROTATION_FAILED",
472
+ ),
473
+ "calcom.event": {
474
+ configSchema: CALCOM_TRIGGER_CONFIG_SCHEMA,
475
+ eventSchema: CALCOM_EVENT_SCHEMA,
476
+ },
477
+ "calcom.form.submitted": contract("FORM_SUBMITTED"),
478
+ "calcom.form.submittedWithoutEvent": contract("FORM_SUBMITTED_NO_EVENT"),
479
+ "calcom.instantMeeting.accepted": contract("INSTANT_MEETING_ACCEPTED"),
480
+ "calcom.instantMeeting.created": contract("INSTANT_MEETING"),
481
+ "calcom.meeting.ended": contract("MEETING_ENDED"),
482
+ "calcom.meeting.started": contract("MEETING_STARTED"),
483
+ "calcom.outOfOffice.created": contract("OOO_CREATED"),
484
+ "calcom.recording.ready": contract("RECORDING_READY"),
485
+ "calcom.recording.transcriptionGenerated": contract(
486
+ "RECORDING_TRANSCRIPTION_GENERATED",
487
+ ),
488
+ "calcom.routingForm.fallbackHit": contract("ROUTING_FORM_FALLBACK_HIT"),
489
+ "calcom.wrongAssignmentReported": contract("WRONG_ASSIGNMENT_REPORT"),
490
+ }
491
+
492
+ /**
493
+ * Builds one trigger contract for an exact Cal.com provider event.
494
+ *
495
+ * @param type Exact Cal.com provider event type.
496
+ */
497
+ function contract<TType extends CalcomWebhookTriggerType>(type: TType) {
498
+ return {
499
+ configSchema: CALCOM_TRIGGER_CONFIG_SCHEMA,
500
+ eventSchema: calcomSemanticEventSchema(type),
501
+ }
502
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./api"
2
+ export * from "./events"
3
+ export * from "./schemas"
4
+ export type { components } from "./openapi-types.generated"