resend 2.1.0 → 3.0.0-canary.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 CHANGED
@@ -97,12 +97,6 @@ interface CreateAudienceResponse {
97
97
  error: ErrorResponse | null;
98
98
  }
99
99
 
100
- type ListAudiencesResponseSuccess = Audience[];
101
- interface ListAudiencesResponse {
102
- data: ListAudiencesResponseSuccess | null;
103
- error: ErrorResponse | null;
104
- }
105
-
106
100
  interface GetAudienceResponseSuccess extends Pick<Audience, 'id' | 'name' | 'created_at'> {
107
101
  object: 'audience';
108
102
  }
@@ -111,6 +105,12 @@ interface GetAudienceResponse {
111
105
  error: ErrorResponse | null;
112
106
  }
113
107
 
108
+ type ListAudiencesResponseSuccess = Audience[];
109
+ interface ListAudiencesResponse {
110
+ data: ListAudiencesResponseSuccess | null;
111
+ error: ErrorResponse | null;
112
+ }
113
+
114
114
  type RemoveAudiencesResponseSuccess = Pick<Audience, 'id'>;
115
115
  interface RemoveAudiencesResponse {
116
116
  data: RemoveAudiencesResponseSuccess | null;
@@ -129,6 +129,7 @@ declare class Audiences {
129
129
  type RequireAtLeastOne<T> = {
130
130
  [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
131
131
  }[keyof T];
132
+
132
133
  interface EmailRenderOptions {
133
134
  /**
134
135
  * The React component used to write the message.
@@ -269,11 +270,11 @@ interface Contact {
269
270
  }
270
271
 
271
272
  interface CreateContactOptions {
272
- audience_id: string;
273
+ audienceId: string;
273
274
  email: string;
274
275
  unsubscribed?: boolean;
275
- first_name?: string;
276
- last_name?: string;
276
+ firstName?: string;
277
+ lastName?: string;
277
278
  }
278
279
  interface CreateContactRequestOptions extends PostOptions {
279
280
  }
@@ -284,12 +285,10 @@ interface CreateContactResponse {
284
285
  error: ErrorResponse | null;
285
286
  }
286
287
 
287
- type ListContactsResponseSuccess = Contact[];
288
- interface ListContactsResponse {
289
- data: ListContactsResponseSuccess | null;
290
- error: ErrorResponse | null;
288
+ interface GetContactOptions {
289
+ audienceId: string;
290
+ id: string;
291
291
  }
292
-
293
292
  interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'name' | 'created_at'> {
294
293
  object: 'contact';
295
294
  }
@@ -298,7 +297,37 @@ interface GetContactResponse {
298
297
  error: ErrorResponse | null;
299
298
  }
300
299
 
301
- type RemoveContactsResponseSuccess = Pick<Contact, 'id'>;
300
+ interface ListContactsOptions {
301
+ audienceId: string;
302
+ }
303
+ type ListContactsResponseSuccess = Contact[];
304
+ interface ListContactsResponse {
305
+ data: ListContactsResponseSuccess | null;
306
+ error: ErrorResponse | null;
307
+ }
308
+
309
+ type RemoveContactsResponseSuccess = {
310
+ object: 'contact';
311
+ deleted: boolean;
312
+ contact: string;
313
+ };
314
+ interface RemoveByOptions {
315
+ /**
316
+ * The contact id.
317
+ *
318
+ * @link https://resend.com/api-reference/contacts/delete-contact#body-parameters
319
+ */
320
+ id?: string;
321
+ /**
322
+ * The contact email.
323
+ *
324
+ * @link https://resend.com/api-reference/contacts/delete-contact#body-parameters
325
+ */
326
+ email?: string;
327
+ }
328
+ interface RemoveContactOptions extends RemoveByOptions {
329
+ audienceId: string;
330
+ }
302
331
  interface RemoveContactsResponse {
303
332
  data: RemoveContactsResponseSuccess | null;
304
333
  error: ErrorResponse | null;
@@ -306,10 +335,10 @@ interface RemoveContactsResponse {
306
335
 
307
336
  interface UpdateContactOptions {
308
337
  id: string;
309
- audience_id: string;
338
+ audienceId: string;
310
339
  unsubscribed?: boolean;
311
- first_name?: string;
312
- last_name?: string;
340
+ fistName?: string;
341
+ lastName?: string;
313
342
  }
314
343
  type UpdateContactResponseSuccess = Pick<Contact, 'id'>;
315
344
  interface UpdateContactResponse {
@@ -321,18 +350,10 @@ declare class Contacts {
321
350
  private readonly resend;
322
351
  constructor(resend: Resend);
323
352
  create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
324
- list({ audience_id, }: {
325
- audience_id: string;
326
- }): Promise<ListContactsResponse>;
327
- get({ audience_id, id, }: {
328
- audience_id: string;
329
- id: string;
330
- }): Promise<GetContactResponse>;
353
+ list(options: ListContactsOptions): Promise<ListContactsResponse>;
354
+ get(options: GetContactOptions): Promise<GetContactResponse>;
331
355
  update(payload: UpdateContactOptions): Promise<UpdateContactResponse>;
332
- remove({ audience_id, id, }: {
333
- audience_id: string;
334
- id: string;
335
- }): Promise<RemoveContactsResponse>;
356
+ remove(payload: RemoveContactOptions): Promise<RemoveContactsResponse>;
336
357
  }
337
358
 
338
359
  type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1';
@@ -382,12 +403,6 @@ interface CreateDomainResponse {
382
403
  error: ErrorResponse | null;
383
404
  }
384
405
 
385
- type ListDomainsResponseSuccess = Domain[];
386
- interface ListDomainsResponse {
387
- data: ListDomainsResponseSuccess | null;
388
- error: ErrorResponse | null;
389
- }
390
-
391
406
  interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> {
392
407
  object: 'domain';
393
408
  records: DomainRecords[];
@@ -397,6 +412,12 @@ interface GetDomainResponse {
397
412
  error: ErrorResponse | null;
398
413
  }
399
414
 
415
+ type ListDomainsResponseSuccess = Domain[];
416
+ interface ListDomainsResponse {
417
+ data: ListDomainsResponseSuccess | null;
418
+ error: ErrorResponse | null;
419
+ }
420
+
400
421
  type RemoveDomainsResponseSuccess = Pick<Domain, 'id'>;
401
422
  interface RemoveDomainsResponse {
402
423
  data: RemoveDomainsResponseSuccess | null;
package/dist/index.d.ts CHANGED
@@ -97,12 +97,6 @@ interface CreateAudienceResponse {
97
97
  error: ErrorResponse | null;
98
98
  }
99
99
 
100
- type ListAudiencesResponseSuccess = Audience[];
101
- interface ListAudiencesResponse {
102
- data: ListAudiencesResponseSuccess | null;
103
- error: ErrorResponse | null;
104
- }
105
-
106
100
  interface GetAudienceResponseSuccess extends Pick<Audience, 'id' | 'name' | 'created_at'> {
107
101
  object: 'audience';
108
102
  }
@@ -111,6 +105,12 @@ interface GetAudienceResponse {
111
105
  error: ErrorResponse | null;
112
106
  }
113
107
 
108
+ type ListAudiencesResponseSuccess = Audience[];
109
+ interface ListAudiencesResponse {
110
+ data: ListAudiencesResponseSuccess | null;
111
+ error: ErrorResponse | null;
112
+ }
113
+
114
114
  type RemoveAudiencesResponseSuccess = Pick<Audience, 'id'>;
115
115
  interface RemoveAudiencesResponse {
116
116
  data: RemoveAudiencesResponseSuccess | null;
@@ -129,6 +129,7 @@ declare class Audiences {
129
129
  type RequireAtLeastOne<T> = {
130
130
  [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
131
131
  }[keyof T];
132
+
132
133
  interface EmailRenderOptions {
133
134
  /**
134
135
  * The React component used to write the message.
@@ -269,11 +270,11 @@ interface Contact {
269
270
  }
270
271
 
271
272
  interface CreateContactOptions {
272
- audience_id: string;
273
+ audienceId: string;
273
274
  email: string;
274
275
  unsubscribed?: boolean;
275
- first_name?: string;
276
- last_name?: string;
276
+ firstName?: string;
277
+ lastName?: string;
277
278
  }
278
279
  interface CreateContactRequestOptions extends PostOptions {
279
280
  }
@@ -284,12 +285,10 @@ interface CreateContactResponse {
284
285
  error: ErrorResponse | null;
285
286
  }
286
287
 
287
- type ListContactsResponseSuccess = Contact[];
288
- interface ListContactsResponse {
289
- data: ListContactsResponseSuccess | null;
290
- error: ErrorResponse | null;
288
+ interface GetContactOptions {
289
+ audienceId: string;
290
+ id: string;
291
291
  }
292
-
293
292
  interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'name' | 'created_at'> {
294
293
  object: 'contact';
295
294
  }
@@ -298,7 +297,37 @@ interface GetContactResponse {
298
297
  error: ErrorResponse | null;
299
298
  }
300
299
 
301
- type RemoveContactsResponseSuccess = Pick<Contact, 'id'>;
300
+ interface ListContactsOptions {
301
+ audienceId: string;
302
+ }
303
+ type ListContactsResponseSuccess = Contact[];
304
+ interface ListContactsResponse {
305
+ data: ListContactsResponseSuccess | null;
306
+ error: ErrorResponse | null;
307
+ }
308
+
309
+ type RemoveContactsResponseSuccess = {
310
+ object: 'contact';
311
+ deleted: boolean;
312
+ contact: string;
313
+ };
314
+ interface RemoveByOptions {
315
+ /**
316
+ * The contact id.
317
+ *
318
+ * @link https://resend.com/api-reference/contacts/delete-contact#body-parameters
319
+ */
320
+ id?: string;
321
+ /**
322
+ * The contact email.
323
+ *
324
+ * @link https://resend.com/api-reference/contacts/delete-contact#body-parameters
325
+ */
326
+ email?: string;
327
+ }
328
+ interface RemoveContactOptions extends RemoveByOptions {
329
+ audienceId: string;
330
+ }
302
331
  interface RemoveContactsResponse {
303
332
  data: RemoveContactsResponseSuccess | null;
304
333
  error: ErrorResponse | null;
@@ -306,10 +335,10 @@ interface RemoveContactsResponse {
306
335
 
307
336
  interface UpdateContactOptions {
308
337
  id: string;
309
- audience_id: string;
338
+ audienceId: string;
310
339
  unsubscribed?: boolean;
311
- first_name?: string;
312
- last_name?: string;
340
+ fistName?: string;
341
+ lastName?: string;
313
342
  }
314
343
  type UpdateContactResponseSuccess = Pick<Contact, 'id'>;
315
344
  interface UpdateContactResponse {
@@ -321,18 +350,10 @@ declare class Contacts {
321
350
  private readonly resend;
322
351
  constructor(resend: Resend);
323
352
  create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
324
- list({ audience_id, }: {
325
- audience_id: string;
326
- }): Promise<ListContactsResponse>;
327
- get({ audience_id, id, }: {
328
- audience_id: string;
329
- id: string;
330
- }): Promise<GetContactResponse>;
353
+ list(options: ListContactsOptions): Promise<ListContactsResponse>;
354
+ get(options: GetContactOptions): Promise<GetContactResponse>;
331
355
  update(payload: UpdateContactOptions): Promise<UpdateContactResponse>;
332
- remove({ audience_id, id, }: {
333
- audience_id: string;
334
- id: string;
335
- }): Promise<RemoveContactsResponse>;
356
+ remove(payload: RemoveContactOptions): Promise<RemoveContactsResponse>;
336
357
  }
337
358
 
338
359
  type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1';
@@ -382,12 +403,6 @@ interface CreateDomainResponse {
382
403
  error: ErrorResponse | null;
383
404
  }
384
405
 
385
- type ListDomainsResponseSuccess = Domain[];
386
- interface ListDomainsResponse {
387
- data: ListDomainsResponseSuccess | null;
388
- error: ErrorResponse | null;
389
- }
390
-
391
406
  interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> {
392
407
  object: 'domain';
393
408
  records: DomainRecords[];
@@ -397,6 +412,12 @@ interface GetDomainResponse {
397
412
  error: ErrorResponse | null;
398
413
  }
399
414
 
415
+ type ListDomainsResponseSuccess = Domain[];
416
+ interface ListDomainsResponse {
417
+ data: ListDomainsResponseSuccess | null;
418
+ error: ErrorResponse | null;
419
+ }
420
+
400
421
  type RemoveDomainsResponseSuccess = Pick<Domain, 'id'>;
401
422
  interface RemoveDomainsResponse {
402
423
  data: RemoveDomainsResponseSuccess | null;
package/dist/index.js CHANGED
@@ -59,7 +59,7 @@ __export(src_exports, {
59
59
  module.exports = __toCommonJS(src_exports);
60
60
 
61
61
  // package.json
62
- var version = "2.1.0";
62
+ var version = "3.0.0-canary.0";
63
63
 
64
64
  // src/api-keys/api-keys.ts
65
65
  var ApiKeys = class {
@@ -168,30 +168,30 @@ var Contacts = class {
168
168
  create(_0) {
169
169
  return __async(this, arguments, function* (payload, options = {}) {
170
170
  const data = yield this.resend.post(
171
- `/audiences/${payload.audience_id}/contacts`,
172
- payload,
171
+ `/audiences/${payload.audienceId}/contacts`,
172
+ {
173
+ unsubscribed: payload.unsubscribed,
174
+ email: payload.email,
175
+ first_name: payload.firstName,
176
+ last_name: payload.lastName
177
+ },
173
178
  options
174
179
  );
175
180
  return data;
176
181
  });
177
182
  }
178
- list(_0) {
179
- return __async(this, arguments, function* ({
180
- audience_id
181
- }) {
183
+ list(options) {
184
+ return __async(this, null, function* () {
182
185
  const data = yield this.resend.get(
183
- `/audiences/${audience_id}/contacts`
186
+ `/audiences/${options.audienceId}/contacts`
184
187
  );
185
188
  return data;
186
189
  });
187
190
  }
188
- get(_0) {
189
- return __async(this, arguments, function* ({
190
- audience_id,
191
- id
192
- }) {
191
+ get(options) {
192
+ return __async(this, null, function* () {
193
193
  const data = yield this.resend.get(
194
- `/audiences/${audience_id}/contacts/${id}`
194
+ `/audiences/${options.audienceId}/contacts/${options.id}`
195
195
  );
196
196
  return data;
197
197
  });
@@ -199,19 +199,20 @@ var Contacts = class {
199
199
  update(payload) {
200
200
  return __async(this, null, function* () {
201
201
  const data = yield this.resend.patch(
202
- `/audiences/${payload.audience_id}/contacts/${payload.id}`,
203
- payload
202
+ `/audiences/${payload.audienceId}/contacts/${payload.id}`,
203
+ {
204
+ unsubscribed: payload.unsubscribed,
205
+ first_name: payload.fistName,
206
+ last_name: payload.lastName
207
+ }
204
208
  );
205
209
  return data;
206
210
  });
207
211
  }
208
- remove(_0) {
209
- return __async(this, arguments, function* ({
210
- audience_id,
211
- id
212
- }) {
212
+ remove(payload) {
213
+ return __async(this, null, function* () {
213
214
  const data = yield this.resend.delete(
214
- `/audiences/${audience_id}/contacts/${id}`
215
+ `/audiences/${payload.audienceId}/contacts/${(payload == null ? void 0 : payload.email) ? payload == null ? void 0 : payload.email : payload == null ? void 0 : payload.id}`
215
216
  );
216
217
  return data;
217
218
  });
package/dist/index.mjs CHANGED
@@ -36,7 +36,7 @@ var __async = (__this, __arguments, generator) => {
36
36
  };
37
37
 
38
38
  // package.json
39
- var version = "2.1.0";
39
+ var version = "3.0.0-canary.0";
40
40
 
41
41
  // src/api-keys/api-keys.ts
42
42
  var ApiKeys = class {
@@ -145,30 +145,30 @@ var Contacts = class {
145
145
  create(_0) {
146
146
  return __async(this, arguments, function* (payload, options = {}) {
147
147
  const data = yield this.resend.post(
148
- `/audiences/${payload.audience_id}/contacts`,
149
- payload,
148
+ `/audiences/${payload.audienceId}/contacts`,
149
+ {
150
+ unsubscribed: payload.unsubscribed,
151
+ email: payload.email,
152
+ first_name: payload.firstName,
153
+ last_name: payload.lastName
154
+ },
150
155
  options
151
156
  );
152
157
  return data;
153
158
  });
154
159
  }
155
- list(_0) {
156
- return __async(this, arguments, function* ({
157
- audience_id
158
- }) {
160
+ list(options) {
161
+ return __async(this, null, function* () {
159
162
  const data = yield this.resend.get(
160
- `/audiences/${audience_id}/contacts`
163
+ `/audiences/${options.audienceId}/contacts`
161
164
  );
162
165
  return data;
163
166
  });
164
167
  }
165
- get(_0) {
166
- return __async(this, arguments, function* ({
167
- audience_id,
168
- id
169
- }) {
168
+ get(options) {
169
+ return __async(this, null, function* () {
170
170
  const data = yield this.resend.get(
171
- `/audiences/${audience_id}/contacts/${id}`
171
+ `/audiences/${options.audienceId}/contacts/${options.id}`
172
172
  );
173
173
  return data;
174
174
  });
@@ -176,19 +176,20 @@ var Contacts = class {
176
176
  update(payload) {
177
177
  return __async(this, null, function* () {
178
178
  const data = yield this.resend.patch(
179
- `/audiences/${payload.audience_id}/contacts/${payload.id}`,
180
- payload
179
+ `/audiences/${payload.audienceId}/contacts/${payload.id}`,
180
+ {
181
+ unsubscribed: payload.unsubscribed,
182
+ first_name: payload.fistName,
183
+ last_name: payload.lastName
184
+ }
181
185
  );
182
186
  return data;
183
187
  });
184
188
  }
185
- remove(_0) {
186
- return __async(this, arguments, function* ({
187
- audience_id,
188
- id
189
- }) {
189
+ remove(payload) {
190
+ return __async(this, null, function* () {
190
191
  const data = yield this.resend.delete(
191
- `/audiences/${audience_id}/contacts/${id}`
192
+ `/audiences/${payload.audienceId}/contacts/${(payload == null ? void 0 : payload.email) ? payload == null ? void 0 : payload.email : payload == null ? void 0 : payload.id}`
192
193
  );
193
194
  return data;
194
195
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "2.1.0",
3
+ "version": "3.0.0-canary.0",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -23,7 +23,7 @@
23
23
  }
24
24
  }
25
25
  },
26
- "packageManager": "yarn@3.6.4",
26
+ "packageManager": "yarn@3.7.0",
27
27
  "scripts": {
28
28
  "build": "tsup src/index.ts --format esm,cjs --dts",
29
29
  "test": "jest",
@@ -44,21 +44,21 @@
44
44
  },
45
45
  "homepage": "https://github.com/resendlabs/resend-node#readme",
46
46
  "dependencies": {
47
- "@react-email/render": "0.0.9"
47
+ "@react-email/render": "0.0.11"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/jest": "29.5.7",
51
- "@types/node": "18.18.8",
50
+ "@types/jest": "29.5.11",
51
+ "@types/node": "18.19.7",
52
52
  "@types/react": "18.2.33",
53
- "@typescript-eslint/eslint-plugin": "6.10.0",
54
- "@typescript-eslint/parser": "6.10.0",
55
- "eslint": "8.52.0",
53
+ "@typescript-eslint/eslint-plugin": "6.19.0",
54
+ "@typescript-eslint/parser": "6.19.0",
55
+ "eslint": "8.56.0",
56
56
  "jest": "29.7.0",
57
57
  "jest-fetch-mock": "3.0.3",
58
- "prettier": "3.1.0",
58
+ "prettier": "3.2.2",
59
59
  "ts-jest": "29.1.1",
60
- "ts-node": "10.9.1",
60
+ "ts-node": "10.9.2",
61
61
  "tsup": "7.2.0",
62
- "typescript": "5.2.2"
62
+ "typescript": "5.3.3"
63
63
  }
64
64
  }