@warlock.js/core 5.31.0 → 5.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1097) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/esm/application/app.d.mts +3 -3
  3. package/esm/application/app.d.mts.map +1 -1
  4. package/esm/application/application-config-types.d.mts +9 -2
  5. package/esm/application/application-config-types.d.mts.map +1 -1
  6. package/esm/application/application.d.mts +5 -7
  7. package/esm/application/application.d.mts.map +1 -1
  8. package/esm/application/application.mjs +3 -1
  9. package/esm/application/application.mjs.map +1 -1
  10. package/esm/application/boot-signal.d.mts +22 -20
  11. package/esm/application/boot-signal.d.mts.map +1 -1
  12. package/esm/application/boot-signal.mjs +15 -9
  13. package/esm/application/boot-signal.mjs.map +1 -1
  14. package/esm/application/index.d.mts +2 -1
  15. package/esm/application/index.mjs +1 -1
  16. package/esm/application/public-url.d.mts +1 -2
  17. package/esm/application/public-url.d.mts.map +1 -1
  18. package/esm/application/roles.d.mts +10 -11
  19. package/esm/application/roles.d.mts.map +1 -1
  20. package/esm/benchmark/benchmark-snapshots.d.mts +1 -3
  21. package/esm/benchmark/benchmark-snapshots.d.mts.map +1 -1
  22. package/esm/benchmark/benchmark.d.mts +1 -3
  23. package/esm/benchmark/benchmark.d.mts.map +1 -1
  24. package/esm/benchmark/channels/console.channel.d.mts +1 -3
  25. package/esm/benchmark/channels/console.channel.d.mts.map +1 -1
  26. package/esm/benchmark/channels/noop.channel.d.mts +1 -3
  27. package/esm/benchmark/channels/noop.channel.d.mts.map +1 -1
  28. package/esm/benchmark/index.mjs +1 -1
  29. package/esm/benchmark/profiler.d.mts +1 -3
  30. package/esm/benchmark/profiler.d.mts.map +1 -1
  31. package/esm/benchmark/profiler.mjs +2 -1
  32. package/esm/benchmark/profiler.mjs.map +1 -1
  33. package/esm/benchmark/types.d.mts +22 -17
  34. package/esm/benchmark/types.d.mts.map +1 -1
  35. package/esm/bootstrap/setup.d.mts +1 -2
  36. package/esm/bootstrap/setup.d.mts.map +1 -1
  37. package/esm/bootstrap.d.mts +1 -2
  38. package/esm/bootstrap.d.mts.map +1 -1
  39. package/esm/cache/database-cache-driver.d.mts +3 -5
  40. package/esm/cache/database-cache-driver.d.mts.map +1 -1
  41. package/esm/cache/database-cache-driver.mjs +1 -1
  42. package/esm/cache/index.d.mts +2 -1
  43. package/esm/cache/index.mjs +1 -1
  44. package/esm/cli/cli-commands.manager.mjs +6 -3
  45. package/esm/cli/cli-commands.manager.mjs.map +1 -1
  46. package/esm/cli/commands/agents-md/agents-md-command.action.mjs +3 -2
  47. package/esm/cli/commands/agents-md/agents-md-command.action.mjs.map +1 -1
  48. package/esm/cli/commands/ai/ai-command.action.mjs +140 -0
  49. package/esm/cli/commands/ai/ai-command.action.mjs.map +1 -0
  50. package/esm/cli/commands/ai.command.mjs +50 -0
  51. package/esm/cli/commands/ai.command.mjs.map +1 -0
  52. package/esm/cli/commands/board/board-command.action.mjs +1 -1
  53. package/esm/cli/commands/check/check-command.action.mjs +4 -1
  54. package/esm/cli/commands/check/check-command.action.mjs.map +1 -1
  55. package/esm/cli/commands/check/child-typecheck.mjs +1 -1
  56. package/esm/cli/commands/check/child-typecheck.mjs.map +1 -1
  57. package/esm/cli/commands/check/format-problems.mjs +1 -1
  58. package/esm/cli/commands/check.command.mjs +6 -1
  59. package/esm/cli/commands/check.command.mjs.map +1 -1
  60. package/esm/cli/commands/dev-server.command.mjs +3 -2
  61. package/esm/cli/commands/dev-server.command.mjs.map +1 -1
  62. package/esm/cli/commands/doctor/check.types.d.mts +29 -16
  63. package/esm/cli/commands/doctor/check.types.d.mts.map +1 -1
  64. package/esm/cli/commands/doctor/checks/locales-ts-deprecated.check.mjs +22 -27
  65. package/esm/cli/commands/doctor/checks/locales-ts-deprecated.check.mjs.map +1 -1
  66. package/esm/cli/commands/doctor/doctor-command.action.mjs +2 -1
  67. package/esm/cli/commands/doctor/doctor-command.action.mjs.map +1 -1
  68. package/esm/cli/commands/explain/explain-command.action.mjs +1 -1
  69. package/esm/cli/commands/generate/generators/controller.generator.mjs +5 -2
  70. package/esm/cli/commands/generate/generators/controller.generator.mjs.map +1 -1
  71. package/esm/cli/commands/generate/generators/endpoint.generator.mjs +5 -3
  72. package/esm/cli/commands/generate/generators/endpoint.generator.mjs.map +1 -1
  73. package/esm/cli/commands/generate/generators/model.generator.mjs +3 -2
  74. package/esm/cli/commands/generate/generators/model.generator.mjs.map +1 -1
  75. package/esm/cli/commands/generate/generators/repository.generator.mjs +3 -1
  76. package/esm/cli/commands/generate/generators/repository.generator.mjs.map +1 -1
  77. package/esm/cli/commands/generate/generators/resource.generator.mjs +3 -1
  78. package/esm/cli/commands/generate/generators/resource.generator.mjs.map +1 -1
  79. package/esm/cli/commands/generate/generators/service.generator.mjs +3 -1
  80. package/esm/cli/commands/generate/generators/service.generator.mjs.map +1 -1
  81. package/esm/cli/commands/generate/templates/endpoint-stubs.mjs +2 -2
  82. package/esm/cli/commands/generate/templates/endpoint-stubs.mjs.map +1 -1
  83. package/esm/cli/commands/generate/utils/endpoint-schema.mjs +1 -2
  84. package/esm/cli/commands/generate/utils/endpoint-schema.mjs.map +1 -1
  85. package/esm/cli/commands/generate/utils/name-parser.mjs +1 -1
  86. package/esm/cli/commands/generate/utils/path-resolver.mjs +1 -1
  87. package/esm/cli/commands/inspect/inspect-command.action.mjs +3 -2
  88. package/esm/cli/commands/inspect/inspect-command.action.mjs.map +1 -1
  89. package/esm/cli/commands/issue/collect-environment.mjs +187 -0
  90. package/esm/cli/commands/issue/collect-environment.mjs.map +1 -0
  91. package/esm/cli/commands/issue/issue-command.action.mjs +70 -0
  92. package/esm/cli/commands/issue/issue-command.action.mjs.map +1 -0
  93. package/esm/cli/commands/issue.command.mjs +31 -0
  94. package/esm/cli/commands/issue.command.mjs.map +1 -0
  95. package/esm/cli/commands/mcp/mcp-command.action.mjs +15 -14
  96. package/esm/cli/commands/mcp/mcp-command.action.mjs.map +1 -1
  97. package/esm/cli/commands/openapi-generator.action.mjs +1 -1
  98. package/esm/cli/commands/pm2/pm2-command.action.mjs +91 -0
  99. package/esm/cli/commands/pm2/pm2-command.action.mjs.map +1 -0
  100. package/esm/cli/commands/pm2/pm2-config.mjs +115 -0
  101. package/esm/cli/commands/pm2/pm2-config.mjs.map +1 -0
  102. package/esm/cli/commands/pm2.command.mjs +53 -0
  103. package/esm/cli/commands/pm2.command.mjs.map +1 -0
  104. package/esm/cli/commands/postman-generator.action.mjs +1 -1
  105. package/esm/cli/commands/routes/format-routes-table.mjs +1 -1
  106. package/esm/cli/commands/routes/route-row.mjs +1 -1
  107. package/esm/cli/commands/routes/routes-diff.action.mjs +2 -2
  108. package/esm/cli/commands/routes/routes-diff.action.mjs.map +1 -1
  109. package/esm/cli/commands/test.command.mjs +1 -1
  110. package/esm/cli/commands/trace/trace-command.action.mjs +1 -1
  111. package/esm/cli/commands-loader.mjs +1 -1
  112. package/esm/cli/framework-cli-commands.mjs +6 -0
  113. package/esm/cli/framework-cli-commands.mjs.map +1 -1
  114. package/esm/cli/parse-cli-args.mjs +2 -2
  115. package/esm/cli/parse-cli-args.mjs.map +1 -1
  116. package/esm/cli/start.d.mts +1 -1
  117. package/esm/cli/string-similarity.mjs +1 -1
  118. package/esm/commands/cli-command.d.mts +2 -4
  119. package/esm/commands/cli-command.d.mts.map +1 -1
  120. package/esm/commands/index.d.mts +2 -1
  121. package/esm/commands/index.mjs +1 -1
  122. package/esm/commands/types.d.mts +8 -8
  123. package/esm/commands/types.d.mts.map +1 -1
  124. package/esm/config/config-getter.d.mts +2 -3
  125. package/esm/config/config-getter.d.mts.map +1 -1
  126. package/esm/config/config-getter.mjs +5 -5
  127. package/esm/config/config-getter.mjs.map +1 -1
  128. package/esm/config/config-handlers.d.mts +1 -3
  129. package/esm/config/config-handlers.d.mts.map +1 -1
  130. package/esm/config/config-loader.d.mts +1 -2
  131. package/esm/config/config-loader.d.mts.map +1 -1
  132. package/esm/config/config-loader.mjs +3 -3
  133. package/esm/config/config-loader.mjs.map +1 -1
  134. package/esm/config/config-manager.mjs +1 -1
  135. package/esm/config/config-schema.d.mts +19 -16
  136. package/esm/config/config-schema.d.mts.map +1 -1
  137. package/esm/config/config-setter.d.mts +2 -4
  138. package/esm/config/config-setter.d.mts.map +1 -1
  139. package/esm/config/config-setter.mjs +2 -2
  140. package/esm/config/config-setter.mjs.map +1 -1
  141. package/esm/config/config-special-handlers.d.mts +2 -4
  142. package/esm/config/config-special-handlers.d.mts.map +1 -1
  143. package/esm/config/index.d.mts +2 -1
  144. package/esm/config/index.mjs +1 -1
  145. package/esm/config/types.d.mts +4 -5
  146. package/esm/config/types.d.mts.map +1 -1
  147. package/esm/connectors/access-connector.d.mts +1 -3
  148. package/esm/connectors/access-connector.d.mts.map +1 -1
  149. package/esm/connectors/access-connector.mjs +2 -2
  150. package/esm/connectors/access-connector.mjs.map +1 -1
  151. package/esm/connectors/ai-connector.d.mts +1 -3
  152. package/esm/connectors/ai-connector.d.mts.map +1 -1
  153. package/esm/connectors/ai-connector.mjs +2 -2
  154. package/esm/connectors/ai-connector.mjs.map +1 -1
  155. package/esm/connectors/assert-no-reserved-connector-names.d.mts +1 -3
  156. package/esm/connectors/assert-no-reserved-connector-names.d.mts.map +1 -1
  157. package/esm/connectors/assert-unique-connector-names.d.mts +1 -3
  158. package/esm/connectors/assert-unique-connector-names.d.mts.map +1 -1
  159. package/esm/connectors/assert-unique-connector-names.mjs +2 -1
  160. package/esm/connectors/assert-unique-connector-names.mjs.map +1 -1
  161. package/esm/connectors/base-connector.d.mts +1 -3
  162. package/esm/connectors/base-connector.d.mts.map +1 -1
  163. package/esm/connectors/cache-connector.d.mts +1 -3
  164. package/esm/connectors/cache-connector.d.mts.map +1 -1
  165. package/esm/connectors/cache-connector.mjs +3 -3
  166. package/esm/connectors/cache-connector.mjs.map +1 -1
  167. package/esm/connectors/connectors-manager.d.mts +2 -4
  168. package/esm/connectors/connectors-manager.d.mts.map +1 -1
  169. package/esm/connectors/connectors-manager.mjs +3 -6
  170. package/esm/connectors/connectors-manager.mjs.map +1 -1
  171. package/esm/connectors/database-connector.d.mts +1 -3
  172. package/esm/connectors/database-connector.d.mts.map +1 -1
  173. package/esm/connectors/database-connector.mjs +2 -2
  174. package/esm/connectors/database-connector.mjs.map +1 -1
  175. package/esm/connectors/describe-server-address.mjs +4 -4
  176. package/esm/connectors/describe-server-address.mjs.map +1 -1
  177. package/esm/connectors/herald-connector.d.mts +1 -3
  178. package/esm/connectors/herald-connector.d.mts.map +1 -1
  179. package/esm/connectors/herald-connector.mjs +2 -2
  180. package/esm/connectors/herald-connector.mjs.map +1 -1
  181. package/esm/connectors/http-connector.d.mts +1 -3
  182. package/esm/connectors/http-connector.d.mts.map +1 -1
  183. package/esm/connectors/http-connector.mjs +8 -7
  184. package/esm/connectors/http-connector.mjs.map +1 -1
  185. package/esm/connectors/index.d.mts +2 -1
  186. package/esm/connectors/index.mjs +1 -1
  187. package/esm/connectors/logger-connector.d.mts +1 -3
  188. package/esm/connectors/logger-connector.d.mts.map +1 -1
  189. package/esm/connectors/logger-connector.mjs +2 -2
  190. package/esm/connectors/logger-connector.mjs.map +1 -1
  191. package/esm/connectors/mail-connector.d.mts +1 -3
  192. package/esm/connectors/mail-connector.d.mts.map +1 -1
  193. package/esm/connectors/mail-connector.mjs +2 -2
  194. package/esm/connectors/mail-connector.mjs.map +1 -1
  195. package/esm/connectors/notifications-connector.d.mts +1 -3
  196. package/esm/connectors/notifications-connector.d.mts.map +1 -1
  197. package/esm/connectors/notifications-connector.mjs +2 -2
  198. package/esm/connectors/notifications-connector.mjs.map +1 -1
  199. package/esm/connectors/register-configured-connectors.d.mts +2 -4
  200. package/esm/connectors/register-configured-connectors.d.mts.map +1 -1
  201. package/esm/connectors/shutdown-timeout.mjs +7 -0
  202. package/esm/connectors/shutdown-timeout.mjs.map +1 -0
  203. package/esm/connectors/socket-connector.d.mts +1 -3
  204. package/esm/connectors/socket-connector.d.mts.map +1 -1
  205. package/esm/connectors/socket-connector.mjs +20 -11
  206. package/esm/connectors/socket-connector.mjs.map +1 -1
  207. package/esm/connectors/storage.connector.d.mts +1 -3
  208. package/esm/connectors/storage.connector.d.mts.map +1 -1
  209. package/esm/connectors/storage.connector.mjs +2 -2
  210. package/esm/connectors/storage.connector.mjs.map +1 -1
  211. package/esm/connectors/types.d.mts +17 -14
  212. package/esm/connectors/types.d.mts.map +1 -1
  213. package/esm/container/container-instance-registry.mjs.map +1 -1
  214. package/esm/container/development-app-modules.d.mts +7 -5
  215. package/esm/container/development-app-modules.d.mts.map +1 -1
  216. package/esm/container/development-model-modules.d.mts +6 -5
  217. package/esm/container/development-model-modules.d.mts.map +1 -1
  218. package/esm/container/index.d.mts +4 -4
  219. package/esm/container/index.d.mts.map +1 -1
  220. package/esm/database/index.d.mts +3 -1
  221. package/esm/database/index.mjs +1 -1
  222. package/esm/database/migrate-action.mjs +1 -1
  223. package/esm/database/models/database-log/database-log.d.mts +2 -3
  224. package/esm/database/models/database-log/database-log.d.mts.map +1 -1
  225. package/esm/database/models/database-log/index.d.mts +2 -1
  226. package/esm/database/models/database-log/index.mjs +1 -1
  227. package/esm/database/seed-command-action.mjs +1 -1
  228. package/esm/database/seeds/seeder.d.mts +2 -4
  229. package/esm/database/seeds/seeder.d.mts.map +1 -1
  230. package/esm/database/seeds/seeder.errors.d.mts +2 -3
  231. package/esm/database/seeds/seeder.errors.d.mts.map +1 -1
  232. package/esm/database/seeds/seeders.manager.mjs +2 -1
  233. package/esm/database/seeds/seeders.manager.mjs.map +1 -1
  234. package/esm/database/seeds/types.d.mts +7 -8
  235. package/esm/database/seeds/types.d.mts.map +1 -1
  236. package/esm/database/utils.d.mts +4 -5
  237. package/esm/database/utils.d.mts.map +1 -1
  238. package/esm/dev-server/app-module-registry.mjs +1 -1
  239. package/esm/dev-server/create-worker.mjs +5 -3
  240. package/esm/dev-server/create-worker.mjs.map +1 -1
  241. package/esm/dev-server/dependency-graph.d.mts +1 -3
  242. package/esm/dev-server/dependency-graph.d.mts.map +1 -1
  243. package/esm/dev-server/dependency-graph.mjs +1 -1
  244. package/esm/dev-server/dependency-graph.mjs.map +1 -1
  245. package/esm/dev-server/extract-translation-keys.mjs +16 -17
  246. package/esm/dev-server/extract-translation-keys.mjs.map +1 -1
  247. package/esm/dev-server/file-manager.d.mts +3 -7
  248. package/esm/dev-server/file-manager.d.mts.map +1 -1
  249. package/esm/dev-server/file-operations.d.mts +1 -3
  250. package/esm/dev-server/file-operations.d.mts.map +1 -1
  251. package/esm/dev-server/files-watcher.mjs +12 -11
  252. package/esm/dev-server/files-watcher.mjs.map +1 -1
  253. package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs +6 -8
  254. package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs.map +1 -1
  255. package/esm/dev-server/health-checker/checkers/typescript-health-checker.mjs +36 -115
  256. package/esm/dev-server/health-checker/checkers/typescript-health-checker.mjs.map +1 -1
  257. package/esm/dev-server/health-checker/default-health-checkers.mjs +6 -15
  258. package/esm/dev-server/health-checker/default-health-checkers.mjs.map +1 -1
  259. package/esm/dev-server/health-checker/eslint-support.mjs +27 -0
  260. package/esm/dev-server/health-checker/eslint-support.mjs.map +1 -0
  261. package/esm/dev-server/health-checker/file-health-checker.contract.d.mts +7 -6
  262. package/esm/dev-server/health-checker/file-health-checker.contract.d.mts.map +1 -1
  263. package/esm/dev-server/health-checker/file-health-result.d.mts +2 -2
  264. package/esm/dev-server/health-checker/file-health-result.d.mts.map +1 -1
  265. package/esm/dev-server/health-checker/files-healthcare.manager.mjs +1 -0
  266. package/esm/dev-server/health-checker/files-healthcare.manager.mjs.map +1 -1
  267. package/esm/dev-server/health-checker/oxlint-runner.mjs +6 -5
  268. package/esm/dev-server/health-checker/oxlint-runner.mjs.map +1 -1
  269. package/esm/dev-server/health-checker/workers/eslint-health.worker.d.mts +1 -1
  270. package/esm/dev-server/health-checker/workers/eslint-health.worker.mjs +2 -11
  271. package/esm/dev-server/health-checker/workers/eslint-health.worker.mjs.map +1 -1
  272. package/esm/dev-server/health-checker/workers/oxlint-health.worker.d.mts +1 -1
  273. package/esm/dev-server/health-checker/workers/ts-health.worker.d.mts +1 -1
  274. package/esm/dev-server/health-checker/workers/ts-health.worker.mjs +40 -174
  275. package/esm/dev-server/health-checker/workers/ts-health.worker.mjs.map +1 -1
  276. package/esm/dev-server/loader/hook-thread.d.mts +4 -8
  277. package/esm/dev-server/loader/hook-thread.d.mts.map +1 -1
  278. package/esm/dev-server/loader/load-hook.d.mts +10 -6
  279. package/esm/dev-server/loader/load-hook.d.mts.map +1 -1
  280. package/esm/dev-server/loader/load-hook.mjs +4 -3
  281. package/esm/dev-server/loader/load-hook.mjs.map +1 -1
  282. package/esm/dev-server/loader/own-resolver.mjs +1 -1
  283. package/esm/dev-server/loader/register-loader.mjs +3 -2
  284. package/esm/dev-server/loader/register-loader.mjs.map +1 -1
  285. package/esm/dev-server/loader/resolve-hook.d.mts +2 -2
  286. package/esm/dev-server/loader/resolve-hook.d.mts.map +1 -1
  287. package/esm/dev-server/loader/resolve-hook.mjs +2 -1
  288. package/esm/dev-server/loader/resolve-hook.mjs.map +1 -1
  289. package/esm/dev-server/loader/transpile-cache.mjs +2 -1
  290. package/esm/dev-server/loader/transpile-cache.mjs.map +1 -1
  291. package/esm/dev-server/manifest-manager.d.mts +1 -3
  292. package/esm/dev-server/manifest-manager.d.mts.map +1 -1
  293. package/esm/dev-server/model-module-registry.mjs +3 -3
  294. package/esm/dev-server/model-module-registry.mjs.map +1 -1
  295. package/esm/dev-server/model-resource-typings.mjs +40 -47
  296. package/esm/dev-server/model-resource-typings.mjs.map +1 -1
  297. package/esm/dev-server/module-loader.mjs +2 -2
  298. package/esm/dev-server/module-loader.mjs.map +1 -1
  299. package/esm/dev-server/package-json-manager.mjs +1 -1
  300. package/esm/dev-server/parse-imports.mjs +6 -38
  301. package/esm/dev-server/parse-imports.mjs.map +1 -1
  302. package/esm/dev-server/read-config-ast.mjs +3 -33
  303. package/esm/dev-server/read-config-ast.mjs.map +1 -1
  304. package/esm/dev-server/ready-block.mjs +1 -1
  305. package/esm/dev-server/shortcuts.mjs +1 -1
  306. package/esm/dev-server/special-files-collector.d.mts +2 -4
  307. package/esm/dev-server/special-files-collector.d.mts.map +1 -1
  308. package/esm/dev-server/supervisor.mjs +1 -1
  309. package/esm/dev-server/tsconfig-manager.mjs +3 -3
  310. package/esm/dev-server/tsconfig-manager.mjs.map +1 -1
  311. package/esm/dev-server/type-generator.mjs +28 -35
  312. package/esm/dev-server/type-generator.mjs.map +1 -1
  313. package/esm/dev-server/types.d.mts +3 -4
  314. package/esm/dev-server/types.d.mts.map +1 -1
  315. package/esm/dev-server/update-check-cache.mjs +2 -2
  316. package/esm/dev-server/update-check-cache.mjs.map +1 -1
  317. package/esm/encryption/encrypt.d.mts +2 -3
  318. package/esm/encryption/encrypt.d.mts.map +1 -1
  319. package/esm/encryption/hash.d.mts +1 -2
  320. package/esm/encryption/hash.d.mts.map +1 -1
  321. package/esm/encryption/index.mjs +1 -1
  322. package/esm/encryption/password.d.mts +2 -3
  323. package/esm/encryption/password.d.mts.map +1 -1
  324. package/esm/encryption/types.d.mts +2 -3
  325. package/esm/encryption/types.d.mts.map +1 -1
  326. package/esm/errors/error-codes.d.mts +29 -22
  327. package/esm/errors/error-codes.d.mts.map +1 -1
  328. package/esm/errors/warlock-error.d.mts +1 -3
  329. package/esm/errors/warlock-error.d.mts.map +1 -1
  330. package/esm/generations/add-command.action.mjs +3 -2
  331. package/esm/generations/add-command.action.mjs.map +1 -1
  332. package/esm/generations/features/bull-board.feature.mjs +2 -1
  333. package/esm/generations/features/bull-board.feature.mjs.map +1 -1
  334. package/esm/generations/features/index.mjs +2 -0
  335. package/esm/generations/features/index.mjs.map +1 -1
  336. package/esm/generations/features/notifications.feature.mjs +2 -1
  337. package/esm/generations/features/notifications.feature.mjs.map +1 -1
  338. package/esm/generations/features/process.feature.mjs +65 -0
  339. package/esm/generations/features/process.feature.mjs.map +1 -0
  340. package/esm/generations/features/shared/merge-web-sitemap-config.mjs +16 -23
  341. package/esm/generations/features/shared/merge-web-sitemap-config.mjs.map +1 -1
  342. package/esm/generations/features/shared/patch-tsconfig-include.mjs +1 -1
  343. package/esm/generations/features/shared/relocate-conflicting-home-route.mjs +1 -1
  344. package/esm/generations/features/sitemap.feature.mjs +2 -1
  345. package/esm/generations/features/sitemap.feature.mjs.map +1 -1
  346. package/esm/generations/generation-fs.mjs +1 -1
  347. package/esm/generations/generation-run.mjs +1 -1
  348. package/esm/generations/stubs.mjs +1 -1
  349. package/esm/generations/stubs.mjs.map +1 -1
  350. package/esm/http/boot-port-preflight.d.mts +4 -5
  351. package/esm/http/boot-port-preflight.d.mts.map +1 -1
  352. package/esm/http/boot-port-preflight.mjs +2 -2
  353. package/esm/http/boot-port-preflight.mjs.map +1 -1
  354. package/esm/http/bounded-stream-queue.d.mts +4 -4
  355. package/esm/http/bounded-stream-queue.d.mts.map +1 -1
  356. package/esm/http/bounded-stream-queue.mjs +1 -1
  357. package/esm/http/bounded-stream-queue.mjs.map +1 -1
  358. package/esm/http/build-cors-options.mjs +2 -2
  359. package/esm/http/build-cors-options.mjs.map +1 -1
  360. package/esm/http/build-rate-limit-options.d.mts +2 -3
  361. package/esm/http/build-rate-limit-options.d.mts.map +1 -1
  362. package/esm/http/build-rate-limit-options.mjs +1 -1
  363. package/esm/http/build-rate-limit-options.mjs.map +1 -1
  364. package/esm/http/conditional-request.d.mts +14 -13
  365. package/esm/http/conditional-request.d.mts.map +1 -1
  366. package/esm/http/config.d.mts +2 -4
  367. package/esm/http/config.d.mts.map +1 -1
  368. package/esm/http/config.mjs +2 -2
  369. package/esm/http/config.mjs.map +1 -1
  370. package/esm/http/context/request-context.d.mts +6 -7
  371. package/esm/http/context/request-context.d.mts.map +1 -1
  372. package/esm/http/context/request-memo.d.mts +1 -2
  373. package/esm/http/context/request-memo.d.mts.map +1 -1
  374. package/esm/http/createHttpApplication.d.mts +2 -3
  375. package/esm/http/createHttpApplication.d.mts.map +1 -1
  376. package/esm/http/createHttpApplication.mjs +2 -2
  377. package/esm/http/createHttpApplication.mjs.map +1 -1
  378. package/esm/http/csp.d.mts +10 -12
  379. package/esm/http/csp.d.mts.map +1 -1
  380. package/esm/http/csp.mjs +2 -2
  381. package/esm/http/csp.mjs.map +1 -1
  382. package/esm/http/csrf-default-guard.d.mts +2 -4
  383. package/esm/http/csrf-default-guard.d.mts.map +1 -1
  384. package/esm/http/csrf-default-guard.mjs +1 -1
  385. package/esm/http/csrf-default-guard.mjs.map +1 -1
  386. package/esm/http/csrf-origin-policy.d.mts +7 -9
  387. package/esm/http/csrf-origin-policy.d.mts.map +1 -1
  388. package/esm/http/csrf-origin-policy.mjs +2 -2
  389. package/esm/http/csrf-origin-policy.mjs.map +1 -1
  390. package/esm/http/database/RequestLog.d.mts +2 -3
  391. package/esm/http/database/RequestLog.d.mts.map +1 -1
  392. package/esm/http/error-codes.d.mts +1 -2
  393. package/esm/http/error-codes.d.mts.map +1 -1
  394. package/esm/http/error-mapper.d.mts +2 -4
  395. package/esm/http/error-mapper.d.mts.map +1 -1
  396. package/esm/http/error-mapper.mjs +2 -2
  397. package/esm/http/error-mapper.mjs.map +1 -1
  398. package/esm/http/errors/errors.d.mts +28 -29
  399. package/esm/http/errors/errors.d.mts.map +1 -1
  400. package/esm/http/escape-header-value.d.mts +1 -2
  401. package/esm/http/escape-header-value.d.mts.map +1 -1
  402. package/esm/http/events.d.mts +2 -4
  403. package/esm/http/events.d.mts.map +1 -1
  404. package/esm/http/health.d.mts +4 -4
  405. package/esm/http/health.d.mts.map +1 -1
  406. package/esm/http/index.d.mts +4 -1
  407. package/esm/http/index.mjs +1 -1
  408. package/esm/http/middleware/cache-response-middleware.d.mts +2 -4
  409. package/esm/http/middleware/cache-response-middleware.d.mts.map +1 -1
  410. package/esm/http/middleware/concurrency-limit.middleware.d.mts +3 -3
  411. package/esm/http/middleware/concurrency-limit.middleware.d.mts.map +1 -1
  412. package/esm/http/middleware/idempotency.middleware.d.mts +3 -3
  413. package/esm/http/middleware/idempotency.middleware.d.mts.map +1 -1
  414. package/esm/http/middleware/idempotency.middleware.mjs +6 -6
  415. package/esm/http/middleware/idempotency.middleware.mjs.map +1 -1
  416. package/esm/http/middleware/index.d.mts +3 -1
  417. package/esm/http/middleware/index.mjs +1 -1
  418. package/esm/http/middleware/inject-request-context.d.mts +2 -4
  419. package/esm/http/middleware/inject-request-context.d.mts.map +1 -1
  420. package/esm/http/middleware/inject-request-context.mjs +3 -3
  421. package/esm/http/middleware/inject-request-context.mjs.map +1 -1
  422. package/esm/http/middleware/ip-filter.middleware.d.mts +3 -3
  423. package/esm/http/middleware/ip-filter.middleware.d.mts.map +1 -1
  424. package/esm/http/middleware/maintenance.middleware.d.mts +3 -3
  425. package/esm/http/middleware/maintenance.middleware.d.mts.map +1 -1
  426. package/esm/http/middleware/maintenance.middleware.mjs +4 -4
  427. package/esm/http/middleware/maintenance.middleware.mjs.map +1 -1
  428. package/esm/http/middleware/max-body-size.middleware.d.mts +2 -2
  429. package/esm/http/middleware/max-body-size.middleware.d.mts.map +1 -1
  430. package/esm/http/middleware/middleware-list.d.mts +1 -3
  431. package/esm/http/middleware/middleware-list.d.mts.map +1 -1
  432. package/esm/http/middleware/rate-limit.middleware.d.mts +3 -3
  433. package/esm/http/middleware/rate-limit.middleware.d.mts.map +1 -1
  434. package/esm/http/middleware/rate-limit.middleware.mjs +2 -2
  435. package/esm/http/middleware/rate-limit.middleware.mjs.map +1 -1
  436. package/esm/http/middleware/utils/cidr-match.d.mts +2 -3
  437. package/esm/http/middleware/utils/cidr-match.d.mts.map +1 -1
  438. package/esm/http/middleware/utils/idempotency-key.d.mts +3 -5
  439. package/esm/http/middleware/utils/idempotency-key.d.mts.map +1 -1
  440. package/esm/http/middleware/utils/index.d.mts +2 -1
  441. package/esm/http/middleware/utils/parse-size.d.mts +1 -2
  442. package/esm/http/middleware/utils/parse-size.d.mts.map +1 -1
  443. package/esm/http/middleware/utils/parse-size.mjs +2 -2
  444. package/esm/http/middleware/utils/parse-size.mjs.map +1 -1
  445. package/esm/http/plugins.d.mts +2 -4
  446. package/esm/http/plugins.d.mts.map +1 -1
  447. package/esm/http/plugins.mjs +10 -10
  448. package/esm/http/plugins.mjs.map +1 -1
  449. package/esm/http/port-preflight.d.mts +3 -4
  450. package/esm/http/port-preflight.d.mts.map +1 -1
  451. package/esm/http/port-preflight.mjs +2 -0
  452. package/esm/http/port-preflight.mjs.map +1 -1
  453. package/esm/http/rate-limit-cache-store.mjs +4 -3
  454. package/esm/http/rate-limit-cache-store.mjs.map +1 -1
  455. package/esm/http/ready-report.d.mts +15 -10
  456. package/esm/http/ready-report.d.mts.map +1 -1
  457. package/esm/http/request-controller.d.mts +1 -3
  458. package/esm/http/request-controller.d.mts.map +1 -1
  459. package/esm/http/request-log-snapshot.d.mts +20 -16
  460. package/esm/http/request-log-snapshot.d.mts.map +1 -1
  461. package/esm/http/request-log-snapshot.mjs +3 -3
  462. package/esm/http/request-log-snapshot.mjs.map +1 -1
  463. package/esm/http/request.d.mts +8 -7
  464. package/esm/http/request.d.mts.map +1 -1
  465. package/esm/http/request.mjs +8 -7
  466. package/esm/http/request.mjs.map +1 -1
  467. package/esm/http/response.d.mts +12 -11
  468. package/esm/http/response.d.mts.map +1 -1
  469. package/esm/http/response.mjs +7 -7
  470. package/esm/http/response.mjs.map +1 -1
  471. package/esm/http/safe-redirect.d.mts +3 -4
  472. package/esm/http/safe-redirect.d.mts.map +1 -1
  473. package/esm/http/serialized.d.mts +12 -13
  474. package/esm/http/serialized.d.mts.map +1 -1
  475. package/esm/http/server-rebuilt.d.mts +3 -5
  476. package/esm/http/server-rebuilt.d.mts.map +1 -1
  477. package/esm/http/server.d.mts +9 -9
  478. package/esm/http/server.d.mts.map +1 -1
  479. package/esm/http/server.mjs +4 -4
  480. package/esm/http/server.mjs.map +1 -1
  481. package/esm/http/stream-react-response.d.mts +7 -7
  482. package/esm/http/stream-react-response.d.mts.map +1 -1
  483. package/esm/http/tracing/index.mjs +1 -1
  484. package/esm/http/tracing/trace-id.d.mts +2 -3
  485. package/esm/http/tracing/trace-id.d.mts.map +1 -1
  486. package/esm/http/tracing/tracing-dispatcher.d.mts +10 -11
  487. package/esm/http/tracing/tracing-dispatcher.d.mts.map +1 -1
  488. package/esm/http/tracing/tracing-dispatcher.mjs +2 -2
  489. package/esm/http/tracing/tracing-dispatcher.mjs.map +1 -1
  490. package/esm/http/tracing/tracing.type.d.mts +11 -9
  491. package/esm/http/tracing/tracing.type.d.mts.map +1 -1
  492. package/esm/http/types.d.mts +49 -43
  493. package/esm/http/types.d.mts.map +1 -1
  494. package/esm/http/uploaded-file.d.mts +6 -5
  495. package/esm/http/uploaded-file.d.mts.map +1 -1
  496. package/esm/http/uploads/generate-image-variants.d.mts +6 -6
  497. package/esm/http/uploads/generate-image-variants.d.mts.map +1 -1
  498. package/esm/http/uploads/generate-image-variants.mjs +1 -1
  499. package/esm/http/uploads/generate-image-variants.mjs.map +1 -1
  500. package/esm/http/uploads/image-variant-cache-entries.mjs +1 -1
  501. package/esm/http/uploads/image-variant-cache.mjs +8 -8
  502. package/esm/http/uploads/image-variant-cache.mjs.map +1 -1
  503. package/esm/http/uploads/image-variant-types.d.mts +7 -9
  504. package/esm/http/uploads/image-variant-types.d.mts.map +1 -1
  505. package/esm/http/uploads/image-variants-config-error.d.mts +1 -2
  506. package/esm/http/uploads/image-variants-config-error.d.mts.map +1 -1
  507. package/esm/http/uploads/index.d.mts +2 -1
  508. package/esm/http/uploads/index.mjs +1 -1
  509. package/esm/http/uploads/parse-uploaded-file-query.mjs +1 -1
  510. package/esm/http/uploads/parse-uploaded-file-query.mjs.map +1 -1
  511. package/esm/http/uploads/purge-image-variants.d.mts +2 -4
  512. package/esm/http/uploads/purge-image-variants.d.mts.map +1 -1
  513. package/esm/http/uploads/resolve-image-variant.d.mts +3 -5
  514. package/esm/http/uploads/resolve-image-variant.d.mts.map +1 -1
  515. package/esm/http/uploads/resolve-image-variants-config.mjs +4 -4
  516. package/esm/http/uploads/resolve-image-variants-config.mjs.map +1 -1
  517. package/esm/http/uploads/resolve-original-content-type.mjs +1 -1
  518. package/esm/http/uploads/resolve-original-content-type.mjs.map +1 -1
  519. package/esm/http/uploads/trim-image-variant-cache.mjs +3 -3
  520. package/esm/http/uploads/trim-image-variant-cache.mjs.map +1 -1
  521. package/esm/http/uploads/uploaded-file.controller.d.mts +6 -5
  522. package/esm/http/uploads/uploaded-file.controller.d.mts.map +1 -1
  523. package/esm/http/uploads/uploaded-file.controller.mjs +2 -1
  524. package/esm/http/uploads/uploaded-file.controller.mjs.map +1 -1
  525. package/esm/http/uploads/variant-cache-key.mjs +1 -1
  526. package/esm/http/uploads-config.d.mts +2 -4
  527. package/esm/http/uploads-config.d.mts.map +1 -1
  528. package/esm/http/uploads-types.d.mts +19 -17
  529. package/esm/http/uploads-types.d.mts.map +1 -1
  530. package/esm/http/xmlable.d.mts +1 -2
  531. package/esm/http/xmlable.d.mts.map +1 -1
  532. package/esm/image/image.d.mts +6 -7
  533. package/esm/image/image.d.mts.map +1 -1
  534. package/esm/image/image.mjs.map +1 -1
  535. package/esm/image/index.d.mts +2 -1
  536. package/esm/image/index.mjs +1 -1
  537. package/esm/index.d.mts +28 -2
  538. package/esm/index.mjs +7 -2
  539. package/esm/loader/app-module-importer.d.mts +1 -2
  540. package/esm/loader/app-module-importer.d.mts.map +1 -1
  541. package/esm/localization/index.mjs +1 -1
  542. package/esm/localization/parse-locale-dictionary.d.mts +4 -5
  543. package/esm/localization/parse-locale-dictionary.d.mts.map +1 -1
  544. package/esm/localization/parse-locale-dictionary.mjs +1 -1
  545. package/esm/localization/parse-locale-dictionary.mjs.map +1 -1
  546. package/esm/localization/register-locale-dictionary.d.mts +3 -4
  547. package/esm/localization/register-locale-dictionary.d.mts.map +1 -1
  548. package/esm/localization/register-locale-dictionary.mjs +2 -2
  549. package/esm/localization/register-locale-dictionary.mjs.map +1 -1
  550. package/esm/logger/fatal-visibility.d.mts +1 -2
  551. package/esm/logger/fatal-visibility.d.mts.map +1 -1
  552. package/esm/logger/index.d.mts +2 -1
  553. package/esm/logger/index.mjs +1 -1
  554. package/esm/logger/logger.d.mts +1 -3
  555. package/esm/logger/logger.d.mts.map +1 -1
  556. package/esm/logger/types.d.mts +2 -3
  557. package/esm/logger/types.d.mts.map +1 -1
  558. package/esm/mail/config.d.mts +12 -14
  559. package/esm/mail/config.d.mts.map +1 -1
  560. package/esm/mail/events.d.mts +4 -6
  561. package/esm/mail/events.d.mts.map +1 -1
  562. package/esm/mail/index.d.mts +2 -1
  563. package/esm/mail/index.mjs +1 -1
  564. package/esm/mail/mail.d.mts +1 -3
  565. package/esm/mail/mail.d.mts.map +1 -1
  566. package/esm/mail/mailer-pool.d.mts +5 -7
  567. package/esm/mail/mailer-pool.d.mts.map +1 -1
  568. package/esm/mail/react-mail.d.mts +1 -3
  569. package/esm/mail/react-mail.d.mts.map +1 -1
  570. package/esm/mail/send-mail.d.mts +1 -3
  571. package/esm/mail/send-mail.d.mts.map +1 -1
  572. package/esm/mail/send-mail.mjs +2 -1
  573. package/esm/mail/send-mail.mjs.map +1 -1
  574. package/esm/mail/test-mailbox.d.mts +11 -13
  575. package/esm/mail/test-mailbox.d.mts.map +1 -1
  576. package/esm/mail/types.d.mts +17 -18
  577. package/esm/mail/types.d.mts.map +1 -1
  578. package/esm/manifest/manifest-manager.mjs +1 -1
  579. package/esm/openapi/build-openapi-document.d.mts +2 -4
  580. package/esm/openapi/build-openapi-document.d.mts.map +1 -1
  581. package/esm/openapi/cast-schema.mjs +1 -1
  582. package/esm/openapi/development-openapi-provider.d.mts +5 -6
  583. package/esm/openapi/development-openapi-provider.d.mts.map +1 -1
  584. package/esm/openapi/index.d.mts +3 -1
  585. package/esm/openapi/index.mjs +1 -1
  586. package/esm/openapi/openapi-child-output.mjs +2 -2
  587. package/esm/openapi/openapi-child-output.mjs.map +1 -1
  588. package/esm/openapi/postman/build-request-url.mjs +1 -1
  589. package/esm/openapi/postman/example-from-schema.d.mts +1 -3
  590. package/esm/openapi/postman/example-from-schema.d.mts.map +1 -1
  591. package/esm/openapi/postman/index.d.mts +2 -1
  592. package/esm/openapi/postman/openapi-to-postman-collection.d.mts +3 -5
  593. package/esm/openapi/postman/openapi-to-postman-collection.d.mts.map +1 -1
  594. package/esm/openapi/postman/postman-types.d.mts +19 -18
  595. package/esm/openapi/postman/postman-types.d.mts.map +1 -1
  596. package/esm/openapi/postman/schema-refs.d.mts +1 -3
  597. package/esm/openapi/postman/schema-refs.d.mts.map +1 -1
  598. package/esm/openapi/postman/uuid-v5.mjs +1 -1
  599. package/esm/openapi/schema-registry.d.mts +1 -1
  600. package/esm/openapi/security.mjs +1 -1
  601. package/esm/openapi/types.d.mts +23 -21
  602. package/esm/openapi/types.d.mts.map +1 -1
  603. package/esm/production/assert-generated-imports.mjs +1 -1
  604. package/esm/production/build-contributions.mjs +1 -1
  605. package/esm/production/bundle-framework-dependencies.mjs +1 -1
  606. package/esm/production/dist-build-manifest.mjs +1 -1
  607. package/esm/production/esbuild-plugins.mjs.map +1 -1
  608. package/esm/production/esbuild-preflight.mjs +1 -1
  609. package/esm/production/production-builder.mjs +2 -1
  610. package/esm/production/production-builder.mjs.map +1 -1
  611. package/esm/production/production-supervisor.mjs +1 -1
  612. package/esm/production/registration-child-runner.mjs +4 -3
  613. package/esm/production/registration-child-runner.mjs.map +1 -1
  614. package/esm/production/resolve-build-config.d.mts +4 -4
  615. package/esm/production/resolve-build-config.d.mts.map +1 -1
  616. package/esm/production/resolve-build-config.mjs +1 -1
  617. package/esm/production/route-registration-child.d.mts +1 -1
  618. package/esm/production/route-registration-child.mjs +8 -7
  619. package/esm/production/route-registration-child.mjs.map +1 -1
  620. package/esm/production/tsconfig-path-aliases.mjs +1 -1
  621. package/esm/react/index.d.mts +1 -3
  622. package/esm/react/index.d.mts.map +1 -1
  623. package/esm/react/index.mjs.map +1 -1
  624. package/esm/repositories/adapters/cascade/cascade-adapter.d.mts +3 -4
  625. package/esm/repositories/adapters/cascade/cascade-adapter.d.mts.map +1 -1
  626. package/esm/repositories/adapters/cascade/cascade-query-builder.d.mts +2 -3
  627. package/esm/repositories/adapters/cascade/cascade-query-builder.d.mts.map +1 -1
  628. package/esm/repositories/adapters/cascade/filter-applicator.mjs +10 -9
  629. package/esm/repositories/adapters/cascade/filter-applicator.mjs.map +1 -1
  630. package/esm/repositories/adapters/cascade/index.d.mts +2 -1
  631. package/esm/repositories/adapters/cascade/index.mjs +1 -1
  632. package/esm/repositories/contracts/index.d.mts +2 -1
  633. package/esm/repositories/contracts/query-builder.contract.d.mts +4 -6
  634. package/esm/repositories/contracts/query-builder.contract.d.mts.map +1 -1
  635. package/esm/repositories/contracts/repository-adapter.contract.d.mts +1 -3
  636. package/esm/repositories/contracts/repository-adapter.contract.d.mts.map +1 -1
  637. package/esm/repositories/contracts/types.d.mts +23 -25
  638. package/esm/repositories/contracts/types.d.mts.map +1 -1
  639. package/esm/repositories/index.d.mts +4 -1
  640. package/esm/repositories/index.mjs +1 -1
  641. package/esm/repositories/repository.manager.d.mts +2 -3
  642. package/esm/repositories/repository.manager.d.mts.map +1 -1
  643. package/esm/repositories/repository.manager.mjs +2 -2
  644. package/esm/repositories/repository.manager.mjs.map +1 -1
  645. package/esm/resource/define-resource.d.mts +3 -5
  646. package/esm/resource/define-resource.d.mts.map +1 -1
  647. package/esm/resource/index.d.mts +2 -1
  648. package/esm/resource/index.mjs +1 -1
  649. package/esm/resource/nullable-resource.d.mts +5 -7
  650. package/esm/resource/nullable-resource.d.mts.map +1 -1
  651. package/esm/resource/register-resource.d.mts +1 -3
  652. package/esm/resource/register-resource.d.mts.map +1 -1
  653. package/esm/resource/resource-field-builder.d.mts +1 -3
  654. package/esm/resource/resource-field-builder.d.mts.map +1 -1
  655. package/esm/resource/resource.d.mts +3 -5
  656. package/esm/resource/resource.d.mts.map +1 -1
  657. package/esm/resource/resource.mjs +4 -2
  658. package/esm/resource/resource.mjs.map +1 -1
  659. package/esm/resource/types.d.mts +21 -21
  660. package/esm/resource/types.d.mts.map +1 -1
  661. package/esm/restful/index.d.mts +2 -1
  662. package/esm/restful/index.mjs +1 -1
  663. package/esm/restful/restful.d.mts +12 -32
  664. package/esm/restful/restful.d.mts.map +1 -1
  665. package/esm/router/index.d.mts +2 -1
  666. package/esm/router/index.mjs +1 -1
  667. package/esm/router/named-api-routes-with-responses.mjs +2 -1
  668. package/esm/router/named-api-routes-with-responses.mjs.map +1 -1
  669. package/esm/router/normalize-request-path.d.mts +1 -2
  670. package/esm/router/normalize-request-path.d.mts.map +1 -1
  671. package/esm/router/normalize-route-path.d.mts +1 -2
  672. package/esm/router/normalize-route-path.d.mts.map +1 -1
  673. package/esm/router/positional-handler-diagnostics.d.mts +15 -13
  674. package/esm/router/positional-handler-diagnostics.d.mts.map +1 -1
  675. package/esm/router/resolve-route-rate-limit.mjs +3 -3
  676. package/esm/router/resolve-route-rate-limit.mjs.map +1 -1
  677. package/esm/router/route-builder.d.mts +1 -3
  678. package/esm/router/route-builder.d.mts.map +1 -1
  679. package/esm/router/route-guard-names.mjs +1 -1
  680. package/esm/router/route-guard-names.mjs.map +1 -1
  681. package/esm/router/route-name-method-suffix.d.mts +2 -3
  682. package/esm/router/route-name-method-suffix.d.mts.map +1 -1
  683. package/esm/router/route-name-taken-error.d.mts +1 -3
  684. package/esm/router/route-name-taken-error.d.mts.map +1 -1
  685. package/esm/router/route-registry.d.mts +1 -3
  686. package/esm/router/route-registry.d.mts.map +1 -1
  687. package/esm/router/router.d.mts +2 -4
  688. package/esm/router/router.d.mts.map +1 -1
  689. package/esm/router/router.mjs +8 -6
  690. package/esm/router/router.mjs.map +1 -1
  691. package/esm/router/types.d.mts +25 -26
  692. package/esm/router/types.d.mts.map +1 -1
  693. package/esm/router/unguarded-route-diagnostics.d.mts +6 -8
  694. package/esm/router/unguarded-route-diagnostics.d.mts.map +1 -1
  695. package/esm/secrets/errors.d.mts +9 -0
  696. package/esm/secrets/errors.d.mts.map +1 -0
  697. package/esm/secrets/errors.mjs +22 -0
  698. package/esm/secrets/errors.mjs.map +1 -0
  699. package/esm/secrets/file-backend.mjs +167 -0
  700. package/esm/secrets/file-backend.mjs.map +1 -0
  701. package/esm/secrets/index.d.mts +6 -0
  702. package/esm/secrets/index.mjs +6 -0
  703. package/esm/secrets/keyring-backend.mjs +50 -0
  704. package/esm/secrets/keyring-backend.mjs.map +1 -0
  705. package/esm/secrets/memory-backend.d.mts +12 -0
  706. package/esm/secrets/memory-backend.d.mts.map +1 -0
  707. package/esm/secrets/memory-backend.mjs +28 -0
  708. package/esm/secrets/memory-backend.mjs.map +1 -0
  709. package/esm/secrets/secret-store.d.mts +25 -0
  710. package/esm/secrets/secret-store.d.mts.map +1 -0
  711. package/esm/secrets/secret-store.mjs +117 -0
  712. package/esm/secrets/secret-store.mjs.map +1 -0
  713. package/esm/secrets/secrets.d.mts +11 -0
  714. package/esm/secrets/secrets.d.mts.map +1 -0
  715. package/esm/secrets/secrets.mjs +63 -0
  716. package/esm/secrets/secrets.mjs.map +1 -0
  717. package/esm/secrets/types.d.mts +22 -0
  718. package/esm/secrets/types.d.mts.map +1 -0
  719. package/esm/socket/index.d.mts +2 -1
  720. package/esm/socket/index.mjs +2 -2
  721. package/esm/socket/types.d.mts +2 -4
  722. package/esm/socket/types.d.mts.map +1 -1
  723. package/esm/socket/utils.d.mts +8 -3
  724. package/esm/socket/utils.d.mts.map +1 -1
  725. package/esm/socket/utils.mjs +12 -1
  726. package/esm/socket/utils.mjs.map +1 -1
  727. package/esm/storage/config.d.mts +4 -6
  728. package/esm/storage/config.d.mts.map +1 -1
  729. package/esm/storage/context/storage-driver-context.d.mts +3 -4
  730. package/esm/storage/context/storage-driver-context.d.mts.map +1 -1
  731. package/esm/storage/drivers/cloud-driver.d.mts +2 -4
  732. package/esm/storage/drivers/cloud-driver.d.mts.map +1 -1
  733. package/esm/storage/drivers/cloud-driver.mjs.map +1 -1
  734. package/esm/storage/drivers/do-spaces-driver.d.mts +1 -3
  735. package/esm/storage/drivers/do-spaces-driver.d.mts.map +1 -1
  736. package/esm/storage/drivers/local-driver.d.mts +2 -3
  737. package/esm/storage/drivers/local-driver.d.mts.map +1 -1
  738. package/esm/storage/drivers/local-driver.mjs +8 -3
  739. package/esm/storage/drivers/local-driver.mjs.map +1 -1
  740. package/esm/storage/drivers/r2-driver.d.mts +1 -3
  741. package/esm/storage/drivers/r2-driver.d.mts.map +1 -1
  742. package/esm/storage/drivers/s3-driver.d.mts +1 -3
  743. package/esm/storage/drivers/s3-driver.d.mts.map +1 -1
  744. package/esm/storage/index.d.mts +2 -1
  745. package/esm/storage/index.mjs +1 -1
  746. package/esm/storage/local-disk-roots.mjs +2 -2
  747. package/esm/storage/local-disk-roots.mjs.map +1 -1
  748. package/esm/storage/scoped-storage.d.mts +2 -3
  749. package/esm/storage/scoped-storage.d.mts.map +1 -1
  750. package/esm/storage/storage-file.d.mts +1 -3
  751. package/esm/storage/storage-file.d.mts.map +1 -1
  752. package/esm/storage/storage.d.mts +3 -4
  753. package/esm/storage/storage.d.mts.map +1 -1
  754. package/esm/storage/types.d.mts +36 -36
  755. package/esm/storage/types.d.mts.map +1 -1
  756. package/esm/storage/utils/classify-ip-address.d.mts +1 -2
  757. package/esm/storage/utils/classify-ip-address.d.mts.map +1 -1
  758. package/esm/storage/utils/contain-path.d.mts +1 -2
  759. package/esm/storage/utils/contain-path.d.mts.map +1 -1
  760. package/esm/storage/utils/mime.d.mts +2 -3
  761. package/esm/storage/utils/mime.d.mts.map +1 -1
  762. package/esm/storage/utils/safe-fetch.d.mts +6 -6
  763. package/esm/storage/utils/safe-fetch.d.mts.map +1 -1
  764. package/esm/storage/utils/safe-fetch.mjs +3 -3
  765. package/esm/storage/utils/safe-fetch.mjs.map +1 -1
  766. package/esm/storage/utils/storage-capability-error.d.mts +1 -3
  767. package/esm/storage/utils/storage-capability-error.d.mts.map +1 -1
  768. package/esm/storage/utils/storage-error.d.mts +2 -3
  769. package/esm/storage/utils/storage-error.d.mts.map +1 -1
  770. package/esm/storage/utils/storage-not-initialized-error.d.mts +1 -2
  771. package/esm/storage/utils/storage-not-initialized-error.d.mts.map +1 -1
  772. package/esm/tests/authenticated-test-client.d.mts +5 -6
  773. package/esm/tests/authenticated-test-client.d.mts.map +1 -1
  774. package/esm/tests/factories.d.mts +38 -23
  775. package/esm/tests/factories.d.mts.map +1 -1
  776. package/esm/tests/fakes/cache-fake.d.mts +14 -9
  777. package/esm/tests/fakes/cache-fake.d.mts.map +1 -1
  778. package/esm/tests/fakes/clock-fake.d.mts +13 -8
  779. package/esm/tests/fakes/clock-fake.d.mts.map +1 -1
  780. package/esm/tests/fakes/fake-assertion-error.d.mts +2 -3
  781. package/esm/tests/fakes/fake-assertion-error.d.mts.map +1 -1
  782. package/esm/tests/fakes/ids-fake.d.mts +5 -4
  783. package/esm/tests/fakes/ids-fake.d.mts.map +1 -1
  784. package/esm/tests/fakes/index.d.mts +3 -1
  785. package/esm/tests/fakes/index.mjs +2 -1
  786. package/esm/tests/fakes/mail-fake.d.mts +21 -13
  787. package/esm/tests/fakes/mail-fake.d.mts.map +1 -1
  788. package/esm/tests/fakes/queue-fake.d.mts +21 -13
  789. package/esm/tests/fakes/queue-fake.d.mts.map +1 -1
  790. package/esm/tests/fakes/secrets-fake.d.mts +13 -0
  791. package/esm/tests/fakes/secrets-fake.d.mts.map +1 -0
  792. package/esm/tests/fakes/secrets-fake.mjs +50 -0
  793. package/esm/tests/fakes/secrets-fake.mjs.map +1 -0
  794. package/esm/tests/fakes/storage-fake.d.mts +12 -8
  795. package/esm/tests/fakes/storage-fake.d.mts.map +1 -1
  796. package/esm/tests/fakes/storage-fake.mjs +1 -1
  797. package/esm/tests/fakes/test-fakes.d.mts +9 -10
  798. package/esm/tests/fakes/test-fakes.d.mts.map +1 -1
  799. package/esm/tests/fakes/test-fakes.mjs +6 -3
  800. package/esm/tests/fakes/test-fakes.mjs.map +1 -1
  801. package/esm/tests/index.d.mts +3 -1
  802. package/esm/tests/index.mjs +2 -1
  803. package/esm/tests/snapshot-response.d.mts +4 -5
  804. package/esm/tests/snapshot-response.d.mts.map +1 -1
  805. package/esm/tests/start-http-development-server.d.mts +4 -6
  806. package/esm/tests/start-http-development-server.d.mts.map +1 -1
  807. package/esm/tests/start-http-development-server.mjs +5 -5
  808. package/esm/tests/start-http-development-server.mjs.map +1 -1
  809. package/esm/tests/test-connectors-selection.d.mts +2 -2
  810. package/esm/tests/test-connectors-selection.d.mts.map +1 -1
  811. package/esm/tests/test-connectors-selection.mjs +1 -1
  812. package/esm/tests/test-helpers.d.mts +11 -12
  813. package/esm/tests/test-helpers.d.mts.map +1 -1
  814. package/esm/tests/test-http-server.d.mts +14 -10
  815. package/esm/tests/test-http-server.d.mts.map +1 -1
  816. package/esm/tests/test-lifecycle-state.mjs +1 -1
  817. package/esm/tests/vitest-setup.d.mts +7 -8
  818. package/esm/tests/vitest-setup.d.mts.map +1 -1
  819. package/esm/tests/vitest-setup.mjs.map +1 -1
  820. package/esm/tooling/agents-md/agents-md-markers.d.mts +4 -5
  821. package/esm/tooling/agents-md/agents-md-markers.d.mts.map +1 -1
  822. package/esm/tooling/agents-md/agents-md-markers.mjs +2 -1
  823. package/esm/tooling/agents-md/agents-md-markers.mjs.map +1 -1
  824. package/esm/tooling/agents-md/agents-md-refresher.d.mts +19 -12
  825. package/esm/tooling/agents-md/agents-md-refresher.d.mts.map +1 -1
  826. package/esm/tooling/agents-md/installed-skills.d.mts +13 -9
  827. package/esm/tooling/agents-md/installed-skills.d.mts.map +1 -1
  828. package/esm/tooling/agents-md/render-agents-md.d.mts +8 -7
  829. package/esm/tooling/agents-md/render-agents-md.d.mts.map +1 -1
  830. package/esm/tooling/agents-md/render-agents-md.mjs +2 -2
  831. package/esm/tooling/agents-md/render-agents-md.mjs.map +1 -1
  832. package/esm/tooling/agents-md/write-agents-md.d.mts +17 -12
  833. package/esm/tooling/agents-md/write-agents-md.d.mts.map +1 -1
  834. package/esm/tooling/board/board-message.d.mts +4 -6
  835. package/esm/tooling/board/board-message.d.mts.map +1 -1
  836. package/esm/tooling/board/board.d.mts +50 -38
  837. package/esm/tooling/board/board.d.mts.map +1 -1
  838. package/esm/tooling/board/board.mjs +4 -3
  839. package/esm/tooling/board/board.mjs.map +1 -1
  840. package/esm/tooling/board/board.types.d.mts +32 -23
  841. package/esm/tooling/board/board.types.d.mts.map +1 -1
  842. package/esm/tooling/check/changed-files.d.mts +4 -6
  843. package/esm/tooling/check/changed-files.d.mts.map +1 -1
  844. package/esm/tooling/check/changed-files.mjs +2 -2
  845. package/esm/tooling/check/changed-files.mjs.map +1 -1
  846. package/esm/tooling/check/check-report.types.d.mts +22 -17
  847. package/esm/tooling/check/check-report.types.d.mts.map +1 -1
  848. package/esm/tooling/check/code-style-conventions.mjs +25 -25
  849. package/esm/tooling/check/code-style-conventions.mjs.map +1 -1
  850. package/esm/tooling/check/conventions-step.d.mts +4 -6
  851. package/esm/tooling/check/conventions-step.d.mts.map +1 -1
  852. package/esm/tooling/check/conventions-step.mjs +7 -18
  853. package/esm/tooling/check/conventions-step.mjs.map +1 -1
  854. package/esm/tooling/check/environment-step.d.mts +2 -4
  855. package/esm/tooling/check/environment-step.d.mts.map +1 -1
  856. package/esm/tooling/check/environment-step.mjs +1 -1
  857. package/esm/tooling/check/index.mjs +1 -1
  858. package/esm/tooling/check/lint-step.d.mts +5 -12
  859. package/esm/tooling/check/lint-step.d.mts.map +1 -1
  860. package/esm/tooling/check/lint-step.mjs +16 -12
  861. package/esm/tooling/check/lint-step.mjs.map +1 -1
  862. package/esm/tooling/check/request-input.mjs +15 -15
  863. package/esm/tooling/check/request-input.mjs.map +1 -1
  864. package/esm/tooling/check/run-check.d.mts +24 -14
  865. package/esm/tooling/check/run-check.d.mts.map +1 -1
  866. package/esm/tooling/check/run-check.mjs +2 -2
  867. package/esm/tooling/check/run-check.mjs.map +1 -1
  868. package/esm/tooling/check/run-tests.d.mts +22 -15
  869. package/esm/tooling/check/run-tests.d.mts.map +1 -1
  870. package/esm/tooling/check/security-conventions.mjs +133 -131
  871. package/esm/tooling/check/security-conventions.mjs.map +1 -1
  872. package/esm/tooling/check/source-ast.mjs +92 -132
  873. package/esm/tooling/check/source-ast.mjs.map +1 -1
  874. package/esm/tooling/check/tests-step.d.mts +7 -8
  875. package/esm/tooling/check/tests-step.d.mts.map +1 -1
  876. package/esm/tooling/check/tests-step.mjs +3 -3
  877. package/esm/tooling/check/tests-step.mjs.map +1 -1
  878. package/esm/tooling/dev-state/dev-server-state.d.mts +17 -13
  879. package/esm/tooling/dev-state/dev-server-state.d.mts.map +1 -1
  880. package/esm/tooling/devtools/devtools-client.d.mts +29 -20
  881. package/esm/tooling/devtools/devtools-client.d.mts.map +1 -1
  882. package/esm/tooling/generate/generation.d.mts +34 -22
  883. package/esm/tooling/generate/generation.d.mts.map +1 -1
  884. package/esm/tooling/generate/generation.mjs +9 -5
  885. package/esm/tooling/generate/generation.mjs.map +1 -1
  886. package/esm/tooling/generate/generator-spec.d.mts +9 -9
  887. package/esm/tooling/generate/generator-spec.d.mts.map +1 -1
  888. package/esm/tooling/generate/index.mjs +1 -1
  889. package/esm/tooling/generate/project-files.mjs +3 -3
  890. package/esm/tooling/generate/project-files.mjs.map +1 -1
  891. package/esm/tooling/generate/run-cli.d.mts +14 -11
  892. package/esm/tooling/generate/run-cli.d.mts.map +1 -1
  893. package/esm/tooling/generate/run-cli.mjs +2 -2
  894. package/esm/tooling/generate/run-cli.mjs.map +1 -1
  895. package/esm/tooling/generate/unified-diff.d.mts +10 -7
  896. package/esm/tooling/generate/unified-diff.d.mts.map +1 -1
  897. package/esm/tooling/index.d.mts +1 -0
  898. package/esm/tooling/inspect/boot-for-inspect.d.mts +7 -7
  899. package/esm/tooling/inspect/boot-for-inspect.d.mts.map +1 -1
  900. package/esm/tooling/inspect/collect-config.mjs +3 -3
  901. package/esm/tooling/inspect/collect-config.mjs.map +1 -1
  902. package/esm/tooling/inspect/collect-models.d.mts +4 -3
  903. package/esm/tooling/inspect/collect-models.d.mts.map +1 -1
  904. package/esm/tooling/inspect/collect-models.mjs +1 -1
  905. package/esm/tooling/inspect/collect-packages.d.mts +1 -2
  906. package/esm/tooling/inspect/collect-packages.d.mts.map +1 -1
  907. package/esm/tooling/inspect/collect-pages.mjs +10 -10
  908. package/esm/tooling/inspect/collect-pages.mjs.map +1 -1
  909. package/esm/tooling/inspect/collect-routes.mjs +1 -1
  910. package/esm/tooling/inspect/event-recorder.d.mts +7 -7
  911. package/esm/tooling/inspect/event-recorder.d.mts.map +1 -1
  912. package/esm/tooling/inspect/index.d.mts +2 -1
  913. package/esm/tooling/inspect/index.mjs +1 -1
  914. package/esm/tooling/inspect/inspect-app.d.mts +25 -16
  915. package/esm/tooling/inspect/inspect-app.d.mts.map +1 -1
  916. package/esm/tooling/inspect/inspect-report.schema.d.mts +1 -2
  917. package/esm/tooling/inspect/inspect-report.schema.d.mts.map +1 -1
  918. package/esm/tooling/inspect/inspect-report.types.d.mts +86 -54
  919. package/esm/tooling/inspect/inspect-report.types.d.mts.map +1 -1
  920. package/esm/tooling/mcp/create-mcp-context.d.mts +11 -8
  921. package/esm/tooling/mcp/create-mcp-context.d.mts.map +1 -1
  922. package/esm/tooling/mcp/db-schema.d.mts +10 -9
  923. package/esm/tooling/mcp/db-schema.d.mts.map +1 -1
  924. package/esm/tooling/mcp/docs-search.d.mts +20 -15
  925. package/esm/tooling/mcp/docs-search.d.mts.map +1 -1
  926. package/esm/tooling/mcp/index.mjs +1 -1
  927. package/esm/tooling/mcp/load-ai-tools.d.mts +7 -8
  928. package/esm/tooling/mcp/load-ai-tools.d.mts.map +1 -1
  929. package/esm/tooling/mcp/load-ai-tools.mjs +2 -1
  930. package/esm/tooling/mcp/load-ai-tools.mjs.map +1 -1
  931. package/esm/tooling/mcp/mcp-tools.d.mts +29 -19
  932. package/esm/tooling/mcp/mcp-tools.d.mts.map +1 -1
  933. package/esm/tooling/mcp/mcp-tools.mjs +3 -2
  934. package/esm/tooling/mcp/mcp-tools.mjs.map +1 -1
  935. package/esm/tooling/mcp/start-mcp-server.d.mts +24 -17
  936. package/esm/tooling/mcp/start-mcp-server.d.mts.map +1 -1
  937. package/esm/tooling/mcp/start-mcp-server.mjs +1 -1
  938. package/esm/tooling/mcp/start-mcp-server.mjs.map +1 -1
  939. package/esm/tooling/mcp/tool-input.d.mts +7 -7
  940. package/esm/tooling/mcp/tool-input.d.mts.map +1 -1
  941. package/esm/tooling/problem.d.mts +27 -17
  942. package/esm/tooling/problem.d.mts.map +1 -1
  943. package/esm/tooling/syntax/ast.mjs +230 -0
  944. package/esm/tooling/syntax/ast.mjs.map +1 -0
  945. package/esm/tooling/syntax/imports.mjs +34 -0
  946. package/esm/tooling/syntax/imports.mjs.map +1 -0
  947. package/esm/tooling/trace/trace-report.types.d.mts +36 -22
  948. package/esm/tooling/trace/trace-report.types.d.mts.map +1 -1
  949. package/esm/tooling/trace/trace-request.d.mts +27 -20
  950. package/esm/tooling/trace/trace-request.d.mts.map +1 -1
  951. package/esm/tooling/trace/trace-request.mjs +2 -2
  952. package/esm/tooling/trace/trace-request.mjs.map +1 -1
  953. package/esm/tooling/typecheck/index.mjs +1 -1
  954. package/esm/tooling/typecheck/run-typecheck.d.mts +15 -48
  955. package/esm/tooling/typecheck/run-typecheck.d.mts.map +1 -1
  956. package/esm/tooling/typecheck/run-typecheck.mjs +42 -105
  957. package/esm/tooling/typecheck/run-typecheck.mjs.map +1 -1
  958. package/esm/tooling/typescript/compiler.d.mts +31 -0
  959. package/esm/tooling/typescript/compiler.d.mts.map +1 -0
  960. package/esm/tooling/typescript/compiler.mjs +120 -0
  961. package/esm/tooling/typescript/compiler.mjs.map +1 -0
  962. package/esm/updater/update-warlock-packages.mjs +3 -2
  963. package/esm/updater/update-warlock-packages.mjs.map +1 -1
  964. package/esm/upgrade/codemods/index.mjs +3 -1
  965. package/esm/upgrade/codemods/index.mjs.map +1 -1
  966. package/esm/upgrade/codemods/logger-sync-calls.mjs +1 -1
  967. package/esm/upgrade/codemods/logger-sync-calls.mjs.map +1 -1
  968. package/esm/upgrade/codemods/oxc-toolchain.mjs +142 -0
  969. package/esm/upgrade/codemods/oxc-toolchain.mjs.map +1 -0
  970. package/esm/upgrade/codemods/request-log-snapshot.mjs +1 -1
  971. package/esm/upgrade/codemods/request-log-snapshot.mjs.map +1 -1
  972. package/esm/upgrade/codemods/toolchain-templates.mjs +244 -0
  973. package/esm/upgrade/codemods/toolchain-templates.mjs.map +1 -0
  974. package/esm/upgrade/diff.mjs +1 -1
  975. package/esm/upgrade/diff.mjs.map +1 -1
  976. package/esm/upgrade/load-ts-morph.mjs +3 -2
  977. package/esm/upgrade/load-ts-morph.mjs.map +1 -1
  978. package/esm/upgrade/run-upgrade.mjs +26 -7
  979. package/esm/upgrade/run-upgrade.mjs.map +1 -1
  980. package/esm/use-cases/index.d.mts +2 -1
  981. package/esm/use-cases/index.mjs +1 -1
  982. package/esm/use-cases/types.d.mts +116 -63
  983. package/esm/use-cases/types.d.mts.map +1 -1
  984. package/esm/use-cases/use-case-broadcast.d.mts +1 -3
  985. package/esm/use-cases/use-case-broadcast.d.mts.map +1 -1
  986. package/esm/use-cases/use-case-events.d.mts +3 -5
  987. package/esm/use-cases/use-case-events.d.mts.map +1 -1
  988. package/esm/use-cases/use-case-pipeline.d.mts +6 -6
  989. package/esm/use-cases/use-case-pipeline.d.mts.map +1 -1
  990. package/esm/use-cases/use-case.d.mts +2 -4
  991. package/esm/use-cases/use-case.d.mts.map +1 -1
  992. package/esm/use-cases/use-case.errors.d.mts +1 -3
  993. package/esm/use-cases/use-case.errors.d.mts.map +1 -1
  994. package/esm/use-cases/use-cases-registry.d.mts +8 -10
  995. package/esm/use-cases/use-cases-registry.d.mts.map +1 -1
  996. package/esm/utils/app-log.d.mts +1 -2
  997. package/esm/utils/app-log.d.mts.map +1 -1
  998. package/esm/utils/clock.d.mts +8 -6
  999. package/esm/utils/clock.d.mts.map +1 -1
  1000. package/esm/utils/database-log.d.mts +3 -4
  1001. package/esm/utils/database-log.d.mts.map +1 -1
  1002. package/esm/utils/environment.d.mts +4 -5
  1003. package/esm/utils/environment.d.mts.map +1 -1
  1004. package/esm/utils/framework-vesion.mjs.map +1 -1
  1005. package/esm/utils/get-localized.d.mts +2 -3
  1006. package/esm/utils/get-localized.d.mts.map +1 -1
  1007. package/esm/utils/ids.d.mts +9 -6
  1008. package/esm/utils/ids.d.mts.map +1 -1
  1009. package/esm/utils/index.d.mts +2 -1
  1010. package/esm/utils/index.mjs +1 -1
  1011. package/esm/utils/normalized-path.d.mts +1 -2
  1012. package/esm/utils/normalized-path.d.mts.map +1 -1
  1013. package/esm/utils/npm-registry.d.mts +1 -2
  1014. package/esm/utils/npm-registry.d.mts.map +1 -1
  1015. package/esm/utils/paths.d.mts +13 -14
  1016. package/esm/utils/paths.d.mts.map +1 -1
  1017. package/esm/utils/paths.mjs +2 -2
  1018. package/esm/utils/paths.mjs.map +1 -1
  1019. package/esm/utils/promise-all-object.d.mts +1 -2
  1020. package/esm/utils/promise-all-object.d.mts.map +1 -1
  1021. package/esm/utils/queue.d.mts +1 -2
  1022. package/esm/utils/queue.d.mts.map +1 -1
  1023. package/esm/utils/runtime.d.mts +11 -10
  1024. package/esm/utils/runtime.d.mts.map +1 -1
  1025. package/esm/utils/sleep.d.mts +1 -2
  1026. package/esm/utils/sleep.d.mts.map +1 -1
  1027. package/esm/utils/sluggable.d.mts +1 -3
  1028. package/esm/utils/sluggable.d.mts.map +1 -1
  1029. package/esm/utils/to-json.d.mts +1 -2
  1030. package/esm/utils/to-json.d.mts.map +1 -1
  1031. package/esm/utils/types.d.mts +1 -2
  1032. package/esm/utils/types.d.mts.map +1 -1
  1033. package/esm/utils/urls.d.mts +5 -6
  1034. package/esm/utils/urls.d.mts.map +1 -1
  1035. package/esm/utils/version-compare.d.mts +1 -2
  1036. package/esm/utils/version-compare.d.mts.map +1 -1
  1037. package/esm/validation/database/exists-except-current-id.d.mts +2 -3
  1038. package/esm/validation/database/exists-except-current-id.d.mts.map +1 -1
  1039. package/esm/validation/database/exists-except-current-user.d.mts +2 -3
  1040. package/esm/validation/database/exists-except-current-user.d.mts.map +1 -1
  1041. package/esm/validation/database/index.d.mts +2 -1
  1042. package/esm/validation/database/index.mjs +1 -1
  1043. package/esm/validation/database/types.d.mts +14 -10
  1044. package/esm/validation/database/types.d.mts.map +1 -1
  1045. package/esm/validation/database/unique-except-current-id.d.mts +2 -3
  1046. package/esm/validation/database/unique-except-current-id.d.mts.map +1 -1
  1047. package/esm/validation/database/unique-except-current-user.d.mts +2 -3
  1048. package/esm/validation/database/unique-except-current-user.d.mts.map +1 -1
  1049. package/esm/validation/file/file.d.mts +4 -6
  1050. package/esm/validation/file/file.d.mts.map +1 -1
  1051. package/esm/validation/file/index.d.mts +2 -1
  1052. package/esm/validation/file/index.mjs +1 -1
  1053. package/esm/validation/index.d.mts +5 -1
  1054. package/esm/validation/index.mjs +1 -1
  1055. package/esm/validation/plugins/index.mjs +1 -1
  1056. package/esm/validation/types.d.mts +6 -4
  1057. package/esm/validation/types.d.mts.map +1 -1
  1058. package/esm/validation/validateAll.mjs +2 -2
  1059. package/esm/validation/validateAll.mjs.map +1 -1
  1060. package/esm/validation/validation-failure-status.mjs +2 -2
  1061. package/esm/validation/validation-failure-status.mjs.map +1 -1
  1062. package/esm/validation/validators/file-validator.d.mts +2 -4
  1063. package/esm/validation/validators/file-validator.d.mts.map +1 -1
  1064. package/esm/validation/validators/index.d.mts +2 -1
  1065. package/esm/validation/validators/index.mjs +1 -1
  1066. package/esm/vite/lower-stage3-decorators.d.mts +2 -3
  1067. package/esm/vite/lower-stage3-decorators.d.mts.map +1 -1
  1068. package/esm/warlock-config/define-config.d.mts +1 -3
  1069. package/esm/warlock-config/define-config.d.mts.map +1 -1
  1070. package/esm/warlock-config/define-config.mjs +3 -2
  1071. package/esm/warlock-config/define-config.mjs.map +1 -1
  1072. package/esm/warlock-config/index.d.mts +2 -1
  1073. package/esm/warlock-config/index.mjs +1 -1
  1074. package/esm/warlock-config/types.d.mts +8 -6
  1075. package/esm/warlock-config/types.d.mts.map +1 -1
  1076. package/esm/warlock-config/warlock-config.manager.d.mts +5 -7
  1077. package/esm/warlock-config/warlock-config.manager.d.mts.map +1 -1
  1078. package/esm/warlock-config/warlock-config.manager.mjs +2 -1
  1079. package/esm/warlock-config/warlock-config.manager.mjs.map +1 -1
  1080. package/esm/warlock-config/warn-deprecated-config.mjs +1 -1
  1081. package/llms-full.txt +379 -22
  1082. package/llms.txt +3 -2
  1083. package/package.json +27 -15
  1084. package/skills/README.md +2 -1
  1085. package/skills/create-module/SKILL.md +7 -0
  1086. package/skills/index.md +3 -1
  1087. package/skills/report-framework-issue.md +154 -0
  1088. package/skills/run-app/SKILL.md +120 -10
  1089. package/skills/store-secrets/SKILL.md +102 -0
  1090. package/skills/test-fakes/SKILL.md +13 -11
  1091. package/skills/upgrade-from-5-29/SKILL.md +78 -0
  1092. package/skills/warlock-check/SKILL.md +6 -1
  1093. package/skills/warlock-doctor/SKILL.md +9 -0
  1094. package/skills/wire-socket/SKILL.md +19 -0
  1095. package/skills/write-cli-command/SKILL.md +21 -0
  1096. package/esm/tooling/check/index.d.mts +0 -8
  1097. package/esm/tooling/typecheck/index.d.mts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"merge-web-sitemap-config.mjs","names":[],"sources":["../../../../../../../../../../packages/core/src/generations/features/shared/merge-web-sitemap-config.ts"],"sourcesContent":["import ts from \"typescript\";\n\n/** What {@link mergeWebSitemapConfig} did, or could not do, to the source it was given. */\nexport type WebSitemapMergeResult =\n | { status: \"merged\"; next: string }\n | { status: \"already-present\" }\n | { status: \"unrecognised\" };\n\n/**\n * Merge a disabled `sitemap` section into `src/config/web.ts` SOURCE TEXT.\n *\n * **String surgery, never parse-and-print** — same rationale as\n * `insertConnectorEntry`: `web.ts` is app-owned and may carry any formatting\n * or comments a parse-and-print would discard. The TypeScript AST is used to\n * *find where to cut*, never to regenerate the file — the splice below still\n * copies the original source's bytes verbatim.\n *\n * Recognises the exported config object two ways: an inline `export default\n * {...}`, or `export default <identifier>;` pointing back at a `const\n * <identifier> = {...}` (or `const <identifier>: SomeType = {...}`) declared\n * earlier in the file — the shape this generator itself scaffolds, and the\n * shape every other generated config file in this project uses. Any other\n * shape (a function call, a re-export, no default export at all) returns\n * `\"unrecognised\"` rather than guessing at where to cut — clobbering an\n * app-owned file the merge could not actually understand is worse than\n * refusing.\n *\n * A `sitemap` property already present anywhere in the source (by key, so one\n * a human has since hand-edited is still found) is left unchanged — that is\n * what makes a second `warlock add sitemap` a no-op instead of a duplicate\n * block. Detection walks the AST rather than regex-matching `sitemap\\s*:`, so\n * a comment like `// sitemap: TODO` — text, not a property — does not count.\n *\n * Before returning a merge, the resulting text is re-parsed and checked for\n * syntax errors; a merge that would not itself parse is refused (as\n * `\"unrecognised\"`) instead of written, since a matched-but-corrupt splice is\n * worse than doing nothing.\n *\n * @param source The config file's current text.\n * @returns What happened, and the new text when there is any.\n */\nexport function mergeWebSitemapConfig(source: string): WebSitemapMergeResult {\n const sourceFile = ts.createSourceFile(\n \"web.ts\",\n source,\n ts.ScriptTarget.ESNext,\n /* setParentNodes */ true,\n ts.ScriptKind.TS,\n );\n\n const objectLiteral = findExportedConfigObjectLiteral(sourceFile);\n\n if (!objectLiteral) {\n return { status: \"unrecognised\" };\n }\n\n if (hasTopLevelSitemapProperty(objectLiteral)) {\n return { status: \"already-present\" };\n }\n\n const bodyStart = objectLiteral.getStart(sourceFile) + 1;\n const closingBraceIndex = objectLiteral.getEnd() - 1;\n const body = source.slice(bodyStart, closingBraceIndex);\n\n const indentMatch = /\\n([ \\t]*)\\S/.exec(body);\n const indent = indentMatch ? indentMatch[1] : \" \";\n\n const block =\n `${indent}sitemap: {\\n` +\n `${indent}${indent}enabled: false,\\n` +\n `${indent}${indent}path: \"/sitemap.xml\",\\n` +\n `${indent}${indent}defaults: { changefreq: \"weekly\", priority: 0.5 },\\n` +\n `${indent}},\\n`;\n\n const { index: insertionPoint, needsComma } = lastPropertyEnd(source, closingBraceIndex);\n\n const next =\n `${source.slice(0, insertionPoint)}` +\n `${needsComma ? \",\\n\" : \"\"}` +\n `${block}` +\n `${source.slice(closingBraceIndex)}`;\n\n if (hasSyntaxErrors(next)) {\n return { status: \"unrecognised\" };\n }\n\n return { status: \"merged\", next };\n}\n\n/** Whether TEXT fails to parse as TypeScript source. */\nfunction hasSyntaxErrors(text: string): boolean {\n const { diagnostics } = ts.transpileModule(text, {\n compilerOptions: { module: ts.ModuleKind.ESNext, target: ts.ScriptTarget.ESNext },\n reportDiagnostics: true,\n });\n\n return Boolean(diagnostics && diagnostics.length > 0);\n}\n\n/**\n * Whether the exported config object literal already has a `sitemap`\n * property directly on it — a `sitemap` key nested under some other\n * property (e.g. `seo: { sitemap: true }`) is a different feature's field\n * and must not block adding the top-level one.\n */\nfunction hasTopLevelSitemapProperty(objectLiteral: ts.ObjectLiteralExpression): boolean {\n return objectLiteral.properties.some(\n (property) =>\n (ts.isPropertyAssignment(property) || ts.isShorthandPropertyAssignment(property)) &&\n propertyKeyName(property.name) === \"sitemap\",\n );\n}\n\n/** The literal text of a property name node, when it is one of the plain shapes we care about. */\nfunction propertyKeyName(name: ts.PropertyName): string | undefined {\n if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNumericLiteral(name)) {\n return name.text;\n }\n\n return undefined;\n}\n\n/**\n * Find the object literal a source file's default export ultimately points\n * at, whether the export is inline or an identifier declared earlier in the\n * file.\n */\nfunction findExportedConfigObjectLiteral(\n sourceFile: ts.SourceFile,\n): ts.ObjectLiteralExpression | undefined {\n const exportAssignment = sourceFile.statements.find(\n (statement): statement is ts.ExportAssignment =>\n ts.isExportAssignment(statement) && !statement.isExportEquals,\n );\n\n if (!exportAssignment) return undefined;\n\n const { expression } = exportAssignment;\n\n if (ts.isObjectLiteralExpression(expression)) {\n return expression;\n }\n\n if (!ts.isIdentifier(expression)) return undefined;\n\n const identifier = expression.text;\n\n for (const statement of sourceFile.statements) {\n if (!ts.isVariableStatement(statement)) continue;\n\n for (const declaration of statement.declarationList.declarations) {\n if (\n ts.isIdentifier(declaration.name) &&\n declaration.name.text === identifier &&\n declaration.initializer &&\n ts.isObjectLiteralExpression(declaration.initializer)\n ) {\n return declaration.initializer;\n }\n }\n }\n\n return undefined;\n}\n\n/**\n * Where to insert a new property right before a closing brace, and whether\n * the property immediately before it (if any) needs a trailing comma added —\n * an object literal with two properties and no comma between them does not\n * parse.\n */\nfunction lastPropertyEnd(\n source: string,\n closingBraceIndex: number,\n): { index: number; needsComma: boolean } {\n let cursor = closingBraceIndex - 1;\n\n while (cursor >= 0 && /\\s/.test(source.charAt(cursor))) {\n cursor--;\n }\n\n if (cursor < 0 || source[cursor] === \"{\" || source[cursor] === \",\") {\n return { index: closingBraceIndex, needsComma: false };\n }\n\n return { index: cursor + 1, needsComma: true };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,sBAAsB,QAAuC;CAC3E,MAAM,aAAa,GAAG,iBACpB,UACA,QACA,GAAG,aAAa,QACK,MACrB,GAAG,WAAW,EAChB;CAEA,MAAM,gBAAgB,gCAAgC,UAAU;CAEhE,IAAI,CAAC,eACH,OAAO,EAAE,QAAQ,eAAe;CAGlC,IAAI,2BAA2B,aAAa,GAC1C,OAAO,EAAE,QAAQ,kBAAkB;CAGrC,MAAM,YAAY,cAAc,SAAS,UAAU,IAAI;CACvD,MAAM,oBAAoB,cAAc,OAAO,IAAI;CACnD,MAAM,OAAO,OAAO,MAAM,WAAW,iBAAiB;CAEtD,MAAM,cAAc,eAAe,KAAK,IAAI;CAC5C,MAAM,SAAS,cAAc,YAAY,KAAK;CAE9C,MAAM,QACJ,GAAG,OAAO,cACP,SAAS,OAAO,mBAChB,SAAS,OAAO,yBAChB,SAAS,OAAO,sDAChB,OAAO;CAEZ,MAAM,EAAE,OAAO,gBAAgB,eAAe,gBAAgB,QAAQ,iBAAiB;CAEvF,MAAM,OACJ,GAAG,OAAO,MAAM,GAAG,cAAc,IAC9B,aAAa,QAAQ,KACrB,QACA,OAAO,MAAM,iBAAiB;CAEnC,IAAI,gBAAgB,IAAI,GACtB,OAAO,EAAE,QAAQ,eAAe;CAGlC,OAAO;EAAE,QAAQ;EAAU;CAAK;AAClC;;AAGA,SAAS,gBAAgB,MAAuB;CAC9C,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,MAAM;EAC/C,iBAAiB;GAAE,QAAQ,GAAG,WAAW;GAAQ,QAAQ,GAAG,aAAa;EAAO;EAChF,mBAAmB;CACrB,CAAC;CAED,OAAO,QAAQ,eAAe,YAAY,SAAS,CAAC;AACtD;;;;;;;AAQA,SAAS,2BAA2B,eAAoD;CACtF,OAAO,cAAc,WAAW,MAC7B,cACE,GAAG,qBAAqB,QAAQ,KAAK,GAAG,8BAA8B,QAAQ,MAC/E,gBAAgB,SAAS,IAAI,MAAM,SACvC;AACF;;AAGA,SAAS,gBAAgB,MAA2C;CAClE,IAAI,GAAG,aAAa,IAAI,KAAK,GAAG,gBAAgB,IAAI,KAAK,GAAG,iBAAiB,IAAI,GAC/E,OAAO,KAAK;AAIhB;;;;;;AAOA,SAAS,gCACP,YACwC;CACxC,MAAM,mBAAmB,WAAW,WAAW,MAC5C,cACC,GAAG,mBAAmB,SAAS,KAAK,CAAC,UAAU,cACnD;CAEA,IAAI,CAAC,kBAAkB,OAAO;CAE9B,MAAM,EAAE,eAAe;CAEvB,IAAI,GAAG,0BAA0B,UAAU,GACzC,OAAO;CAGT,IAAI,CAAC,GAAG,aAAa,UAAU,GAAG,OAAO;CAEzC,MAAM,aAAa,WAAW;CAE9B,KAAK,MAAM,aAAa,WAAW,YAAY;EAC7C,IAAI,CAAC,GAAG,oBAAoB,SAAS,GAAG;EAExC,KAAK,MAAM,eAAe,UAAU,gBAAgB,cAClD,IACE,GAAG,aAAa,YAAY,IAAI,KAChC,YAAY,KAAK,SAAS,cAC1B,YAAY,eACZ,GAAG,0BAA0B,YAAY,WAAW,GAEpD,OAAO,YAAY;CAGzB;AAGF;;;;;;;AAQA,SAAS,gBACP,QACA,mBACwC;CACxC,IAAI,SAAS,oBAAoB;CAEjC,OAAO,UAAU,KAAK,KAAK,KAAK,OAAO,OAAO,MAAM,CAAC,GACnD;CAGF,IAAI,SAAS,KAAK,OAAO,YAAY,OAAO,OAAO,YAAY,KAC7D,OAAO;EAAE,OAAO;EAAmB,YAAY;CAAM;CAGvD,OAAO;EAAE,OAAO,SAAS;EAAG,YAAY;CAAK;AAC/C"}
