@zintrust/core 0.1.40 → 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 (460) 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 -290
  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 -5
  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 +132 -17
  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.js +16 -15
  110. package/src/cli/workers/QueueWorkRunner.js +1 -1
  111. package/src/common/HealthRoutes.d.ts.map +1 -1
  112. package/src/common/HealthRoutes.js +50 -2
  113. package/src/common/RemoteSignedJson.d.ts +1 -0
  114. package/src/common/RemoteSignedJson.d.ts.map +1 -1
  115. package/src/common/RemoteSignedJson.js +39 -13
  116. package/src/common/index.d.ts +1 -0
  117. package/src/common/index.d.ts.map +1 -1
  118. package/src/common/index.js +12 -1
  119. package/src/config/FileLogWriter.d.ts.map +1 -1
  120. package/src/config/FileLogWriter.js +21 -6
  121. package/src/config/app.d.ts +4 -0
  122. package/src/config/app.d.ts.map +1 -1
  123. package/src/config/app.js +4 -0
  124. package/src/config/cache.d.ts.map +1 -1
  125. package/src/config/cache.js +22 -2
  126. package/src/config/cloudflare.d.ts +5 -1
  127. package/src/config/cloudflare.d.ts.map +1 -1
  128. package/src/config/cloudflare.js +48 -0
  129. package/src/config/database.d.ts.map +1 -1
  130. package/src/config/database.js +48 -13
  131. package/src/config/env.d.ts +87 -2
  132. package/src/config/env.d.ts.map +1 -1
  133. package/src/config/env.js +156 -17
  134. package/src/config/index.d.ts +1 -0
  135. package/src/config/index.d.ts.map +1 -1
  136. package/src/config/mail.d.ts.map +1 -1
  137. package/src/config/mail.js +16 -10
  138. package/src/config/middleware.d.ts +5 -0
  139. package/src/config/middleware.d.ts.map +1 -1
  140. package/src/config/middleware.js +19 -1
  141. package/src/config/queue.d.ts.map +1 -1
  142. package/src/config/queue.js +70 -9
  143. package/src/config/redis.d.ts.map +1 -1
  144. package/src/config/redis.js +48 -13
  145. package/src/config/storage.d.ts.map +1 -1
  146. package/src/config/storage.js +1 -0
  147. package/src/config/type.d.ts +18 -0
  148. package/src/config/type.d.ts.map +1 -1
  149. package/src/config/workers.d.ts.map +1 -1
  150. package/src/config/workers.js +122 -16
  151. package/src/functions/cloudflare.d.ts.map +1 -1
  152. package/src/functions/cloudflare.js +55 -1
  153. package/src/health/StartupHealthChecks.js +1 -1
  154. package/src/http/FileUpload.d.ts +3 -2
  155. package/src/http/FileUpload.d.ts.map +1 -1
  156. package/src/http/Kernel.d.ts.map +1 -1
  157. package/src/http/Kernel.js +2 -1
  158. package/src/http/error-pages/ErrorPageRenderer.d.ts +4 -0
  159. package/src/http/error-pages/ErrorPageRenderer.d.ts.map +1 -1
  160. package/src/http/error-pages/ErrorPageRenderer.js +141 -1
  161. package/src/http/middleware/BodyParsingMiddleware.d.ts.map +1 -1
  162. package/src/http/middleware/BodyParsingMiddleware.js +33 -6
  163. package/src/index.d.ts +25 -53
  164. package/src/index.d.ts.map +1 -1
  165. package/src/index.js +30 -14
  166. package/src/microservices/ServiceAuthMiddleware.d.ts.map +1 -1
  167. package/src/microservices/ServiceAuthMiddleware.js +12 -4
  168. package/src/middleware/CsrfMiddleware.d.ts.map +1 -1
  169. package/src/middleware/CsrfMiddleware.js +30 -16
  170. package/src/middleware/ErrorHandlerMiddleware.d.ts.map +1 -1
  171. package/src/middleware/ErrorHandlerMiddleware.js +2 -1
  172. package/src/migrations/MigrationLoader.js +1 -1
  173. package/src/migrations/schema/SchemaCompiler.d.ts.map +1 -1
  174. package/src/migrations/schema/SchemaCompiler.js +6 -3
  175. package/src/node-singletons/crypto.d.ts +1 -1
  176. package/src/node-singletons/crypto.d.ts.map +1 -1
  177. package/src/node-singletons/crypto.js +1 -1
  178. package/src/node-singletons/fs.d.ts +1 -1
  179. package/src/node-singletons/fs.d.ts.map +1 -1
  180. package/src/node-singletons/path.d.ts +1 -1
  181. package/src/node-singletons/path.d.ts.map +1 -1
  182. package/src/node-singletons/path.js +1 -1
  183. package/src/node-singletons/stream.d.ts +11 -0
  184. package/src/node-singletons/stream.d.ts.map +1 -0
  185. package/src/node-singletons/stream.js +8 -0
  186. package/src/observability/OpenTelemetry.d.ts +7 -0
  187. package/src/observability/OpenTelemetry.d.ts.map +1 -1
  188. package/src/observability/OpenTelemetry.js +49 -2
  189. package/src/orm/Database.d.ts +4 -0
  190. package/src/orm/Database.d.ts.map +1 -1
  191. package/src/orm/Database.js +80 -9
  192. package/src/orm/DatabaseRuntimeRegistration.d.ts.map +1 -1
  193. package/src/orm/DatabaseRuntimeRegistration.js +2 -0
  194. package/src/orm/QueryBuilder.d.ts +1 -0
  195. package/src/orm/QueryBuilder.d.ts.map +1 -1
  196. package/src/orm/QueryBuilder.js +33 -3
  197. package/src/orm/SchemaCompiler.d.ts.map +1 -1
  198. package/src/orm/SchemaCompiler.js +6 -3
  199. package/src/orm/adapters/D1RemoteAdapter.d.ts.map +1 -1
  200. package/src/orm/adapters/D1RemoteAdapter.js +14 -1
  201. package/src/orm/adapters/MongoDBProxyAdapter.d.ts +3 -0
  202. package/src/orm/adapters/MongoDBProxyAdapter.d.ts.map +1 -0
  203. package/src/orm/adapters/MongoDBProxyAdapter.js +128 -0
  204. package/src/orm/adapters/MySQLProxyAdapter.d.ts +11 -0
  205. package/src/orm/adapters/MySQLProxyAdapter.d.ts.map +1 -0
  206. package/src/orm/adapters/MySQLProxyAdapter.js +143 -0
  207. package/src/orm/adapters/PostgreSQLProxyAdapter.d.ts +11 -0
  208. package/src/orm/adapters/PostgreSQLProxyAdapter.d.ts.map +1 -0
  209. package/src/orm/adapters/PostgreSQLProxyAdapter.js +147 -0
  210. package/src/orm/adapters/ProxyCache.d.ts +9 -0
  211. package/src/orm/adapters/ProxyCache.d.ts.map +1 -0
  212. package/src/orm/adapters/ProxyCache.js +24 -0
  213. package/src/orm/adapters/ProxySignedRequest.d.ts +11 -0
  214. package/src/orm/adapters/ProxySignedRequest.d.ts.map +1 -0
  215. package/src/orm/adapters/ProxySignedRequest.js +30 -0
  216. package/src/orm/adapters/ProxySigningPath.d.ts +3 -0
  217. package/src/orm/adapters/ProxySigningPath.d.ts.map +1 -0
  218. package/src/orm/adapters/ProxySigningPath.js +25 -0
  219. package/src/orm/adapters/SqlProxyAdapterUtils.d.ts +19 -0
  220. package/src/orm/adapters/SqlProxyAdapterUtils.d.ts.map +1 -0
  221. package/src/orm/adapters/SqlProxyAdapterUtils.js +35 -0
  222. package/src/orm/adapters/SqlServerProxyAdapter.d.ts +3 -0
  223. package/src/orm/adapters/SqlServerProxyAdapter.d.ts.map +1 -0
  224. package/src/orm/adapters/SqlServerProxyAdapter.js +146 -0
  225. package/src/performance/Optimizer.d.ts +1 -0
  226. package/src/performance/Optimizer.d.ts.map +1 -1
  227. package/src/performance/Optimizer.js +21 -8
  228. package/src/proxy/ErrorHandler.d.ts +11 -0
  229. package/src/proxy/ErrorHandler.d.ts.map +1 -0
  230. package/src/proxy/ErrorHandler.js +7 -0
  231. package/src/proxy/PoolManager.d.ts +8 -0
  232. package/src/proxy/PoolManager.d.ts.map +1 -0
  233. package/src/proxy/PoolManager.js +18 -0
  234. package/src/proxy/ProxyBackend.d.ts +18 -0
  235. package/src/proxy/ProxyBackend.d.ts.map +1 -0
  236. package/src/proxy/ProxyBackend.js +1 -0
  237. package/src/proxy/ProxyConfig.d.ts +12 -0
  238. package/src/proxy/ProxyConfig.d.ts.map +1 -0
  239. package/src/proxy/ProxyConfig.js +1 -0
  240. package/src/proxy/ProxyRegistry.d.ts +10 -0
  241. package/src/proxy/ProxyRegistry.d.ts.map +1 -0
  242. package/src/proxy/ProxyRegistry.js +11 -0
  243. package/src/proxy/ProxyServer.d.ts +21 -0
  244. package/src/proxy/ProxyServer.d.ts.map +1 -0
  245. package/src/proxy/ProxyServer.js +84 -0
  246. package/src/proxy/ProxyServerUtils.d.ts +37 -0
  247. package/src/proxy/ProxyServerUtils.d.ts.map +1 -0
  248. package/src/proxy/ProxyServerUtils.js +42 -0
  249. package/src/proxy/ProxySigningConfigResolver.d.ts +22 -0
  250. package/src/proxy/ProxySigningConfigResolver.d.ts.map +1 -0
  251. package/src/proxy/ProxySigningConfigResolver.js +24 -0
  252. package/src/proxy/ProxySigningRequest.d.ts +12 -0
  253. package/src/proxy/ProxySigningRequest.d.ts.map +1 -0
  254. package/src/proxy/ProxySigningRequest.js +31 -0
  255. package/src/proxy/RequestValidator.d.ts +15 -0
  256. package/src/proxy/RequestValidator.d.ts.map +1 -0
  257. package/src/proxy/RequestValidator.js +25 -0
  258. package/src/proxy/SigningService.d.ts +39 -0
  259. package/src/proxy/SigningService.d.ts.map +1 -0
  260. package/src/proxy/SigningService.js +107 -0
  261. package/src/proxy/SqlPayloadValidator.d.ts +13 -0
  262. package/src/proxy/SqlPayloadValidator.d.ts.map +1 -0
  263. package/src/proxy/SqlPayloadValidator.js +14 -0
  264. package/src/proxy/d1/ZintrustD1Proxy.d.ts +2 -0
  265. package/src/proxy/d1/ZintrustD1Proxy.d.ts.map +1 -0
  266. package/src/proxy/d1/ZintrustD1Proxy.js +1 -0
  267. package/src/proxy/d1/register.d.ts +2 -0
  268. package/src/proxy/d1/register.d.ts.map +1 -0
  269. package/src/proxy/d1/register.js +5 -0
  270. package/src/proxy/kv/ZintrustKvProxy.d.ts +2 -0
  271. package/src/proxy/kv/ZintrustKvProxy.d.ts.map +1 -0
  272. package/src/proxy/kv/ZintrustKvProxy.js +1 -0
  273. package/src/proxy/kv/register.d.ts +2 -0
  274. package/src/proxy/kv/register.d.ts.map +1 -0
  275. package/src/proxy/kv/register.js +5 -0
  276. package/src/proxy/mongodb/MongoDBProxyServer.d.ts +33 -0
  277. package/src/proxy/mongodb/MongoDBProxyServer.d.ts.map +1 -0
  278. package/src/proxy/mongodb/MongoDBProxyServer.js +202 -0
  279. package/src/proxy/mongodb/register.d.ts +2 -0
  280. package/src/proxy/mongodb/register.d.ts.map +1 -0
  281. package/src/proxy/mongodb/register.js +5 -0
  282. package/src/proxy/mysql/MySqlProxyServer.d.ts +14 -0
  283. package/src/proxy/mysql/MySqlProxyServer.d.ts.map +1 -0
  284. package/src/proxy/mysql/MySqlProxyServer.js +169 -0
  285. package/src/proxy/mysql/register.d.ts +2 -0
  286. package/src/proxy/mysql/register.d.ts.map +1 -0
  287. package/src/proxy/mysql/register.js +5 -0
  288. package/src/proxy/postgres/PostgresProxyServer.d.ts +14 -0
  289. package/src/proxy/postgres/PostgresProxyServer.d.ts.map +1 -0
  290. package/src/proxy/postgres/PostgresProxyServer.js +140 -0
  291. package/src/proxy/postgres/register.d.ts +2 -0
  292. package/src/proxy/postgres/register.d.ts.map +1 -0
  293. package/src/proxy/postgres/register.js +5 -0
  294. package/src/proxy/redis/RedisProxyServer.d.ts +12 -0
  295. package/src/proxy/redis/RedisProxyServer.d.ts.map +1 -0
  296. package/src/proxy/redis/RedisProxyServer.js +192 -0
  297. package/src/proxy/redis/register.d.ts +2 -0
  298. package/src/proxy/redis/register.d.ts.map +1 -0
  299. package/src/proxy/redis/register.js +5 -0
  300. package/src/proxy/smtp/SmtpProxyServer.d.ts +19 -0
  301. package/src/proxy/smtp/SmtpProxyServer.d.ts.map +1 -0
  302. package/src/proxy/smtp/SmtpProxyServer.js +289 -0
  303. package/src/proxy/smtp/register.d.ts +2 -0
  304. package/src/proxy/smtp/register.d.ts.map +1 -0
  305. package/src/proxy/smtp/register.js +5 -0
  306. package/src/proxy/sqlserver/SqlServerProxyServer.d.ts +14 -0
  307. package/src/proxy/sqlserver/SqlServerProxyServer.d.ts.map +1 -0
  308. package/src/proxy/sqlserver/SqlServerProxyServer.js +168 -0
  309. package/src/proxy/sqlserver/register.d.ts +2 -0
  310. package/src/proxy/sqlserver/register.d.ts.map +1 -0
  311. package/src/proxy/sqlserver/register.js +5 -0
  312. package/src/routes/doc.d.ts.map +1 -1
  313. package/src/routes/doc.js +16 -2
  314. package/src/routes/error.d.ts +5 -4
  315. package/src/routes/error.d.ts.map +1 -1
  316. package/src/routes/error.js +15 -13
  317. package/src/routes/errorPages.d.ts +2 -0
  318. package/src/routes/errorPages.d.ts.map +1 -1
  319. package/src/routes/errorPages.js +144 -4
  320. package/src/runtime/PluginAutoImports.d.ts +1 -0
  321. package/src/runtime/PluginAutoImports.d.ts.map +1 -1
  322. package/src/runtime/PluginAutoImports.js +94 -9
  323. package/src/runtime/RuntimeAdapter.d.ts +8 -9
  324. package/src/runtime/RuntimeAdapter.d.ts.map +1 -1
  325. package/src/runtime/RuntimeAdapter.js +120 -34
  326. package/src/runtime/RuntimeServices.d.ts +47 -0
  327. package/src/runtime/RuntimeServices.d.ts.map +1 -0
  328. package/src/runtime/RuntimeServices.js +164 -0
  329. package/src/runtime/StartupConfigFileRegistry.d.ts +4 -4
  330. package/src/runtime/StartupConfigFileRegistry.d.ts.map +1 -1
  331. package/src/runtime/StartupConfigFileRegistry.js +12 -0
  332. package/src/runtime/WorkerAdapterImports.d.ts +5 -0
  333. package/src/runtime/WorkerAdapterImports.d.ts.map +1 -0
  334. package/src/runtime/WorkerAdapterImports.js +17 -0
  335. package/src/runtime/WorkersModule.d.ts +6 -0
  336. package/src/runtime/WorkersModule.d.ts.map +1 -0
  337. package/src/runtime/WorkersModule.js +278 -0
  338. package/src/runtime/adapters/CloudflareAdapter.d.ts.map +1 -1
  339. package/src/runtime/adapters/CloudflareAdapter.js +19 -2
  340. package/src/runtime/adapters/DenoAdapter.js +1 -0
  341. package/src/runtime/adapters/FargateAdapter.js +1 -1
  342. package/src/runtime/adapters/LambdaAdapter.js +1 -1
  343. package/src/runtime/adapters/NodeServerAdapter.js +1 -1
  344. package/src/runtime/detectRuntime.d.ts +10 -0
  345. package/src/runtime/detectRuntime.d.ts.map +1 -0
  346. package/src/runtime/detectRuntime.js +57 -0
  347. package/src/runtime/useFileLoader.d.ts.map +1 -1
  348. package/src/runtime/useFileLoader.js +16 -0
  349. package/src/scripts/TemplateImportsCheck.js +2 -2
  350. package/src/scripts/TemplateSync.js +3 -4
  351. package/src/security/CsrfTokenManager.d.ts.map +1 -1
  352. package/src/security/CsrfTokenManager.js +12 -0
  353. package/src/security/Hash.d.ts +1 -1
  354. package/src/security/Hash.d.ts.map +1 -1
  355. package/src/security/Hash.js +31 -36
  356. package/src/seeders/SeederLoader.js +1 -1
  357. package/src/session/SessionManager.d.ts +3 -0
  358. package/src/session/SessionManager.d.ts.map +1 -1
  359. package/src/session/SessionManager.js +49 -10
  360. package/src/sockets/CloudflareSocket.d.ts +24 -0
  361. package/src/sockets/CloudflareSocket.d.ts.map +1 -0
  362. package/src/sockets/CloudflareSocket.js +259 -0
  363. package/src/start.d.ts.map +1 -1
  364. package/src/start.js +1 -8
  365. package/src/templates/project/basic/src/zintrust.plugins.wg.ts.tpl +8 -0
  366. package/src/tools/mail/drivers/Smtp.d.ts.map +1 -1
  367. package/src/tools/mail/drivers/Smtp.js +223 -18
  368. package/src/tools/mail/index.d.ts.map +1 -1
  369. package/src/tools/mail/index.js +5 -4
  370. package/src/tools/mail/template-loader.d.ts.map +1 -1
  371. package/src/tools/mail/template-loader.js +197 -29
  372. package/src/tools/mail/templates/auth-password-reset.d.ts +3 -0
  373. package/src/tools/mail/templates/auth-password-reset.d.ts.map +1 -0
  374. package/src/tools/mail/templates/auth-password-reset.js +231 -0
  375. package/src/tools/mail/templates/auth-welcome.d.ts +3 -0
  376. package/src/tools/mail/templates/auth-welcome.d.ts.map +1 -0
  377. package/src/tools/mail/templates/auth-welcome.js +236 -0
  378. package/src/tools/mail/templates/general.d.ts +3 -0
  379. package/src/tools/mail/templates/general.d.ts.map +1 -0
  380. package/src/tools/mail/templates/general.js +109 -0
  381. package/src/tools/mail/templates/index.js +2 -2
  382. package/src/tools/mail/templates/job-completed.d.ts +3 -0
  383. package/src/tools/mail/templates/job-completed.d.ts.map +1 -0
  384. package/src/tools/mail/templates/job-completed.js +188 -0
  385. package/src/tools/mail/templates/notifications-new-comment.d.ts +3 -0
  386. package/src/tools/mail/templates/notifications-new-comment.d.ts.map +1 -0
  387. package/src/tools/mail/templates/notifications-new-comment.js +228 -0
  388. package/src/tools/mail/templates/password-reset.d.ts +3 -0
  389. package/src/tools/mail/templates/password-reset.d.ts.map +1 -0
  390. package/src/tools/mail/templates/password-reset.js +221 -0
  391. package/src/tools/mail/templates/performance-report.d.ts +3 -0
  392. package/src/tools/mail/templates/performance-report.d.ts.map +1 -0
  393. package/src/tools/mail/templates/performance-report.js +258 -0
  394. package/src/tools/mail/templates/welcome.d.ts +3 -0
  395. package/src/tools/mail/templates/welcome.d.ts.map +1 -0
  396. package/src/tools/mail/templates/welcome.js +187 -0
  397. package/src/tools/mail/templates/worker-alert.d.ts +3 -0
  398. package/src/tools/mail/templates/worker-alert.d.ts.map +1 -0
  399. package/src/tools/mail/templates/worker-alert.js +229 -0
  400. package/src/tools/notification/Notification.js +1 -1
  401. package/src/tools/notification/testingHelpers.js +6 -5
  402. package/src/tools/queue/AdvancedQueue.js +2 -6
  403. package/src/tools/queue/IdempotencyManager.d.ts +6 -0
  404. package/src/tools/queue/IdempotencyManager.d.ts.map +1 -0
  405. package/src/tools/queue/IdempotencyManager.js +36 -0
  406. package/src/tools/queue/JobHeartbeatStore.d.ts +16 -0
  407. package/src/tools/queue/JobHeartbeatStore.d.ts.map +1 -0
  408. package/src/tools/queue/JobHeartbeatStore.js +67 -0
  409. package/src/tools/queue/JobReconciliationRunner.d.ts +16 -0
  410. package/src/tools/queue/JobReconciliationRunner.d.ts.map +1 -0
  411. package/src/tools/queue/JobReconciliationRunner.js +88 -0
  412. package/src/tools/queue/JobRecoveryDaemon.d.ts +27 -0
  413. package/src/tools/queue/JobRecoveryDaemon.d.ts.map +1 -0
  414. package/src/tools/queue/JobRecoveryDaemon.js +205 -0
  415. package/src/tools/queue/JobStateTracker.d.ts +131 -0
  416. package/src/tools/queue/JobStateTracker.d.ts.map +1 -0
  417. package/src/tools/queue/JobStateTracker.js +387 -0
  418. package/src/tools/queue/JobStateTrackerDbPersistence.d.ts +12 -0
  419. package/src/tools/queue/JobStateTrackerDbPersistence.d.ts.map +1 -0
  420. package/src/tools/queue/JobStateTrackerDbPersistence.js +148 -0
  421. package/src/tools/queue/Queue.d.ts.map +1 -1
  422. package/src/tools/queue/Queue.js +160 -16
  423. package/src/tools/queue/QueueDataRedactor.d.ts +6 -0
  424. package/src/tools/queue/QueueDataRedactor.d.ts.map +1 -0
  425. package/src/tools/queue/QueueDataRedactor.js +45 -0
  426. package/src/tools/queue/QueueExtensions.d.ts.map +1 -1
  427. package/src/tools/queue/QueueExtensions.js +2 -1
  428. package/src/tools/queue/QueueReliabilityMetrics.d.ts +38 -0
  429. package/src/tools/queue/QueueReliabilityMetrics.d.ts.map +1 -0
  430. package/src/tools/queue/QueueReliabilityMetrics.js +131 -0
  431. package/src/tools/queue/QueueReliabilityOrchestrator.d.ts +7 -0
  432. package/src/tools/queue/QueueReliabilityOrchestrator.d.ts.map +1 -0
  433. package/src/tools/queue/QueueReliabilityOrchestrator.js +59 -0
  434. package/src/tools/queue/QueueRuntimeRegistration.d.ts +1 -9
  435. package/src/tools/queue/QueueRuntimeRegistration.d.ts.map +1 -1
  436. package/src/tools/queue/QueueRuntimeRegistration.js +75 -4
  437. package/src/tools/queue/QueueTracing.d.ts +32 -0
  438. package/src/tools/queue/QueueTracing.d.ts.map +1 -0
  439. package/src/tools/queue/QueueTracing.js +151 -0
  440. package/src/tools/queue/StalledJobMonitor.d.ts +5 -0
  441. package/src/tools/queue/StalledJobMonitor.d.ts.map +1 -0
  442. package/src/tools/queue/StalledJobMonitor.js +21 -0
  443. package/src/tools/queue/TimeoutManager.d.ts +14 -0
  444. package/src/tools/queue/TimeoutManager.d.ts.map +1 -0
  445. package/src/tools/queue/TimeoutManager.js +77 -0
  446. package/src/tools/queue/drivers/Redis.d.ts +1 -0
  447. package/src/tools/queue/drivers/Redis.d.ts.map +1 -1
  448. package/src/tools/queue/drivers/Redis.js +1 -0
  449. package/src/tools/queue/index.d.ts +10 -0
  450. package/src/tools/queue/index.d.ts.map +1 -1
  451. package/src/tools/queue/index.js +10 -0
  452. package/src/tools/storage/drivers/R2.d.ts +13 -0
  453. package/src/tools/storage/drivers/R2.d.ts.map +1 -1
  454. package/src/tools/storage/drivers/R2.js +29 -0
  455. package/src/zintrust.plugins.d.ts +9 -0
  456. package/src/zintrust.plugins.d.ts.map +1 -0
  457. package/src/zintrust.plugins.js +7 -0
  458. package/src/zintrust.plugins.wg.d.ts +9 -0
  459. package/src/zintrust.plugins.wg.d.ts.map +1 -0
  460. 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,MAAM,4BAA4B,CAAC;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,OAA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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,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc,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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;IAC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E,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;AAED;;GAEG;AAEH,wBAAgB,QAAQ,CACtB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,qBAAqB,CAAC,CA+ChC;AAmUD,eAAO,MAAM,iBAAiB;;;;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
