adorn-api 1.0.22 → 1.0.24

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 (380) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc.cjs +30 -0
  3. package/README.md +375 -531
  4. package/dist/core/express-adapter.d.ts +27 -0
  5. package/dist/core/express-adapter.d.ts.map +1 -0
  6. package/dist/core/express-adapter.js +146 -0
  7. package/dist/core/express-adapter.js.map +1 -0
  8. package/dist/core/http-error.d.ts +7 -0
  9. package/dist/core/http-error.d.ts.map +1 -0
  10. package/dist/core/http-error.js +14 -0
  11. package/dist/core/http-error.js.map +1 -0
  12. package/dist/decorators/controller.decorator.d.ts +2 -0
  13. package/dist/decorators/controller.decorator.d.ts.map +1 -0
  14. package/dist/decorators/controller.decorator.js +26 -0
  15. package/dist/decorators/controller.decorator.js.map +1 -0
  16. package/dist/decorators/create.decorator.d.ts +8 -0
  17. package/dist/decorators/create.decorator.d.ts.map +1 -0
  18. package/dist/decorators/create.decorator.js +67 -0
  19. package/dist/decorators/create.decorator.js.map +1 -0
  20. package/dist/decorators/http-method.decorator.d.ts +16 -0
  21. package/dist/decorators/http-method.decorator.d.ts.map +1 -0
  22. package/dist/decorators/http-method.decorator.js +117 -0
  23. package/dist/decorators/http-method.decorator.js.map +1 -0
  24. package/dist/decorators/http-params.d.ts +17 -0
  25. package/dist/decorators/http-params.d.ts.map +1 -0
  26. package/dist/decorators/http-params.js +26 -0
  27. package/dist/decorators/http-params.js.map +1 -0
  28. package/dist/decorators/index.d.ts +10 -5
  29. package/dist/decorators/index.d.ts.map +1 -1
  30. package/dist/decorators/index.js +14 -0
  31. package/dist/decorators/index.js.map +1 -0
  32. package/dist/decorators/list.decorator.d.ts +18 -0
  33. package/dist/decorators/list.decorator.d.ts.map +1 -0
  34. package/dist/decorators/list.decorator.js +99 -0
  35. package/dist/decorators/list.decorator.js.map +1 -0
  36. package/dist/decorators/middleware.decorator.d.ts +4 -0
  37. package/dist/decorators/middleware.decorator.d.ts.map +1 -0
  38. package/dist/decorators/middleware.decorator.js +34 -0
  39. package/dist/decorators/middleware.decorator.js.map +1 -0
  40. package/dist/decorators/response.decorator.d.ts +8 -0
  41. package/dist/decorators/response.decorator.d.ts.map +1 -0
  42. package/dist/decorators/response.decorator.js +44 -0
  43. package/dist/decorators/response.decorator.js.map +1 -0
  44. package/dist/decorators/route-options.d.ts +14 -0
  45. package/dist/decorators/route-options.d.ts.map +1 -0
  46. package/dist/decorators/route-options.js +22 -0
  47. package/dist/decorators/route-options.js.map +1 -0
  48. package/dist/decorators/schema.decorator.d.ts +82 -0
  49. package/dist/decorators/schema.decorator.d.ts.map +1 -0
  50. package/dist/decorators/schema.decorator.js +123 -0
  51. package/dist/decorators/schema.decorator.js.map +1 -0
  52. package/dist/decorators/update.decorator.d.ts +8 -0
  53. package/dist/decorators/update.decorator.d.ts.map +1 -0
  54. package/dist/decorators/update.decorator.js +63 -0
  55. package/dist/decorators/update.decorator.js.map +1 -0
  56. package/dist/index.d.ts +11 -13
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +18 -637
  59. package/dist/index.js.map +1 -1
  60. package/dist/metadata/metadata-storage.d.ts +38 -0
  61. package/dist/metadata/metadata-storage.d.ts.map +1 -0
  62. package/dist/metadata/metadata-storage.js +102 -0
  63. package/dist/metadata/metadata-storage.js.map +1 -0
  64. package/dist/metal-orm-integration/dto-helper.d.ts +5 -0
  65. package/dist/metal-orm-integration/dto-helper.d.ts.map +1 -0
  66. package/dist/metal-orm-integration/dto-helper.js +48 -0
  67. package/dist/metal-orm-integration/dto-helper.js.map +1 -0
  68. package/dist/metal-orm-integration/dto-response.decorator.d.ts +4 -0
  69. package/dist/metal-orm-integration/dto-response.decorator.d.ts.map +1 -0
  70. package/dist/metal-orm-integration/dto-response.decorator.js +69 -0
  71. package/dist/metal-orm-integration/dto-response.decorator.js.map +1 -0
  72. package/dist/metal-orm-integration/entity-schema-builder.d.ts +20 -0
  73. package/dist/metal-orm-integration/entity-schema-builder.d.ts.map +1 -0
  74. package/dist/metal-orm-integration/entity-schema-builder.js +356 -0
  75. package/dist/metal-orm-integration/entity-schema-builder.js.map +1 -0
  76. package/dist/metal-orm-integration/index.d.ts +5 -0
  77. package/dist/metal-orm-integration/index.d.ts.map +1 -0
  78. package/dist/metal-orm-integration/index.js +5 -0
  79. package/dist/metal-orm-integration/index.js.map +1 -0
  80. package/dist/metal-orm-integration/schema-modifier.d.ts +11 -0
  81. package/dist/metal-orm-integration/schema-modifier.d.ts.map +1 -0
  82. package/dist/metal-orm-integration/schema-modifier.js +62 -0
  83. package/dist/metal-orm-integration/schema-modifier.js.map +1 -0
  84. package/dist/openapi/index.d.ts +4 -0
  85. package/dist/openapi/index.d.ts.map +1 -0
  86. package/dist/openapi/index.js +4 -0
  87. package/dist/openapi/index.js.map +1 -0
  88. package/dist/openapi/openapi-generator.d.ts +22 -0
  89. package/dist/openapi/openapi-generator.d.ts.map +1 -0
  90. package/dist/openapi/openapi-generator.js +428 -0
  91. package/dist/openapi/openapi-generator.js.map +1 -0
  92. package/dist/openapi/swagger-ui.d.ts +11 -0
  93. package/dist/openapi/swagger-ui.d.ts.map +1 -0
  94. package/dist/openapi/swagger-ui.js +20 -0
  95. package/dist/openapi/swagger-ui.js.map +1 -0
  96. package/dist/openapi/zod-to-openapi.d.ts +4 -0
  97. package/dist/openapi/zod-to-openapi.d.ts.map +1 -0
  98. package/dist/openapi/zod-to-openapi.js +184 -0
  99. package/dist/openapi/zod-to-openapi.js.map +1 -0
  100. package/dist/types/common.d.ts +4 -0
  101. package/dist/types/common.d.ts.map +1 -0
  102. package/dist/types/common.js +2 -0
  103. package/dist/types/common.js.map +1 -0
  104. package/dist/types/controller.d.ts +14 -0
  105. package/dist/types/controller.d.ts.map +1 -0
  106. package/dist/types/controller.js +2 -0
  107. package/dist/types/controller.js.map +1 -0
  108. package/dist/types/metadata.d.ts +48 -0
  109. package/dist/types/metadata.d.ts.map +1 -0
  110. package/dist/types/metadata.js +2 -0
  111. package/dist/types/metadata.js.map +1 -0
  112. package/dist/types/openapi.d.ts +30 -0
  113. package/dist/types/openapi.d.ts.map +1 -0
  114. package/dist/types/openapi.js +2 -0
  115. package/dist/types/openapi.js.map +1 -0
  116. package/dist/validation/zod-adapter.d.ts +15 -0
  117. package/dist/validation/zod-adapter.d.ts.map +1 -0
  118. package/dist/validation/zod-adapter.js +61 -0
  119. package/dist/validation/zod-adapter.js.map +1 -0
  120. package/examples/basic/app.ts +15 -0
  121. package/examples/basic/index.ts +6 -0
  122. package/examples/basic/user.controller.ts +35 -0
  123. package/examples/basic/user.dtos.ts +23 -0
  124. package/examples/metal-orm-sqlite/app.ts +18 -0
  125. package/examples/metal-orm-sqlite/db.ts +90 -0
  126. package/examples/metal-orm-sqlite/index.ts +6 -0
  127. package/examples/metal-orm-sqlite/post.controller.ts +209 -0
  128. package/examples/metal-orm-sqlite/post.dtos.ts +78 -0
  129. package/examples/metal-orm-sqlite/post.entity.ts +24 -0
  130. package/examples/metal-orm-sqlite/user.controller.helpers.ts +305 -0
  131. package/examples/metal-orm-sqlite/user.controller.ts +231 -0
  132. package/examples/metal-orm-sqlite/user.dtos.ts +88 -0
  133. package/examples/metal-orm-sqlite/user.entity.ts +21 -0
  134. package/examples/metal-orm-sqlite-music/album.controller.ts +278 -0
  135. package/examples/metal-orm-sqlite-music/album.dtos.ts +85 -0
  136. package/examples/metal-orm-sqlite-music/album.entity.ts +28 -0
  137. package/examples/metal-orm-sqlite-music/app.ts +19 -0
  138. package/examples/metal-orm-sqlite-music/artist.controller.ts +272 -0
  139. package/examples/metal-orm-sqlite-music/artist.dtos.ts +68 -0
  140. package/examples/metal-orm-sqlite-music/artist.entity.ts +27 -0
  141. package/examples/metal-orm-sqlite-music/db.ts +148 -0
  142. package/examples/metal-orm-sqlite-music/index.ts +6 -0
  143. package/examples/metal-orm-sqlite-music/track.controller.ts +221 -0
  144. package/examples/metal-orm-sqlite-music/track.dtos.ts +82 -0
  145. package/examples/metal-orm-sqlite-music/track.entity.ts +27 -0
  146. package/examples/openapi/health.controller.ts +11 -0
  147. package/examples/openapi/health.dto.ts +7 -0
  148. package/examples/openapi/index.ts +12 -0
  149. package/examples/restful/app.ts +15 -0
  150. package/examples/restful/index.ts +9 -0
  151. package/examples/restful/task.controller.ts +118 -0
  152. package/examples/restful/task.dtos.ts +66 -0
  153. package/examples/restful/task.store.ts +95 -0
  154. package/examples/tsconfig.json +8 -0
  155. package/examples/utils/start-server.ts +56 -0
  156. package/package.json +33 -97
  157. package/scripts/run-example.js +29 -0
  158. package/src/adapter/express.ts +589 -0
  159. package/src/adapter/metal-orm/convention-overrides.ts +115 -0
  160. package/src/adapter/metal-orm/crud-dtos.ts +141 -0
  161. package/src/adapter/metal-orm/dto.ts +20 -0
  162. package/src/adapter/metal-orm/error-dtos.ts +51 -0
  163. package/src/adapter/metal-orm/field-builder.ts +185 -0
  164. package/src/adapter/metal-orm/filters.ts +52 -0
  165. package/src/adapter/metal-orm/index.ts +66 -0
  166. package/src/adapter/metal-orm/paged-dtos.ts +94 -0
  167. package/src/adapter/metal-orm/pagination.ts +28 -0
  168. package/src/adapter/metal-orm/types.ts +250 -0
  169. package/src/adapter/metal-orm/utils.ts +36 -0
  170. package/src/adapter/metal-orm.test.ts +439 -0
  171. package/src/core/__tests__/coerce.test.ts +39 -0
  172. package/src/core/__tests__/dto-compose.test.ts +68 -0
  173. package/src/core/__tests__/schema-builder.test.ts +82 -0
  174. package/src/core/coerce.ts +190 -0
  175. package/src/core/decorators.ts +645 -0
  176. package/src/core/errors.ts +55 -0
  177. package/src/core/metadata.ts +110 -0
  178. package/src/core/openapi.ts +282 -0
  179. package/src/core/schema-builder.ts +287 -0
  180. package/src/core/schema.ts +400 -0
  181. package/src/core/types.ts +14 -0
  182. package/src/e2e/http-error.e2e.test.ts +52 -0
  183. package/src/e2e/sqlite-metal-orm.e2e.test.ts +174 -0
  184. package/src/e2e/sqlite.e2e.test.ts +126 -0
  185. package/src/index.ts +8 -0
  186. package/tsconfig.eslint.json +7 -0
  187. package/tsconfig.json +18 -0
  188. package/vitest.config.ts +8 -0
  189. package/dist/adapter/express/auth.d.ts +0 -13
  190. package/dist/adapter/express/auth.d.ts.map +0 -1
  191. package/dist/adapter/express/bootstrap.d.ts +0 -40
  192. package/dist/adapter/express/bootstrap.d.ts.map +0 -1
  193. package/dist/adapter/express/coercion.d.ts +0 -102
  194. package/dist/adapter/express/coercion.d.ts.map +0 -1
  195. package/dist/adapter/express/index.d.ts +0 -6
  196. package/dist/adapter/express/index.d.ts.map +0 -1
  197. package/dist/adapter/express/merge.d.ts +0 -45
  198. package/dist/adapter/express/merge.d.ts.map +0 -1
  199. package/dist/adapter/express/openapi.d.ts +0 -66
  200. package/dist/adapter/express/openapi.d.ts.map +0 -1
  201. package/dist/adapter/express/router.d.ts +0 -10
  202. package/dist/adapter/express/router.d.ts.map +0 -1
  203. package/dist/adapter/express/swagger.d.ts +0 -18
  204. package/dist/adapter/express/swagger.d.ts.map +0 -1
  205. package/dist/adapter/express/types.d.ts +0 -110
  206. package/dist/adapter/express/types.d.ts.map +0 -1
  207. package/dist/adapter/express/validation.d.ts +0 -27
  208. package/dist/adapter/express/validation.d.ts.map +0 -1
  209. package/dist/cli/progress.d.ts +0 -122
  210. package/dist/cli/progress.d.ts.map +0 -1
  211. package/dist/cli.cjs +0 -4390
  212. package/dist/cli.cjs.map +0 -1
  213. package/dist/cli.d.ts +0 -3
  214. package/dist/cli.d.ts.map +0 -1
  215. package/dist/cli.js +0 -4371
  216. package/dist/cli.js.map +0 -1
  217. package/dist/compiler/analyze/index.d.ts +0 -5
  218. package/dist/compiler/analyze/index.d.ts.map +0 -1
  219. package/dist/compiler/analyze/scanControllers.d.ts +0 -88
  220. package/dist/compiler/analyze/scanControllers.d.ts.map +0 -1
  221. package/dist/compiler/cache/isStale.d.ts +0 -46
  222. package/dist/compiler/cache/isStale.d.ts.map +0 -1
  223. package/dist/compiler/cache/loadArtifacts.d.ts +0 -149
  224. package/dist/compiler/cache/loadArtifacts.d.ts.map +0 -1
  225. package/dist/compiler/cache/schema.d.ts +0 -32
  226. package/dist/compiler/cache/schema.d.ts.map +0 -1
  227. package/dist/compiler/cache/writeCache.d.ts +0 -14
  228. package/dist/compiler/cache/writeCache.d.ts.map +0 -1
  229. package/dist/compiler/gems.d.ts +0 -75
  230. package/dist/compiler/gems.d.ts.map +0 -1
  231. package/dist/compiler/generator/index.d.ts +0 -7
  232. package/dist/compiler/generator/index.d.ts.map +0 -1
  233. package/dist/compiler/generator/manifest.d.ts +0 -23
  234. package/dist/compiler/generator/manifest.d.ts.map +0 -1
  235. package/dist/compiler/generator/openapi.d.ts +0 -118
  236. package/dist/compiler/generator/openapi.d.ts.map +0 -1
  237. package/dist/compiler/graph/builder.d.ts +0 -24
  238. package/dist/compiler/graph/builder.d.ts.map +0 -1
  239. package/dist/compiler/graph/index.d.ts +0 -7
  240. package/dist/compiler/graph/index.d.ts.map +0 -1
  241. package/dist/compiler/graph/schemaGraph.d.ts +0 -67
  242. package/dist/compiler/graph/schemaGraph.d.ts.map +0 -1
  243. package/dist/compiler/graph/types.d.ts +0 -203
  244. package/dist/compiler/graph/types.d.ts.map +0 -1
  245. package/dist/compiler/index.d.ts +0 -12
  246. package/dist/compiler/index.d.ts.map +0 -1
  247. package/dist/compiler/ir/index.d.ts +0 -7
  248. package/dist/compiler/ir/index.d.ts.map +0 -1
  249. package/dist/compiler/ir/pipeline.d.ts +0 -82
  250. package/dist/compiler/ir/pipeline.d.ts.map +0 -1
  251. package/dist/compiler/ir/stages.d.ts +0 -40
  252. package/dist/compiler/ir/stages.d.ts.map +0 -1
  253. package/dist/compiler/ir/visitor.d.ts +0 -98
  254. package/dist/compiler/ir/visitor.d.ts.map +0 -1
  255. package/dist/compiler/manifest/emit.d.ts +0 -21
  256. package/dist/compiler/manifest/emit.d.ts.map +0 -1
  257. package/dist/compiler/manifest/format.d.ts +0 -119
  258. package/dist/compiler/manifest/format.d.ts.map +0 -1
  259. package/dist/compiler/manifest/index.d.ts +0 -6
  260. package/dist/compiler/manifest/index.d.ts.map +0 -1
  261. package/dist/compiler/runner/createProgram.d.ts +0 -24
  262. package/dist/compiler/runner/createProgram.d.ts.map +0 -1
  263. package/dist/compiler/runner/index.d.ts +0 -5
  264. package/dist/compiler/runner/index.d.ts.map +0 -1
  265. package/dist/compiler/schema/extractAnnotations.d.ts +0 -57
  266. package/dist/compiler/schema/extractAnnotations.d.ts.map +0 -1
  267. package/dist/compiler/schema/index.d.ts +0 -8
  268. package/dist/compiler/schema/index.d.ts.map +0 -1
  269. package/dist/compiler/schema/intersectionHandler.d.ts +0 -44
  270. package/dist/compiler/schema/intersectionHandler.d.ts.map +0 -1
  271. package/dist/compiler/schema/objectHandler.d.ts +0 -146
  272. package/dist/compiler/schema/objectHandler.d.ts.map +0 -1
  273. package/dist/compiler/schema/openapi.d.ts +0 -71
  274. package/dist/compiler/schema/openapi.d.ts.map +0 -1
  275. package/dist/compiler/schema/parameters.d.ts +0 -90
  276. package/dist/compiler/schema/parameters.d.ts.map +0 -1
  277. package/dist/compiler/schema/partitioner.d.ts +0 -85
  278. package/dist/compiler/schema/partitioner.d.ts.map +0 -1
  279. package/dist/compiler/schema/primitives.d.ts +0 -68
  280. package/dist/compiler/schema/primitives.d.ts.map +0 -1
  281. package/dist/compiler/schema/queryBuilderAnalyzer.d.ts +0 -76
  282. package/dist/compiler/schema/queryBuilderAnalyzer.d.ts.map +0 -1
  283. package/dist/compiler/schema/queryBuilderSchemaBuilder.d.ts +0 -13
  284. package/dist/compiler/schema/queryBuilderSchemaBuilder.d.ts.map +0 -1
  285. package/dist/compiler/schema/splitOpenapi.d.ts +0 -46
  286. package/dist/compiler/schema/splitOpenapi.d.ts.map +0 -1
  287. package/dist/compiler/schema/typeToJsonSchema.d.ts +0 -26
  288. package/dist/compiler/schema/typeToJsonSchema.d.ts.map +0 -1
  289. package/dist/compiler/schema/types.d.ts +0 -70
  290. package/dist/compiler/schema/types.d.ts.map +0 -1
  291. package/dist/compiler/schema/unionHandler.d.ts +0 -70
  292. package/dist/compiler/schema/unionHandler.d.ts.map +0 -1
  293. package/dist/compiler/transform/dedup.d.ts +0 -35
  294. package/dist/compiler/transform/dedup.d.ts.map +0 -1
  295. package/dist/compiler/transform/flatten.d.ts +0 -50
  296. package/dist/compiler/transform/flatten.d.ts.map +0 -1
  297. package/dist/compiler/transform/index.d.ts +0 -7
  298. package/dist/compiler/transform/index.d.ts.map +0 -1
  299. package/dist/compiler/transform/inline.d.ts +0 -46
  300. package/dist/compiler/transform/inline.d.ts.map +0 -1
  301. package/dist/compiler/validation/emitPrecompiledValidators.d.ts +0 -62
  302. package/dist/compiler/validation/emitPrecompiledValidators.d.ts.map +0 -1
  303. package/dist/compiler/validation/index.d.ts +0 -5
  304. package/dist/compiler/validation/index.d.ts.map +0 -1
  305. package/dist/decorators/Auth.d.ts +0 -22
  306. package/dist/decorators/Auth.d.ts.map +0 -1
  307. package/dist/decorators/Controller.d.ts +0 -17
  308. package/dist/decorators/Controller.d.ts.map +0 -1
  309. package/dist/decorators/Public.d.ts +0 -15
  310. package/dist/decorators/Public.d.ts.map +0 -1
  311. package/dist/decorators/Use.d.ts +0 -23
  312. package/dist/decorators/Use.d.ts.map +0 -1
  313. package/dist/decorators/methods.d.ts +0 -26
  314. package/dist/decorators/methods.d.ts.map +0 -1
  315. package/dist/express.cjs +0 -1186
  316. package/dist/express.cjs.map +0 -1
  317. package/dist/express.d.ts +0 -8
  318. package/dist/express.d.ts.map +0 -1
  319. package/dist/express.js +0 -1150
  320. package/dist/express.js.map +0 -1
  321. package/dist/http.d.ts +0 -33
  322. package/dist/http.d.ts.map +0 -1
  323. package/dist/index.cjs +0 -724
  324. package/dist/index.cjs.map +0 -1
  325. package/dist/metal/applyListQuery.d.ts +0 -100
  326. package/dist/metal/applyListQuery.d.ts.map +0 -1
  327. package/dist/metal/index.cjs +0 -278
  328. package/dist/metal/index.cjs.map +0 -1
  329. package/dist/metal/index.d.ts +0 -15
  330. package/dist/metal/index.d.ts.map +0 -1
  331. package/dist/metal/index.js +0 -243
  332. package/dist/metal/index.js.map +0 -1
  333. package/dist/metal/listQuery.d.ts +0 -26
  334. package/dist/metal/listQuery.d.ts.map +0 -1
  335. package/dist/metal/queryOptions.d.ts +0 -16
  336. package/dist/metal/queryOptions.d.ts.map +0 -1
  337. package/dist/metal/readMetalBag.d.ts +0 -69
  338. package/dist/metal/readMetalBag.d.ts.map +0 -1
  339. package/dist/metal/registerMetalEntities.d.ts +0 -26
  340. package/dist/metal/registerMetalEntities.d.ts.map +0 -1
  341. package/dist/metal/schemaFromEntity.d.ts +0 -41
  342. package/dist/metal/schemaFromEntity.d.ts.map +0 -1
  343. package/dist/metal/searchWhere.d.ts +0 -97
  344. package/dist/metal/searchWhere.d.ts.map +0 -1
  345. package/dist/metal/symbolMetadata.d.ts +0 -8
  346. package/dist/metal/symbolMetadata.d.ts.map +0 -1
  347. package/dist/runtime/auth/runtime.d.ts +0 -183
  348. package/dist/runtime/auth/runtime.d.ts.map +0 -1
  349. package/dist/runtime/metadata/bucket.d.ts +0 -2
  350. package/dist/runtime/metadata/bucket.d.ts.map +0 -1
  351. package/dist/runtime/metadata/key.d.ts +0 -2
  352. package/dist/runtime/metadata/key.d.ts.map +0 -1
  353. package/dist/runtime/metadata/read.d.ts +0 -2
  354. package/dist/runtime/metadata/read.d.ts.map +0 -1
  355. package/dist/runtime/metadata/types.d.ts +0 -95
  356. package/dist/runtime/metadata/types.d.ts.map +0 -1
  357. package/dist/runtime/polyfill.d.ts +0 -2
  358. package/dist/runtime/polyfill.d.ts.map +0 -1
  359. package/dist/runtime/upload.d.ts +0 -44
  360. package/dist/runtime/upload.d.ts.map +0 -1
  361. package/dist/runtime/validation/ajv.d.ts +0 -120
  362. package/dist/runtime/validation/ajv.d.ts.map +0 -1
  363. package/dist/runtime/validation/index.d.ts +0 -11
  364. package/dist/runtime/validation/index.d.ts.map +0 -1
  365. package/dist/schema/decorators.d.ts +0 -37
  366. package/dist/schema/decorators.d.ts.map +0 -1
  367. package/dist/schema/index.cjs +0 -214
  368. package/dist/schema/index.cjs.map +0 -1
  369. package/dist/schema/index.d.ts +0 -2
  370. package/dist/schema/index.d.ts.map +0 -1
  371. package/dist/schema/index.js +0 -163
  372. package/dist/schema/index.js.map +0 -1
  373. package/dist/scripts/adorn-example.cjs +0 -404
  374. package/dist/scripts/adorn-example.cjs.map +0 -1
  375. package/dist/utils/operationId.d.ts +0 -2
  376. package/dist/utils/operationId.d.ts.map +0 -1
  377. package/dist/utils/path.d.ts +0 -2
  378. package/dist/utils/path.d.ts.map +0 -1
  379. package/dist/utils/port.d.ts +0 -9
  380. package/dist/utils/port.d.ts.map +0 -1