1
+ {"version":3,"file":"merge-web-sitemap-config.mjs","names":["ast.parseSourceFile","ast.isPropertyAssignment","ast.isShorthandPropertyAssignment","ast.nameNode","ast.isIdentifier","ast.isStringLiteral","ast.isNumericLiteral","ast.valueText","ast.isExportAssignment","ast.isObjectLiteralExpression","ast.topLevelDeclarations","ast.isVariableStatement"],"sources":["../../../../../../../../../../packages/core/src/generations/features/shared/merge-web-sitemap-config.ts"],"sourcesContent":["import { parseSync } from \"oxc-parser\";\nimport * as ast from \"../../../tooling/syntax/ast\";\n\n/** What {@link mergeWebSitemapConfig} did, or could not do, to the source it was given. */\nexport type WebSitemapMergeResult =\n | { status: \"merged\"; next: string }\n | { status: \"already-present\" }\n | { status: \"unrecognised\" };\n\n/**\n * Merge a disabled `sitemap` section into `src/config/web.ts` SOURCE TEXT.\n *\n * **String surgery, never parse-and-print** — same rationale as\n * `insertConnectorEntry`: `web.ts` is app-owned and may carry any formatting\n * or comments a parse-and-print would discard. The TypeScript AST is used to\n * *find where to cut*, never to regenerate the file — the splice below still\n * copies the original source's bytes verbatim.\n *\n * Recognises the exported config object two ways: an inline `export default\n * {...}`, or `export default <identifier>;` pointing back at a `const\n * <identifier> = {...}` (or `const <identifier>: SomeType = {...}`) declared\n * earlier in the file — the shape this generator itself scaffolds, and the\n * shape every other generated config file in this project uses. Any other\n * shape (a function call, a re-export, no default export at all) returns\n * `\"unrecognised\"` rather than guessing at where to cut — clobbering an\n * app-owned file the merge could not actually understand is worse than\n * refusing.\n *\n * A `sitemap` property already present anywhere in the source (by key, so one\n * a human has since hand-edited is still found) is left unchanged — that is\n * what makes a second `warlock add sitemap` a no-op instead of a duplicate\n * block. Detection walks the AST rather than regex-matching `sitemap\\s*:`, so\n * a comment like `// sitemap: TODO` — text, not a property — does not count.\n *\n * Before returning a merge, the resulting text is re-parsed and checked for\n * syntax errors; a merge that would not itself parse is refused (as\n * `\"unrecognised\"`) instead of written, since a matched-but-corrupt splice is\n * worse than doing nothing.\n *\n * @param source The config file's current text.\n * @returns What happened, and the new text when there is any.\n */\nexport function mergeWebSitemapConfig(source: string): WebSitemapMergeResult {\n const sourceFile = ast.parseSourceFile(\"web.ts\", source);\n\n const objectLiteral = findExportedConfigObjectLiteral(sourceFile);\n\n if (!objectLiteral) {\n return { status: \"unrecognised\" };\n }\n\n if (hasTopLevelSitemapProperty(objectLiteral)) {\n return { status: \"already-present\" };\n }\n\n const bodyStart = objectLiteral.start + 1;\n const closingBraceIndex = objectLiteral.end - 1;\n const body = source.slice(bodyStart, closingBraceIndex);\n\n const indentMatch = /\\n([ \\t]*)\\S/.exec(body);\n const indent = indentMatch ? indentMatch[1] : \" \";\n\n const block =\n `${indent}sitemap: {\\n` +\n `${indent}${indent}enabled: false,\\n` +\n `${indent}${indent}path: \"/sitemap.xml\",\\n` +\n `${indent}${indent}defaults: { changefreq: \"weekly\", priority: 0.5 },\\n` +\n `${indent}},\\n`;\n\n const { index: insertionPoint, needsComma } = lastPropertyEnd(source, closingBraceIndex);\n\n const next =\n `${source.slice(0, insertionPoint)}` +\n `${needsComma ? \",\\n\" : \"\"}` +\n `${block}` +\n `${source.slice(closingBraceIndex)}`;\n\n if (hasSyntaxErrors(next)) {\n return { status: \"unrecognised\" };\n }\n\n return { status: \"merged\", next };\n}\n\n/** Whether TEXT fails to parse as TypeScript source. */\nfunction hasSyntaxErrors(text: string): boolean {\n return parseSync(\"web.ts\", text).errors.length > 0;\n}\n\n/**\n * Whether the exported config object literal already has a `sitemap`\n * property directly on it — a `sitemap` key nested under some other\n * property (e.g. `seo: { sitemap: true }`) is a different feature's field\n * and must not block adding the top-level one.\n */\nfunction hasTopLevelSitemapProperty(objectLiteral: ast.ObjectExpression): boolean {\n return objectLiteral.properties.some(\n (property) =>\n (ast.isPropertyAssignment(property) || ast.isShorthandPropertyAssignment(property)) &&\n propertyKeyName(ast.nameNode(property)) === \"sitemap\",\n );\n}\n\n/** The literal text of a property name node, when it is one of the plain shapes we care about. */\nfunction propertyKeyName(name: ast.Node): string | undefined {\n if (ast.isIdentifier(name) || ast.isStringLiteral(name) || ast.isNumericLiteral(name)) {\n return ast.valueText(name);\n }\n\n return undefined;\n}\n\n/**\n * Find the object literal a source file's default export ultimately points\n * at, whether the export is inline or an identifier declared earlier in the\n * file.\n */\nfunction findExportedConfigObjectLiteral(\n sourceFile: ast.SourceFile,\n): ast.ObjectExpression | undefined {\n const exportAssignment = sourceFile.body.find(\n (statement): statement is ast.ExportDefaultDeclaration => ast.isExportAssignment(statement),\n );\n\n if (!exportAssignment) return undefined;\n\n const expression = exportAssignment.declaration;\n\n if (ast.isObjectLiteralExpression(expression)) {\n return expression;\n }\n\n if (!ast.isIdentifier(expression)) return undefined;\n\n const identifier = ast.valueText(expression);\n\n for (const statement of ast.topLevelDeclarations(sourceFile)) {\n if (!ast.isVariableStatement(statement)) continue;\n\n for (const declaration of statement.declarations) {\n if (\n ast.isIdentifier(ast.nameNode(declaration)) &&\n ast.valueText(declaration.id) === identifier &&\n declaration.init &&\n ast.isObjectLiteralExpression(declaration.init)\n ) {\n return declaration.init;\n }\n }\n }\n\n return undefined;\n}\n\n/**\n * Where to insert a new property right before a closing brace, and whether\n * the property immediately before it (if any) needs a trailing comma added —\n * an object literal with two properties and no comma between them does not\n * parse.\n */\nfunction lastPropertyEnd(\n source: string,\n closingBraceIndex: number,\n): { index: number; needsComma: boolean } {\n let cursor = closingBraceIndex - 1;\n\n while (cursor >= 0 && /\\s/.test(source.charAt(cursor))) {\n cursor--;\n }\n\n if (cursor < 0 || source[cursor] === \"{\" || source[cursor] === \",\") {\n return { index: closingBraceIndex, needsComma: false };\n }\n\n return { index: cursor + 1, needsComma: true };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,sBAAsB,QAAuC;CAG3E,MAAM,gBAAgB,gCAFHA,gBAAoB,UAAU,MAEc,CAAC;CAEhE,IAAI,CAAC,eACH,OAAO,EAAE,QAAQ,eAAe;CAGlC,IAAI,2BAA2B,aAAa,GAC1C,OAAO,EAAE,QAAQ,kBAAkB;CAGrC,MAAM,YAAY,cAAc,QAAQ;CACxC,MAAM,oBAAoB,cAAc,MAAM;CAC9C,MAAM,OAAO,OAAO,MAAM,WAAW,iBAAiB;CAEtD,MAAM,cAAc,eAAe,KAAK,IAAI;CAC5C,MAAM,SAAS,cAAc,YAAY,KAAK;CAE9C,MAAM,QACJ,GAAG,OAAO,cACP,SAAS,OAAO,mBAChB,SAAS,OAAO,yBAChB,SAAS,OAAO,sDAChB,OAAO;CAEZ,MAAM,EAAE,OAAO,gBAAgB,eAAe,gBAAgB,QAAQ,iBAAiB;CAEvF,MAAM,OACJ,GAAG,OAAO,MAAM,GAAG,cAAc,IAC9B,aAAa,QAAQ,KACrB,QACA,OAAO,MAAM,iBAAiB;CAEnC,IAAI,gBAAgB,IAAI,GACtB,OAAO,EAAE,QAAQ,eAAe;CAGlC,OAAO;EAAE,QAAQ;EAAU;CAAK;AAClC;;AAGA,SAAS,gBAAgB,MAAuB;CAC9C,OAAO,UAAU,UAAU,IAAI,CAAC,CAAC,OAAO,SAAS;AACnD;;;;;;;AAQA,SAAS,2BAA2B,eAA8C;CAChF,OAAO,cAAc,WAAW,MAC7B,cACEC,qBAAyB,QAAQ,KAAKC,8BAAkC,QAAQ,MACjF,gBAAgBC,SAAa,QAAQ,CAAC,MAAM,SAChD;AACF;;AAGA,SAAS,gBAAgB,MAAoC;CAC3D,IAAIC,aAAiB,IAAI,KAAKC,gBAAoB,IAAI,KAAKC,iBAAqB,IAAI,GAClF,OAAOC,UAAc,IAAI;AAI7B;;;;;;AAOA,SAAS,gCACP,YACkC;CAClC,MAAM,mBAAmB,WAAW,KAAK,MACtC,cAAyDC,mBAAuB,SAAS,CAC5F;CAEA,IAAI,CAAC,kBAAkB,OAAO;CAE9B,MAAM,aAAa,iBAAiB;CAEpC,IAAIC,0BAA8B,UAAU,GAC1C,OAAO;CAGT,IAAI,CAACL,aAAiB,UAAU,GAAG,OAAO;CAE1C,MAAM,aAAaG,UAAc,UAAU;CAE3C,KAAK,MAAM,aAAaG,qBAAyB,UAAU,GAAG;EAC5D,IAAI,CAACC,oBAAwB,SAAS,GAAG;EAEzC,KAAK,MAAM,eAAe,UAAU,cAClC,IACEP,aAAiBD,SAAa,WAAW,CAAC,KAC1CI,UAAc,YAAY,EAAE,MAAM,cAClC,YAAY,QACZE,0BAA8B,YAAY,IAAI,GAE9C,OAAO,YAAY;CAGzB;AAGF;;;;;;;AAQA,SAAS,gBACP,QACA,mBACwC;CACxC,IAAI,SAAS,oBAAoB;CAEjC,OAAO,UAAU,KAAK,KAAK,KAAK,OAAO,OAAO,MAAM,CAAC,GACnD;CAGF,IAAI,SAAS,KAAK,OAAO,YAAY,OAAO,OAAO,YAAY,KAC7D,OAAO;EAAE,OAAO;EAAmB,YAAY;CAAM;CAGvD,OAAO;EAAE,OAAO,SAAS;EAAG,YAAY;CAAK;AAC/C"}
@@ -81,5 +81,5 @@ function escapeForRegExp(value) {
81
81
  }
82
82
 
83
83
  //#endregion
84
- export { patchTsconfigInclude };
84
+ export { insertIncludeEntry, patchTsconfigInclude };
85
85
  //# sourceMappingURL=patch-tsconfig-include.mjs.map
@@ -154,5 +154,5 @@ async function relocateConflictingHomeRoute() {
154
154
  }
155
155
 
156
156
  //#endregion
157
- export { relocateConflictingHomeRoute };
157
+ export { relocateConflictingHomeRoute, resolveHomeRouteCollision };
158
158
  //# sourceMappingURL=relocate-conflicting-home-route.mjs.map
@@ -49,7 +49,8 @@ async function installSitemapConfig() {
49
49
  console.log(NEXT_STEPS);
50
50
  return;
51
51
  }
52
- const merge = mergeWebSitemapConfig(await getFileAsync(configPath));
52
+ const current = await getFileAsync(configPath);
53
+ const merge = mergeWebSitemapConfig(current);
53
54
  if (merge.status === "already-present") {
54
55
  console.log(`${colors.yellowBright("sitemap")} already configured in src/config/web.ts, skipping...`);
55
56
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"sitemap.feature.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/generations/features/sitemap.feature.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { fileExistsAsync, getFileAsync, putFileAsync } from \"../generation-fs\";\nimport { srcPath } from \"../../utils\";\nimport { mergeWebSitemapConfig } from \"./shared/merge-web-sitemap-config\";\nimport { type FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\nconst NEXT_STEPS =\n \"Next: set `app.publicUrl` (src/config/app.ts) or the PUBLIC_APP_URL environment \" +\n \"variable, then flip `sitemap.enabled` to true in src/config/web.ts.\";\n\n/**\n * Ships DISABLED because a sitemap needs this application's public origin and\n * a freshly generated app has no way to know it. Two steps to turn it on:\n *\n * 1. set `app.publicUrl` in src/config/app.ts, or the PUBLIC_APP_URL\n * environment variable;\n * 2. flip `sitemap.enabled` to true here.\n *\n * With it enabled and no origin configured, generation REFUSES rather than\n * serving absolute URLs built from a guessed host — a sitemap pointing at\n * the wrong domain is worse than one that never starts, because nothing\n * downstream reports it.\n */\nconst freshWebConfigStub = `import type { WebSitemapConfig } from \"@warlock.js/web/sitemap\";\n\nconst webConfig: { sitemap: WebSitemapConfig } = {\n sitemap: {\n enabled: false,\n path: \"/sitemap.xml\",\n defaults: { changefreq: \"weekly\", priority: 0.5 },\n },\n};\n\nexport default webConfig;\n`;\n\n/**\n * `warlock add sitemap` writes its policy into the app's \\`src/config/web.ts\\`,\n * under the \\`sitemap\\` key — there is no \\`src/config/sitemap.ts\\` and no\n * standalone connector to register; \\`@warlock.js/web\\` (already installed via\n * the \\`web\\` requirement) reads \\`web.sitemap\\` itself.\n *\n * Creates \\`web.ts\\` when the app does not have one yet; otherwise merges a\n * \\`sitemap\\` section into whatever is already there rather than clobbering it.\n */\nasync function installSitemapConfig(): Promise<void> {\n const configPath = srcPath(\"config/web.ts\");\n\n if (!(await fileExistsAsync(configPath))) {\n await putFileAsync(configPath, freshWebConfigStub);\n console.log(`${colors.green(\"✓\")} Created src/config/web.ts with a disabled sitemap section`);\n console.log(NEXT_STEPS);\n\n return;\n }\n\n const current = await getFileAsync(configPath);\n const merge = mergeWebSitemapConfig(current);\n\n if (merge.status === \"already-present\") {\n console.log(\n `${colors.yellowBright(\"sitemap\")} already configured in src/config/web.ts, skipping...`,\n );\n\n return;\n }\n\n if (merge.status === \"unrecognised\") {\n console.log(\n `${colors.redBright(\"✗\")} Could not safely add a \\`sitemap\\` section to ` +\n `${colors.yellowBright(\"src/config/web.ts\")} — its exported config object was not ` +\n \"recognised, so nothing was written. Add it yourself:\\n\" +\n ' sitemap: { enabled: false, path: \"/sitemap.xml\", defaults: { changefreq: \"weekly\", priority: 0.5 } },',\n );\n\n process.exitCode = 1;\n\n return;\n }\n\n await putFileAsync(configPath, merge.next);\n console.log(`${colors.green(\"✓\")} Added a disabled \\`sitemap\\` section to src/config/web.ts`);\n console.log(NEXT_STEPS);\n}\n\n/** `warlock add sitemap` — runtime sitemap.xml generation, backed by the page registry. */\nexport const sitemapFeature: FeatureDefinition = {\n description:\n \"Installs @warlock.js/sitemap — runtime sitemap.xml generation from the page registry. \" +\n \"Adds a disabled `sitemap` section to src/config/web.ts, creating the file if it doesn't \" +\n \"exist yet. Requires app.publicUrl (or PUBLIC_APP_URL) to be set.\",\n requires: [\"web\"],\n dependencies: {\n \"@warlock.js/sitemap\": INSTALLED_WARLOCK_VERSION,\n },\n onExecuting: installSitemapConfig,\n};\n"],"mappings":";;;;;;;;AAMA,MAAM,aACJ;;;;;;;;;;;;;;AAgBF,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;AAsB3B,eAAe,uBAAsC;CACnD,MAAM,aAAa,QAAQ,eAAe;CAE1C,IAAI,CAAE,MAAM,gBAAgB,UAAU,GAAI;EACxC,MAAM,aAAa,YAAY,kBAAkB;EACjD,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,2DAA2D;EAC5F,QAAQ,IAAI,UAAU;EAEtB;CACF;CAGA,MAAM,QAAQ,sBAAsB,MADd,aAAa,UAAU,CACF;CAE3C,IAAI,MAAM,WAAW,mBAAmB;EACtC,QAAQ,IACN,GAAG,OAAO,aAAa,SAAS,EAAE,sDACpC;EAEA;CACF;CAEA,IAAI,MAAM,WAAW,gBAAgB;EACnC,QAAQ,IACN,GAAG,OAAO,UAAU,GAAG,EAAE,iDACpB,OAAO,aAAa,mBAAmB,EAAE;wGAGhD;EAEA,QAAQ,WAAW;EAEnB;CACF;CAEA,MAAM,aAAa,YAAY,MAAM,IAAI;CACzC,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,2DAA2D;CAC5F,QAAQ,IAAI,UAAU;AACxB;;AAGA,MAAa,iBAAoC;CAC/C,aACE;CAGF,UAAU,CAAC,KAAK;CAChB,cAAc,EACZ,uBAAuB,0BACzB;CACA,aAAa;AACf"}
1
+ {"version":3,"file":"sitemap.feature.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/generations/features/sitemap.feature.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { fileExistsAsync, getFileAsync, putFileAsync } from \"../generation-fs\";\nimport { srcPath } from \"../../utils\";\nimport { mergeWebSitemapConfig } from \"./shared/merge-web-sitemap-config\";\nimport { type FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\nconst NEXT_STEPS =\n \"Next: set `app.publicUrl` (src/config/app.ts) or the PUBLIC_APP_URL environment \" +\n \"variable, then flip `sitemap.enabled` to true in src/config/web.ts.\";\n\n/**\n * Ships DISABLED because a sitemap needs this application's public origin and\n * a freshly generated app has no way to know it. Two steps to turn it on:\n *\n * 1. set `app.publicUrl` in src/config/app.ts, or the PUBLIC_APP_URL\n * environment variable;\n * 2. flip `sitemap.enabled` to true here.\n *\n * With it enabled and no origin configured, generation REFUSES rather than\n * serving absolute URLs built from a guessed host — a sitemap pointing at\n * the wrong domain is worse than one that never starts, because nothing\n * downstream reports it.\n */\nconst freshWebConfigStub = `import type { WebSitemapConfig } from \"@warlock.js/web/sitemap\";\n\nconst webConfig: { sitemap: WebSitemapConfig } = {\n sitemap: {\n enabled: false,\n path: \"/sitemap.xml\",\n defaults: { changefreq: \"weekly\", priority: 0.5 },\n },\n};\n\nexport default webConfig;\n`;\n\n/**\n * `warlock add sitemap` writes its policy into the app's \\`src/config/web.ts\\`,\n * under the \\`sitemap\\` key — there is no \\`src/config/sitemap.ts\\` and no\n * standalone connector to register; \\`@warlock.js/web\\` (already installed via\n * the \\`web\\` requirement) reads \\`web.sitemap\\` itself.\n *\n * Creates \\`web.ts\\` when the app does not have one yet; otherwise merges a\n * \\`sitemap\\` section into whatever is already there rather than clobbering it.\n */\nasync function installSitemapConfig(): Promise<void> {\n const configPath = srcPath(\"config/web.ts\");\n\n if (!(await fileExistsAsync(configPath))) {\n await putFileAsync(configPath, freshWebConfigStub);\n console.log(`${colors.green(\"✓\")} Created src/config/web.ts with a disabled sitemap section`);\n console.log(NEXT_STEPS);\n\n return;\n }\n\n const current = await getFileAsync(configPath);\n const merge = mergeWebSitemapConfig(current);\n\n if (merge.status === \"already-present\") {\n console.log(\n `${colors.yellowBright(\"sitemap\")} already configured in src/config/web.ts, skipping...`,\n );\n\n return;\n }\n\n if (merge.status === \"unrecognised\") {\n console.log(\n `${colors.redBright(\"✗\")} Could not safely add a \\`sitemap\\` section to ` +\n `${colors.yellowBright(\"src/config/web.ts\")} — its exported config object was not ` +\n \"recognised, so nothing was written. Add it yourself:\\n\" +\n ' sitemap: { enabled: false, path: \"/sitemap.xml\", defaults: { changefreq: \"weekly\", priority: 0.5 } },',\n );\n\n process.exitCode = 1;\n\n return;\n }\n\n await putFileAsync(configPath, merge.next);\n console.log(`${colors.green(\"✓\")} Added a disabled \\`sitemap\\` section to src/config/web.ts`);\n console.log(NEXT_STEPS);\n}\n\n/** `warlock add sitemap` — runtime sitemap.xml generation, backed by the page registry. */\nexport const sitemapFeature: FeatureDefinition = {\n description:\n \"Installs @warlock.js/sitemap — runtime sitemap.xml generation from the page registry. \" +\n \"Adds a disabled `sitemap` section to src/config/web.ts, creating the file if it doesn't \" +\n \"exist yet. Requires app.publicUrl (or PUBLIC_APP_URL) to be set.\",\n requires: [\"web\"],\n dependencies: {\n \"@warlock.js/sitemap\": INSTALLED_WARLOCK_VERSION,\n },\n onExecuting: installSitemapConfig,\n};\n"],"mappings":";;;;;;;;AAMA,MAAM,aACJ;;;;;;;;;;;;;;AAgBF,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;AAsB3B,eAAe,uBAAsC;CACnD,MAAM,aAAa,QAAQ,eAAe;CAE1C,IAAI,CAAE,MAAM,gBAAgB,UAAU,GAAI;EACxC,MAAM,aAAa,YAAY,kBAAkB;EACjD,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,2DAA2D;EAC5F,QAAQ,IAAI,UAAU;EAEtB;CACF;CAEA,MAAM,UAAU,MAAM,aAAa,UAAU;CAC7C,MAAM,QAAQ,sBAAsB,OAAO;CAE3C,IAAI,MAAM,WAAW,mBAAmB;EACtC,QAAQ,IACN,GAAG,OAAO,aAAa,SAAS,EAAE,sDACpC;EAEA;CACF;CAEA,IAAI,MAAM,WAAW,gBAAgB;EACnC,QAAQ,IACN,GAAG,OAAO,UAAU,GAAG,EAAE,iDACpB,OAAO,aAAa,mBAAmB,EAAE;wGAGhD;EAEA,QAAQ,WAAW;EAEnB;CACF;CAEA,MAAM,aAAa,YAAY,MAAM,IAAI;CACzC,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,2DAA2D;CAC5F,QAAQ,IAAI,UAAU;AACxB;;AAGA,MAAa,iBAAoC;CAC/C,aACE;CAGF,UAAU,CAAC,KAAK;CAChB,cAAc,EACZ,uBAAuB,0BACzB;CACA,aAAa;AACf"}
@@ -69,5 +69,5 @@ async function ensureDirectoryAsync$1(directory) {
69
69
  }
