@keystrokehq/resend 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +184 -0
  2. package/dist/_official/index.d.mts +2 -0
  3. package/dist/_official/index.mjs +3 -0
  4. package/dist/_runtime/index.d.mts +1 -0
  5. package/dist/_runtime/index.mjs +1 -0
  6. package/dist/api-keys.d.mts +67 -0
  7. package/dist/api-keys.mjs +90 -0
  8. package/dist/broadcasts.d.mts +238 -0
  9. package/dist/broadcasts.mjs +178 -0
  10. package/dist/client.d.mts +27 -0
  11. package/dist/client.mjs +40 -0
  12. package/dist/connection.d.mts +2 -0
  13. package/dist/connection.mjs +3 -0
  14. package/dist/contact-properties.d.mts +139 -0
  15. package/dist/contact-properties.mjs +115 -0
  16. package/dist/contacts.d.mts +218 -0
  17. package/dist/contacts.mjs +225 -0
  18. package/dist/domains.d.mts +293 -0
  19. package/dist/domains.mjs +160 -0
  20. package/dist/emails-receiving.d.mts +177 -0
  21. package/dist/emails-receiving.mjs +114 -0
  22. package/dist/emails.d.mts +307 -0
  23. package/dist/emails.mjs +241 -0
  24. package/dist/events.d.mts +571 -0
  25. package/dist/events.mjs +178 -0
  26. package/dist/factory-B3VyPRsL.mjs +8 -0
  27. package/dist/index.d.mts +1 -0
  28. package/dist/index.mjs +1 -0
  29. package/dist/integration-BR1nTAnU.mjs +28 -0
  30. package/dist/integration-ClH0F7x-.d.mts +49 -0
  31. package/dist/logs.d.mts +71 -0
  32. package/dist/logs.mjs +61 -0
  33. package/dist/schemas.d.mts +77 -0
  34. package/dist/schemas.mjs +68 -0
  35. package/dist/segments.d.mts +112 -0
  36. package/dist/segments.mjs +120 -0
  37. package/dist/templates.d.mts +193 -0
  38. package/dist/templates.mjs +151 -0
  39. package/dist/topics.d.mts +125 -0
  40. package/dist/topics.mjs +113 -0
  41. package/dist/triggers.d.mts +68 -0
  42. package/dist/triggers.mjs +141 -0
  43. package/dist/verification.d.mts +49 -0
  44. package/dist/verification.mjs +139 -0
  45. package/dist/webhooks.d.mts +285 -0
  46. package/dist/webhooks.mjs +124 -0
  47. package/package.json +137 -0
