@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
package/dist/client.d.mts DELETED
@@ -1,73 +0,0 @@
1
- import { t as SendGridCredentials } from "./integration-Cj4Xzfq_.mjs";
2
-
3
- //#region src/client.d.ts
4
- type Primitive = string | number | boolean;
5
- type QueryValue = Primitive | readonly Primitive[] | undefined | null;
6
- type SendGridHttpMethod = 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT';
7
- interface SendGridRequestOptions {
8
- readonly body?: unknown;
9
- readonly method?: SendGridHttpMethod;
10
- readonly query?: Record<string, QueryValue>;
11
- /** Override `on-behalf-of` for a single request (rare; defaults to credential subuser). */
12
- readonly onBehalfOf?: string;
13
- /** Send as `application/x-www-form-urlencoded` instead of JSON. */
14
- readonly form?: Record<string, Primitive>;
15
- /** Raw text body (e.g. CSV upload via PUT presigned URL responses). */
16
- readonly rawBody?: string;
17
- /** Disable retry for this call (e.g. idempotent-write guards). */
18
- readonly noRetry?: boolean;
19
- }
20
- type SendGridErrorKind = 'auth' | 'forbidden' | 'not_found' | 'rate_limit' | 'server' | 'validation' | 'network';
21
- interface SendGridProviderError {
22
- readonly message: string;
23
- readonly field?: string;
24
- readonly errorId?: string;
25
- readonly help?: string;
26
- }
27
- declare class SendGridError extends Error {
28
- readonly kind: SendGridErrorKind;
29
- readonly status: number;
30
- readonly body: unknown;
31
- readonly providerErrors: readonly SendGridProviderError[];
32
- readonly requestId: string | undefined;
33
- readonly retryable: boolean;
34
- constructor(init: {
35
- kind: SendGridErrorKind;
36
- status: number;
37
- body: unknown;
38
- providerErrors: readonly SendGridProviderError[];
39
- requestId?: string;
40
- retryable: boolean;
41
- message: string;
42
- });
43
- }
44
- declare function isSendGridError(value: unknown): value is SendGridError;
45
- interface SendGridClientConfig {
46
- readonly maxRetries?: number;
47
- readonly fetchImpl?: typeof fetch;
48
- }
49
- declare function createSendGridClient(credentials: SendGridCredentials, config?: SendGridClientConfig): {
50
- request: <T>(path: string, options?: SendGridRequestOptions) => Promise<T>;
51
- credentials: {
52
- SENDGRID_API_KEY: string;
53
- SENDGRID_ACCOUNT_REGION: "global" | "eu";
54
- SENDGRID_SUBUSER?: string | undefined;
55
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY?: string | undefined;
56
- SENDGRID_INBOUND_PARSE_TOKEN?: string | undefined;
57
- };
58
- baseUrl: string;
59
- };
60
- type SendGridClient = ReturnType<typeof createSendGridClient>;
61
- /**
62
- * Iterate a paginated SendGrid endpoint, yielding individual items.
63
- *
64
- * Implemented as a standalone function rather than a client method because
65
- * the client is wrapped in an error-normalizing `Proxy` which does not play
66
- * well with async iterators returned from method calls.
67
- */
68
- declare function paginateSendGrid<TItem>(client: SendGridClient, path: string, options?: {
69
- readonly query?: Record<string, QueryValue>;
70
- readonly itemsKey?: string;
71
- }): AsyncIterableIterator<TItem>;
72
- //#endregion
73
- export { SendGridClient, SendGridClientConfig, SendGridError, SendGridErrorKind, SendGridHttpMethod, SendGridProviderError, SendGridRequestOptions, createSendGridClient, isSendGridError, paginateSendGrid };
package/dist/client.mjs DELETED
@@ -1,261 +0,0 @@
1
- import { t as sendgrid } from "./integration-DHWfpe0w.mjs";
2
- import { r as stringIfPresent, t as asRecord } from "./shared-CQ8JFNXi.mjs";
3
- import { CredentialRevokedError } from "@keystrokehq/core/errors";
4
- import { createErrorNormalizingProxy } from "@keystrokehq/integration-authoring";
5
-
6
- //#region src/client.ts
7
- const SENDGRID_GLOBAL_BASE = "https://api.sendgrid.com/v3";
8
- const SENDGRID_EU_BASE = "https://api.eu.sendgrid.com/v3";
9
- const CONNECT_HINT = "If you haven't connected SendGrid yet, create an API key in the SendGrid console and save it as `SENDGRID_API_KEY`.";
10
- var SendGridError = class extends Error {
11
- kind;
12
- status;
13
- body;
14
- providerErrors;
15
- requestId;
16
- retryable;
17
- constructor(init) {
18
- super(init.message);
19
- this.name = "SendGridError";
20
- this.kind = init.kind;
21
- this.status = init.status;
22
- this.body = init.body;
23
- this.providerErrors = init.providerErrors;
24
- this.requestId = init.requestId;
25
- this.retryable = init.retryable;
26
- }
27
- };
28
- function isSendGridError(value) {
29
- return value instanceof SendGridError;
30
- }
31
- function parseProviderErrors(body) {
32
- const errors = asRecord(body).errors;
33
- if (!Array.isArray(errors)) return [];
34
- return errors.map((entry) => {
35
- const rec = asRecord(entry);
36
- const message = stringIfPresent(rec.message);
37
- if (!message) return null;
38
- const field = stringIfPresent(rec.field);
39
- const errorId = stringIfPresent(rec.error_id);
40
- const help = stringIfPresent(rec.help);
41
- return {
42
- message,
43
- ...field !== void 0 ? { field } : {},
44
- ...errorId !== void 0 ? { errorId } : {},
45
- ...help !== void 0 ? { help } : {}
46
- };
47
- }).filter((entry) => entry !== null);
48
- }
49
- function classifyStatus(status) {
50
- if (status === 401) return {
51
- kind: "auth",
52
- retryable: false
53
- };
54
- if (status === 403) return {
55
- kind: "forbidden",
56
- retryable: false
57
- };
58
- if (status === 404) return {
59
- kind: "not_found",
60
- retryable: false
61
- };
62
- if (status === 429) return {
63
- kind: "rate_limit",
64
- retryable: true
65
- };
66
- if (status >= 500) return {
67
- kind: "server",
68
- retryable: true
69
- };
70
- if (status >= 400) return {
71
- kind: "validation",
72
- retryable: false
73
- };
74
- return {
75
- kind: "server",
76
- retryable: true
77
- };
78
- }
79
- function joinErrorMessages(status, providerErrors) {
80
- if (providerErrors.length === 0) return `HTTP ${status}`;
81
- return providerErrors.map((entry) => entry.message).join("; ");
82
- }
83
- function isAuthFlavoredError(error) {
84
- if (!isSendGridError(error)) return false;
85
- if (error.kind === "auth") return true;
86
- if (error.kind === "forbidden") return error.providerErrors.map((entry) => entry.message.toLowerCase()).some((msg) => msg.includes("invalid api key") || msg.includes("authorization") || msg.includes("authentication"));
87
- return false;
88
- }
89
- function normalizeSendGridError(error, context) {
90
- if (isAuthFlavoredError(error)) return new CredentialRevokedError(sendgrid.id, `SendGrid authentication failed while calling \`${context.methodPath}\`. The stored credentials for ${sendgrid.id} may be revoked or missing required scopes. ${CONNECT_HINT}`);
91
- if (isSendGridError(error)) return new Error(`SendGrid API call failed while calling \`${context.methodPath}\` (${error.status} ${error.kind}): ${error.message}`, { cause: error });
92
- if (error instanceof Error) return new Error(`SendGrid API call failed while calling \`${context.methodPath}\`: ${error.message}`, { cause: error });
93
- return /* @__PURE__ */ new Error(`SendGrid API call failed while calling \`${context.methodPath}\`.`);
94
- }
95
- function resolveBaseUrl(region) {
96
- return region === "eu" ? SENDGRID_EU_BASE : SENDGRID_GLOBAL_BASE;
97
- }
98
- function appendQuery(searchParams, query) {
99
- if (!query) return;
100
- for (const [key, value] of Object.entries(query)) {
101
- if (value === void 0 || value === null) continue;
102
- if (Array.isArray(value)) {
103
- if (value.length === 0) continue;
104
- searchParams.set(key, value.map(String).join(","));
105
- continue;
106
- }
107
- searchParams.set(key, String(value));
108
- }
109
- }
110
- function parseRetryAfterMs(header) {
111
- if (!header) return void 0;
112
- const seconds = Number(header);
113
- if (Number.isFinite(seconds) && seconds >= 0) return Math.ceil(seconds * 1e3);
114
- const whenMs = Date.parse(header);
115
- if (Number.isFinite(whenMs)) return Math.max(0, whenMs - Date.now());
116
- }
117
- async function sleep(ms) {
118
- await new Promise((resolve) => {
119
- setTimeout(resolve, ms);
120
- });
121
- }
122
- function computeBackoffMs(attempt, retryAfterMs) {
123
- if (retryAfterMs !== void 0) return retryAfterMs;
124
- return 500 * 2 ** Math.min(attempt, 5) + Math.random() * 250;
125
- }
126
- async function parseResponseBody(response) {
127
- if (response.status === 204 || response.status === 205) return {
128
- body: void 0,
129
- text: ""
130
- };
131
- const contentType = response.headers.get("content-type") ?? "";
132
- const text = await response.text();
133
- if (text.length === 0) return {
134
- body: void 0,
135
- text
136
- };
137
- if (contentType.includes("application/json")) try {
138
- return {
139
- body: JSON.parse(text),
140
- text
141
- };
142
- } catch {
143
- return {
144
- body: text,
145
- text
146
- };
147
- }
148
- return {
149
- body: text,
150
- text
151
- };
152
- }
153
- function createSendGridApiClient(credentials, config) {
154
- const apiKey = credentials.SENDGRID_API_KEY.trim();
155
- if (apiKey.length === 0) throw new Error(`SendGrid authentication failed at client initialization. ${CONNECT_HINT}`);
156
- const baseUrl = resolveBaseUrl(credentials.SENDGRID_ACCOUNT_REGION ?? "global");
157
- const defaultSubuser = credentials.SENDGRID_SUBUSER;
158
- const maxRetries = config?.maxRetries ?? 3;
159
- const fetchImpl = config?.fetchImpl ?? fetch;
160
- async function request(path, options = {}) {
161
- const url = new URL(`${baseUrl}${path}`);
162
- appendQuery(url.searchParams, options.query);
163
- const headers = {
164
- Authorization: `Bearer ${apiKey}`,
165
- Accept: "application/json"
166
- };
167
- const subuser = options.onBehalfOf ?? defaultSubuser;
168
- if (subuser !== void 0 && subuser.length > 0) headers["on-behalf-of"] = subuser;
169
- let body;
170
- if (options.rawBody !== void 0) body = options.rawBody;
171
- else if (options.form !== void 0) {
172
- const params = new URLSearchParams();
173
- for (const [key, value] of Object.entries(options.form)) params.set(key, String(value));
174
- body = params.toString();
175
- headers["Content-Type"] = "application/x-www-form-urlencoded";
176
- } else if (options.body !== void 0) {
177
- body = JSON.stringify(options.body);
178
- headers["Content-Type"] = "application/json";
179
- }
180
- const method = options.method ?? "GET";
181
- const maxAttempts = options.noRetry ? 1 : Math.max(1, maxRetries + 1);
182
- let lastError;
183
- for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
184
- let response;
185
- try {
186
- response = await fetchImpl(url, {
187
- method,
188
- headers,
189
- ...body !== void 0 ? { body } : {}
190
- });
191
- } catch (cause) {
192
- const networkError = new SendGridError({
193
- kind: "network",
194
- status: 0,
195
- body: void 0,
196
- providerErrors: [],
197
- retryable: true,
198
- message: cause instanceof Error ? cause.message : "Network error calling SendGrid"
199
- });
200
- lastError = networkError;
201
- if (attempt + 1 >= maxAttempts) throw networkError;
202
- await sleep(computeBackoffMs(attempt));
203
- continue;
204
- }
205
- if (response.ok) return (await parseResponseBody(response)).body;
206
- const parsed = await parseResponseBody(response);
207
- const providerErrors = parseProviderErrors(parsed.body);
208
- const { kind, retryable } = classifyStatus(response.status);
209
- const requestId = response.headers.get("x-message-id") ?? response.headers.get("x-request-id") ?? void 0;
210
- const retryAfterMs = parseRetryAfterMs(response.headers.get("retry-after"));
211
- const err = new SendGridError({
212
- kind,
213
- status: response.status,
214
- body: parsed.body,
215
- providerErrors,
216
- ...requestId !== void 0 ? { requestId } : {},
217
- retryable,
218
- message: joinErrorMessages(response.status, providerErrors)
219
- });
220
- if (!retryable || attempt + 1 >= maxAttempts) throw err;
221
- lastError = err;
222
- await sleep(computeBackoffMs(attempt, retryAfterMs));
223
- }
224
- throw lastError ?? /* @__PURE__ */ new Error("SendGrid request exhausted retries without a response.");
225
- }
226
- return {
227
- request,
228
- credentials,
229
- baseUrl
230
- };
231
- }
232
- function createSendGridClient(credentials, config) {
233
- return createErrorNormalizingProxy(createSendGridApiClient(credentials, config), normalizeSendGridError);
234
- }
235
- /**
236
- * Iterate a paginated SendGrid endpoint, yielding individual items.
237
- *
238
- * Implemented as a standalone function rather than a client method because
239
- * the client is wrapped in an error-normalizing `Proxy` which does not play
240
- * well with async iterators returned from method calls.
241
- */
242
- async function* paginateSendGrid(client, path, options = {}) {
243
- const itemsKey = options.itemsKey ?? "result";
244
- let nextPath = path;
245
- let nextQuery = options.query;
246
- while (nextPath !== void 0) {
247
- const record = asRecord(await client.request(nextPath, { query: nextQuery }));
248
- const items = record[itemsKey];
249
- if (Array.isArray(items)) for (const item of items) yield item;
250
- const nextUrl = stringIfPresent(asRecord(record._metadata).next);
251
- if (!nextUrl) nextPath = void 0;
252
- else {
253
- const parsed = new URL(nextUrl);
254
- nextPath = `${parsed.pathname.replace(/^\/v3/u, "")}${parsed.search}`;
255
- nextQuery = void 0;
256
- }
257
- }
258
- }
259
-
260
- //#endregion
261
- export { SendGridError, createSendGridClient, isSendGridError, paginateSendGrid };
@@ -1,2 +0,0 @@
1
- import { i as sendgridOfficialIntegration, n as sendgrid, t as SendGridCredentials } from "./integration-Cj4Xzfq_.mjs";
2
- export { type SendGridCredentials, sendgrid, sendgridOfficialIntegration };
@@ -1,3 +0,0 @@
1
- import { r as sendgridOfficialIntegration, t as sendgrid } from "./integration-DHWfpe0w.mjs";
2
-
3
- export { sendgrid, sendgridOfficialIntegration };
@@ -1,86 +0,0 @@
1
- import { z } from "zod";
2
- import * as _keystrokehq_core0 from "@keystrokehq/core";
3
-
4
- //#region src/domains.d.ts
5
- declare const listAuthenticatedDomains: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{
6
- limit: z.ZodOptional<z.ZodNumber>;
7
- offset: z.ZodOptional<z.ZodNumber>;
8
- excludeSubusers: z.ZodOptional<z.ZodBoolean>;
9
- username: z.ZodOptional<z.ZodString>;
10
- domain: z.ZodOptional<z.ZodString>;
11
- }, z.core.$strip>>, z.ZodArray<z.ZodObject<{
12
- id: z.ZodNumber;
13
- user_id: z.ZodOptional<z.ZodNumber>;
14
- subdomain: z.ZodOptional<z.ZodString>;
15
- domain: z.ZodString;
16
- username: z.ZodOptional<z.ZodString>;
17
- ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
18
- custom_spf: z.ZodOptional<z.ZodBoolean>;
19
- default: z.ZodOptional<z.ZodBoolean>;
20
- legacy: z.ZodOptional<z.ZodBoolean>;
21
- automatic_security: z.ZodOptional<z.ZodBoolean>;
22
- valid: z.ZodOptional<z.ZodBoolean>;
23
- dns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
24
- valid: z.ZodOptional<z.ZodBoolean>;
25
- type: z.ZodOptional<z.ZodString>;
26
- host: z.ZodOptional<z.ZodString>;
27
- data: z.ZodOptional<z.ZodString>;
28
- }, z.core.$catchall<z.ZodUnknown>>>>;
29
- }, z.core.$catchall<z.ZodUnknown>>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
30
- SENDGRID_API_KEY: z.ZodString;
31
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
32
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
33
- global: "global";
34
- eu: "eu";
35
- }>>;
36
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
37
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
38
- }, z.core.$strip>>], undefined>;
39
- declare const getAuthenticatedDomain: _keystrokehq_core0.Operation<z.ZodObject<{
40
- domainId: z.ZodNumber;
41
- }, z.core.$strip>, z.ZodObject<{
42
- id: z.ZodNumber;
43
- user_id: z.ZodOptional<z.ZodNumber>;
44
- subdomain: z.ZodOptional<z.ZodString>;
45
- domain: z.ZodString;
46
- username: z.ZodOptional<z.ZodString>;
47
- ips: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
- custom_spf: z.ZodOptional<z.ZodBoolean>;
49
- default: z.ZodOptional<z.ZodBoolean>;
50
- legacy: z.ZodOptional<z.ZodBoolean>;
51
- automatic_security: z.ZodOptional<z.ZodBoolean>;
52
- valid: z.ZodOptional<z.ZodBoolean>;
53
- dns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
54
- valid: z.ZodOptional<z.ZodBoolean>;
55
- type: z.ZodOptional<z.ZodString>;
56
- host: z.ZodOptional<z.ZodString>;
57
- data: z.ZodOptional<z.ZodString>;
58
- }, z.core.$catchall<z.ZodUnknown>>>>;
59
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
60
- SENDGRID_API_KEY: z.ZodString;
61
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
62
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
63
- global: "global";
64
- eu: "eu";
65
- }>>;
66
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
67
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
68
- }, z.core.$strip>>], undefined>;
69
- declare const validateAuthenticatedDomain: _keystrokehq_core0.Operation<z.ZodObject<{
70
- domainId: z.ZodNumber;
71
- }, z.core.$strip>, z.ZodObject<{
72
- id: z.ZodNumber;
73
- valid: z.ZodBoolean;
74
- validation_results: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
75
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
76
- SENDGRID_API_KEY: z.ZodString;
77
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
78
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
79
- global: "global";
80
- eu: "eu";
81
- }>>;
82
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
83
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
84
- }, z.core.$strip>>], undefined>;
85
- //#endregion
86
- export { getAuthenticatedDomain, listAuthenticatedDomains, validateAuthenticatedDomain };
package/dist/domains.mjs DELETED
@@ -1,62 +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 { 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: "sendgrid.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: "sendgrid.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: "sendgrid.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 };
@@ -1,97 +0,0 @@
1
- import { z } from "zod";
2
- import * as _keystrokehq_core0 from "@keystrokehq/core";
3
-
4
- //#region src/email-validation.d.ts
5
- declare const validateEmail: _keystrokehq_core0.Operation<z.ZodObject<{
6
- email: z.ZodString;
7
- source: z.ZodOptional<z.ZodString>;
8
- }, z.core.$strip>, z.ZodObject<{
9
- result: z.ZodObject<{
10
- email: z.ZodString;
11
- verdict: z.ZodEnum<{
12
- Valid: "Valid";
13
- Risky: "Risky";
14
- Invalid: "Invalid";
15
- }>;
16
- score: z.ZodOptional<z.ZodNumber>;
17
- local: z.ZodOptional<z.ZodString>;
18
- host: z.ZodOptional<z.ZodString>;
19
- suggestion: z.ZodOptional<z.ZodString>;
20
- checks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
21
- source: z.ZodOptional<z.ZodString>;
22
- ip_address: z.ZodOptional<z.ZodString>;
23
- }, z.core.$catchall<z.ZodUnknown>>;
24
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
25
- SENDGRID_API_KEY: z.ZodString;
26
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
27
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
28
- global: "global";
29
- eu: "eu";
30
- }>>;
31
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
32
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
33
- }, z.core.$strip>>], undefined>;
34
- declare const listBulkEmailValidationJobs: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
35
- result: z.ZodArray<z.ZodObject<{
36
- id: z.ZodString;
37
- status: z.ZodString;
38
- segments: z.ZodOptional<z.ZodNumber>;
39
- results: z.ZodOptional<z.ZodUnknown>;
40
- started_at: z.ZodOptional<z.ZodString>;
41
- finished_at: z.ZodOptional<z.ZodString>;
42
- submitted_at: z.ZodOptional<z.ZodString>;
43
- }, z.core.$catchall<z.ZodUnknown>>>;
44
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
45
- SENDGRID_API_KEY: z.ZodString;
46
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
47
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
48
- global: "global";
49
- eu: "eu";
50
- }>>;
51
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
52
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
53
- }, z.core.$strip>>], undefined>;
54
- declare const getBulkEmailValidationJob: _keystrokehq_core0.Operation<z.ZodObject<{
55
- jobId: z.ZodString;
56
- }, z.core.$strip>, z.ZodObject<{
57
- id: z.ZodString;
58
- status: z.ZodString;
59
- segments: z.ZodOptional<z.ZodNumber>;
60
- results: z.ZodOptional<z.ZodUnknown>;
61
- started_at: z.ZodOptional<z.ZodString>;
62
- finished_at: z.ZodOptional<z.ZodString>;
63
- submitted_at: z.ZodOptional<z.ZodString>;
64
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:sendgrid", z.ZodObject<{
65
- SENDGRID_API_KEY: z.ZodString;
66
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
67
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
68
- global: "global";
69
- eu: "eu";
70
- }>>;
71
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
72
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
73
- }, z.core.$strip>>], undefined>;
74
- declare const createBulkEmailValidationPresignedUrl: _keystrokehq_core0.Operation<z.ZodObject<{
75
- fileType: z.ZodDefault<z.ZodEnum<{
76
- csv: "csv";
77
- zip: "zip";
78
- }>>;
79
- }, z.core.$strip>, z.ZodObject<{
80
- job_id: z.ZodString;
81
- upload_uri: z.ZodString;
82
- upload_headers: z.ZodArray<z.ZodObject<{
83
- header: z.ZodString;
84
- value: z.ZodString;
85
- }, z.core.$strip>>;
86
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke: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>>], undefined>;
96
- //#endregion
97
- export { createBulkEmailValidationPresignedUrl, getBulkEmailValidationJob, listBulkEmailValidationJobs, validateEmail };
@@ -1,73 +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 { 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: "sendgrid.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: "sendgrid.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: "sendgrid.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: "sendgrid.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 };