70
70
 
71
71
  //#endregion
72
- export { directoryExistsAsync$1 as directoryExistsAsync, ensureDirectoryAsync$1 as ensureDirectoryAsync, fileExistsAsync$1 as fileExistsAsync, getFileAsync$1 as getFileAsync, getJsonFileAsync$1 as getJsonFileAsync, putFileAsync$1 as putFileAsync, putJsonFileAsync$1 as putJsonFileAsync };
72
+ export { directoryExistsAsync$1 as directoryExistsAsync, ensureDirectoryAsync$1 as ensureDirectoryAsync, fileExistsAsync$1 as fileExistsAsync, getFileAsync$1 as getFileAsync, getJsonFileAsync$1 as getJsonFileAsync, putFileAsync$1 as putFileAsync, putJsonFileAsync$1 as putJsonFileAsync, recordSkippedFile };
73
73
  //# sourceMappingURL=generation-fs.mjs.map
@@ -181,5 +181,5 @@ const generationOutputOptions = [{
181
181
  }];
182
182
 
183
183
  //#endregion
184
- export { currentGenerationRun, generationOutputOptions, hasPendingContentUnder, isGenerationDryRun, pendingGeneratedContent, recordGeneratedFile, recordSkippedFile, runGenerationCommand, setGenerationDetail, setPendingGeneratedContent, toReportPath };
184
+ export { beginGenerationRun, currentGenerationRun, endGenerationRun, generationOutputOptions, hasPendingContentUnder, isGenerationDryRun, pendingGeneratedContent, recordGeneratedFile, recordSkippedFile, runGenerationCommand, setGenerationDetail, setPendingGeneratedContent, toReportPath };
185
185
  //# sourceMappingURL=generation-run.mjs.map
