@zyno-io/dk-server-foundation 26.216.430

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 (663) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +458 -0
  3. package/dist/devconsole/assets/index-CKF3C3kv.css +1 -0
  4. package/dist/devconsole/assets/index-CsHdomhM.js +27 -0
  5. package/dist/devconsole/index.html +13 -0
  6. package/dist/resources/proto/generated/devconsole/devconsole.d.ts +320 -0
  7. package/dist/resources/proto/generated/devconsole/devconsole.d.ts.map +1 -0
  8. package/dist/resources/proto/generated/devconsole/devconsole.js +3751 -0
  9. package/dist/resources/proto/generated/devconsole/devconsole.js.map +1 -0
  10. package/dist/src/app/base.d.ts +36 -0
  11. package/dist/src/app/base.d.ts.map +1 -0
  12. package/dist/src/app/base.js +240 -0
  13. package/dist/src/app/base.js.map +1 -0
  14. package/dist/src/app/config.d.ts +90 -0
  15. package/dist/src/app/config.d.ts.map +1 -0
  16. package/dist/src/app/config.js +33 -0
  17. package/dist/src/app/config.js.map +1 -0
  18. package/dist/src/app/config.loader.d.ts +14 -0
  19. package/dist/src/app/config.loader.d.ts.map +1 -0
  20. package/dist/src/app/config.loader.js +67 -0
  21. package/dist/src/app/config.loader.js.map +1 -0
  22. package/dist/src/app/const.d.ts +3 -0
  23. package/dist/src/app/const.d.ts.map +1 -0
  24. package/dist/src/app/const.js +6 -0
  25. package/dist/src/app/const.js.map +1 -0
  26. package/dist/src/app/dev.d.ts +7 -0
  27. package/dist/src/app/dev.d.ts.map +1 -0
  28. package/dist/src/app/dev.js +105 -0
  29. package/dist/src/app/dev.js.map +1 -0
  30. package/dist/src/app/index.d.ts +7 -0
  31. package/dist/src/app/index.d.ts.map +1 -0
  32. package/dist/src/app/index.js +12 -0
  33. package/dist/src/app/index.js.map +1 -0
  34. package/dist/src/app/openapi.d.ts +4 -0
  35. package/dist/src/app/openapi.d.ts.map +1 -0
  36. package/dist/src/app/openapi.js +6 -0
  37. package/dist/src/app/openapi.js.map +1 -0
  38. package/dist/src/app/resolver.d.ts +11 -0
  39. package/dist/src/app/resolver.d.ts.map +1 -0
  40. package/dist/src/app/resolver.js +60 -0
  41. package/dist/src/app/resolver.js.map +1 -0
  42. package/dist/src/app/shutdown.d.ts +12 -0
  43. package/dist/src/app/shutdown.d.ts.map +1 -0
  44. package/dist/src/app/shutdown.js +63 -0
  45. package/dist/src/app/shutdown.js.map +1 -0
  46. package/dist/src/app/state.d.ts +16 -0
  47. package/dist/src/app/state.d.ts.map +1 -0
  48. package/dist/src/app/state.js +12 -0
  49. package/dist/src/app/state.js.map +1 -0
  50. package/dist/src/auth/index.d.ts +3 -0
  51. package/dist/src/auth/index.d.ts.map +1 -0
  52. package/dist/src/auth/index.js +6 -0
  53. package/dist/src/auth/index.js.map +1 -0
  54. package/dist/src/auth/jwt.d.ts +76 -0
  55. package/dist/src/auth/jwt.d.ts.map +1 -0
  56. package/dist/src/auth/jwt.js +218 -0
  57. package/dist/src/auth/jwt.js.map +1 -0
  58. package/dist/src/auth/provider.d.ts +15 -0
  59. package/dist/src/auth/provider.d.ts.map +1 -0
  60. package/dist/src/auth/provider.js +50 -0
  61. package/dist/src/auth/provider.js.map +1 -0
  62. package/dist/src/cli/dksf-dev.d.ts +3 -0
  63. package/dist/src/cli/dksf-dev.d.ts.map +1 -0
  64. package/dist/src/cli/dksf-dev.js +408 -0
  65. package/dist/src/cli/dksf-dev.js.map +1 -0
  66. package/dist/src/cli/dksf-gen-proto.d.ts +3 -0
  67. package/dist/src/cli/dksf-gen-proto.d.ts.map +1 -0
  68. package/dist/src/cli/dksf-gen-proto.js +164 -0
  69. package/dist/src/cli/dksf-gen-proto.js.map +1 -0
  70. package/dist/src/cli/dksf-install.d.ts +3 -0
  71. package/dist/src/cli/dksf-install.d.ts.map +1 -0
  72. package/dist/src/cli/dksf-install.js +10 -0
  73. package/dist/src/cli/dksf-install.js.map +1 -0
  74. package/dist/src/cli/dksf-test.d.ts +3 -0
  75. package/dist/src/cli/dksf-test.d.ts.map +1 -0
  76. package/dist/src/cli/dksf-test.js +78 -0
  77. package/dist/src/cli/dksf-test.js.map +1 -0
  78. package/dist/src/cli/dksf-update.d.ts +3 -0
  79. package/dist/src/cli/dksf-update.d.ts.map +1 -0
  80. package/dist/src/cli/dksf-update.js +86 -0
  81. package/dist/src/cli/dksf-update.js.map +1 -0
  82. package/dist/src/database/common.d.ts +84 -0
  83. package/dist/src/database/common.d.ts.map +1 -0
  84. package/dist/src/database/common.js +380 -0
  85. package/dist/src/database/common.js.map +1 -0
  86. package/dist/src/database/dialect.d.ts +10 -0
  87. package/dist/src/database/dialect.d.ts.map +1 -0
  88. package/dist/src/database/dialect.js +56 -0
  89. package/dist/src/database/dialect.js.map +1 -0
  90. package/dist/src/database/entity.d.ts +62 -0
  91. package/dist/src/database/entity.d.ts.map +1 -0
  92. package/dist/src/database/entity.js +198 -0
  93. package/dist/src/database/entity.js.map +1 -0
  94. package/dist/src/database/index.d.ts +8 -0
  95. package/dist/src/database/index.d.ts.map +1 -0
  96. package/dist/src/database/index.js +15 -0
  97. package/dist/src/database/index.js.map +1 -0
  98. package/dist/src/database/migration/MigrationResetCommand.d.ts +9 -0
  99. package/dist/src/database/migration/MigrationResetCommand.d.ts.map +1 -0
  100. package/dist/src/database/migration/MigrationResetCommand.js +75 -0
  101. package/dist/src/database/migration/MigrationResetCommand.js.map +1 -0
  102. package/dist/src/database/migration/MigrationRunCommand.d.ts +11 -0
  103. package/dist/src/database/migration/MigrationRunCommand.d.ts.map +1 -0
  104. package/dist/src/database/migration/MigrationRunCommand.js +118 -0
  105. package/dist/src/database/migration/MigrationRunCommand.js.map +1 -0
  106. package/dist/src/database/migration/characters.d.ts +14 -0
  107. package/dist/src/database/migration/characters.d.ts.map +1 -0
  108. package/dist/src/database/migration/characters.js +56 -0
  109. package/dist/src/database/migration/characters.js.map +1 -0
  110. package/dist/src/database/migration/create/MigrationCreateCommand.d.ts +11 -0
  111. package/dist/src/database/migration/create/MigrationCreateCommand.d.ts.map +1 -0
  112. package/dist/src/database/migration/create/MigrationCreateCommand.js +106 -0
  113. package/dist/src/database/migration/create/MigrationCreateCommand.js.map +1 -0
  114. package/dist/src/database/migration/create/comparator.d.ts +3 -0
  115. package/dist/src/database/migration/create/comparator.d.ts.map +1 -0
  116. package/dist/src/database/migration/create/comparator.js +408 -0
  117. package/dist/src/database/migration/create/comparator.js.map +1 -0
  118. package/dist/src/database/migration/create/db-reader.d.ts +5 -0
  119. package/dist/src/database/migration/create/db-reader.d.ts.map +1 -0
  120. package/dist/src/database/migration/create/db-reader.js +473 -0
  121. package/dist/src/database/migration/create/db-reader.js.map +1 -0
  122. package/dist/src/database/migration/create/ddl-generator.d.ts +3 -0
  123. package/dist/src/database/migration/create/ddl-generator.d.ts.map +1 -0
  124. package/dist/src/database/migration/create/ddl-generator.js +725 -0
  125. package/dist/src/database/migration/create/ddl-generator.js.map +1 -0
  126. package/dist/src/database/migration/create/entity-reader.d.ts +4 -0
  127. package/dist/src/database/migration/create/entity-reader.d.ts.map +1 -0
  128. package/dist/src/database/migration/create/entity-reader.js +417 -0
  129. package/dist/src/database/migration/create/entity-reader.js.map +1 -0
  130. package/dist/src/database/migration/create/file-generator.d.ts +3 -0
  131. package/dist/src/database/migration/create/file-generator.d.ts.map +1 -0
  132. package/dist/src/database/migration/create/file-generator.js +62 -0
  133. package/dist/src/database/migration/create/file-generator.js.map +1 -0
  134. package/dist/src/database/migration/create/prompt.d.ts +4 -0
  135. package/dist/src/database/migration/create/prompt.d.ts.map +1 -0
  136. package/dist/src/database/migration/create/prompt.js +55 -0
  137. package/dist/src/database/migration/create/prompt.js.map +1 -0
  138. package/dist/src/database/migration/create/schema-model.d.ts +109 -0
  139. package/dist/src/database/migration/create/schema-model.d.ts.map +1 -0
  140. package/dist/src/database/migration/create/schema-model.js +24 -0
  141. package/dist/src/database/migration/create/schema-model.js.map +1 -0
  142. package/dist/src/database/migration/helpers.d.ts +3 -0
  143. package/dist/src/database/migration/helpers.d.ts.map +1 -0
  144. package/dist/src/database/migration/helpers.js +13 -0
  145. package/dist/src/database/migration/helpers.js.map +1 -0
  146. package/dist/src/database/migration/index.d.ts +9 -0
  147. package/dist/src/database/migration/index.d.ts.map +1 -0
  148. package/dist/src/database/migration/index.js +43 -0
  149. package/dist/src/database/migration/index.js.map +1 -0
  150. package/dist/src/database/migration/migration.entity.d.ts +8 -0
  151. package/dist/src/database/migration/migration.entity.d.ts.map +1 -0
  152. package/dist/src/database/migration/migration.entity.js +16 -0
  153. package/dist/src/database/migration/migration.entity.js.map +1 -0
  154. package/dist/src/database/mysql.d.ts +16 -0
  155. package/dist/src/database/mysql.d.ts.map +1 -0
  156. package/dist/src/database/mysql.js +140 -0
  157. package/dist/src/database/mysql.js.map +1 -0
  158. package/dist/src/database/postgres.d.ts +16 -0
  159. package/dist/src/database/postgres.d.ts.map +1 -0
  160. package/dist/src/database/postgres.js +91 -0
  161. package/dist/src/database/postgres.js.map +1 -0
  162. package/dist/src/database/types.d.ts +21 -0
  163. package/dist/src/database/types.d.ts.map +1 -0
  164. package/dist/src/database/types.js +27 -0
  165. package/dist/src/database/types.js.map +1 -0
  166. package/dist/src/devconsole/devconsole.controller.d.ts +7 -0
  167. package/dist/src/devconsole/devconsole.controller.d.ts.map +1 -0
  168. package/dist/src/devconsole/devconsole.controller.js +82 -0
  169. package/dist/src/devconsole/devconsole.controller.js.map +1 -0
  170. package/dist/src/devconsole/devconsole.middleware.d.ts +12 -0
  171. package/dist/src/devconsole/devconsole.middleware.d.ts.map +1 -0
  172. package/dist/src/devconsole/devconsole.middleware.js +28 -0
  173. package/dist/src/devconsole/devconsole.middleware.js.map +1 -0
  174. package/dist/src/devconsole/devconsole.srpc.d.ts +14 -0
  175. package/dist/src/devconsole/devconsole.srpc.d.ts.map +1 -0
  176. package/dist/src/devconsole/devconsole.srpc.js +94 -0
  177. package/dist/src/devconsole/devconsole.srpc.js.map +1 -0
  178. package/dist/src/devconsole/devconsole.store.d.ts +101 -0
  179. package/dist/src/devconsole/devconsole.store.d.ts.map +1 -0
  180. package/dist/src/devconsole/devconsole.store.js +125 -0
  181. package/dist/src/devconsole/devconsole.store.js.map +1 -0
  182. package/dist/src/devconsole/devconsole.ws.d.ts +18 -0
  183. package/dist/src/devconsole/devconsole.ws.d.ts.map +1 -0
  184. package/dist/src/devconsole/devconsole.ws.js +470 -0
  185. package/dist/src/devconsole/devconsole.ws.js.map +1 -0
  186. package/dist/src/devconsole/index.d.ts +2 -0
  187. package/dist/src/devconsole/index.d.ts.map +1 -0
  188. package/dist/src/devconsole/index.js +6 -0
  189. package/dist/src/devconsole/index.js.map +1 -0
  190. package/dist/src/devconsole/patches.d.ts +6 -0
  191. package/dist/src/devconsole/patches.d.ts.map +1 -0
  192. package/dist/src/devconsole/patches.js +397 -0
  193. package/dist/src/devconsole/patches.js.map +1 -0
  194. package/dist/src/health/health.module.d.ts +6 -0
  195. package/dist/src/health/health.module.d.ts.map +1 -0
  196. package/dist/src/health/health.module.js +32 -0
  197. package/dist/src/health/health.module.js.map +1 -0
  198. package/dist/src/health/healthcheck.controller.d.ts +10 -0
  199. package/dist/src/health/healthcheck.controller.d.ts.map +1 -0
  200. package/dist/src/health/healthcheck.controller.js +30 -0
  201. package/dist/src/health/healthcheck.controller.js.map +1 -0
  202. package/dist/src/health/healthcheck.service.d.ts +13 -0
  203. package/dist/src/health/healthcheck.service.d.ts.map +1 -0
  204. package/dist/src/health/healthcheck.service.js +33 -0
  205. package/dist/src/health/healthcheck.service.js.map +1 -0
  206. package/dist/src/health/index.d.ts +3 -0
  207. package/dist/src/health/index.d.ts.map +1 -0
  208. package/dist/src/health/index.js +6 -0
  209. package/dist/src/health/index.js.map +1 -0
  210. package/dist/src/helpers/async/context.d.ts +11 -0
  211. package/dist/src/helpers/async/context.d.ts.map +1 -0
  212. package/dist/src/helpers/async/context.js +75 -0
  213. package/dist/src/helpers/async/context.js.map +1 -0
  214. package/dist/src/helpers/async/process.d.ts +16 -0
  215. package/dist/src/helpers/async/process.d.ts.map +1 -0
  216. package/dist/src/helpers/async/process.js +44 -0
  217. package/dist/src/helpers/async/process.js.map +1 -0
  218. package/dist/src/helpers/async/promise.d.ts +5 -0
  219. package/dist/src/helpers/async/promise.d.ts.map +1 -0
  220. package/dist/src/helpers/async/promise.js +27 -0
  221. package/dist/src/helpers/async/promise.js.map +1 -0
  222. package/dist/src/helpers/data/array.d.ts +3 -0
  223. package/dist/src/helpers/data/array.d.ts.map +1 -0
  224. package/dist/src/helpers/data/array.js +17 -0
  225. package/dist/src/helpers/data/array.js.map +1 -0
  226. package/dist/src/helpers/data/objects.d.ts +12 -0
  227. package/dist/src/helpers/data/objects.d.ts.map +1 -0
  228. package/dist/src/helpers/data/objects.js +75 -0
  229. package/dist/src/helpers/data/objects.js.map +1 -0
  230. package/dist/src/helpers/data/serialization.d.ts +4 -0
  231. package/dist/src/helpers/data/serialization.d.ts.map +1 -0
  232. package/dist/src/helpers/data/serialization.js +15 -0
  233. package/dist/src/helpers/data/serialization.js.map +1 -0
  234. package/dist/src/helpers/data/transformer.d.ts +13 -0
  235. package/dist/src/helpers/data/transformer.d.ts.map +1 -0
  236. package/dist/src/helpers/data/transformer.js +55 -0
  237. package/dist/src/helpers/data/transformer.js.map +1 -0
  238. package/dist/src/helpers/framework/decorators.d.ts +5 -0
  239. package/dist/src/helpers/framework/decorators.d.ts.map +1 -0
  240. package/dist/src/helpers/framework/decorators.js +39 -0
  241. package/dist/src/helpers/framework/decorators.js.map +1 -0
  242. package/dist/src/helpers/framework/event.d.ts +3 -0
  243. package/dist/src/helpers/framework/event.d.ts.map +1 -0
  244. package/dist/src/helpers/framework/event.js +20 -0
  245. package/dist/src/helpers/framework/event.js.map +1 -0
  246. package/dist/src/helpers/framework/injection.d.ts +7 -0
  247. package/dist/src/helpers/framework/injection.d.ts.map +1 -0
  248. package/dist/src/helpers/framework/injection.js +52 -0
  249. package/dist/src/helpers/framework/injection.js.map +1 -0
  250. package/dist/src/helpers/index.d.ts +22 -0
  251. package/dist/src/helpers/index.d.ts.map +1 -0
  252. package/dist/src/helpers/index.js +32 -0
  253. package/dist/src/helpers/index.js.map +1 -0
  254. package/dist/src/helpers/io/package.d.ts +5 -0
  255. package/dist/src/helpers/io/package.d.ts.map +1 -0
  256. package/dist/src/helpers/io/package.js +31 -0
  257. package/dist/src/helpers/io/package.js.map +1 -0
  258. package/dist/src/helpers/io/stream.d.ts +18 -0
  259. package/dist/src/helpers/io/stream.d.ts.map +1 -0
  260. package/dist/src/helpers/io/stream.js +91 -0
  261. package/dist/src/helpers/io/stream.js.map +1 -0
  262. package/dist/src/helpers/redis/broadcast.d.ts +13 -0
  263. package/dist/src/helpers/redis/broadcast.d.ts.map +1 -0
  264. package/dist/src/helpers/redis/broadcast.js +100 -0
  265. package/dist/src/helpers/redis/broadcast.js.map +1 -0
  266. package/dist/src/helpers/redis/cache.d.ts +7 -0
  267. package/dist/src/helpers/redis/cache.d.ts.map +1 -0
  268. package/dist/src/helpers/redis/cache.js +28 -0
  269. package/dist/src/helpers/redis/cache.js.map +1 -0
  270. package/dist/src/helpers/redis/mutex.d.ts +24 -0
  271. package/dist/src/helpers/redis/mutex.d.ts.map +1 -0
  272. package/dist/src/helpers/redis/mutex.js +240 -0
  273. package/dist/src/helpers/redis/mutex.js.map +1 -0
  274. package/dist/src/helpers/redis/redis.d.ts +11 -0
  275. package/dist/src/helpers/redis/redis.d.ts.map +1 -0
  276. package/dist/src/helpers/redis/redis.js +59 -0
  277. package/dist/src/helpers/redis/redis.js.map +1 -0
  278. package/dist/src/helpers/security/crypto.d.ts +26 -0
  279. package/dist/src/helpers/security/crypto.d.ts.map +1 -0
  280. package/dist/src/helpers/security/crypto.js +121 -0
  281. package/dist/src/helpers/security/crypto.js.map +1 -0
  282. package/dist/src/helpers/security/validation.d.ts +4 -0
  283. package/dist/src/helpers/security/validation.d.ts.map +1 -0
  284. package/dist/src/helpers/security/validation.js +25 -0
  285. package/dist/src/helpers/security/validation.js.map +1 -0
  286. package/dist/src/helpers/utils/date.d.ts +4 -0
  287. package/dist/src/helpers/utils/date.d.ts.map +1 -0
  288. package/dist/src/helpers/utils/date.js +23 -0
  289. package/dist/src/helpers/utils/date.js.map +1 -0
  290. package/dist/src/helpers/utils/error.d.ts +24 -0
  291. package/dist/src/helpers/utils/error.d.ts.map +1 -0
  292. package/dist/src/helpers/utils/error.js +168 -0
  293. package/dist/src/helpers/utils/error.js.map +1 -0
  294. package/dist/src/helpers/utils/jsx.d.ts +3 -0
  295. package/dist/src/helpers/utils/jsx.d.ts.map +1 -0
  296. package/dist/src/helpers/utils/jsx.js +13 -0
  297. package/dist/src/helpers/utils/jsx.js.map +1 -0
  298. package/dist/src/helpers/utils/uuid.d.ts +3 -0
  299. package/dist/src/helpers/utils/uuid.d.ts.map +1 -0
  300. package/dist/src/helpers/utils/uuid.js +14 -0
  301. package/dist/src/helpers/utils/uuid.js.map +1 -0
  302. package/dist/src/http/auth.d.ts +46 -0
  303. package/dist/src/http/auth.d.ts.map +1 -0
  304. package/dist/src/http/auth.js +162 -0
  305. package/dist/src/http/auth.js.map +1 -0
  306. package/dist/src/http/context.d.ts +5 -0
  307. package/dist/src/http/context.d.ts.map +1 -0
  308. package/dist/src/http/context.js +22 -0
  309. package/dist/src/http/context.js.map +1 -0
  310. package/dist/src/http/cors.d.ts +36 -0
  311. package/dist/src/http/cors.d.ts.map +1 -0
  312. package/dist/src/http/cors.js +171 -0
  313. package/dist/src/http/cors.js.map +1 -0
  314. package/dist/src/http/errors.d.ts +3 -0
  315. package/dist/src/http/errors.d.ts.map +1 -0
  316. package/dist/src/http/errors.js +10 -0
  317. package/dist/src/http/errors.js.map +1 -0
  318. package/dist/src/http/index.d.ts +24 -0
  319. package/dist/src/http/index.d.ts.map +1 -0
  320. package/dist/src/http/index.js +25 -0
  321. package/dist/src/http/index.js.map +1 -0
  322. package/dist/src/http/kernel.d.ts +17 -0
  323. package/dist/src/http/kernel.d.ts.map +1 -0
  324. package/dist/src/http/kernel.js +133 -0
  325. package/dist/src/http/kernel.js.map +1 -0
  326. package/dist/src/http/middleware.d.ts +12 -0
  327. package/dist/src/http/middleware.d.ts.map +1 -0
  328. package/dist/src/http/middleware.js +61 -0
  329. package/dist/src/http/middleware.js.map +1 -0
  330. package/dist/src/http/overrides.d.ts +2 -0
  331. package/dist/src/http/overrides.d.ts.map +1 -0
  332. package/dist/src/http/overrides.js +19 -0
  333. package/dist/src/http/overrides.js.map +1 -0
  334. package/dist/src/http/store.d.ts +33 -0
  335. package/dist/src/http/store.d.ts.map +1 -0
  336. package/dist/src/http/store.js +102 -0
  337. package/dist/src/http/store.js.map +1 -0
  338. package/dist/src/http/uploads.d.ts +7 -0
  339. package/dist/src/http/uploads.d.ts.map +1 -0
  340. package/dist/src/http/uploads.js +8 -0
  341. package/dist/src/http/uploads.js.map +1 -0
  342. package/dist/src/http/workflow.d.ts +18 -0
  343. package/dist/src/http/workflow.d.ts.map +1 -0
  344. package/dist/src/http/workflow.js +181 -0
  345. package/dist/src/http/workflow.js.map +1 -0
  346. package/dist/src/index.d.ts +13 -0
  347. package/dist/src/index.d.ts.map +1 -0
  348. package/dist/src/index.js +25 -0
  349. package/dist/src/index.js.map +1 -0
  350. package/dist/src/services/cli/invoke.d.ts +5 -0
  351. package/dist/src/services/cli/invoke.d.ts.map +1 -0
  352. package/dist/src/services/cli/invoke.js +45 -0
  353. package/dist/src/services/cli/invoke.js.map +1 -0
  354. package/dist/src/services/cli/repl-context.d.ts +13 -0
  355. package/dist/src/services/cli/repl-context.d.ts.map +1 -0
  356. package/dist/src/services/cli/repl-context.js +60 -0
  357. package/dist/src/services/cli/repl-context.js.map +1 -0
  358. package/dist/src/services/cli/repl.d.ts +5 -0
  359. package/dist/src/services/cli/repl.d.ts.map +1 -0
  360. package/dist/src/services/cli/repl.js +32 -0
  361. package/dist/src/services/cli/repl.js.map +1 -0
  362. package/dist/src/services/cli.d.ts +12 -0
  363. package/dist/src/services/cli.d.ts.map +1 -0
  364. package/dist/src/services/cli.js +76 -0
  365. package/dist/src/services/cli.js.map +1 -0
  366. package/dist/src/services/index.d.ts +7 -0
  367. package/dist/src/services/index.d.ts.map +1 -0
  368. package/dist/src/services/index.js +10 -0
  369. package/dist/src/services/index.js.map +1 -0
  370. package/dist/src/services/leader.d.ts +32 -0
  371. package/dist/src/services/leader.d.ts.map +1 -0
  372. package/dist/src/services/leader.js +174 -0
  373. package/dist/src/services/leader.js.map +1 -0
  374. package/dist/src/services/logger.d.ts +35 -0
  375. package/dist/src/services/logger.d.ts.map +1 -0
  376. package/dist/src/services/logger.js +245 -0
  377. package/dist/src/services/logger.js.map +1 -0
  378. package/dist/src/services/mail/index.d.ts +61 -0
  379. package/dist/src/services/mail/index.d.ts.map +1 -0
  380. package/dist/src/services/mail/index.js +90 -0
  381. package/dist/src/services/mail/index.js.map +1 -0
  382. package/dist/src/services/mail/postmark.d.ts +11 -0
  383. package/dist/src/services/mail/postmark.d.ts.map +1 -0
  384. package/dist/src/services/mail/postmark.js +42 -0
  385. package/dist/src/services/mail/postmark.js.map +1 -0
  386. package/dist/src/services/mail/smtp.d.ts +11 -0
  387. package/dist/src/services/mail/smtp.d.ts.map +1 -0
  388. package/dist/src/services/mail/smtp.js +61 -0
  389. package/dist/src/services/mail/smtp.js.map +1 -0
  390. package/dist/src/services/mesh.d.ts +65 -0
  391. package/dist/src/services/mesh.d.ts.map +1 -0
  392. package/dist/src/services/mesh.js +422 -0
  393. package/dist/src/services/mesh.js.map +1 -0
  394. package/dist/src/services/worker/bootstrap.d.ts +3 -0
  395. package/dist/src/services/worker/bootstrap.d.ts.map +1 -0
  396. package/dist/src/services/worker/bootstrap.js +64 -0
  397. package/dist/src/services/worker/bootstrap.js.map +1 -0
  398. package/dist/src/services/worker/cli.d.ts +11 -0
  399. package/dist/src/services/worker/cli.d.ts.map +1 -0
  400. package/dist/src/services/worker/cli.js +43 -0
  401. package/dist/src/services/worker/cli.js.map +1 -0
  402. package/dist/src/services/worker/entity.d.ts +18 -0
  403. package/dist/src/services/worker/entity.d.ts.map +1 -0
  404. package/dist/src/services/worker/entity.js +16 -0
  405. package/dist/src/services/worker/entity.js.map +1 -0
  406. package/dist/src/services/worker/index.d.ts +9 -0
  407. package/dist/src/services/worker/index.d.ts.map +1 -0
  408. package/dist/src/services/worker/index.js +40 -0
  409. package/dist/src/services/worker/index.js.map +1 -0
  410. package/dist/src/services/worker/queue.d.ts +8 -0
  411. package/dist/src/services/worker/queue.d.ts.map +1 -0
  412. package/dist/src/services/worker/queue.js +32 -0
  413. package/dist/src/services/worker/queue.js.map +1 -0
  414. package/dist/src/services/worker/recorder.d.ts +16 -0
  415. package/dist/src/services/worker/recorder.d.ts.map +1 -0
  416. package/dist/src/services/worker/recorder.js +168 -0
  417. package/dist/src/services/worker/recorder.js.map +1 -0
  418. package/dist/src/services/worker/runner.d.ts +21 -0
  419. package/dist/src/services/worker/runner.d.ts.map +1 -0
  420. package/dist/src/services/worker/runner.js +156 -0
  421. package/dist/src/services/worker/runner.js.map +1 -0
  422. package/dist/src/services/worker/types.d.ts +26 -0
  423. package/dist/src/services/worker/types.d.ts.map +1 -0
  424. package/dist/src/services/worker/types.js +29 -0
  425. package/dist/src/services/worker/types.js.map +1 -0
  426. package/dist/src/srpc/SrpcByteStream.d.ts +67 -0
  427. package/dist/src/srpc/SrpcByteStream.d.ts.map +1 -0
  428. package/dist/src/srpc/SrpcByteStream.js +319 -0
  429. package/dist/src/srpc/SrpcByteStream.js.map +1 -0
  430. package/dist/src/srpc/SrpcClient.d.ts +75 -0
  431. package/dist/src/srpc/SrpcClient.d.ts.map +1 -0
  432. package/dist/src/srpc/SrpcClient.js +445 -0
  433. package/dist/src/srpc/SrpcClient.js.map +1 -0
  434. package/dist/src/srpc/SrpcServer.d.ts +80 -0
  435. package/dist/src/srpc/SrpcServer.d.ts.map +1 -0
  436. package/dist/src/srpc/SrpcServer.js +561 -0
  437. package/dist/src/srpc/SrpcServer.js.map +1 -0
  438. package/dist/src/srpc/index.d.ts +7 -0
  439. package/dist/src/srpc/index.d.ts.map +1 -0
  440. package/dist/src/srpc/index.js +12 -0
  441. package/dist/src/srpc/index.js.map +1 -0
  442. package/dist/src/srpc/types.d.ts +131 -0
  443. package/dist/src/srpc/types.d.ts.map +1 -0
  444. package/dist/src/srpc/types.js +65 -0
  445. package/dist/src/srpc/types.js.map +1 -0
  446. package/dist/src/telemetry/index.d.ts +2 -0
  447. package/dist/src/telemetry/index.d.ts.map +1 -0
  448. package/dist/src/telemetry/index.js +5 -0
  449. package/dist/src/telemetry/index.js.map +1 -0
  450. package/dist/src/telemetry/otel/MariaDBInstrumentation.d.ts +22 -0
  451. package/dist/src/telemetry/otel/MariaDBInstrumentation.d.ts.map +1 -0
  452. package/dist/src/telemetry/otel/MariaDBInstrumentation.js +248 -0
  453. package/dist/src/telemetry/otel/MariaDBInstrumentation.js.map +1 -0
  454. package/dist/src/telemetry/otel/helpers.d.ts +27 -0
  455. package/dist/src/telemetry/otel/helpers.d.ts.map +1 -0
  456. package/dist/src/telemetry/otel/helpers.js +126 -0
  457. package/dist/src/telemetry/otel/helpers.js.map +1 -0
  458. package/dist/src/telemetry/otel/index.d.ts +14 -0
  459. package/dist/src/telemetry/otel/index.d.ts.map +1 -0
  460. package/dist/src/telemetry/otel/index.js +132 -0
  461. package/dist/src/telemetry/otel/index.js.map +1 -0
  462. package/dist/src/telemetry/otel/metrics.controller.d.ts +6 -0
  463. package/dist/src/telemetry/otel/metrics.controller.d.ts.map +1 -0
  464. package/dist/src/telemetry/otel/metrics.controller.js +63 -0
  465. package/dist/src/telemetry/otel/metrics.controller.js.map +1 -0
  466. package/dist/src/telemetry/sentry.d.ts +9 -0
  467. package/dist/src/telemetry/sentry.d.ts.map +1 -0
  468. package/dist/src/telemetry/sentry.js +62 -0
  469. package/dist/src/telemetry/sentry.js.map +1 -0
  470. package/dist/src/testing/expect.d.ts +25 -0
  471. package/dist/src/testing/expect.d.ts.map +1 -0
  472. package/dist/src/testing/expect.js +151 -0
  473. package/dist/src/testing/expect.js.map +1 -0
  474. package/dist/src/testing/fixtures.d.ts +19 -0
  475. package/dist/src/testing/fixtures.d.ts.map +1 -0
  476. package/dist/src/testing/fixtures.js +69 -0
  477. package/dist/src/testing/fixtures.js.map +1 -0
  478. package/dist/src/testing/index.d.ts +260 -0
  479. package/dist/src/testing/index.d.ts.map +1 -0
  480. package/dist/src/testing/index.js +345 -0
  481. package/dist/src/testing/index.js.map +1 -0
  482. package/dist/src/testing/requests.d.ts +10 -0
  483. package/dist/src/testing/requests.d.ts.map +1 -0
  484. package/dist/src/testing/requests.js +56 -0
  485. package/dist/src/testing/requests.js.map +1 -0
  486. package/dist/src/testing/sql.d.ts +11 -0
  487. package/dist/src/testing/sql.d.ts.map +1 -0
  488. package/dist/src/testing/sql.js +55 -0
  489. package/dist/src/testing/sql.js.map +1 -0
  490. package/dist/src/types/index.d.ts +57 -0
  491. package/dist/src/types/index.d.ts.map +1 -0
  492. package/dist/src/types/index.js +73 -0
  493. package/dist/src/types/index.js.map +1 -0
  494. package/dist/src/types/phone.d.ts +11 -0
  495. package/dist/src/types/phone.d.ts.map +1 -0
  496. package/dist/src/types/phone.js +73 -0
  497. package/dist/src/types/phone.js.map +1 -0
  498. package/docs/.vitepress/config.mts +79 -0
  499. package/docs/.yarnrc.yml +1 -0
  500. package/docs/content/CONTRIBUTING.md +140 -0
  501. package/docs/content/README-DEV.md +142 -0
  502. package/docs/content/README.md +39 -0
  503. package/docs/content/authentication.md +215 -0
  504. package/docs/content/cli.md +335 -0
  505. package/docs/content/configuration.md +175 -0
  506. package/docs/content/database.md +422 -0
  507. package/docs/content/devconsole.md +123 -0
  508. package/docs/content/getting-started.md +154 -0
  509. package/docs/content/guides/test-migration-guide.md +351 -0
  510. package/docs/content/health.md +54 -0
  511. package/docs/content/helpers.md +322 -0
  512. package/docs/content/http.md +253 -0
  513. package/docs/content/index.md +147 -0
  514. package/docs/content/leader-service.md +98 -0
  515. package/docs/content/logging.md +150 -0
  516. package/docs/content/mail.md +161 -0
  517. package/docs/content/mesh-service.md +204 -0
  518. package/docs/content/public/images/devconsole/01-dashboard.png +0 -0
  519. package/docs/content/public/images/devconsole/02-routes.png +0 -0
  520. package/docs/content/public/images/devconsole/03-openapi.png +0 -0
  521. package/docs/content/public/images/devconsole/04-requests.png +0 -0
  522. package/docs/content/public/images/devconsole/05-srpc.png +0 -0
  523. package/docs/content/public/images/devconsole/06-database.png +0 -0
  524. package/docs/content/public/images/devconsole/07-health.png +0 -0
  525. package/docs/content/public/images/devconsole/08-mutex.png +0 -0
  526. package/docs/content/public/images/devconsole/09-repl.png +0 -0
  527. package/docs/content/public/images/devconsole/10-workers.png +0 -0
  528. package/docs/content/redis.md +168 -0
  529. package/docs/content/srpc.md +261 -0
  530. package/docs/content/telemetry.md +166 -0
  531. package/docs/content/testing.md +222 -0
  532. package/docs/content/types.md +215 -0
  533. package/docs/content/worker.md +177 -0
  534. package/docs/package.json +16 -0
  535. package/docs/scripts/README-SCREENSHOTS.md +145 -0
  536. package/docs/scripts/capture-devconsole-screenshots.js +184 -0
  537. package/docs/yarn.lock +2408 -0
  538. package/package.json +144 -0
  539. package/patches/@deepkit+type+1.0.19.patch +38 -0
  540. package/patches/deepkit-openapi-core+0.0.9.patch +62 -0
  541. package/src/app/base.ts +253 -0
  542. package/src/app/config.loader.ts +66 -0
  543. package/src/app/config.ts +119 -0
  544. package/src/app/const.ts +4 -0
  545. package/src/app/dev.ts +92 -0
  546. package/src/app/index.ts +6 -0
  547. package/src/app/openapi.ts +3 -0
  548. package/src/app/resolver.ts +49 -0
  549. package/src/app/shutdown.ts +55 -0
  550. package/src/app/state.ts +19 -0
  551. package/src/auth/index.ts +2 -0
  552. package/src/auth/jwt.ts +275 -0
  553. package/src/auth/provider.ts +57 -0
  554. package/src/cli/dksf-dev.ts +416 -0
  555. package/src/cli/dksf-gen-proto.ts +176 -0
  556. package/src/cli/dksf-install.ts +11 -0
  557. package/src/cli/dksf-test.ts +84 -0
  558. package/src/cli/dksf-update.ts +101 -0
  559. package/src/database/common.ts +385 -0
  560. package/src/database/dialect.ts +43 -0
  561. package/src/database/entity.ts +285 -0
  562. package/src/database/index.ts +7 -0
  563. package/src/database/migration/MigrationResetCommand.ts +72 -0
  564. package/src/database/migration/MigrationRunCommand.ts +118 -0
  565. package/src/database/migration/characters.ts +53 -0
  566. package/src/database/migration/create/MigrationCreateCommand.ts +96 -0
  567. package/src/database/migration/create/comparator.ts +467 -0
  568. package/src/database/migration/create/db-reader.ts +510 -0
  569. package/src/database/migration/create/ddl-generator.ts +755 -0
  570. package/src/database/migration/create/entity-reader.ts +471 -0
  571. package/src/database/migration/create/file-generator.ts +57 -0
  572. package/src/database/migration/create/prompt.ts +49 -0
  573. package/src/database/migration/create/schema-model.ts +102 -0
  574. package/src/database/migration/helpers.ts +7 -0
  575. package/src/database/migration/index.ts +35 -0
  576. package/src/database/migration/migration.entity.ts +10 -0
  577. package/src/database/mysql.ts +140 -0
  578. package/src/database/postgres.ts +97 -0
  579. package/src/database/types.ts +18 -0
  580. package/src/devconsole/devconsole.controller.ts +59 -0
  581. package/src/devconsole/devconsole.middleware.ts +23 -0
  582. package/src/devconsole/devconsole.srpc.ts +94 -0
  583. package/src/devconsole/devconsole.store.ts +190 -0
  584. package/src/devconsole/devconsole.ws.ts +491 -0
  585. package/src/devconsole/index.ts +1 -0
  586. package/src/devconsole/patches.ts +428 -0
  587. package/src/health/health.module.ts +30 -0
  588. package/src/health/healthcheck.controller.ts +17 -0
  589. package/src/health/healthcheck.service.ts +28 -0
  590. package/src/health/index.ts +2 -0
  591. package/src/helpers/async/context.ts +67 -0
  592. package/src/helpers/async/process.ts +49 -0
  593. package/src/helpers/async/promise.ts +16 -0
  594. package/src/helpers/data/array.ts +11 -0
  595. package/src/helpers/data/objects.ts +64 -0
  596. package/src/helpers/data/serialization.ts +11 -0
  597. package/src/helpers/data/transformer.ts +54 -0
  598. package/src/helpers/framework/decorators.ts +27 -0
  599. package/src/helpers/framework/event.ts +11 -0
  600. package/src/helpers/framework/injection.ts +47 -0
  601. package/src/helpers/index.ts +34 -0
  602. package/src/helpers/io/package.ts +26 -0
  603. package/src/helpers/io/stream.ts +79 -0
  604. package/src/helpers/redis/broadcast.ts +96 -0
  605. package/src/helpers/redis/cache.ts +28 -0
  606. package/src/helpers/redis/mutex.ts +260 -0
  607. package/src/helpers/redis/redis.ts +60 -0
  608. package/src/helpers/security/crypto.ts +133 -0
  609. package/src/helpers/security/validation.ts +16 -0
  610. package/src/helpers/utils/date.ts +13 -0
  611. package/src/helpers/utils/error.ts +155 -0
  612. package/src/helpers/utils/jsx.ts +8 -0
  613. package/src/helpers/utils/uuid.ts +8 -0
  614. package/src/http/auth.ts +156 -0
  615. package/src/http/context.ts +15 -0
  616. package/src/http/cors.ts +159 -0
  617. package/src/http/errors.ts +9 -0
  618. package/src/http/index.ts +19 -0
  619. package/src/http/kernel.ts +138 -0
  620. package/src/http/middleware.ts +59 -0
  621. package/src/http/overrides.ts +20 -0
  622. package/src/http/store.ts +86 -0
  623. package/src/http/uploads.ts +6 -0
  624. package/src/http/workflow.ts +167 -0
  625. package/src/index.ts +19 -0
  626. package/src/services/cli/invoke.ts +39 -0
  627. package/src/services/cli/repl-context.ts +63 -0
  628. package/src/services/cli/repl.ts +22 -0
  629. package/src/services/cli.ts +74 -0
  630. package/src/services/index.ts +6 -0
  631. package/src/services/leader.ts +201 -0
  632. package/src/services/logger.ts +258 -0
  633. package/src/services/mail/index.ts +117 -0
  634. package/src/services/mail/postmark.ts +37 -0
  635. package/src/services/mail/smtp.ts +46 -0
  636. package/src/services/mesh.ts +508 -0
  637. package/src/services/worker/bootstrap.ts +53 -0
  638. package/src/services/worker/cli.ts +32 -0
  639. package/src/services/worker/entity.ts +22 -0
  640. package/src/services/worker/index.ts +30 -0
  641. package/src/services/worker/queue.ts +35 -0
  642. package/src/services/worker/recorder.ts +172 -0
  643. package/src/services/worker/runner.ts +179 -0
  644. package/src/services/worker/types.ts +32 -0
  645. package/src/srpc/SrpcByteStream.ts +382 -0
  646. package/src/srpc/SrpcClient.ts +512 -0
  647. package/src/srpc/SrpcServer.ts +681 -0
  648. package/src/srpc/index.ts +15 -0
  649. package/src/srpc/types.ts +146 -0
  650. package/src/telemetry/index.ts +1 -0
  651. package/src/telemetry/otel/MariaDBInstrumentation.ts +297 -0
  652. package/src/telemetry/otel/helpers.ts +117 -0
  653. package/src/telemetry/otel/index.ts +150 -0
  654. package/src/telemetry/otel/metrics.controller.ts +50 -0
  655. package/src/telemetry/sentry.ts +58 -0
  656. package/src/testing/expect.ts +148 -0
  657. package/src/testing/fixtures.ts +62 -0
  658. package/src/testing/index.ts +355 -0
  659. package/src/testing/requests.ts +68 -0
  660. package/src/testing/sql.ts +50 -0
  661. package/src/types/index.ts +64 -0
  662. package/src/types/phone.ts +64 -0
  663. package/types.d.ts +20 -0
