resend 6.32.1-preview-inboxes.1 → 6.32.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/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.32.1-preview-inboxes.1";
28
+ var version = "6.32.1";
57
29
  //#endregion
58
30
  //#region src/common/utils/build-pagination-query.ts
59
31
  function buildPaginationUrl(base, options) {
@@ -911,7 +883,7 @@ var Receiving = class {
911
883
  }
912
884
  };
913
885
  return {
914
- content: await response.text(),
886
+ content: await response.arrayBuffer(),
915
887
  error: null
916
888
  };
917
889
  } catch {
@@ -1007,189 +979,6 @@ var Events$1 = class {
1007
979
  }
1008
980
  };
1009
981
  //#endregion
1010
- //#region src/inboxes/build-inbox-cursor-query.ts
1011
- function buildInboxCursorUrl(base, options = {}) {
1012
- const searchParams = new URLSearchParams();
1013
- if (options.folder !== void 0) searchParams.set("folder", options.folder);
1014
- if (options.query !== void 0) searchParams.set("query", options.query);
1015
- if (options.from !== void 0) searchParams.set("from", options.from);
1016
- if (options.limit !== void 0) searchParams.set("limit", String(options.limit));
1017
- if (options.after !== void 0) searchParams.set("after", options.after);
1018
- if (options.before !== void 0) searchParams.set("before", options.before);
1019
- const labels = options.label === void 0 ? [] : Array.isArray(options.label) ? options.label : [options.label];
1020
- for (const label of labels) searchParams.append("label", label);
1021
- const queryString = searchParams.toString();
1022
- return queryString ? `${base}?${queryString}` : base;
1023
- }
1024
- //#endregion
1025
- //#region src/inboxes/drafts/drafts.ts
1026
- var InboxDrafts = class {
1027
- constructor(resend) {
1028
- this.resend = resend;
1029
- }
1030
- async list(options, requestOptions = {}) {
1031
- const { inboxId, limit, after, before } = options;
1032
- const url = buildInboxCursorUrl(`/inboxes/${inboxId}/drafts`, {
1033
- limit,
1034
- after,
1035
- before
1036
- });
1037
- return this.resend.get(url, requestOptions);
1038
- }
1039
- async create(payload, options = {}) {
1040
- const { inboxId, threadId, replyToEmailId, ...content } = payload;
1041
- return this.resend.post(`/inboxes/${inboxId}/drafts`, {
1042
- ...content,
1043
- thread_id: threadId,
1044
- reply_to_email_id: replyToEmailId
1045
- }, options);
1046
- }
1047
- async get(options, requestOptions = {}) {
1048
- const { inboxId, draftId } = options;
1049
- return this.resend.get(`/inboxes/${inboxId}/drafts/${draftId}`, requestOptions);
1050
- }
1051
- async update(options, requestOptions = {}) {
1052
- const { inboxId, draftId, ...content } = options;
1053
- return this.resend.patch(`/inboxes/${inboxId}/drafts/${draftId}`, content, requestOptions);
1054
- }
1055
- async remove(options, requestOptions = {}) {
1056
- const { inboxId, draftId } = options;
1057
- return this.resend.delete(`/inboxes/${inboxId}/drafts/${draftId}`, void 0, requestOptions);
1058
- }
1059
- async send(payload, options = {}) {
1060
- const { inboxId, draftId } = payload;
1061
- return this.resend.post(`/inboxes/${inboxId}/drafts/${draftId}/send`, void 0, options);
1062
- }
1063
- };
1064
- //#endregion
1065
- //#region src/inboxes/labels/labels.ts
1066
- var InboxLabels = class {
1067
- constructor(resend) {
1068
- this.resend = resend;
1069
- }
1070
- async list(options, requestOptions = {}) {
1071
- return this.resend.get(`/inboxes/${options.inboxId}/labels`, requestOptions);
1072
- }
1073
- async create(payload, options = {}) {
1074
- const { inboxId, name, color } = payload;
1075
- return this.resend.post(`/inboxes/${inboxId}/labels`, {
1076
- name,
1077
- color
1078
- }, options);
1079
- }
1080
- async update(options, requestOptions = {}) {
1081
- const { inboxId, labelId, name, color } = options;
1082
- return this.resend.patch(`/inboxes/${inboxId}/labels/${labelId}`, {
1083
- name,
1084
- color
1085
- }, requestOptions);
1086
- }
1087
- async remove(options, requestOptions = {}) {
1088
- const { inboxId, labelId } = options;
1089
- return this.resend.delete(`/inboxes/${inboxId}/labels/${labelId}`, void 0, requestOptions);
1090
- }
1091
- };
1092
- //#endregion
1093
- //#region src/inboxes/threads/emails/emails.ts
1094
- var InboxThreadEmails = class {
1095
- constructor(resend) {
1096
- this.resend = resend;
1097
- }
1098
- async list(options, requestOptions = {}) {
1099
- const { inboxId, threadId, ...pagination } = options;
1100
- const url = buildPaginationUrl(`/inboxes/${inboxId}/threads/${threadId}/emails`, pagination);
1101
- return this.resend.get(url, requestOptions);
1102
- }
1103
- async get(options, requestOptions = {}) {
1104
- const { inboxId, threadId, emailId } = options;
1105
- return this.resend.get(`/inboxes/${inboxId}/threads/${threadId}/emails/${emailId}`, requestOptions);
1106
- }
1107
- async reply(payload, options = {}) {
1108
- const { inboxId, threadId, emailId, cc, bcc, html, text, subject } = payload;
1109
- return this.resend.post(`/inboxes/${inboxId}/threads/${threadId}/emails/${emailId}/reply`, {
1110
- cc,
1111
- bcc,
1112
- html,
1113
- text,
1114
- subject
1115
- }, options);
1116
- }
1117
- async forward(payload, options = {}) {
1118
- const { inboxId, threadId, emailId, to, cc, bcc, html, text, subject } = payload;
1119
- return this.resend.post(`/inboxes/${inboxId}/threads/${threadId}/emails/${emailId}/forward`, {
1120
- to,
1121
- cc,
1122
- bcc,
1123
- html,
1124
- text,
1125
- subject
1126
- }, options);
1127
- }
1128
- };
1129
- //#endregion
1130
- //#region src/inboxes/threads/threads.ts
1131
- var InboxThreads = class {
1132
- constructor(resend) {
1133
- this.resend = resend;
1134
- this.emails = new InboxThreadEmails(resend);
1135
- }
1136
- async list(options, requestOptions = {}) {
1137
- const { inboxId, ...query } = options;
1138
- const url = buildInboxCursorUrl(`/inboxes/${inboxId}/threads`, query);
1139
- return this.resend.get(url, requestOptions);
1140
- }
1141
- async get(options, requestOptions = {}) {
1142
- const { inboxId, threadId } = options;
1143
- return this.resend.get(`/inboxes/${inboxId}/threads/${threadId}`, requestOptions);
1144
- }
1145
- async update(options, requestOptions = {}) {
1146
- const { inboxId, threadId, read, folder, labelId } = options;
1147
- return this.resend.patch(`/inboxes/${inboxId}/threads/${threadId}`, {
1148
- read,
1149
- folder,
1150
- label_id: labelId
1151
- }, requestOptions);
1152
- }
1153
- async remove(options, requestOptions = {}) {
1154
- const { inboxId, threadId } = options;
1155
- return this.resend.delete(`/inboxes/${inboxId}/threads/${threadId}`, void 0, requestOptions);
1156
- }
1157
- };
1158
- //#endregion
1159
- //#region src/inboxes/inboxes.ts
1160
- var Inboxes = class {
1161
- constructor(resend) {
1162
- this.resend = resend;
1163
- this.threads = new InboxThreads(resend);
1164
- this.labels = new InboxLabels(resend);
1165
- this.drafts = new InboxDrafts(resend);
1166
- }
1167
- async create(payload, options = {}) {
1168
- return this.resend.post("/inboxes", {
1169
- email_address: payload.emailAddress,
1170
- name: payload.name,
1171
- forwarding: payload.forwarding,
1172
- from_name: payload.fromName
1173
- }, options);
1174
- }
1175
- async list(options = {}, requestOptions = {}) {
1176
- const url = buildPaginationUrl("/inboxes", options);
1177
- return this.resend.get(url, requestOptions);
1178
- }
1179
- async get(idOrEmail, requestOptions = {}) {
1180
- return this.resend.get(`/inboxes/${encodeURIComponent(idOrEmail)}`, requestOptions);
1181
- }
1182
- async update(id, payload, requestOptions = {}) {
1183
- return this.resend.patch(`/inboxes/${id}`, {
1184
- name: payload.name,
1185
- from_name: payload.fromName
1186
- }, requestOptions);
1187
- }
1188
- async remove(id, requestOptions = {}) {
1189
- return this.resend.delete(`/inboxes/${id}`, void 0, requestOptions);
1190
- }
1191
- };
1192
- //#endregion
1193
982
  //#region src/logs/logs.ts
1194
983
  var Logs = class {
1195
984
  constructor(resend) {
@@ -1529,7 +1318,6 @@ var Resend = class {
1529
1318
  this.domains = new Domains(this);
1530
1319
  this.emails = new Emails(this);
1531
1320
  this.events = new Events$1(this);
1532
- this.inboxes = new Inboxes(this);
1533
1321
  this.logs = new Logs(this);
1534
1322
  this.oauthGrants = new OAuthGrants(this);
1535
1323
  this.suppressions = new Suppressions(this);
@@ -1686,7 +1474,4 @@ var Resend = class {
1686
1474
  }
1687
1475
  };
1688
1476
  //#endregion
1689
- exports.INBOX_LABEL_COLORS = INBOX_LABEL_COLORS;
1690
- exports.INBOX_MESSAGE_FOLDERS = INBOX_MESSAGE_FOLDERS;
1691
- exports.MOVE_THREAD_FOLDERS = MOVE_THREAD_FOLDERS;
1692
1477
  exports.Resend = Resend;