@keystrokehq/sendgrid 0.0.15 → 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 (68) 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 +5 -5
  9. package/dist/schemas/index.mjs +1 -1
  10. package/dist/{integration-DHWfpe0w.mjs → sendgrid.credential-set-CzYmlJ2Y.mjs} +9 -8
  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 +11 -99
  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 -147
  20. package/dist/alerts.mjs +0 -101
  21. package/dist/api-keys.d.mts +0 -105
  22. package/dist/api-keys.mjs +0 -113
  23. package/dist/client.d.mts +0 -73
  24. package/dist/client.mjs +0 -261
  25. package/dist/connection.d.mts +0 -2
  26. package/dist/connection.mjs +0 -3
  27. package/dist/domains.d.mts +0 -86
  28. package/dist/domains.mjs +0 -62
  29. package/dist/email-validation.d.mts +0 -97
  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-7q6CQ75J.mjs +0 -25
  34. package/dist/integration-Cj4Xzfq_.d.mts +0 -48
  35. package/dist/mail-send.d.mts +0 -242
  36. package/dist/mail-send.mjs +0 -218
  37. package/dist/marketing-contacts.d.mts +0 -462
  38. package/dist/marketing-contacts.mjs +0 -277
  39. package/dist/marketing-customfields.d.mts +0 -66
  40. package/dist/marketing-customfields.mjs +0 -70
  41. package/dist/marketing-lists.d.mts +0 -120
  42. package/dist/marketing-lists.mjs +0 -130
  43. package/dist/marketing-segments.d.mts +0 -249
  44. package/dist/marketing-segments.mjs +0 -179
  45. package/dist/marketing-singlesends.d.mts +0 -521
  46. package/dist/marketing-singlesends.mjs +0 -277
  47. package/dist/operations.d.mts +0 -25
  48. package/dist/operations.mjs +0 -69
  49. package/dist/sender-identities.d.mts +0 -163
  50. package/dist/sender-identities.mjs +0 -109
  51. package/dist/senders.d.mts +0 -181
  52. package/dist/senders.mjs +0 -83
  53. package/dist/shared-CQ8JFNXi.mjs +0 -13
  54. package/dist/stats.d.mts +0 -169
  55. package/dist/stats.mjs +0 -107
  56. package/dist/suppressions.d.mts +0 -505
  57. package/dist/suppressions.mjs +0 -539
  58. package/dist/templates.d.mts +0 -351
  59. package/dist/templates.mjs +0 -238
  60. package/dist/user-account.d.mts +0 -71
  61. package/dist/user-account.mjs +0 -59
  62. package/dist/verification.d.mts +0 -67
  63. package/dist/verification.mjs +0 -72
  64. package/dist/webhooks/event.d.mts +0 -214
  65. package/dist/webhooks/event.mjs +0 -147
  66. package/dist/webhooks/parse.d.mts +0 -117
  67. package/dist/webhooks/parse.mjs +0 -125
  68. /package/dist/{webhooks-CKdsIikb.mjs → webhooks-dVOd93Hd.mjs} +0 -0
