@readyfor/api-client-base 0.207.1-pr973.4c3ee6c → 0.207.1

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,5 @@
1
1
  import { Store } from './store.mjs';
2
+ import { HTTPError } from './apiError.mjs';
2
3
 
3
4
  type DeserializeResponseConfig = {
4
5
  forceDeserializeResponse?: false;
@@ -12,7 +13,7 @@ type LoggingConfig = {
12
13
  type RequestConfig = {
13
14
  hostName?: string | ((path: string) => string);
14
15
  defaultRequestInit?: RequestInit;
15
- onError?: (error: unknown) => void;
16
+ onError?: (error: HTTPError) => void;
16
17
  };
17
18
  type Config = RequestConfig & DeserializeResponseConfig & LoggingConfig;
18
19
  declare const store: Store<Config>;
@@ -1,4 +1,5 @@
1
1
  import { Store } from './store.js';
2
+ import { HTTPError } from './apiError.js';
2
3
 
3
4
  type DeserializeResponseConfig = {
4
5
  forceDeserializeResponse?: false;
@@ -12,7 +13,7 @@ type LoggingConfig = {
12
13
  type RequestConfig = {
13
14
  hostName?: string | ((path: string) => string);
14
15
  defaultRequestInit?: RequestInit;
15
- onError?: (error: unknown) => void;
16
+ onError?: (error: HTTPError) => void;
16
17
  };
17
18
  type Config = RequestConfig & DeserializeResponseConfig & LoggingConfig;
18
19
  declare const store: Store<Config>;
@@ -40,8 +40,6 @@ var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
40
40
  if (res.ok) return body;
41
41
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
42
42
  const error = new HTTPError(code, body);
43
- throw error;
44
- }).catch((error) => {
45
43
  store.getState().onError?.(error);
46
44
  throw error;
47
45
  });
@@ -59,8 +57,6 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
59
57
  if (res.ok) return { body, headers: res.headers };
60
58
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
61
59
  const error = new HTTPError(code, body);
62
- throw error;
63
- }).catch((error) => {
64
60
  store.getState().onError?.(error);
65
61
  throw error;
66
62
  });
@@ -78,8 +74,6 @@ var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
78
74
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
79
75
  const body = await res.text();
80
76
  const error = new HTTPError(code, body);
81
- throw error;
82
- }).catch((error) => {
83
77
  store.getState().onError?.(error);
84
78
  throw error;
85
79
  });
package/dist/fetcher.js CHANGED
@@ -131,8 +131,6 @@ var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
131
131
  if (res.ok) return body;
132
132
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
133
133
  const error = new HTTPError(code, body);
134
- throw error;
135
- }).catch((error) => {
136
134
  store.getState().onError?.(error);
137
135
  throw error;
138
136
  });
@@ -150,8 +148,6 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
150
148
  if (res.ok) return { body, headers: res.headers };
151
149
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
152
150
  const error = new HTTPError(code, body);
153
- throw error;
154
- }).catch((error) => {
155
151
  store.getState().onError?.(error);
156
152
  throw error;
157
153
  });
@@ -169,8 +165,6 @@ var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
169
165
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
170
166
  const body = await res.text();
171
167
  const error = new HTTPError(code, body);
172
- throw error;
173
- }).catch((error) => {
174
168
  store.getState().onError?.(error);
175
169
  throw error;
176
170
  });
package/dist/fetcher.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createJsonFetcher,
4
4
  createTextFetcher,
5
5
  createVoidFetcher
6
- } from "./chunk-XDHAVIKP.mjs";
6
+ } from "./chunk-HBZIYFCM.mjs";
7
7
  import "./chunk-PY35XWDS.mjs";
8
8
  import "./chunk-JCZWXJBU.mjs";
9
9
  import "./chunk-472P3XVV.mjs";
package/dist/index.js CHANGED
@@ -168,8 +168,6 @@ var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
168
168
  if (res.ok) return body;
169
169
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
170
170
  const error = new HTTPError(code, body);
171
- throw error;
172
- }).catch((error) => {
173
171
  store.getState().onError?.(error);
174
172
  throw error;
175
173
  });
@@ -187,8 +185,6 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
187
185
  if (res.ok) return { body, headers: res.headers };
