@molecule/app-http 1.2.1 → 1.3.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 +96 -1
- package/dist/errors.d.ts +67 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +75 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +9 -1
- package/dist/provider.js.map +1 -1
- package/dist/types.d.ts +36 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +37 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-10-
|
|
6
|
+
Generated: 2026-10-18T22:39:03.959Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-http
|
|
@@ -401,14 +401,38 @@ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTION
|
|
|
401
401
|
|
|
402
402
|
HTTP error with response details.
|
|
403
403
|
|
|
404
|
+
**`status` is an HTTP status when the server answered, and `0` when it did not.**
|
|
405
|
+
A `0` means NO response exists: the request was aborted (an `AbortController`, a
|
|
406
|
+
component's effect cleanup, a route change tearing the request down) or the
|
|
407
|
+
network failed before anything came back. It is not an HTTP status at all, so it
|
|
408
|
+
says nothing about the session — an app must never treat `status < 500` as
|
|
409
|
+
"signed out", because every aborted request on a route change would clear the
|
|
410
|
+
session. The correct check is {@link isAuthFailure} (`status === 401 || status === 403`);
|
|
411
|
+
`isNoResponse` (`status === 0`) identifies this case.
|
|
412
|
+
|
|
404
413
|
```typescript
|
|
405
414
|
class HttpError extends Error {
|
|
415
|
+
/**
|
|
416
|
+
* Builds a failed-request error.
|
|
417
|
+
*
|
|
418
|
+
* @param message - Human-readable message (already translated where a key exists).
|
|
419
|
+
* @param status - HTTP status, or `0` when no response was received (aborted / network failure).
|
|
420
|
+
* @param response - Parsed response when the server answered, otherwise undefined.
|
|
421
|
+
* @param config - The request config that failed.
|
|
422
|
+
* @param errorKey - Translation key for the failure (`http.error.aborted` for an
|
|
423
|
+
* aborted request, `http.error.networkError` for a real network failure).
|
|
424
|
+
* @param aborted - Whether the request was aborted before a response: an
|
|
425
|
+
* `AbortController` signal (component cleanup, a cancelled request) or the
|
|
426
|
+
* browser tearing the fetch down during a navigation. Distinguishes an abort
|
|
427
|
+
* from a network outage on the same `status === 0`, without parsing the message.
|
|
428
|
+
*/
|
|
406
429
|
constructor(
|
|
407
430
|
message: string,
|
|
408
431
|
public status: number,
|
|
409
432
|
public response?: HttpResponse,
|
|
410
433
|
public config?: FullRequestConfig,
|
|
411
434
|
public errorKey?: string,
|
|
435
|
+
public aborted = false,
|
|
412
436
|
) {
|
|
413
437
|
super(message)
|
|
414
438
|
this.name = 'HttpError'
|
|
@@ -468,6 +492,66 @@ function awaitAuthGate(request?: AuthGateRequest): Promise<void>
|
|
|
468
492
|
|
|
469
493
|
**Returns:** A promise that settles when the gate has released the request.
|
|
470
494
|
|
|
495
|
+
#### `isHttpError(err)`
|
|
496
|
+
|
|
497
|
+
Whether `err` is an {@link HttpError} from this package.
|
|
498
|
+
|
|
499
|
+
```typescript
|
|
500
|
+
function isHttpError(err: unknown): boolean
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
- `err` — Any thrown value.
|
|
504
|
+
|
|
505
|
+
**Returns:** True for an `HttpError`.
|
|
506
|
+
|
|
507
|
+
#### `isAuthFailure(err)`
|
|
508
|
+
|
|
509
|
+
Whether the server REJECTED the request's credential — the only failure that
|
|
510
|
+
justifies clearing a session.
|
|
511
|
+
|
|
512
|
+
`401` (unauthenticated/expired token) and `403` (authenticated but refused) are
|
|
513
|
+
the two statuses that say "this credential no longer authorizes this session".
|
|
514
|
+
Everything else — `0` (aborted or offline), `404` (wrong endpoint), `5xx` (server
|
|
515
|
+
fault), a rate limit — says nothing about the credential.
|
|
516
|
+
|
|
517
|
+
```typescript
|
|
518
|
+
function isAuthFailure(err: unknown): boolean
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
- `err` — Any thrown value.
|
|
522
|
+
|
|
523
|
+
**Returns:** True only when `err` is an `HttpError` with status 401 or 403.
|
|
524
|
+
|
|
525
|
+
#### `isNoResponse(err)`
|
|
526
|
+
|
|
527
|
+
Whether no response was received at all: the request was aborted or the network
|
|
528
|
+
failed. `status === 0` is not an HTTP status — it must never be read as
|
|
529
|
+
"the user is not signed in".
|
|
530
|
+
|
|
531
|
+
```typescript
|
|
532
|
+
function isNoResponse(err: unknown): boolean
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
- `err` — Any thrown value.
|
|
536
|
+
|
|
537
|
+
**Returns:** True when `err` is an `HttpError` with status `0`.
|
|
538
|
+
|
|
539
|
+
#### `isAborted(err)`
|
|
540
|
+
|
|
541
|
+
Whether the request was ABORTED (an `AbortController` signal, or the browser
|
|
542
|
+
cancelling the fetch during a navigation) rather than failing on the network.
|
|
543
|
+
|
|
544
|
+
Both arrive as `status === 0`; this distinguishes them, so a UI can stay silent
|
|
545
|
+
for a cancelled request while still reporting a real outage.
|
|
546
|
+
|
|
547
|
+
```typescript
|
|
548
|
+
function isAborted(err: unknown): boolean
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
- `err` — Any thrown value.
|
|
552
|
+
|
|
553
|
+
**Returns:** True when `err` is an `HttpError` flagged `aborted`.
|
|
554
|
+
|
|
471
555
|
#### `createFetchClient(config)`
|
|
472
556
|
|
|
473
557
|
Creates a fetch-based HTTP client using the native Fetch API.
|
|
@@ -751,6 +835,17 @@ skipAuthGate: true })`. Without the opt-out the gate waits on itself, the restor
|
|
|
751
835
|
settles, and every request the gate holds stalls until it times out (3 s).
|
|
752
836
|
`@molecule/app-auth`'s own restore does not need it (it calls `fetch`, not this client).
|
|
753
837
|
|
|
838
|
+
**A failed request's `status` is `0` when NO response arrived — never read it as
|
|
839
|
+
"signed out".** An aborted request (an `AbortController` signal, a component's
|
|
840
|
+
effect cleanup, a route change tearing the fetch down) and a network outage both
|
|
841
|
+
throw an `HttpError` with `status === 0`; the aborted ones also carry
|
|
842
|
+
`aborted: true` and the `http.error.aborted` key, the rest `http.error.networkError`.
|
|
843
|
+
Neither says anything about the session. To decide whether a session ended, use
|
|
844
|
+
`isAuthFailure(err)` (401/403 only); `isNoResponse(err)` identifies the no-response
|
|
845
|
+
case so a caller can stay silent instead of reporting an outage. **Do not write
|
|
846
|
+
`err instanceof HttpError && err.status < 500` as a sign-out check** — it clears
|
|
847
|
+
the session on every aborted navigation request.
|
|
848
|
+
|
|
754
849
|
## Translations
|
|
755
850
|
|
|
756
851
|
Translation strings are provided by `@molecule/app-locales-http`.
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classify a failed request instead of reading its `status` by hand.
|
|
3
|
+
*
|
|
4
|
+
* A failure from this package is an {@link HttpError} whose `status` is either an
|
|
5
|
+
* HTTP status (the server answered) or `0` (it did not — the request was aborted or
|
|
6
|
+
* the network failed). Code that clears a session must ask "did the server REJECT
|
|
7
|
+
* the credential?", which is `status === 401 || status === 403` and nothing else:
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* try {
|
|
11
|
+
* await http.get('/projects')
|
|
12
|
+
* } catch (err) {
|
|
13
|
+
* if (isAuthFailure(err)) clearSession()
|
|
14
|
+
* else if (isNoResponse(err)) return // aborted / offline — keep the session
|
|
15
|
+
* else showError(err)
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* `err instanceof HttpError && err.status < 500` is the trap these helpers exist to
|
|
20
|
+
* replace: an aborted request (a component unmounting, a route change cancelling an
|
|
21
|
+
* in-flight fetch) and a network outage both arrive with `status === 0`, so that
|
|
22
|
+
* check signs the user out on every navigation that cancels a request.
|
|
23
|
+
*
|
|
24
|
+
* @module
|
|
25
|
+
*/
|
|
26
|
+
import { HttpError } from './types.js';
|
|
27
|
+
/**
|
|
28
|
+
* Whether `err` is an {@link HttpError} from this package.
|
|
29
|
+
*
|
|
30
|
+
* @param err - Any thrown value.
|
|
31
|
+
* @returns True for an `HttpError`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isHttpError(err: unknown): err is HttpError;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the server REJECTED the request's credential — the only failure that
|
|
36
|
+
* justifies clearing a session.
|
|
37
|
+
*
|
|
38
|
+
* `401` (unauthenticated/expired token) and `403` (authenticated but refused) are
|
|
39
|
+
* the two statuses that say "this credential no longer authorizes this session".
|
|
40
|
+
* Everything else — `0` (aborted or offline), `404` (wrong endpoint), `5xx` (server
|
|
41
|
+
* fault), a rate limit — says nothing about the credential.
|
|
42
|
+
*
|
|
43
|
+
* @param err - Any thrown value.
|
|
44
|
+
* @returns True only when `err` is an `HttpError` with status 401 or 403.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isAuthFailure(err: unknown): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether no response was received at all: the request was aborted or the network
|
|
49
|
+
* failed. `status === 0` is not an HTTP status — it must never be read as
|
|
50
|
+
* "the user is not signed in".
|
|
51
|
+
*
|
|
52
|
+
* @param err - Any thrown value.
|
|
53
|
+
* @returns True when `err` is an `HttpError` with status `0`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isNoResponse(err: unknown): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the request was ABORTED (an `AbortController` signal, or the browser
|
|
58
|
+
* cancelling the fetch during a navigation) rather than failing on the network.
|
|
59
|
+
*
|
|
60
|
+
* Both arrive as `status === 0`; this distinguishes them, so a UI can stay silent
|
|
61
|
+
* for a cancelled request while still reporting a real outage.
|
|
62
|
+
*
|
|
63
|
+
* @param err - Any thrown value.
|
|
64
|
+
* @returns True when `err` is an `HttpError` flagged `aborted`.
|
|
65
|
+
*/
|
|
66
|
+
export declare function isAborted(err: unknown): boolean;
|
|
67
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,SAAS,CAE1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEnD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAElD;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAE/C"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classify a failed request instead of reading its `status` by hand.
|
|
3
|
+
*
|
|
4
|
+
* A failure from this package is an {@link HttpError} whose `status` is either an
|
|
5
|
+
* HTTP status (the server answered) or `0` (it did not — the request was aborted or
|
|
6
|
+
* the network failed). Code that clears a session must ask "did the server REJECT
|
|
7
|
+
* the credential?", which is `status === 401 || status === 403` and nothing else:
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* try {
|
|
11
|
+
* await http.get('/projects')
|
|
12
|
+
* } catch (err) {
|
|
13
|
+
* if (isAuthFailure(err)) clearSession()
|
|
14
|
+
* else if (isNoResponse(err)) return // aborted / offline — keep the session
|
|
15
|
+
* else showError(err)
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* `err instanceof HttpError && err.status < 500` is the trap these helpers exist to
|
|
20
|
+
* replace: an aborted request (a component unmounting, a route change cancelling an
|
|
21
|
+
* in-flight fetch) and a network outage both arrive with `status === 0`, so that
|
|
22
|
+
* check signs the user out on every navigation that cancels a request.
|
|
23
|
+
*
|
|
24
|
+
* @module
|
|
25
|
+
*/
|
|
26
|
+
import { HttpError } from './types.js';
|
|
27
|
+
/**
|
|
28
|
+
* Whether `err` is an {@link HttpError} from this package.
|
|
29
|
+
*
|
|
30
|
+
* @param err - Any thrown value.
|
|
31
|
+
* @returns True for an `HttpError`.
|
|
32
|
+
*/
|
|
33
|
+
export function isHttpError(err) {
|
|
34
|
+
return err instanceof HttpError;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Whether the server REJECTED the request's credential — the only failure that
|
|
38
|
+
* justifies clearing a session.
|
|
39
|
+
*
|
|
40
|
+
* `401` (unauthenticated/expired token) and `403` (authenticated but refused) are
|
|
41
|
+
* the two statuses that say "this credential no longer authorizes this session".
|
|
42
|
+
* Everything else — `0` (aborted or offline), `404` (wrong endpoint), `5xx` (server
|
|
43
|
+
* fault), a rate limit — says nothing about the credential.
|
|
44
|
+
*
|
|
45
|
+
* @param err - Any thrown value.
|
|
46
|
+
* @returns True only when `err` is an `HttpError` with status 401 or 403.
|
|
47
|
+
*/
|
|
48
|
+
export function isAuthFailure(err) {
|
|
49
|
+
return isHttpError(err) && (err.status === 401 || err.status === 403);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Whether no response was received at all: the request was aborted or the network
|
|
53
|
+
* failed. `status === 0` is not an HTTP status — it must never be read as
|
|
54
|
+
* "the user is not signed in".
|
|
55
|
+
*
|
|
56
|
+
* @param err - Any thrown value.
|
|
57
|
+
* @returns True when `err` is an `HttpError` with status `0`.
|
|
58
|
+
*/
|
|
59
|
+
export function isNoResponse(err) {
|
|
60
|
+
return isHttpError(err) && err.status === 0;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Whether the request was ABORTED (an `AbortController` signal, or the browser
|
|
64
|
+
* cancelling the fetch during a navigation) rather than failing on the network.
|
|
65
|
+
*
|
|
66
|
+
* Both arrive as `status === 0`; this distinguishes them, so a UI can stay silent
|
|
67
|
+
* for a cancelled request while still reporting a real outage.
|
|
68
|
+
*
|
|
69
|
+
* @param err - Any thrown value.
|
|
70
|
+
* @returns True when `err` is an `HttpError` flagged `aborted`.
|
|
71
|
+
*/
|
|
72
|
+
export function isAborted(err) {
|
|
73
|
+
return isHttpError(err) && err.aborted;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,OAAO,GAAG,YAAY,SAAS,CAAA;AACjC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,CAAA;AACvE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,CAAA;AAC7C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,GAAY;IACpC,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,CAAA;AACxC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -88,10 +88,22 @@
|
|
|
88
88
|
* settles, and every request the gate holds stalls until it times out (3 s).
|
|
89
89
|
* `@molecule/app-auth`'s own restore does not need it (it calls `fetch`, not this client).
|
|
90
90
|
*
|
|
91
|
+
* **A failed request's `status` is `0` when NO response arrived — never read it as
|
|
92
|
+
* "signed out".** An aborted request (an `AbortController` signal, a component's
|
|
93
|
+
* effect cleanup, a route change tearing the fetch down) and a network outage both
|
|
94
|
+
* throw an `HttpError` with `status === 0`; the aborted ones also carry
|
|
95
|
+
* `aborted: true` and the `http.error.aborted` key, the rest `http.error.networkError`.
|
|
96
|
+
* Neither says anything about the session. To decide whether a session ended, use
|
|
97
|
+
* `isAuthFailure(err)` (401/403 only); `isNoResponse(err)` identifies the no-response
|
|
98
|
+
* case so a caller can stay silent instead of reporting an outage. **Do not write
|
|
99
|
+
* `err instanceof HttpError && err.status < 500` as a sign-out check** — it clears
|
|
100
|
+
* the session on every aborted navigation request.
|
|
101
|
+
*
|
|
91
102
|
* @module
|
|
92
103
|
*/
|
|
93
104
|
export * from './auth-gate.js';
|
|
94
105
|
export * from './client.js';
|
|
106
|
+
export * from './errors.js';
|
|
95
107
|
export * from './interceptors.js';
|
|
96
108
|
export * from './provider.js';
|
|
97
109
|
export * from './types.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsGG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -88,10 +88,22 @@
|
|
|
88
88
|
* settles, and every request the gate holds stalls until it times out (3 s).
|
|
89
89
|
* `@molecule/app-auth`'s own restore does not need it (it calls `fetch`, not this client).
|
|
90
90
|
*
|
|
91
|
+
* **A failed request's `status` is `0` when NO response arrived — never read it as
|
|
92
|
+
* "signed out".** An aborted request (an `AbortController` signal, a component's
|
|
93
|
+
* effect cleanup, a route change tearing the fetch down) and a network outage both
|
|
94
|
+
* throw an `HttpError` with `status === 0`; the aborted ones also carry
|
|
95
|
+
* `aborted: true` and the `http.error.aborted` key, the rest `http.error.networkError`.
|
|
96
|
+
* Neither says anything about the session. To decide whether a session ended, use
|
|
97
|
+
* `isAuthFailure(err)` (401/403 only); `isNoResponse(err)` identifies the no-response
|
|
98
|
+
* case so a caller can stay silent instead of reporting an outage. **Do not write
|
|
99
|
+
* `err instanceof HttpError && err.status < 500` as a sign-out check** — it clears
|
|
100
|
+
* the session on every aborted navigation request.
|
|
101
|
+
*
|
|
91
102
|
* @module
|
|
92
103
|
*/
|
|
93
104
|
export * from './auth-gate.js';
|
|
94
105
|
export * from './client.js';
|
|
106
|
+
export * from './errors.js';
|
|
95
107
|
export * from './interceptors.js';
|
|
96
108
|
export * from './provider.js';
|
|
97
109
|
export * from './types.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsGG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAQ/D;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAQ,gBAAqB,KAAG,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAQ/D;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAQ,gBAAqB,KAAG,UAiYjE,CAAA"}
|
package/dist/provider.js
CHANGED
|
@@ -257,9 +257,17 @@ export const createFetchClient = (config = {}) => {
|
|
|
257
257
|
else {
|
|
258
258
|
logger.error('Network error', finalConfig.method, url, err);
|
|
259
259
|
}
|
|
260
|
+
// An abort and a navigation cancellation are the SAME fact to a caller —
|
|
261
|
+
// the request was cancelled before any response — and neither is a network
|
|
262
|
+
// outage. Flag it (`aborted`) and give it its own errorKey so app code does
|
|
263
|
+
// not have to parse the message, and so a session-clearing check can tell
|
|
264
|
+
// it apart from a real failure without treating `status === 0` as a 4xx.
|
|
265
|
+
const aborted = isAbort || isNavCancel;
|
|
260
266
|
const error = new HttpError(err instanceof Error
|
|
261
267
|
? err.message
|
|
262
|
-
: t('http.error.
|
|
268
|
+
: t(aborted ? 'http.error.aborted' : 'http.error.networkError', undefined, {
|
|
269
|
+
defaultValue: aborted ? 'Request aborted' : 'Network error',
|
|
270
|
+
}), 0, undefined, finalConfig, aborted ? 'http.error.aborted' : 'http.error.networkError', aborted);
|
|
263
271
|
// Apply error interceptors
|
|
264
272
|
let finalError = error;
|
|
265
273
|
for (const interceptor of errorInterceptors) {
|
package/dist/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAI9C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,2DAA2D;AAC3D,MAAM,iBAAiB,GAAG,gBAAgB,CAAA;AAE1C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAA2B,EAAE,EAAc,EAAE;IAC7E,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;IAChC,IAAI,SAAS,GAAkB,IAAI,CAAA;IACnC,MAAM,mBAAmB,GAAyB,EAAE,CAAA;IACpD,MAAM,oBAAoB,GAA0B,EAAE,CAAA;IACtD,MAAM,iBAAiB,GAAuB,EAAE,CAAA;IAChD,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAc,CAAA;IAE/C,kEAAkE;IAClE,0DAA0D;IAC1D,kEAAkE;IAClE,uEAAuE;IACvE,oEAAoE;IACpE,2CAA2C;IAC3C,IAAI,oBAAoB,GAAG,KAAK,CAAA;IAChC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAA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AAE,CAAC,CAAC,CAAA;gBACvC,CAAC;YACH,CAAC,CAAA;QACH,CAAC;QAED,mBAAmB,CAAC,WAA6B;YAC/C,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;YACnC,OAAO,GAAG,EAAE;gBACV,MAAM,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;gBACpD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;oBACjB,iBAAiB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;gBACpC,CAAC;YACH,CAAC,CAAA;QACH,CAAC;QAED,YAAY,CAAC,KAAoB;YAC/B,SAAS,GAAG,KAAK,CAAA;QACnB,CAAC;QAED,YAAY;YACV,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,WAAW,CAAC,OAAmB;YAC7B,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YAC9B,OAAO,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAChD,CAAC;KACF,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -139,12 +139,47 @@ export interface HttpResponse<T = unknown> {
|
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* HTTP error with response details.
|
|
142
|
+
*
|
|
143
|
+
* **`status` is an HTTP status when the server answered, and `0` when it did not.**
|
|
144
|
+
* A `0` means NO response exists: the request was aborted (an `AbortController`, a
|
|
145
|
+
* component's effect cleanup, a route change tearing the request down) or the
|
|
146
|
+
* network failed before anything came back. It is not an HTTP status at all, so it
|
|
147
|
+
* says nothing about the session — an app must never treat `status < 500` as
|
|
148
|
+
* "signed out", because every aborted request on a route change would clear the
|
|
149
|
+
* session. The correct check is {@link isAuthFailure} (`status === 401 || status === 403`);
|
|
150
|
+
* `isNoResponse` (`status === 0`) identifies this case.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* try {
|
|
155
|
+
* await http.get('/projects')
|
|
156
|
+
* } catch (err) {
|
|
157
|
+
* if (isAuthFailure(err)) clearSession() // 401/403: the server rejected the credential
|
|
158
|
+
* else if (isNoResponse(err)) return // aborted or offline — not a session decision
|
|
159
|
+
* else showError(err)
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
142
162
|
*/
|
|
143
163
|
export declare class HttpError extends Error {
|
|
144
164
|
status: number;
|
|
145
165
|
response?: HttpResponse | undefined;
|
|
146
166
|
config?: FullRequestConfig | undefined;
|
|
147
167
|
errorKey?: string | undefined;
|
|
148
|
-
|
|
168
|
+
aborted: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Builds a failed-request error.
|
|
171
|
+
*
|
|
172
|
+
* @param message - Human-readable message (already translated where a key exists).
|
|
173
|
+
* @param status - HTTP status, or `0` when no response was received (aborted / network failure).
|
|
174
|
+
* @param response - Parsed response when the server answered, otherwise undefined.
|
|
175
|
+
* @param config - The request config that failed.
|
|
176
|
+
* @param errorKey - Translation key for the failure (`http.error.aborted` for an
|
|
177
|
+
* aborted request, `http.error.networkError` for a real network failure).
|
|
178
|
+
* @param aborted - Whether the request was aborted before a response: an
|
|
179
|
+
* `AbortController` signal (component cleanup, a cancelled request) or the
|
|
180
|
+
* browser tearing the fetch down during a navigation. Distinguishes an abort
|
|
181
|
+
* from a network outage on the same `status === 0`, without parsing the message.
|
|
182
|
+
*/
|
|
183
|
+
constructor(message: string, status: number, response?: HttpResponse | undefined, config?: FullRequestConfig | undefined, errorKey?: string | undefined, aborted?: boolean);
|
|
149
184
|
}
|
|
150
185
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAA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M,CAAC,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD;;OAEG;IACH,MAAM,EAAE,UAAU,CAAA;IAElB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IAEX;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC;;OAEG;IACH,IAAI,EAAE,CAAC,CAAA;IAEP;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAE/B;;OAEG;IACH,MAAM,EAAE,iBAAiB,CAAA;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAiBzB,MAAM,EAAE,MAAM;IACd,QAAQ,CAAC,EAAE,YAAY;IACvB,MAAM,CAAC,EAAE,iBAAiB;IAC1B,QAAQ,CAAC,EAAE,MAAM;IACjB,OAAO;IApBhB;;;;;;;;;;;;;OAaG;gBAED,OAAO,EAAE,MAAM,EACR,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,YAAY,YAAA,EACvB,MAAM,CAAC,EAAE,iBAAiB,YAAA,EAC1B,QAAQ,CAAC,EAAE,MAAM,YAAA,EACjB,OAAO,UAAQ;CAKzB"}
|
package/dist/types.js
CHANGED
|
@@ -5,18 +5,54 @@
|
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* HTTP error with response details.
|
|
8
|
+
*
|
|
9
|
+
* **`status` is an HTTP status when the server answered, and `0` when it did not.**
|
|
10
|
+
* A `0` means NO response exists: the request was aborted (an `AbortController`, a
|
|
11
|
+
* component's effect cleanup, a route change tearing the request down) or the
|
|
12
|
+
* network failed before anything came back. It is not an HTTP status at all, so it
|
|
13
|
+
* says nothing about the session — an app must never treat `status < 500` as
|
|
14
|
+
* "signed out", because every aborted request on a route change would clear the
|
|
15
|
+
* session. The correct check is {@link isAuthFailure} (`status === 401 || status === 403`);
|
|
16
|
+
* `isNoResponse` (`status === 0`) identifies this case.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* try {
|
|
21
|
+
* await http.get('/projects')
|
|
22
|
+
* } catch (err) {
|
|
23
|
+
* if (isAuthFailure(err)) clearSession() // 401/403: the server rejected the credential
|
|
24
|
+
* else if (isNoResponse(err)) return // aborted or offline — not a session decision
|
|
25
|
+
* else showError(err)
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
8
28
|
*/
|
|
9
29
|
export class HttpError extends Error {
|
|
10
30
|
status;
|
|
11
31
|
response;
|
|
12
32
|
config;
|
|
13
33
|
errorKey;
|
|
14
|
-
|
|
34
|
+
aborted;
|
|
35
|
+
/**
|
|
36
|
+
* Builds a failed-request error.
|
|
37
|
+
*
|
|
38
|
+
* @param message - Human-readable message (already translated where a key exists).
|
|
39
|
+
* @param status - HTTP status, or `0` when no response was received (aborted / network failure).
|
|
40
|
+
* @param response - Parsed response when the server answered, otherwise undefined.
|
|
41
|
+
* @param config - The request config that failed.
|
|
42
|
+
* @param errorKey - Translation key for the failure (`http.error.aborted` for an
|
|
43
|
+
* aborted request, `http.error.networkError` for a real network failure).
|
|
44
|
+
* @param aborted - Whether the request was aborted before a response: an
|
|
45
|
+
* `AbortController` signal (component cleanup, a cancelled request) or the
|
|
46
|
+
* browser tearing the fetch down during a navigation. Distinguishes an abort
|
|
47
|
+
* from a network outage on the same `status === 0`, without parsing the message.
|
|
48
|
+
*/
|
|
49
|
+
constructor(message, status, response, config, errorKey, aborted = false) {
|
|
15
50
|
super(message);
|
|
16
51
|
this.status = status;
|
|
17
52
|
this.response = response;
|
|
18
53
|
this.config = config;
|
|
19
54
|
this.errorKey = errorKey;
|
|
55
|
+
this.aborted = aborted;
|
|
20
56
|
this.name = 'HttpError';
|
|
21
57
|
}
|
|
22
58
|
}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6JH
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6JH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAiBzB;IACA;IACA;IACA;IACA;IApBT;;;;;;;;;;;;;OAaG;IACH,YACE,OAAe,EACR,MAAc,EACd,QAAuB,EACvB,MAA0B,EAC1B,QAAiB,EACjB,UAAU,KAAK;QAEtB,KAAK,CAAC,OAAO,CAAC,CAAA;QANP,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAe;QACvB,WAAM,GAAN,MAAM,CAAoB;QAC1B,aAAQ,GAAR,QAAQ,CAAS;QACjB,YAAO,GAAP,OAAO,CAAQ;QAGtB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAA;IACzB,CAAC;CACF"}
|