arkos 1.2.15-test.1 → 1.2.16-test

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 (239) hide show
  1. package/README.md +22 -14
  2. package/cli.js +2 -11
  3. package/dist/cjs/app.js +1 -1
  4. package/dist/cjs/app.js.map +1 -1
  5. package/dist/cjs/modules/base/base.controller.js +11 -12
  6. package/dist/cjs/modules/base/base.controller.js.map +1 -1
  7. package/dist/cjs/modules/base/base.router.js.map +1 -1
  8. package/dist/cjs/modules/base/utils/helpers/base.router.helpers.js +41 -27
  9. package/dist/cjs/modules/base/utils/helpers/base.router.helpers.js.map +1 -1
  10. package/dist/cjs/modules/error-handler/error-handler.controller.js.map +1 -1
  11. package/dist/cjs/modules/swagger/swagger.router.js +14 -56
  12. package/dist/cjs/modules/swagger/swagger.router.js.map +1 -1
  13. package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +250 -0
  14. package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -0
  15. package/dist/cjs/modules/swagger/utils/helpers/get-system-json-schema-paths.js +66 -0
  16. package/dist/cjs/modules/swagger/utils/helpers/get-system-json-schema-paths.js.map +1 -0
  17. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js +41 -0
  18. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js.map +1 -0
  19. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js +22 -0
  20. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js.map +1 -0
  21. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schema.js +30 -0
  22. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schema.js.map +1 -0
  23. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes.js +442 -0
  24. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes.js.map +1 -0
  25. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes.js +165 -0
  26. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes.js.map +1 -0
  27. package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js +93 -0
  28. package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -0
  29. package/dist/cjs/paths.js +1 -1
  30. package/dist/cjs/server.js +2 -2
  31. package/dist/cjs/server.js.map +1 -1
  32. package/dist/cjs/types/arkos-config.js.map +1 -1
  33. package/dist/cjs/utils/cli/build.js +2 -19
  34. package/dist/cjs/utils/cli/build.js.map +1 -1
  35. package/dist/cjs/utils/cli/dev.js +3 -1
  36. package/dist/cjs/utils/cli/dev.js.map +1 -1
  37. package/dist/cjs/utils/cli/generate.js +6 -6
  38. package/dist/cjs/utils/cli/generate.js.map +1 -1
  39. package/dist/cjs/utils/cli/utils/cli.helpers.js +10 -1
  40. package/dist/cjs/utils/cli/utils/cli.helpers.js.map +1 -1
  41. package/dist/cjs/utils/helpers/fs.helpers.js +12 -5
  42. package/dist/cjs/utils/helpers/fs.helpers.js.map +1 -1
  43. package/dist/cjs/utils/helpers/global.helpers.js +38 -2
  44. package/dist/cjs/utils/helpers/global.helpers.js.map +1 -1
  45. package/dist/cjs/utils/helpers/models.helpers.js +20 -43
  46. package/dist/cjs/utils/helpers/models.helpers.js.map +1 -1
  47. package/dist/cjs/utils/sheu.js +143 -0
  48. package/dist/cjs/utils/sheu.js.map +1 -0
  49. package/dist/esm/app.js +1 -0
  50. package/dist/esm/app.js.map +1 -0
  51. package/dist/{es2020 → esm}/exports/auth/index.js +1 -1
  52. package/dist/{es2020 → esm}/exports/controllers/index.js +2 -2
  53. package/dist/{es2020 → esm}/exports/error-handler/index.js +2 -2
  54. package/dist/{es2020 → esm}/exports/index.js +2 -2
  55. package/dist/{es2020 → esm}/exports/middlewares/index.js +1 -1
  56. package/dist/esm/exports/prisma/index.js +3 -0
  57. package/dist/{es2020 → esm}/exports/services/index.js +4 -4
  58. package/dist/esm/exports/utils/index.js +4 -0
  59. package/dist/esm/exports/validation/index.js +4 -0
  60. package/dist/{es2020 → esm}/modules/auth/auth.controller.js +7 -7
  61. package/dist/{es2020 → esm}/modules/auth/auth.router.js +6 -6
  62. package/dist/{es2020 → esm}/modules/auth/auth.service.js +6 -6
  63. package/dist/{es2020 → esm}/modules/auth/utils/helpers/auth.controller.helpers.js +2 -2
  64. package/dist/{es2020 → esm}/modules/base/base.controller.js +18 -19
  65. package/dist/esm/modules/base/base.controller.js.map +1 -0
  66. package/dist/{es2020 → esm}/modules/base/base.middlewares.js +6 -6
  67. package/dist/{es2020 → esm}/modules/base/base.router.js +4 -4
  68. package/dist/esm/modules/base/base.router.js.map +1 -0
  69. package/dist/{es2020 → esm}/modules/base/base.service.js +6 -6
  70. package/dist/{es2020 → esm}/modules/base/utils/helpers/base.controller.helpers.js +1 -1
  71. package/dist/{es2020 → esm}/modules/base/utils/helpers/base.middlewares.helpers.js +1 -1
  72. package/dist/{es2020 → esm}/modules/base/utils/helpers/base.router.helpers.js +45 -33
  73. package/dist/esm/modules/base/utils/helpers/base.router.helpers.js.map +1 -0
  74. package/dist/{es2020 → esm}/modules/base/utils/helpers/base.service.helpers.js +1 -1
  75. package/dist/{es2020 → esm}/modules/email/email.service.js +2 -2
  76. package/dist/{es2020 → esm}/modules/error-handler/error-handler.controller.js +3 -3
  77. package/dist/{es2020 → esm}/modules/error-handler/error-handler.controller.js.map +1 -1
  78. package/dist/{es2020 → esm}/modules/error-handler/utils/error-handler.helpers.js +1 -1
  79. package/dist/{es2020 → esm}/modules/file-upload/file-upload.controller.js +7 -7
  80. package/dist/{es2020 → esm}/modules/file-upload/file-upload.router.js +5 -5
  81. package/dist/{es2020 → esm}/modules/file-upload/file-upload.service.js +5 -5
  82. package/dist/{es2020 → esm}/modules/file-upload/utils/helpers/file-upload.helpers.js +2 -2
  83. package/dist/{es2020 → esm}/modules/swagger/swagger.router.js +15 -57
  84. package/dist/esm/modules/swagger/swagger.router.js.map +1 -0
  85. package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +247 -0
  86. package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -0
  87. package/dist/esm/modules/swagger/utils/helpers/get-system-json-schema-paths.js +63 -0
  88. package/dist/esm/modules/swagger/utils/helpers/get-system-json-schema-paths.js.map +1 -0
  89. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js +38 -0
  90. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js.map +1 -0
  91. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js +19 -0
  92. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js.map +1 -0
  93. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schema.js +24 -0
  94. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schema.js.map +1 -0
  95. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes.js +436 -0
  96. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes.js.map +1 -0
  97. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes.js +159 -0
  98. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes.js.map +1 -0
  99. package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js +83 -0
  100. package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -0
  101. package/dist/esm/server.js +3 -0
  102. package/dist/esm/server.js.map +1 -0
  103. package/dist/esm/types/arkos-config.js.map +1 -0
  104. package/dist/{es2020 → esm}/utils/cli/build.js +4 -21
  105. package/dist/esm/utils/cli/build.js.map +1 -0
  106. package/dist/{es2020 → esm}/utils/cli/dev.js +7 -5
  107. package/dist/esm/utils/cli/dev.js.map +1 -0
  108. package/dist/{es2020 → esm}/utils/cli/generate.js +10 -10
  109. package/dist/{es2020 → esm}/utils/cli/generate.js.map +1 -1
  110. package/dist/{es2020 → esm}/utils/cli/index.js +5 -5
  111. package/dist/{es2020 → esm}/utils/cli/start.js +4 -4
  112. package/dist/esm/utils/cli/utils/cli.helpers.js +27 -0
  113. package/dist/esm/utils/cli/utils/cli.helpers.js.map +1 -0
  114. package/dist/{es2020 → esm}/utils/cli/utils/template-generator/templates/generate-auth-configs-template.js +1 -1
  115. package/dist/{es2020 → esm}/utils/cli/utils/template-generator/templates/generate-middlewares.js +1 -1
  116. package/dist/{es2020 → esm}/utils/cli/utils/template-generator/templates/generate-prisma-query-options.js +2 -2
  117. package/dist/{es2020 → esm}/utils/cli/utils/template-generator/templates/generate-router-template.js +1 -1
  118. package/dist/{es2020 → esm}/utils/cli/utils/template-generator/templates/generate-service-template.js +2 -2
  119. package/dist/{es2020 → esm}/utils/cli/utils/template-generators.js +6 -6
  120. package/dist/{es2020 → esm}/utils/features/api.features.js +4 -4
  121. package/dist/{es2020 → esm}/utils/features/change-case.features.js +1 -1
  122. package/dist/{es2020 → esm}/utils/helpers/fs.helpers.js +12 -5
  123. package/dist/esm/utils/helpers/fs.helpers.js.map +1 -0
  124. package/dist/esm/utils/helpers/global.helpers.js +35 -0
  125. package/dist/esm/utils/helpers/global.helpers.js.map +1 -0
  126. package/dist/{es2020 → esm}/utils/helpers/models.helpers.js +21 -11
  127. package/dist/esm/utils/helpers/models.helpers.js.map +1 -0
  128. package/dist/{es2020 → esm}/utils/helpers/prisma.helpers.js +4 -4
  129. package/dist/esm/utils/sheu.js +141 -0
  130. package/dist/esm/utils/sheu.js.map +1 -0
  131. package/dist/{es2020 → esm}/utils/validate-dto.js +1 -1
  132. package/dist/{es2020 → esm}/utils/validate-schema.js +1 -1
  133. package/dist/types/modules/auth/auth.controller.d.ts +7 -7
  134. package/dist/types/modules/auth/auth.service.d.ts +1 -1
  135. package/dist/types/modules/base/base.controller.d.ts +9 -9
  136. package/dist/types/modules/base/utils/helpers/base.router.helpers.d.ts +4 -1
  137. package/dist/types/modules/error-handler/utils/catch-async.d.ts +1 -1
  138. package/dist/types/modules/file-upload/file-upload.controller.d.ts +4 -4
  139. package/dist/types/modules/swagger/swagger.router.d.ts +1 -1
  140. package/dist/types/modules/swagger/utils/helpers/get-authentication-json-schema-paths.d.ts +2 -0
  141. package/dist/types/modules/swagger/utils/helpers/get-system-json-schema-paths.d.ts +2 -0
  142. package/dist/types/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.d.ts +1 -0
  143. package/dist/types/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.d.ts +1 -0
  144. package/dist/types/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schema.d.ts +1 -0
  145. package/dist/types/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes.d.ts +2 -0
  146. package/dist/types/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes.d.ts +2 -0
  147. package/dist/types/modules/swagger/utils/helpers/swagger.router.helpers.d.ts +7 -0
  148. package/dist/types/types/arkos-config.d.ts +7 -4
  149. package/dist/types/utils/helpers/global.helpers.d.ts +5 -1
  150. package/dist/types/utils/helpers/models.helpers.d.ts +10 -1
  151. package/dist/types/utils/helpers/prisma.helpers.d.ts +1 -1
  152. package/dist/types/utils/sheu.d.ts +25 -0
  153. package/package.json +24 -18
  154. package/dist/es2020/app.js +0 -1
  155. package/dist/es2020/app.js.map +0 -1
  156. package/dist/es2020/exports/prisma/index.js +0 -3
  157. package/dist/es2020/exports/utils/index.js +0 -4
  158. package/dist/es2020/exports/validation/index.js +0 -4
  159. package/dist/es2020/modules/base/base.controller.js.map +0 -1
  160. package/dist/es2020/modules/base/base.router.js.map +0 -1
  161. package/dist/es2020/modules/base/utils/helpers/base.router.helpers.js.map +0 -1
  162. package/dist/es2020/modules/swagger/swagger.router.js.map +0 -1
  163. package/dist/es2020/server.js +0 -3
  164. package/dist/es2020/server.js.map +0 -1
  165. package/dist/es2020/types/arkos-config.js.map +0 -1
  166. package/dist/es2020/utils/cli/build.js.map +0 -1
  167. package/dist/es2020/utils/cli/dev.js.map +0 -1
  168. package/dist/es2020/utils/cli/utils/cli.helpers.js +0 -18
  169. package/dist/es2020/utils/cli/utils/cli.helpers.js.map +0 -1
  170. package/dist/es2020/utils/helpers/fs.helpers.js.map +0 -1
  171. package/dist/es2020/utils/helpers/global.helpers.js +0 -4
  172. package/dist/es2020/utils/helpers/global.helpers.js.map +0 -1
  173. package/dist/es2020/utils/helpers/models.helpers.js.map +0 -1
  174. /package/dist/{es2020 → esm}/exports/auth/index.js.map +0 -0
  175. /package/dist/{es2020 → esm}/exports/controllers/index.js.map +0 -0
  176. /package/dist/{es2020 → esm}/exports/error-handler/index.js.map +0 -0
  177. /package/dist/{es2020 → esm}/exports/index.js.map +0 -0
  178. /package/dist/{es2020 → esm}/exports/middlewares/index.js.map +0 -0
  179. /package/dist/{es2020 → esm}/exports/prisma/index.js.map +0 -0
  180. /package/dist/{es2020 → esm}/exports/services/index.js.map +0 -0
  181. /package/dist/{es2020 → esm}/exports/utils/index.js.map +0 -0
  182. /package/dist/{es2020 → esm}/exports/validation/index.js.map +0 -0
  183. /package/dist/{es2020 → esm}/modules/auth/auth.controller.js.map +0 -0
  184. /package/dist/{es2020 → esm}/modules/auth/auth.router.js.map +0 -0
  185. /package/dist/{es2020 → esm}/modules/auth/auth.service.js.map +0 -0
  186. /package/dist/{es2020 → esm}/modules/auth/utils/helpers/auth.controller.helpers.js.map +0 -0
  187. /package/dist/{es2020 → esm}/modules/base/base.middlewares.js.map +0 -0
  188. /package/dist/{es2020 → esm}/modules/base/base.service.js.map +0 -0
  189. /package/dist/{es2020 → esm}/modules/base/utils/helpers/base.controller.helpers.js.map +0 -0
  190. /package/dist/{es2020 → esm}/modules/base/utils/helpers/base.middlewares.helpers.js.map +0 -0
  191. /package/dist/{es2020 → esm}/modules/base/utils/helpers/base.service.helpers.js.map +0 -0
  192. /package/dist/{es2020 → esm}/modules/email/email.service.js.map +0 -0
  193. /package/dist/{es2020 → esm}/modules/error-handler/utils/app-error.js +0 -0
  194. /package/dist/{es2020 → esm}/modules/error-handler/utils/app-error.js.map +0 -0
  195. /package/dist/{es2020 → esm}/modules/error-handler/utils/catch-async.js +0 -0
  196. /package/dist/{es2020 → esm}/modules/error-handler/utils/catch-async.js.map +0 -0
  197. /package/dist/{es2020 → esm}/modules/error-handler/utils/error-handler.helpers.js.map +0 -0
  198. /package/dist/{es2020 → esm}/modules/file-upload/file-upload.controller.js.map +0 -0
  199. /package/dist/{es2020 → esm}/modules/file-upload/file-upload.router.js.map +0 -0
  200. /package/dist/{es2020 → esm}/modules/file-upload/file-upload.service.js.map +0 -0
  201. /package/dist/{es2020 → esm}/modules/file-upload/utils/helpers/file-upload.helpers.js.map +0 -0
  202. /package/dist/{es2020 → esm}/paths.js +0 -0
  203. /package/dist/{es2020 → esm}/paths.js.map +0 -0
  204. /package/dist/{es2020 → esm}/types/arkos-config.js +0 -0
  205. /package/dist/{es2020 → esm}/types/auth.js +0 -0
  206. /package/dist/{es2020 → esm}/types/auth.js.map +0 -0
  207. /package/dist/{es2020 → esm}/types/index.js +0 -0
  208. /package/dist/{es2020 → esm}/types/index.js.map +0 -0
  209. /package/dist/{es2020 → esm}/types/router-config.js +0 -0
  210. /package/dist/{es2020 → esm}/types/router-config.js.map +0 -0
  211. /package/dist/{es2020 → esm}/utils/arkos-env.js +0 -0
  212. /package/dist/{es2020 → esm}/utils/arkos-env.js.map +0 -0
  213. /package/dist/{es2020 → esm}/utils/cli/index.js.map +0 -0
  214. /package/dist/{es2020 → esm}/utils/cli/start.js.map +0 -0
  215. /package/dist/{es2020 → esm}/utils/cli/utils/template-generator/templates/generate-auth-configs-template.js.map +0 -0
  216. /package/dist/{es2020 → esm}/utils/cli/utils/template-generator/templates/generate-controller-template.js +0 -0
  217. /package/dist/{es2020 → esm}/utils/cli/utils/template-generator/templates/generate-controller-template.js.map +0 -0
  218. /package/dist/{es2020 → esm}/utils/cli/utils/template-generator/templates/generate-middlewares.js.map +0 -0
  219. /package/dist/{es2020 → esm}/utils/cli/utils/template-generator/templates/generate-prisma-query-options.js.map +0 -0
  220. /package/dist/{es2020 → esm}/utils/cli/utils/template-generator/templates/generate-router-template.js.map +0 -0
  221. /package/dist/{es2020 → esm}/utils/cli/utils/template-generator/templates/generate-service-template.js.map +0 -0
  222. /package/dist/{es2020 → esm}/utils/cli/utils/template-generators.js.map +0 -0
  223. /package/dist/{es2020 → esm}/utils/dotenv.helpers.js +0 -0
  224. /package/dist/{es2020 → esm}/utils/dotenv.helpers.js.map +0 -0
  225. /package/dist/{es2020 → esm}/utils/features/api.features.js.map +0 -0
  226. /package/dist/{es2020 → esm}/utils/features/change-case.features.js.map +0 -0
  227. /package/dist/{es2020 → esm}/utils/helpers/api.features.helpers.js +0 -0
  228. /package/dist/{es2020 → esm}/utils/helpers/api.features.helpers.js.map +0 -0
  229. /package/dist/{es2020 → esm}/utils/helpers/change-case.helpers.js +0 -0
  230. /package/dist/{es2020 → esm}/utils/helpers/change-case.helpers.js.map +0 -0
  231. /package/dist/{es2020 → esm}/utils/helpers/deepmerge.helper.js +0 -0
  232. /package/dist/{es2020 → esm}/utils/helpers/deepmerge.helper.js.map +0 -0
  233. /package/dist/{es2020 → esm}/utils/helpers/prisma.helpers.js.map +0 -0
  234. /package/dist/{es2020 → esm}/utils/helpers/query-parser.helpers.js +0 -0
  235. /package/dist/{es2020 → esm}/utils/helpers/query-parser.helpers.js.map +0 -0
  236. /package/dist/{es2020 → esm}/utils/helpers/text.helpers.js +0 -0
  237. /package/dist/{es2020 → esm}/utils/helpers/text.helpers.js.map +0 -0
  238. /package/dist/{es2020 → esm}/utils/validate-dto.js.map +0 -0
  239. /package/dist/{es2020 → esm}/utils/validate-schema.js.map +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-prisma-model-main-routes.js","sourceRoot":"","sources":["../../../../../../../../src/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes.ts"],"names":[],"mappings":";;;;;AAKA,gFAicC;AArcD,yEAA4D;AAC5D,0DAAkC;AAClC,+FAA2F;AAEpF,KAAK,UAAU,kCAAkC,CACtD,KAA4B,EAC5B,SAAiB,EACjB,eAAuB,EACvB,iBAAyB,EACzB,uBAA+B,EAC/B,YAAiB,EACjB,IAAY;IAGZ,IAAI,CAAC,IAAA,wCAAkB,EAAC,YAAY,EAAE,WAAW,CAAC,EAAE,CAAC;QACnD,IAAI,CAAC,KAAK,CAAC,QAAQ,SAAS,EAAE,CAAC;YAAE,KAAK,CAAC,QAAQ,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC;QACjE,KAAK,CAAC,QAAQ,SAAS,EAAE,CAAE,CAAC,IAAI,GAAG;YACjC,IAAI,EAAE,CAAC,uBAAuB,CAAC;YAC/B,OAAO,EAAE,gBAAgB,iBAAiB,EAAE;YAC5C,WAAW,EAAE,iBAAiB,iBAAiB,uBAAuB;YACtE,WAAW,EAAE,SAAS,eAAe,EAAE;YACvC,WAAW,EAAE;gBACX,WAAW,EAAE,GAAG,iBAAiB,iBAAiB;gBAClD,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE;oBACP,kBAAkB,EAAE;wBAClB,MAAM,EAAE;4BACN,IAAI,EAAE,IAAA,qCAAY,EAAC,SAAS,eAAe,EAAE,EAAE,IAAI,CAAC;yBACrD;qBACF;iBACF;aACF;YACD,SAAS,EAAE;gBACT,KAAK,EAAE;oBACL,WAAW,EAAE,GAAG,iBAAiB,uBAAuB;oBACxD,OAAO,EAAE;wBACP,kBAAkB,EAAE;4BAClB,MAAM,EAAE;gCACN,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YAC/B,OAAO,EAAE,UAAU,iBAAiB,QAAQ;YAC5C,WAAW,EAAE,gCAAgC,iBAAiB,kCAAkC;YAChG,WAAW,EAAE,SAAS,eAAe,EAAE;YACvC,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,IAAI;oBACV,EAAE,EAAE,MAAM;oBACV,WAAW,EAAE,4BAA4B,iBAAiB,EAAE;oBAC5D,QAAQ,EAAE,IAAI;oBACd,MAAM,EAAE;wBACN,IAAI,EAAE,QAAQ;qBACf;iBACF;aACF;YACD,SAAS,EAAE;gBACT,KAAK,EAAE;oBACL,WAAW,EAAE,GAAG,iBAAiB,uBAAuB;iBACzD;gBACD,KAAK,EAAE;oBACL,WAAW,EAAE,yBAAyB;iBACvC;gBACD,KAAK,EAAE;oBACL,WAAW,EAAE,0BAA0B;iBACxC;gBACD,KAAK,EAAE;oBACL,WAAW,EAAE,GAAG,iBAAiB,YAAY;iBAC9C;aACF;YACD,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;SAC/B,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { OpenAPIV3 } from \"openapi-types\";\nimport { getSchemaRef } from \"../../swagger.router.helpers\";\nimport pluralize from \"pluralize\";\nimport { isEndpointDisabled } from \"../../../../../base/utils/helpers/base.router.helpers\";\n\nexport async function generatePrismaModelMainRoutesPaths(\n paths: OpenAPIV3.PathsObject,\n routeName: string,\n pascalModelName: string,\n humanReadableName: string,\n humanReadableNamePlural: string,\n routerConfig: any,\n mode: string\n) {\n // Create One\n if (!isEndpointDisabled(routerConfig, \"createOne\")) {\n if (!paths[`/api/${routeName}`]) paths[`/api/${routeName}`] = {};\n paths[`/api/${routeName}`]!.post = {\n tags: [humanReadableNamePlural],\n summary: `Create a new ${humanReadableName}`,\n description: `Creates a new ${humanReadableName} record in the system`,\n operationId: `create${pascalModelName}`,\n requestBody: {\n description: `${humanReadableName} data to create`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`Create${pascalModelName}`, mode),\n },\n },\n },\n },\n responses: {\n \"201\": {\n description: `${humanReadableName} created successfully`,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`${pascalModelName}`, mode),\n },\n },\n },\n },\n \"400\": {\n description: \"Invalid input data provided\",\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n\n // Find Many\n if (!isEndpointDisabled(routerConfig, \"findMany\")) {\n if (!paths[`/api/${routeName}`]) paths[`/api/${routeName}`] = {};\n paths[`/api/${routeName}`]!.get = {\n tags: [humanReadableNamePlural],\n summary: `Get ${humanReadableNamePlural}`,\n description: `Retrieves a paginated list of ${humanReadableNamePlural} with optional filtering and sorting`,\n operationId: `get${pluralize.plural(pascalModelName)}`,\n parameters: [\n {\n name: \"filter\",\n in: \"query\",\n description: \"Filter criteria in JSON format\",\n schema: {\n type: \"string\",\n },\n },\n {\n name: \"sort\",\n in: \"query\",\n description: \"Sort field (prefix with '-' for descending order)\",\n schema: {\n type: \"string\",\n },\n },\n {\n name: \"page\",\n in: \"query\",\n description: \"Page number (starts from 1)\",\n schema: {\n type: \"integer\",\n minimum: 1,\n },\n },\n {\n name: \"limit\",\n in: \"query\",\n description: \"Number of items per page\",\n schema: {\n type: \"integer\",\n minimum: 1,\n maximum: 100,\n },\n },\n {\n name: \"fields\",\n in: \"query\",\n description: \"Comma-separated list of fields to include in response\",\n schema: {\n type: \"string\",\n },\n },\n ],\n responses: {\n \"200\": {\n description: `List of ${humanReadableNamePlural} retrieved successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n total: {\n type: \"integer\",\n description:\n \"Total number of records matching the criteria\",\n },\n results: {\n type: \"integer\",\n description: \"Number of records returned in current page\",\n },\n data: {\n type: \"array\",\n items: {\n $ref: getSchemaRef(`FindMany${pascalModelName}`, mode),\n },\n },\n },\n },\n },\n },\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n\n // Create Many\n if (!isEndpointDisabled(routerConfig, \"createMany\")) {\n paths[`/api/${routeName}/many`] = {\n post: {\n tags: [humanReadableNamePlural],\n summary: `Create multiple ${humanReadableNamePlural}`,\n description: `Creates multiple ${humanReadableNamePlural} records in a single batch operation`,\n operationId: `createMany${pascalModelName}`,\n requestBody: {\n description: `Array of ${humanReadableName} data to create`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n type: \"array\",\n items: {\n $ref: getSchemaRef(`Create${pascalModelName}`, mode),\n },\n },\n },\n },\n },\n responses: {\n \"201\": {\n description: `${humanReadableNamePlural} created successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n count: {\n type: \"integer\",\n description: \"Number of records created\",\n },\n },\n },\n },\n },\n },\n \"400\": {\n description: \"Invalid input data provided\",\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n },\n security: [{ BearerAuth: [] }],\n },\n };\n }\n\n // Update Many\n if (!isEndpointDisabled(routerConfig, \"updateMany\")) {\n if (!paths[`/api/${routeName}/many`]) paths[`/api/${routeName}/many`] = {};\n paths[`/api/${routeName}/many`]!.patch = {\n tags: [humanReadableNamePlural],\n summary: `Update multiple ${humanReadableNamePlural}`,\n description: `Updates multiple ${humanReadableNamePlural} records that match the specified filter criteria`,\n operationId: `updateMany${pascalModelName}`,\n parameters: [\n {\n name: \"filter\",\n in: \"query\",\n description: \"Filter criteria in JSON format (required)\",\n required: true,\n schema: {\n type: \"string\",\n },\n },\n ],\n requestBody: {\n description: `Partial ${humanReadableName} data to update`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`Update${pascalModelName}`, mode),\n },\n },\n },\n },\n responses: {\n \"200\": {\n description: `${humanReadableNamePlural} updated successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n count: {\n type: \"integer\",\n description: \"Number of records updated\",\n },\n },\n },\n },\n },\n },\n \"400\": {\n description: \"Invalid input data or missing filter criteria\",\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n\n // Delete Many\n if (!isEndpointDisabled(routerConfig, \"deleteMany\")) {\n if (!paths[`/api/${routeName}/many`]) paths[`/api/${routeName}/many`] = {};\n paths[`/api/${routeName}/many`]!.delete = {\n tags: [humanReadableNamePlural],\n summary: `Delete multiple ${humanReadableNamePlural}`,\n description: `Deletes multiple ${humanReadableNamePlural} records that match the specified filter criteria`,\n operationId: `deleteMany${pascalModelName}`,\n parameters: [\n {\n name: \"filter\",\n in: \"query\",\n description: \"Filter criteria in JSON format (required)\",\n required: true,\n schema: {\n type: \"string\",\n },\n },\n ],\n responses: {\n \"200\": {\n description: `${humanReadableNamePlural} deleted successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n count: {\n type: \"integer\",\n description: \"Number of records deleted\",\n },\n },\n },\n },\n },\n },\n \"400\": {\n description: \"Missing filter criteria\",\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n\n // Find One\n if (!isEndpointDisabled(routerConfig, \"findOne\")) {\n paths[`/api/${routeName}/{id}`] = {\n get: {\n tags: [humanReadableNamePlural],\n summary: `Get ${humanReadableName} by ID`,\n description: `Retrieves a single ${humanReadableName} record by its unique identifier`,\n operationId: `get${pascalModelName}ById`,\n parameters: [\n {\n name: \"id\",\n in: \"path\",\n description: `Unique identifier of the ${humanReadableName}`,\n required: true,\n schema: {\n type: \"string\",\n },\n },\n ],\n responses: {\n \"200\": {\n description: `${humanReadableName} retrieved successfully`,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`FindOne${pascalModelName}`, mode),\n },\n },\n },\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n \"404\": {\n description: `${humanReadableName} not found`,\n },\n },\n security: [{ BearerAuth: [] }],\n },\n };\n }\n\n // Update One\n if (!isEndpointDisabled(routerConfig, \"updateOne\")) {\n if (!paths[`/api/${routeName}/{id}`]) paths[`/api/${routeName}/{id}`] = {};\n paths[`/api/${routeName}/{id}`]!.patch = {\n tags: [humanReadableNamePlural],\n summary: `Update ${humanReadableName} by ID`,\n description: `Updates a single ${humanReadableName} record by its unique identifier`,\n operationId: `update${pascalModelName}`,\n parameters: [\n {\n name: \"id\",\n in: \"path\",\n description: `Unique identifier of the ${humanReadableName}`,\n required: true,\n schema: {\n type: \"string\",\n },\n },\n ],\n requestBody: {\n description: `Partial ${humanReadableName} data to update`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`Update${pascalModelName}`, mode),\n },\n },\n },\n },\n responses: {\n \"200\": {\n description: `${humanReadableName} updated successfully`,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`${pascalModelName}`, mode),\n },\n },\n },\n },\n \"400\": {\n description: \"Invalid input data provided\",\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n \"404\": {\n description: `${humanReadableName} not found`,\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n\n // Delete One\n if (!isEndpointDisabled(routerConfig, \"deleteOne\")) {\n if (!paths[`/api/${routeName}/{id}`]) paths[`/api/${routeName}/{id}`] = {};\n paths[`/api/${routeName}/{id}`]!.delete = {\n tags: [humanReadableNamePlural],\n summary: `Delete ${humanReadableName} by ID`,\n description: `Permanently deletes a single ${humanReadableName} record by its unique identifier`,\n operationId: `delete${pascalModelName}`,\n parameters: [\n {\n name: \"id\",\n in: \"path\",\n description: `Unique identifier of the ${humanReadableName}`,\n required: true,\n schema: {\n type: \"string\",\n },\n },\n ],\n responses: {\n \"204\": {\n description: `${humanReadableName} deleted successfully`,\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n \"404\": {\n description: `${humanReadableName} not found`,\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n}\n"]}
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generatePrismaModelParentRoutePaths = generatePrismaModelParentRoutePaths;
7
+ const pluralize_1 = __importDefault(require("pluralize"));
8
+ const utils_1 = require("../../../../../../exports/utils");
9
+ const swagger_router_helpers_1 = require("../../swagger.router.helpers");
10
+ const base_router_helpers_1 = require("../../../../../base/utils/helpers/base.router.helpers");
11
+ async function generatePrismaModelParentRoutePaths(paths, routeName, pascalModelName, humanReadableName, humanReadableNamePlural, routerConfig, mode) {
12
+ const parentModel = routerConfig.parent.model;
13
+ const parentRouteName = pluralize_1.default.plural((0, utils_1.kebabCase)(parentModel));
14
+ const parentHumanName = (0, swagger_router_helpers_1.kebabToHuman)((0, utils_1.kebabCase)(parentModel));
15
+ if ((0, base_router_helpers_1.isParentEndpointAllowed)(routerConfig, "createOne")) {
16
+ paths[`/api/${parentRouteName}/{id}/${routeName}`] = {
17
+ post: {
18
+ tags: [humanReadableNamePlural],
19
+ summary: `Create ${humanReadableName} for ${parentHumanName}`,
20
+ description: `Creates a new ${humanReadableName} record associated with the specified ${parentHumanName}`,
21
+ operationId: `create${pascalModelName}For${(0, utils_1.pascalCase)(parentModel)}`,
22
+ parameters: [
23
+ {
24
+ name: "id",
25
+ in: "path",
26
+ description: `Unique identifier of the ${parentHumanName}`,
27
+ required: true,
28
+ schema: {
29
+ type: "string",
30
+ },
31
+ },
32
+ ],
33
+ requestBody: {
34
+ description: `${humanReadableName} data to create`,
35
+ required: true,
36
+ content: {
37
+ "application/json": {
38
+ schema: {
39
+ $ref: (0, swagger_router_helpers_1.getSchemaRef)(`Create${pascalModelName}`, mode),
40
+ },
41
+ },
42
+ },
43
+ },
44
+ responses: {
45
+ "201": {
46
+ description: `${humanReadableName} created successfully`,
47
+ content: {
48
+ "application/json": {
49
+ schema: {
50
+ $ref: (0, swagger_router_helpers_1.getSchemaRef)(`${pascalModelName}`, mode),
51
+ },
52
+ },
53
+ },
54
+ },
55
+ "400": {
56
+ description: "Invalid input data provided",
57
+ },
58
+ "401": {
59
+ description: "Authentication required",
60
+ },
61
+ "403": {
62
+ description: "Insufficient permissions",
63
+ },
64
+ "404": {
65
+ description: `${parentHumanName} not found`,
66
+ },
67
+ },
68
+ security: [{ BearerAuth: [] }],
69
+ },
70
+ };
71
+ }
72
+ if ((0, base_router_helpers_1.isParentEndpointAllowed)(routerConfig, "findMany")) {
73
+ if (!paths[`/api/${parentRouteName}/{id}/${routeName}`])
74
+ paths[`/api/${parentRouteName}/{id}/${routeName}`] = {};
75
+ paths[`/api/${parentRouteName}/{id}/${routeName}`].get = {
76
+ tags: [humanReadableNamePlural],
77
+ summary: `Get ${humanReadableNamePlural} for ${parentHumanName}`,
78
+ description: `Retrieves all ${humanReadableNamePlural} associated with the specified ${parentHumanName}`,
79
+ operationId: `get${pluralize_1.default.plural(pascalModelName)}For${(0, utils_1.pascalCase)(parentModel)}`,
80
+ parameters: [
81
+ {
82
+ name: "id",
83
+ in: "path",
84
+ description: `Unique identifier of the ${parentHumanName}`,
85
+ required: true,
86
+ schema: {
87
+ type: "string",
88
+ },
89
+ },
90
+ {
91
+ name: "filter",
92
+ in: "query",
93
+ description: "Additional filter criteria in JSON format",
94
+ schema: {
95
+ type: "string",
96
+ },
97
+ },
98
+ {
99
+ name: "sort",
100
+ in: "query",
101
+ description: "Sort field (prefix with '-' for descending order)",
102
+ schema: {
103
+ type: "string",
104
+ },
105
+ },
106
+ {
107
+ name: "page",
108
+ in: "query",
109
+ description: "Page number (starts from 1)",
110
+ schema: {
111
+ type: "integer",
112
+ minimum: 1,
113
+ },
114
+ },
115
+ {
116
+ name: "limit",
117
+ in: "query",
118
+ description: "Number of items per page",
119
+ schema: {
120
+ type: "integer",
121
+ },
122
+ },
123
+ ],
124
+ responses: {
125
+ "200": {
126
+ description: `List of ${humanReadableNamePlural} retrieved successfully`,
127
+ content: {
128
+ "application/json": {
129
+ schema: {
130
+ type: "object",
131
+ properties: {
132
+ total: {
133
+ type: "integer",
134
+ description: "Total number of records",
135
+ },
136
+ results: {
137
+ type: "integer",
138
+ description: "Number of records in current page",
139
+ },
140
+ data: {
141
+ type: "array",
142
+ items: {
143
+ $ref: (0, swagger_router_helpers_1.getSchemaRef)(`${pascalModelName}`, mode),
144
+ },
145
+ },
146
+ },
147
+ },
148
+ },
149
+ },
150
+ },
151
+ "401": {
152
+ description: "Authentication required",
153
+ },
154
+ "403": {
155
+ description: "Insufficient permissions",
156
+ },
157
+ "404": {
158
+ description: `${parentHumanName} not found`,
159
+ },
160
+ },
161
+ security: [{ BearerAuth: [] }],
162
+ };
163
+ }
164
+ }
165
+ //# sourceMappingURL=generate-prisma-model-parent-routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-prisma-model-parent-routes.js","sourceRoot":"","sources":["../../../../../../../../src/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes.ts"],"names":[],"mappings":";;;;;AAMA,kFAyKC;AA9KD,0DAAkC;AAClC,2DAAwE;AACxE,yEAA0E;AAC1E,+FAAgG;AAEzF,KAAK,UAAU,mCAAmC,CACvD,KAA4B,EAC5B,SAAiB,EACjB,eAAuB,EACvB,iBAAyB,EACzB,uBAA+B,EAC/B,YAAiB,EACjB,IAAY;IAEZ,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC;IAC9C,MAAM,eAAe,GAAG,mBAAS,CAAC,MAAM,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC;IACjE,MAAM,eAAe,GAAG,IAAA,qCAAY,EAA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,EAAE,OAAO;oBACX,WAAW,EAAE,6BAA6B;oBAC1C,MAAM,EAAE;wBACN,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,CAAC;qBACX;iBACF;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,EAAE,EAAE,OAAO;oBACX,WAAW,EAAE,0BAA0B;oBACvC,MAAM,EAAE;wBACN,IAAI,EAAE,SAAS;qBAChB;iBACF;aACF;YACD,SAAS,EAAE;gBACT,KAAK,EAAE;oBACL,WAAW,EAAE,WAAW,uBAAuB,yBAAyB;oBACxE,OAAO,EAAE;wBACP,kBAAkB,EAAE;4BAClB,MAAM,EAAE;gCACN,IAAI,EAAE,QAAQ;gCACd,UAAU,EAAE;oCACV,KAAK,EAAE;wCACL,IAAI,EAAE,SAAS;wCACf,WAAW,EAAE,yBAAyB;qCACvC;oCACD,OAAO,EAAE;wCACP,IAAI,EAAE,SAAS;wCACf,WAAW,EAAE,mCAAmC;qCACjD;oCACD,IAAI,EAAE;wCACJ,IAAI,EAAE,OAAO;wCACb,KAAK,EAAE;4CACL,IAAI,EAAE,IAAA,qCAAY,EAAC,GAAG,eAAe,EAAE,EAAE,IAAI,CAAC;yCAC/C;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;gBACD,KAAK,EAAE;oBACL,WAAW,EAAE,yBAAyB;iBACvC;gBACD,KAAK,EAAE;oBACL,WAAW,EAAE,0BAA0B;iBACxC;gBACD,KAAK,EAAE;oBACL,WAAW,EAAE,GAAG,eAAe,YAAY;iBAC5C;aACF;YACD,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;SAC/B,CAAC;IACJ,CAAC;AAGH,CAAC","sourcesContent":["import { OpenAPIV3 } from \"openapi-types\";\nimport pluralize from \"pluralize\";\nimport { kebabCase, pascalCase } from \"../../../../../../exports/utils\";\nimport { getSchemaRef, kebabToHuman } from \"../../swagger.router.helpers\";\nimport { isParentEndpointAllowed } from \"../../../../../base/utils/helpers/base.router.helpers\";\n\nexport async function generatePrismaModelParentRoutePaths(\n paths: OpenAPIV3.PathsObject,\n routeName: string,\n pascalModelName: string,\n humanReadableName: string,\n humanReadableNamePlural: string,\n routerConfig: any,\n mode: string\n) {\n const parentModel = routerConfig.parent.model;\n const parentRouteName = pluralize.plural(kebabCase(parentModel));\n const parentHumanName = kebabToHuman(kebabCase(parentModel));\n // const foreignKeyField =\n // routerConfig.parent.foreignKeyField || `${kebabCase(parentModel)}Id`;\n\n // Create One (Parent)\n if (isParentEndpointAllowed(routerConfig, \"createOne\")) {\n paths[`/api/${parentRouteName}/{id}/${routeName}`] = {\n post: {\n tags: [humanReadableNamePlural],\n summary: `Create ${humanReadableName} for ${parentHumanName}`,\n description: `Creates a new ${humanReadableName} record associated with the specified ${parentHumanName}`,\n operationId: `create${pascalModelName}For${pascalCase(parentModel)}`,\n parameters: [\n {\n name: \"id\",\n in: \"path\",\n description: `Unique identifier of the ${parentHumanName}`,\n required: true,\n schema: {\n type: \"string\",\n },\n },\n ],\n requestBody: {\n description: `${humanReadableName} data to create`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`Create${pascalModelName}`, mode),\n },\n },\n },\n },\n responses: {\n \"201\": {\n description: `${humanReadableName} created successfully`,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`${pascalModelName}`, mode),\n },\n },\n },\n },\n \"400\": {\n description: \"Invalid input data provided\",\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n \"404\": {\n description: `${parentHumanName} not found`,\n },\n },\n security: [{ BearerAuth: [] }],\n },\n };\n }\n\n // Find Many (Parent)\n if (isParentEndpointAllowed(routerConfig, \"findMany\")) {\n if (!paths[`/api/${parentRouteName}/{id}/${routeName}`])\n paths[`/api/${parentRouteName}/{id}/${routeName}`] = {};\n paths[`/api/${parentRouteName}/{id}/${routeName}`]!.get = {\n tags: [humanReadableNamePlural],\n summary: `Get ${humanReadableNamePlural} for ${parentHumanName}`,\n description: `Retrieves all ${humanReadableNamePlural} associated with the specified ${parentHumanName}`,\n operationId: `get${pluralize.plural(pascalModelName)}For${pascalCase(parentModel)}`,\n parameters: [\n {\n name: \"id\",\n in: \"path\",\n description: `Unique identifier of the ${parentHumanName}`,\n required: true,\n schema: {\n type: \"string\",\n },\n },\n {\n name: \"filter\",\n in: \"query\",\n description: \"Additional filter criteria in JSON format\",\n schema: {\n type: \"string\",\n },\n },\n {\n name: \"sort\",\n in: \"query\",\n description: \"Sort field (prefix with '-' for descending order)\",\n schema: {\n type: \"string\",\n },\n },\n {\n name: \"page\",\n in: \"query\",\n description: \"Page number (starts from 1)\",\n schema: {\n type: \"integer\",\n minimum: 1,\n },\n },\n {\n name: \"limit\",\n in: \"query\",\n description: \"Number of items per page\",\n schema: {\n type: \"integer\",\n },\n },\n ],\n responses: {\n \"200\": {\n description: `List of ${humanReadableNamePlural} retrieved successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n total: {\n type: \"integer\",\n description: \"Total number of records\",\n },\n results: {\n type: \"integer\",\n description: \"Number of records in current page\",\n },\n data: {\n type: \"array\",\n items: {\n $ref: getSchemaRef(`${pascalModelName}`, mode),\n },\n },\n },\n },\n },\n },\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n \"404\": {\n description: `${parentHumanName} not found`,\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n\n // Add other parent endpoints (findOne, updateOne, deleteOne, etc.) following the same pattern...\n}\n"]}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getOpenAPIJsonSchemasByConfigMode = getOpenAPIJsonSchemasByConfigMode;
7
+ exports.getCorrectJsonSchemaName = getCorrectJsonSchemaName;
8
+ exports.kebabToHuman = kebabToHuman;
9
+ exports.getSchemaRef = getSchemaRef;
10
+ exports.generatePathsForModels = generatePathsForModels;
11
+ const models_helpers_1 = require("../../../../utils/helpers/models.helpers");
12
+ const utils_1 = require("../../../../exports/utils");
13
+ const pluralize_1 = __importDefault(require("pluralize"));
14
+ const get_system_json_schema_paths_1 = require("./get-system-json-schema-paths");
15
+ const get_authentication_json_schema_paths_1 = require("./get-authentication-json-schema-paths");
16
+ const generate_zod_json_schema_1 = require("./json-schema-generators/generate-zod-json-schema");
17
+ const generate_class_validator_json_schemas_1 = require("./json-schema-generators/generate-class-validator-json-schemas");
18
+ const generate_prisma_json_schemas_1 = require("./json-schema-generators/generate-prisma-json-schemas");
19
+ const generate_prisma_model_main_routes_1 = require("./json-schema-generators/prisma-models/generate-prisma-model-main-routes");
20
+ const generate_prisma_model_parent_routes_1 = require("./json-schema-generators/prisma-models/generate-prisma-model-parent-routes");
21
+ async function getOpenAPIJsonSchemasByConfigMode(swaggerConfig) {
22
+ switch (swaggerConfig.mode) {
23
+ case "prisma":
24
+ return await (0, generate_prisma_json_schemas_1.generatePrismaJsonSchemas)();
25
+ case "class-validator":
26
+ return await (0, generate_class_validator_json_schemas_1.generateClassValidatorJsonSchemas)();
27
+ case "zod":
28
+ return await (0, generate_zod_json_schema_1.generateZodJsonSchemas)();
29
+ default:
30
+ throw Error("Unknown mode for auto documentation, supported values are prisma, class-validator, zod or json-schemas");
31
+ }
32
+ }
33
+ function getCorrectJsonSchemaName(type, modelName, suffix) {
34
+ const pascalModelName = (0, utils_1.pascalCase)(modelName);
35
+ const map = {
36
+ model: pascalModelName,
37
+ create: `Create${pascalModelName}`,
38
+ createMany: `CreateMany${pascalModelName}`,
39
+ findOne: `FindOne${pascalModelName}`,
40
+ findMany: `FindMany${pascalModelName}`,
41
+ update: `Update${pascalModelName}`,
42
+ updateMany: `UpdateMany${pascalModelName}`,
43
+ query: `Query${pascalModelName}`,
44
+ login: "Login",
45
+ signup: "Signup",
46
+ updateMe: "UpdateMe",
47
+ updatePassword: "UpdatePassword",
48
+ };
49
+ const baseName = map[type] ?? (0, utils_1.pascalCase)(type);
50
+ return `${baseName}${suffix}`;
51
+ }
52
+ function kebabToHuman(kebabStr) {
53
+ return kebabStr
54
+ .split("-")
55
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
56
+ .join(" ");
57
+ }
58
+ function getSchemaRef(schemaName, mode) {
59
+ switch (mode) {
60
+ case "prisma":
61
+ case "zod":
62
+ return `#/components/schemas/${schemaName}Schema`;
63
+ case "class-validator":
64
+ return `#/components/schemas/${schemaName}Dto`;
65
+ default:
66
+ return `#/components/schemas/${schemaName}`;
67
+ }
68
+ }
69
+ async function generatePathsForModels(swaggerConfig) {
70
+ if (!swaggerConfig)
71
+ return {};
72
+ let paths = {};
73
+ const models = (0, models_helpers_1.getModels)();
74
+ const mode = swaggerConfig.mode;
75
+ for (const model of models) {
76
+ const modelName = (0, utils_1.kebabCase)(model);
77
+ const routeName = pluralize_1.default.plural(modelName);
78
+ const pascalModelName = (0, utils_1.pascalCase)(model);
79
+ const humanReadableName = kebabToHuman(modelName);
80
+ const humanReadableNamePlural = pluralize_1.default.plural(humanReadableName);
81
+ const modelModules = await (0, models_helpers_1.importPrismaModelModules)(model);
82
+ const routerConfig = modelModules.router?.config;
83
+ if (routerConfig?.disable === true)
84
+ continue;
85
+ await (0, generate_prisma_model_main_routes_1.generatePrismaModelMainRoutesPaths)(paths, routeName, pascalModelName, humanReadableName, humanReadableNamePlural, routerConfig, mode);
86
+ if (routerConfig?.parent)
87
+ await (0, generate_prisma_model_parent_routes_1.generatePrismaModelParentRoutePaths)(paths, routeName, pascalModelName, humanReadableName, humanReadableNamePlural, routerConfig, mode);
88
+ }
89
+ paths = { ...paths, ...(0, get_system_json_schema_paths_1.getSystemJsonSchemaPaths)() };
90
+ paths = { ...paths, ...(0, get_authentication_json_schema_paths_1.getAuthenticationJsonSchemaPaths)() };
91
+ return paths;
92
+ }
93
+ //# sourceMappingURL=swagger.router.helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swagger.router.helpers.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/swagger.router.helpers.ts"],"names":[],"mappings":";;;;;AAgBA,8EAeC;AAED,4DAwBC;AAED,oCAKC;AAED,oCAUC;AAED,wDAsDC;AAnID,6EAGkD;AAClD,qDAAkE;AAElE,0DAAkC;AAClC,iFAA0E;AAC1E,iGAA0F;AAC1F,gGAA2F;AAC3F,0HAAmH;AACnH,wGAAkG;AAClG,gIAA8H;AAC9H,oIAAiI;AAE1H,KAAK,UAAU,iCAAiC,CACrD,aAAqC;IAErC,QAAQ,aAAc,CAAC,IAAI,EAAE,CAAC;QAC5B,KAAK,QAAQ;YACX,OAAO,MAAM,IAAA,wDAAyB,GAAE,CAAC;QAC3C,KAAK,iBAAiB;YACpB,OAAO,MAAM,IAAA,yEAAiC,GAAE,CAAC;QACnD,KAAK,KAAK;YACR,OAAO,MAAM,IAAA,iDAAsB,GAAE,CAAC;QACxC;YACE,MAAM,KAAK,CACT,wGAAwG,CACzG,CAAC;IACN,CAAC;AACH,CAAC;AAED,SAAgB,wBAAwB,CACtC,IAAY,EACZ,SAAiB,EACjB,MAAwB;IAExB,MAAM,eAAe,GAAG,IAAA,kBAAU,EAAC,SAAS,CAAC,CAAC;IAE9C,MAAM,GAAG,GAA2B;QAClC,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,SAAS,eAAe,EAAE;QAClC,UAAU,EAAE,aAAa,eAAe,EAAE;QAC1C,OAAO,EAAE,UAAU,eAAe,EAAE;QACpC,QAAQ,EAAE,WAAW,eAAe,EAAE;QACtC,MAAM,EAAE,SAAS,eAAe,EAAE;QAClC,UAAU,EAAE,aAAa,eAAe,EAAE;QAC1C,KAAK,EAAE,QAAQ,eAAe,EAAE;QAChC,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,UAAU;QACpB,cAAc,EAAE,gBAAgB;KACjC,CAAC;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C,CAAC;QAClD,MAAM,uBAAuB,GAAG,mBAAS,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAGpE,MAAM,YAAY,GAAG,MAAM,IAAA,yCAAwB,EAAC,KAAK,CAAC,CAAC;QAC3D,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;QAGjD,IAAI,YAAY,EAAE,OAAO,KAAK,IAAI;YAAE,SAAS;QAG7C,MAAM,IAAA,sEAAkC,EACtC,KAAK,EACL,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,YAAY,EACZ,IAAI,CACL,CAAC;QAGF,IAAI,YAAY,EAAE,MAAM;YACtB,MAAM,IAAA,yEAAmC,EACvC,KAAK,EACL,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,YAAY,EACZ,IAAI,CACL,CAAC;IACN,CAAC;IAGD,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,IAAA,uDAAwB,GAAE,EAAE,CAAC;IAGpD,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,IAAA,uEAAgC,GAAE,EAAE,CAAC;IAE5D,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { ArkosConfig } from \"../../../../exports\";\nimport {\n getModels,\n importPrismaModelModules,\n} from \"../../../../utils/helpers/models.helpers\";\nimport { kebabCase, pascalCase } from \"../../../../exports/utils\";\nimport { OpenAPIV3 } from \"openapi-types\";\nimport pluralize from \"pluralize\";\nimport { getSystemJsonSchemaPaths } from \"./get-system-json-schema-paths\";\nimport { getAuthenticationJsonSchemaPaths } from \"./get-authentication-json-schema-paths\";\nimport { generateZodJsonSchemas } from \"./json-schema-generators/generate-zod-json-schema\";\nimport { generateClassValidatorJsonSchemas } from \"./json-schema-generators/generate-class-validator-json-schemas\";\nimport { generatePrismaJsonSchemas } from \"./json-schema-generators/generate-prisma-json-schemas\";\nimport { generatePrismaModelMainRoutesPaths } from \"./json-schema-generators/prisma-models/generate-prisma-model-main-routes\";\nimport { generatePrismaModelParentRoutePaths } from \"./json-schema-generators/prisma-models/generate-prisma-model-parent-routes\";\n\nexport async function getOpenAPIJsonSchemasByConfigMode(\n swaggerConfig: ArkosConfig[\"swagger\"]\n) {\n switch (swaggerConfig!.mode) {\n case \"prisma\":\n return await generatePrismaJsonSchemas();\n case \"class-validator\":\n return await generateClassValidatorJsonSchemas();\n case \"zod\":\n return await generateZodJsonSchemas();\n default:\n throw Error(\n \"Unknown mode for auto documentation, supported values are prisma, class-validator, zod or json-schemas\"\n );\n }\n}\n\nexport function getCorrectJsonSchemaName(\n type: string,\n modelName: string,\n suffix: \"Dto\" | \"Schema\"\n): string {\n const pascalModelName = pascalCase(modelName);\n\n const map: Record<string, string> = {\n model: pascalModelName,\n create: `Create${pascalModelName}`,\n createMany: `CreateMany${pascalModelName}`,\n findOne: `FindOne${pascalModelName}`,\n findMany: `FindMany${pascalModelName}`,\n update: `Update${pascalModelName}`,\n updateMany: `UpdateMany${pascalModelName}`,\n query: `Query${pascalModelName}`,\n login: \"Login\",\n signup: \"Signup\",\n updateMe: \"UpdateMe\",\n updatePassword: \"UpdatePassword\",\n };\n\n const baseName = map[type] ?? pascalCase(type);\n return `${baseName}${suffix}`;\n}\n\nexport function kebabToHuman(kebabStr: string): string {\n return kebabStr\n .split(\"-\")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n}\n\nexport function getSchemaRef(schemaName: string, mode: string): string {\n switch (mode) {\n case \"prisma\":\n case \"zod\":\n return `#/components/schemas/${schemaName}Schema`;\n case \"class-validator\":\n return `#/components/schemas/${schemaName}Dto`;\n default:\n return `#/components/schemas/${schemaName}`;\n }\n}\n\nexport async function generatePathsForModels(\n swaggerConfig: ArkosConfig[\"swagger\"]\n): Promise<OpenAPIV3.PathsObject> {\n if (!swaggerConfig) return {};\n\n let paths: OpenAPIV3.PathsObject = {};\n const models = getModels();\n const mode = swaggerConfig!.mode;\n\n for (const model of models) {\n const modelName = kebabCase(model);\n const routeName = pluralize.plural(modelName);\n const pascalModelName = pascalCase(model);\n const humanReadableName = kebabToHuman(modelName);\n const humanReadableNamePlural = pluralize.plural(humanReadableName);\n\n // Import model modules to get router config\n const modelModules = await importPrismaModelModules(model);\n const routerConfig = modelModules.router?.config;\n\n // Skip if router is completely disabled\n if (routerConfig?.disable === true) continue;\n\n // Generate main routes\n await generatePrismaModelMainRoutesPaths(\n paths,\n routeName,\n pascalModelName,\n humanReadableName,\n humanReadableNamePlural,\n routerConfig,\n mode\n );\n\n // Generate parent routes if configured\n if (routerConfig?.parent)\n await generatePrismaModelParentRoutePaths(\n paths,\n routeName,\n pascalModelName,\n humanReadableName,\n humanReadableNamePlural,\n routerConfig,\n mode\n );\n }\n\n // Add system routes\n paths = { ...paths, ...getSystemJsonSchemaPaths() };\n\n // Add authentication routes\n paths = { ...paths, ...getAuthenticationJsonSchemaPaths() };\n\n return paths;\n}\n"]}
package/dist/cjs/paths.js CHANGED
@@ -1 +1 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ROOT_DIR=void 0;const path_1=__importDefault(require("path"));exports.ROOT_DIR=path_1.default.resolve(__dirname,"../..");
1
+ "use strict";var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ROOT_DIR=void 0;const path_1=__importDefault(require("path"));exports.ROOT_DIR=path_1.default.resolve(__dirname,"../..");
@@ -1,3 +1,3 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.server=void 0,exports.terminateApplicationRunningProcessAndServer=terminateApplicationRunningProcessAndServer,exports.getArkosConfig=getArkosConfig,exports.getExpressApp=getExpressApp,exports.initApp=initApp;const app_1=require("./app"),deepmerge_helper_1=__importDefault(require("./utils/helpers/deepmerge.helper")),http_1=__importDefault(require("http"));process.on("uncaughtException",e=>{e.message.includes("EPIPE")||(console.error(`
1
+ "use strict";var __importDefault=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.server=void 0,exports.terminateApplicationRunningProcessAndServer=terminateApplicationRunningProcessAndServer,exports.getArkosConfig=getArkosConfig,exports.getExpressApp=getExpressApp,exports.initApp=initApp;const app_1=require("./app"),deepmerge_helper_1=__importDefault(require("./utils/helpers/deepmerge.helper")),http_1=__importDefault(require("http")),sheu_1=__importDefault(require("./utils/sheu"));process.on("uncaughtException",e=>{e.message.includes("EPIPE")||(console.error(`
2
2
  UNCAUGHT EXCEPTION! SHUTTING DOWN...
3
- `),console.error(e.name,e.message),console.error(e),process.exit(1))});let server,_app,_arkosConfig={welcomeMessage:"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com",port:Number(process.env.CLI_PORT)||Number(process.env.PORT)||8e3,host:process.env.CLI_HOST||process.env.HOST||"localhost",fileUpload:{baseUploadDir:"uploads",baseRoute:"/api/uploads"},available:!1};async function initApp(e={}){_arkosConfig.available=!0,_arkosConfig=(0,deepmerge_helper_1.default)(_arkosConfig,e);const r=process.env.CLI_PORT||e.port||process.env.PORT||void 0;return _app=await(0,app_1.bootstrap)(_arkosConfig),r&&(exports.server=server=http_1.default.createServer(_app),_arkosConfig?.configureServer&&await _arkosConfig.configureServer(server),server.listen(Number(r),_arkosConfig.host,()=>{const o=new Date().toTimeString().split(" ")[0];console.info(`[\x1B[32mREADY\x1B[0m] \x1B[90m${o}\x1B[0m server waiting on http://${_arkosConfig.host||"localhost"}:${r}`)})),_app}process.on("unhandledRejection",e=>{console.error("UNHANDLED REJECTION! SHUTTING DOWN..."),console.error(e.name,e.message),console.error(e),server?.close(()=>{process.exit(1)})});function terminateApplicationRunningProcessAndServer(){server?.close(()=>{process.exit(1)})}function getArkosConfig(){return _arkosConfig}function getExpressApp(){return _app}
3
+ `),console.error(e.name,e.message),console.error(e),process.exit(1))});let server,_app,_arkosConfig={welcomeMessage:"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com",port:Number(process.env.CLI_PORT)||Number(process.env.PORT)||8e3,host:process.env.CLI_HOST||process.env.HOST||"localhost",fileUpload:{baseUploadDir:"uploads",baseRoute:"/api/uploads"},available:!1};async function initApp(e={}){_arkosConfig.available=!0,_arkosConfig=(0,deepmerge_helper_1.default)(_arkosConfig,e);const r=process.env.CLI_PORT||_arkosConfig.port||process.env.PORT||"port"in _arkosConfig?_arkosConfig.port:8e3;_app=await(0,app_1.bootstrap)(_arkosConfig);const t=new Date().toTimeString().split(" ")[0];return r?(exports.server=server=http_1.default.createServer(_app),_arkosConfig?.configureServer&&await _arkosConfig.configureServer(server),server.listen(Number(r),_arkosConfig.host,()=>{sheu_1.default.ready(`${sheu_1.default.gray(t)} server waiting on http://${_arkosConfig.host||"localhost"}:${r}`)})):sheu_1.default.warn(`${sheu_1.default.gray(t)} port set to undefined, hence no internal http server was setup.`),_app}process.on("unhandledRejection",e=>{console.error("UNHANDLED REJECTION! SHUTTING DOWN..."),console.error(e.name,e.message),console.error(e),server?.close(()=>{process.exit(1)})});function terminateApplicationRunningProcessAndServer(){server?.close(()=>{process.exit(1)})}function getArkosConfig(){return _arkosConfig}function getExpressApp(){return _app}
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;AAqFA,kGAIC;AAOD,wCAEC;AAED,sCAEC;AAEgB,0BAAO;AArGxB,+BAAkC;AAElC,wFAAyD;AACzD,gDAAwB;AAExB,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;IACtC,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO;IAE1C,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC1D,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAA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nD,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACrD,OAAO,CAAC,IAAI,CACV,kCAAkC,IAAI,oCAAoC,YAAY,CAAC,IAAI,IAAI,WAAW,IAAI,IAAI,EAAE,CACrH,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,GAAa,EAAE,EAAE;IACjD,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACvD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAOH,SAAgB,2CAA2C;IACzD,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAOD,SAAgB,cAAc;IAC5B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAgB,aAAa;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { IncomingMessage, Server, ServerResponse } from \"http\";\nimport AppError from \"./modules/error-handler/utils/app-error\";\nimport { Express } from \"express\";\nimport { bootstrap } from \"./app\";\nimport { ArkosConfig } from \"./types/arkos-config\";\nimport deepmerge from \"./utils/helpers/deepmerge.helper\";\nimport http from \"http\";\n\nprocess.on(\"uncaughtException\", (err) => {\n if (err.message.includes(\"EPIPE\")) return;\n\n console.error(\"\\nUNCAUGHT EXCEPTION! SHUTTING DOWN...\\n\");\n console.error(err.name, err.message);\n console.error(err);\n process.exit(1);\n});\n\nlet server: Server<typeof IncomingMessage, typeof ServerResponse>;\nlet _app: Express;\n\nlet _arkosConfig: ArkosConfig & { available?: boolean } = {\n welcomeMessage:\n \"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com\",\n port: Number(process.env.CLI_PORT) || Number(process.env.PORT) || 8000,\n host: process.env.CLI_HOST || process.env.HOST || \"localhost\",\n fileUpload: {\n baseUploadDir: \"uploads\",\n baseRoute: \"/api/uploads\",\n },\n available: false,\n};\n\n/**\n * Initializes the application server.\n *\n * This function starts the server by listening on a specified port.\n * The port is determined by the following order of precedence:\n * 1. The `port` argument passed to the function.\n * 2. Defaults to `8000` if neither is provided.\n *\n * @param {ArkosConfig} arkosConfig - initial configs for the api ( authentication, port).\n * @returns {Promise<Express>} This function returns the Express App after all middlewares configurations.\n * You can prevent it from listen py passing port as undefined\n *\n */\nasync function initApp(arkosConfig: ArkosConfig = {}): Promise<Express> {\n _arkosConfig.available = true;\n _arkosConfig = deepmerge(_arkosConfig, arkosConfig);\n\n const port =\n process.env.CLI_PORT || arkosConfig.port || process.env.PORT || undefined;\n\n _app = await bootstrap(_arkosConfig);\n\n if (port) {\n server = http.createServer(_app);\n\n if (_arkosConfig?.configureServer)\n await _arkosConfig.configureServer(server);\n\n server.listen(Number(port), _arkosConfig.host!, () => {\n const time = new Date().toTimeString().split(\" \")[0];\n console.info(\n `[\\x1b[32mREADY\\x1b[0m] \\x1b[90m${time}\\x1b[0m server waiting on http://${_arkosConfig.host || \"localhost\"}:${port}`\n );\n });\n }\n\n return _app;\n}\n\nprocess.on(\"unhandledRejection\", (err: AppError) => {\n console.error(\"UNHANDLED REJECTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n server?.close(() => {\n process.exit(1);\n });\n});\n\n/**\n * Terminates the current running express application, server and process.\n *\n * @returns {void}\n */\nexport function terminateApplicationRunningProcessAndServer(): void {\n server?.close(() => {\n process.exit(1);\n });\n}\n\n/**\n * Gives access to the underlying current configurations being used by **Arkos** by default and also passed through `arkos.init()`\n *\n * @returns {ArkosConfig}\n */\nexport function getArkosConfig(): ArkosConfig {\n return _arkosConfig;\n}\n\nexport function getExpressApp() {\n return _app;\n}\n\nexport { server, initApp };\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;AA+FA,kGAIC;AAOD,wCAEC;AAED,sCAEC;AAEgB,0BAAO;AA/GxB,+BAAkC;AAElC,wFAAyD;AACzD,gDAAwB;AACxB,wDAAgC;AAEhC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;IACtC,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO;IAE1C,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC1D,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,IAAI,MAA6D,CAAC;AAClE,IAAI,IAAa,CAAC;AAElB,IAAI,YAAY,GAA0C;IACxD,cAAc,EACZ,6FAA6F;IAC/F,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI;IACtE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,WAAW;IAC7D,UAAU,EAAE;QACV,aAAa,EAAE,SAAS;QACxB,SAAS,EAAE,cAAc;KAC1B;IACD,SAAS,EAAE,KAAK;CACjB,CAAC;AAeF,KAA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C,CAAC,CAAC;IACvD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAOH,SAAgB,2CAA2C;IACzD,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAOD,SAAgB,cAAc;IAC5B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAgB,aAAa;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { IncomingMessage, Server, ServerResponse } from \"http\";\nimport AppError from \"./modules/error-handler/utils/app-error\";\nimport { Express } from \"express\";\nimport { bootstrap } from \"./app\";\nimport { ArkosConfig } from \"./types/arkos-config\";\nimport deepmerge from \"./utils/helpers/deepmerge.helper\";\nimport http from \"http\";\nimport sheu from \"./utils/sheu\";\n\nprocess.on(\"uncaughtException\", (err) => {\n if (err.message.includes(\"EPIPE\")) return;\n\n console.error(\"\\nUNCAUGHT EXCEPTION! SHUTTING DOWN...\\n\");\n console.error(err.name, err.message);\n console.error(err);\n process.exit(1);\n});\n\nlet server: Server<typeof IncomingMessage, typeof ServerResponse>;\nlet _app: Express;\n\nlet _arkosConfig: ArkosConfig & { available?: boolean } = {\n welcomeMessage:\n \"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com\",\n port: Number(process.env.CLI_PORT) || Number(process.env.PORT) || 8000,\n host: process.env.CLI_HOST || process.env.HOST || \"localhost\",\n fileUpload: {\n baseUploadDir: \"uploads\",\n baseRoute: \"/api/uploads\",\n },\n available: false,\n};\n\n/**\n * Initializes the application server.\n *\n * This function starts the server by listening on a specified port.\n * The port is determined by the following order of precedence:\n * 1. The `port` argument passed to the function.\n * 2. Defaults to `8000` if neither is provided.\n *\n * @param {ArkosConfig} arkosConfig - initial configs for the api ( authentication, port).\n * @returns {Promise<Express>} This function returns the Express App after all middlewares configurations.\n * You can prevent it from listen py passing port as undefined\n *\n */\nasync function initApp(arkosConfig: ArkosConfig = {}): Promise<Express> {\n _arkosConfig.available = true;\n _arkosConfig = deepmerge(_arkosConfig, arkosConfig);\n\n const port =\n process.env.CLI_PORT ||\n _arkosConfig.port ||\n process.env.PORT ||\n \"port\" in _arkosConfig\n ? _arkosConfig.port\n : 8000;\n\n _app = await bootstrap(_arkosConfig);\n const time = new Date().toTimeString().split(\" \")[0];\n\n if (port) {\n server = http.createServer(_app);\n\n if (_arkosConfig?.configureServer)\n await _arkosConfig.configureServer(server);\n\n server.listen(Number(port), _arkosConfig.host!, () => {\n sheu.ready(\n `${sheu.gray(time)} server waiting on http://${_arkosConfig.host || \"localhost\"}:${port}`\n );\n });\n } else {\n sheu.warn(\n `${sheu.gray(time)} port set to undefined, hence no internal http server was setup.`\n );\n }\n\n return _app;\n}\n\nprocess.on(\"unhandledRejection\", (err: AppError) => {\n console.error(\"UNHANDLED REJECTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n server?.close(() => {\n process.exit(1);\n });\n});\n\n/**\n * Terminates the current running express application, server and process.\n *\n * @returns {void}\n */\nexport function terminateApplicationRunningProcessAndServer(): void {\n server?.close(() => {\n process.exit(1);\n });\n}\n\n/**\n * Gives access to the underlying current configurations being used by **Arkos** by default and also passed through `arkos.init()`\n *\n * @returns {ArkosConfig}\n */\nexport function getArkosConfig(): ArkosConfig {\n return _arkosConfig;\n}\n\nexport function getExpressApp() {\n return _app;\n}\n\nexport { server, initApp };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"arkos-config.js","sourceRoot":"","sources":["../../../src/types/arkos-config.ts"],"names":[],"mappings":"","sourcesContent":["import http from \"http\";\nimport cors from \"cors\";\nimport express from \"express\";\nimport { Options as RateLimitOptions } from \"express-rate-limit\";\nimport cookieParser from \"cookie-parser\";\nimport compression from \"compression\";\nimport { Options as QueryParserOptions } from \"../utils/helpers/query-parser.helpers\";\nimport { ValidatorOptions } from \"class-validator\";\nimport { MsDuration } from \"../modules/auth/utils/helpers/auth.controller.helpers\";\n\n/**\n * Defines the initial configs of the api to be loaded at startup when arkos.init() is called.\n */\nexport type ArkosConfig = {\n /**\n * Allows to configure request configs\n */\n request?: {\n /**\n * Allows to configure request parameters\n */\n parameters?: {\n /**\n * Toggles allowing `VERY DANGEROUS` request paramateres under `req.query` for passing prisma query options.\n *\n * See more\n */\n allowDangerousPrismaQueryOptions?: boolean;\n };\n };\n /** Message you would like to send, as Json and 200 response when\n * ```curl\n * GET /api\n * ```\n *\n * ```json\n * { \"message\": \"Welcome to YourAppName\" }\n * ```\n *\n * default message is: Welcome to our Rest API generated by Arkos, find more about Arkos at www.arkosjs.com.\n *\n *\n * */\n welcomeMessage?: string;\n /**\n * Port where the application will run, can be set in 3 ways:\n *\n * 1. default is 8000\n * 2. PORT under environment variables (Lower precedence)\n * 3. this config option (Higher precedence)\n */\n port?: number | undefined;\n /**\n * Allows to listen on a different host than localhost only\n */\n host?: string;\n /**\n * Defines authentication related configurations, by default is undefined.\n *\n * See [www.arkosjs.com/docs/core-concepts/built-in-authentication-system](https://www.arkosjs.com/docs/core-concepts/built-in-authentication-system) for details.\n */\n authentication?: {\n /**\n * Defines whether to use Static or Dynamic Role-Based Acess Control\n *\n * Visit [www.arkosjs.com/docs/core-concepts/built-in-authentication-system](https://www.arkosjs.com/docs/core-concepts/built-in-authentication-system) for more details.\n */\n mode: \"static\" | \"dynamic\";\n /**\n * Defines auth login related configurations to customize the api.\n */\n login?: {\n /**\n * Defines the field that will be used as username by the built-in auth system, by default arkos will look for the field \"username\" in your model User, hence when making login for example you must send:\n *\n * ```json\n * {\n * \"username\": \"johndoe\",\n * \"password\": \"somePassword123\"\n * }\n * ```\n *\n * **Note:** You can also modify the usernameField on the fly by passing it to the request query parameters. example:\n *\n * ```curl\n * POST /api/auth/login?usernameField=email\n * ```\n *\n * See more at [www.arkosjs.com/docs/guide/authentication-system/sending-authentication-requests#example-changing-the-username-field](https://www.arkosjs.com/docs/guide/authentication-system/sending-authentication-requests#example-changing-the-username-field)\n *\n * By specifing here another field for username, for example passing \"email\", \"companyCode\" or something else your json will be like:\n *\n * **Example with email**\n *\n * ```json\n * {\n * \"email\": \"john.doe@example.com\",\n * \"password\": \"somePassword123\"\n * }\n * ```\n */\n allowedUsernames?: string[];\n /** Defines wether to send the access token in response after login or only send as cookie, defeault is both.*/\n sendAccessTokenThrough?: \"cookie-only\" | \"response-only\" | \"both\";\n };\n /**\n * Specifies the regex pattern used by the authentication system to enforce password strength requirements.\n *\n * **Important**: If using validation libraries like Zod or class-validator, this will be completely overwritten.\n *\n * **Default**: ```/^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d).+$/``` - Ensures the password contains at least one uppercase letter, one lowercase letter, and one numeric digit.\n *\n * **message**: (Optional) A custom error message to display when the password does not meet the required strength criteria.\n */\n passwordValidation?: { regex: RegExp; message?: string };\n /**\n * Allows to specify the request rate limit for all authentication endpoints but `/api/users/me`.\n * \n * #### Default\n *{\n windowMs: 5000,\n limit: 10,\n standardHeaders: \"draft-7\",\n legacyHeaders: false,\n }\n * \n * Passing an object not overriding all the default options will only\n * cause it to be deepmerged and not actually replace with empty fields\n * \n *@see This is are the options used on the `express-rate-limit` npm package used on epxress. read more about [https://www.npmjs.com/package/express-rate-limit](https://www.npmjs.com/package/express-rate-limit)\n */\n requestRateLimitOptions?: Partial<RateLimitOptions>;\n /**\n * JWT (JSON Web Token) authentication configuration.\n *\n * You can override these values directly in code, or use environment variables:\n *\n * - `JWT_SECRET`: Secret used to sign and verify JWT tokens.\n * - `JWT_EXPIRES_IN`: Duration string or number indicating when the token should expire (e.g. \"30d\", 3600).\n * - `JWT_COOKIE_SECURE`: Whether the cookie is sent only over HTTPS. Default: `true` in production.\n * - `JWT_COOKIE_HTTP_ONLY`: Whether the cookie is HTTP-only. Default: `true`.\n * - `JWT_COOKIE_SAME_SITE`: Can be \"lax\", \"strict\", or \"none\". Defaults to \"lax\" in dev, \"none\" in prod.\n *\n * ⚠️ Values passed here take precedence over environment variables.\n */\n jwt?: {\n /** Secret key used for signing and verifying JWT tokens */\n secret?: string;\n /**\n * Duration after which the JWT token expires.\n * Accepts either a duration string (e.g. \"30d\", \"1h\") or a number in milliseconds.\n * Defaults to \"30d\" if not provided.\n */\n expiresIn?: MsDuration | number;\n\n /**\n * Configuration for the JWT cookie sent to the client\n */\n cookie?: {\n /**\n * Whether the cookie should be marked as secure (sent only over HTTPS).\n * Defaults to `true` in production and `false` in development.\n */\n secure?: boolean;\n\n /**\n * Whether the cookie should be marked as HTTP-only.\n * Default is `true` to prevent access via JavaScript.\n */\n httpOnly?: boolean;\n\n /**\n * Controls the SameSite attribute of the cookie.\n * Defaults to \"none\" in production and \"lax\" in development.\n * Options: \"lax\" | \"strict\" | \"none\"\n */\n sameSite?: \"lax\" | \"strict\" | \"none\";\n };\n };\n };\n /** Allows to customize and toggle the built-in validation, by default it is set to `false`. If true is passed it will use validation with the default resolver set to `class-validator` if you intend to change the resolver to `zod` do the following:\n *\n *```ts\n * // src/app.ts\n * import arkos from 'arkos'\n *\n * arkos.init({\n * validation: {\n * resolver: \"zod\"\n * }\n * })\n * ```\n *\n * @See [www.arkosjs.com/docs/core-concepts/request-data-validation](https://www.arkosjs.com/docs/core-concepts/request-data-validation) for more details.\n */\n validation?:\n | {\n resolver?: \"class-validator\";\n /**\n * ValidatorOptions to used while validating request data.\n *\n * **Default**:\n * ```ts\n * {\n * whitelist: true\n * }\n * ```\n */\n validationOptions?: ValidatorOptions;\n }\n | {\n resolver?: \"zod\";\n validationOptions?: Record<string, any>;\n };\n /**\n * Defines file upload configurations\n *\n * See [www.arkosjs.com/docs/core-concepts/file-upload#costum-configurations](https://www.arkosjs.com/docs/core-concepts/file-upload#costum-configurations)\n */\n fileUpload?: {\n /**\n * Defiens the base file upload directory, default is set to /uploads (on root directory)\n *\n * When setting up a path dir always now that root directory will be the starting reference.\n *\n * #### Example\n * passing `../my-arkos-uploaded-files`\n *\n * Will save uploaded files one level outside the root dir inside `my-arkos-uploaded-files`\n *\n * NB: You must be aware of permissions on your server to acess files outside your project directory.\n *\n */\n baseUploadDir?: string;\n /**\n * Changes the default `/api/uploads` base route for accessing file upload route.\n *\n * #### IMPORTANT\n * Changing this will not affect the `baseUploadDir` folder. You can\n * pass here `/api/files/my-user-files` and `baseUploadDir` be `/uploaded-files`.\n *\n */\n baseRoute?: string;\n /**\n * Defines options for `express.static(somePath, someOptions)`\n *\n * #### Default:\n *\n * ```ts\n *{\n maxAge: \"1y\",\n etag: true,\n lastModified: true,\n dotfiles: \"ignore\",\n fallthrough: true,\n index: false,\n cacheControl: true,\n }\n * ```\n * \n * By passing your custom options have in mind that it\n * will be deepmerged with the default.\n * \n * Visit [https://expressjs.com/en/4x/api.html#express.static](https://expressjs.com/en/4x/api.html#express.static) for more understanding.\n * \n */\n expressStaticOptions?: Parameters<typeof express.static>[1];\n /**\n * Defines upload restrictions for each file type: image, video, document or other.\n *\n * #### Important:\n * Passing an object without overriding everything will only cause it\n * to be deepmerged with the default options.\n *\n * See [www.arkosjs.com/docs/api-reference/default-supported-upload-files](https://www.arkosjs.com/docs/api-reference/default-supported-upload-files) for detailed explanation about default values.\n * ```\n */\n restrictions?: {\n images?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n videos?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n documents?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n files?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n };\n };\n /**\n * Allows to specify the request rate limit for all endpoints.\n * \n * #### Default\n *```ts\n *{\n windowMs: 60 * 1000,\n limit: 1000,\n standardHeaders: \"draft-7\",\n legacyHeaders: false,\n }\n ```\n * \n * Passing an object not overriding all the default options will only\n * cause it to be deepmerged and not actually replace with empty fields\n * \n * This is are the options used on the `express-rate-limit` npm package used on epxress. read more about [https://www.npmjs.com/package/express-rate-limit](https://www.npmjs.com/package/express-rate-limit)\n */\n globalRequestRateLimitOptions?: Partial<RateLimitOptions>;\n /**\n * Defines options for the built-in express.json() middleware\n * Nothing is passed by default.\n */\n jsonBodyParserOptions?: Parameters<typeof express.json>[0];\n /**\n * Allows to pass paremeters to cookieParser from npm package cookie-parser\n * Nothing is passed by default.\n *\n * See [www.npmjs.com/package/cookie-parser](https://www.npmjs.com/package/cookie-parser) for further details.\n */\n cookieParserParameters?: Parameters<typeof cookieParser>;\n /**\n * Allows to define options for npm package compression\n * Nothing is passed by default.\n *\n * See [www.npmjs.com/package/compression](https://www.npmjs.com/package/compression) for further details.\n */\n compressionOptions?: compression.CompressionOptions;\n /**\n * Options to define how query must be parsed.\n *\n * #### for example:\n * ```\n * GET /api/product?saleId=null\n * ```\n *\n * Normally would parsed to { saleId: \"null\" } so query parser\n * trough setting option `parseNull` will transform { saleId: null }\n * \n * #### Default:\n * \n * {\n parseNull: true,\n parseUndefined: true,\n parseBoolean: true,\n }\n * \n * parseNumber may convert fields that are string but you only passed\n * numbers to query pay attention to this.\n * \n * Soon a feature to converted the query to the end prisma type will be added.\n */\n queryParserOptions?: QueryParserOptions;\n /**\n * Configuration for CORS (Cross-Origin Resource Sharing).\n *\n * @property {string | string[] | \"all\"} [allowedOrigins] - List of allowed origins. If set to `\"all\"`, all origins are accepted.\n * @property {import('cors').CorsOptions} [options] - Additional CORS options passed directly to the `cors` middleware.\n * @property {import('cors').CorsOptionsDelegate} [customMiddleware] - A custom middleware function that overrides the default behavior.\n *\n * @remarks\n * If `customMiddleware` is provided, both `allowedOrigins` and `options` will be ignored in favor of the custom logic.\n *\n * See https://www.npmjs.com/package/cors\n */\n cors?: {\n /**\n * Defines allowed origins to acess the API.\n */\n allowedOrigins?: string | string[] | \"*\";\n options?: cors.CorsOptions;\n /**\n * If you would like to override the entire middleware\n *\n * see\n */\n customHandler?: cors.CorsOptionsDelegate;\n };\n /**\n * Defines express/arkos middlewares configurations\n */\n middlewares?: {\n /**\n * Allows to add an array of custom express middlewares into the default middleware stack.\n *\n * **Tip**: If you would like to acess the express app before everthing use `configureApp` and pass a function.\n *\n * **Where will these be placed?**: see [www.arkosjs.com/docs/advanced-guide/replace-or-disable-built-in-middlewares#middleware-execution-order](https://www.arkosjs.com/docs/advanced-guide/replace-or-disable-built-in-middlewares#middleware-execution-order)\n *\n * **Note**: If you want to use custom global error handler middleware use `middlewares.replace.globalErrorHandler`.\n *\n * Read more about The Arkos Middleware Stack at [www.arkosjs.com/docs/the-middleware-stack](https://www.arkosjs.com/docs/the-middleware-stack) for in-depth details.\n */\n additional?: express.RequestHandler[];\n /**\n * An array containing a list of defaults middlewares to be disabled\n *\n * **Caution**: Be careful with this because you may endup breaking your entire application.\n */\n disable?: (\n | \"compression\"\n | \"global-rate-limit\"\n | \"auth-rate-limit\"\n | \"cors\"\n | \"express-json\"\n | \"cookie-parser\"\n | \"query-parser\"\n | \"database-connection\"\n | \"request-logger\"\n | \"global-error-handler\"\n )[];\n /**\n * Allows you to replace each of the built-in middlewares with your own implementation\n *\n * **Caution**: Be careful with this because you may endup breaking your entire application.\n */\n replace?: {\n /**\n * Replace the default compression middleware\n */\n compression?: express.RequestHandler;\n /**\n * Replace the default global rate limit middleware\n */\n globalRateLimit?: express.RequestHandler;\n /**\n * Replace the default authentication rate limit middleware\n */\n authRateLimit?: express.RequestHandler;\n /**\n * Replace the default CORS middleware\n */\n cors?: express.RequestHandler;\n /**\n * Replace the default JSON body parser middleware\n */\n expressJson?: express.RequestHandler;\n /**\n * Replace the default cookie parser middleware\n */\n cookieParser?: express.RequestHandler;\n /**\n * Replace the default query parser middleware\n */\n queryParser?: express.RequestHandler;\n /**\n * Replace the default database connection check middleware\n */\n databaseConnection?: express.RequestHandler;\n /**\n * Replace the default request logger middleware\n */\n requestLogger?: express.RequestHandler;\n /**\n * Replace the default global error handler middleware\n */\n globalErrorHandler?: express.ErrorRequestHandler;\n };\n };\n /**\n * Defines express/arkos routers configurations\n */\n routers?: {\n /**\n * Allows to add an array of custom express routers into the default middleware/router stack.\n *\n * **Where will these be placed?**: see [www.arkosjs.com/docs/advanced-guide/adding-custom-routers](https://www.arkosjs.com/docs/advanced-guide/adding-custom-routers)\n *\n *\n * Read more about The Arkos Middleware Stack at [www.arkosjs.com/docs/the-middleware-stack](https://www.arkosjs.com/docs/the-middleware-stack) for in-depth details.\n */\n additional?: express.Router[];\n disable?: (\n | \"auth-router\"\n | \"prisma-models-router\"\n | \"file-upload\"\n | \"welcome-endpoint\"\n )[];\n /**\n * Allows you to replace each of the built-in routers with your own implementation.\n *\n * **Note**: Doing this you will lose all default middleware chaining, auth control, handlers from the specific router.\n *\n * **Tip**: I you want to disable some prisma models specific endpoint\n * see [www.arkosjs.com/docs/guide/adding-custom-routers#disabling-auto-generated-endpoints](https://www.arkosjs.com/docs/guide/adding-custom-routers#disabling-auto-generated-endpoints)\n *\n * **Caution**: Be careful with this because you may endup breaking your entire application.\n */\n replace?: {\n /**\n * Replace the default authentication router\n * @param config The original Arkos configuration\n * @returns A router handling authentication endpoints\n */\n authRouter?: (\n config: ArkosConfig\n ) => express.Router | Promise<express.Router>;\n /**\n * Replace the default Prisma models router\n * @param config The original Arkos configuration\n * @returns A router handling Prisma model endpoints\n */\n prismaModelsRouter?: (\n config: ArkosConfig\n ) => express.Router | Promise<express.Router>;\n /**\n * Replace the default file upload router\n * @param config The original Arkos configuration\n * @returns A router handling file upload endpoints\n */\n fileUpload?: (\n config: ArkosConfig\n ) => express.Router | Promise<express.Router>;\n /**\n * Replace the default welcome endpoint handler\n * @param req Express request object\n * @param res Express response object\n * @param next Express next function\n */\n welcomeEndpoint?: express.RequestHandler;\n };\n };\n /**\n * Gives acess to the underlying express app so that you can add custom configurations beyong **Arkos** customization capabilities\n *\n * **Note**: In the end **Arkos** will call `app.listen` for you.\n *\n * If you want to call `app.listen` by yourself pass port as `undefined` and then use the return app from `arkos.init()`.\n *\n * See how to call `app.listen` correctly [www.arkosjs.com/docs/guide/accessing-the-express-app#calling-applisten-by-yourself](https://www.arkosjs.com/docs/guide/accessing-the-express-app#calling-applisten-by-yourself)\n *\n * See [www.arkosjs.com/docs/guide/accessing-the-express-app](https://www.arkosjs.com/docs/guide/accessing-the-express-app) for further details on the method configureApp.\n *\n * @param {express.Express} app\n * @returns {any}\n */\n configureApp?: (app: express.Express) => Promise<any> | any;\n /**\n * Gives access to the underlying HTTP server so that you can add custom configurations beyond **Arkos** customization capabilities\n *\n * **Note**: In the end **Arkos** will call `server.listen` for you.\n *\n * If you want to call `server.listen` by yourself pass port as `undefined` and then use the return server from `arkos.init()`.\n *\n * See how to call `server.listen` correctly [www.arkosjs.com/docs/guide/accessing-the-express-app#creating-your-own-http-server](https://www.arkosjs.com/docs/guide/accessing-the-express-app#creating-your-own-http-server)\n *\n * See [www.arkosjs.com/docs/guide/accessing-the-express-app#accessing-the-http-server](https://www.arkosjs.com/docs/guide/accessing-the-express-app#accessing-the-http-server) for further details on the method configureServer.\n *\n * @param {http.Server} server - The HTTP server instance\n * @returns {any}\n */\n configureServer?: (server: http.Server) => Promise<any> | any;\n /**\n * Allows to configure email configurations for sending emails through `emailService`\n *\n * See [www.arkosjs.com/docs/core-concepts/sending-emails](https://www.arkosjs.com/docs/core-concepts/sending-emails)\n */\n email?: {\n /**\n * Your email provider url\n */\n host: string;\n /**\n * Email provider SMTP port, Default is `465`\n */\n port?: number;\n /**\n * If smtp connection must be secure, Default is `true`\n */\n secure?: boolean;\n /**\n * Used to authenticate in your smtp server\n */\n auth: {\n /**\n * Email used for auth as well as sending emails\n */\n user: string;\n /**\n * Your SMTP password\n */\n pass: string;\n };\n /**\n * Email name to used like:\n *\n * John Doe\\<john.doe@gmail.com>\n */\n name?: string;\n };\n /**\n * Defines Swagger and OpenApi specifications for auto generating swagger documentation UI using whether it is Prisma Schemas, Class-validator DTOs, Zod Schemas or JSON-Schemas\n *\n * **Usage**\n *\n * ```ts\n * // src/app.ts\n *\n * import arkos from \"arkos\"\n *\n * arkos.init({\n * // other configs\n * swagger: {\n * mode: \"zod\",\n * options: {\n * openapi: \"3.0.0\",\n * title: \"API Generated By Arkos.js\",\n * description: \"This API was automatically generated by Arkos.js read more about at www.arkosjs.com\"\n * }\n * }\n * })\n * ```\n *\n *\n * @see {@link https://www.arkosjs.com/docs/core-concepts/swagger-api-documentation}\n */\n swagger?: {\n /**\n * Endpoint where the Swagger UI will be available.\n *\n * @default \"/api/docs\"\n */\n endpoint?: string;\n /**\n * Determines how your API schemas should be generated.\n *\n * - \"prisma\": Generates schemas based on Prisma models\n * - \"class-validator\": Uses class-validator and class-transformer DTO classes\n * - \"zod`\": Uses OpenAPI-compliant schemas directly\n * - \"json-schema\": Uses OpenAPI-compliant schemas directly\n */\n mode: \"prisma\" | \"class-validator\" | \"zod\" | \"json-schema\";\n /**\n *\n */\n options: {\n /**\n * Swagger definition according to OpenAPI Specification.\n */\n definition: {\n /**\n * OpenAPI version.\n *\n * @default \"3.0.0\"\n */\n openapi?: string;\n\n /**\n * Information about your API.\n */\n info?: {\n /**\n * Title of the API documentation.\n *\n *\n * @example \"My API\"\n *\n * @default \"API Generated By Arkos.js\"\n */\n title?: string;\n\n /**\n * Version of the API.\n *\n * @example \"1.0.0\"\n */\n version?: string;\n\n /**\n * Description of the API.\n *\n * @default \"This API was automatically generated by Arkos.js read more about at www.arkosjs.com\"\n */\n description?: string;\n };\n\n /**\n * Server configurations for the API.\n *\n * @default [{ url: \"http://localhost:8000\", description: \"Local server\" }]\n *\n * This can be overridden automatically by Arkos based on CLI, .env, or `arkos.init()`.\n */\n servers?: {\n /**\n * Base URL of the server.\n *\n * @example \"http://localhost:8000\"\n */\n url: string;\n\n /**\n * Human-readable description of the server.\n *\n * @example \"Development Server\"\n */\n description: string;\n }[];\n\n /**\n * (Optional) Additional metadata such as terms of service, contact, or license.\n *\n * See: https://swagger.io/specification/#infoObject\n */\n termsOfService?: string;\n contact?: {\n name?: string;\n url?: string;\n email?: string;\n };\n license?: {\n name: string;\n url?: string;\n };\n\n /**\n * Tags to group and describe endpoints.\n */\n tags?: {\n name: string;\n description?: string;\n }[];\n\n /**\n * Security definitions (e.g., Bearer Auth).\n */\n components?: {\n securitySchemes?: Record<string, any>;\n schemas?: Record<string, any>;\n };\n\n /**\n * Global security requirements.\n */\n security?: Array<Record<string, string[]>>;\n };\n\n /**\n * Glob patterns defining where Swagger should look for API route definitions and comments.\n *\n * @default \n * ```ts\n * [\"./src/routers/*.router.{ts,js}\", \"./src/modules/**\\/*.router.{ts,js}\"]\n ```\n *\n * Adjust depending on TypeScript or JavaScript usage.\n */\n apis?: string[];\n\n /**\n * Custom Swagger UI options.\n *\n * See: https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md\n */\n swaggerUiOptions?: Record<string, any>;\n\n /**\n * Enables deep linking in the Swagger UI.\n *\n * @default true\n */\n deepLinking?: boolean;\n\n /**\n * Enable/disable the \"Try it out\" button globally.\n *\n * @default true\n */\n tryItOutEnabled?: boolean;\n\n /**\n * Whether to persist authorization data across page reloads.\n *\n * @default false\n */\n persistAuthorization?: boolean;\n };\n };\n};\n"]}
1
+ {"version":3,"file":"arkos-config.js","sourceRoot":"","sources":["../../../src/types/arkos-config.ts"],"names":[],"mappings":"","sourcesContent":["import http from \"http\";\nimport cors from \"cors\";\nimport express from \"express\";\nimport { Options as RateLimitOptions } from \"express-rate-limit\";\nimport cookieParser from \"cookie-parser\";\nimport compression from \"compression\";\nimport { Options as QueryParserOptions } from \"../utils/helpers/query-parser.helpers\";\nimport { ValidatorOptions } from \"class-validator\";\nimport { MsDuration } from \"../modules/auth/utils/helpers/auth.controller.helpers\";\nimport { OpenAPIV3 } from \"openapi-types\";\n\n/**\n * Defines the initial configs of the api to be loaded at startup when arkos.init() is called.\n */\nexport type ArkosConfig = {\n /**\n * Allows to configure request configs\n */\n request?: {\n /**\n * Allows to configure request parameters\n */\n parameters?: {\n /**\n * Toggles allowing `VERY DANGEROUS` request paramateres under `req.query` for passing prisma query options.\n *\n * See more\n */\n allowDangerousPrismaQueryOptions?: boolean;\n };\n };\n /** Message you would like to send, as Json and 200 response when\n * ```curl\n * GET /api\n * ```\n *\n * ```json\n * { \"message\": \"Welcome to YourAppName\" }\n * ```\n *\n * default message is: Welcome to our Rest API generated by Arkos, find more about Arkos at www.arkosjs.com.\n *\n *\n * */\n welcomeMessage?: string;\n /**\n * Port where the application will run, can be set in 3 ways:\n *\n * 1. default is 8000\n * 2. PORT under environment variables (Lower precedence)\n * 3. this config option (Higher precedence)\n */\n port?: number | undefined;\n /**\n * Allows to listen on a different host than localhost only\n */\n host?: string;\n /**\n * Defines authentication related configurations, by default is undefined.\n *\n * See [www.arkosjs.com/docs/core-concepts/built-in-authentication-system](https://www.arkosjs.com/docs/core-concepts/built-in-authentication-system) for details.\n */\n authentication?: {\n /**\n * Defines whether to use Static or Dynamic Role-Based Acess Control\n *\n * Visit [www.arkosjs.com/docs/core-concepts/built-in-authentication-system](https://www.arkosjs.com/docs/core-concepts/built-in-authentication-system) for more details.\n */\n mode: \"static\" | \"dynamic\";\n /**\n * Defines auth login related configurations to customize the api.\n */\n login?: {\n /**\n * Defines the field that will be used as username by the built-in auth system, by default arkos will look for the field \"username\" in your model User, hence when making login for example you must send:\n *\n * ```json\n * {\n * \"username\": \"johndoe\",\n * \"password\": \"somePassword123\"\n * }\n * ```\n *\n * **Note:** You can also modify the usernameField on the fly by passing it to the request query parameters. example:\n *\n * ```curl\n * POST /api/auth/login?usernameField=email\n * ```\n *\n * See more at [www.arkosjs.com/docs/guide/authentication-system/sending-authentication-requests#example-changing-the-username-field](https://www.arkosjs.com/docs/guide/authentication-system/sending-authentication-requests#example-changing-the-username-field)\n *\n * By specifing here another field for username, for example passing \"email\", \"companyCode\" or something else your json will be like:\n *\n * **Example with email**\n *\n * ```json\n * {\n * \"email\": \"john.doe@example.com\",\n * \"password\": \"somePassword123\"\n * }\n * ```\n */\n allowedUsernames?: string[];\n /** Defines wether to send the access token in response after login or only send as cookie, defeault is both.*/\n sendAccessTokenThrough?: \"cookie-only\" | \"response-only\" | \"both\";\n };\n /**\n * Specifies the regex pattern used by the authentication system to enforce password strength requirements.\n *\n * **Important**: If using validation libraries like Zod or class-validator, this will be completely overwritten.\n *\n * **Default**: ```/^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d).+$/``` - Ensures the password contains at least one uppercase letter, one lowercase letter, and one numeric digit.\n *\n * **message**: (Optional) A custom error message to display when the password does not meet the required strength criteria.\n */\n passwordValidation?: { regex: RegExp; message?: string };\n /**\n * Allows to specify the request rate limit for all authentication endpoints but `/api/users/me`.\n * \n * #### Default\n *{\n windowMs: 5000,\n limit: 10,\n standardHeaders: \"draft-7\",\n legacyHeaders: false,\n }\n * \n * Passing an object not overriding all the default options will only\n * cause it to be deepmerged and not actually replace with empty fields\n * \n *@see This is are the options used on the `express-rate-limit` npm package used on epxress. read more about [https://www.npmjs.com/package/express-rate-limit](https://www.npmjs.com/package/express-rate-limit)\n */\n requestRateLimitOptions?: Partial<RateLimitOptions>;\n /**\n * JWT (JSON Web Token) authentication configuration.\n *\n * You can override these values directly in code, or use environment variables:\n *\n * - `JWT_SECRET`: Secret used to sign and verify JWT tokens.\n * - `JWT_EXPIRES_IN`: Duration string or number indicating when the token should expire (e.g. \"30d\", 3600).\n * - `JWT_COOKIE_SECURE`: Whether the cookie is sent only over HTTPS. Default: `true` in production.\n * - `JWT_COOKIE_HTTP_ONLY`: Whether the cookie is HTTP-only. Default: `true`.\n * - `JWT_COOKIE_SAME_SITE`: Can be \"lax\", \"strict\", or \"none\". Defaults to \"lax\" in dev, \"none\" in prod.\n *\n * ⚠️ Values passed here take precedence over environment variables.\n */\n jwt?: {\n /** Secret key used for signing and verifying JWT tokens */\n secret?: string;\n /**\n * Duration after which the JWT token expires.\n * Accepts either a duration string (e.g. \"30d\", \"1h\") or a number in milliseconds.\n * Defaults to \"30d\" if not provided.\n */\n expiresIn?: MsDuration | number;\n\n /**\n * Configuration for the JWT cookie sent to the client\n */\n cookie?: {\n /**\n * Whether the cookie should be marked as secure (sent only over HTTPS).\n * Defaults to `true` in production and `false` in development.\n */\n secure?: boolean;\n\n /**\n * Whether the cookie should be marked as HTTP-only.\n * Default is `true` to prevent access via JavaScript.\n */\n httpOnly?: boolean;\n\n /**\n * Controls the SameSite attribute of the cookie.\n * Defaults to \"none\" in production and \"lax\" in development.\n * Options: \"lax\" | \"strict\" | \"none\"\n */\n sameSite?: \"lax\" | \"strict\" | \"none\";\n };\n };\n };\n /** Allows to customize and toggle the built-in validation, by default it is set to `false`. If true is passed it will use validation with the default resolver set to `class-validator` if you intend to change the resolver to `zod` do the following:\n *\n *```ts\n * // src/app.ts\n * import arkos from 'arkos'\n *\n * arkos.init({\n * validation: {\n * resolver: \"zod\"\n * }\n * })\n * ```\n *\n * @See [www.arkosjs.com/docs/core-concepts/request-data-validation](https://www.arkosjs.com/docs/core-concepts/request-data-validation) for more details.\n */\n validation?:\n | {\n resolver?: \"class-validator\";\n /**\n * ValidatorOptions to used while validating request data.\n *\n * **Default**:\n * ```ts\n * {\n * whitelist: true\n * }\n * ```\n */\n validationOptions?: ValidatorOptions;\n }\n | {\n resolver?: \"zod\";\n validationOptions?: Record<string, any>;\n };\n /**\n * Defines file upload configurations\n *\n * See [www.arkosjs.com/docs/core-concepts/file-upload#costum-configurations](https://www.arkosjs.com/docs/core-concepts/file-upload#costum-configurations)\n */\n fileUpload?: {\n /**\n * Defiens the base file upload directory, default is set to /uploads (on root directory)\n *\n * When setting up a path dir always now that root directory will be the starting reference.\n *\n * #### Example\n * passing `../my-arkos-uploaded-files`\n *\n * Will save uploaded files one level outside the root dir inside `my-arkos-uploaded-files`\n *\n * NB: You must be aware of permissions on your server to acess files outside your project directory.\n *\n */\n baseUploadDir?: string;\n /**\n * Changes the default `/api/uploads` base route for accessing file upload route.\n *\n * #### IMPORTANT\n * Changing this will not affect the `baseUploadDir` folder. You can\n * pass here `/api/files/my-user-files` and `baseUploadDir` be `/uploaded-files`.\n *\n */\n baseRoute?: string;\n /**\n * Defines options for `express.static(somePath, someOptions)`\n *\n * #### Default:\n *\n * ```ts\n *{\n maxAge: \"1y\",\n etag: true,\n lastModified: true,\n dotfiles: \"ignore\",\n fallthrough: true,\n index: false,\n cacheControl: true,\n }\n * ```\n * \n * By passing your custom options have in mind that it\n * will be deepmerged with the default.\n * \n * Visit [https://expressjs.com/en/4x/api.html#express.static](https://expressjs.com/en/4x/api.html#express.static) for more understanding.\n * \n */\n expressStaticOptions?: Parameters<typeof express.static>[1];\n /**\n * Defines upload restrictions for each file type: image, video, document or other.\n *\n * #### Important:\n * Passing an object without overriding everything will only cause it\n * to be deepmerged with the default options.\n *\n * See [www.arkosjs.com/docs/api-reference/default-supported-upload-files](https://www.arkosjs.com/docs/api-reference/default-supported-upload-files) for detailed explanation about default values.\n * ```\n */\n restrictions?: {\n images?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n videos?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n documents?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n files?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n };\n };\n /**\n * Allows to specify the request rate limit for all endpoints.\n * \n * #### Default\n *```ts\n *{\n windowMs: 60 * 1000,\n limit: 1000,\n standardHeaders: \"draft-7\",\n legacyHeaders: false,\n }\n ```\n * \n * Passing an object not overriding all the default options will only\n * cause it to be deepmerged and not actually replace with empty fields\n * \n * This is are the options used on the `express-rate-limit` npm package used on epxress. read more about [https://www.npmjs.com/package/express-rate-limit](https://www.npmjs.com/package/express-rate-limit)\n */\n globalRequestRateLimitOptions?: Partial<RateLimitOptions>;\n /**\n * Defines options for the built-in express.json() middleware\n * Nothing is passed by default.\n */\n jsonBodyParserOptions?: Parameters<typeof express.json>[0];\n /**\n * Allows to pass paremeters to cookieParser from npm package cookie-parser\n * Nothing is passed by default.\n *\n * See [www.npmjs.com/package/cookie-parser](https://www.npmjs.com/package/cookie-parser) for further details.\n */\n cookieParserParameters?: Parameters<typeof cookieParser>;\n /**\n * Allows to define options for npm package compression\n * Nothing is passed by default.\n *\n * See [www.npmjs.com/package/compression](https://www.npmjs.com/package/compression) for further details.\n */\n compressionOptions?: compression.CompressionOptions;\n /**\n * Options to define how query must be parsed.\n *\n * #### for example:\n * ```\n * GET /api/product?saleId=null\n * ```\n *\n * Normally would parsed to { saleId: \"null\" } so query parser\n * trough setting option `parseNull` will transform { saleId: null }\n * \n * #### Default:\n * \n * {\n parseNull: true,\n parseUndefined: true,\n parseBoolean: true,\n }\n * \n * parseNumber may convert fields that are string but you only passed\n * numbers to query pay attention to this.\n * \n * Soon a feature to converted the query to the end prisma type will be added.\n */\n queryParserOptions?: QueryParserOptions;\n /**\n * Configuration for CORS (Cross-Origin Resource Sharing).\n *\n * @property {string | string[] | \"all\"} [allowedOrigins] - List of allowed origins. If set to `\"all\"`, all origins are accepted.\n * @property {import('cors').CorsOptions} [options] - Additional CORS options passed directly to the `cors` middleware.\n * @property {import('cors').CorsOptionsDelegate} [customMiddleware] - A custom middleware function that overrides the default behavior.\n *\n * @remarks\n * If `customMiddleware` is provided, both `allowedOrigins` and `options` will be ignored in favor of the custom logic.\n *\n * See https://www.npmjs.com/package/cors\n */\n cors?: {\n /**\n * Defines allowed origins to acess the API.\n */\n allowedOrigins?: string | string[] | \"*\";\n options?: cors.CorsOptions;\n /**\n * If you would like to override the entire middleware\n *\n * see\n */\n customHandler?: cors.CorsOptionsDelegate;\n };\n /**\n * Defines express/arkos middlewares configurations\n */\n middlewares?: {\n /**\n * Allows to add an array of custom express middlewares into the default middleware stack.\n *\n * **Tip**: If you would like to acess the express app before everthing use `configureApp` and pass a function.\n *\n * **Where will these be placed?**: see [www.arkosjs.com/docs/advanced-guide/replace-or-disable-built-in-middlewares#middleware-execution-order](https://www.arkosjs.com/docs/advanced-guide/replace-or-disable-built-in-middlewares#middleware-execution-order)\n *\n * **Note**: If you want to use custom global error handler middleware use `middlewares.replace.globalErrorHandler`.\n *\n * Read more about The Arkos Middleware Stack at [www.arkosjs.com/docs/the-middleware-stack](https://www.arkosjs.com/docs/the-middleware-stack) for in-depth details.\n */\n additional?: express.RequestHandler[];\n /**\n * An array containing a list of defaults middlewares to be disabled\n *\n * **Caution**: Be careful with this because you may endup breaking your entire application.\n */\n disable?: (\n | \"compression\"\n | \"global-rate-limit\"\n | \"auth-rate-limit\"\n | \"cors\"\n | \"express-json\"\n | \"cookie-parser\"\n | \"query-parser\"\n | \"database-connection\"\n | \"request-logger\"\n | \"global-error-handler\"\n )[];\n /**\n * Allows you to replace each of the built-in middlewares with your own implementation\n *\n * **Caution**: Be careful with this because you may endup breaking your entire application.\n */\n replace?: {\n /**\n * Replace the default compression middleware\n */\n compression?: express.RequestHandler;\n /**\n * Replace the default global rate limit middleware\n */\n globalRateLimit?: express.RequestHandler;\n /**\n * Replace the default authentication rate limit middleware\n */\n authRateLimit?: express.RequestHandler;\n /**\n * Replace the default CORS middleware\n */\n cors?: express.RequestHandler;\n /**\n * Replace the default JSON body parser middleware\n */\n expressJson?: express.RequestHandler;\n /**\n * Replace the default cookie parser middleware\n */\n cookieParser?: express.RequestHandler;\n /**\n * Replace the default query parser middleware\n */\n queryParser?: express.RequestHandler;\n /**\n * Replace the default database connection check middleware\n */\n databaseConnection?: express.RequestHandler;\n /**\n * Replace the default request logger middleware\n */\n requestLogger?: express.RequestHandler;\n /**\n * Replace the default global error handler middleware\n */\n globalErrorHandler?: express.ErrorRequestHandler;\n };\n };\n /**\n * Defines express/arkos routers configurations\n */\n routers?: {\n /**\n * Allows to add an array of custom express routers into the default middleware/router stack.\n *\n * **Where will these be placed?**: see [www.arkosjs.com/docs/advanced-guide/adding-custom-routers](https://www.arkosjs.com/docs/advanced-guide/adding-custom-routers)\n *\n *\n * Read more about The Arkos Middleware Stack at [www.arkosjs.com/docs/the-middleware-stack](https://www.arkosjs.com/docs/the-middleware-stack) for in-depth details.\n */\n additional?: express.Router[];\n disable?: (\n | \"auth-router\"\n | \"prisma-models-router\"\n | \"file-upload\"\n | \"welcome-endpoint\"\n )[];\n /**\n * Allows you to replace each of the built-in routers with your own implementation.\n *\n * **Note**: Doing this you will lose all default middleware chaining, auth control, handlers from the specific router.\n *\n * **Tip**: I you want to disable some prisma models specific endpoint\n * see [www.arkosjs.com/docs/guide/adding-custom-routers#disabling-auto-generated-endpoints](https://www.arkosjs.com/docs/guide/adding-custom-routers#disabling-auto-generated-endpoints)\n *\n * **Caution**: Be careful with this because you may endup breaking your entire application.\n */\n replace?: {\n /**\n * Replace the default authentication router\n * @param config The original Arkos configuration\n * @returns A router handling authentication endpoints\n */\n authRouter?: (\n config: ArkosConfig\n ) => express.Router | Promise<express.Router>;\n /**\n * Replace the default Prisma models router\n * @param config The original Arkos configuration\n * @returns A router handling Prisma model endpoints\n */\n prismaModelsRouter?: (\n config: ArkosConfig\n ) => express.Router | Promise<express.Router>;\n /**\n * Replace the default file upload router\n * @param config The original Arkos configuration\n * @returns A router handling file upload endpoints\n */\n fileUpload?: (\n config: ArkosConfig\n ) => express.Router | Promise<express.Router>;\n /**\n * Replace the default welcome endpoint handler\n * @param req Express request object\n * @param res Express response object\n * @param next Express next function\n */\n welcomeEndpoint?: express.RequestHandler;\n };\n };\n /**\n * Gives acess to the underlying express app so that you can add custom configurations beyong **Arkos** customization capabilities\n *\n * **Note**: In the end **Arkos** will call `app.listen` for you.\n *\n * If you want to call `app.listen` by yourself pass port as `undefined` and then use the return app from `arkos.init()`.\n *\n * See how to call `app.listen` correctly [www.arkosjs.com/docs/guide/accessing-the-express-app#calling-applisten-by-yourself](https://www.arkosjs.com/docs/guide/accessing-the-express-app#calling-applisten-by-yourself)\n *\n * See [www.arkosjs.com/docs/guide/accessing-the-express-app](https://www.arkosjs.com/docs/guide/accessing-the-express-app) for further details on the method configureApp.\n *\n * @param {express.Express} app\n * @returns {any}\n */\n configureApp?: (app: express.Express) => Promise<any> | any;\n /**\n * Gives access to the underlying HTTP server so that you can add custom configurations beyond **Arkos** customization capabilities\n *\n * **Note**: In the end **Arkos** will call `server.listen` for you.\n *\n * If you want to call `server.listen` by yourself pass port as `undefined` and then use the return server from `arkos.init()`.\n *\n * See how to call `server.listen` correctly [www.arkosjs.com/docs/guide/accessing-the-express-app#creating-your-own-http-server](https://www.arkosjs.com/docs/guide/accessing-the-express-app#creating-your-own-http-server)\n *\n * See [www.arkosjs.com/docs/guide/accessing-the-express-app#accessing-the-http-server](https://www.arkosjs.com/docs/guide/accessing-the-express-app#accessing-the-http-server) for further details on the method configureServer.\n *\n * @param {http.Server} server - The HTTP server instance\n * @returns {any}\n */\n configureServer?: (server: http.Server) => Promise<any> | any;\n /**\n * Allows to configure email configurations for sending emails through `emailService`\n *\n * See [www.arkosjs.com/docs/core-concepts/sending-emails](https://www.arkosjs.com/docs/core-concepts/sending-emails)\n */\n email?: {\n /**\n * Your email provider url\n */\n host: string;\n /**\n * Email provider SMTP port, Default is `465`\n */\n port?: number;\n /**\n * If smtp connection must be secure, Default is `true`\n */\n secure?: boolean;\n /**\n * Used to authenticate in your smtp server\n */\n auth: {\n /**\n * Email used for auth as well as sending emails\n */\n user: string;\n /**\n * Your SMTP password\n */\n pass: string;\n };\n /**\n * Email name to used like:\n *\n * John Doe\\<john.doe@gmail.com>\n */\n name?: string;\n };\n /**\n * Defines Swagger and OpenApi specifications for auto generating swagger documentation UI using whether it is Prisma Schemas, Class-validator DTOs, Zod Schemas or JSON-Schemas\n *\n * **Usage**\n *\n * ```ts\n * // src/app.ts\n *\n * import arkos from \"arkos\"\n *\n * arkos.init({\n * // other configs\n * swagger: {\n * mode: \"zod\",\n * options: {\n * openapi: \"3.0.0\",\n * title: \"API Generated By Arkos.js\",\n * description: \"This API was automatically generated by Arkos.js read more about at www.arkosjs.com\"\n * }\n * }\n * })\n * ```\n * @see {@link https://www.arkosjs.com/docs/core-concepts/swagger-api-documentation}\n */\n swagger?: {\n /**\n * By default Arkos will disable API Documentation when the project is built `npm run build`, it does not matter what node environment is set. If you want to use it even after the `arkos build` command just set this to `true`.\n * */\n enableAfterBuild?: boolean;\n /**\n * Endpoint where the Swagger UI will be available.\n *\n * @default \"/api/api-docs\"\n */\n endpoint?: string;\n /**\n * Determines how your API schemas should be generated.\n *\n * - \"prisma\": Generates schemas based on Prisma models\n * - \"class-validator\": Uses class-validator and class-transformer DTO classes\n * - \"zod\": Uses OpenAPI-compliant schemas directly\n */\n mode: \"prisma\" | \"class-validator\" | \"zod\";\n /**\n *\n */\n options?: {\n /**\n * Swagger definition according to OpenAPI Specification.\n */\n definition?: {\n /**\n * OpenAPI version.\n *\n * @default \"3.0.0\"\n */\n openapi?: string;\n\n /**\n * Information about your API.\n */\n info?: {\n /**\n * Title of the API documentation.\n *\n *\n * @example \"My API\"\n *\n * @default \"API Generated By Arkos.js\"\n */\n title?: string;\n\n /**\n * Version of the API.\n *\n * @example \"1.0.0\"\n */\n version?: string;\n\n /**\n * Description of the API.\n *\n * @default \"This API was automatically generated by Arkos.js read more about at www.arkosjs.com\"\n */\n description?: string;\n };\n\n /**\n * Server configurations for the API.\n *\n * @default [{ url: \"http://localhost:8000\", description: \"Development server\" }]\n *\n * This can be overridden automatically by Arkos based on CLI, .env, or `arkos.init()`.\n */\n servers?: {\n /**\n * Base URL of the server.\n *\n * @example \"http://localhost:8000\"\n */\n url: string;\n\n /**\n * Human-readable description of the server.\n *\n * @example \"Development Server\"\n */\n description?: string;\n }[];\n /**\n * Allows adding more paths for your OpenAPI documentation\n *\n * */\n paths?: OpenAPIV3.PathsObject;\n /**\n * (Optional) Additional metadata such as terms of service, contact, or license.\n *\n * See: https://swagger.io/specification/#infoObject\n */\n termsOfService?: string;\n contact?: {\n name?: string;\n url?: string;\n email?: string;\n };\n license?: {\n name: string;\n url?: string;\n };\n\n /**\n * Tags to group and describe endpoints.\n */\n tags?: {\n name: string;\n description?: string;\n }[];\n\n /**\n * Security definitions (e.g., Bearer Auth).\n */\n components?: {\n securitySchemes?: Record<string, any>;\n schemas?: Record<string, any>;\n };\n\n /**\n * Global security requirements.\n */\n security?: Array<Record<string, string[]>>;\n };\n\n /**\n * Glob patterns defining where Swagger should look for API route definitions and comments.\n *\n * @default \n * ```ts\n * [\"./src/routers/*.router.{ts,js}\", \"./src/modules/**\\/*.router.{ts,js}\"]\n ```\n *\n * Adjust depending on TypeScript or JavaScript usage.\n */\n apis?: string[];\n\n /**\n * Custom Swagger UI options.\n *\n * See: https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md\n */\n swaggerUiOptions?: Record<string, any>;\n\n /**\n * Enables deep linking in the Swagger UI.\n *\n * @default true\n */\n deepLinking?: boolean;\n\n /**\n * Enable/disable the \"Try it out\" button globally.\n *\n * @default true\n */\n tryItOutEnabled?: boolean;\n\n /**\n * Whether to persist authorization data across page reloads.\n *\n * @default false\n */\n persistAuthorization?: boolean;\n };\n };\n};\n"]}
@@ -10,26 +10,9 @@ const child_process_1 = require("child_process");
10
10
  const fs_helpers_1 = require("../helpers/fs.helpers");
11
11
  const dotenv_helpers_1 = require("../dotenv.helpers");
12
12
  const cli_helpers_1 = require("./utils/cli.helpers");
13
+ const shared_1 = require("@arkos/shared");
13
14
  const BUILD_DIR = ".build";
14
15
  const MODULE_TYPES = ["cjs", "esm"];
15
- function detectPackageManagerFromUserAgent() {
16
- const userAgent = process.env.npm_config_user_agent || "";
17
- if (userAgent.includes("pnpm"))
18
- return "pnpm";
19
- if (userAgent.includes("yarn"))
20
- return "yarn";
21
- if (userAgent.includes("npm"))
22
- return "npm";
23
- if (userAgent.includes("bun"))
24
- return "bun";
25
- if (userAgent.includes("cnpm"))
26
- return "cnpm";
27
- if (userAgent.includes("corepack"))
28
- return "corepack";
29
- if (userAgent.includes("deno"))
30
- return "deno";
31
- return "npm";
32
- }
33
16
  function buildCommand(options = {}) {
34
17
  const fileExt = (0, fs_helpers_1.getUserFileExtension)();
35
18
  process.env.NODE_ENV = "production";
@@ -49,7 +32,7 @@ function buildCommand(options = {}) {
49
32
  else {
50
33
  buildJavaScriptProject(options, moduleType);
51
34
  }
52
- const packageManger = detectPackageManagerFromUserAgent();
35
+ const packageManger = (0, shared_1.detectPackageManagerFromUserAgent)();
53
36
  console.info(`\n\x1b[1m\x1b[32m Build complete!\x1b[0m\n`);
54
37
  console.info(` \x1b[1mNext step:\x1b[0m`);
55
38
  console.info(` Run it using \x1b[1m\x1b[36m${packageManger} run start\x1b[0m\n`);