@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,130 +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 { 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 };
@@ -1,340 +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/marketing-segments.d.ts
6
- declare const createSegment: _keystrokehq_core0.Operation<z.ZodObject<{
7
- name: z.ZodString;
8
- parentListIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
9
- queryDsl: z.ZodString;
10
- }, z.core.$strip>, z.ZodObject<{
11
- id: z.ZodString;
12
- name: z.ZodString;
13
- query_dsl: z.ZodOptional<z.ZodString>;
14
- query_version: z.ZodOptional<z.ZodString>;
15
- parent_list_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
16
- contacts_count: z.ZodOptional<z.ZodNumber>;
17
- contacts_sample_updated_at: z.ZodOptional<z.ZodISODateTime>;
18
- created_at: z.ZodOptional<z.ZodISODateTime>;
19
- updated_at: z.ZodOptional<z.ZodISODateTime>;
20
- next_sample_update: z.ZodOptional<z.ZodISODateTime>;
21
- status: z.ZodOptional<z.ZodObject<{
22
- query_validation: z.ZodOptional<z.ZodString>;
23
- error_message: z.ZodOptional<z.ZodString>;
24
- }, z.core.$catchall<z.ZodUnknown>>>;
25
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
26
- SENDGRID_API_KEY: z.ZodString;
27
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
28
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
29
- global: "global";
30
- eu: "eu";
31
- }>>;
32
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
33
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
34
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
35
- SENDGRID_API_KEY: z.ZodString;
36
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
37
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
38
- global: "global";
39
- eu: "eu";
40
- }>>;
41
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
42
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
43
- }, z.core.$strip>>[] | undefined>], undefined>;
44
- declare const updateSegment: _keystrokehq_core0.Operation<z.ZodObject<{
45
- segmentId: z.ZodString;
46
- name: z.ZodOptional<z.ZodString>;
47
- queryDsl: z.ZodOptional<z.ZodString>;
48
- }, z.core.$strip>, z.ZodObject<{
49
- id: z.ZodString;
50
- name: z.ZodString;
51
- query_dsl: z.ZodOptional<z.ZodString>;
52
- query_version: z.ZodOptional<z.ZodString>;
53
- parent_list_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
54
- contacts_count: z.ZodOptional<z.ZodNumber>;
55
- contacts_sample_updated_at: z.ZodOptional<z.ZodISODateTime>;
56
- created_at: z.ZodOptional<z.ZodISODateTime>;
57
- updated_at: z.ZodOptional<z.ZodISODateTime>;
58
- next_sample_update: z.ZodOptional<z.ZodISODateTime>;
59
- status: z.ZodOptional<z.ZodObject<{
60
- query_validation: z.ZodOptional<z.ZodString>;
61
- error_message: z.ZodOptional<z.ZodString>;
62
- }, z.core.$catchall<z.ZodUnknown>>>;
63
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
64
- SENDGRID_API_KEY: z.ZodString;
65
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
66
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
67
- global: "global";
68
- eu: "eu";
69
- }>>;
70
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
71
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
72
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
73
- SENDGRID_API_KEY: z.ZodString;
74
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
75
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
76
- global: "global";
77
- eu: "eu";
78
- }>>;
79
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
80
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
81
- }, z.core.$strip>>[] | undefined>], undefined>;
82
- declare const deleteSegment: _keystrokehq_core0.Operation<z.ZodObject<{
83
- segmentId: z.ZodString;
84
- }, z.core.$strip>, z.ZodObject<{
85
- success: z.ZodBoolean;
86
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
87
- SENDGRID_API_KEY: z.ZodString;
88
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
89
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
90
- global: "global";
91
- eu: "eu";
92
- }>>;
93
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
94
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
95
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
96
- SENDGRID_API_KEY: z.ZodString;
97
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
98
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
99
- global: "global";
100
- eu: "eu";
101
- }>>;
102
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
103
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
104
- }, z.core.$strip>>[] | undefined>], undefined>;
105
- declare const listSegments: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{
106
- parentListIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
107
- noParentListId: z.ZodOptional<z.ZodBoolean>;
108
- }, z.core.$strip>>, z.ZodObject<{
109
- results: z.ZodArray<z.ZodObject<{
110
- id: z.ZodString;
111
- name: z.ZodString;
112
- query_dsl: z.ZodOptional<z.ZodString>;
113
- query_version: z.ZodOptional<z.ZodString>;
114
- parent_list_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
115
- contacts_count: z.ZodOptional<z.ZodNumber>;
116
- contacts_sample_updated_at: z.ZodOptional<z.ZodISODateTime>;
117
- created_at: z.ZodOptional<z.ZodISODateTime>;
118
- updated_at: z.ZodOptional<z.ZodISODateTime>;
119
- next_sample_update: z.ZodOptional<z.ZodISODateTime>;
120
- status: z.ZodOptional<z.ZodObject<{
121
- query_validation: z.ZodOptional<z.ZodString>;
122
- error_message: z.ZodOptional<z.ZodString>;
123
- }, z.core.$catchall<z.ZodUnknown>>>;
124
- }, z.core.$catchall<z.ZodUnknown>>>;
125
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
126
- SENDGRID_API_KEY: z.ZodString;
127
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
128
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
129
- global: "global";
130
- eu: "eu";
131
- }>>;
132
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
133
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
134
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
135
- SENDGRID_API_KEY: z.ZodString;
136
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
137
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
138
- global: "global";
139
- eu: "eu";
140
- }>>;
141
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
142
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
143
- }, z.core.$strip>>[] | undefined>], undefined>;
144
- declare const getSegment: _keystrokehq_core0.Operation<z.ZodObject<{
145
- segmentId: z.ZodString;
146
- contactsSample: z.ZodOptional<z.ZodBoolean>;
147
- }, z.core.$strip>, z.ZodObject<{
148
- id: z.ZodString;
149
- name: z.ZodString;
150
- query_dsl: z.ZodOptional<z.ZodString>;
151
- query_version: z.ZodOptional<z.ZodString>;
152
- parent_list_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
153
- contacts_count: z.ZodOptional<z.ZodNumber>;
154
- contacts_sample_updated_at: z.ZodOptional<z.ZodISODateTime>;
155
- created_at: z.ZodOptional<z.ZodISODateTime>;
156
- updated_at: z.ZodOptional<z.ZodISODateTime>;
157
- next_sample_update: z.ZodOptional<z.ZodISODateTime>;
158
- status: z.ZodOptional<z.ZodObject<{
159
- query_validation: z.ZodOptional<z.ZodString>;
160
- error_message: z.ZodOptional<z.ZodString>;
161
- }, z.core.$catchall<z.ZodUnknown>>>;
162
- }, z.core.$catchall<z.ZodUnknown>>, 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 refreshSegment: _keystrokehq_core0.Operation<z.ZodObject<{
182
- segmentId: z.ZodString;
183
- }, z.core.$strip>, z.ZodObject<{
184
- id: z.ZodString;
185
- name: z.ZodString;
186
- query_dsl: z.ZodOptional<z.ZodString>;
187
- query_version: z.ZodOptional<z.ZodString>;
188
- parent_list_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
189
- contacts_count: z.ZodOptional<z.ZodNumber>;
190
- contacts_sample_updated_at: z.ZodOptional<z.ZodISODateTime>;
191
- created_at: z.ZodOptional<z.ZodISODateTime>;
192
- updated_at: z.ZodOptional<z.ZodISODateTime>;
193
- next_sample_update: z.ZodOptional<z.ZodISODateTime>;
194
- status: z.ZodOptional<z.ZodObject<{
195
- query_validation: z.ZodOptional<z.ZodString>;
196
- error_message: z.ZodOptional<z.ZodString>;
197
- }, z.core.$catchall<z.ZodUnknown>>>;
198
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
199
- SENDGRID_API_KEY: z.ZodString;
200
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
201
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
202
- global: "global";
203
- eu: "eu";
204
- }>>;
205
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
206
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
207
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
208
- SENDGRID_API_KEY: z.ZodString;
209
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
210
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
211
- global: "global";
212
- eu: "eu";
213
- }>>;
214
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
215
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
216
- }, z.core.$strip>>[] | undefined>], undefined>;
217
- declare const filterSegmentsByParents: _keystrokehq_core0.Operation<z.ZodObject<{
218
- parentListIds: z.ZodArray<z.ZodString>;
219
- }, z.core.$strip>, z.ZodObject<{
220
- results: z.ZodArray<z.ZodObject<{
221
- id: z.ZodString;
222
- name: z.ZodString;
223
- query_dsl: z.ZodOptional<z.ZodString>;
224
- query_version: z.ZodOptional<z.ZodString>;
225
- parent_list_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
226
- contacts_count: z.ZodOptional<z.ZodNumber>;
227
- contacts_sample_updated_at: z.ZodOptional<z.ZodISODateTime>;
228
- created_at: z.ZodOptional<z.ZodISODateTime>;
229
- updated_at: z.ZodOptional<z.ZodISODateTime>;
230
- next_sample_update: z.ZodOptional<z.ZodISODateTime>;
231
- status: z.ZodOptional<z.ZodObject<{
232
- query_validation: z.ZodOptional<z.ZodString>;
233
- error_message: z.ZodOptional<z.ZodString>;
234
- }, z.core.$catchall<z.ZodUnknown>>>;
235
- }, z.core.$catchall<z.ZodUnknown>>>;
236
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
237
- SENDGRID_API_KEY: z.ZodString;
238
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
239
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
240
- global: "global";
241
- eu: "eu";
242
- }>>;
243
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
244
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
245
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
246
- SENDGRID_API_KEY: z.ZodString;
247
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
248
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
249
- global: "global";
250
- eu: "eu";
251
- }>>;
252
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
253
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
254
- }, z.core.$strip>>[] | undefined>], undefined>;
255
- declare const createLegacySegment: _keystrokehq_core0.Operation<z.ZodObject<{
256
- name: z.ZodString;
257
- parentListIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
258
- queryDsl: z.ZodString;
259
- }, z.core.$strip>, z.ZodObject<{
260
- id: z.ZodString;
261
- name: z.ZodString;
262
- query_dsl: z.ZodOptional<z.ZodString>;
263
- query_version: z.ZodOptional<z.ZodString>;
264
- parent_list_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
265
- contacts_count: z.ZodOptional<z.ZodNumber>;
266
- contacts_sample_updated_at: z.ZodOptional<z.ZodISODateTime>;
267
- created_at: z.ZodOptional<z.ZodISODateTime>;
268
- updated_at: z.ZodOptional<z.ZodISODateTime>;
269
- next_sample_update: z.ZodOptional<z.ZodISODateTime>;
270
- status: z.ZodOptional<z.ZodObject<{
271
- query_validation: z.ZodOptional<z.ZodString>;
272
- error_message: z.ZodOptional<z.ZodString>;
273
- }, z.core.$catchall<z.ZodUnknown>>>;
274
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
275
- SENDGRID_API_KEY: z.ZodString;
276
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
277
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
278
- global: "global";
279
- eu: "eu";
280
- }>>;
281
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
282
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
283
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
284
- SENDGRID_API_KEY: z.ZodString;
285
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
286
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
287
- global: "global";
288
- eu: "eu";
289
- }>>;
290
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
291
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
292
- }, z.core.$strip>>[] | undefined>], undefined>;
293
- declare const deleteLegacySegment: _keystrokehq_core0.Operation<z.ZodObject<{
294
- segmentId: z.ZodString;
295
- }, z.core.$strip>, z.ZodObject<{
296
- success: z.ZodBoolean;
297
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
298
- SENDGRID_API_KEY: z.ZodString;
299
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
300
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
301
- global: "global";
302
- eu: "eu";
303
- }>>;
304
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
305
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
306
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
307
- SENDGRID_API_KEY: z.ZodString;
308
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
309
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
310
- global: "global";
311
- eu: "eu";
312
- }>>;
313
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
314
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
315
- }, z.core.$strip>>[] | undefined>], undefined>;
316
- declare const removeSegmentWithoutContacts: _keystrokehq_core0.Operation<z.ZodObject<{
317
- segmentId: z.ZodString;
318
- }, z.core.$strip>, z.ZodObject<{
319
- success: z.ZodBoolean;
320
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
321
- SENDGRID_API_KEY: z.ZodString;
322
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
323
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
324
- global: "global";
325
- eu: "eu";
326
- }>>;
327
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
328
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
329
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
330
- SENDGRID_API_KEY: z.ZodString;
331
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
332
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
333
- global: "global";
334
- eu: "eu";
335
- }>>;
336
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
337
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
338
- }, z.core.$strip>>[] | undefined>], undefined>;
339
- //#endregion
340
- export { createLegacySegment, createSegment, deleteLegacySegment, deleteSegment, filterSegmentsByParents, getSegment, listSegments, refreshSegment, removeSegmentWithoutContacts, updateSegment };
@@ -1,179 +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 { at as sendgridSegmentListSchema, on as sendgridIdSchema, ot as sendgridSegmentSchema } from "./webhooks-CKdsIikb.mjs";
5
- import { z } from "zod";
6
-
7
- //#region src/marketing-segments.ts
8
- var marketing_segments_exports = /* @__PURE__ */ __exportAll({
9
- createLegacySegment: () => createLegacySegment,
10
- createSegment: () => createSegment,
11
- deleteLegacySegment: () => deleteLegacySegment,
12
- deleteSegment: () => deleteSegment,
13
- filterSegmentsByParents: () => filterSegmentsByParents,
14
- getSegment: () => getSegment,
15
- listSegments: () => listSegments,
16
- refreshSegment: () => refreshSegment,
17
- removeSegmentWithoutContacts: () => removeSegmentWithoutContacts,
18
- updateSegment: () => updateSegment
19
- });
20
- const segmentBody = z.object({
21
- name: z.string().min(1),
22
- parentListIds: z.array(sendgridIdSchema).optional(),
23
- queryDsl: z.string().min(1)
24
- });
25
- function mapSegmentBody(body) {
26
- return omitUndefined({
27
- name: body.name,
28
- parent_list_ids: body.parentListIds,
29
- query_dsl: body.queryDsl
30
- });
31
- }
32
- const createSegment = sendgridOperation({
33
- id: "sendgrid.create-segment",
34
- name: "Create Segment",
35
- description: "Create a Marketing Segments v2.0 segment.",
36
- input: segmentBody,
37
- output: sendgridSegmentSchema,
38
- needsApproval: true,
39
- run: async (input, credentials) => {
40
- const response = await createSendGridClient(credentials).request("/marketing/segments/2.0", {
41
- method: "POST",
42
- body: mapSegmentBody(input)
43
- });
44
- return sendgridSegmentSchema.parse(response);
45
- }
46
- });
47
- const updateSegment = sendgridOperation({
48
- id: "sendgrid.update-segment",
49
- name: "Update Segment",
50
- description: "Update a v2.0 segment.",
51
- input: z.object({
52
- segmentId: sendgridIdSchema,
53
- name: z.string().min(1).optional(),
54
- queryDsl: z.string().min(1).optional()
55
- }),
56
- output: sendgridSegmentSchema,
57
- needsApproval: true,
58
- run: async (input, credentials) => {
59
- const response = await createSendGridClient(credentials).request(`/marketing/segments/2.0/${encodeURIComponent(input.segmentId)}`, {
60
- method: "PATCH",
61
- body: omitUndefined({
62
- name: input.name,
63
- query_dsl: input.queryDsl
64
- })
65
- });
66
- return sendgridSegmentSchema.parse(response);
67
- }
68
- });
69
- const deleteSegment = sendgridOperation({
70
- id: "sendgrid.delete-segment",
71
- name: "Delete Segment",
72
- description: "Delete a v2.0 segment. Contacts remain.",
73
- input: z.object({ segmentId: sendgridIdSchema }),
74
- output: z.object({ success: z.boolean() }),
75
- needsApproval: true,
76
- run: async (input, credentials) => {
77
- await createSendGridClient(credentials).request(`/marketing/segments/2.0/${encodeURIComponent(input.segmentId)}`, { method: "DELETE" });
78
- return { success: true };
79
- }
80
- });
81
- const listSegments = sendgridOperation({
82
- id: "sendgrid.list-segments",
83
- name: "List Segments",
84
- description: "List v2.0 segments. Filter by parent list IDs.",
85
- input: z.object({
86
- parentListIds: z.array(sendgridIdSchema).optional(),
87
- noParentListId: z.boolean().optional()
88
- }).optional(),
89
- output: sendgridSegmentListSchema,
90
- run: async (input, credentials) => {
91
- const response = await createSendGridClient(credentials).request("/marketing/segments/2.0", { query: omitUndefined({
92
- parent_list_ids: input?.parentListIds?.join(","),
93
- no_parent_list_id: input?.noParentListId ? "true" : void 0
94
- }) });
95
- return sendgridSegmentListSchema.parse(response ?? { results: [] });
96
- }
97
- });
98
- const getSegment = sendgridOperation({
99
- id: "sendgrid.get-segment",
100
- name: "Get Segment",
101
- description: "Retrieve a v2.0 segment by ID.",
102
- input: z.object({
103
- segmentId: sendgridIdSchema,
104
- contactsSample: z.boolean().optional()
105
- }),
106
- output: sendgridSegmentSchema,
107
- run: async (input, credentials) => {
108
- const response = await createSendGridClient(credentials).request(`/marketing/segments/2.0/${encodeURIComponent(input.segmentId)}`, { query: omitUndefined({ contacts_sample: input.contactsSample ? "true" : void 0 }) });
109
- return sendgridSegmentSchema.parse(response);
110
- }
111
- });
112
- const refreshSegment = sendgridOperation({
113
- id: "sendgrid.refresh-segment",
114
- name: "Refresh Segment",
115
- description: "Manually refresh a v2.0 segment to re-evaluate its membership.",
116
- input: z.object({ segmentId: sendgridIdSchema }),
117
- output: sendgridSegmentSchema,
118
- needsApproval: true,
119
- run: async (input, credentials) => {
120
- const response = await createSendGridClient(credentials).request(`/marketing/segments/2.0/${encodeURIComponent(input.segmentId)}/refresh`, { method: "POST" });
121
- return sendgridSegmentSchema.parse(response);
122
- }
123
- });
124
- const filterSegmentsByParents = sendgridOperation({
125
- id: "sendgrid.filter-segments-by-parent-ids",
126
- name: "Filter Segments by Parent List IDs",
127
- description: "List segments whose parent list matches any of the given IDs.",
128
- input: z.object({ parentListIds: z.array(sendgridIdSchema).min(1) }),
129
- output: sendgridSegmentListSchema,
130
- run: async (input, credentials) => {
131
- const response = await createSendGridClient(credentials).request("/marketing/segments/2.0", { query: { parent_list_ids: input.parentListIds.join(",") } });
132
- return sendgridSegmentListSchema.parse(response ?? { results: [] });
133
- }
134
- });
135
- const createLegacySegment = sendgridOperation({
136
- id: "sendgrid.create-legacy-marketing-segment",
137
- name: "Create Marketing Segment (v1 engine)",
138
- description: "Create a segment using the v1 engine. Kept because some accounts still run v1; new code should prefer `createSegment`.",
139
- input: segmentBody,
140
- output: sendgridSegmentSchema,
141
- needsApproval: true,
142
- run: async (input, credentials) => {
143
- const response = await createSendGridClient(credentials).request("/marketing/segments", {
144
- method: "POST",
145
- body: mapSegmentBody(input)
146
- });
147
- return sendgridSegmentSchema.parse(response);
148
- }
149
- });
150
- const deleteLegacySegment = sendgridOperation({
151
- id: "sendgrid.delete-legacy-marketing-segment",
152
- name: "Delete Marketing Segment (v1 engine)",
153
- description: "Delete a v1-engine segment.",
154
- input: z.object({ segmentId: sendgridIdSchema }),
155
- output: z.object({ success: z.boolean() }),
156
- needsApproval: true,
157
- run: async (input, credentials) => {
158
- await createSendGridClient(credentials).request(`/marketing/segments/${encodeURIComponent(input.segmentId)}`, { method: "DELETE" });
159
- return { success: true };
160
- }
161
- });
162
- const removeSegmentWithoutContacts = sendgridOperation({
163
- id: "sendgrid.remove-segment-without-affecting-contacts",
164
- name: "Remove Segment Without Affecting Contacts",
165
- description: "Delete a v2.0 segment without removing any contacts.",
166
- input: z.object({ segmentId: sendgridIdSchema }),
167
- output: z.object({ success: z.boolean() }),
168
- needsApproval: true,
169
- run: async (input, credentials) => {
170
- await createSendGridClient(credentials).request(`/marketing/segments/2.0/${encodeURIComponent(input.segmentId)}`, {
171
- method: "DELETE",
172
- query: { contacts: "false" }
173
- });
174
- return { success: true };
175
- }
176
- });
177
-
178
- //#endregion
179
- export { createLegacySegment, createSegment, deleteLegacySegment, deleteSegment, filterSegmentsByParents, getSegment, listSegments, refreshSegment, removeSegmentWithoutContacts, marketing_segments_exports as t, updateSegment };