@upyo/maileroo 0.6.0-dev.223 → 0.6.0-dev.225
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 +25 -4
- package/dist/index.js +25 -4
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -219,20 +219,20 @@ function parseResponse(text) {
|
|
|
219
219
|
function truncateErrorMessage(message) {
|
|
220
220
|
return message.length > maxErrorMessageLength ? `${message.slice(0, maxErrorMessageLength)}...` : message;
|
|
221
221
|
}
|
|
222
|
-
function abortReason(signal) {
|
|
222
|
+
function abortReason$1(signal) {
|
|
223
223
|
return signal?.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
224
224
|
}
|
|
225
225
|
function sleep(ms, signal) {
|
|
226
226
|
return new Promise((resolve, reject) => {
|
|
227
227
|
if (signal?.aborted) {
|
|
228
|
-
reject(abortReason(signal));
|
|
228
|
+
reject(abortReason$1(signal));
|
|
229
229
|
return;
|
|
230
230
|
}
|
|
231
231
|
const timeoutState = {};
|
|
232
232
|
const onAbort = () => {
|
|
233
233
|
if (timeoutState.id !== void 0) clearTimeout(timeoutState.id);
|
|
234
234
|
signal?.removeEventListener("abort", onAbort);
|
|
235
|
-
reject(abortReason(signal));
|
|
235
|
+
reject(abortReason$1(signal));
|
|
236
236
|
};
|
|
237
237
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
238
238
|
if (signal?.aborted) {
|
|
@@ -331,7 +331,7 @@ function convertHeaders(message) {
|
|
|
331
331
|
}
|
|
332
332
|
async function convertAttachment(attachment, signal) {
|
|
333
333
|
signal?.throwIfAborted();
|
|
334
|
-
const content = await attachment.content;
|
|
334
|
+
const content = await waitForAttachmentContent(attachment.content, signal);
|
|
335
335
|
signal?.throwIfAborted();
|
|
336
336
|
return {
|
|
337
337
|
file_name: getAttachmentFileName(attachment),
|
|
@@ -340,6 +340,27 @@ async function convertAttachment(attachment, signal) {
|
|
|
340
340
|
inline: attachment.inline || void 0
|
|
341
341
|
};
|
|
342
342
|
}
|
|
343
|
+
function waitForAttachmentContent(content, signal) {
|
|
344
|
+
if (signal == null) return Promise.resolve(content);
|
|
345
|
+
if (signal.aborted) return Promise.reject(abortReason(signal));
|
|
346
|
+
return new Promise((resolve, reject) => {
|
|
347
|
+
const onAbort = () => {
|
|
348
|
+
signal.removeEventListener("abort", onAbort);
|
|
349
|
+
reject(abortReason(signal));
|
|
350
|
+
};
|
|
351
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
352
|
+
Promise.resolve(content).then((value) => {
|
|
353
|
+
signal.removeEventListener("abort", onAbort);
|
|
354
|
+
resolve(value);
|
|
355
|
+
}, (error) => {
|
|
356
|
+
signal.removeEventListener("abort", onAbort);
|
|
357
|
+
reject(error);
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
function abortReason(signal) {
|
|
362
|
+
return signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
363
|
+
}
|
|
343
364
|
function getAttachmentFileName(attachment) {
|
|
344
365
|
return attachment.inline && typeof attachment.contentId === "string" && attachment.contentId !== "" ? attachment.contentId : attachment.filename;
|
|
345
366
|
}
|
package/dist/index.js
CHANGED
|
@@ -196,20 +196,20 @@ function parseResponse(text) {
|
|
|
196
196
|
function truncateErrorMessage(message) {
|
|
197
197
|
return message.length > maxErrorMessageLength ? `${message.slice(0, maxErrorMessageLength)}...` : message;
|
|
198
198
|
}
|
|
199
|
-
function abortReason(signal) {
|
|
199
|
+
function abortReason$1(signal) {
|
|
200
200
|
return signal?.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
201
201
|
}
|
|
202
202
|
function sleep(ms, signal) {
|
|
203
203
|
return new Promise((resolve, reject) => {
|
|
204
204
|
if (signal?.aborted) {
|
|
205
|
-
reject(abortReason(signal));
|
|
205
|
+
reject(abortReason$1(signal));
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
208
|
const timeoutState = {};
|
|
209
209
|
const onAbort = () => {
|
|
210
210
|
if (timeoutState.id !== void 0) clearTimeout(timeoutState.id);
|
|
211
211
|
signal?.removeEventListener("abort", onAbort);
|
|
212
|
-
reject(abortReason(signal));
|
|
212
|
+
reject(abortReason$1(signal));
|
|
213
213
|
};
|
|
214
214
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
215
215
|
if (signal?.aborted) {
|
|
@@ -308,7 +308,7 @@ function convertHeaders(message) {
|
|
|
308
308
|
}
|
|
309
309
|
async function convertAttachment(attachment, signal) {
|
|
310
310
|
signal?.throwIfAborted();
|
|
311
|
-
const content = await attachment.content;
|
|
311
|
+
const content = await waitForAttachmentContent(attachment.content, signal);
|
|
312
312
|
signal?.throwIfAborted();
|
|
313
313
|
return {
|
|
314
314
|
file_name: getAttachmentFileName(attachment),
|
|
@@ -317,6 +317,27 @@ async function convertAttachment(attachment, signal) {
|
|
|
317
317
|
inline: attachment.inline || void 0
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
|
+
function waitForAttachmentContent(content, signal) {
|
|
321
|
+
if (signal == null) return Promise.resolve(content);
|
|
322
|
+
if (signal.aborted) return Promise.reject(abortReason(signal));
|
|
323
|
+
return new Promise((resolve, reject) => {
|
|
324
|
+
const onAbort = () => {
|
|
325
|
+
signal.removeEventListener("abort", onAbort);
|
|
326
|
+
reject(abortReason(signal));
|
|
327
|
+
};
|
|
328
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
329
|
+
Promise.resolve(content).then((value) => {
|
|
330
|
+
signal.removeEventListener("abort", onAbort);
|
|
331
|
+
resolve(value);
|
|
332
|
+
}, (error) => {
|
|
333
|
+
signal.removeEventListener("abort", onAbort);
|
|
334
|
+
reject(error);
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
function abortReason(signal) {
|
|
339
|
+
return signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
340
|
+
}
|
|
320
341
|
function getAttachmentFileName(attachment) {
|
|
321
342
|
return attachment.inline && typeof attachment.contentId === "string" && attachment.contentId !== "" ? attachment.contentId : attachment.filename;
|
|
322
343
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upyo/maileroo",
|
|
3
|
-
"version": "0.6.0-dev.
|
|
3
|
+
"version": "0.6.0-dev.225",
|
|
4
4
|
"description": "Maileroo transport for Upyo email library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": false,
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@upyo/core": "0.6.0-dev.
|
|
56
|
+
"@upyo/core": "0.6.0-dev.225+1a4bf2e0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"tsdown": "^0.12.7",
|