resend 6.10.0-preview-workflows.3 → 6.10.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.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  import PostalMime from "postal-mime";
2
2
  import { Webhook } from "svix";
3
+
3
4
  //#region package.json
4
- var version = "6.10.0-preview-workflows.3";
5
+ var version = "6.10.0";
6
+
5
7
  //#endregion
6
8
  //#region src/common/utils/build-pagination-query.ts
7
9
  /**
@@ -16,6 +18,7 @@ function buildPaginationQuery(options) {
16
18
  if ("before" in options && options.before !== void 0) searchParams.set("before", options.before);
17
19
  return searchParams.toString();
18
20
  }
21
+
19
22
  //#endregion
20
23
  //#region src/api-keys/api-keys.ts
21
24
  var ApiKeys = class {
@@ -34,126 +37,7 @@ var ApiKeys = class {
34
37
  return await this.resend.delete(`/api-keys/${id}`);
35
38
  }
36
39
  };
37
- //#endregion
38
- //#region src/automation-run-steps/automation-run-steps.ts
39
- var AutomationRunSteps = class {
40
- constructor(resend) {
41
- this.resend = resend;
42
- }
43
- async get(options) {
44
- return await this.resend.get(`/automations/${options.automationId}/runs/${options.runId}/steps/${options.stepId}`);
45
- }
46
- async list(options) {
47
- const queryString = buildPaginationQuery(options);
48
- const url = queryString ? `/automations/${options.automationId}/runs/${options.runId}/steps?${queryString}` : `/automations/${options.automationId}/runs/${options.runId}/steps`;
49
- return await this.resend.get(url);
50
- }
51
- };
52
- //#endregion
53
- //#region src/automation-runs/automation-runs.ts
54
- var AutomationRuns = class {
55
- constructor(resend) {
56
- this.resend = resend;
57
- this.steps = new AutomationRunSteps(resend);
58
- }
59
- async get(options) {
60
- return await this.resend.get(`/automations/${options.automationId}/runs/${options.runId}`);
61
- }
62
- async list(options) {
63
- const queryString = buildPaginationQuery(options);
64
- const url = queryString ? `/automations/${options.automationId}/runs?${queryString}` : `/automations/${options.automationId}/runs`;
65
- return await this.resend.get(url);
66
- }
67
- };
68
- //#endregion
69
- //#region src/common/utils/parse-automation-to-api-options.ts
70
- function parseStepConfig(step) {
71
- switch (step.type) {
72
- case "trigger": return {
73
- ref: step.ref,
74
- type: step.type,
75
- config: { event_name: step.config.eventName }
76
- };
77
- case "delay": return {
78
- ref: step.ref,
79
- type: step.type,
80
- config: step.config
81
- };
82
- case "send_email": return {
83
- ref: step.ref,
84
- type: step.type,
85
- config: {
86
- template_id: step.config.templateId,
87
- subject: step.config.subject,
88
- from: step.config.from,
89
- reply_to: step.config.replyTo,
90
- variables: step.config.variables
91
- }
92
- };
93
- case "wait_for_event": return {
94
- ref: step.ref,
95
- type: step.type,
96
- config: {
97
- event_name: step.config.eventName,
98
- timeout_seconds: step.config.timeoutSeconds,
99
- filter_rule: step.config.filterRule
100
- }
101
- };
102
- case "condition": return {
103
- ref: step.ref,
104
- type: step.type,
105
- config: step.config
106
- };
107
- }
108
- }
109
- function parseEdge(edge) {
110
- return {
111
- from: edge.from,
112
- to: edge.to,
113
- edge_type: edge.edgeType
114
- };
115
- }
116
- function parseAutomationToApiOptions(automation) {
117
- return {
118
- name: automation.name,
119
- status: automation.status,
120
- steps: automation.steps.map(parseStepConfig),
121
- edges: automation.edges.map(parseEdge)
122
- };
123
- }
124
- function parseEventToApiOptions(event) {
125
- return {
126
- event: event.event,
127
- contact_id: event.contactId,
128
- email: event.email,
129
- payload: event.payload
130
- };
131
- }
132
- //#endregion
133
- //#region src/automations/automations.ts
134
- var Automations = class {
135
- constructor(resend) {
136
- this.resend = resend;
137
- this.runs = new AutomationRuns(this.resend);
138
- }
139
- async create(payload) {
140
- return await this.resend.post("/automations", parseAutomationToApiOptions(payload));
141
- }
142
- async list(options = {}) {
143
- const queryString = buildPaginationQuery(options);
144
- const url = queryString ? `/automations?${queryString}` : "/automations";
145
- return await this.resend.get(url);
146
- }
147
- async get(id) {
148
- return await this.resend.get(`/automations/${id}`);
149
- }
150
- async remove(id) {
151
- return await this.resend.delete(`/automations/${id}`);
152
- }
153
- async update(id, payload) {
154
- return await this.resend.patch(`/automations/${id}`, payload);
155
- }
156
- };
40
+
157
41
  //#endregion
158
42
  //#region src/common/utils/parse-email-to-api-options.ts
159
43
  function parseAttachments(attachments) {
@@ -186,6 +70,7 @@ function parseEmailToApiOptions(email) {
186
70
  topic_id: email.topicId
187
71
  };
188
72
  }
73
+
189
74
  //#endregion
190
75
  //#region src/render.ts
191
76
  async function render(node) {
@@ -197,6 +82,7 @@ async function render(node) {
197
82
  }
198
83
  return render(node);
199
84
  }
85
+
200
86
  //#endregion
201
87
  //#region src/batch/batch.ts
202
88
  var Batch = class {
@@ -224,6 +110,7 @@ var Batch = class {
224
110
  });
225
111
  }
226
112
  };
113
+
227
114
  //#endregion
228
115
  //#region src/broadcasts/broadcasts.ts
229
116
  var Broadcasts = class {
@@ -277,6 +164,7 @@ var Broadcasts = class {
277
164
  });
278
165
  }
279
166
  };
167
+
280
168
  //#endregion
281
169
  //#region src/common/utils/parse-contact-properties-to-api-options.ts
282
170
  function parseContactPropertyFromApi(contactProperty) {
@@ -296,6 +184,7 @@ function parseContactPropertyToApiOptions(contactProperty) {
296
184
  };
297
185
  return { fallback_value: contactProperty.fallbackValue };
298
186
  }
187
+
299
188
  //#endregion
300
189
  //#region src/contact-properties/contact-properties.ts
301
190
  var ContactProperties = class {
@@ -367,6 +256,7 @@ var ContactProperties = class {
367
256
  return await this.resend.delete(`/contact-properties/${id}`);
368
257
  }
369
258
  };
259
+
370
260
  //#endregion
371
261
  //#region src/contacts/segments/contact-segments.ts
372
262
  var ContactSegments = class {
@@ -415,6 +305,7 @@ var ContactSegments = class {
415
305
  return this.resend.delete(`/contacts/${identifier}/segments/${options.segmentId}`);
416
306
  }
417
307
  };
308
+
418
309
  //#endregion
419
310
  //#region src/contacts/topics/contact-topics.ts
420
311
  var ContactTopics = class {
@@ -450,6 +341,7 @@ var ContactTopics = class {
450
341
  return this.resend.get(url);
451
342
  }
452
343
  };
344
+
453
345
  //#endregion
454
346
  //#region src/contacts/contacts.ts
455
347
  var Contacts = class {
@@ -550,6 +442,7 @@ var Contacts = class {
550
442
  return this.resend.delete(`/audiences/${payload.audienceId}/contacts/${payload?.email ? payload?.email : payload?.id}`);
551
443
  }
552
444
  };
445
+
553
446
  //#endregion
554
447
  //#region src/common/utils/parse-domain-to-api-options.ts
555
448
  function parseDomainToApiOptions(domain) {
@@ -563,6 +456,7 @@ function parseDomainToApiOptions(domain) {
563
456
  tls: domain.tls
564
457
  };
565
458
  }
459
+
566
460
  //#endregion
567
461
  //#region src/domains/domains.ts
568
462
  var Domains = class {
@@ -595,6 +489,7 @@ var Domains = class {
595
489
  return await this.resend.post(`/domains/${id}/verify`);
596
490
  }
597
491
  };
492
+
598
493
  //#endregion
599
494
  //#region src/emails/attachments/attachments.ts
600
495
  var Attachments$1 = class {
@@ -612,6 +507,7 @@ var Attachments$1 = class {
612
507
  return await this.resend.get(url);
613
508
  }
614
509
  };
510
+
615
511
  //#endregion
616
512
  //#region src/emails/receiving/attachments/attachments.ts
617
513
  var Attachments = class {
@@ -629,6 +525,7 @@ var Attachments = class {
629
525
  return await this.resend.get(url);
630
526
  }
631
527
  };
528
+
632
529
  //#endregion
633
530
  //#region src/emails/receiving/receiving.ts
634
531
  var Receiving = class {
@@ -746,6 +643,7 @@ var Receiving = class {
746
643
  });
747
644
  }
748
645
  };
646
+
749
647
  //#endregion
750
648
  //#region src/emails/emails.ts
751
649
  var Emails = class {
@@ -776,33 +674,23 @@ var Emails = class {
776
674
  return await this.resend.post(`/emails/${id}/cancel`);
777
675
  }
778
676
  };
677
+
779
678
  //#endregion
780
- //#region src/events/events.ts
781
- var Events = class {
679
+ //#region src/logs/logs.ts
680
+ var Logs = class {
782
681
  constructor(resend) {
783
682
  this.resend = resend;
784
683
  }
785
- async send(payload) {
786
- return await this.resend.post("/events/send", parseEventToApiOptions(payload));
787
- }
788
- async create(payload) {
789
- return await this.resend.post("/events", payload);
790
- }
791
- async get(identifier) {
792
- return await this.resend.get(`/events/${encodeURIComponent(identifier)}`);
793
- }
794
684
  async list(options = {}) {
795
685
  const queryString = buildPaginationQuery(options);
796
- const url = queryString ? `/events?${queryString}` : "/events";
686
+ const url = queryString ? `/logs?${queryString}` : "/logs";
797
687
  return await this.resend.get(url);
798
688
  }
799
- async update(identifier, payload) {
800
- return await this.resend.patch(`/events/${encodeURIComponent(identifier)}`, payload);
801
- }
802
- async remove(identifier) {
803
- return await this.resend.delete(`/events/${encodeURIComponent(identifier)}`);
689
+ async get(id) {
690
+ return await this.resend.get(`/logs/${id}`);
804
691
  }
805
692
  };
693
+
806
694
  //#endregion
807
695
  //#region src/segments/segments.ts
808
696
  var Segments = class {
@@ -824,6 +712,7 @@ var Segments = class {
824
712
  return await this.resend.delete(`/segments/${id}`);
825
713
  }
826
714
  };
715
+
827
716
  //#endregion
828
717
  //#region src/common/utils/get-pagination-query-properties.ts
829
718
  function getPaginationQueryProperties(options = {}) {
@@ -833,6 +722,7 @@ function getPaginationQueryProperties(options = {}) {
833
722
  if (options.limit) query.set("limit", options.limit.toString());
834
723
  return query.size > 0 ? `?${query.toString()}` : "";
835
724
  }
725
+
836
726
  //#endregion
837
727
  //#region src/common/utils/parse-template-to-api-options.ts
838
728
  function parseVariables(variables) {
@@ -854,6 +744,7 @@ function parseTemplateToApiOptions(template) {
854
744
  variables: parseVariables(template.variables)
855
745
  };
856
746
  }
747
+
857
748
  //#endregion
858
749
  //#region src/templates/chainable-template-result.ts
859
750
  var ChainableTemplateResult = class {
@@ -874,6 +765,7 @@ var ChainableTemplateResult = class {
874
765
  return this.publishFn(data.id);
875
766
  }
876
767
  };
768
+
877
769
  //#endregion
878
770
  //#region src/templates/templates.ts
879
771
  var Templates = class {
@@ -914,6 +806,7 @@ var Templates = class {
914
806
  return await this.resend.patch(`/templates/${identifier}`, parseTemplateToApiOptions(payload));
915
807
  }
916
808
  };
809
+
917
810
  //#endregion
918
811
  //#region src/topics/topics.ts
919
812
  var Topics = class {
@@ -967,6 +860,7 @@ var Topics = class {
967
860
  return await this.resend.delete(`/topics/${id}`);
968
861
  }
969
862
  };
863
+
970
864
  //#endregion
971
865
  //#region src/webhooks/webhooks.ts
972
866
  var Webhooks = class {
@@ -998,6 +892,7 @@ var Webhooks = class {
998
892
  });
999
893
  }
1000
894
  };
895
+
1001
896
  //#endregion
1002
897
  //#region src/resend.ts
1003
898
  const defaultBaseUrl = "https://api.resend.com";
@@ -1010,14 +905,13 @@ var Resend = class {
1010
905
  this.apiKeys = new ApiKeys(this);
1011
906
  this.segments = new Segments(this);
1012
907
  this.audiences = this.segments;
1013
- this.automations = new Automations(this);
1014
908
  this.batch = new Batch(this);
1015
909
  this.broadcasts = new Broadcasts(this);
1016
910
  this.contacts = new Contacts(this);
1017
911
  this.contactProperties = new ContactProperties(this);
1018
912
  this.domains = new Domains(this);
1019
913
  this.emails = new Emails(this);
1020
- this.events = new Events(this);
914
+ this.logs = new Logs(this);
1021
915
  this.webhooks = new Webhooks(this);
1022
916
  this.templates = new Templates(this);
1023
917
  this.topics = new Topics(this);
@@ -1140,5 +1034,6 @@ var Resend = class {
1140
1034
  return this.fetchRequest(path, requestOptions);
1141
1035
  }
1142
1036
  };
1037
+
1143
1038
  //#endregion
1144
- export { Resend };
1039
+ export { Resend };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "6.10.0-preview-workflows.3",
3
+ "version": "6.10.0",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -29,19 +29,6 @@
29
29
  }
30
30
  }
31
31
  },
32
- "scripts": {
33
- "build": "tsdown src/index.ts --format esm,cjs --dts",
34
- "integration:nextjs": "cd ./integrations/nextjs && next build --turbopack",
35
- "lint": "biome check .",
36
- "lint:fix": "biome check . --write",
37
- "prepublishOnly": "pnpm run build",
38
- "test": "vitest run",
39
- "test:dev": "cross-env TEST_MODE=dev vitest run",
40
- "test:integrations": "vitest run integrations",
41
- "test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run",
42
- "test:watch": "vitest",
43
- "typecheck": "tsc --noEmit"
44
- },
45
32
  "repository": {
46
33
  "type": "git",
47
34
  "url": "git+https://github.com/resend/resend-node.git"
@@ -53,8 +40,8 @@
53
40
  },
54
41
  "homepage": "https://github.com/resend/resend-node#readme",
55
42
  "dependencies": {
56
- "postal-mime": "2.7.3",
57
- "svix": "1.86.0"
43
+ "postal-mime": "2.7.4",
44
+ "svix": "1.88.0"
58
45
  },
59
46
  "peerDependencies": {
60
47
  "@react-email/render": "*"
@@ -65,23 +52,34 @@
65
52
  }
66
53
  },
67
54
  "devDependencies": {
68
- "@biomejs/biome": "2.4.6",
55
+ "@biomejs/biome": "2.4.7",
69
56
  "@pollyjs/adapter-fetch": "6.0.7",
70
57
  "@pollyjs/core": "6.0.6",
71
58
  "@pollyjs/persister-fs": "6.0.6",
72
59
  "@types/mailparser": "3.4.6",
73
- "@types/node": "24.11.0",
60
+ "@types/node": "24.12.0",
74
61
  "@types/react": "19.2.14",
75
62
  "cross-env": "10.1.0",
76
63
  "dotenv": "17.3.1",
77
- "pkg-pr-new": "0.0.65",
64
+ "pkg-pr-new": "0.0.66",
78
65
  "react": "19.2.4",
79
66
  "react-dom": "19.2.4",
80
67
  "rimraf": "6.1.3",
81
- "tsdown": "0.21.0",
68
+ "tsdown": "0.21.4",
82
69
  "typescript": "5.9.3",
83
- "vitest": "4.0.18",
70
+ "vitest": "4.1.0",
84
71
  "vitest-fetch-mock": "0.4.5"
85
72
  },
86
- "packageManager": "pnpm@10.30.3"
87
- }
73
+ "scripts": {
74
+ "build": "tsdown src/index.ts --format esm,cjs --dts",
75
+ "integration:nextjs": "cd ./e2e/nextjs && next build --turbopack",
76
+ "lint": "biome check .",
77
+ "lint:fix": "biome check . --write",
78
+ "test": "vitest run --exclude e2e",
79
+ "test:dev": "cross-env TEST_MODE=dev vitest run --exclude e2e",
80
+ "test:e2e": "vitest run e2e",
81
+ "test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run --exclude e2e",
82
+ "test:watch": "vitest --exclude e2e",
83
+ "typecheck": "tsc --noEmit"
84
+ }
85
+ }