@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,315 +0,0 @@
1
- import * as _keystrokehq_core0 from "@keystrokehq/core";
2
- import { z } from "zod";
3
- import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
-
5
- //#region src/mail-send.d.ts
6
- declare const sendEmail: _keystrokehq_core0.Operation<z.ZodObject<{
7
- personalizations: z.ZodArray<z.ZodObject<{
8
- to: z.ZodArray<z.ZodObject<{
9
- email: z.ZodString;
10
- name: z.ZodOptional<z.ZodString>;
11
- }, z.core.$strip>>;
12
- cc: z.ZodOptional<z.ZodArray<z.ZodObject<{
13
- email: z.ZodString;
14
- name: z.ZodOptional<z.ZodString>;
15
- }, z.core.$strip>>>;
16
- bcc: z.ZodOptional<z.ZodArray<z.ZodObject<{
17
- email: z.ZodString;
18
- name: z.ZodOptional<z.ZodString>;
19
- }, z.core.$strip>>>;
20
- from: z.ZodOptional<z.ZodObject<{
21
- email: z.ZodString;
22
- name: z.ZodOptional<z.ZodString>;
23
- }, z.core.$strip>>;
24
- subject: z.ZodOptional<z.ZodString>;
25
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
26
- substitutions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
27
- dynamicTemplateData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
28
- customArgs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
29
- sendAt: z.ZodOptional<z.ZodNumber>;
30
- }, z.core.$strip>>;
31
- from: z.ZodObject<{
32
- email: z.ZodString;
33
- name: z.ZodOptional<z.ZodString>;
34
- }, z.core.$strip>;
35
- replyTo: z.ZodOptional<z.ZodObject<{
36
- email: z.ZodString;
37
- name: z.ZodOptional<z.ZodString>;
38
- }, z.core.$strip>>;
39
- replyToList: z.ZodOptional<z.ZodArray<z.ZodObject<{
40
- email: z.ZodString;
41
- name: z.ZodOptional<z.ZodString>;
42
- }, z.core.$strip>>>;
43
- subject: z.ZodOptional<z.ZodString>;
44
- content: z.ZodOptional<z.ZodArray<z.ZodObject<{
45
- type: z.ZodUnion<[z.ZodEnum<{
46
- "text/plain": "text/plain";
47
- "text/html": "text/html";
48
- }>, z.ZodString]>;
49
- value: z.ZodString;
50
- }, z.core.$strip>>>;
51
- templateId: z.ZodOptional<z.ZodString>;
52
- attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
53
- content: z.ZodString;
54
- type: z.ZodOptional<z.ZodString>;
55
- filename: z.ZodString;
56
- disposition: z.ZodOptional<z.ZodEnum<{
57
- attachment: "attachment";
58
- inline: "inline";
59
- }>>;
60
- contentId: z.ZodOptional<z.ZodString>;
61
- }, z.core.$strip>>>;
62
- categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
63
- customArgs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
64
- sendAt: z.ZodOptional<z.ZodNumber>;
65
- batchId: z.ZodOptional<z.ZodString>;
66
- asm: z.ZodOptional<z.ZodObject<{
67
- group_id: z.ZodNumber;
68
- groups_to_display: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
69
- }, z.core.$strip>>;
70
- ipPoolName: z.ZodOptional<z.ZodString>;
71
- mailSettings: z.ZodOptional<z.ZodObject<{
72
- sandboxMode: z.ZodOptional<z.ZodObject<{
73
- enable: z.ZodBoolean;
74
- }, z.core.$strip>>;
75
- bypassListManagement: z.ZodOptional<z.ZodObject<{
76
- enable: z.ZodBoolean;
77
- }, z.core.$strip>>;
78
- bypassSpamManagement: z.ZodOptional<z.ZodObject<{
79
- enable: z.ZodBoolean;
80
- }, z.core.$strip>>;
81
- bypassBounceManagement: z.ZodOptional<z.ZodObject<{
82
- enable: z.ZodBoolean;
83
- }, z.core.$strip>>;
84
- bypassUnsubscribeManagement: z.ZodOptional<z.ZodObject<{
85
- enable: z.ZodBoolean;
86
- }, z.core.$strip>>;
87
- footer: z.ZodOptional<z.ZodObject<{
88
- enable: z.ZodBoolean;
89
- text: z.ZodOptional<z.ZodString>;
90
- html: z.ZodOptional<z.ZodString>;
91
- }, z.core.$strip>>;
92
- }, z.core.$strip>>;
93
- trackingSettings: z.ZodOptional<z.ZodObject<{
94
- clickTracking: z.ZodOptional<z.ZodObject<{
95
- enable: z.ZodBoolean;
96
- enableText: z.ZodOptional<z.ZodBoolean>;
97
- }, z.core.$strip>>;
98
- openTracking: z.ZodOptional<z.ZodObject<{
99
- enable: z.ZodBoolean;
100
- substitutionTag: z.ZodOptional<z.ZodString>;
101
- }, z.core.$strip>>;
102
- subscriptionTracking: z.ZodOptional<z.ZodObject<{
103
- enable: z.ZodBoolean;
104
- }, z.core.$strip>>;
105
- ganalytics: z.ZodOptional<z.ZodObject<{
106
- enable: z.ZodBoolean;
107
- utmSource: z.ZodOptional<z.ZodString>;
108
- utmMedium: z.ZodOptional<z.ZodString>;
109
- utmTerm: z.ZodOptional<z.ZodString>;
110
- utmContent: z.ZodOptional<z.ZodString>;
111
- utmCampaign: z.ZodOptional<z.ZodString>;
112
- }, z.core.$strip>>;
113
- }, z.core.$strip>>;
114
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
115
- }, z.core.$strip>, z.ZodObject<{
116
- messageId: z.ZodOptional<z.ZodString>;
117
- accepted: z.ZodBoolean;
118
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
119
- SENDGRID_API_KEY: z.ZodString;
120
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
121
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
122
- global: "global";
123
- eu: "eu";
124
- }>>;
125
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
126
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
127
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
128
- SENDGRID_API_KEY: z.ZodString;
129
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
130
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
131
- global: "global";
132
- eu: "eu";
133
- }>>;
134
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
135
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
136
- }, z.core.$strip>>[] | undefined>], undefined>;
137
- declare const createBatchId: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
138
- batch_id: z.ZodString;
139
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
140
- SENDGRID_API_KEY: z.ZodString;
141
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
142
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
143
- global: "global";
144
- eu: "eu";
145
- }>>;
146
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
147
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
148
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
149
- SENDGRID_API_KEY: z.ZodString;
150
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
151
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
152
- global: "global";
153
- eu: "eu";
154
- }>>;
155
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
156
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
157
- }, z.core.$strip>>[] | undefined>], undefined>;
158
- declare const validateBatchId: _keystrokehq_core0.Operation<z.ZodObject<{
159
- batchId: z.ZodString;
160
- }, z.core.$strip>, z.ZodObject<{
161
- batch_id: z.ZodString;
162
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
163
- SENDGRID_API_KEY: z.ZodString;
164
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
165
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
166
- global: "global";
167
- eu: "eu";
168
- }>>;
169
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
170
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
171
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
172
- SENDGRID_API_KEY: z.ZodString;
173
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
174
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
175
- global: "global";
176
- eu: "eu";
177
- }>>;
178
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
179
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
180
- }, z.core.$strip>>[] | undefined>], undefined>;
181
- declare const cancelOrPauseScheduledSend: _keystrokehq_core0.Operation<z.ZodObject<{
182
- batchId: z.ZodString;
183
- status: z.ZodEnum<{
184
- cancel: "cancel";
185
- pause: "pause";
186
- }>;
187
- }, z.core.$strip>, z.ZodObject<{
188
- batch_id: z.ZodString;
189
- status: z.ZodOptional<z.ZodEnum<{
190
- cancel: "cancel";
191
- pause: "pause";
192
- }>>;
193
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
194
- SENDGRID_API_KEY: z.ZodString;
195
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
196
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
197
- global: "global";
198
- eu: "eu";
199
- }>>;
200
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
201
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
202
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
203
- SENDGRID_API_KEY: z.ZodString;
204
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
205
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
206
- global: "global";
207
- eu: "eu";
208
- }>>;
209
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
210
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
211
- }, z.core.$strip>>[] | undefined>], undefined>;
212
- declare const updateScheduledSend: _keystrokehq_core0.Operation<z.ZodObject<{
213
- batchId: z.ZodString;
214
- status: z.ZodEnum<{
215
- cancel: "cancel";
216
- pause: "pause";
217
- }>;
218
- }, z.core.$strip>, z.ZodObject<{
219
- success: z.ZodBoolean;
220
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
221
- SENDGRID_API_KEY: z.ZodString;
222
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
223
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
224
- global: "global";
225
- eu: "eu";
226
- }>>;
227
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
228
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
229
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
230
- SENDGRID_API_KEY: z.ZodString;
231
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
232
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
233
- global: "global";
234
- eu: "eu";
235
- }>>;
236
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
237
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
238
- }, z.core.$strip>>[] | undefined>], undefined>;
239
- declare const deleteScheduledSend: _keystrokehq_core0.Operation<z.ZodObject<{
240
- batchId: z.ZodString;
241
- }, z.core.$strip>, z.ZodObject<{
242
- success: z.ZodBoolean;
243
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
244
- SENDGRID_API_KEY: z.ZodString;
245
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
246
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
247
- global: "global";
248
- eu: "eu";
249
- }>>;
250
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
251
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
252
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
253
- SENDGRID_API_KEY: z.ZodString;
254
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
255
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
256
- global: "global";
257
- eu: "eu";
258
- }>>;
259
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
260
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
261
- }, z.core.$strip>>[] | undefined>], undefined>;
262
- declare const listScheduledSends: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodArray<z.ZodObject<{
263
- batch_id: z.ZodString;
264
- status: z.ZodOptional<z.ZodEnum<{
265
- cancel: "cancel";
266
- pause: "pause";
267
- }>>;
268
- }, z.core.$catchall<z.ZodUnknown>>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
269
- SENDGRID_API_KEY: z.ZodString;
270
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
271
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
272
- global: "global";
273
- eu: "eu";
274
- }>>;
275
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
276
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
277
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
278
- SENDGRID_API_KEY: z.ZodString;
279
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
280
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
281
- global: "global";
282
- eu: "eu";
283
- }>>;
284
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
285
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
286
- }, z.core.$strip>>[] | undefined>], undefined>;
287
- declare const getScheduledSend: _keystrokehq_core0.Operation<z.ZodObject<{
288
- batchId: z.ZodString;
289
- }, z.core.$strip>, z.ZodObject<{
290
- batch_id: z.ZodString;
291
- status: z.ZodOptional<z.ZodEnum<{
292
- cancel: "cancel";
293
- pause: "pause";
294
- }>>;
295
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
296
- SENDGRID_API_KEY: z.ZodString;
297
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
298
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
299
- global: "global";
300
- eu: "eu";
301
- }>>;
302
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
303
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
304
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
305
- SENDGRID_API_KEY: z.ZodString;
306
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
307
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
308
- global: "global";
309
- eu: "eu";
310
- }>>;
311
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
312
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
313
- }, z.core.$strip>>[] | undefined>], undefined>;
314
- //#endregion
315
- export { cancelOrPauseScheduledSend, createBatchId, deleteScheduledSend, getScheduledSend, listScheduledSends, sendEmail, updateScheduledSend, validateBatchId };
@@ -1,218 +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 { _t as sendgridScheduledSendSchema, ft as sendgridMailSendInputSchema, gt as sendgridScheduledSendListSchema, lt as sendgridBatchIdSchema, on as sendgridIdSchema, pt as sendgridMailSendResultSchema, vt as sendgridScheduledSendStatusSchema } from "./webhooks-CKdsIikb.mjs";
5
- import { z } from "zod";
6
-
7
- //#region src/mail-send.ts
8
- var mail_send_exports = /* @__PURE__ */ __exportAll({
9
- cancelOrPauseScheduledSend: () => cancelOrPauseScheduledSend,
10
- createBatchId: () => createBatchId,
11
- deleteScheduledSend: () => deleteScheduledSend,
12
- getScheduledSend: () => getScheduledSend,
13
- listScheduledSends: () => listScheduledSends,
14
- sendEmail: () => sendEmail,
15
- updateScheduledSend: () => updateScheduledSend,
16
- validateBatchId: () => validateBatchId
17
- });
18
- function mapEmailAddress(value) {
19
- return omitUndefined({
20
- email: value.email,
21
- name: value.name
22
- });
23
- }
24
- function mapEmailAddressList(value) {
25
- if (!value) return void 0;
26
- return value.map(mapEmailAddress);
27
- }
28
- function mapPersonalization(p) {
29
- return omitUndefined({
30
- to: p.to.map(mapEmailAddress),
31
- cc: mapEmailAddressList(p.cc),
32
- bcc: mapEmailAddressList(p.bcc),
33
- from: p.from ? mapEmailAddress(p.from) : void 0,
34
- subject: p.subject,
35
- headers: p.headers,
36
- substitutions: p.substitutions,
37
- dynamic_template_data: p.dynamicTemplateData,
38
- custom_args: p.customArgs,
39
- send_at: p.sendAt
40
- });
41
- }
42
- function mapMailSettings(settings) {
43
- if (!settings) return void 0;
44
- return omitUndefined({
45
- sandbox_mode: settings.sandboxMode,
46
- bypass_list_management: settings.bypassListManagement,
47
- bypass_spam_management: settings.bypassSpamManagement,
48
- bypass_bounce_management: settings.bypassBounceManagement,
49
- bypass_unsubscribe_management: settings.bypassUnsubscribeManagement,
50
- footer: settings.footer
51
- });
52
- }
53
- function mapTrackingSettings(settings) {
54
- if (!settings) return void 0;
55
- return omitUndefined({
56
- click_tracking: settings.clickTracking ? omitUndefined({
57
- enable: settings.clickTracking.enable,
58
- enable_text: settings.clickTracking.enableText
59
- }) : void 0,
60
- open_tracking: settings.openTracking ? omitUndefined({
61
- enable: settings.openTracking.enable,
62
- substitution_tag: settings.openTracking.substitutionTag
63
- }) : void 0,
64
- subscription_tracking: settings.subscriptionTracking,
65
- ganalytics: settings.ganalytics ? omitUndefined({
66
- enable: settings.ganalytics.enable,
67
- utm_source: settings.ganalytics.utmSource,
68
- utm_medium: settings.ganalytics.utmMedium,
69
- utm_term: settings.ganalytics.utmTerm,
70
- utm_content: settings.ganalytics.utmContent,
71
- utm_campaign: settings.ganalytics.utmCampaign
72
- }) : void 0
73
- });
74
- }
75
- function mapMailSendInput(input) {
76
- return omitUndefined({
77
- personalizations: input.personalizations.map(mapPersonalization),
78
- from: mapEmailAddress(input.from),
79
- reply_to: input.replyTo ? mapEmailAddress(input.replyTo) : void 0,
80
- reply_to_list: mapEmailAddressList(input.replyToList),
81
- subject: input.subject,
82
- content: input.content,
83
- template_id: input.templateId,
84
- attachments: input.attachments?.map((a) => omitUndefined({
85
- content: a.content,
86
- type: a.type,
87
- filename: a.filename,
88
- disposition: a.disposition,
89
- content_id: a.contentId
90
- })),
91
- categories: input.categories,
92
- custom_args: input.customArgs,
93
- send_at: input.sendAt,
94
- batch_id: input.batchId,
95
- asm: input.asm,
96
- ip_pool_name: input.ipPoolName,
97
- mail_settings: mapMailSettings(input.mailSettings),
98
- tracking_settings: mapTrackingSettings(input.trackingSettings),
99
- headers: input.headers
100
- });
101
- }
102
- const sendEmail = sendgridOperation({
103
- id: "sendgrid.send-email",
104
- name: "Send Email",
105
- description: "Send a transactional email via SendGrid (v3 Mail Send). Supports personalizations, dynamic templates, attachments, categories, custom args, sandbox mode, scheduled `send_at`, batch IDs, and ASM.",
106
- input: sendgridMailSendInputSchema,
107
- output: sendgridMailSendResultSchema,
108
- needsApproval: true,
109
- run: async (input, credentials) => {
110
- const header = (await createSendGridClient(credentials).request("/mail/send", {
111
- method: "POST",
112
- body: mapMailSendInput(input)
113
- }))?.messageId;
114
- return sendgridMailSendResultSchema.parse({
115
- accepted: true,
116
- ...header !== void 0 ? { messageId: header } : {}
117
- });
118
- }
119
- });
120
- const createBatchId = sendgridOperation({
121
- id: "sendgrid.create-batch-id",
122
- name: "Create Batch ID",
123
- description: "Mint a new batch ID. Use the returned ID as `batchId` on subsequent Mail Send calls to later cancel or pause all messages in the batch.",
124
- input: z.object({}).optional(),
125
- output: sendgridBatchIdSchema,
126
- needsApproval: true,
127
- run: async (_input, credentials) => {
128
- const response = await createSendGridClient(credentials).request("/mail/batch", { method: "POST" });
129
- return sendgridBatchIdSchema.parse(response);
130
- }
131
- });
132
- const validateBatchId = sendgridOperation({
133
- id: "sendgrid.validate-batch-id",
134
- name: "Validate Batch ID",
135
- description: "Confirm a batch ID exists and is usable.",
136
- input: z.object({ batchId: sendgridIdSchema }),
137
- output: sendgridBatchIdSchema,
138
- run: async (input, credentials) => {
139
- const response = await createSendGridClient(credentials).request(`/mail/batch/${encodeURIComponent(input.batchId)}`);
140
- return sendgridBatchIdSchema.parse(response);
141
- }
142
- });
143
- const cancelOrPauseScheduledSend = sendgridOperation({
144
- id: "sendgrid.cancel-or-pause-scheduled-send",
145
- name: "Cancel or Pause Scheduled Send",
146
- description: "Mark a batch ID as `cancel` or `pause`. Applies to all messages with that batch ID scheduled in the future.",
147
- input: z.object({
148
- batchId: sendgridIdSchema,
149
- status: sendgridScheduledSendStatusSchema
150
- }),
151
- output: sendgridScheduledSendSchema,
152
- needsApproval: true,
153
- run: async (input, credentials) => {
154
- const response = await createSendGridClient(credentials).request("/user/scheduled_sends", {
155
- method: "POST",
156
- body: {
157
- batch_id: input.batchId,
158
- status: input.status
159
- }
160
- });
161
- return sendgridScheduledSendSchema.parse(response);
162
- }
163
- });
164
- const updateScheduledSend = sendgridOperation({
165
- id: "sendgrid.update-scheduled-send",
166
- name: "Update Scheduled Send",
167
- description: "Toggle a scheduled batch between `cancel` and `pause`.",
168
- input: z.object({
169
- batchId: sendgridIdSchema,
170
- status: sendgridScheduledSendStatusSchema
171
- }),
172
- output: z.object({ success: z.boolean() }),
173
- needsApproval: true,
174
- run: async (input, credentials) => {
175
- await createSendGridClient(credentials).request(`/user/scheduled_sends/${encodeURIComponent(input.batchId)}`, {
176
- method: "PATCH",
177
- body: { status: input.status }
178
- });
179
- return { success: true };
180
- }
181
- });
182
- const deleteScheduledSend = sendgridOperation({
183
- id: "sendgrid.delete-scheduled-send",
184
- name: "Delete Cancellation or Pause from Scheduled Send",
185
- description: "Remove the cancellation or pause on a scheduled batch ID, allowing messages to send on schedule again.",
186
- input: z.object({ batchId: sendgridIdSchema }),
187
- output: z.object({ success: z.boolean() }),
188
- needsApproval: true,
189
- run: async (input, credentials) => {
190
- await createSendGridClient(credentials).request(`/user/scheduled_sends/${encodeURIComponent(input.batchId)}`, { method: "DELETE" });
191
- return { success: true };
192
- }
193
- });
194
- const listScheduledSends = sendgridOperation({
195
- id: "sendgrid.list-scheduled-sends",
196
- name: "List Scheduled Sends",
197
- description: "Retrieve all scheduled batches currently paused or cancelled.",
198
- input: z.object({}).optional(),
199
- output: sendgridScheduledSendListSchema,
200
- run: async (_input, credentials) => {
201
- const response = await createSendGridClient(credentials).request("/user/scheduled_sends");
202
- return sendgridScheduledSendListSchema.parse(response ?? []);
203
- }
204
- });
205
- const getScheduledSend = sendgridOperation({
206
- id: "sendgrid.get-scheduled-send",
207
- name: "Get Scheduled Send",
208
- description: "Retrieve the current `cancel`/`pause` state of a batch ID.",
209
- input: z.object({ batchId: sendgridIdSchema }),
210
- output: sendgridScheduledSendSchema,
211
- run: async (input, credentials) => {
212
- const response = await createSendGridClient(credentials).request(`/user/scheduled_sends/${encodeURIComponent(input.batchId)}`);
213
- return sendgridScheduledSendSchema.parse(response);
214
- }
215
- });
216
-
217
- //#endregion
218
- export { cancelOrPauseScheduledSend, createBatchId, deleteScheduledSend, getScheduledSend, listScheduledSends, sendEmail, mail_send_exports as t, updateScheduledSend, validateBatchId };