resend 4.1.0-alpha.0 → 4.1.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/chunk-2HHXE2I7.mjs +16534 -0
- package/dist/chunk-FPVDTWJX.mjs +2216 -0
- package/dist/chunk-RO5RSJWE.mjs +83 -0
- package/dist/index.d.mts +49 -3
- package/dist/index.d.ts +49 -3
- package/dist/index.js +43 -3
- package/dist/index.mjs +43 -3
- package/dist/node-CCXSG6KK.mjs +11003 -0
- package/dist/node-I5GQK35D.mjs +9996 -0
- package/dist/server.node-2SV4OLOR.mjs +5 -0
- package/dist/server.node-UI4W6O6F.mjs +14327 -0
- package/package.json +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
25
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
26
|
+
}) : x)(function(x) {
|
|
27
|
+
if (typeof require !== "undefined")
|
|
28
|
+
return require.apply(this, arguments);
|
|
29
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
30
|
+
});
|
|
31
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
32
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
33
|
+
};
|
|
34
|
+
var __export = (target, all) => {
|
|
35
|
+
for (var name in all)
|
|
36
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
37
|
+
};
|
|
38
|
+
var __copyProps = (to, from, except, desc) => {
|
|
39
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
40
|
+
for (let key of __getOwnPropNames(from))
|
|
41
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
42
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
43
|
+
}
|
|
44
|
+
return to;
|
|
45
|
+
};
|
|
46
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
47
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
48
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
49
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
50
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
51
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
52
|
+
mod
|
|
53
|
+
));
|
|
54
|
+
var __async = (__this, __arguments, generator) => {
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
var fulfilled = (value) => {
|
|
57
|
+
try {
|
|
58
|
+
step(generator.next(value));
|
|
59
|
+
} catch (e) {
|
|
60
|
+
reject(e);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var rejected = (value) => {
|
|
64
|
+
try {
|
|
65
|
+
step(generator.throw(value));
|
|
66
|
+
} catch (e) {
|
|
67
|
+
reject(e);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
71
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
__spreadValues,
|
|
77
|
+
__spreadProps,
|
|
78
|
+
__require,
|
|
79
|
+
__commonJS,
|
|
80
|
+
__export,
|
|
81
|
+
__toESM,
|
|
82
|
+
__async
|
|
83
|
+
};
|
package/dist/index.d.mts
CHANGED
|
@@ -344,6 +344,46 @@ interface CreateBroadcastResponse {
|
|
|
344
344
|
error: ErrorResponse | null;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
interface Broadcast {
|
|
348
|
+
id: string;
|
|
349
|
+
name: string;
|
|
350
|
+
audience_id: string | null;
|
|
351
|
+
from: string | null;
|
|
352
|
+
subject: string | null;
|
|
353
|
+
reply_to: string[] | null;
|
|
354
|
+
preview_text: string | null;
|
|
355
|
+
status: 'draft' | 'sent' | 'queued';
|
|
356
|
+
created_at: string;
|
|
357
|
+
scheduled_at: string | null;
|
|
358
|
+
sent_at: string | null;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
interface GetBroadcastResponseSuccess extends Broadcast {
|
|
362
|
+
object: 'broadcast';
|
|
363
|
+
}
|
|
364
|
+
interface GetBroadcastResponse {
|
|
365
|
+
data: GetBroadcastResponseSuccess | null;
|
|
366
|
+
error: ErrorResponse | null;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
type ListBroadcastsResponseSuccess = {
|
|
370
|
+
object: 'list';
|
|
371
|
+
data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
|
|
372
|
+
};
|
|
373
|
+
interface ListBroadcastsResponse {
|
|
374
|
+
data: ListBroadcastsResponseSuccess | null;
|
|
375
|
+
error: ErrorResponse | null;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
interface RemoveBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
|
|
379
|
+
object: 'broadcast';
|
|
380
|
+
deleted: boolean;
|
|
381
|
+
}
|
|
382
|
+
interface RemoveBroadcastResponse {
|
|
383
|
+
data: RemoveBroadcastResponseSuccess | null;
|
|
384
|
+
error: ErrorResponse | null;
|
|
385
|
+
}
|
|
386
|
+
|
|
347
387
|
interface SendBroadcastBaseOptions {
|
|
348
388
|
/**
|
|
349
389
|
* Schedule email to be sent later.
|
|
@@ -371,7 +411,10 @@ declare class Broadcasts {
|
|
|
371
411
|
private renderAsync?;
|
|
372
412
|
constructor(resend: Resend);
|
|
373
413
|
create(payload: CreateBroadcastOptions, options?: CreateBroadcastRequestOptions): Promise<SendBroadcastResponse>;
|
|
374
|
-
send(id: string, payload
|
|
414
|
+
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
415
|
+
list(): Promise<ListBroadcastsResponse>;
|
|
416
|
+
get(id: string): Promise<GetBroadcastResponse>;
|
|
417
|
+
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
375
418
|
}
|
|
376
419
|
|
|
377
420
|
interface PatchOptions {
|
|
@@ -457,8 +500,11 @@ interface RemoveContactsResponse {
|
|
|
457
500
|
error: ErrorResponse | null;
|
|
458
501
|
}
|
|
459
502
|
|
|
460
|
-
interface
|
|
461
|
-
id
|
|
503
|
+
interface UpdateContactBaseOptions {
|
|
504
|
+
id?: string;
|
|
505
|
+
email?: string;
|
|
506
|
+
}
|
|
507
|
+
interface UpdateContactOptions extends UpdateContactBaseOptions {
|
|
462
508
|
audienceId: string;
|
|
463
509
|
unsubscribed?: boolean;
|
|
464
510
|
firstName?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -344,6 +344,46 @@ interface CreateBroadcastResponse {
|
|
|
344
344
|
error: ErrorResponse | null;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
interface Broadcast {
|
|
348
|
+
id: string;
|
|
349
|
+
name: string;
|
|
350
|
+
audience_id: string | null;
|
|
351
|
+
from: string | null;
|
|
352
|
+
subject: string | null;
|
|
353
|
+
reply_to: string[] | null;
|
|
354
|
+
preview_text: string | null;
|
|
355
|
+
status: 'draft' | 'sent' | 'queued';
|
|
356
|
+
created_at: string;
|
|
357
|
+
scheduled_at: string | null;
|
|
358
|
+
sent_at: string | null;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
interface GetBroadcastResponseSuccess extends Broadcast {
|
|
362
|
+
object: 'broadcast';
|
|
363
|
+
}
|
|
364
|
+
interface GetBroadcastResponse {
|
|
365
|
+
data: GetBroadcastResponseSuccess | null;
|
|
366
|
+
error: ErrorResponse | null;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
type ListBroadcastsResponseSuccess = {
|
|
370
|
+
object: 'list';
|
|
371
|
+
data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
|
|
372
|
+
};
|
|
373
|
+
interface ListBroadcastsResponse {
|
|
374
|
+
data: ListBroadcastsResponseSuccess | null;
|
|
375
|
+
error: ErrorResponse | null;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
interface RemoveBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
|
|
379
|
+
object: 'broadcast';
|
|
380
|
+
deleted: boolean;
|
|
381
|
+
}
|
|
382
|
+
interface RemoveBroadcastResponse {
|
|
383
|
+
data: RemoveBroadcastResponseSuccess | null;
|
|
384
|
+
error: ErrorResponse | null;
|
|
385
|
+
}
|
|
386
|
+
|
|
347
387
|
interface SendBroadcastBaseOptions {
|
|
348
388
|
/**
|
|
349
389
|
* Schedule email to be sent later.
|
|
@@ -371,7 +411,10 @@ declare class Broadcasts {
|
|
|
371
411
|
private renderAsync?;
|
|
372
412
|
constructor(resend: Resend);
|
|
373
413
|
create(payload: CreateBroadcastOptions, options?: CreateBroadcastRequestOptions): Promise<SendBroadcastResponse>;
|
|
374
|
-
send(id: string, payload
|
|
414
|
+
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
415
|
+
list(): Promise<ListBroadcastsResponse>;
|
|
416
|
+
get(id: string): Promise<GetBroadcastResponse>;
|
|
417
|
+
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
375
418
|
}
|
|
376
419
|
|
|
377
420
|
interface PatchOptions {
|
|
@@ -457,8 +500,11 @@ interface RemoveContactsResponse {
|
|
|
457
500
|
error: ErrorResponse | null;
|
|
458
501
|
}
|
|
459
502
|
|
|
460
|
-
interface
|
|
461
|
-
id
|
|
503
|
+
interface UpdateContactBaseOptions {
|
|
504
|
+
id?: string;
|
|
505
|
+
email?: string;
|
|
506
|
+
}
|
|
507
|
+
interface UpdateContactOptions extends UpdateContactBaseOptions {
|
|
462
508
|
audienceId: string;
|
|
463
509
|
unsubscribed?: boolean;
|
|
464
510
|
firstName?: string;
|
package/dist/index.js
CHANGED
|
@@ -72,7 +72,7 @@ __export(src_exports, {
|
|
|
72
72
|
module.exports = __toCommonJS(src_exports);
|
|
73
73
|
|
|
74
74
|
// package.json
|
|
75
|
-
var version = "4.1.
|
|
75
|
+
var version = "4.1.1";
|
|
76
76
|
|
|
77
77
|
// src/api-keys/api-keys.ts
|
|
78
78
|
var ApiKeys = class {
|
|
@@ -225,7 +225,29 @@ var Broadcasts = class {
|
|
|
225
225
|
return __async(this, null, function* () {
|
|
226
226
|
const data = yield this.resend.post(
|
|
227
227
|
`/broadcasts/${id}/send`,
|
|
228
|
-
{ scheduled_at: payload.scheduledAt }
|
|
228
|
+
{ scheduled_at: payload == null ? void 0 : payload.scheduledAt }
|
|
229
|
+
);
|
|
230
|
+
return data;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
list() {
|
|
234
|
+
return __async(this, null, function* () {
|
|
235
|
+
const data = yield this.resend.get("/broadcasts");
|
|
236
|
+
return data;
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
get(id) {
|
|
240
|
+
return __async(this, null, function* () {
|
|
241
|
+
const data = yield this.resend.get(
|
|
242
|
+
`/broadcasts/${id}`
|
|
243
|
+
);
|
|
244
|
+
return data;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
remove(id) {
|
|
248
|
+
return __async(this, null, function* () {
|
|
249
|
+
const data = yield this.resend.delete(
|
|
250
|
+
`/broadcasts/${id}`
|
|
229
251
|
);
|
|
230
252
|
return data;
|
|
231
253
|
});
|
|
@@ -270,8 +292,17 @@ var Contacts = class {
|
|
|
270
292
|
}
|
|
271
293
|
update(payload) {
|
|
272
294
|
return __async(this, null, function* () {
|
|
295
|
+
if (!payload.id && !payload.email) {
|
|
296
|
+
return {
|
|
297
|
+
data: null,
|
|
298
|
+
error: {
|
|
299
|
+
message: "Missing `id` or `email` field.",
|
|
300
|
+
name: "missing_required_field"
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
}
|
|
273
304
|
const data = yield this.resend.patch(
|
|
274
|
-
`/audiences/${payload.audienceId}/contacts/${payload.id}`,
|
|
305
|
+
`/audiences/${payload.audienceId}/contacts/${(payload == null ? void 0 : payload.email) ? payload == null ? void 0 : payload.email : payload == null ? void 0 : payload.id}`,
|
|
275
306
|
{
|
|
276
307
|
unsubscribed: payload.unsubscribed,
|
|
277
308
|
first_name: payload.firstName,
|
|
@@ -283,6 +314,15 @@ var Contacts = class {
|
|
|
283
314
|
}
|
|
284
315
|
remove(payload) {
|
|
285
316
|
return __async(this, null, function* () {
|
|
317
|
+
if (!payload.id && !payload.email) {
|
|
318
|
+
return {
|
|
319
|
+
data: null,
|
|
320
|
+
error: {
|
|
321
|
+
message: "Missing `id` or `email` field.",
|
|
322
|
+
name: "missing_required_field"
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
}
|
|
286
326
|
const data = yield this.resend.delete(
|
|
287
327
|
`/audiences/${payload.audienceId}/contacts/${(payload == null ? void 0 : payload.email) ? payload == null ? void 0 : payload.email : payload == null ? void 0 : payload.id}`
|
|
288
328
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// package.json
|
|
42
|
-
var version = "4.1.
|
|
42
|
+
var version = "4.1.1";
|
|
43
43
|
|
|
44
44
|
// src/api-keys/api-keys.ts
|
|
45
45
|
var ApiKeys = class {
|
|
@@ -192,7 +192,29 @@ var Broadcasts = class {
|
|
|
192
192
|
return __async(this, null, function* () {
|
|
193
193
|
const data = yield this.resend.post(
|
|
194
194
|
`/broadcasts/${id}/send`,
|
|
195
|
-
{ scheduled_at: payload.scheduledAt }
|
|
195
|
+
{ scheduled_at: payload == null ? void 0 : payload.scheduledAt }
|
|
196
|
+
);
|
|
197
|
+
return data;
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
list() {
|
|
201
|
+
return __async(this, null, function* () {
|
|
202
|
+
const data = yield this.resend.get("/broadcasts");
|
|
203
|
+
return data;
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
get(id) {
|
|
207
|
+
return __async(this, null, function* () {
|
|
208
|
+
const data = yield this.resend.get(
|
|
209
|
+
`/broadcasts/${id}`
|
|
210
|
+
);
|
|
211
|
+
return data;
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
remove(id) {
|
|
215
|
+
return __async(this, null, function* () {
|
|
216
|
+
const data = yield this.resend.delete(
|
|
217
|
+
`/broadcasts/${id}`
|
|
196
218
|
);
|
|
197
219
|
return data;
|
|
198
220
|
});
|
|
@@ -237,8 +259,17 @@ var Contacts = class {
|
|
|
237
259
|
}
|
|
238
260
|
update(payload) {
|
|
239
261
|
return __async(this, null, function* () {
|
|
262
|
+
if (!payload.id && !payload.email) {
|
|
263
|
+
return {
|
|
264
|
+
data: null,
|
|
265
|
+
error: {
|
|
266
|
+
message: "Missing `id` or `email` field.",
|
|
267
|
+
name: "missing_required_field"
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
240
271
|
const data = yield this.resend.patch(
|
|
241
|
-
`/audiences/${payload.audienceId}/contacts/${payload.id}`,
|
|
272
|
+
`/audiences/${payload.audienceId}/contacts/${(payload == null ? void 0 : payload.email) ? payload == null ? void 0 : payload.email : payload == null ? void 0 : payload.id}`,
|
|
242
273
|
{
|
|
243
274
|
unsubscribed: payload.unsubscribed,
|
|
244
275
|
first_name: payload.firstName,
|
|
@@ -250,6 +281,15 @@ var Contacts = class {
|
|
|
250
281
|
}
|
|
251
282
|
remove(payload) {
|
|
252
283
|
return __async(this, null, function* () {
|
|
284
|
+
if (!payload.id && !payload.email) {
|
|
285
|
+
return {
|
|
286
|
+
data: null,
|
|
287
|
+
error: {
|
|
288
|
+
message: "Missing `id` or `email` field.",
|
|
289
|
+
name: "missing_required_field"
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
253
293
|
const data = yield this.resend.delete(
|
|
254
294
|
`/audiences/${payload.audienceId}/contacts/${(payload == null ? void 0 : payload.email) ? payload == null ? void 0 : payload.email : payload == null ? void 0 : payload.id}`
|
|
255
295
|
);
|