@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,120 @@
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/segments.ts
7
+ /**
8
+ * resend/segments.ts
9
+ *
10
+ * Operations backing the Resend `/segments` endpoints.
11
+ * PLAN.md § 6.8: 5 operations (create, list, get, delete, list contacts).
12
+ *
13
+ * No update endpoint is exposed today — segments are filter-defined and
14
+ * updated by delete/recreate. If Resend ships a PATCH in the future, a
15
+ * minor bump adds it here.
16
+ *
17
+ * The `filter` DSL is not publicly typed by Resend; we keep it as an
18
+ * opaque `record(unknown)` (see PLAN.md § 9 risk #2).
19
+ */
20
+ const segmentSummarySchema = z.object({
21
+ id: z.string(),
22
+ name: z.string().optional(),
23
+ created_at: z.string().optional(),
24
+ updated_at: z.string().optional()
25
+ }).passthrough();
26
+ const segmentDetailSchema = segmentSummarySchema.extend({
27
+ filter: z.record(z.string(), z.unknown()).optional(),
28
+ contact_count: z.number().optional()
29
+ }).passthrough();
30
+ const contactInSegmentSchema = z.object({
31
+ id: z.string(),
32
+ email: z.string().optional(),
33
+ first_name: z.string().optional().nullable(),
34
+ last_name: z.string().optional().nullable(),
35
+ unsubscribed: z.boolean().optional(),
36
+ created_at: z.string().optional()
37
+ }).passthrough();
38
+ const listSegmentsResponseSchema = resendListEnvelope(segmentSummarySchema);
39
+ const listSegmentContactsResponseSchema = resendListEnvelope(contactInSegmentSchema);
40
+ const createSegment = resendOperation({
41
+ id: "create_resend_segment",
42
+ name: "Create Resend Segment",
43
+ description: "Create a new segment. The filter DSL is provider-native JSON.",
44
+ input: z.object({
45
+ name: z.string().min(1),
46
+ filter: z.record(z.string(), z.unknown()).optional()
47
+ }),
48
+ output: segmentDetailSchema,
49
+ needsApproval: true,
50
+ run: async (input, credentials) => {
51
+ return createResendClient(credentials).request({
52
+ method: "POST",
53
+ path: "/segments",
54
+ body: input
55
+ });
56
+ }
57
+ });
58
+ const listSegments = resendOperation({
59
+ id: "list_resend_segments",
60
+ name: "List Resend Segments",
61
+ description: "Retrieve a cursor-paginated list of segments.",
62
+ input: paginationQuerySchema,
63
+ output: listSegmentsResponseSchema,
64
+ run: async (input, credentials) => {
65
+ return createResendClient(credentials).request({
66
+ method: "GET",
67
+ path: "/segments",
68
+ query: input
69
+ });
70
+ }
71
+ });
72
+ const retrieveSegment = resendOperation({
73
+ id: "retrieve_resend_segment",
74
+ name: "Retrieve Resend Segment",
75
+ description: "Retrieve a single segment by id.",
76
+ input: z.object({ id: z.string().min(1) }),
77
+ output: segmentDetailSchema,
78
+ run: async (input, credentials) => {
79
+ return createResendClient(credentials).request({
80
+ method: "GET",
81
+ path: `/segments/${encodeURIComponent(input.id)}`
82
+ });
83
+ }
84
+ });
85
+ const deleteSegment = resendOperation({
86
+ id: "delete_resend_segment",
87
+ name: "Delete Resend Segment",
88
+ description: "Delete a segment.",
89
+ input: z.object({ id: z.string().min(1) }),
90
+ output: z.object({
91
+ object: z.literal("segment").optional(),
92
+ id: z.string(),
93
+ deleted: z.boolean().optional()
94
+ }).passthrough(),
95
+ needsApproval: true,
96
+ run: async (input, credentials) => {
97
+ return createResendClient(credentials).request({
98
+ method: "DELETE",
99
+ path: `/segments/${encodeURIComponent(input.id)}`
100
+ });
101
+ }
102
+ });
103
+ const listSegmentContacts = resendOperation({
104
+ id: "list_resend_segment_contacts",
105
+ name: "List Resend Segment Contacts",
106
+ description: "List the contacts in a segment.",
107
+ input: paginationQuerySchema.extend({ segment_id: z.string().min(1) }),
108
+ output: listSegmentContactsResponseSchema,
109
+ run: async (input, credentials) => {
110
+ const { segment_id, ...query } = input;
111
+ return createResendClient(credentials).request({
112
+ method: "GET",
113
+ path: `/segments/${encodeURIComponent(segment_id)}/contacts`,
114
+ query
115
+ });
116
+ }
117
+ });
118
+
119
+ //#endregion
120
+ export { createSegment, deleteSegment, listSegmentContacts, listSegments, retrieveSegment };
@@ -0,0 +1,193 @@
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/templates.d.ts
6
+ declare const templateSummarySchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ name: z.ZodOptional<z.ZodString>;
9
+ alias: z.ZodNullable<z.ZodOptional<z.ZodString>>;
10
+ subject: z.ZodOptional<z.ZodString>;
11
+ status: z.ZodOptional<z.ZodString>;
12
+ created_at: z.ZodOptional<z.ZodString>;
13
+ updated_at: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$loose>;
15
+ declare const templateDetailSchema: z.ZodObject<{
16
+ id: z.ZodString;
17
+ name: z.ZodOptional<z.ZodString>;
18
+ alias: z.ZodNullable<z.ZodOptional<z.ZodString>>;
19
+ subject: z.ZodOptional<z.ZodString>;
20
+ status: z.ZodOptional<z.ZodString>;
21
+ created_at: z.ZodOptional<z.ZodString>;
22
+ updated_at: z.ZodOptional<z.ZodString>;
23
+ html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
24
+ text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
25
+ variables: z.ZodOptional<z.ZodArray<z.ZodString>>;
26
+ from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
27
+ reply_to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
28
+ }, z.core.$loose>;
29
+ declare const createTemplate: _keystrokehq_core0.Operation<z.ZodObject<{
30
+ name: z.ZodString;
31
+ subject: z.ZodOptional<z.ZodString>;
32
+ html: z.ZodOptional<z.ZodString>;
33
+ text: z.ZodOptional<z.ZodString>;
34
+ from: z.ZodOptional<z.ZodString>;
35
+ reply_to: z.ZodOptional<z.ZodString>;
36
+ variables: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
+ alias: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strip>, z.ZodObject<{
39
+ id: z.ZodString;
40
+ name: z.ZodOptional<z.ZodString>;
41
+ alias: z.ZodNullable<z.ZodOptional<z.ZodString>>;
42
+ subject: z.ZodOptional<z.ZodString>;
43
+ status: z.ZodOptional<z.ZodString>;
44
+ created_at: z.ZodOptional<z.ZodString>;
45
+ updated_at: z.ZodOptional<z.ZodString>;
46
+ html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
47
+ text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
48
+ variables: z.ZodOptional<z.ZodArray<z.ZodString>>;
49
+ from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
50
+ reply_to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
51
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
52
+ RESEND_API_KEY: z.ZodString;
53
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
54
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
55
+ RESEND_API_KEY: z.ZodString;
56
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
57
+ }, z.core.$strip>>[] | undefined>], undefined>;
58
+ declare const listTemplates: _keystrokehq_core0.Operation<z.ZodObject<{
59
+ limit: z.ZodOptional<z.ZodNumber>;
60
+ after: z.ZodOptional<z.ZodString>;
61
+ before: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strip>, z.ZodObject<{
63
+ object: z.ZodLiteral<"list">;
64
+ has_more: z.ZodBoolean;
65
+ data: z.ZodArray<z.ZodObject<{
66
+ id: z.ZodString;
67
+ name: z.ZodOptional<z.ZodString>;
68
+ alias: z.ZodNullable<z.ZodOptional<z.ZodString>>;
69
+ subject: z.ZodOptional<z.ZodString>;
70
+ status: z.ZodOptional<z.ZodString>;
71
+ created_at: z.ZodOptional<z.ZodString>;
72
+ updated_at: z.ZodOptional<z.ZodString>;
73
+ }, z.core.$loose>>;
74
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
75
+ RESEND_API_KEY: z.ZodString;
76
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
77
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
78
+ RESEND_API_KEY: z.ZodString;
79
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
80
+ }, z.core.$strip>>[] | undefined>], undefined>;
81
+ declare const retrieveTemplate: _keystrokehq_core0.Operation<z.ZodObject<{
82
+ id: z.ZodString;
83
+ }, z.core.$strip>, z.ZodObject<{
84
+ id: z.ZodString;
85
+ name: z.ZodOptional<z.ZodString>;
86
+ alias: z.ZodNullable<z.ZodOptional<z.ZodString>>;
87
+ subject: z.ZodOptional<z.ZodString>;
88
+ status: z.ZodOptional<z.ZodString>;
89
+ created_at: z.ZodOptional<z.ZodString>;
90
+ updated_at: z.ZodOptional<z.ZodString>;
91
+ html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
92
+ text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
93
+ variables: z.ZodOptional<z.ZodArray<z.ZodString>>;
94
+ from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
95
+ reply_to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
96
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
97
+ RESEND_API_KEY: z.ZodString;
98
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
99
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
100
+ RESEND_API_KEY: z.ZodString;
101
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
102
+ }, z.core.$strip>>[] | undefined>], undefined>;
103
+ declare const updateTemplate: _keystrokehq_core0.Operation<z.ZodObject<{
104
+ name: z.ZodOptional<z.ZodString>;
105
+ subject: z.ZodOptional<z.ZodOptional<z.ZodString>>;
106
+ html: z.ZodOptional<z.ZodOptional<z.ZodString>>;
107
+ text: z.ZodOptional<z.ZodOptional<z.ZodString>>;
108
+ from: z.ZodOptional<z.ZodOptional<z.ZodString>>;
109
+ reply_to: z.ZodOptional<z.ZodOptional<z.ZodString>>;
110
+ variables: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
111
+ alias: z.ZodOptional<z.ZodOptional<z.ZodString>>;
112
+ id: z.ZodString;
113
+ }, z.core.$strip>, z.ZodObject<{
114
+ id: z.ZodString;
115
+ name: z.ZodOptional<z.ZodString>;
116
+ alias: z.ZodNullable<z.ZodOptional<z.ZodString>>;
117
+ subject: z.ZodOptional<z.ZodString>;
118
+ status: z.ZodOptional<z.ZodString>;
119
+ created_at: z.ZodOptional<z.ZodString>;
120
+ updated_at: z.ZodOptional<z.ZodString>;
121
+ html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
122
+ text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
123
+ variables: z.ZodOptional<z.ZodArray<z.ZodString>>;
124
+ from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
125
+ reply_to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
126
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
127
+ RESEND_API_KEY: z.ZodString;
128
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
129
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
130
+ RESEND_API_KEY: z.ZodString;
131
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
132
+ }, z.core.$strip>>[] | undefined>], undefined>;
133
+ declare const deleteTemplate: _keystrokehq_core0.Operation<z.ZodObject<{
134
+ id: z.ZodString;
135
+ }, z.core.$strip>, z.ZodObject<{
136
+ object: z.ZodOptional<z.ZodLiteral<"template">>;
137
+ id: z.ZodString;
138
+ deleted: z.ZodOptional<z.ZodBoolean>;
139
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
140
+ RESEND_API_KEY: z.ZodString;
141
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
142
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
143
+ RESEND_API_KEY: z.ZodString;
144
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
145
+ }, z.core.$strip>>[] | undefined>], undefined>;
146
+ declare const duplicateTemplate: _keystrokehq_core0.Operation<z.ZodObject<{
147
+ id: z.ZodString;
148
+ }, z.core.$strip>, z.ZodObject<{
149
+ id: z.ZodString;
150
+ name: z.ZodOptional<z.ZodString>;
151
+ alias: z.ZodNullable<z.ZodOptional<z.ZodString>>;
152
+ subject: z.ZodOptional<z.ZodString>;
153
+ status: z.ZodOptional<z.ZodString>;
154
+ created_at: z.ZodOptional<z.ZodString>;
155
+ updated_at: z.ZodOptional<z.ZodString>;
156
+ html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
157
+ text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
158
+ variables: z.ZodOptional<z.ZodArray<z.ZodString>>;
159
+ from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
160
+ reply_to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
161
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
162
+ RESEND_API_KEY: z.ZodString;
163
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
164
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
165
+ RESEND_API_KEY: z.ZodString;
166
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
167
+ }, z.core.$strip>>[] | undefined>], undefined>;
168
+ declare const publishTemplate: _keystrokehq_core0.Operation<z.ZodObject<{
169
+ id: z.ZodString;
170
+ }, z.core.$strip>, z.ZodObject<{
171
+ id: z.ZodString;
172
+ name: z.ZodOptional<z.ZodString>;
173
+ alias: z.ZodNullable<z.ZodOptional<z.ZodString>>;
174
+ subject: z.ZodOptional<z.ZodString>;
175
+ status: z.ZodOptional<z.ZodString>;
176
+ created_at: z.ZodOptional<z.ZodString>;
177
+ updated_at: z.ZodOptional<z.ZodString>;
178
+ html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
179
+ text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
180
+ variables: z.ZodOptional<z.ZodArray<z.ZodString>>;
181
+ from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
182
+ reply_to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
183
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
184
+ RESEND_API_KEY: z.ZodString;
185
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
186
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
187
+ RESEND_API_KEY: z.ZodString;
188
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
189
+ }, z.core.$strip>>[] | undefined>], undefined>;
190
+ type ResendTemplateSummary = z.infer<typeof templateSummarySchema>;
191
+ type ResendTemplateDetail = z.infer<typeof templateDetailSchema>;
192
+ //#endregion
193
+ export { ResendTemplateDetail, ResendTemplateSummary, createTemplate, deleteTemplate, duplicateTemplate, listTemplates, publishTemplate, retrieveTemplate, updateTemplate };
@@ -0,0 +1,151 @@
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/templates.ts
7
+ /**
8
+ * resend/templates.ts
9
+ *
10
+ * Operations backing the Resend `/templates` endpoints.
11
+ * PLAN.md § 6.10: 7 operations (create, list, get, update, delete,
12
+ * duplicate, publish).
13
+ *
14
+ * Templates are drafts by default; `publishTemplate` must be called
15
+ * before a template can be referenced from `sendEmail` via `template.id`.
16
+ * We do not accept `react` here — see `emails.ts` module note.
17
+ */
18
+ const templateSummarySchema = z.object({
19
+ id: z.string(),
20
+ name: z.string().optional(),
21
+ alias: z.string().optional().nullable(),
22
+ subject: z.string().optional(),
23
+ status: z.string().optional(),
24
+ created_at: z.string().optional(),
25
+ updated_at: z.string().optional()
26
+ }).passthrough();
27
+ const templateDetailSchema = templateSummarySchema.extend({
28
+ html: z.string().optional().nullable(),
29
+ text: z.string().optional().nullable(),
30
+ variables: z.array(z.string()).optional(),
31
+ from: z.string().optional().nullable(),
32
+ reply_to: z.string().optional().nullable()
33
+ }).passthrough();
34
+ const listTemplatesResponseSchema = resendListEnvelope(templateSummarySchema);
35
+ const templateWriteFieldsSchema = z.object({
36
+ name: z.string().min(1),
37
+ subject: z.string().optional(),
38
+ html: z.string().optional(),
39
+ text: z.string().optional(),
40
+ from: z.string().optional(),
41
+ reply_to: z.string().optional(),
42
+ variables: z.array(z.string().regex(/^[A-Za-z0-9_]+$/).max(50)).optional(),
43
+ alias: z.string().optional()
44
+ });
45
+ const createTemplate = resendOperation({
46
+ id: "create_resend_template",
47
+ name: "Create Resend Template",
48
+ description: "Create a new email template (draft).",
49
+ input: templateWriteFieldsSchema,
50
+ output: templateDetailSchema,
51
+ needsApproval: true,
52
+ run: async (input, credentials) => {
53
+ return createResendClient(credentials).request({
54
+ method: "POST",
55
+ path: "/templates",
56
+ body: input
57
+ });
58
+ }
59
+ });
60
+ const listTemplates = resendOperation({
61
+ id: "list_resend_templates",
62
+ name: "List Resend Templates",
63
+ description: "Retrieve a cursor-paginated list of templates.",
64
+ input: paginationQuerySchema,
65
+ output: listTemplatesResponseSchema,
66
+ run: async (input, credentials) => {
67
+ return createResendClient(credentials).request({
68
+ method: "GET",
69
+ path: "/templates",
70
+ query: input
71
+ });
72
+ }
73
+ });
74
+ const retrieveTemplate = resendOperation({
75
+ id: "retrieve_resend_template",
76
+ name: "Retrieve Resend Template",
77
+ description: "Retrieve a single template by id or alias.",
78
+ input: z.object({ id: z.string().min(1) }),
79
+ output: templateDetailSchema,
80
+ run: async (input, credentials) => {
81
+ return createResendClient(credentials).request({
82
+ method: "GET",
83
+ path: `/templates/${encodeURIComponent(input.id)}`
84
+ });
85
+ }
86
+ });
87
+ const updateTemplate = resendOperation({
88
+ id: "update_resend_template",
89
+ name: "Update Resend Template",
90
+ description: "Update an existing template. Produces a new draft version.",
91
+ input: templateWriteFieldsSchema.partial().extend({ id: z.string().min(1) }),
92
+ output: templateDetailSchema,
93
+ needsApproval: true,
94
+ run: async (input, credentials) => {
95
+ const { id, ...body } = input;
96
+ return createResendClient(credentials).request({
97
+ method: "PATCH",
98
+ path: `/templates/${encodeURIComponent(id)}`,
99
+ body
100
+ });
101
+ }
102
+ });
103
+ const deleteTemplate = resendOperation({
104
+ id: "delete_resend_template",
105
+ name: "Delete Resend Template",
106
+ description: "Delete an existing template.",
107
+ input: z.object({ id: z.string().min(1) }),
108
+ output: z.object({
109
+ object: z.literal("template").optional(),
110
+ id: z.string(),
111
+ deleted: z.boolean().optional()
112
+ }),
113
+ needsApproval: true,
114
+ run: async (input, credentials) => {
115
+ return createResendClient(credentials).request({
116
+ method: "DELETE",
117
+ path: `/templates/${encodeURIComponent(input.id)}`
118
+ });
119
+ }
120
+ });
121
+ const duplicateTemplate = resendOperation({
122
+ id: "duplicate_resend_template",
123
+ name: "Duplicate Resend Template",
124
+ description: "Duplicate an existing template.",
125
+ input: z.object({ id: z.string().min(1) }),
126
+ output: templateDetailSchema,
127
+ needsApproval: true,
128
+ run: async (input, credentials) => {
129
+ return createResendClient(credentials).request({
130
+ method: "POST",
131
+ path: `/templates/${encodeURIComponent(input.id)}/duplicate`
132
+ });
133
+ }
134
+ });
135
+ const publishTemplate = resendOperation({
136
+ id: "publish_resend_template",
137
+ name: "Publish Resend Template",
138
+ description: "Publish a draft template so it can be referenced from sendEmail.",
139
+ input: z.object({ id: z.string().min(1) }),
140
+ output: templateDetailSchema,
141
+ needsApproval: true,
142
+ run: async (input, credentials) => {
143
+ return createResendClient(credentials).request({
144
+ method: "POST",
145
+ path: `/templates/${encodeURIComponent(input.id)}/publish`
146
+ });
147
+ }
148
+ });
149
+
150
+ //#endregion
151
+ export { createTemplate, deleteTemplate, duplicateTemplate, listTemplates, publishTemplate, retrieveTemplate, updateTemplate };
@@ -0,0 +1,125 @@
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/topics.d.ts
6
+ declare const topicSchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ name: z.ZodOptional<z.ZodString>;
9
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
10
+ default_subscription: z.ZodOptional<z.ZodEnum<{
11
+ opt_in: "opt_in";
12
+ opt_out: "opt_out";
13
+ }>>;
14
+ created_at: z.ZodOptional<z.ZodString>;
15
+ updated_at: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$loose>;
17
+ declare const createTopic: _keystrokehq_core0.Operation<z.ZodObject<{
18
+ name: z.ZodString;
19
+ default_subscription: z.ZodEnum<{
20
+ opt_in: "opt_in";
21
+ opt_out: "opt_out";
22
+ }>;
23
+ description: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strip>, z.ZodObject<{
25
+ id: z.ZodString;
26
+ name: z.ZodOptional<z.ZodString>;
27
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
28
+ default_subscription: z.ZodOptional<z.ZodEnum<{
29
+ opt_in: "opt_in";
30
+ opt_out: "opt_out";
31
+ }>>;
32
+ created_at: z.ZodOptional<z.ZodString>;
33
+ updated_at: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
35
+ RESEND_API_KEY: z.ZodString;
36
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
37
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
38
+ RESEND_API_KEY: z.ZodString;
39
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
40
+ }, z.core.$strip>>[] | undefined>], undefined>;
41
+ declare const listTopics: _keystrokehq_core0.Operation<z.ZodObject<{
42
+ limit: z.ZodOptional<z.ZodNumber>;
43
+ after: z.ZodOptional<z.ZodString>;
44
+ before: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$strip>, z.ZodObject<{
46
+ object: z.ZodLiteral<"list">;
47
+ has_more: z.ZodBoolean;
48
+ data: z.ZodArray<z.ZodObject<{
49
+ id: z.ZodString;
50
+ name: z.ZodOptional<z.ZodString>;
51
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
52
+ default_subscription: z.ZodOptional<z.ZodEnum<{
53
+ opt_in: "opt_in";
54
+ opt_out: "opt_out";
55
+ }>>;
56
+ created_at: z.ZodOptional<z.ZodString>;
57
+ updated_at: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$loose>>;
59
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
60
+ RESEND_API_KEY: z.ZodString;
61
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
62
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
63
+ RESEND_API_KEY: z.ZodString;
64
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
65
+ }, z.core.$strip>>[] | undefined>], undefined>;
66
+ declare const retrieveTopic: _keystrokehq_core0.Operation<z.ZodObject<{
67
+ id: z.ZodString;
68
+ }, z.core.$strip>, z.ZodObject<{
69
+ id: z.ZodString;
70
+ name: z.ZodOptional<z.ZodString>;
71
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
72
+ default_subscription: z.ZodOptional<z.ZodEnum<{
73
+ opt_in: "opt_in";
74
+ opt_out: "opt_out";
75
+ }>>;
76
+ created_at: z.ZodOptional<z.ZodString>;
77
+ updated_at: z.ZodOptional<z.ZodString>;
78
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
79
+ RESEND_API_KEY: z.ZodString;
80
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
81
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
82
+ RESEND_API_KEY: z.ZodString;
83
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
84
+ }, z.core.$strip>>[] | undefined>], undefined>;
85
+ declare const updateTopic: _keystrokehq_core0.Operation<z.ZodObject<{
86
+ id: z.ZodString;
87
+ name: z.ZodOptional<z.ZodString>;
88
+ description: z.ZodOptional<z.ZodString>;
89
+ default_subscription: z.ZodOptional<z.ZodEnum<{
90
+ opt_in: "opt_in";
91
+ opt_out: "opt_out";
92
+ }>>;
93
+ }, z.core.$strip>, z.ZodObject<{
94
+ id: z.ZodString;
95
+ name: z.ZodOptional<z.ZodString>;
96
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
97
+ default_subscription: z.ZodOptional<z.ZodEnum<{
98
+ opt_in: "opt_in";
99
+ opt_out: "opt_out";
100
+ }>>;
101
+ created_at: z.ZodOptional<z.ZodString>;
102
+ updated_at: z.ZodOptional<z.ZodString>;
103
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
104
+ RESEND_API_KEY: z.ZodString;
105
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
106
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
107
+ RESEND_API_KEY: z.ZodString;
108
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
109
+ }, z.core.$strip>>[] | undefined>], undefined>;
110
+ declare const deleteTopic: _keystrokehq_core0.Operation<z.ZodObject<{
111
+ id: z.ZodString;
112
+ }, z.core.$strip>, z.ZodObject<{
113
+ object: z.ZodOptional<z.ZodLiteral<"topic">>;
114
+ id: z.ZodString;
115
+ deleted: z.ZodOptional<z.ZodBoolean>;
116
+ }, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
117
+ RESEND_API_KEY: z.ZodString;
118
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
119
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
120
+ RESEND_API_KEY: z.ZodString;
121
+ RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
122
+ }, z.core.$strip>>[] | undefined>], undefined>;
123
+ type ResendTopic = z.infer<typeof topicSchema>;
124
+ //#endregion
125
+ export { ResendTopic, createTopic, deleteTopic, listTopics, retrieveTopic, updateTopic };