@@ -1,277 +0,0 @@
1
- import { n as __exportAll, t as sendgridOperation } from "./factory-7q6CQ75J.mjs";
2
- import { n as omitUndefined } from "./shared-CQ8JFNXi.mjs";
3
- import { createSendGridClient } from "./client.mjs";
4
- import { Bt as sendgridContactExportSchema, Gt as sendgridContactSearchResultSchema, Ht as sendgridContactImportSchema, It as sendgridContactBatchResultSchema, Jt as sendgridUpsertContactsResultSchema, Kt as sendgridFieldDefinitionListSchema, Lt as sendgridContactCountSchema, Rt as sendgridContactDeleteResultSchema, Ut as sendgridContactInputSchema, Wt as sendgridContactSchema, in as sendgridEmailSchema, on as sendgridIdSchema, zt as sendgridContactExportListSchema } from "./webhooks-CKdsIikb.mjs";
5
- import { z } from "zod";
6
-
7
- //#region src/marketing-contacts.ts
8
- var marketing_contacts_exports = /* @__PURE__ */ __exportAll({
9
- createContactExport: () => createContactExport,
10
- createContactImport: () => createContactImport,
11
- deleteContactIdentifier: () => deleteContactIdentifier,
12
- deleteContacts: () => deleteContacts,
13
- getContact: () => getContact,
14
- getContactCount: () => getContactCount,
15
- getContactExportStatus: () => getContactExportStatus,
16
- getContactImportStatus: () => getContactImportStatus,
17
- getContactSample: () => getContactSample,
18
- getContactsByEmails: () => getContactsByEmails,
19
- getContactsByIdentifiers: () => getContactsByIdentifiers,
20
- getContactsByIds: () => getContactsByIds,
21
- listContactExports: () => listContactExports,
22
- listFieldDefinitions: () => listFieldDefinitions,
23
- searchContacts: () => searchContacts,
24
- upsertContacts: () => upsertContacts
25
- });
26
- const contactIdsSchema = z.array(sendgridIdSchema).min(1).max(100);
27
- const upsertContacts = sendgridOperation({
28
- id: "sendgrid.upsert-contacts",
29
- name: "Add or Update Contacts",
30
- description: "Upsert up to 30,000 contacts in Marketing Contacts v3. Returns a job ID; processing is asynchronous.",
31
- input: z.object({
32
- listIds: z.array(sendgridIdSchema).optional(),
33
- contacts: z.array(sendgridContactInputSchema).min(1).max(3e4)
34
- }),
35
- output: sendgridUpsertContactsResultSchema,
36
- needsApproval: true,
37
- run: async (input, credentials) => {
38
- const response = await createSendGridClient(credentials).request("/marketing/contacts", {
39
- method: "PUT",
40
- body: omitUndefined({
41
- list_ids: input.listIds,
42
- contacts: input.contacts
43
- })
44
- });
45
- return sendgridUpsertContactsResultSchema.parse(response);
46
- }
47
- });
48
- const deleteContacts = sendgridOperation({
49
- id: "sendgrid.delete-contacts",
50
- name: "Delete Contacts",
51
- description: "Delete contacts by ID. Set `deleteAllContacts` to wipe every contact in the account.",
52
- input: z.object({
53
- ids: contactIdsSchema.optional(),
54
- deleteAllContacts: z.boolean().optional()
55
- }).refine((v) => v.ids !== void 0 !== (v.deleteAllContacts === true), { message: "Provide either `ids` or `deleteAllContacts: true`, not both." }),
56
- output: sendgridContactDeleteResultSchema,
57
- needsApproval: true,
58
- run: async (input, credentials) => {
59
- const response = await createSendGridClient(credentials).request("/marketing/contacts", {
60
- method: "DELETE",
61
- query: omitUndefined({
62
- ids: input.ids?.join(","),
63
- delete_all_contacts: input.deleteAllContacts ? "true" : void 0
64
- })
65
- });
66
- return sendgridContactDeleteResultSchema.parse(response);
67
- }
68
- });
69
- const getContact = sendgridOperation({
70
- id: "sendgrid.get-contact",
71
- name: "Get Contact by ID",
72
- description: "Retrieve a single contact by its SendGrid contact ID.",
73
- input: z.object({ contactId: sendgridIdSchema }),
74
- output: sendgridContactSchema,
75
- run: async (input, credentials) => {
76
- const response = await createSendGridClient(credentials).request(`/marketing/contacts/${encodeURIComponent(input.contactId)}`);
77
- return sendgridContactSchema.parse(response);
78
- }
79
- });
80
- const getContactsByIds = sendgridOperation({
81
- id: "sendgrid.get-contacts-by-ids",
82
- name: "Get Batched Contacts by IDs",
83
- description: "Fetch up to 100 contacts in a single batched request.",
84
- input: z.object({ ids: contactIdsSchema }),
85
- output: sendgridContactBatchResultSchema,
86
- run: async (input, credentials) => {
87
- const response = await createSendGridClient(credentials).request("/marketing/contacts/batch", {
88
- method: "POST",
89
- body: { ids: input.ids }
90
- });
91
- return sendgridContactBatchResultSchema.parse(response ?? { result: [] });
92
- }
93
- });
94
- const getContactsByEmails = sendgridOperation({
95
- id: "sendgrid.get-contacts-by-emails",
96
- name: "Get Contacts by Email Addresses",
97
- description: "Find contacts by email (up to 100 per request).",
98
- input: z.object({ emails: z.array(sendgridEmailSchema).min(1).max(100) }),
99
- output: sendgridContactSearchResultSchema,
100
- run: async (input, credentials) => {
101
- const response = await createSendGridClient(credentials).request("/marketing/contacts/search/emails", {
102
- method: "POST",
103
- body: { emails: input.emails }
104
- });
105
- return sendgridContactSearchResultSchema.parse({ result: Array.isArray(response?.result) ? response.result : Object.values(response?.result ?? {}).map((entry) => entry.contact ?? entry) });
106
- }
107
- });
108
- const getContactsByIdentifiers = sendgridOperation({
109
- id: "sendgrid.get-contacts-by-identifiers",
110
- name: "Get Contacts by Identifiers",
111
- description: "Find contacts by alternate identifiers (e.g. phone, WhatsApp).",
112
- input: z.object({
113
- identifierType: z.enum([
114
- "phone_number_id",
115
- "external_id",
116
- "anonymous_id",
117
- "whatsapp"
118
- ]),
119
- identifiers: z.array(z.string().min(1)).min(1).max(100)
120
- }),
121
- output: sendgridContactSearchResultSchema,
122
- run: async (input, credentials) => {
123
- const response = await createSendGridClient(credentials).request("/marketing/contacts/search/identifiers", {
124
- method: "POST",
125
- body: {
126
- identifier_type: input.identifierType,
127
- identifiers: input.identifiers
128
- }
129
- });
130
- return sendgridContactSearchResultSchema.parse(response ?? { result: [] });
131
- }
132
- });
133
- const getContactSample = sendgridOperation({
134
- id: "sendgrid.get-contact-sample",
135
- name: "Get Sample Contacts",
136
- description: "Return up to 50 sample contacts for inspection (not a full list).",
137
- input: z.object({}).optional(),
138
- output: sendgridContactSearchResultSchema,
139
- run: async (_input, credentials) => {
140
- const response = await createSendGridClient(credentials).request("/marketing/contacts");
141
- return sendgridContactSearchResultSchema.parse(response ?? { result: [] });
142
- }
143
- });
144
- const getContactCount = sendgridOperation({
145
- id: "sendgrid.get-contact-count",
146
- name: "Get Total Contact Count",
147
- description: "Return the total + billable contact count for the account.",
148
- input: z.object({}).optional(),
149
- output: sendgridContactCountSchema,
150
- run: async (_input, credentials) => {
151
- const response = await createSendGridClient(credentials).request("/marketing/contacts/count");
152
- return sendgridContactCountSchema.parse(response);
153
- }
154
- });
155
- const searchContacts = sendgridOperation({
156
- id: "sendgrid.search-contacts",
157
- name: "Search Contacts",
158
- description: "Search contacts using a SQL-like `query` expression. Example: `email LIKE '%@example.com' AND last_name = 'Smith'`.",
159
- input: z.object({ query: z.string().min(1) }),
160
- output: sendgridContactSearchResultSchema,
161
- run: async (input, credentials) => {
162
- const response = await createSendGridClient(credentials).request("/marketing/contacts/search", {
163
- method: "POST",
164
- body: { query: input.query }
165
- });
166
- return sendgridContactSearchResultSchema.parse(response ?? { result: [] });
167
- }
168
- });
169
- const createContactImport = sendgridOperation({
170
- id: "sendgrid.create-contact-import",
171
- name: "Create Contact Import",
172
- description: "Create a contact-import job. Returns presigned upload details you then PUT a CSV to.",
173
- input: z.object({
174
- fileType: z.enum(["csv"]).default("csv"),
175
- fieldMappings: z.array(z.string()).optional(),
176
- listIds: z.array(sendgridIdSchema).optional()
177
- }),
178
- output: sendgridContactImportSchema,
179
- needsApproval: true,
180
- run: async (input, credentials) => {
181
- const response = await createSendGridClient(credentials).request("/marketing/contacts/imports", {
182
- method: "PUT",
183
- body: omitUndefined({
184
- file_type: input.fileType,
185
- field_mappings: input.fieldMappings,
186
- list_ids: input.listIds
187
- })
188
- });
189
- return sendgridContactImportSchema.parse(response);
190
- }
191
- });
192
- const getContactImportStatus = sendgridOperation({
193
- id: "sendgrid.get-contact-import-status",
194
- name: "Get Contact Import Status",
195
- description: "Retrieve status for a contact-import job.",
196
- input: z.object({ importId: sendgridIdSchema }),
197
- output: sendgridContactImportSchema,
198
- run: async (input, credentials) => {
199
- const response = await createSendGridClient(credentials).request(`/marketing/contacts/imports/${encodeURIComponent(input.importId)}`);
200
- return sendgridContactImportSchema.parse(response);
201
- }
202
- });
203
- const createContactExport = sendgridOperation({
204
- id: "sendgrid.create-contact-export",
205
- name: "Create Contact Export",
206
- description: "Create a contact-export job. Returns a job ID you poll for CSV URLs.",
207
- input: z.object({
208
- listIds: z.array(sendgridIdSchema).optional(),
209
- segmentIds: z.array(sendgridIdSchema).optional(),
210
- fileType: z.enum(["csv", "json"]).default("csv"),
211
- maxFileSize: z.number().int().positive().optional(),
212
- notifications: z.object({ email: z.object({ addresses: z.array(sendgridEmailSchema) }) }).optional()
213
- }),
214
- output: sendgridContactExportSchema,
215
- needsApproval: true,
216
- run: async (input, credentials) => {
217
- const response = await createSendGridClient(credentials).request("/marketing/contacts/exports", {
218
- method: "POST",
219
- body: omitUndefined({
220
- list_ids: input.listIds,
221
- segment_ids: input.segmentIds,
222
- file_type: input.fileType,
223
- max_file_size: input.maxFileSize,
224
- notifications: input.notifications
225
- })
226
- });
227
- return sendgridContactExportSchema.parse(response);
228
- }
229
- });
230
- const getContactExportStatus = sendgridOperation({
231
- id: "sendgrid.get-contact-export-status",
232
- name: "Get Contact Export Status",
233
- description: "Retrieve status (and signed CSV URLs when ready) for a contact-export job.",
234
- input: z.object({ exportId: sendgridIdSchema }),
235
- output: sendgridContactExportSchema,
236
- run: async (input, credentials) => {
237
- const response = await createSendGridClient(credentials).request(`/marketing/contacts/exports/${encodeURIComponent(input.exportId)}`);
238
- return sendgridContactExportSchema.parse(response);
239
- }
240
- });
241
- const listContactExports = sendgridOperation({
242
- id: "sendgrid.list-contact-exports",
243
- name: "List Existing Contact Exports",
244
- description: "List all contact-export jobs.",
245
- input: z.object({}).optional(),
246
- output: sendgridContactExportListSchema,
247
- run: async (_input, credentials) => {
248
- const response = await createSendGridClient(credentials).request("/marketing/contacts/exports");
249
- return sendgridContactExportListSchema.parse(response ?? { result: [] });
250
- }
251
- });
252
- const listFieldDefinitions = sendgridOperation({
253
- id: "sendgrid.list-field-definitions",
254
- name: "List Custom and Reserved Fields",
255
- description: "Return all custom and reserved Marketing Contacts field definitions.",
256
- input: z.object({}).optional(),
257
- output: sendgridFieldDefinitionListSchema,
258
- run: async (_input, credentials) => {
259
- const response = await createSendGridClient(credentials).request("/marketing/field_definitions");
260
- return sendgridFieldDefinitionListSchema.parse(response);
261
- }
262
- });
263
- const deleteContactIdentifier = sendgridOperation({
264
- id: "sendgrid.delete-contact-identifier",
265
- name: "Delete Contact Identifier",
266
- description: "Remove an alternate identifier (phone, external id, whatsapp, etc.) from a contact.",
267
- input: z.object({ identifierId: sendgridIdSchema }),
268
- output: z.object({ success: z.boolean() }),
269
- needsApproval: true,
270
- run: async (input, credentials) => {
271
- await createSendGridClient(credentials).request(`/marketing/contacts/identifiers/${encodeURIComponent(input.identifierId)}`, { method: "DELETE" });
272
- return { success: true };
273
- }
274
- });
275
-
276
- //#endregion
277
- export { createContactExport, createContactImport, deleteContactIdentifier, deleteContacts, getContact, getContactCount, getContactExportStatus, getContactImportStatus, getContactSample, getContactsByEmails, getContactsByIdentifiers, getContactsByIds, listContactExports, listFieldDefinitions, searchContacts, marketing_contacts_exports as t, upsertContacts };
@@ -1,66 +0,0 @@
1
- import { z } from "zod";
2
- import * as _keystrokehq_core0 from "@keystrokehq/core";
3
-
4
- //#region src/marketing-customfields.d.ts
5
- declare const createCustomField: _keystrokehq_core0.Operation<z.ZodObject<{
6
- name: z.ZodString;
7
- fieldType: z.ZodEnum<{
8
- Text: "Text";
9
- Number: "Number";
10
- Date: "Date";
11
- }>;
12
- }, z.core.$strip>, z.ZodObject<{
13
- id: z.ZodString;
14
- name: z.ZodString;
15
- field_type: z.ZodEnum<{
16
- Text: "Text";
17
- Number: "Number";
18
- Date: "Date";
19
- }>;
20
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
21
- SENDGRID_API_KEY: z.ZodString;
22
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
23
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
24
- global: "global";
25
- eu: "eu";
26
- }>>;
27
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
28
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
29
- }, z.core.$strip>>], undefined>;
30
- declare const updateCustomField: _keystrokehq_core0.Operation<z.ZodObject<{
31
- fieldId: z.ZodString;
32
- name: z.ZodString;
33
- }, z.core.$strip>, z.ZodObject<{
34
- id: z.ZodString;
35
- name: z.ZodString;
36
- field_type: z.ZodEnum<{
37
- Text: "Text";
38
- Number: "Number";
39
- Date: "Date";
40
- }>;
41
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
42
- SENDGRID_API_KEY: z.ZodString;
43
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
44
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
45
- global: "global";
46
- eu: "eu";
47
- }>>;
48
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
49
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
50
- }, z.core.$strip>>], undefined>;
51
- declare const deleteCustomField: _keystrokehq_core0.Operation<z.ZodObject<{
52
- fieldId: z.ZodString;
53
- }, z.core.$strip>, z.ZodObject<{
54
- success: z.ZodBoolean;
55
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
56
- SENDGRID_API_KEY: z.ZodString;
57
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
58
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
59
- global: "global";
60
- eu: "eu";
61
- }>>;
62
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
63
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
64
- }, z.core.$strip>>], undefined>;
65
- //#endregion
66
- export { createCustomField, deleteCustomField, updateCustomField };
@@ -1,70 +0,0 @@
1
- import { n as __exportAll, t as sendgridOperation } from "./factory-7q6CQ75J.mjs";
2
- import { createSendGridClient } from "./client.mjs";
3
- import { Pt as sendgridCustomFieldDefinitionSchema, on as sendgridIdSchema } from "./webhooks-CKdsIikb.mjs";
4
- import { z } from "zod";
5
-
6
- //#region src/marketing-customfields.ts
7
- var marketing_customfields_exports = /* @__PURE__ */ __exportAll({
8
- createCustomField: () => createCustomField,
9
- deleteCustomField: () => deleteCustomField,
10
- updateCustomField: () => updateCustomField
11
- });
12
- const fieldType = z.enum([
13
- "Text",
14
- "Number",
15
- "Date"
16
- ]);
17
- const createCustomField = sendgridOperation({
18
- id: "sendgrid.create-custom-field",
19
- name: "Create Custom Field",
20
- description: "Create a Marketing Contacts custom field definition.",
21
- input: z.object({
22
- name: z.string().min(1),
23
- fieldType
24
- }),
25
- output: sendgridCustomFieldDefinitionSchema,
26
- needsApproval: true,
27
- run: async (input, credentials) => {
28
- const response = await createSendGridClient(credentials).request("/marketing/field_definitions", {
29
- method: "POST",
30
- body: {
31
- name: input.name,
32
- field_type: input.fieldType
33
- }
34
- });
35
- return sendgridCustomFieldDefinitionSchema.parse(response);
36
- }
37
- });
38
- const updateCustomField = sendgridOperation({
39
- id: "sendgrid.update-custom-field",
40
- name: "Update Custom Field",
41
- description: "Rename a Marketing Contacts custom field.",
42
- input: z.object({
43
- fieldId: sendgridIdSchema,
44
- name: z.string().min(1)
45
- }),
46
- output: sendgridCustomFieldDefinitionSchema,
47
- needsApproval: true,
48
- run: async (input, credentials) => {
49
- const response = await createSendGridClient(credentials).request(`/marketing/field_definitions/${encodeURIComponent(input.fieldId)}`, {
50
- method: "PATCH",
51
- body: { name: input.name }
52
- });
53
- return sendgridCustomFieldDefinitionSchema.parse(response);
54
- }
55
- });
56
- const deleteCustomField = sendgridOperation({
57
- id: "sendgrid.delete-custom-field",
58
- name: "Delete Custom Field",
59
- description: "Delete a Marketing Contacts custom field definition.",
60
- input: z.object({ fieldId: sendgridIdSchema }),
61
- output: z.object({ success: z.boolean() }),
62
- needsApproval: true,
63
- run: async (input, credentials) => {
64
- await createSendGridClient(credentials).request(`/marketing/field_definitions/${encodeURIComponent(input.fieldId)}`, { method: "DELETE" });
65
- return { success: true };
66
- }
67
- });
68
-
69
- //#endregion
70
- export { createCustomField, deleteCustomField, marketing_customfields_exports as t, updateCustomField };
@@ -1,120 +0,0 @@
1
- import { z } from "zod";
2
- import * as _keystrokehq_core0 from "@keystrokehq/core";
3
-
4
- //#region src/marketing-lists.d.ts
5
- declare const createList: _keystrokehq_core0.Operation<z.ZodObject<{
6
- name: z.ZodString;
7
- }, z.core.$strip>, z.ZodObject<{
8
- id: z.ZodString;
9
- name: z.ZodString;
10
- contact_count: z.ZodOptional<z.ZodNumber>;
11
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
12
- SENDGRID_API_KEY: z.ZodString;
13
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
14
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
15
- global: "global";
16
- eu: "eu";
17
- }>>;
18
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
19
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
20
- }, z.core.$strip>>], undefined>;
21
- declare const updateList: _keystrokehq_core0.Operation<z.ZodObject<{
22
- listId: z.ZodString;
23
- name: z.ZodString;
24
- }, z.core.$strip>, z.ZodObject<{
25
- id: z.ZodString;
26
- name: z.ZodString;
27
- contact_count: z.ZodOptional<z.ZodNumber>;
28
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
29
- SENDGRID_API_KEY: z.ZodString;
30
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
31
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
32
- global: "global";
33
- eu: "eu";
34
- }>>;
35
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
36
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
37
- }, z.core.$strip>>], undefined>;
38
- declare const listMarketingLists: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{
39
- pageSize: z.ZodOptional<z.ZodNumber>;
40
- pageToken: z.ZodOptional<z.ZodString>;
41
- }, z.core.$strip>>, z.ZodObject<{
42
- result: z.ZodArray<z.ZodObject<{
43
- id: z.ZodString;
44
- name: z.ZodString;
45
- contact_count: z.ZodOptional<z.ZodNumber>;
46
- }, z.core.$catchall<z.ZodUnknown>>>;
47
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
48
- SENDGRID_API_KEY: z.ZodString;
49
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
50
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
51
- global: "global";
52
- eu: "eu";
53
- }>>;
54
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
55
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
56
- }, z.core.$strip>>], undefined>;
57
- declare const getList: _keystrokehq_core0.Operation<z.ZodObject<{
58
- listId: z.ZodString;
59
- contactSampleSize: z.ZodOptional<z.ZodNumber>;
60
- }, z.core.$strip>, z.ZodObject<{
61
- id: z.ZodString;
62
- name: z.ZodString;
63
- contact_count: z.ZodOptional<z.ZodNumber>;
64
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
65
- SENDGRID_API_KEY: z.ZodString;
66
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
67
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
68
- global: "global";
69
- eu: "eu";
70
- }>>;
71
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
72
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
73
- }, z.core.$strip>>], undefined>;
74
- declare const getListContactCount: _keystrokehq_core0.Operation<z.ZodObject<{
75
- listId: z.ZodString;
76
- }, z.core.$strip>, z.ZodObject<{
77
- contact_count: z.ZodNumber;
78
- billable_count: z.ZodOptional<z.ZodNumber>;
79
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
80
- SENDGRID_API_KEY: z.ZodString;
81
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
82
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
83
- global: "global";
84
- eu: "eu";
85
- }>>;
86
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
87
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
88
- }, z.core.$strip>>], undefined>;
89
- declare const removeContactsFromList: _keystrokehq_core0.Operation<z.ZodObject<{
90
- listId: z.ZodString;
91
- contactIds: z.ZodArray<z.ZodString>;
92
- }, z.core.$strip>, z.ZodObject<{
93
- job_id: z.ZodString;
94
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
95
- SENDGRID_API_KEY: z.ZodString;
96
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
97
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
98
- global: "global";
99
- eu: "eu";
100
- }>>;
101
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
102
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
103
- }, z.core.$strip>>], undefined>;
104
- declare const deleteList: _keystrokehq_core0.Operation<z.ZodObject<{
105
- listId: z.ZodString;
106
- deleteContacts: z.ZodOptional<z.ZodBoolean>;
107
- }, z.core.$strip>, z.ZodObject<{
108
- success: z.ZodBoolean;
109
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
110
- SENDGRID_API_KEY: z.ZodString;
111
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
112
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
113
- global: "global";
114
- eu: "eu";
115
- }>>;
116
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
117
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
118
- }, z.core.$strip>>], undefined>;
119
- //#endregion
120
- export { createList, deleteList, getList, getListContactCount, listMarketingLists, removeContactsFromList, updateList };
@@ -1,130 +0,0 @@
1
- import { n as __exportAll, t as sendgridOperation } from "./factory-7q6CQ75J.mjs";
2
- import { n as omitUndefined } from "./shared-CQ8JFNXi.mjs";
3
- import { createSendGridClient } from "./client.mjs";
4
- import { Ct as sendgridListSchema, St as sendgridListRemoveContactsResultSchema, bt as sendgridListCollectionSchema, on as sendgridIdSchema, xt as sendgridListContactCountSchema } from "./webhooks-CKdsIikb.mjs";
5
- import { z } from "zod";
6
-
7
- //#region src/marketing-lists.ts
8
- var marketing_lists_exports = /* @__PURE__ */ __exportAll({
9
- createList: () => createList,
10
- deleteList: () => deleteList,
11
- getList: () => getList,
12
- getListContactCount: () => getListContactCount,
13
- listMarketingLists: () => listMarketingLists,
14
- removeContactsFromList: () => removeContactsFromList,
15
- updateList: () => updateList
16
- });
17
- const createList = sendgridOperation({
18
- id: "sendgrid.create-list",
19
- name: "Create Marketing List",
20
- description: "Create a new v3 marketing list.",
21
- input: z.object({ name: z.string().min(1) }),
22
- output: sendgridListSchema,
23
- needsApproval: true,
24
- run: async (input, credentials) => {
25
- const response = await createSendGridClient(credentials).request("/marketing/lists", {
26
- method: "POST",
27
- body: { name: input.name }
28
- });
29
- return sendgridListSchema.parse(response);
30
- }
31
- });
32
- const updateList = sendgridOperation({
33
- id: "sendgrid.update-list",
34
- name: "Update Marketing List",
35
- description: "Rename a v3 marketing list.",
36
- input: z.object({
37
- listId: sendgridIdSchema,
38
- name: z.string().min(1)
39
- }),
40
- output: sendgridListSchema,
41
- needsApproval: true,
42
- run: async (input, credentials) => {
43
- const response = await createSendGridClient(credentials).request(`/marketing/lists/${encodeURIComponent(input.listId)}`, {
44
- method: "PATCH",
45
- body: { name: input.name }
46
- });
47
- return sendgridListSchema.parse(response);
48
- }
49
- });
50
- const listMarketingLists = sendgridOperation({
51
- id: "sendgrid.list-marketing-lists",
52
- name: "List Marketing Lists",
53
- description: "List all v3 marketing lists.",
54
- input: z.object({
55
- pageSize: z.number().int().positive().max(1e3).optional(),
56
- pageToken: z.string().min(1).optional()
57
- }).optional(),
58
- output: sendgridListCollectionSchema,
59
- run: async (input, credentials) => {
60
- const response = await createSendGridClient(credentials).request("/marketing/lists", { query: omitUndefined({
61
- page_size: input?.pageSize,
62
- page_token: input?.pageToken
63
- }) });
64
- return sendgridListCollectionSchema.parse(response ?? { result: [] });
65
- }
66
- });
67
- const getList = sendgridOperation({
68
- id: "sendgrid.get-list",
69
- name: "Get Marketing List",
70
- description: "Retrieve a v3 marketing list by ID.",
71
- input: z.object({
72
- listId: sendgridIdSchema,
73
- contactSampleSize: z.number().int().min(0).max(5).optional()
74
- }),
75
- output: sendgridListSchema,
76
- run: async (input, credentials) => {
77
- const response = await createSendGridClient(credentials).request(`/marketing/lists/${encodeURIComponent(input.listId)}`, { query: omitUndefined({ contact_sample: input.contactSampleSize }) });
78
- return sendgridListSchema.parse(response);
79
- }
80
- });
81
- const getListContactCount = sendgridOperation({
82
- id: "sendgrid.get-list-contact-count",
83
- name: "Get List Contact Count",
84
- description: "Return the number of contacts on a marketing list.",
85
- input: z.object({ listId: sendgridIdSchema }),
86
- output: sendgridListContactCountSchema,
87
- run: async (input, credentials) => {
88
- const response = await createSendGridClient(credentials).request(`/marketing/lists/${encodeURIComponent(input.listId)}/contacts/count`);
89
- return sendgridListContactCountSchema.parse(response);
90
- }
91
- });
92
- const removeContactsFromList = sendgridOperation({
93
- id: "sendgrid.remove-contacts-from-list",
94
- name: "Remove Contacts from List",
95
- description: "Remove the given contact IDs from a list. Contacts remain in the account (use deleteContacts to purge).",
96
- input: z.object({
97
- listId: sendgridIdSchema,
98
- contactIds: z.array(sendgridIdSchema).min(1).max(100)
99
- }),
100
- output: sendgridListRemoveContactsResultSchema,
101
- needsApproval: true,
102
- run: async (input, credentials) => {
103
- const response = await createSendGridClient(credentials).request(`/marketing/lists/${encodeURIComponent(input.listId)}/contacts`, {
104
- method: "DELETE",
105
- query: { contact_ids: input.contactIds.join(",") }
106
- });
107
- return sendgridListRemoveContactsResultSchema.parse(response);
108
- }
109
- });
110
- const deleteList = sendgridOperation({
111
- id: "sendgrid.delete-list",
112
- name: "Delete Marketing List",
113
- description: "Delete a marketing list. Set `deleteContacts: true` to also delete contacts only on this list.",
114
- input: z.object({
115
- listId: sendgridIdSchema,
116
- deleteContacts: z.boolean().optional()
117
- }),
118
- output: z.object({ success: z.boolean() }),
119
- needsApproval: true,
120
- run: async (input, credentials) => {
121
- await createSendGridClient(credentials).request(`/marketing/lists/${encodeURIComponent(input.listId)}`, {
122
- method: "DELETE",
123
- query: omitUndefined({ delete_contacts: input.deleteContacts ? "true" : void 0 })
124
- });
125
- return { success: true };
126
- }
127
- });
128
-
129
- //#endregion
130
- export { createList, deleteList, getList, getListContactCount, listMarketingLists, removeContactsFromList, marketing_lists_exports as t, updateList };