@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,178 @@
|
|
|
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/broadcasts.ts
|
|
7
|
+
/**
|
|
8
|
+
* resend/broadcasts.ts
|
|
9
|
+
*
|
|
10
|
+
* Operations backing the Resend `/broadcasts` endpoints.
|
|
11
|
+
* PLAN.md § 6.5: 6 operations (create, list, get, update, send, delete).
|
|
12
|
+
*
|
|
13
|
+
* Broadcasts send against a Segment (or legacy Audience) and support an
|
|
14
|
+
* optional `scheduled_at`. The public API exposes the draft → send
|
|
15
|
+
* lifecycle; preview and test-send live in the dashboard, not the API.
|
|
16
|
+
*/
|
|
17
|
+
const broadcastStatusSchema = z.enum([
|
|
18
|
+
"draft",
|
|
19
|
+
"scheduled",
|
|
20
|
+
"queued",
|
|
21
|
+
"sending",
|
|
22
|
+
"sent",
|
|
23
|
+
"cancelled",
|
|
24
|
+
"failed"
|
|
25
|
+
]).or(z.string());
|
|
26
|
+
const broadcastSummarySchema = z.object({
|
|
27
|
+
id: z.string(),
|
|
28
|
+
name: z.string().optional(),
|
|
29
|
+
status: broadcastStatusSchema.optional(),
|
|
30
|
+
audience_id: z.string().optional().nullable(),
|
|
31
|
+
segment_id: z.string().optional().nullable(),
|
|
32
|
+
created_at: z.string().optional(),
|
|
33
|
+
updated_at: z.string().optional(),
|
|
34
|
+
scheduled_at: z.string().optional().nullable(),
|
|
35
|
+
sent_at: z.string().optional().nullable()
|
|
36
|
+
}).passthrough();
|
|
37
|
+
const broadcastDetailSchema = broadcastSummarySchema.extend({
|
|
38
|
+
from: z.string().optional(),
|
|
39
|
+
subject: z.string().optional(),
|
|
40
|
+
reply_to: z.union([z.string(), z.array(z.string())]).optional(),
|
|
41
|
+
preview_text: z.string().optional().nullable(),
|
|
42
|
+
html: z.string().optional().nullable(),
|
|
43
|
+
text: z.string().optional().nullable()
|
|
44
|
+
}).passthrough();
|
|
45
|
+
const listBroadcastsResponseSchema = resendListEnvelope(broadcastSummarySchema);
|
|
46
|
+
const broadcastCreateInputSchema = z.object({
|
|
47
|
+
name: z.string().optional(),
|
|
48
|
+
from: z.string().optional(),
|
|
49
|
+
subject: z.string().optional(),
|
|
50
|
+
reply_to: z.union([z.string(), z.array(z.string())]).optional(),
|
|
51
|
+
preview_text: z.string().optional(),
|
|
52
|
+
html: z.string().optional(),
|
|
53
|
+
text: z.string().optional(),
|
|
54
|
+
template: z.object({
|
|
55
|
+
id: z.string().min(1),
|
|
56
|
+
variables: z.record(z.string(), z.union([z.string(), z.number()])).optional()
|
|
57
|
+
}).optional(),
|
|
58
|
+
audience_id: z.string().optional(),
|
|
59
|
+
segment_id: z.string().optional(),
|
|
60
|
+
scheduled_at: z.string().optional()
|
|
61
|
+
}).refine((b) => b.audience_id !== void 0 || b.segment_id !== void 0, { message: "Broadcast requires either `segment_id` or `audience_id`." });
|
|
62
|
+
const createBroadcast = resendOperation({
|
|
63
|
+
id: "create_resend_broadcast",
|
|
64
|
+
name: "Create Resend Broadcast",
|
|
65
|
+
description: "Create a draft broadcast targeting a segment (or legacy audience).",
|
|
66
|
+
input: broadcastCreateInputSchema,
|
|
67
|
+
output: broadcastDetailSchema,
|
|
68
|
+
needsApproval: true,
|
|
69
|
+
run: async (input, credentials) => {
|
|
70
|
+
return createResendClient(credentials).request({
|
|
71
|
+
method: "POST",
|
|
72
|
+
path: "/broadcasts",
|
|
73
|
+
body: input
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const listBroadcasts = resendOperation({
|
|
78
|
+
id: "list_resend_broadcasts",
|
|
79
|
+
name: "List Resend Broadcasts",
|
|
80
|
+
description: "List broadcasts, optionally cursor-paginated.",
|
|
81
|
+
input: paginationQuerySchema,
|
|
82
|
+
output: listBroadcastsResponseSchema,
|
|
83
|
+
run: async (input, credentials) => {
|
|
84
|
+
return createResendClient(credentials).request({
|
|
85
|
+
method: "GET",
|
|
86
|
+
path: "/broadcasts",
|
|
87
|
+
query: input
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
const retrieveBroadcast = resendOperation({
|
|
92
|
+
id: "retrieve_resend_broadcast",
|
|
93
|
+
name: "Retrieve Resend Broadcast",
|
|
94
|
+
description: "Retrieve a single broadcast by id.",
|
|
95
|
+
input: z.object({ id: z.string().min(1) }),
|
|
96
|
+
output: broadcastDetailSchema,
|
|
97
|
+
run: async (input, credentials) => {
|
|
98
|
+
return createResendClient(credentials).request({
|
|
99
|
+
method: "GET",
|
|
100
|
+
path: `/broadcasts/${encodeURIComponent(input.id)}`
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const updateBroadcast = resendOperation({
|
|
105
|
+
id: "update_resend_broadcast",
|
|
106
|
+
name: "Update Resend Broadcast",
|
|
107
|
+
description: "Update a draft broadcast. Ignored once the broadcast has started sending.",
|
|
108
|
+
input: z.object({
|
|
109
|
+
id: z.string().min(1),
|
|
110
|
+
name: z.string().optional(),
|
|
111
|
+
from: z.string().optional(),
|
|
112
|
+
subject: z.string().optional(),
|
|
113
|
+
reply_to: z.union([z.string(), z.array(z.string())]).optional(),
|
|
114
|
+
preview_text: z.string().optional(),
|
|
115
|
+
html: z.string().optional(),
|
|
116
|
+
text: z.string().optional(),
|
|
117
|
+
template: z.object({
|
|
118
|
+
id: z.string().min(1),
|
|
119
|
+
variables: z.record(z.string(), z.union([z.string(), z.number()])).optional()
|
|
120
|
+
}).optional(),
|
|
121
|
+
segment_id: z.string().optional(),
|
|
122
|
+
audience_id: z.string().optional(),
|
|
123
|
+
scheduled_at: z.string().optional()
|
|
124
|
+
}),
|
|
125
|
+
output: broadcastDetailSchema,
|
|
126
|
+
needsApproval: true,
|
|
127
|
+
run: async (input, credentials) => {
|
|
128
|
+
const { id, ...body } = input;
|
|
129
|
+
return createResendClient(credentials).request({
|
|
130
|
+
method: "PATCH",
|
|
131
|
+
path: `/broadcasts/${encodeURIComponent(id)}`,
|
|
132
|
+
body
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const sendBroadcast = resendOperation({
|
|
137
|
+
id: "send_resend_broadcast",
|
|
138
|
+
name: "Send Resend Broadcast",
|
|
139
|
+
description: "Start sending a draft broadcast. Optionally schedule it for later.",
|
|
140
|
+
input: z.object({
|
|
141
|
+
id: z.string().min(1),
|
|
142
|
+
scheduled_at: z.string().min(1).optional()
|
|
143
|
+
}),
|
|
144
|
+
output: z.object({
|
|
145
|
+
id: z.string(),
|
|
146
|
+
object: z.literal("broadcast").optional()
|
|
147
|
+
}).passthrough(),
|
|
148
|
+
needsApproval: true,
|
|
149
|
+
run: async (input, credentials) => {
|
|
150
|
+
const { id, scheduled_at } = input;
|
|
151
|
+
return createResendClient(credentials).request({
|
|
152
|
+
method: "POST",
|
|
153
|
+
path: `/broadcasts/${encodeURIComponent(id)}/send`,
|
|
154
|
+
...scheduled_at ? { body: { scheduled_at } } : {}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
const deleteBroadcast = resendOperation({
|
|
159
|
+
id: "delete_resend_broadcast",
|
|
160
|
+
name: "Delete Resend Broadcast",
|
|
161
|
+
description: "Delete a broadcast.",
|
|
162
|
+
input: z.object({ id: z.string().min(1) }),
|
|
163
|
+
output: z.object({
|
|
164
|
+
object: z.literal("broadcast").optional(),
|
|
165
|
+
id: z.string(),
|
|
166
|
+
deleted: z.boolean().optional()
|
|
167
|
+
}).passthrough(),
|
|
168
|
+
needsApproval: true,
|
|
169
|
+
run: async (input, credentials) => {
|
|
170
|
+
return createResendClient(credentials).request({
|
|
171
|
+
method: "DELETE",
|
|
172
|
+
path: `/broadcasts/${encodeURIComponent(input.id)}`
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
//#endregion
|
|
178
|
+
export { createBroadcast, deleteBroadcast, listBroadcasts, retrieveBroadcast, sendBroadcast, updateBroadcast };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { t as ResendCredentials } from "./integration-ClH0F7x-.mjs";
|
|
2
|
+
import { JsonRestClient, JsonRestRequestOptions } from "@keystrokehq/integration-authoring/http";
|
|
3
|
+
|
|
4
|
+
//#region src/client.d.ts
|
|
5
|
+
declare const RESEND_BASE_URL = "https://api.resend.com";
|
|
6
|
+
/** User-Agent Resend sees on every request. Stable across minor releases. */
|
|
7
|
+
declare const RESEND_USER_AGENT = "keystroke-integration-resend/0.0.0";
|
|
8
|
+
type ResendClient = JsonRestClient;
|
|
9
|
+
type ResendRequestOptions = JsonRestRequestOptions;
|
|
10
|
+
interface CreateResendClientOptions {
|
|
11
|
+
/** Override the global `fetch`. Primarily for tests. */
|
|
12
|
+
readonly fetchImpl?: typeof fetch;
|
|
13
|
+
/** Override the base URL. Primarily for tests. */
|
|
14
|
+
readonly baseUrl?: string;
|
|
15
|
+
/** Override the default User-Agent. Primarily for tests. */
|
|
16
|
+
readonly userAgent?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a Resend API client from resolved credentials.
|
|
20
|
+
*
|
|
21
|
+
* @param credentials - Resolved credentials containing `RESEND_API_KEY`.
|
|
22
|
+
* @param options - Optional overrides (primarily for testing).
|
|
23
|
+
* @returns A client with a typed `request` method.
|
|
24
|
+
*/
|
|
25
|
+
declare function createResendClient(credentials: ResendCredentials, options?: CreateResendClientOptions): ResendClient;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { CreateResendClientOptions, RESEND_BASE_URL, RESEND_USER_AGENT, ResendClient, ResendRequestOptions, createResendClient };
|
package/dist/client.mjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createJsonRestClient } from "@keystrokehq/integration-authoring/http";
|
|
2
|
+
|
|
3
|
+
//#region src/client.ts
|
|
4
|
+
/**
|
|
5
|
+
* resend/client.ts
|
|
6
|
+
*
|
|
7
|
+
* Thin wrapper over the shared `createJsonRestClient` helper configured
|
|
8
|
+
* for the Resend API.
|
|
9
|
+
*
|
|
10
|
+
* Resend-specific notes:
|
|
11
|
+
* - Base URL is `https://api.resend.com` (no version prefix).
|
|
12
|
+
* - Auth is `Authorization: Bearer re_…`.
|
|
13
|
+
* - A `User-Agent` header is *mandatory*: missing UA = HTTP 403 with
|
|
14
|
+
* error code 1010. Always attach one.
|
|
15
|
+
* - `POST /emails` and `POST /emails/batch` honour an optional
|
|
16
|
+
* `Idempotency-Key` header (24h TTL, ≤256 chars). Pass it via
|
|
17
|
+
* `request({ headers: { 'Idempotency-Key': key } })`.
|
|
18
|
+
*/
|
|
19
|
+
const RESEND_BASE_URL = "https://api.resend.com";
|
|
20
|
+
/** User-Agent Resend sees on every request. Stable across minor releases. */
|
|
21
|
+
const RESEND_USER_AGENT = "keystroke-integration-resend/0.0.0";
|
|
22
|
+
/**
|
|
23
|
+
* Create a Resend API client from resolved credentials.
|
|
24
|
+
*
|
|
25
|
+
* @param credentials - Resolved credentials containing `RESEND_API_KEY`.
|
|
26
|
+
* @param options - Optional overrides (primarily for testing).
|
|
27
|
+
* @returns A client with a typed `request` method.
|
|
28
|
+
*/
|
|
29
|
+
function createResendClient(credentials, options = {}) {
|
|
30
|
+
return createJsonRestClient({
|
|
31
|
+
baseUrl: options.baseUrl ?? RESEND_BASE_URL,
|
|
32
|
+
errorPrefix: "Resend API error",
|
|
33
|
+
authHeaders: () => ({ Authorization: `Bearer ${credentials.RESEND_API_KEY}` }),
|
|
34
|
+
defaultHeaders: { "User-Agent": options.userAgent ?? RESEND_USER_AGENT },
|
|
35
|
+
...options.fetchImpl ? { fetchImpl: options.fetchImpl } : {}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { RESEND_BASE_URL, RESEND_USER_AGENT, createResendClient };
|
|
@@ -0,0 +1,139 @@
|
|
|
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/contact-properties.d.ts
|
|
6
|
+
declare const contactPropertyTypeSchema: z.ZodEnum<{
|
|
7
|
+
string: "string";
|
|
8
|
+
number: "number";
|
|
9
|
+
boolean: "boolean";
|
|
10
|
+
date: "date";
|
|
11
|
+
}>;
|
|
12
|
+
declare const contactPropertySchema: z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
key: z.ZodString;
|
|
15
|
+
type: z.ZodEnum<{
|
|
16
|
+
string: "string";
|
|
17
|
+
number: "number";
|
|
18
|
+
boolean: "boolean";
|
|
19
|
+
date: "date";
|
|
20
|
+
}>;
|
|
21
|
+
label: z.ZodOptional<z.ZodString>;
|
|
22
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
23
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$loose>;
|
|
25
|
+
declare const createContactProperty: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
26
|
+
key: z.ZodString;
|
|
27
|
+
type: z.ZodEnum<{
|
|
28
|
+
string: "string";
|
|
29
|
+
number: "number";
|
|
30
|
+
boolean: "boolean";
|
|
31
|
+
date: "date";
|
|
32
|
+
}>;
|
|
33
|
+
label: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
key: z.ZodString;
|
|
37
|
+
type: z.ZodEnum<{
|
|
38
|
+
string: "string";
|
|
39
|
+
number: "number";
|
|
40
|
+
boolean: "boolean";
|
|
41
|
+
date: "date";
|
|
42
|
+
}>;
|
|
43
|
+
label: z.ZodOptional<z.ZodString>;
|
|
44
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
45
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
47
|
+
RESEND_API_KEY: z.ZodString;
|
|
48
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
49
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
50
|
+
RESEND_API_KEY: z.ZodString;
|
|
51
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
52
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
53
|
+
declare const listContactProperties: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
54
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
after: z.ZodOptional<z.ZodString>;
|
|
56
|
+
before: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
object: z.ZodLiteral<"list">;
|
|
59
|
+
has_more: z.ZodBoolean;
|
|
60
|
+
data: z.ZodArray<z.ZodObject<{
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
key: z.ZodString;
|
|
63
|
+
type: z.ZodEnum<{
|
|
64
|
+
string: "string";
|
|
65
|
+
number: "number";
|
|
66
|
+
boolean: "boolean";
|
|
67
|
+
date: "date";
|
|
68
|
+
}>;
|
|
69
|
+
label: z.ZodOptional<z.ZodString>;
|
|
70
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
71
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, z.core.$loose>>;
|
|
73
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
74
|
+
RESEND_API_KEY: z.ZodString;
|
|
75
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
76
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
77
|
+
RESEND_API_KEY: z.ZodString;
|
|
78
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
79
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
80
|
+
declare const retrieveContactProperty: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
81
|
+
id: z.ZodString;
|
|
82
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
key: z.ZodString;
|
|
85
|
+
type: z.ZodEnum<{
|
|
86
|
+
string: "string";
|
|
87
|
+
number: "number";
|
|
88
|
+
boolean: "boolean";
|
|
89
|
+
date: "date";
|
|
90
|
+
}>;
|
|
91
|
+
label: z.ZodOptional<z.ZodString>;
|
|
92
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
93
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
95
|
+
RESEND_API_KEY: z.ZodString;
|
|
96
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
97
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
98
|
+
RESEND_API_KEY: z.ZodString;
|
|
99
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
100
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
101
|
+
declare const updateContactProperty: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
label: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
105
|
+
id: z.ZodString;
|
|
106
|
+
key: z.ZodString;
|
|
107
|
+
type: z.ZodEnum<{
|
|
108
|
+
string: "string";
|
|
109
|
+
number: "number";
|
|
110
|
+
boolean: "boolean";
|
|
111
|
+
date: "date";
|
|
112
|
+
}>;
|
|
113
|
+
label: z.ZodOptional<z.ZodString>;
|
|
114
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
115
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
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
|
+
declare const deleteContactProperty: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
124
|
+
id: z.ZodString;
|
|
125
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
126
|
+
object: z.ZodOptional<z.ZodLiteral<"contact_property">>;
|
|
127
|
+
id: z.ZodString;
|
|
128
|
+
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
129
|
+
}, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", 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>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
133
|
+
RESEND_API_KEY: z.ZodString;
|
|
134
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
135
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
136
|
+
type ResendContactProperty = z.infer<typeof contactPropertySchema>;
|
|
137
|
+
type ResendContactPropertyType = z.infer<typeof contactPropertyTypeSchema>;
|
|
138
|
+
//#endregion
|
|
139
|
+
export { ResendContactProperty, ResendContactPropertyType, createContactProperty, deleteContactProperty, listContactProperties, retrieveContactProperty, updateContactProperty };
|
|
@@ -0,0 +1,115 @@
|
|
|
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/contact-properties.ts
|
|
7
|
+
/**
|
|
8
|
+
* resend/contact-properties.ts
|
|
9
|
+
*
|
|
10
|
+
* Operations backing the Resend `/contact-properties` endpoints.
|
|
11
|
+
* PLAN.md § 6.7: 5 operations.
|
|
12
|
+
*
|
|
13
|
+
* Contact properties are typed custom fields on contacts.
|
|
14
|
+
*/
|
|
15
|
+
const contactPropertyTypeSchema = z.enum([
|
|
16
|
+
"string",
|
|
17
|
+
"number",
|
|
18
|
+
"boolean",
|
|
19
|
+
"date"
|
|
20
|
+
]);
|
|
21
|
+
const contactPropertySchema = z.object({
|
|
22
|
+
id: z.string(),
|
|
23
|
+
key: z.string(),
|
|
24
|
+
type: contactPropertyTypeSchema,
|
|
25
|
+
label: z.string().optional(),
|
|
26
|
+
created_at: z.string().optional(),
|
|
27
|
+
updated_at: z.string().optional()
|
|
28
|
+
}).passthrough();
|
|
29
|
+
const listContactPropertiesResponseSchema = resendListEnvelope(contactPropertySchema);
|
|
30
|
+
const createContactProperty = resendOperation({
|
|
31
|
+
id: "create_resend_contact_property",
|
|
32
|
+
name: "Create Resend Contact Property",
|
|
33
|
+
description: "Create a custom contact property.",
|
|
34
|
+
input: z.object({
|
|
35
|
+
key: z.string().min(1).regex(/^[a-z0-9_]+$/, "Keys use a-z, 0-9, underscore."),
|
|
36
|
+
type: contactPropertyTypeSchema,
|
|
37
|
+
label: z.string().optional()
|
|
38
|
+
}),
|
|
39
|
+
output: contactPropertySchema,
|
|
40
|
+
needsApproval: true,
|
|
41
|
+
run: async (input, credentials) => {
|
|
42
|
+
return createResendClient(credentials).request({
|
|
43
|
+
method: "POST",
|
|
44
|
+
path: "/contact-properties",
|
|
45
|
+
body: input
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const listContactProperties = resendOperation({
|
|
50
|
+
id: "list_resend_contact_properties",
|
|
51
|
+
name: "List Resend Contact Properties",
|
|
52
|
+
description: "List all custom contact properties.",
|
|
53
|
+
input: paginationQuerySchema,
|
|
54
|
+
output: listContactPropertiesResponseSchema,
|
|
55
|
+
run: async (input, credentials) => {
|
|
56
|
+
return createResendClient(credentials).request({
|
|
57
|
+
method: "GET",
|
|
58
|
+
path: "/contact-properties",
|
|
59
|
+
query: input
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const retrieveContactProperty = resendOperation({
|
|
64
|
+
id: "retrieve_resend_contact_property",
|
|
65
|
+
name: "Retrieve Resend Contact Property",
|
|
66
|
+
description: "Retrieve a single contact property by id.",
|
|
67
|
+
input: z.object({ id: z.string().min(1) }),
|
|
68
|
+
output: contactPropertySchema,
|
|
69
|
+
run: async (input, credentials) => {
|
|
70
|
+
return createResendClient(credentials).request({
|
|
71
|
+
method: "GET",
|
|
72
|
+
path: `/contact-properties/${encodeURIComponent(input.id)}`
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const updateContactProperty = resendOperation({
|
|
77
|
+
id: "update_resend_contact_property",
|
|
78
|
+
name: "Update Resend Contact Property",
|
|
79
|
+
description: "Update a contact property (label only; key and type are immutable).",
|
|
80
|
+
input: z.object({
|
|
81
|
+
id: z.string().min(1),
|
|
82
|
+
label: z.string().optional()
|
|
83
|
+
}),
|
|
84
|
+
output: contactPropertySchema,
|
|
85
|
+
needsApproval: true,
|
|
86
|
+
run: async (input, credentials) => {
|
|
87
|
+
const { id, ...body } = input;
|
|
88
|
+
return createResendClient(credentials).request({
|
|
89
|
+
method: "PATCH",
|
|
90
|
+
path: `/contact-properties/${encodeURIComponent(id)}`,
|
|
91
|
+
body
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const deleteContactProperty = resendOperation({
|
|
96
|
+
id: "delete_resend_contact_property",
|
|
97
|
+
name: "Delete Resend Contact Property",
|
|
98
|
+
description: "Delete a contact property.",
|
|
99
|
+
input: z.object({ id: z.string().min(1) }),
|
|
100
|
+
output: z.object({
|
|
101
|
+
object: z.literal("contact_property").optional(),
|
|
102
|
+
id: z.string(),
|
|
103
|
+
deleted: z.boolean().optional()
|
|
104
|
+
}).passthrough(),
|
|
105
|
+
needsApproval: true,
|
|
106
|
+
run: async (input, credentials) => {
|
|
107
|
+
return createResendClient(credentials).request({
|
|
108
|
+
method: "DELETE",
|
|
109
|
+
path: `/contact-properties/${encodeURIComponent(input.id)}`
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
export { createContactProperty, deleteContactProperty, listContactProperties, retrieveContactProperty, updateContactProperty };
|