blendsdk 5.33.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 (538) hide show
  1. package/README.md +125 -0
  2. package/dist/cmdline/cmdline.d.ts +144 -0
  3. package/dist/cmdline/cmdline.d.ts.map +1 -0
  4. package/dist/cmdline/cmdline.js +683 -0
  5. package/dist/cmdline/cmdline.js.map +1 -0
  6. package/dist/cmdline/errors.d.ts +105 -0
  7. package/dist/cmdline/errors.d.ts.map +1 -0
  8. package/dist/cmdline/errors.js +153 -0
  9. package/dist/cmdline/errors.js.map +1 -0
  10. package/dist/cmdline/index.d.ts +5 -0
  11. package/dist/cmdline/index.d.ts.map +1 -0
  12. package/dist/cmdline/index.js +5 -0
  13. package/dist/cmdline/index.js.map +1 -0
  14. package/dist/cmdline/types.d.ts +260 -0
  15. package/dist/cmdline/types.d.ts.map +1 -0
  16. package/dist/cmdline/types.js +9 -0
  17. package/dist/cmdline/types.js.map +1 -0
  18. package/dist/cmdline/validators.d.ts +28 -0
  19. package/dist/cmdline/validators.d.ts.map +1 -0
  20. package/dist/cmdline/validators.js +211 -0
  21. package/dist/cmdline/validators.js.map +1 -0
  22. package/dist/codegen/database/index.d.ts +3 -0
  23. package/dist/codegen/database/index.d.ts.map +1 -0
  24. package/dist/codegen/database/index.js +3 -0
  25. package/dist/codegen/database/index.js.map +1 -0
  26. package/dist/codegen/database/introspect/index.d.ts +3 -0
  27. package/dist/codegen/database/introspect/index.d.ts.map +1 -0
  28. package/dist/codegen/database/introspect/index.js +3 -0
  29. package/dist/codegen/database/introspect/index.js.map +1 -0
  30. package/dist/codegen/database/introspect/introspect-query.d.ts +2 -0
  31. package/dist/codegen/database/introspect/introspect-query.d.ts.map +1 -0
  32. package/dist/codegen/database/introspect/introspect-query.js +416 -0
  33. package/dist/codegen/database/introspect/introspect-query.js.map +1 -0
  34. package/dist/codegen/database/introspect/introspect-types.d.ts +45 -0
  35. package/dist/codegen/database/introspect/introspect-types.d.ts.map +1 -0
  36. package/dist/codegen/database/introspect/introspect-types.js +2 -0
  37. package/dist/codegen/database/introspect/introspect-types.js.map +1 -0
  38. package/dist/codegen/database/introspect/introspect.d.ts +21 -0
  39. package/dist/codegen/database/introspect/introspect.d.ts.map +1 -0
  40. package/dist/codegen/database/introspect/introspect.js +223 -0
  41. package/dist/codegen/database/introspect/introspect.js.map +1 -0
  42. package/dist/codegen/database/schema/check-constraint.d.ts +8 -0
  43. package/dist/codegen/database/schema/check-constraint.d.ts.map +1 -0
  44. package/dist/codegen/database/schema/check-constraint.js +12 -0
  45. package/dist/codegen/database/schema/check-constraint.js.map +1 -0
  46. package/dist/codegen/database/schema/column-schema.d.ts +7 -0
  47. package/dist/codegen/database/schema/column-schema.d.ts.map +1 -0
  48. package/dist/codegen/database/schema/column-schema.js +9 -0
  49. package/dist/codegen/database/schema/column-schema.js.map +1 -0
  50. package/dist/codegen/database/schema/constraint-base.d.ts +13 -0
  51. package/dist/codegen/database/schema/constraint-base.d.ts.map +1 -0
  52. package/dist/codegen/database/schema/constraint-base.js +32 -0
  53. package/dist/codegen/database/schema/constraint-base.js.map +1 -0
  54. package/dist/codegen/database/schema/database-schema.d.ts +19 -0
  55. package/dist/codegen/database/schema/database-schema.d.ts.map +1 -0
  56. package/dist/codegen/database/schema/database-schema.js +48 -0
  57. package/dist/codegen/database/schema/database-schema.js.map +1 -0
  58. package/dist/codegen/database/schema/dataobject-schema.d.ts +9 -0
  59. package/dist/codegen/database/schema/dataobject-schema.d.ts.map +1 -0
  60. package/dist/codegen/database/schema/dataobject-schema.js +18 -0
  61. package/dist/codegen/database/schema/dataobject-schema.js.map +1 -0
  62. package/dist/codegen/database/schema/fkey-constraints.d.ts +21 -0
  63. package/dist/codegen/database/schema/fkey-constraints.d.ts.map +1 -0
  64. package/dist/codegen/database/schema/fkey-constraints.js +58 -0
  65. package/dist/codegen/database/schema/fkey-constraints.js.map +1 -0
  66. package/dist/codegen/database/schema/index-constraint.d.ts +34 -0
  67. package/dist/codegen/database/schema/index-constraint.d.ts.map +1 -0
  68. package/dist/codegen/database/schema/index-constraint.js +79 -0
  69. package/dist/codegen/database/schema/index-constraint.js.map +1 -0
  70. package/dist/codegen/database/schema/index.d.ts +5 -0
  71. package/dist/codegen/database/schema/index.d.ts.map +1 -0
  72. package/dist/codegen/database/schema/index.js +5 -0
  73. package/dist/codegen/database/schema/index.js.map +1 -0
  74. package/dist/codegen/database/schema/primarykey-constraint.d.ts +4 -0
  75. package/dist/codegen/database/schema/primarykey-constraint.d.ts.map +1 -0
  76. package/dist/codegen/database/schema/primarykey-constraint.js +4 -0
  77. package/dist/codegen/database/schema/primarykey-constraint.js.map +1 -0
  78. package/dist/codegen/database/schema/relation-schema.d.ts +16 -0
  79. package/dist/codegen/database/schema/relation-schema.d.ts.map +1 -0
  80. package/dist/codegen/database/schema/relation-schema.js +32 -0
  81. package/dist/codegen/database/schema/relation-schema.js.map +1 -0
  82. package/dist/codegen/database/schema/table-column-schema.d.ts +59 -0
  83. package/dist/codegen/database/schema/table-column-schema.d.ts.map +1 -0
  84. package/dist/codegen/database/schema/table-column-schema.js +137 -0
  85. package/dist/codegen/database/schema/table-column-schema.js.map +1 -0
  86. package/dist/codegen/database/schema/table-schema.d.ts +48 -0
  87. package/dist/codegen/database/schema/table-schema.d.ts.map +1 -0
  88. package/dist/codegen/database/schema/table-schema.js +219 -0
  89. package/dist/codegen/database/schema/table-schema.js.map +1 -0
  90. package/dist/codegen/database/schema/types.d.ts +13 -0
  91. package/dist/codegen/database/schema/types.d.ts.map +1 -0
  92. package/dist/codegen/database/schema/types.js +175 -0
  93. package/dist/codegen/database/schema/types.js.map +1 -0
  94. package/dist/codegen/database/schema/unique-constraint.d.ts +4 -0
  95. package/dist/codegen/database/schema/unique-constraint.d.ts.map +1 -0
  96. package/dist/codegen/database/schema/unique-constraint.js +4 -0
  97. package/dist/codegen/database/schema/unique-constraint.js.map +1 -0
  98. package/dist/codegen/database/schema/view-schema.d.ts +14 -0
  99. package/dist/codegen/database/schema/view-schema.d.ts.map +1 -0
  100. package/dist/codegen/database/schema/view-schema.js +32 -0
  101. package/dist/codegen/database/schema/view-schema.js.map +1 -0
  102. package/dist/codegen/generator/ctype-generator.d.ts +5 -0
  103. package/dist/codegen/generator/ctype-generator.d.ts.map +1 -0
  104. package/dist/codegen/generator/ctype-generator.js +26 -0
  105. package/dist/codegen/generator/ctype-generator.js.map +1 -0
  106. package/dist/codegen/generator/generator.d.ts +17 -0
  107. package/dist/codegen/generator/generator.d.ts.map +1 -0
  108. package/dist/codegen/generator/generator.js +57 -0
  109. package/dist/codegen/generator/generator.js.map +1 -0
  110. package/dist/codegen/generator/index.d.ts +8 -0
  111. package/dist/codegen/generator/index.d.ts.map +1 -0
  112. package/dist/codegen/generator/index.js +8 -0
  113. package/dist/codegen/generator/index.js.map +1 -0
  114. package/dist/codegen/generator/openapi-generator.d.ts +239 -0
  115. package/dist/codegen/generator/openapi-generator.d.ts.map +1 -0
  116. package/dist/codegen/generator/openapi-generator.js +434 -0
  117. package/dist/codegen/generator/openapi-generator.js.map +1 -0
  118. package/dist/codegen/generator/openapi-types.d.ts +263 -0
  119. package/dist/codegen/generator/openapi-types.d.ts.map +1 -0
  120. package/dist/codegen/generator/openapi-types.js +11 -0
  121. package/dist/codegen/generator/openapi-types.js.map +1 -0
  122. package/dist/codegen/generator/postgres-schema-generator.d.ts +48 -0
  123. package/dist/codegen/generator/postgres-schema-generator.d.ts.map +1 -0
  124. package/dist/codegen/generator/postgres-schema-generator.js +339 -0
  125. package/dist/codegen/generator/postgres-schema-generator.js.map +1 -0
  126. package/dist/codegen/generator/type-generator.d.ts +113 -0
  127. package/dist/codegen/generator/type-generator.d.ts.map +1 -0
  128. package/dist/codegen/generator/type-generator.js +249 -0
  129. package/dist/codegen/generator/type-generator.js.map +1 -0
  130. package/dist/codegen/generator/zod-generator.d.ts +15 -0
  131. package/dist/codegen/generator/zod-generator.d.ts.map +1 -0
  132. package/dist/codegen/generator/zod-generator.js +86 -0
  133. package/dist/codegen/generator/zod-generator.js.map +1 -0
  134. package/dist/codegen/generator/zod-to-openapi.d.ts +69 -0
  135. package/dist/codegen/generator/zod-to-openapi.d.ts.map +1 -0
  136. package/dist/codegen/generator/zod-to-openapi.js +480 -0
  137. package/dist/codegen/generator/zod-to-openapi.js.map +1 -0
  138. package/dist/codegen/index.d.ts +4 -0
  139. package/dist/codegen/index.d.ts.map +1 -0
  140. package/dist/codegen/index.js +4 -0
  141. package/dist/codegen/index.js.map +1 -0
  142. package/dist/codegen/schema/any-schema.d.ts +6 -0
  143. package/dist/codegen/schema/any-schema.d.ts.map +1 -0
  144. package/dist/codegen/schema/any-schema.js +12 -0
  145. package/dist/codegen/schema/any-schema.js.map +1 -0
  146. package/dist/codegen/schema/boolean-schema.d.ts +6 -0
  147. package/dist/codegen/schema/boolean-schema.d.ts.map +1 -0
  148. package/dist/codegen/schema/boolean-schema.js +12 -0
  149. package/dist/codegen/schema/boolean-schema.js.map +1 -0
  150. package/dist/codegen/schema/date-schema.d.ts +6 -0
  151. package/dist/codegen/schema/date-schema.d.ts.map +1 -0
  152. package/dist/codegen/schema/date-schema.js +12 -0
  153. package/dist/codegen/schema/date-schema.js.map +1 -0
  154. package/dist/codegen/schema/index.d.ts +10 -0
  155. package/dist/codegen/schema/index.d.ts.map +1 -0
  156. package/dist/codegen/schema/index.js +10 -0
  157. package/dist/codegen/schema/index.js.map +1 -0
  158. package/dist/codegen/schema/object-schema.d.ts +10 -0
  159. package/dist/codegen/schema/object-schema.d.ts.map +1 -0
  160. package/dist/codegen/schema/object-schema.js +21 -0
  161. package/dist/codegen/schema/object-schema.js.map +1 -0
  162. package/dist/codegen/schema/primitive-schema.d.ts +20 -0
  163. package/dist/codegen/schema/primitive-schema.d.ts.map +1 -0
  164. package/dist/codegen/schema/primitive-schema.js +48 -0
  165. package/dist/codegen/schema/primitive-schema.js.map +1 -0
  166. package/dist/codegen/schema/ref-schema.d.ts +6 -0
  167. package/dist/codegen/schema/ref-schema.d.ts.map +1 -0
  168. package/dist/codegen/schema/ref-schema.js +11 -0
  169. package/dist/codegen/schema/ref-schema.js.map +1 -0
  170. package/dist/codegen/schema/schema-container.d.ts +14 -0
  171. package/dist/codegen/schema/schema-container.d.ts.map +1 -0
  172. package/dist/codegen/schema/schema-container.js +38 -0
  173. package/dist/codegen/schema/schema-container.js.map +1 -0
  174. package/dist/codegen/schema/schema-object.d.ts +42 -0
  175. package/dist/codegen/schema/schema-object.d.ts.map +1 -0
  176. package/dist/codegen/schema/schema-object.js +90 -0
  177. package/dist/codegen/schema/schema-object.js.map +1 -0
  178. package/dist/codegen/schema/schema-scope.d.ts +23 -0
  179. package/dist/codegen/schema/schema-scope.d.ts.map +1 -0
  180. package/dist/codegen/schema/schema-scope.js +67 -0
  181. package/dist/codegen/schema/schema-scope.js.map +1 -0
  182. package/dist/codegen/schema/utils.d.ts +17 -0
  183. package/dist/codegen/schema/utils.d.ts.map +1 -0
  184. package/dist/codegen/schema/utils.js +47 -0
  185. package/dist/codegen/schema/utils.js.map +1 -0
  186. package/dist/dbcore/crud-statement.d.ts +67 -0
  187. package/dist/dbcore/crud-statement.d.ts.map +1 -0
  188. package/dist/dbcore/crud-statement.js +75 -0
  189. package/dist/dbcore/crud-statement.js.map +1 -0
  190. package/dist/dbcore/database.d.ts +272 -0
  191. package/dist/dbcore/database.d.ts.map +1 -0
  192. package/dist/dbcore/database.js +53 -0
  193. package/dist/dbcore/database.js.map +1 -0
  194. package/dist/dbcore/dataservice-base.d.ts +18 -0
  195. package/dist/dbcore/dataservice-base.d.ts.map +1 -0
  196. package/dist/dbcore/dataservice-base.js +19 -0
  197. package/dist/dbcore/dataservice-base.js.map +1 -0
  198. package/dist/dbcore/delete-statement.d.ts +29 -0
  199. package/dist/dbcore/delete-statement.d.ts.map +1 -0
  200. package/dist/dbcore/delete-statement.js +30 -0
  201. package/dist/dbcore/delete-statement.js.map +1 -0
  202. package/dist/dbcore/filterable-statement.d.ts +126 -0
  203. package/dist/dbcore/filterable-statement.d.ts.map +1 -0
  204. package/dist/dbcore/filterable-statement.js +178 -0
  205. package/dist/dbcore/filterable-statement.js.map +1 -0
  206. package/dist/dbcore/from-statement.d.ts +120 -0
  207. package/dist/dbcore/from-statement.d.ts.map +1 -0
  208. package/dist/dbcore/from-statement.js +150 -0
  209. package/dist/dbcore/from-statement.js.map +1 -0
  210. package/dist/dbcore/index.d.ts +21 -0
  211. package/dist/dbcore/index.d.ts.map +1 -0
  212. package/dist/dbcore/index.js +21 -0
  213. package/dist/dbcore/index.js.map +1 -0
  214. package/dist/dbcore/insert-statement.d.ts +48 -0
  215. package/dist/dbcore/insert-statement.d.ts.map +1 -0
  216. package/dist/dbcore/insert-statement.js +52 -0
  217. package/dist/dbcore/insert-statement.js.map +1 -0
  218. package/dist/dbcore/query-dataservice.d.ts +144 -0
  219. package/dist/dbcore/query-dataservice.d.ts.map +1 -0
  220. package/dist/dbcore/query-dataservice.js +144 -0
  221. package/dist/dbcore/query-dataservice.js.map +1 -0
  222. package/dist/dbcore/statement.d.ts +133 -0
  223. package/dist/dbcore/statement.d.ts.map +1 -0
  224. package/dist/dbcore/statement.js +138 -0
  225. package/dist/dbcore/statement.js.map +1 -0
  226. package/dist/dbcore/update-statement.d.ts +48 -0
  227. package/dist/dbcore/update-statement.d.ts.map +1 -0
  228. package/dist/dbcore/update-statement.js +52 -0
  229. package/dist/dbcore/update-statement.js.map +1 -0
  230. package/dist/expression/builders/comparison-builder.d.ts +47 -0
  231. package/dist/expression/builders/comparison-builder.d.ts.map +1 -0
  232. package/dist/expression/builders/comparison-builder.js +197 -0
  233. package/dist/expression/builders/comparison-builder.js.map +1 -0
  234. package/dist/expression/builders/query-builder.d.ts +80 -0
  235. package/dist/expression/builders/query-builder.d.ts.map +1 -0
  236. package/dist/expression/builders/query-builder.js +229 -0
  237. package/dist/expression/builders/query-builder.js.map +1 -0
  238. package/dist/expression/compiler/postgresql-compiler.d.ts +56 -0
  239. package/dist/expression/compiler/postgresql-compiler.d.ts.map +1 -0
  240. package/dist/expression/compiler/postgresql-compiler.js +217 -0
  241. package/dist/expression/compiler/postgresql-compiler.js.map +1 -0
  242. package/dist/expression/core/ast-node.d.ts +47 -0
  243. package/dist/expression/core/ast-node.d.ts.map +1 -0
  244. package/dist/expression/core/ast-node.js +154 -0
  245. package/dist/expression/core/ast-node.js.map +1 -0
  246. package/dist/expression/core/parameter-manager.d.ts +84 -0
  247. package/dist/expression/core/parameter-manager.d.ts.map +1 -0
  248. package/dist/expression/core/parameter-manager.js +164 -0
  249. package/dist/expression/core/parameter-manager.js.map +1 -0
  250. package/dist/expression/core/query-builder-interfaces.d.ts +188 -0
  251. package/dist/expression/core/query-builder-interfaces.d.ts.map +1 -0
  252. package/dist/expression/core/query-builder-interfaces.js +6 -0
  253. package/dist/expression/core/query-builder-interfaces.js.map +1 -0
  254. package/dist/expression/core/types.d.ts +239 -0
  255. package/dist/expression/core/types.d.ts.map +1 -0
  256. package/dist/expression/core/types.js +121 -0
  257. package/dist/expression/core/types.js.map +1 -0
  258. package/dist/expression/index.d.ts +11 -0
  259. package/dist/expression/index.d.ts.map +1 -0
  260. package/dist/expression/index.js +11 -0
  261. package/dist/expression/index.js.map +1 -0
  262. package/dist/i18n/content-file-source.d.ts +109 -0
  263. package/dist/i18n/content-file-source.d.ts.map +1 -0
  264. package/dist/i18n/content-file-source.js +218 -0
  265. package/dist/i18n/content-file-source.js.map +1 -0
  266. package/dist/i18n/index.d.ts +19 -0
  267. package/dist/i18n/index.d.ts.map +1 -0
  268. package/dist/i18n/index.js +21 -0
  269. package/dist/i18n/index.js.map +1 -0
  270. package/dist/i18n/json-file-source.d.ts +96 -0
  271. package/dist/i18n/json-file-source.d.ts.map +1 -0
  272. package/dist/i18n/json-file-source.js +258 -0
  273. package/dist/i18n/json-file-source.js.map +1 -0
  274. package/dist/i18n/merge-catalogs.d.ts +20 -0
  275. package/dist/i18n/merge-catalogs.d.ts.map +1 -0
  276. package/dist/i18n/merge-catalogs.js +34 -0
  277. package/dist/i18n/merge-catalogs.js.map +1 -0
  278. package/dist/i18n/node.d.ts +20 -0
  279. package/dist/i18n/node.d.ts.map +1 -0
  280. package/dist/i18n/node.js +19 -0
  281. package/dist/i18n/node.js.map +1 -0
  282. package/dist/i18n/translation-source.d.ts +35 -0
  283. package/dist/i18n/translation-source.d.ts.map +1 -0
  284. package/dist/i18n/translation-source.js +2 -0
  285. package/dist/i18n/translation-source.js.map +1 -0
  286. package/dist/i18n/translator.d.ts +162 -0
  287. package/dist/i18n/translator.d.ts.map +1 -0
  288. package/dist/i18n/translator.js +259 -0
  289. package/dist/i18n/translator.js.map +1 -0
  290. package/dist/i18n/types.d.ts +80 -0
  291. package/dist/i18n/types.d.ts.map +1 -0
  292. package/dist/i18n/types.js +2 -0
  293. package/dist/i18n/types.js.map +1 -0
  294. package/dist/postgresql/database.d.ts +204 -0
  295. package/dist/postgresql/database.d.ts.map +1 -0
  296. package/dist/postgresql/database.js +321 -0
  297. package/dist/postgresql/database.js.map +1 -0
  298. package/dist/postgresql/delete-statement.d.ts +36 -0
  299. package/dist/postgresql/delete-statement.d.ts.map +1 -0
  300. package/dist/postgresql/delete-statement.js +54 -0
  301. package/dist/postgresql/delete-statement.js.map +1 -0
  302. package/dist/postgresql/index.d.ts +12 -0
  303. package/dist/postgresql/index.d.ts.map +1 -0
  304. package/dist/postgresql/index.js +12 -0
  305. package/dist/postgresql/index.js.map +1 -0
  306. package/dist/postgresql/insert-statement.d.ts +34 -0
  307. package/dist/postgresql/insert-statement.d.ts.map +1 -0
  308. package/dist/postgresql/insert-statement.js +48 -0
  309. package/dist/postgresql/insert-statement.js.map +1 -0
  310. package/dist/postgresql/update-statement.d.ts +38 -0
  311. package/dist/postgresql/update-statement.d.ts.map +1 -0
  312. package/dist/postgresql/update-statement.js +75 -0
  313. package/dist/postgresql/update-statement.js.map +1 -0
  314. package/dist/stdlib/formatString.d.ts +52 -0
  315. package/dist/stdlib/formatString.d.ts.map +1 -0
  316. package/dist/stdlib/formatString.js +118 -0
  317. package/dist/stdlib/formatString.js.map +1 -0
  318. package/dist/stdlib/index.d.ts +8 -0
  319. package/dist/stdlib/index.d.ts.map +1 -0
  320. package/dist/stdlib/index.js +8 -0
  321. package/dist/stdlib/index.js.map +1 -0
  322. package/dist/stdlib/isBoolean.d.ts +15 -0
  323. package/dist/stdlib/isBoolean.d.ts.map +1 -0
  324. package/dist/stdlib/isBoolean.js +17 -0
  325. package/dist/stdlib/isBoolean.js.map +1 -0
  326. package/dist/stdlib/isNullOrUndef.d.ts +24 -0
  327. package/dist/stdlib/isNullOrUndef.d.ts.map +1 -0
  328. package/dist/stdlib/isNullOrUndef.js +28 -0
  329. package/dist/stdlib/isNullOrUndef.js.map +1 -0
  330. package/dist/stdlib/isNumeric.d.ts +20 -0
  331. package/dist/stdlib/isNumeric.d.ts.map +1 -0
  332. package/dist/stdlib/isNumeric.js +39 -0
  333. package/dist/stdlib/isNumeric.js.map +1 -0
  334. package/dist/stdlib/isString.d.ts +15 -0
  335. package/dist/stdlib/isString.d.ts.map +1 -0
  336. package/dist/stdlib/isString.js +17 -0
  337. package/dist/stdlib/isString.js.map +1 -0
  338. package/dist/stdlib/isTemplateString.d.ts +18 -0
  339. package/dist/stdlib/isTemplateString.d.ts.map +1 -0
  340. package/dist/stdlib/isTemplateString.js +38 -0
  341. package/dist/stdlib/isTemplateString.js.map +1 -0
  342. package/dist/stdlib/wrapInArray.d.ts +14 -0
  343. package/dist/stdlib/wrapInArray.d.ts.map +1 -0
  344. package/dist/stdlib/wrapInArray.js +17 -0
  345. package/dist/stdlib/wrapInArray.js.map +1 -0
  346. package/dist/webafx/application/application-settings.d.ts +129 -0
  347. package/dist/webafx/application/application-settings.d.ts.map +1 -0
  348. package/dist/webafx/application/application-settings.js +162 -0
  349. package/dist/webafx/application/application-settings.js.map +1 -0
  350. package/dist/webafx/application/base-controller.d.ts +128 -0
  351. package/dist/webafx/application/base-controller.d.ts.map +1 -0
  352. package/dist/webafx/application/base-controller.js +122 -0
  353. package/dist/webafx/application/base-controller.js.map +1 -0
  354. package/dist/webafx/application/console-logger.d.ts +81 -0
  355. package/dist/webafx/application/console-logger.d.ts.map +1 -0
  356. package/dist/webafx/application/console-logger.js +111 -0
  357. package/dist/webafx/application/console-logger.js.map +1 -0
  358. package/dist/webafx/application/controller-registry.d.ts +34 -0
  359. package/dist/webafx/application/controller-registry.d.ts.map +1 -0
  360. package/dist/webafx/application/controller-registry.js +32 -0
  361. package/dist/webafx/application/controller-registry.js.map +1 -0
  362. package/dist/webafx/application/error-handler-middleware.d.ts +22 -0
  363. package/dist/webafx/application/error-handler-middleware.d.ts.map +1 -0
  364. package/dist/webafx/application/error-handler-middleware.js +70 -0
  365. package/dist/webafx/application/error-handler-middleware.js.map +1 -0
  366. package/dist/webafx/application/index.d.ts +13 -0
  367. package/dist/webafx/application/index.d.ts.map +1 -0
  368. package/dist/webafx/application/index.js +13 -0
  369. package/dist/webafx/application/index.js.map +1 -0
  370. package/dist/webafx/application/logger.d.ts +2 -0
  371. package/dist/webafx/application/logger.d.ts.map +1 -0
  372. package/dist/webafx/application/logger.js +2 -0
  373. package/dist/webafx/application/logger.js.map +1 -0
  374. package/dist/webafx/application/plugin.d.ts +73 -0
  375. package/dist/webafx/application/plugin.d.ts.map +1 -0
  376. package/dist/webafx/application/plugin.js +90 -0
  377. package/dist/webafx/application/plugin.js.map +1 -0
  378. package/dist/webafx/application/rate-limiter.d.ts +35 -0
  379. package/dist/webafx/application/rate-limiter.d.ts.map +1 -0
  380. package/dist/webafx/application/rate-limiter.js +74 -0
  381. package/dist/webafx/application/rate-limiter.js.map +1 -0
  382. package/dist/webafx/application/request-context.d.ts +62 -0
  383. package/dist/webafx/application/request-context.d.ts.map +1 -0
  384. package/dist/webafx/application/request-context.js +54 -0
  385. package/dist/webafx/application/request-context.js.map +1 -0
  386. package/dist/webafx/application/request-id-middleware.d.ts +30 -0
  387. package/dist/webafx/application/request-id-middleware.d.ts.map +1 -0
  388. package/dist/webafx/application/request-id-middleware.js +57 -0
  389. package/dist/webafx/application/request-id-middleware.js.map +1 -0
  390. package/dist/webafx/application/route-builder.d.ts +231 -0
  391. package/dist/webafx/application/route-builder.d.ts.map +1 -0
  392. package/dist/webafx/application/route-builder.js +182 -0
  393. package/dist/webafx/application/route-builder.js.map +1 -0
  394. package/dist/webafx/application/service-container.d.ts +144 -0
  395. package/dist/webafx/application/service-container.d.ts.map +1 -0
  396. package/dist/webafx/application/service-container.js +192 -0
  397. package/dist/webafx/application/service-container.js.map +1 -0
  398. package/dist/webafx/application/services.d.ts +27 -0
  399. package/dist/webafx/application/services.d.ts.map +1 -0
  400. package/dist/webafx/application/services.js +33 -0
  401. package/dist/webafx/application/services.js.map +1 -0
  402. package/dist/webafx/application/structured-logger.d.ts +99 -0
  403. package/dist/webafx/application/structured-logger.d.ts.map +1 -0
  404. package/dist/webafx/application/structured-logger.js +132 -0
  405. package/dist/webafx/application/structured-logger.js.map +1 -0
  406. package/dist/webafx/application/type.d.ts +29 -0
  407. package/dist/webafx/application/type.d.ts.map +1 -0
  408. package/dist/webafx/application/type.js +2 -0
  409. package/dist/webafx/application/type.js.map +1 -0
  410. package/dist/webafx/application/web-application.d.ts +257 -0
  411. package/dist/webafx/application/web-application.d.ts.map +1 -0
  412. package/dist/webafx/application/web-application.js +611 -0
  413. package/dist/webafx/application/web-application.js.map +1 -0
  414. package/dist/webafx/errors/api-error.d.ts +21 -0
  415. package/dist/webafx/errors/api-error.d.ts.map +1 -0
  416. package/dist/webafx/errors/api-error.js +38 -0
  417. package/dist/webafx/errors/api-error.js.map +1 -0
  418. package/dist/webafx/errors/http-errors.d.ts +56 -0
  419. package/dist/webafx/errors/http-errors.d.ts.map +1 -0
  420. package/dist/webafx/errors/http-errors.js +74 -0
  421. package/dist/webafx/errors/http-errors.js.map +1 -0
  422. package/dist/webafx/errors/index.d.ts +4 -0
  423. package/dist/webafx/errors/index.d.ts.map +1 -0
  424. package/dist/webafx/errors/index.js +4 -0
  425. package/dist/webafx/errors/index.js.map +1 -0
  426. package/dist/webafx/errors/types.d.ts +42 -0
  427. package/dist/webafx/errors/types.d.ts.map +1 -0
  428. package/dist/webafx/errors/types.js +2 -0
  429. package/dist/webafx/errors/types.js.map +1 -0
  430. package/dist/webafx/index.d.ts +3 -0
  431. package/dist/webafx/index.d.ts.map +1 -0
  432. package/dist/webafx/index.js +3 -0
  433. package/dist/webafx/index.js.map +1 -0
  434. package/dist/webafx-auth/abstract-auth-provider.d.ts +178 -0
  435. package/dist/webafx-auth/abstract-auth-provider.d.ts.map +1 -0
  436. package/dist/webafx-auth/abstract-auth-provider.js +240 -0
  437. package/dist/webafx-auth/abstract-auth-provider.js.map +1 -0
  438. package/dist/webafx-auth/index.d.ts +27 -0
  439. package/dist/webafx-auth/index.d.ts.map +1 -0
  440. package/dist/webafx-auth/index.js +32 -0
  441. package/dist/webafx-auth/index.js.map +1 -0
  442. package/dist/webafx-auth/jwt-auth-provider.d.ts +100 -0
  443. package/dist/webafx-auth/jwt-auth-provider.d.ts.map +1 -0
  444. package/dist/webafx-auth/jwt-auth-provider.js +154 -0
  445. package/dist/webafx-auth/jwt-auth-provider.js.map +1 -0
  446. package/dist/webafx-auth/memory-auth-provider.d.ts +100 -0
  447. package/dist/webafx-auth/memory-auth-provider.d.ts.map +1 -0
  448. package/dist/webafx-auth/memory-auth-provider.js +122 -0
  449. package/dist/webafx-auth/memory-auth-provider.js.map +1 -0
  450. package/dist/webafx-auth/types.d.ts +333 -0
  451. package/dist/webafx-auth/types.d.ts.map +1 -0
  452. package/dist/webafx-auth/types.js +24 -0
  453. package/dist/webafx-auth/types.js.map +1 -0
  454. package/dist/webafx-cache/abstract-cache-provider.d.ts +185 -0
  455. package/dist/webafx-cache/abstract-cache-provider.d.ts.map +1 -0
  456. package/dist/webafx-cache/abstract-cache-provider.js +133 -0
  457. package/dist/webafx-cache/abstract-cache-provider.js.map +1 -0
  458. package/dist/webafx-cache/abstract-pubsub-provider.d.ts +170 -0
  459. package/dist/webafx-cache/abstract-pubsub-provider.d.ts.map +1 -0
  460. package/dist/webafx-cache/abstract-pubsub-provider.js +132 -0
  461. package/dist/webafx-cache/abstract-pubsub-provider.js.map +1 -0
  462. package/dist/webafx-cache/cache-plugin.d.ts +114 -0
  463. package/dist/webafx-cache/cache-plugin.d.ts.map +1 -0
  464. package/dist/webafx-cache/cache-plugin.js +176 -0
  465. package/dist/webafx-cache/cache-plugin.js.map +1 -0
  466. package/dist/webafx-cache/index.d.ts +33 -0
  467. package/dist/webafx-cache/index.d.ts.map +1 -0
  468. package/dist/webafx-cache/index.js +44 -0
  469. package/dist/webafx-cache/index.js.map +1 -0
  470. package/dist/webafx-cache/memory-cache-provider.d.ts +99 -0
  471. package/dist/webafx-cache/memory-cache-provider.d.ts.map +1 -0
  472. package/dist/webafx-cache/memory-cache-provider.js +251 -0
  473. package/dist/webafx-cache/memory-cache-provider.js.map +1 -0
  474. package/dist/webafx-cache/memory-pubsub-provider.d.ts +124 -0
  475. package/dist/webafx-cache/memory-pubsub-provider.d.ts.map +1 -0
  476. package/dist/webafx-cache/memory-pubsub-provider.js +195 -0
  477. package/dist/webafx-cache/memory-pubsub-provider.js.map +1 -0
  478. package/dist/webafx-cache/pubsub-plugin.d.ts +128 -0
  479. package/dist/webafx-cache/pubsub-plugin.d.ts.map +1 -0
  480. package/dist/webafx-cache/pubsub-plugin.js +182 -0
  481. package/dist/webafx-cache/pubsub-plugin.js.map +1 -0
  482. package/dist/webafx-cache/redis-cache-provider.d.ts +81 -0
  483. package/dist/webafx-cache/redis-cache-provider.d.ts.map +1 -0
  484. package/dist/webafx-cache/redis-cache-provider.js +209 -0
  485. package/dist/webafx-cache/redis-cache-provider.js.map +1 -0
  486. package/dist/webafx-cache/redis-pubsub-provider.d.ts +164 -0
  487. package/dist/webafx-cache/redis-pubsub-provider.d.ts.map +1 -0
  488. package/dist/webafx-cache/redis-pubsub-provider.js +329 -0
  489. package/dist/webafx-cache/redis-pubsub-provider.js.map +1 -0
  490. package/dist/webafx-cache/types.d.ts +206 -0
  491. package/dist/webafx-cache/types.d.ts.map +1 -0
  492. package/dist/webafx-cache/types.js +27 -0
  493. package/dist/webafx-cache/types.js.map +1 -0
  494. package/dist/webafx-i18n/i18n-plugin.d.ts +29 -0
  495. package/dist/webafx-i18n/i18n-plugin.d.ts.map +1 -0
  496. package/dist/webafx-i18n/i18n-plugin.js +145 -0
  497. package/dist/webafx-i18n/i18n-plugin.js.map +1 -0
  498. package/dist/webafx-i18n/index.d.ts +12 -0
  499. package/dist/webafx-i18n/index.d.ts.map +1 -0
  500. package/dist/webafx-i18n/index.js +12 -0
  501. package/dist/webafx-i18n/index.js.map +1 -0
  502. package/dist/webafx-i18n/locale-resolver.d.ts +33 -0
  503. package/dist/webafx-i18n/locale-resolver.d.ts.map +1 -0
  504. package/dist/webafx-i18n/locale-resolver.js +67 -0
  505. package/dist/webafx-i18n/locale-resolver.js.map +1 -0
  506. package/dist/webafx-i18n/postgresql-source.d.ts +101 -0
  507. package/dist/webafx-i18n/postgresql-source.d.ts.map +1 -0
  508. package/dist/webafx-i18n/postgresql-source.js +101 -0
  509. package/dist/webafx-i18n/postgresql-source.js.map +1 -0
  510. package/dist/webafx-i18n/types.d.ts +70 -0
  511. package/dist/webafx-i18n/types.d.ts.map +1 -0
  512. package/dist/webafx-i18n/types.js +2 -0
  513. package/dist/webafx-i18n/types.js.map +1 -0
  514. package/dist/webafx-mailer/abstract-mail-provider.d.ts +55 -0
  515. package/dist/webafx-mailer/abstract-mail-provider.d.ts.map +1 -0
  516. package/dist/webafx-mailer/abstract-mail-provider.js +37 -0
  517. package/dist/webafx-mailer/abstract-mail-provider.js.map +1 -0
  518. package/dist/webafx-mailer/index.d.ts +24 -0
  519. package/dist/webafx-mailer/index.d.ts.map +1 -0
  520. package/dist/webafx-mailer/index.js +34 -0
  521. package/dist/webafx-mailer/index.js.map +1 -0
  522. package/dist/webafx-mailer/mail-plugin.d.ts +98 -0
  523. package/dist/webafx-mailer/mail-plugin.d.ts.map +1 -0
  524. package/dist/webafx-mailer/mail-plugin.js +155 -0
  525. package/dist/webafx-mailer/mail-plugin.js.map +1 -0
  526. package/dist/webafx-mailer/memory-mail-provider.d.ts +85 -0
  527. package/dist/webafx-mailer/memory-mail-provider.d.ts.map +1 -0
  528. package/dist/webafx-mailer/memory-mail-provider.js +111 -0
  529. package/dist/webafx-mailer/memory-mail-provider.js.map +1 -0
  530. package/dist/webafx-mailer/smtp-mail-provider.d.ts +65 -0
  531. package/dist/webafx-mailer/smtp-mail-provider.d.ts.map +1 -0
  532. package/dist/webafx-mailer/smtp-mail-provider.js +113 -0
  533. package/dist/webafx-mailer/smtp-mail-provider.js.map +1 -0
  534. package/dist/webafx-mailer/types.d.ts +136 -0
  535. package/dist/webafx-mailer/types.d.ts.map +1 -0
  536. package/dist/webafx-mailer/types.js +13 -0
  537. package/dist/webafx-mailer/types.js.map +1 -0
  538. package/package.json +159 -0
