@cosmneo/onion-lasagna 0.2.0 → 0.3.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.
Files changed (93) hide show
  1. package/dist/chunk-36IO4BM7.js +113 -0
  2. package/dist/chunk-36IO4BM7.js.map +1 -0
  3. package/dist/chunk-4BVOLXDJ.js +54 -0
  4. package/dist/chunk-4BVOLXDJ.js.map +1 -0
  5. package/dist/{chunk-GGSAAZPM.js → chunk-AUMHMWDD.js} +19 -20
  6. package/dist/chunk-AUMHMWDD.js.map +1 -0
  7. package/dist/chunk-CBTICRSM.js +34 -0
  8. package/dist/chunk-CBTICRSM.js.map +1 -0
  9. package/dist/chunk-H5TNDC5U.js +138 -0
  10. package/dist/chunk-H5TNDC5U.js.map +1 -0
  11. package/dist/chunk-KJ4JGZOE.js +96 -0
  12. package/dist/chunk-KJ4JGZOE.js.map +1 -0
  13. package/dist/chunk-MF2JDREK.js +168 -0
  14. package/dist/chunk-MF2JDREK.js.map +1 -0
  15. package/dist/chunk-RVSBIYY4.js +1 -0
  16. package/dist/chunk-RVSBIYY4.js.map +1 -0
  17. package/dist/{chunk-PUVAB3JX.js → chunk-XIRJ73IO.js} +38 -36
  18. package/dist/chunk-XIRJ73IO.js.map +1 -0
  19. package/dist/{chunk-DS7TE6KZ.js → chunk-XP6PLTV2.js} +11 -3
  20. package/dist/chunk-XP6PLTV2.js.map +1 -0
  21. package/dist/chunk-XWKHOLIP.js +191 -0
  22. package/dist/chunk-XWKHOLIP.js.map +1 -0
  23. package/dist/event-router-definition.type-CP9uTlux.d.cts +150 -0
  24. package/dist/event-router-definition.type-D8CG-kjZ.d.ts +150 -0
  25. package/dist/events/asyncapi/index.cjs +143 -0
  26. package/dist/events/asyncapi/index.cjs.map +1 -0
  27. package/dist/events/asyncapi/index.d.cts +184 -0
  28. package/dist/events/asyncapi/index.d.ts +184 -0
  29. package/dist/events/asyncapi/index.js +8 -0
  30. package/dist/events/asyncapi/index.js.map +1 -0
  31. package/dist/events/handler/index.cjs +171 -0
  32. package/dist/events/handler/index.cjs.map +1 -0
  33. package/dist/events/handler/index.d.cts +153 -0
  34. package/dist/events/handler/index.d.ts +153 -0
  35. package/dist/events/handler/index.js +21 -0
  36. package/dist/events/handler/index.js.map +1 -0
  37. package/dist/events/index.cjs +497 -0
  38. package/dist/events/index.cjs.map +1 -0
  39. package/dist/events/index.d.cts +9 -0
  40. package/dist/events/index.d.ts +9 -0
  41. package/dist/events/index.js +41 -0
  42. package/dist/events/index.js.map +1 -0
  43. package/dist/events/server/index.cjs +291 -0
  44. package/dist/events/server/index.cjs.map +1 -0
  45. package/dist/events/server/index.d.cts +281 -0
  46. package/dist/events/server/index.d.ts +281 -0
  47. package/dist/events/server/index.js +16 -0
  48. package/dist/events/server/index.js.map +1 -0
  49. package/dist/events/shared/index.cjs +85 -0
  50. package/dist/events/shared/index.cjs.map +1 -0
  51. package/dist/events/shared/index.d.cts +35 -0
  52. package/dist/events/shared/index.d.ts +35 -0
  53. package/dist/events/shared/index.js +13 -0
  54. package/dist/events/shared/index.js.map +1 -0
  55. package/dist/global.js +3 -3
  56. package/dist/http/index.cjs +563 -93
  57. package/dist/http/index.cjs.map +1 -1
  58. package/dist/http/index.d.cts +5 -3
  59. package/dist/http/index.d.ts +5 -3
  60. package/dist/http/index.js +30 -12
  61. package/dist/http/openapi/index.cjs +43 -35
  62. package/dist/http/openapi/index.cjs.map +1 -1
  63. package/dist/http/openapi/index.d.cts +8 -34
  64. package/dist/http/openapi/index.d.ts +8 -34
  65. package/dist/http/openapi/index.js +2 -2
  66. package/dist/http/route/index.cjs +106 -9
  67. package/dist/http/route/index.cjs.map +1 -1
  68. package/dist/http/route/index.d.cts +133 -227
  69. package/dist/http/route/index.d.ts +133 -227
  70. package/dist/http/route/index.js +5 -2
  71. package/dist/http/server/index.cjs +24 -19
  72. package/dist/http/server/index.cjs.map +1 -1
  73. package/dist/http/server/index.d.cts +4 -261
  74. package/dist/http/server/index.d.ts +4 -261
  75. package/dist/http/server/index.js +2 -2
  76. package/dist/http/shared/index.cjs.map +1 -1
  77. package/dist/http/shared/index.d.cts +10 -14
  78. package/dist/http/shared/index.d.ts +10 -14
  79. package/dist/http/shared/index.js +11 -127
  80. package/dist/http/shared/index.js.map +1 -1
  81. package/dist/index.js +6 -6
  82. package/dist/{router-definition.type-ynBhT16T.d.cts → router-definition.type-BElX-Pl4.d.cts} +169 -256
  83. package/dist/{router-definition.type-DORVlLNk.d.ts → router-definition.type-DxG8ncJZ.d.ts} +169 -256
  84. package/dist/types-B6Q1iCgf.d.ts +262 -0
  85. package/dist/types-afYpL7Ap.d.cts +262 -0
  86. package/dist/types-cke61juH.d.cts +42 -0
  87. package/dist/types-cke61juH.d.ts +42 -0
  88. package/package.json +35 -2
  89. package/dist/chunk-BZULBF4N.js +0 -82
  90. package/dist/chunk-BZULBF4N.js.map +0 -1
  91. package/dist/chunk-DS7TE6KZ.js.map +0 -1
  92. package/dist/chunk-GGSAAZPM.js.map +0 -1
  93. package/dist/chunk-PUVAB3JX.js.map +0 -1
