@automate.ax/integration-contracts 0.55.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.
Files changed (136) hide show
  1. package/dist/airtable/api.d.ts +19 -0
  2. package/dist/airtable/api.js +44 -0
  3. package/dist/airtable/index.d.ts +353 -0
  4. package/dist/airtable/index.js +32 -0
  5. package/dist/airtable/schemas.d.ts +716 -0
  6. package/dist/airtable/schemas.js +184 -0
  7. package/dist/asana/api.d.ts +70 -0
  8. package/dist/asana/api.js +119 -0
  9. package/dist/asana/index.d.ts +384 -0
  10. package/dist/asana/index.js +38 -0
  11. package/dist/asana/schemas.d.ts +1060 -0
  12. package/dist/asana/schemas.js +512 -0
  13. package/dist/brevo/api.d.ts +31 -0
  14. package/dist/brevo/api.js +64 -0
  15. package/dist/brevo/index.d.ts +822 -0
  16. package/dist/brevo/index.js +51 -0
  17. package/dist/brevo/schemas.d.ts +1217 -0
  18. package/dist/brevo/schemas.js +332 -0
  19. package/dist/github/index.d.ts +37 -0
  20. package/dist/github/index.js +106 -0
  21. package/dist/github/schemas.d.ts +8014 -0
  22. package/dist/github/schemas.js +113 -0
  23. package/dist/gmail/gmail.d.ts +172 -0
  24. package/dist/gmail/gmail.js +405 -0
  25. package/dist/gmail/index.d.ts +262 -0
  26. package/dist/gmail/index.js +23 -0
  27. package/dist/gmail/schemas.d.ts +444 -0
  28. package/dist/gmail/schemas.js +242 -0
  29. package/dist/google-calendar/event-schemas.d.ts +117 -0
  30. package/dist/google-calendar/event-schemas.js +13 -0
  31. package/dist/google-calendar/google-calendar.d.ts +147 -0
  32. package/dist/google-calendar/google-calendar.js +583 -0
  33. package/dist/google-calendar/index.d.ts +365 -0
  34. package/dist/google-calendar/index.js +24 -0
  35. package/dist/google-calendar/schemas.d.ts +592 -0
  36. package/dist/google-calendar/schemas.js +379 -0
  37. package/dist/google-forms/event-schemas.d.ts +105 -0
  38. package/dist/google-forms/event-schemas.js +20 -0
  39. package/dist/google-forms/google-forms.d.ts +243 -0
  40. package/dist/google-forms/google-forms.js +581 -0
  41. package/dist/google-forms/index.d.ts +141 -0
  42. package/dist/google-forms/index.js +20 -0
  43. package/dist/google-forms/schemas.d.ts +618 -0
  44. package/dist/google-forms/schemas.js +383 -0
  45. package/dist/linear/api.d.ts +63 -0
  46. package/dist/linear/api.js +88 -0
  47. package/dist/linear/index.d.ts +1338 -0
  48. package/dist/linear/index.js +55 -0
  49. package/dist/linear/schemas.d.ts +1795 -0
  50. package/dist/linear/schemas.js +760 -0
  51. package/dist/outlook/graph.d.ts +34 -0
  52. package/dist/outlook/graph.js +98 -0
  53. package/dist/outlook/index.d.ts +115 -0
  54. package/dist/outlook/index.js +11 -0
  55. package/dist/outlook/schemas.d.ts +529 -0
  56. package/dist/outlook/schemas.js +312 -0
  57. package/dist/resend/index.d.ts +707 -0
  58. package/dist/resend/index.js +54 -0
  59. package/dist/resend/schemas.d.ts +1033 -0
  60. package/dist/resend/schemas.js +377 -0
  61. package/dist/slack/index.d.ts +151 -0
  62. package/dist/slack/index.js +22 -0
  63. package/dist/slack/schemas.d.ts +641 -0
  64. package/dist/slack/schemas.js +581 -0
  65. package/dist/teams/graph.d.ts +33 -0
  66. package/dist/teams/graph.js +95 -0
  67. package/dist/teams/index.d.ts +164 -0
  68. package/dist/teams/index.js +21 -0
  69. package/dist/teams/schemas.d.ts +675 -0
  70. package/dist/teams/schemas.js +365 -0
  71. package/dist/trello/api.d.ts +69 -0
  72. package/dist/trello/api.js +140 -0
  73. package/dist/trello/event-schemas.d.ts +1101 -0
  74. package/dist/trello/event-schemas.js +233 -0
  75. package/dist/trello/index.d.ts +721 -0
  76. package/dist/trello/index.js +35 -0
  77. package/dist/trello/schemas.d.ts +283 -0
  78. package/dist/trello/schemas.js +401 -0
  79. package/dist/triggers.d.ts +26 -0
  80. package/dist/triggers.js +33 -0
  81. package/dist/vercel/index.d.ts +1065 -0
  82. package/dist/vercel/index.js +114 -0
  83. package/dist/vercel/schemas.d.ts +1518 -0
  84. package/dist/vercel/schemas.js +335 -0
  85. package/dist/whatsapp/api.d.ts +62 -0
  86. package/dist/whatsapp/api.js +121 -0
  87. package/dist/whatsapp/index.d.ts +614 -0
  88. package/dist/whatsapp/index.js +35 -0
  89. package/dist/whatsapp/schemas.d.ts +926 -0
  90. package/dist/whatsapp/schemas.js +326 -0
  91. package/package.json +169 -0
  92. package/src/airtable/api.ts +66 -0
  93. package/src/airtable/index.ts +41 -0
  94. package/src/airtable/schemas.ts +231 -0
  95. package/src/asana/api.ts +171 -0
  96. package/src/asana/index.ts +49 -0
  97. package/src/asana/schemas.ts +655 -0
  98. package/src/brevo/api.ts +89 -0
  99. package/src/brevo/index.ts +66 -0
  100. package/src/brevo/schemas.ts +449 -0
  101. package/src/github/index.ts +217 -0
  102. package/src/github/schemas.ts +435 -0
  103. package/src/gmail/gmail.ts +577 -0
  104. package/src/gmail/index.ts +26 -0
  105. package/src/gmail/schemas.ts +327 -0
  106. package/src/google-calendar/event-schemas.ts +16 -0
  107. package/src/google-calendar/google-calendar.ts +727 -0
  108. package/src/google-calendar/index.ts +27 -0
  109. package/src/google-calendar/schemas.ts +529 -0
  110. package/src/google-forms/event-schemas.ts +26 -0
  111. package/src/google-forms/google-forms.ts +683 -0
  112. package/src/google-forms/index.ts +23 -0
  113. package/src/google-forms/schemas.ts +499 -0
  114. package/src/linear/api.ts +141 -0
  115. package/src/linear/index.ts +71 -0
  116. package/src/linear/schemas.ts +1060 -0
  117. package/src/outlook/graph.ts +132 -0
  118. package/src/outlook/index.ts +14 -0
  119. package/src/outlook/schemas.ts +388 -0
  120. package/src/resend/index.ts +70 -0
  121. package/src/resend/schemas.ts +462 -0
  122. package/src/slack/index.ts +29 -0
  123. package/src/slack/schemas.ts +737 -0
  124. package/src/teams/graph.ts +130 -0
  125. package/src/teams/index.ts +27 -0
  126. package/src/teams/schemas.ts +463 -0
  127. package/src/trello/api.ts +190 -0
  128. package/src/trello/event-schemas.ts +290 -0
  129. package/src/trello/index.ts +45 -0
  130. package/src/trello/schemas.ts +507 -0
  131. package/src/triggers.ts +68 -0
  132. package/src/vercel/index.ts +147 -0
  133. package/src/vercel/schemas.ts +594 -0
  134. package/src/whatsapp/api.ts +171 -0
  135. package/src/whatsapp/index.ts +46 -0
  136. package/src/whatsapp/schemas.ts +341 -0
