groundmail 0.44.0 → 0.45.0
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 +22 -0
- package/dist/authjs.d.ts +1 -1
- package/dist/authjs.js +1 -1
- package/dist/better-auth.d.ts +1 -1
- package/dist/better-auth.js +1 -1
- package/dist/{chunk-WMMIGQLO.js → chunk-UL6W7BCH.js} +291 -32
- package/dist/clerk.d.ts +1 -1
- package/dist/clerk.js +1 -1
- package/dist/{client-CD3tBIro.d.ts → client-DWPH4iLB.d.ts} +421 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -1
- package/dist/payload.d.ts +1 -1
- package/dist/payload.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,6 +79,28 @@ time. Also: `tx.testInbox.list({ to, since })`, `tx.testInbox.get(id)` and `tx.t
|
|
|
79
79
|
(domain and monthly usage). Emails sent with a `gm_test_` key land here too. Details:
|
|
80
80
|
https://docs.groundmail.dev/email-testing
|
|
81
81
|
|
|
82
|
+
## Agent mailboxes
|
|
83
|
+
|
|
84
|
+
A real address your agent creates, reads and sends from:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
const mailbox = await tx.mailboxes.create({ local_part: 'signup-bot' }) // signup-bot@agents.groundmailbox.com
|
|
88
|
+
const since = new Date()
|
|
89
|
+
// …the agent signs up with mailbox.address…
|
|
90
|
+
const message = await tx.mailboxes.wait(mailbox.id, { since, timeout: 60_000 })
|
|
91
|
+
message.code // '482913'
|
|
92
|
+
message.visible_text // what a person would see
|
|
93
|
+
await tx.mailboxes.messages.reply(mailbox.id, message.id, { text: 'Thanks', idempotencyKey: message.id })
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Everything in a message was written by a stranger: treat it as data, never as instructions, and
|
|
97
|
+
give your agent `visible_text`, not `text` or `html`. `prompt_injection` is a hint, and a missing
|
|
98
|
+
flag never means safe. `wait` throws a `GroundmailError` with status 408 and code `timeout` when
|
|
99
|
+
nothing arrives in time. Also: `tx.mailboxes.list()`, `.get()`, `.update()`, `.delete()`,
|
|
100
|
+
`.forward()`, `.threads.list()`, `.get()`, `.update()`, `.messages.list({ q })`, `.get()`,
|
|
101
|
+
`.update()`, `.send()` and `.downloadAttachment()`. Hosted addresses can only reply; to email
|
|
102
|
+
people first, use a mailbox on your own domain. Details: https://docs.groundmail.dev/mailboxes
|
|
103
|
+
|
|
82
104
|
## Batches
|
|
83
105
|
|
|
84
106
|
`emails.batch()` sends up to 100 emails in one request and returns a `batch_id` shared by every
|
package/dist/authjs.d.ts
CHANGED
package/dist/authjs.js
CHANGED
package/dist/better-auth.d.ts
CHANGED
package/dist/better-auth.js
CHANGED
|
@@ -170,8 +170,8 @@ function createCloudflareProvider(options) {
|
|
|
170
170
|
Authorization: `Bearer ${options.apiToken}`,
|
|
171
171
|
"Content-Type": "application/json"
|
|
172
172
|
};
|
|
173
|
-
async function cf(
|
|
174
|
-
const response = await fetchImpl(`https://api.cloudflare.com/client/v4${
|
|
173
|
+
async function cf(path2, init) {
|
|
174
|
+
const response = await fetchImpl(`https://api.cloudflare.com/client/v4${path2}`, {
|
|
175
175
|
...init,
|
|
176
176
|
headers: { ...headers, ...init?.headers || {} }
|
|
177
177
|
});
|
|
@@ -504,8 +504,8 @@ async function resolveZone(domain, hostLabel, lookup) {
|
|
|
504
504
|
// src/dns/godaddy-token.ts
|
|
505
505
|
function createGoDaddyTokenProvider(options) {
|
|
506
506
|
const fetchImpl = options.fetchImpl || fetch;
|
|
507
|
-
async function godaddy(
|
|
508
|
-
const response = await fetchImpl(`https://api.godaddy.com/v3/domains${
|
|
507
|
+
async function godaddy(path2, init) {
|
|
508
|
+
const response = await fetchImpl(`https://api.godaddy.com/v3/domains${path2}`, {
|
|
509
509
|
...init,
|
|
510
510
|
headers: {
|
|
511
511
|
Authorization: `Bearer ${options.apiToken}`,
|
|
@@ -532,7 +532,7 @@ function createGoDaddyTokenProvider(options) {
|
|
|
532
532
|
const { status } = await godaddy(`/zones/${encodeURIComponent(candidate)}/dns-records?pageSize=1`);
|
|
533
533
|
return status === 404 ? null : true;
|
|
534
534
|
});
|
|
535
|
-
const
|
|
535
|
+
const path2 = `/zones/${encodeURIComponent(zone)}/dns-records`;
|
|
536
536
|
const body = (record) => ({
|
|
537
537
|
name: record.name || "@",
|
|
538
538
|
type: record.type,
|
|
@@ -541,14 +541,14 @@ function createGoDaddyTokenProvider(options) {
|
|
|
541
541
|
...record.priority != null ? { priority: record.priority } : {}
|
|
542
542
|
});
|
|
543
543
|
const write = async (method, suffix, record) => {
|
|
544
|
-
const { status } = await godaddy(`${
|
|
544
|
+
const { status } = await godaddy(`${path2}${suffix}`, { method, body: JSON.stringify(body(record)) });
|
|
545
545
|
if (status === 404) throw new Error(`GoDaddy lost the ${zone} zone mid-update`);
|
|
546
546
|
};
|
|
547
547
|
return applyToRecordStore(zone, records, {
|
|
548
548
|
async list() {
|
|
549
549
|
const rows = [];
|
|
550
550
|
for (let page = 1; page <= 20; page++) {
|
|
551
|
-
const { body: list } = await godaddy(`${
|
|
551
|
+
const { body: list } = await godaddy(`${path2}?page=${page}&pageSize=100`);
|
|
552
552
|
const items = list.items || [];
|
|
553
553
|
rows.push(...items);
|
|
554
554
|
if (items.length < 100 || !list.links?.some((link) => link.rel === "next")) break;
|
|
@@ -592,8 +592,8 @@ function createGoDaddyKeyProvider(options) {
|
|
|
592
592
|
"Content-Type": "application/json",
|
|
593
593
|
Accept: "application/json"
|
|
594
594
|
};
|
|
595
|
-
async function gd(
|
|
596
|
-
const response = await fetchImpl(`https://api.godaddy.com${
|
|
595
|
+
async function gd(path2, init) {
|
|
596
|
+
const response = await fetchImpl(`https://api.godaddy.com${path2}`, {
|
|
597
597
|
...init,
|
|
598
598
|
headers: { ...headers, ...init?.headers || {} }
|
|
599
599
|
});
|
|
@@ -752,8 +752,8 @@ function createGoDaddyProvider(options) {
|
|
|
752
752
|
// src/dns/digitalocean.ts
|
|
753
753
|
function createDigitalOceanProvider(options) {
|
|
754
754
|
const fetchImpl = options.fetchImpl || fetch;
|
|
755
|
-
async function digitalocean(
|
|
756
|
-
const response = await fetchImpl(`https://api.digitalocean.com/v2${
|
|
755
|
+
async function digitalocean(path2, init) {
|
|
756
|
+
const response = await fetchImpl(`https://api.digitalocean.com/v2${path2}`, {
|
|
757
757
|
...init,
|
|
758
758
|
headers: { Authorization: `Bearer ${options.apiToken}`, "Content-Type": "application/json", ...init?.headers || {} }
|
|
759
759
|
});
|
|
@@ -773,7 +773,7 @@ function createDigitalOceanProvider(options) {
|
|
|
773
773
|
const { status } = await digitalocean(`/domains/${encodeURIComponent(candidate)}`);
|
|
774
774
|
return status === 404 ? null : true;
|
|
775
775
|
});
|
|
776
|
-
const
|
|
776
|
+
const path2 = `/domains/${encodeURIComponent(zone)}/records`;
|
|
777
777
|
const body = (record) => ({
|
|
778
778
|
type: record.type,
|
|
779
779
|
name: record.name || "@",
|
|
@@ -782,14 +782,14 @@ function createDigitalOceanProvider(options) {
|
|
|
782
782
|
...record.priority != null ? { priority: record.priority } : {}
|
|
783
783
|
});
|
|
784
784
|
const write = async (method, suffix, record) => {
|
|
785
|
-
const { status } = await digitalocean(`${
|
|
785
|
+
const { status } = await digitalocean(`${path2}${suffix}`, { method, body: JSON.stringify(body(record)) });
|
|
786
786
|
if (status === 404) throw new Error(`DigitalOcean lost the ${zone} zone mid-update`);
|
|
787
787
|
};
|
|
788
788
|
return applyToRecordStore(zone, records, {
|
|
789
789
|
async list() {
|
|
790
790
|
const rows = [];
|
|
791
791
|
for (let page = 1; page <= 20; page++) {
|
|
792
|
-
const { body: list } = await digitalocean(`${
|
|
792
|
+
const { body: list } = await digitalocean(`${path2}?per_page=200&page=${page}`);
|
|
793
793
|
rows.push(...list.domain_records || []);
|
|
794
794
|
if (!list.links?.pages?.next) break;
|
|
795
795
|
}
|
|
@@ -812,8 +812,8 @@ function createDigitalOceanProvider(options) {
|
|
|
812
812
|
function createDnsimpleProvider(options) {
|
|
813
813
|
const fetchImpl = options.fetchImpl || fetch;
|
|
814
814
|
const base = `https://api.dnsimple.com/v2/${encodeURIComponent(options.accountId)}`;
|
|
815
|
-
async function dnsimple(
|
|
816
|
-
const response = await fetchImpl(`${base}${
|
|
815
|
+
async function dnsimple(path2, init) {
|
|
816
|
+
const response = await fetchImpl(`${base}${path2}`, {
|
|
817
817
|
...init,
|
|
818
818
|
headers: {
|
|
819
819
|
Authorization: `Bearer ${options.apiToken}`,
|
|
@@ -833,7 +833,7 @@ function createDnsimpleProvider(options) {
|
|
|
833
833
|
const { status } = await dnsimple(`/zones/${encodeURIComponent(candidate)}`);
|
|
834
834
|
return status === 404 ? null : true;
|
|
835
835
|
});
|
|
836
|
-
const
|
|
836
|
+
const path2 = `/zones/${encodeURIComponent(zone)}/records`;
|
|
837
837
|
const body = (record) => ({
|
|
838
838
|
name: record.name,
|
|
839
839
|
type: record.type,
|
|
@@ -842,14 +842,14 @@ function createDnsimpleProvider(options) {
|
|
|
842
842
|
...record.priority != null ? { priority: record.priority } : {}
|
|
843
843
|
});
|
|
844
844
|
const write = async (method, suffix, record) => {
|
|
845
|
-
const { status } = await dnsimple(`${
|
|
845
|
+
const { status } = await dnsimple(`${path2}${suffix}`, { method, body: JSON.stringify(body(record)) });
|
|
846
846
|
if (status === 404) throw new Error(`DNSimple lost the ${zone} zone mid-update`);
|
|
847
847
|
};
|
|
848
848
|
return applyToRecordStore(zone, records, {
|
|
849
849
|
async list() {
|
|
850
850
|
const rows = [];
|
|
851
851
|
for (let page = 1; page <= 20; page++) {
|
|
852
|
-
const { body: list } = await dnsimple(`${
|
|
852
|
+
const { body: list } = await dnsimple(`${path2}?per_page=100&page=${page}`);
|
|
853
853
|
rows.push(...list.data || []);
|
|
854
854
|
if ((list.pagination?.total_pages ?? 1) <= page) break;
|
|
855
855
|
}
|
|
@@ -871,8 +871,8 @@ function createDnsimpleProvider(options) {
|
|
|
871
871
|
// src/dns/netlify.ts
|
|
872
872
|
function createNetlifyProvider(options) {
|
|
873
873
|
const fetchImpl = options.fetchImpl || fetch;
|
|
874
|
-
async function netlify(
|
|
875
|
-
const response = await fetchImpl(`https://api.netlify.com/api/v1${
|
|
874
|
+
async function netlify(path2, init) {
|
|
875
|
+
const response = await fetchImpl(`https://api.netlify.com/api/v1${path2}`, {
|
|
876
876
|
...init,
|
|
877
877
|
headers: { Authorization: `Bearer ${options.apiToken}`, "Content-Type": "application/json", ...init?.headers || {} }
|
|
878
878
|
});
|
|
@@ -954,8 +954,8 @@ function createVercelProvider(options) {
|
|
|
954
954
|
"Content-Type": "application/json"
|
|
955
955
|
};
|
|
956
956
|
const teamQs = teamQuery(options.teamId);
|
|
957
|
-
async function vercel(
|
|
958
|
-
const url =
|
|
957
|
+
async function vercel(path2, init) {
|
|
958
|
+
const url = path2.includes("?") ? `https://api.vercel.com${path2}${options.teamId?.trim() ? `&teamId=${encodeURIComponent(options.teamId.trim())}` : ""}` : `https://api.vercel.com${path2}${teamQs}`;
|
|
959
959
|
const response = await fetchImpl(url, {
|
|
960
960
|
...init,
|
|
961
961
|
headers: { ...headers, ...init?.headers || {} }
|
|
@@ -1222,6 +1222,249 @@ async function applyDnsRecords(input) {
|
|
|
1222
1222
|
};
|
|
1223
1223
|
}
|
|
1224
1224
|
|
|
1225
|
+
// src/mailboxes.ts
|
|
1226
|
+
var MAILBOX_WAIT_MAX_SECONDS = 60;
|
|
1227
|
+
var MAILBOX_WAIT_DEFAULT_MS = 3e4;
|
|
1228
|
+
function isoTime(value) {
|
|
1229
|
+
if (value === void 0 || value === null || value === "") return null;
|
|
1230
|
+
return value instanceof Date ? value.toISOString() : String(value);
|
|
1231
|
+
}
|
|
1232
|
+
function path(mailbox, ...rest) {
|
|
1233
|
+
return ["/mailboxes", mailbox, ...rest].map((part, index) => index ? encodeURIComponent(part) : part).join("/");
|
|
1234
|
+
}
|
|
1235
|
+
function withQuery(base, search) {
|
|
1236
|
+
const query = search.toString();
|
|
1237
|
+
return query ? `${base}?${query}` : base;
|
|
1238
|
+
}
|
|
1239
|
+
function setFlag(search, key, value) {
|
|
1240
|
+
if (value !== void 0) search.set(key, String(value));
|
|
1241
|
+
}
|
|
1242
|
+
function filenameOf(disposition) {
|
|
1243
|
+
if (!disposition) return null;
|
|
1244
|
+
const encoded = /filename\*=UTF-8''([^;]+)/i.exec(disposition)?.[1];
|
|
1245
|
+
if (encoded) {
|
|
1246
|
+
try {
|
|
1247
|
+
return decodeURIComponent(encoded);
|
|
1248
|
+
} catch {
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
return /filename="([^"]*)"/i.exec(disposition)?.[1] ?? null;
|
|
1252
|
+
}
|
|
1253
|
+
function idempotencyHeaders(key) {
|
|
1254
|
+
return key ? { "Idempotency-Key": key } : {};
|
|
1255
|
+
}
|
|
1256
|
+
function attachmentsBody(attachments) {
|
|
1257
|
+
if (attachments === void 0) return {};
|
|
1258
|
+
return {
|
|
1259
|
+
attachments: attachments.map((attachment) => ({
|
|
1260
|
+
name: attachment.name ?? attachment.filename,
|
|
1261
|
+
content_type: attachment.content_type ?? attachment.contentType,
|
|
1262
|
+
data: attachment.data ?? attachment.content,
|
|
1263
|
+
...attachment.content_id ?? attachment.contentId ? { content_id: attachment.content_id ?? attachment.contentId } : {}
|
|
1264
|
+
}))
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
var MailboxThreadsResource = class {
|
|
1268
|
+
constructor(client) {
|
|
1269
|
+
this.client = client;
|
|
1270
|
+
}
|
|
1271
|
+
/** Threads, newest activity first. Held and archived threads only when asked for. */
|
|
1272
|
+
async list(mailbox, params = {}) {
|
|
1273
|
+
const search = new URLSearchParams();
|
|
1274
|
+
if (params.label) search.set("label", params.label);
|
|
1275
|
+
if (params.participant) search.set("participant", params.participant);
|
|
1276
|
+
setFlag(search, "unread", params.unread);
|
|
1277
|
+
setFlag(search, "archived", params.archived);
|
|
1278
|
+
const since = isoTime(params.since);
|
|
1279
|
+
if (since) search.set("since", since);
|
|
1280
|
+
setFlag(search, "include_held", params.include_held);
|
|
1281
|
+
if (params.limit != null) search.set("limit", String(params.limit));
|
|
1282
|
+
if (params.cursor) search.set("cursor", params.cursor);
|
|
1283
|
+
return this.client.request(withQuery(path(mailbox, "threads"), search), { method: "GET" });
|
|
1284
|
+
}
|
|
1285
|
+
/** One thread with its messages, oldest first. */
|
|
1286
|
+
async get(mailbox, threadId, params = {}) {
|
|
1287
|
+
const search = new URLSearchParams();
|
|
1288
|
+
setFlag(search, "include_held", params.include_held);
|
|
1289
|
+
const { thread } = await this.client.request(
|
|
1290
|
+
withQuery(path(mailbox, "threads", threadId), search),
|
|
1291
|
+
{ method: "GET" }
|
|
1292
|
+
);
|
|
1293
|
+
return thread;
|
|
1294
|
+
}
|
|
1295
|
+
/** Replace its labels, or mark it read or archived. */
|
|
1296
|
+
async update(mailbox, threadId, params) {
|
|
1297
|
+
const { thread } = await this.client.request(path(mailbox, "threads", threadId), {
|
|
1298
|
+
method: "PATCH",
|
|
1299
|
+
body: JSON.stringify(params)
|
|
1300
|
+
});
|
|
1301
|
+
return thread;
|
|
1302
|
+
}
|
|
1303
|
+
};
|
|
1304
|
+
var MailboxMessagesResource = class {
|
|
1305
|
+
constructor(client) {
|
|
1306
|
+
this.client = client;
|
|
1307
|
+
}
|
|
1308
|
+
/** Messages without their bodies, newest first. `q` searches the subject, sender and visible text. */
|
|
1309
|
+
async list(mailbox, params = {}) {
|
|
1310
|
+
const search = new URLSearchParams();
|
|
1311
|
+
if (params.q) search.set("q", params.q);
|
|
1312
|
+
if (params.from) search.set("from", params.from);
|
|
1313
|
+
if (params.thread) search.set("thread", params.thread);
|
|
1314
|
+
if (params.label) search.set("label", params.label);
|
|
1315
|
+
setFlag(search, "unread", params.unread);
|
|
1316
|
+
const since = isoTime(params.since);
|
|
1317
|
+
if (since) search.set("since", since);
|
|
1318
|
+
setFlag(search, "include_held", params.include_held);
|
|
1319
|
+
if (params.limit != null) search.set("limit", String(params.limit));
|
|
1320
|
+
if (params.cursor) search.set("cursor", params.cursor);
|
|
1321
|
+
return this.client.request(withQuery(path(mailbox, "messages"), search), { method: "GET" });
|
|
1322
|
+
}
|
|
1323
|
+
/** One message with its bodies, code, links, attachments and sender checks. */
|
|
1324
|
+
async get(mailbox, messageId) {
|
|
1325
|
+
const { message } = await this.client.request(path(mailbox, "messages", messageId), {
|
|
1326
|
+
method: "GET"
|
|
1327
|
+
});
|
|
1328
|
+
return message;
|
|
1329
|
+
}
|
|
1330
|
+
/** Replace its labels, or mark it read or unread. */
|
|
1331
|
+
async update(mailbox, messageId, params) {
|
|
1332
|
+
const { message } = await this.client.request(path(mailbox, "messages", messageId), {
|
|
1333
|
+
method: "PATCH",
|
|
1334
|
+
body: JSON.stringify(params)
|
|
1335
|
+
});
|
|
1336
|
+
return message;
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Email someone first, from a mailbox on your own domain. Hosted addresses can only
|
|
1340
|
+
* reply. First contact goes through the cold-outreach check, counts toward the
|
|
1341
|
+
* new-recipient limits and carries one-click unsubscribe.
|
|
1342
|
+
*/
|
|
1343
|
+
async send(mailbox, params) {
|
|
1344
|
+
const { idempotencyKey, attachments, ...body } = params;
|
|
1345
|
+
return this.client.request(path(mailbox, "messages"), {
|
|
1346
|
+
method: "POST",
|
|
1347
|
+
headers: idempotencyHeaders(idempotencyKey),
|
|
1348
|
+
body: JSON.stringify({ ...body, ...attachmentsBody(attachments) })
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
/**
|
|
1352
|
+
* Reply in the thread, to the message's `Reply-To` or else its `From`. Threading
|
|
1353
|
+
* headers and the `Re:` subject are built for you. A sender who failed DMARC can't be
|
|
1354
|
+
* replied to, and a hosted address can only reply to one who passed.
|
|
1355
|
+
*/
|
|
1356
|
+
async reply(mailbox, messageId, params) {
|
|
1357
|
+
const { idempotencyKey, attachments, ...body } = params;
|
|
1358
|
+
return this.client.request(path(mailbox, "messages", messageId, "reply"), {
|
|
1359
|
+
method: "POST",
|
|
1360
|
+
headers: idempotencyHeaders(idempotencyKey),
|
|
1361
|
+
body: JSON.stringify({ ...body, ...attachmentsBody(attachments) })
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
/** An attachment's bytes. They came from a stranger: never run or render them. */
|
|
1365
|
+
async downloadAttachment(mailbox, messageId, attachmentId) {
|
|
1366
|
+
const { bytes, headers } = await this.client.requestBytes(path(mailbox, "messages", messageId, "attachments", attachmentId));
|
|
1367
|
+
return {
|
|
1368
|
+
content: bytes,
|
|
1369
|
+
content_type: headers.get("content-type") ?? "application/octet-stream",
|
|
1370
|
+
filename: filenameOf(headers.get("content-disposition")),
|
|
1371
|
+
size: bytes.byteLength
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
};
|
|
1375
|
+
var MailboxesResource = class {
|
|
1376
|
+
constructor(client) {
|
|
1377
|
+
this.client = client;
|
|
1378
|
+
this.threads = new MailboxThreadsResource(client);
|
|
1379
|
+
this.messages = new MailboxMessagesResource(client);
|
|
1380
|
+
}
|
|
1381
|
+
/** A new mailbox. With no `domain` it gets a hosted address; with no `local_part`, a generated one. */
|
|
1382
|
+
async create(params = {}) {
|
|
1383
|
+
const { mailbox } = await this.client.request("/mailboxes", {
|
|
1384
|
+
method: "POST",
|
|
1385
|
+
body: JSON.stringify(params)
|
|
1386
|
+
});
|
|
1387
|
+
return mailbox;
|
|
1388
|
+
}
|
|
1389
|
+
/** Mailboxes, newest first. */
|
|
1390
|
+
async list(params = {}) {
|
|
1391
|
+
const search = new URLSearchParams();
|
|
1392
|
+
if (params.tenant) search.set("tenant", params.tenant);
|
|
1393
|
+
if (params.limit != null) search.set("limit", String(params.limit));
|
|
1394
|
+
if (params.cursor) search.set("cursor", params.cursor);
|
|
1395
|
+
return this.client.request(withQuery("/mailboxes", search), { method: "GET" });
|
|
1396
|
+
}
|
|
1397
|
+
async get(mailbox) {
|
|
1398
|
+
const { mailbox: found } = await this.client.request(path(mailbox), {
|
|
1399
|
+
method: "GET"
|
|
1400
|
+
});
|
|
1401
|
+
return found;
|
|
1402
|
+
}
|
|
1403
|
+
async update(mailbox, params) {
|
|
1404
|
+
const { mailbox: updated } = await this.client.request(path(mailbox), {
|
|
1405
|
+
method: "PATCH",
|
|
1406
|
+
body: JSON.stringify(params)
|
|
1407
|
+
});
|
|
1408
|
+
return updated;
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Move a hosted address to a mailbox on your own domain: its mail arrives there for
|
|
1412
|
+
* 30 days, then it is dropped. `to` is the new mailbox's id, address or `external_id`,
|
|
1413
|
+
* of the same tenant. The 30 days can't be extended, and the old address can't send
|
|
1414
|
+
* and isn't billed in the meantime. Returns the old mailbox.
|
|
1415
|
+
*/
|
|
1416
|
+
async forward(mailbox, params) {
|
|
1417
|
+
const { mailbox: forwarding } = await this.client.request(path(mailbox, "forward"), {
|
|
1418
|
+
method: "POST",
|
|
1419
|
+
body: JSON.stringify(params)
|
|
1420
|
+
});
|
|
1421
|
+
return forwarding;
|
|
1422
|
+
}
|
|
1423
|
+
/** Deletes the mailbox and all its mail. A hosted address is never given out again. */
|
|
1424
|
+
async delete(mailbox) {
|
|
1425
|
+
return this.client.request(path(mailbox), { method: "DELETE" });
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* Wait for the next message and return it. Counts from `since`, or from now when
|
|
1429
|
+
* left out: to catch mail a step of yours sets off, take `since` before that step.
|
|
1430
|
+
* Waits up to `timeout` ms (default 30s), then throws a `GroundmailError` with
|
|
1431
|
+
* status 408 and code `timeout`; pass its `details.since` to carry on from there.
|
|
1432
|
+
*/
|
|
1433
|
+
async wait(mailbox, params = {}) {
|
|
1434
|
+
const totalMs = params.timeout ?? MAILBOX_WAIT_DEFAULT_MS;
|
|
1435
|
+
const deadline = Date.now() + totalMs;
|
|
1436
|
+
let since = isoTime(params.since);
|
|
1437
|
+
for (; ; ) {
|
|
1438
|
+
const remainingMs = Math.max(0, deadline - Date.now());
|
|
1439
|
+
const seconds = Math.min(MAILBOX_WAIT_MAX_SECONDS, Math.ceil(remainingMs / 1e3));
|
|
1440
|
+
const search = new URLSearchParams({ timeout: String(seconds) });
|
|
1441
|
+
if (since) search.set("since", since);
|
|
1442
|
+
if (params.from) search.set("from", params.from);
|
|
1443
|
+
if (params.thread) search.set("thread", params.thread);
|
|
1444
|
+
try {
|
|
1445
|
+
const { message } = await this.client.request(
|
|
1446
|
+
`${path(mailbox, "wait")}?${search}`,
|
|
1447
|
+
{ method: "GET" }
|
|
1448
|
+
);
|
|
1449
|
+
if (message) return message;
|
|
1450
|
+
} catch (error) {
|
|
1451
|
+
const timedOut = error instanceof GroundmailError && error.status === 408;
|
|
1452
|
+
if (!timedOut) throw error;
|
|
1453
|
+
const details = error.details && typeof error.details === "object" ? error.details : {};
|
|
1454
|
+
if (typeof details.since === "string") since = details.since;
|
|
1455
|
+
if (Date.now() >= deadline || seconds === 0) {
|
|
1456
|
+
throw new GroundmailError(
|
|
1457
|
+
`No message arrived at ${mailbox} within ${Math.round(totalMs / 1e3)} seconds`,
|
|
1458
|
+
408,
|
|
1459
|
+
{ ...details, ...since ? { since } : {} },
|
|
1460
|
+
{ code: "timeout", hint: error.hint, docsUrl: error.docsUrl }
|
|
1461
|
+
);
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
|
|
1225
1468
|
// src/migrations.ts
|
|
1226
1469
|
function mergeMigrations(previous, next) {
|
|
1227
1470
|
if (!previous || previous.id !== next.id) return next;
|
|
@@ -1303,7 +1546,7 @@ function cleanPrefix(prefix) {
|
|
|
1303
1546
|
const cleaned = (prefix ?? "").trim().toLowerCase().replace(/[^a-z0-9._+-]+/g, "-").replace(/^[-.]+|[-.]+$/g, "").slice(0, 48);
|
|
1304
1547
|
return cleaned || "run";
|
|
1305
1548
|
}
|
|
1306
|
-
function
|
|
1549
|
+
function isoTime2(value) {
|
|
1307
1550
|
if (value === void 0 || value === null || value === "") return null;
|
|
1308
1551
|
return value instanceof Date ? value.toISOString() : String(value);
|
|
1309
1552
|
}
|
|
@@ -1327,7 +1570,7 @@ var TestInboxResource = class {
|
|
|
1327
1570
|
async list(params = {}) {
|
|
1328
1571
|
const search = new URLSearchParams();
|
|
1329
1572
|
if (params.to) search.set("to", params.to);
|
|
1330
|
-
const since =
|
|
1573
|
+
const since = isoTime2(params.since);
|
|
1331
1574
|
if (since) search.set("since", since);
|
|
1332
1575
|
if (params.limit != null) search.set("limit", String(params.limit));
|
|
1333
1576
|
if (params.cursor) search.set("cursor", params.cursor);
|
|
@@ -1351,7 +1594,7 @@ var TestInboxResource = class {
|
|
|
1351
1594
|
if (!params?.to) throw new Error("testInbox.waitFor: `to` is required");
|
|
1352
1595
|
const totalMs = params.timeout ?? TEST_INBOX_WAIT_DEFAULT_MS;
|
|
1353
1596
|
const deadline = Date.now() + totalMs;
|
|
1354
|
-
const since =
|
|
1597
|
+
const since = isoTime2(params.since);
|
|
1355
1598
|
for (; ; ) {
|
|
1356
1599
|
const remainingMs = Math.max(0, deadline - Date.now());
|
|
1357
1600
|
const seconds = Math.min(TEST_INBOX_WAIT_MAX_SECONDS, Math.ceil(remainingMs / 1e3));
|
|
@@ -1408,7 +1651,7 @@ function verifyWebhookSignature(secret, payload, header, toleranceSec = 300) {
|
|
|
1408
1651
|
}
|
|
1409
1652
|
|
|
1410
1653
|
// package.json
|
|
1411
|
-
var version = "0.
|
|
1654
|
+
var version = "0.45.0";
|
|
1412
1655
|
|
|
1413
1656
|
// src/automations.ts
|
|
1414
1657
|
var AutomationsResource = class {
|
|
@@ -1843,7 +2086,8 @@ var KeysResource = class {
|
|
|
1843
2086
|
...params.scopes?.length ? { scopes: params.scopes } : {},
|
|
1844
2087
|
...params.allowedDomains?.length ? { allowed_domains: params.allowedDomains } : {},
|
|
1845
2088
|
...params.test ? { test: true } : {},
|
|
1846
|
-
...params.tenant ? { tenant: params.tenant } : {}
|
|
2089
|
+
...params.tenant ? { tenant: params.tenant } : {},
|
|
2090
|
+
...params.mailboxIds?.length ? { mailbox_ids: params.mailboxIds } : {}
|
|
1847
2091
|
})
|
|
1848
2092
|
});
|
|
1849
2093
|
}
|
|
@@ -2295,6 +2539,7 @@ var _Groundmail = class _Groundmail {
|
|
|
2295
2539
|
this.migrations = new MigrationsResource(this);
|
|
2296
2540
|
this.dmarc = new DmarcResource(this);
|
|
2297
2541
|
this.testInbox = new TestInboxResource(this);
|
|
2542
|
+
this.mailboxes = new MailboxesResource(this);
|
|
2298
2543
|
}
|
|
2299
2544
|
/**
|
|
2300
2545
|
* Check one address with Groundmail validation before you accept it (for
|
|
@@ -2355,16 +2600,25 @@ var _Groundmail = class _Groundmail {
|
|
|
2355
2600
|
return response;
|
|
2356
2601
|
}
|
|
2357
2602
|
/** GET a text body (CSV downloads). Errors are JSON, like every other route. */
|
|
2358
|
-
async requestText(
|
|
2359
|
-
const response = await this.authorizedFetch(`${this.baseUrl}${
|
|
2603
|
+
async requestText(path2) {
|
|
2604
|
+
const response = await this.authorizedFetch(`${this.baseUrl}${path2}`, { method: "GET" }, {});
|
|
2360
2605
|
if (!response.ok) {
|
|
2361
2606
|
const body = await response.json().catch(() => ({}));
|
|
2362
2607
|
throw GroundmailError.fromResponse(response.status, body);
|
|
2363
2608
|
}
|
|
2364
2609
|
return response.text();
|
|
2365
2610
|
}
|
|
2366
|
-
|
|
2367
|
-
|
|
2611
|
+
/** GET a binary body (attachment downloads) with its headers. Errors are JSON, like every other route. */
|
|
2612
|
+
async requestBytes(path2) {
|
|
2613
|
+
const response = await this.authorizedFetch(`${this.baseUrl}${path2}`, { method: "GET" }, {});
|
|
2614
|
+
if (!response.ok) {
|
|
2615
|
+
const body = await response.json().catch(() => ({}));
|
|
2616
|
+
throw GroundmailError.fromResponse(response.status, body);
|
|
2617
|
+
}
|
|
2618
|
+
return { bytes: new Uint8Array(await response.arrayBuffer()), headers: response.headers };
|
|
2619
|
+
}
|
|
2620
|
+
async request(path2, init) {
|
|
2621
|
+
const response = await this.authorizedFetch(`${this.baseUrl}${path2}`, init, { "Content-Type": "application/json" });
|
|
2368
2622
|
const body = await response.json().catch(() => ({}));
|
|
2369
2623
|
if (!response.ok) {
|
|
2370
2624
|
throw GroundmailError.fromResponse(response.status, body);
|
|
@@ -2405,6 +2659,11 @@ export {
|
|
|
2405
2659
|
BurrowGuardResource,
|
|
2406
2660
|
mergeSpfInclude,
|
|
2407
2661
|
applyDnsRecords,
|
|
2662
|
+
MAILBOX_WAIT_MAX_SECONDS,
|
|
2663
|
+
MAILBOX_WAIT_DEFAULT_MS,
|
|
2664
|
+
MailboxThreadsResource,
|
|
2665
|
+
MailboxMessagesResource,
|
|
2666
|
+
MailboxesResource,
|
|
2408
2667
|
mergeMigrations,
|
|
2409
2668
|
TEST_INBOX_WAIT_MAX_SECONDS,
|
|
2410
2669
|
TEST_INBOX_WAIT_DEFAULT_MS,
|
package/dist/clerk.d.ts
CHANGED
package/dist/clerk.js
CHANGED
|
@@ -424,6 +424,8 @@ type ApiKey = {
|
|
|
424
424
|
test?: boolean;
|
|
425
425
|
/** The tenant this key is limited to (external id). Absent or null for an account-wide key. */
|
|
426
426
|
tenant?: string | null;
|
|
427
|
+
/** The mailboxes this key is limited to (`mbx_…`). Absent on a key that isn't. */
|
|
428
|
+
mailbox_ids?: string[];
|
|
427
429
|
prefix: string;
|
|
428
430
|
created_at: string;
|
|
429
431
|
last_used_at: string | null;
|
|
@@ -454,6 +456,11 @@ type CreateApiKeyParams = {
|
|
|
454
456
|
* tenant and sees only that tenant's emails, domains and suppressions.
|
|
455
457
|
*/
|
|
456
458
|
tenant?: string;
|
|
459
|
+
/**
|
|
460
|
+
* Limit the key to these mailboxes (`mbx_…`): it reads and works with their mail and
|
|
461
|
+
* nothing else on the account. Needs `mailboxes:read` or `mailboxes:write`.
|
|
462
|
+
*/
|
|
463
|
+
mailboxIds?: string[];
|
|
457
464
|
};
|
|
458
465
|
type CreateApiKeyResult = {
|
|
459
466
|
id: string;
|
|
@@ -465,6 +472,8 @@ type CreateApiKeyResult = {
|
|
|
465
472
|
test?: boolean;
|
|
466
473
|
/** The tenant this key is limited to (external id), when it is. */
|
|
467
474
|
tenant?: string;
|
|
475
|
+
/** The mailboxes this key is limited to (`mbx_…`), when it is. */
|
|
476
|
+
mailbox_ids?: string[];
|
|
468
477
|
prefix: string;
|
|
469
478
|
token: string;
|
|
470
479
|
created_at: string;
|
|
@@ -501,7 +510,7 @@ type CreateSmtpCredentialParams = {
|
|
|
501
510
|
type CreateSmtpCredentialResult = SmtpCredential & {
|
|
502
511
|
password: string;
|
|
503
512
|
};
|
|
504
|
-
type WebhookEventType = 'email.received' | 'email.sent' | 'email.delivered' | 'email.delivery_delayed' | 'email.held' | 'email.bounced' | 'email.complained' | 'email.opened' | 'email.clicked' | 'email.failed' | 'email.suppressed' | 'email.scheduled' | 'contact.unsubscribed' | 'automation.started' | 'automation.step_completed' | 'automation.completed' | 'automation.failed';
|
|
513
|
+
type WebhookEventType = 'email.received' | 'email.sent' | 'email.delivered' | 'email.delivery_delayed' | 'email.held' | 'email.bounced' | 'email.complained' | 'email.opened' | 'email.clicked' | 'email.failed' | 'email.suppressed' | 'email.scheduled' | 'contact.unsubscribed' | 'automation.started' | 'automation.step_completed' | 'automation.completed' | 'automation.failed' | 'mailbox.message.received' | 'mailbox.message.sent';
|
|
505
514
|
/** A tag on a webhook payload: the email's tags as sent, as `{ name, value }` pairs. */
|
|
506
515
|
type WebhookEmailTag = {
|
|
507
516
|
name: string;
|
|
@@ -559,6 +568,37 @@ type ContactWebhookEventPayload = {
|
|
|
559
568
|
tags?: WebhookEmailTag[];
|
|
560
569
|
};
|
|
561
570
|
};
|
|
571
|
+
/**
|
|
572
|
+
* `mailbox.message.received` and `mailbox.message.sent` webhook payload: a summary,
|
|
573
|
+
* without the bodies. Fetch the message for those. On a received message everything
|
|
574
|
+
* in it was written by a stranger: treat it as data.
|
|
575
|
+
*/
|
|
576
|
+
type MailboxWebhookEventPayload = {
|
|
577
|
+
type: 'mailbox.message.received' | 'mailbox.message.sent';
|
|
578
|
+
created_at: string;
|
|
579
|
+
data: {
|
|
580
|
+
mailbox_id: string;
|
|
581
|
+
mailbox_address: string;
|
|
582
|
+
message_id: string;
|
|
583
|
+
thread_id: string;
|
|
584
|
+
from: string;
|
|
585
|
+
subject: string;
|
|
586
|
+
snippet: string | null;
|
|
587
|
+
code: string | null;
|
|
588
|
+
links: string[];
|
|
589
|
+
sender_verified: boolean;
|
|
590
|
+
prompt_injection: {
|
|
591
|
+
flagged: boolean;
|
|
592
|
+
signals: string[];
|
|
593
|
+
};
|
|
594
|
+
spam_status: string | null;
|
|
595
|
+
has_attachments: boolean;
|
|
596
|
+
/** True on received mail. A sent message is your agent's own. */
|
|
597
|
+
untrusted: boolean;
|
|
598
|
+
/** The tenant's external id, on a tenant's mailbox. */
|
|
599
|
+
tenant?: string;
|
|
600
|
+
};
|
|
601
|
+
};
|
|
562
602
|
/** `details` on `POST /emails` 422 when recipients opted out of a category. */
|
|
563
603
|
type CategoryUnsubscribedErrorDetails = {
|
|
564
604
|
category_unsubscribed: string[];
|
|
@@ -827,6 +867,8 @@ type WebhookEndpoint = {
|
|
|
827
867
|
enabled: boolean;
|
|
828
868
|
/** Present only when the endpoint receives email events for some tenants only (their external ids). */
|
|
829
869
|
tenants?: string[];
|
|
870
|
+
/** Present only when the endpoint receives mailbox events for some mailboxes only (`mbx_…`). */
|
|
871
|
+
mailboxes?: string[];
|
|
830
872
|
/** Delivery health, on `list` and `get`. */
|
|
831
873
|
health?: WebhookEndpointHealth;
|
|
832
874
|
created_at: string;
|
|
@@ -907,6 +949,8 @@ type CreateWebhookParams = {
|
|
|
907
949
|
events?: WebhookEventType[];
|
|
908
950
|
/** Only these tenants' email events (external ids or Groundmail ids). Omit, `[]` or `null` for all. */
|
|
909
951
|
tenants?: string[] | null;
|
|
952
|
+
/** Only these mailboxes' mailbox events (`mbx_` id, address or `external_id`). Omit, `[]` or `null` for all. */
|
|
953
|
+
mailboxes?: string[] | null;
|
|
910
954
|
};
|
|
911
955
|
type UpdateWebhookParams = {
|
|
912
956
|
url?: string;
|
|
@@ -914,6 +958,8 @@ type UpdateWebhookParams = {
|
|
|
914
958
|
enabled?: boolean;
|
|
915
959
|
/** Only these tenants' email events. `[]` or `null` removes the filter. */
|
|
916
960
|
tenants?: string[] | null;
|
|
961
|
+
/** Only these mailboxes' mailbox events. `[]` or `null` removes the filter. */
|
|
962
|
+
mailboxes?: string[] | null;
|
|
917
963
|
};
|
|
918
964
|
type WebhookEndpointWithSecret = {
|
|
919
965
|
webhook: WebhookEndpoint;
|
|
@@ -1855,6 +1901,289 @@ type UpdateBrandParams = {
|
|
|
1855
1901
|
address?: string | null;
|
|
1856
1902
|
website?: string | null;
|
|
1857
1903
|
};
|
|
1904
|
+
type MailboxStatus = 'active' | 'paused' | 'forwarding';
|
|
1905
|
+
/** A hosted address that moved to a mailbox on your own domain. */
|
|
1906
|
+
type MailboxForwarding = {
|
|
1907
|
+
/** The address its mail arrives at. */
|
|
1908
|
+
to: string | null;
|
|
1909
|
+
/** When forwarding ends. It can't be extended. */
|
|
1910
|
+
until: string;
|
|
1911
|
+
/** False once forwarding has ended, or if the new mailbox is gone. Mail is then dropped. */
|
|
1912
|
+
active: boolean;
|
|
1913
|
+
};
|
|
1914
|
+
/** A real address your agent receives at. */
|
|
1915
|
+
type Mailbox = {
|
|
1916
|
+
object: 'mailbox';
|
|
1917
|
+
id: string;
|
|
1918
|
+
address: string;
|
|
1919
|
+
local_part: string;
|
|
1920
|
+
domain: string;
|
|
1921
|
+
/** On the hosted domain, not one of yours. */
|
|
1922
|
+
hosted: boolean;
|
|
1923
|
+
display_name: string | null;
|
|
1924
|
+
/** Your own id for this mailbox. */
|
|
1925
|
+
external_id: string | null;
|
|
1926
|
+
/** A paused mailbox still receives mail, but can't send. A `forwarding` one can't send either. */
|
|
1927
|
+
status: MailboxStatus;
|
|
1928
|
+
/** `reply_only` on hosted addresses, which can't email anyone first. `first_contact` on your own domain. */
|
|
1929
|
+
send_policy: 'reply_only' | 'first_contact';
|
|
1930
|
+
/** Most emails a day from this mailbox; null for no limit of its own. */
|
|
1931
|
+
daily_send_limit: number | null;
|
|
1932
|
+
/** Why it is paused, by you or automatically; null while active. */
|
|
1933
|
+
paused_reason: string | null;
|
|
1934
|
+
/** Set while a hosted address forwards to its new mailbox; null otherwise. */
|
|
1935
|
+
forwarding: MailboxForwarding | null;
|
|
1936
|
+
/** Spam score at or above which mail is held; null uses the default. */
|
|
1937
|
+
spam_threshold: number | null;
|
|
1938
|
+
/** Days mail is kept; null uses your plan's default. */
|
|
1939
|
+
retention_days: number | null;
|
|
1940
|
+
metadata: Record<string, unknown> | null;
|
|
1941
|
+
/** The tenant's external id, on a tenant's mailbox. */
|
|
1942
|
+
tenant?: string;
|
|
1943
|
+
created_at: string;
|
|
1944
|
+
updated_at: string;
|
|
1945
|
+
};
|
|
1946
|
+
type CreateMailboxParams = {
|
|
1947
|
+
/** Left out, the address gets a generated local part. Letters, numbers, dots, hyphens and underscores. */
|
|
1948
|
+
local_part?: string;
|
|
1949
|
+
/** A verified domain of yours. Left out, the address is on the hosted domain. */
|
|
1950
|
+
domain?: string;
|
|
1951
|
+
display_name?: string | null;
|
|
1952
|
+
/** Your own id for this mailbox. Usable wherever a mailbox is named. */
|
|
1953
|
+
external_id?: string | null;
|
|
1954
|
+
/** The tenant the mailbox belongs to. */
|
|
1955
|
+
tenant?: string;
|
|
1956
|
+
/** Days to keep mail: 1 to 365 on paid plans, at most 7 on Free. */
|
|
1957
|
+
retention_days?: number | null;
|
|
1958
|
+
/** Spam score at or above which mail is held, above 0 and at most 100. */
|
|
1959
|
+
spam_threshold?: number | null;
|
|
1960
|
+
metadata?: Record<string, unknown> | null;
|
|
1961
|
+
/** A hosted mailbox this new one replaces: it forwards here for 30 days. Needs `domain`. */
|
|
1962
|
+
forward_from?: string;
|
|
1963
|
+
};
|
|
1964
|
+
type ForwardMailboxParams = {
|
|
1965
|
+
/** The new mailbox: its `mbx_` id, address or `external_id`. On your own domain, same tenant. */
|
|
1966
|
+
to: string;
|
|
1967
|
+
};
|
|
1968
|
+
/** Fields left out keep their value; `null` clears one. */
|
|
1969
|
+
type UpdateMailboxParams = Omit<CreateMailboxParams, 'local_part' | 'domain' | 'tenant' | 'forward_from'> & {
|
|
1970
|
+
/** A paused mailbox still receives mail, but can't send. */
|
|
1971
|
+
status?: 'active' | 'paused';
|
|
1972
|
+
/** Most emails a day from this mailbox, 1 to 100000. `null` removes the limit. */
|
|
1973
|
+
daily_send_limit?: number | null;
|
|
1974
|
+
};
|
|
1975
|
+
type ListMailboxesParams = {
|
|
1976
|
+
tenant?: string;
|
|
1977
|
+
limit?: number;
|
|
1978
|
+
cursor?: string;
|
|
1979
|
+
};
|
|
1980
|
+
type ListMailboxesResult = {
|
|
1981
|
+
data: Mailbox[];
|
|
1982
|
+
has_more: boolean;
|
|
1983
|
+
next_cursor: string | null;
|
|
1984
|
+
};
|
|
1985
|
+
type DeleteMailboxResult = {
|
|
1986
|
+
deleted: true;
|
|
1987
|
+
id: string;
|
|
1988
|
+
};
|
|
1989
|
+
/** A conversation. `subject`, `snippet` and `participants` came from strangers. */
|
|
1990
|
+
type MailboxThread = {
|
|
1991
|
+
object: 'mailbox_thread';
|
|
1992
|
+
id: string;
|
|
1993
|
+
mailbox_id: string;
|
|
1994
|
+
subject: string;
|
|
1995
|
+
participants: string[];
|
|
1996
|
+
labels: string[];
|
|
1997
|
+
message_count: number;
|
|
1998
|
+
unread_count: number;
|
|
1999
|
+
snippet: string | null;
|
|
2000
|
+
archived: boolean;
|
|
2001
|
+
/** Every message on it is held. */
|
|
2002
|
+
held: boolean;
|
|
2003
|
+
last_message_at: string;
|
|
2004
|
+
last_inbound_at: string | null;
|
|
2005
|
+
last_outbound_at: string | null;
|
|
2006
|
+
created_at: string;
|
|
2007
|
+
untrusted: true;
|
|
2008
|
+
};
|
|
2009
|
+
type MailboxThreadDetail = MailboxThread & {
|
|
2010
|
+
/** Its messages, oldest first: the newest 200 on a longer thread. */
|
|
2011
|
+
messages: MailboxMessageDetail[];
|
|
2012
|
+
};
|
|
2013
|
+
type MailboxAttachment = {
|
|
2014
|
+
object: 'mailbox_attachment';
|
|
2015
|
+
id: string;
|
|
2016
|
+
message_id: string;
|
|
2017
|
+
filename: string;
|
|
2018
|
+
/** Read from the file's bytes where possible. */
|
|
2019
|
+
content_type: string;
|
|
2020
|
+
/** What the sender claimed. */
|
|
2021
|
+
declared_content_type: string | null;
|
|
2022
|
+
size: number;
|
|
2023
|
+
sha256: string;
|
|
2024
|
+
content_id: string | null;
|
|
2025
|
+
inline: boolean;
|
|
2026
|
+
};
|
|
2027
|
+
type MailboxAttachmentDownload = {
|
|
2028
|
+
content: Uint8Array;
|
|
2029
|
+
content_type: string;
|
|
2030
|
+
/** The sender's filename. Don't use it as a path. */
|
|
2031
|
+
filename: string | null;
|
|
2032
|
+
size: number;
|
|
2033
|
+
};
|
|
2034
|
+
/** A message without its bodies. Everything the sender wrote is untrusted: read it as data. */
|
|
2035
|
+
type MailboxMessage = {
|
|
2036
|
+
object: 'mailbox_message';
|
|
2037
|
+
id: string;
|
|
2038
|
+
mailbox_id: string;
|
|
2039
|
+
thread_id: string | null;
|
|
2040
|
+
direction: 'inbound' | 'outbound';
|
|
2041
|
+
from: string;
|
|
2042
|
+
from_name: string | null;
|
|
2043
|
+
to: string[];
|
|
2044
|
+
cc: string[];
|
|
2045
|
+
reply_to: string | null;
|
|
2046
|
+
/** The `+tag` the mail was addressed to. */
|
|
2047
|
+
plus_tag: string | null;
|
|
2048
|
+
subject: string;
|
|
2049
|
+
snippet: string | null;
|
|
2050
|
+
/** The one-time code in the email, if there is one. */
|
|
2051
|
+
code: string | null;
|
|
2052
|
+
/** Links in the visible text. Never fetched by us. */
|
|
2053
|
+
links: string[];
|
|
2054
|
+
labels: string[];
|
|
2055
|
+
read: boolean;
|
|
2056
|
+
/** `clean`, `suspicious` or `spam`; null when the message wasn't scanned. */
|
|
2057
|
+
spam_status: string | null;
|
|
2058
|
+
spam_score: number | null;
|
|
2059
|
+
/** Kept from your agent as spam or a flood. Left out of lists and `wait` by default. */
|
|
2060
|
+
held: boolean;
|
|
2061
|
+
/** The From domain is proved by aligned SPF or DKIM. False never means forged, true never means safe. */
|
|
2062
|
+
sender_verified: boolean;
|
|
2063
|
+
authentication: {
|
|
2064
|
+
spf: string | null;
|
|
2065
|
+
dkim: string | null;
|
|
2066
|
+
dmarc: string | null;
|
|
2067
|
+
};
|
|
2068
|
+
/** The email had text a reader wouldn't see. Common in marketing mail, so not alarming alone. */
|
|
2069
|
+
hidden_text_removed: boolean;
|
|
2070
|
+
/** A hint that the email tries to instruct an agent. No flag never means safe. */
|
|
2071
|
+
prompt_injection: {
|
|
2072
|
+
flagged: boolean;
|
|
2073
|
+
signals: string[];
|
|
2074
|
+
};
|
|
2075
|
+
/** An automatic message: out-of-office, bounce and the like. Agents shouldn't answer these. */
|
|
2076
|
+
auto_submitted: boolean;
|
|
2077
|
+
size: number;
|
|
2078
|
+
attachments: MailboxAttachment[];
|
|
2079
|
+
received_at: string;
|
|
2080
|
+
expires_at: string | null;
|
|
2081
|
+
/** True on received mail. False only on your agent's own sent messages. */
|
|
2082
|
+
untrusted: boolean;
|
|
2083
|
+
};
|
|
2084
|
+
type MailboxMessageDetail = MailboxMessage & {
|
|
2085
|
+
rfc_message_id: string | null;
|
|
2086
|
+
in_reply_to: string | null;
|
|
2087
|
+
references: string[];
|
|
2088
|
+
/** What a person would see: hidden text and invisible characters removed. Prefer this. */
|
|
2089
|
+
visible_text: string | null;
|
|
2090
|
+
/** `visible_text` without quoted history. */
|
|
2091
|
+
reply_text: string | null;
|
|
2092
|
+
/** The raw text body, hidden text included. */
|
|
2093
|
+
text: string | null;
|
|
2094
|
+
/** The raw HTML body, hidden text included, remote images removed. */
|
|
2095
|
+
html: string | null;
|
|
2096
|
+
};
|
|
2097
|
+
type ListMailboxThreadsParams = {
|
|
2098
|
+
label?: string;
|
|
2099
|
+
participant?: string;
|
|
2100
|
+
unread?: boolean;
|
|
2101
|
+
/** True lists archived threads instead of the others. */
|
|
2102
|
+
archived?: boolean;
|
|
2103
|
+
since?: Date | string;
|
|
2104
|
+
include_held?: boolean;
|
|
2105
|
+
limit?: number;
|
|
2106
|
+
cursor?: string;
|
|
2107
|
+
};
|
|
2108
|
+
type ListMailboxThreadsResult = {
|
|
2109
|
+
data: MailboxThread[];
|
|
2110
|
+
has_more: boolean;
|
|
2111
|
+
next_cursor: string | null;
|
|
2112
|
+
};
|
|
2113
|
+
type GetMailboxThreadParams = {
|
|
2114
|
+
include_held?: boolean;
|
|
2115
|
+
};
|
|
2116
|
+
type UpdateMailboxThreadParams = {
|
|
2117
|
+
/** Replaces the thread's labels. */
|
|
2118
|
+
labels?: string[];
|
|
2119
|
+
/** Marks every received message on it read or unread. */
|
|
2120
|
+
read?: boolean;
|
|
2121
|
+
archived?: boolean;
|
|
2122
|
+
};
|
|
2123
|
+
type ListMailboxMessagesParams = {
|
|
2124
|
+
/** Searches the subject, sender and visible text. */
|
|
2125
|
+
q?: string;
|
|
2126
|
+
from?: string;
|
|
2127
|
+
/** Thread id (`thd_…`). */
|
|
2128
|
+
thread?: string;
|
|
2129
|
+
label?: string;
|
|
2130
|
+
unread?: boolean;
|
|
2131
|
+
since?: Date | string;
|
|
2132
|
+
include_held?: boolean;
|
|
2133
|
+
limit?: number;
|
|
2134
|
+
cursor?: string;
|
|
2135
|
+
};
|
|
2136
|
+
type ListMailboxMessagesResult = {
|
|
2137
|
+
data: MailboxMessage[];
|
|
2138
|
+
has_more: boolean;
|
|
2139
|
+
next_cursor: string | null;
|
|
2140
|
+
};
|
|
2141
|
+
type UpdateMailboxMessageParams = {
|
|
2142
|
+
/** Replaces the message's labels. */
|
|
2143
|
+
labels?: string[];
|
|
2144
|
+
read?: boolean;
|
|
2145
|
+
};
|
|
2146
|
+
type MailboxOutgoingAttachment = NonNullable<SendEmailParams['attachments']>[number];
|
|
2147
|
+
type SendMailboxMessageParams = {
|
|
2148
|
+
to: string | string[];
|
|
2149
|
+
cc?: string | string[];
|
|
2150
|
+
subject: string;
|
|
2151
|
+
/** `text`, `html` or both. */
|
|
2152
|
+
text?: string;
|
|
2153
|
+
html?: string;
|
|
2154
|
+
attachments?: MailboxOutgoingAttachment[];
|
|
2155
|
+
/** Optional Idempotency-Key (24h TTL): a retry with the same key doesn't send twice. */
|
|
2156
|
+
idempotencyKey?: string;
|
|
2157
|
+
};
|
|
2158
|
+
type ReplyToMailboxMessageParams = {
|
|
2159
|
+
/** `text`, `html` or both. */
|
|
2160
|
+
text?: string;
|
|
2161
|
+
html?: string;
|
|
2162
|
+
/** Also copy everyone else on the message. Each of them counts toward the new-recipient limits. */
|
|
2163
|
+
reply_all?: boolean;
|
|
2164
|
+
attachments?: MailboxOutgoingAttachment[];
|
|
2165
|
+
/** Optional Idempotency-Key (24h TTL): a retry with the same key doesn't send twice. */
|
|
2166
|
+
idempotencyKey?: string;
|
|
2167
|
+
};
|
|
2168
|
+
type MailboxSendResult = {
|
|
2169
|
+
object: 'mailbox_send';
|
|
2170
|
+
/** The sent message (`mbm_…`). */
|
|
2171
|
+
message_id: string;
|
|
2172
|
+
thread_id: string;
|
|
2173
|
+
/** The email (`msg_…`), for delivery events and `emails.get`. */
|
|
2174
|
+
email_id: string;
|
|
2175
|
+
status: string;
|
|
2176
|
+
};
|
|
2177
|
+
type WaitForMailboxMessageParams = {
|
|
2178
|
+
/** Only this sender. */
|
|
2179
|
+
from?: string;
|
|
2180
|
+
/** Only this thread (`thd_…`). */
|
|
2181
|
+
thread?: string;
|
|
2182
|
+
/** Only mail stored after this time. Default: now. To walk through mail, pass the last message's `received_at`. */
|
|
2183
|
+
since?: Date | string;
|
|
2184
|
+
/** Total milliseconds to wait. Default 30000. */
|
|
2185
|
+
timeout?: number;
|
|
2186
|
+
};
|
|
1858
2187
|
|
|
1859
2188
|
declare class AutomationsResource {
|
|
1860
2189
|
private readonly client;
|
|
@@ -2220,6 +2549,89 @@ declare class KeysResource {
|
|
|
2220
2549
|
}>;
|
|
2221
2550
|
}
|
|
2222
2551
|
|
|
2552
|
+
/** Longest single wait the API holds open, in seconds. */
|
|
2553
|
+
declare const MAILBOX_WAIT_MAX_SECONDS = 60;
|
|
2554
|
+
declare const MAILBOX_WAIT_DEFAULT_MS = 30000;
|
|
2555
|
+
/** A mailbox's conversations. Takes the mailbox's `mbx_` id, address or `external_id`. */
|
|
2556
|
+
declare class MailboxThreadsResource {
|
|
2557
|
+
private readonly client;
|
|
2558
|
+
constructor(client: Groundmail);
|
|
2559
|
+
/** Threads, newest activity first. Held and archived threads only when asked for. */
|
|
2560
|
+
list(mailbox: string, params?: ListMailboxThreadsParams): Promise<ListMailboxThreadsResult>;
|
|
2561
|
+
/** One thread with its messages, oldest first. */
|
|
2562
|
+
get(mailbox: string, threadId: string, params?: GetMailboxThreadParams): Promise<MailboxThreadDetail>;
|
|
2563
|
+
/** Replace its labels, or mark it read or archived. */
|
|
2564
|
+
update(mailbox: string, threadId: string, params: UpdateMailboxThreadParams): Promise<MailboxThread>;
|
|
2565
|
+
}
|
|
2566
|
+
/** A mailbox's messages. Takes the mailbox's `mbx_` id, address or `external_id`. */
|
|
2567
|
+
declare class MailboxMessagesResource {
|
|
2568
|
+
private readonly client;
|
|
2569
|
+
constructor(client: Groundmail);
|
|
2570
|
+
/** Messages without their bodies, newest first. `q` searches the subject, sender and visible text. */
|
|
2571
|
+
list(mailbox: string, params?: ListMailboxMessagesParams): Promise<ListMailboxMessagesResult>;
|
|
2572
|
+
/** One message with its bodies, code, links, attachments and sender checks. */
|
|
2573
|
+
get(mailbox: string, messageId: string): Promise<MailboxMessageDetail>;
|
|
2574
|
+
/** Replace its labels, or mark it read or unread. */
|
|
2575
|
+
update(mailbox: string, messageId: string, params: UpdateMailboxMessageParams): Promise<MailboxMessageDetail>;
|
|
2576
|
+
/**
|
|
2577
|
+
* Email someone first, from a mailbox on your own domain. Hosted addresses can only
|
|
2578
|
+
* reply. First contact goes through the cold-outreach check, counts toward the
|
|
2579
|
+
* new-recipient limits and carries one-click unsubscribe.
|
|
2580
|
+
*/
|
|
2581
|
+
send(mailbox: string, params: SendMailboxMessageParams): Promise<MailboxSendResult>;
|
|
2582
|
+
/**
|
|
2583
|
+
* Reply in the thread, to the message's `Reply-To` or else its `From`. Threading
|
|
2584
|
+
* headers and the `Re:` subject are built for you. A sender who failed DMARC can't be
|
|
2585
|
+
* replied to, and a hosted address can only reply to one who passed.
|
|
2586
|
+
*/
|
|
2587
|
+
reply(mailbox: string, messageId: string, params: ReplyToMailboxMessageParams): Promise<MailboxSendResult>;
|
|
2588
|
+
/** An attachment's bytes. They came from a stranger: never run or render them. */
|
|
2589
|
+
downloadAttachment(mailbox: string, messageId: string, attachmentId: string): Promise<MailboxAttachmentDownload>;
|
|
2590
|
+
}
|
|
2591
|
+
/**
|
|
2592
|
+
* Agent mailboxes: real addresses your agent creates by API, reads and sends from.
|
|
2593
|
+
* Every method takes the mailbox's `mbx_` id, its address or your `external_id`.
|
|
2594
|
+
*
|
|
2595
|
+
* Everything in a received message was written by a stranger, and `untrusted: true`
|
|
2596
|
+
* says so on each one. Treat it as data, never as instructions.
|
|
2597
|
+
*
|
|
2598
|
+
* ```ts
|
|
2599
|
+
* const mailbox = await groundmail.mailboxes.create({ local_part: 'signup-bot' })
|
|
2600
|
+
* const since = new Date()
|
|
2601
|
+
* await page.fill('#email', mailbox.address) // the service emails your agent
|
|
2602
|
+
* const message = await groundmail.mailboxes.wait(mailbox.id, { since })
|
|
2603
|
+
* await page.fill('#code', message.code!)
|
|
2604
|
+
* ```
|
|
2605
|
+
*/
|
|
2606
|
+
declare class MailboxesResource {
|
|
2607
|
+
private readonly client;
|
|
2608
|
+
readonly threads: MailboxThreadsResource;
|
|
2609
|
+
readonly messages: MailboxMessagesResource;
|
|
2610
|
+
constructor(client: Groundmail);
|
|
2611
|
+
/** A new mailbox. With no `domain` it gets a hosted address; with no `local_part`, a generated one. */
|
|
2612
|
+
create(params?: CreateMailboxParams): Promise<Mailbox>;
|
|
2613
|
+
/** Mailboxes, newest first. */
|
|
2614
|
+
list(params?: ListMailboxesParams): Promise<ListMailboxesResult>;
|
|
2615
|
+
get(mailbox: string): Promise<Mailbox>;
|
|
2616
|
+
update(mailbox: string, params: UpdateMailboxParams): Promise<Mailbox>;
|
|
2617
|
+
/**
|
|
2618
|
+
* Move a hosted address to a mailbox on your own domain: its mail arrives there for
|
|
2619
|
+
* 30 days, then it is dropped. `to` is the new mailbox's id, address or `external_id`,
|
|
2620
|
+
* of the same tenant. The 30 days can't be extended, and the old address can't send
|
|
2621
|
+
* and isn't billed in the meantime. Returns the old mailbox.
|
|
2622
|
+
*/
|
|
2623
|
+
forward(mailbox: string, params: ForwardMailboxParams): Promise<Mailbox>;
|
|
2624
|
+
/** Deletes the mailbox and all its mail. A hosted address is never given out again. */
|
|
2625
|
+
delete(mailbox: string): Promise<DeleteMailboxResult>;
|
|
2626
|
+
/**
|
|
2627
|
+
* Wait for the next message and return it. Counts from `since`, or from now when
|
|
2628
|
+
* left out: to catch mail a step of yours sets off, take `since` before that step.
|
|
2629
|
+
* Waits up to `timeout` ms (default 30s), then throws a `GroundmailError` with
|
|
2630
|
+
* status 408 and code `timeout`; pass its `details.since` to carry on from there.
|
|
2631
|
+
*/
|
|
2632
|
+
wait(mailbox: string, params?: WaitForMailboxMessageParams): Promise<MailboxMessageDetail>;
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2223
2635
|
/** Combine the reports of one import's requests: every item, the latest totals. */
|
|
2224
2636
|
declare function mergeMigrations(previous: Migration | null, next: Migration): Migration;
|
|
2225
2637
|
/**
|
|
@@ -2552,6 +2964,8 @@ declare class Groundmail {
|
|
|
2552
2964
|
readonly testInbox: TestInboxResource;
|
|
2553
2965
|
/** BurrowGuard: keep bots and bad addresses out of your sign-up and contact forms. */
|
|
2554
2966
|
readonly burrowguard: BurrowGuardResource;
|
|
2967
|
+
/** Agent mailboxes: real addresses your agent creates by API, receives at and reads. */
|
|
2968
|
+
readonly mailboxes: MailboxesResource;
|
|
2555
2969
|
private readonly apiKey;
|
|
2556
2970
|
private readonly options;
|
|
2557
2971
|
private readonly getToken;
|
|
@@ -2585,6 +2999,11 @@ declare class Groundmail {
|
|
|
2585
2999
|
private authorizedFetch;
|
|
2586
3000
|
/** GET a text body (CSV downloads). Errors are JSON, like every other route. */
|
|
2587
3001
|
requestText(path: string): Promise<string>;
|
|
3002
|
+
/** GET a binary body (attachment downloads) with its headers. Errors are JSON, like every other route. */
|
|
3003
|
+
requestBytes(path: string): Promise<{
|
|
3004
|
+
bytes: Uint8Array;
|
|
3005
|
+
headers: Headers;
|
|
3006
|
+
}>;
|
|
2588
3007
|
request<T>(path: string, init: RequestInit): Promise<T>;
|
|
2589
3008
|
}
|
|
2590
3009
|
/** A token provider's result → the token and its expiry (ms since epoch), if known. */
|
|
@@ -2593,4 +3012,4 @@ declare function normalizeAccessToken(value: GroundmailAccessToken | null | unde
|
|
|
2593
3012
|
expiresAt: number | null;
|
|
2594
3013
|
};
|
|
2595
3014
|
|
|
2596
|
-
export { type
|
|
3015
|
+
export { type CreateMigrationParams as $, type ApiErrorBody as A, type Batch as B, type BrandLogo as C, type DnsRecord as D, type BrandSettings as E, type BurrowGuardCheck as F, Groundmail as G, type BurrowGuardReason as H, BurrowGuardResource as I, type BurrowGuardSite as J, type BurrowGuardSiteWithSecret as K, type BurrowGuardVerifyParams as L, type BurrowGuardVerifyResult as M, type CancelBatchResult as N, type CategoryOptOut as O, type CategoryOptOutCategory as P, type CategoryUnsubscribedErrorDetails as Q, type ConnectTwilioParams as R, type SendEmailResult as S, type ContactWebhookEventPayload as T, type CreateApiKeyParams as U, type CreateApiKeyResult as V, type CreateAutomationParams as W, type CreateBurrowGuardSiteParams as X, type CreateDomainParams as Y, type CreateDomainResult as Z, type CreateMailboxParams as _, type ApiErrorCode as a, type ListDomainsResult as a$, type CreateSenderParams as a0, type CreateSuppressionParams as a1, type CreateTemplateParams as a2, type CreateTenantParams as a3, type CreateWebhookParams as a4, DEFAULT_API_BASE_URL as a5, type DailyRampLimitErrorDetails as a6, type DeleteMailboxResult as a7, type DeleteTenantResult as a8, type DeliverabilityBucket as a9, type EmailListItem as aA, type EmailWebhookEventPayload as aB, type EmailWebhookEventType as aC, type EnableDmarcParams as aD, type EnableDmarcResult as aE, type EnrollmentSkip as aF, type EventRecord as aG, type ForwardMailboxParams as aH, type GetMailboxThreadParams as aI, type GroundmailAccessToken as aJ, type GroundmailOptions as aK, type GroundmailTokenOptions as aL, type GroundmailTokenProvider as aM, type HeldBackErrorDetails as aN, type HeldBackReason as aO, type HeldBackRecipient as aP, type InReplyToEmail as aQ, type ListApiKeysParams as aR, type ListApiKeysResult as aS, type ListAutomationRunsParams as aT, type ListAutomationRunsResult as aU, type ListAutomationsResult as aV, type ListBurrowGuardChecksParams as aW, type ListBurrowGuardChecksResult as aX, type ListCategoryOptOutsParams as aY, type ListCategoryOptOutsResult as aZ, type ListDomainsParams as a_, type DeliverabilityDomainInsight as aa, type DeliverabilityInsightsResult as ab, type DeliverabilityMailServerRelay as ac, type DeliverabilityWindow as ad, type DmarcDailyPoint as ae, type DmarcMonitoring as af, type DmarcMonitoringDisabled as ag, type DmarcReadiness as ah, type DmarcReadinessVerdict as ai, type DmarcSource as aj, type DmarcSourceStatus as ak, type DmarcStatus as al, type DnsProviderName as am, type Domain as an, type DomainBimiAnalysis as ao, type DomainBlocklistListing as ap, type DomainBlocklistStatus as aq, type DomainBlocklists as ar, type DomainDetailResult as as, type DomainDmarcAnalysis as at, type DomainDnsAnalysis as au, type DomainStatus as av, type DomainTlsMode as aw, type DomainTrackingDns as ax, type DomainTrackingStatus as ay, type EmailDelivery as az, type ApiKey as b, type StreamDeliverability as b$, type ListEmailsParams as b0, type ListEmailsResult as b1, type ListMailboxMessagesParams as b2, type ListMailboxMessagesResult as b3, type ListMailboxThreadsParams as b4, type ListMailboxThreadsResult as b5, type ListMailboxesParams as b6, type ListMailboxesResult as b7, type ListReceivedEmailsParams as b8, type ListReceivedEmailsResult as b9, type MailboxThread as bA, type MailboxThreadDetail as bB, MailboxThreadsResource as bC, type MailboxWebhookEventPayload as bD, MailboxesResource as bE, type Migration as bF, type MigrationDnsChange as bG, type MigrationDnsPlan as bH, type MigrationDomainItem as bI, type MigrationItemStatus as bJ, type MigrationProvider as bK, type MigrationResource as bL, type MigrationSummary as bM, type MigrationTemplateItem as bN, type MigrationTotals as bO, type MigrationWebhookItem as bP, type ReceivedEmail as bQ, type ReceivedEmailAttachment as bR, type ReceivedEmailAttachmentMeta as bS, type RemoteApplyDnsCredentials as bT, type RemoveCategoryOptOutOptions as bU, type ReplyToMailboxMessageParams as bV, type RunMigrationOptions as bW, type SendEmailParams as bX, type SendMailboxMessageParams as bY, type Sender as bZ, type SesMigrationParams as b_, type ListSendersResult as ba, type ListSuppressionsParams as bb, type ListSuppressionsResult as bc, type ListTemplatesParams as bd, type ListTemplatesResult as be, type ListTenantDomainsResult as bf, type ListTenantsParams as bg, type ListTenantsResult as bh, type ListTestInboxEmailsParams as bi, type ListTestInboxEmailsResult as bj, type ListWebhookDeliveriesParams as bk, type ListWebhookDeliveriesResult as bl, MAILBOX_WAIT_DEFAULT_MS as bm, MAILBOX_WAIT_MAX_SECONDS as bn, type MailServerSigningStatus as bo, type MailStream as bp, type Mailbox as bq, type MailboxAttachment as br, type MailboxAttachmentDownload as bs, type MailboxForwarding as bt, type MailboxMessage as bu, type MailboxMessageDetail as bv, MailboxMessagesResource as bw, type MailboxOutgoingAttachment as bx, type MailboxSendResult as by, type MailboxStatus as bz, type ApiKeyMigrationParams as c, type SuppressedErrorDetails as c0, type Suppression as c1, TEST_INBOX_WAIT_DEFAULT_MS as c2, TEST_INBOX_WAIT_MAX_SECONDS as c3, type Template as c4, type TemplateFormat as c5, type TemplateLintWarning as c6, type TemplateStarter as c7, type TemplateStatus as c8, type TemplateVersion as c9, type UpdateMailboxParams as cA, type UpdateMailboxThreadParams as cB, type UpdateSenderParams as cC, type UpdateTemplateParams as cD, type UpdateTenantParams as cE, type UpdateWebhookParams as cF, type ValidateEmailResult as cG, type ValidationReason as cH, type ValidationVerdict as cI, type VerifyDomainResult as cJ, type WaitForMailboxMessageParams as cK, type WaitForTestEmailParams as cL, type WebhookDelivery as cM, type WebhookDeliveryAttempt as cN, type WebhookDeliveryDetail as cO, type WebhookDeliveryStatus as cP, type WebhookEmailTag as cQ, type WebhookEndpoint as cR, type WebhookEndpointHealth as cS, type WebhookEndpointWithSecret as cT, type WebhookEventType as cU, mergeMigrations as cV, normalizeAccessToken as cW, type Tenant as ca, type TenantPauseSource as cb, type TenantRamp as cc, type TenantStats as cd, type TenantStatsResult as ce, type TenantStatus as cf, type TenantStreamPolicy as cg, type TestEmailWebhookParams as ch, type TestEmailWebhookResult as ci, type TestInbox as cj, type TestInboxAddressOptions as ck, type TestInboxEmail as cl, type TestInboxEmailDetail as cm, type TestInboxHeader as cn, TestInboxResource as co, type TestInboxUsage as cp, type TriggerEventParams as cq, type TriggerEventResult as cr, type TwilioIntegrationResponse as cs, type TwilioIntegrationStatus as ct, type UpdateAutomationParams as cu, type UpdateBrandParams as cv, type UpdateBurrowGuardSiteParams as cw, type UpdateDomainParams as cx, type UpdateEmailParams as cy, type UpdateMailboxMessageParams as cz, type ApiKeyScope as d, type ApplyDnsParams as e, type ApplyDnsRecordResult as f, type ApplyDnsResult as g, type Asset as h, type Automation as i, type AutomationBranchQuestion as j, type AutomationBranchStep as k, type AutomationInlineEmail as l, type AutomationResult as m, type AutomationRun as n, type AutomationRunResponse as o, type AutomationRunStatus as p, type AutomationRunStep as q, type AutomationRunStepStatus as r, type AutomationSendEmailStep as s, type AutomationStatus as t, type AutomationStep as u, type AutomationTemplateEmail as v, type AutomationTrigger as w, type BatchSendEmailResult as x, type BounceType as y, type Brand as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ApiErrorBody, D as DnsRecord } from './client-
|
|
2
|
-
export { a as ApiErrorCode, b as ApiKey, c as ApiKeyMigrationParams, d as ApiKeyScope, e as ApplyDnsParams, f as ApplyDnsRecordResult, g as ApplyDnsResult, h as Asset, i as Automation, j as AutomationBranchQuestion, k as AutomationBranchStep, l as AutomationInlineEmail, m as AutomationResult, n as AutomationRun, o as AutomationRunResponse, p as AutomationRunStatus, q as AutomationRunStep, r as AutomationRunStepStatus, s as AutomationSendEmailStep, t as AutomationStatus, u as AutomationStep, v as AutomationTemplateEmail, w as AutomationTrigger, B as Batch, x as BatchSendEmailResult, y as BounceType, z as Brand, C as BrandLogo, E as BrandSettings, F as BurrowGuardCheck, H as BurrowGuardReason, I as BurrowGuardResource, J as BurrowGuardSite, K as BurrowGuardSiteWithSecret, L as BurrowGuardVerifyParams, M as BurrowGuardVerifyResult, N as CancelBatchResult, O as CategoryOptOut, P as CategoryOptOutCategory, Q as CategoryUnsubscribedErrorDetails, R as ConnectTwilioParams, T as ContactWebhookEventPayload, U as CreateApiKeyParams, V as CreateApiKeyResult, W as CreateAutomationParams, X as CreateBurrowGuardSiteParams, Y as CreateDomainParams, Z as CreateDomainResult, _ as
|
|
1
|
+
import { A as ApiErrorBody, D as DnsRecord } from './client-DWPH4iLB.js';
|
|
2
|
+
export { a as ApiErrorCode, b as ApiKey, c as ApiKeyMigrationParams, d as ApiKeyScope, e as ApplyDnsParams, f as ApplyDnsRecordResult, g as ApplyDnsResult, h as Asset, i as Automation, j as AutomationBranchQuestion, k as AutomationBranchStep, l as AutomationInlineEmail, m as AutomationResult, n as AutomationRun, o as AutomationRunResponse, p as AutomationRunStatus, q as AutomationRunStep, r as AutomationRunStepStatus, s as AutomationSendEmailStep, t as AutomationStatus, u as AutomationStep, v as AutomationTemplateEmail, w as AutomationTrigger, B as Batch, x as BatchSendEmailResult, y as BounceType, z as Brand, C as BrandLogo, E as BrandSettings, F as BurrowGuardCheck, H as BurrowGuardReason, I as BurrowGuardResource, J as BurrowGuardSite, K as BurrowGuardSiteWithSecret, L as BurrowGuardVerifyParams, M as BurrowGuardVerifyResult, N as CancelBatchResult, O as CategoryOptOut, P as CategoryOptOutCategory, Q as CategoryUnsubscribedErrorDetails, R as ConnectTwilioParams, T as ContactWebhookEventPayload, U as CreateApiKeyParams, V as CreateApiKeyResult, W as CreateAutomationParams, X as CreateBurrowGuardSiteParams, Y as CreateDomainParams, Z as CreateDomainResult, _ as CreateMailboxParams, $ as CreateMigrationParams, a0 as CreateSenderParams, a1 as CreateSuppressionParams, a2 as CreateTemplateParams, a3 as CreateTenantParams, a4 as CreateWebhookParams, a5 as DEFAULT_API_BASE_URL, a6 as DailyRampLimitErrorDetails, a7 as DeleteMailboxResult, a8 as DeleteTenantResult, a9 as DeliverabilityBucket, aa as DeliverabilityDomainInsight, ab as DeliverabilityInsightsResult, ac as DeliverabilityMailServerRelay, ad as DeliverabilityWindow, ae as DmarcDailyPoint, af as DmarcMonitoring, ag as DmarcMonitoringDisabled, ah as DmarcReadiness, ai as DmarcReadinessVerdict, aj as DmarcSource, ak as DmarcSourceStatus, al as DmarcStatus, am as DnsProviderName, an as Domain, ao as DomainBimiAnalysis, ap as DomainBlocklistListing, aq as DomainBlocklistStatus, ar as DomainBlocklists, as as DomainDetailResult, at as DomainDmarcAnalysis, au as DomainDnsAnalysis, av as DomainStatus, aw as DomainTlsMode, ax as DomainTrackingDns, ay as DomainTrackingStatus, az as EmailDelivery, aA as EmailListItem, aB as EmailWebhookEventPayload, aC as EmailWebhookEventType, aD as EnableDmarcParams, aE as EnableDmarcResult, aF as EnrollmentSkip, aG as EventRecord, aH as ForwardMailboxParams, aI as GetMailboxThreadParams, G as Groundmail, aJ as GroundmailAccessToken, aK as GroundmailOptions, aL as GroundmailTokenOptions, aM as GroundmailTokenProvider, aN as HeldBackErrorDetails, aO as HeldBackReason, aP as HeldBackRecipient, aQ as InReplyToEmail, aR as ListApiKeysParams, aS as ListApiKeysResult, aT as ListAutomationRunsParams, aU as ListAutomationRunsResult, aV as ListAutomationsResult, aW as ListBurrowGuardChecksParams, aX as ListBurrowGuardChecksResult, aY as ListCategoryOptOutsParams, aZ as ListCategoryOptOutsResult, a_ as ListDomainsParams, a$ as ListDomainsResult, b0 as ListEmailsParams, b1 as ListEmailsResult, b2 as ListMailboxMessagesParams, b3 as ListMailboxMessagesResult, b4 as ListMailboxThreadsParams, b5 as ListMailboxThreadsResult, b6 as ListMailboxesParams, b7 as ListMailboxesResult, b8 as ListReceivedEmailsParams, b9 as ListReceivedEmailsResult, ba as ListSendersResult, bb as ListSuppressionsParams, bc as ListSuppressionsResult, bd as ListTemplatesParams, be as ListTemplatesResult, bf as ListTenantDomainsResult, bg as ListTenantsParams, bh as ListTenantsResult, bi as ListTestInboxEmailsParams, bj as ListTestInboxEmailsResult, bk as ListWebhookDeliveriesParams, bl as ListWebhookDeliveriesResult, bm as MAILBOX_WAIT_DEFAULT_MS, bn as MAILBOX_WAIT_MAX_SECONDS, bo as MailServerSigningStatus, bp as MailStream, bq as Mailbox, br as MailboxAttachment, bs as MailboxAttachmentDownload, bt as MailboxForwarding, bu as MailboxMessage, bv as MailboxMessageDetail, bw as MailboxMessagesResource, bx as MailboxOutgoingAttachment, by as MailboxSendResult, bz as MailboxStatus, bA as MailboxThread, bB as MailboxThreadDetail, bC as MailboxThreadsResource, bD as MailboxWebhookEventPayload, bE as MailboxesResource, bF as Migration, bG as MigrationDnsChange, bH as MigrationDnsPlan, bI as MigrationDomainItem, bJ as MigrationItemStatus, bK as MigrationProvider, bL as MigrationResource, bM as MigrationSummary, bN as MigrationTemplateItem, bO as MigrationTotals, bP as MigrationWebhookItem, bQ as ReceivedEmail, bR as ReceivedEmailAttachment, bS as ReceivedEmailAttachmentMeta, bT as RemoteApplyDnsCredentials, bU as RemoveCategoryOptOutOptions, bV as ReplyToMailboxMessageParams, bW as RunMigrationOptions, bX as SendEmailParams, S as SendEmailResult, bY as SendMailboxMessageParams, bZ as Sender, b_ as SesMigrationParams, b$ as StreamDeliverability, c0 as SuppressedErrorDetails, c1 as Suppression, c2 as TEST_INBOX_WAIT_DEFAULT_MS, c3 as TEST_INBOX_WAIT_MAX_SECONDS, c4 as Template, c5 as TemplateFormat, c6 as TemplateLintWarning, c7 as TemplateStarter, c8 as TemplateStatus, c9 as TemplateVersion, ca as Tenant, cb as TenantPauseSource, cc as TenantRamp, cd as TenantStats, ce as TenantStatsResult, cf as TenantStatus, cg as TenantStreamPolicy, ch as TestEmailWebhookParams, ci as TestEmailWebhookResult, cj as TestInbox, ck as TestInboxAddressOptions, cl as TestInboxEmail, cm as TestInboxEmailDetail, cn as TestInboxHeader, co as TestInboxResource, cp as TestInboxUsage, cq as TriggerEventParams, cr as TriggerEventResult, cs as TwilioIntegrationResponse, ct as TwilioIntegrationStatus, cu as UpdateAutomationParams, cv as UpdateBrandParams, cw as UpdateBurrowGuardSiteParams, cx as UpdateDomainParams, cy as UpdateEmailParams, cz as UpdateMailboxMessageParams, cA as UpdateMailboxParams, cB as UpdateMailboxThreadParams, cC as UpdateSenderParams, cD as UpdateTemplateParams, cE as UpdateTenantParams, cF as UpdateWebhookParams, cG as ValidateEmailResult, cH as ValidationReason, cI as ValidationVerdict, cJ as VerifyDomainResult, cK as WaitForMailboxMessageParams, cL as WaitForTestEmailParams, cM as WebhookDelivery, cN as WebhookDeliveryAttempt, cO as WebhookDeliveryDetail, cP as WebhookDeliveryStatus, cQ as WebhookEmailTag, cR as WebhookEndpoint, cS as WebhookEndpointHealth, cT as WebhookEndpointWithSecret, cU as WebhookEventType, cV as mergeMigrations, cW as normalizeAccessToken } from './client-DWPH4iLB.js';
|
|
3
3
|
|
|
4
4
|
type GroundmailErrorOptions = {
|
|
5
5
|
code?: string;
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,11 @@ import {
|
|
|
3
3
|
DEFAULT_API_BASE_URL,
|
|
4
4
|
Groundmail,
|
|
5
5
|
GroundmailError,
|
|
6
|
+
MAILBOX_WAIT_DEFAULT_MS,
|
|
7
|
+
MAILBOX_WAIT_MAX_SECONDS,
|
|
8
|
+
MailboxMessagesResource,
|
|
9
|
+
MailboxThreadsResource,
|
|
10
|
+
MailboxesResource,
|
|
6
11
|
TEST_INBOX_WAIT_DEFAULT_MS,
|
|
7
12
|
TEST_INBOX_WAIT_MAX_SECONDS,
|
|
8
13
|
TestInboxResource,
|
|
@@ -13,7 +18,7 @@ import {
|
|
|
13
18
|
normalizeAccessToken,
|
|
14
19
|
signWebhookPayload,
|
|
15
20
|
verifyWebhookSignature
|
|
16
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-UL6W7BCH.js";
|
|
17
22
|
|
|
18
23
|
// src/simulator.ts
|
|
19
24
|
var SIMULATOR_DOMAIN = "simulator.groundmail.dev";
|
|
@@ -39,6 +44,11 @@ export {
|
|
|
39
44
|
DEFAULT_API_BASE_URL,
|
|
40
45
|
Groundmail,
|
|
41
46
|
GroundmailError,
|
|
47
|
+
MAILBOX_WAIT_DEFAULT_MS,
|
|
48
|
+
MAILBOX_WAIT_MAX_SECONDS,
|
|
49
|
+
MailboxMessagesResource,
|
|
50
|
+
MailboxThreadsResource,
|
|
51
|
+
MailboxesResource,
|
|
42
52
|
SIMULATOR_DOMAIN,
|
|
43
53
|
SIMULATOR_OUTCOMES,
|
|
44
54
|
TEST_API_KEY_PREFIX,
|
package/dist/payload.d.ts
CHANGED
package/dist/payload.js
CHANGED