@zintrust/core 0.1.39 → 0.1.41

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 (475) hide show
  1. package/bin/zintrust-main.d.ts.map +1 -1
  2. package/bin/zintrust-main.js +22 -1
  3. package/package.json +8 -4
  4. package/public/error-pages/404.html +2 -2
  5. package/src/auth/Auth.js +1 -1
  6. package/src/boot/Application.d.ts +1 -16
  7. package/src/boot/Application.d.ts.map +1 -1
  8. package/src/boot/Application.js +2 -262
  9. package/src/boot/Server.d.ts +1 -1
  10. package/src/boot/Server.d.ts.map +1 -1
  11. package/src/boot/bootstrap.js +23 -9
  12. package/src/boot/registry/registerRoute.d.ts +6 -0
  13. package/src/boot/registry/registerRoute.d.ts.map +1 -0
  14. package/src/boot/registry/registerRoute.js +96 -0
  15. package/src/boot/registry/runtime.d.ts +15 -0
  16. package/src/boot/registry/runtime.d.ts.map +1 -0
  17. package/src/boot/registry/runtime.js +353 -0
  18. package/src/boot/registry/type.d.ts +25 -0
  19. package/src/boot/registry/type.d.ts.map +1 -0
  20. package/src/boot/registry/type.js +1 -0
  21. package/src/boot/registry/worker.d.ts +6 -0
  22. package/src/boot/registry/worker.d.ts.map +1 -0
  23. package/src/boot/registry/worker.js +35 -0
  24. package/src/cache/drivers/KVRemoteDriver.d.ts.map +1 -1
  25. package/src/cache/drivers/KVRemoteDriver.js +14 -1
  26. package/src/cli/CLI.d.ts.map +1 -1
  27. package/src/cli/CLI.js +82 -34
  28. package/src/cli/ErrorHandler.js +1 -1
  29. package/src/cli/commands/ContainerProxiesCommand.d.ts +5 -0
  30. package/src/cli/commands/ContainerProxiesCommand.d.ts.map +1 -0
  31. package/src/cli/commands/ContainerProxiesCommand.js +77 -0
  32. package/src/cli/commands/ContainerWorkersCommand.d.ts +5 -0
  33. package/src/cli/commands/ContainerWorkersCommand.d.ts.map +1 -0
  34. package/src/cli/commands/ContainerWorkersCommand.js +57 -0
  35. package/src/cli/commands/DeployCommand.d.ts +16 -0
  36. package/src/cli/commands/DeployCommand.d.ts.map +1 -0
  37. package/src/cli/commands/DeployCommand.js +110 -0
  38. package/src/cli/commands/DeployContainerProxiesCommand.d.ts +5 -0
  39. package/src/cli/commands/DeployContainerProxiesCommand.d.ts.map +1 -0
  40. package/src/cli/commands/DeployContainerProxiesCommand.js +27 -0
  41. package/src/cli/commands/DeployContainerWorkersCommand.d.ts +5 -0
  42. package/src/cli/commands/DeployContainerWorkersCommand.d.ts.map +1 -0
  43. package/src/cli/commands/DeployContainerWorkersCommand.js +27 -0
  44. package/src/cli/commands/DockerComposeCommandUtils.d.ts +3 -0
  45. package/src/cli/commands/DockerComposeCommandUtils.d.ts.map +1 -0
  46. package/src/cli/commands/DockerComposeCommandUtils.js +34 -0
  47. package/src/cli/commands/DoctorArchitectureCommand.d.ts +5 -0
  48. package/src/cli/commands/DoctorArchitectureCommand.d.ts.map +1 -0
  49. package/src/cli/commands/DoctorArchitectureCommand.js +54 -0
  50. package/src/cli/commands/InitContainerCommand.d.ts +5 -0
  51. package/src/cli/commands/InitContainerCommand.d.ts.map +1 -0
  52. package/src/cli/commands/InitContainerCommand.js +216 -0
  53. package/src/cli/commands/InitProducerCommand.d.ts +5 -0
  54. package/src/cli/commands/InitProducerCommand.d.ts.map +1 -0
  55. package/src/cli/commands/InitProducerCommand.js +47 -0
  56. package/src/cli/commands/InitProxyCommand.d.ts +5 -0
  57. package/src/cli/commands/InitProxyCommand.d.ts.map +1 -0
  58. package/src/cli/commands/InitProxyCommand.js +442 -0
  59. package/src/cli/commands/MongoDBProxyCommand.d.ts +5 -0
  60. package/src/cli/commands/MongoDBProxyCommand.d.ts.map +1 -0
  61. package/src/cli/commands/MongoDBProxyCommand.js +98 -0
  62. package/src/cli/commands/MySqlProxyCommand.d.ts +6 -0
  63. package/src/cli/commands/MySqlProxyCommand.d.ts.map +1 -0
  64. package/src/cli/commands/MySqlProxyCommand.js +32 -0
  65. package/src/cli/commands/PostgresProxyCommand.d.ts +6 -0
  66. package/src/cli/commands/PostgresProxyCommand.d.ts.map +1 -0
  67. package/src/cli/commands/PostgresProxyCommand.js +32 -0
  68. package/src/cli/commands/ProxyCommand.d.ts +12 -0
  69. package/src/cli/commands/ProxyCommand.d.ts.map +1 -0
  70. package/src/cli/commands/ProxyCommand.js +80 -0
  71. package/src/cli/commands/ProxyCommandUtils.d.ts +6 -0
  72. package/src/cli/commands/ProxyCommandUtils.d.ts.map +1 -0
  73. package/src/cli/commands/ProxyCommandUtils.js +38 -0
  74. package/src/cli/commands/QueueRecoveryCommand.d.ts +6 -0
  75. package/src/cli/commands/QueueRecoveryCommand.d.ts.map +1 -0
  76. package/src/cli/commands/QueueRecoveryCommand.js +513 -0
  77. package/src/cli/commands/RedisProxyCommand.d.ts +6 -0
  78. package/src/cli/commands/RedisProxyCommand.d.ts.map +1 -0
  79. package/src/cli/commands/RedisProxyCommand.js +53 -0
  80. package/src/cli/commands/SmtpProxyCommand.d.ts +6 -0
  81. package/src/cli/commands/SmtpProxyCommand.d.ts.map +1 -0
  82. package/src/cli/commands/SmtpProxyCommand.js +56 -0
  83. package/src/cli/commands/SqlProxyCommandUtils.d.ts +46 -0
  84. package/src/cli/commands/SqlProxyCommandUtils.d.ts.map +1 -0
  85. package/src/cli/commands/SqlProxyCommandUtils.js +48 -0
  86. package/src/cli/commands/SqlServerProxyCommand.d.ts +5 -0
  87. package/src/cli/commands/SqlServerProxyCommand.d.ts.map +1 -0
  88. package/src/cli/commands/SqlServerProxyCommand.js +85 -0
  89. package/src/cli/commands/StartCommand.d.ts.map +1 -1
  90. package/src/cli/commands/StartCommand.js +145 -18
  91. package/src/cli/commands/WorkerCommands.d.ts +1 -0
  92. package/src/cli/commands/WorkerCommands.d.ts.map +1 -1
  93. package/src/cli/commands/WorkerCommands.js +140 -6
  94. package/src/cli/commands/index.d.ts +2 -0
  95. package/src/cli/commands/index.d.ts.map +1 -1
  96. package/src/cli/commands/index.js +2 -0
  97. package/src/cli/commands/runner/index.d.ts +2 -2
  98. package/src/cli/commands/runner/index.d.ts.map +1 -1
  99. package/src/cli/commands/runner/index.js +15 -4
  100. package/src/cli/d1/D1SqlMigrations.d.ts.map +1 -1
  101. package/src/cli/d1/D1SqlMigrations.js +3 -0
  102. package/src/cli/index.d.ts +4 -0
  103. package/src/cli/index.d.ts.map +1 -1
  104. package/src/cli/index.js +4 -0
  105. package/src/cli/scaffolding/ProjectScaffolder.d.ts.map +1 -1
  106. package/src/cli/scaffolding/ProjectScaffolder.js +2 -0
  107. package/src/cli/scaffolding/ServiceScaffolder.d.ts.map +1 -1
  108. package/src/cli/scaffolding/ServiceScaffolder.js +1 -0
  109. package/src/cli/utils/EnvFileLoader.d.ts +2 -1
  110. package/src/cli/utils/EnvFileLoader.d.ts.map +1 -1
  111. package/src/cli/utils/EnvFileLoader.js +22 -21
  112. package/src/cli/utils/spawn.d.ts.map +1 -1
  113. package/src/cli/utils/spawn.js +17 -10
  114. package/src/cli/workers/QueueWorkRunner.js +1 -1
  115. package/src/common/ExternalServiceUtils.d.ts.map +1 -1
  116. package/src/common/ExternalServiceUtils.js +7 -2
  117. package/src/common/HealthRoutes.d.ts.map +1 -1
  118. package/src/common/HealthRoutes.js +50 -2
  119. package/src/common/RemoteSignedJson.d.ts +1 -0
  120. package/src/common/RemoteSignedJson.d.ts.map +1 -1
  121. package/src/common/RemoteSignedJson.js +39 -13
  122. package/src/common/index.d.ts +1 -0
  123. package/src/common/index.d.ts.map +1 -1
  124. package/src/common/index.js +12 -1
  125. package/src/config/FileLogWriter.d.ts.map +1 -1
  126. package/src/config/FileLogWriter.js +21 -6
  127. package/src/config/app.d.ts +4 -0
  128. package/src/config/app.d.ts.map +1 -1
  129. package/src/config/app.js +4 -0
  130. package/src/config/cache.d.ts.map +1 -1
  131. package/src/config/cache.js +22 -2
  132. package/src/config/cloudflare.d.ts +5 -1
  133. package/src/config/cloudflare.d.ts.map +1 -1
  134. package/src/config/cloudflare.js +48 -0
  135. package/src/config/database.d.ts.map +1 -1
  136. package/src/config/database.js +48 -13
  137. package/src/config/env.d.ts +90 -2
  138. package/src/config/env.d.ts.map +1 -1
  139. package/src/config/env.js +160 -18
  140. package/src/config/index.d.ts +1 -0
  141. package/src/config/index.d.ts.map +1 -1
  142. package/src/config/logger.d.ts.map +1 -1
  143. package/src/config/logger.js +60 -16
  144. package/src/config/mail.d.ts.map +1 -1
  145. package/src/config/mail.js +16 -10
  146. package/src/config/middleware.d.ts +5 -0
  147. package/src/config/middleware.d.ts.map +1 -1
  148. package/src/config/middleware.js +19 -1
  149. package/src/config/queue.d.ts.map +1 -1
  150. package/src/config/queue.js +70 -9
  151. package/src/config/redis.d.ts.map +1 -1
  152. package/src/config/redis.js +48 -13
  153. package/src/config/storage.d.ts.map +1 -1
  154. package/src/config/storage.js +1 -0
  155. package/src/config/type.d.ts +19 -0
  156. package/src/config/type.d.ts.map +1 -1
  157. package/src/config/workers.d.ts.map +1 -1
  158. package/src/config/workers.js +122 -16
  159. package/src/functions/cloudflare.d.ts.map +1 -1
  160. package/src/functions/cloudflare.js +55 -1
  161. package/src/health/StartupHealthChecks.js +1 -1
  162. package/src/http/FileUpload.d.ts +3 -2
  163. package/src/http/FileUpload.d.ts.map +1 -1
  164. package/src/http/Kernel.d.ts.map +1 -1
  165. package/src/http/Kernel.js +2 -1
  166. package/src/http/error-pages/ErrorPageRenderer.d.ts +4 -0
  167. package/src/http/error-pages/ErrorPageRenderer.d.ts.map +1 -1
  168. package/src/http/error-pages/ErrorPageRenderer.js +141 -1
  169. package/src/http/middleware/BodyParsingMiddleware.d.ts.map +1 -1
  170. package/src/http/middleware/BodyParsingMiddleware.js +33 -6
  171. package/src/index.d.ts +25 -53
  172. package/src/index.d.ts.map +1 -1
  173. package/src/index.js +30 -14
  174. package/src/microservices/ServiceAuthMiddleware.d.ts.map +1 -1
  175. package/src/microservices/ServiceAuthMiddleware.js +12 -4
  176. package/src/middleware/CsrfMiddleware.d.ts.map +1 -1
  177. package/src/middleware/CsrfMiddleware.js +39 -10
  178. package/src/middleware/ErrorHandlerMiddleware.d.ts.map +1 -1
  179. package/src/middleware/ErrorHandlerMiddleware.js +2 -1
  180. package/src/migrations/MigrationLoader.js +1 -1
  181. package/src/migrations/schema/SchemaCompiler.d.ts.map +1 -1
  182. package/src/migrations/schema/SchemaCompiler.js +6 -3
  183. package/src/node-singletons/crypto.d.ts +1 -1
  184. package/src/node-singletons/crypto.d.ts.map +1 -1
  185. package/src/node-singletons/crypto.js +1 -1
  186. package/src/node-singletons/fs.d.ts +1 -1
  187. package/src/node-singletons/fs.d.ts.map +1 -1
  188. package/src/node-singletons/path.d.ts +1 -1
  189. package/src/node-singletons/path.d.ts.map +1 -1
  190. package/src/node-singletons/path.js +1 -1
  191. package/src/node-singletons/stream.d.ts +11 -0
  192. package/src/node-singletons/stream.d.ts.map +1 -0
  193. package/src/node-singletons/stream.js +8 -0
  194. package/src/observability/OpenTelemetry.d.ts +7 -0
  195. package/src/observability/OpenTelemetry.d.ts.map +1 -1
  196. package/src/observability/OpenTelemetry.js +49 -2
  197. package/src/orm/Database.d.ts +4 -0
  198. package/src/orm/Database.d.ts.map +1 -1
  199. package/src/orm/Database.js +80 -9
  200. package/src/orm/DatabaseRuntimeRegistration.d.ts.map +1 -1
  201. package/src/orm/DatabaseRuntimeRegistration.js +2 -0
  202. package/src/orm/QueryBuilder.d.ts +1 -0
  203. package/src/orm/QueryBuilder.d.ts.map +1 -1
  204. package/src/orm/QueryBuilder.js +33 -3
  205. package/src/orm/SchemaCompiler.d.ts.map +1 -1
  206. package/src/orm/SchemaCompiler.js +6 -3
  207. package/src/orm/adapters/D1RemoteAdapter.d.ts.map +1 -1
  208. package/src/orm/adapters/D1RemoteAdapter.js +14 -1
  209. package/src/orm/adapters/MongoDBProxyAdapter.d.ts +3 -0
  210. package/src/orm/adapters/MongoDBProxyAdapter.d.ts.map +1 -0
  211. package/src/orm/adapters/MongoDBProxyAdapter.js +128 -0
  212. package/src/orm/adapters/MySQLProxyAdapter.d.ts +11 -0
  213. package/src/orm/adapters/MySQLProxyAdapter.d.ts.map +1 -0
  214. package/src/orm/adapters/MySQLProxyAdapter.js +143 -0
  215. package/src/orm/adapters/PostgreSQLProxyAdapter.d.ts +11 -0
  216. package/src/orm/adapters/PostgreSQLProxyAdapter.d.ts.map +1 -0
  217. package/src/orm/adapters/PostgreSQLProxyAdapter.js +147 -0
  218. package/src/orm/adapters/ProxyCache.d.ts +9 -0
  219. package/src/orm/adapters/ProxyCache.d.ts.map +1 -0
  220. package/src/orm/adapters/ProxyCache.js +24 -0
  221. package/src/orm/adapters/ProxySignedRequest.d.ts +11 -0
  222. package/src/orm/adapters/ProxySignedRequest.d.ts.map +1 -0
  223. package/src/orm/adapters/ProxySignedRequest.js +30 -0
  224. package/src/orm/adapters/ProxySigningPath.d.ts +3 -0
  225. package/src/orm/adapters/ProxySigningPath.d.ts.map +1 -0
  226. package/src/orm/adapters/ProxySigningPath.js +25 -0
  227. package/src/orm/adapters/SqlProxyAdapterUtils.d.ts +19 -0
  228. package/src/orm/adapters/SqlProxyAdapterUtils.d.ts.map +1 -0
  229. package/src/orm/adapters/SqlProxyAdapterUtils.js +35 -0
  230. package/src/orm/adapters/SqlServerProxyAdapter.d.ts +3 -0
  231. package/src/orm/adapters/SqlServerProxyAdapter.d.ts.map +1 -0
  232. package/src/orm/adapters/SqlServerProxyAdapter.js +146 -0
  233. package/src/performance/Optimizer.d.ts +1 -0
  234. package/src/performance/Optimizer.d.ts.map +1 -1
  235. package/src/performance/Optimizer.js +21 -8
  236. package/src/proxy/ErrorHandler.d.ts +11 -0
  237. package/src/proxy/ErrorHandler.d.ts.map +1 -0
  238. package/src/proxy/ErrorHandler.js +7 -0
  239. package/src/proxy/PoolManager.d.ts +8 -0
  240. package/src/proxy/PoolManager.d.ts.map +1 -0
  241. package/src/proxy/PoolManager.js +18 -0
  242. package/src/proxy/ProxyBackend.d.ts +18 -0
  243. package/src/proxy/ProxyBackend.d.ts.map +1 -0
  244. package/src/proxy/ProxyBackend.js +1 -0
  245. package/src/proxy/ProxyConfig.d.ts +12 -0
  246. package/src/proxy/ProxyConfig.d.ts.map +1 -0
  247. package/src/proxy/ProxyConfig.js +1 -0
  248. package/src/proxy/ProxyRegistry.d.ts +10 -0
  249. package/src/proxy/ProxyRegistry.d.ts.map +1 -0
  250. package/src/proxy/ProxyRegistry.js +11 -0
  251. package/src/proxy/ProxyServer.d.ts +21 -0
  252. package/src/proxy/ProxyServer.d.ts.map +1 -0
  253. package/src/proxy/ProxyServer.js +84 -0
  254. package/src/proxy/ProxyServerUtils.d.ts +37 -0
  255. package/src/proxy/ProxyServerUtils.d.ts.map +1 -0
  256. package/src/proxy/ProxyServerUtils.js +42 -0
  257. package/src/proxy/ProxySigningConfigResolver.d.ts +22 -0
  258. package/src/proxy/ProxySigningConfigResolver.d.ts.map +1 -0
  259. package/src/proxy/ProxySigningConfigResolver.js +24 -0
  260. package/src/proxy/ProxySigningRequest.d.ts +12 -0
  261. package/src/proxy/ProxySigningRequest.d.ts.map +1 -0
  262. package/src/proxy/ProxySigningRequest.js +31 -0
  263. package/src/proxy/RequestValidator.d.ts +15 -0
  264. package/src/proxy/RequestValidator.d.ts.map +1 -0
  265. package/src/proxy/RequestValidator.js +25 -0
  266. package/src/proxy/SigningService.d.ts +39 -0
  267. package/src/proxy/SigningService.d.ts.map +1 -0
  268. package/src/proxy/SigningService.js +107 -0
  269. package/src/proxy/SqlPayloadValidator.d.ts +13 -0
  270. package/src/proxy/SqlPayloadValidator.d.ts.map +1 -0
  271. package/src/proxy/SqlPayloadValidator.js +14 -0
  272. package/src/proxy/d1/ZintrustD1Proxy.d.ts +2 -0
  273. package/src/proxy/d1/ZintrustD1Proxy.d.ts.map +1 -0
  274. package/src/proxy/d1/ZintrustD1Proxy.js +1 -0
  275. package/src/proxy/d1/register.d.ts +2 -0
  276. package/src/proxy/d1/register.d.ts.map +1 -0
  277. package/src/proxy/d1/register.js +5 -0
  278. package/src/proxy/kv/ZintrustKvProxy.d.ts +2 -0
  279. package/src/proxy/kv/ZintrustKvProxy.d.ts.map +1 -0
  280. package/src/proxy/kv/ZintrustKvProxy.js +1 -0
  281. package/src/proxy/kv/register.d.ts +2 -0
  282. package/src/proxy/kv/register.d.ts.map +1 -0
  283. package/src/proxy/kv/register.js +5 -0
  284. package/src/proxy/mongodb/MongoDBProxyServer.d.ts +33 -0
  285. package/src/proxy/mongodb/MongoDBProxyServer.d.ts.map +1 -0
  286. package/src/proxy/mongodb/MongoDBProxyServer.js +202 -0
  287. package/src/proxy/mongodb/register.d.ts +2 -0
  288. package/src/proxy/mongodb/register.d.ts.map +1 -0
  289. package/src/proxy/mongodb/register.js +5 -0
  290. package/src/proxy/mysql/MySqlProxyServer.d.ts +14 -0
  291. package/src/proxy/mysql/MySqlProxyServer.d.ts.map +1 -0
  292. package/src/proxy/mysql/MySqlProxyServer.js +169 -0
  293. package/src/proxy/mysql/register.d.ts +2 -0
  294. package/src/proxy/mysql/register.d.ts.map +1 -0
  295. package/src/proxy/mysql/register.js +5 -0
  296. package/src/proxy/postgres/PostgresProxyServer.d.ts +14 -0
  297. package/src/proxy/postgres/PostgresProxyServer.d.ts.map +1 -0
  298. package/src/proxy/postgres/PostgresProxyServer.js +140 -0
  299. package/src/proxy/postgres/register.d.ts +2 -0
  300. package/src/proxy/postgres/register.d.ts.map +1 -0
  301. package/src/proxy/postgres/register.js +5 -0
  302. package/src/proxy/redis/RedisProxyServer.d.ts +12 -0
  303. package/src/proxy/redis/RedisProxyServer.d.ts.map +1 -0
  304. package/src/proxy/redis/RedisProxyServer.js +192 -0
  305. package/src/proxy/redis/register.d.ts +2 -0
  306. package/src/proxy/redis/register.d.ts.map +1 -0
  307. package/src/proxy/redis/register.js +5 -0
  308. package/src/proxy/smtp/SmtpProxyServer.d.ts +19 -0
  309. package/src/proxy/smtp/SmtpProxyServer.d.ts.map +1 -0
  310. package/src/proxy/smtp/SmtpProxyServer.js +289 -0
  311. package/src/proxy/smtp/register.d.ts +2 -0
  312. package/src/proxy/smtp/register.d.ts.map +1 -0
  313. package/src/proxy/smtp/register.js +5 -0
  314. package/src/proxy/sqlserver/SqlServerProxyServer.d.ts +14 -0
  315. package/src/proxy/sqlserver/SqlServerProxyServer.d.ts.map +1 -0
  316. package/src/proxy/sqlserver/SqlServerProxyServer.js +168 -0
  317. package/src/proxy/sqlserver/register.d.ts +2 -0
  318. package/src/proxy/sqlserver/register.d.ts.map +1 -0
  319. package/src/proxy/sqlserver/register.js +5 -0
  320. package/src/routes/doc.d.ts.map +1 -1
  321. package/src/routes/doc.js +16 -2
  322. package/src/routes/error.d.ts +5 -4
  323. package/src/routes/error.d.ts.map +1 -1
  324. package/src/routes/error.js +15 -13
  325. package/src/routes/errorPages.d.ts +2 -0
  326. package/src/routes/errorPages.d.ts.map +1 -1
  327. package/src/routes/errorPages.js +144 -4
  328. package/src/runtime/PluginAutoImports.d.ts +1 -0
  329. package/src/runtime/PluginAutoImports.d.ts.map +1 -1
  330. package/src/runtime/PluginAutoImports.js +94 -9
  331. package/src/runtime/RuntimeAdapter.d.ts +8 -9
  332. package/src/runtime/RuntimeAdapter.d.ts.map +1 -1
  333. package/src/runtime/RuntimeAdapter.js +120 -34
  334. package/src/runtime/RuntimeServices.d.ts +47 -0
  335. package/src/runtime/RuntimeServices.d.ts.map +1 -0
  336. package/src/runtime/RuntimeServices.js +164 -0
  337. package/src/runtime/StartupConfigFileRegistry.d.ts +4 -4
  338. package/src/runtime/StartupConfigFileRegistry.d.ts.map +1 -1
  339. package/src/runtime/StartupConfigFileRegistry.js +12 -0
  340. package/src/runtime/WorkerAdapterImports.d.ts +5 -0
  341. package/src/runtime/WorkerAdapterImports.d.ts.map +1 -0
  342. package/src/runtime/WorkerAdapterImports.js +17 -0
  343. package/src/runtime/WorkersModule.d.ts +6 -0
  344. package/src/runtime/WorkersModule.d.ts.map +1 -0
  345. package/src/runtime/WorkersModule.js +278 -0
  346. package/src/runtime/adapters/CloudflareAdapter.d.ts.map +1 -1
  347. package/src/runtime/adapters/CloudflareAdapter.js +19 -2
  348. package/src/runtime/adapters/DenoAdapter.js +1 -0
  349. package/src/runtime/adapters/FargateAdapter.js +1 -1
  350. package/src/runtime/adapters/LambdaAdapter.js +1 -1
  351. package/src/runtime/adapters/NodeServerAdapter.js +1 -1
  352. package/src/runtime/detectRuntime.d.ts +10 -0
  353. package/src/runtime/detectRuntime.d.ts.map +1 -0
  354. package/src/runtime/detectRuntime.js +57 -0
  355. package/src/runtime/useFileLoader.d.ts.map +1 -1
  356. package/src/runtime/useFileLoader.js +16 -0
  357. package/src/scripts/TemplateImportsCheck.js +2 -2
  358. package/src/scripts/TemplateSync.js +3 -4
  359. package/src/security/CsrfTokenManager.d.ts +18 -9
  360. package/src/security/CsrfTokenManager.d.ts.map +1 -1
  361. package/src/security/CsrfTokenManager.js +204 -11
  362. package/src/security/Hash.d.ts +1 -1
  363. package/src/security/Hash.d.ts.map +1 -1
  364. package/src/security/Hash.js +31 -36
  365. package/src/seeders/SeederLoader.js +1 -1
  366. package/src/session/SessionManager.d.ts +3 -0
  367. package/src/session/SessionManager.d.ts.map +1 -1
  368. package/src/session/SessionManager.js +49 -10
  369. package/src/sockets/CloudflareSocket.d.ts +24 -0
  370. package/src/sockets/CloudflareSocket.d.ts.map +1 -0
  371. package/src/sockets/CloudflareSocket.js +259 -0
  372. package/src/start.d.ts.map +1 -1
  373. package/src/start.js +1 -8
  374. package/src/templates/project/basic/app/Middleware/index.ts.tpl +1 -1
  375. package/src/templates/project/basic/src/zintrust.plugins.wg.ts.tpl +8 -0
  376. package/src/toolkit/Secrets/providers/AwsSecretsManager.d.ts.map +1 -1
  377. package/src/toolkit/Secrets/providers/AwsSecretsManager.js +4 -2
  378. package/src/tools/mail/drivers/Smtp.d.ts.map +1 -1
  379. package/src/tools/mail/drivers/Smtp.js +223 -18
  380. package/src/tools/mail/index.d.ts.map +1 -1
  381. package/src/tools/mail/index.js +5 -4
  382. package/src/tools/mail/template-loader.d.ts.map +1 -1
  383. package/src/tools/mail/template-loader.js +197 -29
  384. package/src/tools/mail/templates/auth-password-reset.d.ts +3 -0
  385. package/src/tools/mail/templates/auth-password-reset.d.ts.map +1 -0
  386. package/src/tools/mail/templates/auth-password-reset.js +231 -0
  387. package/src/tools/mail/templates/auth-welcome.d.ts +3 -0
  388. package/src/tools/mail/templates/auth-welcome.d.ts.map +1 -0
  389. package/src/tools/mail/templates/auth-welcome.js +236 -0
  390. package/src/tools/mail/templates/general.d.ts +3 -0
  391. package/src/tools/mail/templates/general.d.ts.map +1 -0
  392. package/src/tools/mail/templates/general.js +109 -0
  393. package/src/tools/mail/templates/index.js +2 -2
  394. package/src/tools/mail/templates/job-completed.d.ts +3 -0
  395. package/src/tools/mail/templates/job-completed.d.ts.map +1 -0
  396. package/src/tools/mail/templates/job-completed.js +188 -0
  397. package/src/tools/mail/templates/notifications-new-comment.d.ts +3 -0
  398. package/src/tools/mail/templates/notifications-new-comment.d.ts.map +1 -0
  399. package/src/tools/mail/templates/notifications-new-comment.js +228 -0
  400. package/src/tools/mail/templates/password-reset.d.ts +3 -0
  401. package/src/tools/mail/templates/password-reset.d.ts.map +1 -0
  402. package/src/tools/mail/templates/password-reset.js +221 -0
  403. package/src/tools/mail/templates/performance-report.d.ts +3 -0
  404. package/src/tools/mail/templates/performance-report.d.ts.map +1 -0
  405. package/src/tools/mail/templates/performance-report.js +258 -0
  406. package/src/tools/mail/templates/welcome.d.ts +3 -0
  407. package/src/tools/mail/templates/welcome.d.ts.map +1 -0
  408. package/src/tools/mail/templates/welcome.js +187 -0
  409. package/src/tools/mail/templates/worker-alert.d.ts +3 -0
  410. package/src/tools/mail/templates/worker-alert.d.ts.map +1 -0
  411. package/src/tools/mail/templates/worker-alert.js +229 -0
  412. package/src/tools/notification/Notification.js +1 -1
  413. package/src/tools/notification/testingHelpers.js +6 -5
  414. package/src/tools/queue/AdvancedQueue.js +2 -6
  415. package/src/tools/queue/IdempotencyManager.d.ts +6 -0
  416. package/src/tools/queue/IdempotencyManager.d.ts.map +1 -0
  417. package/src/tools/queue/IdempotencyManager.js +36 -0
  418. package/src/tools/queue/JobHeartbeatStore.d.ts +16 -0
  419. package/src/tools/queue/JobHeartbeatStore.d.ts.map +1 -0
  420. package/src/tools/queue/JobHeartbeatStore.js +67 -0
  421. package/src/tools/queue/JobReconciliationRunner.d.ts +16 -0
  422. package/src/tools/queue/JobReconciliationRunner.d.ts.map +1 -0
  423. package/src/tools/queue/JobReconciliationRunner.js +88 -0
  424. package/src/tools/queue/JobRecoveryDaemon.d.ts +27 -0
  425. package/src/tools/queue/JobRecoveryDaemon.d.ts.map +1 -0
  426. package/src/tools/queue/JobRecoveryDaemon.js +205 -0
  427. package/src/tools/queue/JobStateTracker.d.ts +131 -0
  428. package/src/tools/queue/JobStateTracker.d.ts.map +1 -0
  429. package/src/tools/queue/JobStateTracker.js +387 -0
  430. package/src/tools/queue/JobStateTrackerDbPersistence.d.ts +12 -0
  431. package/src/tools/queue/JobStateTrackerDbPersistence.d.ts.map +1 -0
  432. package/src/tools/queue/JobStateTrackerDbPersistence.js +148 -0
  433. package/src/tools/queue/Queue.d.ts.map +1 -1
  434. package/src/tools/queue/Queue.js +160 -16
  435. package/src/tools/queue/QueueDataRedactor.d.ts +6 -0
  436. package/src/tools/queue/QueueDataRedactor.d.ts.map +1 -0
  437. package/src/tools/queue/QueueDataRedactor.js +45 -0
  438. package/src/tools/queue/QueueExtensions.d.ts.map +1 -1
  439. package/src/tools/queue/QueueExtensions.js +2 -1
  440. package/src/tools/queue/QueueReliabilityMetrics.d.ts +38 -0
  441. package/src/tools/queue/QueueReliabilityMetrics.d.ts.map +1 -0
  442. package/src/tools/queue/QueueReliabilityMetrics.js +131 -0
  443. package/src/tools/queue/QueueReliabilityOrchestrator.d.ts +7 -0
  444. package/src/tools/queue/QueueReliabilityOrchestrator.d.ts.map +1 -0
  445. package/src/tools/queue/QueueReliabilityOrchestrator.js +59 -0
  446. package/src/tools/queue/QueueRuntimeRegistration.d.ts +1 -9
  447. package/src/tools/queue/QueueRuntimeRegistration.d.ts.map +1 -1
  448. package/src/tools/queue/QueueRuntimeRegistration.js +75 -4
  449. package/src/tools/queue/QueueTracing.d.ts +32 -0
  450. package/src/tools/queue/QueueTracing.d.ts.map +1 -0
  451. package/src/tools/queue/QueueTracing.js +151 -0
  452. package/src/tools/queue/StalledJobMonitor.d.ts +5 -0
  453. package/src/tools/queue/StalledJobMonitor.d.ts.map +1 -0
  454. package/src/tools/queue/StalledJobMonitor.js +21 -0
  455. package/src/tools/queue/TimeoutManager.d.ts +14 -0
  456. package/src/tools/queue/TimeoutManager.d.ts.map +1 -0
  457. package/src/tools/queue/TimeoutManager.js +77 -0
  458. package/src/tools/queue/drivers/Redis.d.ts +1 -0
  459. package/src/tools/queue/drivers/Redis.d.ts.map +1 -1
  460. package/src/tools/queue/drivers/Redis.js +1 -0
  461. package/src/tools/queue/index.d.ts +10 -0
  462. package/src/tools/queue/index.d.ts.map +1 -1
  463. package/src/tools/queue/index.js +10 -0
  464. package/src/tools/redis/RedisKeyManager.d.ts +3 -0
  465. package/src/tools/redis/RedisKeyManager.d.ts.map +1 -1
  466. package/src/tools/redis/RedisKeyManager.js +15 -0
  467. package/src/tools/storage/drivers/R2.d.ts +13 -0
  468. package/src/tools/storage/drivers/R2.d.ts.map +1 -1
  469. package/src/tools/storage/drivers/R2.js +29 -0
  470. package/src/zintrust.plugins.d.ts +9 -0
  471. package/src/zintrust.plugins.d.ts.map +1 -0
  472. package/src/zintrust.plugins.js +7 -0
  473. package/src/zintrust.plugins.wg.d.ts +9 -0
  474. package/src/zintrust.plugins.wg.d.ts.map +1 -0
  475. package/src/zintrust.plugins.wg.js +7 -0