@@ -0,0 +1,377 @@
1
+ import { z } from "zod";
2
+ export const RESEND_EMAIL_EVENT_TYPES = [
3
+ "email.bounced",
4
+ "email.clicked",
5
+ "email.complained",
6
+ "email.delivered",
7
+ "email.delivery_delayed",
8
+ "email.failed",
9
+ "email.opened",
10
+ "email.received",
11
+ "email.scheduled",
12
+ "email.sent",
13
+ "email.suppressed",
14
+ ];
15
+ const RESEND_EMAIL_DATA_SCHEMA = z.object({
16
+ /** Stable broadcast campaign ID, when the email came from a broadcast. */
17
+ broadcastId: z.string().optional(),
18
+ /** When Resend created the email. */
19
+ createdAt: z.iso.datetime({ offset: true }),
20
+ /** Stable Resend email ID. */
21
+ emailId: z.string(),
22
+ /** Sender address, optionally including a display name. */
23
+ from: z.string(),
24
+ /** RFC Message-ID header value. */
25
+ messageId: z.string().optional(),
26
+ /** Email subject. */
27
+ subject: z.string(),
28
+ /** Tags associated with the email. */
29
+ tags: z.record(z.string(), z.string()).optional(),
30
+ /** Stable template ID, when the email used a template. */
31
+ templateId: z.string().optional(),
32
+ /** Recipient addresses affected by this event. */
33
+ to: z.string().array(),
34
+ });
35
+ const RESEND_BOUNCE_SCHEMA = z
36
+ .looseObject({
37
+ /** SMTP diagnostic responses returned by the receiving server. */
38
+ diagnosticCode: z.string().array().optional(),
39
+ /** Detailed bounce message returned by the receiving server. */
40
+ message: z.string(),
41
+ /** Provider bounce subtype. */
42
+ subType: z.string(),
43
+ /** Provider bounce type. */
44
+ type: z.string(),
45
+ })
46
+ .catchall(z.json());
47
+ const RESEND_CLICK_SCHEMA = z
48
+ .looseObject({
49
+ /** IP address that requested the tracked link. */
50
+ ipAddress: z.string(),
51
+ /** URL requested through the tracked link. */
52
+ link: z.string(),
53
+ /** When the tracked link was requested. */
54
+ timestamp: z.iso.datetime({ offset: true }),
55
+ /** User agent that requested the tracked link. */
56
+ userAgent: z.string(),
57
+ })
58
+ .catchall(z.json());
59
+ const RESEND_FAILED_SCHEMA = z
60
+ .looseObject({
61
+ /** Provider reason for the send failure. */
62
+ reason: z.string(),
63
+ })
64
+ .catchall(z.json());
65
+ const RESEND_SUPPRESSED_SCHEMA = z
66
+ .looseObject({
67
+ /** Explanation of why Resend suppressed the email. */
68
+ message: z.string(),
69
+ /** Provider suppression type. */
70
+ type: z.string(),
71
+ })
72
+ .catchall(z.json());
73
+ const RESEND_RECEIVED_EMAIL_ATTACHMENT_SCHEMA = z
74
+ .looseObject({
75
+ /** MIME content disposition, when supplied. */
76
+ contentDisposition: z.string().nullable(),
77
+ /** Content-ID header, when supplied. */
78
+ contentId: z.string().nullable(),
79
+ /** Attachment MIME type. */
80
+ contentType: z.string(),
81
+ /** Attachment filename, when supplied. */
82
+ filename: z.string().nullable(),
83
+ /** Stable Resend attachment ID. */
84
+ id: z.string(),
85
+ })
86
+ .catchall(z.json());
87
+ const RESEND_RECEIVED_EMAIL_DATA_SCHEMA = z.object({
88
+ /** Metadata for attachments included with the inbound email. */
89
+ attachments: RESEND_RECEIVED_EMAIL_ATTACHMENT_SCHEMA.array(),
90
+ /** Blind-copy recipient addresses. */
91
+ bcc: z.string().array(),
92
+ /** Copy recipient addresses. */
93
+ cc: z.string().array(),
94
+ /** When Resend created the inbound email record. */
95
+ createdAt: z.iso.datetime({ offset: true }),
96
+ /** Stable Resend email ID. */
97
+ emailId: z.string(),
98
+ /** Bare sender address. */
99
+ from: z.string(),
100
+ /** RFC Message-ID header value. */
101
+ messageId: z.string(),
102
+ /** Addresses the email was forwarded for. */
103
+ receivedFor: z.string().array().optional(),
104
+ /** Email subject. */
105
+ subject: z.string(),
106
+ /** Direct recipient addresses. */
107
+ to: z.string().array(),
108
+ });
109
+ const RESEND_PROVIDER_EMAIL_DATA_SCHEMA = z
110
+ .looseObject({
111
+ broadcast_id: z.string().optional(),
112
+ created_at: z.iso.datetime({ offset: true }),
113
+ email_id: z.string(),
114
+ from: z.string(),
115
+ message_id: z.string().optional(),
116
+ subject: z.string(),
117
+ tags: z.record(z.string(), z.string()).optional(),
118
+ template_id: z.string().optional(),
119
+ to: z.string().array(),
120
+ })
121
+ .catchall(z.json());
122
+ const RESEND_PROVIDER_RECEIVED_EMAIL_DATA_SCHEMA = z
123
+ .looseObject({
124
+ attachments: z
125
+ .looseObject({
126
+ content_disposition: z.string().nullable(),
127
+ content_id: z.string().nullable(),
128
+ content_type: z.string(),
129
+ filename: z.string().nullable(),
130
+ id: z.string(),
131
+ })
132
+ .catchall(z.json())
133
+ .array(),
134
+ bcc: z.string().array(),
135
+ cc: z.string().array(),
136
+ created_at: z.iso.datetime({ offset: true }),
137
+ email_id: z.string(),
138
+ from: z.string(),
139
+ message_id: z.string(),
140
+ received_for: z.string().array().optional(),
141
+ subject: z.string(),
142
+ to: z.string().array(),
143
+ })
144
+ .catchall(z.json());
145
+ const RESEND_PROVIDER_EMAIL_EVENT_SCHEMA = z
146
+ .looseObject({
147
+ created_at: z.iso.datetime({ offset: true }),
148
+ data: RESEND_PROVIDER_EMAIL_DATA_SCHEMA,
149
+ type: z.enum(RESEND_EMAIL_EVENT_TYPES),
150
+ })
151
+ .catchall(z.json());
152
+ const RESEND_PROVIDER_EMAIL_SENT_EVENT_SCHEMA = RESEND_PROVIDER_EMAIL_EVENT_SCHEMA.extend({ type: z.literal("email.sent") });
153
+ const RESEND_PROVIDER_EMAIL_DELIVERED_EVENT_SCHEMA = RESEND_PROVIDER_EMAIL_EVENT_SCHEMA.extend({
154
+ type: z.literal("email.delivered"),
155
+ });
156
+ const RESEND_PROVIDER_EMAIL_BOUNCED_EVENT_SCHEMA = RESEND_PROVIDER_EMAIL_EVENT_SCHEMA.extend({
157
+ data: RESEND_PROVIDER_EMAIL_DATA_SCHEMA.extend({
158
+ bounce: RESEND_BOUNCE_SCHEMA,
159
+ }),
160
+ type: z.literal("email.bounced"),
161
+ });
162
+ const RESEND_PROVIDER_EMAIL_FAILED_EVENT_SCHEMA = RESEND_PROVIDER_EMAIL_EVENT_SCHEMA.extend({
163
+ data: RESEND_PROVIDER_EMAIL_DATA_SCHEMA.extend({
164
+ failed: RESEND_FAILED_SCHEMA,
165
+ }),
166
+ type: z.literal("email.failed"),
167
+ });
168
+ const RESEND_PROVIDER_EMAIL_OPENED_EVENT_SCHEMA = RESEND_PROVIDER_EMAIL_EVENT_SCHEMA.extend({ type: z.literal("email.opened") });
169
+ const RESEND_PROVIDER_EMAIL_CLICKED_EVENT_SCHEMA = RESEND_PROVIDER_EMAIL_EVENT_SCHEMA.extend({
170
+ data: RESEND_PROVIDER_EMAIL_DATA_SCHEMA.extend({
171
+ click: RESEND_CLICK_SCHEMA,
172
+ }),
173
+ type: z.literal("email.clicked"),
174
+ });
175
+ const RESEND_PROVIDER_EMAIL_COMPLAINED_EVENT_SCHEMA = RESEND_PROVIDER_EMAIL_EVENT_SCHEMA.extend({
176
+ type: z.literal("email.complained"),
177
+ });
178
+ const RESEND_PROVIDER_EMAIL_RECEIVED_EVENT_SCHEMA = RESEND_PROVIDER_EMAIL_EVENT_SCHEMA.extend({
179
+ data: RESEND_PROVIDER_RECEIVED_EMAIL_DATA_SCHEMA,
180
+ type: z.literal("email.received"),
181
+ });
182
+ const RESEND_PROVIDER_EMAIL_DELIVERY_DELAYED_EVENT_SCHEMA = RESEND_PROVIDER_EMAIL_EVENT_SCHEMA.extend({
183
+ type: z.literal("email.delivery_delayed"),
184
+ });
185
+ const RESEND_PROVIDER_EMAIL_SCHEDULED_EVENT_SCHEMA = RESEND_PROVIDER_EMAIL_EVENT_SCHEMA.extend({
186
+ type: z.literal("email.scheduled"),
187
+ });
188
+ const RESEND_PROVIDER_EMAIL_SUPPRESSED_EVENT_SCHEMA = RESEND_PROVIDER_EMAIL_EVENT_SCHEMA.extend({
189
+ data: RESEND_PROVIDER_EMAIL_DATA_SCHEMA.extend({
190
+ suppressed: RESEND_SUPPRESSED_SCHEMA,
191
+ }),
192
+ type: z.literal("email.suppressed"),
193
+ });
194
+ const RESEND_PROVIDER_WEBHOOK_SCHEMA = z.discriminatedUnion("type", [
195
+ RESEND_PROVIDER_EMAIL_BOUNCED_EVENT_SCHEMA,
196
+ RESEND_PROVIDER_EMAIL_CLICKED_EVENT_SCHEMA,
197
+ RESEND_PROVIDER_EMAIL_COMPLAINED_EVENT_SCHEMA,
198
+ RESEND_PROVIDER_EMAIL_DELIVERED_EVENT_SCHEMA,
199
+ RESEND_PROVIDER_EMAIL_DELIVERY_DELAYED_EVENT_SCHEMA,
200
+ RESEND_PROVIDER_EMAIL_FAILED_EVENT_SCHEMA,
201
+ RESEND_PROVIDER_EMAIL_OPENED_EVENT_SCHEMA,
202
+ RESEND_PROVIDER_EMAIL_RECEIVED_EVENT_SCHEMA,
203
+ RESEND_PROVIDER_EMAIL_SCHEDULED_EVENT_SCHEMA,
204
+ RESEND_PROVIDER_EMAIL_SENT_EVENT_SCHEMA,
205
+ RESEND_PROVIDER_EMAIL_SUPPRESSED_EVENT_SCHEMA,
206
+ ]);
207
+ export const RESEND_EMAIL_SENT_EVENT_SCHEMA = RESEND_EMAIL_DATA_SCHEMA.extend({
208
+ /** Original provider webhook envelope. */
209
+ event: RESEND_PROVIDER_EMAIL_SENT_EVENT_SCHEMA,
210
+ });
211
+ export const RESEND_EMAIL_DELIVERED_EVENT_SCHEMA = RESEND_EMAIL_DATA_SCHEMA.extend({
212
+ /** Original provider webhook envelope. */
213
+ event: RESEND_PROVIDER_EMAIL_DELIVERED_EVENT_SCHEMA,
214
+ });
215
+ export const RESEND_EMAIL_BOUNCED_EVENT_SCHEMA = RESEND_EMAIL_DATA_SCHEMA.extend({
216
+ /** Bounce details from the receiving server. */
217
+ bounce: RESEND_BOUNCE_SCHEMA,
218
+ /** Original provider webhook envelope. */
219
+ event: RESEND_PROVIDER_EMAIL_BOUNCED_EVENT_SCHEMA,
220
+ });
221
+ export const RESEND_EMAIL_FAILED_EVENT_SCHEMA = RESEND_EMAIL_DATA_SCHEMA.extend({
222
+ /** Original provider webhook envelope. */
223
+ event: RESEND_PROVIDER_EMAIL_FAILED_EVENT_SCHEMA,
224
+ /** Send failure details. */
225
+ failed: RESEND_FAILED_SCHEMA,
226
+ });
227
+ export const RESEND_EMAIL_OPENED_EVENT_SCHEMA = RESEND_EMAIL_DATA_SCHEMA.extend({
228
+ /** Original provider webhook envelope. */
229
+ event: RESEND_PROVIDER_EMAIL_OPENED_EVENT_SCHEMA,
230
+ });
231
+ export const RESEND_EMAIL_CLICKED_EVENT_SCHEMA = RESEND_EMAIL_DATA_SCHEMA.extend({
232
+ /** Click tracking details. */
233
+ click: RESEND_CLICK_SCHEMA,
234
+ /** Original provider webhook envelope. */
235
+ event: RESEND_PROVIDER_EMAIL_CLICKED_EVENT_SCHEMA,
236
+ });
237
+ export const RESEND_EMAIL_COMPLAINED_EVENT_SCHEMA = RESEND_EMAIL_DATA_SCHEMA.extend({
238
+ /** Original provider webhook envelope. */
239
+ event: RESEND_PROVIDER_EMAIL_COMPLAINED_EVENT_SCHEMA,
240
+ });
241
+ export const RESEND_EMAIL_RECEIVED_EVENT_SCHEMA = RESEND_RECEIVED_EMAIL_DATA_SCHEMA.extend({
242
+ /** Original provider webhook envelope. */
243
+ event: RESEND_PROVIDER_EMAIL_RECEIVED_EVENT_SCHEMA,
244
+ });
245
+ export const RESEND_EMAIL_DELIVERY_DELAYED_EVENT_SCHEMA = RESEND_EMAIL_DATA_SCHEMA.extend({
246
+ /** Original provider webhook envelope. */
247
+ event: RESEND_PROVIDER_EMAIL_DELIVERY_DELAYED_EVENT_SCHEMA,
248
+ });
249
+ export const RESEND_EMAIL_SCHEDULED_EVENT_SCHEMA = RESEND_EMAIL_DATA_SCHEMA.extend({
250
+ /** Original provider webhook envelope. */
251
+ event: RESEND_PROVIDER_EMAIL_SCHEDULED_EVENT_SCHEMA,
252
+ });
253
+ export const RESEND_EMAIL_SUPPRESSED_EVENT_SCHEMA = RESEND_EMAIL_DATA_SCHEMA.extend({
254
+ /** Original provider webhook envelope. */
255
+ event: RESEND_PROVIDER_EMAIL_SUPPRESSED_EVENT_SCHEMA,
256
+ /** Details explaining why Resend suppressed the email. */
257
+ suppressed: RESEND_SUPPRESSED_SCHEMA,
258
+ });
259
+ export const RESEND_EMAIL_EVENT_SCHEMA = z.union([
260
+ RESEND_EMAIL_BOUNCED_EVENT_SCHEMA,
261
+ RESEND_EMAIL_CLICKED_EVENT_SCHEMA,
262
+ RESEND_EMAIL_COMPLAINED_EVENT_SCHEMA,
263
+ RESEND_EMAIL_DELIVERED_EVENT_SCHEMA,
264
+ RESEND_EMAIL_DELIVERY_DELAYED_EVENT_SCHEMA,
265
+ RESEND_EMAIL_FAILED_EVENT_SCHEMA,
266
+ RESEND_EMAIL_OPENED_EVENT_SCHEMA,
267
+ RESEND_EMAIL_RECEIVED_EVENT_SCHEMA,
268
+ RESEND_EMAIL_SCHEDULED_EVENT_SCHEMA,
269
+ RESEND_EMAIL_SENT_EVENT_SCHEMA,
270
+ RESEND_EMAIL_SUPPRESSED_EVENT_SCHEMA,
271
+ ]);
272
+ /**
273
+ * Normalizes one authenticated Resend email webhook.
274
+ *
275
+ * @param value - Untrusted provider webhook payload.
276
+ */
277
+ export function normalizeResendEmailEvent(value) {
278
+ const event = RESEND_PROVIDER_WEBHOOK_SCHEMA.parse(value);
279
+ switch (event.type) {
280
+ case "email.bounced":
281
+ return RESEND_EMAIL_BOUNCED_EVENT_SCHEMA.parse({
282
+ ...normalizeResendEmailData(event.data),
283
+ bounce: event.data.bounce,
284
+ event,
285
+ });
286
+ case "email.clicked":
287
+ return RESEND_EMAIL_CLICKED_EVENT_SCHEMA.parse({
288
+ ...normalizeResendEmailData(event.data),
289
+ click: event.data.click,
290
+ event,
291
+ });
292
+ case "email.failed":
293
+ return RESEND_EMAIL_FAILED_EVENT_SCHEMA.parse({
294
+ ...normalizeResendEmailData(event.data),
295
+ event,
296
+ failed: event.data.failed,
297
+ });
298
+ case "email.received":
299
+ return RESEND_EMAIL_RECEIVED_EVENT_SCHEMA.parse({
300
+ attachments: event.data.attachments.map((attachment) => ({
301
+ contentDisposition: attachment.content_disposition,
302
+ contentId: attachment.content_id,
303
+ contentType: attachment.content_type,
304
+ filename: attachment.filename,
305
+ id: attachment.id,
306
+ })),
307
+ bcc: event.data.bcc,
308
+ cc: event.data.cc,
309
+ createdAt: event.data.created_at,
310
+ emailId: event.data.email_id,
311
+ event,
312
+ from: event.data.from,
313
+ messageId: event.data.message_id,
314
+ ...(event.data.received_for === undefined
315
+ ? {}
316
+ : { receivedFor: event.data.received_for }),
317
+ subject: event.data.subject,
318
+ to: event.data.to,
319
+ });
320
+ case "email.suppressed":
321
+ return RESEND_EMAIL_SUPPRESSED_EVENT_SCHEMA.parse({
322
+ ...normalizeResendEmailData(event.data),
323
+ event,
324
+ suppressed: event.data.suppressed,
325
+ });
326
+ case "email.complained":
327
+ return RESEND_EMAIL_COMPLAINED_EVENT_SCHEMA.parse({
328
+ ...normalizeResendEmailData(event.data),
329
+ event,
330
+ });
331
+ case "email.delivered":
332
+ return RESEND_EMAIL_DELIVERED_EVENT_SCHEMA.parse({
333
+ ...normalizeResendEmailData(event.data),
334
+ event,
335
+ });
336
+ case "email.delivery_delayed":
337
+ return RESEND_EMAIL_DELIVERY_DELAYED_EVENT_SCHEMA.parse({
338
+ ...normalizeResendEmailData(event.data),
339
+ event,
340
+ });
341
+ case "email.opened":
342
+ return RESEND_EMAIL_OPENED_EVENT_SCHEMA.parse({
343
+ ...normalizeResendEmailData(event.data),
344
+ event,
345
+ });
346
+ case "email.scheduled":
347
+ return RESEND_EMAIL_SCHEDULED_EVENT_SCHEMA.parse({
348
+ ...normalizeResendEmailData(event.data),
349
+ event,
350
+ });
351
+ case "email.sent":
352
+ return RESEND_EMAIL_SENT_EVENT_SCHEMA.parse({
353
+ ...normalizeResendEmailData(event.data),
354
+ event,
355
+ });
356
+ }
357
+ }
358
+ /**
359
+ * Normalizes common outbound email webhook data.
360
+ *
361
+ * @param data - Provider-native email data.
362
+ */
363
+ function normalizeResendEmailData(data) {
364
+ return {
365
+ ...(data.broadcast_id === undefined
366
+ ? {}
367
+ : { broadcastId: data.broadcast_id }),
368
+ createdAt: data.created_at,
369
+ emailId: data.email_id,
370
+ from: data.from,
371
+ ...(data.message_id === undefined ? {} : { messageId: data.message_id }),
372
+ subject: data.subject,
373
+ ...(data.tags === undefined ? {} : { tags: data.tags }),
374
+ ...(data.template_id === undefined ? {} : { templateId: data.template_id }),
375
+ to: data.to,
376
+ };
377
+ }
@@ -0,0 +1,151 @@
1
+ import { z } from "zod";
2
+ export * from "./schemas.js";
3
+ export declare const SLACK_TRIGGER_CONFIG_SCHEMA: z.ZodObject<{}, z.core.$strip>;
4
+ export declare const slackTriggerContracts: {
5
+ readonly "slack.app.mentioned": {
6
+ readonly configSchema: z.ZodObject<{}, z.core.$strip>;
7
+ readonly eventSchema: z.ZodObject<{
8
+ appId: z.ZodOptional<z.ZodString>;
9
+ attachments: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
10
+ blocks: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
11
+ botId: z.ZodOptional<z.ZodString>;
12
+ files: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
13
+ parentUserId: z.ZodOptional<z.ZodString>;
14
+ reactions: z.ZodOptional<z.ZodArray<z.ZodObject<{
15
+ count: z.ZodNumber;
16
+ name: z.ZodString;
17
+ userIds: z.ZodArray<z.ZodString>;
18
+ }, z.core.$strip>>>;
19
+ replyCount: z.ZodOptional<z.ZodNumber>;
20
+ subtype: z.ZodOptional<z.ZodString>;
21
+ text: z.ZodString;
22
+ threadTimestamp: z.ZodOptional<z.ZodString>;
23
+ timestamp: z.ZodString;
24
+ userId: z.ZodOptional<z.ZodString>;
25
+ conversationId: z.ZodString;
26
+ conversationType: z.ZodOptional<z.ZodString>;
27
+ eventTimestamp: z.ZodString;
28
+ workspaceId: z.ZodString;
29
+ event: z.ZodObject<{
30
+ app_id: z.ZodOptional<z.ZodString>;
31
+ attachments: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
32
+ blocks: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
33
+ bot_id: z.ZodOptional<z.ZodString>;
34
+ files: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
35
+ parent_user_id: z.ZodOptional<z.ZodString>;
36
+ reactions: z.ZodOptional<z.ZodArray<z.ZodObject<{
37
+ count: z.ZodNumber;
38
+ name: z.ZodString;
39
+ users: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
+ }, z.core.$strip>>>;
41
+ reply_count: z.ZodOptional<z.ZodNumber>;
42
+ subtype: z.ZodOptional<z.ZodString>;
43
+ text: z.ZodPrefault<z.ZodString>;
44
+ thread_ts: z.ZodOptional<z.ZodString>;
45
+ ts: z.ZodString;
46
+ user: z.ZodOptional<z.ZodString>;
47
+ channel: z.ZodString;
48
+ channel_type: z.ZodOptional<z.ZodString>;
49
+ event_ts: z.ZodString;
50
+ type: z.ZodLiteral<"app_mention">;
51
+ }, z.core.$catchall<z.ZodJSONSchema>>;
52
+ type: z.ZodLiteral<"app_mention">;
53
+ }, z.core.$strip>;
54
+ };
55
+ readonly "slack.message.posted": {
56
+ readonly configSchema: z.ZodObject<{}, z.core.$strip>;
57
+ readonly eventSchema: z.ZodObject<{
58
+ appId: z.ZodOptional<z.ZodString>;
59
+ attachments: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
60
+ blocks: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
61
+ botId: z.ZodOptional<z.ZodString>;
62
+ files: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
63
+ parentUserId: z.ZodOptional<z.ZodString>;
64
+ reactions: z.ZodOptional<z.ZodArray<z.ZodObject<{
65
+ count: z.ZodNumber;
66
+ name: z.ZodString;
67
+ userIds: z.ZodArray<z.ZodString>;
68
+ }, z.core.$strip>>>;
69
+ replyCount: z.ZodOptional<z.ZodNumber>;
70
+ subtype: z.ZodOptional<z.ZodString>;
71
+ text: z.ZodString;
72
+ threadTimestamp: z.ZodOptional<z.ZodString>;
73
+ timestamp: z.ZodString;
74
+ userId: z.ZodOptional<z.ZodString>;
75
+ conversationId: z.ZodString;
76
+ conversationType: z.ZodOptional<z.ZodString>;
77
+ eventTimestamp: z.ZodString;
78
+ workspaceId: z.ZodString;
79
+ event: z.ZodObject<{
80
+ app_id: z.ZodOptional<z.ZodString>;
81
+ attachments: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
82
+ blocks: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
83
+ bot_id: z.ZodOptional<z.ZodString>;
84
+ files: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
85
+ parent_user_id: z.ZodOptional<z.ZodString>;
86
+ reactions: z.ZodOptional<z.ZodArray<z.ZodObject<{
87
+ count: z.ZodNumber;
88
+ name: z.ZodString;
89
+ users: z.ZodOptional<z.ZodArray<z.ZodString>>;
90
+ }, z.core.$strip>>>;
91
+ reply_count: z.ZodOptional<z.ZodNumber>;
92
+ subtype: z.ZodOptional<z.ZodString>;
93
+ text: z.ZodPrefault<z.ZodString>;
94
+ thread_ts: z.ZodOptional<z.ZodString>;
95
+ ts: z.ZodString;
96
+ user: z.ZodOptional<z.ZodString>;
97
+ channel: z.ZodString;
98
+ channel_type: z.ZodOptional<z.ZodString>;
99
+ event_ts: z.ZodString;
100
+ type: z.ZodLiteral<"message">;
101
+ }, z.core.$catchall<z.ZodJSONSchema>>;
102
+ type: z.ZodLiteral<"message">;
103
+ }, z.core.$strip>;
104
+ };
105
+ readonly "slack.reaction.added": {
106
+ readonly configSchema: z.ZodObject<{}, z.core.$strip>;
107
+ readonly eventSchema: z.ZodObject<{
108
+ eventTimestamp: z.ZodString;
109
+ item: z.ZodDiscriminatedUnion<[z.ZodObject<{
110
+ conversationId: z.ZodString;
111
+ conversationType: z.ZodOptional<z.ZodString>;
112
+ messageTimestamp: z.ZodString;
113
+ type: z.ZodLiteral<"message">;
114
+ }, z.core.$strip>, z.ZodObject<{
115
+ fileId: z.ZodString;
116
+ type: z.ZodLiteral<"file">;
117
+ }, z.core.$strip>, z.ZodObject<{
118
+ fileId: z.ZodString;
119
+ fileCommentId: z.ZodString;
120
+ type: z.ZodLiteral<"fileComment">;
121
+ }, z.core.$strip>], "type">;
122
+ itemUserId: z.ZodOptional<z.ZodString>;
123
+ reaction: z.ZodString;
124
+ userId: z.ZodString;
125
+ workspaceId: z.ZodString;
126
+ }, z.core.$strip>;
127
+ };
128
+ readonly "slack.reaction.removed": {
129
+ readonly configSchema: z.ZodObject<{}, z.core.$strip>;
130
+ readonly eventSchema: z.ZodObject<{
131
+ eventTimestamp: z.ZodString;
132
+ item: z.ZodDiscriminatedUnion<[z.ZodObject<{
133
+ conversationId: z.ZodString;
134
+ conversationType: z.ZodOptional<z.ZodString>;
135
+ messageTimestamp: z.ZodString;
136
+ type: z.ZodLiteral<"message">;
137
+ }, z.core.$strip>, z.ZodObject<{
138
+ fileId: z.ZodString;
139
+ type: z.ZodLiteral<"file">;
140
+ }, z.core.$strip>, z.ZodObject<{
141
+ fileId: z.ZodString;
142
+ fileCommentId: z.ZodString;
143
+ type: z.ZodLiteral<"fileComment">;
144
+ }, z.core.$strip>], "type">;
145
+ itemUserId: z.ZodOptional<z.ZodString>;
146
+ reaction: z.ZodString;
147
+ userId: z.ZodString;
148
+ workspaceId: z.ZodString;
149
+ }, z.core.$strip>;
150
+ };
151
+ };
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ import { SLACK_APP_MENTION_EVENT_SCHEMA, SLACK_MESSAGE_POSTED_EVENT_SCHEMA, SLACK_REACTION_EVENT_SCHEMA, } from "./schemas.js";
3
+ export * from "./schemas.js";
4
+ export const SLACK_TRIGGER_CONFIG_SCHEMA = z.object({});
5
+ export const slackTriggerContracts = {
6
+ "slack.app.mentioned": {
7
+ configSchema: SLACK_TRIGGER_CONFIG_SCHEMA,
8
+ eventSchema: SLACK_APP_MENTION_EVENT_SCHEMA,
9
+ },
10
+ "slack.message.posted": {
11
+ configSchema: SLACK_TRIGGER_CONFIG_SCHEMA,
12
+ eventSchema: SLACK_MESSAGE_POSTED_EVENT_SCHEMA,
13
+ },
14
+ "slack.reaction.added": {
15
+ configSchema: SLACK_TRIGGER_CONFIG_SCHEMA,
16
+ eventSchema: SLACK_REACTION_EVENT_SCHEMA,
17
+ },
18
+ "slack.reaction.removed": {
19
+ configSchema: SLACK_TRIGGER_CONFIG_SCHEMA,
20
+ eventSchema: SLACK_REACTION_EVENT_SCHEMA,
21
+ },
22
+ };