+ 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) => {
@@ -61,13 +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'];
70
+ if (Env.get('PORT', '') === '' && Env.get('APP_PORT', '') !== '') {
71
+ Env.set('PORT', Env.get('APP_PORT', ''));
71
72
  }
72
73
  };
73
74
  const readEnvFileIfExists = (cwd, filename) => {
@@ -78,8 +79,8 @@ const readEnvFileIfExists = (cwd, filename) => {
78
79
  return parseEnvFile(raw);
79
80
  };
80
81
  const resolveAppMode = (cwd) => {
81
- const existing = process.env['NODE_ENV'];
82
- if (typeof existing === 'string' && existing.trim() !== '')
82
+ const existing = Env.get('NODE_ENV', '');
83
+ if (existing.trim() !== '')
83
84
  return normalizeAppMode(existing);
84
85
  const fromDotEnv = readEnvFileIfExists(cwd, '.env');
85
86
  const value = fromDotEnv?.['NODE_ENV'];
@@ -130,7 +131,7 @@ const load = (options = {}) => {
130
131
  }
131
132
  // Set NODE_ENV to the normalized mode if we have one (after applying files)
132
133
  if (mode !== undefined) {
133
- process.env['NODE_ENV'] = mode;
134
+ Env.set('NODE_ENV', mode);
134
135
  }
135
136
  cached = { loadedFiles: files, mode };
136
137
  return cached;
@@ -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();
@@ -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":"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"}
@@ -5,18 +5,55 @@
5
5
  import { appConfig } from '../config/app.js';
6
6
  import { RuntimeHealthProbes } from '../health/RuntimeHealthProbes.js';
7
7
  import { HealthUtils } from './ExternalServiceUtils.js';
8
+ import { databaseConfig } from '../config/database.js';
8
9
  import { Env } from '../config/env.js';
9
10
  import { Logger } from '../config/logger.js';
10
11
  import { Router } from '../routes/Router.js';
11
12
  import { useDatabase } from '../orm/Database.js';
12
13
  import { QueryBuilder } from '../orm/QueryBuilder.js';
14
+ const isMissingDefaultDatabase = (error) => {
15
+ if (typeof error !== 'object' || error === null)
16
+ return false;
17
+ const maybe = error;
18
+ if (maybe.name !== 'ConfigError' || maybe.code !== 'CONFIG_ERROR')
19
+ return false;
20
+ return typeof maybe.message === 'string'
21
+ ? maybe.message.includes("Database connection 'default' is not registered")
22
+ : false;
23
+ };
24
+ const ensureDefaultDatabase = async () => {
25
+ try {
26
+ return useDatabase();
27
+ }
28
+ catch (error) {
29
+ if (!isMissingDefaultDatabase(error))
30
+ throw error;
31
+ try {
32
+ const mod = await import('../orm/DatabaseRuntimeRegistration.js');
33
+ mod.registerDatabasesFromRuntimeConfig?.(databaseConfig);
34
+ return useDatabase();
35
+ }
36
+ catch (innerError) {
37
+ Logger.warn('Database registration failed; skipping health DB check', innerError);
38
+ return null;
39
+ }
40
+ }
41
+ };
13
42
  /**
14
43
  * Health check endpoint handler
15
44
  */
16
45
  async function handleHealthRoute(_req, res) {
17
46
  const environment = Env.NODE_ENV ?? 'development';
18
47
  try {
19
- const db = useDatabase();
48
+ const db = await ensureDefaultDatabase();
49
+ if (db === null) {
50
+ const uptime = HealthUtils.getUptime();
51
+ res.json(HealthUtils.buildHealthResponse('healthy', environment, {
52
+ uptime,
53
+ database: 'unconfigured',
54
+ }));
55
+ return;
56
+ }
20
57
  const maybeIsConnected = db.isConnected;
21
58
  const maybeConnect = db.connect;
22
59
  if (typeof maybeIsConnected === 'function' && maybeIsConnected.call(db) === false) {
@@ -56,7 +93,18 @@ async function handleHealthReadyRoute(_req, res) {
56
93
  let databaseResponseTime = null;
57
94
  let cacheResponseTime = null;
58
95
  try {
59
- const db = useDatabase();
96
+ const db = await ensureDefaultDatabase();
97
+ if (db === null) {
98
+ res.json(HealthUtils.buildHealthResponse('ready', environment, {
99
+ dependencies: {
100
+ database: {
101
+ status: 'unconfigured',
102
+ responseTime: 0,
103
+ },
104
+ },
105
+ }));
106
+ return;
107
+ }
60
108
  const maybeIsConnected = db.isConnected;
61
109
  const maybeConnect = db.connect;
62
110
  if (typeof maybeIsConnected === 'function' && maybeIsConnected.call(db) === false) {
@@ -3,6 +3,7 @@ export type RemoteSignedJsonSettings = {
3
3
  keyId: string;
4
4
  secret: string;
5
5
  timeoutMs: number;
6
+ signaturePathPrefixToStrip?: string;
6
7
  missingUrlMessage: string;
7
8
  missingCredentialsMessage: string;
8
9
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteSignedJson.d.ts","sourceRoot":"","sources":["../../../src/common/RemoteSignedJson.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAElB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,yBAAyB,EAAE,MAAM,CAAC;IAElC,QAAQ,EAAE;QACR,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAoCF,eAAO,MAAM,gBAAgB;YACb,CAAC,YACH,wBAAwB,QAC5B,MAAM,WACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,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