@keystrokehq/sendgrid 0.0.1

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 (63) hide show
  1. package/README.md +225 -0
  2. package/dist/_official/index.d.mts +2 -0
  3. package/dist/_official/index.mjs +3 -0
  4. package/dist/_runtime/index.d.mts +2 -0
  5. package/dist/_runtime/index.mjs +3 -0
  6. package/dist/alerts.d.mts +193 -0
  7. package/dist/alerts.mjs +101 -0
  8. package/dist/api-keys.d.mts +160 -0
  9. package/dist/api-keys.mjs +113 -0
  10. package/dist/client.d.mts +73 -0
  11. package/dist/client.mjs +261 -0
  12. package/dist/connection.d.mts +2 -0
  13. package/dist/connection.mjs +3 -0
  14. package/dist/domains.d.mts +114 -0
  15. package/dist/domains.mjs +62 -0
  16. package/dist/email-validation.d.mts +134 -0
  17. package/dist/email-validation.mjs +73 -0
  18. package/dist/events.d.mts +69 -0
  19. package/dist/events.mjs +28 -0
  20. package/dist/factory-BSL0D2L0.mjs +25 -0
  21. package/dist/index.d.mts +1 -0
  22. package/dist/index.mjs +1 -0
  23. package/dist/integration-37BovSeK.mjs +23 -0
  24. package/dist/integration-CmJ2TILG.d.mts +57 -0
  25. package/dist/mail-send.d.mts +315 -0
  26. package/dist/mail-send.mjs +218 -0
  27. package/dist/marketing-contacts.d.mts +607 -0
  28. package/dist/marketing-contacts.mjs +277 -0
  29. package/dist/marketing-customfields.d.mts +94 -0
  30. package/dist/marketing-customfields.mjs +70 -0
  31. package/dist/marketing-lists.d.mts +184 -0
  32. package/dist/marketing-lists.mjs +130 -0
  33. package/dist/marketing-segments.d.mts +340 -0
  34. package/dist/marketing-segments.mjs +179 -0
  35. package/dist/marketing-singlesends.d.mts +648 -0
  36. package/dist/marketing-singlesends.mjs +277 -0
  37. package/dist/operations.d.mts +25 -0
  38. package/dist/operations.mjs +69 -0
  39. package/dist/schemas/index.d.mts +1395 -0
  40. package/dist/schemas/index.mjs +3 -0
  41. package/dist/sender-identities.d.mts +218 -0
  42. package/dist/sender-identities.mjs +109 -0
  43. package/dist/senders.d.mts +227 -0
  44. package/dist/senders.mjs +83 -0
  45. package/dist/shared-CQ8JFNXi.mjs +13 -0
  46. package/dist/stats.d.mts +215 -0
  47. package/dist/stats.mjs +107 -0
  48. package/dist/suppressions.d.mts +785 -0
  49. package/dist/suppressions.mjs +539 -0
  50. package/dist/templates.d.mts +451 -0
  51. package/dist/templates.mjs +238 -0
  52. package/dist/triggers.d.mts +35 -0
  53. package/dist/triggers.mjs +98 -0
  54. package/dist/user-account.d.mts +108 -0
  55. package/dist/user-account.mjs +59 -0
  56. package/dist/verification.d.mts +67 -0
  57. package/dist/verification.mjs +72 -0
  58. package/dist/webhooks/event.d.mts +287 -0
  59. package/dist/webhooks/event.mjs +147 -0
  60. package/dist/webhooks/parse.d.mts +172 -0
  61. package/dist/webhooks/parse.mjs +125 -0
  62. package/dist/webhooks-CKdsIikb.mjs +735 -0
  63. package/package.json +162 -0
