better-call 1.0.27 → 1.0.28-beta.2
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/README.md +87 -0
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/index.cjs +32 -20
- 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 +32 -20
- package/dist/index.js.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/{router-D1f_-c2B.d.ts → router-NaFkuy-s.d.ts} +31 -1
- package/dist/{router-DxWRTWmk.d.cts → router-rGV6mTr8.d.cts} +31 -1
- package/package.json +1 -1
package/dist/node.d.cts
CHANGED
package/dist/node.d.ts
CHANGED
|
@@ -931,6 +931,22 @@ interface EndpointBaseOptions {
|
|
|
931
931
|
* If enabled, endpoint won't be exposed over a router
|
|
932
932
|
*/
|
|
933
933
|
SERVER_ONLY?: boolean;
|
|
934
|
+
/**
|
|
935
|
+
* List of allowed media types (MIME types) for the endpoint
|
|
936
|
+
*
|
|
937
|
+
* if provided, only the media types in the list will be allowed to be passed in the body
|
|
938
|
+
*
|
|
939
|
+
* @example
|
|
940
|
+
* ```ts
|
|
941
|
+
* const endpoint = createEndpoint("/path", {
|
|
942
|
+
* method: "POST",
|
|
943
|
+
* allowedMediaTypes: ["application/json", "application/x-www-form-urlencoded"],
|
|
944
|
+
* }, async(ctx)=>{
|
|
945
|
+
* const body = ctx.body
|
|
946
|
+
* })
|
|
947
|
+
* ```
|
|
948
|
+
*/
|
|
949
|
+
allowedMediaTypes?: string[];
|
|
934
950
|
/**
|
|
935
951
|
* Extra metadata
|
|
936
952
|
*/
|
|
@@ -1210,6 +1226,20 @@ interface RouterConfig {
|
|
|
1210
1226
|
* A callback to run before any request
|
|
1211
1227
|
*/
|
|
1212
1228
|
onRequest?: (req: Request) => any | Promise<any>;
|
|
1229
|
+
/**
|
|
1230
|
+
* List of allowed media types (MIME types) for the router
|
|
1231
|
+
*
|
|
1232
|
+
* if provided, only the media types in the list will be allowed to be passed in the body.
|
|
1233
|
+
*
|
|
1234
|
+
* If an endpoint has allowed media types, it will override the router's allowed media types.
|
|
1235
|
+
*
|
|
1236
|
+
* @example
|
|
1237
|
+
* ```ts
|
|
1238
|
+
* const router = createRouter({
|
|
1239
|
+
* allowedMediaTypes: ["application/json", "application/x-www-form-urlencoded"],
|
|
1240
|
+
* })
|
|
1241
|
+
*/
|
|
1242
|
+
allowedMediaTypes?: string[];
|
|
1213
1243
|
/**
|
|
1214
1244
|
* Open API route configuration
|
|
1215
1245
|
*/
|
|
@@ -1260,4 +1290,4 @@ declare const createRouter: <E extends Record<string, Endpoint>, Config extends
|
|
|
1260
1290
|
type Router = ReturnType<typeof createRouter>;
|
|
1261
1291
|
//#endregion
|
|
1262
1292
|
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, createEndpoint, createInternalContext, createMiddleware, createRouter, generator, getCookieKey, getHTML, hideInternalStackFrames, makeErrorForHideStackFrame, parseCookies, serializeCookie, serializeSignedCookie, statusCodes };
|
|
1263
|
-
//# sourceMappingURL=router-
|
|
1293
|
+
//# sourceMappingURL=router-NaFkuy-s.d.ts.map
|
|
@@ -931,6 +931,22 @@ interface EndpointBaseOptions {
|
|
|
931
931
|
* If enabled, endpoint won't be exposed over a router
|
|
932
932
|
*/
|
|
933
933
|
SERVER_ONLY?: boolean;
|
|
934
|
+
/**
|
|
935
|
+
* List of allowed media types (MIME types) for the endpoint
|
|
936
|
+
*
|
|
937
|
+
* if provided, only the media types in the list will be allowed to be passed in the body
|
|
938
|
+
*
|
|
939
|
+
* @example
|
|
940
|
+
* ```ts
|
|
941
|
+
* const endpoint = createEndpoint("/path", {
|
|
942
|
+
* method: "POST",
|
|
943
|
+
* allowedMediaTypes: ["application/json", "application/x-www-form-urlencoded"],
|
|
944
|
+
* }, async(ctx)=>{
|
|
945
|
+
* const body = ctx.body
|
|
946
|
+
* })
|
|
947
|
+
* ```
|
|
948
|
+
*/
|
|
949
|
+
allowedMediaTypes?: string[];
|
|
934
950
|
/**
|
|
935
951
|
* Extra metadata
|
|
936
952
|
*/
|
|
@@ -1210,6 +1226,20 @@ interface RouterConfig {
|
|
|
1210
1226
|
* A callback to run before any request
|
|
1211
1227
|
*/
|
|
1212
1228
|
onRequest?: (req: Request) => any | Promise<any>;
|
|
1229
|
+
/**
|
|
1230
|
+
* List of allowed media types (MIME types) for the router
|
|
1231
|
+
*
|
|
1232
|
+
* if provided, only the media types in the list will be allowed to be passed in the body.
|
|
1233
|
+
*
|
|
1234
|
+
* If an endpoint has allowed media types, it will override the router's allowed media types.
|
|
1235
|
+
*
|
|
1236
|
+
* @example
|
|
1237
|
+
* ```ts
|
|
1238
|
+
* const router = createRouter({
|
|
1239
|
+
* allowedMediaTypes: ["application/json", "application/x-www-form-urlencoded"],
|
|
1240
|
+
* })
|
|
1241
|
+
*/
|
|
1242
|
+
allowedMediaTypes?: string[];
|
|
1213
1243
|
/**
|
|
1214
1244
|
* Open API route configuration
|
|
1215
1245
|
*/
|
|
@@ -1260,4 +1290,4 @@ declare const createRouter: <E extends Record<string, Endpoint>, Config extends
|
|
|
1260
1290
|
type Router = ReturnType<typeof createRouter>;
|
|
1261
1291
|
//#endregion
|
|
1262
1292
|
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, createEndpoint, createInternalContext, createMiddleware, createRouter, generator, getCookieKey, getHTML, hideInternalStackFrames, makeErrorForHideStackFrame, parseCookies, serializeCookie, serializeSignedCookie, statusCodes };
|
|
1263
|
-
//# sourceMappingURL=router-
|
|
1293
|
+
//# sourceMappingURL=router-rGV6mTr8.d.cts.map
|