@@ -0,0 +1,123 @@
1
+ # DevConsole
2
+
3
+ A built-in web dashboard for development-time monitoring and debugging. Automatically enabled when `APP_ENV !== 'production'` and accessible at `http://localhost:{PORT}/_devconsole/`.
4
+
5
+ DevConsole is zero-config, localhost-only, and requires no additional setup beyond running your app in development mode.
6
+
7
+ ## Screenshots
8
+
9
+ ### Dashboard
10
+ ![DevConsole Dashboard](/images/devconsole/01-dashboard.png)
11
+
12
+ ### Routes
13
+ ![DevConsole Routes](/images/devconsole/02-routes.png)
14
+
15
+ ### OpenAPI Schema
16
+ ![DevConsole OpenAPI](/images/devconsole/03-openapi.png)
17
+
18
+ ### HTTP Requests
19
+ ![DevConsole Requests](/images/devconsole/04-requests.png)
20
+
21
+ ### SRPC
22
+ ![DevConsole SRPC](/images/devconsole/05-srpc.png)
23
+
24
+ ### Database
25
+ ![DevConsole Database](/images/devconsole/06-database.png)
26
+
27
+ ### Health Checks
28
+ ![DevConsole Health](/images/devconsole/07-health.png)
29
+
30
+ ### Mutex Monitor
31
+ ![DevConsole Mutex](/images/devconsole/08-mutex.png)
32
+
33
+ ### Interactive REPL
34
+ ![DevConsole REPL](/images/devconsole/09-repl.png)
35
+
36
+ ### Workers
37
+ ![DevConsole Workers](/images/devconsole/10-workers.png)
38
+
39
+ ## Views
40
+
41
+ ### Dashboard
42
+
43
+ App overview showing name, version, environment, uptime, and real-time statistics (HTTP request count, SRPC connections/messages). Also displays process info: PID, Node version, platform, CPU usage, and memory consumption.
44
+
45
+ ### Routes
46
+
47
+ Lists all registered HTTP routes with their methods, paths, controller class, and handler method. Internal `/_devconsole` routes are excluded.
48
+
49
+ ### OpenAPI
50
+
51
+ Displays the OpenAPI schema generated from your HTTP routes. The schema is generated on-demand from route metadata via `deepkit-openapi-core`.
52
+
53
+ ### Requests
54
+
55
+ HTTP request inspector capturing the last 500 requests. Shows timestamp, method, URL, status code, duration, and remote address. Expanding a request reveals full request/response headers and bodies (up to 32KB), plus error details with stack traces for failed requests. New requests appear in real time.
56
+
57
+ ### SRPC
58
+
59
+ SRPC connection monitor showing active connections (client ID, stream ID, app version, address, uptime, ping, message count) and recent disconnections. Includes a message-level inspector (last 500 messages) showing type, direction, request ID, reply status, and errors. Messages can be filtered by stream ID.
60
+
61
+ ### Database
62
+
63
+ Entity browser listing all registered ORM entities with table names and columns. Includes a SQL query editor — `SELECT` queries return result rows, while `INSERT`/`UPDATE`/`DELETE` return affected row counts. Execute with Ctrl+Enter.
64
+
65
+ ### Health
66
+
67
+ Displays results from all registered health checks with status (ok/error) and error messages.
68
+
69
+ ### Mutex
70
+
71
+ Redis mutex monitor showing active mutexes (key, status, timing) and a history of the last 200 completed/failed acquisitions with wait and hold duration metrics.
72
+
73
+ ### REPL
74
+
75
+ Interactive JavaScript REPL running in the server's context. Access DI-registered classes via `$` and instances via `$$`. Supports Tab-completion, command history (arrow keys), and multiline input (Shift+Enter). Console output (`log`, `warn`, `error`) is captured and displayed.
76
+
77
+ ### Environment
78
+
79
+ Displays application configuration from the config class. Keys containing `SECRET`, `PASSWORD`, `DSN`, `TOKEN`, or `KEY` are masked.
80
+
81
+ ### Workers
82
+
83
+ BullMQ job inspector showing queue statistics (active, waiting, delayed, completed, failed counts), live jobs, and job history (last 200 from the `_jobs` table).
84
+
85
+ ## Architecture
86
+
87
+ ### Transport
88
+
89
+ DevConsole uses SRPC over WebSocket (`/_devconsole/ws`) for bidirectional communication. The protocol is defined in `resources/proto/devconsole.proto` and uses Protocol Buffers for encoding.
90
+
91
+ Real-time events (new HTTP requests, SRPC messages, mutex state changes, worker jobs) are pushed from server to client without polling.
92
+
93
+ ### Security
94
+
95
+ Access is restricted to localhost connections only. The `DevConsoleLocalhostMiddleware` checks that the request originates from `127.0.0.1` or `::1` using the socket's `remoteAddress` (not proxy headers). SRPC authentication is bypassed for DevConsole connections.
96
+
97
+ ### How It Works
98
+
99
+ DevConsole initializes via `initDevConsole()` in `src/devconsole/patches.ts`, which monkey-patches core framework components to intercept events:
100
+
101
+ - **HTTP Kernel** — captures request/response data for the Requests view
102
+ - **HTTP Workflow** — captures controller errors
103
+ - **SRPC Client & Server** — observes messages and connection lifecycle
104
+ - **Worker Recorder** — listens to BullMQ job events
105
+ - **Mutex (`withMutex`)** — tracks mutex acquisitions and releases
106
+
107
+ Captured data is stored in ring buffers (`DevConsoleStore`) for bounded memory usage.
108
+
109
+ ### Frontend
110
+
111
+ The frontend is a Vue 3 SPA built with Vite. Source lives in `devconsole/` and builds to `dist/devconsole/`. The built assets are served by `DevConsoleController` at `/_devconsole/`.
112
+
113
+ In development, the frontend can be run standalone with `cd devconsole && npm run dev`, which proxies API and WebSocket requests to `localhost:3000`.
114
+
115
+ ## Demo App
116
+
117
+ A demo application is included to showcase all DevConsole features:
118
+
119
+ ```bash
120
+ yarn demoapp
121
+ ```
122
+
123
+ This starts a server at `http://localhost:3000` with auto-generated HTTP traffic, SRPC client/server chatter, worker jobs, and mutex contention. Open `http://localhost:3000/_devconsole/` to see it all in action.
@@ -0,0 +1,154 @@
1
+ # Getting Started
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ npm install @zyno-io/dk-server-foundation
7
+ # or
8
+ yarn add @zyno-io/dk-server-foundation
9
+ ```
10
+
11
+ ### TypeScript Configuration
12
+
13
+ Your `tsconfig.json` must enable experimental decorators and Deepkit reflection:
14
+
15
+ ```json
16
+ {
17
+ "compilerOptions": {
18
+ "experimentalDecorators": true
19
+ },
20
+ "reflection": true
21
+ }
22
+ ```
23
+
24
+ ## Creating an Application
25
+
26
+ Use `createApp()` to set up a Deepkit application with opinionated defaults.
27
+
28
+ ```typescript
29
+ import { createApp, BaseAppConfig, createMySQLDatabase } from '@zyno-io/dk-server-foundation';
30
+
31
+ // 1. Define your config
32
+ class AppConfig extends BaseAppConfig {
33
+ STRIPE_KEY_SECRET!: string;
34
+ }
35
+
36
+ // 2. Define your database
37
+ class AppDB extends createMySQLDatabase({}, [UserEntity, PostEntity]) {}
38
+
39
+ // 3. Create and run
40
+ const app = createApp({
41
+ config: AppConfig,
42
+ db: AppDB,
43
+ enableWorker: true,
44
+ cors: config => ({
45
+ hosts: ['https://myapp.com'],
46
+ credentials: true
47
+ }),
48
+ controllers: [UserController, PostController],
49
+ providers: [UserService, PostService]
50
+ });
51
+
52
+ app.run();
53
+ ```
54
+
55
+ ### What `createApp()` Sets Up
56
+
57
+ - HTTP server on port 3000 (configurable via `PORT`)
58
+ - Custom HTTP kernel with request logging
59
+ - Health check endpoint at `GET /healthz`
60
+ - Multipart form parsing (JSON key: `_payload`)
61
+ - REPL and provider invoke CLI commands
62
+ - [DevConsole](./devconsole.md) at `/_devconsole/` with request inspector, REPL, database browser, and more (development only)
63
+ - Sentry integration (if `SENTRY_DSN` is set)
64
+ - Graceful shutdown with 30-second timeout
65
+
66
+ ## `createApp()` Options
67
+
68
+ ```typescript
69
+ interface CreateAppOptions<C extends BaseAppConfig> extends RootModuleDefinition {
70
+ config: ClassType<C>;
71
+ defaultConfig?: Partial<C>;
72
+ db?: ClassType<BaseDatabase>;
73
+ frameworkConfig?: Partial<FrameworkConfig>;
74
+ cors?: (config: C) => HttpCorsOptions | HttpCorsOptions[];
75
+ enableWorker?: boolean;
76
+ enableDkRpc?: boolean;
77
+ }
78
+ ```
79
+
80
+ | Option | Required | Description |
81
+ | ----------------- | -------- | --------------------------------------------------------------------------------------------------------- |
82
+ | `config` | Yes | Config class extending `BaseAppConfig`. Properties are loaded from environment variables. |
83
+ | `defaultConfig` | No | Default values for config properties. |
84
+ | `db` | No | Database class created via `createMySQLDatabase()`. Registers health check and enables entity management. |
85
+ | `frameworkConfig` | No | Override Deepkit framework settings (debug mode, etc.). |
86
+ | `cors` | No | Factory function returning CORS options. Receives the resolved config instance. |
87
+ | `enableWorker` | No | Enable BullMQ worker system. Registers job runner with leader-elected recorder and CLI commands. |
88
+ | `enableDkRpc` | No | Enable Deepkit's built-in RPC module. |
89
+
90
+ Standard Deepkit `RootModuleDefinition` fields are also accepted: `controllers`, `providers`, `listeners`, `imports`, `exports`, `workflows`, `middlewares`.
91
+
92
+ ## AutoStart Decorator
93
+
94
+ Services decorated with `@AutoStart()` are instantiated at application startup, before dependency injection requests. Use this for services that need to establish connections or start background processes.
95
+
96
+ ```typescript
97
+ import { AutoStart } from '@zyno-io/dk-server-foundation';
98
+
99
+ @AutoStart()
100
+ class WebSocketManager {
101
+ constructor() {
102
+ // Automatically called at startup
103
+ this.connect();
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## Dependency Resolution
109
+
110
+ Use `resolve()` (or its alias `r()`) to access providers outside of constructor injection:
111
+
112
+ ```typescript
113
+ import { r, resolve, getApp, getAppConfig } from '@zyno-io/dk-server-foundation';
114
+
115
+ // Resolve a provider
116
+ const db = r(MyDatabase);
117
+ const logger = resolve(ExtendedLogger);
118
+
119
+ // Access the app or config
120
+ const app = getApp();
121
+ const config = getAppConfig();
122
+ ```
123
+
124
+ ### `resolveDeep(type, fromModule?)`
125
+
126
+ Recursively searches through module imports to find a provider. Returns `undefined` if not found.
127
+
128
+ ```typescript
129
+ import { resolveDeep } from '@zyno-io/dk-server-foundation';
130
+
131
+ const service = resolveDeep(MyService); // searches all modules
132
+ ```
133
+
134
+ ## Environment Detection
135
+
136
+ ```typescript
137
+ import { isDevelopment, isTest } from '@zyno-io/dk-server-foundation';
138
+
139
+ if (isDevelopment) {
140
+ // APP_ENV and NODE_ENV are unset or 'development'
141
+ }
142
+
143
+ if (isTest) {
144
+ // Running inside Jest or APP_ENV === 'test'
145
+ }
146
+ ```
147
+
148
+ ## Timezone
149
+
150
+ The library enforces UTC at startup. If `TZ` is not set to `UTC`, the process will throw an error. Set the environment variable before starting:
151
+
152
+ ```bash
153
+ TZ=UTC node app.js
154
+ ```
@@ -0,0 +1,351 @@
1
+ # Migrating from Jest to node:test (dk-server-foundation)
2
+
3
+ This guide documents how to migrate a project that uses `@zyno-io/dk-server-foundation` from Jest to Node.js's built-in `node:test` runner. It is written as a reference for Claude and other AI assistants performing this migration.
4
+
5
+ ## Why node:test?
6
+
7
+ Since projects already build to CJS via `tsc` (which runs the Deepkit type compiler), testing against the built output eliminates test-time compilation entirely — Deepkit reflection is already compiled in.
8
+
9
+ Benefits:
10
+
11
+ - Tests run against the same compiled output as production
12
+ - Faster test startup (no transform pipeline)
13
+ - Zero-config Deepkit reflection (already compiled by `tsc`)
14
+
15
+ ## Step-by-step migration
16
+
17
+ ### 1. Create `tsconfig.test.json`
18
+
19
+ Extend the base `tsconfig.json` to also compile test files:
20
+
21
+ ```json
22
+ {
23
+ "extends": "./tsconfig.json",
24
+ "compilerOptions": {
25
+ "declaration": false,
26
+ "declarationMap": false
27
+ },
28
+ "include": ["src/**/*", "tests/**/*", "types.d.ts"]
29
+ }
30
+ ```
31
+
32
+ This compiles `tests/` into `dist/tests/` alongside `dist/src/`. Relative imports like `../../src/foo` naturally resolve to `dist/src/foo` in the output.
33
+
34
+ ### 2. Create `globalSetup.ts`
35
+
36
+ Create `tests/shared/globalSetup.ts` with `setup` and `teardown` exports:
37
+
38
+ ```typescript
39
+ import { TestingHelpers } from '@zyno-io/dk-server-foundation';
40
+
41
+ export async function setup() {
42
+ TestingHelpers.setDefaultDatabaseConfig({
43
+ MYSQL_HOST: 'localhost',
44
+ MYSQL_PORT: 3306,
45
+ MYSQL_USER: 'root',
46
+ MYSQL_PASSWORD_SECRET: 'secret'
47
+ });
48
+
49
+ await TestingHelpers.cleanupTestDatabases('myapp_test');
50
+ }
51
+
52
+ export async function teardown() {
53
+ await TestingHelpers.cleanupTestDatabases('myapp_test');
54
+ }
55
+ ```
56
+
57
+ The `dksf-test` runner will automatically load `dist/tests/shared/globalSetup.js` if it exists, calling `setup()` before tests and `teardown()` after.
58
+
59
+ ### 3. Update `package.json` scripts
60
+
61
+ ```json
62
+ {
63
+ "scripts": {
64
+ "test": "tsc -p tsconfig.test.json && dksf-test",
65
+ "test:debug": "tsc -p tsconfig.test.json && node --inspect=9201 node_modules/.bin/dksf-test"
66
+ }
67
+ }
68
+ ```
69
+
70
+ `dksf-test` sets `APP_ENV=test` and `TZ=UTC` automatically, finds all `*.spec.js` files in `dist/tests/`, and runs them with `node --test`. You can pass specific files and node flags:
71
+
72
+ ```bash
73
+ # Run a single test file (source path is mapped to dist automatically)
74
+ yarn test tests/my-feature.spec.ts
75
+
76
+ # Run all tests in a directory
77
+ yarn test tests/integration/
78
+
79
+ # Pass node flags
80
+ yarn test --test-name-pattern="my test"
81
+ ```
82
+
83
+ Remove Jest dependencies and configuration files.
84
+
85
+ ### 4. Migrate test imports
86
+
87
+ Add explicit imports at the top of each test file:
88
+
89
+ ```typescript
90
+ import { describe, it, before, after, beforeEach, afterEach, mock } from 'node:test';
91
+ import assert from 'node:assert/strict';
92
+ ```
93
+
94
+ Rename any `beforeAll`/`afterAll` calls to `before`/`after`.
95
+
96
+ ### 5. Migrate assertions
97
+
98
+ #### Simple replacements
99
+
100
+ | Jest | node:test |
101
+ | ------------------------------------------- | ------------------------------------------------- |
102
+ | `expect(x).toBe(y)` | `assert.strictEqual(x, y)` |
103
+ | `expect(x).toEqual(y)` | `assert.deepStrictEqual(x, y)` |
104
+ | `expect(x).toBeDefined()` | `assert.notStrictEqual(x, undefined)` |
105
+ | `expect(x).toBeUndefined()` | `assert.strictEqual(x, undefined)` |
106
+ | `expect(x).toBeNull()` | `assert.strictEqual(x, null)` |
107
+ | `expect(x).toBeTruthy()` | `assert.ok(x)` |
108
+ | `expect(x).toBeFalsy()` | `assert.ok(!x)` |
109
+ | `expect(x).toBeInstanceOf(Y)` | `assert.ok(x instanceof Y)` |
110
+ | `expect(x).toHaveLength(n)` | `assert.strictEqual(x.length, n)` |
111
+ | `expect(x).toContain(y)` | `assert.ok(x.includes(y))` |
112
+ | `expect(x).toMatch(/re/)` | `assert.match(x, /re/)` |
113
+ | `expect(x).toBeGreaterThan(n)` | `assert.ok(x > n)` |
114
+ | `expect(x).toBeGreaterThanOrEqual(n)` | `assert.ok(x >= n)` |
115
+ | `expect(x).toBeLessThan(n)` | `assert.ok(x < n)` |
116
+ | `expect(x).toHaveProperty(k)` | `assert.ok(k in x)` |
117
+ | `expect(x).not.toBe(y)` | `assert.notStrictEqual(x, y)` |
118
+ | `expect(x).not.toEqual(y)` | `assert.notDeepStrictEqual(x, y)` |
119
+ | `expect(() => fn()).toThrow(msg)` | `assert.throws(() => fn(), { message: msg })` |
120
+ | `expect(() => fn()).toThrow(ErrClass)` | `assert.throws(() => fn(), ErrClass)` |
121
+ | `expect(() => fn()).toThrow(/re/)` | `assert.throws(() => fn(), /re/)` |
122
+ | `expect(() => fn()).not.toThrow()` | `assert.doesNotThrow(() => fn())` |
123
+ | `expect(promise).rejects.toThrow(msg)` | `await assert.rejects(promise, { message: msg })` |
124
+ | `expect(promise).rejects.toThrow(/re/)` | `await assert.rejects(promise, /re/)` |
125
+ | `expect(promise).rejects.toThrow(ErrClass)` | `await assert.rejects(promise, ErrClass)` |
126
+
127
+ #### `toMatchObject` — use `matchesObject` from dk-server-foundation
128
+
129
+ ```typescript
130
+ import { matchesObject } from '@zyno-io/dk-server-foundation/testing/expect';
131
+
132
+ // Before
133
+ expect(result).toMatchObject({ name: 'Fred', age: 30 });
134
+
135
+ // After
136
+ matchesObject(result, { name: 'Fred', age: 30 });
137
+ ```
138
+
139
+ #### Asymmetric matchers — use helpers from dk-server-foundation
140
+
141
+ ```typescript
142
+ import { matchesObject, anyOf, stringContaining, arrayContaining, anything, objectContaining } from '@zyno-io/dk-server-foundation/testing/expect';
143
+
144
+ // Before
145
+ expect(result).toMatchObject({ id: expect.any(Number), name: expect.stringContaining('Fred') });
146
+
147
+ // After
148
+ matchesObject(result, { id: anyOf(Number), name: stringContaining('Fred') });
149
+ ```
150
+
151
+ Available matchers:
152
+ | Jest | dk-server-foundation |
153
+ |---|---|
154
+ | `expect.any(Type)` | `anyOf(Type)` |
155
+ | `expect.anything()` | `anything()` |
156
+ | `expect.stringContaining(s)` | `stringContaining(s)` |
157
+ | `expect.arrayContaining(arr)` | `arrayContaining(arr)` |
158
+ | `expect.objectContaining(obj)` | `objectContaining(obj)` |
159
+
160
+ #### Mock assertions — use `assertCalledWith`
161
+
162
+ ```typescript
163
+ import { assertCalledWith, anyOf } from '@zyno-io/dk-server-foundation/testing/expect';
164
+
165
+ // Before
166
+ expect(mockFn).toHaveBeenCalledWith('arg1', expect.any(Number));
167
+
168
+ // After
169
+ assertCalledWith(mockFn, 'arg1', anyOf(Number));
170
+ ```
171
+
172
+ Other mock assertion conversions:
173
+
174
+ | Jest | node:test |
175
+ | ------------------------------------- | -------------------------------------------- |
176
+ | `expect(fn).toHaveBeenCalledTimes(n)` | `assert.strictEqual(fn.mock.callCount(), n)` |
177
+ | `expect(fn).toHaveBeenCalled()` | `assert.ok(fn.mock.callCount() > 0)` |
178
+ | `expect(fn).not.toHaveBeenCalled()` | `assert.strictEqual(fn.mock.callCount(), 0)` |
179
+ | `fn.mock.calls[0][1]` | `fn.mock.calls[0].arguments[1]` |
180
+ | `fn.mockClear()` | `fn.mock.resetCalls()` |
181
+
182
+ ### 6. Migrate mock APIs
183
+
184
+ | Jest | node:test |
185
+ | ---------------------------------------------- | ----------------------------------------- |
186
+ | `jest.fn()` | `mock.fn()` |
187
+ | `jest.fn(() => value)` | `mock.fn(() => value)` |
188
+ | `jest.spyOn(obj, method)` | `mock.method(obj, method)` |
189
+ | `jest.spyOn(obj, method).mockReturnValue(x)` | `mock.method(obj, method, () => x)` |
190
+ | `jest.spyOn(obj, method).mockResolvedValue(x)` | `mock.method(obj, method, async () => x)` |
191
+ | `jest.clearAllMocks()` | Per-mock `fn.mock.resetCalls()` |
192
+ | `jest.restoreAllMocks()` | `mock.restoreAll()` |
193
+ | `jest.useFakeTimers()` | `mock.timers.enable()` |
194
+ | `jest.advanceTimersByTime(n)` | `mock.timers.tick(n)` |
195
+ | `jest.useRealTimers()` | `mock.timers.reset()` |
196
+ | `jest.setTimeout(n)` | `--test-timeout=N` flag in test runner |
197
+
198
+ #### `mockReturnValue` / `mockImplementation` on existing mocks
199
+
200
+ node:test does not have `mockReturnValue()` or `mockImplementation()` on mock instances. Instead, pass the implementation when creating the mock:
201
+
202
+ ```typescript
203
+ // Jest
204
+ const fn = jest.fn();
205
+ fn.mockReturnValue(42);
206
+ fn.mockImplementation(x => x * 2);
207
+
208
+ // node:test
209
+ const fn = mock.fn(() => 42);
210
+ // To change implementation later, create a new mock or use a wrapper:
211
+ let impl = (x: number) => x * 2;
212
+ const fn = mock.fn((x: number) => impl(x));
213
+ impl = (x: number) => x * 3; // change behavior
214
+ ```
215
+
216
+ #### `mockReturnValueOnce` — no direct equivalent
217
+
218
+ Use a counter or array of return values:
219
+
220
+ ```typescript
221
+ // Jest
222
+ fn.mockReturnValueOnce(1).mockReturnValueOnce(2).mockReturnValue(0);
223
+
224
+ // node:test
225
+ const returns = [1, 2];
226
+ const fn = mock.fn(() => returns.shift() ?? 0);
227
+ ```
228
+
229
+ ### 7. Migrate module mocking
230
+
231
+ Since tests run against CJS output, use `require.cache` manipulation with `TestingHelpers.resetSrcModuleCache()`:
232
+
233
+ ```typescript
234
+ // Before (Jest)
235
+ jest.doMock('../../src/app/resolver', () => ({
236
+ getAppConfig: () => mockConfig
237
+ }));
238
+ const { MyModule } = await import('../../src/my-module');
239
+
240
+ // After (node:test with CJS)
241
+ import { TestingHelpers } from '@zyno-io/dk-server-foundation';
242
+
243
+ TestingHelpers.resetSrcModuleCache();
244
+ const resolver = require('../../src/app/resolver');
245
+ resolver.getAppConfig = () => mockConfig;
246
+ const { MyModule } = require('../../src/my-module');
247
+ ```
248
+
249
+ This works because CJS `import { x } from 'y'` compiles to `const y_1 = require('y')`, preserving a reference to the module exports object. Patching `resolver.getAppConfig` is visible to all subsequently-required modules.
250
+
251
+ ### 8. Migrate `it.skip`, `it.only`, `it.each`
252
+
253
+ **`it.skip` / `describe.skip`** — same syntax, works identically:
254
+
255
+ ```typescript
256
+ it.skip('not yet implemented', () => { ... });
257
+ describe.skip('disabled suite', () => { ... });
258
+ ```
259
+
260
+ **`it.only` / `describe.only`** — same syntax, but only affects the current file. To filter tests across files, use `--test-name-pattern`:
261
+
262
+ ```bash
263
+ node --test --test-name-pattern="my test name" dist/tests/**/*.spec.js
264
+ ```
265
+
266
+ **`it.each` / `describe.each`** — no built-in equivalent. Use a loop:
267
+
268
+ ```typescript
269
+ // Jest
270
+ it.each([
271
+ [1, 2, 3],
272
+ [4, 5, 9]
273
+ ])('adds %i + %i = %i', (a, b, expected) => {
274
+ expect(a + b).toBe(expected);
275
+ });
276
+
277
+ // node:test
278
+ for (const [a, b, expected] of [
279
+ [1, 2, 3],
280
+ [4, 5, 9]
281
+ ]) {
282
+ it(`adds ${a} + ${b} = ${expected}`, () => {
283
+ assert.strictEqual(a + b, expected);
284
+ });
285
+ }
286
+ ```
287
+
288
+ ### 9. Migrate test timeouts
289
+
290
+ | Jest | node:test |
291
+ | ------------------------ | ------------------------------------- |
292
+ | `it('name', fn, 30_000)` | `it('name', { timeout: 30_000 }, fn)` |
293
+ | `beforeAll(fn, 10_000)` | `before(fn, { timeout: 10_000 })` |
294
+
295
+ ### 10. Environment detection
296
+
297
+ The `isTest` constant in dk-server-foundation checks `process.env.APP_ENV === 'test'`. The config loader auto-detects `node --test` and sets `APP_ENV=test` if it wasn't already set, so test-time behaviors (e.g., skipping worker job queueing) work automatically.
298
+
299
+ ### 11. Clean up Redis connections
300
+
301
+ If your tests use Redis-backed features (mutex, cache, leader election, mesh), call `disconnectAllRedis()` in your top-level `after()` hook to properly close memoized connections. Without this, `node:test` child processes will hang waiting for the event loop to drain.
302
+
303
+ ```typescript
304
+ import { after } from 'node:test';
305
+ import { disconnectAllRedis } from '@zyno-io/dk-server-foundation';
306
+
307
+ after(async () => {
308
+ await tf.stop();
309
+ await disconnectAllRedis();
310
+ });
311
+ ```
312
+
313
+ ### 12. Remove old config files
314
+
315
+ Delete these files if they exist:
316
+
317
+ - `jest.config.js` / `jest.config.ts`
318
+
319
+ ## Troubleshooting
320
+
321
+ ### `APP_ENV must be specified in the environment`
322
+
323
+ Set `APP_ENV=test` in your test runner script (see step 2). The config loader auto-detects `node --test`, but if you use a custom runner that spawns node separately, set the env var explicitly.
324
+
325
+ ### Tests hang or time out
326
+
327
+ `node:test` runs test files sequentially by default. If your `before`/`after` hooks don't complete (e.g., database connection not closing), the entire suite will hang. Ensure all connections are properly closed in `after()` hooks. See step 10 for Redis cleanup.
328
+
329
+ ### `beforeAll` / `afterAll` is not defined
330
+
331
+ Replace with `before`/`after` from `node:test`:
332
+
333
+ ```typescript
334
+ import { before, after } from 'node:test';
335
+ ```
336
+
337
+ ### Source maps not working
338
+
339
+ Ensure `--enable-source-maps` is passed to `node` in your test runner. The `tsconfig.json` must have `"sourceMap": true`.
340
+
341
+ ### Mock function call structure differences
342
+
343
+ In `node:test`, mock call arguments are accessed via `.arguments` property, not as a flat array:
344
+
345
+ ```typescript
346
+ // Jest
347
+ fn.mock.calls[0][1]; // second argument of first call
348
+
349
+ // node:test
350
+ fn.mock.calls[0].arguments[1]; // second argument of first call
351
+ ```
@@ -0,0 +1,54 @@
1
+ # Health Checks
2
+
3
+ Built-in health check system with an extensible service and HTTP endpoint.
4
+
5
+ ## Endpoint
6
+
7
+ ```
8
+ GET /healthz
9
+ ```
10
+
11
+ Returns:
12
+
13
+ ```json
14
+ { "version": "1.2.3" }
15
+ ```
16
+
17
+ The version is read from `package.json`. Returns `"unknown"` if not available.
18
+
19
+ If any registered health check fails, the endpoint returns an HTTP 500 error.
20
+
21
+ ## Registering Health Checks
22
+
23
+ ```typescript
24
+ import { HealthcheckService } from '@zyno-io/dk-server-foundation';
25
+
26
+ class MyService {
27
+ constructor(private hcSvc: HealthcheckService) {
28
+ hcSvc.register('Database', async () => {
29
+ // Throw to indicate unhealthy
30
+ await db.rawQuery(sql`SELECT 1`);
31
+ });
32
+ }
33
+ }
34
+ ```
35
+
36
+ ### Database Health Check
37
+
38
+ When a database class is passed to `createApp()`, a database health check is automatically registered. It verifies the database connection is alive.
39
+
40
+ ## `HealthcheckService`
41
+
42
+ | Method | Description |
43
+ | ----------------------------------------- | ------------------------------------------------------------------------------------------- |
44
+ | `register(name, fn: () => Promise<void>)` | Register a named health check function. Throw to indicate failure. |
45
+ | `check()` | Run all registered health checks. Throws on first failure. |
46
+ | `checkIndividual()` | Run all checks and return per-check results: `{ name, status: 'ok' \| 'error', error? }[]`. |
47
+
48
+ ## Health Module
49
+
50
+ The `HealthModule` is automatically included by `createApp()`. It provides:
51
+
52
+ - `HealthcheckService` as a DI provider
53
+ - `HealthcheckController` at `/healthz`
54
+ - `MetricsController` at `/metrics` (if Prometheus exporter is enabled)