@upyo/pool 0.5.0-dev.170 → 0.5.0-dev.174
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 +15 -12
- package/dist/index.js +15 -12
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -341,10 +341,7 @@ var PoolTransport = class {
|
|
|
341
341
|
try {
|
|
342
342
|
receipt = await selection.entry.transport.send(message, sendOptions.options);
|
|
343
343
|
} catch (error) {
|
|
344
|
-
if (sendOptions.abortedByCaller() && isCallerAbort(error, options?.signal))
|
|
345
|
-
abortedByCaller = true;
|
|
346
|
-
throw error;
|
|
347
|
-
}
|
|
344
|
+
if (sendOptions.abortedByCaller() && isCallerAbort(error, options?.signal)) abortedByCaller = true;
|
|
348
345
|
throw error;
|
|
349
346
|
} finally {
|
|
350
347
|
sendOptions.cleanup();
|
|
@@ -484,20 +481,26 @@ function isCallerAbort(error, signal) {
|
|
|
484
481
|
return isAbortError(error) || error === signal?.reason;
|
|
485
482
|
}
|
|
486
483
|
function getReceiptErrors(receipt, provider) {
|
|
487
|
-
if (receipt.errors != null && receipt.errors.length > 0) return receipt.errors.map((error) => error
|
|
488
|
-
...error,
|
|
489
|
-
provider
|
|
490
|
-
} : error);
|
|
484
|
+
if (receipt.errors != null && receipt.errors.length > 0) return receipt.errors.map((error) => withReceiptErrorProvider(error, provider));
|
|
491
485
|
return receipt.errorMessages.map((message) => (0, __upyo_core.createReceiptError)(message, { provider: receipt.provider ?? provider }));
|
|
492
486
|
}
|
|
493
487
|
function getThrownReceiptErrors(error, provider) {
|
|
494
|
-
if (isReceiptError(error)) return [error
|
|
495
|
-
...error,
|
|
496
|
-
provider
|
|
497
|
-
} : error];
|
|
488
|
+
if (isReceiptError(error)) return [withReceiptErrorProvider(error, provider)];
|
|
498
489
|
if (isFailedReceipt(error)) return getReceiptErrors(error, provider);
|
|
499
490
|
return [];
|
|
500
491
|
}
|
|
492
|
+
function withReceiptErrorProvider(error, provider) {
|
|
493
|
+
return {
|
|
494
|
+
message: error.message,
|
|
495
|
+
code: error.code,
|
|
496
|
+
category: error.category,
|
|
497
|
+
retryable: error.retryable,
|
|
498
|
+
provider: error.provider ?? provider,
|
|
499
|
+
statusCode: error.statusCode,
|
|
500
|
+
retryAfterMilliseconds: error.retryAfterMilliseconds,
|
|
501
|
+
providerDetails: error.providerDetails
|
|
502
|
+
};
|
|
503
|
+
}
|
|
501
504
|
function isReceiptError(value) {
|
|
502
505
|
return typeof value === "object" && value != null && typeof value.message === "string" && typeof value.code === "string" && typeof value.retryable === "boolean" && typeof value.category === "string";
|
|
503
506
|
}
|
package/dist/index.js
CHANGED
|
@@ -318,10 +318,7 @@ var PoolTransport = class {
|
|
|
318
318
|
try {
|
|
319
319
|
receipt = await selection.entry.transport.send(message, sendOptions.options);
|
|
320
320
|
} catch (error) {
|
|
321
|
-
if (sendOptions.abortedByCaller() && isCallerAbort(error, options?.signal))
|
|
322
|
-
abortedByCaller = true;
|
|
323
|
-
throw error;
|
|
324
|
-
}
|
|
321
|
+
if (sendOptions.abortedByCaller() && isCallerAbort(error, options?.signal)) abortedByCaller = true;
|
|
325
322
|
throw error;
|
|
326
323
|
} finally {
|
|
327
324
|
sendOptions.cleanup();
|
|
@@ -461,20 +458,26 @@ function isCallerAbort(error, signal) {
|
|
|
461
458
|
return isAbortError(error) || error === signal?.reason;
|
|
462
459
|
}
|
|
463
460
|
function getReceiptErrors(receipt, provider) {
|
|
464
|
-
if (receipt.errors != null && receipt.errors.length > 0) return receipt.errors.map((error) => error
|
|
465
|
-
...error,
|
|
466
|
-
provider
|
|
467
|
-
} : error);
|
|
461
|
+
if (receipt.errors != null && receipt.errors.length > 0) return receipt.errors.map((error) => withReceiptErrorProvider(error, provider));
|
|
468
462
|
return receipt.errorMessages.map((message) => createReceiptError(message, { provider: receipt.provider ?? provider }));
|
|
469
463
|
}
|
|
470
464
|
function getThrownReceiptErrors(error, provider) {
|
|
471
|
-
if (isReceiptError(error)) return [error
|
|
472
|
-
...error,
|
|
473
|
-
provider
|
|
474
|
-
} : error];
|
|
465
|
+
if (isReceiptError(error)) return [withReceiptErrorProvider(error, provider)];
|
|
475
466
|
if (isFailedReceipt(error)) return getReceiptErrors(error, provider);
|
|
476
467
|
return [];
|
|
477
468
|
}
|
|
469
|
+
function withReceiptErrorProvider(error, provider) {
|
|
470
|
+
return {
|
|
471
|
+
message: error.message,
|
|
472
|
+
code: error.code,
|
|
473
|
+
category: error.category,
|
|
474
|
+
retryable: error.retryable,
|
|
475
|
+
provider: error.provider ?? provider,
|
|
476
|
+
statusCode: error.statusCode,
|
|
477
|
+
retryAfterMilliseconds: error.retryAfterMilliseconds,
|
|
478
|
+
providerDetails: error.providerDetails
|
|
479
|
+
};
|
|
480
|
+
}
|
|
478
481
|
function isReceiptError(value) {
|
|
479
482
|
return typeof value === "object" && value != null && typeof value.message === "string" && typeof value.code === "string" && typeof value.retryable === "boolean" && typeof value.category === "string";
|
|
480
483
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upyo/pool",
|
|
3
|
-
"version": "0.5.0-dev.
|
|
3
|
+
"version": "0.5.0-dev.174",
|
|
4
4
|
"description": "Pool transport for Upyo email library—provides load balancing and failover for multiple email providers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
},
|
|
57
57
|
"sideEffects": false,
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@upyo/core": "0.5.0-dev.
|
|
59
|
+
"@upyo/core": "0.5.0-dev.174+b968510a"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"tsdown": "^0.12.7",
|
|
63
63
|
"typescript": "5.8.3",
|
|
64
|
-
"@upyo/mock": "0.5.0-dev.
|
|
64
|
+
"@upyo/mock": "0.5.0-dev.174+b968510a"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"prepublish": "mise run --no-deps :build"
|