@webstir-io/module-contract 0.1.13

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.
@@ -0,0 +1,1517 @@
1
+ import { z } from 'zod';
2
+ export declare const CONTRACT_VERSION: "1.0.0";
3
+ export declare const contractVersionLiteral: z.ZodLiteral<"1.0.0">;
4
+ export type ModuleKind = 'frontend' | 'backend';
5
+ export interface ModuleCompatibility {
6
+ readonly minCliVersion: string;
7
+ readonly maxCliVersion?: string;
8
+ readonly nodeRange: string;
9
+ readonly notes?: string;
10
+ }
11
+ export interface ModuleProviderMetadata {
12
+ readonly id: string;
13
+ readonly kind: ModuleKind;
14
+ readonly version: string;
15
+ readonly compatibility: ModuleCompatibility;
16
+ }
17
+ export interface ResolveWorkspaceOptions {
18
+ readonly workspaceRoot: string;
19
+ readonly config: Record<string, unknown>;
20
+ }
21
+ export interface ResolvedModuleWorkspace {
22
+ readonly sourceRoot: string;
23
+ readonly buildRoot: string;
24
+ readonly testsRoot?: string;
25
+ }
26
+ export interface ModuleBuildOptions {
27
+ readonly workspaceRoot: string;
28
+ readonly env: Record<string, string | undefined>;
29
+ readonly incremental?: boolean;
30
+ }
31
+ export interface ModuleDiagnostic {
32
+ readonly severity: 'info' | 'warn' | 'error';
33
+ readonly message: string;
34
+ readonly file?: string;
35
+ }
36
+ export interface ModuleBuildManifest {
37
+ readonly entryPoints: readonly string[];
38
+ readonly staticAssets: readonly string[];
39
+ readonly diagnostics: readonly ModuleDiagnostic[];
40
+ readonly module?: ModuleManifest;
41
+ }
42
+ export interface ModuleArtifact {
43
+ readonly path: string;
44
+ readonly type: 'asset' | 'bundle' | 'metadata';
45
+ }
46
+ export interface ModuleBuildResult {
47
+ readonly artifacts: readonly ModuleArtifact[];
48
+ readonly manifest: ModuleBuildManifest;
49
+ }
50
+ export interface ModuleAsset {
51
+ readonly sourcePath: string;
52
+ readonly targetPath: string;
53
+ }
54
+ export interface ModuleProvider {
55
+ readonly metadata: ModuleProviderMetadata;
56
+ resolveWorkspace(options: ResolveWorkspaceOptions): Promise<ResolvedModuleWorkspace> | ResolvedModuleWorkspace;
57
+ build(options: ModuleBuildOptions): Promise<ModuleBuildResult> | ModuleBuildResult;
58
+ getScaffoldAssets?(): Promise<readonly ModuleAsset[]> | readonly ModuleAsset[];
59
+ }
60
+ export declare const moduleKindSchema: z.ZodEnum<["frontend", "backend"]>;
61
+ export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
62
+ export declare const logLevelSchema: z.ZodEnum<["trace", "debug", "info", "warn", "error", "fatal"]>;
63
+ export interface Logger {
64
+ readonly level: LogLevel;
65
+ log(level: LogLevel, message: string, metadata?: Record<string, unknown>): void;
66
+ debug(message: string, metadata?: Record<string, unknown>): void;
67
+ info(message: string, metadata?: Record<string, unknown>): void;
68
+ warn(message: string, metadata?: Record<string, unknown>): void;
69
+ error(message: string, metadata?: Record<string, unknown>): void;
70
+ with(bindings: Record<string, unknown>): Logger;
71
+ }
72
+ export interface EnvAccessor {
73
+ get(name: string): string | undefined;
74
+ require(name: string): string;
75
+ entries(): Record<string, string | undefined>;
76
+ }
77
+ export interface RequestContext<TRequest = unknown, TReply = unknown, TAuth = unknown, TSession = unknown, TDatabase = unknown, TEnv extends EnvAccessor = EnvAccessor, TLogger extends Logger = Logger> {
78
+ readonly request: TRequest;
79
+ readonly reply: TReply;
80
+ readonly auth: TAuth;
81
+ readonly session: TSession | null;
82
+ readonly db: TDatabase;
83
+ readonly env: TEnv;
84
+ readonly logger: TLogger;
85
+ readonly requestId: string;
86
+ readonly now: () => Date;
87
+ }
88
+ export interface SSRContext<TParams = Record<string, string>, TAuth = unknown, TSession = unknown, TEnv extends EnvAccessor = EnvAccessor, TLogger extends Logger = Logger> {
89
+ readonly url: URL;
90
+ readonly params: TParams;
91
+ readonly cookies: Record<string, string>;
92
+ readonly headers: Record<string, string>;
93
+ readonly auth: TAuth;
94
+ readonly session: TSession | null;
95
+ readonly env: TEnv;
96
+ readonly logger: TLogger;
97
+ readonly requestId?: string;
98
+ readonly now: () => Date;
99
+ }
100
+ export interface AuthSession<TData = Record<string, unknown>> {
101
+ readonly id: string;
102
+ readonly userId?: string;
103
+ readonly data: TData;
104
+ readonly createdAt: Date;
105
+ readonly expiresAt?: Date;
106
+ }
107
+ export interface CreateSessionInput<TData = Record<string, unknown>> {
108
+ readonly userId?: string;
109
+ readonly data: TData;
110
+ readonly expiresInSeconds?: number;
111
+ }
112
+ export type PermissionCheckResult = {
113
+ readonly allowed: true;
114
+ } | {
115
+ readonly allowed: false;
116
+ readonly reason?: string;
117
+ };
118
+ export interface AuthProvider<TSession extends AuthSession = AuthSession> {
119
+ getSession(context: RequestContext | SSRContext): Promise<TSession | null> | TSession | null;
120
+ createSession(input: CreateSessionInput<TSession['data']>, context: RequestContext | SSRContext): Promise<TSession> | TSession;
121
+ invalidateSession(sessionId: string, context: RequestContext | SSRContext): Promise<void> | void;
122
+ getCsrfToken?(context: RequestContext | SSRContext): Promise<string> | string;
123
+ verifyPermissions?(context: RequestContext | SSRContext, permissions: readonly string[]): Promise<PermissionCheckResult> | PermissionCheckResult;
124
+ }
125
+ export interface DatabaseTransaction<TDatabase = unknown> {
126
+ readonly run: <TResult>(callback: (client: TDatabase) => Promise<TResult> | TResult) => Promise<TResult>;
127
+ }
128
+ export interface DatabaseProvider<TDatabase = unknown> {
129
+ readonly client: TDatabase;
130
+ transaction?(): DatabaseTransaction<TDatabase>;
131
+ }
132
+ export interface CacheProvider<TKey = string, TValue = unknown> {
133
+ get(key: TKey): Promise<TValue | undefined> | TValue | undefined;
134
+ set(key: TKey, value: TValue, options?: {
135
+ readonly ttlSeconds?: number;
136
+ }): Promise<void> | void;
137
+ delete(key: TKey): Promise<void> | void;
138
+ }
139
+ export interface QueueMessage<TPayload = unknown> {
140
+ readonly id: string;
141
+ readonly payload: TPayload;
142
+ readonly attempts: number;
143
+ readonly enqueuedAt: Date;
144
+ }
145
+ export interface QueueProvider<TPayload = unknown> {
146
+ enqueue(payload: TPayload, options?: {
147
+ readonly delaySeconds?: number;
148
+ }): Promise<string> | string;
149
+ process(handler: (message: QueueMessage<TPayload>) => Promise<void> | void): Promise<void> | void;
150
+ }
151
+ export interface TestingManifest {
152
+ readonly name: string;
153
+ readonly version: string;
154
+ readonly capabilities: readonly string[];
155
+ }
156
+ export interface TestingProvider {
157
+ readonly manifest: TestingManifest;
158
+ run(options: {
159
+ readonly workspaceRoot: string;
160
+ readonly env: Record<string, string | undefined>;
161
+ }): Promise<void> | void;
162
+ }
163
+ export declare const moduleErrorCodeSchema: z.ZodEnum<["validation", "auth", "not_found", "domain", "conflict", "internal"]>;
164
+ export type ModuleErrorCode = z.infer<typeof moduleErrorCodeSchema>;
165
+ export declare const moduleErrorSchema: z.ZodObject<{
166
+ code: z.ZodEnum<["validation", "auth", "not_found", "domain", "conflict", "internal"]>;
167
+ message: z.ZodString;
168
+ details: z.ZodOptional<z.ZodUnknown>;
169
+ cause: z.ZodOptional<z.ZodUnknown>;
170
+ correlationId: z.ZodOptional<z.ZodString>;
171
+ }, "strip", z.ZodTypeAny, {
172
+ code: "validation" | "auth" | "not_found" | "domain" | "conflict" | "internal";
173
+ message: string;
174
+ details?: unknown;
175
+ cause?: unknown;
176
+ correlationId?: string | undefined;
177
+ }, {
178
+ code: "validation" | "auth" | "not_found" | "domain" | "conflict" | "internal";
179
+ message: string;
180
+ details?: unknown;
181
+ cause?: unknown;
182
+ correlationId?: string | undefined;
183
+ }>;
184
+ export type ModuleError = z.infer<typeof moduleErrorSchema>;
185
+ export declare const httpMethodSchema: z.ZodEnum<["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]>;
186
+ export type HttpMethod = z.infer<typeof httpMethodSchema>;
187
+ export declare const schemaReferenceSchema: z.ZodObject<{
188
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
189
+ name: z.ZodString;
190
+ source: z.ZodOptional<z.ZodString>;
191
+ }, "strip", z.ZodTypeAny, {
192
+ kind: "zod" | "json-schema" | "ts-rest";
193
+ name: string;
194
+ source?: string | undefined;
195
+ }, {
196
+ name: string;
197
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
198
+ source?: string | undefined;
199
+ }>;
200
+ export type SchemaReference = z.infer<typeof schemaReferenceSchema>;
201
+ export declare const routeInputSchema: z.ZodObject<{
202
+ params: z.ZodOptional<z.ZodOptional<z.ZodObject<{
203
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
204
+ name: z.ZodString;
205
+ source: z.ZodOptional<z.ZodString>;
206
+ }, "strip", z.ZodTypeAny, {
207
+ kind: "zod" | "json-schema" | "ts-rest";
208
+ name: string;
209
+ source?: string | undefined;
210
+ }, {
211
+ name: string;
212
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
213
+ source?: string | undefined;
214
+ }>>>;
215
+ query: z.ZodOptional<z.ZodOptional<z.ZodObject<{
216
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
217
+ name: z.ZodString;
218
+ source: z.ZodOptional<z.ZodString>;
219
+ }, "strip", z.ZodTypeAny, {
220
+ kind: "zod" | "json-schema" | "ts-rest";
221
+ name: string;
222
+ source?: string | undefined;
223
+ }, {
224
+ name: string;
225
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
226
+ source?: string | undefined;
227
+ }>>>;
228
+ body: z.ZodOptional<z.ZodOptional<z.ZodObject<{
229
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
230
+ name: z.ZodString;
231
+ source: z.ZodOptional<z.ZodString>;
232
+ }, "strip", z.ZodTypeAny, {
233
+ kind: "zod" | "json-schema" | "ts-rest";
234
+ name: string;
235
+ source?: string | undefined;
236
+ }, {
237
+ name: string;
238
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
239
+ source?: string | undefined;
240
+ }>>>;
241
+ headers: z.ZodOptional<z.ZodOptional<z.ZodObject<{
242
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
243
+ name: z.ZodString;
244
+ source: z.ZodOptional<z.ZodString>;
245
+ }, "strip", z.ZodTypeAny, {
246
+ kind: "zod" | "json-schema" | "ts-rest";
247
+ name: string;
248
+ source?: string | undefined;
249
+ }, {
250
+ name: string;
251
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
252
+ source?: string | undefined;
253
+ }>>>;
254
+ }, "strict", z.ZodTypeAny, {
255
+ params?: {
256
+ kind: "zod" | "json-schema" | "ts-rest";
257
+ name: string;
258
+ source?: string | undefined;
259
+ } | undefined;
260
+ query?: {
261
+ kind: "zod" | "json-schema" | "ts-rest";
262
+ name: string;
263
+ source?: string | undefined;
264
+ } | undefined;
265
+ body?: {
266
+ kind: "zod" | "json-schema" | "ts-rest";
267
+ name: string;
268
+ source?: string | undefined;
269
+ } | undefined;
270
+ headers?: {
271
+ kind: "zod" | "json-schema" | "ts-rest";
272
+ name: string;
273
+ source?: string | undefined;
274
+ } | undefined;
275
+ }, {
276
+ params?: {
277
+ name: string;
278
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
279
+ source?: string | undefined;
280
+ } | undefined;
281
+ query?: {
282
+ name: string;
283
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
284
+ source?: string | undefined;
285
+ } | undefined;
286
+ body?: {
287
+ name: string;
288
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
289
+ source?: string | undefined;
290
+ } | undefined;
291
+ headers?: {
292
+ name: string;
293
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
294
+ source?: string | undefined;
295
+ } | undefined;
296
+ }>;
297
+ export type RouteInputDefinition = z.infer<typeof routeInputSchema>;
298
+ export declare const routeOutputSchema: z.ZodObject<{
299
+ body: z.ZodObject<{
300
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
301
+ name: z.ZodString;
302
+ source: z.ZodOptional<z.ZodString>;
303
+ }, "strip", z.ZodTypeAny, {
304
+ kind: "zod" | "json-schema" | "ts-rest";
305
+ name: string;
306
+ source?: string | undefined;
307
+ }, {
308
+ name: string;
309
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
310
+ source?: string | undefined;
311
+ }>;
312
+ status: z.ZodOptional<z.ZodNumber>;
313
+ headers: z.ZodOptional<z.ZodObject<{
314
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
315
+ name: z.ZodString;
316
+ source: z.ZodOptional<z.ZodString>;
317
+ }, "strip", z.ZodTypeAny, {
318
+ kind: "zod" | "json-schema" | "ts-rest";
319
+ name: string;
320
+ source?: string | undefined;
321
+ }, {
322
+ name: string;
323
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
324
+ source?: string | undefined;
325
+ }>>;
326
+ }, "strip", z.ZodTypeAny, {
327
+ body: {
328
+ kind: "zod" | "json-schema" | "ts-rest";
329
+ name: string;
330
+ source?: string | undefined;
331
+ };
332
+ status?: number | undefined;
333
+ headers?: {
334
+ kind: "zod" | "json-schema" | "ts-rest";
335
+ name: string;
336
+ source?: string | undefined;
337
+ } | undefined;
338
+ }, {
339
+ body: {
340
+ name: string;
341
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
342
+ source?: string | undefined;
343
+ };
344
+ status?: number | undefined;
345
+ headers?: {
346
+ name: string;
347
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
348
+ source?: string | undefined;
349
+ } | undefined;
350
+ }>;
351
+ export type RouteOutputDefinition = z.infer<typeof routeOutputSchema>;
352
+ export declare const routeDefinitionSchema: z.ZodObject<{
353
+ name: z.ZodString;
354
+ method: z.ZodEnum<["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]>;
355
+ path: z.ZodString;
356
+ summary: z.ZodOptional<z.ZodString>;
357
+ description: z.ZodOptional<z.ZodString>;
358
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
359
+ input: z.ZodOptional<z.ZodObject<{
360
+ params: z.ZodOptional<z.ZodOptional<z.ZodObject<{
361
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
362
+ name: z.ZodString;
363
+ source: z.ZodOptional<z.ZodString>;
364
+ }, "strip", z.ZodTypeAny, {
365
+ kind: "zod" | "json-schema" | "ts-rest";
366
+ name: string;
367
+ source?: string | undefined;
368
+ }, {
369
+ name: string;
370
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
371
+ source?: string | undefined;
372
+ }>>>;
373
+ query: z.ZodOptional<z.ZodOptional<z.ZodObject<{
374
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
375
+ name: z.ZodString;
376
+ source: z.ZodOptional<z.ZodString>;
377
+ }, "strip", z.ZodTypeAny, {
378
+ kind: "zod" | "json-schema" | "ts-rest";
379
+ name: string;
380
+ source?: string | undefined;
381
+ }, {
382
+ name: string;
383
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
384
+ source?: string | undefined;
385
+ }>>>;
386
+ body: z.ZodOptional<z.ZodOptional<z.ZodObject<{
387
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
388
+ name: z.ZodString;
389
+ source: z.ZodOptional<z.ZodString>;
390
+ }, "strip", z.ZodTypeAny, {
391
+ kind: "zod" | "json-schema" | "ts-rest";
392
+ name: string;
393
+ source?: string | undefined;
394
+ }, {
395
+ name: string;
396
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
397
+ source?: string | undefined;
398
+ }>>>;
399
+ headers: z.ZodOptional<z.ZodOptional<z.ZodObject<{
400
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
401
+ name: z.ZodString;
402
+ source: z.ZodOptional<z.ZodString>;
403
+ }, "strip", z.ZodTypeAny, {
404
+ kind: "zod" | "json-schema" | "ts-rest";
405
+ name: string;
406
+ source?: string | undefined;
407
+ }, {
408
+ name: string;
409
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
410
+ source?: string | undefined;
411
+ }>>>;
412
+ }, "strict", z.ZodTypeAny, {
413
+ params?: {
414
+ kind: "zod" | "json-schema" | "ts-rest";
415
+ name: string;
416
+ source?: string | undefined;
417
+ } | undefined;
418
+ query?: {
419
+ kind: "zod" | "json-schema" | "ts-rest";
420
+ name: string;
421
+ source?: string | undefined;
422
+ } | undefined;
423
+ body?: {
424
+ kind: "zod" | "json-schema" | "ts-rest";
425
+ name: string;
426
+ source?: string | undefined;
427
+ } | undefined;
428
+ headers?: {
429
+ kind: "zod" | "json-schema" | "ts-rest";
430
+ name: string;
431
+ source?: string | undefined;
432
+ } | undefined;
433
+ }, {
434
+ params?: {
435
+ name: string;
436
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
437
+ source?: string | undefined;
438
+ } | undefined;
439
+ query?: {
440
+ name: string;
441
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
442
+ source?: string | undefined;
443
+ } | undefined;
444
+ body?: {
445
+ name: string;
446
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
447
+ source?: string | undefined;
448
+ } | undefined;
449
+ headers?: {
450
+ name: string;
451
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
452
+ source?: string | undefined;
453
+ } | undefined;
454
+ }>>;
455
+ output: z.ZodOptional<z.ZodObject<{
456
+ body: z.ZodObject<{
457
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
458
+ name: z.ZodString;
459
+ source: z.ZodOptional<z.ZodString>;
460
+ }, "strip", z.ZodTypeAny, {
461
+ kind: "zod" | "json-schema" | "ts-rest";
462
+ name: string;
463
+ source?: string | undefined;
464
+ }, {
465
+ name: string;
466
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
467
+ source?: string | undefined;
468
+ }>;
469
+ status: z.ZodOptional<z.ZodNumber>;
470
+ headers: z.ZodOptional<z.ZodObject<{
471
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
472
+ name: z.ZodString;
473
+ source: z.ZodOptional<z.ZodString>;
474
+ }, "strip", z.ZodTypeAny, {
475
+ kind: "zod" | "json-schema" | "ts-rest";
476
+ name: string;
477
+ source?: string | undefined;
478
+ }, {
479
+ name: string;
480
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
481
+ source?: string | undefined;
482
+ }>>;
483
+ }, "strip", z.ZodTypeAny, {
484
+ body: {
485
+ kind: "zod" | "json-schema" | "ts-rest";
486
+ name: string;
487
+ source?: string | undefined;
488
+ };
489
+ status?: number | undefined;
490
+ headers?: {
491
+ kind: "zod" | "json-schema" | "ts-rest";
492
+ name: string;
493
+ source?: string | undefined;
494
+ } | undefined;
495
+ }, {
496
+ body: {
497
+ name: string;
498
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
499
+ source?: string | undefined;
500
+ };
501
+ status?: number | undefined;
502
+ headers?: {
503
+ name: string;
504
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
505
+ source?: string | undefined;
506
+ } | undefined;
507
+ }>>;
508
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
509
+ code: z.ZodEnum<["validation", "auth", "not_found", "domain", "conflict", "internal"]>;
510
+ message: z.ZodString;
511
+ details: z.ZodOptional<z.ZodUnknown>;
512
+ cause: z.ZodOptional<z.ZodUnknown>;
513
+ correlationId: z.ZodOptional<z.ZodString>;
514
+ }, "strip", z.ZodTypeAny, {
515
+ code: "validation" | "auth" | "not_found" | "domain" | "conflict" | "internal";
516
+ message: string;
517
+ details?: unknown;
518
+ cause?: unknown;
519
+ correlationId?: string | undefined;
520
+ }, {
521
+ code: "validation" | "auth" | "not_found" | "domain" | "conflict" | "internal";
522
+ message: string;
523
+ details?: unknown;
524
+ cause?: unknown;
525
+ correlationId?: string | undefined;
526
+ }>, "many">>;
527
+ renderMode: z.ZodOptional<z.ZodEnum<["ssg", "ssr", "spa"]>>;
528
+ staticPaths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
529
+ ssg: z.ZodOptional<z.ZodObject<{
530
+ revalidateSeconds: z.ZodOptional<z.ZodNumber>;
531
+ }, "strip", z.ZodTypeAny, {
532
+ revalidateSeconds?: number | undefined;
533
+ }, {
534
+ revalidateSeconds?: number | undefined;
535
+ }>>;
536
+ }, "strip", z.ZodTypeAny, {
537
+ name: string;
538
+ path: string;
539
+ method: "GET" | "POST" | "DELETE" | "PUT" | "PATCH" | "HEAD" | "OPTIONS";
540
+ summary?: string | undefined;
541
+ description?: string | undefined;
542
+ tags?: string[] | undefined;
543
+ errors?: {
544
+ code: "validation" | "auth" | "not_found" | "domain" | "conflict" | "internal";
545
+ message: string;
546
+ details?: unknown;
547
+ cause?: unknown;
548
+ correlationId?: string | undefined;
549
+ }[] | undefined;
550
+ input?: {
551
+ params?: {
552
+ kind: "zod" | "json-schema" | "ts-rest";
553
+ name: string;
554
+ source?: string | undefined;
555
+ } | undefined;
556
+ query?: {
557
+ kind: "zod" | "json-schema" | "ts-rest";
558
+ name: string;
559
+ source?: string | undefined;
560
+ } | undefined;
561
+ body?: {
562
+ kind: "zod" | "json-schema" | "ts-rest";
563
+ name: string;
564
+ source?: string | undefined;
565
+ } | undefined;
566
+ headers?: {
567
+ kind: "zod" | "json-schema" | "ts-rest";
568
+ name: string;
569
+ source?: string | undefined;
570
+ } | undefined;
571
+ } | undefined;
572
+ output?: {
573
+ body: {
574
+ kind: "zod" | "json-schema" | "ts-rest";
575
+ name: string;
576
+ source?: string | undefined;
577
+ };
578
+ status?: number | undefined;
579
+ headers?: {
580
+ kind: "zod" | "json-schema" | "ts-rest";
581
+ name: string;
582
+ source?: string | undefined;
583
+ } | undefined;
584
+ } | undefined;
585
+ ssg?: {
586
+ revalidateSeconds?: number | undefined;
587
+ } | undefined;
588
+ renderMode?: "ssg" | "ssr" | "spa" | undefined;
589
+ staticPaths?: string[] | undefined;
590
+ }, {
591
+ name: string;
592
+ path: string;
593
+ method: "GET" | "POST" | "DELETE" | "PUT" | "PATCH" | "HEAD" | "OPTIONS";
594
+ summary?: string | undefined;
595
+ description?: string | undefined;
596
+ tags?: string[] | undefined;
597
+ errors?: {
598
+ code: "validation" | "auth" | "not_found" | "domain" | "conflict" | "internal";
599
+ message: string;
600
+ details?: unknown;
601
+ cause?: unknown;
602
+ correlationId?: string | undefined;
603
+ }[] | undefined;
604
+ input?: {
605
+ params?: {
606
+ name: string;
607
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
608
+ source?: string | undefined;
609
+ } | undefined;
610
+ query?: {
611
+ name: string;
612
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
613
+ source?: string | undefined;
614
+ } | undefined;
615
+ body?: {
616
+ name: string;
617
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
618
+ source?: string | undefined;
619
+ } | undefined;
620
+ headers?: {
621
+ name: string;
622
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
623
+ source?: string | undefined;
624
+ } | undefined;
625
+ } | undefined;
626
+ output?: {
627
+ body: {
628
+ name: string;
629
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
630
+ source?: string | undefined;
631
+ };
632
+ status?: number | undefined;
633
+ headers?: {
634
+ name: string;
635
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
636
+ source?: string | undefined;
637
+ } | undefined;
638
+ } | undefined;
639
+ ssg?: {
640
+ revalidateSeconds?: number | undefined;
641
+ } | undefined;
642
+ renderMode?: "ssg" | "ssr" | "spa" | undefined;
643
+ staticPaths?: string[] | undefined;
644
+ }>;
645
+ export type RouteDefinition = z.infer<typeof routeDefinitionSchema>;
646
+ export type InferOrNever<TSchema extends z.ZodTypeAny | undefined> = TSchema extends z.ZodTypeAny ? z.infer<TSchema> : Record<string, never>;
647
+ export interface RouteSchemas<TParams extends z.ZodTypeAny | undefined, TQuery extends z.ZodTypeAny | undefined, TBody extends z.ZodTypeAny | undefined, TResponse extends z.ZodTypeAny> {
648
+ readonly params?: TParams;
649
+ readonly query?: TQuery;
650
+ readonly body?: TBody;
651
+ readonly headers?: z.ZodTypeAny;
652
+ readonly response: TResponse;
653
+ readonly errors?: readonly z.ZodTypeAny[];
654
+ }
655
+ export type RouteHandlerContext<TContext extends RequestContext, TParams extends z.ZodTypeAny | undefined, TQuery extends z.ZodTypeAny | undefined, TBody extends z.ZodTypeAny | undefined> = TContext & {
656
+ readonly params: InferOrNever<TParams>;
657
+ readonly query: InferOrNever<TQuery>;
658
+ readonly body: InferOrNever<TBody>;
659
+ };
660
+ export interface RouteSuccessResponse<TResponse extends z.ZodTypeAny> {
661
+ readonly status?: number;
662
+ readonly body: z.infer<TResponse>;
663
+ readonly headers?: Record<string, string>;
664
+ }
665
+ export interface RouteErrorResponse {
666
+ readonly status?: number;
667
+ readonly errors: readonly ModuleError[];
668
+ readonly headers?: Record<string, string>;
669
+ }
670
+ export type RouteHandlerResult<TResponse extends z.ZodTypeAny> = RouteSuccessResponse<TResponse> | RouteErrorResponse;
671
+ export type RouteHandler<TContext extends RequestContext, TParams extends z.ZodTypeAny | undefined, TQuery extends z.ZodTypeAny | undefined, TBody extends z.ZodTypeAny | undefined, TResponse extends z.ZodTypeAny> = (context: RouteHandlerContext<TContext, TParams, TQuery, TBody>) => Promise<RouteHandlerResult<TResponse>> | RouteHandlerResult<TResponse>;
672
+ export interface RouteSpec<TContext extends RequestContext = RequestContext, TParams extends z.ZodTypeAny | undefined = undefined, TQuery extends z.ZodTypeAny | undefined = undefined, TBody extends z.ZodTypeAny | undefined = undefined, TResponse extends z.ZodTypeAny = z.ZodTypeAny> {
673
+ readonly definition: RouteDefinition;
674
+ readonly schemas: RouteSchemas<TParams, TQuery, TBody, TResponse>;
675
+ readonly handler: RouteHandler<TContext, TParams, TQuery, TBody, TResponse>;
676
+ }
677
+ export declare const viewDefinitionSchema: z.ZodObject<{
678
+ name: z.ZodString;
679
+ path: z.ZodString;
680
+ summary: z.ZodOptional<z.ZodString>;
681
+ description: z.ZodOptional<z.ZodString>;
682
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
683
+ params: z.ZodOptional<z.ZodObject<{
684
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
685
+ name: z.ZodString;
686
+ source: z.ZodOptional<z.ZodString>;
687
+ }, "strip", z.ZodTypeAny, {
688
+ kind: "zod" | "json-schema" | "ts-rest";
689
+ name: string;
690
+ source?: string | undefined;
691
+ }, {
692
+ name: string;
693
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
694
+ source?: string | undefined;
695
+ }>>;
696
+ data: z.ZodOptional<z.ZodObject<{
697
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
698
+ name: z.ZodString;
699
+ source: z.ZodOptional<z.ZodString>;
700
+ }, "strip", z.ZodTypeAny, {
701
+ kind: "zod" | "json-schema" | "ts-rest";
702
+ name: string;
703
+ source?: string | undefined;
704
+ }, {
705
+ name: string;
706
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
707
+ source?: string | undefined;
708
+ }>>;
709
+ renderMode: z.ZodOptional<z.ZodEnum<["ssg", "ssr", "spa"]>>;
710
+ staticPaths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
711
+ ssg: z.ZodOptional<z.ZodObject<{
712
+ revalidateSeconds: z.ZodOptional<z.ZodNumber>;
713
+ }, "strip", z.ZodTypeAny, {
714
+ revalidateSeconds?: number | undefined;
715
+ }, {
716
+ revalidateSeconds?: number | undefined;
717
+ }>>;
718
+ }, "strip", z.ZodTypeAny, {
719
+ name: string;
720
+ path: string;
721
+ params?: {
722
+ kind: "zod" | "json-schema" | "ts-rest";
723
+ name: string;
724
+ source?: string | undefined;
725
+ } | undefined;
726
+ summary?: string | undefined;
727
+ description?: string | undefined;
728
+ tags?: string[] | undefined;
729
+ ssg?: {
730
+ revalidateSeconds?: number | undefined;
731
+ } | undefined;
732
+ renderMode?: "ssg" | "ssr" | "spa" | undefined;
733
+ staticPaths?: string[] | undefined;
734
+ data?: {
735
+ kind: "zod" | "json-schema" | "ts-rest";
736
+ name: string;
737
+ source?: string | undefined;
738
+ } | undefined;
739
+ }, {
740
+ name: string;
741
+ path: string;
742
+ params?: {
743
+ name: string;
744
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
745
+ source?: string | undefined;
746
+ } | undefined;
747
+ summary?: string | undefined;
748
+ description?: string | undefined;
749
+ tags?: string[] | undefined;
750
+ ssg?: {
751
+ revalidateSeconds?: number | undefined;
752
+ } | undefined;
753
+ renderMode?: "ssg" | "ssr" | "spa" | undefined;
754
+ staticPaths?: string[] | undefined;
755
+ data?: {
756
+ name: string;
757
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
758
+ source?: string | undefined;
759
+ } | undefined;
760
+ }>;
761
+ export type ViewDefinition = z.infer<typeof viewDefinitionSchema>;
762
+ export type ViewLoaderContext<TContext extends SSRContext, TParams extends z.ZodTypeAny | undefined> = TContext & {
763
+ readonly params: InferOrNever<TParams>;
764
+ };
765
+ export type ViewLoader<TContext extends SSRContext, TParams extends z.ZodTypeAny | undefined, TData extends z.ZodTypeAny> = (context: ViewLoaderContext<TContext, TParams>) => Promise<z.infer<TData>> | z.infer<TData>;
766
+ export interface ViewSpec<TContext extends SSRContext = SSRContext, TParams extends z.ZodTypeAny | undefined = undefined, TData extends z.ZodTypeAny = z.ZodTypeAny> {
767
+ readonly definition: ViewDefinition;
768
+ readonly params?: TParams;
769
+ readonly data: TData;
770
+ readonly load: ViewLoader<TContext, TParams, TData>;
771
+ }
772
+ export declare const jobDefinitionSchema: z.ZodObject<{
773
+ name: z.ZodString;
774
+ schedule: z.ZodOptional<z.ZodString>;
775
+ priority: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
776
+ }, "strip", z.ZodTypeAny, {
777
+ name: string;
778
+ schedule?: string | undefined;
779
+ priority?: string | number | undefined;
780
+ }, {
781
+ name: string;
782
+ schedule?: string | undefined;
783
+ priority?: string | number | undefined;
784
+ }>;
785
+ export type JobDefinition = z.infer<typeof jobDefinitionSchema>;
786
+ export declare const eventDefinitionSchema: z.ZodObject<{
787
+ name: z.ZodString;
788
+ payload: z.ZodOptional<z.ZodObject<{
789
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
790
+ name: z.ZodString;
791
+ source: z.ZodOptional<z.ZodString>;
792
+ }, "strip", z.ZodTypeAny, {
793
+ kind: "zod" | "json-schema" | "ts-rest";
794
+ name: string;
795
+ source?: string | undefined;
796
+ }, {
797
+ name: string;
798
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
799
+ source?: string | undefined;
800
+ }>>;
801
+ description: z.ZodOptional<z.ZodString>;
802
+ }, "strip", z.ZodTypeAny, {
803
+ name: string;
804
+ description?: string | undefined;
805
+ payload?: {
806
+ kind: "zod" | "json-schema" | "ts-rest";
807
+ name: string;
808
+ source?: string | undefined;
809
+ } | undefined;
810
+ }, {
811
+ name: string;
812
+ description?: string | undefined;
813
+ payload?: {
814
+ name: string;
815
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
816
+ source?: string | undefined;
817
+ } | undefined;
818
+ }>;
819
+ export type EventDefinition = z.infer<typeof eventDefinitionSchema>;
820
+ export declare const serviceDefinitionSchema: z.ZodObject<{
821
+ name: z.ZodString;
822
+ description: z.ZodOptional<z.ZodString>;
823
+ }, "strip", z.ZodTypeAny, {
824
+ name: string;
825
+ description?: string | undefined;
826
+ }, {
827
+ name: string;
828
+ description?: string | undefined;
829
+ }>;
830
+ export type ServiceDefinition = z.infer<typeof serviceDefinitionSchema>;
831
+ export declare const moduleManifestSchema: z.ZodObject<{
832
+ contractVersion: z.ZodString;
833
+ name: z.ZodString;
834
+ version: z.ZodString;
835
+ kind: z.ZodEnum<["frontend", "backend"]>;
836
+ capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
837
+ assets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
838
+ middlewares: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
839
+ routes: z.ZodOptional<z.ZodArray<z.ZodObject<{
840
+ name: z.ZodString;
841
+ method: z.ZodEnum<["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]>;
842
+ path: z.ZodString;
843
+ summary: z.ZodOptional<z.ZodString>;
844
+ description: z.ZodOptional<z.ZodString>;
845
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
846
+ input: z.ZodOptional<z.ZodObject<{
847
+ params: z.ZodOptional<z.ZodOptional<z.ZodObject<{
848
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
849
+ name: z.ZodString;
850
+ source: z.ZodOptional<z.ZodString>;
851
+ }, "strip", z.ZodTypeAny, {
852
+ kind: "zod" | "json-schema" | "ts-rest";
853
+ name: string;
854
+ source?: string | undefined;
855
+ }, {
856
+ name: string;
857
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
858
+ source?: string | undefined;
859
+ }>>>;
860
+ query: z.ZodOptional<z.ZodOptional<z.ZodObject<{
861
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
862
+ name: z.ZodString;
863
+ source: z.ZodOptional<z.ZodString>;
864
+ }, "strip", z.ZodTypeAny, {
865
+ kind: "zod" | "json-schema" | "ts-rest";
866
+ name: string;
867
+ source?: string | undefined;
868
+ }, {
869
+ name: string;
870
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
871
+ source?: string | undefined;
872
+ }>>>;
873
+ body: z.ZodOptional<z.ZodOptional<z.ZodObject<{
874
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
875
+ name: z.ZodString;
876
+ source: z.ZodOptional<z.ZodString>;
877
+ }, "strip", z.ZodTypeAny, {
878
+ kind: "zod" | "json-schema" | "ts-rest";
879
+ name: string;
880
+ source?: string | undefined;
881
+ }, {
882
+ name: string;
883
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
884
+ source?: string | undefined;
885
+ }>>>;
886
+ headers: z.ZodOptional<z.ZodOptional<z.ZodObject<{
887
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
888
+ name: z.ZodString;
889
+ source: z.ZodOptional<z.ZodString>;
890
+ }, "strip", z.ZodTypeAny, {
891
+ kind: "zod" | "json-schema" | "ts-rest";
892
+ name: string;
893
+ source?: string | undefined;
894
+ }, {
895
+ name: string;
896
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
897
+ source?: string | undefined;
898
+ }>>>;
899
+ }, "strict", z.ZodTypeAny, {
900
+ params?: {
901
+ kind: "zod" | "json-schema" | "ts-rest";
902
+ name: string;
903
+ source?: string | undefined;
904
+ } | undefined;
905
+ query?: {
906
+ kind: "zod" | "json-schema" | "ts-rest";
907
+ name: string;
908
+ source?: string | undefined;
909
+ } | undefined;
910
+ body?: {
911
+ kind: "zod" | "json-schema" | "ts-rest";
912
+ name: string;
913
+ source?: string | undefined;
914
+ } | undefined;
915
+ headers?: {
916
+ kind: "zod" | "json-schema" | "ts-rest";
917
+ name: string;
918
+ source?: string | undefined;
919
+ } | undefined;
920
+ }, {
921
+ params?: {
922
+ name: string;
923
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
924
+ source?: string | undefined;
925
+ } | undefined;
926
+ query?: {
927
+ name: string;
928
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
929
+ source?: string | undefined;
930
+ } | undefined;
931
+ body?: {
932
+ name: string;
933
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
934
+ source?: string | undefined;
935
+ } | undefined;
936
+ headers?: {
937
+ name: string;
938
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
939
+ source?: string | undefined;
940
+ } | undefined;
941
+ }>>;
942
+ output: z.ZodOptional<z.ZodObject<{
943
+ body: z.ZodObject<{
944
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
945
+ name: z.ZodString;
946
+ source: z.ZodOptional<z.ZodString>;
947
+ }, "strip", z.ZodTypeAny, {
948
+ kind: "zod" | "json-schema" | "ts-rest";
949
+ name: string;
950
+ source?: string | undefined;
951
+ }, {
952
+ name: string;
953
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
954
+ source?: string | undefined;
955
+ }>;
956
+ status: z.ZodOptional<z.ZodNumber>;
957
+ headers: z.ZodOptional<z.ZodObject<{
958
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
959
+ name: z.ZodString;
960
+ source: z.ZodOptional<z.ZodString>;
961
+ }, "strip", z.ZodTypeAny, {
962
+ kind: "zod" | "json-schema" | "ts-rest";
963
+ name: string;
964
+ source?: string | undefined;
965
+ }, {
966
+ name: string;
967
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
968
+ source?: string | undefined;
969
+ }>>;
970
+ }, "strip", z.ZodTypeAny, {
971
+ body: {
972
+ kind: "zod" | "json-schema" | "ts-rest";
973
+ name: string;
974
+ source?: string | undefined;
975
+ };
976
+ status?: number | undefined;
977
+ headers?: {
978
+ kind: "zod" | "json-schema" | "ts-rest";
979
+ name: string;
980
+ source?: string | undefined;
981
+ } | undefined;
982
+ }, {
983
+ body: {
984
+ name: string;
985
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
986
+ source?: string | undefined;
987
+ };
988
+ status?: number | undefined;
989
+ headers?: {
990
+ name: string;
991
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
992
+ source?: string | undefined;
993
+ } | undefined;
994
+ }>>;
995
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
996
+ code: z.ZodEnum<["validation", "auth", "not_found", "domain", "conflict", "internal"]>;
997
+ message: z.ZodString;
998
+ details: z.ZodOptional<z.ZodUnknown>;
999
+ cause: z.ZodOptional<z.ZodUnknown>;
1000
+ correlationId: z.ZodOptional<z.ZodString>;
1001
+ }, "strip", z.ZodTypeAny, {
1002
+ code: "validation" | "auth" | "not_found" | "domain" | "conflict" | "internal";
1003
+ message: string;
1004
+ details?: unknown;
1005
+ cause?: unknown;
1006
+ correlationId?: string | undefined;
1007
+ }, {
1008
+ code: "validation" | "auth" | "not_found" | "domain" | "conflict" | "internal";
1009
+ message: string;
1010
+ details?: unknown;
1011
+ cause?: unknown;
1012
+ correlationId?: string | undefined;
1013
+ }>, "many">>;
1014
+ renderMode: z.ZodOptional<z.ZodEnum<["ssg", "ssr", "spa"]>>;
1015
+ staticPaths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1016
+ ssg: z.ZodOptional<z.ZodObject<{
1017
+ revalidateSeconds: z.ZodOptional<z.ZodNumber>;
1018
+ }, "strip", z.ZodTypeAny, {
1019
+ revalidateSeconds?: number | undefined;
1020
+ }, {
1021
+ revalidateSeconds?: number | undefined;
1022
+ }>>;
1023
+ }, "strip", z.ZodTypeAny, {
1024
+ name: string;
1025
+ path: string;
1026
+ method: "GET" | "POST" | "DELETE" | "PUT" | "PATCH" | "HEAD" | "OPTIONS";
1027
+ summary?: string | undefined;
1028
+ description?: string | undefined;
1029
+ tags?: string[] | undefined;
1030
+ errors?: {
1031
+ code: "validation" | "auth" | "not_found" | "domain" | "conflict" | "internal";
1032
+ message: string;
1033
+ details?: unknown;
1034
+ cause?: unknown;
1035
+ correlationId?: string | undefined;
1036
+ }[] | undefined;
1037
+ input?: {
1038
+ params?: {
1039
+ kind: "zod" | "json-schema" | "ts-rest";
1040
+ name: string;
1041
+ source?: string | undefined;
1042
+ } | undefined;
1043
+ query?: {
1044
+ kind: "zod" | "json-schema" | "ts-rest";
1045
+ name: string;
1046
+ source?: string | undefined;
1047
+ } | undefined;
1048
+ body?: {
1049
+ kind: "zod" | "json-schema" | "ts-rest";
1050
+ name: string;
1051
+ source?: string | undefined;
1052
+ } | undefined;
1053
+ headers?: {
1054
+ kind: "zod" | "json-schema" | "ts-rest";
1055
+ name: string;
1056
+ source?: string | undefined;
1057
+ } | undefined;
1058
+ } | undefined;
1059
+ output?: {
1060
+ body: {
1061
+ kind: "zod" | "json-schema" | "ts-rest";
1062
+ name: string;
1063
+ source?: string | undefined;
1064
+ };
1065
+ status?: number | undefined;
1066
+ headers?: {
1067
+ kind: "zod" | "json-schema" | "ts-rest";
1068
+ name: string;
1069
+ source?: string | undefined;
1070
+ } | undefined;
1071
+ } | undefined;
1072
+ ssg?: {
1073
+ revalidateSeconds?: number | undefined;
1074
+ } | undefined;
1075
+ renderMode?: "ssg" | "ssr" | "spa" | undefined;
1076
+ staticPaths?: string[] | undefined;
1077
+ }, {
1078
+ name: string;
1079
+ path: string;
1080
+ method: "GET" | "POST" | "DELETE" | "PUT" | "PATCH" | "HEAD" | "OPTIONS";
1081
+ summary?: string | undefined;
1082
+ description?: string | undefined;
1083
+ tags?: string[] | undefined;
1084
+ errors?: {
1085
+ code: "validation" | "auth" | "not_found" | "domain" | "conflict" | "internal";
1086
+ message: string;
1087
+ details?: unknown;
1088
+ cause?: unknown;
1089
+ correlationId?: string | undefined;
1090
+ }[] | undefined;
1091
+ input?: {
1092
+ params?: {
1093
+ name: string;
1094
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1095
+ source?: string | undefined;
1096
+ } | undefined;
1097
+ query?: {
1098
+ name: string;
1099
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1100
+ source?: string | undefined;
1101
+ } | undefined;
1102
+ body?: {
1103
+ name: string;
1104
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1105
+ source?: string | undefined;
1106
+ } | undefined;
1107
+ headers?: {
1108
+ name: string;
1109
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1110
+ source?: string | undefined;
1111
+ } | undefined;
1112
+ } | undefined;
1113
+ output?: {
1114
+ body: {
1115
+ name: string;
1116
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1117
+ source?: string | undefined;
1118
+ };
1119
+ status?: number | undefined;
1120
+ headers?: {
1121
+ name: string;
1122
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1123
+ source?: string | undefined;
1124
+ } | undefined;
1125
+ } | undefined;
1126
+ ssg?: {
1127
+ revalidateSeconds?: number | undefined;
1128
+ } | undefined;
1129
+ renderMode?: "ssg" | "ssr" | "spa" | undefined;
1130
+ staticPaths?: string[] | undefined;
1131
+ }>, "many">>;
1132
+ views: z.ZodOptional<z.ZodArray<z.ZodObject<{
1133
+ name: z.ZodString;
1134
+ path: z.ZodString;
1135
+ summary: z.ZodOptional<z.ZodString>;
1136
+ description: z.ZodOptional<z.ZodString>;
1137
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1138
+ params: z.ZodOptional<z.ZodObject<{
1139
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
1140
+ name: z.ZodString;
1141
+ source: z.ZodOptional<z.ZodString>;
1142
+ }, "strip", z.ZodTypeAny, {
1143
+ kind: "zod" | "json-schema" | "ts-rest";
1144
+ name: string;
1145
+ source?: string | undefined;
1146
+ }, {
1147
+ name: string;
1148
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1149
+ source?: string | undefined;
1150
+ }>>;
1151
+ data: z.ZodOptional<z.ZodObject<{
1152
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
1153
+ name: z.ZodString;
1154
+ source: z.ZodOptional<z.ZodString>;
1155
+ }, "strip", z.ZodTypeAny, {
1156
+ kind: "zod" | "json-schema" | "ts-rest";
1157
+ name: string;
1158
+ source?: string | undefined;
1159
+ }, {
1160
+ name: string;
1161
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1162
+ source?: string | undefined;
1163
+ }>>;
1164
+ renderMode: z.ZodOptional<z.ZodEnum<["ssg", "ssr", "spa"]>>;
1165
+ staticPaths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1166
+ ssg: z.ZodOptional<z.ZodObject<{
1167
+ revalidateSeconds: z.ZodOptional<z.ZodNumber>;
1168
+ }, "strip", z.ZodTypeAny, {
1169
+ revalidateSeconds?: number | undefined;
1170
+ }, {
1171
+ revalidateSeconds?: number | undefined;
1172
+ }>>;
1173
+ }, "strip", z.ZodTypeAny, {
1174
+ name: string;
1175
+ path: string;
1176
+ params?: {
1177
+ kind: "zod" | "json-schema" | "ts-rest";
1178
+ name: string;
1179
+ source?: string | undefined;
1180
+ } | undefined;
1181
+ summary?: string | undefined;
1182
+ description?: string | undefined;
1183
+ tags?: string[] | undefined;
1184
+ ssg?: {
1185
+ revalidateSeconds?: number | undefined;
1186
+ } | undefined;
1187
+ renderMode?: "ssg" | "ssr" | "spa" | undefined;
1188
+ staticPaths?: string[] | undefined;
1189
+ data?: {
1190
+ kind: "zod" | "json-schema" | "ts-rest";
1191
+ name: string;
1192
+ source?: string | undefined;
1193
+ } | undefined;
1194
+ }, {
1195
+ name: string;
1196
+ path: string;
1197
+ params?: {
1198
+ name: string;
1199
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1200
+ source?: string | undefined;
1201
+ } | undefined;
1202
+ summary?: string | undefined;
1203
+ description?: string | undefined;
1204
+ tags?: string[] | undefined;
1205
+ ssg?: {
1206
+ revalidateSeconds?: number | undefined;
1207
+ } | undefined;
1208
+ renderMode?: "ssg" | "ssr" | "spa" | undefined;
1209
+ staticPaths?: string[] | undefined;
1210
+ data?: {
1211
+ name: string;
1212
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1213
+ source?: string | undefined;
1214
+ } | undefined;
1215
+ }>, "many">>;
1216
+ jobs: z.ZodOptional<z.ZodArray<z.ZodObject<{
1217
+ name: z.ZodString;
1218
+ schedule: z.ZodOptional<z.ZodString>;
1219
+ priority: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
1220
+ }, "strip", z.ZodTypeAny, {
1221
+ name: string;
1222
+ schedule?: string | undefined;
1223
+ priority?: string | number | undefined;
1224
+ }, {
1225
+ name: string;
1226
+ schedule?: string | undefined;
1227
+ priority?: string | number | undefined;
1228
+ }>, "many">>;
1229
+ events: z.ZodOptional<z.ZodArray<z.ZodObject<{
1230
+ name: z.ZodString;
1231
+ payload: z.ZodOptional<z.ZodObject<{
1232
+ kind: z.ZodDefault<z.ZodEnum<["zod", "json-schema", "ts-rest"]>>;
1233
+ name: z.ZodString;
1234
+ source: z.ZodOptional<z.ZodString>;
1235
+ }, "strip", z.ZodTypeAny, {
1236
+ kind: "zod" | "json-schema" | "ts-rest";
1237
+ name: string;
1238
+ source?: string | undefined;
1239
+ }, {
1240
+ name: string;
1241
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1242
+ source?: string | undefined;
1243
+ }>>;
1244
+ description: z.ZodOptional<z.ZodString>;
1245
+ }, "strip", z.ZodTypeAny, {
1246
+ name: string;
1247
+ description?: string | undefined;
1248
+ payload?: {
1249
+ kind: "zod" | "json-schema" | "ts-rest";
1250
+ name: string;
1251
+ source?: string | undefined;
1252
+ } | undefined;
1253
+ }, {
1254
+ name: string;
1255
+ description?: string | undefined;
1256
+ payload?: {
1257
+ name: string;
1258
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1259
+ source?: string | undefined;
1260
+ } | undefined;
1261
+ }>, "many">>;
1262
+ services: z.ZodOptional<z.ZodArray<z.ZodObject<{
1263
+ name: z.ZodString;
1264
+ description: z.ZodOptional<z.ZodString>;
1265
+ }, "strip", z.ZodTypeAny, {
1266
+ name: string;
1267
+ description?: string | undefined;
1268
+ }, {
1269
+ name: string;
1270
+ description?: string | undefined;
1271
+ }>, "many">>;
1272
+ init: z.ZodOptional<z.ZodString>;
1273
+ dispose: z.ZodOptional<z.ZodString>;
1274
+ }, "strip", z.ZodTypeAny, {
1275
+ kind: "frontend" | "backend";
1276
+ name: string;
1277
+ contractVersion: string;
1278
+ version: string;
1279
+ capabilities?: string[] | undefined;
1280
+ assets?: string[] | undefined;
1281
+ middlewares?: string[] | undefined;
1282
+ routes?: {
1283
+ name: string;
1284
+ path: string;
1285
+ method: "GET" | "POST" | "DELETE" | "PUT" | "PATCH" | "HEAD" | "OPTIONS";
1286
+ summary?: string | undefined;
1287
+ description?: string | undefined;
1288
+ tags?: string[] | undefined;
1289
+ errors?: {
1290
+ code: "validation" | "auth" | "not_found" | "domain" | "conflict" | "internal";
1291
+ message: string;
1292
+ details?: unknown;
1293
+ cause?: unknown;
1294
+ correlationId?: string | undefined;
1295
+ }[] | undefined;
1296
+ input?: {
1297
+ params?: {
1298
+ kind: "zod" | "json-schema" | "ts-rest";
1299
+ name: string;
1300
+ source?: string | undefined;
1301
+ } | undefined;
1302
+ query?: {
1303
+ kind: "zod" | "json-schema" | "ts-rest";
1304
+ name: string;
1305
+ source?: string | undefined;
1306
+ } | undefined;
1307
+ body?: {
1308
+ kind: "zod" | "json-schema" | "ts-rest";
1309
+ name: string;
1310
+ source?: string | undefined;
1311
+ } | undefined;
1312
+ headers?: {
1313
+ kind: "zod" | "json-schema" | "ts-rest";
1314
+ name: string;
1315
+ source?: string | undefined;
1316
+ } | undefined;
1317
+ } | undefined;
1318
+ output?: {
1319
+ body: {
1320
+ kind: "zod" | "json-schema" | "ts-rest";
1321
+ name: string;
1322
+ source?: string | undefined;
1323
+ };
1324
+ status?: number | undefined;
1325
+ headers?: {
1326
+ kind: "zod" | "json-schema" | "ts-rest";
1327
+ name: string;
1328
+ source?: string | undefined;
1329
+ } | undefined;
1330
+ } | undefined;
1331
+ ssg?: {
1332
+ revalidateSeconds?: number | undefined;
1333
+ } | undefined;
1334
+ renderMode?: "ssg" | "ssr" | "spa" | undefined;
1335
+ staticPaths?: string[] | undefined;
1336
+ }[] | undefined;
1337
+ views?: {
1338
+ name: string;
1339
+ path: string;
1340
+ params?: {
1341
+ kind: "zod" | "json-schema" | "ts-rest";
1342
+ name: string;
1343
+ source?: string | undefined;
1344
+ } | undefined;
1345
+ summary?: string | undefined;
1346
+ description?: string | undefined;
1347
+ tags?: string[] | undefined;
1348
+ ssg?: {
1349
+ revalidateSeconds?: number | undefined;
1350
+ } | undefined;
1351
+ renderMode?: "ssg" | "ssr" | "spa" | undefined;
1352
+ staticPaths?: string[] | undefined;
1353
+ data?: {
1354
+ kind: "zod" | "json-schema" | "ts-rest";
1355
+ name: string;
1356
+ source?: string | undefined;
1357
+ } | undefined;
1358
+ }[] | undefined;
1359
+ jobs?: {
1360
+ name: string;
1361
+ schedule?: string | undefined;
1362
+ priority?: string | number | undefined;
1363
+ }[] | undefined;
1364
+ events?: {
1365
+ name: string;
1366
+ description?: string | undefined;
1367
+ payload?: {
1368
+ kind: "zod" | "json-schema" | "ts-rest";
1369
+ name: string;
1370
+ source?: string | undefined;
1371
+ } | undefined;
1372
+ }[] | undefined;
1373
+ services?: {
1374
+ name: string;
1375
+ description?: string | undefined;
1376
+ }[] | undefined;
1377
+ init?: string | undefined;
1378
+ dispose?: string | undefined;
1379
+ }, {
1380
+ kind: "frontend" | "backend";
1381
+ name: string;
1382
+ contractVersion: string;
1383
+ version: string;
1384
+ capabilities?: string[] | undefined;
1385
+ assets?: string[] | undefined;
1386
+ middlewares?: string[] | undefined;
1387
+ routes?: {
1388
+ name: string;
1389
+ path: string;
1390
+ method: "GET" | "POST" | "DELETE" | "PUT" | "PATCH" | "HEAD" | "OPTIONS";
1391
+ summary?: string | undefined;
1392
+ description?: string | undefined;
1393
+ tags?: string[] | undefined;
1394
+ errors?: {
1395
+ code: "validation" | "auth" | "not_found" | "domain" | "conflict" | "internal";
1396
+ message: string;
1397
+ details?: unknown;
1398
+ cause?: unknown;
1399
+ correlationId?: string | undefined;
1400
+ }[] | undefined;
1401
+ input?: {
1402
+ params?: {
1403
+ name: string;
1404
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1405
+ source?: string | undefined;
1406
+ } | undefined;
1407
+ query?: {
1408
+ name: string;
1409
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1410
+ source?: string | undefined;
1411
+ } | undefined;
1412
+ body?: {
1413
+ name: string;
1414
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1415
+ source?: string | undefined;
1416
+ } | undefined;
1417
+ headers?: {
1418
+ name: string;
1419
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1420
+ source?: string | undefined;
1421
+ } | undefined;
1422
+ } | undefined;
1423
+ output?: {
1424
+ body: {
1425
+ name: string;
1426
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1427
+ source?: string | undefined;
1428
+ };
1429
+ status?: number | undefined;
1430
+ headers?: {
1431
+ name: string;
1432
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1433
+ source?: string | undefined;
1434
+ } | undefined;
1435
+ } | undefined;
1436
+ ssg?: {
1437
+ revalidateSeconds?: number | undefined;
1438
+ } | undefined;
1439
+ renderMode?: "ssg" | "ssr" | "spa" | undefined;
1440
+ staticPaths?: string[] | undefined;
1441
+ }[] | undefined;
1442
+ views?: {
1443
+ name: string;
1444
+ path: string;
1445
+ params?: {
1446
+ name: string;
1447
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1448
+ source?: string | undefined;
1449
+ } | undefined;
1450
+ summary?: string | undefined;
1451
+ description?: string | undefined;
1452
+ tags?: string[] | undefined;
1453
+ ssg?: {
1454
+ revalidateSeconds?: number | undefined;
1455
+ } | undefined;
1456
+ renderMode?: "ssg" | "ssr" | "spa" | undefined;
1457
+ staticPaths?: string[] | undefined;
1458
+ data?: {
1459
+ name: string;
1460
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1461
+ source?: string | undefined;
1462
+ } | undefined;
1463
+ }[] | undefined;
1464
+ jobs?: {
1465
+ name: string;
1466
+ schedule?: string | undefined;
1467
+ priority?: string | number | undefined;
1468
+ }[] | undefined;
1469
+ events?: {
1470
+ name: string;
1471
+ description?: string | undefined;
1472
+ payload?: {
1473
+ name: string;
1474
+ kind?: "zod" | "json-schema" | "ts-rest" | undefined;
1475
+ source?: string | undefined;
1476
+ } | undefined;
1477
+ }[] | undefined;
1478
+ services?: {
1479
+ name: string;
1480
+ description?: string | undefined;
1481
+ }[] | undefined;
1482
+ init?: string | undefined;
1483
+ dispose?: string | undefined;
1484
+ }>;
1485
+ export type ModuleManifest = z.infer<typeof moduleManifestSchema>;
1486
+ export interface ModuleLifecycleContext {
1487
+ readonly env: EnvAccessor;
1488
+ readonly logger: Logger;
1489
+ }
1490
+ export type ModuleLifecycleHook = (context: ModuleLifecycleContext) => Promise<void> | void;
1491
+ export interface ModuleDefinition<TRequestContext extends RequestContext = RequestContext, TSSRContext extends SSRContext = SSRContext, TRoutes extends readonly RouteSpec<TRequestContext, any, any, any, any>[] = readonly RouteSpec<TRequestContext, any, any, any, any>[], TViews extends readonly ViewSpec<TSSRContext, any, any>[] = readonly ViewSpec<TSSRContext, any, any>[]> {
1492
+ readonly manifest: ModuleManifest;
1493
+ readonly routes?: TRoutes;
1494
+ readonly views?: TViews;
1495
+ readonly init?: ModuleLifecycleHook;
1496
+ readonly dispose?: ModuleLifecycleHook;
1497
+ }
1498
+ export interface BackendProvider<TDefinition extends ModuleDefinition = ModuleDefinition> extends ModuleProvider {
1499
+ readonly module: TDefinition;
1500
+ }
1501
+ export interface AuthProviderCapability {
1502
+ readonly auth: AuthProvider | undefined;
1503
+ }
1504
+ export interface DatabaseProviderCapability {
1505
+ readonly database: DatabaseProvider | undefined;
1506
+ }
1507
+ export interface CacheProviderCapability {
1508
+ readonly cache: CacheProvider | undefined;
1509
+ }
1510
+ export interface QueueProviderCapability {
1511
+ readonly queue: QueueProvider | undefined;
1512
+ }
1513
+ export declare function defineRoute<TContext extends RequestContext, TParams extends z.ZodTypeAny | undefined = undefined, TQuery extends z.ZodTypeAny | undefined = undefined, TBody extends z.ZodTypeAny | undefined = undefined, TResponse extends z.ZodTypeAny = z.ZodTypeAny>(spec: RouteSpec<TContext, TParams, TQuery, TBody, TResponse>): RouteSpec<TContext, TParams, TQuery, TBody, TResponse>;
1514
+ export declare function defineView<TContext extends SSRContext, TParams extends z.ZodTypeAny | undefined = undefined, TData extends z.ZodTypeAny = z.ZodTypeAny>(spec: ViewSpec<TContext, TParams, TData>): ViewSpec<TContext, TParams, TData>;
1515
+ export declare function createModule<TRequestContext extends RequestContext, TSSRContext extends SSRContext, TRoutes extends readonly RouteSpec<TRequestContext, any, any, any, any>[] = readonly RouteSpec<TRequestContext, any, any, any, any>[], TViews extends readonly ViewSpec<TSSRContext, any, any>[] = readonly ViewSpec<TSSRContext, any, any>[]>(definition: ModuleDefinition<TRequestContext, TSSRContext, TRoutes, TViews>): ModuleDefinition<TRequestContext, TSSRContext, TRoutes, TViews>;
1516
+ export { fromTsRestRoute, fromTsRestRouter } from './adapters/ts-rest.js';
1517
+ export type { FromTsRestRouteOptions, FromTsRestRouterOptions, RouterRouteConfig } from './adapters/ts-rest.js';