@@ -0,0 +1,178 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/events.ts
4
+ /**
5
+ * resend/events.ts
6
+ *
7
+ * Event-name constants and payload schemas for Resend webhook events.
8
+ *
9
+ * Resend emits 17 events across three resource families — 11 email,
10
+ * 3 domain, 3 contact — all over a single Svix-signed webhook channel.
11
+ * See <https://resend.com/docs/dashboard/webhooks/event-types>.
12
+ *
13
+ * Webhook envelope shape:
14
+ *
15
+ * { type: 'email.delivered', created_at: '…', data: { email_id, from, … } }
16
+ *
17
+ * We keep `data` schemas liberal (`.passthrough()`) because Resend
18
+ * adds fields (e.g. `bounce.classification`, Apple MPP's
19
+ * `is_machine_opened`) without bumping versions. The `type`
20
+ * discriminator is strict.
21
+ */
22
+ const RESEND_EMAIL_EVENT_NAMES = [
23
+ "email.sent",
24
+ "email.delivered",
25
+ "email.delivery_delayed",
26
+ "email.bounced",
27
+ "email.complained",
28
+ "email.opened",
29
+ "email.clicked",
30
+ "email.failed",
31
+ "email.received",
32
+ "email.scheduled",
33
+ "email.suppressed"
34
+ ];
35
+ const RESEND_DOMAIN_EVENT_NAMES = [
36
+ "domain.created",
37
+ "domain.updated",
38
+ "domain.deleted"
39
+ ];
40
+ const RESEND_CONTACT_EVENT_NAMES = [
41
+ "contact.created",
42
+ "contact.updated",
43
+ "contact.deleted"
44
+ ];
45
+ const RESEND_WEBHOOK_EVENT_NAMES = [
46
+ ...RESEND_EMAIL_EVENT_NAMES,
47
+ ...RESEND_DOMAIN_EVENT_NAMES,
48
+ ...RESEND_CONTACT_EVENT_NAMES
49
+ ];
50
+ const attachmentMetadataSchema = z.object({
51
+ id: z.string().optional(),
52
+ filename: z.string().optional(),
53
+ content_type: z.string().optional(),
54
+ content_id: z.string().nullable().optional(),
55
+ content_disposition: z.string().nullable().optional()
56
+ }).passthrough();
57
+ const bounceDataSchema = z.object({
58
+ type: z.enum([
59
+ "hard",
60
+ "soft",
61
+ "block"
62
+ ]).or(z.string()).optional(),
63
+ classification: z.string().optional(),
64
+ message: z.string().optional()
65
+ }).passthrough();
66
+ const failureDataSchema = z.object({
67
+ reason: z.string().optional(),
68
+ code: z.union([z.string(), z.number()]).optional()
69
+ }).passthrough();
70
+ const clickDataSchema = z.object({
71
+ link: z.string().optional(),
72
+ user_agent: z.string().optional(),
73
+ ip: z.string().optional(),
74
+ clicked_at: z.string().optional()
75
+ }).passthrough();
76
+ const openDataSchema = z.object({
77
+ user_agent: z.string().optional(),
78
+ ip: z.string().optional(),
79
+ opened_at: z.string().optional(),
80
+ is_machine_opened: z.boolean().optional()
81
+ }).passthrough();
82
+ const emailBaseDataSchema = z.object({
83
+ email_id: z.string(),
84
+ from: z.string().optional(),
85
+ to: z.array(z.string()).optional(),
86
+ subject: z.string().optional(),
87
+ created_at: z.string().optional(),
88
+ tags: z.array(z.object({
89
+ name: z.string(),
90
+ value: z.string()
91
+ })).optional()
92
+ }).passthrough();
93
+ const emailDeliveredDataSchema = emailBaseDataSchema.extend({ delivered_at: z.string().optional() }).passthrough();
94
+ const emailBouncedDataSchema = emailBaseDataSchema.extend({ bounce: bounceDataSchema.optional() }).passthrough();
95
+ const emailFailedDataSchema = emailBaseDataSchema.extend({ failed: failureDataSchema.optional() }).passthrough();
96
+ const emailClickedDataSchema = emailBaseDataSchema.extend(clickDataSchema.shape).passthrough();
97
+ const emailOpenedDataSchema = emailBaseDataSchema.extend(openDataSchema.shape).passthrough();
98
+ const emailReceivedDataSchema = emailBaseDataSchema.extend({
99
+ message_id: z.string().optional(),
100
+ cc: z.array(z.string()).optional(),
101
+ bcc: z.array(z.string()).optional(),
102
+ reply_to: z.array(z.string()).optional(),
103
+ attachments: z.array(attachmentMetadataSchema).optional()
104
+ }).passthrough();
105
+ const emailScheduledDataSchema = emailBaseDataSchema.extend({ scheduled_at: z.string().optional() }).passthrough();
106
+ const emailSuppressedDataSchema = emailBaseDataSchema.extend({ reason: z.string().optional() }).passthrough();
107
+ const domainDataSchema = z.object({
108
+ id: z.string(),
109
+ name: z.string().optional(),
110
+ region: z.string().optional(),
111
+ status: z.string().optional(),
112
+ created_at: z.string().optional()
113
+ }).passthrough();
114
+ const contactDataSchema = z.object({
115
+ id: z.string(),
116
+ email: z.string().optional(),
117
+ first_name: z.string().nullable().optional(),
118
+ last_name: z.string().nullable().optional(),
119
+ unsubscribed: z.boolean().optional(),
120
+ created_at: z.string().optional(),
121
+ updated_at: z.string().optional()
122
+ }).passthrough();
123
+ function envelope(type, data) {
124
+ return z.object({
125
+ type: z.literal(type),
126
+ created_at: z.string().optional(),
127
+ data
128
+ }).passthrough();
129
+ }
130
+ const resendEmailSentEventSchema = envelope("email.sent", emailBaseDataSchema);
131
+ const resendEmailDeliveredEventSchema = envelope("email.delivered", emailDeliveredDataSchema);
132
+ const resendEmailDeliveryDelayedEventSchema = envelope("email.delivery_delayed", emailBaseDataSchema);
133
+ const resendEmailBouncedEventSchema = envelope("email.bounced", emailBouncedDataSchema);
134
+ const resendEmailComplainedEventSchema = envelope("email.complained", emailBaseDataSchema);
135
+ const resendEmailOpenedEventSchema = envelope("email.opened", emailOpenedDataSchema);
136
+ const resendEmailClickedEventSchema = envelope("email.clicked", emailClickedDataSchema);
137
+ const resendEmailFailedEventSchema = envelope("email.failed", emailFailedDataSchema);
138
+ const resendEmailReceivedEventSchema = envelope("email.received", emailReceivedDataSchema);
139
+ const resendEmailScheduledEventSchema = envelope("email.scheduled", emailScheduledDataSchema);
140
+ const resendEmailSuppressedEventSchema = envelope("email.suppressed", emailSuppressedDataSchema);
141
+ const resendDomainCreatedEventSchema = envelope("domain.created", domainDataSchema);
142
+ const resendDomainUpdatedEventSchema = envelope("domain.updated", domainDataSchema);
143
+ const resendDomainDeletedEventSchema = envelope("domain.deleted", domainDataSchema);
144
+ const resendContactCreatedEventSchema = envelope("contact.created", contactDataSchema);
145
+ const resendContactUpdatedEventSchema = envelope("contact.updated", contactDataSchema);
146
+ const resendContactDeletedEventSchema = envelope("contact.deleted", contactDataSchema);
147
+ const resendWebhookEventSchema = z.discriminatedUnion("type", [
148
+ resendEmailSentEventSchema,
149
+ resendEmailDeliveredEventSchema,
150
+ resendEmailDeliveryDelayedEventSchema,
151
+ resendEmailBouncedEventSchema,
152
+ resendEmailComplainedEventSchema,
153
+ resendEmailOpenedEventSchema,
154
+ resendEmailClickedEventSchema,
155
+ resendEmailFailedEventSchema,
156
+ resendEmailReceivedEventSchema,
157
+ resendEmailScheduledEventSchema,
158
+ resendEmailSuppressedEventSchema,
159
+ resendDomainCreatedEventSchema,
160
+ resendDomainUpdatedEventSchema,
161
+ resendDomainDeletedEventSchema,
162
+ resendContactCreatedEventSchema,
163
+ resendContactUpdatedEventSchema,
164
+ resendContactDeletedEventSchema
165
+ ]);
166
+ /**
167
+ * Generic envelope used by `createWebhookTriggerBindingFactory`
168
+ * when the trigger filter must parse the incoming type before the
169
+ * discriminated-union variants can be applied.
170
+ */
171
+ const resendGenericWebhookEventSchema = z.object({
172
+ type: z.enum(RESEND_WEBHOOK_EVENT_NAMES),
173
+ created_at: z.string().optional(),
174
+ data: z.record(z.string(), z.unknown())
175
+ }).passthrough();
176
+
177
+ //#endregion
178
+ export { RESEND_CONTACT_EVENT_NAMES, RESEND_DOMAIN_EVENT_NAMES, RESEND_EMAIL_EVENT_NAMES, RESEND_WEBHOOK_EVENT_NAMES, resendContactCreatedEventSchema, resendContactDeletedEventSchema, resendContactUpdatedEventSchema, resendDomainCreatedEventSchema, resendDomainDeletedEventSchema, resendDomainUpdatedEventSchema, resendEmailBouncedEventSchema, resendEmailClickedEventSchema, resendEmailComplainedEventSchema, resendEmailDeliveredEventSchema, resendEmailDeliveryDelayedEventSchema, resendEmailFailedEventSchema, resendEmailOpenedEventSchema, resendEmailReceivedEventSchema, resendEmailScheduledEventSchema, resendEmailSentEventSchema, resendEmailSuppressedEventSchema, resendGenericWebhookEventSchema, resendWebhookEventSchema };
@@ -0,0 +1,8 @@
1
+ import { t as resend } from "./integration-BR1nTAnU.mjs";
2
+ import { createOfficialOperationFactory } from "@keystrokehq/integration-authoring/official";
3
+
4
+ //#region src/factory.ts
5
+ const resendOperation = createOfficialOperationFactory(resend);
6
+
7
+ //#endregion
8
+ export { resendOperation as t };
@@ -0,0 +1 @@
1
+ export { };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,28 @@
1
+ import { defineOfficialIntegration } from "@keystrokehq/integration-authoring/official";
2
+ import { z } from "zod";
3
+
4
+ //#region src/integration.ts
5
+ const resendAuthSchema = z.object({
6
+ RESEND_API_KEY: z.string().min(1).regex(/^re_/, "Resend API keys start with \"re_\"."),
7
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.record(z.string().min(1), z.string().regex(/^whsec_/, "Svix signing secrets start with \"whsec_\".")).optional()
8
+ });
9
+ /**
10
+ * Resend integration — manual API-key auth.
11
+ *
12
+ * All requests use `Authorization: Bearer re_…`. A mandatory
13
+ * `User-Agent` header is attached by the client. Optional
14
+ * webhook signing secrets are stored per-endpoint so webhook
15
+ * triggers can verify inbound Svix-signed payloads.
16
+ */
17
+ const resendOfficialIntegration = {
18
+ id: "resend",
19
+ name: "Resend",
20
+ description: "Resend transactional + receiving + broadcast email, contacts, segments, templates, domains, and Svix-signed webhook helpers.",
21
+ auth: resendAuthSchema,
22
+ proxy: { hosts: ["api.resend.com"] }
23
+ };
24
+ const resendBundle = defineOfficialIntegration(resendOfficialIntegration);
25
+ const resend = resendBundle.credentialSet;
26
+
27
+ //#endregion
28
+ export { resendOfficialIntegration as i, resendAuthSchema as n, resendBundle as r, resend as t };
@@ -0,0 +1,49 @@
1
+ import * as _keystrokehq_integration_authoring_official0 from "@keystrokehq/integration-authoring/official";
2
+ import { z } from "zod";
3
+ import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
+ import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
5
+ import * as _keystrokehq_core0 from "@keystrokehq/core";
6
+
7
+ //#region src/integration.d.ts
8
+ declare const resendAuthSchema: z.ZodObject<{
9
+ RESEND_API_KEY: z.ZodString;
10
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
11
+ }, z.core.$strip>;
12
+ /**
13
+ * Resend integration — manual API-key auth.
14
+ *
15
+ * All requests use `Authorization: Bearer re_…`. A mandatory
16
+ * `User-Agent` header is attached by the client. Optional
17
+ * webhook signing secrets are stored per-endpoint so webhook
18
+ * triggers can verify inbound Svix-signed payloads.
19
+ */
20
+ declare const resendOfficialIntegration: {
21
+ id: "resend";
22
+ name: string;
23
+ description: string;
24
+ auth: z.ZodObject<{
25
+ RESEND_API_KEY: z.ZodString;
26
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
27
+ }, z.core.$strip>;
28
+ proxy: {
29
+ hosts: string[];
30
+ };
31
+ };
32
+ declare const resendBundle: _keystrokehq_integration_authoring_official0.OfficialIntegrationBundle<"resend", z.ZodObject<{
33
+ RESEND_API_KEY: z.ZodString;
34
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
35
+ }, z.core.$strip>>;
36
+ declare const resend: _keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
37
+ RESEND_API_KEY: z.ZodString;
38
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
39
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
40
+ RESEND_API_KEY: z.ZodString;
41
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
42
+ }, z.core.$strip>>[] | undefined>;
43
+ /**
44
+ * Credentials injected into operations.
45
+ * Derived from the integration definition.
46
+ */
47
+ type ResendCredentials = InferCredentialSetAuth<typeof resend>;
48
+ //#endregion
49
+ export { resendOfficialIntegration as a, resendBundle as i, resend as n, resendAuthSchema as r, ResendCredentials as t };
@@ -0,0 +1,71 @@
1
+ import { z } from "zod";
2
+ import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
3
+ import * as _keystrokehq_core0 from "@keystrokehq/core";
4
+
5
+ //#region src/logs.d.ts
6
+ declare const logSummarySchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ created_at: z.ZodOptional<z.ZodString>;
9
+ method: z.ZodOptional<z.ZodString>;
10
+ path: z.ZodOptional<z.ZodString>;
11
+ status: z.ZodOptional<z.ZodNumber>;
12
+ duration_ms: z.ZodOptional<z.ZodNumber>;
13
+ }, z.core.$loose>;
14
+ declare const logDetailSchema: z.ZodObject<{
15
+ id: z.ZodString;
16
+ created_at: z.ZodOptional<z.ZodString>;
17
+ method: z.ZodOptional<z.ZodString>;
18
+ path: z.ZodOptional<z.ZodString>;
19
+ status: z.ZodOptional<z.ZodNumber>;
20
+ duration_ms: z.ZodOptional<z.ZodNumber>;
21
+ request_body: z.ZodOptional<z.ZodUnknown>;
22
+ response_body: z.ZodOptional<z.ZodUnknown>;
23
+ request_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
24
+ response_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
25
+ }, z.core.$loose>;
26
+ declare const listLogs: _keystrokehq_core0.Operation<z.ZodObject<{
27
+ limit: z.ZodOptional<z.ZodNumber>;
28
+ after: z.ZodOptional<z.ZodString>;
29
+ before: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strip>, z.ZodObject<{
31
+ object: z.ZodLiteral<"list">;
32
+ has_more: z.ZodBoolean;
33
+ data: z.ZodArray<z.ZodObject<{
34
+ id: z.ZodString;
35
+ created_at: z.ZodOptional<z.ZodString>;
36
+ method: z.ZodOptional<z.ZodString>;
37
+ path: z.ZodOptional<z.ZodString>;
38
+ status: z.ZodOptional<z.ZodNumber>;
39
+ duration_ms: z.ZodOptional<z.ZodNumber>;
40
+ }, z.core.$loose>>;
41
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
42
+ RESEND_API_KEY: z.ZodString;
43
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
44
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
45
+ RESEND_API_KEY: z.ZodString;
46
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
47
+ }, z.core.$strip>>[] | undefined>], undefined>;
48
+ declare const retrieveLog: _keystrokehq_core0.Operation<z.ZodObject<{
49
+ id: z.ZodString;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ id: z.ZodString;
52
+ created_at: z.ZodOptional<z.ZodString>;
53
+ method: z.ZodOptional<z.ZodString>;
54
+ path: z.ZodOptional<z.ZodString>;
55
+ status: z.ZodOptional<z.ZodNumber>;
56
+ duration_ms: z.ZodOptional<z.ZodNumber>;
57
+ request_body: z.ZodOptional<z.ZodUnknown>;
58
+ response_body: z.ZodOptional<z.ZodUnknown>;
59
+ request_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
60
+ response_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
61
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
62
+ RESEND_API_KEY: z.ZodString;
63
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
64
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
65
+ RESEND_API_KEY: z.ZodString;
66
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
67
+ }, z.core.$strip>>[] | undefined>], undefined>;
68
+ type ResendLogSummary = z.infer<typeof logSummarySchema>;
69
+ type ResendLogDetail = z.infer<typeof logDetailSchema>;
70
+ //#endregion
71
+ export { ResendLogDetail, ResendLogSummary, listLogs, retrieveLog };
package/dist/logs.mjs ADDED
@@ -0,0 +1,61 @@
1
+ import { createResendClient } from "./client.mjs";
2
+ import { paginationQuerySchema, resendListEnvelope } from "./schemas.mjs";
3
+ import { t as resendOperation } from "./factory-B3VyPRsL.mjs";
4
+ import { z } from "zod";
5
+
6
+ //#region src/logs.ts
7
+ /**
8
+ * resend/logs.ts
9
+ *
10
+ * Operations backing the Resend `/logs` endpoints.
11
+ * PLAN.md § 6.12: 2 operations (list, retrieve).
12
+ *
13
+ * Plan-gated: free-tier accounts have limited retention and may return
14
+ * 402/403 on these endpoints — the shared JsonRestError surfaces the
15
+ * status cleanly for workflow branches to handle.
16
+ */
17
+ const logSummarySchema = z.object({
18
+ id: z.string(),
19
+ created_at: z.string().optional(),
20
+ method: z.string().optional(),
21
+ path: z.string().optional(),
22
+ status: z.number().optional(),
23
+ duration_ms: z.number().optional()
24
+ }).passthrough();
25
+ const logDetailSchema = logSummarySchema.extend({
26
+ request_body: z.unknown().optional(),
27
+ response_body: z.unknown().optional(),
28
+ request_headers: z.record(z.string(), z.string()).optional(),
29
+ response_headers: z.record(z.string(), z.string()).optional()
30
+ }).passthrough();
31
+ const listLogsResponseSchema = resendListEnvelope(logSummarySchema);
32
+ const listLogs = resendOperation({
33
+ id: "list_resend_logs",
34
+ name: "List Resend Logs",
35
+ description: "List API request logs. Plan-gated.",
36
+ input: paginationQuerySchema,
37
+ output: listLogsResponseSchema,
38
+ run: async (input, credentials) => {
39
+ return createResendClient(credentials).request({
40
+ method: "GET",
41
+ path: "/logs",
42
+ query: input
43
+ });
44
+ }
45
+ });
46
+ const retrieveLog = resendOperation({
47
+ id: "retrieve_resend_log",
48
+ name: "Retrieve Resend Log",
49
+ description: "Retrieve a single API request log with full request and response bodies.",
50
+ input: z.object({ id: z.string().min(1) }),
51
+ output: logDetailSchema,
52
+ run: async (input, credentials) => {
53
+ return createResendClient(credentials).request({
54
+ method: "GET",
55
+ path: `/logs/${encodeURIComponent(input.id)}`
56
+ });
57
+ }
58
+ });
59
+
60
+ //#endregion
61
+ export { listLogs, retrieveLog };
@@ -0,0 +1,77 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/schemas.d.ts
4
+ /**
5
+ * Paginated list envelope returned by most Resend list endpoints.
6
+ *
7
+ * `object` is always the literal `'list'`, `has_more` drives cursor
8
+ * pagination, `data` is the actual resource array. Callers pass a
9
+ * `z.array(schema)` for `data` when parsing a concrete response.
10
+ */
11
+ declare function resendListEnvelope<T extends z.ZodTypeAny>(itemSchema: T): z.ZodObject<{
12
+ object: z.ZodLiteral<'list'>;
13
+ has_more: z.ZodBoolean;
14
+ data: z.ZodArray<T>;
15
+ }>;
16
+ type ResendListEnvelope<T> = {
17
+ readonly object: 'list';
18
+ readonly has_more: boolean;
19
+ readonly data: readonly T[];
20
+ };
21
+ /**
22
+ * Cursor-pagination query parameters accepted by every paginated Resend
23
+ * endpoint. `limit` is 1-100 inclusive (Resend default 20); `after` and
24
+ * `before` are opaque IDs. Only one of `after`/`before` may be set per
25
+ * request — validated at the operation layer.
26
+ */
27
+ declare const paginationQuerySchema: z.ZodObject<{
28
+ limit: z.ZodOptional<z.ZodNumber>;
29
+ after: z.ZodOptional<z.ZodString>;
30
+ before: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>;
32
+ type PaginationQuery = z.infer<typeof paginationQuerySchema>;
33
+ /**
34
+ * Regions offered by Resend at domain creation.
35
+ * See <https://resend.com/docs/dashboard/domains/regions>.
36
+ */
37
+ declare const resendRegionSchema: z.ZodEnum<{
38
+ "us-east-1": "us-east-1";
39
+ "eu-west-1": "eu-west-1";
40
+ "sa-east-1": "sa-east-1";
41
+ "ap-northeast-1": "ap-northeast-1";
42
+ }>;
43
+ type ResendRegion = z.infer<typeof resendRegionSchema>;
44
+ /**
45
+ * TLS policy on a Resend domain.
46
+ * - `opportunistic`: attempt TLS, fall back to plaintext if rejected.
47
+ * - `enforced`: require TLS, drop the message otherwise.
48
+ */
49
+ declare const resendTlsPolicySchema: z.ZodEnum<{
50
+ opportunistic: "opportunistic";
51
+ enforced: "enforced";
52
+ }>;
53
+ type ResendTlsPolicy = z.infer<typeof resendTlsPolicySchema>;
54
+ /**
55
+ * Enabled/disabled capability flag on a Resend domain. Used on both
56
+ * `sending` and `receiving` sides of `capabilities`.
57
+ */
58
+ declare const resendCapabilityStateSchema: z.ZodEnum<{
59
+ enabled: "enabled";
60
+ disabled: "disabled";
61
+ }>;
62
+ type ResendCapabilityState = z.infer<typeof resendCapabilityStateSchema>;
63
+ /**
64
+ * Permission tier on a Resend API key. Two tiers:
65
+ * - `full_access`: every endpoint.
66
+ * - `sending_access`: send emails only. Can be further restricted to a
67
+ * single `domain_id`.
68
+ *
69
+ * Source: <https://resend.com/docs/api-reference/api-keys/create-api-key>.
70
+ */
71
+ declare const resendApiKeyPermissionSchema: z.ZodEnum<{
72
+ full_access: "full_access";
73
+ sending_access: "sending_access";
74
+ }>;
75
+ type ResendApiKeyPermission = z.infer<typeof resendApiKeyPermissionSchema>;
76
+ //#endregion
77
+ export { PaginationQuery, ResendApiKeyPermission, ResendCapabilityState, ResendListEnvelope, ResendRegion, ResendTlsPolicy, paginationQuerySchema, resendApiKeyPermissionSchema, resendCapabilityStateSchema, resendListEnvelope, resendRegionSchema, resendTlsPolicySchema };
@@ -0,0 +1,68 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/schemas.ts
4
+ /**
5
+ * resend/schemas.ts
6
+ *
7
+ * Shared Zod v4 schemas and inferred types used across the Resend
8
+ * integration. Per-resource shapes live with their operation files;
9
+ * this module only holds cross-resource primitives.
10
+ */
11
+ /**
12
+ * Paginated list envelope returned by most Resend list endpoints.
13
+ *
14
+ * `object` is always the literal `'list'`, `has_more` drives cursor
15
+ * pagination, `data` is the actual resource array. Callers pass a
16
+ * `z.array(schema)` for `data` when parsing a concrete response.
17
+ */
18
+ function resendListEnvelope(itemSchema) {
19
+ return z.object({
20
+ object: z.literal("list"),
21
+ has_more: z.boolean(),
22
+ data: z.array(itemSchema)
23
+ });
24
+ }
25
+ /**
26
+ * Cursor-pagination query parameters accepted by every paginated Resend
27
+ * endpoint. `limit` is 1-100 inclusive (Resend default 20); `after` and
28
+ * `before` are opaque IDs. Only one of `after`/`before` may be set per
29
+ * request — validated at the operation layer.
30
+ */
31
+ const paginationQuerySchema = z.object({
32
+ limit: z.number().int().min(1).max(100).optional(),
33
+ after: z.string().min(1).optional(),
34
+ before: z.string().min(1).optional()
35
+ });
36
+ /**
37
+ * Regions offered by Resend at domain creation.
38
+ * See <https://resend.com/docs/dashboard/domains/regions>.
39
+ */
40
+ const resendRegionSchema = z.enum([
41
+ "us-east-1",
42
+ "eu-west-1",
43
+ "sa-east-1",
44
+ "ap-northeast-1"
45
+ ]);
46
+ /**
47
+ * TLS policy on a Resend domain.
48
+ * - `opportunistic`: attempt TLS, fall back to plaintext if rejected.
49
+ * - `enforced`: require TLS, drop the message otherwise.
50
+ */
51
+ const resendTlsPolicySchema = z.enum(["opportunistic", "enforced"]);
52
+ /**
53
+ * Enabled/disabled capability flag on a Resend domain. Used on both
54
+ * `sending` and `receiving` sides of `capabilities`.
55
+ */
56
+ const resendCapabilityStateSchema = z.enum(["enabled", "disabled"]);
57
+ /**
58
+ * Permission tier on a Resend API key. Two tiers:
59
+ * - `full_access`: every endpoint.
60
+ * - `sending_access`: send emails only. Can be further restricted to a
61
+ * single `domain_id`.
62
+ *
63
+ * Source: <https://resend.com/docs/api-reference/api-keys/create-api-key>.
64
+ */
65
+ const resendApiKeyPermissionSchema = z.enum(["full_access", "sending_access"]);
66
+
67
+ //#endregion
68
+ export { paginationQuerySchema, resendApiKeyPermissionSchema, resendCapabilityStateSchema, resendListEnvelope, resendRegionSchema, resendTlsPolicySchema };
@@ -0,0 +1,112 @@
1
+ import { z } from "zod";
2
+ import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
3
+ import * as _keystrokehq_core0 from "@keystrokehq/core";
4
+
5
+ //#region src/segments.d.ts
6
+ declare const segmentSummarySchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ name: z.ZodOptional<z.ZodString>;
9
+ created_at: z.ZodOptional<z.ZodString>;
10
+ updated_at: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$loose>;
12
+ declare const segmentDetailSchema: z.ZodObject<{
13
+ id: z.ZodString;
14
+ name: z.ZodOptional<z.ZodString>;
15
+ created_at: z.ZodOptional<z.ZodString>;
16
+ updated_at: z.ZodOptional<z.ZodString>;
17
+ filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
18
+ contact_count: z.ZodOptional<z.ZodNumber>;
19
+ }, z.core.$loose>;
20
+ declare const createSegment: _keystrokehq_core0.Operation<z.ZodObject<{
21
+ name: z.ZodString;
22
+ filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
23
+ }, z.core.$strip>, z.ZodObject<{
24
+ id: z.ZodString;
25
+ name: z.ZodOptional<z.ZodString>;
26
+ created_at: z.ZodOptional<z.ZodString>;
27
+ updated_at: z.ZodOptional<z.ZodString>;
28
+ filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
29
+ contact_count: z.ZodOptional<z.ZodNumber>;
30
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
31
+ RESEND_API_KEY: z.ZodString;
32
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
33
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
34
+ RESEND_API_KEY: z.ZodString;
35
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
36
+ }, z.core.$strip>>[] | undefined>], undefined>;
37
+ declare const listSegments: _keystrokehq_core0.Operation<z.ZodObject<{
38
+ limit: z.ZodOptional<z.ZodNumber>;
39
+ after: z.ZodOptional<z.ZodString>;
40
+ before: z.ZodOptional<z.ZodString>;
41
+ }, z.core.$strip>, z.ZodObject<{
42
+ object: z.ZodLiteral<"list">;
43
+ has_more: z.ZodBoolean;
44
+ data: z.ZodArray<z.ZodObject<{
45
+ id: z.ZodString;
46
+ name: z.ZodOptional<z.ZodString>;
47
+ created_at: z.ZodOptional<z.ZodString>;
48
+ updated_at: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$loose>>;
50
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
51
+ RESEND_API_KEY: z.ZodString;
52
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
53
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
54
+ RESEND_API_KEY: z.ZodString;
55
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
56
+ }, z.core.$strip>>[] | undefined>], undefined>;
57
+ declare const retrieveSegment: _keystrokehq_core0.Operation<z.ZodObject<{
58
+ id: z.ZodString;
59
+ }, z.core.$strip>, z.ZodObject<{
60
+ id: z.ZodString;
61
+ name: z.ZodOptional<z.ZodString>;
62
+ created_at: z.ZodOptional<z.ZodString>;
63
+ updated_at: z.ZodOptional<z.ZodString>;
64
+ filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
65
+ contact_count: z.ZodOptional<z.ZodNumber>;
66
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
67
+ RESEND_API_KEY: z.ZodString;
68
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
69
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
70
+ RESEND_API_KEY: z.ZodString;
71
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
72
+ }, z.core.$strip>>[] | undefined>], undefined>;
73
+ declare const deleteSegment: _keystrokehq_core0.Operation<z.ZodObject<{
74
+ id: z.ZodString;
75
+ }, z.core.$strip>, z.ZodObject<{
76
+ object: z.ZodOptional<z.ZodLiteral<"segment">>;
77
+ id: z.ZodString;
78
+ deleted: z.ZodOptional<z.ZodBoolean>;
79
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
80
+ RESEND_API_KEY: z.ZodString;
81
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
82
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
83
+ RESEND_API_KEY: z.ZodString;
84
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
85
+ }, z.core.$strip>>[] | undefined>], undefined>;
86
+ declare const listSegmentContacts: _keystrokehq_core0.Operation<z.ZodObject<{
87
+ limit: z.ZodOptional<z.ZodNumber>;
88
+ after: z.ZodOptional<z.ZodString>;
89
+ before: z.ZodOptional<z.ZodString>;
90
+ segment_id: z.ZodString;
91
+ }, z.core.$strip>, z.ZodObject<{
92
+ object: z.ZodLiteral<"list">;
93
+ has_more: z.ZodBoolean;
94
+ data: z.ZodArray<z.ZodObject<{
95
+ id: z.ZodString;
96
+ email: z.ZodOptional<z.ZodString>;
97
+ first_name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
98
+ last_name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
99
+ unsubscribed: z.ZodOptional<z.ZodBoolean>;
100
+ created_at: z.ZodOptional<z.ZodString>;
101
+ }, z.core.$loose>>;
102
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
103
+ RESEND_API_KEY: z.ZodString;
104
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
105
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
106
+ RESEND_API_KEY: z.ZodString;
107
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
108
+ }, z.core.$strip>>[] | undefined>], undefined>;
109
+ type ResendSegmentSummary = z.infer<typeof segmentSummarySchema>;
110
+ type ResendSegmentDetail = z.infer<typeof segmentDetailSchema>;
111
+ //#endregion
112
+ export { ResendSegmentDetail, ResendSegmentSummary, createSegment, deleteSegment, listSegmentContacts, listSegments, retrieveSegment };