resend 6.10.0-preview-workflows.2 → 6.10.0-preview-tracking-domains.2
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 +27 -207
- package/dist/index.d.cts +91 -558
- package/dist/index.d.mts +91 -558
- package/dist/index.mjs +27 -207
- package/package.json +15 -17
package/dist/index.cjs
CHANGED
|
@@ -25,7 +25,7 @@ let postal_mime = require("postal-mime");
|
|
|
25
25
|
postal_mime = __toESM(postal_mime);
|
|
26
26
|
let svix = require("svix");
|
|
27
27
|
//#region package.json
|
|
28
|
-
var version = "6.10.0-preview-
|
|
28
|
+
var version = "6.10.0-preview-tracking-domains.2";
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/common/utils/build-pagination-query.ts
|
|
31
31
|
/**
|
|
@@ -59,126 +59,6 @@ var ApiKeys = class {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
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
|
-
};
|
|
181
|
-
//#endregion
|
|
182
62
|
//#region src/common/utils/parse-email-to-api-options.ts
|
|
183
63
|
function parseAttachments(attachments) {
|
|
184
64
|
return attachments?.map((attachment) => ({
|
|
@@ -588,10 +468,36 @@ function parseDomainToApiOptions(domain) {
|
|
|
588
468
|
};
|
|
589
469
|
}
|
|
590
470
|
//#endregion
|
|
471
|
+
//#region src/domains/tracking/tracking.ts
|
|
472
|
+
var Tracking = class {
|
|
473
|
+
constructor(resend) {
|
|
474
|
+
this.resend = resend;
|
|
475
|
+
}
|
|
476
|
+
async create(domainId, payload, options = {}) {
|
|
477
|
+
return this.resend.post(`/domains/${domainId}/tracking`, payload, options);
|
|
478
|
+
}
|
|
479
|
+
async list(domainId) {
|
|
480
|
+
return this.resend.get(`/domains/${domainId}/tracking`);
|
|
481
|
+
}
|
|
482
|
+
async get(domainId, trackingId) {
|
|
483
|
+
return this.resend.get(`/domains/${domainId}/tracking/${trackingId}`);
|
|
484
|
+
}
|
|
485
|
+
async update(domainId, trackingId, payload) {
|
|
486
|
+
return this.resend.patch(`/domains/${domainId}/tracking/${trackingId}`, payload);
|
|
487
|
+
}
|
|
488
|
+
async remove(domainId, trackingId) {
|
|
489
|
+
return this.resend.delete(`/domains/${domainId}/tracking/${trackingId}`);
|
|
490
|
+
}
|
|
491
|
+
async verify(domainId, trackingId) {
|
|
492
|
+
return this.resend.post(`/domains/${domainId}/tracking/${trackingId}/verify`);
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
//#endregion
|
|
591
496
|
//#region src/domains/domains.ts
|
|
592
497
|
var Domains = class {
|
|
593
498
|
constructor(resend) {
|
|
594
499
|
this.resend = resend;
|
|
500
|
+
this.tracking = new Tracking(resend);
|
|
595
501
|
}
|
|
596
502
|
async create(payload, options = {}) {
|
|
597
503
|
return await this.resend.post("/domains", parseDomainToApiOptions(payload), options);
|
|
@@ -801,33 +707,6 @@ var Emails = class {
|
|
|
801
707
|
}
|
|
802
708
|
};
|
|
803
709
|
//#endregion
|
|
804
|
-
//#region src/events/events.ts
|
|
805
|
-
var Events = class {
|
|
806
|
-
constructor(resend) {
|
|
807
|
-
this.resend = resend;
|
|
808
|
-
}
|
|
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
|
-
async list(options = {}) {
|
|
819
|
-
const queryString = buildPaginationQuery(options);
|
|
820
|
-
const url = queryString ? `/events?${queryString}` : "/events";
|
|
821
|
-
return await this.resend.get(url);
|
|
822
|
-
}
|
|
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)}`);
|
|
828
|
-
}
|
|
829
|
-
};
|
|
830
|
-
//#endregion
|
|
831
710
|
//#region src/segments/segments.ts
|
|
832
711
|
var Segments = class {
|
|
833
712
|
constructor(resend) {
|
|
@@ -1023,62 +902,6 @@ var Webhooks = class {
|
|
|
1023
902
|
}
|
|
1024
903
|
};
|
|
1025
904
|
//#endregion
|
|
1026
|
-
//#region src/workflow-run-steps/workflow-run-steps.ts
|
|
1027
|
-
var WorkflowRunSteps = class {
|
|
1028
|
-
constructor(resend) {
|
|
1029
|
-
this.resend = resend;
|
|
1030
|
-
}
|
|
1031
|
-
async get(options) {
|
|
1032
|
-
return await this.resend.get(`/automations/${options.workflowId}/runs/${options.runId}/steps/${options.stepId}`);
|
|
1033
|
-
}
|
|
1034
|
-
async list(options) {
|
|
1035
|
-
const queryString = buildPaginationQuery(options);
|
|
1036
|
-
const url = queryString ? `/automations/${options.workflowId}/runs/${options.runId}/steps?${queryString}` : `/automations/${options.workflowId}/runs/${options.runId}/steps`;
|
|
1037
|
-
return await this.resend.get(url);
|
|
1038
|
-
}
|
|
1039
|
-
};
|
|
1040
|
-
//#endregion
|
|
1041
|
-
//#region src/workflow-runs/workflow-runs.ts
|
|
1042
|
-
var WorkflowRuns = class {
|
|
1043
|
-
constructor(resend) {
|
|
1044
|
-
this.resend = resend;
|
|
1045
|
-
this.steps = new WorkflowRunSteps(resend);
|
|
1046
|
-
}
|
|
1047
|
-
async get(options) {
|
|
1048
|
-
return await this.resend.get(`/automations/${options.workflowId}/runs/${options.runId}`);
|
|
1049
|
-
}
|
|
1050
|
-
async list(options) {
|
|
1051
|
-
const queryString = buildPaginationQuery(options);
|
|
1052
|
-
const url = queryString ? `/automations/${options.workflowId}/runs?${queryString}` : `/automations/${options.workflowId}/runs`;
|
|
1053
|
-
return await this.resend.get(url);
|
|
1054
|
-
}
|
|
1055
|
-
};
|
|
1056
|
-
//#endregion
|
|
1057
|
-
//#region src/workflows/workflows.ts
|
|
1058
|
-
var Workflows = class {
|
|
1059
|
-
constructor(resend) {
|
|
1060
|
-
this.resend = resend;
|
|
1061
|
-
this.runs = new WorkflowRuns(this.resend);
|
|
1062
|
-
}
|
|
1063
|
-
async create(payload) {
|
|
1064
|
-
return await this.resend.post("/automations", parseAutomationToApiOptions(payload));
|
|
1065
|
-
}
|
|
1066
|
-
async list(options = {}) {
|
|
1067
|
-
const queryString = buildPaginationQuery(options);
|
|
1068
|
-
const url = queryString ? `/automations?${queryString}` : "/automations";
|
|
1069
|
-
return await this.resend.get(url);
|
|
1070
|
-
}
|
|
1071
|
-
async get(id) {
|
|
1072
|
-
return await this.resend.get(`/automations/${id}`);
|
|
1073
|
-
}
|
|
1074
|
-
async remove(id) {
|
|
1075
|
-
return await this.resend.delete(`/automations/${id}`);
|
|
1076
|
-
}
|
|
1077
|
-
async update(id, payload) {
|
|
1078
|
-
return await this.resend.patch(`/automations/${id}`, payload);
|
|
1079
|
-
}
|
|
1080
|
-
};
|
|
1081
|
-
//#endregion
|
|
1082
905
|
//#region src/resend.ts
|
|
1083
906
|
const defaultBaseUrl = "https://api.resend.com";
|
|
1084
907
|
const defaultUserAgent = `resend-node:${version}`;
|
|
@@ -1090,18 +913,15 @@ var Resend = class {
|
|
|
1090
913
|
this.apiKeys = new ApiKeys(this);
|
|
1091
914
|
this.segments = new Segments(this);
|
|
1092
915
|
this.audiences = this.segments;
|
|
1093
|
-
this.automations = new Automations(this);
|
|
1094
916
|
this.batch = new Batch(this);
|
|
1095
917
|
this.broadcasts = new Broadcasts(this);
|
|
1096
918
|
this.contacts = new Contacts(this);
|
|
1097
919
|
this.contactProperties = new ContactProperties(this);
|
|
1098
920
|
this.domains = new Domains(this);
|
|
1099
921
|
this.emails = new Emails(this);
|
|
1100
|
-
this.events = new Events(this);
|
|
1101
922
|
this.webhooks = new Webhooks(this);
|
|
1102
923
|
this.templates = new Templates(this);
|
|
1103
924
|
this.topics = new Topics(this);
|
|
1104
|
-
this.workflows = new Workflows(this);
|
|
1105
925
|
if (!key) {
|
|
1106
926
|
if (typeof process !== "undefined" && process.env) this.key = process.env.RESEND_API_KEY;
|
|
1107
927
|
if (!this.key) throw new Error("Missing API key. Pass it to the constructor `new Resend(\"re_123\")`");
|