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/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, U as HasRequiredKeys, t as InferBody, I as InferBodyInput, F as InferHeaders, G as InferHeadersInput, x as InferInputMethod, w as InferMethod, K as InferMiddlewareBody, L as InferMiddlewareQuery, y as InferParam, z as InferParamInput, Z as InferParamPath, $ as InferParamWildCard, v as InferQuery, u as InferQueryInput, B as InferRequest, D as InferRequestInput, J as InferUse, N as InputContext, W as IsEmptyObject, Y as MergeObject, r as Method, h as Middleware, e as MiddlewareContext, g as MiddlewareInputContext, M as MiddlewareOptions, d as MiddlewareResponse, n as OpenAPIParameter, O as OpenAPISchemaType, P as Path, V as Prettify, T as RequiredKeysOf, j as Router, R as RouterConfig, a0 as StandardSchemaV1, S as Status, X as UnionToIntersection, _ as _statusCode, c as createEndpoint, Q as createInternalContext, f as createMiddleware, i as createRouter, o as generator, l as getCookieKey, q as getHTML, p as parseCookies, s as serializeCookie, m as serializeSignedCookie } from './router-Bn_wF2y_.cjs';
1
+ export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, U as HasRequiredKeys, t as InferBody, I as InferBodyInput, F as InferHeaders, G as InferHeadersInput, x as InferInputMethod, w as InferMethod, K as InferMiddlewareBody, L as InferMiddlewareQuery, y as InferParam, z as InferParamInput, Z as InferParamPath, $ as InferParamWildCard, v as InferQuery, u as InferQueryInput, B as InferRequest, D as InferRequestInput, J as InferUse, N as InputContext, W as IsEmptyObject, Y as MergeObject, r as Method, h as Middleware, e as MiddlewareContext, g as MiddlewareInputContext, M as MiddlewareOptions, d as MiddlewareResponse, n as OpenAPIParameter, O as OpenAPISchemaType, P as Path, V as Prettify, T as RequiredKeysOf, j as Router, R as RouterConfig, a0 as StandardSchemaV1, S as Status, X as UnionToIntersection, _ as _statusCode, c as createEndpoint, Q as createInternalContext, f as createMiddleware, i as createRouter, o as generator, l as getCookieKey, q as getHTML, p as parseCookies, s as serializeCookie, m as serializeSignedCookie } from './router-BEp4ze3Q.cjs';
2
2
 
3
3
  declare function toResponse(data?: any, init?: ResponseInit): Response;
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, U as HasRequiredKeys, t as InferBody, I as InferBodyInput, F as InferHeaders, G as InferHeadersInput, x as InferInputMethod, w as InferMethod, K as InferMiddlewareBody, L as InferMiddlewareQuery, y as InferParam, z as InferParamInput, Z as InferParamPath, $ as InferParamWildCard, v as InferQuery, u as InferQueryInput, B as InferRequest, D as InferRequestInput, J as InferUse, N as InputContext, W as IsEmptyObject, Y as MergeObject, r as Method, h as Middleware, e as MiddlewareContext, g as MiddlewareInputContext, M as MiddlewareOptions, d as MiddlewareResponse, n as OpenAPIParameter, O as OpenAPISchemaType, P as Path, V as Prettify, T as RequiredKeysOf, j as Router, R as RouterConfig, a0 as StandardSchemaV1, S as Status, X as UnionToIntersection, _ as _statusCode, c as createEndpoint, Q as createInternalContext, f as createMiddleware, i as createRouter, o as generator, l as getCookieKey, q as getHTML, p as parseCookies, s as serializeCookie, m as serializeSignedCookie } from './router-Bn_wF2y_.js';
1
+ export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, U as HasRequiredKeys, t as InferBody, I as InferBodyInput, F as InferHeaders, G as InferHeadersInput, x as InferInputMethod, w as InferMethod, K as InferMiddlewareBody, L as InferMiddlewareQuery, y as InferParam, z as InferParamInput, Z as InferParamPath, $ as InferParamWildCard, v as InferQuery, u as InferQueryInput, B as InferRequest, D as InferRequestInput, J as InferUse, N as InputContext, W as IsEmptyObject, Y as MergeObject, r as Method, h as Middleware, e as MiddlewareContext, g as MiddlewareInputContext, M as MiddlewareOptions, d as MiddlewareResponse, n as OpenAPIParameter, O as OpenAPISchemaType, P as Path, V as Prettify, T as RequiredKeysOf, j as Router, R as RouterConfig, a0 as StandardSchemaV1, S as Status, X as UnionToIntersection, _ as _statusCode, c as createEndpoint, Q as createInternalContext, f as createMiddleware, i as createRouter, o as generator, l as getCookieKey, q as getHTML, p as parseCookies, s as serializeCookie, m as serializeSignedCookie } from './router-BEp4ze3Q.js';
2
2
 
3
3
  declare function toResponse(data?: any, init?: ResponseInit): Response;
4
4
 
package/dist/index.js CHANGED
@@ -192,7 +192,12 @@ function toResponse(data, init) {
192
192
  body = data;
193
193
  headers.set("Content-Type", "application/octet-stream");
194
194
  } else if (isJSONSerializable(data)) {
195
- body = JSON.stringify(data);
195
+ body = JSON.stringify(data, (key, value) => {
196
+ if (typeof value === "bigint") {
197
+ return value.toString();
198
+ }
199
+ return value;
200
+ });
196
201
  headers.set("Content-Type", "application/json");
197
202
  }
198
203
  return new Response(body, {
@@ -4837,6 +4842,18 @@ var createRouter = (endpoints, config) => {
4837
4842
  if (!route?.data) {
4838
4843
  return new Response(null, { status: 404, statusText: "Not Found" });
4839
4844
  }
4845
+ const query = {};
4846
+ url.searchParams.forEach((value, key) => {
4847
+ if (key in query) {
4848
+ if (Array.isArray(query[key])) {
4849
+ query[key].push(value);
4850
+ } else {
4851
+ query[key] = [query[key], value];
4852
+ }
4853
+ } else {
4854
+ query[key] = value;
4855
+ }
4856
+ });
4840
4857
  const handler = route.data;
4841
4858
  const context = {
4842
4859
  path,
@@ -4844,8 +4861,8 @@ var createRouter = (endpoints, config) => {
4844
4861
  headers: request.headers,
4845
4862
  params: route.params ? JSON.parse(JSON.stringify(route.params)) : {},
4846
4863
  request,
4847
- body: await getBody(handler.options.cloneRequest ? request.clone() : request),
4848
- query: Object.fromEntries(url.searchParams),
4864
+ body: handler.options.disableBody ? void 0 : await getBody(handler.options.cloneRequest ? request.clone() : request),
4865
+ query,
4849
4866
  _flag: "router",
4850
4867
  asResponse: true,
4851
4868
  context: config?.routerContext