@readyfor/api-client-base 0.207.0 → 0.207.1-pr973.2d83c79
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.
|
@@ -12,6 +12,7 @@ type LoggingConfig = {
|
|
|
12
12
|
type RequestConfig = {
|
|
13
13
|
hostName?: string | ((path: string) => string);
|
|
14
14
|
defaultRequestInit?: RequestInit;
|
|
15
|
+
onError?: (error: unknown) => void;
|
|
15
16
|
};
|
|
16
17
|
type Config = RequestConfig & DeserializeResponseConfig & LoggingConfig;
|
|
17
18
|
declare const store: Store<Config>;
|
|
@@ -12,6 +12,7 @@ type LoggingConfig = {
|
|
|
12
12
|
type RequestConfig = {
|
|
13
13
|
hostName?: string | ((path: string) => string);
|
|
14
14
|
defaultRequestInit?: RequestInit;
|
|
15
|
+
onError?: (error: unknown) => void;
|
|
15
16
|
};
|
|
16
17
|
type Config = RequestConfig & DeserializeResponseConfig & LoggingConfig;
|
|
17
18
|
declare const store: Store<Config>;
|
|
@@ -39,7 +39,11 @@ var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
39
39
|
const body = await res.text();
|
|
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
|
+
store.getState().onError?.(error);
|
|
46
|
+
throw error;
|
|
43
47
|
});
|
|
44
48
|
var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
45
49
|
...defaultRequestInit,
|
|
@@ -54,7 +58,11 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
54
58
|
const body = await res.blob();
|
|
55
59
|
if (res.ok) return { body, headers: res.headers };
|
|
56
60
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
57
|
-
|
|
61
|
+
const error = new HTTPError(code, body);
|
|
62
|
+
throw error;
|
|
63
|
+
}).catch((error) => {
|
|
64
|
+
store.getState().onError?.(error);
|
|
65
|
+
throw error;
|
|
58
66
|
});
|
|
59
67
|
var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
60
68
|
...defaultRequestInit,
|
|
@@ -69,7 +77,11 @@ var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
69
77
|
if (res.ok) return;
|
|
70
78
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
71
79
|
const body = await res.text();
|
|
72
|
-
|
|
80
|
+
const error = new HTTPError(code, body);
|
|
81
|
+
throw error;
|
|
82
|
+
}).catch((error) => {
|
|
83
|
+
store.getState().onError?.(error);
|
|
84
|
+
throw error;
|
|
73
85
|
});
|
|
74
86
|
|
|
75
87
|
export {
|
package/dist/fetcher.js
CHANGED
|
@@ -130,7 +130,11 @@ var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
130
130
|
const body = await res.text();
|
|
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
|
+
store.getState().onError?.(error);
|
|
137
|
+
throw error;
|
|
134
138
|
});
|
|
135
139
|
var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
136
140
|
...defaultRequestInit,
|
|
@@ -145,7 +149,11 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
145
149
|
const body = await res.blob();
|
|
146
150
|
if (res.ok) return { body, headers: res.headers };
|
|
147
151
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
148
|
-
|
|
152
|
+
const error = new HTTPError(code, body);
|
|
153
|
+
throw error;
|
|
154
|
+
}).catch((error) => {
|
|
155
|
+
store.getState().onError?.(error);
|
|
156
|
+
throw error;
|
|
149
157
|
});
|
|
150
158
|
var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
151
159
|
...defaultRequestInit,
|
|
@@ -160,7 +168,11 @@ var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
160
168
|
if (res.ok) return;
|
|
161
169
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
162
170
|
const body = await res.text();
|
|
163
|
-
|
|
171
|
+
const error = new HTTPError(code, body);
|
|
172
|
+
throw error;
|
|
173
|
+
}).catch((error) => {
|
|
174
|
+
store.getState().onError?.(error);
|
|
175
|
+
throw error;
|
|
164
176
|
});
|
|
165
177
|
// Annotate the CommonJS export names for ESM import in node:
|
|
166
178
|
0 && (module.exports = {
|
package/dist/fetcher.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -167,7 +167,11 @@ var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
167
167
|
const body = await res.text();
|
|
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
|
+
store.getState().onError?.(error);
|
|
174
|
+
throw error;
|
|
171
175
|
});
|
|
172
176
|
var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
173
177
|
...defaultRequestInit,
|
|
@@ -182,7 +186,11 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
182
186
|
const body = await res.blob();
|
|
183
187
|
if (res.ok) return { body, headers: res.headers };
|
|
184
188
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
185
|
-
|
|
189
|
+
const error = new HTTPError(code, body);
|
|
190
|
+
throw error;
|
|
191
|
+
}).catch((error) => {
|
|
192
|
+
store.getState().onError?.(error);
|
|
193
|
+
throw error;
|
|
186
194
|
});
|
|
187
195
|
var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
188
196
|
...defaultRequestInit,
|
|
@@ -197,7 +205,11 @@ var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
197
205
|
if (res.ok) return;
|
|
198
206
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
199
207
|
const body = await res.text();
|
|
200
|
-
|
|
208
|
+
const error = new HTTPError(code, body);
|
|
209
|
+
throw error;
|
|
210
|
+
}).catch((error) => {
|
|
211
|
+
store.getState().onError?.(error);
|
|
212
|
+
throw error;
|
|
201
213
|
});
|
|
202
214
|
|
|
203
215
|
// src/requestUrl.ts
|
package/dist/index.mjs
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.1-pr973.2d83c79",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -20,17 +20,14 @@
|
|
|
20
20
|
"require": "./dist/react/index.js"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "tsup"
|
|
25
|
-
},
|
|
26
23
|
"dependencies": {
|
|
27
24
|
"qs": "6.14.0",
|
|
28
25
|
"zod": "^3.24.1"
|
|
29
26
|
},
|
|
30
27
|
"devDependencies": {
|
|
31
28
|
"@types/qs": "6.9.18",
|
|
32
|
-
"@types/react": "
|
|
33
|
-
"@types/use-sync-external-store": "
|
|
29
|
+
"@types/react": "catalog:react19",
|
|
30
|
+
"@types/use-sync-external-store": "catalog:use-sync-external-store",
|
|
34
31
|
"react": "catalog:react19",
|
|
35
32
|
"swr": "catalog:",
|
|
36
33
|
"use-sync-external-store": "catalog:use-sync-external-store"
|
|
@@ -63,5 +60,7 @@
|
|
|
63
60
|
"src"
|
|
64
61
|
]
|
|
65
62
|
},
|
|
66
|
-
"
|
|
67
|
-
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "tsup"
|
|
65
|
+
}
|
|
66
|
+
}
|