@@ -1,265 +1,8 @@
1
- import { R as RouteDefinition, H as HttpMethod, j as RouterConfig, m as RouterKeys, G as GetRoute, k as RouterDefinition } from '../../router-definition.type-ynBhT16T.cjs';
1
+ import { d as RouterConfig, e as RouterDefinition, g as RouterKeys, G as GetRoute, R as RouteDefinition } from '../../router-definition.type-BElX-Pl4.cjs';
2
+ import { d as SimpleHandlerFn, e as SimpleHandlerConfig, V as ValidatedRequest, T as TypedContext, U as UseCasePort, a as HandlerResponse, M as MiddlewareFunction, C as CreateServerRoutesOptions, b as UnifiedRouteInput } from '../../types-afYpL7Ap.cjs';
3
+ export { H as HandlerContext, c as RawHttpRequest, R as RouteHandlerConfig, S as ServerRoutesConfig } from '../../types-afYpL7Ap.cjs';
2
4
  import '../schema/types.cjs';
3
5
 
4
- /**
5
- * @fileoverview Server types for the unified route system.
6
- *
7
- * @module unified/server/types
8
- */
9
-
10
- /**
11
- * A validated request with typed data.
12
- * This is what handlers receive after validation passes.
13
- */
14
- interface ValidatedRequest<TRoute extends RouteDefinition> {
15
- /**
16
- * Validated request body.
17
- */
18
- readonly body: TRoute['_types']['body'];
19
- /**
20
- * Validated query parameters.
21
- */
22
- readonly query: TRoute['_types']['query'];
23
- /**
24
- * Validated path parameters.
25
- */
26
- readonly pathParams: TRoute['_types']['pathParams'];
27
- /**
28
- * Validated headers.
29
- */
30
- readonly headers: TRoute['_types']['headers'];
31
- /**
32
- * Raw request object for advanced use cases.
33
- */
34
- readonly raw: {
35
- readonly method: string;
36
- readonly url: string;
37
- readonly headers: Record<string, string>;
38
- };
39
- }
40
- /**
41
- * Typed context based on route definition.
42
- * If the route defines a context schema, this will be the validated type.
43
- * Otherwise, it falls back to the generic HandlerContext.
44
- */
45
- type TypedContext<TRoute extends RouteDefinition> = TRoute['_types']['context'] extends undefined ? HandlerContext : TRoute['_types']['context'];
46
- /**
47
- * Context passed to handlers.
48
- * Can be extended with custom context via serverRoutes options.
49
- */
50
- interface HandlerContext {
51
- /**
52
- * Request ID for tracing.
53
- */
54
- readonly requestId?: string;
55
- /**
56
- * Additional context data.
57
- */
58
- readonly [key: string]: unknown;
59
- }
60
- /**
61
- * Response from a handler.
62
- */
63
- interface HandlerResponse<TData = unknown> {
64
- /**
65
- * HTTP status code.
66
- */
67
- readonly status: number;
68
- /**
69
- * Response body.
70
- */
71
- readonly body?: TData;
72
- /**
73
- * Response headers.
74
- */
75
- readonly headers?: Record<string, string>;
76
- }
77
- /**
78
- * Use case port interface for unified routes.
79
- *
80
- * This is a simplified version that accepts any input/output types (plain objects).
81
- * It's structurally compatible with `BaseInboundPort`, so existing use case
82
- * implementations work without changes.
83
- *
84
- * @typeParam TInput - Input type (plain object or void for no input)
85
- * @typeParam TOutput - Output type (plain object or void for no output)
86
- *
87
- * @example
88
- * ```typescript
89
- * // Define plain types for use case contracts
90
- * type CreateProjectInput = {
91
- * name: string;
92
- * description?: string;
93
- * };
94
- *
95
- * type CreateProjectOutput = {
96
- * projectId: string;
97
- * };
98
- *
99
- * // Use case implements this interface
100
- * class CreateProjectUseCase implements UseCasePort<CreateProjectInput, CreateProjectOutput> {
101
- * async execute(input: CreateProjectInput): Promise<CreateProjectOutput> {
102
- * // ... implementation
103
- * return { projectId: '...' };
104
- * }
105
- * }
106
- * ```
107
- */
108
- interface UseCasePort<TInput = void, TOutput = void> {
109
- execute(input?: TInput): Promise<TOutput>;
110
- }
111
- /**
112
- * Handler configuration for a single route.
113
- *
114
- * Mirrors the BaseController pattern with three components:
115
- * - `requestMapper`: Maps validated HTTP request to use case input
116
- * - `useCase`: The use case to execute
117
- * - `responseMapper`: Maps use case output to HTTP response
118
- *
119
- * @typeParam TRoute - The route definition type
120
- * @typeParam TInput - Use case input type (plain object)
121
- * @typeParam TOutput - Use case output type (plain object)
122
- *
123
- * @example
124
- * ```typescript
125
- * const config: RouteHandlerConfig<typeof createProjectRoute, CreateProjectInput, CreateProjectOutput> = {
126
- * requestMapper: (req) => ({
127
- * name: req.body.name,
128
- * description: req.body.description,
129
- * }),
130
- * useCase: createProjectUseCase,
131
- * responseMapper: (out) => ({
132
- * status: 201,
133
- * body: { projectId: out.projectId },
134
- * }),
135
- * };
136
- * ```
137
- */
138
- interface RouteHandlerConfig<TRoute extends RouteDefinition, TInput = void, TOutput = void> {
139
- /**
140
- * Maps the validated HTTP request to use case input.
141
- * The request has already been validated by the route's schemas.
142
- * Context is typed based on the route's context schema (if defined).
143
- */
144
- readonly requestMapper: (req: ValidatedRequest<TRoute>, ctx: TypedContext<TRoute>) => TInput;
145
- /**
146
- * The use case to execute.
147
- * Can be any object with an `execute` method matching `UseCasePort`.
148
- */
149
- readonly useCase: UseCasePort<TInput, TOutput>;
150
- /**
151
- * Maps the use case output to an HTTP response.
152
- * Determines the status code and response body.
153
- */
154
- readonly responseMapper: (output: TOutput) => HandlerResponse;
155
- /**
156
- * Middleware to run before the handler.
157
- */
158
- readonly middleware?: readonly MiddlewareFunction[];
159
- }
160
- /**
161
- * Middleware function type.
162
- */
163
- type MiddlewareFunction = (request: unknown, context: HandlerContext, next: () => Promise<HandlerResponse>) => Promise<HandlerResponse>;
164
- /**
165
- * Simple handler function that directly returns a response.
166
- * Use this for simple routes that don't need the use case pattern.
167
- */
168
- type SimpleHandlerFn<TRoute extends RouteDefinition> = (req: ValidatedRequest<TRoute>, ctx: TypedContext<TRoute>) => Promise<HandlerResponse> | HandlerResponse;
169
- /**
170
- * Configuration for a simple handler (no use case).
171
- */
172
- interface SimpleHandlerConfig<TRoute extends RouteDefinition> {
173
- readonly handler: SimpleHandlerFn<TRoute>;
174
- readonly middleware?: readonly MiddlewareFunction[];
175
- }
176
- /**
177
- * Configuration mapping route keys to handlers.
178
- *
179
- * Each route key maps to a `RouteHandlerConfig` with:
180
- * - The route definition for that key (provides request/response types)
181
- * - User-defined input/output types for the use case
182
- *
183
- * The `TInput` and `TOutput` types are inferred from the `useCase` property,
184
- * so you don't need to specify them explicitly.
185
- */
186
- type ServerRoutesConfig<T extends RouterConfig> = {
187
- [K in RouterKeys<T>]: RouteHandlerConfig<GetRoute<T, K>, any, any>;
188
- };
189
- /**
190
- * Options for creating server routes.
191
- */
192
- interface CreateServerRoutesOptions {
193
- /**
194
- * Global middleware to run before all handlers.
195
- */
196
- readonly middleware?: readonly MiddlewareFunction[];
197
- /**
198
- * Whether to validate incoming requests against route schemas.
199
- * When enabled, invalid requests throw InvalidRequestError.
200
- * @default true
201
- */
202
- readonly validateRequest?: boolean;
203
- /**
204
- * Whether to validate outgoing responses against route schemas.
205
- * When enabled, invalid responses throw ControllerError.
206
- * Useful for catching bugs and ensuring API contract compliance.
207
- * @default true
208
- */
209
- readonly validateResponse?: boolean;
210
- /**
211
- * Context factory to create handler context.
212
- */
213
- readonly createContext?: (rawRequest: unknown) => HandlerContext;
214
- /**
215
- * Allow partial handler configuration (not all routes need handlers).
216
- * When true, missing handlers are silently skipped.
217
- * When false (default), missing handlers throw an error.
218
- * @default false
219
- * @internal Used by builder pattern's buildPartial()
220
- */
221
- readonly allowPartial?: boolean;
222
- }
223
- /**
224
- * Route input compatible with framework adapters.
225
- * This is the output of serverRoutes().build().
226
- */
227
- interface UnifiedRouteInput {
228
- /**
229
- * HTTP method.
230
- */
231
- readonly method: HttpMethod;
232
- /**
233
- * URL path pattern.
234
- */
235
- readonly path: string;
236
- /**
237
- * Handler function.
238
- */
239
- readonly handler: (rawRequest: RawHttpRequest, context?: HandlerContext) => Promise<HandlerResponse>;
240
- /**
241
- * Route metadata for documentation.
242
- */
243
- readonly metadata: {
244
- readonly operationId?: string;
245
- readonly summary?: string;
246
- readonly description?: string;
247
- readonly tags?: readonly string[];
248
- readonly deprecated?: boolean;
249
- };
250
- }
251
- /**
252
- * Raw HTTP request from the framework.
253
- */
254
- interface RawHttpRequest {
255
- readonly method: string;
256
- readonly url: string;
257
- readonly headers: Record<string, string | string[] | undefined>;
258
- readonly body?: unknown;
259
- readonly query?: Record<string, string | string[] | undefined>;
260
- readonly params?: Record<string, string>;
261
- }
262
-
263
6
  /**
264
7
  * @fileoverview Builder pattern for creating type-safe server routes.
265
8
  *
@@ -442,4 +185,4 @@ interface ServerRoutesBuilder<T extends RouterConfig, THandled extends string =
442
185
  */