@@ -893,7 +893,7 @@ export default function App({ children }: AppProps) {
893
893
  * dependency: replace the acknowledgement with a mail/job/database action.
894
894
  */
895
895
  const webContactControllerStub = `import { type Request, type RequestHandler } from "@warlock.js/core";
896
- import { type Infer, v } from "@warlock.js/seal";
896
+ import { v, type Infer } from "@warlock.js/seal";
897
897
 
898
898
  export const contactSchema = v.object({
899
899
  name: v.string().min(2),
@@ -1 +1 @@
1
- {"version":3,"file":"stubs.mjs","names":[],"sources":["../../../../../../../../packages/core/src/generations/stubs.ts"],"sourcesContent":["export const accessConfigStub = `import { type AccessConfigurations } from \"@warlock.js/access\";\nimport { DatabaseAccessResolver } from \"app/access/services/access-resolver\";\n\n/**\n * Authorization configuration — read by @warlock.js/access on boot.\n *\n * The resolver is the one required piece: it tells the engine how to read a\n * user's roles + permissions. The ejected DatabaseAccessResolver reads roles\n * from the user_roles table and maps them through the roles catalog table (so\n * roles + their permissions are managed at runtime, in the DB).\n *\n * For a fixed, code-defined catalog with no tables, swap in DefaultAccessResolver:\n * import { DefaultAccessResolver } from \"@warlock.js/access\";\n * resolver: new DefaultAccessResolver({ admin: [\"*\"], editor: [\"orders.*\"] }),\n *\n * Multi-tenant? Add a \\`resolveTenant()\\` to the resolver to read the active\n * tenant from the request; checks then scope to it automatically.\n */\nconst access: AccessConfigurations = {\n resolver: new DatabaseAccessResolver(),\n\n // Cache resolved permission sets (default \"10m\").\n // cache: { ttl: \"10m\" },\n};\n\nexport default access;\n`;\n\nexport const aiConfigStub = `import type { AIConfig } from \"@warlock.js/ai\";\n\n// >>> warlock:ai-packages (auto-managed) >>>\n// Satellite packages augment the \"ai\" object on import — e.g. ai.workspace,\n// ai.tools / ai.mcp, and panoptic's ai.config({ panoptic }) wiring. The command\n// \"warlock add ai-workspace | ai-tools | ai-panoptic\" adds the matching\n// side-effect import below; keep them so the augmentation + runtime registration\n// load before the ai connector applies this config.\n// <<< warlock:ai-packages <<<\n\n/**\n * AI configuration — applied on boot by the ai connector, which calls\n * ai.config(...) with the object below. Cross-cutting defaults live here\n * (shared cache / snapshot stores, observability); per-call options always win.\n *\n * Wire a default model from a provider you installed, e.g.:\n * import { OpenAISDK } from \"@warlock.js/ai-openai\";\n * const openai = OpenAISDK({ apiKey: env(\"OPENAI_API_KEY\") });\n * // then pass openai.model({ name: \"gpt-4o-mini\" }) into your agents.\n */\nconst ai: Partial<AIConfig> = {\n // Default cache driver for cache-backed AI features (semantic cache, rag / memory vector stores).\n // defaultStore: cache.driver(\"redis\", { client }),\n\n // Observability — requires \"warlock add ai-panoptic\". Exporters + the local dashboard.\n // panoptic: { exporters: [], dashboard: false, observeAll: false },\n};\n\nexport default ai;\n`;\n\nexport const accessRoleModelStub = `import { Model, RegisterModel } from \"@warlock.js/cascade\";\nimport { type Infer, v } from \"@warlock.js/seal\";\n\n/**\n * Validation schema for the roles catalog — mirrors the migration columns\n * (snake_case). Each row is a role name plus the permission strings it grants;\n * wildcards work (\"orders.*\", \"*\"). The DatabaseAccessResolver maps a user's\n * assigned role names through this table to their effective permissions.\n */\nexport const roleSchema = v.object({\n name: v.string(),\n permissions: v.array(v.string()).default([]),\n});\n\nexport type RoleSchema = Infer<typeof roleSchema>;\n\n/**\n * The roles catalog — role name → the permissions it grants. Managed at runtime\n * (admins add roles + edit their permissions), unlike a fixed code map. Read by\n * DatabaseAccessResolver.resolvePermissions to expand a user's roles to permissions.\n */\n@RegisterModel()\nexport class Role extends Model<RoleSchema> {\n public static table = \"roles\";\n\n public static schema = roleSchema;\n\n /** The permission strings this role grants. */\n public get permissions(): string[] {\n return this.get<string[]>(\"permissions\", []);\n }\n}\n`;\n\nexport const accessRoleModelIndexStub = `export * from \"./role.model\";\n`;\n\nexport const accessRoleMigrationStub = `import { arrayText, Migration, text } from \"@warlock.js/cascade\";\nimport { Role } from \"../role.model\";\n\n/**\n * Roles catalog table. \\`name\\` is unique (one row per role); \\`permissions\\` is a\n * text array of the permission strings the role grants.\n */\nexport default Migration.create(Role, {\n name: text().notNullable().unique(),\n permissions: arrayText().nullable(),\n});\n`;\n\nexport const accessUserRoleModelStub = `import { access } from \"@warlock.js/access\";\nimport type { Auth } from \"@warlock.js/auth\";\nimport { Model, RegisterModel } from \"@warlock.js/cascade\";\nimport { type Infer, v } from \"@warlock.js/seal\";\n\n/**\n * Validation schema for a role assignment — mirrors the migration columns\n * (snake_case). \\`tenant\\` is nullable: a null tenant is a GLOBAL assignment.\n */\nexport const userRoleSchema = v.object({\n user_id: v.string(),\n user_type: v.string(),\n role: v.string(),\n tenant: v.string().optional(),\n});\n\nexport type UserRoleSchema = Infer<typeof userRoleSchema>;\n\n/**\n * The role-assignment table — which roles a user holds, optionally per tenant.\n * Read by DatabaseAccessResolver.resolveRoles; mutated via the statics below.\n * \\`assign\\` / \\`revoke\\` flush the cached permission set automatically, so callers\n * never need to call \\`access.flush(user, tenant)\\` themselves.\n */\n@RegisterModel()\nexport class UserRole extends Model<UserRoleSchema> {\n public static table = \"user_roles\";\n\n public static schema = userRoleSchema;\n\n /**\n * Role names assigned to the user in the given tenant.\n *\n * An unresolved tenant (\\`undefined\\`) scopes to GLOBAL roles only — the rows\n * stored with no tenant (\\`null\\`) — never the union across every tenant. The\n * union would be a privilege-escalation: a user who is \\`owner\\` in one tenant\n * must not be treated as \\`owner\\` everywhere just because a check didn't carry\n * a tenant. This mirrors how \\`assign(user, role)\\` stores a global row.\n */\n public static async rolesFor(user: Auth, tenant?: string): Promise<string[]> {\n const rows = await this.query()\n .where({\n user_id: user.id,\n user_type: user.userType,\n tenant: tenant ?? null,\n })\n .get();\n\n // De-dupe so a duplicate row (a concurrent assign that slipped past the\n // existence check) can't distort the resolved set.\n return [...new Set(rows.map((row) => row.get(\"role\") as string))];\n }\n\n /**\n * Assign a role to the user. No-op if the assignment already exists.\n * Flushes the user's cached permission set automatically.\n */\n public static async assign(user: Auth, role: string, tenant?: string): Promise<void> {\n const existing = await this.first({\n user_id: user.id,\n user_type: user.userType,\n role,\n tenant: tenant ?? null,\n });\n\n if (existing) return;\n\n await this.create({\n user_id: user.id,\n user_type: user.userType,\n role,\n tenant,\n });\n\n await access.flush(user, tenant);\n }\n\n /**\n * Remove a role assignment from the user.\n * Flushes the user's cached permission set automatically.\n */\n public static async revoke(user: Auth, role: string, tenant?: string): Promise<void> {\n await this.delete({\n user_id: user.id,\n user_type: user.userType,\n role,\n tenant: tenant ?? null,\n });\n\n await access.flush(user, tenant);\n }\n}\n`;\n\nexport const accessUserRoleModelIndexStub = `export * from \"./user-role.model\";\n`;\n\nexport const accessUserRoleMigrationStub = `import { Migration, text, uuid } from \"@warlock.js/cascade\";\nimport { UserRole } from \"../user-role.model\";\n\n/**\n * Role-assignment table. \\`user_id\\` is a UUID — override this migration if your\n * user ids are integers. The composite index powers the per-user (per-tenant)\n * lookup the resolver runs on every check.\n */\nexport default Migration.create(\n UserRole,\n {\n user_id: uuid().notNullable().index(),\n user_type: text().notNullable(),\n role: text().notNullable().index(),\n tenant: text().nullable().index(),\n },\n {\n index: [{ columns: [\"user_id\", \"user_type\", \"tenant\"] }],\n },\n);\n`;\n\nexport const accessResolverStub = `import type { AccessResolver } from \"@warlock.js/access\";\nimport type { Auth } from \"@warlock.js/auth\";\nimport { Role } from \"app/access/models/role\";\nimport { UserRole } from \"app/access/models/user-role\";\n\n/**\n * The app's access adapter — connects @warlock.js/access to the ejected role\n * tables. Roles come from the user_roles assignment table; permissions are\n * expanded by mapping those role names through the roles catalog table. Both\n * are managed at runtime (in the DB), so admins can add roles + edit their\n * permissions without a deploy.\n *\n * The engine owns the hard parts (wildcard matching, caching, fail-closed); this\n * resolver only fetches — keep it dumb, never cache inside it.\n */\nexport class DatabaseAccessResolver implements AccessResolver {\n /** The role names this user holds (powers \\`hasRole\\` / \\`hasAnyRole\\`). */\n public async resolveRoles(user: Auth, tenant?: string): Promise<string[]> {\n return UserRole.rolesFor(user, tenant);\n }\n\n /** The effective permission strings this user has (powers \\`can\\` / \\`authorize\\`). */\n public async resolvePermissions(user: Auth, tenant?: string): Promise<string[]> {\n const names = await this.resolveRoles(user, tenant);\n\n if (names.length === 0) return [];\n\n const roles = await Role.query().whereIn(\"name\", names).get();\n\n // Flatten + de-dupe so two roles granting the same permission yield one entry.\n return [...new Set(roles.flatMap((role) => role.permissions))];\n }\n\n /**\n * Optional. Resolve the ambient tenant when a check doesn't pass one\n * explicitly — derive it from the authenticated user (safer than reading\n * client request input, which a caller could spoof). Uncomment + adapt for a\n * multi-tenant app (single-tenant apps leave this off and return undefined).\n */\n // public resolveTenant(user: Auth): string | undefined {\n // return user.get(\"organization_id\");\n // }\n}\n`;\n\nexport const socketConfigStub = `import type { SocketOptions } from \"@warlock.js/core\";\n\n/**\n * Socket.IO configuration — read by the framework's socket connector\n * on boot. When the HTTP server is running the socket server attaches\n * to it; otherwise it listens on its own configured port.\n *\n * Remove this file to disable the socket server entirely.\n */\nexport default {\n options: {\n cors: {\n origin: \"*\",\n },\n },\n} as SocketOptions;\n`;\n\nexport const communicatorsConfigStub = `import { env } from \"@warlock.js/core\";\nimport type { BrokerConfigurations, RabbitMQClientOptions } from \"@warlock.js/herald\";\n\nconst heraldConfigurations: BrokerConfigurations<RabbitMQClientOptions> = {\n driver: \"rabbitmq\",\n name: \"default\",\n isDefault: true,\n\n // ============================================================================\n // Connection Settings\n // ============================================================================\n\n host: env(\"RABBITMQ_HOST\", \"localhost\"),\n port: env(\"RABBITMQ_PORT\", 5672),\n username: env(\"RABBITMQ_USERNAME\", \"guest\"),\n password: env(\"RABBITMQ_PASSWORD\", \"guest\"),\n vhost: env(\"RABBITMQ_VHOST\", \"/\"),\n\n // Or use connection URI (takes precedence over host/port)\n // uri: env(\"RABBITMQ_URL\"),\n\n // ============================================================================\n // Connection Options\n // ============================================================================\n\n /** Heartbeat interval in seconds */\n heartbeat: 60,\n\n /** Connection timeout in milliseconds */\n connectionTimeout: 10000,\n\n /** Enable automatic reconnection on disconnect */\n reconnect: true,\n\n /** Delay between reconnection attempts in milliseconds */\n reconnectDelay: 5_000,\n\n // ============================================================================\n // Consumer Options\n // ============================================================================\n\n /** Default prefetch count (number of unacknowledged messages per consumer) */\n prefetch: 10,\n\n // ============================================================================\n // Client Options (Native amqplib options)\n // ============================================================================\n // These options are passed directly to amqplib.connect()\n // for low-level configuration like frame size, TLS, socket options, etc.\n // ============================================================================\n clientOptions: {\n // Frame max size in bytes (0 = no limit)\n // frameMax: 0,\n\n // Channel max (0 = unlimited)\n // channelMax: 0,\n\n // Socket options\n socket: {\n // Enable TCP keep-alive\n keepAlive: true,\n\n // Disable Nagle's algorithm for lower latency\n noDelay: true,\n\n // Socket timeout (in addition to heartbeat)\n // timeout: 30000,\n },\n\n // TLS/SSL options (uncomment for secure connections)\n // socket: {\n // ca: fs.readFileSync('/path/to/ca.pem'),\n // cert: fs.readFileSync('/path/to/cert.pem'),\n // key: fs.readFileSync('/path/to/key.pem'),\n // rejectUnauthorized: true,\n // },\n },\n};\n\nexport default heraldConfigurations;\n`;\n\nexport const notificationsConfigStub = `import { type NotificationConfig, inApp, mailChannel } from \"@warlock.js/notifications\";\nimport { Notification } from \"app/notifications/models/notification/notification.model\";\n\n/**\n * Notifications configuration. Auto-loaded from src/config on boot — the\n * framework's notifications connector reads this default export and hands it to\n * setNotificationConfig, so this file stays declarative (no side-effect call).\n *\n * Each channel is payload-typed, so notify.mail(...) / notify.database(...)\n * and defineNotification are type-checked against the registry.\n *\n * Channels enabled here:\n * - mail wraps @warlock.js/core sendMail; route is notifiable.email.\n * The \"from\" address defaults to config/mail.ts; override per\n * channel with mailChannel({ from: \"no-reply@yourapp.com\" }).\n * - database in-app store backed by the Notification model. The \"inApp\"\n * facade exposes the recipient-scoped read API: listUnread,\n * countUnread, markAsRead, dismiss, ...\n *\n * Async delivery (.queue()) is OPTIONAL: run \"npx warlock add herald\",\n * import { heraldQueue } from \"@warlock.js/notifications\", and uncomment the\n * queue line below.\n */\nconst config: NotificationConfig = {\n channels: {\n mail: mailChannel(),\n database: inApp.configure({ model: Notification }),\n },\n\n // Async queue — requires @warlock.js/herald (npx warlock add herald):\n // queue: heraldQueue(),\n};\n\nexport default config;\n`;\n\n/** `src/app/notifications/models/notification/notification.model.ts`. */\nexport const notificationModelStub = `import { RegisterModel } from \"@warlock.js/cascade\";\nimport { DatabaseNotification, type NotificationColumnMap } from \"@warlock.js/notifications\";\nimport { v } from \"@warlock.js/seal\";\nimport { NotificationResource } from \"../../resources/notification.resource\";\n\n/**\n * Validation schema for the notifications table — mirrors the migration\n * columns (snake_case). Cascade validates + casts every write against it:\n * nullable columns use .nullish() (may be absent or null), and payload is\n * free-form JSON. Keep this in sync with the migration + columnMap when you\n * add or rename columns.\n *\n * user_id accepts a string or an integer so it matches whichever id type your\n * users use (and the idType you pass to notificationColumns in the migration).\n * Narrow it to that one type.\n */\nconst notificationSchema = v.object({\n user_id: v.union([v.string(), v.int()]),\n type: v.string(),\n title: v.string(),\n body: v.string().nullish(),\n payload: v.record(v.any()).nullish(),\n read_at: v.date().nullish(),\n idempotency_key: v.string().nullish(),\n});\n\n/**\n * In-app notification model.\n *\n * Extends the package's DatabaseNotification base, which provides the stable\n * accessors (recipientId, tenantId, isRead, readAt, markRead) — all derived\n * from the columnMap below. The read/write API lives on the inApp facade\n * (configured in config/notifications.ts); you rarely touch this class directly.\n */\n@RegisterModel()\nexport class Notification extends DatabaseNotification {\n public static table = \"notifications\";\n public static schema = notificationSchema;\n\n /** Every response that returns a notification is shaped by this resource. */\n public static resource = NotificationResource;\n\n /**\n * Maps the in-app store's roles to your columns. This default is\n * single-tenant + read_at-only. Add tenant: \"organization_id\" for\n * multi-tenant; use isRead: \"is_read\" (instead of, or alongside, readAt) to\n * track a boolean read flag. The migration, the accessors and the resource\n * all follow this map.\n */\n public static columnMap: NotificationColumnMap = { readAt: \"read_at\" };\n}\n`;\n\n/** The notifications migration, under `models/notification/migrations/`. */\nexport const notificationMigrationStub = `import { Migration } from \"@warlock.js/cascade\";\nimport { notificationColumns } from \"@warlock.js/notifications\";\nimport { Notification } from \"../notification.model\";\n\n/**\n * Notifications table.\n *\n * Columns come from notificationColumns(Notification) — the recipient / tenant\n * / read-state names follow the model's columnMap; type / title / body /\n * payload / idempotency_key are fixed. The recipient column is a UUID unless\n * you pass { idType: \"integer\" } (or \"bigint\" / \"string\") to match your users.\n * Spread it to add your own columns (and mirror them in the model schema):\n *\n * import { uuid } from \"@warlock.js/cascade\";\n *\n * export default Migration.create(Notification, {\n * ...notificationColumns(Notification, { idType: \"integer\" }),\n * // category_id: uuid().index().nullable(),\n * });\n */\nexport default Migration.create(Notification, notificationColumns(Notification));\n`;\n\n/** `src/app/notifications/resources/notification.resource.ts` — the output shape. */\nexport const notificationResourceStub = `import { defineResource } from \"@warlock.js/core\";\n\n/**\n * What every notification endpoint returns, whatever columns the model holds.\n * readAt reads the default read_at column; change it if you change the model's\n * columnMap.\n */\nexport const NotificationResource = defineResource({\n schema: {\n // Passed through as stored: a UUID string or an integer, per the migration.\n id: (id: string | number) => id,\n type: \"string\",\n title: \"string\",\n body: \"string?\",\n payload: \"object?\",\n readAt: [\"read_at\", \"date?\"],\n createdAt: \"date?\",\n },\n});\n`;\n\n/** `src/app/notifications/schema/list-notifications.schema.ts` — the validated list query. */\nexport const listNotificationsSchemaStub = `import { type Infer, v } from \"@warlock.js/seal\";\n\n/**\n * Query for GET /notifications. Only these keys reach the store (others, such\n * as a cache-busting \\`_\\`, are dropped rather than rejected), and limit is\n * capped so one request cannot read every row. Query values arrive as strings,\n * so the numbers and the flag are coerced.\n */\nexport const listNotificationsSchema = v.object({\n page: v.int().coerce().min(1).optional(),\n limit: v.int().coerce().min(1).max(50).optional(),\n type: v.string().optional(),\n unread: v.boolean().coerce().optional(),\n}).stripUnknown();\n\nexport type ListNotificationsSchema = Infer<typeof listNotificationsSchema>;\n`;\n\n/** `src/app/notifications/types/notifications-request.type.ts` — the guarded request. */\nexport const notificationsRequestTypeStub = `import type { Request, RequestHandler, RequestLocals } from \"@warlock.js/core\";\nimport type { Id } from \"@warlock.js/notifications\";\n\n/**\n * A request that passed authMiddleware, so locals.user is always set. Only the\n * user's id is declared because that is all the inApp store needs. If your\n * app has its own guarded request type, use it instead.\n */\nexport type NotificationsRequest<Payload = unknown> = Request<Payload> & {\n locals: RequestLocals & { user: { id: Id } };\n};\n\nexport type NotificationsRequestHandler<Payload = unknown> = RequestHandler<\n NotificationsRequest<Payload>\n>;\n`;\n\n/** `src/app/notifications/services/mark-notification-read.service.ts`. */\nexport const markNotificationReadServiceStub = `import { ResourceNotFoundError, t } from \"@warlock.js/core\";\nimport { type Id, inApp } from \"@warlock.js/notifications\";\n\n/**\n * Mark one of the user's notifications read and return it. inApp is scoped to\n * the recipient, so another user's id changes nothing and answers 404 here.\n */\nexport async function markNotificationReadService(userId: Id, notificationId: Id) {\n await inApp.markAsRead(userId, notificationId);\n\n const notification = await inApp.find(userId, notificationId);\n\n if (!notification) {\n throw new ResourceNotFoundError(t(\"notifications.notFound\"));\n }\n\n return notification;\n}\n`;\n\n/** `src/app/notifications/controllers/list-notifications.controller.ts`. */\nexport const listNotificationsControllerStub = `import { inApp } from \"@warlock.js/notifications\";\nimport {\n type ListNotificationsSchema,\n listNotificationsSchema,\n} from \"../schema/list-notifications.schema\";\nimport type { NotificationsRequestHandler } from \"../types/notifications-request.type\";\n\n/** GET /notifications — the user's notifications, most recent first. */\nexport const listNotificationsController: NotificationsRequestHandler<\n ListNotificationsSchema\n> = async ({ request, response }) => {\n const { data, pagination } = await inApp.list(request.locals.user.id, request.validated());\n\n return response.success({ notifications: data, pagination });\n};\n\nlistNotificationsController.description = \"List notifications\";\n\nlistNotificationsController.validation = {\n schema: listNotificationsSchema,\n validating: [\"query\"],\n};\n`;\n\n/** `src/app/notifications/controllers/unread-notifications-count.controller.ts`. */\nexport const unreadNotificationsCountControllerStub = `import { inApp } from \"@warlock.js/notifications\";\nimport type { NotificationsRequestHandler } from \"../types/notifications-request.type\";\n\n/** GET /notifications/unread-count — drives the bell badge. */\nexport const unreadNotificationsCountController: NotificationsRequestHandler = async ({\n request,\n response,\n}) => {\n const count = await inApp.countUnread(request.locals.user.id);\n\n return response.success({ count });\n};\n\nunreadNotificationsCountController.description = \"Unread notifications count\";\n`;\n\n/** `src/app/notifications/controllers/mark-notification-read.controller.ts`. */\nexport const markNotificationReadControllerStub = `import { markNotificationReadService } from \"../services/mark-notification-read.service\";\nimport type { NotificationsRequestHandler } from \"../types/notifications-request.type\";\n\n/** PATCH /notifications/:id/read — mark one read and return it. */\nexport const markNotificationReadController: NotificationsRequestHandler = async ({\n request,\n response,\n}) => {\n // Route params are strings. A numeric id is an integer id (the default\n // MongoDB stack); anything else, such as a UUID, stays a string.\n const rawId = request.string(\"id\");\n const id = /^\\\\d+$/.test(rawId) ? Number(rawId) : rawId;\n\n const notification = await markNotificationReadService(request.locals.user.id, id);\n\n return response.success({ notification });\n};\n\nmarkNotificationReadController.description = \"Mark notification read\";\n`;\n\n/** `src/app/notifications/controllers/mark-all-notifications-read.controller.ts`. */\nexport const markAllNotificationsReadControllerStub = `import { inApp } from \"@warlock.js/notifications\";\nimport type { NotificationsRequestHandler } from \"../types/notifications-request.type\";\n\n/** PATCH /notifications/read-all — mark every unread one read. */\nexport const markAllNotificationsReadController: NotificationsRequestHandler = async ({\n request,\n response,\n}) => {\n const count = await inApp.markAsRead(request.locals.user.id);\n\n return response.success({ count });\n};\n\nmarkAllNotificationsReadController.description = \"Mark all notifications read\";\n`;\n\n/** `src/app/notifications/routes.ts` — the four read endpoints behind `authMiddleware`. */\nexport const notificationRoutesStub = `import { authMiddleware } from \"@warlock.js/auth\";\nimport { router } from \"@warlock.js/core\";\nimport { listNotificationsController } from \"./controllers/list-notifications.controller\";\nimport { markAllNotificationsReadController } from \"./controllers/mark-all-notifications-read.controller\";\nimport { markNotificationReadController } from \"./controllers/mark-notification-read.controller\";\nimport { unreadNotificationsCountController } from \"./controllers/unread-notifications-count.controller\";\n\n/**\n * The signed-in user's own notifications.\n *\n * Notifications come from domain events, so there is no create. Dismissing is\n * left out on purpose; add it when the product needs it (inApp.dismiss).\n *\n * authMiddleware([]) admits any signed-in user. To limit who may read\n * notifications, add a permission gate to the group:\n *\n * import { gate } from \"@warlock.js/access\";\n *\n * router.group({ middleware: [authMiddleware([]), gate(\"notifications.read\")] }, ...);\n */\nrouter.group({ middleware: [authMiddleware([])] }, () => {\n const notifications = router.route(\"/notifications\");\n\n notifications.list(listNotificationsController);\n notifications.nest(\"/unread-count\").get(unreadNotificationsCountController);\n notifications.nest(\"/read-all\").patch(markAllNotificationsReadController);\n notifications.nest(\"/:id/read\").patch(markNotificationReadController);\n});\n`;\n\n/** `src/app/notifications/utils/locales.json` — the module's translations. */\nexport const notificationLocalesStub = `{\n \"notFound\": { \"en\": \"Notification not found\" }\n}\n`;\n\n/** Shared fixtures for the generated signed-in notification controller specs. */\nexport const notificationTestFixtureStub = `import type { Auth } from \"@warlock.js/auth\";\nimport type { ChildModel } from \"@warlock.js/cascade\";\nimport { config } from \"@warlock.js/core\";\nimport { actingAs, type AuthenticatedTestClient } from \"@warlock.js/core/tests\";\nimport { randomUUID } from \"node:crypto\";\nimport { Notification } from \"../models/notification/notification.model\";\n\n/** Isolated recipients and rows; adjust user fields if your auth model requires more. */\nexport async function createNotificationTestFixture() {\n const User = config.key<ChildModel<Auth>>(\"auth.userType.user\");\n if (!User) throw new Error(\"Notification specs need the configured auth.userType.user model.\");\n const users: Auth[] = [];\n const clients: AuthenticatedTestClient[] = [];\n const rows: Notification[] = [];\n\n async function cleanup() {\n const credentials = await Promise.allSettled(\n clients.splice(0).map((client) => client.dispose()),\n );\n const notifications = await Promise.allSettled(\n rows.splice(0).map((row) => row.destroy({ strategy: \"permanent\" })),\n );\n const recipients = await Promise.allSettled(\n users.splice(0).map((user) => user.destroy({ strategy: \"permanent\" })),\n );\n const errors = [...credentials, ...notifications, ...recipients]\n .filter((result): result is PromiseRejectedResult => result.status === \"rejected\")\n .map((result) => result.reason);\n if (errors.length) throw new AggregateError(errors, \"Notification fixture cleanup failed.\");\n }\n\n const createUser = async () => {\n const user = await User.create({\n name: \"Notification test user\",\n email: \"notifications-\" + randomUUID() + \"@example.test\",\n password: \"test-password\",\n });\n users.push(user);\n return user;\n };\n const signIn = async (user: Auth) => {\n const client = await actingAs(user);\n clients.push(client);\n return client;\n };\n const createNotification = async (recipientId: string | number, title: string, readAt?: Date) => {\n const row = await Notification.create({\n user_id: recipientId,\n type: \"test\",\n title,\n read_at: readAt,\n });\n rows.push(row);\n return row;\n };\n\n try {\n const user = await createUser();\n const otherUser = await createUser();\n const client = await signIn(user);\n const otherClient = await signIn(otherUser);\n const own = await createNotification(user.id, \"Own unread notification\");\n const alreadyRead = await createNotification(user.id, \"Own read notification\", new Date());\n const foreign = await createNotification(otherUser.id, \"Other user's notification\");\n await createNotification(otherUser.id, \"Other user's second notification\");\n return { user, otherUser, client, otherClient, own, alreadyRead, foreign, cleanup };\n } catch (error) {\n // Preserve the setup failure after attempting every owned resource's cleanup.\n await cleanup().catch(() => undefined);\n throw error;\n }\n}\n`;\n\n/** A spec for each generated controller, including authenticated recipient isolation. */\nexport function notificationControllerSpecStub(method: \"GET\" | \"PATCH\", path: string): string {\n const helper = method === \"GET\" ? \"testGet\" : \"testPatch\";\n let signedInCases: string;\n if (path === \"/notifications\") {\n signedInCases = ` it(\"lists only the signed-in recipient's rows, ignoring a forged recipient query\", async () => {\n const response = await fixture.client.get(\n \"/notifications?recipientId=\" + fixture.otherUser.id,\n );\n const body = await expectJson<{ notifications: { id: string | number }[] }>(response);\n expect(body.notifications.map((row) => row.id)).toEqual(\n expect.arrayContaining([fixture.own.id, fixture.alreadyRead.id]),\n );\n expect(body.notifications).toHaveLength(2);\n });\n\n it(\"applies unread and paging query filters\", async () => {\n const response = await fixture.client.get(\"/notifications?unread=true&limit=1\");\n const body = await expectJson<{ notifications: { id: string | number }[] }>(response);\n expect(body.notifications.map((row) => row.id)).toEqual([fixture.own.id]);\n });\n\n it(\"rejects a list limit above the schema's cap\", async () => {\n expect((await fixture.client.get(\"/notifications?limit=999\")).status).toBe(422);\n });`;\n } else if (path === \"/notifications/unread-count\") {\n signedInCases = ` it(\"counts only this recipient's unread notifications\", async () => {\n const own = await expectJson<{ count: number }>(\n await fixture.client.get(\"/notifications/unread-count\"),\n );\n const other = await expectJson<{ count: number }>(\n await fixture.otherClient.get(\"/notifications/unread-count\"),\n );\n expect(own.count).toBe(1);\n expect(other.count).toBe(2);\n });`;\n } else if (path === \"/notifications/read-all\") {\n signedInCases = ` it(\"marks only this recipient's unread rows and leaves another recipient unchanged\", async () => {\n const body = await expectJson<{ count: number }>(\n await fixture.client.patch(\"/notifications/read-all\"),\n );\n expect(body.count).toBe(1);\n expect((await Notification.find(fixture.own.id))?.isRead).toBe(true);\n expect((await Notification.find(fixture.foreign.id))?.isRead).toBe(false);\n const other = await expectJson<{ count: number }>(\n await fixture.otherClient.get(\"/notifications/unread-count\"),\n );\n expect(other.count).toBe(2);\n const again = await expectJson<{ count: number }>(\n await fixture.client.patch(\"/notifications/read-all\"),\n );\n expect(again.count).toBe(0);\n });`;\n } else {\n signedInCases = ` it(\"marks its own notification read and returns it\", async () => {\n const response = await fixture.client.patch(\"/notifications/\" + fixture.own.id + \"/read\");\n const body = await expectJson<{\n notification: { id: string | number; readAt?: string | null };\n }>(response);\n expect(body.notification.id).toBe(fixture.own.id);\n expect(body.notification.readAt).toBeTruthy();\n expect((await Notification.find(fixture.own.id))?.isRead).toBe(true);\n });\n\n it(\"answers 404 for another recipient's notification without changing it\", async () => {\n const response = await fixture.client.patch(\"/notifications/\" + fixture.foreign.id + \"/read\");\n expect(response.status).toBe(404);\n expect((await Notification.find(fixture.foreign.id))?.isRead).toBe(false);\n });`;\n }\n const modelImport =\n method === \"PATCH\"\n ? 'import { Notification } from \"../models/notification/notification.model\";\\n'\n : \"\";\n return `import { expectJson, ${helper} } from \"@warlock.js/core/tests\";\nimport { afterEach, beforeEach, describe, expect, it } from \"vitest\";\n${modelImport}import { createNotificationTestFixture } from \"../tests/notifications.fixture\";\n\ndescribe(\"${method} ${path}\", () => {\n it(\"answers 401 without a signed-in user\", async () => {\n const response = await ${helper}(\"${path}\");\n expect(response.status).toBe(401);\n });\n\n describe(\"signed in\", () => {\n let fixture: Awaited<ReturnType<typeof createNotificationTestFixture>> | undefined;\n beforeEach(async () => {\n fixture = await createNotificationTestFixture();\n });\n afterEach(async () => {\n const current = fixture;\n fixture = undefined;\n await current?.cleanup();\n });\n\n${signedInCases.replaceAll(\"fixture.\", \"fixture!.\")}\n });\n});\n`;\n}\n\n/**\n * `src/web/root.tsx` — the application root for the SSR page layer.\n *\n * Deliberately minimal. The framework ships a default root, so this exists to\n * give you a place to start rather than because anything requires it. The\n * reference app (`v5/app/src/web/root.tsx`) is where to look for the fuller\n * shape: middleware, an app-level loader, locales, an ErrorBoundary.\n */\nexport const webRootStub = `import type { AppProps } from \"@warlock.js/web\";\nimport { Head, Scripts } from \"@warlock.js/web\";\n\n/**\n * The application root.\n *\n * NOT async, and it receives no request/response: it renders on the server and\n * again in the browser during hydration, where neither exists.\n */\nexport default function App({ children }: AppProps) {\n return (\n <html lang=\"en\">\n <head>\n {/*\n <Head /> also renders the viewport tag (width=device-width,\n initial-scale=1). Change it with \\`metadata.viewport\\`,\n or set it to false to leave it out; do not add a second one here.\n */}\n {/*\n Placement only. The framework injects the page's \\`metadata\\`, the\n stylesheet and preload tags for this route, and the canonical links\n into <head> by default — <Head /> just says WHERE they land.\n\n Do not add a <title> here: the page's \\`metadata\\` owns it, and a root\n that emits one too produces two.\n */}\n <Head />\n <link rel=\"icon\" href=\"data:,\" />\n </head>\n <body>\n {/*\n REQUIRED — this is the hydration mount point, not a styling wrapper.\n\n The browser runtime looks up \\`#vessel\\` and hydrates that element only.\n Remove this div, or rename the id, and the page still renders from the\n server but never becomes interactive: the runtime throws in the console\n and nothing on screen changes.\n\n Wrap it in your own markup freely, and put anything that must live\n outside the hydrated tree (a static footer, a portal target) outside\n it — just keep an element with \\`id=\"vessel\"\\` around {children}.\n */}\n <div id=\"vessel\">{children}</div>\n {/*\n The hydration payload and module tags. Written explicitly because\n placement occasionally matters — a CSP nonce, or ordering against\n your own scripts.\n */}\n <Scripts />\n </body>\n </html>\n );\n}\n`;\n\n/**\n * `src/app/contact/controllers/contact.controller.ts` — a real API endpoint\n * for the Web starter's contact form. It intentionally has no persistence\n * dependency: replace the acknowledgement with a mail/job/database action.\n */\nexport const webContactControllerStub = `import { type Request, type RequestHandler } from \"@warlock.js/core\";\nimport { type Infer, v } from \"@warlock.js/seal\";\n\nexport const contactSchema = v.object({\n name: v.string().min(2),\n email: v.email(),\n message: v.string().min(10),\n});\n\nexport type ContactSchema = Infer.Output<typeof contactSchema>;\n\n/** POST /api/contact — validates the starter contact form. */\nexport const contactController: RequestHandler<Request<ContactSchema>> = async ({\n request,\n response,\n}) => {\n const contact = request.validated();\n\n // Replace this with delivery/persistence for your app. Keeping the accepted\n // payload visible makes the endpoint useful while remaining side-effect free.\n return response.success({\n message: \"Thanks, \" + contact.name + \". Your message has been received.\",\n });\n};\n\ncontactController.validation = { schema: contactSchema };\n`;\n\n/** `src/app/contact/routes.ts` — discovered by the standard app route loader. */\nexport const webContactRoutesStub = `import { router } from \"@warlock.js/core\";\nimport { contactController } from \"./controllers/contact.controller\";\n\nrouter.post(\"/api/contact\", contactController, { public: true });\n`;\n\n/**\n * `src/web/index.register.ts` — universal static setup for the starter page.\n *\n * The page re-exports this stable binding so Warlock's `register()` lifecycle\n * still sees it in both realms without making React Fast Refresh treat every\n * JSX edit as an incompatible function-export replacement.\n */\nexport const webHomeRegisterStub = `import { extend } from \"@mongez/localization\";\n\nexport function register() {\n extend(\"en\", {\n starter: {\n title: \"Your Warlock app is running.\",\n introduction: \"This page is rendered on the server and hydrated in the browser.\",\n language: \"العربية\",\n contact: \"Send a message\",\n name: \"Name\",\n email: \"Email\",\n message: \"Message\",\n submit: \"Send message\",\n sent: \"Thanks — your message has been received.\",\n },\n });\n extend(\"ar\", {\n starter: {\n title: \"تطبيق Warlock يعمل الآن.\",\n introduction: \"تُعرض هذه الصفحة على الخادم ثم تُفعَّل في المتصفح.\",\n language: \"English\",\n contact: \"أرسل رسالة\",\n name: \"الاسم\",\n email: \"البريد الإلكتروني\",\n message: \"الرسالة\",\n submit: \"إرسال الرسالة\",\n sent: \"شكرًا — تم استلام رسالتك.\",\n },\n });\n}\n`;\n\n/**\n * `src/web/index.page.tsx` — one page, so \\`warlock dev\\` has something to serve\n * the moment this finishes.\n */\nexport const webHomePageStub = `import { http } from \"@mongez/http\";\nimport { setCurrentLocaleCode } from \"@mongez/localization\";\nimport { Form, useFormControl, type FormControlProps } from \"@mongez/react-form\";\nimport { transX } from \"@mongez/react-localization\";\nimport { v } from \"@warlock.js/seal\";\nimport { Link, type PageConfig, type PageProps } from \"@warlock.js/web\";\nimport { useState } from \"react\";\n\nexport { register } from \"./index.register\";\n\n/**\n * A page route is an ordinary Warlock route whose handler renders React\n * instead of returning JSON.\n *\n * The URL and stable hydration name are the ones this file DECLARES below.\n * This page answers \\`GET \"/\"\\` because \\`config.route.path = \"/\"\\`, not because of\n * where the file lives. A page file with\n * no \\`config.route\\` declaration derives its URL from the filesystem.\n */\nexport const config: PageConfig = {\n route: { path: \"/\", name: \"index\" },\n metadata: { title: \"Home\" },\n};\n\nconst contactSchema = v.object({\n name: v.string().min(2),\n email: v.email(),\n message: v.string().min(10),\n});\n\nfunction TextInput({ label, ...controlProps }: FormControlProps & { label: string }) {\n const { error, getErrorProps, getInputProps } = useFormControl(controlProps);\n\n return (\n <div className=\"wk-field\">\n <label htmlFor={controlProps.name}>{label}</label>\n <input {...getInputProps()} />\n {error && <p {...getErrorProps()}>{error}</p>}\n </div>\n );\n}\n\n/**\n * Add a \\`loader\\` export to fetch data on the server, and it arrives here as\n * \\`data\\`, typed:\n *\n * export const loader = (async () => ({ items: await itemsRepository.all() }));\n * export default function HomePage({ data }: PageProps<typeof loader>) { ... }\n */\nexport default function HomePage(_props: PageProps) {\n // Live state. If the button below does nothing, the page rendered on the\n // server but never hydrated — the runtime never mounted at \\`#vessel\\`. This is\n // deliberately here so that failure is impossible to miss.\n const [count, setCount] = useState(0);\n const [locale, setLocale] = useState<\"en\" | \"ar\">(\"en\");\n const [submitted, setSubmitted] = useState(false);\n const [submitError, setSubmitError] = useState<string | null>(null);\n\n const toggleLocale = () => {\n const nextLocale = locale === \"en\" ? \"ar\" : \"en\";\n setCurrentLocaleCode(nextLocale);\n setLocale(nextLocale);\n };\n\n return (\n <>\n {/*\n Self-contained, dependency-free styling: plain CSS, system fonts, and\n CSS custom properties, scoped to this page. No CSS framework, no utility\n classes, no external stylesheet — this page looks the same whether or\n not \\`warlock add tailwind\\` has ever been run.\n */}\n <style>{\\`\n .wk-home {\n --wk-fg: #0f172a;\n --wk-muted: #64748b;\n --wk-accent: #4f46e5;\n --wk-border: #e2e8f0;\n font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n color: var(--wk-fg);\n max-width: 42rem;\n margin: 4rem auto;\n padding: 0 1.5rem;\n line-height: 1.6;\n }\n .wk-home h1 { font-size: 2.25rem; margin: 0 0 0.5rem; }\n .wk-home p { color: var(--wk-muted); margin: 0 0 1.5rem; }\n .wk-home code {\n font-family: ui-monospace, \"SFMono-Regular\", Menlo, monospace;\n background: #f1f5f9;\n padding: 0.1rem 0.35rem;\n border-radius: 0.25rem;\n }\n .wk-check {\n border: 1px solid var(--wk-border);\n border-radius: 0.75rem;\n padding: 1.25rem 1.5rem;\n margin: 2rem 0;\n }\n .wk-check strong { display: block; font-size: 1.5rem; }\n .wk-check button {\n font: inherit;\n cursor: pointer;\n background: var(--wk-accent);\n color: #fff;\n border: 0;\n border-radius: 0.5rem;\n padding: 0.5rem 1rem;\n margin-top: 0.75rem;\n }\n .wk-links { display: flex; gap: 1.25rem; font-size: 0.95rem; }\n .wk-links a { color: var(--wk-accent); text-decoration: none; }\n .wk-links a:hover { text-decoration: underline; }\n .wk-language { margin-left: auto; }\n .wk-contact { margin-top: 2rem; }\n .wk-field { display: grid; gap: 0.35rem; margin: 0.8rem 0; }\n .wk-field input, .wk-field textarea { font: inherit; padding: 0.55rem; }\n .wk-field p, .wk-submit-error { color: #b91c1c; margin: 0; }\n .wk-success { color: #047857; }\n \\`}</style>\n\n <main className=\"wk-home\" dir={locale === \"ar\" ? \"rtl\" : \"ltr\"}>\n <nav className=\"wk-links\" aria-label=\"Starter links\">\n <a href=\"https://warlock.js.org\" target=\"_blank\" rel=\"noreferrer\">\n Docs\n </a>\n <Link href=\"/\" aria-current=\"page\">\n Home\n </Link>\n <button\n className=\"wk-language\"\n type=\"button\"\n aria-pressed={locale === \"ar\"}\n onClick={toggleLocale}\n >\n {transX(\"starter.language\")}\n </button>\n </nav>\n\n <h1>{transX(\"starter.title\")}</h1>\n <p>{transX(\"starter.introduction\")}</p>\n\n <section className=\"wk-check\">\n <label>If this number goes up when you click, React is hydrated:</label>\n <strong>{count}</strong>\n <button type=\"button\" onClick={() => setCount((c) => c + 1)}>\n Count up\n </button>\n </section>\n\n <section className=\"wk-contact\" aria-labelledby=\"contact-heading\">\n <h2 id=\"contact-heading\">{transX(\"starter.contact\")}</h2>\n <Form<typeof contactSchema>\n id=\"contact-form\"\n schema={contactSchema}\n onSubmit={async ({ form, values }) => {\n setSubmitted(false);\n setSubmitError(null);\n const result = await http.post<{ message: string }>(\"/api/contact\", values);\n\n if (result.error) {\n if (result.error.isValidationError) {\n const body = result.error.body as {\n errors?: Array<{ input: string; error: string }>;\n message?: string;\n };\n form.setErrors(\n Object.fromEntries(\n (body.errors ?? []).map(({ input, error }) => [input, error]),\n ),\n );\n setSubmitError(body.message ?? \"Please correct the highlighted fields.\");\n } else {\n setSubmitError(\"Your message could not be sent. Please try again.\");\n }\n return;\n }\n\n setSubmitted(true);\n form.reset();\n }}\n >\n <TextInput name=\"name\" label={transX(\"starter.name\")} autoComplete=\"name\" />\n <TextInput\n name=\"email\"\n label={transX(\"starter.email\")}\n type=\"email\"\n autoComplete=\"email\"\n />\n <ContactMessage />\n <button type=\"submit\">{transX(\"starter.submit\")}</button>\n {submitError && (\n <p className=\"wk-submit-error\" role=\"alert\">\n {submitError}\n </p>\n )}\n {submitted && (\n <p className=\"wk-success\" role=\"status\">\n {transX(\"starter.sent\")}\n </p>\n )}\n </Form>\n </section>\n </main>\n </>\n );\n}\n\nfunction ContactMessage() {\n const { error, getErrorProps, getInputProps } = useFormControl({ name: \"message\" });\n\n return (\n <div className=\"wk-field\">\n <label htmlFor=\"message\">{transX(\"starter.message\")}</label>\n <textarea {...getInputProps()} rows={5} />\n {error && <p {...getErrorProps()}>{error}</p>}\n </div>\n );\n}\n`;\n"],"mappings":";AAAA,MAAa,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BhC,MAAa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+B5B,MAAa,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCnC,MAAa,2BAA2B;;AAGxC,MAAa,0BAA0B;;;;;;;;;;;;AAavC,MAAa,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FvC,MAAa,+BAA+B;;AAG5C,MAAa,8BAA8B;;;;;;;;;;;;;;;;;;;;;AAsB3C,MAAa,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6ClC,MAAa,mBAAmB;;;;;;;;;;;;;;;;;AAkBhC,MAAa,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFvC,MAAa,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCvC,MAAa,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDrC,MAAa,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;AAwBzC,MAAa,2BAA2B;;;;;;;;;;;;;;;;;;;;;AAsBxC,MAAa,8BAA8B;;;;;;;;;;;;;;;;;;AAmB3C,MAAa,+BAA+B;;;;;;;;;;;;;;;;;AAkB5C,MAAa,kCAAkC;;;;;;;;;;;;;;;;;;;;AAqB/C,MAAa,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;AAyB/C,MAAa,yCAAyC;;;;;;;;;;;;;;;;AAiBtD,MAAa,qCAAqC;;;;;;;;;;;;;;;;;;;;;AAsBlD,MAAa,yCAAyC;;;;;;;;;;;;;;;;AAiBtD,MAAa,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BtC,MAAa,0BAA0B;;;;;AAMvC,MAAa,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2E3C,SAAgB,+BAA+B,QAAyB,MAAsB;CAC5F,MAAM,SAAS,WAAW,QAAQ,YAAY;CAC9C,IAAI;CACJ,IAAI,SAAS,kBACX,gBAAgB;;;;;;;;;;;;;;;;;;;;MAoBX,IAAI,SAAS,+BAClB,gBAAgB;;;;;;;;;;MAUX,IAAI,SAAS,2BAClB,gBAAgB;;;;;;;;;;;;;;;;MAiBhB,gBAAgB;;;;;;;;;;;;;;;CAoBlB,OAAO,wBAAwB,OAAO;;EAHpC,WAAW,UACP,kFACA,GAGM;;YAEF,OAAO,GAAG,KAAK;;6BAEE,OAAO,IAAI,KAAK;;;;;;;;;;;;;;;EAe3C,cAAc,WAAW,YAAY,WAAW,EAAE;;;;AAIpD;;;;;;;;;AAUA,MAAa,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4D3B,MAAa,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BxC,MAAa,uBAAuB;;;;;;;;;;;;AAapC,MAAa,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCnC,MAAa,kBAAkB"}
1
+ {"version":3,"file":"stubs.mjs","names":[],"sources":["../../../../../../../../packages/core/src/generations/stubs.ts"],"sourcesContent":["export const accessConfigStub = `import { type AccessConfigurations } from \"@warlock.js/access\";\nimport { DatabaseAccessResolver } from \"app/access/services/access-resolver\";\n\n/**\n * Authorization configuration — read by @warlock.js/access on boot.\n *\n * The resolver is the one required piece: it tells the engine how to read a\n * user's roles + permissions. The ejected DatabaseAccessResolver reads roles\n * from the user_roles table and maps them through the roles catalog table (so\n * roles + their permissions are managed at runtime, in the DB).\n *\n * For a fixed, code-defined catalog with no tables, swap in DefaultAccessResolver:\n * import { DefaultAccessResolver } from \"@warlock.js/access\";\n * resolver: new DefaultAccessResolver({ admin: [\"*\"], editor: [\"orders.*\"] }),\n *\n * Multi-tenant? Add a \\`resolveTenant()\\` to the resolver to read the active\n * tenant from the request; checks then scope to it automatically.\n */\nconst access: AccessConfigurations = {\n resolver: new DatabaseAccessResolver(),\n\n // Cache resolved permission sets (default \"10m\").\n // cache: { ttl: \"10m\" },\n};\n\nexport default access;\n`;\n\nexport const aiConfigStub = `import type { AIConfig } from \"@warlock.js/ai\";\n\n// >>> warlock:ai-packages (auto-managed) >>>\n// Satellite packages augment the \"ai\" object on import — e.g. ai.workspace,\n// ai.tools / ai.mcp, and panoptic's ai.config({ panoptic }) wiring. The command\n// \"warlock add ai-workspace | ai-tools | ai-panoptic\" adds the matching\n// side-effect import below; keep them so the augmentation + runtime registration\n// load before the ai connector applies this config.\n// <<< warlock:ai-packages <<<\n\n/**\n * AI configuration — applied on boot by the ai connector, which calls\n * ai.config(...) with the object below. Cross-cutting defaults live here\n * (shared cache / snapshot stores, observability); per-call options always win.\n *\n * Wire a default model from a provider you installed, e.g.:\n * import { OpenAISDK } from \"@warlock.js/ai-openai\";\n * const openai = OpenAISDK({ apiKey: env(\"OPENAI_API_KEY\") });\n * // then pass openai.model({ name: \"gpt-4o-mini\" }) into your agents.\n */\nconst ai: Partial<AIConfig> = {\n // Default cache driver for cache-backed AI features (semantic cache, rag / memory vector stores).\n // defaultStore: cache.driver(\"redis\", { client }),\n\n // Observability — requires \"warlock add ai-panoptic\". Exporters + the local dashboard.\n // panoptic: { exporters: [], dashboard: false, observeAll: false },\n};\n\nexport default ai;\n`;\n\nexport const accessRoleModelStub = `import { Model, RegisterModel } from \"@warlock.js/cascade\";\nimport { type Infer, v } from \"@warlock.js/seal\";\n\n/**\n * Validation schema for the roles catalog — mirrors the migration columns\n * (snake_case). Each row is a role name plus the permission strings it grants;\n * wildcards work (\"orders.*\", \"*\"). The DatabaseAccessResolver maps a user's\n * assigned role names through this table to their effective permissions.\n */\nexport const roleSchema = v.object({\n name: v.string(),\n permissions: v.array(v.string()).default([]),\n});\n\nexport type RoleSchema = Infer<typeof roleSchema>;\n\n/**\n * The roles catalog — role name → the permissions it grants. Managed at runtime\n * (admins add roles + edit their permissions), unlike a fixed code map. Read by\n * DatabaseAccessResolver.resolvePermissions to expand a user's roles to permissions.\n */\n@RegisterModel()\nexport class Role extends Model<RoleSchema> {\n public static table = \"roles\";\n\n public static schema = roleSchema;\n\n /** The permission strings this role grants. */\n public get permissions(): string[] {\n return this.get<string[]>(\"permissions\", []);\n }\n}\n`;\n\nexport const accessRoleModelIndexStub = `export * from \"./role.model\";\n`;\n\nexport const accessRoleMigrationStub = `import { arrayText, Migration, text } from \"@warlock.js/cascade\";\nimport { Role } from \"../role.model\";\n\n/**\n * Roles catalog table. \\`name\\` is unique (one row per role); \\`permissions\\` is a\n * text array of the permission strings the role grants.\n */\nexport default Migration.create(Role, {\n name: text().notNullable().unique(),\n permissions: arrayText().nullable(),\n});\n`;\n\nexport const accessUserRoleModelStub = `import { access } from \"@warlock.js/access\";\nimport type { Auth } from \"@warlock.js/auth\";\nimport { Model, RegisterModel } from \"@warlock.js/cascade\";\nimport { type Infer, v } from \"@warlock.js/seal\";\n\n/**\n * Validation schema for a role assignment — mirrors the migration columns\n * (snake_case). \\`tenant\\` is nullable: a null tenant is a GLOBAL assignment.\n */\nexport const userRoleSchema = v.object({\n user_id: v.string(),\n user_type: v.string(),\n role: v.string(),\n tenant: v.string().optional(),\n});\n\nexport type UserRoleSchema = Infer<typeof userRoleSchema>;\n\n/**\n * The role-assignment table — which roles a user holds, optionally per tenant.\n * Read by DatabaseAccessResolver.resolveRoles; mutated via the statics below.\n * \\`assign\\` / \\`revoke\\` flush the cached permission set automatically, so callers\n * never need to call \\`access.flush(user, tenant)\\` themselves.\n */\n@RegisterModel()\nexport class UserRole extends Model<UserRoleSchema> {\n public static table = \"user_roles\";\n\n public static schema = userRoleSchema;\n\n /**\n * Role names assigned to the user in the given tenant.\n *\n * An unresolved tenant (\\`undefined\\`) scopes to GLOBAL roles only — the rows\n * stored with no tenant (\\`null\\`) — never the union across every tenant. The\n * union would be a privilege-escalation: a user who is \\`owner\\` in one tenant\n * must not be treated as \\`owner\\` everywhere just because a check didn't carry\n * a tenant. This mirrors how \\`assign(user, role)\\` stores a global row.\n */\n public static async rolesFor(user: Auth, tenant?: string): Promise<string[]> {\n const rows = await this.query()\n .where({\n user_id: user.id,\n user_type: user.userType,\n tenant: tenant ?? null,\n })\n .get();\n\n // De-dupe so a duplicate row (a concurrent assign that slipped past the\n // existence check) can't distort the resolved set.\n return [...new Set(rows.map((row) => row.get(\"role\") as string))];\n }\n\n /**\n * Assign a role to the user. No-op if the assignment already exists.\n * Flushes the user's cached permission set automatically.\n */\n public static async assign(user: Auth, role: string, tenant?: string): Promise<void> {\n const existing = await this.first({\n user_id: user.id,\n user_type: user.userType,\n role,\n tenant: tenant ?? null,\n });\n\n if (existing) return;\n\n await this.create({\n user_id: user.id,\n user_type: user.userType,\n role,\n tenant,\n });\n\n await access.flush(user, tenant);\n }\n\n /**\n * Remove a role assignment from the user.\n * Flushes the user's cached permission set automatically.\n */\n public static async revoke(user: Auth, role: string, tenant?: string): Promise<void> {\n await this.delete({\n user_id: user.id,\n user_type: user.userType,\n role,\n tenant: tenant ?? null,\n });\n\n await access.flush(user, tenant);\n }\n}\n`;\n\nexport const accessUserRoleModelIndexStub = `export * from \"./user-role.model\";\n`;\n\nexport const accessUserRoleMigrationStub = `import { Migration, text, uuid } from \"@warlock.js/cascade\";\nimport { UserRole } from \"../user-role.model\";\n\n/**\n * Role-assignment table. \\`user_id\\` is a UUID — override this migration if your\n * user ids are integers. The composite index powers the per-user (per-tenant)\n * lookup the resolver runs on every check.\n */\nexport default Migration.create(\n UserRole,\n {\n user_id: uuid().notNullable().index(),\n user_type: text().notNullable(),\n role: text().notNullable().index(),\n tenant: text().nullable().index(),\n },\n {\n index: [{ columns: [\"user_id\", \"user_type\", \"tenant\"] }],\n },\n);\n`;\n\nexport const accessResolverStub = `import type { AccessResolver } from \"@warlock.js/access\";\nimport type { Auth } from \"@warlock.js/auth\";\nimport { Role } from \"app/access/models/role\";\nimport { UserRole } from \"app/access/models/user-role\";\n\n/**\n * The app's access adapter — connects @warlock.js/access to the ejected role\n * tables. Roles come from the user_roles assignment table; permissions are\n * expanded by mapping those role names through the roles catalog table. Both\n * are managed at runtime (in the DB), so admins can add roles + edit their\n * permissions without a deploy.\n *\n * The engine owns the hard parts (wildcard matching, caching, fail-closed); this\n * resolver only fetches — keep it dumb, never cache inside it.\n */\nexport class DatabaseAccessResolver implements AccessResolver {\n /** The role names this user holds (powers \\`hasRole\\` / \\`hasAnyRole\\`). */\n public async resolveRoles(user: Auth, tenant?: string): Promise<string[]> {\n return UserRole.rolesFor(user, tenant);\n }\n\n /** The effective permission strings this user has (powers \\`can\\` / \\`authorize\\`). */\n public async resolvePermissions(user: Auth, tenant?: string): Promise<string[]> {\n const names = await this.resolveRoles(user, tenant);\n\n if (names.length === 0) return [];\n\n const roles = await Role.query().whereIn(\"name\", names).get();\n\n // Flatten + de-dupe so two roles granting the same permission yield one entry.\n return [...new Set(roles.flatMap((role) => role.permissions))];\n }\n\n /**\n * Optional. Resolve the ambient tenant when a check doesn't pass one\n * explicitly — derive it from the authenticated user (safer than reading\n * client request input, which a caller could spoof). Uncomment + adapt for a\n * multi-tenant app (single-tenant apps leave this off and return undefined).\n */\n // public resolveTenant(user: Auth): string | undefined {\n // return user.get(\"organization_id\");\n // }\n}\n`;\n\nexport const socketConfigStub = `import type { SocketOptions } from \"@warlock.js/core\";\n\n/**\n * Socket.IO configuration — read by the framework's socket connector\n * on boot. When the HTTP server is running the socket server attaches\n * to it; otherwise it listens on its own configured port.\n *\n * Remove this file to disable the socket server entirely.\n */\nexport default {\n options: {\n cors: {\n origin: \"*\",\n },\n },\n} as SocketOptions;\n`;\n\nexport const communicatorsConfigStub = `import { env } from \"@warlock.js/core\";\nimport type { BrokerConfigurations, RabbitMQClientOptions } from \"@warlock.js/herald\";\n\nconst heraldConfigurations: BrokerConfigurations<RabbitMQClientOptions> = {\n driver: \"rabbitmq\",\n name: \"default\",\n isDefault: true,\n\n // ============================================================================\n // Connection Settings\n // ============================================================================\n\n host: env(\"RABBITMQ_HOST\", \"localhost\"),\n port: env(\"RABBITMQ_PORT\", 5672),\n username: env(\"RABBITMQ_USERNAME\", \"guest\"),\n password: env(\"RABBITMQ_PASSWORD\", \"guest\"),\n vhost: env(\"RABBITMQ_VHOST\", \"/\"),\n\n // Or use connection URI (takes precedence over host/port)\n // uri: env(\"RABBITMQ_URL\"),\n\n // ============================================================================\n // Connection Options\n // ============================================================================\n\n /** Heartbeat interval in seconds */\n heartbeat: 60,\n\n /** Connection timeout in milliseconds */\n connectionTimeout: 10000,\n\n /** Enable automatic reconnection on disconnect */\n reconnect: true,\n\n /** Delay between reconnection attempts in milliseconds */\n reconnectDelay: 5_000,\n\n // ============================================================================\n // Consumer Options\n // ============================================================================\n\n /** Default prefetch count (number of unacknowledged messages per consumer) */\n prefetch: 10,\n\n // ============================================================================\n // Client Options (Native amqplib options)\n // ============================================================================\n // These options are passed directly to amqplib.connect()\n // for low-level configuration like frame size, TLS, socket options, etc.\n // ============================================================================\n clientOptions: {\n // Frame max size in bytes (0 = no limit)\n // frameMax: 0,\n\n // Channel max (0 = unlimited)\n // channelMax: 0,\n\n // Socket options\n socket: {\n // Enable TCP keep-alive\n keepAlive: true,\n\n // Disable Nagle's algorithm for lower latency\n noDelay: true,\n\n // Socket timeout (in addition to heartbeat)\n // timeout: 30000,\n },\n\n // TLS/SSL options (uncomment for secure connections)\n // socket: {\n // ca: fs.readFileSync('/path/to/ca.pem'),\n // cert: fs.readFileSync('/path/to/cert.pem'),\n // key: fs.readFileSync('/path/to/key.pem'),\n // rejectUnauthorized: true,\n // },\n },\n};\n\nexport default heraldConfigurations;\n`;\n\nexport const notificationsConfigStub = `import { type NotificationConfig, inApp, mailChannel } from \"@warlock.js/notifications\";\nimport { Notification } from \"app/notifications/models/notification/notification.model\";\n\n/**\n * Notifications configuration. Auto-loaded from src/config on boot — the\n * framework's notifications connector reads this default export and hands it to\n * setNotificationConfig, so this file stays declarative (no side-effect call).\n *\n * Each channel is payload-typed, so notify.mail(...) / notify.database(...)\n * and defineNotification are type-checked against the registry.\n *\n * Channels enabled here:\n * - mail wraps @warlock.js/core sendMail; route is notifiable.email.\n * The \"from\" address defaults to config/mail.ts; override per\n * channel with mailChannel({ from: \"no-reply@yourapp.com\" }).\n * - database in-app store backed by the Notification model. The \"inApp\"\n * facade exposes the recipient-scoped read API: listUnread,\n * countUnread, markAsRead, dismiss, ...\n *\n * Async delivery (.queue()) is OPTIONAL: run \"npx warlock add herald\",\n * import { heraldQueue } from \"@warlock.js/notifications\", and uncomment the\n * queue line below.\n */\nconst config: NotificationConfig = {\n channels: {\n mail: mailChannel(),\n database: inApp.configure({ model: Notification }),\n },\n\n // Async queue — requires @warlock.js/herald (npx warlock add herald):\n // queue: heraldQueue(),\n};\n\nexport default config;\n`;\n\n/** `src/app/notifications/models/notification/notification.model.ts`. */\nexport const notificationModelStub = `import { RegisterModel } from \"@warlock.js/cascade\";\nimport { DatabaseNotification, type NotificationColumnMap } from \"@warlock.js/notifications\";\nimport { v } from \"@warlock.js/seal\";\nimport { NotificationResource } from \"../../resources/notification.resource\";\n\n/**\n * Validation schema for the notifications table — mirrors the migration\n * columns (snake_case). Cascade validates + casts every write against it:\n * nullable columns use .nullish() (may be absent or null), and payload is\n * free-form JSON. Keep this in sync with the migration + columnMap when you\n * add or rename columns.\n *\n * user_id accepts a string or an integer so it matches whichever id type your\n * users use (and the idType you pass to notificationColumns in the migration).\n * Narrow it to that one type.\n */\nconst notificationSchema = v.object({\n user_id: v.union([v.string(), v.int()]),\n type: v.string(),\n title: v.string(),\n body: v.string().nullish(),\n payload: v.record(v.any()).nullish(),\n read_at: v.date().nullish(),\n idempotency_key: v.string().nullish(),\n});\n\n/**\n * In-app notification model.\n *\n * Extends the package's DatabaseNotification base, which provides the stable\n * accessors (recipientId, tenantId, isRead, readAt, markRead) — all derived\n * from the columnMap below. The read/write API lives on the inApp facade\n * (configured in config/notifications.ts); you rarely touch this class directly.\n */\n@RegisterModel()\nexport class Notification extends DatabaseNotification {\n public static table = \"notifications\";\n public static schema = notificationSchema;\n\n /** Every response that returns a notification is shaped by this resource. */\n public static resource = NotificationResource;\n\n /**\n * Maps the in-app store's roles to your columns. This default is\n * single-tenant + read_at-only. Add tenant: \"organization_id\" for\n * multi-tenant; use isRead: \"is_read\" (instead of, or alongside, readAt) to\n * track a boolean read flag. The migration, the accessors and the resource\n * all follow this map.\n */\n public static columnMap: NotificationColumnMap = { readAt: \"read_at\" };\n}\n`;\n\n/** The notifications migration, under `models/notification/migrations/`. */\nexport const notificationMigrationStub = `import { Migration } from \"@warlock.js/cascade\";\nimport { notificationColumns } from \"@warlock.js/notifications\";\nimport { Notification } from \"../notification.model\";\n\n/**\n * Notifications table.\n *\n * Columns come from notificationColumns(Notification) — the recipient / tenant\n * / read-state names follow the model's columnMap; type / title / body /\n * payload / idempotency_key are fixed. The recipient column is a UUID unless\n * you pass { idType: \"integer\" } (or \"bigint\" / \"string\") to match your users.\n * Spread it to add your own columns (and mirror them in the model schema):\n *\n * import { uuid } from \"@warlock.js/cascade\";\n *\n * export default Migration.create(Notification, {\n * ...notificationColumns(Notification, { idType: \"integer\" }),\n * // category_id: uuid().index().nullable(),\n * });\n */\nexport default Migration.create(Notification, notificationColumns(Notification));\n`;\n\n/** `src/app/notifications/resources/notification.resource.ts` — the output shape. */\nexport const notificationResourceStub = `import { defineResource } from \"@warlock.js/core\";\n\n/**\n * What every notification endpoint returns, whatever columns the model holds.\n * readAt reads the default read_at column; change it if you change the model's\n * columnMap.\n */\nexport const NotificationResource = defineResource({\n schema: {\n // Passed through as stored: a UUID string or an integer, per the migration.\n id: (id: string | number) => id,\n type: \"string\",\n title: \"string\",\n body: \"string?\",\n payload: \"object?\",\n readAt: [\"read_at\", \"date?\"],\n createdAt: \"date?\",\n },\n});\n`;\n\n/** `src/app/notifications/schema/list-notifications.schema.ts` — the validated list query. */\nexport const listNotificationsSchemaStub = `import { type Infer, v } from \"@warlock.js/seal\";\n\n/**\n * Query for GET /notifications. Only these keys reach the store (others, such\n * as a cache-busting \\`_\\`, are dropped rather than rejected), and limit is\n * capped so one request cannot read every row. Query values arrive as strings,\n * so the numbers and the flag are coerced.\n */\nexport const listNotificationsSchema = v.object({\n page: v.int().coerce().min(1).optional(),\n limit: v.int().coerce().min(1).max(50).optional(),\n type: v.string().optional(),\n unread: v.boolean().coerce().optional(),\n}).stripUnknown();\n\nexport type ListNotificationsSchema = Infer<typeof listNotificationsSchema>;\n`;\n\n/** `src/app/notifications/types/notifications-request.type.ts` — the guarded request. */\nexport const notificationsRequestTypeStub = `import type { Request, RequestHandler, RequestLocals } from \"@warlock.js/core\";\nimport type { Id } from \"@warlock.js/notifications\";\n\n/**\n * A request that passed authMiddleware, so locals.user is always set. Only the\n * user's id is declared because that is all the inApp store needs. If your\n * app has its own guarded request type, use it instead.\n */\nexport type NotificationsRequest<Payload = unknown> = Request<Payload> & {\n locals: RequestLocals & { user: { id: Id } };\n};\n\nexport type NotificationsRequestHandler<Payload = unknown> = RequestHandler<\n NotificationsRequest<Payload>\n>;\n`;\n\n/** `src/app/notifications/services/mark-notification-read.service.ts`. */\nexport const markNotificationReadServiceStub = `import { ResourceNotFoundError, t } from \"@warlock.js/core\";\nimport { type Id, inApp } from \"@warlock.js/notifications\";\n\n/**\n * Mark one of the user's notifications read and return it. inApp is scoped to\n * the recipient, so another user's id changes nothing and answers 404 here.\n */\nexport async function markNotificationReadService(userId: Id, notificationId: Id) {\n await inApp.markAsRead(userId, notificationId);\n\n const notification = await inApp.find(userId, notificationId);\n\n if (!notification) {\n throw new ResourceNotFoundError(t(\"notifications.notFound\"));\n }\n\n return notification;\n}\n`;\n\n/** `src/app/notifications/controllers/list-notifications.controller.ts`. */\nexport const listNotificationsControllerStub = `import { inApp } from \"@warlock.js/notifications\";\nimport {\n type ListNotificationsSchema,\n listNotificationsSchema,\n} from \"../schema/list-notifications.schema\";\nimport type { NotificationsRequestHandler } from \"../types/notifications-request.type\";\n\n/** GET /notifications — the user's notifications, most recent first. */\nexport const listNotificationsController: NotificationsRequestHandler<\n ListNotificationsSchema\n> = async ({ request, response }) => {\n const { data, pagination } = await inApp.list(request.locals.user.id, request.validated());\n\n return response.success({ notifications: data, pagination });\n};\n\nlistNotificationsController.description = \"List notifications\";\n\nlistNotificationsController.validation = {\n schema: listNotificationsSchema,\n validating: [\"query\"],\n};\n`;\n\n/** `src/app/notifications/controllers/unread-notifications-count.controller.ts`. */\nexport const unreadNotificationsCountControllerStub = `import { inApp } from \"@warlock.js/notifications\";\nimport type { NotificationsRequestHandler } from \"../types/notifications-request.type\";\n\n/** GET /notifications/unread-count — drives the bell badge. */\nexport const unreadNotificationsCountController: NotificationsRequestHandler = async ({\n request,\n response,\n}) => {\n const count = await inApp.countUnread(request.locals.user.id);\n\n return response.success({ count });\n};\n\nunreadNotificationsCountController.description = \"Unread notifications count\";\n`;\n\n/** `src/app/notifications/controllers/mark-notification-read.controller.ts`. */\nexport const markNotificationReadControllerStub = `import { markNotificationReadService } from \"../services/mark-notification-read.service\";\nimport type { NotificationsRequestHandler } from \"../types/notifications-request.type\";\n\n/** PATCH /notifications/:id/read — mark one read and return it. */\nexport const markNotificationReadController: NotificationsRequestHandler = async ({\n request,\n response,\n}) => {\n // Route params are strings. A numeric id is an integer id (the default\n // MongoDB stack); anything else, such as a UUID, stays a string.\n const rawId = request.string(\"id\");\n const id = /^\\\\d+$/.test(rawId) ? Number(rawId) : rawId;\n\n const notification = await markNotificationReadService(request.locals.user.id, id);\n\n return response.success({ notification });\n};\n\nmarkNotificationReadController.description = \"Mark notification read\";\n`;\n\n/** `src/app/notifications/controllers/mark-all-notifications-read.controller.ts`. */\nexport const markAllNotificationsReadControllerStub = `import { inApp } from \"@warlock.js/notifications\";\nimport type { NotificationsRequestHandler } from \"../types/notifications-request.type\";\n\n/** PATCH /notifications/read-all — mark every unread one read. */\nexport const markAllNotificationsReadController: NotificationsRequestHandler = async ({\n request,\n response,\n}) => {\n const count = await inApp.markAsRead(request.locals.user.id);\n\n return response.success({ count });\n};\n\nmarkAllNotificationsReadController.description = \"Mark all notifications read\";\n`;\n\n/** `src/app/notifications/routes.ts` — the four read endpoints behind `authMiddleware`. */\nexport const notificationRoutesStub = `import { authMiddleware } from \"@warlock.js/auth\";\nimport { router } from \"@warlock.js/core\";\nimport { listNotificationsController } from \"./controllers/list-notifications.controller\";\nimport { markAllNotificationsReadController } from \"./controllers/mark-all-notifications-read.controller\";\nimport { markNotificationReadController } from \"./controllers/mark-notification-read.controller\";\nimport { unreadNotificationsCountController } from \"./controllers/unread-notifications-count.controller\";\n\n/**\n * The signed-in user's own notifications.\n *\n * Notifications come from domain events, so there is no create. Dismissing is\n * left out on purpose; add it when the product needs it (inApp.dismiss).\n *\n * authMiddleware([]) admits any signed-in user. To limit who may read\n * notifications, add a permission gate to the group:\n *\n * import { gate } from \"@warlock.js/access\";\n *\n * router.group({ middleware: [authMiddleware([]), gate(\"notifications.read\")] }, ...);\n */\nrouter.group({ middleware: [authMiddleware([])] }, () => {\n const notifications = router.route(\"/notifications\");\n\n notifications.list(listNotificationsController);\n notifications.nest(\"/unread-count\").get(unreadNotificationsCountController);\n notifications.nest(\"/read-all\").patch(markAllNotificationsReadController);\n notifications.nest(\"/:id/read\").patch(markNotificationReadController);\n});\n`;\n\n/** `src/app/notifications/utils/locales.json` — the module's translations. */\nexport const notificationLocalesStub = `{\n \"notFound\": { \"en\": \"Notification not found\" }\n}\n`;\n\n/** Shared fixtures for the generated signed-in notification controller specs. */\nexport const notificationTestFixtureStub = `import type { Auth } from \"@warlock.js/auth\";\nimport type { ChildModel } from \"@warlock.js/cascade\";\nimport { config } from \"@warlock.js/core\";\nimport { actingAs, type AuthenticatedTestClient } from \"@warlock.js/core/tests\";\nimport { randomUUID } from \"node:crypto\";\nimport { Notification } from \"../models/notification/notification.model\";\n\n/** Isolated recipients and rows; adjust user fields if your auth model requires more. */\nexport async function createNotificationTestFixture() {\n const User = config.key<ChildModel<Auth>>(\"auth.userType.user\");\n if (!User) throw new Error(\"Notification specs need the configured auth.userType.user model.\");\n const users: Auth[] = [];\n const clients: AuthenticatedTestClient[] = [];\n const rows: Notification[] = [];\n\n async function cleanup() {\n const credentials = await Promise.allSettled(\n clients.splice(0).map((client) => client.dispose()),\n );\n const notifications = await Promise.allSettled(\n rows.splice(0).map((row) => row.destroy({ strategy: \"permanent\" })),\n );\n const recipients = await Promise.allSettled(\n users.splice(0).map((user) => user.destroy({ strategy: \"permanent\" })),\n );\n const errors = [...credentials, ...notifications, ...recipients]\n .filter((result): result is PromiseRejectedResult => result.status === \"rejected\")\n .map((result) => result.reason);\n if (errors.length) throw new AggregateError(errors, \"Notification fixture cleanup failed.\");\n }\n\n const createUser = async () => {\n const user = await User.create({\n name: \"Notification test user\",\n email: \"notifications-\" + randomUUID() + \"@example.test\",\n password: \"test-password\",\n });\n users.push(user);\n return user;\n };\n const signIn = async (user: Auth) => {\n const client = await actingAs(user);\n clients.push(client);\n return client;\n };\n const createNotification = async (recipientId: string | number, title: string, readAt?: Date) => {\n const row = await Notification.create({\n user_id: recipientId,\n type: \"test\",\n title,\n read_at: readAt,\n });\n rows.push(row);\n return row;\n };\n\n try {\n const user = await createUser();\n const otherUser = await createUser();\n const client = await signIn(user);\n const otherClient = await signIn(otherUser);\n const own = await createNotification(user.id, \"Own unread notification\");\n const alreadyRead = await createNotification(user.id, \"Own read notification\", new Date());\n const foreign = await createNotification(otherUser.id, \"Other user's notification\");\n await createNotification(otherUser.id, \"Other user's second notification\");\n return { user, otherUser, client, otherClient, own, alreadyRead, foreign, cleanup };\n } catch (error) {\n // Preserve the setup failure after attempting every owned resource's cleanup.\n await cleanup().catch(() => undefined);\n throw error;\n }\n}\n`;\n\n/** A spec for each generated controller, including authenticated recipient isolation. */\nexport function notificationControllerSpecStub(method: \"GET\" | \"PATCH\", path: string): string {\n const helper = method === \"GET\" ? \"testGet\" : \"testPatch\";\n let signedInCases: string;\n if (path === \"/notifications\") {\n signedInCases = ` it(\"lists only the signed-in recipient's rows, ignoring a forged recipient query\", async () => {\n const response = await fixture.client.get(\n \"/notifications?recipientId=\" + fixture.otherUser.id,\n );\n const body = await expectJson<{ notifications: { id: string | number }[] }>(response);\n expect(body.notifications.map((row) => row.id)).toEqual(\n expect.arrayContaining([fixture.own.id, fixture.alreadyRead.id]),\n );\n expect(body.notifications).toHaveLength(2);\n });\n\n it(\"applies unread and paging query filters\", async () => {\n const response = await fixture.client.get(\"/notifications?unread=true&limit=1\");\n const body = await expectJson<{ notifications: { id: string | number }[] }>(response);\n expect(body.notifications.map((row) => row.id)).toEqual([fixture.own.id]);\n });\n\n it(\"rejects a list limit above the schema's cap\", async () => {\n expect((await fixture.client.get(\"/notifications?limit=999\")).status).toBe(422);\n });`;\n } else if (path === \"/notifications/unread-count\") {\n signedInCases = ` it(\"counts only this recipient's unread notifications\", async () => {\n const own = await expectJson<{ count: number }>(\n await fixture.client.get(\"/notifications/unread-count\"),\n );\n const other = await expectJson<{ count: number }>(\n await fixture.otherClient.get(\"/notifications/unread-count\"),\n );\n expect(own.count).toBe(1);\n expect(other.count).toBe(2);\n });`;\n } else if (path === \"/notifications/read-all\") {\n signedInCases = ` it(\"marks only this recipient's unread rows and leaves another recipient unchanged\", async () => {\n const body = await expectJson<{ count: number }>(\n await fixture.client.patch(\"/notifications/read-all\"),\n );\n expect(body.count).toBe(1);\n expect((await Notification.find(fixture.own.id))?.isRead).toBe(true);\n expect((await Notification.find(fixture.foreign.id))?.isRead).toBe(false);\n const other = await expectJson<{ count: number }>(\n await fixture.otherClient.get(\"/notifications/unread-count\"),\n );\n expect(other.count).toBe(2);\n const again = await expectJson<{ count: number }>(\n await fixture.client.patch(\"/notifications/read-all\"),\n );\n expect(again.count).toBe(0);\n });`;\n } else {\n signedInCases = ` it(\"marks its own notification read and returns it\", async () => {\n const response = await fixture.client.patch(\"/notifications/\" + fixture.own.id + \"/read\");\n const body = await expectJson<{\n notification: { id: string | number; readAt?: string | null };\n }>(response);\n expect(body.notification.id).toBe(fixture.own.id);\n expect(body.notification.readAt).toBeTruthy();\n expect((await Notification.find(fixture.own.id))?.isRead).toBe(true);\n });\n\n it(\"answers 404 for another recipient's notification without changing it\", async () => {\n const response = await fixture.client.patch(\"/notifications/\" + fixture.foreign.id + \"/read\");\n expect(response.status).toBe(404);\n expect((await Notification.find(fixture.foreign.id))?.isRead).toBe(false);\n });`;\n }\n const modelImport =\n method === \"PATCH\"\n ? 'import { Notification } from \"../models/notification/notification.model\";\\n'\n : \"\";\n return `import { expectJson, ${helper} } from \"@warlock.js/core/tests\";\nimport { afterEach, beforeEach, describe, expect, it } from \"vitest\";\n${modelImport}import { createNotificationTestFixture } from \"../tests/notifications.fixture\";\n\ndescribe(\"${method} ${path}\", () => {\n it(\"answers 401 without a signed-in user\", async () => {\n const response = await ${helper}(\"${path}\");\n expect(response.status).toBe(401);\n });\n\n describe(\"signed in\", () => {\n let fixture: Awaited<ReturnType<typeof createNotificationTestFixture>> | undefined;\n beforeEach(async () => {\n fixture = await createNotificationTestFixture();\n });\n afterEach(async () => {\n const current = fixture;\n fixture = undefined;\n await current?.cleanup();\n });\n\n${signedInCases.replaceAll(\"fixture.\", \"fixture!.\")}\n });\n});\n`;\n}\n\n/**\n * `src/web/root.tsx` — the application root for the SSR page layer.\n *\n * Deliberately minimal. The framework ships a default root, so this exists to\n * give you a place to start rather than because anything requires it. The\n * reference app (`v5/app/src/web/root.tsx`) is where to look for the fuller\n * shape: middleware, an app-level loader, locales, an ErrorBoundary.\n */\nexport const webRootStub = `import type { AppProps } from \"@warlock.js/web\";\nimport { Head, Scripts } from \"@warlock.js/web\";\n\n/**\n * The application root.\n *\n * NOT async, and it receives no request/response: it renders on the server and\n * again in the browser during hydration, where neither exists.\n */\nexport default function App({ children }: AppProps) {\n return (\n <html lang=\"en\">\n <head>\n {/*\n <Head /> also renders the viewport tag (width=device-width,\n initial-scale=1). Change it with \\`metadata.viewport\\`,\n or set it to false to leave it out; do not add a second one here.\n */}\n {/*\n Placement only. The framework injects the page's \\`metadata\\`, the\n stylesheet and preload tags for this route, and the canonical links\n into <head> by default — <Head /> just says WHERE they land.\n\n Do not add a <title> here: the page's \\`metadata\\` owns it, and a root\n that emits one too produces two.\n */}\n <Head />\n <link rel=\"icon\" href=\"data:,\" />\n </head>\n <body>\n {/*\n REQUIRED — this is the hydration mount point, not a styling wrapper.\n\n The browser runtime looks up \\`#vessel\\` and hydrates that element only.\n Remove this div, or rename the id, and the page still renders from the\n server but never becomes interactive: the runtime throws in the console\n and nothing on screen changes.\n\n Wrap it in your own markup freely, and put anything that must live\n outside the hydrated tree (a static footer, a portal target) outside\n it — just keep an element with \\`id=\"vessel\"\\` around {children}.\n */}\n <div id=\"vessel\">{children}</div>\n {/*\n The hydration payload and module tags. Written explicitly because\n placement occasionally matters — a CSP nonce, or ordering against\n your own scripts.\n */}\n <Scripts />\n </body>\n </html>\n );\n}\n`;\n\n/**\n * `src/app/contact/controllers/contact.controller.ts` — a real API endpoint\n * for the Web starter's contact form. It intentionally has no persistence\n * dependency: replace the acknowledgement with a mail/job/database action.\n */\nexport const webContactControllerStub = `import { type Request, type RequestHandler } from \"@warlock.js/core\";\nimport { v, type Infer } from \"@warlock.js/seal\";\n\nexport const contactSchema = v.object({\n name: v.string().min(2),\n email: v.email(),\n message: v.string().min(10),\n});\n\nexport type ContactSchema = Infer.Output<typeof contactSchema>;\n\n/** POST /api/contact — validates the starter contact form. */\nexport const contactController: RequestHandler<Request<ContactSchema>> = async ({\n request,\n response,\n}) => {\n const contact = request.validated();\n\n // Replace this with delivery/persistence for your app. Keeping the accepted\n // payload visible makes the endpoint useful while remaining side-effect free.\n return response.success({\n message: \"Thanks, \" + contact.name + \". Your message has been received.\",\n });\n};\n\ncontactController.validation = { schema: contactSchema };\n`;\n\n/** `src/app/contact/routes.ts` — discovered by the standard app route loader. */\nexport const webContactRoutesStub = `import { router } from \"@warlock.js/core\";\nimport { contactController } from \"./controllers/contact.controller\";\n\nrouter.post(\"/api/contact\", contactController, { public: true });\n`;\n\n/**\n * `src/web/index.register.ts` — universal static setup for the starter page.\n *\n * The page re-exports this stable binding so Warlock's `register()` lifecycle\n * still sees it in both realms without making React Fast Refresh treat every\n * JSX edit as an incompatible function-export replacement.\n */\nexport const webHomeRegisterStub = `import { extend } from \"@mongez/localization\";\n\nexport function register() {\n extend(\"en\", {\n starter: {\n title: \"Your Warlock app is running.\",\n introduction: \"This page is rendered on the server and hydrated in the browser.\",\n language: \"العربية\",\n contact: \"Send a message\",\n name: \"Name\",\n email: \"Email\",\n message: \"Message\",\n submit: \"Send message\",\n sent: \"Thanks — your message has been received.\",\n },\n });\n extend(\"ar\", {\n starter: {\n title: \"تطبيق Warlock يعمل الآن.\",\n introduction: \"تُعرض هذه الصفحة على الخادم ثم تُفعَّل في المتصفح.\",\n language: \"English\",\n contact: \"أرسل رسالة\",\n name: \"الاسم\",\n email: \"البريد الإلكتروني\",\n message: \"الرسالة\",\n submit: \"إرسال الرسالة\",\n sent: \"شكرًا — تم استلام رسالتك.\",\n },\n });\n}\n`;\n\n/**\n * `src/web/index.page.tsx` — one page, so \\`warlock dev\\` has something to serve\n * the moment this finishes.\n */\nexport const webHomePageStub = `import { http } from \"@mongez/http\";\nimport { setCurrentLocaleCode } from \"@mongez/localization\";\nimport { Form, useFormControl, type FormControlProps } from \"@mongez/react-form\";\nimport { transX } from \"@mongez/react-localization\";\nimport { v } from \"@warlock.js/seal\";\nimport { Link, type PageConfig, type PageProps } from \"@warlock.js/web\";\nimport { useState } from \"react\";\n\nexport { register } from \"./index.register\";\n\n/**\n * A page route is an ordinary Warlock route whose handler renders React\n * instead of returning JSON.\n *\n * The URL and stable hydration name are the ones this file DECLARES below.\n * This page answers \\`GET \"/\"\\` because \\`config.route.path = \"/\"\\`, not because of\n * where the file lives. A page file with\n * no \\`config.route\\` declaration derives its URL from the filesystem.\n */\nexport const config: PageConfig = {\n route: { path: \"/\", name: \"index\" },\n metadata: { title: \"Home\" },\n};\n\nconst contactSchema = v.object({\n name: v.string().min(2),\n email: v.email(),\n message: v.string().min(10),\n});\n\nfunction TextInput({ label, ...controlProps }: FormControlProps & { label: string }) {\n const { error, getErrorProps, getInputProps } = useFormControl(controlProps);\n\n return (\n <div className=\"wk-field\">\n <label htmlFor={controlProps.name}>{label}</label>\n <input {...getInputProps()} />\n {error && <p {...getErrorProps()}>{error}</p>}\n </div>\n );\n}\n\n/**\n * Add a \\`loader\\` export to fetch data on the server, and it arrives here as\n * \\`data\\`, typed:\n *\n * export const loader = (async () => ({ items: await itemsRepository.all() }));\n * export default function HomePage({ data }: PageProps<typeof loader>) { ... }\n */\nexport default function HomePage(_props: PageProps) {\n // Live state. If the button below does nothing, the page rendered on the\n // server but never hydrated — the runtime never mounted at \\`#vessel\\`. This is\n // deliberately here so that failure is impossible to miss.\n const [count, setCount] = useState(0);\n const [locale, setLocale] = useState<\"en\" | \"ar\">(\"en\");\n const [submitted, setSubmitted] = useState(false);\n const [submitError, setSubmitError] = useState<string | null>(null);\n\n const toggleLocale = () => {\n const nextLocale = locale === \"en\" ? \"ar\" : \"en\";\n setCurrentLocaleCode(nextLocale);\n setLocale(nextLocale);\n };\n\n return (\n <>\n {/*\n Self-contained, dependency-free styling: plain CSS, system fonts, and\n CSS custom properties, scoped to this page. No CSS framework, no utility\n classes, no external stylesheet — this page looks the same whether or\n not \\`warlock add tailwind\\` has ever been run.\n */}\n <style>{\\`\n .wk-home {\n --wk-fg: #0f172a;\n --wk-muted: #64748b;\n --wk-accent: #4f46e5;\n --wk-border: #e2e8f0;\n font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n color: var(--wk-fg);\n max-width: 42rem;\n margin: 4rem auto;\n padding: 0 1.5rem;\n line-height: 1.6;\n }\n .wk-home h1 { font-size: 2.25rem; margin: 0 0 0.5rem; }\n .wk-home p { color: var(--wk-muted); margin: 0 0 1.5rem; }\n .wk-home code {\n font-family: ui-monospace, \"SFMono-Regular\", Menlo, monospace;\n background: #f1f5f9;\n padding: 0.1rem 0.35rem;\n border-radius: 0.25rem;\n }\n .wk-check {\n border: 1px solid var(--wk-border);\n border-radius: 0.75rem;\n padding: 1.25rem 1.5rem;\n margin: 2rem 0;\n }\n .wk-check strong { display: block; font-size: 1.5rem; }\n .wk-check button {\n font: inherit;\n cursor: pointer;\n background: var(--wk-accent);\n color: #fff;\n border: 0;\n border-radius: 0.5rem;\n padding: 0.5rem 1rem;\n margin-top: 0.75rem;\n }\n .wk-links { display: flex; gap: 1.25rem; font-size: 0.95rem; }\n .wk-links a { color: var(--wk-accent); text-decoration: none; }\n .wk-links a:hover { text-decoration: underline; }\n .wk-language { margin-left: auto; }\n .wk-contact { margin-top: 2rem; }\n .wk-field { display: grid; gap: 0.35rem; margin: 0.8rem 0; }\n .wk-field input, .wk-field textarea { font: inherit; padding: 0.55rem; }\n .wk-field p, .wk-submit-error { color: #b91c1c; margin: 0; }\n .wk-success { color: #047857; }\n \\`}</style>\n\n <main className=\"wk-home\" dir={locale === \"ar\" ? \"rtl\" : \"ltr\"}>\n <nav className=\"wk-links\" aria-label=\"Starter links\">\n <a href=\"https://warlock.js.org\" target=\"_blank\" rel=\"noreferrer\">\n Docs\n </a>\n <Link href=\"/\" aria-current=\"page\">\n Home\n </Link>\n <button\n className=\"wk-language\"\n type=\"button\"\n aria-pressed={locale === \"ar\"}\n onClick={toggleLocale}\n >\n {transX(\"starter.language\")}\n </button>\n </nav>\n\n <h1>{transX(\"starter.title\")}</h1>\n <p>{transX(\"starter.introduction\")}</p>\n\n <section className=\"wk-check\">\n <label>If this number goes up when you click, React is hydrated:</label>\n <strong>{count}</strong>\n <button type=\"button\" onClick={() => setCount((c) => c + 1)}>\n Count up\n </button>\n </section>\n\n <section className=\"wk-contact\" aria-labelledby=\"contact-heading\">\n <h2 id=\"contact-heading\">{transX(\"starter.contact\")}</h2>\n <Form<typeof contactSchema>\n id=\"contact-form\"\n schema={contactSchema}\n onSubmit={async ({ form, values }) => {\n setSubmitted(false);\n setSubmitError(null);\n const result = await http.post<{ message: string }>(\"/api/contact\", values);\n\n if (result.error) {\n if (result.error.isValidationError) {\n const body = result.error.body as {\n errors?: Array<{ input: string; error: string }>;\n message?: string;\n };\n form.setErrors(\n Object.fromEntries(\n (body.errors ?? []).map(({ input, error }) => [input, error]),\n ),\n );\n setSubmitError(body.message ?? \"Please correct the highlighted fields.\");\n } else {\n setSubmitError(\"Your message could not be sent. Please try again.\");\n }\n return;\n }\n\n setSubmitted(true);\n form.reset();\n }}\n >\n <TextInput name=\"name\" label={transX(\"starter.name\")} autoComplete=\"name\" />\n <TextInput\n name=\"email\"\n label={transX(\"starter.email\")}\n type=\"email\"\n autoComplete=\"email\"\n />\n <ContactMessage />\n <button type=\"submit\">{transX(\"starter.submit\")}</button>\n {submitError && (\n <p className=\"wk-submit-error\" role=\"alert\">\n {submitError}\n </p>\n )}\n {submitted && (\n <p className=\"wk-success\" role=\"status\">\n {transX(\"starter.sent\")}\n </p>\n )}\n </Form>\n </section>\n </main>\n </>\n );\n}\n\nfunction ContactMessage() {\n const { error, getErrorProps, getInputProps } = useFormControl({ name: \"message\" });\n\n return (\n <div className=\"wk-field\">\n <label htmlFor=\"message\">{transX(\"starter.message\")}</label>\n <textarea {...getInputProps()} rows={5} />\n {error && <p {...getErrorProps()}>{error}</p>}\n </div>\n );\n}\n`;\n"],"mappings":";AAAA,MAAa,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BhC,MAAa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+B5B,MAAa,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCnC,MAAa,2BAA2B;;AAGxC,MAAa,0BAA0B;;;;;;;;;;;;AAavC,MAAa,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FvC,MAAa,+BAA+B;;AAG5C,MAAa,8BAA8B;;;;;;;;;;;;;;;;;;;;;AAsB3C,MAAa,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6ClC,MAAa,mBAAmB;;;;;;;;;;;;;;;;;AAkBhC,MAAa,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFvC,MAAa,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCvC,MAAa,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDrC,MAAa,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;AAwBzC,MAAa,2BAA2B;;;;;;;;;;;;;;;;;;;;;AAsBxC,MAAa,8BAA8B;;;;;;;;;;;;;;;;;;AAmB3C,MAAa,+BAA+B;;;;;;;;;;;;;;;;;AAkB5C,MAAa,kCAAkC;;;;;;;;;;;;;;;;;;;;AAqB/C,MAAa,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;AAyB/C,MAAa,yCAAyC;;;;;;;;;;;;;;;;AAiBtD,MAAa,qCAAqC;;;;;;;;;;;;;;;;;;;;;AAsBlD,MAAa,yCAAyC;;;;;;;;;;;;;;;;AAiBtD,MAAa,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BtC,MAAa,0BAA0B;;;;;AAMvC,MAAa,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2E3C,SAAgB,+BAA+B,QAAyB,MAAsB;CAC5F,MAAM,SAAS,WAAW,QAAQ,YAAY;CAC9C,IAAI;CACJ,IAAI,SAAS,kBACX,gBAAgB;;;;;;;;;;;;;;;;;;;;MAoBX,IAAI,SAAS,+BAClB,gBAAgB;;;;;;;;;;MAUX,IAAI,SAAS,2BAClB,gBAAgB;;;;;;;;;;;;;;;;MAiBhB,gBAAgB;;;;;;;;;;;;;;;CAoBlB,OAAO,wBAAwB,OAAO;;EAHpC,WAAW,UACP,kFACA,GAGM;;YAEF,OAAO,GAAG,KAAK;;6BAEE,OAAO,IAAI,KAAK;;;;;;;;;;;;;;;EAe3C,cAAc,WAAW,YAAY,WAAW,EAAE;;;;AAIpD;;;;;;;;;AAUA,MAAa,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4D3B,MAAa,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BxC,MAAa,uBAAuB;;;;;;;;;;;;AAapC,MAAa,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCnC,MAAa,kBAAkB"}
@@ -12,7 +12,7 @@
12
12
  * stray `HTTP_PORT`), so a read-only data command fails on a port it was never
