@keystrokehq/sendgrid 0.0.9 → 0.0.16-integration-id-canonicalization.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +59 -111
  2. package/dist/credential-sets/index.d.mts +2 -0
  3. package/dist/credential-sets/index.mjs +3 -0
  4. package/dist/index.d.mts +4 -1
  5. package/dist/index.mjs +5 -1
  6. package/dist/operations/index.d.mts +2 -0
  7. package/dist/operations/index.mjs +3 -0
  8. package/dist/schemas/index.d.mts +8 -8
  9. package/dist/schemas/index.mjs +1 -1
  10. package/dist/sendgrid.credential-set-CzYmlJ2Y.mjs +25 -0
  11. package/dist/sendgrid.credential-set-ivRIiUDy.d.mts +32 -0
  12. package/dist/validate-email.operation-CCCDxLjH.mjs +4301 -0
  13. package/dist/validate-email.operation-DY4rCHFE.d.mts +5436 -0
  14. package/package.json +8 -96
  15. package/dist/_official/index.d.mts +0 -2
  16. package/dist/_official/index.mjs +0 -3
  17. package/dist/_runtime/index.d.mts +0 -2
  18. package/dist/_runtime/index.mjs +0 -3
  19. package/dist/alerts.d.mts +0 -193
  20. package/dist/alerts.mjs +0 -101
  21. package/dist/api-keys.d.mts +0 -160
  22. package/dist/api-keys.mjs +0 -113
  23. package/dist/client.d.mts +0 -73
  24. package/dist/client.mjs +0 -260
  25. package/dist/connection.d.mts +0 -2
  26. package/dist/connection.mjs +0 -3
  27. package/dist/domains.d.mts +0 -114
  28. package/dist/domains.mjs +0 -62
  29. package/dist/email-validation.d.mts +0 -134
  30. package/dist/email-validation.mjs +0 -73
  31. package/dist/events.d.mts +0 -69
  32. package/dist/events.mjs +0 -28
  33. package/dist/factory-CToXR1jp.mjs +0 -24
  34. package/dist/integration-C9EALG65.mjs +0 -113
  35. package/dist/integration-zx-jmybs.d.mts +0 -56
  36. package/dist/mail-send.d.mts +0 -315
  37. package/dist/mail-send.mjs +0 -218
  38. package/dist/marketing-contacts.d.mts +0 -607
  39. package/dist/marketing-contacts.mjs +0 -277
  40. package/dist/marketing-customfields.d.mts +0 -94
  41. package/dist/marketing-customfields.mjs +0 -70
  42. package/dist/marketing-lists.d.mts +0 -184
  43. package/dist/marketing-lists.mjs +0 -130
  44. package/dist/marketing-segments.d.mts +0 -340
  45. package/dist/marketing-segments.mjs +0 -179
  46. package/dist/marketing-singlesends.d.mts +0 -648
  47. package/dist/marketing-singlesends.mjs +0 -277
  48. package/dist/operations.d.mts +0 -25
  49. package/dist/operations.mjs +0 -69
  50. package/dist/sender-identities.d.mts +0 -218
  51. package/dist/sender-identities.mjs +0 -109
  52. package/dist/senders.d.mts +0 -227
  53. package/dist/senders.mjs +0 -83
  54. package/dist/shared-BayZ0Lt6.mjs +0 -46
  55. package/dist/stats.d.mts +0 -215
  56. package/dist/stats.mjs +0 -107
  57. package/dist/suppressions.d.mts +0 -785
  58. package/dist/suppressions.mjs +0 -539
  59. package/dist/templates.d.mts +0 -451
  60. package/dist/templates.mjs +0 -238
  61. package/dist/user-account.d.mts +0 -108
  62. package/dist/user-account.mjs +0 -59
  63. package/dist/verification.d.mts +0 -67
  64. package/dist/verification.mjs +0 -72
  65. package/dist/webhooks/event.d.mts +0 -287
  66. package/dist/webhooks/event.mjs +0 -147
  67. package/dist/webhooks/parse.d.mts +0 -172
  68. package/dist/webhooks/parse.mjs +0 -125
  69. /package/dist/{webhooks-CKdsIikb.mjs → webhooks-dVOd93Hd.mjs} +0 -0
