@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,59 +0,0 @@
1
- import { n as __exportAll, t as sendgridOperation } from "./factory-7q6CQ75J.mjs";
2
- import { createSendGridClient } from "./client.mjs";
3
- import { f as sendgridAccountInfoSchema, g as sendgridUserProfileSchema, m as sendgridScopesSchema, p as sendgridCreditBalanceSchema } from "./webhooks-CKdsIikb.mjs";
4
- import { z } from "zod";
5
-
6
- //#region src/user-account.ts
7
- var user_account_exports = /* @__PURE__ */ __exportAll({
8
- getAccountInfo: () => getAccountInfo,
9
- getCreditBalance: () => getCreditBalance,
10
- getUserProfile: () => getUserProfile,
11
- getUserScopes: () => getUserScopes
12
- });
13
- const getUserProfile = sendgridOperation({
14
- id: "sendgrid.get-user-profile",
15
- name: "Get User Profile",
16
- description: "Retrieve the account profile (name, company, mailing address).",
17
- input: z.object({}).optional(),
18
- output: sendgridUserProfileSchema,
19
- run: async (_input, credentials) => {
20
- const response = await createSendGridClient(credentials).request("/user/profile");
21
- return sendgridUserProfileSchema.parse(response);
22
- }
23
- });
24
- const getAccountInfo = sendgridOperation({
25
- id: "sendgrid.get-account-info",
26
- name: "Get Account Info",
27
- description: "Retrieve account type + reputation score.",
28
- input: z.object({}).optional(),
29
- output: sendgridAccountInfoSchema,
30
- run: async (_input, credentials) => {
31
- const response = await createSendGridClient(credentials).request("/user/account");
32
- return sendgridAccountInfoSchema.parse(response);
33
- }
34
- });
35
- const getUserScopes = sendgridOperation({
36
- id: "sendgrid.get-user-scopes",
37
- name: "Get User Scopes",
38
- description: "Retrieve the list of API scopes the current API key has access to.",
39
- input: z.object({}).optional(),
40
- output: sendgridScopesSchema,
41
- run: async (_input, credentials) => {
42
- const response = await createSendGridClient(credentials).request("/scopes");
43
- return sendgridScopesSchema.parse(response);
44
- }
45
- });
46
- const getCreditBalance = sendgridOperation({
47
- id: "sendgrid.get-credit-balance",
48
- name: "Get Credit Balance",
49
- description: "Retrieve the current SendGrid credit balance for the account.",
50
- input: z.object({}).optional(),
51
- output: sendgridCreditBalanceSchema,
52
- run: async (_input, credentials) => {
53
- const response = await createSendGridClient(credentials).request("/user/credits");
54
- return sendgridCreditBalanceSchema.parse(response);
55
- }
56
- });
57
-
58
- //#endregion
59
- export { getAccountInfo, getCreditBalance, getUserProfile, getUserScopes, user_account_exports as t };
@@ -1,67 +0,0 @@
1
- import { sendgridEventWebhookPayloadSchema } from "./schemas/index.mjs";
2
- import { z } from "zod";
3
-
4
- //#region src/verification.d.ts
5
- declare const SENDGRID_EVENT_SIGNATURE_HEADER = "x-twilio-email-event-webhook-signature";
6
- declare const SENDGRID_EVENT_TIMESTAMP_HEADER = "x-twilio-email-event-webhook-timestamp";
7
- interface SendGridEventWebhookVerifyInput {
8
- /** Raw request body bytes (not a JSON-reparsed string). */
9
- readonly rawBody: string | Uint8Array;
10
- /** Value of the `X-Twilio-Email-Event-Webhook-Signature` header. */
11
- readonly signature: string;
12
- /** Value of the `X-Twilio-Email-Event-Webhook-Timestamp` header. */
13
- readonly timestamp: string;
14
- /** Ed25519 public key in PEM form (as returned by `GET /v3/user/webhooks/event/settings/signed`). */
15
- readonly publicKeyPem: string;
16
- /** Maximum allowed clock skew between provider and verifier, in seconds. Defaults to 300s. */
17
- readonly toleranceSeconds?: number;
18
- /** Override `now` in tests. Defaults to `Date.now()`. */
19
- readonly now?: () => number;
20
- }
21
- /**
22
- * Verify a SendGrid Event Webhook request. Returns `true` for a valid signature.
23
- *
24
- * SendGrid signs `timestamp + rawBody` with Ed25519. The public key rotates when
25
- * `TOGGLE_WEBHOOK_SIGNATURE` is toggled, so callers should cache + refresh on
26
- * verification failures.
27
- */
28
- declare function verifySendGridEventWebhookRequest(input: SendGridEventWebhookVerifyInput): boolean;
29
- declare function parseSendGridEventWebhookBody(rawBody: string | Uint8Array): z.output<typeof sendgridEventWebhookPayloadSchema>;
30
- interface SendGridInboundParseVerifyInput {
31
- /** Full URL path the request arrived at (including any Keystroke-minted token). */
32
- readonly path: string;
33
- /** Expected Keystroke-minted parse token (from `SENDGRID_INBOUND_PARSE_TOKEN`). */
34
- readonly expectedToken: string;
35
- /** Optional IP allowlist (SendGrid publishes the IP range for Inbound Parse). */
36
- readonly sourceIp?: string;
37
- readonly allowedIps?: readonly string[];
38
- }
39
- /**
40
- * Verify an Inbound Parse request.
41
- *
42
- * SendGrid does NOT sign Inbound Parse payloads. Verification uses a Keystroke-minted
43
- * token embedded in the receiver URL, plus an optional IP allowlist check. This is
44
- * weaker than the Event Webhook's Ed25519 verification — callers are encouraged to
45
- * rotate `expectedToken` periodically.
46
- */
47
- declare function verifyInboundParseRequest(input: SendGridInboundParseVerifyInput): boolean;
48
- declare const sendgridInboundParseBodySchema: z.ZodObject<{
49
- headers: z.ZodOptional<z.ZodString>;
50
- dkim: z.ZodOptional<z.ZodString>;
51
- to: z.ZodOptional<z.ZodString>;
52
- from: z.ZodOptional<z.ZodString>;
53
- subject: z.ZodOptional<z.ZodString>;
54
- html: z.ZodOptional<z.ZodString>;
55
- text: z.ZodOptional<z.ZodString>;
56
- envelope: z.ZodOptional<z.ZodString>;
57
- charsets: z.ZodOptional<z.ZodString>;
58
- SPF: z.ZodOptional<z.ZodString>;
59
- spam_score: z.ZodOptional<z.ZodString>;
60
- spam_report: z.ZodOptional<z.ZodString>;
61
- sender_ip: z.ZodOptional<z.ZodString>;
62
- attachments: z.ZodOptional<z.ZodString>;
63
- 'attachment-info': z.ZodOptional<z.ZodString>;
64
- email: z.ZodOptional<z.ZodString>;
65
- }, z.core.$catchall<z.ZodUnknown>>;
66
- //#endregion
67
- export { SENDGRID_EVENT_SIGNATURE_HEADER, SENDGRID_EVENT_TIMESTAMP_HEADER, SendGridEventWebhookVerifyInput, SendGridInboundParseVerifyInput, parseSendGridEventWebhookBody, sendgridInboundParseBodySchema, verifyInboundParseRequest, verifySendGridEventWebhookRequest };
@@ -1,72 +0,0 @@
1
- import { a as sendgridInboundParsePayloadSchema, r as sendgridEventWebhookPayloadSchema } from "./webhooks-CKdsIikb.mjs";
2
- import { createPublicKey, createVerify, verify } from "node:crypto";
3
-
4
- //#region src/verification.ts
5
- const SENDGRID_EVENT_SIGNATURE_HEADER = "x-twilio-email-event-webhook-signature";
6
- const SENDGRID_EVENT_TIMESTAMP_HEADER = "x-twilio-email-event-webhook-timestamp";
7
- /**
8
- * Verify a SendGrid Event Webhook request. Returns `true` for a valid signature.
9
- *
10
- * SendGrid signs `timestamp + rawBody` with Ed25519. The public key rotates when
11
- * `TOGGLE_WEBHOOK_SIGNATURE` is toggled, so callers should cache + refresh on
12
- * verification failures.
13
- */
14
- function verifySendGridEventWebhookRequest(input) {
15
- const tolerance = input.toleranceSeconds ?? 300;
16
- const nowMs = (input.now ?? Date.now)();
17
- const timestampSeconds = Number(input.timestamp);
18
- if (!Number.isFinite(timestampSeconds)) return false;
19
- if (Math.abs(nowMs / 1e3 - timestampSeconds) > tolerance) return false;
20
- let publicKey;
21
- try {
22
- publicKey = createPublicKey({
23
- key: input.publicKeyPem,
24
- format: "pem"
25
- });
26
- } catch {
27
- return false;
28
- }
29
- let signatureBytes;
30
- try {
31
- signatureBytes = Buffer.from(input.signature, "base64");
32
- } catch {
33
- return false;
34
- }
35
- const rawBodyBuffer = typeof input.rawBody === "string" ? Buffer.from(input.rawBody, "utf8") : Buffer.from(input.rawBody);
36
- const payloadBuffer = Buffer.concat([Buffer.from(input.timestamp, "utf8"), rawBodyBuffer]);
37
- try {
38
- return verify(null, payloadBuffer, publicKey, signatureBytes);
39
- } catch {
40
- const verifier = createVerify("sha256");
41
- verifier.update(payloadBuffer);
42
- try {
43
- return verifier.verify(publicKey, signatureBytes);
44
- } catch {
45
- return false;
46
- }
47
- }
48
- }
49
- function parseSendGridEventWebhookBody(rawBody) {
50
- const text = typeof rawBody === "string" ? rawBody : Buffer.from(rawBody).toString("utf8");
51
- const json = JSON.parse(text);
52
- return sendgridEventWebhookPayloadSchema.parse(json);
53
- }
54
- /**
55
- * Verify an Inbound Parse request.
56
- *
57
- * SendGrid does NOT sign Inbound Parse payloads. Verification uses a Keystroke-minted
58
- * token embedded in the receiver URL, plus an optional IP allowlist check. This is
59
- * weaker than the Event Webhook's Ed25519 verification — callers are encouraged to
60
- * rotate `expectedToken` periodically.
61
- */
62
- function verifyInboundParseRequest(input) {
63
- if (!input.path.includes(input.expectedToken)) return false;
64
- if (input.allowedIps && input.allowedIps.length > 0) {
65
- if (!input.sourceIp || !input.allowedIps.includes(input.sourceIp)) return false;
66
- }
67
- return true;
68
- }
69
- const sendgridInboundParseBodySchema = sendgridInboundParsePayloadSchema;
70
-
71
- //#endregion
72
- export { SENDGRID_EVENT_SIGNATURE_HEADER, SENDGRID_EVENT_TIMESTAMP_HEADER, parseSendGridEventWebhookBody, sendgridInboundParseBodySchema, verifyInboundParseRequest, verifySendGridEventWebhookRequest };
@@ -1,214 +0,0 @@
1
- import { z } from "zod";
2
- import * as _keystrokehq_core0 from "@keystrokehq/core";
3
-
4
- //#region src/webhooks/event.d.ts
5
- declare const createEventWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
6
- friendly_name: z.ZodOptional<z.ZodString>;
7
- enabled: z.ZodOptional<z.ZodBoolean>;
8
- url: z.ZodString;
9
- group_resubscribe: z.ZodOptional<z.ZodBoolean>;
10
- delivered: z.ZodOptional<z.ZodBoolean>;
11
- group_unsubscribe: z.ZodOptional<z.ZodBoolean>;
12
- spam_report: z.ZodOptional<z.ZodBoolean>;
13
- bounce: z.ZodOptional<z.ZodBoolean>;
14
- deferred: z.ZodOptional<z.ZodBoolean>;
15
- unsubscribe: z.ZodOptional<z.ZodBoolean>;
16
- processed: z.ZodOptional<z.ZodBoolean>;
17
- open: z.ZodOptional<z.ZodBoolean>;
18
- click: z.ZodOptional<z.ZodBoolean>;
19
- dropped: z.ZodOptional<z.ZodBoolean>;
20
- oauth_client_id: z.ZodOptional<z.ZodString>;
21
- oauth_client_secret: z.ZodOptional<z.ZodString>;
22
- oauth_token_url: z.ZodOptional<z.ZodString>;
23
- }, z.core.$strip>, z.ZodObject<{
24
- id: z.ZodOptional<z.ZodString>;
25
- friendly_name: z.ZodOptional<z.ZodString>;
26
- enabled: z.ZodOptional<z.ZodBoolean>;
27
- url: z.ZodOptional<z.ZodString>;
28
- group_resubscribe: z.ZodOptional<z.ZodBoolean>;
29
- delivered: z.ZodOptional<z.ZodBoolean>;
30
- group_unsubscribe: z.ZodOptional<z.ZodBoolean>;
31
- spam_report: z.ZodOptional<z.ZodBoolean>;
32
- bounce: z.ZodOptional<z.ZodBoolean>;
33
- deferred: z.ZodOptional<z.ZodBoolean>;
34
- unsubscribe: z.ZodOptional<z.ZodBoolean>;
35
- processed: z.ZodOptional<z.ZodBoolean>;
36
- open: z.ZodOptional<z.ZodBoolean>;
37
- click: z.ZodOptional<z.ZodBoolean>;
38
- dropped: z.ZodOptional<z.ZodBoolean>;
39
- oauth_client_id: z.ZodOptional<z.ZodString>;
40
- oauth_token_url: z.ZodOptional<z.ZodString>;
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 updateEventWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
52
- friendly_name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
53
- enabled: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
54
- url: z.ZodOptional<z.ZodString>;
55
- group_resubscribe: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
56
- delivered: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
57
- group_unsubscribe: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
58
- spam_report: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
59
- bounce: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
60
- deferred: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
61
- unsubscribe: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
62
- processed: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
63
- open: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
64
- click: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
65
- dropped: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
66
- oauth_client_id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
67
- oauth_client_secret: z.ZodOptional<z.ZodOptional<z.ZodString>>;
68
- oauth_token_url: z.ZodOptional<z.ZodOptional<z.ZodString>>;
69
- webhookId: z.ZodString;
70
- }, z.core.$strip>, z.ZodObject<{
71
- id: z.ZodOptional<z.ZodString>;
72
- friendly_name: z.ZodOptional<z.ZodString>;
73
- enabled: z.ZodOptional<z.ZodBoolean>;
74
- url: z.ZodOptional<z.ZodString>;
75
- group_resubscribe: z.ZodOptional<z.ZodBoolean>;
76
- delivered: z.ZodOptional<z.ZodBoolean>;
77
- group_unsubscribe: z.ZodOptional<z.ZodBoolean>;
78
- spam_report: z.ZodOptional<z.ZodBoolean>;
79
- bounce: z.ZodOptional<z.ZodBoolean>;
80
- deferred: z.ZodOptional<z.ZodBoolean>;
81
- unsubscribe: z.ZodOptional<z.ZodBoolean>;
82
- processed: z.ZodOptional<z.ZodBoolean>;
83
- open: z.ZodOptional<z.ZodBoolean>;
84
- click: z.ZodOptional<z.ZodBoolean>;
85
- dropped: z.ZodOptional<z.ZodBoolean>;
86
- oauth_client_id: z.ZodOptional<z.ZodString>;
87
- oauth_token_url: z.ZodOptional<z.ZodString>;
88
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
89
- SENDGRID_API_KEY: z.ZodString;
90
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
91
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
92
- global: "global";
93
- eu: "eu";
94
- }>>;
95
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
96
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
97
- }, z.core.$strip>>], undefined>;
98
- declare const deleteEventWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
99
- webhookId: z.ZodString;
100
- }, z.core.$strip>, z.ZodObject<{
101
- success: z.ZodBoolean;
102
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
103
- SENDGRID_API_KEY: z.ZodString;
104
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
105
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
106
- global: "global";
107
- eu: "eu";
108
- }>>;
109
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
110
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
111
- }, z.core.$strip>>], undefined>;
112
- declare const listEventWebhooks: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
113
- max_allowed: z.ZodOptional<z.ZodNumber>;
114
- webhooks: z.ZodArray<z.ZodObject<{
115
- id: z.ZodOptional<z.ZodString>;
116
- friendly_name: z.ZodOptional<z.ZodString>;
117
- enabled: z.ZodOptional<z.ZodBoolean>;
118
- url: z.ZodOptional<z.ZodString>;
119
- group_resubscribe: z.ZodOptional<z.ZodBoolean>;
120
- delivered: z.ZodOptional<z.ZodBoolean>;
121
- group_unsubscribe: z.ZodOptional<z.ZodBoolean>;
122
- spam_report: z.ZodOptional<z.ZodBoolean>;
123
- bounce: z.ZodOptional<z.ZodBoolean>;
124
- deferred: z.ZodOptional<z.ZodBoolean>;
125
- unsubscribe: z.ZodOptional<z.ZodBoolean>;
126
- processed: z.ZodOptional<z.ZodBoolean>;
127
- open: z.ZodOptional<z.ZodBoolean>;
128
- click: z.ZodOptional<z.ZodBoolean>;
129
- dropped: z.ZodOptional<z.ZodBoolean>;
130
- oauth_client_id: z.ZodOptional<z.ZodString>;
131
- oauth_token_url: z.ZodOptional<z.ZodString>;
132
- }, z.core.$catchall<z.ZodUnknown>>>;
133
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
134
- SENDGRID_API_KEY: z.ZodString;
135
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
136
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
137
- global: "global";
138
- eu: "eu";
139
- }>>;
140
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
141
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
142
- }, z.core.$strip>>], undefined>;
143
- declare const getEventWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
144
- webhookId: z.ZodString;
145
- }, z.core.$strip>, z.ZodObject<{
146
- id: z.ZodOptional<z.ZodString>;
147
- friendly_name: z.ZodOptional<z.ZodString>;
148
- enabled: z.ZodOptional<z.ZodBoolean>;
149
- url: z.ZodOptional<z.ZodString>;
150
- group_resubscribe: z.ZodOptional<z.ZodBoolean>;
151
- delivered: z.ZodOptional<z.ZodBoolean>;
152
- group_unsubscribe: z.ZodOptional<z.ZodBoolean>;
153
- spam_report: z.ZodOptional<z.ZodBoolean>;
154
- bounce: z.ZodOptional<z.ZodBoolean>;
155
- deferred: z.ZodOptional<z.ZodBoolean>;
156
- unsubscribe: z.ZodOptional<z.ZodBoolean>;
157
- processed: z.ZodOptional<z.ZodBoolean>;
158
- open: z.ZodOptional<z.ZodBoolean>;
159
- click: z.ZodOptional<z.ZodBoolean>;
160
- dropped: z.ZodOptional<z.ZodBoolean>;
161
- oauth_client_id: z.ZodOptional<z.ZodString>;
162
- oauth_token_url: z.ZodOptional<z.ZodString>;
163
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
164
- SENDGRID_API_KEY: z.ZodString;
165
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
166
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
167
- global: "global";
168
- eu: "eu";
169
- }>>;
170
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
171
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
172
- }, z.core.$strip>>], undefined>;
173
- declare const getSignedPublicKey: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
174
- public_key: z.ZodString;
175
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
176
- SENDGRID_API_KEY: z.ZodString;
177
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
178
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
179
- global: "global";
180
- eu: "eu";
181
- }>>;
182
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
183
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
184
- }, z.core.$strip>>], undefined>;
185
- declare const toggleWebhookSignature: _keystrokehq_core0.Operation<z.ZodObject<{
186
- enabled: z.ZodBoolean;
187
- }, z.core.$strip>, z.ZodObject<{
188
- enabled: z.ZodBoolean;
189
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
190
- SENDGRID_API_KEY: z.ZodString;
191
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
192
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
193
- global: "global";
194
- eu: "eu";
195
- }>>;
196
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
197
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
198
- }, z.core.$strip>>], undefined>;
199
- declare const testEventWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
200
- url: z.ZodString;
201
- }, z.core.$strip>, z.ZodObject<{
202
- success: z.ZodBoolean;
203
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
204
- SENDGRID_API_KEY: z.ZodString;
205
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
206
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
207
- global: "global";
208
- eu: "eu";
209
- }>>;
210
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
211
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
212
- }, z.core.$strip>>], undefined>;
213
- //#endregion
214
- export { createEventWebhook, deleteEventWebhook, getEventWebhook, getSignedPublicKey, listEventWebhooks, testEventWebhook, toggleWebhookSignature, updateEventWebhook };
@@ -1,147 +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 { d as sendgridSignedPublicKeySchema, i as sendgridEventWebhookSettingsSchema, n as sendgridEventWebhookListSchema, u as sendgridSignatureToggleSchema } from "../webhooks-CKdsIikb.mjs";
5
- import { z } from "zod";
6
-
7
- //#region src/webhooks/event.ts
8
- var event_exports = /* @__PURE__ */ __exportAll({
9
- createEventWebhook: () => createEventWebhook,
10
- deleteEventWebhook: () => deleteEventWebhook,
11
- getEventWebhook: () => getEventWebhook,
12
- getSignedPublicKey: () => getSignedPublicKey,
13
- listEventWebhooks: () => listEventWebhooks,
14
- testEventWebhook: () => testEventWebhook,
15
- toggleWebhookSignature: () => toggleWebhookSignature,
16
- updateEventWebhook: () => updateEventWebhook
17
- });
18
- const webhookId = z.string().min(1);
19
- const eventWebhookInputSchema = z.object({
20
- friendly_name: z.string().optional(),
21
- enabled: z.boolean().optional(),
22
- url: z.string().url(),
23
- group_resubscribe: z.boolean().optional(),
24
- delivered: z.boolean().optional(),
25
- group_unsubscribe: z.boolean().optional(),
26
- spam_report: z.boolean().optional(),
27
- bounce: z.boolean().optional(),
28
- deferred: z.boolean().optional(),
29
- unsubscribe: z.boolean().optional(),
30
- processed: z.boolean().optional(),
31
- open: z.boolean().optional(),
32
- click: z.boolean().optional(),
33
- dropped: z.boolean().optional(),
34
- oauth_client_id: z.string().optional(),
35
- oauth_client_secret: z.string().optional(),
36
- oauth_token_url: z.string().optional()
37
- });
38
- const createEventWebhook = sendgridOperation({
39
- id: "sendgrid.create-event-webhook",
40
- name: "Create Event Webhook",
41
- description: "Register a new Event Webhook endpoint.",
42
- input: eventWebhookInputSchema,
43
- output: sendgridEventWebhookSettingsSchema,
44
- needsApproval: true,
45
- run: async (input, credentials) => {
46
- const response = await createSendGridClient(credentials).request("/user/webhooks/event/settings", {
47
- method: "POST",
48
- body: omitUndefined(input)
49
- });
50
- return sendgridEventWebhookSettingsSchema.parse(response);
51
- }
52
- });
53
- const updateEventWebhook = sendgridOperation({
54
- id: "sendgrid.update-event-webhook",
55
- name: "Update Event Webhook",
56
- description: "Update an Event Webhook endpoint.",
57
- input: eventWebhookInputSchema.partial().extend({ webhookId }),
58
- output: sendgridEventWebhookSettingsSchema,
59
- needsApproval: true,
60
- run: async (input, credentials) => {
61
- const client = createSendGridClient(credentials);
62
- const { webhookId: id, ...rest } = input;
63
- const response = await client.request(`/user/webhooks/event/settings/${encodeURIComponent(id)}`, {
64
- method: "PATCH",
65
- body: omitUndefined(rest)
66
- });
67
- return sendgridEventWebhookSettingsSchema.parse(response);
68
- }
69
- });
70
- const deleteEventWebhook = sendgridOperation({
71
- id: "sendgrid.delete-event-webhook",
72
- name: "Delete Event Webhook",
73
- description: "Delete an Event Webhook endpoint.",
74
- input: z.object({ webhookId }),
75
- output: z.object({ success: z.boolean() }),
76
- needsApproval: true,
77
- run: async (input, credentials) => {
78
- await createSendGridClient(credentials).request(`/user/webhooks/event/settings/${encodeURIComponent(input.webhookId)}`, { method: "DELETE" });
79
- return { success: true };
80
- }
81
- });
82
- const listEventWebhooks = sendgridOperation({
83
- id: "sendgrid.list-event-webhooks",
84
- name: "List Event Webhooks",
85
- description: "List all Event Webhook endpoints configured on the account.",
86
- input: z.object({}).optional(),
87
- output: sendgridEventWebhookListSchema,
88
- run: async (_input, credentials) => {
89
- const response = await createSendGridClient(credentials).request("/user/webhooks/event/settings/all");
90
- return sendgridEventWebhookListSchema.parse(response ?? { webhooks: [] });
91
- }
92
- });
93
- const getEventWebhook = sendgridOperation({
94
- id: "sendgrid.get-event-webhook",
95
- name: "Get Event Webhook",
96
- description: "Retrieve a single Event Webhook endpoint by ID.",
97
- input: z.object({ webhookId }),
98
- output: sendgridEventWebhookSettingsSchema,
99
- run: async (input, credentials) => {
100
- const response = await createSendGridClient(credentials).request(`/user/webhooks/event/settings/${encodeURIComponent(input.webhookId)}`);
101
- return sendgridEventWebhookSettingsSchema.parse(response);
102
- }
103
- });
104
- const getSignedPublicKey = sendgridOperation({
105
- id: "sendgrid.get-signed-public-key",
106
- name: "Get Signed Event Webhook Public Key",
107
- description: "Retrieve the Ed25519 public key used to verify signed Event Webhook POSTs. Cache + rotate on `toggle_webhook_signature`.",
108
- input: z.object({}).optional(),
109
- output: sendgridSignedPublicKeySchema,
110
- run: async (_input, credentials) => {
111
- const response = await createSendGridClient(credentials).request("/user/webhooks/event/settings/signed");
112
- return sendgridSignedPublicKeySchema.parse(response);
113
- }
114
- });
115
- const toggleWebhookSignature = sendgridOperation({
116
- id: "sendgrid.toggle-webhook-signature",
117
- name: "Toggle Webhook Signature",
118
- description: "Enable or disable Ed25519 signing on Event Webhook deliveries.",
119
- input: z.object({ enabled: z.boolean() }),
120
- output: sendgridSignatureToggleSchema,
121
- needsApproval: true,
122
- run: async (input, credentials) => {
123
- const response = await createSendGridClient(credentials).request("/user/webhooks/event/settings/signed", {
124
- method: "PATCH",
125
- body: { enabled: input.enabled }
126
- });
127
- return sendgridSignatureToggleSchema.parse(response);
128
- }
129
- });
130
- const testEventWebhook = sendgridOperation({
131
- id: "sendgrid.test-event-webhook",
132
- name: "Test Event Webhook",
133
- description: "Ask SendGrid to POST a test payload to the configured Event Webhook URL.",
134
- input: z.object({ url: z.string().url() }),
135
- output: z.object({ success: z.boolean() }),
136
- needsApproval: true,
137
- run: async (input, credentials) => {
138
- await createSendGridClient(credentials).request("/user/webhooks/event/test", {
139
- method: "POST",
140
- body: { url: input.url }
141
- });
142
- return { success: true };
143
- }
144
- });
145
-
146
- //#endregion
147
- export { createEventWebhook, deleteEventWebhook, getEventWebhook, getSignedPublicKey, listEventWebhooks, event_exports as t, testEventWebhook, toggleWebhookSignature, updateEventWebhook };
@@ -1,117 +0,0 @@
1
- import { z } from "zod";
2
- import * as _keystrokehq_core0 from "@keystrokehq/core";
3
-
4
- //#region src/webhooks/parse.d.ts
5
- declare const createParseSetting: _keystrokehq_core0.Operation<z.ZodObject<{
6
- url: z.ZodString;
7
- hostname: z.ZodString;
8
- spamCheck: z.ZodOptional<z.ZodBoolean>;
9
- sendRaw: z.ZodOptional<z.ZodBoolean>;
10
- }, z.core.$strip>, z.ZodObject<{
11
- url: z.ZodOptional<z.ZodString>;
12
- hostname: z.ZodString;
13
- spam_check: z.ZodOptional<z.ZodBoolean>;
14
- send_raw: z.ZodOptional<z.ZodBoolean>;
15
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
16
- SENDGRID_API_KEY: z.ZodString;
17
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
18
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
19
- global: "global";
20
- eu: "eu";
21
- }>>;
22
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
23
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
24
- }, z.core.$strip>>], undefined>;
25
- declare const updateParseSetting: _keystrokehq_core0.Operation<z.ZodObject<{
26
- url: z.ZodOptional<z.ZodString>;
27
- spamCheck: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
28
- sendRaw: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
29
- hostname: z.ZodString;
30
- }, z.core.$strip>, z.ZodObject<{
31
- url: z.ZodOptional<z.ZodString>;
32
- hostname: z.ZodString;
33
- spam_check: z.ZodOptional<z.ZodBoolean>;
34
- send_raw: z.ZodOptional<z.ZodBoolean>;
35
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
36
- SENDGRID_API_KEY: z.ZodString;
37
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
38
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
39
- global: "global";
40
- eu: "eu";
41
- }>>;
42
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
43
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
44
- }, z.core.$strip>>], undefined>;
45
- declare const deleteParseSetting: _keystrokehq_core0.Operation<z.ZodObject<{
46
- hostname: z.ZodString;
47
- }, z.core.$strip>, z.ZodObject<{
48
- success: z.ZodBoolean;
49
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
50
- SENDGRID_API_KEY: z.ZodString;
51
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
52
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
53
- global: "global";
54
- eu: "eu";
55
- }>>;
56
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
57
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
58
- }, z.core.$strip>>], undefined>;
59
- declare const listParseSettings: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
60
- result: z.ZodArray<z.ZodObject<{
61
- url: z.ZodOptional<z.ZodString>;
62
- hostname: z.ZodString;
63
- spam_check: z.ZodOptional<z.ZodBoolean>;
64
- send_raw: z.ZodOptional<z.ZodBoolean>;
65
- }, z.core.$catchall<z.ZodUnknown>>>;
66
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
67
- SENDGRID_API_KEY: z.ZodString;
68
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
69
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
70
- global: "global";
71
- eu: "eu";
72
- }>>;
73
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
74
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
75
- }, z.core.$strip>>], undefined>;
76
- declare const getParseSetting: _keystrokehq_core0.Operation<z.ZodObject<{
77
- hostname: z.ZodString;
78
- }, z.core.$strip>, z.ZodObject<{
79
- url: z.ZodOptional<z.ZodString>;
80
- hostname: z.ZodString;
81
- spam_check: z.ZodOptional<z.ZodBoolean>;
82
- send_raw: z.ZodOptional<z.ZodBoolean>;
83
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke: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>>], undefined>;
93
- declare const getParseStats: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{
94
- startDate: z.ZodOptional<z.ZodISODate>;
95
- endDate: z.ZodOptional<z.ZodISODate>;
96
- aggregatedBy: z.ZodOptional<z.ZodEnum<{
97
- day: "day";
98
- week: "week";
99
- month: "month";
100
- }>>;
101
- limit: z.ZodOptional<z.ZodNumber>;
102
- offset: z.ZodOptional<z.ZodNumber>;
103
- }, z.core.$strip>>, z.ZodArray<z.ZodObject<{
104
- date: z.ZodString;
105
- stats: z.ZodArray<z.ZodUnknown>;
106
- }, z.core.$catchall<z.ZodUnknown>>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
107
- SENDGRID_API_KEY: z.ZodString;
108
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
109
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
110
- global: "global";
111
- eu: "eu";
112
- }>>;
113
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
114
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
115
- }, z.core.$strip>>], undefined>;
116
- //#endregion
117
- export { createParseSetting, deleteParseSetting, getParseSetting, getParseStats, listParseSettings, updateParseSetting };