@@ -5,17 +5,17 @@
5
5
  */
6
6
  import { ErrorFactory } from '../../exceptions/ZintrustError.js';
7
7
  import { BaseCommand } from '../BaseCommand.js';
8
+ import { Env } from '../../config/env.js';
8
9
  import { Logger } from '../../config/logger.js';
10
+ import { loadWorkersModule as loadWorkersRuntimeModule } from '../../runtime/WorkersModule.js';
9
11
  // Lazy initialization to prevent temporal dead zone issues
10
12
  let WorkerFactory;
11
13
  let WorkerRegistry;
12
14
  let HealthMonitor;
13
15
  let ResourceMonitor;
14
- let workersModulePromise;
15
16
  const loadWorkersModule = async () => {
16
- workersModulePromise ??= import('@zintrust/workers');
17
17
  try {
18
- return await workersModulePromise;
18
+ return (await loadWorkersRuntimeModule());
19
19
  }
20
20
  catch (error) {
21
21
  Logger.error('Failed to load optional package "@zintrust/workers"; worker commands require this package.', error);
@@ -50,6 +50,31 @@ const getResourceMonitor = async () => {
50
50
  }
51
51
  return ResourceMonitor;
52
52
  };
53
+ const extractStatus = (item) => {
54
+ const status = typeof item === 'object' && item !== null ? item.status : undefined;
55
+ if (status === 'healthy' ||
56
+ status === 'degraded' ||
57
+ status === 'unhealthy' ||
58
+ status === 'critical') {
59
+ return status;
60
+ }
61
+ return undefined;
62
+ };
63
+ const normalizeHealthStatuses = (summary) => {
64
+ let list;
65
+ if (Array.isArray(summary)) {
66
+ list = summary;
67
+ }
68
+ else if (typeof summary === 'object' && summary !== null) {
69
+ const details = summary.details;
70
+ if (Array.isArray(details)) {
71
+ list = details;
72
+ }
73
+ }
74
+ return (list ?? [])
75
+ .map(extractStatus)
76
+ .filter((status) => status !== undefined);
77
+ };
53
78
  /**
54
79
  * Helper: Format table output
55
80
  */
@@ -173,6 +198,113 @@ const createWorkerStartCommand = () => {
173
198
  });