13
13
  * going to use. Finding f9ace89e.
14
14
  */
15
- declare function shouldPreflightHttpPort(connectors: readonly string[] | true): boolean;
15
+ export declare function shouldPreflightHttpPort(connectors: readonly string[] | true): boolean;
16
16
  /**
17
17
  * Probe the port declared in `src/config/http.ts`, if there is one.
18
18
  *
@@ -27,7 +27,7 @@ declare function shouldPreflightHttpPort(connectors: readonly string[] | true):
27
27
  *
28
28
  * @throws {PortInUseError} when the configured port is already taken.
29
29
  */
30
- declare function assertConfiguredHttpPortIsFree(): Promise<void>;
30
+ export declare function assertConfiguredHttpPortIsFree(): Promise<void>;
31
31
  /**
32
32
  * Fail the boot immediately, and by name, when the http port is already taken.
33
33
  *
@@ -54,7 +54,7 @@ declare function assertConfiguredHttpPortIsFree(): Promise<void>;
54
54
  * fast-fail convenience, and it must never be the thing that stops an app which
55
55
  * would otherwise have booted. `HttpConnector` still runs the real check.
56
56
  */
57
- declare function preflightConfiguredHttpPort(): Promise<void>;
57
+ export declare function preflightConfiguredHttpPort(): Promise<void>;
58
58
  /**
59
59
  * The remedy lines, chosen by where `http.port` actually came from.
60
60
  *
@@ -64,7 +64,6 @@ declare function preflightConfiguredHttpPort(): Promise<void>;
64
64
  * and, only when the answer is yes, replaces the config-edit advice with the
65
65
  * one that will actually free the port.
66
66
  */