@@ -0,0 +1,114 @@
1
+ import { z } from "zod";
2
+ import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
3
+ import * as _keystrokehq_core0 from "@keystrokehq/core";
4
+
5
+ //#region src/domains.d.ts
6
+ declare const listAuthenticatedDomains: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{
7
+ limit: z.ZodOptional<z.ZodNumber>;
8
+ offset: z.ZodOptional<z.ZodNumber>;
9
+ excludeSubusers: z.ZodOptional<z.ZodBoolean>;
10
+ username: z.ZodOptional<z.ZodString>;
11
+ domain: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>>, z.ZodArray<z.ZodObject<{
13
+ id: z.ZodNumber;
14
+ user_id: z.ZodOptional<z.ZodNumber>;
15
+ subdomain: z.ZodOptional<z.ZodString>;
16
+ domain: z.ZodString;
17
+ username: z.ZodOptional<z.ZodString>;
18
+ ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ custom_spf: z.ZodOptional<z.ZodBoolean>;
20
+ default: z.ZodOptional<z.ZodBoolean>;
21
+ legacy: z.ZodOptional<z.ZodBoolean>;
22
+ automatic_security: z.ZodOptional<z.ZodBoolean>;
23
+ valid: z.ZodOptional<z.ZodBoolean>;
24
+ dns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
25
+ valid: z.ZodOptional<z.ZodBoolean>;
26
+ type: z.ZodOptional<z.ZodString>;
27
+ host: z.ZodOptional<z.ZodString>;
28
+ data: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$catchall<z.ZodUnknown>>>>;
30
+ }, z.core.$catchall<z.ZodUnknown>>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
31
+ SENDGRID_API_KEY: z.ZodString;
32
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
33
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
34
+ global: "global";
35
+ eu: "eu";
36
+ }>>;
37
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
38
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
39
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
40
+ SENDGRID_API_KEY: z.ZodString;
41
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
42
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
43
+ global: "global";
44
+ eu: "eu";
45
+ }>>;
46
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
47
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strip>>[] | undefined>], undefined>;
49
+ declare const getAuthenticatedDomain: _keystrokehq_core0.Operation<z.ZodObject<{
50
+ domainId: z.ZodNumber;
51
+ }, z.core.$strip>, z.ZodObject<{
52
+ id: z.ZodNumber;
53
+ user_id: z.ZodOptional<z.ZodNumber>;
54
+ subdomain: z.ZodOptional<z.ZodString>;
55
+ domain: z.ZodString;
56
+ username: z.ZodOptional<z.ZodString>;
57
+ ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
58
+ custom_spf: z.ZodOptional<z.ZodBoolean>;
59
+ default: z.ZodOptional<z.ZodBoolean>;
60
+ legacy: z.ZodOptional<z.ZodBoolean>;
61
+ automatic_security: z.ZodOptional<z.ZodBoolean>;
62
+ valid: z.ZodOptional<z.ZodBoolean>;
63
+ dns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
64
+ valid: z.ZodOptional<z.ZodBoolean>;
65
+ type: z.ZodOptional<z.ZodString>;
66
+ host: z.ZodOptional<z.ZodString>;
67
+ data: z.ZodOptional<z.ZodString>;
68
+ }, z.core.$catchall<z.ZodUnknown>>>>;
69
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
70
+ SENDGRID_API_KEY: z.ZodString;
71
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
72
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
73
+ global: "global";
74
+ eu: "eu";
75
+ }>>;
76
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
77
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
78
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
79
+ SENDGRID_API_KEY: z.ZodString;
80
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
81
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
82
+ global: "global";
83
+ eu: "eu";
84
+ }>>;
85
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
86
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
87
+ }, z.core.$strip>>[] | undefined>], undefined>;
88
+ declare const validateAuthenticatedDomain: _keystrokehq_core0.Operation<z.ZodObject<{
89
+ domainId: z.ZodNumber;
90
+ }, z.core.$strip>, z.ZodObject<{
91
+ id: z.ZodNumber;
92
+ valid: z.ZodBoolean;
93
+ validation_results: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
94
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"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>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
104
+ SENDGRID_API_KEY: z.ZodString;
105
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
106
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
107
+ global: "global";
108
+ eu: "eu";
109
+ }>>;
110
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
111
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
112
+ }, z.core.$strip>>[] | undefined>], undefined>;
113
+ //#endregion
114
+ export { getAuthenticatedDomain, listAuthenticatedDomains, validateAuthenticatedDomain };
@@ -0,0 +1,62 @@
1
+ import { n as __exportAll, t as sendgridOperation } from "./factory-BSL0D2L0.mjs";
2
+ import { n as omitUndefined } from "./shared-CQ8JFNXi.mjs";
3
+ import { createSendGridClient } from "./client.mjs";
4
+ import { At as sendgridAuthenticatedDomainListSchema, Nt as sendgridDomainValidateResultSchema, jt as sendgridAuthenticatedDomainSchema } from "./webhooks-CKdsIikb.mjs";
5
+ import { z } from "zod";
6
+
7
+ //#region src/domains.ts
8
+ var domains_exports = /* @__PURE__ */ __exportAll({
9
+ getAuthenticatedDomain: () => getAuthenticatedDomain,
10
+ listAuthenticatedDomains: () => listAuthenticatedDomains,
11
+ validateAuthenticatedDomain: () => validateAuthenticatedDomain
12
+ });
13
+ const domainId = z.number().int().positive();
14
+ const listAuthenticatedDomains = sendgridOperation({
15
+ id: "list_authenticated_domains",
16
+ name: "List Authenticated Domains",
17
+ description: "List all domains set up for Sender Authentication.",
18
+ input: z.object({
19
+ limit: z.number().int().positive().max(500).optional(),
20
+ offset: z.number().int().nonnegative().optional(),
21
+ excludeSubusers: z.boolean().optional(),
22
+ username: z.string().optional(),
23
+ domain: z.string().optional()
24
+ }).optional(),
25
+ output: sendgridAuthenticatedDomainListSchema,
26
+ run: async (input, credentials) => {
27
+ const response = await createSendGridClient(credentials).request("/whitelabel/domains", { query: omitUndefined({
28
+ limit: input?.limit,
29
+ offset: input?.offset,
30
+ exclude_subusers: input?.excludeSubusers ? "true" : void 0,
31
+ username: input?.username,
32
+ domain: input?.domain
33
+ }) });
34
+ return sendgridAuthenticatedDomainListSchema.parse(response ?? []);
35
+ }
36
+ });
37
+ const getAuthenticatedDomain = sendgridOperation({
38
+ id: "get_authenticated_domain",
39
+ name: "Get Authenticated Domain",
40
+ description: "Retrieve a single authenticated-domain record including its DNS rows.",
41
+ input: z.object({ domainId }),
42
+ output: sendgridAuthenticatedDomainSchema,
43
+ run: async (input, credentials) => {
44
+ const response = await createSendGridClient(credentials).request(`/whitelabel/domains/${input.domainId}`);
45
+ return sendgridAuthenticatedDomainSchema.parse(response);
46
+ }
47
+ });
48
+ const validateAuthenticatedDomain = sendgridOperation({
49
+ id: "validate_authenticated_domain",
50
+ name: "Validate Authenticated Domain",
51
+ description: "Ask SendGrid to re-check the DNS records of an authenticated domain.",
52
+ input: z.object({ domainId }),
53
+ output: sendgridDomainValidateResultSchema,
54
+ needsApproval: true,
55
+ run: async (input, credentials) => {
56
+ const response = await createSendGridClient(credentials).request(`/whitelabel/domains/${input.domainId}/validate`, { method: "POST" });
57
+ return sendgridDomainValidateResultSchema.parse(response);
58
+ }
59
+ });
60
+
61
+ //#endregion
62
+ export { getAuthenticatedDomain, listAuthenticatedDomains, domains_exports as t, validateAuthenticatedDomain };
@@ -0,0 +1,134 @@
1
+ import { z } from "zod";
2
+ import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
3
+ import * as _keystrokehq_core0 from "@keystrokehq/core";
4
+
5
+ //#region src/email-validation.d.ts
6
+ declare const validateEmail: _keystrokehq_core0.Operation<z.ZodObject<{
7
+ email: z.ZodString;
8
+ source: z.ZodOptional<z.ZodString>;
9
+ }, z.core.$strip>, z.ZodObject<{
10
+ result: z.ZodObject<{
11
+ email: z.ZodString;
12
+ verdict: z.ZodEnum<{
13
+ Valid: "Valid";
14
+ Risky: "Risky";
15
+ Invalid: "Invalid";
16
+ }>;
17
+ score: z.ZodOptional<z.ZodNumber>;
18
+ local: z.ZodOptional<z.ZodString>;
19
+ host: z.ZodOptional<z.ZodString>;
20
+ suggestion: z.ZodOptional<z.ZodString>;
21
+ checks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
22
+ source: z.ZodOptional<z.ZodString>;
23
+ ip_address: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$catchall<z.ZodUnknown>>;
25
+ }, z.core.$strip>, 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 listBulkEmailValidationJobs: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
45
+ result: z.ZodArray<z.ZodObject<{
46
+ id: z.ZodString;
47
+ status: z.ZodString;
48
+ segments: z.ZodOptional<z.ZodNumber>;
49
+ results: z.ZodOptional<z.ZodUnknown>;
50
+ started_at: z.ZodOptional<z.ZodString>;
51
+ finished_at: z.ZodOptional<z.ZodString>;
52
+ submitted_at: z.ZodOptional<z.ZodString>;
53
+ }, z.core.$catchall<z.ZodUnknown>>>;
54
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
55
+ SENDGRID_API_KEY: z.ZodString;
56
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
57
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
58
+ global: "global";
59
+ eu: "eu";
60
+ }>>;
61
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
62
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<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>>[] | undefined>], undefined>;
73
+ declare const getBulkEmailValidationJob: _keystrokehq_core0.Operation<z.ZodObject<{
74
+ jobId: z.ZodString;
75
+ }, z.core.$strip>, z.ZodObject<{
76
+ id: z.ZodString;
77
+ status: z.ZodString;
78
+ segments: z.ZodOptional<z.ZodNumber>;
79
+ results: z.ZodOptional<z.ZodUnknown>;
80
+ started_at: z.ZodOptional<z.ZodString>;
81
+ finished_at: z.ZodOptional<z.ZodString>;
82
+ submitted_at: z.ZodOptional<z.ZodString>;
83
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
84
+ SENDGRID_API_KEY: z.ZodString;
85
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
86
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
87
+ global: "global";
88
+ eu: "eu";
89
+ }>>;
90
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
91
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
92
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
93
+ SENDGRID_API_KEY: z.ZodString;
94
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
95
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
96
+ global: "global";
97
+ eu: "eu";
98
+ }>>;
99
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
100
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
101
+ }, z.core.$strip>>[] | undefined>], undefined>;
102
+ declare const createBulkEmailValidationPresignedUrl: _keystrokehq_core0.Operation<z.ZodObject<{
103
+ fileType: z.ZodDefault<z.ZodEnum<{
104
+ zip: "zip";
105
+ csv: "csv";
106
+ }>>;
107
+ }, z.core.$strip>, z.ZodObject<{
108
+ job_id: z.ZodString;
109
+ upload_uri: z.ZodString;
110
+ upload_headers: z.ZodArray<z.ZodObject<{
111
+ header: z.ZodString;
112
+ value: z.ZodString;
113
+ }, z.core.$strip>>;
114
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
115
+ SENDGRID_API_KEY: z.ZodString;
116
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
117
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
118
+ global: "global";
119
+ eu: "eu";
120
+ }>>;
121
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
122
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
123
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
124
+ SENDGRID_API_KEY: z.ZodString;
125
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
126
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
127
+ global: "global";
128
+ eu: "eu";
129
+ }>>;
130
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
131
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
132
+ }, z.core.$strip>>[] | undefined>], undefined>;
133
+ //#endregion
134
+ export { createBulkEmailValidationPresignedUrl, getBulkEmailValidationJob, listBulkEmailValidationJobs, validateEmail };
@@ -0,0 +1,73 @@
1
+ import { n as __exportAll, t as sendgridOperation } from "./factory-BSL0D2L0.mjs";
2
+ import { n as omitUndefined } from "./shared-CQ8JFNXi.mjs";
3
+ import { createSendGridClient } from "./client.mjs";
4
+ import { Dt as sendgridEmailValidationResponseSchema, Et as sendgridBulkEmailValidationPresignedUrlSchema, Tt as sendgridBulkEmailValidationJobSchema, in as sendgridEmailSchema, on as sendgridIdSchema, wt as sendgridBulkEmailValidationJobListSchema } from "./webhooks-CKdsIikb.mjs";
5
+ import { z } from "zod";
6
+
7
+ //#region src/email-validation.ts
8
+ var email_validation_exports = /* @__PURE__ */ __exportAll({
9
+ createBulkEmailValidationPresignedUrl: () => createBulkEmailValidationPresignedUrl,
10
+ getBulkEmailValidationJob: () => getBulkEmailValidationJob,
11
+ listBulkEmailValidationJobs: () => listBulkEmailValidationJobs,
12
+ validateEmail: () => validateEmail
13
+ });
14
+ const validateEmail = sendgridOperation({
15
+ id: "validate_email",
16
+ name: "Validate Email",
17
+ description: "Validate a single email address using SendGrid Email Validation. Requires the Email Validation add-on.",
18
+ input: z.object({
19
+ email: sendgridEmailSchema,
20
+ source: z.string().max(30).optional()
21
+ }),
22
+ output: sendgridEmailValidationResponseSchema,
23
+ run: async (input, credentials) => {
24
+ const response = await createSendGridClient(credentials).request("/validations/email", {
25
+ method: "POST",
26
+ body: omitUndefined({
27
+ email: input.email,
28
+ source: input.source
29
+ })
30
+ });
31
+ return sendgridEmailValidationResponseSchema.parse(response);
32
+ }
33
+ });
34
+ const listBulkEmailValidationJobs = sendgridOperation({
35
+ id: "list_bulk_email_validation_jobs",
36
+ name: "List Bulk Email Validation Jobs",
37
+ description: "List bulk email validation jobs.",
38
+ input: z.object({}).optional(),
39
+ output: sendgridBulkEmailValidationJobListSchema,
40
+ run: async (_input, credentials) => {
41
+ const response = await createSendGridClient(credentials).request("/validations/email/jobs");
42
+ return sendgridBulkEmailValidationJobListSchema.parse(response ?? { result: [] });
43
+ }
44
+ });
45
+ const getBulkEmailValidationJob = sendgridOperation({
46
+ id: "get_bulk_email_validation_job",
47
+ name: "Get Bulk Email Validation Job",
48
+ description: "Retrieve status and results for a bulk validation job.",
49
+ input: z.object({ jobId: sendgridIdSchema }),
50
+ output: sendgridBulkEmailValidationJobSchema,
51
+ run: async (input, credentials) => {
52
+ const response = await createSendGridClient(credentials).request(`/validations/email/jobs/${encodeURIComponent(input.jobId)}`);
53
+ return sendgridBulkEmailValidationJobSchema.parse(response);
54
+ }
55
+ });
56
+ const createBulkEmailValidationPresignedUrl = sendgridOperation({
57
+ id: "create_bulk_email_validation_presigned_url",
58
+ name: "Create Bulk Email Validation Upload URL",
59
+ description: "Allocate a presigned upload URL for a bulk email-validation CSV.",
60
+ input: z.object({ fileType: z.enum(["csv", "zip"]).default("csv") }),
61
+ output: sendgridBulkEmailValidationPresignedUrlSchema,
62
+ needsApproval: true,
63
+ run: async (input, credentials) => {
64
+ const response = await createSendGridClient(credentials).request("/validations/email/jobs", {
65
+ method: "PUT",
66
+ body: { file_type: input.fileType }
67
+ });
68
+ return sendgridBulkEmailValidationPresignedUrlSchema.parse(response);
69
+ }
70
+ });
71
+
72
+ //#endregion
73
+ export { createBulkEmailValidationPresignedUrl, getBulkEmailValidationJob, listBulkEmailValidationJobs, email_validation_exports as t, validateEmail };
@@ -0,0 +1,69 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/events.d.ts
4
+ /**
5
+ * SendGrid Event Webhook event-name constants. Each webhook helper in
6
+ * `./triggers` pins `event` to one of these values.
7
+ */
8
+ declare const sendgridEventWebhookEventNames: readonly ["processed", "dropped", "deferred", "delivered", "bounce", "open", "click", "spam_report", "unsubscribe", "group_unsubscribe", "group_resubscribe"];
9
+ type SendGridEventWebhookEventName = (typeof sendgridEventWebhookEventNames)[number];
10
+ declare const sendgridEventWebhookEventNameSchema: z.ZodEnum<{
11
+ group_resubscribe: "group_resubscribe";
12
+ delivered: "delivered";
13
+ group_unsubscribe: "group_unsubscribe";
14
+ spam_report: "spam_report";
15
+ bounce: "bounce";
16
+ deferred: "deferred";
17
+ unsubscribe: "unsubscribe";
18
+ processed: "processed";
19
+ open: "open";
20
+ click: "click";
21
+ dropped: "dropped";
22
+ }>;
23
+ declare const sendgridEventEnvelopeSchema: z.ZodArray<z.ZodObject<{
24
+ email: z.ZodString;
25
+ timestamp: z.ZodNumber;
26
+ event: z.ZodString;
27
+ 'smtp-id': z.ZodOptional<z.ZodString>;
28
+ sg_event_id: z.ZodString;
29
+ sg_message_id: z.ZodOptional<z.ZodString>;
30
+ category: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
31
+ reason: z.ZodOptional<z.ZodString>;
32
+ status: z.ZodOptional<z.ZodString>;
33
+ response: z.ZodOptional<z.ZodString>;
34
+ attempt: z.ZodOptional<z.ZodString>;
35
+ url: z.ZodOptional<z.ZodString>;
36
+ useragent: z.ZodOptional<z.ZodString>;
37
+ ip: z.ZodOptional<z.ZodString>;
38
+ asm_group_id: z.ZodOptional<z.ZodNumber>;
39
+ tls: z.ZodOptional<z.ZodNumber>;
40
+ type: z.ZodOptional<z.ZodString>;
41
+ bounce_classification: z.ZodOptional<z.ZodString>;
42
+ sg_machine_open: z.ZodOptional<z.ZodBoolean>;
43
+ }, z.core.$catchall<z.ZodUnknown>>>;
44
+ declare const sendgridEventSchema: z.ZodObject<{
45
+ email: z.ZodString;
46
+ timestamp: z.ZodNumber;
47
+ event: z.ZodString;
48
+ 'smtp-id': z.ZodOptional<z.ZodString>;
49
+ sg_event_id: z.ZodString;
50
+ sg_message_id: z.ZodOptional<z.ZodString>;
51
+ category: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
52
+ reason: z.ZodOptional<z.ZodString>;
53
+ status: z.ZodOptional<z.ZodString>;
54
+ response: z.ZodOptional<z.ZodString>;
55
+ attempt: z.ZodOptional<z.ZodString>;
56
+ url: z.ZodOptional<z.ZodString>;
57
+ useragent: z.ZodOptional<z.ZodString>;
58
+ ip: z.ZodOptional<z.ZodString>;
59
+ asm_group_id: z.ZodOptional<z.ZodNumber>;
60
+ tls: z.ZodOptional<z.ZodNumber>;
61
+ type: z.ZodOptional<z.ZodString>;
62
+ bounce_classification: z.ZodOptional<z.ZodString>;
63
+ sg_machine_open: z.ZodOptional<z.ZodBoolean>;
64
+ }, z.core.$catchall<z.ZodUnknown>>;
65
+ type SendGridEvent = z.output<typeof sendgridEventSchema>;
66
+ declare const sendgridInboundParseEventName: "inbound_parse.received";
67
+ type SendGridInboundParseEventName = typeof sendgridInboundParseEventName;
68
+ //#endregion
69
+ export { SendGridEvent, SendGridEventWebhookEventName, SendGridInboundParseEventName, sendgridEventEnvelopeSchema, sendgridEventSchema, sendgridEventWebhookEventNameSchema, sendgridEventWebhookEventNames, sendgridInboundParseEventName };
@@ -0,0 +1,28 @@
1
+ import { r as sendgridEventWebhookPayloadSchema, t as sendgridEventWebhookEventSchema } from "./webhooks-CKdsIikb.mjs";
2
+ import { z } from "zod";
3
+
4
+ //#region src/events.ts
5
+ /**
6
+ * SendGrid Event Webhook event-name constants. Each webhook helper in
7
+ * `./triggers` pins `event` to one of these values.
8
+ */
9
+ const sendgridEventWebhookEventNames = [
10
+ "processed",
11
+ "dropped",
12
+ "deferred",
13
+ "delivered",
14
+ "bounce",
15
+ "open",
16
+ "click",
17
+ "spam_report",
18
+ "unsubscribe",
19
+ "group_unsubscribe",
20
+ "group_resubscribe"
21
+ ];
22
+ const sendgridEventWebhookEventNameSchema = z.enum(sendgridEventWebhookEventNames);
23
+ const sendgridEventEnvelopeSchema = sendgridEventWebhookPayloadSchema;
24
+ const sendgridEventSchema = sendgridEventWebhookEventSchema;
25
+ const sendgridInboundParseEventName = "inbound_parse.received";
26
+
27
+ //#endregion
28
+ export { sendgridEventEnvelopeSchema, sendgridEventSchema, sendgridEventWebhookEventNameSchema, sendgridEventWebhookEventNames, sendgridInboundParseEventName };
@@ -0,0 +1,25 @@
1
+ import { t as sendgrid } from "./integration-37BovSeK.mjs";
2
+ import { createOfficialOperationFactory } from "@keystrokehq/integration-authoring/official";
3
+
4
+ //#region \0rolldown/runtime.js
5
+ var __defProp = Object.defineProperty;
6
+ var __exportAll = (all, no_symbols) => {
7
+ let target = {};
8
+ for (var name in all) {
9
+ __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ }
14
+ if (!no_symbols) {
15
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
16
+ }
17
+ return target;
18
+ };
19
+
20
+ //#endregion
21
+ //#region src/factory.ts
22
+ const sendgridOperation = createOfficialOperationFactory(sendgrid);
23
+
24
+ //#endregion
25
+ export { __exportAll as n, sendgridOperation as t };
@@ -0,0 +1 @@
1
+ export { };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,23 @@
1
+ import { defineOfficialIntegration } from "@keystrokehq/integration-authoring/official";
2
+ import { z } from "zod";
3
+
4
+ //#region src/integration.ts
5
+ const sendgridAuthSchema = z.object({
6
+ SENDGRID_API_KEY: z.string().min(1).regex(/^SG\./u, "SendGrid API keys start with \"SG.\""),
7
+ SENDGRID_SUBUSER: z.string().min(1).optional(),
8
+ SENDGRID_ACCOUNT_REGION: z.enum(["global", "eu"]).default("global"),
9
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.string().min(1).optional(),
10
+ SENDGRID_INBOUND_PARSE_TOKEN: z.string().min(1).optional()
11
+ });
12
+ const sendgridOfficialIntegration = {
13
+ id: "sendgrid",
14
+ name: "SendGrid",
15
+ description: "SendGrid (Twilio) transactional + marketing email, templates, contacts, lists, segments, deliverability, and webhook helpers for Keystroke workflows",
16
+ auth: sendgridAuthSchema,
17
+ proxy: { hosts: ["api.sendgrid.com", "api.eu.sendgrid.com"] }
18
+ };
19
+ const sendgridBundle = defineOfficialIntegration(sendgridOfficialIntegration);
20
+ const sendgrid = sendgridBundle.credentialSet;
21
+
22
+ //#endregion
23
+ export { sendgridBundle as n, sendgridOfficialIntegration as r, sendgrid as t };
@@ -0,0 +1,57 @@
1
+ import * as _keystrokehq_integration_authoring_official0 from "@keystrokehq/integration-authoring/official";
2
+ import { z } from "zod";
3
+ import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
+ import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
5
+ import * as _keystrokehq_core0 from "@keystrokehq/core";
6
+
7
+ //#region src/integration.d.ts
8
+ declare const sendgridOfficialIntegration: {
9
+ id: "sendgrid";
10
+ name: string;
11
+ description: string;
12
+ auth: z.ZodObject<{
13
+ SENDGRID_API_KEY: z.ZodString;
14
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
15
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
16
+ global: "global";
17
+ eu: "eu";
18
+ }>>;
19
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
20
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>;
22
+ proxy: {
23
+ hosts: string[];
24
+ };
25
+ };
26
+ declare const sendgridBundle: _keystrokehq_integration_authoring_official0.OfficialIntegrationBundle<"sendgrid", z.ZodObject<{
27
+ SENDGRID_API_KEY: z.ZodString;
28
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
29
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
30
+ global: "global";
31
+ eu: "eu";
32
+ }>>;
33
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
34
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>>;
36
+ declare const sendgrid: _keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
37
+ SENDGRID_API_KEY: z.ZodString;
38
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
39
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
40
+ global: "global";
41
+ eu: "eu";
42
+ }>>;
43
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
44
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
46
+ SENDGRID_API_KEY: z.ZodString;
47
+ SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
48
+ SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
49
+ global: "global";
50
+ eu: "eu";
51
+ }>>;
52
+ SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
53
+ SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$strip>>[] | undefined>;
55
+ type SendGridCredentials = InferCredentialSetAuth<typeof sendgrid>;
56
+ //#endregion
57
+ export { sendgridOfficialIntegration as i, sendgrid as n, sendgridBundle as r, SendGridCredentials as t };