443
186
  declare function serverRoutes<T extends RouterConfig>(router: T | RouterDefinition<T>): ServerRoutesBuilder<T, never>;
444
187
 
445
- export { type BuilderHandlerConfig, type CreateServerRoutesOptions, type HandlerContext, type HandlerResponse, type MiddlewareFunction, type MissingHandlersError, type RawHttpRequest, type RouteHandlerConfig, type ServerRoutesBuilder, type ServerRoutesConfig, type TypedContext, type UnifiedRouteInput, type UseCasePort, type ValidatedRequest, serverRoutes };
188
+ export { type BuilderHandlerConfig, CreateServerRoutesOptions, HandlerResponse, MiddlewareFunction, type MissingHandlersError, type ServerRoutesBuilder, TypedContext, UnifiedRouteInput, UseCasePort, ValidatedRequest, serverRoutes };
@@ -1,265 +1,8 @@
1
- import { R as RouteDefinition, H as HttpMethod, j as RouterConfig, m as RouterKeys, G as GetRoute, k as RouterDefinition } from '../../router-definition.type-DORVlLNk.js';
1
+ import { d as RouterConfig, e as RouterDefinition, g as RouterKeys, G as GetRoute, R as RouteDefinition } from '../../router-definition.type-DxG8ncJZ.js';
2
+ import { d as SimpleHandlerFn, e as SimpleHandlerConfig, V as ValidatedRequest, T as TypedContext, U as UseCasePort, a as HandlerResponse, M as MiddlewareFunction, C as CreateServerRoutesOptions, b as UnifiedRouteInput } from '../../types-B6Q1iCgf.js';
3
+ export { H as HandlerContext, c as RawHttpRequest, R as RouteHandlerConfig, S as ServerRoutesConfig } from '../../types-B6Q1iCgf.js';
2
4
  import '../schema/types.js';
