@emeryld/rrroutes-client 2.2.16 → 2.2.17

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.
@@ -1,4 +1,16 @@
1
1
  import { Fetcher } from './routesV3.client.types';
2
+ export declare class HttpError extends Error {
3
+ status: number;
4
+ statusText: string;
5
+ url: string;
6
+ body: unknown;
7
+ headers: Record<string, string>;
8
+ constructor(args: {
9
+ res: Response;
10
+ url: string;
11
+ body: unknown;
12
+ });
13
+ }
2
14
  /**
3
15
  * Default fetch implementation used by the route client helper.
4
16
  * @param req Normalized request information (URL, method, body, headers).
@@ -16,7 +16,12 @@ export type FetchInput = {
16
16
  headers?: Record<string, string>;
17
17
  };
18
18
  /** Default signature for HTTP fetch implementations. */
19
- export type Fetcher = <T>(req: FetchInput) => Promise<T>;
19
+ export type Fetcher = <T>(req: FetchInput) => Promise<FetcherOutput<T>> | FetcherOutput<T>;
20
+ export type FetcherOutput<T> = {
21
+ data: T;
22
+ status: number;
23
+ headers: Record<string, any>;
24
+ };
20
25
  /** Debug verbosity levels supported by the client. */
21
26
  export type RouteClientDebugMode = 'minimal' | 'complete';
22
27
  type RouteClientDebugEventBase = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emeryld/rrroutes-client",
3
- "version": "2.2.16",
3
+ "version": "2.2.17",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",