67
- declare function remedyLines(collidingPort: number): string[];
67
+ export declare function remedyLines(collidingPort: number): string[];
68
68
  //#endregion
69
- export { assertConfiguredHttpPortIsFree, preflightConfiguredHttpPort, remedyLines, shouldPreflightHttpPort };
70
69
  //# sourceMappingURL=boot-port-preflight.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"boot-port-preflight.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/http/boot-port-preflight.ts"],"mappings":";;AAyCA;;;;AAA4E;AAkB5E;;;;AAA+D;AA4D/D;;iBA9EgB,uBAAA,CAAwB,UAAoC;;AA8EhB;AAwD5D;;;;AAAiD;;;;;;;;iBApH3B,8BAAA,IAAkC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4DzC,2BAAA,IAA+B,OAAO;;;;;;;;;;iBAwD5C,WAAA,CAAY,aAAqB"}
1
+ {"version":3,"file":"boot-port-preflight.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/http/boot-port-preflight.ts"],"mappings":";;;;;;;;;;;;;;wBAyCgB,wBAAwB;;;;;;;;;;;;;;;wBAkBlB,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA4DlC,+BAA+B;;;;;;;;;;wBAwDrC,YAAY"}
@@ -1,7 +1,7 @@
1
1
  import { getRecordedEnvironmentOverride } from "../utils/recorded-environment-overrides.mjs";
