resend 4.3.0 → 4.4.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.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +21 -3
- package/dist/index.mjs +21 -3
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -479,7 +479,8 @@ interface CreateContactResponse {
|
|
|
479
479
|
|
|
480
480
|
interface GetContactOptions {
|
|
481
481
|
audienceId: string;
|
|
482
|
-
id
|
|
482
|
+
id?: string;
|
|
483
|
+
email?: string;
|
|
483
484
|
}
|
|
484
485
|
interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'email' | 'created_at' | 'first_name' | 'last_name' | 'unsubscribed'> {
|
|
485
486
|
object: 'contact';
|
|
@@ -592,6 +593,7 @@ interface Domain {
|
|
|
592
593
|
interface CreateDomainOptions {
|
|
593
594
|
name: string;
|
|
594
595
|
region?: DomainRegion;
|
|
596
|
+
customReturnPath?: string;
|
|
595
597
|
}
|
|
596
598
|
interface CreateDomainRequestOptions extends PostOptions {
|
|
597
599
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -479,7 +479,8 @@ interface CreateContactResponse {
|
|
|
479
479
|
|
|
480
480
|
interface GetContactOptions {
|
|
481
481
|
audienceId: string;
|
|
482
|
-
id
|
|
482
|
+
id?: string;
|
|
483
|
+
email?: string;
|
|
483
484
|
}
|
|
484
485
|
interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'email' | 'created_at' | 'first_name' | 'last_name' | 'unsubscribed'> {
|
|
485
486
|
object: 'contact';
|
|
@@ -592,6 +593,7 @@ interface Domain {
|
|
|
592
593
|
interface CreateDomainOptions {
|
|
593
594
|
name: string;
|
|
594
595
|
region?: DomainRegion;
|
|
596
|
+
customReturnPath?: string;
|
|
595
597
|
}
|
|
596
598
|
interface CreateDomainRequestOptions extends PostOptions {
|
|
597
599
|
}
|
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.
|
|
75
|
+
var version = "4.4.0";
|
|
76
76
|
|
|
77
77
|
// src/api-keys/api-keys.ts
|
|
78
78
|
var ApiKeys = class {
|
|
@@ -322,8 +322,17 @@ var Contacts = class {
|
|
|
322
322
|
}
|
|
323
323
|
get(options) {
|
|
324
324
|
return __async(this, null, function* () {
|
|
325
|
+
if (!options.id && !options.email) {
|
|
326
|
+
return {
|
|
327
|
+
data: null,
|
|
328
|
+
error: {
|
|
329
|
+
message: "Missing `id` or `email` field.",
|
|
330
|
+
name: "missing_required_field"
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
}
|
|
325
334
|
const data = yield this.resend.get(
|
|
326
|
-
`/audiences/${options.audienceId}/contacts/${options.id}`
|
|
335
|
+
`/audiences/${options.audienceId}/contacts/${(options == null ? void 0 : options.email) ? options == null ? void 0 : options.email : options == null ? void 0 : options.id}`
|
|
327
336
|
);
|
|
328
337
|
return data;
|
|
329
338
|
});
|
|
@@ -369,6 +378,15 @@ var Contacts = class {
|
|
|
369
378
|
}
|
|
370
379
|
};
|
|
371
380
|
|
|
381
|
+
// src/common/utils/parse-domain-to-api-options.ts
|
|
382
|
+
function parseDomainToApiOptions(domain) {
|
|
383
|
+
return {
|
|
384
|
+
name: domain.name,
|
|
385
|
+
region: domain.region,
|
|
386
|
+
custom_return_path: domain.customReturnPath
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
|
|
372
390
|
// src/domains/domains.ts
|
|
373
391
|
var Domains = class {
|
|
374
392
|
constructor(resend) {
|
|
@@ -378,7 +396,7 @@ var Domains = class {
|
|
|
378
396
|
return __async(this, arguments, function* (payload, options = {}) {
|
|
379
397
|
const data = yield this.resend.post(
|
|
380
398
|
"/domains",
|
|
381
|
-
payload,
|
|
399
|
+
parseDomainToApiOptions(payload),
|
|
382
400
|
options
|
|
383
401
|
);
|
|
384
402
|
return data;
|
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.
|
|
42
|
+
var version = "4.4.0";
|
|
43
43
|
|
|
44
44
|
// src/api-keys/api-keys.ts
|
|
45
45
|
var ApiKeys = class {
|
|
@@ -289,8 +289,17 @@ var Contacts = class {
|
|
|
289
289
|
}
|
|
290
290
|
get(options) {
|
|
291
291
|
return __async(this, null, function* () {
|
|
292
|
+
if (!options.id && !options.email) {
|
|
293
|
+
return {
|
|
294
|
+
data: null,
|
|
295
|
+
error: {
|
|
296
|
+
message: "Missing `id` or `email` field.",
|
|
297
|
+
name: "missing_required_field"
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
}
|
|
292
301
|
const data = yield this.resend.get(
|
|
293
|
-
`/audiences/${options.audienceId}/contacts/${options.id}`
|
|
302
|
+
`/audiences/${options.audienceId}/contacts/${(options == null ? void 0 : options.email) ? options == null ? void 0 : options.email : options == null ? void 0 : options.id}`
|
|
294
303
|
);
|
|
295
304
|
return data;
|
|
296
305
|
});
|
|
@@ -336,6 +345,15 @@ var Contacts = class {
|
|
|
336
345
|
}
|
|
337
346
|
};
|
|
338
347
|
|
|
348
|
+
// src/common/utils/parse-domain-to-api-options.ts
|
|
349
|
+
function parseDomainToApiOptions(domain) {
|
|
350
|
+
return {
|
|
351
|
+
name: domain.name,
|
|
352
|
+
region: domain.region,
|
|
353
|
+
custom_return_path: domain.customReturnPath
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
339
357
|
// src/domains/domains.ts
|
|
340
358
|
var Domains = class {
|
|
341
359
|
constructor(resend) {
|
|
@@ -345,7 +363,7 @@ var Domains = class {
|
|
|
345
363
|
return __async(this, arguments, function* (payload, options = {}) {
|
|
346
364
|
const data = yield this.resend.post(
|
|
347
365
|
"/domains",
|
|
348
|
-
payload,
|
|
366
|
+
parseDomainToApiOptions(payload),
|
|
349
367
|
options
|
|
350
368
|
);
|
|
351
369
|
return data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resend",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "Node.js library for the Resend API",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"@biomejs/biome": "1.9.4",
|
|
49
49
|
"@types/jest": "29.5.14",
|
|
50
50
|
"@types/node": "18.19.86",
|
|
51
|
-
"@types/react": "19.1.
|
|
51
|
+
"@types/react": "19.1.2",
|
|
52
52
|
"jest": "29.7.0",
|
|
53
53
|
"jest-fetch-mock": "3.0.3",
|
|
54
|
-
"ts-jest": "29.3.
|
|
54
|
+
"ts-jest": "29.3.2",
|
|
55
55
|
"ts-node": "10.9.2",
|
|
56
56
|
"tsup": "7.2.0",
|
|
57
57
|
"typescript": "5.8.3"
|
|
58
58
|
},
|
|
59
|
-
"packageManager": "pnpm@10.8.
|
|
59
|
+
"packageManager": "pnpm@10.8.1"
|
|
60
60
|
}
|