better-call 1.0.1 → 1.0.3

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, T as HasRequiredKeys, t as InferBody, I as InferBodyInput, B as InferHeaders, D as InferHeadersInput, x as InferInputMethod, w as InferMethod, G as InferMiddlewareBody, J as InferMiddlewareQuery, y as InferParam, Y as InferParamPath, Z as InferParamWildCard, v as InferQuery, u as InferQueryInput, z as InferRequest, F as InferUse, N as Input, K as InputContext, V as IsEmptyObject, X 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, U as Prettify, Q as RequiredKeysOf, j as Router, R as RouterConfig, $ as StandardSchemaV1, S as Status, W as UnionToIntersection, _ as _statusCode, c as createEndpoint, L 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-Bpb8tT1Y.cjs';
1
+ export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, T as HasRequiredKeys, t as InferBody, I as InferBodyInput, B as InferHeaders, D as InferHeadersInput, x as InferInputMethod, w as InferMethod, G as InferMiddlewareBody, J as InferMiddlewareQuery, y as InferParam, Y as InferParamPath, Z as InferParamWildCard, v as InferQuery, u as InferQueryInput, z as InferRequest, F as InferUse, N as Input, K as InputContext, V as IsEmptyObject, X 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, U as Prettify, Q as RequiredKeysOf, j as Router, R as RouterConfig, $ as StandardSchemaV1, S as Status, W as UnionToIntersection, _ as _statusCode, c as createEndpoint, L 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-DUkPVacX.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, T as HasRequiredKeys, t as InferBody, I as InferBodyInput, B as InferHeaders, D as InferHeadersInput, x as InferInputMethod, w as InferMethod, G as InferMiddlewareBody, J as InferMiddlewareQuery, y as InferParam, Y as InferParamPath, Z as InferParamWildCard, v as InferQuery, u as InferQueryInput, z as InferRequest, F as InferUse, N as Input, K as InputContext, V as IsEmptyObject, X 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, U as Prettify, Q as RequiredKeysOf, j as Router, R as RouterConfig, $ as StandardSchemaV1, S as Status, W as UnionToIntersection, _ as _statusCode, c as createEndpoint, L 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-Bpb8tT1Y.js';
1
+ export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, T as HasRequiredKeys, t as InferBody, I as InferBodyInput, B as InferHeaders, D as InferHeadersInput, x as InferInputMethod, w as InferMethod, G as InferMiddlewareBody, J as InferMiddlewareQuery, y as InferParam, Y as InferParamPath, Z as InferParamWildCard, v as InferQuery, u as InferQueryInput, z as InferRequest, F as InferUse, N as Input, K as InputContext, V as IsEmptyObject, X 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, U as Prettify, Q as RequiredKeysOf, j as Router, R as RouterConfig, $ as StandardSchemaV1, S as Status, W as UnionToIntersection, _ as _statusCode, c as createEndpoint, L 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-DUkPVacX.js';
2
2
 
3
3
  declare function toResponse(data?: any, init?: ResponseInit): Response;
4
4
 
package/dist/index.js CHANGED
@@ -4437,8 +4437,8 @@ function getTypeFromZodType(zodType) {
4437
4437
  }
4438
4438
  function getParameters(options) {
4439
4439
  const parameters = [];
4440
- if (options.metadata?.openAPI?.parameters) {
4441
- parameters.push(...options.metadata.openAPI.parameters);
4440
+ if (options.metadata?.openapi?.parameters) {
4441
+ parameters.push(...options.metadata.openapi.parameters);
4442
4442
  return parameters;
4443
4443
  }
4444
4444
  if (options.query instanceof ZodObject) {
@@ -4461,8 +4461,8 @@ function getParameters(options) {
4461
4461
  return parameters;
4462
4462
  }
4463
4463
  function getRequestBody(options) {
4464
- if (options.metadata?.openAPI?.requestBody) {
4465
- return options.metadata.openAPI.requestBody;
4464
+ if (options.metadata?.openapi?.requestBody) {
4465
+ return options.metadata.openapi.requestBody;
4466
4466
  }
4467
4467
  if (!options.body) return void 0;
4468
4468
  if (options.body instanceof ZodObject || options.body instanceof ZodOptional) {
@@ -4603,16 +4603,16 @@ async function generator(endpoints, config) {
4603
4603
  if (options.method === "GET") {
4604
4604
  paths[value.path] = {
4605
4605
  get: {
4606
- tags: ["Default", ...options.metadata?.openAPI?.tags || []],
4607
- description: options.metadata?.openAPI?.description,
4608
- operationId: options.metadata?.openAPI?.operationId,
4606
+ tags: ["Default", ...options.metadata?.openapi?.tags || []],
4607
+ description: options.metadata?.openapi?.description,
4608
+ operationId: options.metadata?.openapi?.operationId,
4609
4609
  security: [
4610
4610
  {
4611
4611
  bearerAuth: []
4612
4612
  }
4613
4613
  ],
4614
4614
  parameters: getParameters(options),
4615
- responses: getResponse(options.metadata?.openAPI?.responses)
4615
+ responses: getResponse(options.metadata?.openapi?.responses)
4616
4616
  }
4617
4617
  };
4618
4618
  }
@@ -4620,9 +4620,9 @@ async function generator(endpoints, config) {
4620
4620
  const body = getRequestBody(options);
4621
4621
  paths[value.path] = {
4622
4622
  post: {
4623
- tags: ["Default", ...options.metadata?.openAPI?.tags || []],
4624
- description: options.metadata?.openAPI?.description,
4625
- operationId: options.metadata?.openAPI?.operationId,
4623
+ tags: ["Default", ...options.metadata?.openapi?.tags || []],
4624
+ description: options.metadata?.openapi?.description,
4625
+ operationId: options.metadata?.openapi?.operationId,
4626
4626
  security: [
4627
4627
  {
4628
4628
  bearerAuth: []
@@ -4642,7 +4642,7 @@ async function generator(endpoints, config) {
4642
4642
  }
4643
4643
  }
4644
4644
  },
4645
- responses: getResponse(options.metadata?.openAPI?.responses)
4645
+ responses: getResponse(options.metadata?.openapi?.responses)
4646
4646
  }
4647
4647
  };
4648
4648
  }
@@ -4749,19 +4749,19 @@ async function getBody(request) {
4749
4749
 
4750
4750
  // src/router.ts
4751
4751
  var createRouter = (endpoints, config) => {
4752
- if (!config?.openAPI?.disabled) {
4753
- const openAPI = {
4752
+ if (!config?.openapi?.disabled) {
4753
+ const openapi = {
4754
4754
  path: "/api/reference",
4755
- ...config?.openAPI
4755
+ ...config?.openapi
4756
4756
  };
4757
- endpoints["openAPI"] = createEndpoint2(
4758
- openAPI.path,
4757
+ endpoints["openapi"] = createEndpoint2(
4758
+ openapi.path,
4759
4759
  {
4760
4760
  method: "GET"
4761
4761
  },
4762
4762
  async (c) => {
4763
4763
  const schema = await generator(endpoints);
4764
- return new Response(getHTML(schema, openAPI.scalar), {
4764
+ return new Response(getHTML(schema, openapi.scalar), {
4765
4765
  headers: {
4766
4766
  "Content-Type": "text/html"
4767
4767
  }