@mpen/routekit 0.1.0
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 +526 -0
- package/dist/bin.mjs +574 -0
- package/package.json +95 -0
- package/src/bin/gen-api-client.test.ts +70 -0
- package/src/bin/gen-api-client.ts +986 -0
- package/src/client/headers.ts +31 -0
- package/src/client/index.ts +8 -0
- package/src/client/promise.ts +11 -0
- package/src/client/react/index.test.tsx +266 -0
- package/src/client/react/index.ts +431 -0
- package/src/client/responses.test.ts +151 -0
- package/src/client/responses.ts +278 -0
- package/src/client/transport.ts +74 -0
- package/src/client/transports/body-codec.ts +61 -0
- package/src/client/transports/fetch.ts +113 -0
- package/src/client/tsconfig.json +9 -0
- package/src/client/types.ts +15 -0
- package/src/client/url.ts +31 -0
- package/src/index.ts +63 -0
- package/src/router/fetch-types.ts +13 -0
- package/src/router/handlers/index.ts +2 -0
- package/src/router/handlers/openapi/index.ts +2 -0
- package/src/router/handlers/openapi/openapi.ts +293 -0
- package/src/router/integration/zod-openapi.test.ts +74 -0
- package/src/router/lib/charset.test.ts +22 -0
- package/src/router/lib/charset.ts +133 -0
- package/src/router/lib/collections.ts +3 -0
- package/src/router/lib/format.test.ts +67 -0
- package/src/router/lib/format.ts +35 -0
- package/src/router/lib/host.ts +4 -0
- package/src/router/lib/json-schema.ts +6 -0
- package/src/router/lib/media-type.test.ts +122 -0
- package/src/router/lib/media-type.ts +289 -0
- package/src/router/lib/pathname.test.ts +18 -0
- package/src/router/lib/pathname.ts +19 -0
- package/src/router/lib/route-names.ts +70 -0
- package/src/router/lib/route-normalize.test.ts +36 -0
- package/src/router/lib/route-normalize.ts +67 -0
- package/src/router/lib/schema-merge.ts +56 -0
- package/src/router/middleware/accept-ctx.test.ts +33 -0
- package/src/router/middleware/accept-ctx.ts +12 -0
- package/src/router/middleware/body-limit.test.ts +112 -0
- package/src/router/middleware/body-limit.ts +121 -0
- package/src/router/middleware/content-type-context.ts +0 -0
- package/src/router/middleware/cors.test.ts +269 -0
- package/src/router/middleware/cors.ts +490 -0
- package/src/router/middleware/csrf.test.ts +106 -0
- package/src/router/middleware/csrf.ts +192 -0
- package/src/router/middleware/define.ts +249 -0
- package/src/router/middleware/index.ts +34 -0
- package/src/router/middleware/jsxhtml-response.ts +0 -0
- package/src/router/middleware/oas-swagger.ts +0 -0
- package/src/router/middleware/rate-limit.test.ts +886 -0
- package/src/router/middleware/rate-limit.ts +920 -0
- package/src/router/middleware/request-id-ctx.test.ts +183 -0
- package/src/router/middleware/request-id-ctx.ts +135 -0
- package/src/router/middleware/request-logger-format.test.ts +16 -0
- package/src/router/middleware/request-logger-format.ts +269 -0
- package/src/router/middleware/request-logger.test.ts +267 -0
- package/src/router/middleware/request-logger.ts +131 -0
- package/src/router/middleware/start-time-ctx.ts +5 -0
- package/src/router/request.ts +611 -0
- package/src/router/response/core.ts +181 -0
- package/src/router/response/directives.ts +233 -0
- package/src/router/response/formats/content/bodyless.ts +54 -0
- package/src/router/response/formats/content/content.ts +79 -0
- package/src/router/response/formats/content/index.ts +2 -0
- package/src/router/response/formats/json-rpc/index.ts +2 -0
- package/src/router/response/formats/problem/badRequest.ts +90 -0
- package/src/router/response/formats/problem/conflict.ts +90 -0
- package/src/router/response/formats/problem/created.ts +40 -0
- package/src/router/response/formats/problem/index.ts +27 -0
- package/src/router/response/formats/problem/notFound.ts +90 -0
- package/src/router/response/formats/problem/permissionDenied.ts +90 -0
- package/src/router/response/formats/problem/problem.test.ts +888 -0
- package/src/router/response/formats/problem/rateLimited.ts +90 -0
- package/src/router/response/formats/problem/responses.ts +219 -0
- package/src/router/response/formats/problem/root-errors.ts +48 -0
- package/src/router/response/formats/problem/sessionExpired.ts +90 -0
- package/src/router/response/formats/problem/types.ts +170 -0
- package/src/router/response/formats/problem/unauthenticated.ts +90 -0
- package/src/router/response/formats/problem/valibot.ts +410 -0
- package/src/router/response/formats/status/index.ts +1 -0
- package/src/router/response/formats/status/responses.ts +59 -0
- package/src/router/response/formats/status/status.test.ts +21 -0
- package/src/router/response/framers.ts +85 -0
- package/src/router/response/index.ts +28 -0
- package/src/router/response/openapi.test.ts +96 -0
- package/src/router/response/openapi.ts +1 -0
- package/src/router/response/serializers.ts +66 -0
- package/src/router/response/stream.ts +35 -0
- package/src/router/router.test.ts +1571 -0
- package/src/router/router.ts +1965 -0
- package/src/router/routes/index.ts +46 -0
- package/src/router/routes/valibot/index.ts +18 -0
- package/src/router/routes/valibot/valibot.ts +1393 -0
- package/src/router/routes/valibot.test.ts +286 -0
- package/src/router/routes/zod/index.ts +18 -0
- package/src/router/routes/zod/zod.ts +1318 -0
- package/src/router/routes/zod.test.ts +280 -0
- package/src/router/server-interface.ts +31 -0
- package/src/router/types.ts +657 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
AddedContextFromMiddlewareInput,
|
|
3
|
+
ContextFromMiddlewareInput,
|
|
4
|
+
MiddlewareEntry,
|
|
5
|
+
Route,
|
|
6
|
+
RouteMatch,
|
|
7
|
+
RouteMeta,
|
|
8
|
+
RouteOptions,
|
|
9
|
+
RouteSchema,
|
|
10
|
+
} from '../types'
|
|
11
|
+
export {
|
|
12
|
+
createValibotRouteBuilder,
|
|
13
|
+
defineValibotMiddleware,
|
|
14
|
+
valibotSchemaMiddleware,
|
|
15
|
+
ValibotValidationError,
|
|
16
|
+
} from './valibot'
|
|
17
|
+
export type {
|
|
18
|
+
DefineValibotMiddlewareOptions,
|
|
19
|
+
ValibotHandlerContext,
|
|
20
|
+
ValibotHandlerParams,
|
|
21
|
+
ValibotRouteBuilder,
|
|
22
|
+
ValibotRouteHandler,
|
|
23
|
+
ValibotRouteHelperDefaults,
|
|
24
|
+
ValibotRouteSchemaInput,
|
|
25
|
+
ValibotValidationErrorBody,
|
|
26
|
+
ValibotValidationErrorHandler,
|
|
27
|
+
ValibotSchemaMiddlewareOptions,
|
|
28
|
+
} from './valibot'
|
|
29
|
+
export {
|
|
30
|
+
createZodRouteBuilder,
|
|
31
|
+
defineZodMiddleware,
|
|
32
|
+
zodSchemaMiddleware,
|
|
33
|
+
ValidationError,
|
|
34
|
+
} from './zod'
|
|
35
|
+
export type {
|
|
36
|
+
DefineZodMiddlewareOptions,
|
|
37
|
+
ValidationErrorHandler,
|
|
38
|
+
ZodRouteBuilder,
|
|
39
|
+
ZodHandlerContext,
|
|
40
|
+
ZodHandlerParams,
|
|
41
|
+
ZodRouteHelperDefaults,
|
|
42
|
+
ZodRouteHandler,
|
|
43
|
+
ZodRouteSchemaInput,
|
|
44
|
+
ZodValidationErrorBody,
|
|
45
|
+
ZodSchemaMiddlewareOptions,
|
|
46
|
+
} from './zod'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export {
|
|
2
|
+
createValibotRouteBuilder,
|
|
3
|
+
defineValibotMiddleware,
|
|
4
|
+
valibotSchemaMiddleware,
|
|
5
|
+
ValibotValidationError,
|
|
6
|
+
} from './valibot'
|
|
7
|
+
export type {
|
|
8
|
+
DefineValibotMiddlewareOptions,
|
|
9
|
+
ValibotHandlerContext,
|
|
10
|
+
ValibotHandlerParams,
|
|
11
|
+
ValibotRouteBuilder,
|
|
12
|
+
ValibotRouteHandler,
|
|
13
|
+
ValibotRouteHelperDefaults,
|
|
14
|
+
ValibotRouteSchemaInput,
|
|
15
|
+
ValibotValidationErrorBody,
|
|
16
|
+
ValibotValidationErrorHandler,
|
|
17
|
+
ValibotSchemaMiddlewareOptions,
|
|
18
|
+
} from './valibot'
|