174
199
  return cmd;
175
200
  };
201
+ /**
202
+ * Helper: Poll for persisted workers in container mode
203
+ */
204
+ const pollForPersistedWorkers = async (factory) => {
205
+ let workers = await factory.listPersisted();
206
+ if (workers.length === 0 && process.env['RUNTIME_MODE'] === 'containers') {
207
+ Logger.info('No persisted workers found. Waiting for workers to be registered... (Polling every 10s)');
208
+ while (workers.length === 0) {
209
+ // eslint-disable-next-line no-await-in-loop
210
+ await new Promise((resolve) => globalThis.setTimeout(resolve, 10000));
211
+ try {
212
+ // eslint-disable-next-line no-await-in-loop
213
+ workers = await factory.listPersisted();
214
+ if (workers.length > 0) {
215
+ Logger.info(`Found ${workers.length} workers. Proceeding to start.`);
216
+ }
217
+ }
218
+ catch (e) {
219
+ Logger.warn('Error checking for persisted workers (retrying in 10s):', e instanceof Error ? e.message : String(e));
220
+ }
221
+ }
222
+ }
223
+ return workers;
224
+ };
225
+ const isRegisteredWorkerRunning = async (workerLike) => {
226
+ if (typeof workerLike !== 'object' || workerLike === null)
227
+ return false;
228
+ const candidate = workerLike;
229
+ const runningFn = candidate.worker?.isRunning;
230
+ const pausedFn = candidate.worker?.isPaused;
231
+ const isRunning = typeof runningFn === 'function' ? await Promise.resolve(runningFn()) : false;
232
+ const isPaused = typeof pausedFn === 'function' ? pausedFn() : false;
233
+ return isRunning && !isPaused;
234
+ };
235
+ /**
236
+ * Worker Start All Command
237
+ */
238
+ const createWorkerStartAllCommand = () => {
239
+ const ext = async () => {
240
+ try {
241
+ const globalAutoStart = Env.getBool('WORKER_AUTO_START', false);
242
+ if (!globalAutoStart) {
243
+ Logger.info('Skipping auto-start because WORKER_AUTO_START is false.');
244
+ return;
245
+ }
246
+ const factory = await getWorkerFactory();
247
+ const records = await factory.listPersistedRecords();
248
+ const autoStartRecords = records.filter((record) => record.activeStatus !== false && record.autoStart === true);
249
+ const workers = autoStartRecords.map((record) => record.name);
250
+ if (workers.length === 0) {
251
+ Logger.info('No auto-start eligible persisted workers found.');
252
+ return;
253
+ }
254
+ const discoveredWorkers = await pollForPersistedWorkers(factory);
255
+ const eligibleWorkers = workers.filter((name) => discoveredWorkers.includes(name));
256
+ if (eligibleWorkers.length === 0) {
257
+ Logger.info('No auto-start eligible workers are currently persisted.');
258
+ return;
259
+ }
260
+ const results = await Promise.all(eligibleWorkers.map(async (name) => {
261
+ const existing = await factory.get(name);
262
+ if (existing !== null && existing !== undefined) {
263
+ const trulyRunning = await isRegisteredWorkerRunning(existing);
264
+ if (trulyRunning) {
265
+ return { name, status: 'skipped' };
266
+ }
267
+ Logger.warn(`Worker "${name}" is registered but not truly running. Restarting for crash recovery.`);
268
+ try {
269
+ await factory.restart(name);
270
+ return { name, status: 'started' };
271
+ }
272
+ catch (error) {
273
+ Logger.warn(`Failed to restart stale worker "${name}"`, error);
274
+ return { name, status: 'failed' };
275
+ }
276
+ }
277
+ try {
278
+ await factory.startFromPersisted(name);
279
+ return { name, status: 'started' };
280
+ }
281
+ catch (error) {
282
+ Logger.warn(`Failed to start worker "${name}"`, error);
283
+ return { name, status: 'failed' };
284
+ }
285
+ }));
286
+ const started = results.filter((result) => result.status === 'started').length;
287
+ const skipped = results.filter((result) => result.status === 'skipped').length;
288
+ const failed = results.filter((result) => result.status === 'failed').length;
289
+ Logger.info('Worker start-all summary', {
290
+ total: eligibleWorkers.length,
291
+ started,
292
+ skipped,
293
+ failed,
294
+ });
295
+ }
296
+ catch (error) {
297
+ Logger.error('worker:start-all command failed', error);
298
+ process.exit(1);
299
+ }
300
+ };
301
+ const cmd = BaseCommand.create({
302
+ name: 'worker:start-all',
303
+ description: 'Start all persisted workers',
304
+ execute: async () => ext(),
305
+ });
306
+ return cmd;
307
+ };
176
308
  /**
177
309
  * Worker Stop Command
178
310
  */
