rouzer 3.1.0 → 4.0.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 +57 -10
- package/dist/client/index.d.ts +19 -23
- package/dist/client/index.js +44 -24
- package/dist/common.d.ts +11 -1
- package/dist/http.d.ts +0 -3
- package/dist/http.js +4 -9
- package/dist/response-map.d.ts +10 -0
- package/dist/response-map.js +32 -0
- package/dist/response.d.ts +16 -5
- package/dist/response.js +4 -6
- package/dist/server/router.js +53 -3
- package/dist/type.d.ts +33 -4
- package/dist/type.js +32 -3
- package/dist/types/args.d.ts +1 -1
- package/dist/types/handler.d.ts +54 -4
- package/dist/types/index.d.ts +0 -1
- package/dist/types/infer.d.ts +3 -8
- package/dist/types/response.d.ts +51 -11
- package/dist/types/schema.d.ts +15 -4
- package/docs/context.md +133 -54
- package/examples/error-responses.ts +98 -0
- package/package.json +2 -1
- package/dist/types/request.d.ts +0 -35
- package/dist/types/request.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rouzer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
],
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "rm -rf dist && tsgo -b tsconfig.json",
|
|
55
|
+
"format": "prettier --write src test",
|
|
55
56
|
"test": "vitest run"
|
|
56
57
|
}
|
|
57
58
|
}
|
package/dist/types/request.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { RoutePattern } from '@remix-run/route-pattern';
|
|
2
|
-
import type { RouteArgs } from './args.js';
|
|
3
|
-
import type { InferRouteResponse } from './response.js';
|
|
4
|
-
import type { RouteSchema } from './schema.js';
|
|
5
|
-
/**
|
|
6
|
-
* Request descriptor produced by an HTTP action request factory.
|
|
7
|
-
*
|
|
8
|
-
* @remarks Pass this object to `client.request(...)` for a raw `Response` or
|
|
9
|
-
* `client.json(...)` for parsed JSON handling.
|
|
10
|
-
*/
|
|
11
|
-
export type RouteRequest<TResult = any> = {
|
|
12
|
-
/** Method schema used for client-side validation. */
|
|
13
|
-
schema: RouteSchema;
|
|
14
|
-
/** Parsed route pattern used to generate the request URL. */
|
|
15
|
-
path: RoutePattern;
|
|
16
|
-
/** HTTP method to send. */
|
|
17
|
-
method: string;
|
|
18
|
-
/** Validated route arguments and request options. */
|
|
19
|
-
args: RouteArgs;
|
|
20
|
-
/** Phantom result type consumed by `client.json(...)`. */
|
|
21
|
-
$result: TResult;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Callable factory attached to an HTTP action.
|
|
25
|
-
*
|
|
26
|
-
* @remarks Calling a factory validates no data by itself; it creates a typed
|
|
27
|
-
* `RouteRequest` descriptor for `createClient` to validate and send.
|
|
28
|
-
*/
|
|
29
|
-
export type RouteRequestFactory<T extends RouteSchema, P extends string> = {
|
|
30
|
-
(...p: RouteArgs<T, P> extends infer TArgs ? {} extends TArgs ? [args?: TArgs] : [args: TArgs] : never): RouteRequest<InferRouteResponse<T>>;
|
|
31
|
-
/** Inferred argument type for this request factory. */
|
|
32
|
-
$args: RouteArgs<T, P>;
|
|
33
|
-
/** Inferred response type for this request factory. */
|
|
34
|
-
$response: InferRouteResponse<T>;
|
|
35
|
-
};
|
package/dist/types/request.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|