@upyo/jmap 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 +8 -1
- package/dist/index.js +8 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -190,13 +190,14 @@ var JmapHttpClient = class {
|
|
|
190
190
|
}
|
|
191
191
|
return await response.json();
|
|
192
192
|
} catch (error) {
|
|
193
|
-
if (error
|
|
193
|
+
if (isCallerAbort(error, signal)) throw error;
|
|
194
194
|
if (error instanceof JmapApiError && error.statusCode !== void 0) {
|
|
195
195
|
if (error.statusCode >= 400 && error.statusCode < 500) throw error;
|
|
196
196
|
}
|
|
197
197
|
lastError = error instanceof Error ? error : new Error(String(error));
|
|
198
198
|
if (attempt === this.config.retries) {
|
|
199
199
|
if (error instanceof JmapApiError) throw error;
|
|
200
|
+
if (isAbortError(error)) throw new JmapApiError("JMAP request timed out.", void 0, void 0, void 0, void 0, attempt + 1);
|
|
200
201
|
throw new JmapApiError(lastError.message, void 0, void 0, void 0, void 0, attempt + 1);
|
|
201
202
|
}
|
|
202
203
|
const delay = Math.pow(2, attempt) * 1e3;
|
|
@@ -250,6 +251,12 @@ var JmapHttpClient = class {
|
|
|
250
251
|
}
|
|
251
252
|
}
|
|
252
253
|
};
|
|
254
|
+
function isCallerAbort(error, signal) {
|
|
255
|
+
return signal?.aborted === true && (isAbortError(error) || error === signal.reason);
|
|
256
|
+
}
|
|
257
|
+
function isAbortError(error) {
|
|
258
|
+
return error instanceof Error && error.name === "AbortError";
|
|
259
|
+
}
|
|
253
260
|
|
|
254
261
|
//#endregion
|
|
255
262
|
//#region src/message-converter.ts
|
package/dist/index.js
CHANGED
|
@@ -167,13 +167,14 @@ var JmapHttpClient = class {
|
|
|
167
167
|
}
|
|
168
168
|
return await response.json();
|
|
169
169
|
} catch (error) {
|
|
170
|
-
if (error
|
|
170
|
+
if (isCallerAbort(error, signal)) throw error;
|
|
171
171
|
if (error instanceof JmapApiError && error.statusCode !== void 0) {
|
|
172
172
|
if (error.statusCode >= 400 && error.statusCode < 500) throw error;
|
|
173
173
|
}
|
|
174
174
|
lastError = error instanceof Error ? error : new Error(String(error));
|
|
175
175
|
if (attempt === this.config.retries) {
|
|
176
176
|
if (error instanceof JmapApiError) throw error;
|
|
177
|
+
if (isAbortError(error)) throw new JmapApiError("JMAP request timed out.", void 0, void 0, void 0, void 0, attempt + 1);
|
|
177
178
|
throw new JmapApiError(lastError.message, void 0, void 0, void 0, void 0, attempt + 1);
|
|
178
179
|
}
|
|
179
180
|
const delay = Math.pow(2, attempt) * 1e3;
|
|
@@ -227,6 +228,12 @@ var JmapHttpClient = class {
|
|
|
227
228
|
}
|
|
228
229
|
}
|
|
229
230
|
};
|
|
231
|
+
function isCallerAbort(error, signal) {
|
|
232
|
+
return signal?.aborted === true && (isAbortError(error) || error === signal.reason);
|
|
233
|
+
}
|
|
234
|
+
function isAbortError(error) {
|
|
235
|
+
return error instanceof Error && error.name === "AbortError";
|
|
236
|
+
}
|
|
230
237
|
|
|
231
238
|
//#endregion
|
|
232
239
|
//#region src/message-converter.ts
|
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.174",
|
|
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.174+b968510a"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"jmap-rfc-types": "^0.1.2",
|