better-call 1.0.25-beta.2 → 1.0.25-beta.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/node.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Router } from "./router-BFJOSfmb.cjs";
1
+ import { Router } from "./router-DOTL_ENw.cjs";
2
2
  import { IncomingMessage, ServerResponse } from "node:http";
3
3
 
4
4
  //#region src/adapters/node/request.d.ts
package/dist/node.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Router } from "./router-D0KeMgM6.js";
1
+ import { Router } from "./router-CC_up1_c.js";
2
2
  import { IncomingMessage, ServerResponse } from "node:http";
3
3
 
4
4
  //#region src/adapters/node/request.d.ts
@@ -89,6 +89,9 @@ declare class InternalAPIError extends Error {
89
89
  cause?: unknown;
90
90
  } & Record<string, any>) | undefined, headers?: HeadersInit, statusCode?: number);
91
91
  }
92
+ declare class BetterCallError extends Error {
93
+ constructor(message: string);
94
+ }
92
95
  type APIError = InstanceType<typeof InternalAPIError>;
93
96
  declare const APIError: new (status?: "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED" | Status | undefined, body?: ({
94
97
  message?: string;
@@ -799,15 +802,7 @@ declare const getHTML: (apiReference: Record<string, any>, config?: {
799
802
  }) => string;
800
803
  //#endregion
801
804
  //#region src/endpoint.d.ts
802
- interface EndpointOptions {
803
- /**
804
- * Request Method
805
- */
806
- method: Method | Method[];
807
- /**
808
- * Body Schema
809
- */
810
- body?: StandardSchemaV1;
805
+ interface EndpointBaseOptions {
811
806
  /**
812
807
  * Query Schema
813
808
  */
@@ -940,6 +935,44 @@ interface EndpointOptions {
940
935
  */
941
936
  onAPIError?: (e: APIError) => void | Promise<void>;
942
937
  }
938
+ type EndpointBodyMethodOptions = {
939
+ /**
940
+ * Request Method
941
+ */
942
+ method: "POST" | "PUT" | "DELETE" | "PATCH" | ("POST" | "PUT" | "DELETE" | "PATCH")[];
943
+ /**
944
+ * Body Schema
945
+ */
946
+ body?: StandardSchemaV1;
947
+ } | {
948
+ /**
949
+ * Request Method
950
+ */
951
+ method: "GET" | "HEAD" | ("GET" | "HEAD")[];
952
+ /**
953
+ * Body Schema
954
+ */
955
+ body?: never;
956
+ } | {
957
+ /**
958
+ * Request Method
959
+ */
960
+ method: "*";
961
+ /**
962
+ * Body Schema
963
+ */
964
+ body?: StandardSchemaV1;
965
+ } | {
966
+ /**
967
+ * Request Method
968
+ */
969
+ method: ("POST" | "PUT" | "DELETE" | "PATCH" | "GET" | "HEAD")[];
970
+ /**
971
+ * Body Schema
972
+ */
973
+ body?: StandardSchemaV1;
974
+ };
975
+ type EndpointOptions = EndpointBaseOptions & EndpointBodyMethodOptions;
943
976
  type EndpointContext<Path extends string, Options extends EndpointOptions, Context = {}> = {
944
977
  /**
945
978
  * Method
@@ -1182,5 +1215,5 @@ declare const createRouter: <E extends Record<string, Endpoint>, Config extends
1182
1215
  };
1183
1216
  type Router = ReturnType<typeof createRouter>;
1184
1217
  //#endregion
1185
- export { APIError, CookieOptions, CookiePrefixOptions, Endpoint, EndpointContext, EndpointOptions, HTTPMethod, HasRequiredKeys, InferBody, InferBodyInput, InferHeaders, InferHeadersInput, InferInputMethod, InferMethod, InferMiddlewareBody, InferMiddlewareQuery, InferParam, InferParamInput, InferParamPath, InferParamWildCard, InferQuery, InferQueryInput, InferRequest, InferRequestInput, InferUse, InputContext, IsEmptyObject, MergeObject, Method, Middleware, MiddlewareContext, MiddlewareInputContext, MiddlewareOptions, MiddlewareResponse, OpenAPIParameter, OpenAPISchemaType, Path$1 as Path, Prettify, RequiredKeysOf, Router, RouterConfig, StandardSchemaV1, Status, StrictEndpoint, UnionToIntersection, _statusCode, createEndpoint, createInternalContext, createMiddleware, createRouter, generator, getCookieKey, getHTML, hideInternalStackFrames, makeErrorForHideStackFrame, parseCookies, serializeCookie, serializeSignedCookie };
1186
- //# sourceMappingURL=router-BFJOSfmb.d.cts.map
1218
+ export { APIError, BetterCallError, CookieOptions, CookiePrefixOptions, Endpoint, EndpointBaseOptions, EndpointBodyMethodOptions, EndpointContext, EndpointOptions, HTTPMethod, HasRequiredKeys, InferBody, InferBodyInput, InferHeaders, InferHeadersInput, InferInputMethod, InferMethod, InferMiddlewareBody, InferMiddlewareQuery, InferParam, InferParamInput, InferParamPath, InferParamWildCard, InferQuery, InferQueryInput, InferRequest, InferRequestInput, InferUse, InputContext, IsEmptyObject, MergeObject, Method, Middleware, MiddlewareContext, MiddlewareInputContext, MiddlewareOptions, MiddlewareResponse, OpenAPIParameter, OpenAPISchemaType, Path$1 as Path, Prettify, RequiredKeysOf, Router, RouterConfig, StandardSchemaV1, Status, StrictEndpoint, UnionToIntersection, _statusCode, createEndpoint, createInternalContext, createMiddleware, createRouter, generator, getCookieKey, getHTML, hideInternalStackFrames, makeErrorForHideStackFrame, parseCookies, serializeCookie, serializeSignedCookie };
1219
+ //# sourceMappingURL=router-CC_up1_c.d.ts.map
@@ -89,6 +89,9 @@ declare class InternalAPIError extends Error {
89
89
  cause?: unknown;
90
90
  } & Record<string, any>) | undefined, headers?: HeadersInit, statusCode?: number);
91
91
  }
92
+ declare class BetterCallError extends Error {
93
+ constructor(message: string);
94
+ }
92
95
  type APIError = InstanceType<typeof InternalAPIError>;
93
96
  declare const APIError: new (status?: "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED" | Status | undefined, body?: ({
94
97
  message?: string;
@@ -799,15 +802,7 @@ declare const getHTML: (apiReference: Record<string, any>, config?: {
799
802
  }) => string;
800
803
  //#endregion
801
804
  //#region src/endpoint.d.ts
802
- interface EndpointOptions {
803
- /**
804
- * Request Method
805
- */
806
- method: Method | Method[];
807
- /**
808
- * Body Schema
809
- */
810
- body?: StandardSchemaV1;
805
+ interface EndpointBaseOptions {
811
806
  /**
812
807
  * Query Schema
813
808
  */
@@ -940,6 +935,44 @@ interface EndpointOptions {
940
935
  */
941
936
  onAPIError?: (e: APIError) => void | Promise<void>;
942
937
  }
938
+ type EndpointBodyMethodOptions = {
939
+ /**
940
+ * Request Method
941
+ */
942
+ method: "POST" | "PUT" | "DELETE" | "PATCH" | ("POST" | "PUT" | "DELETE" | "PATCH")[];
943
+ /**
944
+ * Body Schema
945
+ */
946
+ body?: StandardSchemaV1;
947
+ } | {
948
+ /**
949
+ * Request Method
950
+ */
951
+ method: "GET" | "HEAD" | ("GET" | "HEAD")[];
952
+ /**
953
+ * Body Schema
954
+ */
955
+ body?: never;
956
+ } | {
957
+ /**
958
+ * Request Method
959
+ */
960
+ method: "*";
961
+ /**
962
+ * Body Schema
963
+ */
964
+ body?: StandardSchemaV1;
965
+ } | {
966
+ /**
967
+ * Request Method
968
+ */
969
+ method: ("POST" | "PUT" | "DELETE" | "PATCH" | "GET" | "HEAD")[];
970
+ /**
971
+ * Body Schema
972
+ */
973
+ body?: StandardSchemaV1;
974
+ };
975
+ type EndpointOptions = EndpointBaseOptions & EndpointBodyMethodOptions;
943
976
  type EndpointContext<Path extends string, Options extends EndpointOptions, Context = {}> = {
944
977
  /**
945
978
  * Method
@@ -1182,5 +1215,5 @@ declare const createRouter: <E extends Record<string, Endpoint>, Config extends
1182
1215
  };
1183
1216
  type Router = ReturnType<typeof createRouter>;
1184
1217
  //#endregion
1185
- export { APIError, CookieOptions, CookiePrefixOptions, Endpoint, EndpointContext, EndpointOptions, HTTPMethod, HasRequiredKeys, InferBody, InferBodyInput, InferHeaders, InferHeadersInput, InferInputMethod, InferMethod, InferMiddlewareBody, InferMiddlewareQuery, InferParam, InferParamInput, InferParamPath, InferParamWildCard, InferQuery, InferQueryInput, InferRequest, InferRequestInput, InferUse, InputContext, IsEmptyObject, MergeObject, Method, Middleware, MiddlewareContext, MiddlewareInputContext, MiddlewareOptions, MiddlewareResponse, OpenAPIParameter, OpenAPISchemaType, Path$1 as Path, Prettify, RequiredKeysOf, Router, RouterConfig, StandardSchemaV1, Status, StrictEndpoint, UnionToIntersection, _statusCode, createEndpoint, createInternalContext, createMiddleware, createRouter, generator, getCookieKey, getHTML, hideInternalStackFrames, makeErrorForHideStackFrame, parseCookies, serializeCookie, serializeSignedCookie };
1186
- //# sourceMappingURL=router-D0KeMgM6.d.ts.map
1218
+ export { APIError, BetterCallError, CookieOptions, CookiePrefixOptions, Endpoint, EndpointBaseOptions, EndpointBodyMethodOptions, EndpointContext, EndpointOptions, HTTPMethod, HasRequiredKeys, InferBody, InferBodyInput, InferHeaders, InferHeadersInput, InferInputMethod, InferMethod, InferMiddlewareBody, InferMiddlewareQuery, InferParam, InferParamInput, InferParamPath, InferParamWildCard, InferQuery, InferQueryInput, InferRequest, InferRequestInput, InferUse, InputContext, IsEmptyObject, MergeObject, Method, Middleware, MiddlewareContext, MiddlewareInputContext, MiddlewareOptions, MiddlewareResponse, OpenAPIParameter, OpenAPISchemaType, Path$1 as Path, Prettify, RequiredKeysOf, Router, RouterConfig, StandardSchemaV1, Status, StrictEndpoint, UnionToIntersection, _statusCode, createEndpoint, createInternalContext, createMiddleware, createRouter, generator, getCookieKey, getHTML, hideInternalStackFrames, makeErrorForHideStackFrame, parseCookies, serializeCookie, serializeSignedCookie };
1219
+ //# sourceMappingURL=router-DOTL_ENw.d.cts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-call",
3
- "version": "1.0.25-beta.2",
3
+ "version": "1.0.25-beta.3",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",