@@ -0,0 +1,239 @@
1
+ import type { RouteDefinition, HttpMethod } from '../../webafx/index.js';
2
+ import type { OpenAPIDocument, OpenAPIGeneratorConfig, OpenAPIOperation, OpenAPIPathItem, OpenAPIResponse, OpenAPIParameter, OpenAPISchema, SecurityRequirement } from './openapi-types.js';
3
+ /**
4
+ * Constructor type for webafx controllers.
5
+ * Controllers must accept (settings, services) and implement routes().
6
+ *
7
+ * @remarks
8
+ * Uses a loose constructor signature so codegen doesn't need to import
9
+ * the full ApplicationSettings/ServiceContainer types at runtime.
10
+ */
11
+ export type ControllerConstructor = new (settings: any, services: any) => {
12
+ routes(): RouteDefinition[];
13
+ };
14
+ /**
15
+ * Internal representation of a collected route with its base path.
16
+ * Routes are collected from controllers and stored for document generation.
17
+ */
18
+ interface CollectedRoute {
19
+ /** The controller's base path (e.g., '/api/products') */
20
+ basePath: string;
21
+ /** The complete route definition from the controller */
22
+ definition: RouteDefinition;
23
+ }
24
+ /**
25
+ * Generates OpenAPI v3.1 specification documents from webafx controller routes.
26
+ *
27
+ * This generator reads route definitions (with their Zod validation schemas
28
+ * and OpenAPI metadata) and produces a complete OpenAPI 3.1.0 document.
29
+ * Only routes that have been annotated with `.openapi()` metadata are included
30
+ * in the generated specification — this is the opt-in mechanism.
31
+ *
32
+ * @remarks
33
+ * - This class does NOT extend the existing codegen `Generator` base class
34
+ * because it operates on webafx routes, not on database schemas.
35
+ * - Controllers are instantiated with empty mock settings/services since
36
+ * `routes()` only builds RouteDefinition objects (no side effects).
37
+ * - Zod→OpenAPI schema conversion is handled by dedicated protected methods
38
+ * that can be overridden or extended.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * import { OpenAPIGenerator } from '../index.js';
43
+ * import { ProductsController } from './controllers/products.controller.js';
44
+ *
45
+ * const generator = new OpenAPIGenerator({
46
+ * title: 'My API',
47
+ * version: '1.0.0',
48
+ * servers: [{ url: 'http://localhost:3000' }],
49
+ * securitySchemes: {
50
+ * bearerAuth: { type: 'http', scheme: 'bearer', bearerFormat: 'JWT' }
51
+ * },
52
+ * defaultSecurity: [{ bearerAuth: [] }]
53
+ * });
54
+ *
55
+ * generator.addController('/api/products', ProductsController);
56
+ *
57
+ * const spec = generator.generate();
58
+ * generator.toFile('./openapi.json');
59
+ * ```
60
+ */
61
+ export declare class OpenAPIGenerator {
62
+ /** Generator configuration (API info, servers, security) */
63
+ protected config: OpenAPIGeneratorConfig;
64
+ /** Collected routes from controllers (only those with .openapi() metadata) */
65
+ protected routes: CollectedRoute[];
66
+ /**
67
+ * Creates a new OpenAPIGenerator instance.
68
+ *
69
+ * @param config - Generator configuration with API metadata and security settings
70
+ */
71
+ constructor(config: OpenAPIGeneratorConfig);
72
+ /**
73
+ * Add a controller class — instantiates it with mock settings/services
74
+ * and collects routes that have OpenAPI metadata.
75
+ *
76
+ * @param basePath - The base URL path for all controller routes (e.g., '/api/products')
77
+ * @param ControllerClass - The controller class constructor
78
+ * @returns This generator instance for method chaining
79
+ *
80
+ * @remarks
81
+ * The controller is instantiated with empty objects as settings and services.
82
+ * This is safe because `routes()` only builds `RouteDefinition` objects —
83
+ * it does not access the database, make HTTP calls, or produce side effects.
84
+ */
85
+ addController(basePath: string, ControllerClass: ControllerConstructor): this;
86
+ /**
87
+ * Add individual route definitions directly.
88
+ * Only routes with `.openapi()` metadata are collected (opt-in filtering).
89
+ *
90
+ * @param basePath - The base URL path for these routes
91
+ * @param routeDefinitions - Array of route definitions to add
92
+ * @returns This generator instance for method chaining
93
+ */
94
+ addRoutes(basePath: string, routeDefinitions: RouteDefinition[]): this;
95
+ /**
96
+ * Generate the complete OpenAPI v3.1 document from collected routes.
97
+ *
98
+ * @returns The assembled OpenAPI document object
99
+ */
100
+ generate(): OpenAPIDocument;
101
+ /**
102
+ * Generate and return the specification as a formatted JSON string.
103
+ *
104
+ * @param indent - Number of spaces for JSON indentation (default: 2)
105
+ * @returns Formatted JSON string of the OpenAPI document
106
+ */
107
+ toJSON(indent?: number): string;
108
+ /**
109
+ * Generate and write the specification to a file.
110
+ * Creates parent directories if they don't exist.
111
+ *
112
+ * @param filePath - The path where the JSON file should be written
113
+ */
114
+ toFile(filePath: string): void;
115
+ /**
116
+ * Build the paths object from all collected routes.
117
+ * Groups routes by their full path (basePath + route path) and
118
+ * creates an operation for each HTTP method on that path.
119
+ *
120
+ * @returns The paths object for the OpenAPI document
121
+ */
122
+ protected buildPaths(): Record<string, OpenAPIPathItem>;
123
+ /**
124
+ * Combine a base path and route path into a full path.
125
+ * Handles trailing/leading slashes and avoids double slashes.
126
+ *
127
+ * @param basePath - The controller's base path (e.g., '/api/products')
128
+ * @param routePath - The route's relative path (e.g., '/:id')
129
+ * @returns The combined full path (e.g., '/api/products/:id')
130
+ *
131
+ * @example
132
+ * ```
133
+ * buildFullPath('/api/products', '/') → '/api/products'
134
+ * buildFullPath('/api/products', '/:id') → '/api/products/:id'
135
+ * buildFullPath('/api', '/users/:id') → '/api/users/:id'
136
+ * ```
137
+ */
138
+ protected buildFullPath(basePath: string, routePath: string): string;
139
+ /**
140
+ * Convert Express-style path parameters to OpenAPI format.
141
+ * Express uses `:param` syntax, OpenAPI uses `{param}` syntax.
142
+ *
143
+ * @param expressPath - Express-style path (e.g., '/users/:userId/posts/:postId')
144
+ * @returns OpenAPI-style path (e.g., '/users/{userId}/posts/{postId}')
145
+ */
146
+ protected convertExpressPathToOpenAPI(expressPath: string): string;
147
+ /**
148
+ * Extract path parameter names from an Express-style path.
149
+ *
150
+ * @param expressPath - Express-style path (e.g., '/users/:userId/posts/:postId')
151
+ * @returns Array of parameter names (e.g., ['userId', 'postId'])
152
+ */
153
+ protected extractPathParamNames(expressPath: string): string[];
154
+ /**
155
+ * Build an OpenAPI operation object from a route definition.
156
+ * Assembles summary, description, tags, operationId, parameters,
157
+ * requestBody, responses, security, and deprecated flag.
158
+ *
159
+ * @param definition - The route definition to convert
160
+ * @returns The assembled OpenAPI operation object
161
+ */
162
+ protected buildOperation(definition: RouteDefinition): OpenAPIOperation;
163
+ /**
164
+ * Build path parameters from the route path and metadata.
165
+ *
166
+ * @remarks
167
+ * Path parameters are extracted from Express `:param` syntax in the URL.
168
+ * If the metadata includes `pathParams` with schemas and descriptions,
169
+ * those are used to enrich the parameter definitions.
170
+ *
171
+ * For GET/DELETE routes with a validation schema, query parameters are
172
+ * also generated (handled in Session 2.2 — Zod conversion).
173
+ *
174
+ * @param definition - The route definition
175
+ * @returns Array of OpenAPI parameter objects
176
+ */
177
+ protected buildParameters(definition: RouteDefinition): OpenAPIParameter[];
178
+ /**
179
+ * Build request body from validation schema for POST/PUT/PATCH routes.
180
+ *
181
+ * @param definition - The route definition
182
+ * @returns OpenAPI request body object, or undefined for GET/DELETE routes
183
+ */
184
+ protected buildRequestBody(definition: RouteDefinition): {
185
+ description?: string;
186
+ required?: boolean;
187
+ content: Record<string, {
188
+ schema?: any;
189
+ }>;
190
+ } | undefined;
191
+ /**
192
+ * Build response objects from OpenAPI metadata.
193
+ *
194
+ * @param definition - The route definition
195
+ * @returns Record of status code → response object
196
+ */
197
+ protected buildResponses(definition: RouteDefinition): Record<string, OpenAPIResponse>;
198
+ /**
199
+ * Build security requirements for the operation.
200
+ * Routes with `secure: true` get the configured `defaultSecurity` applied.
201
+ * Routes without `secure` or with `secure: false` have no security.
202
+ *
203
+ * @param definition - The route definition
204
+ * @returns Array of security requirements, or undefined for public routes
205
+ */
206
+ protected buildSecurity(definition: RouteDefinition): SecurityRequirement[] | undefined;
207
+ /**
208
+ * Check if the HTTP method typically uses query parameters instead of request body.
209
+ * GET and DELETE routes use query parameters; POST, PUT, PATCH use request body.
210
+ *
211
+ * @param method - The HTTP method
212
+ * @returns True for GET and DELETE, false otherwise
213
+ */
214
+ protected isQueryParamMethod(method: HttpMethod): boolean;
215
+ /**
216
+ * Convert a Zod schema to an OpenAPI JSON Schema object.
217
+ *
218
+ * Delegates to the `zodToOpenAPISchema` function from the zod-to-openapi module,
219
+ * which introspects Zod v4's internal `_zod.def` structure to produce a complete
220
+ * OpenAPI-compatible JSON Schema.
221
+ *
222
+ * @param zodSchema - The Zod schema to convert (any Zod type)
223
+ * @returns An OpenAPI schema object with type, constraints, and nested definitions
224
+ */
225
+ protected convertZodToSchema(zodSchema: unknown): OpenAPISchema;
226
+ /**
227
+ * Convert a Zod object schema to an array of OpenAPI query parameters.
228
+ * Each top-level property of the Zod object becomes a separate query parameter.
229
+ *
230
+ * Delegates to the `zodToQueryParameters` function from the zod-to-openapi module.
231
+ * Optional properties become non-required parameters. Default values are preserved.
232
+ *
233
+ * @param zodSchema - The Zod schema (expected to be z.object())
234
+ * @returns Array of OpenAPI parameter objects with `in: 'query'`
235
+ */
236
+ protected convertZodToQueryParameters(zodSchema: unknown): OpenAPIParameter[];
237
+ }
238
+ export {};
239
+ //# sourceMappingURL=openapi-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi-generator.d.ts","sourceRoot":"","sources":["../../src/generator/openapi-generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAAG,KAAK,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,KAAK;IACxE,MAAM,IAAI,eAAe,EAAE,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,UAAU,cAAc;IACtB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBAAa,gBAAgB;IAC3B,4DAA4D;IAC5D,SAAS,CAAC,MAAM,EAAE,sBAAsB,CAAC;IAEzC,8EAA8E;IAC9E,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IAEnC;;;;OAIG;gBACS,MAAM,EAAE,sBAAsB;IAK1C;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,qBAAqB,GAAG,IAAI;IAQ7E;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,eAAe,EAAE,GAAG,IAAI;IAUtE;;;;OAIG;IACH,QAAQ,IAAI,eAAe;IA6B3B;;;;;OAKG;IACH,MAAM,CAAC,MAAM,GAAE,MAAU,GAAG,MAAM;IAKlC;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAe9B;;;;;;OAMG;IACH,SAAS,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAuBvD;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IAcpE;;;;;;OAMG;IACH,SAAS,CAAC,2BAA2B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAIlE;;;;;OAKG;IACH,SAAS,CAAC,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE;IAU9D;;;;;;;OAOG;IACH,SAAS,CAAC,cAAc,CAAC,UAAU,EAAE,eAAe,GAAG,gBAAgB;IAgDvE;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,eAAe,CAAC,UAAU,EAAE,eAAe,GAAG,gBAAgB,EAAE;IA2C1E;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,CACxB,UAAU,EAAE,eAAe,GAC1B;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,MAAM,CAAC,EAAE,GAAG,CAAA;SAAE,CAAC,CAAA;KAAE,GAAG,SAAS;IAwBtG;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CAAC,UAAU,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IA8BtF;;;;;;;OAOG;IACH,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,eAAe,GAAG,mBAAmB,EAAE,GAAG,SAAS;IAevF;;;;;;OAMG;IACH,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;IAMzD;;;;;;;;;OASG;IACH,SAAS,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,GAAG,aAAa;IAI/D;;;;;;;;;OASG;IACH,SAAS,CAAC,2BAA2B,CAAC,SAAS,EAAE,OAAO,GAAG,gBAAgB,EAAE;CAG9E"}
@@ -0,0 +1,434 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { zodToOpenAPISchema, zodToQueryParameters } from './zod-to-openapi.js';
4
+ /**
5
+ * Generates OpenAPI v3.1 specification documents from webafx controller routes.
6
+ *
7
+ * This generator reads route definitions (with their Zod validation schemas
8
+ * and OpenAPI metadata) and produces a complete OpenAPI 3.1.0 document.
9
+ * Only routes that have been annotated with `.openapi()` metadata are included
10
+ * in the generated specification — this is the opt-in mechanism.
11
+ *
12
+ * @remarks
13
+ * - This class does NOT extend the existing codegen `Generator` base class
14
+ * because it operates on webafx routes, not on database schemas.
15
+ * - Controllers are instantiated with empty mock settings/services since
16
+ * `routes()` only builds RouteDefinition objects (no side effects).
17
+ * - Zod→OpenAPI schema conversion is handled by dedicated protected methods
18
+ * that can be overridden or extended.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * import { OpenAPIGenerator } from '../index.js';
23
+ * import { ProductsController } from './controllers/products.controller.js';
24
+ *
25
+ * const generator = new OpenAPIGenerator({
26
+ * title: 'My API',
27
+ * version: '1.0.0',
28
+ * servers: [{ url: 'http://localhost:3000' }],
29
+ * securitySchemes: {
30
+ * bearerAuth: { type: 'http', scheme: 'bearer', bearerFormat: 'JWT' }
31
+ * },
32
+ * defaultSecurity: [{ bearerAuth: [] }]
33
+ * });
34
+ *
35
+ * generator.addController('/api/products', ProductsController);
36
+ *
37
+ * const spec = generator.generate();
38
+ * generator.toFile('./openapi.json');
39
+ * ```
40
+ */
41
+ export class OpenAPIGenerator {
42
+ /** Generator configuration (API info, servers, security) */
43
+ config;
44
+ /** Collected routes from controllers (only those with .openapi() metadata) */
45
+ routes;
46
+ /**
47
+ * Creates a new OpenAPIGenerator instance.
48
+ *
49
+ * @param config - Generator configuration with API metadata and security settings
50
+ */
51
+ constructor(config) {
52
+ this.config = config;
53
+ this.routes = [];
54
+ }
55
+ /**
56
+ * Add a controller class — instantiates it with mock settings/services
57
+ * and collects routes that have OpenAPI metadata.
58
+ *
59
+ * @param basePath - The base URL path for all controller routes (e.g., '/api/products')
60
+ * @param ControllerClass - The controller class constructor
61
+ * @returns This generator instance for method chaining
62
+ *
63
+ * @remarks
64
+ * The controller is instantiated with empty objects as settings and services.
65
+ * This is safe because `routes()` only builds `RouteDefinition` objects —
66
+ * it does not access the database, make HTTP calls, or produce side effects.
67
+ */
68
+ addController(basePath, ControllerClass) {
69
+ // Instantiate controller with minimal mock dependencies.
70
+ // routes() only builds RouteDefinition objects — no side effects.
71
+ const controller = new ControllerClass({}, {});
72
+ const routeDefinitions = controller.routes();
73
+ return this.addRoutes(basePath, routeDefinitions);
74
+ }
75
+ /**
76
+ * Add individual route definitions directly.
77
+ * Only routes with `.openapi()` metadata are collected (opt-in filtering).
78
+ *
79
+ * @param basePath - The base URL path for these routes
80
+ * @param routeDefinitions - Array of route definitions to add
81
+ * @returns This generator instance for method chaining
82
+ */
83
+ addRoutes(basePath, routeDefinitions) {
84
+ for (const definition of routeDefinitions) {
85
+ // Only include routes with OpenAPI metadata (opt-in mechanism)
86
+ if (definition.openapi) {
87
+ this.routes.push({ basePath, definition });
88
+ }
89
+ }
90
+ return this;
91
+ }
92
+ /**
93
+ * Generate the complete OpenAPI v3.1 document from collected routes.
94
+ *
95
+ * @returns The assembled OpenAPI document object
96
+ */
97
+ generate() {
98
+ const document = {
99
+ openapi: '3.1.0',
100
+ info: {
101
+ title: this.config.title,
102
+ version: this.config.version,
103
+ ...(this.config.description ? { description: this.config.description } : {}),
104
+ },
105
+ paths: {},
106
+ };
107
+ // Add servers if configured
108
+ if (this.config.servers && this.config.servers.length > 0) {
109
+ document.servers = this.config.servers;
110
+ }
111
+ // Build paths from collected routes
112
+ document.paths = this.buildPaths();
113
+ // Add components section if security schemes are configured
114
+ if (this.config.securitySchemes && Object.keys(this.config.securitySchemes).length > 0) {
115
+ document.components = {
116
+ securitySchemes: this.config.securitySchemes,
117
+ };
118
+ }
119
+ return document;
120
+ }
121
+ /**
122
+ * Generate and return the specification as a formatted JSON string.
123
+ *
124
+ * @param indent - Number of spaces for JSON indentation (default: 2)
125
+ * @returns Formatted JSON string of the OpenAPI document
126
+ */
127
+ toJSON(indent = 2) {
128
+ const document = this.generate();
129
+ return JSON.stringify(document, null, indent);
130
+ }
131
+ /**
132
+ * Generate and write the specification to a file.
133
+ * Creates parent directories if they don't exist.
134
+ *
135
+ * @param filePath - The path where the JSON file should be written
136
+ */
137
+ toFile(filePath) {
138
+ const resolvedPath = path.resolve(filePath);
139
+ const dir = path.dirname(resolvedPath);
140
+ // Ensure the output directory exists
141
+ if (!fs.existsSync(dir)) {
142
+ fs.mkdirSync(dir, { recursive: true });
143
+ }
144
+ const json = this.toJSON();
145
+ fs.writeFileSync(resolvedPath, json, 'utf-8');
146
+ }
147
+ // ─── Protected Methods ──────────────────────────────────────────────────
148
+ /**
149
+ * Build the paths object from all collected routes.
150
+ * Groups routes by their full path (basePath + route path) and
151
+ * creates an operation for each HTTP method on that path.
152
+ *
153
+ * @returns The paths object for the OpenAPI document
154
+ */
155
+ buildPaths() {
156
+ const paths = {};
157
+ for (const { basePath, definition } of this.routes) {
158
+ const fullPath = this.buildFullPath(basePath, definition.path);
159
+ const openApiPath = this.convertExpressPathToOpenAPI(fullPath);
160
+ // Initialize path item if it doesn't exist yet
161
+ if (!paths[openApiPath]) {
162
+ paths[openApiPath] = {};
163
+ }
164
+ // Build the operation for this route's HTTP method
165
+ const operation = this.buildOperation(definition);
166
+ // Assign the operation to the correct HTTP method
167
+ const method = definition.method;
168
+ paths[openApiPath][method] = operation;
169
+ }
170
+ return paths;
171
+ }
172
+ /**
173
+ * Combine a base path and route path into a full path.
174
+ * Handles trailing/leading slashes and avoids double slashes.
175
+ *
176
+ * @param basePath - The controller's base path (e.g., '/api/products')
177
+ * @param routePath - The route's relative path (e.g., '/:id')
178
+ * @returns The combined full path (e.g., '/api/products/:id')
179
+ *
180
+ * @example
181
+ * ```
182
+ * buildFullPath('/api/products', '/') → '/api/products'
183
+ * buildFullPath('/api/products', '/:id') → '/api/products/:id'
184
+ * buildFullPath('/api', '/users/:id') → '/api/users/:id'
185
+ * ```
186
+ */
187
+ buildFullPath(basePath, routePath) {
188
+ // Remove trailing slash from basePath
189
+ const normalizedBase = basePath.replace(/\/+$/, '');
190
+ // Ensure routePath starts with /
191
+ const normalizedRoute = routePath.startsWith('/') ? routePath : `/${routePath}`;
192
+ // If route is just '/', return basePath alone
193
+ if (normalizedRoute === '/') {
194
+ return normalizedBase || '/';
195
+ }
196
+ return `${normalizedBase}${normalizedRoute}`;
197
+ }
198
+ /**
199
+ * Convert Express-style path parameters to OpenAPI format.
200
+ * Express uses `:param` syntax, OpenAPI uses `{param}` syntax.
201
+ *
202
+ * @param expressPath - Express-style path (e.g., '/users/:userId/posts/:postId')
203
+ * @returns OpenAPI-style path (e.g., '/users/{userId}/posts/{postId}')
204
+ */
205
+ convertExpressPathToOpenAPI(expressPath) {
206
+ return expressPath.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g, '{$1}');
207
+ }
208
+ /**
209
+ * Extract path parameter names from an Express-style path.
210
+ *
211
+ * @param expressPath - Express-style path (e.g., '/users/:userId/posts/:postId')
212
+ * @returns Array of parameter names (e.g., ['userId', 'postId'])
213
+ */
214
+ extractPathParamNames(expressPath) {
215
+ const paramRegex = /:([a-zA-Z_][a-zA-Z0-9_]*)/g;
216
+ const params = [];
217
+ let match;
218
+ while ((match = paramRegex.exec(expressPath)) !== null) {
219
+ params.push(match[1]);
220
+ }
221
+ return params;
222
+ }
223
+ /**
224
+ * Build an OpenAPI operation object from a route definition.
225
+ * Assembles summary, description, tags, operationId, parameters,
226
+ * requestBody, responses, security, and deprecated flag.
227
+ *
228
+ * @param definition - The route definition to convert
229
+ * @returns The assembled OpenAPI operation object
230
+ */
231
+ buildOperation(definition) {
232
+ const metadata = definition.openapi;
233
+ const operation = {};
234
+ // Basic metadata from .openapi()
235
+ if (metadata.summary) {
236
+ operation.summary = metadata.summary;
237
+ }
238
+ if (metadata.description) {
239
+ operation.description = metadata.description;
240
+ }
241
+ if (metadata.tags && metadata.tags.length > 0) {
242
+ operation.tags = metadata.tags;
243
+ }
244
+ if (metadata.operationId) {
245
+ operation.operationId = metadata.operationId;
246
+ }
247
+ if (metadata.deprecated) {
248
+ operation.deprecated = true;
249
+ }
250
+ // Build parameters (path params + query params for GET/DELETE)
251
+ const parameters = this.buildParameters(definition);
252
+ if (parameters.length > 0) {
253
+ operation.parameters = parameters;
254
+ }
255
+ // Build request body (for POST/PUT/PATCH with validation schema)
256
+ const requestBody = this.buildRequestBody(definition);
257
+ if (requestBody) {
258
+ operation.requestBody = requestBody;
259
+ }
260
+ // Build responses from metadata
261
+ const responses = this.buildResponses(definition);
262
+ if (Object.keys(responses).length > 0) {
263
+ operation.responses = responses;
264
+ }
265
+ // Apply security requirements for secure routes
266
+ const security = this.buildSecurity(definition);
267
+ if (security) {
268
+ operation.security = security;
269
+ }
270
+ return operation;
271
+ }
272
+ /**
273
+ * Build path parameters from the route path and metadata.
274
+ *
275
+ * @remarks
276
+ * Path parameters are extracted from Express `:param` syntax in the URL.
277
+ * If the metadata includes `pathParams` with schemas and descriptions,
278
+ * those are used to enrich the parameter definitions.
279
+ *
280
+ * For GET/DELETE routes with a validation schema, query parameters are
281
+ * also generated (handled in Session 2.2 — Zod conversion).
282
+ *
283
+ * @param definition - The route definition
284
+ * @returns Array of OpenAPI parameter objects
285
+ */
286
+ buildParameters(definition) {
287
+ const parameters = [];
288
+ const fullPath = this.buildFullPath(this.routes.find(r => r.definition === definition)?.basePath || '', definition.path);
289
+ const pathParamNames = this.extractPathParamNames(fullPath);
290
+ const metadata = definition.openapi;
291
+ // Add path parameters
292
+ for (const paramName of pathParamNames) {
293
+ const paramMeta = metadata.pathParams?.[paramName];
294
+ const param = {
295
+ name: paramName,
296
+ in: 'path',
297
+ required: true, // Path parameters are always required per OpenAPI spec
298
+ };
299
+ if (paramMeta?.description) {
300
+ param.description = paramMeta.description;
301
+ }
302
+ // Schema conversion from Zod pathParams will be added in Session 2.2
303
+ // For now, default to string type
304
+ if (paramMeta?.schema) {
305
+ param.schema = this.convertZodToSchema(paramMeta.schema);
306
+ }
307
+ else {
308
+ param.schema = { type: 'string' };
309
+ }
310
+ parameters.push(param);
311
+ }
312
+ // Query parameters for GET/DELETE routes with validation schemas
313
+ // (Zod→OpenAPI conversion will be implemented in Session 2.2)
314
+ if (this.isQueryParamMethod(definition.method) && definition.validation) {
315
+ const queryParams = this.convertZodToQueryParameters(definition.validation);
316
+ parameters.push(...queryParams);
317
+ }
318
+ return parameters;
319
+ }
320
+ /**
321
+ * Build request body from validation schema for POST/PUT/PATCH routes.
322
+ *
323
+ * @param definition - The route definition
324
+ * @returns OpenAPI request body object, or undefined for GET/DELETE routes
325
+ */
326
+ buildRequestBody(definition) {
327
+ // Only POST, PUT, PATCH have request bodies
328
+ if (this.isQueryParamMethod(definition.method)) {
329
+ return undefined;
330
+ }
331
+ // Need a validation schema to generate request body
332
+ if (!definition.validation) {
333
+ return undefined;
334
+ }
335
+ // Zod→OpenAPI schema conversion (Session 2.2 will implement convertZodToSchema)
336
+ const schema = this.convertZodToSchema(definition.validation);
337
+ return {
338
+ required: true,
339
+ content: {
340
+ 'application/json': {
341
+ schema,
342
+ },
343
+ },
344
+ };
345
+ }
346
+ /**
347
+ * Build response objects from OpenAPI metadata.
348
+ *
349
+ * @param definition - The route definition
350
+ * @returns Record of status code → response object
351
+ */
352
+ buildResponses(definition) {
353
+ const responses = {};
354
+ const metadata = definition.openapi;
355
+ if (!metadata.responses || metadata.responses.length === 0) {
356
+ return responses;
357
+ }
358
+ for (const responseDef of metadata.responses) {
359
+ const statusCode = String(responseDef.statusCode);
360
+ const response = {
361
+ description: responseDef.description,
362
+ };
363
+ // If a response schema is provided, convert it
364
+ // (Zod→OpenAPI conversion will be fully implemented in Session 2.2)
365
+ if (responseDef.schema) {
366
+ response.content = {
367
+ 'application/json': {
368
+ schema: this.convertZodToSchema(responseDef.schema),
369
+ },
370
+ };
371
+ }
372
+ responses[statusCode] = response;
373
+ }
374
+ return responses;
375
+ }
376
+ /**
377
+ * Build security requirements for the operation.
378
+ * Routes with `secure: true` get the configured `defaultSecurity` applied.
379
+ * Routes without `secure` or with `secure: false` have no security.
380
+ *
381
+ * @param definition - The route definition
382
+ * @returns Array of security requirements, or undefined for public routes
383
+ */
384
+ buildSecurity(definition) {
385
+ if (!definition.secure) {
386
+ return undefined;
387
+ }
388
+ // Apply default security from config when route is secure
389
+ if (this.config.defaultSecurity && this.config.defaultSecurity.length > 0) {
390
+ return this.config.defaultSecurity;
391
+ }
392
+ // Secure route but no default security configured — return empty array
393
+ // (indicates security is required but no specific scheme defined)
394
+ return [];
395
+ }
396
+ /**
397
+ * Check if the HTTP method typically uses query parameters instead of request body.
398
+ * GET and DELETE routes use query parameters; POST, PUT, PATCH use request body.
399
+ *
400
+ * @param method - The HTTP method
401
+ * @returns True for GET and DELETE, false otherwise
402
+ */
403
+ isQueryParamMethod(method) {
404
+ return method === 'get' || method === 'delete';
405
+ }
406
+ // ─── Zod → OpenAPI Conversion ───────────────────────────────────────────
407
+ /**
408
+ * Convert a Zod schema to an OpenAPI JSON Schema object.
409
+ *
410
+ * Delegates to the `zodToOpenAPISchema` function from the zod-to-openapi module,
411
+ * which introspects Zod v4's internal `_zod.def` structure to produce a complete
412
+ * OpenAPI-compatible JSON Schema.
413
+ *
414
+ * @param zodSchema - The Zod schema to convert (any Zod type)
415
+ * @returns An OpenAPI schema object with type, constraints, and nested definitions
416
+ */
417
+ convertZodToSchema(zodSchema) {
418
+ return zodToOpenAPISchema(zodSchema);
419
+ }
420
+ /**
421
+ * Convert a Zod object schema to an array of OpenAPI query parameters.
422
+ * Each top-level property of the Zod object becomes a separate query parameter.
423
+ *
424
+ * Delegates to the `zodToQueryParameters` function from the zod-to-openapi module.
425
+ * Optional properties become non-required parameters. Default values are preserved.
426
+ *
427
+ * @param zodSchema - The Zod schema (expected to be z.object())
428
+ * @returns Array of OpenAPI parameter objects with `in: 'query'`
429
+ */
430
+ convertZodToQueryParameters(zodSchema) {
431
+ return zodToQueryParameters(zodSchema);
432
+ }
433
+ }
434
+ //# sourceMappingURL=openapi-generator.js.map