better-call 1.0.8 → 1.0.10
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/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/index.cjs +20 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/{router-Bn_wF2y_.d.cts → router-BEp4ze3Q.d.cts} +4 -0
- package/dist/{router-Bn_wF2y_.d.ts → router-BEp4ze3Q.d.ts} +4 -0
- package/package.json +1 -1
package/dist/client.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BetterFetchOption, BetterFetchResponse } from '@better-fetch/fetch';
|
|
2
|
-
import { j as Router, X as UnionToIntersection, b as Endpoint, U as HasRequiredKeys } from './router-
|
|
2
|
+
import { j as Router, X as UnionToIntersection, b as Endpoint, U as HasRequiredKeys } from './router-BEp4ze3Q.cjs';
|
|
3
3
|
|
|
4
4
|
type HasRequired<T extends {
|
|
5
5
|
body?: any;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BetterFetchOption, BetterFetchResponse } from '@better-fetch/fetch';
|
|
2
|
-
import { j as Router, X as UnionToIntersection, b as Endpoint, U as HasRequiredKeys } from './router-
|
|
2
|
+
import { j as Router, X as UnionToIntersection, b as Endpoint, U as HasRequiredKeys } from './router-BEp4ze3Q.js';
|
|
3
3
|
|
|
4
4
|
type HasRequired<T extends {
|
|
5
5
|
body?: any;
|
package/dist/index.cjs
CHANGED
|
@@ -230,7 +230,12 @@ function toResponse(data, init) {
|
|
|
230
230
|
body = data;
|
|
231
231
|
headers.set("Content-Type", "application/octet-stream");
|
|
232
232
|
} else if (isJSONSerializable(data)) {
|
|
233
|
-
body = JSON.stringify(data)
|
|
233
|
+
body = JSON.stringify(data, (key, value) => {
|
|
234
|
+
if (typeof value === "bigint") {
|
|
235
|
+
return value.toString();
|
|
236
|
+
}
|
|
237
|
+
return value;
|
|
238
|
+
});
|
|
234
239
|
headers.set("Content-Type", "application/json");
|
|
235
240
|
}
|
|
236
241
|
return new Response(body, {
|
|
@@ -4875,6 +4880,18 @@ var createRouter = (endpoints, config) => {
|
|
|
4875
4880
|
if (!route?.data) {
|
|
4876
4881
|
return new Response(null, { status: 404, statusText: "Not Found" });
|
|
4877
4882
|
}
|
|
4883
|
+
const query = {};
|
|
4884
|
+
url.searchParams.forEach((value, key) => {
|
|
4885
|
+
if (key in query) {
|
|
4886
|
+
if (Array.isArray(query[key])) {
|
|
4887
|
+
query[key].push(value);
|
|
4888
|
+
} else {
|
|
4889
|
+
query[key] = [query[key], value];
|
|
4890
|
+
}
|
|
4891
|
+
} else {
|
|
4892
|
+
query[key] = value;
|
|
4893
|
+
}
|
|
4894
|
+
});
|
|
4878
4895
|
const handler = route.data;
|
|
4879
4896
|
const context = {
|
|
4880
4897
|
path,
|
|
@@ -4882,8 +4899,8 @@ var createRouter = (endpoints, config) => {
|
|
|
4882
4899
|
headers: request.headers,
|
|
4883
4900
|
params: route.params ? JSON.parse(JSON.stringify(route.params)) : {},
|
|
4884
4901
|
request,
|
|
4885
|
-
body: await getBody(handler.options.cloneRequest ? request.clone() : request),
|
|
4886
|
-
query
|
|
4902
|
+
body: handler.options.disableBody ? void 0 : await getBody(handler.options.cloneRequest ? request.clone() : request),
|
|
4903
|
+
query,
|
|
4887
4904
|
_flag: "router",
|
|
4888
4905
|
asResponse: true,
|
|
4889
4906
|
context: config?.routerContext
|