@readyfor/api-client-base 0.207.1 → 0.207.2
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/apiClientConfigStore.d.mts +1 -2
- package/dist/apiClientConfigStore.d.ts +1 -2
- package/dist/{chunk-HBZIYFCM.mjs → chunk-XDHAVIKP.mjs} +6 -0
- package/dist/fetcher.js +6 -0
- package/dist/fetcher.mjs +1 -1
- package/dist/index.js +6 -0
- package/dist/index.mjs +1 -1
- package/dist/react/ApiClientConfigProvider.d.mts +0 -1
- package/dist/react/ApiClientConfigProvider.d.ts +0 -1
- package/dist/react/index.d.mts +0 -1
- package/dist/react/index.d.ts +0 -1
- package/dist/react/useApiClientConfig.d.mts +0 -1
- package/dist/react/useApiClientConfig.d.ts +0 -1
- package/package.json +2 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Store } from './store.mjs';
|
|
2
|
-
import { HTTPError } from './apiError.mjs';
|
|
3
2
|
|
|
4
3
|
type DeserializeResponseConfig = {
|
|
5
4
|
forceDeserializeResponse?: false;
|
|
@@ -13,7 +12,7 @@ type LoggingConfig = {
|
|
|
13
12
|
type RequestConfig = {
|
|
14
13
|
hostName?: string | ((path: string) => string);
|
|
15
14
|
defaultRequestInit?: RequestInit;
|
|
16
|
-
onError?: (error:
|
|
15
|
+
onError?: (error: unknown) => void;
|
|
17
16
|
};
|
|
18
17
|
type Config = RequestConfig & DeserializeResponseConfig & LoggingConfig;
|
|
19
18
|
declare const store: Store<Config>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Store } from './store.js';
|
|
2
|
-
import { HTTPError } from './apiError.js';
|
|
3
2
|
|
|
4
3
|
type DeserializeResponseConfig = {
|
|
5
4
|
forceDeserializeResponse?: false;
|
|
@@ -13,7 +12,7 @@ type LoggingConfig = {
|
|
|
13
12
|
type RequestConfig = {
|
|
14
13
|
hostName?: string | ((path: string) => string);
|
|
15
14
|
defaultRequestInit?: RequestInit;
|
|
16
|
-
onError?: (error:
|
|
15
|
+
onError?: (error: unknown) => void;
|
|
17
16
|
};
|
|
18
17
|
type Config = RequestConfig & DeserializeResponseConfig & LoggingConfig;
|
|
19
18
|
declare const store: Store<Config>;
|
|
@@ -40,6 +40,8 @@ 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) => {
|
|
43
45
|
store.getState().onError?.(error);
|
|
44
46
|
throw error;
|
|
45
47
|
});
|
|
@@ -57,6 +59,8 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
57
59
|
if (res.ok) return { body, headers: res.headers };
|
|
58
60
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
59
61
|
const error = new HTTPError(code, body);
|
|
62
|
+
throw error;
|
|
63
|
+
}).catch((error) => {
|
|
60
64
|
store.getState().onError?.(error);
|
|
61
65
|
throw error;
|
|
62
66
|
});
|
|
@@ -74,6 +78,8 @@ var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
74
78
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
75
79
|
const body = await res.text();
|
|
76
80
|
const error = new HTTPError(code, body);
|
|
81
|
+
throw error;
|
|
82
|
+
}).catch((error) => {
|
|
77
83
|
store.getState().onError?.(error);
|
|
78
84
|
throw error;
|
|
79
85
|
});
|
package/dist/fetcher.js
CHANGED
|
@@ -131,6 +131,8 @@ 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) => {
|
|
134
136
|
store.getState().onError?.(error);
|
|
135
137
|
throw error;
|
|
136
138
|
});
|
|
@@ -148,6 +150,8 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
148
150
|
if (res.ok) return { body, headers: res.headers };
|
|
149
151
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
150
152
|
const error = new HTTPError(code, body);
|
|
153
|
+
throw error;
|
|
154
|
+
}).catch((error) => {
|
|
151
155
|
store.getState().onError?.(error);
|
|
152
156
|
throw error;
|
|
153
157
|
});
|
|
@@ -165,6 +169,8 @@ var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
165
169
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
166
170
|
const body = await res.text();
|
|
167
171
|
const error = new HTTPError(code, body);
|
|
172
|
+
throw error;
|
|
173
|
+
}).catch((error) => {
|
|
168
174
|
store.getState().onError?.(error);
|
|
169
175
|
throw error;
|
|
170
176
|
});
|
package/dist/fetcher.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -168,6 +168,8 @@ 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) => {
|
|
171
173
|
store.getState().onError?.(error);
|
|
172
174
|
throw error;
|
|
173
175
|
});
|
|
@@ -185,6 +187,8 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
185
187
|
if (res.ok) return { body, headers: res.headers };
|
|
186
188
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
187
189
|
const error = new HTTPError(code, body);
|
|
190
|
+
throw error;
|
|
191
|
+
}).catch((error) => {
|
|
188
192
|
store.getState().onError?.(error);
|
|
189
193
|
throw error;
|
|
190
194
|
});
|
|
@@ -202,6 +206,8 @@ var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
202
206
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
203
207
|
const body = await res.text();
|
|
204
208
|
const error = new HTTPError(code, body);
|
|
209
|
+
throw error;
|
|
210
|
+
}).catch((error) => {
|
|
205
211
|
store.getState().onError?.(error);
|
|
206
212
|
throw error;
|
|
207
213
|
});
|
package/dist/index.mjs
CHANGED
package/dist/react/index.d.mts
CHANGED
package/dist/react/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@readyfor/api-client-base",
|
|
3
|
-
"version": "0.207.
|
|
3
|
+
"version": "0.207.2",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"src"
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "cdc91b00d586f23fd3d63815b14d329c214adc7b"
|
|
67
67
|
}
|