@@ -0,0 +1,126 @@
1
+ import { afterAll, beforeAll, describe, expect, it } from "vitest";
2
+ import request from "supertest";
3
+ import sqlite3 from "sqlite3";
4
+ import {
5
+ Body,
6
+ Controller,
7
+ Dto,
8
+ Field,
9
+ Get,
10
+ Post,
11
+ Returns,
12
+ createExpressApp,
13
+ t,
14
+ type RequestContext
15
+ } from "../index";
16
+
17
+ let db: sqlite3.Database;
18
+
19
+ function run(sql: string, params: unknown[] = []): Promise<{ lastID: number; changes: number }> {
20
+ return new Promise((resolve, reject) => {
21
+ db.run(sql, params, function onRun(err) {
22
+ if (err) {
23
+ reject(err);
24
+ return;
25
+ }
26
+ resolve({ lastID: this.lastID, changes: this.changes });
27
+ });
28
+ });
29
+ }
30
+
31
+ function get<T>(sql: string, params: unknown[] = []): Promise<T | undefined> {
32
+ return new Promise((resolve, reject) => {
33
+ db.get(sql, params, (err, row) => {
34
+ if (err) {
35
+ reject(err);
36
+ return;
37
+ }
38
+ resolve(row as T | undefined);
39
+ });
40
+ });
41
+ }
42
+
43
+ function all<T>(sql: string, params: unknown[] = []): Promise<T[]> {
44
+ return new Promise((resolve, reject) => {
45
+ db.all(sql, params, (err, rows) => {
46
+ if (err) {
47
+ reject(err);
48
+ return;
49
+ }
50
+ resolve(rows as T[]);
51
+ });
52
+ });
53
+ }
54
+
55
+ function closeDb(): Promise<void> {
56
+ return new Promise((resolve, reject) => {
57
+ db.close((err) => {
58
+ if (err) {
59
+ reject(err);
60
+ return;
61
+ }
62
+ resolve();
63
+ });
64
+ });
65
+ }
66
+
67
+ @Dto()
68
+ class CreateUserDto {
69
+ @Field(t.string({ minLength: 1 }))
70
+ name!: string;
71
+ }
72
+
73
+ @Dto()
74
+ class UserDto {
75
+ @Field(t.integer())
76
+ id!: number;
77
+
78
+ @Field(t.string({ minLength: 1 }))
79
+ name!: string;
80
+ }
81
+
82
+ @Controller("/users")
83
+ class UserController {
84
+ @Get("/")
85
+ @Returns(t.array(t.ref(UserDto)))
86
+ async list() {
87
+ return all<UserDto>("select id, name from users order by id asc");
88
+ }
89
+
90
+ @Post("/")
91
+ @Body(CreateUserDto)
92
+ @Returns({ status: 201, schema: UserDto })
93
+ async create(ctx: RequestContext<CreateUserDto>) {
94
+ const result = await run("insert into users (name) values (?)", [ctx.body.name]);
95
+ const row = await get<UserDto>("select id, name from users where id = ?", [result.lastID]);
96
+ return row!;
97
+ }
98
+ }
99
+
100
+ describe("e2e sqlite memory", () => {
101
+ const app = createExpressApp({ controllers: [UserController] });
102
+
103
+ beforeAll(async () => {
104
+ db = new sqlite3.Database(":memory:");
105
+ await run("create table users (id integer primary key autoincrement, name text not null)");
106
+ });
107
+
108
+ afterAll(async () => {
109
+ await closeDb();
110
+ });
111
+
112
+ it("creates and lists users", async () => {
113
+ const createResponse = await request(app)
114
+ .post("/users")
115
+ .send({ name: "Ada" })
116
+ .expect(201);
117
+
118
+ expect(createResponse.body).toMatchObject({ id: 1, name: "Ada" });
119
+
120
+ const listResponse = await request(app)
121
+ .get("/users")
122
+ .expect(200);
123
+
124
+ expect(listResponse.body).toEqual([{ id: 1, name: "Ada" }]);
125
+ });
126
+ });
package/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ export * from "./core/decorators";
2
+ export * from "./core/schema";
3
+ export * from "./core/openapi";
4
+ export * from "./core/errors";
5
+ export * from "./core/coerce";
6
+ export * from "./adapter/express";
7
+ export * from "./adapter/metal-orm/index";
8
+ export * from "./core/types";
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "allowJs": true
5
+ },
6
+ "include": ["src", "examples", "scripts", "vitest.config.ts"]
7
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "CommonJS",
5
+ "moduleResolution": "Node",
6
+ "rootDir": "src",
7
+ "outDir": "dist",
8
+ "declaration": true,
9
+ "strict": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "esModuleInterop": true,
13
+ "useDefineForClassFields": true,
14
+ "experimentalDecorators": false,
15
+ "emitDecoratorMetadata": false
16
+ },
17
+ "include": ["src"]
18
+ }
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ environment: "node",
6
+ include: ["src/**/*.test.ts"]
7
+ }
8
+ });
@@ -1,13 +0,0 @@
1
- import type { Response, NextFunction } from "express";
2
- import type { AuthenticatedRequest, CreateRouterOptions, OpenAPI31 } from "./types.js";
3
- import type { BoundRoute } from "./merge.js";
4
- /**
5
- * Creates an authentication middleware for Express routes
6
- *
7
- * @param authConfig - Authentication configuration
8
- * @param routeAuth - Route-specific authentication settings
9
- * @param globalSecurity - Global security requirements from OpenAPI
10
- * @returns Express middleware function
11
- */
12
- export declare function createAuthMiddleware(authConfig: NonNullable<CreateRouterOptions["auth"]>, routeAuth: BoundRoute["auth"], globalSecurity: NonNullable<OpenAPI31["security"]>): (req: AuthenticatedRequest, res: Response, next: NextFunction) => Promise<void>;
13
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/adapter/express/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,WAAW,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,EACpD,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,EAC7B,cAAc,EAAE,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,IAEpC,KAAK,oBAAoB,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,mBA4C7E"}
@@ -1,40 +0,0 @@
1
- import express from "express";
2
- import { type Server } from "http";
3
- import { type CreateRouterOptions, type CorsConfig, type SetupSwaggerOptions } from "./index.js";
4
- /**
5
- * Options for bootstrapping an Express server with Adorn API
6
- */
7
- export interface BootstrapOptions {
8
- controllers: Array<new (...args: any[]) => any>;
9
- port?: number;
10
- host?: string;
11
- artifactsDir?: string;
12
- enableSwagger?: boolean;
13
- swaggerPath?: string;
14
- swaggerJsonPath?: string;
15
- swaggerOptions?: SetupSwaggerOptions["swaggerOptions"];
16
- swaggerUiOptions?: SetupSwaggerOptions["swaggerUiOptions"];
17
- middleware?: CreateRouterOptions["middleware"];
18
- auth?: CreateRouterOptions["auth"];
19
- coerce?: CreateRouterOptions["coerce"];
20
- cors?: CorsConfig;
21
- }
22
- /**
23
- * Result of bootstrapping an Express server
24
- */
25
- export interface BootstrapResult {
26
- server: Server;
27
- app: express.Express;
28
- url: string;
29
- port: number;
30
- host: string;
31
- close: () => Promise<void>;
32
- }
33
- /**
34
- * Bootstraps an Express server with the provided controllers and options
35
- *
36
- * @param options - Configuration options for the server
37
- * @returns Promise that resolves with the server instance and metadata
38
- */
39
- export declare function bootstrap(options: BootstrapOptions): Promise<BootstrapResult>;
40
- //# sourceMappingURL=bootstrap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../src/adapter/express/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAuB,KAAK,mBAAmB,EAAgB,KAAK,UAAU,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAIpI;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,KAAK,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IACvD,gBAAgB,CAAC,EAAE,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;IAC3D,UAAU,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAC/C,IAAI,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAkDD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAyG7E"}
@@ -1,102 +0,0 @@
1
- import type { Request } from "express";
2
- import type { CoerceLocation, DateCoercionOptions, CoerceOptions } from "./types.js";
3
- /**
4
- * Normalizes coercion options to ensure all properties are set
5
- *
6
- * @param coerce - Optional coercion options
7
- * @returns Required coercion options with defaults applied
8
- */
9
- export declare function normalizeCoerceOptions(coerce?: CoerceOptions): Required<CoerceOptions>;
10
- /**
11
- * Gets date coercion options for a specific location
12
- *
13
- * @param coerce - Required coercion options
14
- * @param location - The location to get options for
15
- * @returns Date coercion options for the specified location
16
- */
17
- export declare function getDateCoercionOptions(coerce: Required<CoerceOptions>, location: CoerceLocation): DateCoercionOptions;
18
- /**
19
- * Coerces dates in a value based on the schema
20
- *
21
- * @param value - The value to coerce
22
- * @param schema - The schema to use for coercion
23
- * @param dateCoercion - Date coercion options
24
- * @param components - OpenAPI components for schema resolution
25
- * @returns The coerced value
26
- */
27
- export declare function coerceDatesWithSchema(value: any, schema: Record<string, unknown> | null, dateCoercion: DateCoercionOptions, components: Record<string, Record<string, unknown>>): any;
28
- /**
29
- * Coerces a parameter value based on the schema
30
- *
31
- * @param value - The value to coerce
32
- * @param schema - The schema to use for coercion
33
- * @param dateCoercion - Date coercion options
34
- * @param components - OpenAPI components for schema resolution
35
- * @returns The coerced value
36
- */
37
- export declare function coerceParamValue(value: any, schema: Record<string, unknown> | null, dateCoercion: DateCoercionOptions, components: Record<string, Record<string, unknown>>): any;
38
- /**
39
- * Coerces a value based on the schema
40
- *
41
- * @param value - The value to coerce
42
- * @param schema - The schema to use for coercion
43
- * @param dateCoercion - Date coercion options
44
- * @param components - OpenAPI components for schema resolution
45
- * @param options - Additional coercion options
46
- * @returns The coerced value
47
- */
48
- export declare function coerceWithSchema(value: any, schema: Record<string, unknown>, dateCoercion: DateCoercionOptions, components: Record<string, Record<string, unknown>>, options: {
49
- coercePrimitives: boolean;
50
- }): any;
51
- /**
52
- * Checks if a value is a plain object
53
- *
54
- * @param value - The value to check
55
- * @returns True if the value is a plain object
56
- */
57
- export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
58
- /**
59
- * Parses a query value based on its schema type and serialization options
60
- *
61
- * @param value - The raw query value
62
- * @param param - The parameter configuration
63
- * @returns The parsed value
64
- */
65
- export declare function parseQueryValue(value: any, param: {
66
- schemaType?: string | string[];
67
- serialization?: {
68
- style?: string;
69
- explode?: boolean;
70
- };
71
- }): any;
72
- /**
73
- * Gets the raw query string from a request
74
- *
75
- * @param req - The Express request object
76
- * @returns The raw query string without the leading "?"
77
- */
78
- export declare function getRawQueryString(req: Request): string;
79
- /**
80
- * Parses query string parameters with deep object style
81
- *
82
- * @param rawQuery - The raw query string
83
- * @param names - Set of parameter names that use deepObject style
84
- * @param maxDepth - Maximum nesting depth (default: 5)
85
- * @returns Object containing the parsed deep object parameters
86
- */
87
- export declare function parseDeepObjectParams(rawQuery: string, names: Set<string>, maxDepth?: number): Record<string, unknown>;
88
- /**
89
- * Parses cookies from a cookie header
90
- *
91
- * @param cookieHeader - The cookie header string
92
- * @returns Object containing the parsed cookies
93
- */
94
- export declare function parseCookies(cookieHeader: string | undefined): Record<string, string>;
95
- /**
96
- * Normalizes a sort parameter to an array of strings
97
- *
98
- * @param sort - The sort parameter (array or string)
99
- * @returns Array of sort field names
100
- */
101
- export declare function normalizeSort(sort: unknown): string[];
102
- //# sourceMappingURL=coercion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coercion.d.ts","sourceRoot":"","sources":["../../../src/adapter/express/coercion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGrF;;;;;GAK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AAE,KAAK,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAAC,aAAa,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,GAAG,GAAG,CAgCjJ;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAKtD;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACjC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,EAClB,QAAQ,GAAE,MAAU,GACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBzB;AAyDD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAcrF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,EAAE,CAQrD"}
@@ -1,6 +0,0 @@
1
- export * from "./types.js";
2
- export * from "./router.js";
3
- export * from "./swagger.js";
4
- export { bootstrap, type BootstrapOptions } from "./bootstrap.js";
5
- export { parseDeepObjectParams, getRawQueryString } from "./coercion.js";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapter/express/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
@@ -1,45 +0,0 @@
1
- import type { ManifestV1, OperationEntry } from "../../compiler/manifest/format.js";
2
- /**
3
- * Represents a route bound to a controller
4
- */
5
- export interface BoundRoute {
6
- operationId: string;
7
- fullPath: string;
8
- httpMethod: OperationEntry["http"]["method"];
9
- controllerCtor: new (...args: any[]) => any;
10
- methodName: string;
11
- args: OperationEntry["args"];
12
- responses: OperationEntry["responses"];
13
- use?: Array<string | ((req: any, res: any, next: (err?: any) => void) => any)>;
14
- auth?: {
15
- scheme: string;
16
- scopes?: string[];
17
- optional?: boolean;
18
- } | "public";
19
- controllerUse?: Array<string | ((req: any, res: any, next: (err?: any) => void) => any)>;
20
- }
21
- /**
22
- * Binds controllers to routes from the manifest
23
- *
24
- * @param params - Binding parameters including controllers and manifest
25
- * @returns Array of bound routes
26
- */
27
- export declare function bindRoutes(params: {
28
- controllers: Array<new (...args: any[]) => any>;
29
- manifest: ManifestV1;
30
- useCache?: boolean;
31
- }): BoundRoute[];
32
- /**
33
- * Clears the route cache
34
- */
35
- export declare function clearRouteCache(): void;
36
- /**
37
- * Gets statistics about the route cache
38
- *
39
- * @returns Object containing cache size and keys
40
- */
41
- export declare function getRouteCacheStats(): {
42
- size: number;
43
- keys: string[];
44
- };
45
- //# sourceMappingURL=merge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/adapter/express/merge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAMpF;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC7C,cAAc,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IACvC,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;IAC/E,IAAI,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,QAAQ,CAAC;IAC5E,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;CAC1F;AA2BD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE;IACjC,WAAW,EAAE,KAAK,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC;IAChD,QAAQ,EAAE,UAAU,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,UAAU,EAAE,CAyBf;AAoED;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAKrE"}
@@ -1,66 +0,0 @@
1
- import type { BoundRoute } from "./merge.js";
2
- import type { OpenAPI31 } from "./types.js";
3
- /**
4
- * Converts an Express path to OpenAPI path format
5
- *
6
- * @param path - Express path with colon parameters
7
- * @returns OpenAPI path with curly brace parameters
8
- */
9
- export declare function toOpenApiPath(path: string): string;
10
- /**
11
- * Gets the OpenAPI operation for a given route
12
- *
13
- * @param openapi - The OpenAPI specification
14
- * @param route - The bound route
15
- * @returns OpenAPI operation object or null
16
- */
17
- export declare function getOpenApiOperation(openapi: OpenAPI31, route: BoundRoute): any | null;
18
- /**
19
- * Creates an index of parameter schemas by location and name
20
- *
21
- * @param operation - OpenAPI operation object
22
- * @returns Map of parameter schemas keyed by location:name
23
- */
24
- export declare function getParamSchemaIndex(operation: any | null): Map<string, Record<string, unknown>>;
25
- /**
26
- * Gets a parameter schema from the index
27
- *
28
- * @param index - The parameter schema index
29
- * @param location - The parameter location
30
- * @param name - The parameter name
31
- * @returns Parameter schema or null
32
- */
33
- export declare function getParamSchemaFromIndex(index: Map<string, Record<string, unknown>>, location: "path" | "query" | "header" | "cookie", name: string): Record<string, unknown> | null;
34
- /**
35
- * Gets the request body schema for an operation
36
- *
37
- * @param operation - OpenAPI operation object
38
- * @param contentType - Optional content type to retrieve
39
- * @returns Request body schema or null
40
- */
41
- export declare function getRequestBodySchema(operation: any | null, contentType?: string): Record<string, unknown> | null;
42
- /**
43
- * Creates a schema from a type
44
- *
45
- * @param schemaType - Schema type (string or array of strings)
46
- * @returns Schema object or null
47
- */
48
- export declare function schemaFromType(schemaType?: string | string[]): Record<string, unknown> | null;
49
- /**
50
- * Resolves a schema, following $ref references
51
- *
52
- * @param schema - The schema to resolve
53
- * @param components - OpenAPI components for reference resolution
54
- * @param seen - Set of already seen references to prevent cycles
55
- * @returns Resolved schema
56
- */
57
- export declare function resolveSchema(schema: Record<string, unknown>, components: Record<string, Record<string, unknown>>, seen?: Set<string>): Record<string, unknown>;
58
- /**
59
- * Gets a schema from OpenAPI by reference
60
- *
61
- * @param openapi - The OpenAPI specification
62
- * @param ref - The schema reference
63
- * @returns Schema object or null
64
- */
65
- export declare function getSchemaByRef(openapi: OpenAPI31, ref: string): Record<string, unknown> | null;
66
- //# sourceMappingURL=openapi.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../../src/adapter/express/openapi.ts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AC,EACnD,IAAI,GAAE,GAAG,CAAC,MAAM,CAAa,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAczB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAI9F"}
@@ -1,10 +0,0 @@
1
- import { Router } from "express";
2
- import type { CreateRouterOptions } from "./types.js";
3
- /**
4
- * Creates an Express router with Adorn API controllers
5
- *
6
- * @param options - Router configuration options
7
- * @returns Promise that resolves with the configured Express router
8
- */
9
- export declare function createExpressRouter(options: CreateRouterOptions): Promise<Router>;
10
- //# sourceMappingURL=router.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/adapter/express/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAOjC,OAAO,KAAK,EAAa,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAuBjE;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6QvF"}
@@ -1,18 +0,0 @@
1
- import { Router } from "express";
2
- import type { SetupSwaggerOptions } from "./types.js";
3
- /**
4
- * Sets up Swagger UI for API documentation
5
- *
6
- * @param options - Swagger configuration options
7
- * @returns Express router with Swagger endpoints
8
- */
9
- export declare function setupSwagger(options?: SetupSwaggerOptions): Router;
10
- /**
11
- * Create a Swagger UI router with custom configuration
12
- *
13
- * @param openapiPath - Path to the OpenAPI spec file
14
- * @param options - Additional Swagger UI options
15
- * @returns Configured Express router
16
- */
17
- export declare function createSwaggerRouter(openapiPath: string, options?: Partial<SetupSwaggerOptions>): Router;
18
- //# sourceMappingURL=swagger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"swagger.d.ts","sourceRoot":"","sources":["../../../src/adapter/express/swagger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAKjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAoDtD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAqDtE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM,GACzC,MAAM,CAOR"}
@@ -1,110 +0,0 @@
1
- import type { Request } from "express";
2
- import type { ManifestV1 } from "../../compiler/manifest/format.js";
3
- import type { AuthSchemeRuntime } from "../../runtime/auth/runtime.js";
4
- /**
5
- * OpenAPI 3.1 specification structure
6
- */
7
- export interface OpenAPI31 {
8
- openapi: string;
9
- components: {
10
- schemas: Record<string, Record<string, unknown>>;
11
- securitySchemes?: Record<string, Record<string, unknown>>;
12
- };
13
- paths?: Record<string, Record<string, any>>;
14
- security?: Array<Record<string, string[]>>;
15
- }
16
- /**
17
- * Express request with authentication data
18
- */
19
- export interface AuthenticatedRequest extends Request {
20
- auth?: any;
21
- }
22
- /**
23
- * Coercion options for request parameters
24
- */
25
- export interface CoerceOptions {
26
- body?: boolean;
27
- query?: boolean;
28
- path?: boolean;
29
- header?: boolean;
30
- cookie?: boolean;
31
- dateTime?: boolean;
32
- date?: boolean;
33
- }
34
- /**
35
- * Query parameter options
36
- */
37
- export interface QueryOptions {
38
- /** Maximum nesting depth for deepObject parameters (default: 5) */
39
- maxNestingDepth?: number;
40
- }
41
- /**
42
- * Options for creating an Express router
43
- */
44
- export interface CreateRouterOptions {
45
- controllers: Array<new (...args: any[]) => any>;
46
- artifactsDir?: string;
47
- manifest?: ManifestV1;
48
- openapi?: OpenAPI31;
49
- auth?: {
50
- schemes: Record<string, AuthSchemeRuntime>;
51
- };
52
- coerce?: CoerceOptions;
53
- defaultPageSize?: number;
54
- queryOptions?: QueryOptions;
55
- middleware?: {
56
- global?: Array<string | ((req: any, res: any, next: (err?: any) => void) => any)>;
57
- named?: Record<string, (req: any, res: any, next: (err?: any) => void) => any>;
58
- };
59
- }
60
- /**
61
- * Options for setting up Swagger UI
62
- */
63
- export interface SetupSwaggerOptions {
64
- artifactsDir?: string;
65
- jsonPath?: string;
66
- uiPath?: string;
67
- swaggerOptions?: {
68
- url?: string;
69
- servers?: Array<{
70
- url: string;
71
- description?: string;
72
- }>;
73
- [key: string]: any;
74
- };
75
- swaggerUiOptions?: {
76
- dom_id?: string;
77
- deepLinking?: boolean;
78
- presets?: Array<any>;
79
- plugins?: Array<any>;
80
- [key: string]: any;
81
- };
82
- }
83
- /**
84
- * Represents a validation error
85
- */
86
- export interface ValidationError {
87
- path: string;
88
- message: string;
89
- keyword: string;
90
- params: Record<string, unknown>;
91
- }
92
- export type CoerceLocation = "body" | "query" | "path" | "header" | "cookie";
93
- export type DateCoercionOptions = {
94
- dateTime: boolean;
95
- date: boolean;
96
- };
97
- export type StaticOrigin = boolean | string | RegExp | Array<string | RegExp>;
98
- export type CustomOrigin = (requestOrigin: string | undefined, callback: (err: Error | null, origin?: StaticOrigin) => void) => void;
99
- export interface CorsOptions {
100
- origin?: StaticOrigin | CustomOrigin;
101
- methods?: string | string[];
102
- allowedHeaders?: string | string[];
103
- exposedHeaders?: string | string[];
104
- credentials?: boolean;
105
- maxAge?: number;
106
- preflightContinue?: boolean;
107
- optionsSuccessStatus?: number;
108
- }
109
- export type CorsConfig = boolean | CorsOptions | ((app: import('express').Express) => void);
110
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapter/express/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB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}
@@ -1,27 +0,0 @@
1
- import type { Request } from "express";
2
- import type { BoundRoute } from "./merge.js";
3
- import type { OpenAPI31, ValidationError } from "./types.js";
4
- import { createValidator } from "../../runtime/validation/ajv.js";
5
- /**
6
- * Validates a request using precompiled validators
7
- *
8
- * @param route - The bound route configuration
9
- * @param req - The Express request object
10
- * @param validators - Precompiled validators for the route
11
- * @returns Array of validation errors, or null if validation passes
12
- */
13
- export declare function validateRequestWithPrecompiled(route: BoundRoute, req: Request, validators: Record<string, {
14
- body?: (data: unknown) => boolean;
15
- response: Record<string, (data: unknown) => boolean>;
16
- }>, maxDepth?: number): ValidationError[] | null;
17
- /**
18
- * Validates a request against the OpenAPI schema
19
- *
20
- * @param route - The bound route configuration
21
- * @param req - The Express request object
22
- * @param openapi - The OpenAPI specification
23
- * @param validator - The AJV validator instance
24
- * @returns Array of validation errors, or null if validation passes
25
- */
26
- export declare function validateRequest(route: BoundRoute, req: Request, openapi: OpenAPI31, validator: ReturnType<typeof createValidator>, maxDepth?: number): ValidationError[] | null;
27
- //# sourceMappingURL=validation.d.ts.map