@@ -238,8 +370,9 @@ const createWorkerSummaryCommand = () => {
238
370
  const ext = async () => {
239
371
  try {
240
372
  const workers = (await getWorkerFactory()).list();
241
- const monitoringSummary = (await getHealthMonitor()).getSummary();
373
+ const monitoringSummary = await (await getHealthMonitor()).getSummary();
242
374
  const resourceUsage = (await getResourceMonitor()).getCurrentUsage('system');
375
+ const statuses = normalizeHealthStatuses(monitoringSummary);
243
376
  console.log(`\n=== Worker System Summary ===\n`);
244
377
  console.log(`Total Workers: ${workers.length}`);
245
378
  console.log(`\nHealth Overview:`);
@@ -249,8 +382,8 @@ const createWorkerSummaryCommand = () => {
249
382
  unhealthy: 0,
250
383
  critical: 0,
251
384
  };
252
- monitoringSummary.forEach((w) => {
253
- healthCounts[w.status]++;
385
+ statuses.forEach((status) => {
386
+ healthCounts[status]++;
254
387
  });
255
388
  console.log(` Healthy: ${healthCounts.healthy}`);
256
389
  console.log(` Degraded: ${healthCounts.degraded}`);
@@ -282,6 +415,7 @@ export const WorkerCommands = {
282
415
  createWorkerListCommand,
283
416
  createWorkerStatusCommand,
284
417
  createWorkerStartCommand,
418
+ createWorkerStartAllCommand,
285
419
  createWorkerStopCommand,
286
420
  createWorkerRestartCommand,
287
421
  createWorkerSummaryCommand,
@@ -4,6 +4,7 @@
4
4
  export { AddCommand } from '../commands/AddCommand';
5
5
  export { BroadcastWorkCommand } from '../commands/BroadcastWorkCommand';
6
6
  export { ConfigCommand } from '../commands/ConfigCommand';
7
+ export { ContainerWorkersCommand } from '../commands/ContainerWorkersCommand';
7
8
  export { AddMigrationCommand, CreateCommand, CreateMigrationCommand, } from '../commands/CreateCommand';
8
9
  export { DebugCommand } from '../commands/DebugCommand';
9
10
  export { JwtDevCommand } from '../commands/JwtDevCommand';
@@ -16,6 +17,7 @@ export { NewCommand } from '../commands/NewCommand';
16
17
  export { NotificationWorkCommand } from '../commands/NotificationWorkCommand';
17
18
  export { PrepareCommand } from '../commands/PrepareCommand';
18
19
  export { QueueCommand } from '../commands/QueueCommand';
20
+ export { QueueRecoveryCommand } from '../commands/QueueRecoveryCommand';
19
21
  export { ResourceControlCommand } from '../commands/ResourceControlCommand';
20
22
  export { RoutesCommand } from '../commands/RoutesCommand';
21
23
  export { SecretsCommand } from '../commands/SecretsCommand';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,M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C;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -4,6 +4,7 @@
4
4
  export { AddCommand } from '../commands/AddCommand.js';
5
5
  export { BroadcastWorkCommand } from '../commands/BroadcastWorkCommand.js';
6
6
  export { ConfigCommand } from '../commands/ConfigCommand.js';
7
+ export { ContainerWorkersCommand } from '../commands/ContainerWorkersCommand.js';
7
8
  export { AddMigrationCommand, CreateCommand, CreateMigrationCommand, } from '../commands/CreateCommand.js';
8
9
  export { DebugCommand } from '../commands/DebugCommand.js';
9
10
  export { JwtDevCommand } from '../commands/JwtDevCommand.js';
@@ -16,6 +17,7 @@ export { NewCommand } from '../commands/NewCommand.js';
16
17
  export { NotificationWorkCommand } from '../commands/NotificationWorkCommand.js';
17
18
  export { PrepareCommand } from '../commands/PrepareCommand.js';
18
19
  export { QueueCommand } from '../commands/QueueCommand.js';
20
+ export { QueueRecoveryCommand } from '../commands/QueueRecoveryCommand.js';
19
21
  export { ResourceControlCommand } from '../commands/ResourceControlCommand.js';
20
22
  export { RoutesCommand } from '../commands/RoutesCommand.js';
21
23
  export { SecretsCommand } from '../commands/SecretsCommand.js';
@@ -1,3 +1,3 @@
1
- export declare const DENO_RUNNER_SOURCE: string;
2
- export declare const LAMBDA_RUNNER_SOURCE: string;
1
+ export declare const createDenoRunnerSource: (startModuleSpecifier: string) => string;
2
+ export declare const createLambdaRunnerSource: (startModuleSpecifier: string) => string;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/runner/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,QAwDnB,CAAC;AAEb,eAAO,MAAM,oBAAoB,QAiFrB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/runner/index.ts"],"names":[],"mappings":"AAoJA,eAAO,MAAM,sBAAsB,GAAI,sBAAsB,MAAM,KAAG,MAErE,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,sBAAsB,MAAM,KAAG,MAEvE,CAAC"}
@@ -1,6 +1,11 @@
1
- export const DENO_RUNNER_SOURCE = [
1
+ const quote = (value) => JSON.stringify(value);
2
+ const START_MODULE_PLACEHOLDER = '__ZINTRUST_START_MODULE__';
3
+ const injectStartModuleSpecifier = (template, startModuleSpecifier) => {
4
+ return template.replaceAll(START_MODULE_PLACEHOLDER, quote(startModuleSpecifier));
5
+ };
6
+ const denoRunnerTemplate = [
2
7
  "import http from 'node:http';",
3
- "import { deno } from '@zintrust/core/start';",
8
+ `import { deno } from ${START_MODULE_PLACEHOLDER};`,
4
9
  '',
5
10
  "const port = Number.parseInt(process.env.PORT ?? '3000', 10) || 3000;",
6
11
  "const host = process.env.HOST ?? 'localhost';",
@@ -55,9 +60,9 @@ export const DENO_RUNNER_SOURCE = [
55
60
  '});',
56
61
  '',
57
62
  ].join('\n');
58
- export const LAMBDA_RUNNER_SOURCE = [
63
+ const lambdaRunnerTemplate = [
59
64
  "import http from 'node:http';",
60
- "import { handler as lambdaHandler } from '@zintrust/core/start';",
65
+ `import { handler as lambdaHandler } from ${START_MODULE_PLACEHOLDER};`,
61
66
  '',
62
67
  "const port = Number.parseInt(process.env.PORT ?? '3000', 10) || 3000;",
63
68
  "const host = process.env.HOST ?? 'localhost';",
@@ -137,3 +142,9 @@ export const LAMBDA_RUNNER_SOURCE = [
137
142
  '});',
138
143
  '',
139
144
  ].join('\n');
145
+ export const createDenoRunnerSource = (startModuleSpecifier) => {
146
+ return injectStartModuleSpecifier(denoRunnerTemplate, startModuleSpecifier);
147
+ };
148
+ export const createLambdaRunnerSource = (startModuleSpecifier) => {
149
+ return injectStartModuleSpecifier(lambdaRunnerTemplate, startModuleSpecifier);
150
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"D1SqlMigrations.d.ts","sourceRoot":"","sources":["../../../../src/cli/d1/D1SqlMigrations.ts"],"names":[],"mappings":"AAYA,KAAK,6BAA6B,GAAG;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAiOF,eAAO,MAAM,eAAe;0BACE,6BAA6B,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;EAmC5F,CAAC"}
1
+ {"version":3,"file":"D1SqlMigrations.d.ts","sourceRoot":"","sources":["../../../../src/cli/d1/D1SqlMigrations.ts"],"names":[],"mappings":"AAYA,KAAK,6BAA6B,GAAG;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAoOF,eAAO,MAAM,eAAe;0BACE,6BAA6B,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;EAmC5F,CAAC"}
@@ -127,6 +127,9 @@ const createCaptureDb = (onSql) => {
127
127
  await RESOLVED_VOID;
128
128
  return { rows: [], rowCount: 0 };
129
129
  },
130
+ raw(value) {
131
+ return { __raw: value };
132
+ },
130
133
  async transaction(callback) {
131
134
  await RESOLVED_VOID;
132
135
  return callback(this);
@@ -10,6 +10,10 @@ export { AddCommand } from './commands/AddCommand';
10
10
  export { ConfigCommand } from './commands/ConfigCommand';
11
11
  export { DebugCommand } from './commands/DebugCommand';
12
12
  export { MigrateCommand } from './commands/MigrateCommand';
13
+ export { MySqlProxyCommand } from './commands/MySqlProxyCommand';
13
14
  export { NewCommand } from './commands/NewCommand';
15
+ export { PostgresProxyCommand } from './commands/PostgresProxyCommand';
16
+ export { ProxyCommand } from './commands/ProxyCommand';
17
+ export { RedisProxyCommand } from './commands/RedisProxyCommand';
14
18
  export { SecretsCommand } from './commands/SecretsCommand';
15
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC"}
package/src/cli/index.js CHANGED
@@ -11,5 +11,9 @@ export { AddCommand } from './commands/AddCommand.js';
11
11
  export { ConfigCommand } from './commands/ConfigCommand.js';
12
12
  export { DebugCommand } from './commands/DebugCommand.js';
13
13
  export { MigrateCommand } from './commands/MigrateCommand.js';
14
+ export { MySqlProxyCommand } from './commands/MySqlProxyCommand.js';
14
15
  export { NewCommand } from './commands/NewCommand.js';
16
+ export { PostgresProxyCommand } from './commands/PostgresProxyCommand.js';
17
+ export { ProxyCommand } from './commands/ProxyCommand.js';
18
+ export { RedisProxyCommand } from './commands/RedisProxyCommand.js';
15
19
  export { SecretsCommand } from './commands/SecretsCommand.js';
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectScaffolder.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/ProjectScaffolder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CA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AC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACtD,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,eAAe,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;IACpE,cAAc,IAAI,MAAM,CAAC;IACzB,sBAAsB,IAAI,OAAO,CAAC;IAClC,iBAAiB,IAAI,MAAM,CAAC;IAC5B,WAAW,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAAC;IACtD,gBAAgB,IAAI,OAAO,CAAC;IAC5B,aAAa,IAAI,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC3E;AA+eD,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAsBrE;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG;IAChE,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAsBA;AA4ID;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,GAAE,MAAsB,GAAG,kBAAkB,CAsB/F;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAEhC;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;EAM5B,CAAC"}
@@ -174,6 +174,7 @@ const createEnvFile = (projectPath, variables) => {
174
174
  HOST: 'localhost',
175
175
  PORT: String(Number(variables['port'] ?? 7777)),
176
176
  LOG_LEVEL: 'debug',
177
+ CSRF_SKIP_PATHS: '/api/*,/queue-monitor/*',
177
178
  });
178
179
  return true;
179
180
  }
@@ -206,6 +207,7 @@ const createEnvFile = (projectPath, variables) => {
206
207
  'JWT_SECRET=',
207
208
  'JWT_EXPIRES_IN=1h',
208
209
  'CSRF_SECRET=',
210
+ 'CSRF_SKIP_PATHS=/api/*,/queue-monitor/*',
209
211
  'ENCRYPTION_CIPHER=aes-256-cbc',
210
212
  'APP_PREVIOUS_KEYS=',
211
213
  '',
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceScaffolder.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/ServiceScaffolder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACjC,IAAI,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AAEH;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAuB7F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CAGnF;A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AAiB;;;;EAI5B,CAAC"}
@@ -314,6 +314,7 @@ ${options.database === 'isolated' ? `${options.name?.toUpperCase()}_DB_HOST=loca
314
314
  # Authentication
315
315
  SERVICE_AUTH_STRATEGY=${options.auth ?? 'api-key'}
316
316
  SERVICE_AUTH_KEY=your-auth-key-here
317
+ CSRF_SKIP_PATHS=/api/*,/queue-monitor/*
317
318
 
318
319
  # Tracing
319
320
  SERVICE_TRACING_ENABLED=true
@@ -1,3 +1,4 @@
1
+ type node_env = 'development' | 'production' | 'testing';
1
2
  type LoadOptions = {
2
3
  cwd?: string;
3
4
  overrideExisting?: boolean;
@@ -7,7 +8,7 @@ type LoadState = {
7
8
  mode?: string;
8
9
  };
9
10
  type CliOverrides = {
10
- nodeEnv?: 'development' | 'production' | 'testing';
11
+ nodeEnv?: node_env;
11
12
  port?: number;
12
13
  runtime?: string;
13
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"EnvFileLoader.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/EnvFileLoader.ts"],"names":[],"mappings":"AAgHA,KAAK,WAAW,GAAG;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,aAAa,GAAG,YAAY,GAAG,SAAS,CAAC;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAsFF,eAAO,MAAM,aAAa;qBA7DH,WAAW,KAAQ,SAAS;wBA8B1B,SAAS;mCAEI,YAAY,KAAG,IAAI;oBA2BpC,SAAS;EAO5B,CAAC"}
1
+ {"version":3,"file":"EnvFileLoader.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/EnvFileLoader.ts"],"names":[],"mappings":"AAQA,KAAK,QAAQ,GAAG,aAAa,GAAG,YAAY,GAAG,SAAS,CAAC;AAoGzD,KAAK,WAAW,GAAG;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AA2FF,eAAO,MAAM,aAAa;qBAlEH,WAAW,KAAQ,SAAS;wBAmC1B,SAAS;mCAEI,YAAY,KAAG,IAAI;oBA2BpC,SAAS;EAO5B,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { Env } from '../../config/env.js';
1
2
  import { existsSync, readFileSync } from '../../node-singletons/fs.js';
2
3
  import { join } from '../../node-singletons/path.js';
3
4
  const normalizeAppMode = (value) => {
@@ -5,9 +6,9 @@ const normalizeAppMode = (value) => {
5
6
  if (normalized === 'production' || normalized === 'pro' || normalized === 'prod')
6
7
  return 'production';
7
8
  if (normalized === 'dev' || normalized === 'development')
8
- return 'dev';
9
+ return 'development';
9
10
  // Per spec: any other value is treated as development.
10
- return 'dev';
11
+ return 'development';
11
12
  };
12
13
  const stripInlineComment = (value) => {
13
14
  let inSingle = false;
@@ -61,17 +62,13 @@ const parseEnvFile = (raw) => {
61
62
  };
62
63
  const applyToProcessEnv = (values, overrideExisting) => {
63
64
  for (const [key, value] of Object.entries(values)) {
64
- if (!overrideExisting && typeof process.env[key] === 'string')
65
+ if (!overrideExisting && Env.get(key, '') !== '')
65
66
  continue;
66
- process.env[key] = value;
67
+ Env.set(key, value);
67
68
  }
68
69
  // Compatibility helpers
69
- if (typeof process.env['PORT'] !== 'string' && typeof process.env['APP_PORT'] === 'string') {
70
- process.env['PORT'] = process.env['APP_PORT'];
71
- }
72
- if (typeof process.env['NODE_ENV'] !== 'string' && typeof process.env['APP_MODE'] === 'string') {
73
- const mode = normalizeAppMode(process.env['APP_MODE']);
74
- process.env['NODE_ENV'] = mode === 'production' ? 'production' : 'development';
70
+ if (Env.get('PORT', '') === '' && Env.get('APP_PORT', '') !== '') {
71
+ Env.set('PORT', Env.get('APP_PORT', ''));
75
72
  }
76
73
  };
77
74
  const readEnvFileIfExists = (cwd, filename) => {
@@ -82,11 +79,11 @@ const readEnvFileIfExists = (cwd, filename) => {
82
79
  return parseEnvFile(raw);
83
80
  };
84
81
  const resolveAppMode = (cwd) => {
85
- const existing = process.env['APP_MODE'];
86
- if (typeof existing === 'string' && existing.trim() !== '')
82
+ const existing = Env.get('NODE_ENV', '');
83
+ if (existing.trim() !== '')
87
84
  return normalizeAppMode(existing);
88
85
  const fromDotEnv = readEnvFileIfExists(cwd, '.env');
89
- const value = fromDotEnv?.['APP_MODE'];
86
+ const value = fromDotEnv?.['NODE_ENV'];
90
87
  if (typeof value === 'string' && value.trim() !== '')
91
88
  return normalizeAppMode(value);
92
89
  return undefined;
@@ -132,6 +129,10 @@ const load = (options = {}) => {
132
129
  // .env is primary: overlays only fill missing values and never override base.
133
130
  applyToProcessEnv(parsed, baseApplied ? false : overrideExisting);
134
131
  }
132
+ // Set NODE_ENV to the normalized mode if we have one (after applying files)
133
+ if (mode !== undefined) {
134
+ Env.set('NODE_ENV', mode);
135
+ }
135
136
  cached = { loadedFiles: files, mode };
136
137
  return cached;
137
138
  };
@@ -140,21 +141,21 @@ const applyCliOverrides = (overrides) => {
140
141
  // Ensure base env is loaded first.
141
142
  ensureLoaded();
142
143
  if (typeof overrides.runtime === 'string' && overrides.runtime.trim() !== '') {
143
- process.env['RUNTIME'] = overrides.runtime.trim();
144
+ Env.set('RUNTIME', overrides.runtime.trim());
144
145
  }
145
146
  if (typeof overrides.nodeEnv === 'string') {
146
- process.env['NODE_ENV'] = overrides.nodeEnv;
147
+ Env.set('NODE_ENV', overrides.nodeEnv);
147
148
  }
148
149
  if (typeof overrides.port === 'number') {
149
- process.env['PORT'] = String(overrides.port);
150
- process.env['APP_PORT'] = String(overrides.port);
150
+ Env.set('PORT', String(overrides.port));
151
+ Env.set('APP_PORT', String(overrides.port));
151
152
  }
152
153
  // Keep PORT/APP_PORT in sync if only one exists.
153
- if (typeof process.env['PORT'] !== 'string' && typeof process.env['APP_PORT'] === 'string') {
154
- process.env['PORT'] = process.env['APP_PORT'];
154
+ if (Env.get('PORT', '') === '' && Env.get('APP_PORT', '') !== '') {
155
+ Env.set('PORT', Env.get('APP_PORT', ''));
155
156
  }
156
- if (typeof process.env['APP_PORT'] !== 'string' && typeof process.env['PORT'] === 'string') {
157
- process.env['APP_PORT'] = process.env['PORT'];
157
+ if (Env.get('APP_PORT', '') === '' && Env.get('PORT', '') !== '') {
158
+ Env.set('APP_PORT', Env.get('PORT', ''));
158
159
  }
159
160
  };
160
161
  const getState = () => ensureLoaded();
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/spawn.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA8BD,eAAO,MAAM,SAAS;wBACM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;EAwE7D,CAAC"}
1
+ {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/spawn.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA8BD,eAAO,MAAM,SAAS;wBACM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;EA+E7D,CAAC"}
@@ -58,12 +58,21 @@ export const SpawnUtil = Object.freeze({
58
58
  throw wrapped;
59
59
  }
60
60
  };
61
- const onSigint = () => forwardSignal('SIGINT');
62
- const onSigterm = () => forwardSignal('SIGTERM');
63
- if (forwardSignals) {
64
- process.on('SIGINT', onSigint);
65
- process.on('SIGTERM', onSigterm);
66
- }
61
+ const onSigint = () => {
62
+ if (forwardSignals) {
63
+ forwardSignal('SIGINT');
64
+ }
65
+ // If not forwarding, handle to prevent the parent from exiting before the child
66
+ // finishes its graceful shutdown (child receives SIGINT directly in TTY).
67
+ };
68
+ const onSigterm = () => {
69
+ if (forwardSignals) {
70
+ forwardSignal('SIGTERM');
71
+ }
72
+ // Same rationale as SIGINT: keep parent alive while waiting for child to exit.
73
+ };
74
+ process.on('SIGINT', onSigint);
75
+ process.on('SIGTERM', onSigterm);
67
76
  try {
68
77
  const result = await new Promise((resolve, reject) => {
69
78
  child.once('error', (error) => {
@@ -83,10 +92,8 @@ export const SpawnUtil = Object.freeze({
83
92
  throw ErrorFactory.createTryCatchError('Failed to spawn child process', error);
84
93
  }
85
94
  finally {
86
- if (forwardSignals) {
87
- process.off('SIGINT', onSigint);
88
- process.off('SIGTERM', onSigterm);
89
- }
95
+ process.off('SIGINT', onSigint);
96
+ process.off('SIGTERM', onSigterm);
90
97
  }
91
98
  },
92
99
  });
@@ -234,7 +234,7 @@ const processMessage = async (options, msg, maxAttempts, result) => {
234
234
  };
235
235
  export const QueueWorkRunner = Object.freeze({
236
236
  async run(options) {
237
- registerQueuesFromRuntimeConfig(queueConfig);
237
+ await registerQueuesFromRuntimeConfig(queueConfig);
238
238
  const startedAtMs = Date.now();
239
239
  const maxItems = typeof options.maxItems === 'number' ? options.maxItems : 1000;
240
240
  const timeoutSeconds = typeof options.timeoutSeconds === 'number' ? options.timeoutSeconds : 10;
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalServiceUtils.d.ts","sourceRoot":"","sources":["../../../src/common/ExternalServiceUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,iBAAa,KAAG,MAS1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,UAAU,MAAM,EAAE,KACjB,IAWF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,SAAS,MAAM,KAAG,KAEjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GAAU,KAAK,MAAM,EAAE,SAAS,WAAW,KAAG,OAAO,CAAC,QAAQ,CAcnF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAChC,SAAS,OAAO,EAChB,OAAO,CAAC,EACR,QAAQ,MAAM,KACb;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAY9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;IACtB;;OAEG;iBACU,MAAM;IAMnB;;OAEG;oBACa,MAAM;IAItB;;OAEG;8BACuB,MAAM,GAAG,OAAO;IAI1C;;OAEG;gCAEO,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,eACpD,MAAM,UACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;IAYjC;;OAEG;+BAEO,WAAW,GAAG,WAAW,eACpB,MAAM,SACZ,KAAK,UACJ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;CASlC,CAAC"}
1
+ {"version":3,"file":"ExternalServiceUtils.d.ts","sourceRoot":"","sources":["../../../src/common/ExternalServiceUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,iBAAa,KAAG,MAe1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,UAAU,MAAM,EAAE,KACjB,IAWF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,SAAS,MAAM,KAAG,KAEjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GAAU,KAAK,MAAM,EAAE,SAAS,WAAW,KAAG,OAAO,CAAC,QAAQ,CAcnF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAChC,SAAS,OAAO,EAChB,OAAO,CAAC,EACR,QAAQ,MAAM,KACb;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAY9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;IACtB;;OAEG;iBACU,MAAM;IAMnB;;OAEG;oBACa,MAAM;IAItB;;OAEG;8BACuB,MAAM,GAAG,OAAO;IAI1C;;OAEG;gCAEO,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,eACpD,MAAM,UACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;IAYjC;;OAEG;+BAEO,WAAW,GAAG,WAAW,eACpB,MAAM,SACZ,KAAK,UACJ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;CASlC,CAAC"}
@@ -11,14 +11,19 @@ import { ErrorFactory } from '../exceptions/ZintrustError.js';
11
11
  export const readEnvString = (key, fallback = '') => {
12
12
  const anyEnv = Env;
13
13
  const fromEnv = typeof anyEnv.get === 'function' ? anyEnv.get(key, '') : '';
14
- if (typeof fromEnv === 'string' && fromEnv.trim() !== '')
14
+ if (typeof fromEnv === 'string' && fromEnv.trim() !== '') {
15
15
  return fromEnv;
16
+ }
17
+ const getEnv = anyEnv[key];
18
+ if (typeof getEnv === 'string' && getEnv.trim() !== '') {
19
+ return getEnv;
20
+ }
16
21
  if (typeof process !== 'undefined') {
17
22
  const raw = process.env?.[key];
18
23
  if (typeof raw === 'string')
19
24
  return raw;
20
25
  }
21
- return fromEnv ?? fallback;
26
+ return fallback;
22
27
  };
23
28
  /**
24
29
  * Validate required parameters for external service calls
@@ -1 +1 @@
1
- {"version":3,"file":"HealthRoutes.d.ts","sourceRoot":"","sources":["../../../src/common/HealthRoutes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AA4HnD;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,OAAO,KAAG,IAItD,CAAC"}
1
+ {"version":3,"file":"HealthRoutes.d.ts","sourceRoot":"","sources":["../../../src/common/HealthRoutes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AA6KnD;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,OAAO,KAAG,IAItD,CAAC"}