@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.
- package/README.md +184 -0
- package/dist/_official/index.d.mts +2 -0
- package/dist/_official/index.mjs +3 -0
- package/dist/_runtime/index.d.mts +1 -0
- package/dist/_runtime/index.mjs +1 -0
- package/dist/api-keys.d.mts +67 -0
- package/dist/api-keys.mjs +90 -0
- package/dist/broadcasts.d.mts +238 -0
- package/dist/broadcasts.mjs +178 -0
- package/dist/client.d.mts +27 -0
- package/dist/client.mjs +40 -0
- package/dist/connection.d.mts +2 -0
- package/dist/connection.mjs +3 -0
- package/dist/contact-properties.d.mts +139 -0
- package/dist/contact-properties.mjs +115 -0
- package/dist/contacts.d.mts +218 -0
- package/dist/contacts.mjs +225 -0
- package/dist/domains.d.mts +293 -0
- package/dist/domains.mjs +160 -0
- package/dist/emails-receiving.d.mts +177 -0
- package/dist/emails-receiving.mjs +114 -0
- package/dist/emails.d.mts +307 -0
- package/dist/emails.mjs +241 -0
- package/dist/events.d.mts +571 -0
- package/dist/events.mjs +178 -0
- package/dist/factory-B3VyPRsL.mjs +8 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-BR1nTAnU.mjs +28 -0
- package/dist/integration-ClH0F7x-.d.mts +49 -0
- package/dist/logs.d.mts +71 -0
- package/dist/logs.mjs +61 -0
- package/dist/schemas.d.mts +77 -0
- package/dist/schemas.mjs +68 -0
- package/dist/segments.d.mts +112 -0
- package/dist/segments.mjs +120 -0
- package/dist/templates.d.mts +193 -0
- package/dist/templates.mjs +151 -0
- package/dist/topics.d.mts +125 -0
- package/dist/topics.mjs +113 -0
- package/dist/triggers.d.mts +68 -0
- package/dist/triggers.mjs +141 -0
- package/dist/verification.d.mts +49 -0
- package/dist/verification.mjs +139 -0
- package/dist/webhooks.d.mts +285 -0
- package/dist/webhooks.mjs +124 -0
- package/package.json +137 -0
|
@@ -0,0 +1,285 @@
|
|
|
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/webhooks.d.ts
|
|
6
|
+
declare const webhookSummarySchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
endpoint_url: z.ZodString;
|
|
9
|
+
events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
10
|
+
"email.sent": "email.sent";
|
|
11
|
+
"email.delivered": "email.delivered";
|
|
12
|
+
"email.delivery_delayed": "email.delivery_delayed";
|
|
13
|
+
"email.bounced": "email.bounced";
|
|
14
|
+
"email.complained": "email.complained";
|
|
15
|
+
"email.opened": "email.opened";
|
|
16
|
+
"email.clicked": "email.clicked";
|
|
17
|
+
"email.failed": "email.failed";
|
|
18
|
+
"email.received": "email.received";
|
|
19
|
+
"email.scheduled": "email.scheduled";
|
|
20
|
+
"email.suppressed": "email.suppressed";
|
|
21
|
+
"domain.created": "domain.created";
|
|
22
|
+
"domain.updated": "domain.updated";
|
|
23
|
+
"domain.deleted": "domain.deleted";
|
|
24
|
+
"contact.created": "contact.created";
|
|
25
|
+
"contact.updated": "contact.updated";
|
|
26
|
+
"contact.deleted": "contact.deleted";
|
|
27
|
+
}>>>;
|
|
28
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
29
|
+
enabled: "enabled";
|
|
30
|
+
disabled: "disabled";
|
|
31
|
+
}>>;
|
|
32
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
33
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$loose>;
|
|
35
|
+
declare const webhookDetailSchema: z.ZodObject<{
|
|
36
|
+
id: z.ZodString;
|
|
37
|
+
endpoint_url: z.ZodString;
|
|
38
|
+
events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
39
|
+
"email.sent": "email.sent";
|
|
40
|
+
"email.delivered": "email.delivered";
|
|
41
|
+
"email.delivery_delayed": "email.delivery_delayed";
|
|
42
|
+
"email.bounced": "email.bounced";
|
|
43
|
+
"email.complained": "email.complained";
|
|
44
|
+
"email.opened": "email.opened";
|
|
45
|
+
"email.clicked": "email.clicked";
|
|
46
|
+
"email.failed": "email.failed";
|
|
47
|
+
"email.received": "email.received";
|
|
48
|
+
"email.scheduled": "email.scheduled";
|
|
49
|
+
"email.suppressed": "email.suppressed";
|
|
50
|
+
"domain.created": "domain.created";
|
|
51
|
+
"domain.updated": "domain.updated";
|
|
52
|
+
"domain.deleted": "domain.deleted";
|
|
53
|
+
"contact.created": "contact.created";
|
|
54
|
+
"contact.updated": "contact.updated";
|
|
55
|
+
"contact.deleted": "contact.deleted";
|
|
56
|
+
}>>>;
|
|
57
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
58
|
+
enabled: "enabled";
|
|
59
|
+
disabled: "disabled";
|
|
60
|
+
}>>;
|
|
61
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
62
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
63
|
+
signing_secret: z.ZodOptional<z.ZodString>;
|
|
64
|
+
}, z.core.$loose>;
|
|
65
|
+
declare const createWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
66
|
+
endpoint_url: z.ZodURL;
|
|
67
|
+
events: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodEnum<{
|
|
68
|
+
"email.sent": "email.sent";
|
|
69
|
+
"email.delivered": "email.delivered";
|
|
70
|
+
"email.delivery_delayed": "email.delivery_delayed";
|
|
71
|
+
"email.bounced": "email.bounced";
|
|
72
|
+
"email.complained": "email.complained";
|
|
73
|
+
"email.opened": "email.opened";
|
|
74
|
+
"email.clicked": "email.clicked";
|
|
75
|
+
"email.failed": "email.failed";
|
|
76
|
+
"email.received": "email.received";
|
|
77
|
+
"email.scheduled": "email.scheduled";
|
|
78
|
+
"email.suppressed": "email.suppressed";
|
|
79
|
+
"domain.created": "domain.created";
|
|
80
|
+
"domain.updated": "domain.updated";
|
|
81
|
+
"domain.deleted": "domain.deleted";
|
|
82
|
+
"contact.created": "contact.created";
|
|
83
|
+
"contact.updated": "contact.updated";
|
|
84
|
+
"contact.deleted": "contact.deleted";
|
|
85
|
+
}>>]>;
|
|
86
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
87
|
+
enabled: "enabled";
|
|
88
|
+
disabled: "disabled";
|
|
89
|
+
}>>;
|
|
90
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
91
|
+
id: z.ZodString;
|
|
92
|
+
endpoint_url: z.ZodString;
|
|
93
|
+
events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
94
|
+
"email.sent": "email.sent";
|
|
95
|
+
"email.delivered": "email.delivered";
|
|
96
|
+
"email.delivery_delayed": "email.delivery_delayed";
|
|
97
|
+
"email.bounced": "email.bounced";
|
|
98
|
+
"email.complained": "email.complained";
|
|
99
|
+
"email.opened": "email.opened";
|
|
100
|
+
"email.clicked": "email.clicked";
|
|
101
|
+
"email.failed": "email.failed";
|
|
102
|
+
"email.received": "email.received";
|
|
103
|
+
"email.scheduled": "email.scheduled";
|
|
104
|
+
"email.suppressed": "email.suppressed";
|
|
105
|
+
"domain.created": "domain.created";
|
|
106
|
+
"domain.updated": "domain.updated";
|
|
107
|
+
"domain.deleted": "domain.deleted";
|
|
108
|
+
"contact.created": "contact.created";
|
|
109
|
+
"contact.updated": "contact.updated";
|
|
110
|
+
"contact.deleted": "contact.deleted";
|
|
111
|
+
}>>>;
|
|
112
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
113
|
+
enabled: "enabled";
|
|
114
|
+
disabled: "disabled";
|
|
115
|
+
}>>;
|
|
116
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
117
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
118
|
+
signing_secret: z.ZodOptional<z.ZodString>;
|
|
119
|
+
}, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", 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>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
123
|
+
RESEND_API_KEY: z.ZodString;
|
|
124
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
125
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
126
|
+
declare const listWebhooks: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
127
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
after: z.ZodOptional<z.ZodString>;
|
|
129
|
+
before: z.ZodOptional<z.ZodString>;
|
|
130
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
131
|
+
object: z.ZodLiteral<"list">;
|
|
132
|
+
has_more: z.ZodBoolean;
|
|
133
|
+
data: z.ZodArray<z.ZodObject<{
|
|
134
|
+
id: z.ZodString;
|
|
135
|
+
endpoint_url: z.ZodString;
|
|
136
|
+
events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
137
|
+
"email.sent": "email.sent";
|
|
138
|
+
"email.delivered": "email.delivered";
|
|
139
|
+
"email.delivery_delayed": "email.delivery_delayed";
|
|
140
|
+
"email.bounced": "email.bounced";
|
|
141
|
+
"email.complained": "email.complained";
|
|
142
|
+
"email.opened": "email.opened";
|
|
143
|
+
"email.clicked": "email.clicked";
|
|
144
|
+
"email.failed": "email.failed";
|
|
145
|
+
"email.received": "email.received";
|
|
146
|
+
"email.scheduled": "email.scheduled";
|
|
147
|
+
"email.suppressed": "email.suppressed";
|
|
148
|
+
"domain.created": "domain.created";
|
|
149
|
+
"domain.updated": "domain.updated";
|
|
150
|
+
"domain.deleted": "domain.deleted";
|
|
151
|
+
"contact.created": "contact.created";
|
|
152
|
+
"contact.updated": "contact.updated";
|
|
153
|
+
"contact.deleted": "contact.deleted";
|
|
154
|
+
}>>>;
|
|
155
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
156
|
+
enabled: "enabled";
|
|
157
|
+
disabled: "disabled";
|
|
158
|
+
}>>;
|
|
159
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
160
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
161
|
+
}, z.core.$loose>>;
|
|
162
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
163
|
+
RESEND_API_KEY: z.ZodString;
|
|
164
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
165
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
166
|
+
RESEND_API_KEY: z.ZodString;
|
|
167
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
168
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
169
|
+
declare const retrieveWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
170
|
+
id: z.ZodString;
|
|
171
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
172
|
+
id: z.ZodString;
|
|
173
|
+
endpoint_url: z.ZodString;
|
|
174
|
+
events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
175
|
+
"email.sent": "email.sent";
|
|
176
|
+
"email.delivered": "email.delivered";
|
|
177
|
+
"email.delivery_delayed": "email.delivery_delayed";
|
|
178
|
+
"email.bounced": "email.bounced";
|
|
179
|
+
"email.complained": "email.complained";
|
|
180
|
+
"email.opened": "email.opened";
|
|
181
|
+
"email.clicked": "email.clicked";
|
|
182
|
+
"email.failed": "email.failed";
|
|
183
|
+
"email.received": "email.received";
|
|
184
|
+
"email.scheduled": "email.scheduled";
|
|
185
|
+
"email.suppressed": "email.suppressed";
|
|
186
|
+
"domain.created": "domain.created";
|
|
187
|
+
"domain.updated": "domain.updated";
|
|
188
|
+
"domain.deleted": "domain.deleted";
|
|
189
|
+
"contact.created": "contact.created";
|
|
190
|
+
"contact.updated": "contact.updated";
|
|
191
|
+
"contact.deleted": "contact.deleted";
|
|
192
|
+
}>>>;
|
|
193
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
194
|
+
enabled: "enabled";
|
|
195
|
+
disabled: "disabled";
|
|
196
|
+
}>>;
|
|
197
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
198
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
199
|
+
signing_secret: z.ZodOptional<z.ZodString>;
|
|
200
|
+
}, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
201
|
+
RESEND_API_KEY: z.ZodString;
|
|
202
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
203
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
204
|
+
RESEND_API_KEY: z.ZodString;
|
|
205
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
206
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
207
|
+
declare const updateWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
208
|
+
id: z.ZodString;
|
|
209
|
+
endpoint_url: z.ZodOptional<z.ZodURL>;
|
|
210
|
+
events: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodArray<z.ZodEnum<{
|
|
211
|
+
"email.sent": "email.sent";
|
|
212
|
+
"email.delivered": "email.delivered";
|
|
213
|
+
"email.delivery_delayed": "email.delivery_delayed";
|
|
214
|
+
"email.bounced": "email.bounced";
|
|
215
|
+
"email.complained": "email.complained";
|
|
216
|
+
"email.opened": "email.opened";
|
|
217
|
+
"email.clicked": "email.clicked";
|
|
218
|
+
"email.failed": "email.failed";
|
|
219
|
+
"email.received": "email.received";
|
|
220
|
+
"email.scheduled": "email.scheduled";
|
|
221
|
+
"email.suppressed": "email.suppressed";
|
|
222
|
+
"domain.created": "domain.created";
|
|
223
|
+
"domain.updated": "domain.updated";
|
|
224
|
+
"domain.deleted": "domain.deleted";
|
|
225
|
+
"contact.created": "contact.created";
|
|
226
|
+
"contact.updated": "contact.updated";
|
|
227
|
+
"contact.deleted": "contact.deleted";
|
|
228
|
+
}>>]>>;
|
|
229
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
230
|
+
enabled: "enabled";
|
|
231
|
+
disabled: "disabled";
|
|
232
|
+
}>>;
|
|
233
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
234
|
+
id: z.ZodString;
|
|
235
|
+
endpoint_url: z.ZodString;
|
|
236
|
+
events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
237
|
+
"email.sent": "email.sent";
|
|
238
|
+
"email.delivered": "email.delivered";
|
|
239
|
+
"email.delivery_delayed": "email.delivery_delayed";
|
|
240
|
+
"email.bounced": "email.bounced";
|
|
241
|
+
"email.complained": "email.complained";
|
|
242
|
+
"email.opened": "email.opened";
|
|
243
|
+
"email.clicked": "email.clicked";
|
|
244
|
+
"email.failed": "email.failed";
|
|
245
|
+
"email.received": "email.received";
|
|
246
|
+
"email.scheduled": "email.scheduled";
|
|
247
|
+
"email.suppressed": "email.suppressed";
|
|
248
|
+
"domain.created": "domain.created";
|
|
249
|
+
"domain.updated": "domain.updated";
|
|
250
|
+
"domain.deleted": "domain.deleted";
|
|
251
|
+
"contact.created": "contact.created";
|
|
252
|
+
"contact.updated": "contact.updated";
|
|
253
|
+
"contact.deleted": "contact.deleted";
|
|
254
|
+
}>>>;
|
|
255
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
256
|
+
enabled: "enabled";
|
|
257
|
+
disabled: "disabled";
|
|
258
|
+
}>>;
|
|
259
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
260
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
261
|
+
signing_secret: z.ZodOptional<z.ZodString>;
|
|
262
|
+
}, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
263
|
+
RESEND_API_KEY: z.ZodString;
|
|
264
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
265
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
266
|
+
RESEND_API_KEY: z.ZodString;
|
|
267
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
268
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
269
|
+
declare const deleteWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
270
|
+
id: z.ZodString;
|
|
271
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
272
|
+
object: z.ZodOptional<z.ZodLiteral<"webhook">>;
|
|
273
|
+
id: z.ZodString;
|
|
274
|
+
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
275
|
+
}, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
276
|
+
RESEND_API_KEY: z.ZodString;
|
|
277
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
278
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
279
|
+
RESEND_API_KEY: z.ZodString;
|
|
280
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
281
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
282
|
+
type ResendWebhookSummary = z.infer<typeof webhookSummarySchema>;
|
|
283
|
+
type ResendWebhookDetail = z.infer<typeof webhookDetailSchema>;
|
|
284
|
+
//#endregion
|
|
285
|
+
export { ResendWebhookDetail, ResendWebhookSummary, createWebhook, deleteWebhook, listWebhooks, retrieveWebhook, updateWebhook };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { createResendClient } from "./client.mjs";
|
|
2
|
+
import { paginationQuerySchema, resendListEnvelope } from "./schemas.mjs";
|
|
3
|
+
import { RESEND_WEBHOOK_EVENT_NAMES } from "./events.mjs";
|
|
4
|
+
import { t as resendOperation } from "./factory-B3VyPRsL.mjs";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/webhooks.ts
|
|
8
|
+
/**
|
|
9
|
+
* resend/webhooks.ts
|
|
10
|
+
*
|
|
11
|
+
* Operations backing the Resend `/webhooks` endpoints (endpoint CRUD —
|
|
12
|
+
* distinct from the direct-binding trigger surface exported from
|
|
13
|
+
* `./triggers`).
|
|
14
|
+
*
|
|
15
|
+
* PLAN.md § 6.11: 5 operations (create, list, get, update, delete).
|
|
16
|
+
*
|
|
17
|
+
* Create and retrieve responses return the per-endpoint Svix signing
|
|
18
|
+
* secret (`whsec_…`). Callers are responsible for stashing it on the
|
|
19
|
+
* credential set (e.g. under `RESEND_WEBHOOK_SIGNING_SECRETS`) so the
|
|
20
|
+
* trigger dispatcher can verify inbound payloads. A higher-level
|
|
21
|
+
* `ensureKeystrokeResendWebhook` helper will land with the triggers
|
|
22
|
+
* module.
|
|
23
|
+
*/
|
|
24
|
+
const webhookEventNameSchema = z.enum(RESEND_WEBHOOK_EVENT_NAMES);
|
|
25
|
+
const webhookEventSelectionSchema = z.union([z.literal("all"), z.array(webhookEventNameSchema).min(1)]);
|
|
26
|
+
const webhookStatusSchema = z.enum(["enabled", "disabled"]);
|
|
27
|
+
const webhookSummarySchema = z.object({
|
|
28
|
+
id: z.string(),
|
|
29
|
+
endpoint_url: z.string(),
|
|
30
|
+
events: z.array(webhookEventNameSchema).optional(),
|
|
31
|
+
status: webhookStatusSchema.optional(),
|
|
32
|
+
created_at: z.string().optional(),
|
|
33
|
+
updated_at: z.string().optional()
|
|
34
|
+
}).passthrough();
|
|
35
|
+
const webhookDetailSchema = webhookSummarySchema.extend({ signing_secret: z.string().regex(/^whsec_/).optional() }).passthrough();
|
|
36
|
+
const listWebhooksResponseSchema = resendListEnvelope(webhookSummarySchema);
|
|
37
|
+
const createWebhook = resendOperation({
|
|
38
|
+
id: "create_resend_webhook",
|
|
39
|
+
name: "Create Resend Webhook",
|
|
40
|
+
description: "Register a webhook endpoint. Response includes the Svix signing secret (whsec_…); store it securely.",
|
|
41
|
+
input: z.object({
|
|
42
|
+
endpoint_url: z.url(),
|
|
43
|
+
events: webhookEventSelectionSchema,
|
|
44
|
+
status: webhookStatusSchema.optional()
|
|
45
|
+
}),
|
|
46
|
+
output: webhookDetailSchema,
|
|
47
|
+
needsApproval: true,
|
|
48
|
+
run: async (input, credentials) => {
|
|
49
|
+
return createResendClient(credentials).request({
|
|
50
|
+
method: "POST",
|
|
51
|
+
path: "/webhooks",
|
|
52
|
+
body: input
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const listWebhooks = resendOperation({
|
|
57
|
+
id: "list_resend_webhooks",
|
|
58
|
+
name: "List Resend Webhooks",
|
|
59
|
+
description: "List registered webhook endpoints.",
|
|
60
|
+
input: paginationQuerySchema,
|
|
61
|
+
output: listWebhooksResponseSchema,
|
|
62
|
+
run: async (input, credentials) => {
|
|
63
|
+
return createResendClient(credentials).request({
|
|
64
|
+
method: "GET",
|
|
65
|
+
path: "/webhooks",
|
|
66
|
+
query: input
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const retrieveWebhook = resendOperation({
|
|
71
|
+
id: "retrieve_resend_webhook",
|
|
72
|
+
name: "Retrieve Resend Webhook",
|
|
73
|
+
description: "Retrieve a webhook endpoint, including its signing secret.",
|
|
74
|
+
input: z.object({ id: z.string().min(1) }),
|
|
75
|
+
output: webhookDetailSchema,
|
|
76
|
+
run: async (input, credentials) => {
|
|
77
|
+
return createResendClient(credentials).request({
|
|
78
|
+
method: "GET",
|
|
79
|
+
path: `/webhooks/${encodeURIComponent(input.id)}`
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
const updateWebhook = resendOperation({
|
|
84
|
+
id: "update_resend_webhook",
|
|
85
|
+
name: "Update Resend Webhook",
|
|
86
|
+
description: "Update a webhook endpoint. Does NOT rotate the signing secret — cutover via create+delete for rotation.",
|
|
87
|
+
input: z.object({
|
|
88
|
+
id: z.string().min(1),
|
|
89
|
+
endpoint_url: z.url().optional(),
|
|
90
|
+
events: webhookEventSelectionSchema.optional(),
|
|
91
|
+
status: webhookStatusSchema.optional()
|
|
92
|
+
}),
|
|
93
|
+
output: webhookDetailSchema,
|
|
94
|
+
needsApproval: true,
|
|
95
|
+
run: async (input, credentials) => {
|
|
96
|
+
const { id, ...body } = input;
|
|
97
|
+
return createResendClient(credentials).request({
|
|
98
|
+
method: "PATCH",
|
|
99
|
+
path: `/webhooks/${encodeURIComponent(id)}`,
|
|
100
|
+
body
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const deleteWebhook = resendOperation({
|
|
105
|
+
id: "delete_resend_webhook",
|
|
106
|
+
name: "Delete Resend Webhook",
|
|
107
|
+
description: "Delete a webhook endpoint.",
|
|
108
|
+
input: z.object({ id: z.string().min(1) }),
|
|
109
|
+
output: z.object({
|
|
110
|
+
object: z.literal("webhook").optional(),
|
|
111
|
+
id: z.string(),
|
|
112
|
+
deleted: z.boolean().optional()
|
|
113
|
+
}).passthrough(),
|
|
114
|
+
needsApproval: true,
|
|
115
|
+
run: async (input, credentials) => {
|
|
116
|
+
return createResendClient(credentials).request({
|
|
117
|
+
method: "DELETE",
|
|
118
|
+
path: `/webhooks/${encodeURIComponent(input.id)}`
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
//#endregion
|
|
124
|
+
export { createWebhook, deleteWebhook, listWebhooks, retrieveWebhook, updateWebhook };
|
package/package.json
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@keystrokehq/resend",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.mts",
|
|
10
|
+
"default": "./dist/index.mjs"
|
|
11
|
+
},
|
|
12
|
+
"./connection": {
|
|
13
|
+
"types": "./dist/connection.d.mts",
|
|
14
|
+
"default": "./dist/connection.mjs"
|
|
15
|
+
},
|
|
16
|
+
"./client": {
|
|
17
|
+
"types": "./dist/client.d.mts",
|
|
18
|
+
"default": "./dist/client.mjs"
|
|
19
|
+
},
|
|
20
|
+
"./schemas": {
|
|
21
|
+
"types": "./dist/schemas.d.mts",
|
|
22
|
+
"default": "./dist/schemas.mjs"
|
|
23
|
+
},
|
|
24
|
+
"./_official": {
|
|
25
|
+
"types": "./dist/_official/index.d.mts",
|
|
26
|
+
"default": "./dist/_official/index.mjs"
|
|
27
|
+
},
|
|
28
|
+
"./events": {
|
|
29
|
+
"types": "./dist/events.d.mts",
|
|
30
|
+
"default": "./dist/events.mjs"
|
|
31
|
+
},
|
|
32
|
+
"./triggers": {
|
|
33
|
+
"types": "./dist/triggers.d.mts",
|
|
34
|
+
"default": "./dist/triggers.mjs"
|
|
35
|
+
},
|
|
36
|
+
"./verification": {
|
|
37
|
+
"types": "./dist/verification.d.mts",
|
|
38
|
+
"default": "./dist/verification.mjs"
|
|
39
|
+
},
|
|
40
|
+
"./emails": {
|
|
41
|
+
"types": "./dist/emails.d.mts",
|
|
42
|
+
"default": "./dist/emails.mjs"
|
|
43
|
+
},
|
|
44
|
+
"./emails-receiving": {
|
|
45
|
+
"types": "./dist/emails-receiving.d.mts",
|
|
46
|
+
"default": "./dist/emails-receiving.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./templates": {
|
|
49
|
+
"types": "./dist/templates.d.mts",
|
|
50
|
+
"default": "./dist/templates.mjs"
|
|
51
|
+
},
|
|
52
|
+
"./broadcasts": {
|
|
53
|
+
"types": "./dist/broadcasts.d.mts",
|
|
54
|
+
"default": "./dist/broadcasts.mjs"
|
|
55
|
+
},
|
|
56
|
+
"./contacts": {
|
|
57
|
+
"types": "./dist/contacts.d.mts",
|
|
58
|
+
"default": "./dist/contacts.mjs"
|
|
59
|
+
},
|
|
60
|
+
"./contact-properties": {
|
|
61
|
+
"types": "./dist/contact-properties.d.mts",
|
|
62
|
+
"default": "./dist/contact-properties.mjs"
|
|
63
|
+
},
|
|
64
|
+
"./segments": {
|
|
65
|
+
"types": "./dist/segments.d.mts",
|
|
66
|
+
"default": "./dist/segments.mjs"
|
|
67
|
+
},
|
|
68
|
+
"./topics": {
|
|
69
|
+
"types": "./dist/topics.d.mts",
|
|
70
|
+
"default": "./dist/topics.mjs"
|
|
71
|
+
},
|
|
72
|
+
"./domains": {
|
|
73
|
+
"types": "./dist/domains.d.mts",
|
|
74
|
+
"default": "./dist/domains.mjs"
|
|
75
|
+
},
|
|
76
|
+
"./api-keys": {
|
|
77
|
+
"types": "./dist/api-keys.d.mts",
|
|
78
|
+
"default": "./dist/api-keys.mjs"
|
|
79
|
+
},
|
|
80
|
+
"./webhooks": {
|
|
81
|
+
"types": "./dist/webhooks.d.mts",
|
|
82
|
+
"default": "./dist/webhooks.mjs"
|
|
83
|
+
},
|
|
84
|
+
"./logs": {
|
|
85
|
+
"types": "./dist/logs.d.mts",
|
|
86
|
+
"default": "./dist/logs.mjs"
|
|
87
|
+
},
|
|
88
|
+
"./_runtime": {
|
|
89
|
+
"types": "./dist/_runtime/index.d.mts",
|
|
90
|
+
"default": "./dist/_runtime/index.mjs"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"files": [
|
|
94
|
+
"dist",
|
|
95
|
+
"README.md",
|
|
96
|
+
"LICENSE"
|
|
97
|
+
],
|
|
98
|
+
"scripts": {
|
|
99
|
+
"typecheck": "tsgo --build",
|
|
100
|
+
"build": "tsdown",
|
|
101
|
+
"lint": "biome check .",
|
|
102
|
+
"test:unit": "vitest run --passWithNoTests --project unit",
|
|
103
|
+
"prepublishOnly": "pnpm build && pnpm test:unit",
|
|
104
|
+
"lint:fix": "biome check --write .",
|
|
105
|
+
"test:int": "vitest run --passWithNoTests --project int"
|
|
106
|
+
},
|
|
107
|
+
"dependencies": {
|
|
108
|
+
"@keystrokehq/integration-authoring": "^0.0.1",
|
|
109
|
+
"@keystrokehq/core": "^0.0.5",
|
|
110
|
+
"zod": "^4.3.6"
|
|
111
|
+
},
|
|
112
|
+
"devDependencies": {
|
|
113
|
+
"@types/node": "catalog:",
|
|
114
|
+
"@keystrokehq/test-utils": "workspace:*",
|
|
115
|
+
"@keystrokehq/typescript-config": "workspace:*",
|
|
116
|
+
"tsdown": "catalog:",
|
|
117
|
+
"typescript": "catalog:",
|
|
118
|
+
"vitest": "catalog:"
|
|
119
|
+
},
|
|
120
|
+
"keywords": [
|
|
121
|
+
"resend",
|
|
122
|
+
"email",
|
|
123
|
+
"transactional-email",
|
|
124
|
+
"keystroke",
|
|
125
|
+
"integration"
|
|
126
|
+
],
|
|
127
|
+
"repository": {
|
|
128
|
+
"type": "git",
|
|
129
|
+
"url": "https://github.com/keystrokehq/integrations",
|
|
130
|
+
"directory": "integrations/resend"
|
|
131
|
+
},
|
|
132
|
+
"license": "MIT",
|
|
133
|
+
"publishConfig": {
|
|
134
|
+
"access": "public",
|
|
135
|
+
"registry": "https://registry.npmjs.org/"
|
|
136
|
+
}
|
|
137
|
+
}
|