3
5
 
4
- /**
5
- * @fileoverview Server types for the unified route system.
6
- *
7
- * @module unified/server/types
8
- */
9
-
10
- /**
11
- * A validated request with typed data.
12
- * This is what handlers receive after validation passes.
13
- */
14
- interface ValidatedRequest<TRoute extends RouteDefinition> {
15
- /**
16
- * Validated request body.
17
- */
18
- readonly body: TRoute['_types']['body'];
19
- /**
20
- * Validated query parameters.
21
- */
22
- readonly query: TRoute['_types']['query'];
23
- /**
24
- * Validated path parameters.
25
- */
26
- readonly pathParams: TRoute['_types']['pathParams'];
27
- /**
28
- * Validated headers.
29
- */
30
- readonly headers: TRoute['_types']['headers'];
31
- /**
32
- * Raw request object for advanced use cases.
33
- */
34
- readonly raw: {
35
- readonly method: string;
36
- readonly url: string;
37
- readonly headers: Record<string, string>;
38
- };
39
- }
40
- /**
41
- * Typed context based on route definition.
42
- * If the route defines a context schema, this will be the validated type.
43
- * Otherwise, it falls back to the generic HandlerContext.
44
- */
45
- type TypedContext<TRoute extends RouteDefinition> = TRoute['_types']['context'] extends undefined ? HandlerContext : TRoute['_types']['context'];
46
- /**
47
- * Context passed to handlers.
48
- * Can be extended with custom context via serverRoutes options.
49
- */
50
- interface HandlerContext {
51
- /**
52
- * Request ID for tracing.
53
- */
54
- readonly requestId?: string;
55
- /**
56
- * Additional context data.
57
- */
58
- readonly [key: string]: unknown;
59
- }
60
- /**
61
- * Response from a handler.
62
- */
63
- interface HandlerResponse<TData = unknown> {
64
- /**
65
- * HTTP status code.
66
- */
67
- readonly status: number;
68
- /**
69
- * Response body.
70
- */
71
- readonly body?: TData;
72
- /**
73
- * Response headers.
74
- */
75
- readonly headers?: Record<string, string>;
76
- }
77
- /**
78
- * Use case port interface for unified routes.
79
- *
80
- * This is a simplified version that accepts any input/output types (plain objects).
81
- * It's structurally compatible with `BaseInboundPort`, so existing use case
82
- * implementations work without changes.
83
- *
84
- * @typeParam TInput - Input type (plain object or void for no input)
85
- * @typeParam TOutput - Output type (plain object or void for no output)
86
- *
87
- * @example
88
- * ```typescript
89
- * // Define plain types for use case contracts
90
- * type CreateProjectInput = {
91
- * name: string;
92
- * description?: string;
93
- * };
94
- *
95
- * type CreateProjectOutput = {
96
- * projectId: string;
97
- * };
98
- *
99
- * // Use case implements this interface
100
- * class CreateProjectUseCase implements UseCasePort<CreateProjectInput, CreateProjectOutput> {
101
- * async execute(input: CreateProjectInput): Promise<CreateProjectOutput> {
102
- * // ... implementation
103
- * return { projectId: '...' };
104
- * }
105
- * }
106
- * ```
107
- */
108
- interface UseCasePort<TInput = void, TOutput = void> {
109
- execute(input?: TInput): Promise<TOutput>;
110
- }
111
- /**
112
- * Handler configuration for a single route.
113
- *
114
- * Mirrors the BaseController pattern with three components:
115
- * - `requestMapper`: Maps validated HTTP request to use case input
116
- * - `useCase`: The use case to execute
117
- * - `responseMapper`: Maps use case output to HTTP response
118
- *
119
- * @typeParam TRoute - The route definition type
120
- * @typeParam TInput - Use case input type (plain object)
121
- * @typeParam TOutput - Use case output type (plain object)
122
- *
123
- * @example
124
- * ```typescript
125
- * const config: RouteHandlerConfig<typeof createProjectRoute, CreateProjectInput, CreateProjectOutput> = {
126
- * requestMapper: (req) => ({
127
- * name: req.body.name,
128
- * description: req.body.description,
129
- * }),
130
- * useCase: createProjectUseCase,
131
- * responseMapper: (out) => ({
132
- * status: 201,
133
- * body: { projectId: out.projectId },
134
- * }),
135
- * };
136
- * ```
137
- */
138
- interface RouteHandlerConfig<TRoute extends RouteDefinition, TInput = void, TOutput = void> {
139
- /**
140
- * Maps the validated HTTP request to use case input.
141
- * The request has already been validated by the route's schemas.
142
- * Context is typed based on the route's context schema (if defined).
143
- */
144
- readonly requestMapper: (req: ValidatedRequest<TRoute>, ctx: TypedContext<TRoute>) => TInput;
145
- /**
146
- * The use case to execute.
147
- * Can be any object with an `execute` method matching `UseCasePort`.
148
- */
149
- readonly useCase: UseCasePort<TInput, TOutput>;
150
- /**
151
- * Maps the use case output to an HTTP response.
152
- * Determines the status code and response body.
153
- */
154
- readonly responseMapper: (output: TOutput) => HandlerResponse;
155
- /**
156
- * Middleware to run before the handler.
157
- */
158
- readonly middleware?: readonly MiddlewareFunction[];
159
- }
160
- /**
161
- * Middleware function type.
162
- */
163
- type MiddlewareFunction = (request: unknown, context: HandlerContext, next: () => Promise<HandlerResponse>) => Promise<HandlerResponse>;
164
- /**
165
- * Simple handler function that directly returns a response.
166
- * Use this for simple routes that don't need the use case pattern.
167
- */
168
- type SimpleHandlerFn<TRoute extends RouteDefinition> = (req: ValidatedRequest<TRoute>, ctx: TypedContext<TRoute>) => Promise<HandlerResponse> | HandlerResponse;
169
- /**
170
- * Configuration for a simple handler (no use case).
171
- */
172
- interface SimpleHandlerConfig<TRoute extends RouteDefinition> {
173
- readonly handler: SimpleHandlerFn<TRoute>;
174
- readonly middleware?: readonly MiddlewareFunction[];
175
- }
176
- /**
177
- * Configuration mapping route keys to handlers.
178
- *
179
- * Each route key maps to a `RouteHandlerConfig` with:
180
- * - The route definition for that key (provides request/response types)
181
- * - User-defined input/output types for the use case
182
- *
183
- * The `TInput` and `TOutput` types are inferred from the `useCase` property,
184
- * so you don't need to specify them explicitly.
185
- */
186
- type ServerRoutesConfig<T extends RouterConfig> = {
187
- [K in RouterKeys<T>]: RouteHandlerConfig<GetRoute<T, K>, any, any>;
188
- };
189
- /**
190
- * Options for creating server routes.
191
- */
192
- interface CreateServerRoutesOptions {
193
- /**
194
- * Global middleware to run before all handlers.
195
- */
196
- readonly middleware?: readonly MiddlewareFunction[];
197
- /**
198
- * Whether to validate incoming requests against route schemas.
199
- * When enabled, invalid requests throw InvalidRequestError.
200
- * @default true
201
- */
202
- readonly validateRequest?: boolean;
203
- /**
204
- * Whether to validate outgoing responses against route schemas.
205
- * When enabled, invalid responses throw ControllerError.
206
- * Useful for catching bugs and ensuring API contract compliance.
207
- * @default true
208
- */
209
- readonly validateResponse?: boolean;
210
- /**
211
- * Context factory to create handler context.
212
- */
213
- readonly createContext?: (rawRequest: unknown) => HandlerContext;
214
- /**
215
- * Allow partial handler configuration (not all routes need handlers).
216
- * When true, missing handlers are silently skipped.
217
- * When false (default), missing handlers throw an error.
218
- * @default false
219
- * @internal Used by builder pattern's buildPartial()
220
- */
221
- readonly allowPartial?: boolean;
222
- }
223
- /**
224
- * Route input compatible with framework adapters.
225
- * This is the output of serverRoutes().build().
226
- */
227
- interface UnifiedRouteInput {
228
- /**
229
- * HTTP method.
230
- */
231
- readonly method: HttpMethod;
232
- /**
233
- * URL path pattern.
234
- */
235
- readonly path: string;
236
- /**
237
- * Handler function.
238
- */
239
- readonly handler: (rawRequest: RawHttpRequest, context?: HandlerContext) => Promise<HandlerResponse>;
240
- /**
241
- * Route metadata for documentation.
242
- */
243
- readonly metadata: {
244
- readonly operationId?: string;
245
- readonly summary?: string;
246
- readonly description?: string;
247
- readonly tags?: readonly string[];
248
- readonly deprecated?: boolean;
249
- };
250
- }
251
- /**
252
- * Raw HTTP request from the framework.
253
- */
254
- interface RawHttpRequest {
255
- readonly method: string;
256
- readonly url: string;
257
- readonly headers: Record<string, string | string[] | undefined>;
258
- readonly body?: unknown;
259
- readonly query?: Record<string, string | string[] | undefined>;
260
- readonly params?: Record<string, string>;
261
- }
262
-
263
6
  /**
264
7
  * @fileoverview Builder pattern for creating type-safe server routes.
265
8
  *
@@ -442,4 +185,4 @@ interface ServerRoutesBuilder<T extends RouterConfig, THandled extends string =
442
185
  */
