@upyo/jmap 0.5.0-dev.156 → 0.5.0-dev.164
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 +13 -13
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +13 -13
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -489,12 +489,14 @@ var JmapTransport = class {
|
|
|
489
489
|
* @param message The message to send.
|
|
490
490
|
* @param options Optional transport options.
|
|
491
491
|
* @returns A receipt indicating success or failure.
|
|
492
|
+
* @throws The abort reason or an `AbortError` when the caller aborts the
|
|
493
|
+
* operation.
|
|
492
494
|
* @since 0.4.0
|
|
493
495
|
*/
|
|
494
496
|
async send(message, options) {
|
|
495
497
|
const signal = options?.signal;
|
|
498
|
+
signal?.throwIfAborted();
|
|
496
499
|
try {
|
|
497
|
-
signal?.throwIfAborted();
|
|
498
500
|
const session = await this.getSession(signal);
|
|
499
501
|
signal?.throwIfAborted();
|
|
500
502
|
const accountId = this.config.accountId ?? findMailAccount(session);
|
|
@@ -537,14 +539,12 @@ var JmapTransport = class {
|
|
|
537
539
|
}, signal);
|
|
538
540
|
return this.parseResponse(response);
|
|
539
541
|
} catch (error) {
|
|
540
|
-
if (
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
});
|
|
547
|
-
}
|
|
542
|
+
if (signal?.aborted) throw getAbortReason(signal, error);
|
|
543
|
+
if (error instanceof Error && error.name === "AbortError") return createJmapFailure(`Request aborted: ${error.message}`, error, {
|
|
544
|
+
category: "timeout",
|
|
545
|
+
code: "abort",
|
|
546
|
+
retryable: true
|
|
547
|
+
});
|
|
548
548
|
if (error instanceof JmapApiError) return createJmapFailure(error.message, error);
|
|
549
549
|
return createJmapFailure(error instanceof Error ? error.message : String(error), error);
|
|
550
550
|
}
|
|
@@ -554,6 +554,8 @@ var JmapTransport = class {
|
|
|
554
554
|
* @param messages The messages to send.
|
|
555
555
|
* @param options Optional transport options.
|
|
556
556
|
* @yields Receipts for each message.
|
|
557
|
+
* @throws The abort reason or an `AbortError` when the caller aborts the
|
|
558
|
+
* operation.
|
|
557
559
|
* @since 0.4.0
|
|
558
560
|
*/
|
|
559
561
|
async *sendMany(messages, options) {
|
|
@@ -633,9 +635,7 @@ var JmapTransport = class {
|
|
|
633
635
|
}, signal);
|
|
634
636
|
for (let i = 0; i < messageArray.length; i++) yield this.parseBatchResponseForIndex(response, i);
|
|
635
637
|
} catch (error) {
|
|
636
|
-
if (
|
|
637
|
-
if (signal?.aborted) throw getAbortReason(signal, error);
|
|
638
|
-
}
|
|
638
|
+
if (signal?.aborted) throw getAbortReason(signal, error);
|
|
639
639
|
const baseMessage = error instanceof Error && error.name === "AbortError" ? `Request aborted: ${error.message}` : error instanceof JmapApiError ? error.message : error instanceof Error ? error.message : String(error);
|
|
640
640
|
let detailedMessage = `Failed during ${processingStage}: ${baseMessage}`;
|
|
641
641
|
if (processingStage === "attachment upload" && attachmentsUploadedCount > 0) detailedMessage += ` (${attachmentsUploadedCount}/${messageArray.length} messages had attachments uploaded before failure)`;
|
|
@@ -879,7 +879,7 @@ function getAttemptCount(error) {
|
|
|
879
879
|
return 1;
|
|
880
880
|
}
|
|
881
881
|
function getAbortReason(signal, fallback) {
|
|
882
|
-
return signal.reason ?? fallback;
|
|
882
|
+
return signal.reason ?? fallback ?? new DOMException("The operation was aborted.", "AbortError");
|
|
883
883
|
}
|
|
884
884
|
|
|
885
885
|
//#endregion
|
package/dist/index.d.cts
CHANGED
|
@@ -119,6 +119,8 @@ declare class JmapTransport implements Transport<"jmap"> {
|
|
|
119
119
|
* @param message The message to send.
|
|
120
120
|
* @param options Optional transport options.
|
|
121
121
|
* @returns A receipt indicating success or failure.
|
|
122
|
+
* @throws The abort reason or an `AbortError` when the caller aborts the
|
|
123
|
+
* operation.
|
|
122
124
|
* @since 0.4.0
|
|
123
125
|
*/
|
|
124
126
|
send(message: Message, options?: TransportOptions): Promise<Receipt<"jmap">>;
|
|
@@ -127,6 +129,8 @@ declare class JmapTransport implements Transport<"jmap"> {
|
|
|
127
129
|
* @param messages The messages to send.
|
|
128
130
|
* @param options Optional transport options.
|
|
129
131
|
* @yields Receipts for each message.
|
|
132
|
+
* @throws The abort reason or an `AbortError` when the caller aborts the
|
|
133
|
+
* operation.
|
|
130
134
|
* @since 0.4.0
|
|
131
135
|
*/
|
|
132
136
|
sendMany(messages: Iterable<Message> | AsyncIterable<Message>, options?: TransportOptions): AsyncIterable<Receipt<"jmap">>;
|
package/dist/index.d.ts
CHANGED
|
@@ -119,6 +119,8 @@ declare class JmapTransport implements Transport<"jmap"> {
|
|
|
119
119
|
* @param message The message to send.
|
|
120
120
|
* @param options Optional transport options.
|
|
121
121
|
* @returns A receipt indicating success or failure.
|
|
122
|
+
* @throws The abort reason or an `AbortError` when the caller aborts the
|
|
123
|
+
* operation.
|
|
122
124
|
* @since 0.4.0
|
|
123
125
|
*/
|
|
124
126
|
send(message: Message, options?: TransportOptions): Promise<Receipt<"jmap">>;
|
|
@@ -127,6 +129,8 @@ declare class JmapTransport implements Transport<"jmap"> {
|
|
|
127
129
|
* @param messages The messages to send.
|
|
128
130
|
* @param options Optional transport options.
|
|
129
131
|
* @yields Receipts for each message.
|
|
132
|
+
* @throws The abort reason or an `AbortError` when the caller aborts the
|
|
133
|
+
* operation.
|
|
130
134
|
* @since 0.4.0
|
|
131
135
|
*/
|
|
132
136
|
sendMany(messages: Iterable<Message> | AsyncIterable<Message>, options?: TransportOptions): AsyncIterable<Receipt<"jmap">>;
|
package/dist/index.js
CHANGED
|
@@ -466,12 +466,14 @@ var JmapTransport = class {
|
|
|
466
466
|
* @param message The message to send.
|
|
467
467
|
* @param options Optional transport options.
|
|
468
468
|
* @returns A receipt indicating success or failure.
|
|
469
|
+
* @throws The abort reason or an `AbortError` when the caller aborts the
|
|
470
|
+
* operation.
|
|
469
471
|
* @since 0.4.0
|
|
470
472
|
*/
|
|
471
473
|
async send(message, options) {
|
|
472
474
|
const signal = options?.signal;
|
|
475
|
+
signal?.throwIfAborted();
|
|
473
476
|
try {
|
|
474
|
-
signal?.throwIfAborted();
|
|
475
477
|
const session = await this.getSession(signal);
|
|
476
478
|
signal?.throwIfAborted();
|
|
477
479
|
const accountId = this.config.accountId ?? findMailAccount(session);
|
|
@@ -514,14 +516,12 @@ var JmapTransport = class {
|
|
|
514
516
|
}, signal);
|
|
515
517
|
return this.parseResponse(response);
|
|
516
518
|
} catch (error) {
|
|
517
|
-
if (
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
});
|
|
524
|
-
}
|
|
519
|
+
if (signal?.aborted) throw getAbortReason(signal, error);
|
|
520
|
+
if (error instanceof Error && error.name === "AbortError") return createJmapFailure(`Request aborted: ${error.message}`, error, {
|
|
521
|
+
category: "timeout",
|
|
522
|
+
code: "abort",
|
|
523
|
+
retryable: true
|
|
524
|
+
});
|
|
525
525
|
if (error instanceof JmapApiError) return createJmapFailure(error.message, error);
|
|
526
526
|
return createJmapFailure(error instanceof Error ? error.message : String(error), error);
|
|
527
527
|
}
|
|
@@ -531,6 +531,8 @@ var JmapTransport = class {
|
|
|
531
531
|
* @param messages The messages to send.
|
|
532
532
|
* @param options Optional transport options.
|
|
533
533
|
* @yields Receipts for each message.
|
|
534
|
+
* @throws The abort reason or an `AbortError` when the caller aborts the
|
|
535
|
+
* operation.
|
|
534
536
|
* @since 0.4.0
|
|
535
537
|
*/
|
|
536
538
|
async *sendMany(messages, options) {
|
|
@@ -610,9 +612,7 @@ var JmapTransport = class {
|
|
|
610
612
|
}, signal);
|
|
611
613
|
for (let i = 0; i < messageArray.length; i++) yield this.parseBatchResponseForIndex(response, i);
|
|
612
614
|
} catch (error) {
|
|
613
|
-
if (
|
|
614
|
-
if (signal?.aborted) throw getAbortReason(signal, error);
|
|
615
|
-
}
|
|
615
|
+
if (signal?.aborted) throw getAbortReason(signal, error);
|
|
616
616
|
const baseMessage = error instanceof Error && error.name === "AbortError" ? `Request aborted: ${error.message}` : error instanceof JmapApiError ? error.message : error instanceof Error ? error.message : String(error);
|
|
617
617
|
let detailedMessage = `Failed during ${processingStage}: ${baseMessage}`;
|
|
618
618
|
if (processingStage === "attachment upload" && attachmentsUploadedCount > 0) detailedMessage += ` (${attachmentsUploadedCount}/${messageArray.length} messages had attachments uploaded before failure)`;
|
|
@@ -856,7 +856,7 @@ function getAttemptCount(error) {
|
|
|
856
856
|
return 1;
|
|
857
857
|
}
|
|
858
858
|
function getAbortReason(signal, fallback) {
|
|
859
|
-
return signal.reason ?? fallback;
|
|
859
|
+
return signal.reason ?? fallback ?? new DOMException("The operation was aborted.", "AbortError");
|
|
860
860
|
}
|
|
861
861
|
|
|
862
862
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upyo/jmap",
|
|
3
|
-
"version": "0.5.0-dev.
|
|
3
|
+
"version": "0.5.0-dev.164",
|
|
4
4
|
"description": "JMAP 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.5.0-dev.
|
|
56
|
+
"@upyo/core": "0.5.0-dev.164+5e283c64"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"jmap-rfc-types": "^0.1.2",
|