@ddd-ts-kit/http 0.0.0-stage → 0.1.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 (394) hide show
  1. package/README.md +388 -2
  2. package/dist/criteria/coerce-value.d.ts +8 -0
  3. package/dist/criteria/coerce-value.d.ts.map +1 -0
  4. package/dist/criteria/coerce-value.js +29 -0
  5. package/dist/criteria/coerce-value.js.map +1 -0
  6. package/dist/criteria/criteria-from.d.ts +11 -0
  7. package/dist/criteria/criteria-from.d.ts.map +1 -0
  8. package/dist/criteria/criteria-from.js +17 -0
  9. package/dist/criteria/criteria-from.js.map +1 -0
  10. package/dist/criteria/criteria-parameters.d.ts +10 -0
  11. package/dist/criteria/criteria-parameters.d.ts.map +1 -0
  12. package/dist/criteria/criteria-parameters.js +45 -0
  13. package/dist/criteria/criteria-parameters.js.map +1 -0
  14. package/dist/criteria/criteria-query-options.d.ts +6 -0
  15. package/dist/criteria/criteria-query-options.d.ts.map +1 -0
  16. package/dist/criteria/criteria-query-options.js +2 -0
  17. package/dist/criteria/criteria-query-options.js.map +1 -0
  18. package/dist/criteria/criteria-query-schema.d.ts +10 -0
  19. package/dist/criteria/criteria-query-schema.d.ts.map +1 -0
  20. package/dist/criteria/criteria-query-schema.js +12 -0
  21. package/dist/criteria/criteria-query-schema.js.map +1 -0
  22. package/dist/criteria/filter-entries.d.ts +9 -0
  23. package/dist/criteria/filter-entries.d.ts.map +1 -0
  24. package/dist/criteria/filter-entries.js +28 -0
  25. package/dist/criteria/filter-entries.js.map +1 -0
  26. package/dist/criteria/filter-entry.d.ts +6 -0
  27. package/dist/criteria/filter-entry.d.ts.map +1 -0
  28. package/dist/criteria/filter-entry.js +2 -0
  29. package/dist/criteria/filter-entry.js.map +1 -0
  30. package/dist/criteria/parse-condition.d.ts +7 -0
  31. package/dist/criteria/parse-condition.d.ts.map +1 -0
  32. package/dist/criteria/parse-condition.js +52 -0
  33. package/dist/criteria/parse-condition.js.map +1 -0
  34. package/dist/criteria/parse-criteria-query.d.ts +5 -0
  35. package/dist/criteria/parse-criteria-query.d.ts.map +1 -0
  36. package/dist/criteria/parse-criteria-query.js +31 -0
  37. package/dist/criteria/parse-criteria-query.js.map +1 -0
  38. package/dist/criteria/parse-filters.d.ts +15 -0
  39. package/dist/criteria/parse-filters.d.ts.map +1 -0
  40. package/dist/criteria/parse-filters.js +52 -0
  41. package/dist/criteria/parse-filters.js.map +1 -0
  42. package/dist/criteria/sortable-fields.d.ts +4 -0
  43. package/dist/criteria/sortable-fields.d.ts.map +1 -0
  44. package/dist/criteria/sortable-fields.js +6 -0
  45. package/dist/criteria/sortable-fields.js.map +1 -0
  46. package/dist/criteria/split-list.d.ts +3 -0
  47. package/dist/criteria/split-list.d.ts.map +1 -0
  48. package/dist/criteria/split-list.js +19 -0
  49. package/dist/criteria/split-list.js.map +1 -0
  50. package/dist/docs/docs-page.d.ts +11 -0
  51. package/dist/docs/docs-page.d.ts.map +1 -0
  52. package/dist/docs/docs-page.js +18 -0
  53. package/dist/docs/docs-page.js.map +1 -0
  54. package/dist/docs/docs-ui.d.ts +2 -0
  55. package/dist/docs/docs-ui.d.ts.map +1 -0
  56. package/dist/docs/docs-ui.js +2 -0
  57. package/dist/docs/docs-ui.js.map +1 -0
  58. package/dist/docs/open-api-docs-routes.d.ts +22 -0
  59. package/dist/docs/open-api-docs-routes.d.ts.map +1 -0
  60. package/dist/docs/open-api-docs-routes.js +54 -0
  61. package/dist/docs/open-api-docs-routes.js.map +1 -0
  62. package/dist/docs.d.ts +3 -0
  63. package/dist/docs.d.ts.map +1 -0
  64. package/dist/docs.js +2 -0
  65. package/dist/docs.js.map +1 -0
  66. package/dist/error/create-error-mapper.d.ts +10 -0
  67. package/dist/error/create-error-mapper.d.ts.map +1 -0
  68. package/dist/error/create-error-mapper.js +12 -0
  69. package/dist/error/create-error-mapper.js.map +1 -0
  70. package/dist/error/default-error-mapping.d.ts +3 -0
  71. package/dist/error/default-error-mapping.d.ts.map +1 -0
  72. package/dist/error/default-error-mapping.js +9 -0
  73. package/dist/error/default-error-mapping.js.map +1 -0
  74. package/dist/error/error-mapper.d.ts +12 -0
  75. package/dist/error/error-mapper.d.ts.map +1 -0
  76. package/dist/error/error-mapper.js +8 -0
  77. package/dist/error/error-mapper.js.map +1 -0
  78. package/dist/error/error-mapping.d.ts +3 -0
  79. package/dist/error/error-mapping.d.ts.map +1 -0
  80. package/dist/error/error-mapping.js +2 -0
  81. package/dist/error/error-mapping.js.map +1 -0
  82. package/dist/error/forbidden-error.d.ts +5 -0
  83. package/dist/error/forbidden-error.d.ts.map +1 -0
  84. package/dist/error/forbidden-error.js +5 -0
  85. package/dist/error/forbidden-error.js.map +1 -0
  86. package/dist/error/internal-error-code.d.ts +2 -0
  87. package/dist/error/internal-error-code.d.ts.map +1 -0
  88. package/dist/error/internal-error-code.js +2 -0
  89. package/dist/error/internal-error-code.js.map +1 -0
  90. package/dist/error/problem.d.ts +11 -0
  91. package/dist/error/problem.d.ts.map +1 -0
  92. package/dist/error/problem.js +2 -0
  93. package/dist/error/problem.js.map +1 -0
  94. package/dist/error/response-contract-error.d.ts +7 -0
  95. package/dist/error/response-contract-error.d.ts.map +1 -0
  96. package/dist/error/response-contract-error.js +10 -0
  97. package/dist/error/response-contract-error.js.map +1 -0
  98. package/dist/error/status-title.d.ts +2 -0
  99. package/dist/error/status-title.d.ts.map +1 -0
  100. package/dist/error/status-title.js +28 -0
  101. package/dist/error/status-title.js.map +1 -0
  102. package/dist/error/to-problem.d.ts +4 -0
  103. package/dist/error/to-problem.d.ts.map +1 -0
  104. package/dist/error/to-problem.js +34 -0
  105. package/dist/error/to-problem.js.map +1 -0
  106. package/dist/error/unauthorized-error.d.ts +5 -0
  107. package/dist/error/unauthorized-error.d.ts.map +1 -0
  108. package/dist/error/unauthorized-error.js +5 -0
  109. package/dist/error/unauthorized-error.js.map +1 -0
  110. package/dist/express/mount-express.d.ts +10 -0
  111. package/dist/express/mount-express.d.ts.map +1 -0
  112. package/dist/express/mount-express.js +38 -0
  113. package/dist/express/mount-express.js.map +1 -0
  114. package/dist/express.d.ts +2 -0
  115. package/dist/express.d.ts.map +1 -0
  116. package/dist/express.js +2 -0
  117. package/dist/express.js.map +1 -0
  118. package/dist/fastify/fastify-mount-options.d.ts +3 -0
  119. package/dist/fastify/fastify-mount-options.d.ts.map +1 -0
  120. package/dist/fastify/fastify-mount-options.js +2 -0
  121. package/dist/fastify/fastify-mount-options.js.map +1 -0
  122. package/dist/fastify/fastify-routes.d.ts +6 -0
  123. package/dist/fastify/fastify-routes.d.ts.map +1 -0
  124. package/dist/fastify/fastify-routes.js +10 -0
  125. package/dist/fastify/fastify-routes.js.map +1 -0
  126. package/dist/fastify/mount-fastify.d.ts +6 -0
  127. package/dist/fastify/mount-fastify.d.ts.map +1 -0
  128. package/dist/fastify/mount-fastify.js +19 -0
  129. package/dist/fastify/mount-fastify.js.map +1 -0
  130. package/dist/fastify.d.ts +4 -0
  131. package/dist/fastify.d.ts.map +1 -0
  132. package/dist/fastify.js +3 -0
  133. package/dist/fastify.js.map +1 -0
  134. package/dist/index.d.ts +50 -0
  135. package/dist/index.d.ts.map +1 -0
  136. package/dist/index.js +27 -0
  137. package/dist/index.js.map +1 -0
  138. package/dist/nest/create-routes-module.d.ts +15 -0
  139. package/dist/nest/create-routes-module.d.ts.map +1 -0
  140. package/dist/nest/create-routes-module.js +54 -0
  141. package/dist/nest/create-routes-module.js.map +1 -0
  142. package/dist/nest/routes-factory.d.ts +8 -0
  143. package/dist/nest/routes-factory.d.ts.map +1 -0
  144. package/dist/nest/routes-factory.js +2 -0
  145. package/dist/nest/routes-factory.js.map +1 -0
  146. package/dist/nest/routes-mounter.d.ts +9 -0
  147. package/dist/nest/routes-mounter.d.ts.map +1 -0
  148. package/dist/nest/routes-mounter.js +8 -0
  149. package/dist/nest/routes-mounter.js.map +1 -0
  150. package/dist/nest.d.ts +4 -0
  151. package/dist/nest.d.ts.map +1 -0
  152. package/dist/nest.js +3 -0
  153. package/dist/nest.js.map +1 -0
  154. package/dist/openapi/check-open-api-drift.d.ts +6 -0
  155. package/dist/openapi/check-open-api-drift.d.ts.map +1 -0
  156. package/dist/openapi/check-open-api-drift.js +6 -0
  157. package/dist/openapi/check-open-api-drift.js.map +1 -0
  158. package/dist/openapi/compare.d.ts +3 -0
  159. package/dist/openapi/compare.d.ts.map +1 -0
  160. package/dist/openapi/compare.js +5 -0
  161. package/dist/openapi/compare.js.map +1 -0
  162. package/dist/openapi/definitions.d.ts +14 -0
  163. package/dist/openapi/definitions.d.ts.map +1 -0
  164. package/dist/openapi/definitions.js +61 -0
  165. package/dist/openapi/definitions.js.map +1 -0
  166. package/dist/openapi/generate-open-api.d.ts +21 -0
  167. package/dist/openapi/generate-open-api.d.ts.map +1 -0
  168. package/dist/openapi/generate-open-api.js +43 -0
  169. package/dist/openapi/generate-open-api.js.map +1 -0
  170. package/dist/openapi/open-api-document.d.ts +18 -0
  171. package/dist/openapi/open-api-document.d.ts.map +1 -0
  172. package/dist/openapi/open-api-document.js +2 -0
  173. package/dist/openapi/open-api-document.js.map +1 -0
  174. package/dist/openapi/open-api-info.d.ts +6 -0
  175. package/dist/openapi/open-api-info.d.ts.map +1 -0
  176. package/dist/openapi/open-api-info.js +2 -0
  177. package/dist/openapi/open-api-info.js.map +1 -0
  178. package/dist/openapi/open-api-path.d.ts +2 -0
  179. package/dist/openapi/open-api-path.d.ts.map +1 -0
  180. package/dist/openapi/open-api-path.js +4 -0
  181. package/dist/openapi/open-api-path.js.map +1 -0
  182. package/dist/openapi/open-api-server.d.ts +5 -0
  183. package/dist/openapi/open-api-server.d.ts.map +1 -0
  184. package/dist/openapi/open-api-server.js +2 -0
  185. package/dist/openapi/open-api-server.js.map +1 -0
  186. package/dist/openapi/path-items.d.ts +7 -0
  187. package/dist/openapi/path-items.d.ts.map +1 -0
  188. package/dist/openapi/path-items.js +43 -0
  189. package/dist/openapi/path-items.js.map +1 -0
  190. package/dist/openapi/path-parameters.d.ts +4 -0
  191. package/dist/openapi/path-parameters.d.ts.map +1 -0
  192. package/dist/openapi/path-parameters.js +13 -0
  193. package/dist/openapi/path-parameters.js.map +1 -0
  194. package/dist/openapi/problem-schema.d.ts +3 -0
  195. package/dist/openapi/problem-schema.d.ts.map +1 -0
  196. package/dist/openapi/problem-schema.js +27 -0
  197. package/dist/openapi/problem-schema.js.map +1 -0
  198. package/dist/openapi/requirement.d.ts +3 -0
  199. package/dist/openapi/requirement.d.ts.map +1 -0
  200. package/dist/openapi/requirement.js +5 -0
  201. package/dist/openapi/requirement.js.map +1 -0
  202. package/dist/openapi/responses.d.ts +7 -0
  203. package/dist/openapi/responses.d.ts.map +1 -0
  204. package/dist/openapi/responses.js +50 -0
  205. package/dist/openapi/responses.js.map +1 -0
  206. package/dist/openapi/schema-parameters.d.ts +5 -0
  207. package/dist/openapi/schema-parameters.d.ts.map +1 -0
  208. package/dist/openapi/schema-parameters.js +24 -0
  209. package/dist/openapi/schema-parameters.js.map +1 -0
  210. package/dist/openapi/stringify-open-api.d.ts +4 -0
  211. package/dist/openapi/stringify-open-api.d.ts.map +1 -0
  212. package/dist/openapi/stringify-open-api.js +5 -0
  213. package/dist/openapi/stringify-open-api.js.map +1 -0
  214. package/dist/openapi.d.ts +7 -0
  215. package/dist/openapi.d.ts.map +1 -0
  216. package/dist/openapi.js +4 -0
  217. package/dist/openapi.js.map +1 -0
  218. package/dist/pagination/issue.d.ts +3 -0
  219. package/dist/pagination/issue.d.ts.map +1 -0
  220. package/dist/pagination/issue.js +4 -0
  221. package/dist/pagination/issue.js.map +1 -0
  222. package/dist/pagination/limits-of.d.ts +3 -0
  223. package/dist/pagination/limits-of.d.ts.map +1 -0
  224. package/dist/pagination/limits-of.js +8 -0
  225. package/dist/pagination/limits-of.js.map +1 -0
  226. package/dist/pagination/page-body.d.ts +7 -0
  227. package/dist/pagination/page-body.d.ts.map +1 -0
  228. package/dist/pagination/page-body.js +2 -0
  229. package/dist/pagination/page-body.js.map +1 -0
  230. package/dist/pagination/page-query-options.d.ts +8 -0
  231. package/dist/pagination/page-query-options.d.ts.map +1 -0
  232. package/dist/pagination/page-query-options.js +2 -0
  233. package/dist/pagination/page-query-options.js.map +1 -0
  234. package/dist/pagination/page-query-schema.d.ts +6 -0
  235. package/dist/pagination/page-query-schema.d.ts.map +1 -0
  236. package/dist/pagination/page-query-schema.js +8 -0
  237. package/dist/pagination/page-query-schema.js.map +1 -0
  238. package/dist/pagination/page-request-from.d.ts +9 -0
  239. package/dist/pagination/page-request-from.d.ts.map +1 -0
  240. package/dist/pagination/page-request-from.js +16 -0
  241. package/dist/pagination/page-request-from.js.map +1 -0
  242. package/dist/pagination/page-request-parameters.d.ts +9 -0
  243. package/dist/pagination/page-request-parameters.d.ts.map +1 -0
  244. package/dist/pagination/page-request-parameters.js +30 -0
  245. package/dist/pagination/page-request-parameters.js.map +1 -0
  246. package/dist/pagination/page-response.d.ts +5 -0
  247. package/dist/pagination/page-response.d.ts.map +1 -0
  248. package/dist/pagination/page-response.js +9 -0
  249. package/dist/pagination/page-response.js.map +1 -0
  250. package/dist/pagination/page-schema-of.d.ts +9 -0
  251. package/dist/pagination/page-schema-of.d.ts.map +1 -0
  252. package/dist/pagination/page-schema-of.js +60 -0
  253. package/dist/pagination/page-schema-of.js.map +1 -0
  254. package/dist/pagination/parse-page-query.d.ts +5 -0
  255. package/dist/pagination/parse-page-query.d.ts.map +1 -0
  256. package/dist/pagination/parse-page-query.js +108 -0
  257. package/dist/pagination/parse-page-query.js.map +1 -0
  258. package/dist/pipeline/assert-declared-response.d.ts +4 -0
  259. package/dist/pipeline/assert-declared-response.d.ts.map +1 -0
  260. package/dist/pipeline/assert-declared-response.js +18 -0
  261. package/dist/pipeline/assert-declared-response.js.map +1 -0
  262. package/dist/pipeline/correlation-header.d.ts +2 -0
  263. package/dist/pipeline/correlation-header.d.ts.map +1 -0
  264. package/dist/pipeline/correlation-header.js +2 -0
  265. package/dist/pipeline/correlation-header.js.map +1 -0
  266. package/dist/pipeline/correlation-id-of.d.ts +4 -0
  267. package/dist/pipeline/correlation-id-of.d.ts.map +1 -0
  268. package/dist/pipeline/correlation-id-of.js +7 -0
  269. package/dist/pipeline/correlation-id-of.js.map +1 -0
  270. package/dist/pipeline/error-context.d.ts +15 -0
  271. package/dist/pipeline/error-context.d.ts.map +1 -0
  272. package/dist/pipeline/error-context.js +2 -0
  273. package/dist/pipeline/error-context.js.map +1 -0
  274. package/dist/pipeline/execute-options.d.ts +40 -0
  275. package/dist/pipeline/execute-options.d.ts.map +1 -0
  276. package/dist/pipeline/execute-options.js +2 -0
  277. package/dist/pipeline/execute-options.js.map +1 -0
  278. package/dist/pipeline/execute-route.d.ts +6 -0
  279. package/dist/pipeline/execute-route.d.ts.map +1 -0
  280. package/dist/pipeline/execute-route.js +108 -0
  281. package/dist/pipeline/execute-route.js.map +1 -0
  282. package/dist/pipeline/execution-of-request.d.ts +16 -0
  283. package/dist/pipeline/execution-of-request.d.ts.map +1 -0
  284. package/dist/pipeline/execution-of-request.js +44 -0
  285. package/dist/pipeline/execution-of-request.js.map +1 -0
  286. package/dist/pipeline/raw-request.d.ts +10 -0
  287. package/dist/pipeline/raw-request.d.ts.map +1 -0
  288. package/dist/pipeline/raw-request.js +2 -0
  289. package/dist/pipeline/raw-request.js.map +1 -0
  290. package/dist/pipeline/report-http-errors.d.ts +11 -0
  291. package/dist/pipeline/report-http-errors.d.ts.map +1 -0
  292. package/dist/pipeline/report-http-errors.js +17 -0
  293. package/dist/pipeline/report-http-errors.js.map +1 -0
  294. package/dist/pipeline/route-around.d.ts +5 -0
  295. package/dist/pipeline/route-around.d.ts.map +1 -0
  296. package/dist/pipeline/route-around.js +2 -0
  297. package/dist/pipeline/route-around.js.map +1 -0
  298. package/dist/pipeline/route-response.d.ts +7 -0
  299. package/dist/pipeline/route-response.d.ts.map +1 -0
  300. package/dist/pipeline/route-response.js +2 -0
  301. package/dist/pipeline/route-response.js.map +1 -0
  302. package/dist/pipeline/serialize-body.d.ts +7 -0
  303. package/dist/pipeline/serialize-body.d.ts.map +1 -0
  304. package/dist/pipeline/serialize-body.js +16 -0
  305. package/dist/pipeline/serialize-body.js.map +1 -0
  306. package/dist/pipeline/validate-request.d.ts +8 -0
  307. package/dist/pipeline/validate-request.d.ts.map +1 -0
  308. package/dist/pipeline/validate-request.js +30 -0
  309. package/dist/pipeline/validate-request.js.map +1 -0
  310. package/dist/pipeline/well-formed-identifier.d.ts +3 -0
  311. package/dist/pipeline/well-formed-identifier.d.ts.map +1 -0
  312. package/dist/pipeline/well-formed-identifier.js +6 -0
  313. package/dist/pipeline/well-formed-identifier.js.map +1 -0
  314. package/dist/route/assert-unique-routes.d.ts +3 -0
  315. package/dist/route/assert-unique-routes.d.ts.map +1 -0
  316. package/dist/route/assert-unique-routes.js +22 -0
  317. package/dist/route/assert-unique-routes.js.map +1 -0
  318. package/dist/route/define-route.d.ts +7 -0
  319. package/dist/route/define-route.d.ts.map +1 -0
  320. package/dist/route/define-route.js +17 -0
  321. package/dist/route/define-route.js.map +1 -0
  322. package/dist/route/define-routes.d.ts +4 -0
  323. package/dist/route/define-routes.d.ts.map +1 -0
  324. package/dist/route/define-routes.js +11 -0
  325. package/dist/route/define-routes.js.map +1 -0
  326. package/dist/route/duplicate-route-error.d.ts +4 -0
  327. package/dist/route/duplicate-route-error.d.ts.map +1 -0
  328. package/dist/route/duplicate-route-error.js +7 -0
  329. package/dist/route/duplicate-route-error.js.map +1 -0
  330. package/dist/route/handler-input.d.ts +23 -0
  331. package/dist/route/handler-input.d.ts.map +1 -0
  332. package/dist/route/handler-input.js +2 -0
  333. package/dist/route/handler-input.js.map +1 -0
  334. package/dist/route/handler-result.d.ts +20 -0
  335. package/dist/route/handler-result.d.ts.map +1 -0
  336. package/dist/route/handler-result.js +2 -0
  337. package/dist/route/handler-result.js.map +1 -0
  338. package/dist/route/http-method.d.ts +2 -0
  339. package/dist/route/http-method.d.ts.map +1 -0
  340. package/dist/route/http-method.js +2 -0
  341. package/dist/route/http-method.js.map +1 -0
  342. package/dist/route/prefix-routes.d.ts +4 -0
  343. package/dist/route/prefix-routes.d.ts.map +1 -0
  344. package/dist/route/prefix-routes.js +10 -0
  345. package/dist/route/prefix-routes.js.map +1 -0
  346. package/dist/route/raw-headers.d.ts +2 -0
  347. package/dist/route/raw-headers.d.ts.map +1 -0
  348. package/dist/route/raw-headers.js +2 -0
  349. package/dist/route/raw-headers.js.map +1 -0
  350. package/dist/route/request-context.d.ts +13 -0
  351. package/dist/route/request-context.d.ts.map +1 -0
  352. package/dist/route/request-context.js +2 -0
  353. package/dist/route/request-context.js.map +1 -0
  354. package/dist/route/request-schemas.d.ts +8 -0
  355. package/dist/route/request-schemas.d.ts.map +1 -0
  356. package/dist/route/request-schemas.js +2 -0
  357. package/dist/route/request-schemas.js.map +1 -0
  358. package/dist/route/response-spec.d.ts +6 -0
  359. package/dist/route/response-spec.d.ts.map +1 -0
  360. package/dist/route/response-spec.js +2 -0
  361. package/dist/route/response-spec.js.map +1 -0
  362. package/dist/route/responses-spec.d.ts +5 -0
  363. package/dist/route/responses-spec.d.ts.map +1 -0
  364. package/dist/route/responses-spec.js +2 -0
  365. package/dist/route/responses-spec.js.map +1 -0
  366. package/dist/route/route-handler.d.ts +6 -0
  367. package/dist/route/route-handler.d.ts.map +1 -0
  368. package/dist/route/route-handler.js +2 -0
  369. package/dist/route/route-handler.js.map +1 -0
  370. package/dist/route/route-input.d.ts +10 -0
  371. package/dist/route/route-input.d.ts.map +1 -0
  372. package/dist/route/route-input.js +2 -0
  373. package/dist/route/route-input.js.map +1 -0
  374. package/dist/route/route-output.d.ts +6 -0
  375. package/dist/route/route-output.d.ts.map +1 -0
  376. package/dist/route/route-output.js +2 -0
  377. package/dist/route/route-output.js.map +1 -0
  378. package/dist/route/route-spec.d.ts +23 -0
  379. package/dist/route/route-spec.d.ts.map +1 -0
  380. package/dist/route/route-spec.js +2 -0
  381. package/dist/route/route-spec.js.map +1 -0
  382. package/dist/route/route.d.ts +11 -0
  383. package/dist/route/route.d.ts.map +1 -0
  384. package/dist/route/route.js +2 -0
  385. package/dist/route/route.js.map +1 -0
  386. package/dist/route/without-trailing-slashes.d.ts +3 -0
  387. package/dist/route/without-trailing-slashes.d.ts.map +1 -0
  388. package/dist/route/without-trailing-slashes.js +9 -0
  389. package/dist/route/without-trailing-slashes.js.map +1 -0
  390. package/dist/support/is-record.d.ts +2 -0
  391. package/dist/support/is-record.d.ts.map +1 -0
  392. package/dist/support/is-record.js +4 -0
  393. package/dist/support/is-record.js.map +1 -0
  394. package/package.json +82 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"problem.d.ts","sourceRoot":"","sources":["../../src/error/problem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=problem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"problem.js","sourceRoot":"","sources":["../../src/error/problem.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { ValidationIssue } from '@ddd-ts-kit/validation';
2
+ /** The route answered something its declaration does not allow; reported as a 500. */
3
+ export declare class ResponseContractError extends Error {
4
+ readonly issues: readonly ValidationIssue[];
5
+ constructor(message: string, issues?: readonly ValidationIssue[]);
6
+ }
7
+ //# sourceMappingURL=response-contract-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-contract-error.d.ts","sourceRoot":"","sources":["../../src/error/response-contract-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,sFAAsF;AACtF,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IAE5C,YAAY,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,SAAS,eAAe,EAAO,EAInE;CACF"}
@@ -0,0 +1,10 @@
1
+ /** The route answered something its declaration does not allow; reported as a 500. */
2
+ export class ResponseContractError extends Error {
3
+ issues;
4
+ constructor(message, issues = []) {
5
+ super(message);
6
+ this.name = 'ResponseContractError';
7
+ this.issues = issues;
8
+ }
9
+ }
10
+ //# sourceMappingURL=response-contract-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-contract-error.js","sourceRoot":"","sources":["../../src/error/response-contract-error.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACrC,MAAM,CAA6B;IAE5C,YAAY,OAAe,EAAE,MAAM,GAA+B,EAAE;QAClE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export declare function statusTitle(status: number): string;
2
+ //# sourceMappingURL=status-title.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-title.d.ts","sourceRoot":"","sources":["../../src/error/status-title.ts"],"names":[],"mappings":"AAyBA,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD"}
@@ -0,0 +1,28 @@
1
+ const STATUS_TITLES = {
2
+ 400: 'Bad Request',
3
+ 401: 'Unauthorized',
4
+ 402: 'Payment Required',
5
+ 403: 'Forbidden',
6
+ 404: 'Not Found',
7
+ 405: 'Method Not Allowed',
8
+ 406: 'Not Acceptable',
9
+ 408: 'Request Timeout',
10
+ 409: 'Conflict',
11
+ 410: 'Gone',
12
+ 412: 'Precondition Failed',
13
+ 413: 'Content Too Large',
14
+ 415: 'Unsupported Media Type',
15
+ 422: 'Unprocessable Content',
16
+ 423: 'Locked',
17
+ 428: 'Precondition Required',
18
+ 429: 'Too Many Requests',
19
+ 500: 'Internal Server Error',
20
+ 501: 'Not Implemented',
21
+ 502: 'Bad Gateway',
22
+ 503: 'Service Unavailable',
23
+ 504: 'Gateway Timeout',
24
+ };
25
+ export function statusTitle(status) {
26
+ return STATUS_TITLES[status] ?? (status >= 500 ? 'Server Error' : 'Client Error');
27
+ }
28
+ //# sourceMappingURL=status-title.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-title.js","sourceRoot":"","sources":["../../src/error/status-title.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAqC;IACtD,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,wBAAwB;IAC7B,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,iBAAiB;CACvB,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;AACpF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ErrorMapper } from './error-mapper.js';
2
+ import type { Problem } from './problem.js';
3
+ export declare function toProblem(error: unknown, mapper: ErrorMapper, requestId: string): Problem;
4
+ //# sourceMappingURL=to-problem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-problem.d.ts","sourceRoot":"","sources":["../../src/error/to-problem.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAqBzF"}
@@ -0,0 +1,34 @@
1
+ import { DomainError } from '@ddd-ts-kit/kernel';
2
+ import { ValidationError } from '@ddd-ts-kit/validation';
3
+ import { INTERNAL_ERROR_CODE } from './internal-error-code.js';
4
+ import { statusTitle } from './status-title.js';
5
+ export function toProblem(error, mapper, requestId) {
6
+ if (!(error instanceof DomainError)) {
7
+ return internalProblem(requestId);
8
+ }
9
+ const status = mapper.statusOf(error.code);
10
+ if (status >= 500) {
11
+ // A domain error mapped to a server fault is no longer the client's business.
12
+ return { ...internalProblem(requestId), status, title: statusTitle(status), code: error.code };
13
+ }
14
+ return {
15
+ type: mapper.typeOf(error.code),
16
+ title: statusTitle(status),
17
+ status,
18
+ code: error.code,
19
+ detail: error.message,
20
+ ...(error instanceof ValidationError ? { issues: error.issues } : {}),
21
+ requestId,
22
+ };
23
+ }
24
+ // The message of an unexpected error quotes data and internals: it never leaves the process.
25
+ function internalProblem(requestId) {
26
+ return {
27
+ type: 'about:blank',
28
+ title: 'Internal Server Error',
29
+ status: 500,
30
+ code: INTERNAL_ERROR_CODE,
31
+ requestId,
32
+ };
33
+ }
34
+ //# sourceMappingURL=to-problem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-problem.js","sourceRoot":"","sources":["../../src/error/to-problem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,SAAS,CAAC,KAAc,EAAE,MAAmB,EAAE,SAAiB;IAC9E,IAAI,CAAC,CAAC,KAAK,YAAY,WAAW,CAAC,EAAE,CAAC;QACpC,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE3C,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QAClB,8EAA8E;QAC9E,OAAO,EAAE,GAAG,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IACjG,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;QAC/B,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC;QAC1B,MAAM;QACN,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,MAAM,EAAE,KAAK,CAAC,OAAO;QACrB,GAAG,CAAC,KAAK,YAAY,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrE,SAAS;KACV,CAAC;AACJ,CAAC;AAED,6FAA6F;AAC7F,SAAS,eAAe,CAAC,SAAiB;IACxC,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,uBAAuB;QAC9B,MAAM,EAAE,GAAG;QACX,IAAI,EAAE,mBAAmB;QACzB,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { DomainError } from '@ddd-ts-kit/kernel';
2
+ export declare class UnauthorizedError extends DomainError {
3
+ readonly code = "UNAUTHORIZED";
4
+ }
5
+ //# sourceMappingURL=unauthorized-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unauthorized-error.d.ts","sourceRoot":"","sources":["../../src/error/unauthorized-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,IAAI,kBAAkB;CAChC"}
@@ -0,0 +1,5 @@
1
+ import { DomainError } from '@ddd-ts-kit/kernel';
2
+ export class UnauthorizedError extends DomainError {
3
+ code = 'UNAUTHORIZED';
4
+ }
5
+ //# sourceMappingURL=unauthorized-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unauthorized-error.js","sourceRoot":"","sources":["../../src/error/unauthorized-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IACvC,IAAI,GAAG,cAAc,CAAC;CAChC"}
@@ -0,0 +1,10 @@
1
+ import type { IRouter } from 'express';
2
+ import type { ExecuteOptions } from '../pipeline/execute-options.js';
3
+ import type { Route } from '../route/route.js';
4
+ export type ExpressMountOptions = ExecuteOptions;
5
+ /**
6
+ * Registers the routes on an Express 5 application or router. A JSON body parser
7
+ * (`express.json()`) must be installed before, otherwise bodies reach validation as `undefined`.
8
+ */
9
+ export declare function mountExpress(target: IRouter, routes: readonly Route[], options?: ExpressMountOptions): void;
10
+ //# sourceMappingURL=mount-express.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount-express.d.ts","sourceRoot":"","sources":["../../src/express/mount-express.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,SAAS,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAMjD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,OAAO,GAAE,mBAAwB,GAAG,IAAI,CAQ/G"}
@@ -0,0 +1,38 @@
1
+ import { executeRoute } from '../pipeline/execute-route.js';
2
+ import { serializeBody } from '../pipeline/serialize-body.js';
3
+ import { assertUniqueRoutes } from '../route/assert-unique-routes.js';
4
+ /**
5
+ * Registers the routes on an Express 5 application or router. A JSON body parser
6
+ * (`express.json()`) must be installed before, otherwise bodies reach validation as `undefined`.
7
+ */
8
+ export function mountExpress(target, routes, options = {}) {
9
+ assertUniqueRoutes(routes);
10
+ const register = registrarOf(target);
11
+ for (const route of routes) {
12
+ register[route.method](route.path, handlerOf(route, options));
13
+ }
14
+ }
15
+ function registrarOf(target) {
16
+ return {
17
+ GET: (path, handler) => target.get(path, handler),
18
+ POST: (path, handler) => target.post(path, handler),
19
+ PUT: (path, handler) => target.put(path, handler),
20
+ PATCH: (path, handler) => target.patch(path, handler),
21
+ DELETE: (path, handler) => target.delete(path, handler),
22
+ HEAD: (path, handler) => target.head(path, handler),
23
+ OPTIONS: (path, handler) => target.options(path, handler),
24
+ };
25
+ }
26
+ function handlerOf(route, options) {
27
+ return async (request, response) => {
28
+ const { params, query, headers } = request;
29
+ const body = request.body;
30
+ const result = await executeRoute(route, { params, query, headers, body, raw: request }, options);
31
+ response.status(result.status);
32
+ for (const [name, value] of Object.entries(result.headers)) {
33
+ response.setHeader(name, value);
34
+ }
35
+ response.end(serializeBody(result));
36
+ };
37
+ }
38
+ //# sourceMappingURL=mount-express.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount-express.js","sourceRoot":"","sources":["../../src/express/mount-express.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAUtE;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAe,EAAE,MAAwB,EAAE,OAAO,GAAwB,EAAE;IACvG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAErC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,MAAe;IAClC,OAAO;QACL,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;QACjD,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC;QACnD,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;QACjD,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;QACrD,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;QACvD,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC;QACnD,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;KAC1D,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,KAAY,EAAE,OAA4B;IAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;QACjC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAC3C,MAAM,IAAI,GAAY,OAAO,CAAC,IAAI,CAAC;QACnC,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QAElG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAE/B,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3D,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;QAED,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { mountExpress, type ExpressMountOptions } from './express/mount-express.js';
2
+ //# sourceMappingURL=express.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../src/express.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { mountExpress } from './express/mount-express.js';
2
+ //# sourceMappingURL=express.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"express.js","sourceRoot":"","sources":["../src/express.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA4B,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ExecuteOptions } from '../pipeline/execute-options.js';
2
+ export type FastifyMountOptions = ExecuteOptions;
3
+ //# sourceMappingURL=fastify-mount-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fastify-mount-options.d.ts","sourceRoot":"","sources":["../../src/fastify/fastify-mount-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=fastify-mount-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fastify-mount-options.js","sourceRoot":"","sources":["../../src/fastify/fastify-mount-options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { FastifyPluginAsync } from 'fastify';
2
+ import type { Route } from '../route/route.js';
3
+ import type { FastifyMountOptions } from './fastify-mount-options.js';
4
+ /** The same as `mountFastify`, as a plugin: `app.register(fastifyRoutes(routes), { prefix })`. */
5
+ export declare function fastifyRoutes(routes: readonly Route[], options?: FastifyMountOptions): FastifyPluginAsync;
6
+ //# sourceMappingURL=fastify-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fastify-routes.d.ts","sourceRoot":"","sources":["../../src/fastify/fastify-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,OAAO,GAAE,mBAAwB,GAAG,kBAAkB,CAM7G"}
@@ -0,0 +1,10 @@
1
+ import { assertUniqueRoutes } from '../route/assert-unique-routes.js';
2
+ import { mountFastify } from './mount-fastify.js';
3
+ /** The same as `mountFastify`, as a plugin: `app.register(fastifyRoutes(routes), { prefix })`. */
4
+ export function fastifyRoutes(routes, options = {}) {
5
+ assertUniqueRoutes(routes);
6
+ return async (instance) => {
7
+ mountFastify(instance, routes, options);
8
+ };
9
+ }
10
+ //# sourceMappingURL=fastify-routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fastify-routes.js","sourceRoot":"","sources":["../../src/fastify/fastify-routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,kGAAkG;AAClG,MAAM,UAAU,aAAa,CAAC,MAAwB,EAAE,OAAO,GAAwB,EAAE;IACvF,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,OAAO,KAAK,EAAE,QAAQ,EAAE,EAAE;QACxB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { FastifyInstance } from 'fastify';
2
+ import type { Route } from '../route/route.js';
3
+ import type { FastifyMountOptions } from './fastify-mount-options.js';
4
+ /** Registers the routes on a Fastify 5 instance. Validation stays in the shared pipeline. */
5
+ export declare function mountFastify(instance: FastifyInstance, routes: readonly Route[], options?: FastifyMountOptions): void;
6
+ //# sourceMappingURL=mount-fastify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount-fastify.d.ts","sourceRoot":"","sources":["../../src/fastify/mount-fastify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,6FAA6F;AAC7F,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,SAAS,KAAK,EAAE,EACxB,OAAO,GAAE,mBAAwB,GAChC,IAAI,CAeN"}
@@ -0,0 +1,19 @@
1
+ import { executeRoute } from '../pipeline/execute-route.js';
2
+ import { serializeBody } from '../pipeline/serialize-body.js';
3
+ import { assertUniqueRoutes } from '../route/assert-unique-routes.js';
4
+ /** Registers the routes on a Fastify 5 instance. Validation stays in the shared pipeline. */
5
+ export function mountFastify(instance, routes, options = {}) {
6
+ assertUniqueRoutes(routes);
7
+ for (const route of routes) {
8
+ instance.route({
9
+ method: route.method,
10
+ url: route.path,
11
+ handler: async (request, reply) => {
12
+ const { params, query, headers, body } = request;
13
+ const result = await executeRoute(route, { params, query, headers, body, raw: request }, options);
14
+ return reply.code(result.status).headers(result.headers).send(serializeBody(result));
15
+ },
16
+ });
17
+ }
18
+ }
19
+ //# sourceMappingURL=mount-fastify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount-fastify.js","sourceRoot":"","sources":["../../src/fastify/mount-fastify.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAItE,6FAA6F;AAC7F,MAAM,UAAU,YAAY,CAC1B,QAAyB,EACzB,MAAwB,EACxB,OAAO,GAAwB,EAAE;IAEjC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,QAAQ,CAAC,KAAK,CAAC;YACb,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,GAAG,EAAE,KAAK,CAAC,IAAI;YACf,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;gBAChC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;gBACjD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;gBAElG,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;YACvF,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type { FastifyMountOptions } from './fastify/fastify-mount-options.js';
2
+ export { fastifyRoutes } from './fastify/fastify-routes.js';
3
+ export { mountFastify } from './fastify/mount-fastify.js';
4
+ //# sourceMappingURL=fastify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { fastifyRoutes } from './fastify/fastify-routes.js';
2
+ export { mountFastify } from './fastify/mount-fastify.js';
3
+ //# sourceMappingURL=fastify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fastify.js","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,50 @@
1
+ export { criteriaFrom } from './criteria/criteria-from.js';
2
+ export { criteriaParameters } from './criteria/criteria-parameters.js';
3
+ export type { CriteriaQueryOptions } from './criteria/criteria-query-options.js';
4
+ export { criteriaQuerySchema } from './criteria/criteria-query-schema.js';
5
+ export { createErrorMapper, type ErrorMapperOptions } from './error/create-error-mapper.js';
6
+ export { DEFAULT_ERROR_MAPPING } from './error/default-error-mapping.js';
7
+ export { ErrorMapper } from './error/error-mapper.js';
8
+ export type { ErrorMapping } from './error/error-mapping.js';
9
+ export { ForbiddenError } from './error/forbidden-error.js';
10
+ export { INTERNAL_ERROR_CODE } from './error/internal-error-code.js';
11
+ export type { Problem } from './error/problem.js';
12
+ export { ResponseContractError } from './error/response-contract-error.js';
13
+ export { statusTitle } from './error/status-title.js';
14
+ export { toProblem } from './error/to-problem.js';
15
+ export { UnauthorizedError } from './error/unauthorized-error.js';
16
+ export type { PageBody } from './pagination/page-body.js';
17
+ export type { PageQueryOptions } from './pagination/page-query-options.js';
18
+ export { pageQuerySchema } from './pagination/page-query-schema.js';
19
+ export { pageRequestFrom } from './pagination/page-request-from.js';
20
+ export { pageRequestParameters } from './pagination/page-request-parameters.js';
21
+ export { pageResponse } from './pagination/page-response.js';
22
+ export { pageSchemaOf } from './pagination/page-schema-of.js';
23
+ export { CORRELATION_HEADER } from './pipeline/correlation-header.js';
24
+ export type { ErrorContext } from './pipeline/error-context.js';
25
+ export type { ExecuteOptions } from './pipeline/execute-options.js';
26
+ export { executeRoute } from './pipeline/execute-route.js';
27
+ export type { RawRequest } from './pipeline/raw-request.js';
28
+ export type { RouteAround } from './pipeline/route-around.js';
29
+ export { reportHttpErrors } from './pipeline/report-http-errors.js';
30
+ export type { RouteResponse } from './pipeline/route-response.js';
31
+ export { serializeBody } from './pipeline/serialize-body.js';
32
+ export { assertUniqueRoutes } from './route/assert-unique-routes.js';
33
+ export { defineRoute } from './route/define-route.js';
34
+ export { defineRoutes } from './route/define-routes.js';
35
+ export { DuplicateRouteError } from './route/duplicate-route-error.js';
36
+ export type { HandlerInput } from './route/handler-input.js';
37
+ export type { HandlerResult } from './route/handler-result.js';
38
+ export type { HttpMethod } from './route/http-method.js';
39
+ export { prefixRoutes } from './route/prefix-routes.js';
40
+ export type { RawHeaders } from './route/raw-headers.js';
41
+ export type { RequestContext } from './route/request-context.js';
42
+ export type { RequestSchemas } from './route/request-schemas.js';
43
+ export type { ResponseSpec } from './route/response-spec.js';
44
+ export type { ResponsesSpec } from './route/responses-spec.js';
45
+ export type { RouteHandler } from './route/route-handler.js';
46
+ export type { RouteInput } from './route/route-input.js';
47
+ export type { RouteOutput } from './route/route-output.js';
48
+ export type { RouteSpec } from './route/route-spec.js';
49
+ export type { Route } from './route/route.js';
50
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,YAAY,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,YAAY,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ export { criteriaFrom } from './criteria/criteria-from.js';
2
+ export { criteriaParameters } from './criteria/criteria-parameters.js';
3
+ export { criteriaQuerySchema } from './criteria/criteria-query-schema.js';
4
+ export { createErrorMapper } from './error/create-error-mapper.js';
5
+ export { DEFAULT_ERROR_MAPPING } from './error/default-error-mapping.js';
6
+ export { ErrorMapper } from './error/error-mapper.js';
7
+ export { ForbiddenError } from './error/forbidden-error.js';
8
+ export { INTERNAL_ERROR_CODE } from './error/internal-error-code.js';
9
+ export { ResponseContractError } from './error/response-contract-error.js';
10
+ export { statusTitle } from './error/status-title.js';
11
+ export { toProblem } from './error/to-problem.js';
12
+ export { UnauthorizedError } from './error/unauthorized-error.js';
13
+ export { pageQuerySchema } from './pagination/page-query-schema.js';
14
+ export { pageRequestFrom } from './pagination/page-request-from.js';
15
+ export { pageRequestParameters } from './pagination/page-request-parameters.js';
16
+ export { pageResponse } from './pagination/page-response.js';
17
+ export { pageSchemaOf } from './pagination/page-schema-of.js';
18
+ export { CORRELATION_HEADER } from './pipeline/correlation-header.js';
19
+ export { executeRoute } from './pipeline/execute-route.js';
20
+ export { reportHttpErrors } from './pipeline/report-http-errors.js';
21
+ export { serializeBody } from './pipeline/serialize-body.js';
22
+ export { assertUniqueRoutes } from './route/assert-unique-routes.js';
23
+ export { defineRoute } from './route/define-route.js';
24
+ export { defineRoutes } from './route/define-routes.js';
25
+ export { DuplicateRouteError } from './route/duplicate-route-error.js';
26
+ export { prefixRoutes } from './route/prefix-routes.js';
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAA2B,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAIvE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { DynamicModule, ModuleMetadata } from '@nestjs/common';
2
+ import type { ExecuteOptions } from '../pipeline/execute-options.js';
3
+ import type { Route } from '../route/route.js';
4
+ import type { RoutesFactory } from './routes-factory.js';
5
+ export interface RoutesModuleOptions extends ExecuteOptions {
6
+ /** Modules exporting the tokens listed in `inject`. */
7
+ readonly imports?: ModuleMetadata['imports'];
8
+ }
9
+ /**
10
+ * A Nest module that mounts framework-free routes on the underlying HTTP server, Express or
11
+ * Fastify. The routes bypass Nest's own pipeline (pipes, guards, interceptors, filters, global
12
+ * prefix): validation and error mapping are those of `executeRoute`, as with the other adapters.
13
+ */
14
+ export declare function createRoutesModule(routes: readonly Route[] | RoutesFactory, options?: RoutesModuleOptions): DynamicModule;
15
+ //# sourceMappingURL=create-routes-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-routes-module.d.ts","sourceRoot":"","sources":["../../src/nest/create-routes-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD,uDAAuD;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;CAC9C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,aAAa,EACxC,OAAO,GAAE,mBAAwB,GAChC,aAAa,CAwBf"}
@@ -0,0 +1,54 @@
1
+ import { HttpAdapterHost } from '@nestjs/core';
2
+ import { mountExpress } from '../express/mount-express.js';
3
+ import { mountFastify } from '../fastify/mount-fastify.js';
4
+ import { assertUniqueRoutes } from '../route/assert-unique-routes.js';
5
+ import { RoutesMounter } from './routes-mounter.js';
6
+ /**
7
+ * A Nest module that mounts framework-free routes on the underlying HTTP server, Express or
8
+ * Fastify. The routes bypass Nest's own pipeline (pipes, guards, interceptors, filters, global
9
+ * prefix): validation and error mapping are those of `executeRoute`, as with the other adapters.
10
+ */
11
+ export function createRoutesModule(routes, options = {}) {
12
+ // One class per call: Nest identifies a module by its class, and two route sets must not merge.
13
+ class RoutesModule {
14
+ }
15
+ const { imports, ...executeOptions } = options;
16
+ const factory = isFactory(routes) ? routes : { inject: [], useFactory: () => routes };
17
+ return {
18
+ module: RoutesModule,
19
+ imports: imports ?? [],
20
+ providers: [
21
+ {
22
+ provide: RoutesMounter,
23
+ inject: [HttpAdapterHost, ...factory.inject],
24
+ useFactory: (host, ...dependencies) => ({
25
+ // Module init runs after Nest installed its body parsers and before it installs its
26
+ // not-found handler, which is the window where a route can still be added.
27
+ onModuleInit() {
28
+ mountOn(host, factory.useFactory(...dependencies), executeOptions);
29
+ },
30
+ }),
31
+ },
32
+ ],
33
+ };
34
+ }
35
+ function isFactory(routes) {
36
+ return !Array.isArray(routes);
37
+ }
38
+ function mountOn(host, routes, options) {
39
+ assertUniqueRoutes(routes);
40
+ const adapter = host.httpAdapter;
41
+ const type = adapter.getType();
42
+ if (type === 'express') {
43
+ const instance = adapter.getInstance();
44
+ mountExpress(instance, routes, options);
45
+ }
46
+ else if (type === 'fastify') {
47
+ const instance = adapter.getInstance();
48
+ mountFastify(instance, routes, options);
49
+ }
50
+ else {
51
+ throw new Error(`Unsupported Nest HTTP platform "${type}".`);
52
+ }
53
+ }
54
+ //# sourceMappingURL=create-routes-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-routes-module.js","sourceRoot":"","sources":["../../src/nest/create-routes-module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAwC,EACxC,OAAO,GAAwB,EAAE;IAEjC,gGAAgG;IAChG,MAAM,YAAY;KAAG;IAErB,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,GAAG,OAAO,CAAC;IAC/C,MAAM,OAAO,GAAkB,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;IAErG,OAAO;QACL,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,OAAO,IAAI,EAAE;QACtB,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,aAAa;gBACtB,MAAM,EAAE,CAAC,eAAe,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;gBAC5C,UAAU,EAAE,CAAC,IAAqB,EAAE,GAAG,YAAuB,EAAiB,EAAE,CAAC,CAAC;oBACjF,oFAAoF;oBACpF,2EAA2E;oBAC3E,YAAY;wBACV,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,EAAE,cAAc,CAAC,CAAC;oBACrE,CAAC;iBACF,CAAC;aACH;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,MAAwC;IACzD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,OAAO,CAAC,IAAqB,EAAE,MAAwB,EAAE,OAAuB;IACvF,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC;IACjC,MAAM,IAAI,GAAW,OAAO,CAAC,OAAO,EAAE,CAAC;IAEvC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAY,OAAO,CAAC,WAAW,EAAE,CAAC;QAEhD,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;SAAM,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAoB,OAAO,CAAC,WAAW,EAAE,CAAC;QAExD,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,mCAAmC,IAAI,IAAI,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { InjectionToken } from '@nestjs/common';
2
+ import type { Route } from '../route/route.js';
3
+ /** Routes whose handlers close over injected dependencies. */
4
+ export interface RoutesFactory {
5
+ readonly inject: readonly InjectionToken[];
6
+ useFactory(...dependencies: unknown[]): readonly Route[];
7
+ }
8
+ //# sourceMappingURL=routes-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes-factory.d.ts","sourceRoot":"","sources":["../../src/nest/routes-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,8DAA8D;AAC9D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;IAI3C,UAAU,CAAC,GAAG,YAAY,EAAE,OAAO,EAAE,GAAG,SAAS,KAAK,EAAE,CAAC;CAC1D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=routes-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes-factory.js","sourceRoot":"","sources":["../../src/nest/routes-factory.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The Nest provider every routes module registers: it mounts the routes of its module when Nest
3
+ * initialises it. The class is the provider token.
4
+ */
5
+ export declare abstract class RoutesMounter {
6
+ static readonly tokenKey = "http.RoutesMounter";
7
+ abstract onModuleInit(): void;
8
+ }
9
+ //# sourceMappingURL=routes-mounter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes-mounter.d.ts","sourceRoot":"","sources":["../../src/nest/routes-mounter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,8BAAsB,aAAa;IACjC,MAAM,CAAC,QAAQ,CAAC,QAAQ,wBAAwB;IAEhD,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC;CAC/B"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The Nest provider every routes module registers: it mounts the routes of its module when Nest
3
+ * initialises it. The class is the provider token.
4
+ */
5
+ export class RoutesMounter {
6
+ static tokenKey = 'http.RoutesMounter';
7
+ }
8
+ //# sourceMappingURL=routes-mounter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes-mounter.js","sourceRoot":"","sources":["../../src/nest/routes-mounter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAgB,aAAa;IACjC,MAAM,CAAU,QAAQ,GAAG,oBAAoB,CAAC;CAGjD"}
package/dist/nest.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { createRoutesModule, type RoutesModuleOptions } from './nest/create-routes-module.js';
2
+ export type { RoutesFactory } from './nest/routes-factory.js';
3
+ export { RoutesMounter } from './nest/routes-mounter.js';
4
+ //# sourceMappingURL=nest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nest.d.ts","sourceRoot":"","sources":["../src/nest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC9F,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/nest.js ADDED
@@ -0,0 +1,3 @@
1
+ export { createRoutesModule } from './nest/create-routes-module.js';
2
+ export { RoutesMounter } from './nest/routes-mounter.js';
3
+ //# sourceMappingURL=nest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nest.js","sourceRoot":"","sources":["../src/nest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA4B,MAAM,gCAAgC,CAAC;AAE9F,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { OpenApiDocument } from './open-api-document.js';
2
+ /** Compares the generated contract with the committed one, ignoring line-ending style. */
3
+ export declare function checkOpenApiDrift(document: OpenApiDocument, existingFileContent: string): {
4
+ drift: boolean;
5
+ };
6
+ //# sourceMappingURL=check-open-api-drift.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-open-api-drift.d.ts","sourceRoot":"","sources":["../../src/openapi/check-open-api-drift.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,CAE5G"}
@@ -0,0 +1,6 @@
1
+ import { stringifyOpenApi } from './stringify-open-api.js';
2
+ /** Compares the generated contract with the committed one, ignoring line-ending style. */
3
+ export function checkOpenApiDrift(document, existingFileContent) {
4
+ return { drift: stringifyOpenApi(document) !== existingFileContent.replaceAll('\r\n', '\n') };
5
+ }
6
+ //# sourceMappingURL=check-open-api-drift.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-open-api-drift.js","sourceRoot":"","sources":["../../src/openapi/check-open-api-drift.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,0FAA0F;AAC1F,MAAM,UAAU,iBAAiB,CAAC,QAAyB,EAAE,mBAA2B;IACtF,OAAO,EAAE,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,KAAK,mBAAmB,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;AAChG,CAAC"}