rouzer 5.3.0 → 5.3.1

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/http.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RoutePattern } from '@remix-run/route-pattern';
2
- import { type RouteMetadata, type RouteMetadataMarker } from './metadata.js';
2
+ import { type RouteMetadata } from './metadata.js';
3
3
  import type { RawBodySchema, RouteSchema } from './types/schema.js';
4
4
  /** HTTP methods supported by Rouzer action declarations. */
5
5
  export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
@@ -43,7 +43,6 @@ export type HttpNode = HttpAction | HttpResource;
43
43
  export type HttpRouteTree = {
44
44
  [key: string]: HttpNode;
45
45
  };
46
- type RouteDeclaration<T extends object> = T & Partial<RouteMetadataMarker>;
47
46
  type StringKeys<T> = Pick<T, Extract<keyof T, string>>;
48
47
  /**
49
48
  * Declare an HTTP resource namespace.
@@ -52,22 +51,22 @@ type StringKeys<T> = Pick<T, Extract<keyof T, string>>;
52
51
  * property names are API names only; they do not affect the URL unless the child
53
52
  * is another resource or an action with an explicit path.
54
53
  */
55
- export declare function resource<const P extends string, const TChildren extends HttpRouteTree>(path: P, children: RouteDeclaration<TChildren>): HttpResource<P, StringKeys<TChildren>>;
54
+ export declare function resource<const P extends string, const TChildren extends HttpRouteTree>(path: P, children: TChildren): HttpResource<P, StringKeys<TChildren>>;
56
55
  /** Declare a GET action, optionally with an action-local path segment. */
57
- export declare function get<const P extends string, const T extends RouteSchema>(path: P, schema: RouteDeclaration<T>): HttpAction<P, T, 'GET'>;
58
- export declare function get<const T extends RouteSchema>(schema: RouteDeclaration<T>): HttpAction<'', T, 'GET'>;
56
+ export declare function get<const P extends string, const T extends RouteSchema>(path: P, schema: T): HttpAction<P, T, 'GET'>;
57
+ export declare function get<const T extends RouteSchema>(schema: T): HttpAction<'', T, 'GET'>;
59
58
  /** Declare a POST action, optionally with an action-local path segment. */
60
- export declare function post<const P extends string, const T extends RouteSchema>(path: P, schema: RouteDeclaration<T>): HttpAction<P, T, 'POST'>;
61
- export declare function post<const T extends RouteSchema>(schema: RouteDeclaration<T>): HttpAction<'', T, 'POST'>;
59
+ export declare function post<const P extends string, const T extends RouteSchema>(path: P, schema: T): HttpAction<P, T, 'POST'>;
60
+ export declare function post<const T extends RouteSchema>(schema: T): HttpAction<'', T, 'POST'>;
62
61
  /** Declare a PUT action, optionally with an action-local path segment. */
63
- export declare function put<const P extends string, const T extends RouteSchema>(path: P, schema: RouteDeclaration<T>): HttpAction<P, T, 'PUT'>;
64
- export declare function put<const T extends RouteSchema>(schema: RouteDeclaration<T>): HttpAction<'', T, 'PUT'>;
62
+ export declare function put<const P extends string, const T extends RouteSchema>(path: P, schema: T): HttpAction<P, T, 'PUT'>;
63
+ export declare function put<const T extends RouteSchema>(schema: T): HttpAction<'', T, 'PUT'>;
65
64
  /** Declare a PATCH action, optionally with an action-local path segment. */
66
- export declare function patch<const P extends string, const T extends RouteSchema>(path: P, schema: RouteDeclaration<T>): HttpAction<P, T, 'PATCH'>;
67
- export declare function patch<const T extends RouteSchema>(schema: RouteDeclaration<T>): HttpAction<'', T, 'PATCH'>;
65
+ export declare function patch<const P extends string, const T extends RouteSchema>(path: P, schema: T): HttpAction<P, T, 'PATCH'>;
66
+ export declare function patch<const T extends RouteSchema>(schema: T): HttpAction<'', T, 'PATCH'>;
68
67
  /** Declare a DELETE action, optionally with an action-local path segment. */
69
- declare function deleteAction<const P extends string, const T extends RouteSchema>(path: P, schema: RouteDeclaration<T>): HttpAction<P, T, 'DELETE'>;
70
- declare function deleteAction<const T extends RouteSchema>(schema: RouteDeclaration<T>): HttpAction<'', T, 'DELETE'>;
68
+ declare function deleteAction<const P extends string, const T extends RouteSchema>(path: P, schema: T): HttpAction<P, T, 'DELETE'>;
69
+ declare function deleteAction<const T extends RouteSchema>(schema: T): HttpAction<'', T, 'DELETE'>;
71
70
  export { deleteAction as delete };
72
71
  /**
73
72
  * Declare a request body that is passed through to `fetch` without JSON encoding.
@@ -6,11 +6,8 @@ export type RouteMetadata = {
6
6
  /** Human-readable route description for generated tooling. */
7
7
  description?: string;
8
8
  };
9
- export type RouteMetadataMarker = {
10
- readonly [routeMetadataKey]: RouteMetadata;
11
- };
12
9
  /** Attach runtime metadata to a route declaration. */
13
- export declare function metadata(value: RouteMetadata): RouteMetadataMarker;
10
+ export declare function metadata(value: RouteMetadata): object;
14
11
  export declare function getRouteMetadata(value: unknown): RouteMetadata | undefined;
15
12
  export declare function stripRouteMetadata<T extends object>(value: T): Omit<T, typeof routeMetadataKey>;
16
13
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rouzer",
3
- "version": "5.3.0",
3
+ "version": "5.3.1",
4
4
  "packageManager": "pnpm@11.5.1",
5
5
  "type": "module",
6
6
  "exports": {