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.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  //#region \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -7,12 +7,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
- get: ((k) => from[k]).bind(null, key),
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) {
14
+ __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ }
16
20
  }
17
21
  return to;
18
22
  };
@@ -20,12 +24,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
20
24
  value: mod,
21
25
  enumerable: true
22
26
  }) : target, mod));
27
+
23
28
  //#endregion
24
29
  let postal_mime = require("postal-mime");
25
30
  postal_mime = __toESM(postal_mime);
26
31
  let svix = require("svix");
32
+
27
33
  //#region package.json
28
- var version = "6.10.0-preview-workflows.3";
34
+ var version = "6.10.0";
35
+
29
36
  //#endregion
30
37
  //#region src/common/utils/build-pagination-query.ts
31
38
  /**
@@ -40,6 +47,7 @@ function buildPaginationQuery(options) {
40
47
  if ("before" in options && options.before !== void 0) searchParams.set("before", options.before);
41
48
  return searchParams.toString();
42
49
  }
50
+
43
51
  //#endregion
44
52
  //#region src/api-keys/api-keys.ts
45
53
  var ApiKeys = class {
@@ -58,126 +66,7 @@ var ApiKeys = class {
58
66
  return await this.resend.delete(`/api-keys/${id}`);
59
67
  }
60
68
  };
61
- //#endregion
62
- //#region src/automation-run-steps/automation-run-steps.ts
63
- var AutomationRunSteps = class {
64
- constructor(resend) {
65
- this.resend = resend;
66
- }
67
- async get(options) {
68
- return await this.resend.get(`/automations/${options.automationId}/runs/${options.runId}/steps/${options.stepId}`);
69
- }
70
- async list(options) {
71
- const queryString = buildPaginationQuery(options);
72
- const url = queryString ? `/automations/${options.automationId}/runs/${options.runId}/steps?${queryString}` : `/automations/${options.automationId}/runs/${options.runId}/steps`;
73
- return await this.resend.get(url);
74
- }
75
- };
76
- //#endregion
77
- //#region src/automation-runs/automation-runs.ts
78
- var AutomationRuns = class {
79
- constructor(resend) {
80
- this.resend = resend;
81
- this.steps = new AutomationRunSteps(resend);
82
- }
83
- async get(options) {
84
- return await this.resend.get(`/automations/${options.automationId}/runs/${options.runId}`);
85
- }
86
- async list(options) {
87
- const queryString = buildPaginationQuery(options);
88
- const url = queryString ? `/automations/${options.automationId}/runs?${queryString}` : `/automations/${options.automationId}/runs`;
89
- return await this.resend.get(url);
90
- }
91
- };
92
- //#endregion
93
- //#region src/common/utils/parse-automation-to-api-options.ts
94
- function parseStepConfig(step) {
95
- switch (step.type) {
96
- case "trigger": return {
97
- ref: step.ref,
98
- type: step.type,
99
- config: { event_name: step.config.eventName }
100
- };
101
- case "delay": return {
102
- ref: step.ref,
103
- type: step.type,
104
- config: step.config
105
- };
106
- case "send_email": return {
107
- ref: step.ref,
108
- type: step.type,
109
- config: {
110
- template_id: step.config.templateId,
111
- subject: step.config.subject,
112
- from: step.config.from,
113
- reply_to: step.config.replyTo,
114
- variables: step.config.variables
115
- }
116
- };
117
- case "wait_for_event": return {
118
- ref: step.ref,
119
- type: step.type,
120
- config: {
121
- event_name: step.config.eventName,
122
- timeout_seconds: step.config.timeoutSeconds,
123
- filter_rule: step.config.filterRule
124
- }
125
- };
126
- case "condition": return {
127
- ref: step.ref,
128
- type: step.type,
129
- config: step.config
130
- };
131
- }
132
- }
133
- function parseEdge(edge) {
134
- return {
135
- from: edge.from,
136
- to: edge.to,
137
- edge_type: edge.edgeType
138
- };
139
- }
140
- function parseAutomationToApiOptions(automation) {
141
- return {
142
- name: automation.name,
143
- status: automation.status,
144
- steps: automation.steps.map(parseStepConfig),
145
- edges: automation.edges.map(parseEdge)
146
- };
147
- }
148
- function parseEventToApiOptions(event) {
149
- return {
150
- event: event.event,
151
- contact_id: event.contactId,
152
- email: event.email,
153
- payload: event.payload
154
- };
155
- }
156
- //#endregion
157
- //#region src/automations/automations.ts
158
- var Automations = class {
159
- constructor(resend) {
160
- this.resend = resend;
161
- this.runs = new AutomationRuns(this.resend);
162
- }
163
- async create(payload) {
164
- return await this.resend.post("/automations", parseAutomationToApiOptions(payload));
165
- }
166
- async list(options = {}) {
167
- const queryString = buildPaginationQuery(options);
168
- const url = queryString ? `/automations?${queryString}` : "/automations";
169
- return await this.resend.get(url);
170
- }
171
- async get(id) {
172
- return await this.resend.get(`/automations/${id}`);
173
- }
174
- async remove(id) {
175
- return await this.resend.delete(`/automations/${id}`);
176
- }
177
- async update(id, payload) {
178
- return await this.resend.patch(`/automations/${id}`, payload);
179
- }
180
- };
69
+
181
70
  //#endregion
182
71
  //#region src/common/utils/parse-email-to-api-options.ts
183
72
  function parseAttachments(attachments) {
@@ -210,6 +99,7 @@ function parseEmailToApiOptions(email) {
210
99
  topic_id: email.topicId
211
100
  };
212
101
  }
102
+
213
103
  //#endregion
214
104
  //#region src/render.ts
215
105
  async function render(node) {
@@ -221,6 +111,7 @@ async function render(node) {
221
111
  }
222
112
  return render(node);
223
113
  }
114
+
224
115
  //#endregion
225
116
  //#region src/batch/batch.ts
226
117
  var Batch = class {
@@ -248,6 +139,7 @@ var Batch = class {
248
139
  });
249
140
  }
250
141
  };
142
+
251
143
  //#endregion
252
144
  //#region src/broadcasts/broadcasts.ts
253
145
  var Broadcasts = class {
@@ -301,6 +193,7 @@ var Broadcasts = class {
301
193
  });
302
194
  }
303
195
  };
196
+
304
197
  //#endregion
305
198
  //#region src/common/utils/parse-contact-properties-to-api-options.ts
306
199
  function parseContactPropertyFromApi(contactProperty) {
@@ -320,6 +213,7 @@ function parseContactPropertyToApiOptions(contactProperty) {
320
213
  };
321
214
  return { fallback_value: contactProperty.fallbackValue };
322
215
  }
216
+
323
217
  //#endregion
324
218
  //#region src/contact-properties/contact-properties.ts
325
219
  var ContactProperties = class {
@@ -391,6 +285,7 @@ var ContactProperties = class {
391
285
  return await this.resend.delete(`/contact-properties/${id}`);
392
286
  }
393
287
  };
288
+
394
289
  //#endregion
395
290
  //#region src/contacts/segments/contact-segments.ts
396
291
  var ContactSegments = class {
@@ -439,6 +334,7 @@ var ContactSegments = class {
439
334
  return this.resend.delete(`/contacts/${identifier}/segments/${options.segmentId}`);
440
335
  }
441
336
  };
337
+
442
338
  //#endregion
443
339
  //#region src/contacts/topics/contact-topics.ts
444
340
  var ContactTopics = class {
@@ -474,6 +370,7 @@ var ContactTopics = class {
474
370
  return this.resend.get(url);
475
371
  }
476
372
  };
373
+
477
374
  //#endregion
478
375
  //#region src/contacts/contacts.ts
479
376
  var Contacts = class {
@@ -574,6 +471,7 @@ var Contacts = class {
574
471
  return this.resend.delete(`/audiences/${payload.audienceId}/contacts/${payload?.email ? payload?.email : payload?.id}`);
575
472
  }
576
473
  };
474
+
577
475
  //#endregion
578
476
  //#region src/common/utils/parse-domain-to-api-options.ts
579
477
  function parseDomainToApiOptions(domain) {
@@ -587,6 +485,7 @@ function parseDomainToApiOptions(domain) {
587
485
  tls: domain.tls
588
486
  };
589
487
  }
488
+
590
489
  //#endregion
591
490
  //#region src/domains/domains.ts
592
491
  var Domains = class {
@@ -619,6 +518,7 @@ var Domains = class {
619
518
  return await this.resend.post(`/domains/${id}/verify`);
620
519
  }
621
520
  };
521
+
622
522
  //#endregion
623
523
  //#region src/emails/attachments/attachments.ts
624
524
  var Attachments$1 = class {
@@ -636,6 +536,7 @@ var Attachments$1 = class {
636
536
  return await this.resend.get(url);
637
537
  }
638
538
  };
539
+
639
540
  //#endregion
640
541
  //#region src/emails/receiving/attachments/attachments.ts
641
542
  var Attachments = class {
@@ -653,6 +554,7 @@ var Attachments = class {
653
554
  return await this.resend.get(url);
654
555
  }
655
556
  };
557
+
656
558
  //#endregion
657
559
  //#region src/emails/receiving/receiving.ts
658
560
  var Receiving = class {
@@ -770,6 +672,7 @@ var Receiving = class {
770
672
  });
771
673
  }
772
674
  };
675
+
773
676
  //#endregion
774
677
  //#region src/emails/emails.ts
775
678
  var Emails = class {
@@ -800,33 +703,23 @@ var Emails = class {
800
703
  return await this.resend.post(`/emails/${id}/cancel`);
801
704
  }
802
705
  };
706
+
803
707
  //#endregion
804
- //#region src/events/events.ts
805
- var Events = class {
708
+ //#region src/logs/logs.ts
709
+ var Logs = class {
806
710
  constructor(resend) {
807
711
  this.resend = resend;
808
712
  }
809
- async send(payload) {
810
- return await this.resend.post("/events/send", parseEventToApiOptions(payload));
811
- }
812
- async create(payload) {
813
- return await this.resend.post("/events", payload);
814
- }
815
- async get(identifier) {
816
- return await this.resend.get(`/events/${encodeURIComponent(identifier)}`);
817
- }
818
713
  async list(options = {}) {
819
714
  const queryString = buildPaginationQuery(options);
820
- const url = queryString ? `/events?${queryString}` : "/events";
715
+ const url = queryString ? `/logs?${queryString}` : "/logs";
821
716
  return await this.resend.get(url);
822
717
  }
823
- async update(identifier, payload) {
824
- return await this.resend.patch(`/events/${encodeURIComponent(identifier)}`, payload);
825
- }
826
- async remove(identifier) {
827
- return await this.resend.delete(`/events/${encodeURIComponent(identifier)}`);
718
+ async get(id) {
719
+ return await this.resend.get(`/logs/${id}`);
828
720
  }
829
721
  };
722
+
830
723
  //#endregion
831
724
  //#region src/segments/segments.ts
832
725
  var Segments = class {
@@ -848,6 +741,7 @@ var Segments = class {
848
741
  return await this.resend.delete(`/segments/${id}`);
849
742
  }
850
743
  };
744
+
851
745
  //#endregion
852
746
  //#region src/common/utils/get-pagination-query-properties.ts
853
747
  function getPaginationQueryProperties(options = {}) {
@@ -857,6 +751,7 @@ function getPaginationQueryProperties(options = {}) {
857
751
  if (options.limit) query.set("limit", options.limit.toString());
858
752
  return query.size > 0 ? `?${query.toString()}` : "";
859
753
  }
754
+
860
755
  //#endregion
861
756
  //#region src/common/utils/parse-template-to-api-options.ts
862
757
  function parseVariables(variables) {
@@ -878,6 +773,7 @@ function parseTemplateToApiOptions(template) {
878
773
  variables: parseVariables(template.variables)
879
774
  };
880
775
  }
776
+
881
777
  //#endregion
882
778
  //#region src/templates/chainable-template-result.ts
883
779
  var ChainableTemplateResult = class {
@@ -898,6 +794,7 @@ var ChainableTemplateResult = class {
898
794
  return this.publishFn(data.id);
899
795
  }
900
796
  };
797
+
901
798
  //#endregion
902
799
  //#region src/templates/templates.ts
903
800
  var Templates = class {
@@ -938,6 +835,7 @@ var Templates = class {
938
835
  return await this.resend.patch(`/templates/${identifier}`, parseTemplateToApiOptions(payload));
939
836
  }
940
837
  };
838
+
941
839
  //#endregion
942
840
  //#region src/topics/topics.ts
943
841
  var Topics = class {
@@ -991,6 +889,7 @@ var Topics = class {
991
889
  return await this.resend.delete(`/topics/${id}`);
992
890
  }
993
891
  };
892
+
994
893
  //#endregion
995
894
  //#region src/webhooks/webhooks.ts
996
895
  var Webhooks = class {
@@ -1022,6 +921,7 @@ var Webhooks = class {
1022
921
  });
1023
922
  }
1024
923
  };
924
+
1025
925
  //#endregion
1026
926
  //#region src/resend.ts
1027
927
  const defaultBaseUrl = "https://api.resend.com";
@@ -1034,14 +934,13 @@ var Resend = class {
1034
934
  this.apiKeys = new ApiKeys(this);
1035
935
  this.segments = new Segments(this);
1036
936
  this.audiences = this.segments;
1037
- this.automations = new Automations(this);
1038
937
  this.batch = new Batch(this);
1039
938
  this.broadcasts = new Broadcasts(this);
1040
939
  this.contacts = new Contacts(this);
1041
940
  this.contactProperties = new ContactProperties(this);
1042
941
  this.domains = new Domains(this);
1043
942
  this.emails = new Emails(this);
1044
- this.events = new Events(this);
943
+ this.logs = new Logs(this);
1045
944
  this.webhooks = new Webhooks(this);
1046
945
  this.templates = new Templates(this);
1047
946
  this.topics = new Topics(this);
@@ -1164,5 +1063,6 @@ var Resend = class {
1164
1063
  return this.fetchRequest(path, requestOptions);
1165
1064
  }
1166
1065
  };
1066
+
1167
1067
  //#endregion
1168
- exports.Resend = Resend;
1068
+ exports.Resend = Resend;