443
186
  declare function serverRoutes<T extends RouterConfig>(router: T | RouterDefinition<T>): ServerRoutesBuilder<T, never>;
444
187
 
445
- export { type BuilderHandlerConfig, type CreateServerRoutesOptions, type HandlerContext, type HandlerResponse, type MiddlewareFunction, type MissingHandlersError, type RawHttpRequest, type RouteHandlerConfig, type ServerRoutesBuilder, type ServerRoutesConfig, type TypedContext, type UnifiedRouteInput, type UseCasePort, type ValidatedRequest, serverRoutes };
188
+ export { type BuilderHandlerConfig, CreateServerRoutesOptions, HandlerResponse, MiddlewareFunction, type MissingHandlersError, type ServerRoutesBuilder, TypedContext, UnifiedRouteInput, UseCasePort, ValidatedRequest, serverRoutes };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  serverRoutes
3
- } from "../../chunk-GGSAAZPM.js";
3
+ } from "../../chunk-AUMHMWDD.js";
4
4
  import "../../chunk-T7S574XQ.js";
5
5
  import "../../chunk-ZG26OQFN.js";
6
6
  import "../../chunk-A4JUAZK4.js";
7
- import "../../chunk-DS7TE6KZ.js";
7
+ import "../../chunk-XP6PLTV2.js";
8
8
  export {
9
9
  serverRoutes
10
10
  };