2
2
  import { PortInUseError, assertPortIsAvailable } from "./port-preflight.mjs";
3
3
  import { resolveBindPort } from "./resolve-bind-port.mjs";
4
- import config from "@mongez/config";
4
+ import baseConfig from "@mongez/config";
5
5
 
6
6
  //#region ../../packages/core/src/http/boot-port-preflight.ts
7
7
  /**
@@ -55,7 +55,7 @@ function shouldPreflightHttpPort(connectors) {
55
55
  * @throws {PortInUseError} when the configured port is already taken.
56
56
  */
57
57
  async function assertConfiguredHttpPortIsFree() {
58
- const httpConfig = config.get("http");
58
+ const httpConfig = baseConfig.get("http");
59
59
  if (!httpConfig) return;
60
60
  let port;
61
61
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"boot-port-preflight.mjs","names":[],"sources":["../../../../../../../../packages/core/src/http/boot-port-preflight.ts"],"sourcesContent":["import config from \"@mongez/config\";\nimport { getRecordedEnvironmentOverride } from \"../utils/recorded-environment-overrides\";\nimport { assertPortIsAvailable, PortInUseError } from \"./port-preflight\";\nimport { resolveBindPort } from \"./resolve-bind-port\";\n\n/**\n * The env var whose value `src/config/http.ts` reads for `http.port`\n * (`port: env(\"HTTP_PORT\", …)`). When an ambient value for it beats `.env`,\n * `http.port` resolves to the ambient value and editing the config literal\n * changes nothing — the whole point of the provenance branch below.\n */\nconst HTTP_PORT_ENV_KEY = \"HTTP_PORT\";\n\n/**\n * Mirrors `dev-server/supervisor.ts`'s `BOOT_PRECONDITION_EXIT_CODE`. Kept as\n * its own literal here (rather than imported) so this file — reached by both\n * the dev-preload path and the generated, standalone production entry — never\n * pulls dev-server's supervisor module (child_process, TTY handling, ...)\n * into a production bundle that has no supervisor at all. EX_CONFIG.\n */\nconst BOOT_PRECONDITION_EXIT_CODE = 78;\n\n/**\n * Host used when `http.host` is unset — the same default `HttpConnector`\n * binds with, so the probe tests the address the server will actually take.\n */\nconst DEFAULT_BIND_HOST = \"localhost\";\n\n/**\n * Whether the HTTP-port preflight should run for a command's `connectors`\n * preload.\n *\n * The bind-and-release probe is only meaningful when this boot will actually\n * start the http connector: `true` (a full boot — http starts in its late\n * phase) or an explicit list that names `\"http\"`. A scoped list WITHOUT http —\n * e.g. `warlock seed`'s `[\"database\", \"cache\", \"logger\"]`, or `migrate` — never\n * binds the port, so probing it is pointless and actively harmful: the probe\n * collides with a dev server already listening on that port (and inherits a\n * stray `HTTP_PORT`), so a read-only data command fails on a port it was never\n * going to use. Finding f9ace89e.\n */\nexport function shouldPreflightHttpPort(connectors: readonly string[] | true): boolean {\n return connectors === true || connectors.includes(\"http\");\n}\n\n/**\n * Probe the port declared in `src/config/http.ts`, if there is one.\n *\n * Reads config rather than taking arguments because the only honest answer to\n * \"which port will this boot bind\" lives in the loaded config, and the callers\n * that need this check (the generated production entry) run before anything\n * that could hand it over.\n *\n * A no-op for an app with no `http` config, or an `http.port` that is not a\n * usable port number — those apps never bind, so there is nothing to preflight\n * and nothing to fail on.\n *\n * @throws {PortInUseError} when the configured port is already taken.\n */\nexport async function assertConfiguredHttpPortIsFree(): Promise<void> {\n const httpConfig = config.get(\"http\");\n\n if (!httpConfig) {\n return;\n }\n\n // This runs BEFORE the connectors in the generated production entry, and\n // `preflightConfiguredHttpPort()` below only exits on `PortInUseError` —\n // any other throw is swallowed there. So a bad port must not throw HERE:\n // it stays a no-op, exactly like the previous hand-rolled coercion, and\n // `HttpConnector` (which now also calls `resolveBindPort`) is the one that\n // reports it, a moment later, with a channel a developer will actually see.\n let port: number;\n\n try {\n port = resolveBindPort(httpConfig.port);\n } catch {\n return;\n }\n\n // Port 0 asks the OS to pick a free one, so there is nothing to preflight:\n // probing 0 binds SOME unrelated ephemeral port and \"passes\" without proving\n // anything about the port this boot will end up on. The hand-rolled coercion\n // this replaced skipped 0 by rejecting `port <= 0`; `resolveBindPort` accepts\n // 0 as a legitimate TCP value, so the skip has to be stated here instead of\n // falling out of a range check.\n if (port === 0) {\n return;\n }\n\n await assertPortIsAvailable(port, httpConfig.host || DEFAULT_BIND_HOST);\n}\n\n/**\n * Fail the boot immediately, and by name, when the http port is already taken.\n *\n * Called from the generated production entry BEFORE the early-phase connectors,\n * because the port is the cheapest thing in the boot to check and the one most\n * likely to be wrong. `HttpConnector` is a LATE-phase connector, so its own\n * preflight is not reached until the database has connected, the cache has\n * connected and every module of app code has been imported — 7-13 seconds of\n * work, all of it discarded, before anyone learns the port was busy. This check\n * costs a bind-and-release on a socket that is never served.\n *\n * It does NOT replace `HttpConnector`'s preflight: a port can be taken in the\n * seconds between the two, and only the connector's check sits immediately\n * before the real `listen()`. This one exists to make the common case fast and\n * legible.\n *\n * Reports through `console.error` and NOT through `log.fatal`: the logger has\n * no channels yet at this point in the boot (the logger connector is part of\n * the early phase this runs ahead of), so a logged message here would reach\n * nobody. stderr always reaches the terminal, and `warlock start` forwards the\n * child's stderr verbatim.\n *\n * A probe that fails for any OTHER reason is deliberately swallowed: this is a\n * fast-fail convenience, and it must never be the thing that stops an app which\n * would otherwise have booted. `HttpConnector` still runs the real check.\n */\nexport async function preflightConfiguredHttpPort(): Promise<void> {\n try {\n await assertConfiguredHttpPortIsFree();\n } catch (error) {\n if (!(error instanceof PortInUseError)) {\n return;\n }\n\n reportPortInUse(error);\n\n process.exit(BOOT_PRECONDITION_EXIT_CODE);\n }\n}\n\n/**\n * Print the collision the way the developer needs to read it: the errno they\n * grep for, the port and host by name, and the command that names the process\n * holding it — the supervisor cannot discover the owning PID for them, but it\n * can hand them the one line that will.\n *\n * The remedy is chosen by PROVENANCE, never appended as a menu. When the\n * colliding port came from an ambient `HTTP_PORT` that beat `.env` (the exact\n * two-rebuild trap of finding 8782b840), \"edit src/config/http.ts and rebuild\"\n * is actively wrong — the env var wins, so the rebuild changes nothing. In that\n * case name the variable and give the remedy that works (unset it); only when\n * the port genuinely came from config do we point at the config file.\n */\nfunction reportPortInUse(error: PortInUseError): void {\n const ownerCommand =\n process.platform === \"win32\"\n ? `netstat -ano | findstr :${error.port}`\n : `lsof -i :${error.port}`;\n\n const lines = [\n \"\",\n ` ✖ EADDRINUSE: port ${error.port} is already in use on ${error.host}`,\n ` the application cannot start because something else is already listening there.`,\n ` find the owning process: ${ownerCommand}`,\n ...remedyLines(error.port),\n \"\",\n ];\n\n for (const line of lines) {\n console.error(line);\n }\n}\n\n/**\n * The remedy lines, chosen by where `http.port` actually came from.\n *\n * The provenance is the detector's own finding from env-load, carried here via\n * {@link getRecordedEnvironmentOverride} rather than recomputed — so this asks\n * \"did an ambient HTTP_PORT beat .env, and is that the value now colliding?\"\n * and, only when the answer is yes, replaces the config-edit advice with the\n * one that will actually free the port.\n */\nexport function remedyLines(collidingPort: number): string[] {\n const httpPortOverride = getRecordedEnvironmentOverride(HTTP_PORT_ENV_KEY);\n\n // Only claim the environment is the source when the ambient value is the one\n // that is actually colliding — an HTTP_PORT override of an UNRELATED port\n // must not misdirect the reader away from their real (config) port.\n const cameFromEnvironment =\n httpPortOverride !== undefined &&\n Number(String(httpPortOverride.effectiveValue).trim()) === collidingPort;\n\n if (cameFromEnvironment) {\n return [\n ` this port came from the ${HTTP_PORT_ENV_KEY} environment variable (=${httpPortOverride!.effectiveValue}), which overrode .env's ${HTTP_PORT_ENV_KEY}=${httpPortOverride!.fileValue}.`,\n ` editing src/config/http.ts and rebuilding will NOT change it — the environment variable wins.`,\n ` then stop the process above, or unset ${HTTP_PORT_ENV_KEY} and run again.`,\n ];\n }\n\n return [` then stop it, or change http.port in src/config/http.ts and rebuild.`];\n}\n"],"mappings":";;;;;;;;;;;;AAWA,MAAM,oBAAoB;;;;;;;;AAS1B,MAAM,8BAA8B;;;;;AAMpC,MAAM,oBAAoB;;;;;;;;;;;;;;AAe1B,SAAgB,wBAAwB,YAA+C;CACrF,OAAO,eAAe,QAAQ,WAAW,SAAS,MAAM;AAC1D;;;;;;;;;;;;;;;AAgBA,eAAsB,iCAAgD;CACpE,MAAM,aAAa,OAAO,IAAI,MAAM;CAEpC,IAAI,CAAC,YACH;CASF,IAAI;CAEJ,IAAI;EACF,OAAO,gBAAgB,WAAW,IAAI;CACxC,QAAQ;EACN;CACF;CAQA,IAAI,SAAS,GACX;CAGF,MAAM,sBAAsB,MAAM,WAAW,QAAQ,iBAAiB;AACxE;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,eAAsB,8BAA6C;CACjE,IAAI;EACF,MAAM,+BAA+B;CACvC,SAAS,OAAO;EACd,IAAI,EAAE,iBAAiB,iBACrB;EAGF,gBAAgB,KAAK;EAErB,QAAQ,KAAK,2BAA2B;CAC1C;AACF;;;;;;;;;;;;;;AAeA,SAAS,gBAAgB,OAA6B;CACpD,MAAM,eACJ,QAAQ,aAAa,UACjB,2BAA2B,MAAM,SACjC,YAAY,MAAM;CAExB,MAAM,QAAQ;EACZ;EACA,wBAAwB,MAAM,KAAK,wBAAwB,MAAM;EACjE;EACA,8BAA8B;EAC9B,GAAG,YAAY,MAAM,IAAI;EACzB;CACF;CAEA,KAAK,MAAM,QAAQ,OACjB,QAAQ,MAAM,IAAI;AAEtB;;;;;;;;;;AAWA,SAAgB,YAAY,eAAiC;CAC3D,MAAM,mBAAmB,+BAA+B,iBAAiB;CASzE,IAHE,qBAAqB,UACrB,OAAO,OAAO,iBAAiB,cAAc,CAAC,CAAC,KAAK,CAAC,MAAM,eAG3D,OAAO;EACL,6BAA6B,kBAAkB,0BAA0B,iBAAkB,eAAe,2BAA2B,kBAAkB,GAAG,iBAAkB,UAAU;EACtL;EACA,2CAA2C,kBAAkB;CAC/D;CAGF,OAAO,CAAC,wEAAwE;AAClF"}
1
+ {"version":3,"file":"boot-port-preflight.mjs","names":["config"],"sources":["../../../../../../../../packages/core/src/http/boot-port-preflight.ts"],"sourcesContent":["import config from \"@mongez/config\";\nimport { getRecordedEnvironmentOverride } from \"../utils/recorded-environment-overrides\";\nimport { assertPortIsAvailable, PortInUseError } from \"./port-preflight\";\nimport { resolveBindPort } from \"./resolve-bind-port\";\n\n/**\n * The env var whose value `src/config/http.ts` reads for `http.port`\n * (`port: env(\"HTTP_PORT\", …)`). When an ambient value for it beats `.env`,\n * `http.port` resolves to the ambient value and editing the config literal\n * changes nothing — the whole point of the provenance branch below.\n */\nconst HTTP_PORT_ENV_KEY = \"HTTP_PORT\";\n\n/**\n * Mirrors `dev-server/supervisor.ts`'s `BOOT_PRECONDITION_EXIT_CODE`. Kept as\n * its own literal here (rather than imported) so this file — reached by both\n * the dev-preload path and the generated, standalone production entry — never\n * pulls dev-server's supervisor module (child_process, TTY handling, ...)\n * into a production bundle that has no supervisor at all. EX_CONFIG.\n */\nconst BOOT_PRECONDITION_EXIT_CODE = 78;\n\n/**\n * Host used when `http.host` is unset — the same default `HttpConnector`\n * binds with, so the probe tests the address the server will actually take.\n */\nconst DEFAULT_BIND_HOST = \"localhost\";\n\n/**\n * Whether the HTTP-port preflight should run for a command's `connectors`\n * preload.\n *\n * The bind-and-release probe is only meaningful when this boot will actually\n * start the http connector: `true` (a full boot — http starts in its late\n * phase) or an explicit list that names `\"http\"`. A scoped list WITHOUT http —\n * e.g. `warlock seed`'s `[\"database\", \"cache\", \"logger\"]`, or `migrate` — never\n * binds the port, so probing it is pointless and actively harmful: the probe\n * collides with a dev server already listening on that port (and inherits a\n * stray `HTTP_PORT`), so a read-only data command fails on a port it was never\n * going to use. Finding f9ace89e.\n */\nexport function shouldPreflightHttpPort(connectors: readonly string[] | true): boolean {\n return connectors === true || connectors.includes(\"http\");\n}\n\n/**\n * Probe the port declared in `src/config/http.ts`, if there is one.\n *\n * Reads config rather than taking arguments because the only honest answer to\n * \"which port will this boot bind\" lives in the loaded config, and the callers\n * that need this check (the generated production entry) run before anything\n * that could hand it over.\n *\n * A no-op for an app with no `http` config, or an `http.port` that is not a\n * usable port number — those apps never bind, so there is nothing to preflight\n * and nothing to fail on.\n *\n * @throws {PortInUseError} when the configured port is already taken.\n */\nexport async function assertConfiguredHttpPortIsFree(): Promise<void> {\n const httpConfig = config.get(\"http\");\n\n if (!httpConfig) {\n return;\n }\n\n // This runs BEFORE the connectors in the generated production entry, and\n // `preflightConfiguredHttpPort()` below only exits on `PortInUseError` —\n // any other throw is swallowed there. So a bad port must not throw HERE:\n // it stays a no-op, exactly like the previous hand-rolled coercion, and\n // `HttpConnector` (which now also calls `resolveBindPort`) is the one that\n // reports it, a moment later, with a channel a developer will actually see.\n let port: number;\n\n try {\n port = resolveBindPort(httpConfig.port);\n } catch {\n return;\n }\n\n // Port 0 asks the OS to pick a free one, so there is nothing to preflight:\n // probing 0 binds SOME unrelated ephemeral port and \"passes\" without proving\n // anything about the port this boot will end up on. The hand-rolled coercion\n // this replaced skipped 0 by rejecting `port <= 0`; `resolveBindPort` accepts\n // 0 as a legitimate TCP value, so the skip has to be stated here instead of\n // falling out of a range check.\n if (port === 0) {\n return;\n }\n\n await assertPortIsAvailable(port, httpConfig.host || DEFAULT_BIND_HOST);\n}\n\n/**\n * Fail the boot immediately, and by name, when the http port is already taken.\n *\n * Called from the generated production entry BEFORE the early-phase connectors,\n * because the port is the cheapest thing in the boot to check and the one most\n * likely to be wrong. `HttpConnector` is a LATE-phase connector, so its own\n * preflight is not reached until the database has connected, the cache has\n * connected and every module of app code has been imported — 7-13 seconds of\n * work, all of it discarded, before anyone learns the port was busy. This check\n * costs a bind-and-release on a socket that is never served.\n *\n * It does NOT replace `HttpConnector`'s preflight: a port can be taken in the\n * seconds between the two, and only the connector's check sits immediately\n * before the real `listen()`. This one exists to make the common case fast and\n * legible.\n *\n * Reports through `console.error` and NOT through `log.fatal`: the logger has\n * no channels yet at this point in the boot (the logger connector is part of\n * the early phase this runs ahead of), so a logged message here would reach\n * nobody. stderr always reaches the terminal, and `warlock start` forwards the\n * child's stderr verbatim.\n *\n * A probe that fails for any OTHER reason is deliberately swallowed: this is a\n * fast-fail convenience, and it must never be the thing that stops an app which\n * would otherwise have booted. `HttpConnector` still runs the real check.\n */\nexport async function preflightConfiguredHttpPort(): Promise<void> {\n try {\n await assertConfiguredHttpPortIsFree();\n } catch (error) {\n if (!(error instanceof PortInUseError)) {\n return;\n }\n\n reportPortInUse(error);\n\n process.exit(BOOT_PRECONDITION_EXIT_CODE);\n }\n}\n\n/**\n * Print the collision the way the developer needs to read it: the errno they\n * grep for, the port and host by name, and the command that names the process\n * holding it — the supervisor cannot discover the owning PID for them, but it\n * can hand them the one line that will.\n *\n * The remedy is chosen by PROVENANCE, never appended as a menu. When the\n * colliding port came from an ambient `HTTP_PORT` that beat `.env` (the exact\n * two-rebuild trap of finding 8782b840), \"edit src/config/http.ts and rebuild\"\n * is actively wrong — the env var wins, so the rebuild changes nothing. In that\n * case name the variable and give the remedy that works (unset it); only when\n * the port genuinely came from config do we point at the config file.\n */\nfunction reportPortInUse(error: PortInUseError): void {\n const ownerCommand =\n process.platform === \"win32\"\n ? `netstat -ano | findstr :${error.port}`\n : `lsof -i :${error.port}`;\n\n const lines = [\n \"\",\n ` ✖ EADDRINUSE: port ${error.port} is already in use on ${error.host}`,\n ` the application cannot start because something else is already listening there.`,\n ` find the owning process: ${ownerCommand}`,\n ...remedyLines(error.port),\n \"\",\n ];\n\n for (const line of lines) {\n console.error(line);\n }\n}\n\n/**\n * The remedy lines, chosen by where `http.port` actually came from.\n *\n * The provenance is the detector's own finding from env-load, carried here via\n * {@link getRecordedEnvironmentOverride} rather than recomputed — so this asks\n * \"did an ambient HTTP_PORT beat .env, and is that the value now colliding?\"\n * and, only when the answer is yes, replaces the config-edit advice with the\n * one that will actually free the port.\n */\nexport function remedyLines(collidingPort: number): string[] {\n const httpPortOverride = getRecordedEnvironmentOverride(HTTP_PORT_ENV_KEY);\n\n // Only claim the environment is the source when the ambient value is the one\n // that is actually colliding — an HTTP_PORT override of an UNRELATED port\n // must not misdirect the reader away from their real (config) port.\n const cameFromEnvironment =\n httpPortOverride !== undefined &&\n Number(String(httpPortOverride.effectiveValue).trim()) === collidingPort;\n\n if (cameFromEnvironment) {\n return [\n ` this port came from the ${HTTP_PORT_ENV_KEY} environment variable (=${httpPortOverride!.effectiveValue}), which overrode .env's ${HTTP_PORT_ENV_KEY}=${httpPortOverride!.fileValue}.`,\n ` editing src/config/http.ts and rebuilding will NOT change it — the environment variable wins.`,\n ` then stop the process above, or unset ${HTTP_PORT_ENV_KEY} and run again.`,\n ];\n }\n\n return [` then stop it, or change http.port in src/config/http.ts and rebuild.`];\n}\n"],"mappings":";;;;;;;;;;;;AAWA,MAAM,oBAAoB;;;;;;;;AAS1B,MAAM,8BAA8B;;;;;AAMpC,MAAM,oBAAoB;;;;;;;;;;;;;;AAe1B,SAAgB,wBAAwB,YAA+C;CACrF,OAAO,eAAe,QAAQ,WAAW,SAAS,MAAM;AAC1D;;;;;;;;;;;;;;;AAgBA,eAAsB,iCAAgD;CACpE,MAAM,aAAaA,WAAO,IAAI,MAAM;CAEpC,IAAI,CAAC,YACH;CASF,IAAI;CAEJ,IAAI;EACF,OAAO,gBAAgB,WAAW,IAAI;CACxC,QAAQ;EACN;CACF;CAQA,IAAI,SAAS,GACX;CAGF,MAAM,sBAAsB,MAAM,WAAW,QAAQ,iBAAiB;AACxE;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,eAAsB,8BAA6C;CACjE,IAAI;EACF,MAAM,+BAA+B;CACvC,SAAS,OAAO;EACd,IAAI,EAAE,iBAAiB,iBACrB;EAGF,gBAAgB,KAAK;EAErB,QAAQ,KAAK,2BAA2B;CAC1C;AACF;;;;;;;;;;;;;;AAeA,SAAS,gBAAgB,OAA6B;CACpD,MAAM,eACJ,QAAQ,aAAa,UACjB,2BAA2B,MAAM,SACjC,YAAY,MAAM;CAExB,MAAM,QAAQ;EACZ;EACA,wBAAwB,MAAM,KAAK,wBAAwB,MAAM;EACjE;EACA,8BAA8B;EAC9B,GAAG,YAAY,MAAM,IAAI;EACzB;CACF;CAEA,KAAK,MAAM,QAAQ,OACjB,QAAQ,MAAM,IAAI;AAEtB;;;;;;;;;;AAWA,SAAgB,YAAY,eAAiC;CAC3D,MAAM,mBAAmB,+BAA+B,iBAAiB;CASzE,IAHE,qBAAqB,UACrB,OAAO,OAAO,iBAAiB,cAAc,CAAC,CAAC,KAAK,CAAC,MAAM,eAG3D,OAAO;EACL,6BAA6B,kBAAkB,0BAA0B,iBAAkB,eAAe,2BAA2B,kBAAkB,GAAG,iBAAkB,UAAU;EACtL;EACA,2CAA2C,kBAAkB;CAC/D;CAGF,OAAO,CAAC,wEAAwE;AAClF"}
@@ -1,10 +1,10 @@
1
1
  import { ServerResponse } from "node:http";
