@readyfor/api-client-base 0.243.0-pr981.52c46aa → 0.243.0-pr981.f3ebbce
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/{chunk-IF7WWYV5.mjs → chunk-PAUHDRVC.mjs} +40 -31
- package/dist/fetcher.js +40 -52
- package/dist/fetcher.mjs +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +40 -30
- package/dist/index.mjs +2 -5
- package/package.json +1 -1
|
@@ -5,21 +5,21 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
store
|
|
7
7
|
} from "./chunk-DATABM5C.mjs";
|
|
8
|
-
import {
|
|
9
|
-
mergeRequestInit
|
|
10
|
-
} from "./chunk-LYXJUKKR.mjs";
|
|
11
8
|
|
|
12
9
|
// src/fetcher.ts
|
|
13
10
|
var defaultRequestInit = {
|
|
14
11
|
credentials: "include"
|
|
15
12
|
};
|
|
16
|
-
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => fetch(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
14
|
+
...defaultRequestInit,
|
|
15
|
+
...customRequestInit,
|
|
16
|
+
...requestInit,
|
|
17
|
+
headers: {
|
|
18
|
+
...defaultRequestInit.headers,
|
|
19
|
+
...customRequestInit.headers,
|
|
20
|
+
...requestInit.headers
|
|
21
|
+
}
|
|
22
|
+
}).then(async (res) => {
|
|
23
23
|
const body = await res.json();
|
|
24
24
|
if (res.ok) return body;
|
|
25
25
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
@@ -43,13 +43,16 @@ var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit
|
|
|
43
43
|
}
|
|
44
44
|
throw result.error;
|
|
45
45
|
});
|
|
46
|
-
var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
47
|
+
...defaultRequestInit,
|
|
48
|
+
...customRequestInit,
|
|
49
|
+
...requestInit,
|
|
50
|
+
headers: {
|
|
51
|
+
...defaultRequestInit.headers,
|
|
52
|
+
...customRequestInit.headers,
|
|
53
|
+
...requestInit.headers
|
|
54
|
+
}
|
|
55
|
+
}).then(async (res) => {
|
|
53
56
|
const body = await res.text();
|
|
54
57
|
if (res.ok) return body;
|
|
55
58
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
@@ -59,13 +62,16 @@ var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
59
62
|
store.getState().onError?.(error);
|
|
60
63
|
throw error;
|
|
61
64
|
});
|
|
62
|
-
var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
66
|
+
...defaultRequestInit,
|
|
67
|
+
...customRequestInit,
|
|
68
|
+
...requestInit,
|
|
69
|
+
headers: {
|
|
70
|
+
...defaultRequestInit.headers,
|
|
71
|
+
...customRequestInit.headers,
|
|
72
|
+
...requestInit.headers
|
|
73
|
+
}
|
|
74
|
+
}).then(async (res) => {
|
|
69
75
|
const body = await res.blob();
|
|
70
76
|
if (res.ok) return { body, headers: res.headers };
|
|
71
77
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
@@ -75,13 +81,16 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
75
81
|
store.getState().onError?.(error);
|
|
76
82
|
throw error;
|
|
77
83
|
});
|
|
78
|
-
var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
85
|
+
...defaultRequestInit,
|
|
86
|
+
...customRequestInit,
|
|
87
|
+
...requestInit,
|
|
88
|
+
headers: {
|
|
89
|
+
...defaultRequestInit.headers,
|
|
90
|
+
...customRequestInit.headers,
|
|
91
|
+
...requestInit.headers
|
|
92
|
+
}
|
|
93
|
+
}).then(async (res) => {
|
|
85
94
|
if (res.ok) return;
|
|
86
95
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
87
96
|
const body = await res.text();
|
package/dist/fetcher.js
CHANGED
|
@@ -93,30 +93,6 @@ var createStore = (initialState) => {
|
|
|
93
93
|
};
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
// src/utils/headersInit.ts
|
|
97
|
-
var mergeHeadersInit = (baseHeadersInit, overrideHeadersInit) => {
|
|
98
|
-
const base = new Headers(baseHeadersInit);
|
|
99
|
-
const override = new Headers(overrideHeadersInit);
|
|
100
|
-
const setCookies = base.getSetCookie().concat(override.getSetCookie());
|
|
101
|
-
base.delete("set-cookie");
|
|
102
|
-
override.delete("set-cookie");
|
|
103
|
-
const mergedHeaders = new Headers({
|
|
104
|
-
...Object.fromEntries(base),
|
|
105
|
-
...Object.fromEntries(override)
|
|
106
|
-
});
|
|
107
|
-
setCookies.forEach((cookie) => {
|
|
108
|
-
mergedHeaders.append("set-cookie", cookie);
|
|
109
|
-
});
|
|
110
|
-
return mergedHeaders;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
// src/utils/requestInit.ts
|
|
114
|
-
var mergeRequestInit = ({ headers: baseHeaders, ...base }, { headers: overrideHeaders, ...override }) => ({
|
|
115
|
-
...base,
|
|
116
|
-
...override,
|
|
117
|
-
headers: baseHeaders === void 0 ? overrideHeaders : overrideHeaders === void 0 ? baseHeaders : mergeHeadersInit(baseHeaders, overrideHeaders)
|
|
118
|
-
});
|
|
119
|
-
|
|
120
96
|
// src/apiClientConfigStore.ts
|
|
121
97
|
var defaultConfig = {};
|
|
122
98
|
var store = createStore(defaultConfig);
|
|
@@ -125,13 +101,16 @@ var store = createStore(defaultConfig);
|
|
|
125
101
|
var defaultRequestInit = {
|
|
126
102
|
credentials: "include"
|
|
127
103
|
};
|
|
128
|
-
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => fetch(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
104
|
+
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
105
|
+
...defaultRequestInit,
|
|
106
|
+
...customRequestInit,
|
|
107
|
+
...requestInit,
|
|
108
|
+
headers: {
|
|
109
|
+
...defaultRequestInit.headers,
|
|
110
|
+
...customRequestInit.headers,
|
|
111
|
+
...requestInit.headers
|
|
112
|
+
}
|
|
113
|
+
}).then(async (res) => {
|
|
135
114
|
const body = await res.json();
|
|
136
115
|
if (res.ok) return body;
|
|
137
116
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
@@ -155,13 +134,16 @@ var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit
|
|
|
155
134
|
}
|
|
156
135
|
throw result.error;
|
|
157
136
|
});
|
|
158
|
-
var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
137
|
+
var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
138
|
+
...defaultRequestInit,
|
|
139
|
+
...customRequestInit,
|
|
140
|
+
...requestInit,
|
|
141
|
+
headers: {
|
|
142
|
+
...defaultRequestInit.headers,
|
|
143
|
+
...customRequestInit.headers,
|
|
144
|
+
...requestInit.headers
|
|
145
|
+
}
|
|
146
|
+
}).then(async (res) => {
|
|
165
147
|
const body = await res.text();
|
|
166
148
|
if (res.ok) return body;
|
|
167
149
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
@@ -171,13 +153,16 @@ var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
171
153
|
store.getState().onError?.(error);
|
|
172
154
|
throw error;
|
|
173
155
|
});
|
|
174
|
-
var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
156
|
+
var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
157
|
+
...defaultRequestInit,
|
|
158
|
+
...customRequestInit,
|
|
159
|
+
...requestInit,
|
|
160
|
+
headers: {
|
|
161
|
+
...defaultRequestInit.headers,
|
|
162
|
+
...customRequestInit.headers,
|
|
163
|
+
...requestInit.headers
|
|
164
|
+
}
|
|
165
|
+
}).then(async (res) => {
|
|
181
166
|
const body = await res.blob();
|
|
182
167
|
if (res.ok) return { body, headers: res.headers };
|
|
183
168
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
@@ -187,13 +172,16 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
187
172
|
store.getState().onError?.(error);
|
|
188
173
|
throw error;
|
|
189
174
|
});
|
|
190
|
-
var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
175
|
+
var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
176
|
+
...defaultRequestInit,
|
|
177
|
+
...customRequestInit,
|
|
178
|
+
...requestInit,
|
|
179
|
+
headers: {
|
|
180
|
+
...defaultRequestInit.headers,
|
|
181
|
+
...customRequestInit.headers,
|
|
182
|
+
...requestInit.headers
|
|
183
|
+
}
|
|
184
|
+
}).then(async (res) => {
|
|
197
185
|
if (res.ok) return;
|
|
198
186
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
199
187
|
const body = await res.text();
|
package/dist/fetcher.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -5,5 +5,4 @@ export { __internal__requestUrl } from './requestUrl.mjs';
|
|
|
5
5
|
export { Store, createStore } from './store.mjs';
|
|
6
6
|
export { ForceDig, QueryPropsFor } from './types.mjs';
|
|
7
7
|
export { isZodError, schemaForType } from './zod.mjs';
|
|
8
|
-
export { mergeRequestInit } from './utils/requestInit.mjs';
|
|
9
8
|
import 'zod';
|
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,4 @@ export { __internal__requestUrl } from './requestUrl.js';
|
|
|
5
5
|
export { Store, createStore } from './store.js';
|
|
6
6
|
export { ForceDig, QueryPropsFor } from './types.js';
|
|
7
7
|
export { isZodError, schemaForType } from './zod.js';
|
|
8
|
-
export { mergeRequestInit } from './utils/requestInit.js';
|
|
9
8
|
import 'zod';
|
package/dist/index.js
CHANGED
|
@@ -42,7 +42,6 @@ __export(index_exports, {
|
|
|
42
42
|
errorTitle: () => errorTitle,
|
|
43
43
|
getErrorStatus: () => getErrorStatus,
|
|
44
44
|
isZodError: () => isZodError,
|
|
45
|
-
mergeRequestInit: () => mergeRequestInit,
|
|
46
45
|
schemaForType: () => schemaForType,
|
|
47
46
|
setApiClientConfig: () => setApiClientConfig,
|
|
48
47
|
store: () => store
|
|
@@ -168,13 +167,16 @@ var getErrorStatus = (response) => {
|
|
|
168
167
|
var defaultRequestInit = {
|
|
169
168
|
credentials: "include"
|
|
170
169
|
};
|
|
171
|
-
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => fetch(
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
170
|
+
var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
171
|
+
...defaultRequestInit,
|
|
172
|
+
...customRequestInit,
|
|
173
|
+
...requestInit,
|
|
174
|
+
headers: {
|
|
175
|
+
...defaultRequestInit.headers,
|
|
176
|
+
...customRequestInit.headers,
|
|
177
|
+
...requestInit.headers
|
|
178
|
+
}
|
|
179
|
+
}).then(async (res) => {
|
|
178
180
|
const body = await res.json();
|
|
179
181
|
if (res.ok) return body;
|
|
180
182
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
@@ -198,13 +200,16 @@ var createJsonFetcher = (schema, customRequestInit = {}) => (input, requestInit
|
|
|
198
200
|
}
|
|
199
201
|
throw result.error;
|
|
200
202
|
});
|
|
201
|
-
var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
203
|
+
var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
204
|
+
...defaultRequestInit,
|
|
205
|
+
...customRequestInit,
|
|
206
|
+
...requestInit,
|
|
207
|
+
headers: {
|
|
208
|
+
...defaultRequestInit.headers,
|
|
209
|
+
...customRequestInit.headers,
|
|
210
|
+
...requestInit.headers
|
|
211
|
+
}
|
|
212
|
+
}).then(async (res) => {
|
|
208
213
|
const body = await res.text();
|
|
209
214
|
if (res.ok) return body;
|
|
210
215
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
@@ -214,13 +219,16 @@ var createTextFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
214
219
|
store.getState().onError?.(error);
|
|
215
220
|
throw error;
|
|
216
221
|
});
|
|
217
|
-
var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
223
|
+
...defaultRequestInit,
|
|
224
|
+
...customRequestInit,
|
|
225
|
+
...requestInit,
|
|
226
|
+
headers: {
|
|
227
|
+
...defaultRequestInit.headers,
|
|
228
|
+
...customRequestInit.headers,
|
|
229
|
+
...requestInit.headers
|
|
230
|
+
}
|
|
231
|
+
}).then(async (res) => {
|
|
224
232
|
const body = await res.blob();
|
|
225
233
|
if (res.ok) return { body, headers: res.headers };
|
|
226
234
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
@@ -230,13 +238,16 @@ var createBlobFetcher = (customRequestInit = {}) => (input, requestInit = {}) =>
|
|
|
230
238
|
store.getState().onError?.(error);
|
|
231
239
|
throw error;
|
|
232
240
|
});
|
|
233
|
-
var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
241
|
+
var createVoidFetcher = (customRequestInit = {}) => (input, requestInit = {}) => fetch(input, {
|
|
242
|
+
...defaultRequestInit,
|
|
243
|
+
...customRequestInit,
|
|
244
|
+
...requestInit,
|
|
245
|
+
headers: {
|
|
246
|
+
...defaultRequestInit.headers,
|
|
247
|
+
...customRequestInit.headers,
|
|
248
|
+
...requestInit.headers
|
|
249
|
+
}
|
|
250
|
+
}).then(async (res) => {
|
|
240
251
|
if (res.ok) return;
|
|
241
252
|
const code = Object.values(errorStatusCode).includes(res.status) ? res.status : 999;
|
|
242
253
|
const body = await res.text();
|
|
@@ -275,7 +286,6 @@ function __internal__requestUrl(...args) {
|
|
|
275
286
|
errorTitle,
|
|
276
287
|
getErrorStatus,
|
|
277
288
|
isZodError,
|
|
278
|
-
mergeRequestInit,
|
|
279
289
|
schemaForType,
|
|
280
290
|
setApiClientConfig,
|
|
281
291
|
store
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createJsonFetcher,
|
|
4
4
|
createTextFetcher,
|
|
5
5
|
createVoidFetcher
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PAUHDRVC.mjs";
|
|
7
7
|
import {
|
|
8
8
|
HTTPError,
|
|
9
9
|
errorStatusCode,
|
|
@@ -22,9 +22,7 @@ import {
|
|
|
22
22
|
setApiClientConfig,
|
|
23
23
|
store
|
|
24
24
|
} from "./chunk-DATABM5C.mjs";
|
|
25
|
-
import
|
|
26
|
-
mergeRequestInit
|
|
27
|
-
} from "./chunk-LYXJUKKR.mjs";
|
|
25
|
+
import "./chunk-LYXJUKKR.mjs";
|
|
28
26
|
import "./chunk-SMMDKVWH.mjs";
|
|
29
27
|
import {
|
|
30
28
|
createStore
|
|
@@ -44,7 +42,6 @@ export {
|
|
|
44
42
|
errorTitle,
|
|
45
43
|
getErrorStatus,
|
|
46
44
|
isZodError,
|
|
47
|
-
mergeRequestInit,
|
|
48
45
|
schemaForType,
|
|
49
46
|
setApiClientConfig,
|
|
50
47
|
store
|