@keystrokehq/sendgrid 0.0.9 → 0.0.16-integration-id-canonicalization.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 (69) hide show
  1. package/README.md +59 -111
  2. package/dist/credential-sets/index.d.mts +2 -0
  3. package/dist/credential-sets/index.mjs +3 -0
  4. package/dist/index.d.mts +4 -1
  5. package/dist/index.mjs +5 -1
  6. package/dist/operations/index.d.mts +2 -0
  7. package/dist/operations/index.mjs +3 -0
  8. package/dist/schemas/index.d.mts +8 -8
  9. package/dist/schemas/index.mjs +1 -1
  10. package/dist/sendgrid.credential-set-CzYmlJ2Y.mjs +25 -0
  11. package/dist/sendgrid.credential-set-ivRIiUDy.d.mts +32 -0
  12. package/dist/validate-email.operation-CCCDxLjH.mjs +4301 -0
  13. package/dist/validate-email.operation-DY4rCHFE.d.mts +5436 -0
  14. package/package.json +8 -96
  15. package/dist/_official/index.d.mts +0 -2
  16. package/dist/_official/index.mjs +0 -3
  17. package/dist/_runtime/index.d.mts +0 -2
  18. package/dist/_runtime/index.mjs +0 -3
  19. package/dist/alerts.d.mts +0 -193
  20. package/dist/alerts.mjs +0 -101
  21. package/dist/api-keys.d.mts +0 -160
  22. package/dist/api-keys.mjs +0 -113
  23. package/dist/client.d.mts +0 -73
  24. package/dist/client.mjs +0 -260
  25. package/dist/connection.d.mts +0 -2
  26. package/dist/connection.mjs +0 -3
  27. package/dist/domains.d.mts +0 -114
  28. package/dist/domains.mjs +0 -62
  29. package/dist/email-validation.d.mts +0 -134
  30. package/dist/email-validation.mjs +0 -73
  31. package/dist/events.d.mts +0 -69
  32. package/dist/events.mjs +0 -28
  33. package/dist/factory-CToXR1jp.mjs +0 -24
  34. package/dist/integration-C9EALG65.mjs +0 -113
  35. package/dist/integration-zx-jmybs.d.mts +0 -56
  36. package/dist/mail-send.d.mts +0 -315
  37. package/dist/mail-send.mjs +0 -218
  38. package/dist/marketing-contacts.d.mts +0 -607
  39. package/dist/marketing-contacts.mjs +0 -277
  40. package/dist/marketing-customfields.d.mts +0 -94
  41. package/dist/marketing-customfields.mjs +0 -70
  42. package/dist/marketing-lists.d.mts +0 -184
  43. package/dist/marketing-lists.mjs +0 -130
  44. package/dist/marketing-segments.d.mts +0 -340
  45. package/dist/marketing-segments.mjs +0 -179
  46. package/dist/marketing-singlesends.d.mts +0 -648
  47. package/dist/marketing-singlesends.mjs +0 -277
  48. package/dist/operations.d.mts +0 -25
  49. package/dist/operations.mjs +0 -69
  50. package/dist/sender-identities.d.mts +0 -218
  51. package/dist/sender-identities.mjs +0 -109
  52. package/dist/senders.d.mts +0 -227
  53. package/dist/senders.mjs +0 -83
  54. package/dist/shared-BayZ0Lt6.mjs +0 -46
  55. package/dist/stats.d.mts +0 -215
  56. package/dist/stats.mjs +0 -107
  57. package/dist/suppressions.d.mts +0 -785
  58. package/dist/suppressions.mjs +0 -539
  59. package/dist/templates.d.mts +0 -451
  60. package/dist/templates.mjs +0 -238
  61. package/dist/user-account.d.mts +0 -108
  62. package/dist/user-account.mjs +0 -59
  63. package/dist/verification.d.mts +0 -67
  64. package/dist/verification.mjs +0 -72
  65. package/dist/webhooks/event.d.mts +0 -287
  66. package/dist/webhooks/event.mjs +0 -147
  67. package/dist/webhooks/parse.d.mts +0 -172
  68. package/dist/webhooks/parse.mjs +0 -125
  69. /package/dist/{webhooks-CKdsIikb.mjs → webhooks-dVOd93Hd.mjs} +0 -0