2
-
3
2
  //#region ../../packages/core/src/http/bounded-stream-queue.d.ts
4
- type StreamQueueOptions = {
5
- /** Total unsent bytes, including Node's writable buffer. Defaults to 1 MiB for enqueue(). */maxQueuedBytes?: number; /** Disconnect the slow client (default), or reject the newest chunk without disconnecting. */
3
+ export type StreamQueueOptions = {
4
+ /** Total unsent bytes, including Node's writable buffer. Defaults to 1 MiB for enqueue(). */
5
+ maxQueuedBytes?: number;
6
+ /** Disconnect the slow client (default), or reject the newest chunk without disconnecting. */
6
7
  onOverflow?: "disconnect" | "drop";
7
8
  };
8
9
  //#endregion
9
- export { StreamQueueOptions };
10
10
  //# sourceMappingURL=bounded-stream-queue.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bounded-stream-queue.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/http/bounded-stream-queue.ts"],"mappings":";;;KAGY,kBAAA;EAAA,6FAEV,cAAA;EAEA,UAAU;AAAA"}
1
+ {"version":3,"file":"bounded-stream-queue.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/http/bounded-stream-queue.ts"],"mappings":";;YAGY;;EAEV;;EAEA"}
@@ -5,7 +5,7 @@ function validateStreamQueueOptions(options) {
5
5
  }
6
6
  function createBoundedStreamQueue(raw, transport, options) {
7
7
  validateStreamQueueOptions(options);
8
- const limit = options.maxQueuedBytes ?? 1024 * 1024;
8
+ const limit = options.maxQueuedBytes ?? 1048576;
9
9
  const pending = [];
10
10
  const waiters = /* @__PURE__ */ new Set();
11
11
  let bytes = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"bounded-stream-queue.mjs","names":[],"sources":["../../../../../../../../packages/core/src/http/bounded-stream-queue.ts"],"sourcesContent":["import type { ServerResponse } from \"node:http\";\nimport type { StreamTransport } from \"./stream-transport\";\n\nexport type StreamQueueOptions = {\n /** Total unsent bytes, including Node's writable buffer. Defaults to 1 MiB for enqueue(). */\n maxQueuedBytes?: number;\n /** Disconnect the slow client (default), or reject the newest chunk without disconnecting. */\n onOverflow?: \"disconnect\" | \"drop\";\n};\n\nexport function validateStreamQueueOptions(options: StreamQueueOptions): void {\n if (\n options.onOverflow !== undefined &&\n options.onOverflow !== \"drop\" &&\n options.onOverflow !== \"disconnect\"\n ) {\n throw new TypeError('onOverflow must be \"drop\" or \"disconnect\"');\n }\n if (\n options.maxQueuedBytes !== undefined &&\n (!Number.isSafeInteger(options.maxQueuedBytes) || options.maxQueuedBytes < 0)\n ) {\n throw new RangeError(\"maxQueuedBytes must be a non-negative safe integer\");\n }\n}\n\nexport function createBoundedStreamQueue(\n raw: ServerResponse,\n transport: StreamTransport,\n options: StreamQueueOptions,\n) {\n validateStreamQueueOptions(options);\n const limit = options.maxQueuedBytes ?? 1024 * 1024;\n const pending: Array<{ data: string | Uint8Array; bytes: number }> = [];\n const waiters = new Set<(drained: boolean) => void>();\n let bytes = 0;\n let ending = false;\n let dropped = 0;\n let onFinished: (() => void) | undefined;\n\n function settle(drained: boolean) {\n for (const resolve of waiters) resolve(drained);\n waiters.clear();\n }\n function cleanup() {\n raw.off(\"drain\", flush);\n raw.off(\"close\", close);\n }\n function close() {\n ending = true;\n pending.length = 0;\n bytes = 0;\n onFinished = undefined;\n cleanup();\n settle(false);\n }\n function flush() {\n if (transport.closed) return close();\n while (pending.length && !raw.writableNeedDrain) {\n const item = pending.shift()!;\n bytes -= item.bytes;\n raw.write(item.data);\n }\n if (!pending.length && !raw.writableNeedDrain) settle(!ending);\n if (!pending.length && onFinished) {\n const finish = onFinished;\n onFinished = undefined;\n cleanup();\n settle(false);\n finish();\n }\n }\n raw.on(\"drain\", flush);\n raw.once(\"close\", close);\n\n return {\n get dropped() {\n return dropped;\n },\n get ending() {\n return ending;\n },\n get backpressured() {\n return pending.length > 0 || transport.backpressured;\n },\n enqueue(data: string | Uint8Array): boolean {\n if (typeof data !== \"string\" && !(data instanceof Uint8Array))\n throw new TypeError(\"Stream data must be a string or Uint8Array\");\n if (ending || transport.closed) return false;\n const size = typeof data === \"string\" ? Buffer.byteLength(data) : data.byteLength;\n if (bytes + (raw.writableLength ?? 0) + size > limit) {\n if (options.onOverflow === \"drop\") dropped++;\n else {\n transport.disconnect();\n close();\n raw.destroy();\n }\n return false;\n }\n if (pending.length || raw.writableNeedDrain) {\n // Own the bytes: a producer may reuse its Uint8Array after enqueue().\n pending.push({ data: typeof data === \"string\" ? data : Buffer.from(data), bytes: size });\n bytes += size;\n } else {\n raw.write(data);\n }\n return true;\n },\n waitForDrain(): Promise<boolean> {\n if (ending || transport.closed) return Promise.resolve(false);\n if (!pending.length && !raw.writableNeedDrain) return Promise.resolve(true);\n return new Promise((resolve) => waiters.add(resolve));\n },\n finish(callback: () => void) {\n if (ending || transport.closed) return;\n ending = true;\n onFinished = callback;\n flush();\n },\n };\n}\n"],"mappings":";AAUA,SAAgB,2BAA2B,SAAmC;CAC5E,IACE,QAAQ,eAAe,UACvB,QAAQ,eAAe,UACvB,QAAQ,eAAe,cAEvB,MAAM,IAAI,UAAU,+CAA2C;CAEjE,IACE,QAAQ,mBAAmB,WAC1B,CAAC,OAAO,cAAc,QAAQ,cAAc,KAAK,QAAQ,iBAAiB,IAE3E,MAAM,IAAI,WAAW,oDAAoD;AAE7E;AAEA,SAAgB,yBACd,KACA,WACA,SACA;CACA,2BAA2B,OAAO;CAClC,MAAM,QAAQ,QAAQ,kBAAkB,OAAO;CAC/C,MAAM,UAA+D,CAAC;CACtE,MAAM,0BAAU,IAAI,IAAgC;CACpD,IAAI,QAAQ;CACZ,IAAI,SAAS;CACb,IAAI,UAAU;CACd,IAAI;CAEJ,SAAS,OAAO,SAAkB;EAChC,KAAK,MAAM,WAAW,SAAS,QAAQ,OAAO;EAC9C,QAAQ,MAAM;CAChB;CACA,SAAS,UAAU;EACjB,IAAI,IAAI,SAAS,KAAK;EACtB,IAAI,IAAI,SAAS,KAAK;CACxB;CACA,SAAS,QAAQ;EACf,SAAS;EACT,QAAQ,SAAS;EACjB,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,OAAO,KAAK;CACd;CACA,SAAS,QAAQ;EACf,IAAI,UAAU,QAAQ,OAAO,MAAM;EACnC,OAAO,QAAQ,UAAU,CAAC,IAAI,mBAAmB;GAC/C,MAAM,OAAO,QAAQ,MAAM;GAC3B,SAAS,KAAK;GACd,IAAI,MAAM,KAAK,IAAI;EACrB;EACA,IAAI,CAAC,QAAQ,UAAU,CAAC,IAAI,mBAAmB,OAAO,CAAC,MAAM;EAC7D,IAAI,CAAC,QAAQ,UAAU,YAAY;GACjC,MAAM,SAAS;GACf,aAAa;GACb,QAAQ;GACR,OAAO,KAAK;GACZ,OAAO;EACT;CACF;CACA,IAAI,GAAG,SAAS,KAAK;CACrB,IAAI,KAAK,SAAS,KAAK;CAEvB,OAAO;EACL,IAAI,UAAU;GACZ,OAAO;EACT;EACA,IAAI,SAAS;GACX,OAAO;EACT;EACA,IAAI,gBAAgB;GAClB,OAAO,QAAQ,SAAS,KAAK,UAAU;EACzC;EACA,QAAQ,MAAoC;GAC1C,IAAI,OAAO,SAAS,YAAY,EAAE,gBAAgB,aAChD,MAAM,IAAI,UAAU,4CAA4C;GAClE,IAAI,UAAU,UAAU,QAAQ,OAAO;GACvC,MAAM,OAAO,OAAO,SAAS,WAAW,OAAO,WAAW,IAAI,IAAI,KAAK;GACvE,IAAI,SAAS,IAAI,kBAAkB,KAAK,OAAO,OAAO;IACpD,IAAI,QAAQ,eAAe,QAAQ;SAC9B;KACH,UAAU,WAAW;KACrB,MAAM;KACN,IAAI,QAAQ;IACd;IACA,OAAO;GACT;GACA,IAAI,QAAQ,UAAU,IAAI,mBAAmB;IAE3C,QAAQ,KAAK;KAAE,MAAM,OAAO,SAAS,WAAW,OAAO,OAAO,KAAK,IAAI;KAAG,OAAO;IAAK,CAAC;IACvF,SAAS;GACX,OACE,IAAI,MAAM,IAAI;GAEhB,OAAO;EACT;EACA,eAAiC;GAC/B,IAAI,UAAU,UAAU,QAAQ,OAAO,QAAQ,QAAQ,KAAK;GAC5D,IAAI,CAAC,QAAQ,UAAU,CAAC,IAAI,mBAAmB,OAAO,QAAQ,QAAQ,IAAI;GAC1E,OAAO,IAAI,SAAS,YAAY,QAAQ,IAAI,OAAO,CAAC;EACtD;EACA,OAAO,UAAsB;GAC3B,IAAI,UAAU,UAAU,QAAQ;GAChC,SAAS;GACT,aAAa;GACb,MAAM;EACR;CACF;AACF"}
1
+ {"version":3,"file":"bounded-stream-queue.mjs","names":[],"sources":["../../../../../../../../packages/core/src/http/bounded-stream-queue.ts"],"sourcesContent":["import type { ServerResponse } from \"node:http\";\nimport type { StreamTransport } from \"./stream-transport\";\n\nexport type StreamQueueOptions = {\n /** Total unsent bytes, including Node's writable buffer. Defaults to 1 MiB for enqueue(). */\n maxQueuedBytes?: number;\n /** Disconnect the slow client (default), or reject the newest chunk without disconnecting. */\n onOverflow?: \"disconnect\" | \"drop\";\n};\n\nexport function validateStreamQueueOptions(options: StreamQueueOptions): void {\n if (\n options.onOverflow !== undefined &&\n options.onOverflow !== \"drop\" &&\n options.onOverflow !== \"disconnect\"\n ) {\n throw new TypeError('onOverflow must be \"drop\" or \"disconnect\"');\n }\n if (\n options.maxQueuedBytes !== undefined &&\n (!Number.isSafeInteger(options.maxQueuedBytes) || options.maxQueuedBytes < 0)\n ) {\n throw new RangeError(\"maxQueuedBytes must be a non-negative safe integer\");\n }\n}\n\nexport function createBoundedStreamQueue(\n raw: ServerResponse,\n transport: StreamTransport,\n options: StreamQueueOptions,\n) {\n validateStreamQueueOptions(options);\n const limit = options.maxQueuedBytes ?? 1024 * 1024;\n const pending: Array<{ data: string | Uint8Array; bytes: number }> = [];\n const waiters = new Set<(drained: boolean) => void>();\n let bytes = 0;\n let ending = false;\n let dropped = 0;\n let onFinished: (() => void) | undefined;\n\n function settle(drained: boolean) {\n for (const resolve of waiters) resolve(drained);\n waiters.clear();\n }\n function cleanup() {\n raw.off(\"drain\", flush);\n raw.off(\"close\", close);\n }\n function close() {\n ending = true;\n pending.length = 0;\n bytes = 0;\n onFinished = undefined;\n cleanup();\n settle(false);\n }\n function flush() {\n if (transport.closed) return close();\n while (pending.length && !raw.writableNeedDrain) {\n const item = pending.shift()!;\n bytes -= item.bytes;\n raw.write(item.data);\n }\n if (!pending.length && !raw.writableNeedDrain) settle(!ending);\n if (!pending.length && onFinished) {\n const finish = onFinished;\n onFinished = undefined;\n cleanup();\n settle(false);\n finish();\n }\n }\n raw.on(\"drain\", flush);\n raw.once(\"close\", close);\n\n return {\n get dropped() {\n return dropped;\n },\n get ending() {\n return ending;\n },\n get backpressured() {\n return pending.length > 0 || transport.backpressured;\n },\n enqueue(data: string | Uint8Array): boolean {\n if (typeof data !== \"string\" && !(data instanceof Uint8Array))\n throw new TypeError(\"Stream data must be a string or Uint8Array\");\n if (ending || transport.closed) return false;\n const size = typeof data === \"string\" ? Buffer.byteLength(data) : data.byteLength;\n if (bytes + (raw.writableLength ?? 0) + size > limit) {\n if (options.onOverflow === \"drop\") dropped++;\n else {\n transport.disconnect();\n close();\n raw.destroy();\n }\n return false;\n }\n if (pending.length || raw.writableNeedDrain) {\n // Own the bytes: a producer may reuse its Uint8Array after enqueue().\n pending.push({ data: typeof data === \"string\" ? data : Buffer.from(data), bytes: size });\n bytes += size;\n } else {\n raw.write(data);\n }\n return true;\n },\n waitForDrain(): Promise<boolean> {\n if (ending || transport.closed) return Promise.resolve(false);\n if (!pending.length && !raw.writableNeedDrain) return Promise.resolve(true);\n return new Promise((resolve) => waiters.add(resolve));\n },\n finish(callback: () => void) {\n if (ending || transport.closed) return;\n ending = true;\n onFinished = callback;\n flush();\n },\n };\n}\n"],"mappings":";AAUA,SAAgB,2BAA2B,SAAmC;CAC5E,IACE,QAAQ,eAAe,UACvB,QAAQ,eAAe,UACvB,QAAQ,eAAe,cAEvB,MAAM,IAAI,UAAU,+CAA2C;CAEjE,IACE,QAAQ,mBAAmB,WAC1B,CAAC,OAAO,cAAc,QAAQ,cAAc,KAAK,QAAQ,iBAAiB,IAE3E,MAAM,IAAI,WAAW,oDAAoD;AAE7E;AAEA,SAAgB,yBACd,KACA,WACA,SACA;CACA,2BAA2B,OAAO;CAClC,MAAM,QAAQ,QAAQ,kBAAkB;CACxC,MAAM,UAA+D,CAAC;CACtE,MAAM,0BAAU,IAAI,IAAgC;CACpD,IAAI,QAAQ;CACZ,IAAI,SAAS;CACb,IAAI,UAAU;CACd,IAAI;CAEJ,SAAS,OAAO,SAAkB;EAChC,KAAK,MAAM,WAAW,SAAS,QAAQ,OAAO;EAC9C,QAAQ,MAAM;CAChB;CACA,SAAS,UAAU;EACjB,IAAI,IAAI,SAAS,KAAK;EACtB,IAAI,IAAI,SAAS,KAAK;CACxB;CACA,SAAS,QAAQ;EACf,SAAS;EACT,QAAQ,SAAS;EACjB,QAAQ;EACR,aAAa;EACb,QAAQ;EACR,OAAO,KAAK;CACd;CACA,SAAS,QAAQ;EACf,IAAI,UAAU,QAAQ,OAAO,MAAM;EACnC,OAAO,QAAQ,UAAU,CAAC,IAAI,mBAAmB;GAC/C,MAAM,OAAO,QAAQ,MAAM;GAC3B,SAAS,KAAK;GACd,IAAI,MAAM,KAAK,IAAI;EACrB;EACA,IAAI,CAAC,QAAQ,UAAU,CAAC,IAAI,mBAAmB,OAAO,CAAC,MAAM;EAC7D,IAAI,CAAC,QAAQ,UAAU,YAAY;GACjC,MAAM,SAAS;GACf,aAAa;GACb,QAAQ;GACR,OAAO,KAAK;GACZ,OAAO;EACT;CACF;CACA,IAAI,GAAG,SAAS,KAAK;CACrB,IAAI,KAAK,SAAS,KAAK;CAEvB,OAAO;EACL,IAAI,UAAU;GACZ,OAAO;EACT;EACA,IAAI,SAAS;GACX,OAAO;EACT;EACA,IAAI,gBAAgB;GAClB,OAAO,QAAQ,SAAS,KAAK,UAAU;EACzC;EACA,QAAQ,MAAoC;GAC1C,IAAI,OAAO,SAAS,YAAY,EAAE,gBAAgB,aAChD,MAAM,IAAI,UAAU,4CAA4C;GAClE,IAAI,UAAU,UAAU,QAAQ,OAAO;GACvC,MAAM,OAAO,OAAO,SAAS,WAAW,OAAO,WAAW,IAAI,IAAI,KAAK;GACvE,IAAI,SAAS,IAAI,kBAAkB,KAAK,OAAO,OAAO;IACpD,IAAI,QAAQ,eAAe,QAAQ;SAC9B;KACH,UAAU,WAAW;KACrB,MAAM;KACN,IAAI,QAAQ;IACd;IACA,OAAO;GACT;GACA,IAAI,QAAQ,UAAU,IAAI,mBAAmB;IAE3C,QAAQ,KAAK;KAAE,MAAM,OAAO,SAAS,WAAW,OAAO,OAAO,KAAK,IAAI;KAAG,OAAO;IAAK,CAAC;IACvF,SAAS;GACX,OACE,IAAI,MAAM,IAAI;GAEhB,OAAO;EACT;EACA,eAAiC;GAC/B,IAAI,UAAU,UAAU,QAAQ,OAAO,QAAQ,QAAQ,KAAK;GAC5D,IAAI,CAAC,QAAQ,UAAU,CAAC,IAAI,mBAAmB,OAAO,QAAQ,QAAQ,IAAI;GAC1E,OAAO,IAAI,SAAS,YAAY,QAAQ,IAAI,OAAO,CAAC;EACtD;EACA,OAAO,UAAsB;GAC3B,IAAI,UAAU,UAAU,QAAQ;GAChC,SAAS;GACT,aAAa;GACb,MAAM;EACR;CACF;AACF"}
@@ -1,4 +1,4 @@
1
- import config from "@mongez/config";
1
+ import baseConfig from "@mongez/config";
2
2
 
3
3
  //#region ../../packages/core/src/http/build-cors-options.ts
4
4
  /**
@@ -23,7 +23,7 @@ const defaultCorsOptions = {
23
23
  function buildCorsOptions() {
24
24
  return {
25
25
  ...defaultCorsOptions,
26
- ...config.get("http.cors", {})
26
+ ...baseConfig.get("http.cors", {})
27
27
  };
28
28
  }
29
29