@quilla-be-kit/http 0.2.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 (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +400 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/adapter/hono/create-http-request.d.ts +15 -0
  5. package/dist/adapter/hono/create-http-request.d.ts.map +1 -0
  6. package/dist/adapter/hono/create-http-request.js +57 -0
  7. package/dist/adapter/hono/create-http-request.js.map +1 -0
  8. package/dist/adapter/hono/get-request-attributes.d.ts +2 -0
  9. package/dist/adapter/hono/get-request-attributes.d.ts.map +1 -0
  10. package/dist/adapter/hono/get-request-attributes.js +10 -0
  11. package/dist/adapter/hono/get-request-attributes.js.map +1 -0
  12. package/dist/adapter/hono/hono-middleware.adapter.d.ts +10 -0
  13. package/dist/adapter/hono/hono-middleware.adapter.d.ts.map +1 -0
  14. package/dist/adapter/hono/hono-middleware.adapter.js +13 -0
  15. package/dist/adapter/hono/hono-middleware.adapter.js.map +1 -0
  16. package/dist/adapter/hono/hono-request.adapter.d.ts +12 -0
  17. package/dist/adapter/hono/hono-request.adapter.d.ts.map +1 -0
  18. package/dist/adapter/hono/hono-request.adapter.js +99 -0
  19. package/dist/adapter/hono/hono-request.adapter.js.map +1 -0
  20. package/dist/adapter/hono/hono.server.d.ts +30 -0
  21. package/dist/adapter/hono/hono.server.d.ts.map +1 -0
  22. package/dist/adapter/hono/hono.server.js +64 -0
  23. package/dist/adapter/hono/hono.server.js.map +1 -0
  24. package/dist/adapter/hono/hono.types.d.ts +9 -0
  25. package/dist/adapter/hono/hono.types.d.ts.map +1 -0
  26. package/dist/adapter/hono/hono.types.js +4 -0
  27. package/dist/adapter/hono/hono.types.js.map +1 -0
  28. package/dist/adapter/hono/index.d.ts +2 -0
  29. package/dist/adapter/hono/index.d.ts.map +1 -0
  30. package/dist/adapter/hono/index.js +2 -0
  31. package/dist/adapter/hono/index.js.map +1 -0
  32. package/dist/decorator/authorize-scope.decorator.d.ts +6 -0
  33. package/dist/decorator/authorize-scope.decorator.d.ts.map +1 -0
  34. package/dist/decorator/authorize-scope.decorator.js +30 -0
  35. package/dist/decorator/authorize-scope.decorator.js.map +1 -0
  36. package/dist/decorator/controller.decorator.d.ts +2 -0
  37. package/dist/decorator/controller.decorator.d.ts.map +1 -0
  38. package/dist/decorator/controller.decorator.js +7 -0
  39. package/dist/decorator/controller.decorator.js.map +1 -0
  40. package/dist/decorator/index.d.ts +5 -0
  41. package/dist/decorator/index.d.ts.map +1 -0
  42. package/dist/decorator/index.js +5 -0
  43. package/dist/decorator/index.js.map +1 -0
  44. package/dist/decorator/method.decorators.d.ts +11 -0
  45. package/dist/decorator/method.decorators.d.ts.map +1 -0
  46. package/dist/decorator/method.decorators.js +27 -0
  47. package/dist/decorator/method.decorators.js.map +1 -0
  48. package/dist/decorator/route.metadata.d.ts +22 -0
  49. package/dist/decorator/route.metadata.d.ts.map +1 -0
  50. package/dist/decorator/route.metadata.js +61 -0
  51. package/dist/decorator/route.metadata.js.map +1 -0
  52. package/dist/decorator/validate-request.decorator.d.ts +7 -0
  53. package/dist/decorator/validate-request.decorator.d.ts.map +1 -0
  54. package/dist/decorator/validate-request.decorator.js +57 -0
  55. package/dist/decorator/validate-request.decorator.js.map +1 -0
  56. package/dist/error/index.d.ts +2 -0
  57. package/dist/error/index.d.ts.map +1 -0
  58. package/dist/error/index.js +2 -0
  59. package/dist/error/index.js.map +1 -0
  60. package/dist/error/resolve-http-error.d.ts +7 -0
  61. package/dist/error/resolve-http-error.d.ts.map +1 -0
  62. package/dist/error/resolve-http-error.js +43 -0
  63. package/dist/error/resolve-http-error.js.map +1 -0
  64. package/dist/index.d.ts +6 -0
  65. package/dist/index.d.ts.map +1 -0
  66. package/dist/index.js +6 -0
  67. package/dist/index.js.map +1 -0
  68. package/dist/request/authenticated-token.interface.d.ts +4 -0
  69. package/dist/request/authenticated-token.interface.d.ts.map +1 -0
  70. package/dist/request/authenticated-token.interface.js +2 -0
  71. package/dist/request/authenticated-token.interface.js.map +1 -0
  72. package/dist/request/http-attributes.d.ts +6 -0
  73. package/dist/request/http-attributes.d.ts.map +1 -0
  74. package/dist/request/http-attributes.js +6 -0
  75. package/dist/request/http-attributes.js.map +1 -0
  76. package/dist/request/http-middleware.type.d.ts +3 -0
  77. package/dist/request/http-middleware.type.d.ts.map +1 -0
  78. package/dist/request/http-middleware.type.js +2 -0
  79. package/dist/request/http-middleware.type.js.map +1 -0
  80. package/dist/request/http-request.interface.d.ts +18 -0
  81. package/dist/request/http-request.interface.d.ts.map +1 -0
  82. package/dist/request/http-request.interface.js +2 -0
  83. package/dist/request/http-request.interface.js.map +1 -0
  84. package/dist/request/http-response.type.d.ts +18 -0
  85. package/dist/request/http-response.type.d.ts.map +1 -0
  86. package/dist/request/http-response.type.js +2 -0
  87. package/dist/request/http-response.type.js.map +1 -0
  88. package/dist/request/index.d.ts +6 -0
  89. package/dist/request/index.d.ts.map +1 -0
  90. package/dist/request/index.js +2 -0
  91. package/dist/request/index.js.map +1 -0
  92. package/dist/router/auth-middleware-stack.type.d.ts +13 -0
  93. package/dist/router/auth-middleware-stack.type.d.ts.map +1 -0
  94. package/dist/router/auth-middleware-stack.type.js +2 -0
  95. package/dist/router/auth-middleware-stack.type.js.map +1 -0
  96. package/dist/router/controller-registration.type.d.ts +7 -0
  97. package/dist/router/controller-registration.type.d.ts.map +1 -0
  98. package/dist/router/controller-registration.type.js +2 -0
  99. package/dist/router/controller-registration.type.js.map +1 -0
  100. package/dist/router/http-module-meta.type.d.ts +8 -0
  101. package/dist/router/http-module-meta.type.d.ts.map +1 -0
  102. package/dist/router/http-module-meta.type.js +2 -0
  103. package/dist/router/http-module-meta.type.js.map +1 -0
  104. package/dist/router/index.d.ts +6 -0
  105. package/dist/router/index.d.ts.map +1 -0
  106. package/dist/router/index.js +2 -0
  107. package/dist/router/index.js.map +1 -0
  108. package/dist/router/normalized-route.type.d.ts +20 -0
  109. package/dist/router/normalized-route.type.d.ts.map +1 -0
  110. package/dist/router/normalized-route.type.js +2 -0
  111. package/dist/router/normalized-route.type.js.map +1 -0
  112. package/dist/router/router-options.type.d.ts +37 -0
  113. package/dist/router/router-options.type.d.ts.map +1 -0
  114. package/dist/router/router-options.type.js +2 -0
  115. package/dist/router/router-options.type.js.map +1 -0
  116. package/dist/router/router.d.ts +11 -0
  117. package/dist/router/router.d.ts.map +1 -0
  118. package/dist/router/router.js +143 -0
  119. package/dist/router/router.js.map +1 -0
  120. package/dist/server/index.d.ts +2 -0
  121. package/dist/server/index.d.ts.map +1 -0
  122. package/dist/server/index.js +2 -0
  123. package/dist/server/index.js.map +1 -0
  124. package/dist/server/middleware-adapter.interface.d.ts +5 -0
  125. package/dist/server/middleware-adapter.interface.d.ts.map +1 -0
  126. package/dist/server/middleware-adapter.interface.js +2 -0
  127. package/dist/server/middleware-adapter.interface.js.map +1 -0
  128. package/dist/server/request-adapter.interface.d.ts +7 -0
  129. package/dist/server/request-adapter.interface.d.ts.map +1 -0
  130. package/dist/server/request-adapter.interface.js +2 -0
  131. package/dist/server/request-adapter.interface.js.map +1 -0
  132. package/dist/server/web-server.interface.d.ts +6 -0
  133. package/dist/server/web-server.interface.d.ts.map +1 -0
  134. package/dist/server/web-server.interface.js +2 -0
  135. package/dist/server/web-server.interface.js.map +1 -0
  136. package/dist/validator/index.d.ts +4 -0
  137. package/dist/validator/index.d.ts.map +1 -0
  138. package/dist/validator/index.js +2 -0
  139. package/dist/validator/index.js.map +1 -0
  140. package/dist/validator/request-source.type.d.ts +2 -0
  141. package/dist/validator/request-source.type.d.ts.map +1 -0
  142. package/dist/validator/request-source.type.js +2 -0
  143. package/dist/validator/request-source.type.js.map +1 -0
  144. package/dist/validator/request-validator.interface.d.ts +30 -0
  145. package/dist/validator/request-validator.interface.d.ts.map +1 -0
  146. package/dist/validator/request-validator.interface.js +2 -0
  147. package/dist/validator/request-validator.interface.js.map +1 -0
  148. package/dist/validator/validation-result.type.d.ts +8 -0
  149. package/dist/validator/validation-result.type.d.ts.map +1 -0
  150. package/dist/validator/validation-result.type.js +2 -0
  151. package/dist/validator/validation-result.type.js.map +1 -0
  152. package/dist/validator/zod.d.ts +29 -0
  153. package/dist/validator/zod.d.ts.map +1 -0
  154. package/dist/validator/zod.js +43 -0
  155. package/dist/validator/zod.js.map +1 -0
  156. package/package.json +85 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-request.interface.d.ts","sourceRoot":"","sources":["../../src/request/http-request.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,MAAM,WAAW,WAAW;IAC1B,OAAO,IAAI,MAAM,CAAC;IAClB,SAAS,IAAI,MAAM,CAAC;IACpB,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC;IACvD,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACvC,OAAO,IAAI,OAAO,CAAC;IACnB,SAAS,IAAI,UAAU,GAAG,IAAI,CAAC;IAC/B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACnC,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC;IAC5D,mBAAmB,IAAI,gBAAgB,CAAC;IACxC,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAC7C,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAC5C,iBAAiB,CAAC,CAAC,KAAK,CAAC,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=http-request.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-request.interface.js","sourceRoot":"","sources":["../../src/request/http-request.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ export type HttpResponse = {
2
+ readonly httpCode: number;
3
+ readonly headers?: Record<string, string>;
4
+ readonly payload?: unknown;
5
+ readonly error?: {
6
+ readonly name: string;
7
+ readonly message: string;
8
+ readonly details?: unknown;
9
+ };
10
+ readonly metadata?: {
11
+ readonly pagination?: {
12
+ readonly total: number;
13
+ readonly page: number;
14
+ readonly limit: number;
15
+ };
16
+ };
17
+ };
18
+ //# sourceMappingURL=http-response.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-response.type.d.ts","sourceRoot":"","sources":["../../src/request/http-response.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE;QACf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;KAC5B,CAAC;IACF,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClB,QAAQ,CAAC,UAAU,CAAC,EAAE;YACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;YACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;SACxB,CAAC;KACH,CAAC;CACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=http-response.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-response.type.js","sourceRoot":"","sources":["../../src/request/http-response.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export type { HttpRequest } from './http-request.interface.js';
2
+ export type { HttpResponse } from './http-response.type.js';
3
+ export type { HttpMiddleware } from './http-middleware.type.js';
4
+ export type { AuthenticatedToken } from './authenticated-token.interface.js';
5
+ export { HttpAttributes } from './http-attributes.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { HttpAttributes } from './http-attributes.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { HttpMiddleware } from '../request/http-middleware.type.js';
2
+ /**
3
+ * Router runs phases in fixed order regardless of key declaration —
4
+ * `tokenVerification` first, then `sessionLoad` if present. Phase
5
+ * misordering is a type error, not a runtime bug.
6
+ */
7
+ export type AuthMiddlewareStack = {
8
+ /** Must populate `HttpAttributes.VERIFIED_TOKEN` on success. */
9
+ readonly tokenVerification: HttpMiddleware;
10
+ /** Optional — omit for services that verify tokens but don't load sessions. */
11
+ readonly sessionLoad?: HttpMiddleware;
12
+ };
13
+ //# sourceMappingURL=auth-middleware-stack.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-middleware-stack.type.d.ts","sourceRoot":"","sources":["../../src/router/auth-middleware-stack.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,gEAAgE;IAChE,QAAQ,CAAC,iBAAiB,EAAE,cAAc,CAAC;IAC3C,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,CAAC,EAAE,cAAc,CAAC;CACvC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=auth-middleware-stack.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-middleware-stack.type.js","sourceRoot":"","sources":["../../src/router/auth-middleware-stack.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { HttpMiddleware } from '../request/http-middleware.type.js';
2
+ export type ControllerRegistration = {
3
+ readonly controller: object;
4
+ readonly prefix?: string;
5
+ readonly middlewares?: readonly HttpMiddleware[];
6
+ };
7
+ //# sourceMappingURL=controller-registration.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller-registration.type.d.ts","sourceRoot":"","sources":["../../src/router/controller-registration.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CAClD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=controller-registration.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller-registration.type.js","sourceRoot":"","sources":["../../src/router/controller-registration.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type { HttpMiddleware } from '../request/http-middleware.type.js';
2
+ import type { ControllerRegistration } from './controller-registration.type.js';
3
+ export type HttpModuleMeta = {
4
+ readonly controllers?: readonly (object | ControllerRegistration)[];
5
+ readonly middlewares?: readonly HttpMiddleware[];
6
+ readonly prefix?: string;
7
+ };
8
+ //# sourceMappingURL=http-module-meta.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-module-meta.type.d.ts","sourceRoot":"","sources":["../../src/router/http-module-meta.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEhF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,sBAAsB,CAAC,EAAE,CAAC;IACpE,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACjD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=http-module-meta.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-module-meta.type.js","sourceRoot":"","sources":["../../src/router/http-module-meta.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export { Router } from './router.js';
2
+ export type { RouterOptions, RouterExecutionContextOptions, } from './router-options.type.js';
3
+ export type { AuthMiddlewareStack } from './auth-middleware-stack.type.js';
4
+ export type { ControllerRegistration } from './controller-registration.type.js';
5
+ export type { HttpModuleMeta } from './http-module-meta.type.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EACV,aAAa,EACb,6BAA6B,GAC9B,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,YAAY,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAChF,YAAY,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Router } from './router.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { HttpMethod } from '../decorator/route.metadata.js';
2
+ import type { HttpMiddleware } from '../request/http-middleware.type.js';
3
+ import type { HttpRequest } from '../request/http-request.interface.js';
4
+ import type { HttpResponse } from '../request/http-response.type.js';
5
+ export type NormalizedRoute = {
6
+ readonly httpMethod: HttpMethod;
7
+ readonly fullPath: string;
8
+ readonly public: boolean;
9
+ /**
10
+ * Complete ordered middleware chain for this route:
11
+ * `[system? → globalMiddlewares → (public ? [] : authMiddlewares) → moduleMiddlewares → registrationMiddlewares]`.
12
+ * Adapters iterate and wrap each entry; they do not re-compose the chain.
13
+ */
14
+ readonly middlewareChain: readonly HttpMiddleware[];
15
+ readonly handler: (request: HttpRequest) => Promise<HttpResponse>;
16
+ readonly handlerMethodName: string;
17
+ readonly controllerName: string;
18
+ readonly specificity: number;
19
+ };
20
+ //# sourceMappingURL=normalized-route.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalized-route.type.d.ts","sourceRoot":"","sources":["../../src/router/normalized-route.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAClE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=normalized-route.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalized-route.type.js","sourceRoot":"","sources":["../../src/router/normalized-route.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ import type { ExecutionContextProvider } from '@quilla-be-kit/execution-context';
2
+ import type { Component } from '@quilla-be-kit/runtime';
3
+ import type { HttpMiddleware } from '../request/http-middleware.type.js';
4
+ import type { AuthMiddlewareStack } from './auth-middleware-stack.type.js';
5
+ import type { ControllerRegistration } from './controller-registration.type.js';
6
+ import type { HttpModuleMeta } from './http-module-meta.type.js';
7
+ /**
8
+ * Execution-context bootstrap options. Router installs the bootstrap
9
+ * middleware internally so it runs before any consumer middleware on every
10
+ * route (public and non-public). Provider carries its own factory, so this
11
+ * option collapses to `{ provider, correlationIdHeader? }`.
12
+ */
13
+ export type RouterExecutionContextOptions = {
14
+ readonly provider: ExecutionContextProvider;
15
+ /** Header name to read the inbound correlation id from. Default: `x-correlation-id`. */
16
+ readonly correlationIdHeader?: string;
17
+ };
18
+ export type RouterOptions = {
19
+ readonly controllers?: readonly (object | ControllerRegistration)[];
20
+ readonly modules?: readonly Component<HttpModuleMeta>[];
21
+ /**
22
+ * Optional — when provided, Router installs a system-owned bootstrap that
23
+ * runs on every route. Required iff `authMiddlewares` is set (Router
24
+ * throws at construction otherwise). Handlers that never read
25
+ * `ExecutionContext` can skip this.
26
+ */
27
+ readonly executionContext?: RouterExecutionContextOptions;
28
+ /** Custom middlewares that run on every route after the system bootstrap. */
29
+ readonly globalMiddlewares?: readonly HttpMiddleware[];
30
+ /**
31
+ * Typed, phase-ordered auth stack. Runs only on non-public routes, after
32
+ * `globalMiddlewares`. `tokenVerification` always runs first, then
33
+ * `sessionLoad` if present.
34
+ */
35
+ readonly authMiddlewares?: AuthMiddlewareStack;
36
+ };
37
+ //# sourceMappingURL=router-options.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-options.type.d.ts","sourceRoot":"","sources":["../../src/router/router-options.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,wFAAwF;IACxF,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,sBAAsB,CAAC,EAAE,CAAC;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;IAExD;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,6BAA6B,CAAC;IAE1D,6EAA6E;IAC7E,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAEvD;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,mBAAmB,CAAC;CAChD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=router-options.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-options.type.js","sourceRoot":"","sources":["../../src/router/router-options.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { ExecutionContextProvider } from '@quilla-be-kit/execution-context';
2
+ import type { NormalizedRoute } from './normalized-route.type.js';
3
+ import type { RouterOptions } from './router-options.type.js';
4
+ export declare class Router {
5
+ private readonly routes;
6
+ private readonly executionContextProvider;
7
+ constructor(options: RouterOptions);
8
+ getRoutes(): readonly NormalizedRoute[];
9
+ getExecutionContextProvider(): ExecutionContextProvider | undefined;
10
+ }
11
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAWjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAiC,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAO7F,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;IACpD,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAuC;gBAEpE,OAAO,EAAE,aAAa;IA0ClC,SAAS,IAAI,SAAS,eAAe,EAAE;IAIvC,2BAA2B,IAAI,wBAAwB,GAAG,SAAS;CAGpE"}
@@ -0,0 +1,143 @@
1
+ import { getControllerPrefix, getControllerRoutes, } from '../decorator/route.metadata.js';
2
+ export class Router {
3
+ routes;
4
+ executionContextProvider;
5
+ constructor(options) {
6
+ if (options.authMiddlewares && !options.executionContext) {
7
+ throw new Error('Router: `authMiddlewares` requires `executionContext` — auth middlewares depend on an active ExecutionContext scope. Wire `{ provider }` on the `executionContext` option.');
8
+ }
9
+ this.executionContextProvider = options.executionContext?.provider;
10
+ const systemMiddleware = options.executionContext
11
+ ? buildExecutionContextMiddleware(options.executionContext)
12
+ : undefined;
13
+ const globalMiddlewares = options.globalMiddlewares ?? [];
14
+ const authChain = flattenAuthStack(options.authMiddlewares);
15
+ const registrations = [];
16
+ for (const raw of options.controllers ?? []) {
17
+ registrations.push({
18
+ ...normalizeRegistration(raw),
19
+ modulePrefix: '',
20
+ moduleMiddlewares: [],
21
+ });
22
+ }
23
+ for (const mod of options.modules ?? []) {
24
+ const meta = mod.meta;
25
+ if (!meta?.controllers)
26
+ continue;
27
+ for (const raw of meta.controllers) {
28
+ registrations.push({
29
+ ...normalizeRegistration(raw),
30
+ modulePrefix: meta.prefix ?? '',
31
+ moduleMiddlewares: meta.middlewares ?? [],
32
+ });
33
+ }
34
+ }
35
+ this.routes = buildRoutes(registrations, {
36
+ systemMiddleware,
37
+ globalMiddlewares,
38
+ authChain,
39
+ });
40
+ }
41
+ getRoutes() {
42
+ return this.routes;
43
+ }
44
+ getExecutionContextProvider() {
45
+ return this.executionContextProvider;
46
+ }
47
+ }
48
+ function buildExecutionContextMiddleware(options) {
49
+ const header = options.correlationIdHeader ?? 'x-correlation-id';
50
+ const { provider } = options;
51
+ return async (request, next) => {
52
+ const correlationId = request.getHeader(header);
53
+ const ctx = provider.factory.createBaselineContext(correlationId !== null ? { correlationId } : undefined);
54
+ await provider.runWithContext(ctx, next);
55
+ };
56
+ }
57
+ function flattenAuthStack(stack) {
58
+ if (!stack)
59
+ return [];
60
+ return stack.sessionLoad
61
+ ? [stack.tokenVerification, stack.sessionLoad]
62
+ : [stack.tokenVerification];
63
+ }
64
+ function buildRoutes(registrations, chain) {
65
+ const normalized = [];
66
+ const seen = new Map();
67
+ for (const reg of registrations) {
68
+ const controllerPrefix = getControllerPrefix(reg.controller);
69
+ const controllerName = reg.controller.constructor.name;
70
+ const routeDefs = getControllerRoutes(reg.controller);
71
+ for (const def of routeDefs) {
72
+ const fullPath = joinPath(reg.modulePrefix, reg.prefix ?? '', controllerPrefix, def.path);
73
+ const key = `${def.httpMethod} ${fullPath}`;
74
+ const existing = seen.get(key);
75
+ if (existing) {
76
+ throw new Error(`Duplicate route: ${key} declared in both "${existing}" and "${controllerName}.${def.handlerMethodName}"`);
77
+ }
78
+ seen.set(key, `${controllerName}.${def.handlerMethodName}`);
79
+ const registrationMiddlewares = reg.middlewares ?? [];
80
+ const middlewareChain = [];
81
+ if (chain.systemMiddleware)
82
+ middlewareChain.push(chain.systemMiddleware);
83
+ middlewareChain.push(...chain.globalMiddlewares);
84
+ if (!def.public)
85
+ middlewareChain.push(...chain.authChain);
86
+ middlewareChain.push(...reg.moduleMiddlewares, ...registrationMiddlewares);
87
+ normalized.push({
88
+ httpMethod: def.httpMethod,
89
+ fullPath,
90
+ public: def.public,
91
+ middlewareChain,
92
+ handler: buildHandler(reg.controller, def),
93
+ handlerMethodName: def.handlerMethodName,
94
+ controllerName,
95
+ specificity: computeSpecificity(fullPath),
96
+ });
97
+ }
98
+ }
99
+ return normalized.sort(compareBySpecificity);
100
+ }
101
+ function normalizeRegistration(raw) {
102
+ if ('controller' in raw && typeof raw.controller === 'object') {
103
+ return raw;
104
+ }
105
+ return { controller: raw };
106
+ }
107
+ function joinPath(...segments) {
108
+ const combined = segments
109
+ .map((s) => s.trim())
110
+ .filter((s) => s.length > 0)
111
+ .map((s) => (s.startsWith('/') ? s : `/${s}`))
112
+ .join('')
113
+ .replace(/\/+/g, '/')
114
+ .replace(/\/+$/, '');
115
+ return combined.length === 0 ? '/' : combined;
116
+ }
117
+ function buildHandler(controller, def) {
118
+ const methodName = def.handlerMethodName;
119
+ const methodRef = controller[methodName];
120
+ if (typeof methodRef !== 'function') {
121
+ throw new Error(`Controller "${controller.constructor.name}" has no method "${methodName}"`);
122
+ }
123
+ return (request) => methodRef.call(controller, request);
124
+ }
125
+ function computeSpecificity(path) {
126
+ const segments = path.split('/').filter(Boolean);
127
+ let score = 0;
128
+ for (const seg of segments) {
129
+ if (seg.startsWith(':'))
130
+ score += 2;
131
+ else if (seg === '*')
132
+ score += 1;
133
+ else
134
+ score += 3;
135
+ }
136
+ return score + segments.length;
137
+ }
138
+ function compareBySpecificity(a, b) {
139
+ if (a.specificity !== b.specificity)
140
+ return b.specificity - a.specificity;
141
+ return b.fullPath.length - a.fullPath.length;
142
+ }
143
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AAcxC,MAAM,OAAO,MAAM;IACA,MAAM,CAA6B;IACnC,wBAAwB,CAAuC;IAEhF,YAAY,OAAsB;QAChC,IAAI,OAAO,CAAC,eAAe,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;YACzD,MAAM,IAAI,KAAK,CACb,4KAA4K,CAC7K,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAAC,gBAAgB,EAAE,QAAQ,CAAC;QAEnE,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB;YAC/C,CAAC,CAAC,+BAA+B,CAAC,OAAO,CAAC,gBAAgB,CAAC;YAC3D,CAAC,CAAC,SAAS,CAAC;QACd,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC;QAC1D,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ED,SAAS,kBAAkB,CAAC,IAAY;IACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,KAAK,IAAI,CAAC,CAAC;aAC/B,IAAI,GAAG,KAAK,GAAG;YAAE,KAAK,IAAI,CAAC,CAAC;;YAC5B,KAAK,IAAI,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC;AACjC,CAAC;AAED,SAAS,oBAAoB,CAAC,CAAkB,EAAE,CAAkB;IAClE,IAAI,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,WAAW;QAAE,OAAO,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC;IAC1E,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type { WebServer } from './web-server.interface.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { HttpMiddleware } from '../request/http-middleware.type.js';
2
+ export interface MiddlewareAdapter {
3
+ wrap(mw: HttpMiddleware): unknown;
4
+ }
5
+ //# sourceMappingURL=middleware-adapter.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware-adapter.interface.d.ts","sourceRoot":"","sources":["../../src/server/middleware-adapter.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC;CACnC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=middleware-adapter.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware-adapter.interface.js","sourceRoot":"","sources":["../../src/server/middleware-adapter.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { HttpRequest } from '../request/http-request.interface.js';
2
+ import type { HttpResponse } from '../request/http-response.type.js';
3
+ export interface RequestAdapter {
4
+ controller(handler: (request: HttpRequest) => Promise<HttpResponse>): (frameworkContext: unknown) => Promise<unknown>;
5
+ toHttpRequest(frameworkContext: unknown): Promise<HttpRequest>;
6
+ }
7
+ //# sourceMappingURL=request-adapter.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-adapter.interface.d.ts","sourceRoot":"","sources":["../../src/server/request-adapter.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,WAAW,cAAc;IAC7B,UAAU,CACR,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,GACvD,CAAC,gBAAgB,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,aAAa,CAAC,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAChE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=request-adapter.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-adapter.interface.js","sourceRoot":"","sources":["../../src/server/request-adapter.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export interface WebServer {
2
+ bootstrap(): void | Promise<void>;
3
+ listen(): Promise<void>;
4
+ close(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=web-server.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-server.interface.d.ts","sourceRoot":"","sources":["../../src/server/web-server.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,SAAS,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=web-server.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-server.interface.js","sourceRoot":"","sources":["../../src/server/web-server.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export type { RequestSource } from './request-source.type.js';
2
+ export type { ValidationResult } from './validation-result.type.js';
3
+ export type { RequestValidator, SchemaDescription } from './request-validator.interface.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validator/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validator/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export type RequestSource = 'body' | 'params' | 'query';
2
+ //# sourceMappingURL=request-source.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-source.type.d.ts","sourceRoot":"","sources":["../../src/validator/request-source.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=request-source.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-source.type.js","sourceRoot":"","sources":["../../src/validator/request-source.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import type { ValidationResult } from './validation-result.type.js';
2
+ export type SchemaDescription = {
3
+ readonly keys: readonly string[];
4
+ };
5
+ export interface RequestValidator {
6
+ validate(schema: unknown, input: unknown): ValidationResult;
7
+ /**
8
+ * Optional schema introspection. When implemented, `@ValidateRequest`
9
+ * uses it to inject auth-derived fields (`scopeId`, `userId`) from the
10
+ * `ExecutionContext` into the validated input **only when the schema
11
+ * declares them**.
12
+ *
13
+ * Return `null` (or leave unimplemented) when the wrapped validator
14
+ * can't enumerate top-level field names — auth-injection is skipped in
15
+ * that case (fail-safe: no surprise fields written into schemas that
16
+ * didn't ask for them).
17
+ *
18
+ * Zod example:
19
+ *
20
+ * ```ts
21
+ * describeSchema(schema) {
22
+ * if (schema instanceof z.ZodObject) return { keys: Object.keys(schema.shape) };
23
+ * if (schema instanceof z.ZodEffects) return this.describeSchema(schema._def.schema);
24
+ * return null;
25
+ * }
26
+ * ```
27
+ */
28
+ describeSchema?(schema: unknown): SchemaDescription | null;
29
+ }
30
+ //# sourceMappingURL=request-validator.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-validator.interface.d.ts","sourceRoot":"","sources":["../../src/validator/request-validator.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC;IAC5D;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,cAAc,CAAC,CAAC,MAAM,EAAE,OAAO,GAAG,iBAAiB,GAAG,IAAI,CAAC;CAC5D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=request-validator.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-validator.interface.js","sourceRoot":"","sources":["../../src/validator/request-validator.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export type ValidationResult = {
2
+ readonly success: true;
3
+ readonly data: unknown;
4
+ } | {
5
+ readonly success: false;
6
+ readonly error: readonly unknown[];
7
+ };
8
+ //# sourceMappingURL=validation-result.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-result.type.d.ts","sourceRoot":"","sources":["../../src/validator/validation-result.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validation-result.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-result.type.js","sourceRoot":"","sources":["../../src/validator/validation-result.type.ts"],"names":[],"mappings":""}