@@ -1,539 +0,0 @@
1
- import { n as __exportAll, t as sendgridOperation } from "./factory-CToXR1jp.mjs";
2
- import { n as omitUndefined } from "./shared-BayZ0Lt6.mjs";
3
- import { createSendGridClient } from "./client.mjs";
4
- import { C as sendgridBounceListSchema, E as sendgridGlobalSuppressionSchema, N as sendgridSuppressionGroupListSchema, O as sendgridGroupSuppressionListSchema, P as sendgridSuppressionGroupSchema, T as sendgridGlobalSuppressionListSchema, in as sendgridEmailSchema, j as sendgridSpamReportListSchema, k as sendgridInvalidEmailListSchema, x as sendgridBlockListSchema } from "./webhooks-CKdsIikb.mjs";
5
- import { z } from "zod";
6
-
7
- //#region src/suppressions.ts
8
- var suppressions_exports = /* @__PURE__ */ __exportAll({
9
- addGlobalSuppressions: () => addGlobalSuppressions,
10
- addSuppressionsToGroup: () => addSuppressionsToGroup,
11
- createSuppressionGroup: () => createSuppressionGroup,
12
- deleteBlock: () => deleteBlock,
13
- deleteBlocks: () => deleteBlocks,
14
- deleteBounce: () => deleteBounce,
15
- deleteBounces: () => deleteBounces,
16
- deleteGlobalSuppression: () => deleteGlobalSuppression,
17
- deleteInvalidEmail: () => deleteInvalidEmail,
18
- deleteInvalidEmails: () => deleteInvalidEmails,
19
- deleteSpamReport: () => deleteSpamReport,
20
- deleteSpamReports: () => deleteSpamReports,
21
- deleteSuppressionFromGroup: () => deleteSuppressionFromGroup,
22
- deleteSuppressionGroup: () => deleteSuppressionGroup,
23
- getBlock: () => getBlock,
24
- getBounce: () => getBounce,
25
- getGlobalSuppression: () => getGlobalSuppression,
26
- getInvalidEmail: () => getInvalidEmail,
27
- getSpamReport: () => getSpamReport,
28
- getSuppressionGroup: () => getSuppressionGroup,
29
- listAllSuppressions: () => listAllSuppressions,
30
- listBlocks: () => listBlocks,
31
- listBounces: () => listBounces,
32
- listGlobalSuppressions: () => listGlobalSuppressions,
33
- listGroupSuppressions: () => listGroupSuppressions,
34
- listGroupsForEmail: () => listGroupsForEmail,
35
- listInvalidEmails: () => listInvalidEmails,
36
- listSpamReports: () => listSpamReports,
37
- listSuppressionGroups: () => listSuppressionGroups,
38
- searchSuppressionsInGroup: () => searchSuppressionsInGroup,
39
- updateSuppressionGroup: () => updateSuppressionGroup
40
- });
41
- const groupId = z.number().int().nonnegative();
42
- const timeRange = z.object({
43
- startTime: z.number().int().optional(),
44
- endTime: z.number().int().optional()
45
- }).optional();
46
- function mapTimeQuery(range) {
47
- return {
48
- start_time: range?.startTime,
49
- end_time: range?.endTime
50
- };
51
- }
52
- const addGlobalSuppressions = sendgridOperation({
53
- id: "sendgrid.add-global-suppressions",
54
- name: "Add Global Suppressions",
55
- description: "Add email addresses to the global suppression list.",
56
- input: z.object({ recipientEmails: z.array(sendgridEmailSchema).min(1) }),
57
- output: z.object({ recipient_emails: z.array(z.string()) }),
58
- needsApproval: true,
59
- run: async (input, credentials) => {
60
- const response = await createSendGridClient(credentials).request("/asm/suppressions/global", {
61
- method: "POST",
62
- body: { recipient_emails: input.recipientEmails }
63
- });
64
- return z.object({ recipient_emails: z.array(z.string()) }).parse(response ?? { recipient_emails: input.recipientEmails });
65
- }
66
- });
67
- const deleteGlobalSuppression = sendgridOperation({
68
- id: "sendgrid.delete-global-suppression",
69
- name: "Delete Global Suppression",
70
- description: "Remove an email from the global suppression list.",
71
- input: z.object({ email: sendgridEmailSchema }),
72
- output: z.object({ success: z.boolean() }),
73
- needsApproval: true,
74
- run: async (input, credentials) => {
75
- await createSendGridClient(credentials).request(`/asm/suppressions/global/${encodeURIComponent(input.email)}`, { method: "DELETE" });
76
- return { success: true };
77
- }
78
- });
79
- const getGlobalSuppression = sendgridOperation({
80
- id: "sendgrid.get-global-suppression",
81
- name: "Get Global Suppression",
82
- description: "Check whether an email is on the global suppression list.",
83
- input: z.object({ email: sendgridEmailSchema }),
84
- output: sendgridGlobalSuppressionSchema,
85
- run: async (input, credentials) => {
86
- const response = await createSendGridClient(credentials).request(`/asm/suppressions/global/${encodeURIComponent(input.email)}`);
87
- return sendgridGlobalSuppressionSchema.parse(response ?? { recipient_email: input.email });
88
- }
89
- });
90
- const listGlobalSuppressions = sendgridOperation({
91
- id: "sendgrid.list-global-suppressions",
92
- name: "List Global Unsubscribes",
93
- description: "List email addresses that have globally unsubscribed.",
94
- input: z.object({
95
- limit: z.number().int().positive().max(500).optional(),
96
- offset: z.number().int().nonnegative().optional(),
97
- email: sendgridEmailSchema.optional()
98
- }).merge(timeRange.unwrap()).optional(),
99
- output: sendgridGlobalSuppressionListSchema,
100
- run: async (input, credentials) => {
101
- const response = await createSendGridClient(credentials).request("/suppression/unsubscribes", { query: omitUndefined({
102
- limit: input?.limit,
103
- offset: input?.offset,
104
- email: input?.email,
105
- ...mapTimeQuery(input)
106
- }) });
107
- return sendgridGlobalSuppressionListSchema.parse(response ?? []);
108
- }
109
- });
110
- const createSuppressionGroup = sendgridOperation({
111
- id: "sendgrid.create-suppression-group",
112
- name: "Create Suppression Group",
113
- description: "Create an unsubscribe/suppression group.",
114
- input: z.object({
115
- name: z.string().min(1).max(30),
116
- description: z.string().max(100).optional(),
117
- isDefault: z.boolean().optional()
118
- }),
119
- output: sendgridSuppressionGroupSchema,
120
- needsApproval: true,
121
- run: async (input, credentials) => {
122
- const response = await createSendGridClient(credentials).request("/asm/groups", {
123
- method: "POST",
124
- body: omitUndefined({
125
- name: input.name,
126
- description: input.description,
127
- is_default: input.isDefault
128
- })
129
- });
130
- return sendgridSuppressionGroupSchema.parse(response);
131
- }
132
- });
133
- const updateSuppressionGroup = sendgridOperation({
134
- id: "sendgrid.update-suppression-group",
135
- name: "Update Suppression Group",
136
- description: "Update a suppression group.",
137
- input: z.object({
138
- groupId,
139
- name: z.string().min(1).max(30).optional(),
140
- description: z.string().max(100).optional(),
141
- isDefault: z.boolean().optional()
142
- }),
143
- output: sendgridSuppressionGroupSchema,
144
- needsApproval: true,
145
- run: async (input, credentials) => {
146
- const response = await createSendGridClient(credentials).request(`/asm/groups/${input.groupId}`, {
147
- method: "PATCH",
148
- body: omitUndefined({
149
- name: input.name,
150
- description: input.description,
151
- is_default: input.isDefault
152
- })
153
- });
154
- return sendgridSuppressionGroupSchema.parse(response);
155
- }
156
- });
157
- const deleteSuppressionGroup = sendgridOperation({
158
- id: "sendgrid.delete-suppression-group",
159
- name: "Delete Suppression Group",
160
- description: "Delete a suppression group.",
161
- input: z.object({ groupId }),
162
- output: z.object({ success: z.boolean() }),
163
- needsApproval: true,
164
- run: async (input, credentials) => {
165
- await createSendGridClient(credentials).request(`/asm/groups/${input.groupId}`, { method: "DELETE" });
166
- return { success: true };
167
- }
168
- });
169
- const listSuppressionGroups = sendgridOperation({
170
- id: "sendgrid.list-suppression-groups",
171
- name: "List Suppression Groups",
172
- description: "List all suppression groups.",
173
- input: z.object({}).optional(),
174
- output: sendgridSuppressionGroupListSchema,
175
- run: async (_input, credentials) => {
176
- const response = await createSendGridClient(credentials).request("/asm/groups");
177
- return sendgridSuppressionGroupListSchema.parse(response ?? []);
178
- }
179
- });
180
- const getSuppressionGroup = sendgridOperation({
181
- id: "sendgrid.get-suppression-group",
182
- name: "Get Suppression Group",
183
- description: "Retrieve a single suppression group by ID.",
184
- input: z.object({ groupId }),
185
- output: sendgridSuppressionGroupSchema,
186
- run: async (input, credentials) => {
187
- const response = await createSendGridClient(credentials).request(`/asm/groups/${input.groupId}`);
188
- return sendgridSuppressionGroupSchema.parse(response);
189
- }
190
- });
191
- const addSuppressionsToGroup = sendgridOperation({
192
- id: "sendgrid.add-suppressions-to-group",
193
- name: "Add Suppressions to Group",
194
- description: "Add emails to a specific suppression group.",
195
- input: z.object({
196
- groupId,
197
- recipientEmails: z.array(sendgridEmailSchema).min(1)
198
- }),
199
- output: z.object({ recipient_emails: z.array(z.string()) }),
200
- needsApproval: true,
201
- run: async (input, credentials) => {
202
- const response = await createSendGridClient(credentials).request(`/asm/groups/${input.groupId}/suppressions`, {
203
- method: "POST",
204
- body: { recipient_emails: input.recipientEmails }
205
- });
206
- return z.object({ recipient_emails: z.array(z.string()) }).parse(response ?? { recipient_emails: input.recipientEmails });
207
- }
208
- });
209
- const deleteSuppressionFromGroup = sendgridOperation({
210
- id: "sendgrid.delete-suppression-from-group",
211
- name: "Delete Suppression from Group",
212
- description: "Remove an email from a suppression group.",
213
- input: z.object({
214
- groupId,
215
- email: sendgridEmailSchema
216
- }),
217
- output: z.object({ success: z.boolean() }),
218
- needsApproval: true,
219
- run: async (input, credentials) => {
220
- await createSendGridClient(credentials).request(`/asm/groups/${input.groupId}/suppressions/${encodeURIComponent(input.email)}`, { method: "DELETE" });
221
- return { success: true };
222
- }
223
- });
224
- const listGroupSuppressions = sendgridOperation({
225
- id: "sendgrid.list-group-suppressions",
226
- name: "List Group Suppressions",
227
- description: "List all suppressions for a single group.",
228
- input: z.object({ groupId }),
229
- output: z.array(z.string()),
230
- run: async (input, credentials) => {
231
- const response = await createSendGridClient(credentials).request(`/asm/groups/${input.groupId}/suppressions`);
232
- return z.array(z.string()).parse(response ?? []);
233
- }
234
- });
235
- const listAllSuppressions = sendgridOperation({
236
- id: "sendgrid.list-all-suppressions",
237
- name: "List All Suppressions",
238
- description: "List suppressions across all groups (returns group + email pairs).",
239
- input: z.object({}).optional(),
240
- output: sendgridGroupSuppressionListSchema,
241
- run: async (_input, credentials) => {
242
- const response = await createSendGridClient(credentials).request("/asm/suppressions");
243
- return sendgridGroupSuppressionListSchema.parse(response ?? []);
244
- }
245
- });
246
- const listGroupsForEmail = sendgridOperation({
247
- id: "sendgrid.list-groups-for-email",
248
- name: "List Suppression Groups for Email",
249
- description: "Retrieve all suppression groups an email address is on.",
250
- input: z.object({ email: sendgridEmailSchema }),
251
- output: z.array(z.object({
252
- id: z.number().int(),
253
- name: z.string(),
254
- description: z.string().optional(),
255
- suppressed: z.boolean().optional()
256
- }).catchall(z.unknown())),
257
- run: async (input, credentials) => {
258
- const response = await createSendGridClient(credentials).request(`/asm/suppressions/${encodeURIComponent(input.email)}`);
259
- const array = Array.isArray(response) ? response : [];
260
- return z.array(z.object({
261
- id: z.number().int(),
262
- name: z.string(),
263
- description: z.string().optional(),
264
- suppressed: z.boolean().optional()
265
- }).catchall(z.unknown())).parse(array);
266
- }
267
- });
268
- const searchSuppressionsInGroup = sendgridOperation({
269
- id: "sendgrid.search-suppressions-in-group",
270
- name: "Search Suppressions in Group",
271
- description: "Check which of the given emails are currently suppressed in a specific group.",
272
- input: z.object({
273
- groupId,
274
- recipientEmails: z.array(sendgridEmailSchema).min(1)
275
- }),
276
- output: z.object({ recipient_emails: z.array(z.string()) }),
277
- run: async (input, credentials) => {
278
- const response = await createSendGridClient(credentials).request(`/asm/groups/${input.groupId}/suppressions/search`, {
279
- method: "POST",
280
- body: { recipient_emails: input.recipientEmails }
281
- });
282
- return z.object({ recipient_emails: z.array(z.string()) }).parse(response ?? { recipient_emails: [] });
283
- }
284
- });
285
- const listBounces = sendgridOperation({
286
- id: "sendgrid.list-bounces",
287
- name: "List Bounces",
288
- description: "List bounce records.",
289
- input: timeRange.unwrap().extend({
290
- limit: z.number().int().positive().max(500).optional(),
291
- offset: z.number().int().nonnegative().optional()
292
- }).optional(),
293
- output: sendgridBounceListSchema,
294
- run: async (input, credentials) => {
295
- const response = await createSendGridClient(credentials).request("/suppression/bounces", { query: omitUndefined({
296
- limit: input?.limit,
297
- offset: input?.offset,
298
- ...mapTimeQuery(input)
299
- }) });
300
- return sendgridBounceListSchema.parse(response ?? []);
301
- }
302
- });
303
- const getBounce = sendgridOperation({
304
- id: "sendgrid.get-bounce",
305
- name: "Get Bounce",
306
- description: "Return the bounce record(s) for a specific email.",
307
- input: z.object({ email: sendgridEmailSchema }),
308
- output: sendgridBounceListSchema,
309
- run: async (input, credentials) => {
310
- const response = await createSendGridClient(credentials).request(`/suppression/bounces/${encodeURIComponent(input.email)}`);
311
- const arr = Array.isArray(response) ? response : response !== void 0 ? [response] : [];
312
- return sendgridBounceListSchema.parse(arr);
313
- }
314
- });
315
- const deleteBounce = sendgridOperation({
316
- id: "sendgrid.delete-bounce",
317
- name: "Delete Bounce",
318
- description: "Delete a bounce record for a specific email.",
319
- input: z.object({ email: sendgridEmailSchema }),
320
- output: z.object({ success: z.boolean() }),
321
- needsApproval: true,
322
- run: async (input, credentials) => {
323
- await createSendGridClient(credentials).request(`/suppression/bounces/${encodeURIComponent(input.email)}`, { method: "DELETE" });
324
- return { success: true };
325
- }
326
- });
327
- const deleteBounces = sendgridOperation({
328
- id: "sendgrid.delete-bounces",
329
- name: "Delete Bounces",
330
- description: "Delete bounce records by email list, or delete all bounces.",
331
- input: z.object({
332
- emails: z.array(sendgridEmailSchema).min(1).optional(),
333
- deleteAll: z.boolean().optional()
334
- }).refine((v) => v.emails !== void 0 !== (v.deleteAll === true), { message: "Provide either `emails` or `deleteAll: true`, not both." }),
335
- output: z.object({ success: z.boolean() }),
336
- needsApproval: true,
337
- run: async (input, credentials) => {
338
- await createSendGridClient(credentials).request("/suppression/bounces", {
339
- method: "DELETE",
340
- body: omitUndefined({
341
- emails: input.emails,
342
- delete_all: input.deleteAll
343
- })
344
- });
345
- return { success: true };
346
- }
347
- });
348
- const listBlocks = sendgridOperation({
349
- id: "sendgrid.list-blocks",
350
- name: "List Blocks",
351
- description: "List blocks (temporary delivery rejections).",
352
- input: timeRange.unwrap().extend({
353
- limit: z.number().int().positive().max(500).optional(),
354
- offset: z.number().int().nonnegative().optional()
355
- }).optional(),
356
- output: sendgridBlockListSchema,
357
- run: async (input, credentials) => {
358
- const response = await createSendGridClient(credentials).request("/suppression/blocks", { query: omitUndefined({
359
- limit: input?.limit,
360
- offset: input?.offset,
361
- ...mapTimeQuery(input)
362
- }) });
363
- return sendgridBlockListSchema.parse(response ?? []);
364
- }
365
- });
366
- const getBlock = sendgridOperation({
367
- id: "sendgrid.get-block",
368
- name: "Get Block",
369
- description: "Retrieve block records for a specific email.",
370
- input: z.object({ email: sendgridEmailSchema }),
371
- output: sendgridBlockListSchema,
372
- run: async (input, credentials) => {
373
- const response = await createSendGridClient(credentials).request(`/suppression/blocks/${encodeURIComponent(input.email)}`);
374
- const arr = Array.isArray(response) ? response : response !== void 0 ? [response] : [];
375
- return sendgridBlockListSchema.parse(arr);
376
- }
377
- });
378
- const deleteBlock = sendgridOperation({
379
- id: "sendgrid.delete-block",
380
- name: "Delete Block",
381
- description: "Delete a block record for a specific email.",
382
- input: z.object({ email: sendgridEmailSchema }),
383
- output: z.object({ success: z.boolean() }),
384
- needsApproval: true,
385
- run: async (input, credentials) => {
386
- await createSendGridClient(credentials).request(`/suppression/blocks/${encodeURIComponent(input.email)}`, { method: "DELETE" });
387
- return { success: true };
388
- }
389
- });
390
- const deleteBlocks = sendgridOperation({
391
- id: "sendgrid.delete-blocks",
392
- name: "Delete Blocks",
393
- description: "Delete block records by email list, or delete all blocks.",
394
- input: z.object({
395
- emails: z.array(sendgridEmailSchema).min(1).optional(),
396
- deleteAll: z.boolean().optional()
397
- }).refine((v) => v.emails !== void 0 !== (v.deleteAll === true), { message: "Provide either `emails` or `deleteAll: true`, not both." }),
398
- output: z.object({ success: z.boolean() }),
399
- needsApproval: true,
400
- run: async (input, credentials) => {
401
- await createSendGridClient(credentials).request("/suppression/blocks", {
402
- method: "DELETE",
403
- body: omitUndefined({
404
- emails: input.emails,
405
- delete_all: input.deleteAll
406
- })
407
- });
408
- return { success: true };
409
- }
410
- });
411
- const listInvalidEmails = sendgridOperation({
412
- id: "sendgrid.list-invalid-emails",
413
- name: "List Invalid Emails",
414
- description: "List invalid-email suppression records.",
415
- input: timeRange.unwrap().extend({
416
- limit: z.number().int().positive().max(500).optional(),
417
- offset: z.number().int().nonnegative().optional()
418
- }).optional(),
419
- output: sendgridInvalidEmailListSchema,
420
- run: async (input, credentials) => {
421
- const response = await createSendGridClient(credentials).request("/suppression/invalid_emails", { query: omitUndefined({
422
- limit: input?.limit,
423
- offset: input?.offset,
424
- ...mapTimeQuery(input)
425
- }) });
426
- return sendgridInvalidEmailListSchema.parse(response ?? []);
427
- }
428
- });
429
- const getInvalidEmail = sendgridOperation({
430
- id: "sendgrid.get-invalid-email",
431
- name: "Get Invalid Email",
432
- description: "Retrieve invalid-email suppression records for a specific address.",
433
- input: z.object({ email: sendgridEmailSchema }),
434
- output: sendgridInvalidEmailListSchema,
435
- run: async (input, credentials) => {
436
- const response = await createSendGridClient(credentials).request(`/suppression/invalid_emails/${encodeURIComponent(input.email)}`);
437
- const arr = Array.isArray(response) ? response : response !== void 0 ? [response] : [];
438
- return sendgridInvalidEmailListSchema.parse(arr);
439
- }
440
- });
441
- const deleteInvalidEmail = sendgridOperation({
442
- id: "sendgrid.delete-invalid-email",
443
- name: "Delete Invalid Email",
444
- description: "Delete an invalid-email suppression record.",
445
- input: z.object({ email: sendgridEmailSchema }),
446
- output: z.object({ success: z.boolean() }),
447
- needsApproval: true,
448
- run: async (input, credentials) => {
449
- await createSendGridClient(credentials).request(`/suppression/invalid_emails/${encodeURIComponent(input.email)}`, { method: "DELETE" });
450
- return { success: true };
451
- }
452
- });
453
- const deleteInvalidEmails = sendgridOperation({
454
- id: "sendgrid.delete-invalid-emails",
455
- name: "Delete Invalid Emails",
456
- description: "Delete invalid-email suppression records in bulk.",
457
- input: z.object({
458
- emails: z.array(sendgridEmailSchema).min(1).optional(),
459
- deleteAll: z.boolean().optional()
460
- }).refine((v) => v.emails !== void 0 !== (v.deleteAll === true), { message: "Provide either `emails` or `deleteAll: true`, not both." }),
461
- output: z.object({ success: z.boolean() }),
462
- needsApproval: true,
463
- run: async (input, credentials) => {
464
- await createSendGridClient(credentials).request("/suppression/invalid_emails", {
465
- method: "DELETE",
466
- body: omitUndefined({
467
- emails: input.emails,
468
- delete_all: input.deleteAll
469
- })
470
- });
471
- return { success: true };
472
- }
473
- });
474
- const listSpamReports = sendgridOperation({
475
- id: "sendgrid.list-spam-reports",
476
- name: "List Spam Reports",
477
- description: "List spam-report suppression records.",
478
- input: timeRange.unwrap().extend({
479
- limit: z.number().int().positive().max(500).optional(),
480
- offset: z.number().int().nonnegative().optional()
481
- }).optional(),
482
- output: sendgridSpamReportListSchema,
483
- run: async (input, credentials) => {
484
- const response = await createSendGridClient(credentials).request("/suppression/spam_reports", { query: omitUndefined({
485
- limit: input?.limit,
486
- offset: input?.offset,
487
- ...mapTimeQuery(input)
488
- }) });
489
- return sendgridSpamReportListSchema.parse(response ?? []);
490
- }
491
- });
492
- const getSpamReport = sendgridOperation({
493
- id: "sendgrid.get-spam-report",
494
- name: "Get Spam Report",
495
- description: "Retrieve spam-report suppression records for a specific email.",
496
- input: z.object({ email: sendgridEmailSchema }),
497
- output: sendgridSpamReportListSchema,
498
- run: async (input, credentials) => {
499
- const response = await createSendGridClient(credentials).request(`/suppression/spam_reports/${encodeURIComponent(input.email)}`);
500
- const arr = Array.isArray(response) ? response : response !== void 0 ? [response] : [];
501
- return sendgridSpamReportListSchema.parse(arr);
502
- }
503
- });
504
- const deleteSpamReport = sendgridOperation({
505
- id: "sendgrid.delete-spam-report",
506
- name: "Delete Spam Report",
507
- description: "Delete a spam-report suppression record.",
508
- input: z.object({ email: sendgridEmailSchema }),
509
- output: z.object({ success: z.boolean() }),
510
- needsApproval: true,
511
- run: async (input, credentials) => {
512
- await createSendGridClient(credentials).request(`/suppression/spam_reports/${encodeURIComponent(input.email)}`, { method: "DELETE" });
513
- return { success: true };
514
- }
515
- });
516
- const deleteSpamReports = sendgridOperation({
517
- id: "sendgrid.delete-spam-reports",
518
- name: "Delete Spam Reports",
519
- description: "Delete spam-report suppression records in bulk.",
520
- input: z.object({
521
- emails: z.array(sendgridEmailSchema).min(1).optional(),
522
- deleteAll: z.boolean().optional()
523
- }).refine((v) => v.emails !== void 0 !== (v.deleteAll === true), { message: "Provide either `emails` or `deleteAll: true`, not both." }),
524
- output: z.object({ success: z.boolean() }),
525
- needsApproval: true,
526
- run: async (input, credentials) => {
527
- await createSendGridClient(credentials).request("/suppression/spam_reports", {
528
- method: "DELETE",
529
- body: omitUndefined({
530
- emails: input.emails,
531
- delete_all: input.deleteAll
532
- })
533
- });
534
- return { success: true };
535
- }
536
- });
537
-
538
- //#endregion
539
- export { addGlobalSuppressions, addSuppressionsToGroup, createSuppressionGroup, deleteBlock, deleteBlocks, deleteBounce, deleteBounces, deleteGlobalSuppression, deleteInvalidEmail, deleteInvalidEmails, deleteSpamReport, deleteSpamReports, deleteSuppressionFromGroup, deleteSuppressionGroup, getBlock, getBounce, getGlobalSuppression, getInvalidEmail, getSpamReport, getSuppressionGroup, listAllSuppressions, listBlocks, listBounces, listGlobalSuppressions, listGroupSuppressions, listGroupsForEmail, listInvalidEmails, listSpamReports, listSuppressionGroups, searchSuppressionsInGroup, suppressions_exports as t, updateSuppressionGroup };