@masters-union/outbound-sdk 0.1.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/README.md +175 -0
- package/dist/index.d.mts +420 -0
- package/dist/index.d.ts +420 -0
- package/dist/index.js +419 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +389 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +49 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/errors.ts
|
|
9
|
+
var OutboundError = class extends Error {
|
|
10
|
+
constructor(message, statusCode, details, requestId) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.statusCode = statusCode;
|
|
13
|
+
this.details = details;
|
|
14
|
+
this.requestId = requestId;
|
|
15
|
+
this.name = "OutboundError";
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var BadRequestError = class extends OutboundError {
|
|
19
|
+
constructor(message, details, requestId) {
|
|
20
|
+
super(message, 400, details, requestId);
|
|
21
|
+
this.name = "BadRequestError";
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var AuthenticationError = class extends OutboundError {
|
|
25
|
+
constructor(message, details, requestId) {
|
|
26
|
+
super(message, 401, details, requestId);
|
|
27
|
+
this.name = "AuthenticationError";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var ForbiddenError = class extends OutboundError {
|
|
31
|
+
constructor(message, details, requestId) {
|
|
32
|
+
super(message, 403, details, requestId);
|
|
33
|
+
this.name = "ForbiddenError";
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var NotFoundError = class extends OutboundError {
|
|
37
|
+
constructor(message, details, requestId) {
|
|
38
|
+
super(message, 404, details, requestId);
|
|
39
|
+
this.name = "NotFoundError";
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var ConflictError = class extends OutboundError {
|
|
43
|
+
constructor(message, details, requestId) {
|
|
44
|
+
super(message, 409, details, requestId);
|
|
45
|
+
this.name = "ConflictError";
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var RateLimitError = class extends OutboundError {
|
|
49
|
+
retryAfter;
|
|
50
|
+
constructor(message, retryAfter, details, requestId) {
|
|
51
|
+
super(message, 429, details, requestId);
|
|
52
|
+
this.name = "RateLimitError";
|
|
53
|
+
this.retryAfter = retryAfter;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var ServerError = class extends OutboundError {
|
|
57
|
+
constructor(message, statusCode = 500, details, requestId) {
|
|
58
|
+
super(message, statusCode, details, requestId);
|
|
59
|
+
this.name = "ServerError";
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var TimeoutError = class extends OutboundError {
|
|
63
|
+
constructor(message = "Request timed out") {
|
|
64
|
+
super(message, 0);
|
|
65
|
+
this.name = "TimeoutError";
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var NetworkError = class extends OutboundError {
|
|
69
|
+
constructor(message = "Network request failed") {
|
|
70
|
+
super(message, 0);
|
|
71
|
+
this.name = "NetworkError";
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// src/http.ts
|
|
76
|
+
var HttpClient = class {
|
|
77
|
+
constructor(config) {
|
|
78
|
+
this.config = config;
|
|
79
|
+
}
|
|
80
|
+
async get(path, params) {
|
|
81
|
+
return this.request("GET", path, { params });
|
|
82
|
+
}
|
|
83
|
+
async post(path, body) {
|
|
84
|
+
return this.request("POST", path, { body });
|
|
85
|
+
}
|
|
86
|
+
async patch(path, body) {
|
|
87
|
+
return this.request("PATCH", path, { body });
|
|
88
|
+
}
|
|
89
|
+
async delete(path) {
|
|
90
|
+
return this.request("DELETE", path);
|
|
91
|
+
}
|
|
92
|
+
async request(method, path, options) {
|
|
93
|
+
let lastError;
|
|
94
|
+
for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
|
|
95
|
+
try {
|
|
96
|
+
const url = this.buildUrl(path, options?.params);
|
|
97
|
+
const controller = new AbortController();
|
|
98
|
+
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
99
|
+
const response = await fetch(url, {
|
|
100
|
+
method,
|
|
101
|
+
headers: {
|
|
102
|
+
"X-Api-Key": this.config.apiKey,
|
|
103
|
+
"Content-Type": "application/json"
|
|
104
|
+
},
|
|
105
|
+
body: options?.body ? JSON.stringify(options.body) : void 0,
|
|
106
|
+
signal: controller.signal
|
|
107
|
+
});
|
|
108
|
+
clearTimeout(timeoutId);
|
|
109
|
+
if (response.ok) {
|
|
110
|
+
return await response.json();
|
|
111
|
+
}
|
|
112
|
+
const error = await this.parseError(response);
|
|
113
|
+
if (response.status === 429 || response.status >= 500) {
|
|
114
|
+
lastError = error;
|
|
115
|
+
if (attempt < this.config.maxRetries) {
|
|
116
|
+
const retryAfter = error instanceof RateLimitError && error.retryAfter ? error.retryAfter * 1e3 : this.config.retryDelay * Math.pow(2, attempt);
|
|
117
|
+
await this.sleep(retryAfter);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
throw error;
|
|
122
|
+
} catch (err) {
|
|
123
|
+
if (err instanceof OutboundError) {
|
|
124
|
+
if ((err.statusCode === 429 || err.statusCode >= 500) && attempt < this.config.maxRetries) {
|
|
125
|
+
lastError = err;
|
|
126
|
+
const retryAfter = err instanceof RateLimitError && err.retryAfter ? err.retryAfter * 1e3 : this.config.retryDelay * Math.pow(2, attempt);
|
|
127
|
+
await this.sleep(retryAfter);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
throw err;
|
|
131
|
+
}
|
|
132
|
+
if (err instanceof DOMException && err.name === "AbortError") {
|
|
133
|
+
lastError = new TimeoutError(`Request timed out after ${this.config.timeout}ms`);
|
|
134
|
+
if (attempt < this.config.maxRetries) {
|
|
135
|
+
await this.sleep(this.config.retryDelay * Math.pow(2, attempt));
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
throw lastError;
|
|
139
|
+
}
|
|
140
|
+
lastError = new NetworkError(err.message);
|
|
141
|
+
if (attempt < this.config.maxRetries) {
|
|
142
|
+
await this.sleep(this.config.retryDelay * Math.pow(2, attempt));
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
throw lastError;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
throw lastError || new NetworkError("Request failed after retries");
|
|
149
|
+
}
|
|
150
|
+
buildUrl(path, params) {
|
|
151
|
+
const base = this.config.baseUrl.replace(/\/+$/, "");
|
|
152
|
+
const url = new URL(`${base}${path}`);
|
|
153
|
+
if (params) {
|
|
154
|
+
for (const [key, value] of Object.entries(params)) {
|
|
155
|
+
if (value !== void 0 && value !== null) {
|
|
156
|
+
url.searchParams.set(key, String(value));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return url.toString();
|
|
161
|
+
}
|
|
162
|
+
async parseError(response) {
|
|
163
|
+
let body = {};
|
|
164
|
+
const requestId = response.headers.get("x-request-id") || void 0;
|
|
165
|
+
try {
|
|
166
|
+
body = await response.json();
|
|
167
|
+
} catch {
|
|
168
|
+
}
|
|
169
|
+
const message = body.error || body.message || `HTTP ${response.status}`;
|
|
170
|
+
const details = body.details;
|
|
171
|
+
switch (response.status) {
|
|
172
|
+
case 400:
|
|
173
|
+
return new BadRequestError(message, details, requestId);
|
|
174
|
+
case 401:
|
|
175
|
+
return new AuthenticationError(message, details, requestId);
|
|
176
|
+
case 403:
|
|
177
|
+
return new ForbiddenError(message, details, requestId);
|
|
178
|
+
case 404:
|
|
179
|
+
return new NotFoundError(message, details, requestId);
|
|
180
|
+
case 409:
|
|
181
|
+
return new ConflictError(message, details, requestId);
|
|
182
|
+
case 429: {
|
|
183
|
+
const retryAfter = response.headers.get("retry-after");
|
|
184
|
+
return new RateLimitError(
|
|
185
|
+
message,
|
|
186
|
+
retryAfter ? parseInt(retryAfter, 10) : void 0,
|
|
187
|
+
details,
|
|
188
|
+
requestId
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
default:
|
|
192
|
+
if (response.status >= 500) {
|
|
193
|
+
return new ServerError(message, response.status, details, requestId);
|
|
194
|
+
}
|
|
195
|
+
return new OutboundError(message, response.status, details, requestId);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
sleep(ms) {
|
|
199
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// src/resources/email.ts
|
|
204
|
+
var EmailResource = class {
|
|
205
|
+
constructor(http) {
|
|
206
|
+
this.http = http;
|
|
207
|
+
}
|
|
208
|
+
async send(params) {
|
|
209
|
+
return this.http.post("/v1/email/send", params);
|
|
210
|
+
}
|
|
211
|
+
async bulk(params) {
|
|
212
|
+
return this.http.post("/v1/email/bulk", params);
|
|
213
|
+
}
|
|
214
|
+
async status(jobId) {
|
|
215
|
+
return this.http.get(`/v1/email/status/${encodeURIComponent(jobId)}`);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// src/resources/templates.ts
|
|
220
|
+
var TemplatesResource = class {
|
|
221
|
+
constructor(http) {
|
|
222
|
+
this.http = http;
|
|
223
|
+
}
|
|
224
|
+
async create(params) {
|
|
225
|
+
return this.http.post("/v1/email-templates", params);
|
|
226
|
+
}
|
|
227
|
+
async list(params) {
|
|
228
|
+
return this.http.get("/v1/email-templates", params);
|
|
229
|
+
}
|
|
230
|
+
async *listAll(params) {
|
|
231
|
+
let page = 1;
|
|
232
|
+
const limit = params?.limit || 20;
|
|
233
|
+
while (true) {
|
|
234
|
+
const result = await this.list({ ...params, page, limit });
|
|
235
|
+
for (const template of result.templates) {
|
|
236
|
+
yield template;
|
|
237
|
+
}
|
|
238
|
+
if (result.templates.length < limit) break;
|
|
239
|
+
page++;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
async get(id) {
|
|
243
|
+
return this.http.get(`/v1/email-templates/${encodeURIComponent(id)}`);
|
|
244
|
+
}
|
|
245
|
+
async update(id, params) {
|
|
246
|
+
return this.http.patch(`/v1/email-templates/${encodeURIComponent(id)}`, params);
|
|
247
|
+
}
|
|
248
|
+
async delete(id) {
|
|
249
|
+
return this.http.delete(`/v1/email-templates/${encodeURIComponent(id)}`);
|
|
250
|
+
}
|
|
251
|
+
async duplicate(id, params) {
|
|
252
|
+
return this.http.post(`/v1/email-templates/${encodeURIComponent(id)}/duplicate`, params);
|
|
253
|
+
}
|
|
254
|
+
async preview(id, params) {
|
|
255
|
+
return this.http.post(`/v1/email-templates/${encodeURIComponent(id)}/preview`, params);
|
|
256
|
+
}
|
|
257
|
+
async send(params) {
|
|
258
|
+
return this.http.post("/v1/email-templates/send", params);
|
|
259
|
+
}
|
|
260
|
+
async bulkSend(params) {
|
|
261
|
+
return this.http.post("/v1/email-templates/bulk", params);
|
|
262
|
+
}
|
|
263
|
+
async stats() {
|
|
264
|
+
return this.http.get("/v1/email-templates/stats");
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// src/resources/suppressions.ts
|
|
269
|
+
var SuppressionsResource = class {
|
|
270
|
+
constructor(http) {
|
|
271
|
+
this.http = http;
|
|
272
|
+
}
|
|
273
|
+
async list(params) {
|
|
274
|
+
return this.http.get("/v1/tenants/suppressions", params);
|
|
275
|
+
}
|
|
276
|
+
async *listAll(params) {
|
|
277
|
+
let page = 1;
|
|
278
|
+
const limit = params?.limit || 50;
|
|
279
|
+
while (true) {
|
|
280
|
+
const result = await this.list({ ...params, page, limit });
|
|
281
|
+
for (const suppression of result.suppressions) {
|
|
282
|
+
yield suppression;
|
|
283
|
+
}
|
|
284
|
+
if (result.suppressions.length < limit) break;
|
|
285
|
+
page++;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
async add(params) {
|
|
289
|
+
return this.http.post("/v1/tenants/suppressions", params);
|
|
290
|
+
}
|
|
291
|
+
async remove(email) {
|
|
292
|
+
return this.http.delete(`/v1/tenants/suppressions/${encodeURIComponent(email)}`);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
// src/resources/webhooks.ts
|
|
297
|
+
var WebhooksResource = class {
|
|
298
|
+
constructor(http) {
|
|
299
|
+
this.http = http;
|
|
300
|
+
}
|
|
301
|
+
async create(params) {
|
|
302
|
+
return this.http.post("/v1/tenants/webhooks", params);
|
|
303
|
+
}
|
|
304
|
+
async list() {
|
|
305
|
+
return this.http.get("/v1/tenants/webhooks");
|
|
306
|
+
}
|
|
307
|
+
async update(id, params) {
|
|
308
|
+
return this.http.patch(`/v1/tenants/webhooks/${encodeURIComponent(id)}`, params);
|
|
309
|
+
}
|
|
310
|
+
async delete(id) {
|
|
311
|
+
return this.http.delete(`/v1/tenants/webhooks/${encodeURIComponent(id)}`);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// src/resources/dashboard.ts
|
|
316
|
+
var DashboardResource = class {
|
|
317
|
+
constructor(http) {
|
|
318
|
+
this.http = http;
|
|
319
|
+
}
|
|
320
|
+
async get() {
|
|
321
|
+
return this.http.get("/v1/tenants/dashboard");
|
|
322
|
+
}
|
|
323
|
+
async quota() {
|
|
324
|
+
return this.http.get("/v1/tenants/quota");
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// src/client.ts
|
|
329
|
+
var BASE_URL = "https://outbound-api.mastersunion.org";
|
|
330
|
+
var Outbound = class {
|
|
331
|
+
email;
|
|
332
|
+
templates;
|
|
333
|
+
suppressions;
|
|
334
|
+
webhooks;
|
|
335
|
+
dashboard;
|
|
336
|
+
constructor(config) {
|
|
337
|
+
const resolved = {
|
|
338
|
+
apiKey: config?.apiKey || this.getEnv("OUTBOUND_API_KEY") || "",
|
|
339
|
+
baseUrl: config?.baseUrl || BASE_URL,
|
|
340
|
+
timeout: config?.timeout ?? 3e4,
|
|
341
|
+
maxRetries: config?.maxRetries ?? 3,
|
|
342
|
+
retryDelay: config?.retryDelay ?? 1e3
|
|
343
|
+
};
|
|
344
|
+
if (!resolved.apiKey) {
|
|
345
|
+
throw new AuthenticationError(
|
|
346
|
+
"API key is required. Pass it to the constructor or set the OUTBOUND_API_KEY environment variable."
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
const http = new HttpClient(resolved);
|
|
350
|
+
this.email = new EmailResource(http);
|
|
351
|
+
this.templates = new TemplatesResource(http);
|
|
352
|
+
this.suppressions = new SuppressionsResource(http);
|
|
353
|
+
this.webhooks = new WebhooksResource(http);
|
|
354
|
+
this.dashboard = new DashboardResource(http);
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Verify a webhook signature using HMAC-SHA256.
|
|
358
|
+
* Use this in your webhook handler to validate incoming requests.
|
|
359
|
+
*/
|
|
360
|
+
static verifyWebhookSignature(payload, signature, secret) {
|
|
361
|
+
const crypto = __require("crypto");
|
|
362
|
+
const expected = crypto.createHmac("sha256", secret).update(payload).digest("hex");
|
|
363
|
+
try {
|
|
364
|
+
return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
|
|
365
|
+
} catch {
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
getEnv(key) {
|
|
370
|
+
if (typeof process !== "undefined" && process.env) {
|
|
371
|
+
return process.env[key];
|
|
372
|
+
}
|
|
373
|
+
return void 0;
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
export {
|
|
377
|
+
AuthenticationError,
|
|
378
|
+
BadRequestError,
|
|
379
|
+
ConflictError,
|
|
380
|
+
ForbiddenError,
|
|
381
|
+
NetworkError,
|
|
382
|
+
NotFoundError,
|
|
383
|
+
Outbound,
|
|
384
|
+
OutboundError,
|
|
385
|
+
RateLimitError,
|
|
386
|
+
ServerError,
|
|
387
|
+
TimeoutError
|
|
388
|
+
};
|
|
389
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/http.ts","../src/resources/email.ts","../src/resources/templates.ts","../src/resources/suppressions.ts","../src/resources/webhooks.ts","../src/resources/dashboard.ts","../src/client.ts"],"sourcesContent":["export class OutboundError extends Error {\n constructor(\n message: string,\n public readonly statusCode: number,\n public readonly details?: unknown,\n public readonly requestId?: string,\n ) {\n super(message);\n this.name = 'OutboundError';\n }\n}\n\nexport class BadRequestError extends OutboundError {\n constructor(message: string, details?: unknown, requestId?: string) {\n super(message, 400, details, requestId);\n this.name = 'BadRequestError';\n }\n}\n\nexport class AuthenticationError extends OutboundError {\n constructor(message: string, details?: unknown, requestId?: string) {\n super(message, 401, details, requestId);\n this.name = 'AuthenticationError';\n }\n}\n\nexport class ForbiddenError extends OutboundError {\n constructor(message: string, details?: unknown, requestId?: string) {\n super(message, 403, details, requestId);\n this.name = 'ForbiddenError';\n }\n}\n\nexport class NotFoundError extends OutboundError {\n constructor(message: string, details?: unknown, requestId?: string) {\n super(message, 404, details, requestId);\n this.name = 'NotFoundError';\n }\n}\n\nexport class ConflictError extends OutboundError {\n constructor(message: string, details?: unknown, requestId?: string) {\n super(message, 409, details, requestId);\n this.name = 'ConflictError';\n }\n}\n\nexport class RateLimitError extends OutboundError {\n public readonly retryAfter?: number;\n\n constructor(message: string, retryAfter?: number, details?: unknown, requestId?: string) {\n super(message, 429, details, requestId);\n this.name = 'RateLimitError';\n this.retryAfter = retryAfter;\n }\n}\n\nexport class ServerError extends OutboundError {\n constructor(message: string, statusCode: number = 500, details?: unknown, requestId?: string) {\n super(message, statusCode, details, requestId);\n this.name = 'ServerError';\n }\n}\n\nexport class TimeoutError extends OutboundError {\n constructor(message: string = 'Request timed out') {\n super(message, 0);\n this.name = 'TimeoutError';\n }\n}\n\nexport class NetworkError extends OutboundError {\n constructor(message: string = 'Network request failed') {\n super(message, 0);\n this.name = 'NetworkError';\n }\n}\n","import type { ResolvedConfig } from './types';\nimport {\n OutboundError,\n BadRequestError,\n AuthenticationError,\n ForbiddenError,\n NotFoundError,\n ConflictError,\n RateLimitError,\n ServerError,\n TimeoutError,\n NetworkError,\n} from './errors';\n\nexport interface RequestOptions {\n body?: unknown;\n params?: Record<string, unknown>;\n}\n\nexport class HttpClient {\n constructor(private config: ResolvedConfig) {}\n\n async get<T>(path: string, params?: Record<string, unknown>): Promise<T> {\n return this.request<T>('GET', path, { params });\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n return this.request<T>('POST', path, { body });\n }\n\n async patch<T>(path: string, body?: unknown): Promise<T> {\n return this.request<T>('PATCH', path, { body });\n }\n\n async delete<T>(path: string): Promise<T> {\n return this.request<T>('DELETE', path);\n }\n\n private async request<T>(method: string, path: string, options?: RequestOptions): Promise<T> {\n let lastError: Error | undefined;\n\n for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {\n try {\n const url = this.buildUrl(path, options?.params);\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n const response = await fetch(url, {\n method,\n headers: {\n 'X-Api-Key': this.config.apiKey,\n 'Content-Type': 'application/json',\n },\n body: options?.body ? JSON.stringify(options.body) : undefined,\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (response.ok) {\n return (await response.json()) as T;\n }\n\n const error = await this.parseError(response);\n\n // Only retry on 429 and 5xx\n if (response.status === 429 || response.status >= 500) {\n lastError = error;\n\n if (attempt < this.config.maxRetries) {\n const retryAfter = error instanceof RateLimitError && error.retryAfter\n ? error.retryAfter * 1000\n : this.config.retryDelay * Math.pow(2, attempt);\n\n await this.sleep(retryAfter);\n continue;\n }\n }\n\n throw error;\n } catch (err) {\n if (err instanceof OutboundError) {\n // Already a typed error from parseError — check if retryable\n if ((err.statusCode === 429 || err.statusCode >= 500) && attempt < this.config.maxRetries) {\n lastError = err;\n const retryAfter = err instanceof RateLimitError && err.retryAfter\n ? err.retryAfter * 1000\n : this.config.retryDelay * Math.pow(2, attempt);\n await this.sleep(retryAfter);\n continue;\n }\n throw err;\n }\n\n if (err instanceof DOMException && err.name === 'AbortError') {\n lastError = new TimeoutError(`Request timed out after ${this.config.timeout}ms`);\n if (attempt < this.config.maxRetries) {\n await this.sleep(this.config.retryDelay * Math.pow(2, attempt));\n continue;\n }\n throw lastError;\n }\n\n lastError = new NetworkError((err as Error).message);\n if (attempt < this.config.maxRetries) {\n await this.sleep(this.config.retryDelay * Math.pow(2, attempt));\n continue;\n }\n throw lastError;\n }\n }\n\n throw lastError || new NetworkError('Request failed after retries');\n }\n\n private buildUrl(path: string, params?: Record<string, unknown>): string {\n const base = this.config.baseUrl.replace(/\\/+$/, '');\n const url = new URL(`${base}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n return url.toString();\n }\n\n private async parseError(response: Response): Promise<OutboundError> {\n let body: { error?: string; message?: string; details?: unknown } = {};\n const requestId = response.headers.get('x-request-id') || undefined;\n\n try {\n body = (await response.json()) as typeof body;\n } catch {\n // Response may not be JSON\n }\n\n const message = body.error || body.message || `HTTP ${response.status}`;\n const details = body.details;\n\n switch (response.status) {\n case 400:\n return new BadRequestError(message, details, requestId);\n case 401:\n return new AuthenticationError(message, details, requestId);\n case 403:\n return new ForbiddenError(message, details, requestId);\n case 404:\n return new NotFoundError(message, details, requestId);\n case 409:\n return new ConflictError(message, details, requestId);\n case 429: {\n const retryAfter = response.headers.get('retry-after');\n return new RateLimitError(\n message,\n retryAfter ? parseInt(retryAfter, 10) : undefined,\n details,\n requestId,\n );\n }\n default:\n if (response.status >= 500) {\n return new ServerError(message, response.status, details, requestId);\n }\n return new OutboundError(message, response.status, details, requestId);\n }\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n","import type { HttpClient } from '../http';\nimport type {\n SendEmailParams,\n SendEmailResponse,\n BulkEmailParams,\n BulkEmailResponse,\n JobStatusResponse,\n} from '../types';\n\nexport class EmailResource {\n constructor(private http: HttpClient) {}\n\n async send(params: SendEmailParams): Promise<SendEmailResponse> {\n return this.http.post<SendEmailResponse>('/v1/email/send', params);\n }\n\n async bulk(params: BulkEmailParams): Promise<BulkEmailResponse> {\n return this.http.post<BulkEmailResponse>('/v1/email/bulk', params);\n }\n\n async status(jobId: string): Promise<JobStatusResponse> {\n return this.http.get<JobStatusResponse>(`/v1/email/status/${encodeURIComponent(jobId)}`);\n }\n}\n","import type { HttpClient } from '../http';\nimport type {\n CreateTemplateParams,\n UpdateTemplateParams,\n ListTemplatesParams,\n ListTemplatesResponse,\n Template,\n TemplateResponse,\n TemplateSendParams,\n SendEmailResponse,\n TemplateBulkSendParams,\n TemplateBulkSendResponse,\n TemplatePreviewParams,\n TemplatePreviewResponse,\n TemplateStatsResponse,\n} from '../types';\n\nexport class TemplatesResource {\n constructor(private http: HttpClient) {}\n\n async create(params: CreateTemplateParams): Promise<TemplateResponse> {\n return this.http.post<TemplateResponse>('/v1/email-templates', params);\n }\n\n async list(params?: ListTemplatesParams): Promise<ListTemplatesResponse> {\n return this.http.get<ListTemplatesResponse>('/v1/email-templates', params as Record<string, unknown>);\n }\n\n async *listAll(params?: Omit<ListTemplatesParams, 'page'>): AsyncGenerator<Template> {\n let page = 1;\n const limit = params?.limit || 20;\n\n while (true) {\n const result = await this.list({ ...params, page, limit });\n for (const template of result.templates) {\n yield template;\n }\n if (result.templates.length < limit) break;\n page++;\n }\n }\n\n async get(id: string): Promise<TemplateResponse> {\n return this.http.get<TemplateResponse>(`/v1/email-templates/${encodeURIComponent(id)}`);\n }\n\n async update(id: string, params: UpdateTemplateParams): Promise<TemplateResponse> {\n return this.http.patch<TemplateResponse>(`/v1/email-templates/${encodeURIComponent(id)}`, params);\n }\n\n async delete(id: string): Promise<{ message: string; id: string }> {\n return this.http.delete<{ message: string; id: string }>(`/v1/email-templates/${encodeURIComponent(id)}`);\n }\n\n async duplicate(id: string, params?: { name?: string }): Promise<TemplateResponse> {\n return this.http.post<TemplateResponse>(`/v1/email-templates/${encodeURIComponent(id)}/duplicate`, params);\n }\n\n async preview(id: string, params?: TemplatePreviewParams): Promise<TemplatePreviewResponse> {\n return this.http.post<TemplatePreviewResponse>(`/v1/email-templates/${encodeURIComponent(id)}/preview`, params);\n }\n\n async send(params: TemplateSendParams): Promise<SendEmailResponse> {\n return this.http.post<SendEmailResponse>('/v1/email-templates/send', params);\n }\n\n async bulkSend(params: TemplateBulkSendParams): Promise<TemplateBulkSendResponse> {\n return this.http.post<TemplateBulkSendResponse>('/v1/email-templates/bulk', params);\n }\n\n async stats(): Promise<TemplateStatsResponse> {\n return this.http.get<TemplateStatsResponse>('/v1/email-templates/stats');\n }\n}\n","import type { HttpClient } from '../http';\nimport type {\n ListSuppressionsParams,\n ListSuppressionsResponse,\n AddSuppressionParams,\n SuppressionResponse,\n Suppression,\n} from '../types';\n\nexport class SuppressionsResource {\n constructor(private http: HttpClient) {}\n\n async list(params?: ListSuppressionsParams): Promise<ListSuppressionsResponse> {\n return this.http.get<ListSuppressionsResponse>('/v1/tenants/suppressions', params as Record<string, unknown>);\n }\n\n async *listAll(params?: Omit<ListSuppressionsParams, 'page'>): AsyncGenerator<Suppression> {\n let page = 1;\n const limit = params?.limit || 50;\n\n while (true) {\n const result = await this.list({ ...params, page, limit });\n for (const suppression of result.suppressions) {\n yield suppression;\n }\n if (result.suppressions.length < limit) break;\n page++;\n }\n }\n\n async add(params: AddSuppressionParams): Promise<SuppressionResponse> {\n return this.http.post<SuppressionResponse>('/v1/tenants/suppressions', params);\n }\n\n async remove(email: string): Promise<{ message: string }> {\n return this.http.delete<{ message: string }>(`/v1/tenants/suppressions/${encodeURIComponent(email)}`);\n }\n}\n","import type { HttpClient } from '../http';\nimport type {\n CreateWebhookParams,\n CreateWebhookResponse,\n UpdateWebhookParams,\n UpdateWebhookResponse,\n ListWebhooksResponse,\n} from '../types';\n\nexport class WebhooksResource {\n constructor(private http: HttpClient) {}\n\n async create(params: CreateWebhookParams): Promise<CreateWebhookResponse> {\n return this.http.post<CreateWebhookResponse>('/v1/tenants/webhooks', params);\n }\n\n async list(): Promise<ListWebhooksResponse> {\n return this.http.get<ListWebhooksResponse>('/v1/tenants/webhooks');\n }\n\n async update(id: string, params: UpdateWebhookParams): Promise<UpdateWebhookResponse> {\n return this.http.patch<UpdateWebhookResponse>(`/v1/tenants/webhooks/${encodeURIComponent(id)}`, params);\n }\n\n async delete(id: string): Promise<{ message: string; id: string }> {\n return this.http.delete<{ message: string; id: string }>(`/v1/tenants/webhooks/${encodeURIComponent(id)}`);\n }\n}\n","import type { HttpClient } from '../http';\nimport type { DashboardResponse, QuotaResponse } from '../types';\n\nexport class DashboardResource {\n constructor(private http: HttpClient) {}\n\n async get(): Promise<DashboardResponse> {\n return this.http.get<DashboardResponse>('/v1/tenants/dashboard');\n }\n\n async quota(): Promise<QuotaResponse> {\n return this.http.get<QuotaResponse>('/v1/tenants/quota');\n }\n}\n","import { HttpClient } from './http';\nimport { AuthenticationError } from './errors';\nimport { EmailResource } from './resources/email';\nimport { TemplatesResource } from './resources/templates';\nimport { SuppressionsResource } from './resources/suppressions';\nimport { WebhooksResource } from './resources/webhooks';\nimport { DashboardResource } from './resources/dashboard';\nimport type { OutboundConfig, ResolvedConfig } from './types';\n\nconst BASE_URL = 'https://outbound-api.mastersunion.org';\n\nexport class Outbound {\n readonly email: EmailResource;\n readonly templates: TemplatesResource;\n readonly suppressions: SuppressionsResource;\n readonly webhooks: WebhooksResource;\n readonly dashboard: DashboardResource;\n\n constructor(config?: OutboundConfig) {\n const resolved: ResolvedConfig = {\n apiKey: config?.apiKey || this.getEnv('OUTBOUND_API_KEY') || '',\n baseUrl: config?.baseUrl || BASE_URL,\n timeout: config?.timeout ?? 30_000,\n maxRetries: config?.maxRetries ?? 3,\n retryDelay: config?.retryDelay ?? 1000,\n };\n\n if (!resolved.apiKey) {\n throw new AuthenticationError(\n 'API key is required. Pass it to the constructor or set the OUTBOUND_API_KEY environment variable.',\n );\n }\n\n const http = new HttpClient(resolved);\n\n this.email = new EmailResource(http);\n this.templates = new TemplatesResource(http);\n this.suppressions = new SuppressionsResource(http);\n this.webhooks = new WebhooksResource(http);\n this.dashboard = new DashboardResource(http);\n }\n\n /**\n * Verify a webhook signature using HMAC-SHA256.\n * Use this in your webhook handler to validate incoming requests.\n */\n static verifyWebhookSignature(\n payload: string | Buffer,\n signature: string,\n secret: string,\n ): boolean {\n // Dynamic import to keep browser-compatible at the type level\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const crypto = require('crypto') as typeof import('crypto');\n const expected = crypto.createHmac('sha256', secret).update(payload).digest('hex');\n try {\n return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));\n } catch {\n return false;\n }\n }\n\n private getEnv(key: string): string | undefined {\n if (typeof process !== 'undefined' && process.env) {\n return process.env[key];\n }\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;AAAO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACvC,YACE,SACgB,YACA,SACA,WAChB;AACA,UAAM,OAAO;AAJG;AACA;AACA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,kBAAN,cAA8B,cAAc;AAAA,EACjD,YAAY,SAAiB,SAAmB,WAAoB;AAClE,UAAM,SAAS,KAAK,SAAS,SAAS;AACtC,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,sBAAN,cAAkC,cAAc;AAAA,EACrD,YAAY,SAAiB,SAAmB,WAAoB;AAClE,UAAM,SAAS,KAAK,SAAS,SAAS;AACtC,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,iBAAN,cAA6B,cAAc;A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AE,OAAO,KAAK;AACjF,QAAI;AACF,aAAO,OAAO,gBAAgB,OAAO,KAAK,SAAS,GAAG,OAAO,KAAK,QAAQ,CAAC;AAAA,IAC7E,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEQ,OAAO,KAAiC;AAC9C,QAAI,OAAO,YAAY,eAAe,QAAQ,KAAK;AACjD,aAAO,QAAQ,IAAI,GAAG;AAAA,IACxB;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@masters-union/outbound-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Official Node.js SDK for the Outbound email platform",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsup",
|
|
20
|
+
"dev": "tsup --watch",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"test:watch": "vitest",
|
|
23
|
+
"lint": "tsc --noEmit",
|
|
24
|
+
"docs:dev": "vitepress dev docs",
|
|
25
|
+
"docs:build": "vitepress build docs",
|
|
26
|
+
"docs:preview": "vitepress preview docs",
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"email",
|
|
31
|
+
"bulk-email",
|
|
32
|
+
"ses",
|
|
33
|
+
"outbound",
|
|
34
|
+
"email-api",
|
|
35
|
+
"transactional-email"
|
|
36
|
+
],
|
|
37
|
+
"author": "Adarsh Chakraborty",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^25.3.5",
|
|
44
|
+
"tsup": "^8.0.0",
|
|
45
|
+
"typescript": "^5.4.0",
|
|
46
|
+
"vitepress": "^1.6.4",
|
|
47
|
+
"vitest": "^1.0.0"
|
|
48
|
+
}
|
|
49
|
+
}
|