inviton-backduck 1.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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +302 -0
  3. package/dist/apidoc/api-doc-generator.d.ts +58 -0
  4. package/dist/apidoc/api-doc-generator.d.ts.map +1 -0
  5. package/dist/apidoc/api-doc-generator.js +201 -0
  6. package/dist/apidoc/api-doc-generator.js.map +1 -0
  7. package/dist/apidoc/config.d.ts +153 -0
  8. package/dist/apidoc/config.d.ts.map +1 -0
  9. package/dist/apidoc/config.js +254 -0
  10. package/dist/apidoc/config.js.map +1 -0
  11. package/dist/apidoc/controller-parser.d.ts +208 -0
  12. package/dist/apidoc/controller-parser.d.ts.map +1 -0
  13. package/dist/apidoc/controller-parser.js +686 -0
  14. package/dist/apidoc/controller-parser.js.map +1 -0
  15. package/dist/apidoc/html-generator.d.ts +290 -0
  16. package/dist/apidoc/html-generator.d.ts.map +1 -0
  17. package/dist/apidoc/html-generator.js +2295 -0
  18. package/dist/apidoc/html-generator.js.map +1 -0
  19. package/dist/apidoc/index.d.ts +20 -0
  20. package/dist/apidoc/index.d.ts.map +1 -0
  21. package/dist/apidoc/index.js +16 -0
  22. package/dist/apidoc/index.js.map +1 -0
  23. package/dist/apidoc/openapi-builder.d.ts +169 -0
  24. package/dist/apidoc/openapi-builder.d.ts.map +1 -0
  25. package/dist/apidoc/openapi-builder.js +634 -0
  26. package/dist/apidoc/openapi-builder.js.map +1 -0
  27. package/dist/apidoc/parameterGeneratorRegistry.d.ts +20 -0
  28. package/dist/apidoc/parameterGeneratorRegistry.d.ts.map +1 -0
  29. package/dist/apidoc/parameterGeneratorRegistry.js +6 -0
  30. package/dist/apidoc/parameterGeneratorRegistry.js.map +1 -0
  31. package/dist/apidoc/test-type-resolver.d.ts +2 -0
  32. package/dist/apidoc/test-type-resolver.d.ts.map +1 -0
  33. package/dist/apidoc/test-type-resolver.js +6 -0
  34. package/dist/apidoc/test-type-resolver.js.map +1 -0
  35. package/dist/apidoc/type-resolver.d.ts +266 -0
  36. package/dist/apidoc/type-resolver.d.ts.map +1 -0
  37. package/dist/apidoc/type-resolver.js +1226 -0
  38. package/dist/apidoc/type-resolver.js.map +1 -0
  39. package/dist/apidoc/verify-type-resolution.d.ts +3 -0
  40. package/dist/apidoc/verify-type-resolution.d.ts.map +1 -0
  41. package/dist/apidoc/verify-type-resolution.js +29 -0
  42. package/dist/apidoc/verify-type-resolution.js.map +1 -0
  43. package/dist/bun/bunRouter.d.ts +70 -0
  44. package/dist/bun/bunRouter.d.ts.map +1 -0
  45. package/dist/bun/bunRouter.js +324 -0
  46. package/dist/bun/bunRouter.js.map +1 -0
  47. package/dist/bun/bunServer.d.ts +72 -0
  48. package/dist/bun/bunServer.d.ts.map +1 -0
  49. package/dist/bun/bunServer.js +218 -0
  50. package/dist/bun/bunServer.js.map +1 -0
  51. package/dist/bun/bunStaticFiles.d.ts +76 -0
  52. package/dist/bun/bunStaticFiles.d.ts.map +1 -0
  53. package/dist/bun/bunStaticFiles.js +251 -0
  54. package/dist/bun/bunStaticFiles.js.map +1 -0
  55. package/dist/bun/index.d.ts +7 -0
  56. package/dist/bun/index.d.ts.map +1 -0
  57. package/dist/bun/index.js +7 -0
  58. package/dist/bun/index.js.map +1 -0
  59. package/dist/data-contracts.d.ts +132 -0
  60. package/dist/data-contracts.d.ts.map +1 -0
  61. package/dist/data-contracts.js +2 -0
  62. package/dist/data-contracts.js.map +1 -0
  63. package/dist/decorators.d.ts +75 -0
  64. package/dist/decorators.d.ts.map +1 -0
  65. package/dist/decorators.js +101 -0
  66. package/dist/decorators.js.map +1 -0
  67. package/dist/express/expressFrontendRouter.d.ts +17 -0
  68. package/dist/express/expressFrontendRouter.d.ts.map +1 -0
  69. package/dist/express/expressFrontendRouter.js +33 -0
  70. package/dist/express/expressFrontendRouter.js.map +1 -0
  71. package/dist/express/expressRouter.d.ts +25 -0
  72. package/dist/express/expressRouter.d.ts.map +1 -0
  73. package/dist/express/expressRouter.js +150 -0
  74. package/dist/express/expressRouter.js.map +1 -0
  75. package/dist/express/index.d.ts +6 -0
  76. package/dist/express/index.d.ts.map +1 -0
  77. package/dist/express/index.js +6 -0
  78. package/dist/express/index.js.map +1 -0
  79. package/dist/index.d.ts +47 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +52 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/router.d.ts +162 -0
  84. package/dist/router.d.ts.map +1 -0
  85. package/dist/router.js +350 -0
  86. package/dist/router.js.map +1 -0
  87. package/dist/runtime-detect.d.ts +20 -0
  88. package/dist/runtime-detect.d.ts.map +1 -0
  89. package/dist/runtime-detect.js +20 -0
  90. package/dist/runtime-detect.js.map +1 -0
  91. package/dist/server.d.ts +126 -0
  92. package/dist/server.d.ts.map +1 -0
  93. package/dist/server.js +181 -0
  94. package/dist/server.js.map +1 -0
  95. package/dist/utils.d.ts +83 -0
  96. package/dist/utils.d.ts.map +1 -0
  97. package/dist/utils.js +157 -0
  98. package/dist/utils.js.map +1 -0
  99. package/package.json +65 -0
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Options for setting HTTP cookies
3
+ */
4
+ export interface CookieOptions {
5
+ /** Maximum age of the cookie in milliseconds */
6
+ maxAge?: number;
7
+ /** Whether the cookie should be signed using a secret key */
8
+ signed?: boolean;
9
+ /** Expiration date of the cookie */
10
+ expires?: Date;
11
+ /** Whether the cookie is accessible only via HTTP (not JavaScript) */
12
+ httpOnly?: boolean;
13
+ /** URL path for which the cookie is valid */
14
+ path?: string;
15
+ /** Domain for which the cookie is valid */
16
+ domain?: string;
17
+ /** Whether the cookie should only be transmitted over HTTPS */
18
+ secure?: boolean;
19
+ /** Controls cross-site request behavior for the cookie */
20
+ sameSite?: boolean | 'lax' | 'strict' | 'none';
21
+ }
22
+ /**
23
+ * Runtime-agnostic HTTP headers interface
24
+ */
25
+ export interface WebHeaders {
26
+ /**
27
+ * Get a header value by name
28
+ * @param name - Header name (case-insensitive)
29
+ * @returns Header value or null if not found
30
+ */
31
+ get: (name: string) => string | null | undefined;
32
+ }
33
+ /**
34
+ * Runtime-agnostic HTTP request interface
35
+ * Compatible with both Express Request and Bun Request
36
+ */
37
+ export interface WebRequest {
38
+ /** HTTP method (GET, POST, PUT, PATCH, DELETE) */
39
+ method: string;
40
+ /** Full request URL including query string */
41
+ url: string;
42
+ /** Request path without query string */
43
+ path: string;
44
+ /** Parsed query string parameters */
45
+ query: Record<string, any>;
46
+ /** URL path parameters (e.g., /users/:id) */
47
+ params: Record<string, string>;
48
+ /** Parsed request body (requires body parser middleware) */
49
+ body: any;
50
+ /** HTTP request headers */
51
+ headers: WebHeaders;
52
+ /** Client IP address */
53
+ ip: string;
54
+ /** Parsed cookies (requires cookie-parser middleware in Express) */
55
+ cookies?: Record<string, string>;
56
+ /** Signed cookies (requires cookie-parser middleware in Express) */
57
+ signedCookies?: Record<string, string>;
58
+ }
59
+ /**
60
+ * Runtime-agnostic HTTP response interface
61
+ * Compatible with both Express Response and Bun Response
62
+ */
63
+ export interface WebResponse {
64
+ /** Current HTTP status code */
65
+ statusCode: number;
66
+ /**
67
+ * Set HTTP status code
68
+ * @param code - HTTP status code (200, 404, 500, etc.)
69
+ * @returns The response object for chaining
70
+ */
71
+ status: (code: number) => WebResponse;
72
+ /**
73
+ * Send JSON response
74
+ * @param data - Data to serialize as JSON
75
+ */
76
+ json: (data: any) => void;
77
+ /**
78
+ * Send text response
79
+ * @param data - Text content to send
80
+ */
81
+ send: (data: string) => void;
82
+ /**
83
+ * Send binary data (Buffer or ArrayBuffer)
84
+ * @param data - Binary data to send
85
+ */
86
+ sendBuffer: (data: Buffer | ArrayBuffer | Uint8Array) => void;
87
+ /**
88
+ * Set response header
89
+ * @param name - Header name
90
+ * @param value - Header value
91
+ * @returns The response object for chaining
92
+ */
93
+ setHeader: (name: string, value: string) => WebResponse;
94
+ /**
95
+ * Redirect to another URL
96
+ * @param url - Target URL for redirection
97
+ */
98
+ redirect: (url: string) => void;
99
+ /** Whether response headers have been sent */
100
+ headersSent: boolean;
101
+ /**
102
+ * Set a cookie
103
+ * @param name - Cookie name
104
+ * @param value - Cookie value
105
+ * @param options - Cookie options (maxAge, httpOnly, etc.)
106
+ * @returns The response object for chaining
107
+ */
108
+ cookie?: (name: string, value: string, options?: CookieOptions) => WebResponse;
109
+ /**
110
+ * Clear a cookie
111
+ * @param name - Cookie name to clear
112
+ * @param options - Cookie options (must match original options)
113
+ * @returns The response object for chaining
114
+ */
115
+ clearCookie?: (name: string, options?: CookieOptions) => WebResponse;
116
+ }
117
+ /**
118
+ * Route handler function that processes HTTP requests
119
+ * @param req - HTTP request object
120
+ * @param res - HTTP response object
121
+ * @param next - Optional function to pass control to next handler
122
+ */
123
+ export type RouteHandler = (req: WebRequest, res: WebResponse, next?: () => void) => void | Promise<void>;
124
+ /**
125
+ * Middleware function that processes requests before route handlers
126
+ * Middleware can modify request/response or pass control to next handler
127
+ * @param req - HTTP request object
128
+ * @param res - HTTP response object
129
+ * @param next - Function to pass control to next middleware/handler
130
+ */
131
+ export type MiddlewareDefinition = (req: WebRequest, res: WebResponse, next: () => void | Promise<void>) => void | Promise<void>;
132
+ //# sourceMappingURL=data-contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-contracts.d.ts","sourceRoot":"","sources":["../src/data-contracts.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oCAAoC;IACpC,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,sEAAsE;IACtE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,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AC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,KAAK,IAAI,CAAC;IAC9D;;;;;OAKG;IACH,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,WAAW,CAAC;IACxD;;;OAGG;IACH,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,8CAA8C;IAC9C,WAAW,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,WAAW,CAAC;IAC/E;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,WAAW,CAAC;CACrE;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,CAC1B,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,WAAW,EAChB,IAAI,CAAC,EAAE,MAAM,IAAI,KACb,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAClC,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAC5B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data-contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-contracts.js","sourceRoot":"","sources":["../src/data-contracts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Controller decorators for route configuration
3
+ */
4
+ import type { MiddlewareDefinition, WebRequest } from './data-contracts';
5
+ /**
6
+ * Get or create middlewares array on controller
7
+ * Used internally by the Middleware decorator
8
+ * @param target - Controller class or prototype
9
+ * @returns Array of middleware functions
10
+ */
11
+ export declare const ControllerGetMiddlewares: (target: any) => MiddlewareDefinition[];
12
+ /**
13
+ * Decorator to set the route path for a controller
14
+ * @param route - Base route path (e.g., '/users', '/products')
15
+ * @returns Decorator function
16
+ * @example
17
+ * ```typescript
18
+ * @Route('/products')
19
+ * class ProductController extends ControllerBase {
20
+ * // Routes will be registered under /products
21
+ * }
22
+ * ```
23
+ */
24
+ export declare const Route: (route: string) => (target: any) => void;
25
+ /**
26
+ * Decorator to set the request body size limit for a controller
27
+ * Only applies to Express runtime (Bun handles large payloads natively)
28
+ * @param size - Size limit (e.g., '10mb', '50mb')
29
+ * @returns Decorator function
30
+ * @example
31
+ * ```typescript
32
+ * @Route('/files')
33
+ * @RequestSize('50mb')
34
+ * class FileUploadController extends ControllerBase {
35
+ * // Allows up to 50MB file uploads
36
+ * }
37
+ * ```
38
+ */
39
+ export declare const RequestSize: (size: string) => (target: any) => void;
40
+ /**
41
+ * Decorator to add middlewares to a controller
42
+ * Middlewares run before all route handlers in the controller
43
+ * @param middlewares - Array of middleware functions
44
+ * @returns Decorator function
45
+ * @example
46
+ * ```typescript
47
+ * @Route('/admin')
48
+ * @Middleware([authMiddleware, loggingMiddleware])
49
+ * class AdminController extends ControllerBase {
50
+ * // All routes require auth and logging
51
+ * }
52
+ * ```
53
+ */
54
+ export declare const Middleware: (middlewares: MiddlewareDefinition[]) => (target: any) => void;
55
+ /**
56
+ * Decorator to set a custom request args parser for a controller method
57
+ * By default, GET methods use query string parsing and POST/PUT/PATCH use body parsing
58
+ * Use this decorator to customize how request arguments are extracted
59
+ * @param parser - Function that extracts arguments from the request
60
+ * @returns Decorator function
61
+ * @example
62
+ * ```typescript
63
+ * class UserController extends ControllerBase {
64
+ * @ParseRequestArgs((req) => ({
65
+ * id: parseInt(req.params.id),
66
+ * includeDeleted: req.query.includeDeleted === 'true'
67
+ * }))
68
+ * async get(args: { id: number, includeDeleted: boolean }) {
69
+ * // Custom parsed args
70
+ * }
71
+ * }
72
+ * ```
73
+ */
74
+ export declare const ParseRequestArgs: <T>(parser: (req: WebRequest) => T) => (target: any, methodName?: string) => void;
75
+ //# sourceMappingURL=decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAEtF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,QAAQ,GAAG,KAAG,oBAAoB,EAgB1E,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,MAAM,QAAQ,GAAG,SAQnD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,MAAM,QAAQ,GAAG,SAQxD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,GAAI,aAAa,oBAAoB,EAAE,MAAM,QAAQ,GAAG,SAK9E,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAE,QAAQ,CAAC,GAAG,EAAE,UAAU,KAAK,CAAC,MAAM,QAAQ,GAAG,EAAE,aAAa,MAAM,SAQvG,CAAC"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Controller decorators for route configuration
3
+ */
4
+ /**
5
+ * Get or create middlewares array on controller
6
+ * Used internally by the Middleware decorator
7
+ * @param target - Controller class or prototype
8
+ * @returns Array of middleware functions
9
+ */
10
+ export const ControllerGetMiddlewares = (target) => {
11
+ let middlewares = target.$middlewares;
12
+ if (middlewares == null) {
13
+ const arr = [];
14
+ Object.defineProperty(target, '$middlewares', {
15
+ get: () => arr,
16
+ });
17
+ middlewares = target.$middlewares;
18
+ }
19
+ return middlewares;
20
+ };
21
+ /**
22
+ * Decorator to set the route path for a controller
23
+ * @param route - Base route path (e.g., '/users', '/products')
24
+ * @returns Decorator function
25
+ * @example
26
+ * ```typescript
27
+ * @Route('/products')
28
+ * class ProductController extends ControllerBase {
29
+ * // Routes will be registered under /products
30
+ * }
31
+ * ```
32
+ */
33
+ export const Route = (route) => (target) => {
34
+ Object.defineProperty(target, '$route', {
35
+ get: () => route,
36
+ });
37
+ };
38
+ /**
39
+ * Decorator to set the request body size limit for a controller
40
+ * Only applies to Express runtime (Bun handles large payloads natively)
41
+ * @param size - Size limit (e.g., '10mb', '50mb')
42
+ * @returns Decorator function
43
+ * @example
44
+ * ```typescript
45
+ * @Route('/files')
46
+ * @RequestSize('50mb')
47
+ * class FileUploadController extends ControllerBase {
48
+ * // Allows up to 50MB file uploads
49
+ * }
50
+ * ```
51
+ */
52
+ export const RequestSize = (size) => (target) => {
53
+ Object.defineProperty(target, '$requestSize', {
54
+ get: () => size,
55
+ });
56
+ };
57
+ /**
58
+ * Decorator to add middlewares to a controller
59
+ * Middlewares run before all route handlers in the controller
60
+ * @param middlewares - Array of middleware functions
61
+ * @returns Decorator function
62
+ * @example
63
+ * ```typescript
64
+ * @Route('/admin')
65
+ * @Middleware([authMiddleware, loggingMiddleware])
66
+ * class AdminController extends ControllerBase {
67
+ * // All routes require auth and logging
68
+ * }
69
+ * ```
70
+ */
71
+ export const Middleware = (middlewares) => (target) => {
72
+ const arr = ControllerGetMiddlewares(target);
73
+ for (const mw of middlewares) {
74
+ arr.push(mw);
75
+ }
76
+ };
77
+ /**
78
+ * Decorator to set a custom request args parser for a controller method
79
+ * By default, GET methods use query string parsing and POST/PUT/PATCH use body parsing
80
+ * Use this decorator to customize how request arguments are extracted
81
+ * @param parser - Function that extracts arguments from the request
82
+ * @returns Decorator function
83
+ * @example
84
+ * ```typescript
85
+ * class UserController extends ControllerBase {
86
+ * @ParseRequestArgs((req) => ({
87
+ * id: parseInt(req.params.id),
88
+ * includeDeleted: req.query.includeDeleted === 'true'
89
+ * }))
90
+ * async get(args: { id: number, includeDeleted: boolean }) {
91
+ * // Custom parsed args
92
+ * }
93
+ * }
94
+ * ```
95
+ */
96
+ export const ParseRequestArgs = (parser) => (target, methodName) => {
97
+ Object.defineProperty(target, methodName && methodName.length > 0 ? `$parse-${methodName}` : '$parse-', {
98
+ get: () => (req, _) => parser(req),
99
+ });
100
+ };
101
+ //# sourceMappingURL=decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAAW,EAA0B,EAAE;IAC/E,IAAI,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC;IACtC,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;QACzB,MAAM,GAAG,GAA2B,EAAE,CAAC;QACvC,MAAM,CAAC,cAAc,CACpB,MAAM,EACN,cAAc,EACd;YACC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG;SACd,CACD,CAAC;QAEF,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC;IACnC,CAAC;IAED,OAAO,WAAW,CAAC;AACpB,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,MAAW,EAAE,EAAE;IACvD,MAAM,CAAC,cAAc,CACpB,MAAM,EACN,QAAQ,EACR;QACC,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK;KAChB,CACD,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,MAAW,EAAE,EAAE;IAC5D,MAAM,CAAC,cAAc,CACpB,MAAM,EACN,cAAc,EACd;QACC,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;KACf,CACD,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,WAAmC,EAAE,EAAE,CAAC,CAAC,MAAW,EAAE,EAAE;IAClF,MAAM,GAAG,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC7C,KAAK,MAAM,EAAE,IAAI,WAAW,EAAE,CAAC;QAC9B,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;AACF,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAI,MAA8B,EAAE,EAAE,CAAC,CAAC,MAAW,EAAE,UAAmB,EAAE,EAAE;IAC3G,MAAM,CAAC,cAAc,CACpB,MAAM,EACN,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,EACxE;QACC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAe,EAAE,CAAc,EAAK,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC;KAC9D,CACD,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Express Frontend Router - Express-specific SPA routing
3
+ */
4
+ import type { Router as ExpressRouter } from 'express';
5
+ type StringOrRegex = string | RegExp;
6
+ export interface ExpressFrontendConfig {
7
+ /** Route patterns to match */
8
+ routes: StringOrRegex[];
9
+ /** Pre-loaded HTML content */
10
+ indexHtml: string | null;
11
+ }
12
+ /**
13
+ * Build Express frontend router for SPA routing
14
+ */
15
+ export declare const buildExpressFrontendRouter: (config: ExpressFrontendConfig) => Promise<ExpressRouter>;
16
+ export {};
17
+ //# sourceMappingURL=expressFrontendRouter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expressFrontendRouter.d.ts","sourceRoot":"","sources":["../../src/express/expressFrontendRouter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAA0D,MAAM,IAAI,aAAa,EAAgB,MAAM,SAAS,CAAC;AAE7H,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;AAErC,MAAM,WAAW,qBAAqB;IACrC,8BAA8B;IAC9B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,8BAA8B;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B,GAAU,QAAQ,qBAAqB,KAAG,OAAO,CAAC,aAAa,CA+BrG,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Express Frontend Router - Express-specific SPA routing
3
+ */
4
+ /**
5
+ * Build Express frontend router for SPA routing
6
+ */
7
+ export const buildExpressFrontendRouter = async (config) => {
8
+ const { default: express } = await import('express');
9
+ const router = express.Router();
10
+ const { indexHtml, routes } = config;
11
+ const handler = (_req, res, _next) => {
12
+ res.setHeader('Content-Type', 'text/html');
13
+ res.send(indexHtml);
14
+ };
15
+ // Convert routes to Express-compatible format
16
+ // Using *splat for Express 5+ compatibility with path-to-regexp v8
17
+ const expressRoutes = [];
18
+ for (const route of routes) {
19
+ if (typeof route === 'string') {
20
+ expressRoutes.push(route);
21
+ // Add wildcard version for SPA routing
22
+ if (!route.endsWith('/*splat')) {
23
+ expressRoutes.push(`${route}/*splat`);
24
+ }
25
+ }
26
+ else {
27
+ expressRoutes.push(route);
28
+ }
29
+ }
30
+ router.use(expressRoutes, handler);
31
+ return router;
32
+ };
33
+ //# sourceMappingURL=expressFrontendRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expressFrontendRouter.js","sourceRoot":"","sources":["../../src/express/expressFrontendRouter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAAE,MAA6B,EAA0B,EAAE;IACzG,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IACrD,MAAM,MAAM,GAAkB,OAAO,CAAC,MAAM,EAAE,CAAC;IAC/C,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAErC,MAAM,OAAO,GAAG,CACf,IAAoB,EACpB,GAAoB,EACpB,KAAmB,EAClB,EAAE;QACH,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QAC3C,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC,CAAC;IAEF,8CAA8C;IAC9C,mEAAmE;IACnE,MAAM,aAAa,GAAwB,EAAE,CAAC;IAC9C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC/B,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC1B,uCAAuC;YACvC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBAChC,aAAa,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;YACvC,CAAC;QACF,CAAC;aAAM,CAAC;YACP,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IACF,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Express Router - Express-specific routing implementation
3
+ */
4
+ import type { Router as ExpressRouter } from 'express';
5
+ import type { MiddlewareDefinition, RouteHandler } from '../data-contracts';
6
+ import type { HttpMethod } from '../router';
7
+ interface RouteDefinition {
8
+ method: HttpMethod;
9
+ path: string;
10
+ /** Optional regex for pattern matching */
11
+ regex?: RegExp;
12
+ handlers: (RouteHandler | MiddlewareDefinition)[];
13
+ /** Optional request size limit for body parsing */
14
+ requestSize?: string;
15
+ }
16
+ interface SubRouterMount {
17
+ path: string;
18
+ buildExpress: () => Promise<ExpressRouter>;
19
+ }
20
+ /**
21
+ * Build Express router from route definitions
22
+ */
23
+ export declare const buildExpressRouter: (routes: RouteDefinition[], subRouters: SubRouterMount[]) => Promise<ExpressRouter>;
24
+ export {};
25
+ //# sourceMappingURL=expressRouter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expressRouter.d.ts","sourceRoot":"","sources":["../../src/express/expressRouter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAiD,MAAM,IAAI,aAAa,EAAgB,MAAM,SAAS,CAAC;AACpH,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAA2B,MAAM,mBAAmB,CAAC;AACrG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAM5C,UAAU,eAAe;IACxB,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,YAAY,GAAG,oBAAoB,CAAC,EAAE,CAAC;IAClD,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,cAAc;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;CAC3C;AA0ID;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAU,QAAQ,eAAe,EAAE,EAAE,YAAY,cAAc,EAAE,KAAG,OAAO,CAAC,aAAa,CAoCvH,CAAC"}
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Express Router - Express-specific routing implementation
3
+ */
4
+ /** Symbol keys for storing universal request/response on Express objects */
5
+ const UNI_REQ_KEY = Symbol('uniReq');
6
+ const UNI_RES_KEY = Symbol('uniRes');
7
+ /**
8
+ * Convert Express request to WebRequest
9
+ */
10
+ const expressToUniversalReq = (req) => ({
11
+ method: req.method,
12
+ url: req.url,
13
+ path: req.path,
14
+ query: req.query,
15
+ params: req.params,
16
+ body: req.body,
17
+ headers: { get: (name) => req.get(name) },
18
+ ip: req.ip || req.socket?.remoteAddress || '',
19
+ cookies: req.cookies,
20
+ signedCookies: req.signedCookies,
21
+ });
22
+ /**
23
+ * Convert Express response to WebResponse
24
+ */
25
+ const expressToUniversalRes = (res) => {
26
+ const uniRes = {
27
+ statusCode: 200,
28
+ status(code) {
29
+ this.statusCode = code;
30
+ res.status(code);
31
+ return this;
32
+ },
33
+ json: (data) => {
34
+ res.json(data);
35
+ },
36
+ send: (data) => {
37
+ res.send(data);
38
+ },
39
+ sendBuffer: (data) => {
40
+ res.send(data);
41
+ },
42
+ setHeader: (name, value) => {
43
+ res.setHeader(name, value);
44
+ return uniRes;
45
+ },
46
+ redirect: (url) => {
47
+ res.redirect(url);
48
+ },
49
+ get headersSent() {
50
+ return res.headersSent;
51
+ },
52
+ cookie: (name, value, options) => {
53
+ res.cookie(name, value, options);
54
+ return uniRes;
55
+ },
56
+ clearCookie: (name, options) => {
57
+ res.clearCookie(name, options);
58
+ return uniRes;
59
+ },
60
+ };
61
+ return uniRes;
62
+ };
63
+ /**
64
+ * Get or create universal request/response from Express objects.
65
+ * Conversion happens only once per request lifecycle.
66
+ */
67
+ const getOrCreateUniversal = (req, res) => {
68
+ if (!req[UNI_REQ_KEY]) {
69
+ req[UNI_REQ_KEY] = expressToUniversalReq(req);
70
+ res[UNI_RES_KEY] = expressToUniversalRes(res);
71
+ }
72
+ return {
73
+ uniReq: req[UNI_REQ_KEY],
74
+ uniRes: res[UNI_RES_KEY],
75
+ };
76
+ };
77
+ /**
78
+ * Convert universal handler to Express handler
79
+ */
80
+ const toExpressHandler = (handler) => async (req, res, next) => {
81
+ const { uniReq, uniRes } = getOrCreateUniversal(req, res);
82
+ try {
83
+ await handler(uniReq, uniRes, next);
84
+ }
85
+ catch (err) {
86
+ next(err);
87
+ }
88
+ };
89
+ /**
90
+ * Convert wildcard paths to Express 5+ compatible format
91
+ * Express 5 with path-to-regexp v8 requires named parameters for wildcards
92
+ * Converts /* to /*splat
93
+ */
94
+ const toExpressPath = (path) => path.replace(/\/\*$/g, '/*splat').replace(/\/\*\//g, '/*splat/');
95
+ /**
96
+ * Check if method requires body parsing
97
+ */
98
+ const isBodyMethod = (method) => method === 'post' || method === 'put' || method === 'patch';
99
+ /**
100
+ * Get body parser middlewares for a route
101
+ */
102
+ const getBodyParserMiddlewares = (express, requestSize) => {
103
+ if (requestSize) {
104
+ return [
105
+ express.urlencoded({ extended: true, limit: requestSize }),
106
+ express.json({ limit: requestSize }),
107
+ ];
108
+ }
109
+ return [
110
+ express.urlencoded({ extended: true }),
111
+ express.json(),
112
+ ];
113
+ };
114
+ /**
115
+ * Build Express router from route definitions
116
+ */
117
+ export const buildExpressRouter = async (routes, subRouters) => {
118
+ const { default: express } = await import('express');
119
+ const router = express.Router();
120
+ // Mount sub-routers
121
+ for (const { path, buildExpress } of subRouters) {
122
+ router.use(path, await buildExpress());
123
+ }
124
+ // Register routes
125
+ for (const route of routes) {
126
+ const method = route.method.toLowerCase();
127
+ const expressHandlers = route.handlers.map(h => toExpressHandler(h));
128
+ // Add body parser middlewares for POST/PUT/PATCH methods
129
+ const allHandlers = isBodyMethod(method)
130
+ ? [
131
+ ...getBodyParserMiddlewares(express, route.requestSize),
132
+ ...expressHandlers,
133
+ ]
134
+ : expressHandlers;
135
+ // For regex routes (path starts with __regex__), use the regex pattern
136
+ // For regular routes, convert to Express 5+ compatible path
137
+ if (route.path.startsWith('__regex__')) {
138
+ if (route.regex) {
139
+ router[method](route.regex, ...allHandlers);
140
+ }
141
+ // Skip if regex is missing (shouldn't happen, but defensive)
142
+ }
143
+ else {
144
+ const expressPath = toExpressPath(route.path);
145
+ router[method](expressPath, ...allHandlers);
146
+ }
147
+ }
148
+ return router;
149
+ };
150
+ //# sourceMappingURL=expressRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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0,0 +1,6 @@
1
+ /**
2
+ * Express runtime utilities - barrel export
3
+ */
4
+ export { buildExpressFrontendRouter, type ExpressFrontendConfig } from './expressFrontendRouter';
5
+ export { buildExpressRouter } from './expressRouter';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/express/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,0BAA0B,EAAE,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Express runtime utilities - barrel export
3
+ */
4
+ export { buildExpressFrontendRouter } from './expressFrontendRouter';
5
+ export { buildExpressRouter } from './expressRouter';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/express/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,0BAA0B,EAA8B,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @server-runtime - Runtime-agnostic utilities for building web servers
3
+ *
4
+ * This package provides a unified API for building web servers that can run on
5
+ * both Node.js (with Express) and Bun natively. Write your server code once,
6
+ * and it will automatically adapt to the runtime environment.
7
+ *
8
+ * Key Features:
9
+ * - Universal Router: Define routes once, run anywhere
10
+ * - Controller-based routing with automatic REST mapping
11
+ * - Runtime detection and automatic adaptation
12
+ * - Type-safe request/response handling
13
+ * - Middleware support with chaining
14
+ * - Static file serving with compression
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * import { createRouter, createServer, Route, ControllerBase } from '@server-runtime';
19
+ *
20
+ * // Define a controller
21
+ * @Route('/products')
22
+ * class ProductController extends ControllerBase {
23
+ * async getAll() { return products; }
24
+ * async get(args: { id: number }) { return product; }
25
+ * async post(args: CreateProductArgs) { return created; }
26
+ * }
27
+ *
28
+ * // Create router and register controllers
29
+ * const router = createRouter();
30
+ * router.registerController(ProductController);
31
+ *
32
+ * // Create and start server
33
+ * const server = createServer({
34
+ * port: 3000,
35
+ * apiRouters: { '/api': router }
36
+ * });
37
+ * await server.start();
38
+ * ```
39
+ */
40
+ export * from './apidoc';
41
+ export type { CookieOptions, MiddlewareDefinition as Middleware, RouteHandler, WebHeaders as UniversalHeaders, WebRequest, WebResponse, } from './data-contracts';
42
+ export { ControllerGetMiddlewares, Middleware as MiddlewareDecorator, ParseRequestArgs, RequestSize, Route, } from './decorators';
43
+ export { ControllerBase, createRouter, type HttpMethod, type IController, WebRouter as UniversalRouter, WebRouter, } from './router';
44
+ export { IS_BUN, RUNTIME } from './runtime-detect';
45
+ export { type BuildableRouter, createServer, type ServerInstance, type StaticFileConfig, UniversalServer, type UniversalServerOptions, } from './server';
46
+ export { RuntimeUtils } from './utils';
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,cAAc,UAAU,CAAC;AAGzB,YAAY,EACX,aAAa,EACb,oBAAoB,IAAI,UAAU,EAClC,YAAY,EACZ,UAAU,IAAI,gBAAgB,EAC9B,UAAU,EACV,WAAW,GACX,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACN,wBAAwB,EACxB,UAAU,IAAI,mBAAmB,EACjC,gBAAgB,EAChB,WAAW,EACX,KAAK,GACL,MAAM,cAAc,CAAC;AAGtB,OAAO,EACN,cAAc,EACd,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,SAAS,IAAI,eAAe,EAC5B,SAAS,GACT,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EACN,KAAK,eAAe,EACpB,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,eAAe,EACf,KAAK,sBAAsB,GAC3B,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}