@agentisend/sdk-node 0.4.0 → 0.5.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/dist/client.d.ts +204 -22
- package/dist/client.js +139 -14
- package/dist/client.js.map +1 -1
- package/dist/compat-resend.d.ts +12 -9
- package/dist/compat-resend.js +91 -9
- package/dist/compat-resend.js.map +1 -1
- package/dist/types.d.ts +153 -12
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -2
package/dist/types.d.ts
CHANGED
|
@@ -16,7 +16,11 @@ export interface Attachment {
|
|
|
16
16
|
content_id?: string;
|
|
17
17
|
}
|
|
18
18
|
export interface SendEmailPayload {
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Required unless `template_id` or `template` names a published template
|
|
21
|
+
* with a default sender. A `from` here overrides the template's.
|
|
22
|
+
*/
|
|
23
|
+
from?: string;
|
|
20
24
|
to: AddressList;
|
|
21
25
|
/** Required unless `template_id` or `template` names a published template with a subject. */
|
|
22
26
|
subject?: string;
|
|
@@ -44,10 +48,10 @@ export interface SendEmailPayload {
|
|
|
44
48
|
topic_id?: string;
|
|
45
49
|
/** Resend Node SDK name for `topic_id`. */
|
|
46
50
|
topicId?: string;
|
|
47
|
-
/**
|
|
51
|
+
/** Id or alias of a published template to render, instead of html or text. */
|
|
48
52
|
template_id?: string;
|
|
49
53
|
template_values?: Record<string, unknown>;
|
|
50
|
-
/** Resend's send shape: `{id, variables}`
|
|
54
|
+
/** Resend's send shape: `{id, variables}`; `id` is the template's id or its alias. */
|
|
51
55
|
template?: {
|
|
52
56
|
id: string;
|
|
53
57
|
variables?: Record<string, string | number>;
|
|
@@ -55,6 +59,34 @@ export interface SendEmailPayload {
|
|
|
55
59
|
/** When a held send stops waiting for a person. At most 7 days ahead. */
|
|
56
60
|
expires_at?: string;
|
|
57
61
|
}
|
|
62
|
+
/** A template variable as Resend writes it: a key, a type, and an optional fallback. */
|
|
63
|
+
export interface TemplateVariableInput {
|
|
64
|
+
key: string;
|
|
65
|
+
type: 'string' | 'number' | 'boolean';
|
|
66
|
+
/** With no fallback the variable is required when sending. */
|
|
67
|
+
fallback_value?: string | number | boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* POST /templates. Send `html` the way Resend does, or `content` for markdown
|
|
71
|
+
* and blocks. `variables` take Resend's `{key, type, fallback_value}` or the
|
|
72
|
+
* native `{name, type, required, default}`.
|
|
73
|
+
*/
|
|
74
|
+
export interface TemplateCreatePayload {
|
|
75
|
+
name: string;
|
|
76
|
+
/** Unique on the account. Use it wherever a template id is taken. */
|
|
77
|
+
alias?: string;
|
|
78
|
+
/** Default sender, such as `Acme <hello@acme.com>`. A send's own `from` overrides it. */
|
|
79
|
+
from?: string;
|
|
80
|
+
subject?: string;
|
|
81
|
+
/** Default Reply-To. A send's own `reply_to` overrides it. */
|
|
82
|
+
reply_to?: string | string[];
|
|
83
|
+
html?: string;
|
|
84
|
+
/** Native body: `{mode: 'markdown' | 'html', source}` or `{mode: 'block', blocks}`. */
|
|
85
|
+
content?: unknown;
|
|
86
|
+
/** Plain-text part. Left out, one is made from the HTML; `''` sends no text part. */
|
|
87
|
+
text?: string;
|
|
88
|
+
variables?: Array<TemplateVariableInput | Record<string, unknown>>;
|
|
89
|
+
}
|
|
58
90
|
export type MessageStatus = 'queued' | 'scheduled' | 'sent' | 'delivered' | 'delivery_delayed' | 'bounced' | 'complained' | 'opened' | 'clicked' | 'failed' | 'canceled' | 'suppressed';
|
|
59
91
|
export interface AttachmentView {
|
|
60
92
|
filename: string;
|
|
@@ -109,14 +141,59 @@ export interface ListQuery {
|
|
|
109
141
|
/** Resend's previous-page cursor. Mutually exclusive with cursor/after. */
|
|
110
142
|
before?: string;
|
|
111
143
|
}
|
|
112
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* GET /metrics and GET /emails/metrics (W4.10).
|
|
146
|
+
*
|
|
147
|
+
* `since` and `until` (and `group_by`, `event`, `domain`, `api_key_id` on the
|
|
148
|
+
* route) select this API's own shape. `start_date`, `end_date` and the rest
|
|
149
|
+
* select Resend's: totals, or rows broken down by `dimensions`.
|
|
150
|
+
*/
|
|
113
151
|
export interface MetricsQuery {
|
|
114
152
|
since?: string;
|
|
115
153
|
until?: string;
|
|
116
|
-
/**
|
|
154
|
+
/** The start of the range: an ISO 8601 date or datetime. Defaults to 6 days before `end_date`. */
|
|
117
155
|
start_date?: string;
|
|
118
|
-
/**
|
|
156
|
+
/** The end of the range. A date covers that whole day. A future value is clamped to now. */
|
|
119
157
|
end_date?: string;
|
|
158
|
+
/** IANA timezone that buckets periods when `period` is a dimension. Default UTC. */
|
|
159
|
+
timezone?: string;
|
|
160
|
+
/** Bucket size when `period` is a dimension. Default daily. At most 10,000 periods. */
|
|
161
|
+
granularity?: 'hourly' | 'daily' | 'weekly' | 'monthly';
|
|
162
|
+
/** Metrics to return (a list, or a comma-separated string). Omit for all. */
|
|
163
|
+
metrics?: string | string[];
|
|
164
|
+
/** Any of period, domain, email, broadcast. `email` cannot be combined with `broadcast`. */
|
|
165
|
+
dimensions?: string | string[];
|
|
166
|
+
/** Up to 100 sending domain ids. */
|
|
167
|
+
domain_id?: string | string[];
|
|
168
|
+
/** Up to 100 email ids. Not with the broadcast dimension or `broadcast_id`. */
|
|
169
|
+
email_id?: string | string[];
|
|
170
|
+
/** Up to 100 broadcast ids. Not with the email dimension or `email_id`. */
|
|
171
|
+
broadcast_id?: string | string[];
|
|
172
|
+
}
|
|
173
|
+
/** GET /broadcasts/{id}/recipients (Resend: list-broadcast-recipients). */
|
|
174
|
+
export interface BroadcastRecipientsQuery {
|
|
175
|
+
type: 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | 'unsubscribed' | 'suppressed';
|
|
176
|
+
/** Keep recipients whose email contains this value. */
|
|
177
|
+
email?: string;
|
|
178
|
+
/** Only with `type: 'bounced'`. */
|
|
179
|
+
bounce_type?: 'permanent' | 'transient' | 'undetermined';
|
|
180
|
+
/** 1 to 100. Default 20. */
|
|
181
|
+
limit?: number;
|
|
182
|
+
after?: string;
|
|
183
|
+
before?: string;
|
|
184
|
+
}
|
|
185
|
+
/** GET /broadcasts/{id}/clicked-links (Resend: list-broadcast-clicked-links). */
|
|
186
|
+
export interface BroadcastClickedLinksQuery {
|
|
187
|
+
/** 1 to 100. Default 20. */
|
|
188
|
+
limit?: number;
|
|
189
|
+
after?: string;
|
|
190
|
+
before?: string;
|
|
191
|
+
}
|
|
192
|
+
/** Resend's list envelope for the broadcast engagement routes. */
|
|
193
|
+
export interface EngagementList<T> {
|
|
194
|
+
object: 'list';
|
|
195
|
+
has_more: boolean;
|
|
196
|
+
data: T[];
|
|
120
197
|
}
|
|
121
198
|
/** One component on the public status page, and what it reports about itself. */
|
|
122
199
|
export interface ServiceComponent {
|
|
@@ -207,31 +284,62 @@ export interface EventDefinition {
|
|
|
207
284
|
updated_at: string;
|
|
208
285
|
}
|
|
209
286
|
/** One step of one automation run, and what it did (M5.6). */
|
|
287
|
+
/** A graph step (Resend's shape): `config` depends on `type`. */
|
|
288
|
+
export interface AutomationGraphStep {
|
|
289
|
+
key: string;
|
|
290
|
+
type: 'trigger' | 'delay' | 'send_email' | 'wait_for_event' | 'condition' | 'contact_update' | 'contact_delete' | 'add_to_segment';
|
|
291
|
+
config: Record<string, unknown>;
|
|
292
|
+
}
|
|
293
|
+
/** A link between two graph steps, by key. `type` defaults to `default`. */
|
|
294
|
+
export interface AutomationConnection {
|
|
295
|
+
from: string;
|
|
296
|
+
to: string;
|
|
297
|
+
type?: 'default' | 'condition_met' | 'condition_not_met' | 'timeout' | 'event_received';
|
|
298
|
+
}
|
|
210
299
|
export interface AutomationRunStep {
|
|
211
300
|
index: number;
|
|
212
301
|
kind: string;
|
|
302
|
+
/** A graph step's key; null on a linear run. */
|
|
303
|
+
key: string | null;
|
|
304
|
+
type: string;
|
|
213
305
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
306
|
+
* Linear: succeeded, skipped, failed, or waiting (sending is paused for
|
|
307
|
+
* every account; the step runs again after `output.retry_at`). Graph:
|
|
308
|
+
* completed, skipped, failed, or waiting (a delay or a wait for an event).
|
|
217
309
|
*/
|
|
218
|
-
status: 'succeeded' | 'skipped' | 'failed' | 'waiting';
|
|
310
|
+
status: 'succeeded' | 'completed' | 'skipped' | 'failed' | 'waiting' | 'pending' | 'running';
|
|
219
311
|
output: Record<string, unknown> | null;
|
|
220
|
-
|
|
312
|
+
/** A linear run's sentence, or a graph run's `{ message }`. */
|
|
313
|
+
error: string | {
|
|
314
|
+
message: string;
|
|
315
|
+
} | null;
|
|
221
316
|
started_at: string;
|
|
222
317
|
finished_at: string | null;
|
|
318
|
+
completed_at: string | null;
|
|
319
|
+
created_at: string;
|
|
223
320
|
}
|
|
224
321
|
/** One execution of one automation. `steps` is present on the single read. */
|
|
225
322
|
export interface AutomationRun {
|
|
323
|
+
object: 'automation_run';
|
|
226
324
|
id: string;
|
|
227
325
|
automation_id: string;
|
|
228
326
|
version_number: number | null;
|
|
229
327
|
trigger_type: string;
|
|
230
328
|
event_name: string | null;
|
|
231
329
|
contact_id: string | null;
|
|
232
|
-
|
|
330
|
+
/** Linear: running, succeeded or failed. Graph: running, completed, failed or cancelled. */
|
|
331
|
+
status: 'running' | 'succeeded' | 'completed' | 'failed' | 'cancelled';
|
|
233
332
|
started_at: string;
|
|
234
333
|
finished_at: string | null;
|
|
334
|
+
completed_at: string | null;
|
|
335
|
+
created_at: string;
|
|
336
|
+
/** Graph runs: the step the run is on. */
|
|
337
|
+
current_step: string | null;
|
|
338
|
+
/** Graph runs: the event a wait holds for, and when a delay or timeout ends. */
|
|
339
|
+
waiting_for: {
|
|
340
|
+
event: string | null;
|
|
341
|
+
until: string | null;
|
|
342
|
+
} | null;
|
|
235
343
|
steps?: AutomationRunStep[];
|
|
236
344
|
}
|
|
237
345
|
/** One item's outcome in a suppression batch (M5.5). */
|
|
@@ -459,7 +567,35 @@ export interface DomainRecord {
|
|
|
459
567
|
/** What to do about this record, the alternative accepted forms included. */
|
|
460
568
|
fix: string;
|
|
461
569
|
}
|
|
570
|
+
/** What a domain does. Sending defaults to enabled, receiving to disabled. */
|
|
571
|
+
export interface DomainCapabilities {
|
|
572
|
+
sending?: 'enabled' | 'disabled';
|
|
573
|
+
receiving?: 'enabled' | 'disabled';
|
|
574
|
+
}
|
|
575
|
+
/** `POST /domains/claim`, `GET /domains/:id/claim` and `POST /domains/:id/claim/verify`. */
|
|
576
|
+
export interface DomainClaim {
|
|
577
|
+
object: 'domain_claim';
|
|
578
|
+
id: string;
|
|
579
|
+
name: string;
|
|
580
|
+
status: 'pending' | 'verified' | 'completed' | 'blocked' | 'expired' | 'superseded' | 'canceled' | 'failed';
|
|
581
|
+
/** The placeholder domain the claim created on your account. */
|
|
582
|
+
domain_id: string | null;
|
|
583
|
+
region: DomainRegion | null;
|
|
584
|
+
/** The TXT record to publish at your DNS to prove you control the domain. */
|
|
585
|
+
record: {
|
|
586
|
+
type: 'TXT';
|
|
587
|
+
name: string;
|
|
588
|
+
value: string;
|
|
589
|
+
ttl: string;
|
|
590
|
+
};
|
|
591
|
+
blocked_reason: 'grace_period' | 'recent_owner_activity' | 'pending_scheduled_emails' | null;
|
|
592
|
+
failure_reason: string | null;
|
|
593
|
+
created_at: string;
|
|
594
|
+
expires_at: string;
|
|
595
|
+
}
|
|
462
596
|
export interface Domain {
|
|
597
|
+
/** `domain` on a retrieved domain; absent on list items. */
|
|
598
|
+
object?: 'domain';
|
|
463
599
|
id: string;
|
|
464
600
|
name: string;
|
|
465
601
|
zone?: string;
|
|
@@ -471,6 +607,11 @@ export interface Domain {
|
|
|
471
607
|
open_tracking: boolean;
|
|
472
608
|
tracking_subdomain: string;
|
|
473
609
|
return_path_subdomain?: string;
|
|
610
|
+
/** Whether the domain sends and whether it receives. */
|
|
611
|
+
capabilities?: {
|
|
612
|
+
sending: 'enabled' | 'disabled';
|
|
613
|
+
receiving: 'enabled' | 'disabled';
|
|
614
|
+
};
|
|
474
615
|
/**
|
|
475
616
|
* DNS sheet. Present on create, get, verify, and update. `list()` omits it
|
|
476
617
|
* (research/01-resend-api-baseline.md:182); call `get(id)` for the records.
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentisend/sdk-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "AgentiSend is a transactional email API for AI agents. This is its typed Node client.",
|
|
5
5
|
"author": "AgentiSend <hello@agentisend.com>",
|
|
6
6
|
"type": "module",
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"README.md"
|
|
58
58
|
],
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"resend": "6.30.0",
|
|
61
60
|
"typescript": "^5.6.0",
|
|
62
61
|
"vitest": "^3.0.0"
|
|
63
62
|
},
|