188
186
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
189
187
  const error = new HTTPError(code, body);
190
- throw error;
191
- }).catch((error) => {
192
188
  store.getState().onError?.(error);
193
189
  throw error;
194
190
  });
@@ -206,8 +202,6 @@ var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
206
202
  const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
207
203
  const body = await res.text();
208
204
  const error = new HTTPError(code, body);
209
- throw error;
210
- }).catch((error) => {
211
205
  store.getState().onError?.(error);
212
206
  throw error;
213
207
  });
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createJsonFetcher,
4
4
  createTextFetcher,
5
5
  createVoidFetcher
6
- } from "./chunk-XDHAVIKP.mjs";
6
+ } from "./chunk-HBZIYFCM.mjs";
7
7
  import {
8
8
  HTTPError,
9
9
  errorStatusCode,
@@ -2,6 +2,7 @@ import { FC, ReactNode } from 'react';
2
2
  import { Config } from '../apiClientConfigStore.mjs';
3
3
  import { Store } from '../store.mjs';
4
4
  import { SWRConfiguration } from 'swr';
5
+ import '../apiError.mjs';
5
6
 
6
7
  type Configuration = Config & {
7
8
  swr?: SWRConfiguration;
@@ -2,6 +2,7 @@ import { FC, ReactNode } from 'react';
2
2
  import { Config } from '../apiClientConfigStore.js';
3
3
  import { Store } from '../store.js';
4
4
  import { SWRConfiguration } from 'swr';
5
+ import '../apiError.js';
5
6
 
6
7
  type Configuration = Config & {
7
8
  swr?: SWRConfiguration;
@@ -4,4 +4,5 @@ export { useApiClientConfig, useApiClientConfigWithSelector, useRequestInit } fr
4
4
  import 'react';
5
5
  import '../apiClientConfigStore.mjs';
6
6
  import '../store.mjs';
7
+ import '../apiError.mjs';
7
8
  import 'swr';
@@ -4,4 +4,5 @@ export { useApiClientConfig, useApiClientConfigWithSelector, useRequestInit } fr
4
4
  import 'react';
5
5
  import '../apiClientConfigStore.js';
6
6
  import '../store.js';
7
+ import '../apiError.js';
7
8
  import 'swr';
@@ -1,5 +1,6 @@
1
1
  import { Config } from '../apiClientConfigStore.mjs';
2
2
  import '../store.mjs';
3
+ import '../apiError.mjs';
3
4
 
4
5
  declare const useApiClientConfig: () => Config;
5
6
  declare const useApiClientConfigWithSelector: <T>(selector: (state: Config) => T) => T;
@@ -1,5 +1,6 @@
1
1
  import { Config } from '../apiClientConfigStore.js';
2
2
  import '../store.js';
3
+ import '../apiError.js';
3
4
 
4
5
  declare const useApiClientConfig: () => Config;
5
6
  declare const useApiClientConfigWithSelector: <T>(selector: (state: Config) => T) => T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readyfor/api-client-base",
3
- "version": "0.207.1-pr973.4c3ee6c",
3
+ "version": "0.207.1",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,14 +20,17 @@
20
20
  "require": "./dist/react/index.js"
21
21
  }
22
22
  },
23
+ "scripts": {
24
+ "build": "tsup"
25
+ },
23
26
  "dependencies": {
24
27
  "qs": "6.14.0",
25
28
  "zod": "^3.24.1"
26
29
  },
27
30
  "devDependencies": {
28
31
  "@types/qs": "6.9.18",
29
- "@types/react": "catalog:react19",
30
- "@types/use-sync-external-store": "catalog:use-sync-external-store",
32
+ "@types/react": "19.1.0",
33
+ "@types/use-sync-external-store": "1.5.0",
31
34
  "react": "catalog:react19",
32
35
  "swr": "catalog:",
33
36
  "use-sync-external-store": "catalog:use-sync-external-store"
@@ -60,7 +63,5 @@
60
63
  "src"
61
64
  ]
62
65
  },
63
- "scripts": {
64
- "build": "tsup"
65
- }
66
- }
66
+ "gitHead": "8d5b1494e0a21fe73dff424239d633f58dbfad7a"
67
+ }