resend 6.28.0-preview-inboxes.0 → 6.28.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/dist/index.cjs +4 -201
- package/dist/index.d.cts +8 -476
- package/dist/index.d.mts +8 -476
- package/dist/index.mjs +5 -199
- package/package.json +14 -16
- package/readme.md +0 -16
package/dist/index.cjs
CHANGED
|
@@ -24,36 +24,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
let postal_mime = require("postal-mime");
|
|
25
25
|
postal_mime = __toESM(postal_mime);
|
|
26
26
|
let standardwebhooks = require("standardwebhooks");
|
|
27
|
-
//#region src/inboxes/interfaces/inbox.ts
|
|
28
|
-
const INBOX_MESSAGE_FOLDERS = [
|
|
29
|
-
"inbox",
|
|
30
|
-
"archive",
|
|
31
|
-
"spam",
|
|
32
|
-
"sent",
|
|
33
|
-
"trash"
|
|
34
|
-
];
|
|
35
|
-
const MOVE_THREAD_FOLDERS = [
|
|
36
|
-
"inbox",
|
|
37
|
-
"archive",
|
|
38
|
-
"spam",
|
|
39
|
-
"trash"
|
|
40
|
-
];
|
|
41
|
-
const INBOX_LABEL_COLORS = [
|
|
42
|
-
"cyan",
|
|
43
|
-
"teal",
|
|
44
|
-
"grass",
|
|
45
|
-
"lime",
|
|
46
|
-
"yellow",
|
|
47
|
-
"orange",
|
|
48
|
-
"iris",
|
|
49
|
-
"plum",
|
|
50
|
-
"crimson",
|
|
51
|
-
"bronze",
|
|
52
|
-
"mauve"
|
|
53
|
-
];
|
|
54
|
-
//#endregion
|
|
55
27
|
//#region package.json
|
|
56
|
-
var version = "6.28.0
|
|
28
|
+
var version = "6.28.0";
|
|
57
29
|
//#endregion
|
|
58
30
|
//#region src/common/utils/build-pagination-query.ts
|
|
59
31
|
function buildPaginationUrl(base, options) {
|
|
@@ -351,6 +323,9 @@ var Broadcasts = class {
|
|
|
351
323
|
async cancel(id) {
|
|
352
324
|
return await this.resend.post(`/broadcasts/${id}/cancel`);
|
|
353
325
|
}
|
|
326
|
+
async duplicate(id) {
|
|
327
|
+
return await this.resend.post(`/broadcasts/${id}/duplicate`);
|
|
328
|
+
}
|
|
354
329
|
async update(id, payload) {
|
|
355
330
|
const html = payload.react ? await render(payload.react) : payload.html;
|
|
356
331
|
return await this.resend.patch(`/broadcasts/${id}`, {
|
|
@@ -989,174 +964,6 @@ var Events$1 = class {
|
|
|
989
964
|
}
|
|
990
965
|
};
|
|
991
966
|
//#endregion
|
|
992
|
-
//#region src/inboxes/build-inbox-cursor-query.ts
|
|
993
|
-
function buildInboxCursorUrl(base, options = {}) {
|
|
994
|
-
const searchParams = new URLSearchParams();
|
|
995
|
-
if (options.folder !== void 0) searchParams.set("folder", options.folder);
|
|
996
|
-
if (options.query !== void 0) searchParams.set("query", options.query);
|
|
997
|
-
if (options.from !== void 0) searchParams.set("from", options.from);
|
|
998
|
-
if (options.cursor !== void 0) searchParams.set("cursor", options.cursor);
|
|
999
|
-
const labels = options.label === void 0 ? [] : Array.isArray(options.label) ? options.label : [options.label];
|
|
1000
|
-
for (const label of labels) searchParams.append("label", label);
|
|
1001
|
-
const queryString = searchParams.toString();
|
|
1002
|
-
return queryString ? `${base}?${queryString}` : base;
|
|
1003
|
-
}
|
|
1004
|
-
//#endregion
|
|
1005
|
-
//#region src/inboxes/drafts/drafts.ts
|
|
1006
|
-
var InboxDrafts = class {
|
|
1007
|
-
constructor(resend) {
|
|
1008
|
-
this.resend = resend;
|
|
1009
|
-
}
|
|
1010
|
-
async list(options) {
|
|
1011
|
-
const { inboxId, cursor } = options;
|
|
1012
|
-
const url = buildInboxCursorUrl(`/inboxes/${inboxId}/drafts`, { cursor });
|
|
1013
|
-
return this.resend.get(url);
|
|
1014
|
-
}
|
|
1015
|
-
async create(payload, options = {}) {
|
|
1016
|
-
const { inboxId, threadId, replyToEmailId, ...content } = payload;
|
|
1017
|
-
return this.resend.post(`/inboxes/${inboxId}/drafts`, {
|
|
1018
|
-
...content,
|
|
1019
|
-
thread_id: threadId,
|
|
1020
|
-
reply_to_email_id: replyToEmailId
|
|
1021
|
-
}, options);
|
|
1022
|
-
}
|
|
1023
|
-
async get(options) {
|
|
1024
|
-
const { inboxId, draftId } = options;
|
|
1025
|
-
return this.resend.get(`/inboxes/${inboxId}/drafts/${draftId}`);
|
|
1026
|
-
}
|
|
1027
|
-
async update(options) {
|
|
1028
|
-
const { inboxId, draftId, ...content } = options;
|
|
1029
|
-
return this.resend.patch(`/inboxes/${inboxId}/drafts/${draftId}`, content);
|
|
1030
|
-
}
|
|
1031
|
-
async remove(options) {
|
|
1032
|
-
const { inboxId, draftId } = options;
|
|
1033
|
-
return this.resend.delete(`/inboxes/${inboxId}/drafts/${draftId}`);
|
|
1034
|
-
}
|
|
1035
|
-
async send(payload, options = {}) {
|
|
1036
|
-
const { inboxId, draftId } = payload;
|
|
1037
|
-
return this.resend.post(`/inboxes/${inboxId}/drafts/${draftId}/send`, void 0, options);
|
|
1038
|
-
}
|
|
1039
|
-
};
|
|
1040
|
-
//#endregion
|
|
1041
|
-
//#region src/inboxes/labels/labels.ts
|
|
1042
|
-
var InboxLabels = class {
|
|
1043
|
-
constructor(resend) {
|
|
1044
|
-
this.resend = resend;
|
|
1045
|
-
}
|
|
1046
|
-
async list(options) {
|
|
1047
|
-
return this.resend.get(`/inboxes/${options.inboxId}/labels`);
|
|
1048
|
-
}
|
|
1049
|
-
async create(payload, options = {}) {
|
|
1050
|
-
const { inboxId, name, color } = payload;
|
|
1051
|
-
return this.resend.post(`/inboxes/${inboxId}/labels`, {
|
|
1052
|
-
name,
|
|
1053
|
-
color
|
|
1054
|
-
}, options);
|
|
1055
|
-
}
|
|
1056
|
-
async update(options) {
|
|
1057
|
-
const { inboxId, labelId, name, color } = options;
|
|
1058
|
-
return this.resend.patch(`/inboxes/${inboxId}/labels/${labelId}`, {
|
|
1059
|
-
name,
|
|
1060
|
-
color
|
|
1061
|
-
});
|
|
1062
|
-
}
|
|
1063
|
-
async remove(options) {
|
|
1064
|
-
const { inboxId, labelId } = options;
|
|
1065
|
-
return this.resend.delete(`/inboxes/${inboxId}/labels/${labelId}`);
|
|
1066
|
-
}
|
|
1067
|
-
};
|
|
1068
|
-
//#endregion
|
|
1069
|
-
//#region src/inboxes/threads/emails/emails.ts
|
|
1070
|
-
var InboxThreadEmails = class {
|
|
1071
|
-
constructor(resend) {
|
|
1072
|
-
this.resend = resend;
|
|
1073
|
-
}
|
|
1074
|
-
async get(options) {
|
|
1075
|
-
const { inboxId, threadId, emailId } = options;
|
|
1076
|
-
return this.resend.get(`/inboxes/${inboxId}/threads/${threadId}/emails/${emailId}`);
|
|
1077
|
-
}
|
|
1078
|
-
async reply(payload, options = {}) {
|
|
1079
|
-
const { inboxId, threadId, emailId, html, text, subject } = payload;
|
|
1080
|
-
return this.resend.post(`/inboxes/${inboxId}/threads/${threadId}/emails/${emailId}/reply`, {
|
|
1081
|
-
html,
|
|
1082
|
-
text,
|
|
1083
|
-
subject
|
|
1084
|
-
}, options);
|
|
1085
|
-
}
|
|
1086
|
-
async forward(payload, options = {}) {
|
|
1087
|
-
const { inboxId, threadId, emailId, to, html, text, subject } = payload;
|
|
1088
|
-
return this.resend.post(`/inboxes/${inboxId}/threads/${threadId}/emails/${emailId}/forward`, {
|
|
1089
|
-
to,
|
|
1090
|
-
html,
|
|
1091
|
-
text,
|
|
1092
|
-
subject
|
|
1093
|
-
}, options);
|
|
1094
|
-
}
|
|
1095
|
-
};
|
|
1096
|
-
//#endregion
|
|
1097
|
-
//#region src/inboxes/threads/threads.ts
|
|
1098
|
-
var InboxThreads = class {
|
|
1099
|
-
constructor(resend) {
|
|
1100
|
-
this.resend = resend;
|
|
1101
|
-
this.emails = new InboxThreadEmails(resend);
|
|
1102
|
-
}
|
|
1103
|
-
async list(options) {
|
|
1104
|
-
const { inboxId, ...query } = options;
|
|
1105
|
-
const url = buildInboxCursorUrl(`/inboxes/${inboxId}/threads`, query);
|
|
1106
|
-
return this.resend.get(url);
|
|
1107
|
-
}
|
|
1108
|
-
async get(options) {
|
|
1109
|
-
const { inboxId, threadId } = options;
|
|
1110
|
-
return this.resend.get(`/inboxes/${inboxId}/threads/${threadId}`);
|
|
1111
|
-
}
|
|
1112
|
-
async update(options) {
|
|
1113
|
-
const { inboxId, threadId, read, folder, labelId } = options;
|
|
1114
|
-
return this.resend.patch(`/inboxes/${inboxId}/threads/${threadId}`, {
|
|
1115
|
-
read,
|
|
1116
|
-
folder,
|
|
1117
|
-
label_id: labelId
|
|
1118
|
-
});
|
|
1119
|
-
}
|
|
1120
|
-
async remove(options) {
|
|
1121
|
-
const { inboxId, threadId } = options;
|
|
1122
|
-
return this.resend.delete(`/inboxes/${inboxId}/threads/${threadId}`);
|
|
1123
|
-
}
|
|
1124
|
-
};
|
|
1125
|
-
//#endregion
|
|
1126
|
-
//#region src/inboxes/inboxes.ts
|
|
1127
|
-
var Inboxes = class {
|
|
1128
|
-
constructor(resend) {
|
|
1129
|
-
this.resend = resend;
|
|
1130
|
-
this.threads = new InboxThreads(resend);
|
|
1131
|
-
this.labels = new InboxLabels(resend);
|
|
1132
|
-
this.drafts = new InboxDrafts(resend);
|
|
1133
|
-
}
|
|
1134
|
-
async create(payload, options = {}) {
|
|
1135
|
-
return this.resend.post("/inboxes", {
|
|
1136
|
-
email_address: payload.emailAddress,
|
|
1137
|
-
name: payload.name,
|
|
1138
|
-
forwarding: payload.forwarding,
|
|
1139
|
-
friendly_name: payload.friendlyName
|
|
1140
|
-
}, options);
|
|
1141
|
-
}
|
|
1142
|
-
async list(options = {}) {
|
|
1143
|
-
const url = buildPaginationUrl("/inboxes", options);
|
|
1144
|
-
return this.resend.get(url);
|
|
1145
|
-
}
|
|
1146
|
-
async get(id) {
|
|
1147
|
-
return this.resend.get(`/inboxes/${id}`);
|
|
1148
|
-
}
|
|
1149
|
-
async update(id, payload) {
|
|
1150
|
-
return this.resend.patch(`/inboxes/${id}`, {
|
|
1151
|
-
name: payload.name,
|
|
1152
|
-
friendly_name: payload.friendlyName
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
async remove(id) {
|
|
1156
|
-
return this.resend.delete(`/inboxes/${id}`);
|
|
1157
|
-
}
|
|
1158
|
-
};
|
|
1159
|
-
//#endregion
|
|
1160
967
|
//#region src/logs/logs.ts
|
|
1161
968
|
var Logs = class {
|
|
1162
969
|
constructor(resend) {
|
|
@@ -1486,7 +1293,6 @@ var Resend = class {
|
|
|
1486
1293
|
this.domains = new Domains(this);
|
|
1487
1294
|
this.emails = new Emails(this);
|
|
1488
1295
|
this.events = new Events$1(this);
|
|
1489
|
-
this.inboxes = new Inboxes(this);
|
|
1490
1296
|
this.logs = new Logs(this);
|
|
1491
1297
|
this.oauthGrants = new OAuthGrants(this);
|
|
1492
1298
|
this.suppressions = new Suppressions(this);
|
|
@@ -1640,7 +1446,4 @@ var Resend = class {
|
|
|
1640
1446
|
}
|
|
1641
1447
|
};
|
|
1642
1448
|
//#endregion
|
|
1643
|
-
exports.INBOX_LABEL_COLORS = INBOX_LABEL_COLORS;
|
|
1644
|
-
exports.INBOX_MESSAGE_FOLDERS = INBOX_MESSAGE_FOLDERS;
|
|
1645
|
-
exports.MOVE_THREAD_FOLDERS = MOVE_THREAD_FOLDERS;
|
|
1646
1449
|
exports.Resend = Resend;
|