package/dist/api-keys.mjs DELETED
@@ -1,113 +0,0 @@
1
- import { n as __exportAll, t as sendgridOperation } from "./factory-CToXR1jp.mjs";
2
- import { n as omitUndefined } from "./shared-BayZ0Lt6.mjs";
3
- import { createSendGridClient } from "./client.mjs";
4
- import { Qt as sendgridApiKeyWithKeySchema, Xt as sendgridApiKeySchema, Yt as sendgridApiKeyListSchema, on as sendgridIdSchema } from "./webhooks-CKdsIikb.mjs";
5
- import { z } from "zod";
6
-
7
- //#region src/api-keys.ts
8
- var api_keys_exports = /* @__PURE__ */ __exportAll({
9
- createApiKey: () => createApiKey,
10
- deleteApiKey: () => deleteApiKey,
11
- getApiKey: () => getApiKey,
12
- listApiKeys: () => listApiKeys,
13
- updateApiKeyName: () => updateApiKeyName,
14
- updateApiKeyNameAndScopes: () => updateApiKeyNameAndScopes
15
- });
16
- const createApiKey = sendgridOperation({
17
- id: "sendgrid.create-api-key",
18
- name: "Create API Key",
19
- description: "Create a new SendGrid API key. Returns the full key value only at creation time — store it safely.",
20
- input: z.object({
21
- name: z.string().min(1),
22
- scopes: z.array(z.string()).optional()
23
- }),
24
- output: sendgridApiKeyWithKeySchema,
25
- needsApproval: true,
26
- run: async (input, credentials) => {
27
- const response = await createSendGridClient(credentials).request("/api_keys", {
28
- method: "POST",
29
- body: omitUndefined({
30
- name: input.name,
31
- scopes: input.scopes
32
- })
33
- });
34
- return sendgridApiKeyWithKeySchema.parse(response);
35
- }
36
- });
37
- const listApiKeys = sendgridOperation({
38
- id: "sendgrid.list-api-keys",
39
- name: "List API Keys",
40
- description: "List all API keys on the account (values are not returned).",
41
- input: z.object({}).optional(),
42
- output: sendgridApiKeyListSchema,
43
- run: async (_input, credentials) => {
44
- const response = await createSendGridClient(credentials).request("/api_keys");
45
- return sendgridApiKeyListSchema.parse(response ?? { result: [] });
46
- }
47
- });
48
- const getApiKey = sendgridOperation({
49
- id: "sendgrid.get-api-key",
50
- name: "Get API Key",
51
- description: "Retrieve an API key record by ID (the secret value is never returned).",
52
- input: z.object({ apiKeyId: sendgridIdSchema }),
53
- output: sendgridApiKeySchema,
54
- run: async (input, credentials) => {
55
- const response = await createSendGridClient(credentials).request(`/api_keys/${encodeURIComponent(input.apiKeyId)}`);
56
- return sendgridApiKeySchema.parse(response);
57
- }
58
- });
59
- const updateApiKeyName = sendgridOperation({
60
- id: "sendgrid.update-api-key-name",
61
- name: "Update API Key Name",
62
- description: "Rename an API key without changing its scopes.",
63
- input: z.object({
64
- apiKeyId: sendgridIdSchema,
65
- name: z.string().min(1)
66
- }),
67
- output: sendgridApiKeySchema,
68
- needsApproval: true,
69
- run: async (input, credentials) => {
70
- const response = await createSendGridClient(credentials).request(`/api_keys/${encodeURIComponent(input.apiKeyId)}`, {
71
- method: "PATCH",
72
- body: { name: input.name }
73
- });
74
- return sendgridApiKeySchema.parse(response);
75
- }
76
- });
77
- const updateApiKeyNameAndScopes = sendgridOperation({
78
- id: "sendgrid.update-api-key-name-and-scopes",
79
- name: "Update API Key Name and Scopes",
80
- description: "Update an API key by replacing the full set of scopes.",
81
- input: z.object({
82
- apiKeyId: sendgridIdSchema,
83
- name: z.string().min(1),
84
- scopes: z.array(z.string()).min(1)
85
- }),
86
- output: sendgridApiKeySchema,
87
- needsApproval: true,
88
- run: async (input, credentials) => {
89
- const response = await createSendGridClient(credentials).request(`/api_keys/${encodeURIComponent(input.apiKeyId)}`, {
90
- method: "PUT",
91
- body: {
92
- name: input.name,
93
- scopes: input.scopes
94
- }
95
- });
96
- return sendgridApiKeySchema.parse(response);
97
- }
98
- });
99
- const deleteApiKey = sendgridOperation({
100
- id: "sendgrid.delete-api-key",
101
- name: "Delete API Key",
102
- description: "Delete (revoke) an API key.",
103
- input: z.object({ apiKeyId: sendgridIdSchema }),
104
- output: z.object({ success: z.boolean() }),
105
- needsApproval: true,
106
- run: async (input, credentials) => {
107
- await createSendGridClient(credentials).request(`/api_keys/${encodeURIComponent(input.apiKeyId)}`, { method: "DELETE" });
108
- return { success: true };
109
- }
110
- });
111
-
112
- //#endregion
113
- export { createApiKey, deleteApiKey, getApiKey, listApiKeys, api_keys_exports as t, updateApiKeyName, updateApiKeyNameAndScopes };
package/dist/client.d.mts DELETED
@@ -1,73 +0,0 @@
1
- import { t as SendGridCredentials } from "./integration-zx-jmybs.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,260 +0,0 @@
1
- import { t as sendgrid } from "./integration-C9EALG65.mjs";
2
- import { i as createErrorNormalizingProxy, r as stringIfPresent, t as asRecord } from "./shared-BayZ0Lt6.mjs";
3
- import { CredentialRevokedError } from "@keystrokehq/core/errors";
4
-
5
- //#region src/client.ts
6
- const SENDGRID_GLOBAL_BASE = "https://api.sendgrid.com/v3";
7
- const SENDGRID_EU_BASE = "https://api.eu.sendgrid.com/v3";
8
- 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`.";
9
- var SendGridError = class extends Error {
10
- kind;
11
- status;
12
- body;
13
- providerErrors;
14
- requestId;
15
- retryable;
16
- constructor(init) {
17
- super(init.message);
18
- this.name = "SendGridError";
19
- this.kind = init.kind;
20
- this.status = init.status;
21
- this.body = init.body;
22
- this.providerErrors = init.providerErrors;
23
- this.requestId = init.requestId;
24
- this.retryable = init.retryable;
25
- }
26
- };
27
- function isSendGridError(value) {
28
- return value instanceof SendGridError;
29
- }
30
- function parseProviderErrors(body) {
31
- const errors = asRecord(body).errors;
32
- if (!Array.isArray(errors)) return [];
33
- return errors.map((entry) => {
34
- const rec = asRecord(entry);
35
- const message = stringIfPresent(rec.message);
36
- if (!message) return null;
37
- const field = stringIfPresent(rec.field);
38
- const errorId = stringIfPresent(rec.error_id);
39
- const help = stringIfPresent(rec.help);
40
- return {
41
- message,
42
- ...field !== void 0 ? { field } : {},
43
- ...errorId !== void 0 ? { errorId } : {},
44
- ...help !== void 0 ? { help } : {}
45
- };
46
- }).filter((entry) => entry !== null);
47
- }
48
- function classifyStatus(status) {
49
- if (status === 401) return {
50
- kind: "auth",
51
- retryable: false
52
- };
53
- if (status === 403) return {
54
- kind: "forbidden",
55
- retryable: false
56
- };
57
- if (status === 404) return {
58
- kind: "not_found",
59
- retryable: false
60
- };
61
- if (status === 429) return {
62
- kind: "rate_limit",
63
- retryable: true
64
- };
65
- if (status >= 500) return {
66
- kind: "server",
67
- retryable: true
68
- };
69
- if (status >= 400) return {
70
- kind: "validation",
71
- retryable: false
72
- };
73
- return {
74
- kind: "server",
75
- retryable: true
76
- };
77
- }
78
- function joinErrorMessages(status, providerErrors) {
79
- if (providerErrors.length === 0) return `HTTP ${status}`;
80
- return providerErrors.map((entry) => entry.message).join("; ");
81
- }
82
- function isAuthFlavoredError(error) {
83
- if (!isSendGridError(error)) return false;
84
- if (error.kind === "auth") return true;
85
- 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"));
86
- return false;
87
- }
88
- function normalizeSendGridError(error, context) {
89
- 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}`);
90
- if (isSendGridError(error)) return new Error(`SendGrid API call failed while calling \`${context.methodPath}\` (${error.status} ${error.kind}): ${error.message}`, { cause: error });
91
- if (error instanceof Error) return new Error(`SendGrid API call failed while calling \`${context.methodPath}\`: ${error.message}`, { cause: error });
92
- return /* @__PURE__ */ new Error(`SendGrid API call failed while calling \`${context.methodPath}\`.`);
93
- }
94
- function resolveBaseUrl(region) {
95
- return region === "eu" ? SENDGRID_EU_BASE : SENDGRID_GLOBAL_BASE;
96
- }
97
- function appendQuery(searchParams, query) {
98
- if (!query) return;
99
- for (const [key, value] of Object.entries(query)) {
100
- if (value === void 0 || value === null) continue;
101
- if (Array.isArray(value)) {
102
- if (value.length === 0) continue;
103
- searchParams.set(key, value.map(String).join(","));
104
- continue;
105
- }
106
- searchParams.set(key, String(value));
107
- }
108
- }
109
- function parseRetryAfterMs(header) {
110
- if (!header) return void 0;
111
- const seconds = Number(header);
112
- if (Number.isFinite(seconds) && seconds >= 0) return Math.ceil(seconds * 1e3);
113
- const whenMs = Date.parse(header);
114
- if (Number.isFinite(whenMs)) return Math.max(0, whenMs - Date.now());
115
- }
116
- async function sleep(ms) {
117
- await new Promise((resolve) => {
118
- setTimeout(resolve, ms);
119
- });
120
- }
121
- function computeBackoffMs(attempt, retryAfterMs) {
122
- if (retryAfterMs !== void 0) return retryAfterMs;
123
- return 500 * 2 ** Math.min(attempt, 5) + Math.random() * 250;
124
- }
125
- async function parseResponseBody(response) {
126
- if (response.status === 204 || response.status === 205) return {
127
- body: void 0,
128
- text: ""
129
- };
130
- const contentType = response.headers.get("content-type") ?? "";
131
- const text = await response.text();
132
- if (text.length === 0) return {
133
- body: void 0,
134
- text
135
- };
136
- if (contentType.includes("application/json")) try {
137
- return {
138
- body: JSON.parse(text),
139
- text
140
- };
141
- } catch {
142
- return {
143
- body: text,
144
- text
145
- };
146
- }
147
- return {
148
- body: text,
149
- text
150
- };
151
- }
152
- function createSendGridApiClient(credentials, config) {
153
- const apiKey = credentials.SENDGRID_API_KEY.trim();
154
- if (apiKey.length === 0) throw new Error(`SendGrid authentication failed at client initialization. ${CONNECT_HINT}`);
155
- const baseUrl = resolveBaseUrl(credentials.SENDGRID_ACCOUNT_REGION ?? "global");
156
- const defaultSubuser = credentials.SENDGRID_SUBUSER;
157
- const maxRetries = config?.maxRetries ?? 3;
158
- const fetchImpl = config?.fetchImpl ?? fetch;
159
- async function request(path, options = {}) {
160
- const url = new URL(`${baseUrl}${path}`);
161
- appendQuery(url.searchParams, options.query);
162
- const headers = {
163
- Authorization: `Bearer ${apiKey}`,
164
- Accept: "application/json"
165
- };
166
- const subuser = options.onBehalfOf ?? defaultSubuser;
167
- if (subuser !== void 0 && subuser.length > 0) headers["on-behalf-of"] = subuser;
168
- let body;
169
- if (options.rawBody !== void 0) body = options.rawBody;
170
- else if (options.form !== void 0) {
171
- const params = new URLSearchParams();
172
- for (const [key, value] of Object.entries(options.form)) params.set(key, String(value));
173
- body = params.toString();
174
- headers["Content-Type"] = "application/x-www-form-urlencoded";
175
- } else if (options.body !== void 0) {
176
- body = JSON.stringify(options.body);
177
- headers["Content-Type"] = "application/json";
178
- }
179
- const method = options.method ?? "GET";
180
- const maxAttempts = options.noRetry ? 1 : Math.max(1, maxRetries + 1);
181
- let lastError;
182
- for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
183
- let response;
184
- try {
185
- response = await fetchImpl(url, {
186
- method,
187
- headers,
188
- ...body !== void 0 ? { body } : {}
189
- });
190
- } catch (cause) {
191
- const networkError = new SendGridError({
192
- kind: "network",
193
- status: 0,
194
- body: void 0,
195
- providerErrors: [],
196
- retryable: true,
197
- message: cause instanceof Error ? cause.message : "Network error calling SendGrid"
198
- });
199
- lastError = networkError;
200
- if (attempt + 1 >= maxAttempts) throw networkError;
201
- await sleep(computeBackoffMs(attempt));
202
- continue;
203
- }
204
- if (response.ok) return (await parseResponseBody(response)).body;
205
- const parsed = await parseResponseBody(response);
206
- const providerErrors = parseProviderErrors(parsed.body);
207
- const { kind, retryable } = classifyStatus(response.status);
208
- const requestId = response.headers.get("x-message-id") ?? response.headers.get("x-request-id") ?? void 0;
209
- const retryAfterMs = parseRetryAfterMs(response.headers.get("retry-after"));
210
- const err = new SendGridError({
211
- kind,
212
- status: response.status,
213
- body: parsed.body,
214
- providerErrors,
215
- ...requestId !== void 0 ? { requestId } : {},
216
- retryable,
217
- message: joinErrorMessages(response.status, providerErrors)
218
- });
219
- if (!retryable || attempt + 1 >= maxAttempts) throw err;
220
- lastError = err;
221
- await sleep(computeBackoffMs(attempt, retryAfterMs));
222
- }
223
- throw lastError ?? /* @__PURE__ */ new Error("SendGrid request exhausted retries without a response.");
224
- }
225
- return {
226
- request,
227
- credentials,
228
- baseUrl
229
- };
230
- }
231
- function createSendGridClient(credentials, config) {
232
- return createErrorNormalizingProxy(createSendGridApiClient(credentials, config), normalizeSendGridError);
233
- }
234
- /**
235
- * Iterate a paginated SendGrid endpoint, yielding individual items.
236
- *
237
- * Implemented as a standalone function rather than a client method because
238
- * the client is wrapped in an error-normalizing `Proxy` which does not play
239
- * well with async iterators returned from method calls.
240
- */
241
- async function* paginateSendGrid(client, path, options = {}) {
242
- const itemsKey = options.itemsKey ?? "result";
243
- let nextPath = path;
244
- let nextQuery = options.query;
245
- while (nextPath !== void 0) {
246
- const record = asRecord(await client.request(nextPath, { query: nextQuery }));
247
- const items = record[itemsKey];
248
- if (Array.isArray(items)) for (const item of items) yield item;
249
- const nextUrl = stringIfPresent(asRecord(record._metadata).next);
250
- if (!nextUrl) nextPath = void 0;
251
- else {
252
- const parsed = new URL(nextUrl);
253
- nextPath = `${parsed.pathname.replace(/^\/v3/u, "")}${parsed.search}`;
254
- nextQuery = void 0;
255
- }
256
- }
257
- }
258
-
259
- //#endregion
260
- export { SendGridError, createSendGridClient, isSendGridError, paginateSendGrid };
@@ -1,2 +0,0 @@
1
- import { i as sendgridOfficialIntegration, n as sendgrid, t as SendGridCredentials } from "./integration-zx-jmybs.mjs";
2
- export { type SendGridCredentials, sendgrid, sendgridOfficialIntegration };
@@ -1,3 +0,0 @@
1
- import { r as sendgridOfficialIntegration, t as sendgrid } from "./integration-C9EALG65.mjs";
2
-
3
- export { sendgrid, sendgridOfficialIntegration };
@@ -1,114 +0,0 @@
1
- import * as _keystrokehq_core0 from "@keystrokehq/core";
2
- import { z } from "zod";
3
- import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
-
5
- //#region src/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 };
package/dist/domains.mjs DELETED
@@ -1,62 +0,0 @@
1
- import { n as __exportAll, t as sendgridOperation } from "./factory-CToXR1jp.mjs";
2
- import { n as omitUndefined } from "./shared-BayZ0Lt6.mjs";
3
- import { createSendGridClient } from "./client.mjs";
4
- import { At as 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 };