@molecule/app-http 1.5.0 → 1.5.3

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 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-25T20:03:35.125Z
6
+ Generated: 2026-11-01T06:26:04.968Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-http
@@ -394,8 +394,8 @@ interface AuthGateRequest {
394
394
  method?: string
395
395
 
396
396
  /**
397
- * The request's URL, for the message logged when the gate never settles. A URL may carry
398
- * an id; it never carries a credential (tokens travel in headers).
397
+ * The request's URL, for the message logged when the gate never settles. Any userinfo or
398
+ * credential query/fragment values are redacted from that report; non-secret parts remain.
399
399
  */
400
400
  url?: string
401
401
  }
@@ -519,6 +519,12 @@ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTION
519
519
 
520
520
  HTTP error with response details.
521
521
 
522
+ Request metadata on `config` and `response.config` is limited to method, a
523
+ credential-redacted URL, and the two boolean notification-suppression controls
524
+ (`molSilentErrorNotification` and `molSilentRateLimitNotification`). Request bodies,
525
+ headers, params and all other provider options are omitted, as are credential-bearing
526
+ response headers, because errors are routinely serialized by logging transports.
527
+
522
528
  **`status` is an HTTP status when the server answered, and `0` when it did not.**
523
529
  A `0` means NO response exists: the request was aborted (an `AbortController`, a
524
530
  component's effect cleanup, a route change tearing the request down) or the
@@ -530,13 +536,22 @@ session. The correct check is {@link isAuthFailure} (`status === 401 || status =
530
536
 
531
537
  ```typescript
532
538
  class HttpError extends Error {
539
+ /**
540
+ * Redacts URL userinfo and credential query/fragment values while preserving the path and
541
+ * non-secret parameters. Shared by compatible HTTP and auth error/log views.
542
+ */
543
+ static readonly redactUrlCredentials = redactUrlCredentials
544
+
533
545
  /**
534
546
  * Builds a failed-request error.
535
547
  *
536
- * @param message - Human-readable message (already translated where a key exists).
548
+ * @param message - Human-readable message (already translated where a key exists);
549
+ * credentials in any URL it contains are redacted.
537
550
  * @param status - HTTP status, or `0` when no response was received (aborted / network failure).
538
- * @param response - Parsed response when the server answered, otherwise undefined.
539
- * @param config - The request config that failed.
551
+ * @param response - Parsed response when the server answered, otherwise undefined;
552
+ * its request config and headers are sanitized for safe logging.
553
+ * @param config - The request config that failed; only its method, redacted URL and
554
+ * boolean notification-suppression controls are retained.
540
555
  * @param errorKey - Translation key for the failure (`http.error.aborted` for an
541
556
  * aborted request, `http.error.networkError` for a real network failure).
542
557
  * @param aborted - Whether the request was aborted before a response: an
@@ -552,8 +567,11 @@ class HttpError extends Error {
552
567
  public errorKey?: string,
553
568
  public aborted = false,
554
569
  ) {
555
- super(message)
570
+ super(snapshotCredentials(message))
556
571
  this.name = 'HttpError'
572
+ this.response = response ? errorResponse(response) : undefined
573
+ this.config = config ? errorRequestConfig(config) : undefined
574
+ Object.defineProperty(this, HTTP_ERROR_BRAND, { value: true })
557
575
  }
558
576
  }
559
577
  ```
@@ -612,15 +630,18 @@ function awaitAuthGate(request?: AuthGateRequest): Promise<void>
612
630
 
613
631
  #### `isHttpError(err)`
614
632
 
615
- Whether `err` is an {@link HttpError} from this package.
633
+ Whether `err` is an {@link HttpError} or a compatible branded request failure.
634
+ `@molecule/app-auth` uses the same global brand for its non-ok responses, so
635
+ this also recognizes them across realms and duplicated package copies without
636
+ either package depending on the other.
616
637
 
617
638
  ```typescript
618
- function isHttpError(err: unknown): boolean
639
+ function isHttpError(err: unknown): err is HttpError
619
640
  ```
620
641
 
621
642
  - `err` — Any thrown value.
622
643
 
623
- **Returns:** True for an `HttpError`.
644
+ **Returns:** True for an `HttpError` or a compatibly branded request failure.
624
645
 
625
646
  #### `isAuthFailure(err)`
626
647
 
@@ -751,7 +772,7 @@ be back); otherwise exponential backoff with full jitter.
751
772
  function retryDelayMs(
752
773
  retryAfter: string | undefined,
753
774
  attempt: number,
754
- options?: false | RetryOptions,
775
+ options?: RetryOptions | false,
755
776
  random?: () => number,
756
777
  ): number
757
778
  ```
@@ -763,6 +784,35 @@ function retryDelayMs(
763
784
 
764
785
  **Returns:** Milliseconds to wait before retrying.
765
786
 
787
+ #### `snapshotHttpErrorBody(body)`
788
+
789
+ Materialize a failed response body before the synchronous HttpError capture. Unchanged bytes
790
+ are cloned directly, including a Blob's BOM and every typed-array kind. Changed textual bytes
791
+ retain the BOM and use a Uint8Array fallback if the original view's alignment no longer fits.
792
+ Successful responses never pass through this helper.
793
+
794
+ ```typescript
795
+ function snapshotHttpErrorBody<T>(body: T): Promise<T>
796
+ ```
797
+
798
+ - `body` — A response body about to be retained on a failed request.
799
+
800
+ **Returns:** A scrubbed body with unchanged binary content preserved byte-for-byte.
801
+
802
+ #### `snapshotHttpErrorResponse(response)`
803
+
804
+ Read and scrub a failed response once for a retained-error reconstruction. The detached capture
805
+ carries the original body kind, safe response metadata, and minimal request config, so callers
806
+ such as auth never need to read the source response or its body again.
807
+
808
+ ```typescript
809
+ function snapshotHttpErrorResponse<T extends HttpResponse>(response: T): Promise<T>
810
+ ```
811
+
812
+ - `response` — The failed HTTP response to capture.
813
+
814
+ **Returns:** A detached, credential-scrubbed response preserving binary body bytes where safe.
815
+
766
816
  #### `unwrapList(res)`
767
817
 
768
818
  Normalize an unknown response body into a typed array.
@@ -792,7 +842,7 @@ raw JSON, or `response.data.items` for an `HttpResponse`. Passing that
792
842
  array to `unwrapList` is also valid; passing the enclosing object is not.
793
843
 
794
844
  ```typescript
795
- function unwrapList(res: unknown): T[]
845
+ function unwrapList<T>(res: unknown): T[]
796
846
  ```
797
847
 
798
848
  - `res` — Raw response body OR an `HttpResponse` envelope from `@molecule/app-http`.
@@ -817,7 +867,7 @@ where the mock server returns `[]` for unmatched endpoints but the
817
867
  caller expects a single resource.
818
868
 
819
869
  ```typescript
820
- function unwrapSingle(res: unknown): T | null
870
+ function unwrapSingle<T>(res: unknown): T | null
821
871
  ```
822
872
 
823
873
  - `res` — Raw response body (e.g. `HttpResponse.data` from `@molecule/app-http`).
@@ -896,7 +946,7 @@ function getClient(): HttpClient
896
946
  Makes a GET request using the bonded HTTP client.
897
947
 
898
948
  ```typescript
899
- function get(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
949
+ function get<T = unknown>(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
900
950
  ```
901
951
 
902
952
  - `url` — The request URL (relative to baseURL if configured).
@@ -913,7 +963,11 @@ The body is `data` — the SECOND argument. `post(url, { data: body })` sends th
913
963
  body directly (`post('/users', { user })`). The config is the THIRD argument.
914
964
 
915
965
  ```typescript
916
- function post(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>
966
+ function post<T = unknown>(
967
+ url: string,
968
+ data?: unknown,
969
+ config?: RequestConfig,
970
+ ): Promise<HttpResponse<T>>
917
971
  ```
918
972
 
919
973
  - `url` — The request URL.
@@ -927,7 +981,11 @@ function post(url: string, data?: unknown, config?: RequestConfig): Promise<Http
927
981
  Makes a PUT request using the bonded HTTP client.
928
982
 
929
983
  ```typescript
930
- function put(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>
984
+ function put<T = unknown>(
985
+ url: string,
986
+ data?: unknown,
987
+ config?: RequestConfig,
988
+ ): Promise<HttpResponse<T>>
931
989
  ```
932
990
 
933
991
  - `url` — The request URL. The body is `data` — the SECOND argument, never `{ data: body }`.
@@ -941,7 +999,11 @@ function put(url: string, data?: unknown, config?: RequestConfig): Promise<HttpR
941
999
  Makes a PATCH request using the bonded HTTP client.
942
1000
 
943
1001
  ```typescript
944
- function patch(url: string, data?: unknown, config?: RequestConfig): Promise<HttpResponse<T>>
1002
+ function patch<T = unknown>(
1003
+ url: string,
1004
+ data?: unknown,
1005
+ config?: RequestConfig,
1006
+ ): Promise<HttpResponse<T>>
945
1007
  ```
946
1008
 
947
1009
  - `url` — The request URL. The body is `data` — the SECOND argument, never `{ data: body }`.
@@ -955,7 +1017,7 @@ function patch(url: string, data?: unknown, config?: RequestConfig): Promise<Htt
955
1017
  Makes a DELETE request using the bonded HTTP client.
956
1018
 
957
1019
  ```typescript
958
- function del(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
1020
+ function del<T = unknown>(url: string, config?: RequestConfig): Promise<HttpResponse<T>>
959
1021
  ```
960
1022
 
961
1023
  - `url` — The request URL.
@@ -996,7 +1058,7 @@ Peer dependencies:
996
1058
 
997
1059
  - `@molecule/app-bond` ^1.0.1
998
1060
  - `@molecule/app-i18n` ^1.0.1
999
- - `@molecule/app-logger` ^1.0.1
1061
+ - `@molecule/app-logger` ^1.0.4
1000
1062
 
1001
1063
  ### Runtime Dependencies
1002
1064
 
@@ -1018,7 +1080,7 @@ Two mistakes that break in preview/production (seen in real imported apps):
1018
1080
  the author's machine, then fails cross-origin (CORS) in the preview and points at the wrong
1019
1081
  server in production. The base URL is configured ONCE (via `setClient`), not per call.
1020
1082
  - **`getClient()` itself knows no baseURL.** The fallback client it mints when nothing is
1021
- bonded has `baseURL: ''`, so `getClient().get('/articles')` requests the PAGE origin — in
1083
+ bonded has `baseURL: ''`, so `getClient().get('/items')` requests the PAGE origin — in
1022
1084
  dev the Vite server answers its own `index.html` with a 200, and the HTML arrives as
1023
1085
  `data`, and the API then validates none of the fields it was sent. A scaffold bonds
1024
1086
  `'/api'`; an app that builds its own client must pass `{ baseURL }`.
@@ -1038,8 +1100,8 @@ authScheme: 'Token' }))`, or the bonded provider's constructor
1038
1100
  error (TS2339) that changes no header. Do not hand-write a fetch wrapper for the scheme either.
1039
1101
 
1040
1102
  A request made while the session is still being restored WAITS for that restore, so a page
1041
- that fetches viewer-dependent data on mount (a profile's `following` flag, a feed, a
1042
- `favorited` state) cannot go out unauthenticated and answer for an anonymous viewer. The auth
1103
+ that fetches viewer-dependent data on mount (account settings, a dashboard, or a
1104
+ saved-item state) cannot go out unauthenticated and answer for an anonymous viewer. The auth
1043
1105
  bond registers that wait with `setAuthGate`; apps that bond auth through
1044
1106
  `@molecule/app-bonds-default-react` get it without doing anything. An app with its own session
1045
1107
  module registers its own: `setAuthGate(() => session.whenRestored())`.
@@ -1073,6 +1135,10 @@ case so a caller can stay silent instead of reporting an outage. **Do not write
1073
1135
  `err instanceof HttpError && err.status < 500` as a sign-out check** — it clears
1074
1136
  the session on every aborted navigation request.
1075
1137
 
1138
+ Every non-ok response rejected by `@molecule/app-auth` also satisfies
1139
+ `isHttpError(err)`: its `status` and `response.data` are the same HTTP status
1140
+ and parsed body exposed as `AuthError.status` and `AuthError.body`.
1141
+
1076
1142
  ## Translations
1077
1143
 
1078
1144
  Translation strings are provided by `@molecule/app-locales-http`.
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * The one gate every HTTP request awaits before it is sent.
3
3
  *
4
- * A page that fetches viewer-dependent data on mount (`GET /profiles/:user`,
5
- * a feed, a "favorited" flag) can fire BEFORE the stored session has been
4
+ * A page that fetches viewer-dependent data on mount (`GET /accounts/:user`,
5
+ * a dashboard, a saved-item flag) can fire BEFORE the stored session has been
6
6
  * restored, so the request leaves with no `Authorization` header and the server
7
- * answers for an anonymous viewer — `following: false` on a user you follow.
7
+ * answers for an anonymous viewer — `saved: false` on an item you saved.
8
8
  * It is invisible on localhost, where the restore wins the race against the
9
9
  * first effect, and appears over the network as soon as the restore takes one
10
10
  * round trip: on a deployed URL it reads as stale server data rather than as a
package/dist/auth-gate.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * The one gate every HTTP request awaits before it is sent.
3
3
  *
4
- * A page that fetches viewer-dependent data on mount (`GET /profiles/:user`,
5
- * a feed, a "favorited" flag) can fire BEFORE the stored session has been
4
+ * A page that fetches viewer-dependent data on mount (`GET /accounts/:user`,
5
+ * a dashboard, a saved-item flag) can fire BEFORE the stored session has been
6
6
  * restored, so the request leaves with no `Authorization` header and the server
7
- * answers for an anonymous viewer — `following: false` on a user you follow.
7
+ * answers for an anonymous viewer — `saved: false` on an item you saved.
8
8
  * It is invisible on localhost, where the restore wins the race against the
9
9
  * first effect, and appears over the network as soon as the restore takes one
10
10
  * round trip: on a deployed URL it reads as stale server data rather than as a
package/dist/errors.d.ts CHANGED
@@ -25,10 +25,13 @@
25
25
  */
26
26
  import { HttpError } from './types.js';
27
27
  /**
28
- * Whether `err` is an {@link HttpError} from this package.
28
+ * Whether `err` is an {@link HttpError} or a compatible branded request failure.
29
+ * `@molecule/app-auth` uses the same global brand for its non-ok responses, so
30
+ * this also recognizes them across realms and duplicated package copies without
31
+ * either package depending on the other.
29
32
  *
30
33
  * @param err - Any thrown value.
31
- * @returns True for an `HttpError`.
34
+ * @returns True for an `HttpError` or a compatibly branded request failure.
32
35
  */
33
36
  export declare function isHttpError(err: unknown): err is HttpError;
34
37
  /**
@@ -1 +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"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAItC;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,SAAS,CAO1D;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 CHANGED
@@ -24,14 +24,21 @@
24
24
  * @module
25
25
  */
26
26
  import { HttpError } from './types.js';
27
+ const HTTP_ERROR_BRAND = Symbol.for('@molecule/app-http/HttpError');
27
28
  /**
28
- * Whether `err` is an {@link HttpError} from this package.
29
+ * Whether `err` is an {@link HttpError} or a compatible branded request failure.
30
+ * `@molecule/app-auth` uses the same global brand for its non-ok responses, so
31
+ * this also recognizes them across realms and duplicated package copies without
32
+ * either package depending on the other.
29
33
  *
30
34
  * @param err - Any thrown value.
31
- * @returns True for an `HttpError`.
35
+ * @returns True for an `HttpError` or a compatibly branded request failure.
32
36
  */
33
37
  export function isHttpError(err) {
34
- return err instanceof HttpError;
38
+ return (err instanceof HttpError ||
39
+ (typeof err === 'object' &&
40
+ err !== null &&
41
+ err[HTTP_ERROR_BRAND] === true));
35
42
  }
36
43
  /**
37
44
  * Whether the server REJECTED the request's credential — the only failure that
@@ -1 +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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AS,CAAC,GAAY;IACpC,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,CAAA;AACxC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -47,7 +47,7 @@
47
47
  * the author's machine, then fails cross-origin (CORS) in the preview and points at the wrong
48
48
  * server in production. The base URL is configured ONCE (via `setClient`), not per call.
49
49
  * - **`getClient()` itself knows no baseURL.** The fallback client it mints when nothing is
50
- * bonded has `baseURL: ''`, so `getClient().get('/articles')` requests the PAGE origin — in
50
+ * bonded has `baseURL: ''`, so `getClient().get('/items')` requests the PAGE origin — in
51
51
  * dev the Vite server answers its own `index.html` with a 200, and the HTML arrives as
52
52
  * `data`, and the API then validates none of the fields it was sent. A scaffold bonds
53
53
  * `'/api'`; an app that builds its own client must pass `{ baseURL }`.
@@ -67,8 +67,8 @@
67
67
  * error (TS2339) that changes no header. Do not hand-write a fetch wrapper for the scheme either.
68
68
  *
69
69
  * A request made while the session is still being restored WAITS for that restore, so a page
70
- * that fetches viewer-dependent data on mount (a profile's `following` flag, a feed, a
71
- * `favorited` state) cannot go out unauthenticated and answer for an anonymous viewer. The auth
70
+ * that fetches viewer-dependent data on mount (account settings, a dashboard, or a
71
+ * saved-item state) cannot go out unauthenticated and answer for an anonymous viewer. The auth
72
72
  * bond registers that wait with `setAuthGate`; apps that bond auth through
73
73
  * `@molecule/app-bonds-default-react` get it without doing anything. An app with its own session
74
74
  * module registers its own: `setAuthGate(() => session.whenRestored())`.
@@ -102,6 +102,10 @@
102
102
  * `err instanceof HttpError && err.status < 500` as a sign-out check** — it clears
103
103
  * the session on every aborted navigation request.
104
104
  *
105
+ * Every non-ok response rejected by `@molecule/app-auth` also satisfies
106
+ * `isHttpError(err)`: its `status` and `response.data` are the same HTTP status
107
+ * and parsed body exposed as `AuthError.status` and `AuthError.body`.
108
+ *
105
109
  * @module
106
110
  */
107
111
  export * from './auth-gate.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;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,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6GG;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,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@
47
47
  * the author's machine, then fails cross-origin (CORS) in the preview and points at the wrong
48
48
  * server in production. The base URL is configured ONCE (via `setClient`), not per call.
49
49
  * - **`getClient()` itself knows no baseURL.** The fallback client it mints when nothing is
50
- * bonded has `baseURL: ''`, so `getClient().get('/articles')` requests the PAGE origin — in
50
+ * bonded has `baseURL: ''`, so `getClient().get('/items')` requests the PAGE origin — in
51
51
  * dev the Vite server answers its own `index.html` with a 200, and the HTML arrives as
52
52
  * `data`, and the API then validates none of the fields it was sent. A scaffold bonds
53
53
  * `'/api'`; an app that builds its own client must pass `{ baseURL }`.
@@ -67,8 +67,8 @@
67
67
  * error (TS2339) that changes no header. Do not hand-write a fetch wrapper for the scheme either.
68
68
  *
69
69
  * A request made while the session is still being restored WAITS for that restore, so a page
70
- * that fetches viewer-dependent data on mount (a profile's `following` flag, a feed, a
71
- * `favorited` state) cannot go out unauthenticated and answer for an anonymous viewer. The auth
70
+ * that fetches viewer-dependent data on mount (account settings, a dashboard, or a
71
+ * saved-item state) cannot go out unauthenticated and answer for an anonymous viewer. The auth
72
72
  * bond registers that wait with `setAuthGate`; apps that bond auth through
73
73
  * `@molecule/app-bonds-default-react` get it without doing anything. An app with its own session
74
74
  * module registers its own: `setAuthGate(() => session.whenRestored())`.
@@ -102,6 +102,10 @@
102
102
  * `err instanceof HttpError && err.status < 500` as a sign-out check** — it clears
103
103
  * the session on every aborted navigation request.
104
104
  *
105
+ * Every non-ok response rejected by `@molecule/app-auth` also satisfies
106
+ * `isHttpError(err)`: its `status` and `response.data` are the same HTTP status
107
+ * and parsed body exposed as `AuthError.status` and `AuthError.body`.
108
+ *
105
109
  * @module
106
110
  */
107
111
  export * from './auth-gate.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;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,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6GG;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,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAqB,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AA4ClF;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAQ,gBAAqB,KAAG,UAqbjE,CAAA"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAqB,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AA4ClF;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAQ,gBAAqB,KAAG,UA0bjE,CAAA"}
package/dist/provider.js CHANGED
@@ -9,7 +9,7 @@ import { t } from '@molecule/app-i18n';
9
9
  import { getLogger } from '@molecule/app-logger';
10
10
  import { awaitAuthGate } from './auth-gate.js';
11
11
  import { retryDelayMs, shouldRetryRequest } from './retry.js';
12
- import { HttpError } from './types.js';
12
+ import { HttpError, snapshotHttpErrorBody } from './types.js';
13
13
  /** Wait for a retry backoff. */
14
14
  function sleep(ms) {
15
15
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -208,8 +208,7 @@ export const createFetchClient = (config = {}) => {
208
208
  // server answering a request that expected JSON — the Vite dev server's
209
209
  // SPA fallback when a relative URL had no API baseURL. Resolving with the
210
210
  // HTML as `data` turns that into a `Cannot read properties of undefined`
211
- // crash far from the call (xr-molecule-flash-m126: 6.5 minutes and 22
212
- // probe scripts to discover `getClient().baseURL` was `''`).
211
+ // crash far from the call, obscuring the missing API base URL.
213
212
  const contentType = fetchResponse.headers.get('content-type') ?? '';
214
213
  if (fetchResponse.ok && HTML_CONTENT_TYPE.test(contentType)) {
215
214
  throw new HttpError(`${finalConfig.method} ${url} answered ${contentType.split(';')[0]} instead of ` +
@@ -237,6 +236,7 @@ export const createFetchClient = (config = {}) => {
237
236
  };
238
237
  // Handle error status codes
239
238
  if (!fetchResponse.ok) {
239
+ response.data = await snapshotHttpErrorBody(response.data);
240
240
  logger.warn('HTTP error', finalConfig.method, url, fetchResponse.status);
241
241
  const error = new HttpError(t('http.error.requestFailed', { status: fetchResponse.status }, { defaultValue: `Request failed with status ${fetchResponse.status}` }), fetchResponse.status, response, finalConfig, 'http.error.requestFailed');
242
242
  // Handle auth errors
@@ -308,7 +308,7 @@ export const createFetchClient = (config = {}) => {
308
308
  logger.warn('Network request cancelled by navigation', finalConfig.method, url);
309
309
  }
310
310
  else {
311
- logger.error('Network error', finalConfig.method, url, err);
311
+ logger.error('Network error', finalConfig.method, url, err instanceof Error ? err.message : String(err));
312
312
  }
313
313
  // An abort and a navigation cancellation are the SAME fact to a caller —
314
314
  // the request was cancelled before any response — and neither is a network
@@ -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;AAG9C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE7D,OAAO,EAAE,S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AAC,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,oBAAoB,CAAC,QAAkC;YACrD,iBAAiB,GAAG,QAAQ,CAAA;QAC9B,CAAC;QAED,YAAY;YACV,OAAO,gBAAgB,EAAE,CAAA;QAC3B,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
@@ -101,8 +101,8 @@ export interface AuthGateRequest {
101
101
  */
102
102
  method?: string;
103
103
  /**
104
- * The request's URL, for the message logged when the gate never settles. A URL may carry
105
- * an id; it never carries a credential (tokens travel in headers).
104
+ * The request's URL, for the message logged when the gate never settles. Any userinfo or
105
+ * credential query/fragment values are redacted from that report; non-secret parts remain.
106
106
  */
107
107
  url?: string;
108
108
  }
@@ -148,9 +148,34 @@ export interface HttpResponse<T = unknown> {
148
148
  */
149
149
  config: FullRequestConfig;
150
150
  }
151
+ /**
152
+ * Materialize a failed response body before the synchronous HttpError capture. Unchanged bytes
153
+ * are cloned directly, including a Blob's BOM and every typed-array kind. Changed textual bytes
154
+ * retain the BOM and use a Uint8Array fallback if the original view's alignment no longer fits.
155
+ * Successful responses never pass through this helper.
156
+ *
157
+ * @param body - A response body about to be retained on a failed request.
158
+ * @returns A scrubbed body with unchanged binary content preserved byte-for-byte.
159
+ */
160
+ export declare const snapshotHttpErrorBody: <T>(body: T) => Promise<T>;
161
+ /**
162
+ * Read and scrub a failed response once for a retained-error reconstruction. The detached capture
163
+ * carries the original body kind, safe response metadata, and minimal request config, so callers
164
+ * such as auth never need to read the source response or its body again.
165
+ *
166
+ * @param response - The failed HTTP response to capture.
167
+ * @returns A detached, credential-scrubbed response preserving binary body bytes where safe.
168
+ */
169
+ export declare const snapshotHttpErrorResponse: <T extends HttpResponse>(response: T) => Promise<T>;
151
170
  /**
152
171
  * HTTP error with response details.
153
172
  *
173
+ * Request metadata on `config` and `response.config` is limited to method, a
174
+ * credential-redacted URL, and the two boolean notification-suppression controls
175
+ * (`molSilentErrorNotification` and `molSilentRateLimitNotification`). Request bodies,
176
+ * headers, params and all other provider options are omitted, as are credential-bearing
177
+ * response headers, because errors are routinely serialized by logging transports.
178
+ *
154
179
  * **`status` is an HTTP status when the server answered, and `0` when it did not.**
155
180
  * A `0` means NO response exists: the request was aborted (an `AbortController`, a
156
181
  * component's effect cleanup, a route change tearing the request down) or the
@@ -177,13 +202,21 @@ export declare class HttpError extends Error {
177
202
  config?: FullRequestConfig | undefined;
178
203
  errorKey?: string | undefined;
179
204
  aborted: boolean;
205
+ /**
206
+ * Redacts URL userinfo and credential query/fragment values while preserving the path and
207
+ * non-secret parameters. Shared by compatible HTTP and auth error/log views.
208
+ */
209
+ static readonly redactUrlCredentials: (value: string) => string;
180
210
  /**
181
211
  * Builds a failed-request error.
182
212
  *
183
- * @param message - Human-readable message (already translated where a key exists).
213
+ * @param message - Human-readable message (already translated where a key exists);
214
+ * credentials in any URL it contains are redacted.
184
215
  * @param status - HTTP status, or `0` when no response was received (aborted / network failure).
185
- * @param response - Parsed response when the server answered, otherwise undefined.
186
- * @param config - The request config that failed.
216
+ * @param response - Parsed response when the server answered, otherwise undefined;
217
+ * its request config and headers are sanitized for safe logging.
218
+ * @param config - The request config that failed; only its method, redacted URL and
219
+ * boolean notification-suppression controls are retained.
187
220
  * @param errorKey - Translation key for the failure (`http.error.aborted` for an
188
221
  * aborted request, `http.error.networkError` for a real network failure).
189
222
  * @param aborted - Whether the request was aborted before a response: an
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAA;AAEzF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEhC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IAE9D;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,aAAa,CAAA;IAEvD;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IAEpB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAEjC;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,YAAY,GAAG,KAAK,CAAA;CAC7B;AAED;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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;AAgHD;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAU,CAAC,EAAE,MAAM,CAAC,KAAG,OAAO,CAAC,CAAC,CA2BjE,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GAAU,CAAC,SAAS,YAAY,EACpE,UAAU,CAAC,KACV,OAAO,CAAC,CAAC,CAWX,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,SAAU,SAAQ,KAAK;IA0BzB,MAAM,EAAE,MAAM;IACd,QAAQ,CAAC,EAAE,YAAY;IACvB,MAAM,CAAC,EAAE,iBAAiB;IAC1B,QAAQ,CAAC,EAAE,MAAM;IACjB,OAAO;IA7BhB;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,oBAAoB,4BAAuB;IAE3D;;;;;;;;;;;;;;;;OAgBG;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;CAQzB"}
package/dist/types.js CHANGED
@@ -3,9 +3,179 @@
3
3
  *
4
4
  * @module
5
5
  */
6
+ import { snapshotCredentials } from '@molecule/app-logger';
7
+ import { redactUrlCredentials } from './url.js';
8
+ // A global brand keeps failed-request classification working across realms and
9
+ // duplicated package copies. It is deliberately not an exported runtime key.
10
+ const HTTP_ERROR_BRAND = Symbol.for('@molecule/app-http/HttpError');
11
+ /** The boolean-only notification controls an error interceptor may read. */
12
+ const ERROR_INTERCEPTOR_OPTIONS = [
13
+ 'molSilentErrorNotification',
14
+ 'molSilentRateLimitNotification',
15
+ ];
16
+ /** Keep notification suppression without retaining arbitrary provider options. */
17
+ const errorInterceptorOptions = (options) => {
18
+ if (!options)
19
+ return undefined;
20
+ const safe = Object.fromEntries(ERROR_INTERCEPTOR_OPTIONS.flatMap((key) => (options[key] === true ? [[key, true]] : [])));
21
+ return Object.keys(safe).length > 0 ? safe : undefined;
22
+ };
23
+ /** Keep only non-credential request metadata on an error that may be logged. */
24
+ const errorRequestConfig = (config) => {
25
+ const url = redactUrlCredentials(config.url);
26
+ const options = errorInterceptorOptions(config.options);
27
+ // Even the minimal public form is detached: a later caller mutation must not
28
+ // introduce credentials into the error's retained config or response.config.
29
+ return { method: config.method, url, ...(options ? { options } : {}) };
30
+ };
31
+ /** Fresh Blobs already materialized by the async failure boundary; no native property is written. */
32
+ const retainedErrorBlobs = new WeakSet();
33
+ const isBuffer = (value) => value instanceof ArrayBuffer ||
34
+ (typeof SharedArrayBuffer !== 'undefined' && value instanceof SharedArrayBuffer);
35
+ const sharedBuffer = (bytes) => {
36
+ const copy = new SharedArrayBuffer(bytes.byteLength);
37
+ new Uint8Array(copy).set(bytes);
38
+ return copy;
39
+ };
40
+ /** Clone a view over its exact bytes, retaining element width, offset-independent length and kind. */
41
+ const cloneBinaryBody = (original, bytes) => {
42
+ if (typeof SharedArrayBuffer !== 'undefined' && original instanceof SharedArrayBuffer) {
43
+ return sharedBuffer(bytes);
44
+ }
45
+ if (original instanceof ArrayBuffer)
46
+ return original.slice(0);
47
+ const copy = bytes.slice();
48
+ if (original instanceof DataView)
49
+ return new DataView(copy.buffer);
50
+ if (typeof Buffer !== 'undefined' && original instanceof Buffer)
51
+ return Buffer.from(copy);
52
+ const View = original.constructor;
53
+ return new View(copy.buffer);
54
+ };
55
+ /** Rebuild only changed textual bytes; unchanged and non-text bodies are cloned byte-for-byte. */
56
+ const retainedBinaryBody = (original, snapshot) => {
57
+ if (!isBuffer(original) && !ArrayBuffer.isView(original))
58
+ return snapshot;
59
+ let bytes;
60
+ try {
61
+ bytes = isBuffer(original)
62
+ ? new Uint8Array(original)
63
+ : new Uint8Array(original.buffer, original.byteOffset, original.byteLength);
64
+ }
65
+ catch (_detached) {
66
+ return snapshot;
67
+ }
68
+ let decoded;
69
+ try {
70
+ decoded = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
71
+ }
72
+ catch (_error) {
73
+ // A genuine non-text body is retained byte-for-byte below.
74
+ }
75
+ if (decoded === undefined || snapshot === decoded || typeof snapshot !== 'string') {
76
+ return cloneBinaryBody(original, bytes);
77
+ }
78
+ // snapshotCredentials decodes without a BOM. Restore one on changed text too,
79
+ // then construct typed/BigInt views over bytes rather than numeric elements.
80
+ const hasUtf8Bom = bytes[0] === 0xef && bytes[1] === 0xbb && bytes[2] === 0xbf;
81
+ const encoded = new TextEncoder().encode(hasUtf8Bom ? `\uFEFF${snapshot}` : snapshot);
82
+ if (typeof SharedArrayBuffer !== 'undefined' && original instanceof SharedArrayBuffer) {
83
+ return sharedBuffer(encoded);
84
+ }
85
+ if (original instanceof ArrayBuffer)
86
+ return encoded.buffer;
87
+ if (original instanceof DataView)
88
+ return new DataView(encoded.buffer);
89
+ if (typeof Buffer !== 'undefined' && original instanceof Buffer)
90
+ return Buffer.from(encoded);
91
+ const View = original.constructor;
92
+ const width = View.BYTES_PER_ELEMENT ?? 1;
93
+ return encoded.byteLength % width === 0 ? new View(encoded.buffer) : encoded;
94
+ };
95
+ /** Scrub response headers/body into a new tree and project safe request metadata onto it. */
96
+ const errorResponse = (response) => {
97
+ const config = errorRequestConfig(response.config);
98
+ const scrubbed = snapshotCredentials(response);
99
+ return {
100
+ ...scrubbed,
101
+ data: typeof Blob !== 'undefined' &&
102
+ response.data instanceof Blob &&
103
+ retainedErrorBlobs.has(response.data)
104
+ ? response.data
105
+ : retainedBinaryBody(response.data, scrubbed.data),
106
+ config,
107
+ };
108
+ };
109
+ /**
110
+ * Materialize a failed response body before the synchronous HttpError capture. Unchanged bytes
111
+ * are cloned directly, including a Blob's BOM and every typed-array kind. Changed textual bytes
112
+ * retain the BOM and use a Uint8Array fallback if the original view's alignment no longer fits.
113
+ * Successful responses never pass through this helper.
114
+ *
115
+ * @param body - A response body about to be retained on a failed request.
116
+ * @returns A scrubbed body with unchanged binary content preserved byte-for-byte.
117
+ */
118
+ export const snapshotHttpErrorBody = async (body) => {
119
+ if (isBuffer(body) || ArrayBuffer.isView(body)) {
120
+ return retainedBinaryBody(body, snapshotCredentials(body));
121
+ }
122
+ if (typeof Blob === 'undefined' || !(body instanceof Blob))
123
+ return body;
124
+ try {
125
+ const bytes = new Uint8Array(await body.arrayBuffer());
126
+ let snapshot;
127
+ try {
128
+ const text = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
129
+ const scrubbed = snapshotCredentials(text);
130
+ if (scrubbed === text) {
131
+ snapshot = new Blob([bytes], { type: body.type });
132
+ }
133
+ else {
134
+ const hasUtf8Bom = bytes[0] === 0xef && bytes[1] === 0xbb && bytes[2] === 0xbf;
135
+ const encoded = new TextEncoder().encode(hasUtf8Bom ? `\uFEFF${scrubbed}` : scrubbed);
136
+ snapshot = new Blob([encoded], { type: body.type });
137
+ }
138
+ }
139
+ catch (_nonText) {
140
+ snapshot = new Blob([bytes], { type: body.type });
141
+ }
142
+ retainedErrorBlobs.add(snapshot);
143
+ return snapshot;
144
+ }
145
+ catch (_unreadable) {
146
+ retainedErrorBlobs.add(body);
147
+ return body;
148
+ }
149
+ };
150
+ /**
151
+ * Read and scrub a failed response once for a retained-error reconstruction. The detached capture
152
+ * carries the original body kind, safe response metadata, and minimal request config, so callers
153
+ * such as auth never need to read the source response or its body again.
154
+ *
155
+ * @param response - The failed HTTP response to capture.
156
+ * @returns A detached, credential-scrubbed response preserving binary body bytes where safe.
157
+ */
158
+ export const snapshotHttpErrorResponse = async (response) => {
159
+ const captured = {
160
+ ...response,
161
+ data: response.data,
162
+ status: response.status,
163
+ statusText: response.statusText,
164
+ headers: response.headers,
165
+ config: response.config,
166
+ };
167
+ captured.data = await snapshotHttpErrorBody(captured.data);
168
+ return errorResponse(captured);
169
+ };
6
170
  /**
7
171
  * HTTP error with response details.
8
172
  *
173
+ * Request metadata on `config` and `response.config` is limited to method, a
174
+ * credential-redacted URL, and the two boolean notification-suppression controls
175
+ * (`molSilentErrorNotification` and `molSilentRateLimitNotification`). Request bodies,
176
+ * headers, params and all other provider options are omitted, as are credential-bearing
177
+ * response headers, because errors are routinely serialized by logging transports.
178
+ *
9
179
  * **`status` is an HTTP status when the server answered, and `0` when it did not.**
10
180
  * A `0` means NO response exists: the request was aborted (an `AbortController`, a
11
181
  * component's effect cleanup, a route change tearing the request down) or the
@@ -32,13 +202,21 @@ export class HttpError extends Error {
32
202
  config;
33
203
  errorKey;
34
204
  aborted;
205
+ /**
206
+ * Redacts URL userinfo and credential query/fragment values while preserving the path and
207
+ * non-secret parameters. Shared by compatible HTTP and auth error/log views.
208
+ */
209
+ static redactUrlCredentials = redactUrlCredentials;
35
210
  /**
36
211
  * Builds a failed-request error.
37
212
  *
38
- * @param message - Human-readable message (already translated where a key exists).
213
+ * @param message - Human-readable message (already translated where a key exists);
214
+ * credentials in any URL it contains are redacted.
39
215
  * @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.
216
+ * @param response - Parsed response when the server answered, otherwise undefined;
217
+ * its request config and headers are sanitized for safe logging.
218
+ * @param config - The request config that failed; only its method, redacted URL and
219
+ * boolean notification-suppression controls are retained.
42
220
  * @param errorKey - Translation key for the failure (`http.error.aborted` for an
43
221
  * aborted request, `http.error.networkError` for a real network failure).
44
222
  * @param aborted - Whether the request was aborted before a response: an
@@ -47,13 +225,16 @@ export class HttpError extends Error {
47
225
  * from a network outage on the same `status === 0`, without parsing the message.
48
226
  */
49
227
  constructor(message, status, response, config, errorKey, aborted = false) {
50
- super(message);
228
+ super(snapshotCredentials(message));
51
229
  this.status = status;
52
230
  this.response = response;
53
231
  this.config = config;
54
232
  this.errorKey = errorKey;
55
233
  this.aborted = aborted;
56
234
  this.name = 'HttpError';
235
+ this.response = response ? errorResponse(response) : undefined;
236
+ this.config = config ? errorRequestConfig(config) : undefined;
237
+ Object.defineProperty(this, HTTP_ERROR_BRAND, { value: true });
57
238
  }
58
239
  }
59
240
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0KH;;;;;;;;;;;;;;;;;;;;;;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"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAG1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAE/C,+EAA+E;AAC/E,6EAA6E;AAC7E,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,C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,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QAC9D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QAC7D,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IAChE,CAAC"}
package/dist/url.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * URL sanitization for errors and logs.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Redacts credentials from a URL or from text containing one, while preserving its scheme,
8
+ * host, path and non-credential parameters. Both absolute and relative URLs are supported;
9
+ * userinfo is replaced as a whole and credential-valued query/fragment parameters keep their
10
+ * names with `[REDACTED]` as their value. A string without URL credentials is returned unchanged.
11
+ *
12
+ * The implementation is the logger core's shared deep scrubber; this named view keeps the
13
+ * existing `HttpError.redactUrlCredentials` API without maintaining a second classification rule.
14
+ *
15
+ * @param value - A URL, error message or log argument that may contain a credential URL.
16
+ * @returns The input with URL userinfo and credential parameter values redacted.
17
+ */
18
+ export declare const redactUrlCredentials: (value: string) => string;
19
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,MAAM,KAAG,MAAkC,CAAA"}
package/dist/url.js ADDED
@@ -0,0 +1,20 @@
1
+ /**
2
+ * URL sanitization for errors and logs.
3
+ *
4
+ * @module
5
+ */
6
+ import { redactCredentials } from '@molecule/app-logger';
7
+ /**
8
+ * Redacts credentials from a URL or from text containing one, while preserving its scheme,
9
+ * host, path and non-credential parameters. Both absolute and relative URLs are supported;
10
+ * userinfo is replaced as a whole and credential-valued query/fragment parameters keep their
11
+ * names with `[REDACTED]` as their value. A string without URL credentials is returned unchanged.
12
+ *
13
+ * The implementation is the logger core's shared deep scrubber; this named view keeps the
14
+ * existing `HttpError.redactUrlCredentials` API without maintaining a second classification rule.
15
+ *
16
+ * @param value - A URL, error message or log argument that may contain a credential URL.
17
+ * @returns The input with URL userinfo and credential parameter values redacted.
18
+ */
19
+ export const redactUrlCredentials = (value) => redactCredentials(value);
20
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-http",
3
- "version": "1.5.0",
3
+ "version": "1.5.3",
4
4
  "description": "Client HTTP interface for molecule.dev",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,12 +30,12 @@
30
30
  "peerDependencies": {
31
31
  "@molecule/app-bond": "^1.0.1",
32
32
  "@molecule/app-i18n": "^1.0.1",
33
- "@molecule/app-logger": "^1.0.1"
33
+ "@molecule/app-logger": "^1.0.4"
34
34
  },
35
35
  "devDependencies": {
36
- "@molecule/app-bond": "1.0.3",
37
- "@molecule/app-i18n": "1.1.0",
38
- "@molecule/app-logger": "1.0.3",
36
+ "@molecule/app-bond": "1.0.5",
37
+ "@molecule/app-i18n": "1.1.2",
38
+ "@molecule/app-logger": "1.0.5",
39
39
  "@types/node": "26.6.5",
40
40
  "typescript": "6.0.3",
41
41
  "vitest": "4.1.12"