@warlock.js/core 5.30.0 → 5.31.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 (797) hide show
  1. package/CHANGELOG.md +142 -36
  2. package/README.md +28 -23
  3. package/bin/source-load-hook.mjs +63 -0
  4. package/bin/warlock.js +102 -42
  5. package/esm/cli/commands/add.command.mjs +4 -2
  6. package/esm/cli/commands/add.command.mjs.map +1 -1
  7. package/esm/cli/commands/agents-md/agents-md-command.action.mjs +69 -0
  8. package/esm/cli/commands/agents-md/agents-md-command.action.mjs.map +1 -0
  9. package/esm/cli/commands/agents-md.command.mjs +38 -0
  10. package/esm/cli/commands/agents-md.command.mjs.map +1 -0
  11. package/esm/cli/commands/board/board-command.action.mjs +279 -0
  12. package/esm/cli/commands/board/board-command.action.mjs.map +1 -0
  13. package/esm/cli/commands/board.command.mjs +78 -0
  14. package/esm/cli/commands/board.command.mjs.map +1 -0
  15. package/esm/cli/commands/build.command.mjs +6 -1
  16. package/esm/cli/commands/build.command.mjs.map +1 -1
  17. package/esm/cli/commands/check/check-command.action.mjs +57 -0
  18. package/esm/cli/commands/check/check-command.action.mjs.map +1 -0
  19. package/esm/cli/commands/check/child-typecheck.mjs +66 -0
  20. package/esm/cli/commands/check/child-typecheck.mjs.map +1 -0
  21. package/esm/cli/commands/check/format-problems.mjs +43 -0
  22. package/esm/cli/commands/check/format-problems.mjs.map +1 -0
  23. package/esm/cli/commands/check/typecheck-command.action.mjs +61 -0
  24. package/esm/cli/commands/check/typecheck-command.action.mjs.map +1 -0
  25. package/esm/cli/commands/check.command.mjs +50 -0
  26. package/esm/cli/commands/check.command.mjs.map +1 -0
  27. package/esm/cli/commands/dev-server.command.mjs +9 -1
  28. package/esm/cli/commands/dev-server.command.mjs.map +1 -1
  29. package/esm/cli/commands/doctor/boot-for-diagnostics.mjs +8 -3
  30. package/esm/cli/commands/doctor/boot-for-diagnostics.mjs.map +1 -1
  31. package/esm/cli/commands/doctor/check.types.d.mts +76 -0
  32. package/esm/cli/commands/doctor/check.types.d.mts.map +1 -0
  33. package/esm/cli/commands/doctor/checks/config.check.mjs +1 -0
  34. package/esm/cli/commands/doctor/checks/config.check.mjs.map +1 -1
  35. package/esm/cli/commands/doctor/checks/connectors.check.mjs +2 -0
  36. package/esm/cli/commands/doctor/checks/connectors.check.mjs.map +1 -1
  37. package/esm/cli/commands/doctor/checks/handler-signature.check.mjs +1 -0
  38. package/esm/cli/commands/doctor/checks/handler-signature.check.mjs.map +1 -1
  39. package/esm/cli/commands/doctor/checks/health.check.mjs +3 -0
  40. package/esm/cli/commands/doctor/checks/health.check.mjs.map +1 -1
  41. package/esm/cli/commands/doctor/checks/jwt-secret.check.mjs +1 -0
  42. package/esm/cli/commands/doctor/checks/jwt-secret.check.mjs.map +1 -1
  43. package/esm/cli/commands/doctor/checks/locales-ts-deprecated.check.mjs +1 -0
  44. package/esm/cli/commands/doctor/checks/locales-ts-deprecated.check.mjs.map +1 -1
  45. package/esm/cli/commands/doctor/checks/optional-peers.check.mjs +1 -0
  46. package/esm/cli/commands/doctor/checks/optional-peers.check.mjs.map +1 -1
  47. package/esm/cli/commands/doctor/checks/release-hygiene.check.mjs +4 -0
  48. package/esm/cli/commands/doctor/checks/release-hygiene.check.mjs.map +1 -1
  49. package/esm/cli/commands/doctor/checks/routes.check.mjs +3 -0
  50. package/esm/cli/commands/doctor/checks/routes.check.mjs.map +1 -1
  51. package/esm/cli/commands/doctor/doctor-command.action.mjs +14 -6
  52. package/esm/cli/commands/doctor/doctor-command.action.mjs.map +1 -1
  53. package/esm/cli/commands/doctor/format-report.mjs +30 -2
  54. package/esm/cli/commands/doctor/format-report.mjs.map +1 -1
  55. package/esm/cli/commands/doctor.command.mjs +4 -0
  56. package/esm/cli/commands/doctor.command.mjs.map +1 -1
  57. package/esm/cli/commands/explain/explain-command.action.mjs +64 -0
  58. package/esm/cli/commands/explain/explain-command.action.mjs.map +1 -0
  59. package/esm/cli/commands/explain.command.mjs +23 -0
  60. package/esm/cli/commands/explain.command.mjs.map +1 -0
  61. package/esm/cli/commands/generate/generate.command.mjs +124 -124
  62. package/esm/cli/commands/generate/generate.command.mjs.map +1 -1
  63. package/esm/cli/commands/generate/generators/endpoint.generator.mjs +311 -0
  64. package/esm/cli/commands/generate/generators/endpoint.generator.mjs.map +1 -0
  65. package/esm/cli/commands/generate/generators/migration.generator.mjs +1 -1
  66. package/esm/cli/commands/generate/generators/migration.generator.mjs.map +1 -1
  67. package/esm/cli/commands/generate/generators/model.generator.mjs +1 -1
  68. package/esm/cli/commands/generate/templates/endpoint-stubs.mjs +341 -0
  69. package/esm/cli/commands/generate/templates/endpoint-stubs.mjs.map +1 -0
  70. package/esm/cli/commands/generate/templates/stubs.mjs +19 -6
  71. package/esm/cli/commands/generate/templates/stubs.mjs.map +1 -1
  72. package/esm/cli/commands/generate/utils/endpoint-schema.mjs +137 -0
  73. package/esm/cli/commands/generate/utils/endpoint-schema.mjs.map +1 -0
  74. package/esm/cli/commands/generate/utils/name-parser.mjs +1 -1
  75. package/esm/cli/commands/generate/utils/name-parser.mjs.map +1 -1
  76. package/esm/cli/commands/generate/utils/prompt.mjs.map +1 -1
  77. package/esm/cli/commands/generate/utils/writer.mjs +38 -13
  78. package/esm/cli/commands/generate/utils/writer.mjs.map +1 -1
  79. package/esm/cli/commands/inspect/inspect-command.action.mjs +72 -0
  80. package/esm/cli/commands/inspect/inspect-command.action.mjs.map +1 -0
  81. package/esm/cli/commands/inspect.command.mjs +39 -0
  82. package/esm/cli/commands/inspect.command.mjs.map +1 -0
  83. package/esm/cli/commands/mcp/mcp-command.action.mjs +103 -0
  84. package/esm/cli/commands/mcp/mcp-command.action.mjs.map +1 -0
  85. package/esm/cli/commands/mcp.command.mjs +76 -0
  86. package/esm/cli/commands/mcp.command.mjs.map +1 -0
  87. package/esm/cli/commands/openapi-generator.action.mjs.map +1 -1
  88. package/esm/cli/commands/openapi-generator.command.mjs.map +1 -1
  89. package/esm/cli/commands/postman-generator.action.mjs.map +1 -1
  90. package/esm/cli/commands/postman-generator.command.mjs.map +1 -1
  91. package/esm/cli/commands/routes/routes-diff.action.mjs +1 -1
  92. package/esm/cli/commands/test.command.mjs +131 -0
  93. package/esm/cli/commands/test.command.mjs.map +1 -0
  94. package/esm/cli/commands/trace/trace-command.action.mjs +145 -0
  95. package/esm/cli/commands/trace/trace-command.action.mjs.map +1 -0
  96. package/esm/cli/commands/trace.command.mjs +60 -0
  97. package/esm/cli/commands/trace.command.mjs.map +1 -0
  98. package/esm/cli/commands/typecheck.command.mjs +40 -0
  99. package/esm/cli/commands/typecheck.command.mjs.map +1 -0
  100. package/esm/cli/commands/upgrade.command.mjs +46 -0
  101. package/esm/cli/commands/upgrade.command.mjs.map +1 -0
  102. package/esm/cli/flush-and-exit.mjs +34 -0
  103. package/esm/cli/flush-and-exit.mjs.map +1 -0
  104. package/esm/cli/framework-cli-commands.mjs +23 -1
  105. package/esm/cli/framework-cli-commands.mjs.map +1 -1
  106. package/esm/cli/parse-cli-args.mjs +1 -0
  107. package/esm/cli/parse-cli-args.mjs.map +1 -1
  108. package/esm/config/config-loader.d.mts.map +1 -1
  109. package/esm/config/config-loader.mjs +34 -13
  110. package/esm/config/config-loader.mjs.map +1 -1
  111. package/esm/config/config-schema.d.mts +67 -0
  112. package/esm/config/config-schema.d.mts.map +1 -0
  113. package/esm/config/config-schema.mjs +77 -0
  114. package/esm/config/config-schema.mjs.map +1 -0
  115. package/esm/config/index.d.mts +6 -0
  116. package/esm/config/index.mjs +1 -0
  117. package/esm/connectors/assert-no-reserved-connector-names.d.mts.map +1 -1
  118. package/esm/connectors/assert-no-reserved-connector-names.mjs +2 -1
  119. package/esm/connectors/assert-no-reserved-connector-names.mjs.map +1 -1
  120. package/esm/connectors/assert-unique-connector-names.d.mts.map +1 -1
  121. package/esm/connectors/assert-unique-connector-names.mjs +26 -2
  122. package/esm/connectors/assert-unique-connector-names.mjs.map +1 -1
  123. package/esm/connectors/http-connector.d.mts.map +1 -1
  124. package/esm/connectors/http-connector.mjs +3 -2
  125. package/esm/connectors/http-connector.mjs.map +1 -1
  126. package/esm/connectors/single-server-warnings.mjs.map +1 -1
  127. package/esm/connectors/socket-connector.d.mts.map +1 -1
  128. package/esm/connectors/socket-connector.mjs.map +1 -1
  129. package/esm/container/index.d.mts.map +1 -1
  130. package/esm/container/index.mjs.map +1 -1
  131. package/esm/database/migrate-action.mjs.map +1 -1
  132. package/esm/database/models/database-log/database-log.d.mts +0 -28
  133. package/esm/database/models/database-log/database-log.d.mts.map +1 -1
  134. package/esm/database/seeds/seeder.errors.d.mts +4 -0
  135. package/esm/database/seeds/seeder.errors.d.mts.map +1 -1
  136. package/esm/database/seeds/seeder.errors.mjs +2 -0
  137. package/esm/database/seeds/seeder.errors.mjs.map +1 -1
  138. package/esm/dev-server/boot-precondition-error.mjs +1 -0
  139. package/esm/dev-server/boot-precondition-error.mjs.map +1 -1
  140. package/esm/dev-server/create-worker.mjs +15 -9
  141. package/esm/dev-server/create-worker.mjs.map +1 -1
  142. package/esm/dev-server/dev-agent-tooling.mjs +135 -0
  143. package/esm/dev-server/dev-agent-tooling.mjs.map +1 -0
  144. package/esm/dev-server/dev-logger.mjs.map +1 -1
  145. package/esm/dev-server/development-server.mjs +8 -0
  146. package/esm/dev-server/development-server.mjs.map +1 -1
  147. package/esm/dev-server/files-orchestrator.mjs +4 -5
  148. package/esm/dev-server/files-orchestrator.mjs.map +1 -1
  149. package/esm/dev-server/files-watcher.mjs +1 -1
  150. package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs +2 -3
  151. package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs.map +1 -1
  152. package/esm/dev-server/health-checker/checkers/oxlint-health-checker.mjs +33 -0
  153. package/esm/dev-server/health-checker/checkers/oxlint-health-checker.mjs.map +1 -0
  154. package/esm/dev-server/health-checker/default-health-checkers.mjs +31 -0
  155. package/esm/dev-server/health-checker/default-health-checkers.mjs.map +1 -0
  156. package/esm/dev-server/health-checker/file-health-checker.contract.d.mts +9 -3
  157. package/esm/dev-server/health-checker/file-health-checker.contract.d.mts.map +1 -1
  158. package/esm/dev-server/health-checker/files-healthcare.manager.mjs +15 -4
  159. package/esm/dev-server/health-checker/files-healthcare.manager.mjs.map +1 -1
  160. package/esm/dev-server/health-checker/oxlint-runner.mjs +302 -0
  161. package/esm/dev-server/health-checker/oxlint-runner.mjs.map +1 -0
  162. package/esm/dev-server/health-checker/workers/oxlint-health.worker.d.mts +1 -0
  163. package/esm/dev-server/health-checker/workers/oxlint-health.worker.mjs +42 -0
  164. package/esm/dev-server/health-checker/workers/oxlint-health.worker.mjs.map +1 -0
  165. package/esm/dev-server/loader/loader-port-acks.mjs +1 -1
  166. package/esm/dev-server/loader/loader-port-acks.mjs.map +1 -1
  167. package/esm/dev-server/loader/register-loader.mjs +1 -1
  168. package/esm/dev-server/loader/register-loader.mjs.map +1 -1
  169. package/esm/dev-server/loader/resolve-hook.mjs +1 -1
  170. package/esm/dev-server/loader/transpile-cache.mjs +1 -1
  171. package/esm/dev-server/model-resource-typings.mjs.map +1 -1
  172. package/esm/dev-server/module-loader.mjs +1 -0
  173. package/esm/dev-server/module-loader.mjs.map +1 -1
  174. package/esm/dev-server/parse-imports.mjs +1 -1
  175. package/esm/dev-server/parse-imports.mjs.map +1 -1
  176. package/esm/dev-server/route-types-publisher.mjs +1 -1
  177. package/esm/dev-server/start-development-server.mjs.map +1 -1
  178. package/esm/dev-server/translation-keys-sources.mjs +1 -1
  179. package/esm/dev-server/translation-keys-sources.mjs.map +1 -1
  180. package/esm/dev-server/tsconfig-manager.mjs.map +1 -1
  181. package/esm/dev-server/type-generator.mjs +3 -3
  182. package/esm/dev-server/type-generator.mjs.map +1 -1
  183. package/esm/dev-server/types.d.mts.map +1 -1
  184. package/esm/errors/container-key-missing-error.mjs +1 -0
  185. package/esm/errors/container-key-missing-error.mjs.map +1 -1
  186. package/esm/errors/error-codes.d.mts +653 -0
  187. package/esm/errors/error-codes.d.mts.map +1 -0
  188. package/esm/errors/error-codes.mjs +634 -0
  189. package/esm/errors/error-codes.mjs.map +1 -0
  190. package/esm/errors/esbuild-binary-missing-error.mjs +1 -0
  191. package/esm/errors/esbuild-binary-missing-error.mjs.map +1 -1
  192. package/esm/errors/index.d.mts +3 -1
  193. package/esm/errors/index.mjs +3 -1
  194. package/esm/errors/unknown-locale-error.mjs +1 -0
  195. package/esm/errors/unknown-locale-error.mjs.map +1 -1
  196. package/esm/errors/warlock-error.d.mts +23 -0
  197. package/esm/errors/warlock-error.d.mts.map +1 -0
  198. package/esm/errors/warlock-error.mjs +22 -0
  199. package/esm/errors/warlock-error.mjs.map +1 -0
  200. package/esm/generations/add-command.action.mjs +19 -3
  201. package/esm/generations/add-command.action.mjs.map +1 -1
  202. package/esm/generations/features/access.feature.mjs +1 -1
  203. package/esm/generations/features/access.feature.mjs.map +1 -1
  204. package/esm/generations/features/bull-board.feature.mjs +1 -1
  205. package/esm/generations/features/bull-board.feature.mjs.map +1 -1
  206. package/esm/generations/features/mysql.feature.mjs.map +1 -1
  207. package/esm/generations/features/notifications.feature.mjs +5 -2
  208. package/esm/generations/features/notifications.feature.mjs.map +1 -1
  209. package/esm/generations/features/queue.feature.mjs +1 -1
  210. package/esm/generations/features/queue.feature.mjs.map +1 -1
  211. package/esm/generations/features/react-email.feature.mjs +1 -1
  212. package/esm/generations/features/react-email.feature.mjs.map +1 -1
  213. package/esm/generations/features/shadcn.feature.mjs +1 -1
  214. package/esm/generations/features/shadcn.feature.mjs.map +1 -1
  215. package/esm/generations/features/shared/link-ai-package-import.mjs +1 -1
  216. package/esm/generations/features/shared/link-ai-package-import.mjs.map +1 -1
  217. package/esm/generations/features/shared/merge-web-sitemap-config.mjs.map +1 -1
  218. package/esm/generations/features/shared/patch-tsconfig-include.mjs +1 -1
  219. package/esm/generations/features/shared/patch-tsconfig-include.mjs.map +1 -1
  220. package/esm/generations/features/shared/relocate-conflicting-home-route.mjs +1 -1
  221. package/esm/generations/features/shared/relocate-conflicting-home-route.mjs.map +1 -1
  222. package/esm/generations/features/sitemap.feature.mjs +1 -1
  223. package/esm/generations/features/sitemap.feature.mjs.map +1 -1
  224. package/esm/generations/features/tailwind.feature.mjs +1 -1
  225. package/esm/generations/features/tailwind.feature.mjs.map +1 -1
  226. package/esm/generations/features/test.feature.mjs +11 -6
  227. package/esm/generations/features/test.feature.mjs.map +1 -1
  228. package/esm/generations/features/web.feature.mjs +1 -1
  229. package/esm/generations/features/web.feature.mjs.map +1 -1
  230. package/esm/generations/generation-fs.mjs +73 -0
  231. package/esm/generations/generation-fs.mjs.map +1 -0
  232. package/esm/generations/generation-run.mjs +185 -0
  233. package/esm/generations/generation-run.mjs.map +1 -0
  234. package/esm/generations/stubs.mjs +155 -13
  235. package/esm/generations/stubs.mjs.map +1 -1
  236. package/esm/http/bounded-stream-queue.d.mts +10 -0
  237. package/esm/http/bounded-stream-queue.d.mts.map +1 -0
  238. package/esm/http/bounded-stream-queue.mjs +97 -0
  239. package/esm/http/bounded-stream-queue.mjs.map +1 -0
  240. package/esm/http/build-rate-limit-options.d.mts +13 -0
  241. package/esm/http/build-rate-limit-options.d.mts.map +1 -1
  242. package/esm/http/build-rate-limit-options.mjs.map +1 -1
  243. package/esm/http/conditional-request.d.mts +86 -0
  244. package/esm/http/conditional-request.d.mts.map +1 -0
  245. package/esm/http/conditional-request.mjs +121 -0
  246. package/esm/http/conditional-request.mjs.map +1 -0
  247. package/esm/http/csp.d.mts +2 -0
  248. package/esm/http/csp.d.mts.map +1 -1
  249. package/esm/http/csp.mjs +1 -0
  250. package/esm/http/csp.mjs.map +1 -1
  251. package/esm/http/csrf-origin-policy.mjs.map +1 -1
  252. package/esm/http/database/RequestLog.d.mts +24 -84
  253. package/esm/http/database/RequestLog.d.mts.map +1 -1
  254. package/esm/http/errors/errors.d.mts +2 -0
  255. package/esm/http/errors/errors.d.mts.map +1 -1
  256. package/esm/http/errors/errors.mjs +1 -0
  257. package/esm/http/errors/errors.mjs.map +1 -1
  258. package/esm/http/escape-header-value.d.mts +18 -0
  259. package/esm/http/escape-header-value.d.mts.map +1 -0
  260. package/esm/http/escape-header-value.mjs +27 -0
  261. package/esm/http/escape-header-value.mjs.map +1 -0
  262. package/esm/http/flush-pending-cookies.mjs.map +1 -1
  263. package/esm/http/index.d.mts +5 -2
  264. package/esm/http/index.mjs +4 -1
  265. package/esm/http/lazy-static.mjs +194 -0
  266. package/esm/http/lazy-static.mjs.map +1 -0
  267. package/esm/http/middleware/idempotency.middleware.mjs.map +1 -1
  268. package/esm/http/plugins.d.mts.map +1 -1
  269. package/esm/http/plugins.mjs +7 -4
  270. package/esm/http/plugins.mjs.map +1 -1
  271. package/esm/http/rate-limit-cache-store.mjs +2 -1
  272. package/esm/http/rate-limit-cache-store.mjs.map +1 -1
  273. package/esm/http/request-log-snapshot.d.mts +12 -5
  274. package/esm/http/request-log-snapshot.d.mts.map +1 -1
  275. package/esm/http/request-log-snapshot.mjs +83 -4
  276. package/esm/http/request-log-snapshot.mjs.map +1 -1
  277. package/esm/http/request.d.mts +2 -2
  278. package/esm/http/request.d.mts.map +1 -1
  279. package/esm/http/request.mjs +5 -4
  280. package/esm/http/request.mjs.map +1 -1
  281. package/esm/http/response.d.mts +11 -1
  282. package/esm/http/response.d.mts.map +1 -1
  283. package/esm/http/response.mjs +164 -76
  284. package/esm/http/response.mjs.map +1 -1
  285. package/esm/http/safe-redirect.d.mts +51 -0
  286. package/esm/http/safe-redirect.d.mts.map +1 -0
  287. package/esm/http/safe-redirect.mjs +80 -0
  288. package/esm/http/safe-redirect.mjs.map +1 -0
  289. package/esm/http/serialized.d.mts.map +1 -1
  290. package/esm/http/server.d.mts +3 -1
  291. package/esm/http/server.d.mts.map +1 -1
  292. package/esm/http/server.mjs +14 -4
  293. package/esm/http/server.mjs.map +1 -1
  294. package/esm/http/stream-transport.mjs +4 -2
  295. package/esm/http/stream-transport.mjs.map +1 -1
  296. package/esm/http/types.d.mts +44 -11
  297. package/esm/http/types.d.mts.map +1 -1
  298. package/esm/http/uploads/generate-image-variant.mjs +1 -1
  299. package/esm/http/uploads/generate-image-variants.d.mts +10 -7
  300. package/esm/http/uploads/generate-image-variants.d.mts.map +1 -1
  301. package/esm/http/uploads/generate-image-variants.mjs +61 -24
  302. package/esm/http/uploads/generate-image-variants.mjs.map +1 -1
  303. package/esm/http/uploads/image-variant-cache-entries.mjs +78 -0
  304. package/esm/http/uploads/image-variant-cache-entries.mjs.map +1 -0
  305. package/esm/http/uploads/image-variant-cache.mjs +72 -30
  306. package/esm/http/uploads/image-variant-cache.mjs.map +1 -1
  307. package/esm/http/uploads/image-variant-types.d.mts +2 -0
  308. package/esm/http/uploads/image-variant-types.d.mts.map +1 -1
  309. package/esm/http/uploads/image-variants-config-error.d.mts +3 -1
  310. package/esm/http/uploads/image-variants-config-error.d.mts.map +1 -1
  311. package/esm/http/uploads/image-variants-config-error.mjs +3 -2
  312. package/esm/http/uploads/image-variants-config-error.mjs.map +1 -1
  313. package/esm/http/uploads/load-variant-source.mjs +1 -1
  314. package/esm/http/uploads/load-variant-source.mjs.map +1 -1
  315. package/esm/http/uploads/purge-image-variants.d.mts +7 -2
  316. package/esm/http/uploads/purge-image-variants.d.mts.map +1 -1
  317. package/esm/http/uploads/purge-image-variants.mjs +16 -16
  318. package/esm/http/uploads/purge-image-variants.mjs.map +1 -1
  319. package/esm/http/uploads/remote-variant-source.mjs +115 -0
  320. package/esm/http/uploads/remote-variant-source.mjs.map +1 -0
  321. package/esm/http/uploads/resolve-image-variant.d.mts +3 -4
  322. package/esm/http/uploads/resolve-image-variant.d.mts.map +1 -1
  323. package/esm/http/uploads/resolve-image-variant.mjs +10 -18
  324. package/esm/http/uploads/resolve-image-variant.mjs.map +1 -1
  325. package/esm/http/uploads/resolve-image-variants-config.mjs +5 -3
  326. package/esm/http/uploads/resolve-image-variants-config.mjs.map +1 -1
  327. package/esm/http/uploads/resolve-remote-image-variant.mjs +89 -0
  328. package/esm/http/uploads/resolve-remote-image-variant.mjs.map +1 -0
  329. package/esm/http/uploads/trim-image-variant-cache.mjs +193 -0
  330. package/esm/http/uploads/trim-image-variant-cache.mjs.map +1 -0
  331. package/esm/http/uploads/uploaded-file.controller.d.mts +5 -3
  332. package/esm/http/uploads/uploaded-file.controller.d.mts.map +1 -1
  333. package/esm/http/uploads/uploaded-file.controller.mjs +16 -8
  334. package/esm/http/uploads/uploaded-file.controller.mjs.map +1 -1
  335. package/esm/http/uploads/variant-cache-key.mjs +1 -1
  336. package/esm/http/uploads-types.d.mts +6 -2
  337. package/esm/http/uploads-types.d.mts.map +1 -1
  338. package/esm/index.d.mts +17 -6
  339. package/esm/index.mjs +14 -3
  340. package/esm/localization/parse-locale-dictionary.d.mts +2 -0
  341. package/esm/localization/parse-locale-dictionary.d.mts.map +1 -1
  342. package/esm/localization/parse-locale-dictionary.mjs +1 -0
  343. package/esm/localization/parse-locale-dictionary.mjs.map +1 -1
  344. package/esm/mail/config.d.mts +12 -1
  345. package/esm/mail/config.d.mts.map +1 -1
  346. package/esm/mail/config.mjs +16 -1
  347. package/esm/mail/config.mjs.map +1 -1
  348. package/esm/mail/index.d.mts +1 -1
  349. package/esm/mail/index.mjs +1 -1
  350. package/esm/net/index.d.mts +2 -0
  351. package/esm/net/index.mjs +3 -0
  352. package/esm/openapi/build-openapi-document.d.mts.map +1 -1
  353. package/esm/openapi/build-openapi-document.mjs +8 -5
  354. package/esm/openapi/build-openapi-document.mjs.map +1 -1
  355. package/esm/openapi/error-responses.mjs +28 -2
  356. package/esm/openapi/error-responses.mjs.map +1 -1
  357. package/esm/openapi/postman/build-request-body.mjs.map +1 -1
  358. package/esm/openapi/postman/build-request-url.mjs.map +1 -1
  359. package/esm/openapi/postman/build-saved-responses.mjs.map +1 -1
  360. package/esm/openapi/postman/example-from-schema.d.mts.map +1 -1
  361. package/esm/openapi/postman/example-from-schema.mjs.map +1 -1
  362. package/esm/openapi/postman/openapi-to-postman-collection.d.mts.map +1 -1
  363. package/esm/openapi/postman/openapi-to-postman-collection.mjs.map +1 -1
  364. package/esm/openapi/postman/schema-refs.mjs.map +1 -1
  365. package/esm/openapi/postman/uuid-v5.mjs.map +1 -1
  366. package/esm/openapi/request-schemas.mjs.map +1 -1
  367. package/esm/openapi/response-schemas.mjs.map +1 -1
  368. package/esm/openapi/schema-registry.d.mts +1 -0
  369. package/esm/openapi/schema-registry.mjs.map +1 -1
  370. package/esm/openapi/security.mjs.map +1 -1
  371. package/esm/openapi/types.d.mts +3 -2
  372. package/esm/openapi/types.d.mts.map +1 -1
  373. package/esm/production/assert-generated-imports.mjs +1 -0
  374. package/esm/production/assert-generated-imports.mjs.map +1 -1
  375. package/esm/production/production-builder.mjs +12 -4
  376. package/esm/production/production-builder.mjs.map +1 -1
  377. package/esm/production/resolve-build-config.mjs +1 -0
  378. package/esm/production/resolve-build-config.mjs.map +1 -1
  379. package/esm/production/route-registration-child.mjs.map +1 -1
  380. package/esm/production/route-registration-snapshot.mjs.map +1 -1
  381. package/esm/repositories/contracts/query-builder.contract.d.mts.map +1 -1
  382. package/esm/repositories/contracts/types.d.mts.map +1 -1
  383. package/esm/repositories/repository.manager.mjs.map +1 -1
  384. package/esm/resource/resource.d.mts.map +1 -1
  385. package/esm/resource/resource.mjs.map +1 -1
  386. package/esm/resource/types.d.mts.map +1 -1
  387. package/esm/restful/restful.d.mts +5 -5
  388. package/esm/restful/restful.d.mts.map +1 -1
  389. package/esm/restful/restful.mjs.map +1 -1
  390. package/esm/router/build-route-rate-limit.mjs.map +1 -1
  391. package/esm/router/dev-dispatch.mjs +31 -12
  392. package/esm/router/dev-dispatch.mjs.map +1 -1
  393. package/esm/router/index.d.mts +4 -2
  394. package/esm/router/index.mjs +2 -0
  395. package/esm/router/log-request-lifecycle.mjs.map +1 -1
  396. package/esm/router/positional-handler-diagnostics.d.mts.map +1 -1
  397. package/esm/router/positional-handler-diagnostics.mjs.map +1 -1
  398. package/esm/router/resolve-route-rate-limit.mjs +47 -0
  399. package/esm/router/resolve-route-rate-limit.mjs.map +1 -0
  400. package/esm/router/resolve-route-validation.mjs +19 -0
  401. package/esm/router/resolve-route-validation.mjs.map +1 -0
  402. package/esm/router/route-guard-names.mjs +30 -0
  403. package/esm/router/route-guard-names.mjs.map +1 -0
  404. package/esm/router/route-name-taken-error.d.mts +14 -0
  405. package/esm/router/route-name-taken-error.d.mts.map +1 -0
  406. package/esm/router/route-name-taken-error.mjs +18 -0
  407. package/esm/router/route-name-taken-error.mjs.map +1 -0
  408. package/esm/router/router.d.mts +32 -13
  409. package/esm/router/router.d.mts.map +1 -1
  410. package/esm/router/router.mjs +71 -38
  411. package/esm/router/router.mjs.map +1 -1
  412. package/esm/router/types.d.mts +137 -17
  413. package/esm/router/types.d.mts.map +1 -1
  414. package/esm/router/unguarded-route-diagnostics.d.mts +40 -0
  415. package/esm/router/unguarded-route-diagnostics.d.mts.map +1 -0
  416. package/esm/router/unguarded-route-diagnostics.mjs +95 -0
  417. package/esm/router/unguarded-route-diagnostics.mjs.map +1 -0
  418. package/esm/storage/drivers/cloud-driver.d.mts.map +1 -1
  419. package/esm/storage/drivers/cloud-driver.mjs.map +1 -1
  420. package/esm/storage/drivers/local-driver.d.mts.map +1 -1
  421. package/esm/storage/drivers/local-driver.mjs.map +1 -1
  422. package/esm/storage/local-disk-roots.mjs +24 -0
  423. package/esm/storage/local-disk-roots.mjs.map +1 -0
  424. package/esm/storage/storage.d.mts +14 -0
  425. package/esm/storage/storage.d.mts.map +1 -1
  426. package/esm/storage/storage.mjs +22 -0
  427. package/esm/storage/storage.mjs.map +1 -1
  428. package/esm/storage/types.d.mts.map +1 -1
  429. package/esm/storage/utils/storage-not-initialized-error.d.mts +2 -0
  430. package/esm/storage/utils/storage-not-initialized-error.d.mts.map +1 -1
  431. package/esm/storage/utils/storage-not-initialized-error.mjs +1 -0
  432. package/esm/storage/utils/storage-not-initialized-error.mjs.map +1 -1
  433. package/esm/tests/authenticated-test-client.d.mts +32 -0
  434. package/esm/tests/authenticated-test-client.d.mts.map +1 -0
  435. package/esm/tests/authenticated-test-client.mjs +40 -0
  436. package/esm/tests/authenticated-test-client.mjs.map +1 -0
  437. package/esm/tests/factories.d.mts +59 -0
  438. package/esm/tests/factories.d.mts.map +1 -0
  439. package/esm/tests/factories.mjs +105 -0
  440. package/esm/tests/factories.mjs.map +1 -0
  441. package/esm/tests/fakes/cache-fake.d.mts +29 -0
  442. package/esm/tests/fakes/cache-fake.d.mts.map +1 -0
  443. package/esm/tests/fakes/cache-fake.mjs +79 -0
  444. package/esm/tests/fakes/cache-fake.mjs.map +1 -0
  445. package/esm/tests/fakes/clock-fake.d.mts +32 -0
  446. package/esm/tests/fakes/clock-fake.d.mts.map +1 -0
  447. package/esm/tests/fakes/clock-fake.mjs +69 -0
  448. package/esm/tests/fakes/clock-fake.mjs.map +1 -0
  449. package/esm/tests/fakes/fake-assertion-error.d.mts +13 -0
  450. package/esm/tests/fakes/fake-assertion-error.d.mts.map +1 -0
  451. package/esm/tests/fakes/fake-assertion-error.mjs +20 -0
  452. package/esm/tests/fakes/fake-assertion-error.mjs.map +1 -0
  453. package/esm/tests/fakes/ids-fake.d.mts +22 -0
  454. package/esm/tests/fakes/ids-fake.d.mts.map +1 -0
  455. package/esm/tests/fakes/ids-fake.mjs +57 -0
  456. package/esm/tests/fakes/ids-fake.mjs.map +1 -0
  457. package/esm/tests/fakes/index.d.mts +8 -0
  458. package/esm/tests/fakes/index.mjs +10 -0
  459. package/esm/tests/fakes/mail-fake.d.mts +41 -0
  460. package/esm/tests/fakes/mail-fake.d.mts.map +1 -0
  461. package/esm/tests/fakes/mail-fake.mjs +111 -0
  462. package/esm/tests/fakes/mail-fake.mjs.map +1 -0
  463. package/esm/tests/fakes/queue-fake.d.mts +48 -0
  464. package/esm/tests/fakes/queue-fake.d.mts.map +1 -0
  465. package/esm/tests/fakes/queue-fake.mjs +134 -0
  466. package/esm/tests/fakes/queue-fake.mjs.map +1 -0
  467. package/esm/tests/fakes/storage-fake.d.mts +31 -0
  468. package/esm/tests/fakes/storage-fake.d.mts.map +1 -0
  469. package/esm/tests/fakes/storage-fake.mjs +122 -0
  470. package/esm/tests/fakes/storage-fake.mjs.map +1 -0
  471. package/esm/tests/fakes/test-fakes.d.mts +39 -0
  472. package/esm/tests/fakes/test-fakes.d.mts.map +1 -0
  473. package/esm/tests/fakes/test-fakes.mjs +90 -0
  474. package/esm/tests/fakes/test-fakes.mjs.map +1 -0
  475. package/esm/tests/index.d.mts +14 -2
  476. package/esm/tests/index.mjs +15 -2
  477. package/esm/tests/snapshot-response.d.mts +34 -0
  478. package/esm/tests/snapshot-response.d.mts.map +1 -0
  479. package/esm/tests/snapshot-response.mjs +42 -0
  480. package/esm/tests/snapshot-response.mjs.map +1 -0
  481. package/esm/tests/start-http-development-server.d.mts +22 -0
  482. package/esm/tests/start-http-development-server.d.mts.map +1 -1
  483. package/esm/tests/start-http-development-server.mjs +36 -3
  484. package/esm/tests/start-http-development-server.mjs.map +1 -1
  485. package/esm/tests/test-helpers.d.mts +20 -1
  486. package/esm/tests/test-helpers.d.mts.map +1 -1
  487. package/esm/tests/test-helpers.mjs +40 -27
  488. package/esm/tests/test-helpers.mjs.map +1 -1
  489. package/esm/tests/test-http-server.d.mts +62 -0
  490. package/esm/tests/test-http-server.d.mts.map +1 -0
  491. package/esm/tests/test-http-server.mjs +119 -0
  492. package/esm/tests/test-http-server.mjs.map +1 -0
  493. package/esm/tests/vitest-setup.d.mts +11 -0
  494. package/esm/tests/vitest-setup.d.mts.map +1 -1
  495. package/esm/tests/vitest-setup.mjs +12 -4
  496. package/esm/tests/vitest-setup.mjs.map +1 -1
  497. package/esm/tooling/agents-md/agents-md-markers.d.mts +27 -0
  498. package/esm/tooling/agents-md/agents-md-markers.d.mts.map +1 -0
  499. package/esm/tooling/agents-md/agents-md-markers.mjs +59 -0
  500. package/esm/tooling/agents-md/agents-md-markers.mjs.map +1 -0
  501. package/esm/tooling/agents-md/agents-md-refresher.d.mts +36 -0
  502. package/esm/tooling/agents-md/agents-md-refresher.d.mts.map +1 -0
  503. package/esm/tooling/agents-md/agents-md-refresher.mjs +72 -0
  504. package/esm/tooling/agents-md/agents-md-refresher.mjs.map +1 -0
  505. package/esm/tooling/agents-md/index.mjs +7 -0
  506. package/esm/tooling/agents-md/installed-skills.d.mts +30 -0
  507. package/esm/tooling/agents-md/installed-skills.d.mts.map +1 -0
  508. package/esm/tooling/agents-md/installed-skills.mjs +74 -0
  509. package/esm/tooling/agents-md/installed-skills.mjs.map +1 -0
  510. package/esm/tooling/agents-md/render-agents-md.d.mts +33 -0
  511. package/esm/tooling/agents-md/render-agents-md.d.mts.map +1 -0
  512. package/esm/tooling/agents-md/render-agents-md.mjs +195 -0
  513. package/esm/tooling/agents-md/render-agents-md.mjs.map +1 -0
  514. package/esm/tooling/agents-md/write-agents-md.d.mts +33 -0
  515. package/esm/tooling/agents-md/write-agents-md.d.mts.map +1 -0
  516. package/esm/tooling/agents-md/write-agents-md.mjs +49 -0
  517. package/esm/tooling/agents-md/write-agents-md.mjs.map +1 -0
  518. package/esm/tooling/board/board-message.d.mts +31 -0
  519. package/esm/tooling/board/board-message.d.mts.map +1 -0
  520. package/esm/tooling/board/board-message.mjs +86 -0
  521. package/esm/tooling/board/board-message.mjs.map +1 -0
  522. package/esm/tooling/board/board.d.mts +109 -0
  523. package/esm/tooling/board/board.d.mts.map +1 -0
  524. package/esm/tooling/board/board.mjs +406 -0
  525. package/esm/tooling/board/board.mjs.map +1 -0
  526. package/esm/tooling/board/board.types.d.mts +72 -0
  527. package/esm/tooling/board/board.types.d.mts.map +1 -0
  528. package/esm/tooling/board/board.types.mjs +54 -0
  529. package/esm/tooling/board/board.types.mjs.map +1 -0
  530. package/esm/tooling/check/changed-files.d.mts +33 -0
  531. package/esm/tooling/check/changed-files.d.mts.map +1 -0
  532. package/esm/tooling/check/changed-files.mjs +73 -0
  533. package/esm/tooling/check/changed-files.mjs.map +1 -0
  534. package/esm/tooling/check/check-report.types.d.mts +62 -0
  535. package/esm/tooling/check/check-report.types.d.mts.map +1 -0
  536. package/esm/tooling/check/check-report.types.mjs +37 -0
  537. package/esm/tooling/check/check-report.types.mjs.map +1 -0
  538. package/esm/tooling/check/code-style-conventions.mjs +106 -0
  539. package/esm/tooling/check/code-style-conventions.mjs.map +1 -0
  540. package/esm/tooling/check/conventions-step.d.mts +34 -0
  541. package/esm/tooling/check/conventions-step.d.mts.map +1 -0
  542. package/esm/tooling/check/conventions-step.mjs +184 -0
  543. package/esm/tooling/check/conventions-step.mjs.map +1 -0
  544. package/esm/tooling/check/environment-step.d.mts +18 -0
  545. package/esm/tooling/check/environment-step.d.mts.map +1 -0
  546. package/esm/tooling/check/environment-step.mjs +78 -0
  547. package/esm/tooling/check/environment-step.mjs.map +1 -0
  548. package/esm/tooling/check/index.d.mts +8 -0
  549. package/esm/tooling/check/index.mjs +10 -0
  550. package/esm/tooling/check/lint-step.d.mts +19 -0
  551. package/esm/tooling/check/lint-step.d.mts.map +1 -0
  552. package/esm/tooling/check/lint-step.mjs +111 -0
  553. package/esm/tooling/check/lint-step.mjs.map +1 -0
  554. package/esm/tooling/check/request-input.mjs +132 -0
  555. package/esm/tooling/check/request-input.mjs.map +1 -0
  556. package/esm/tooling/check/run-check.d.mts +35 -0
  557. package/esm/tooling/check/run-check.d.mts.map +1 -0
  558. package/esm/tooling/check/run-check.mjs +192 -0
  559. package/esm/tooling/check/run-check.mjs.map +1 -0
  560. package/esm/tooling/check/run-tests.d.mts +48 -0
  561. package/esm/tooling/check/run-tests.d.mts.map +1 -0
  562. package/esm/tooling/check/run-tests.mjs +93 -0
  563. package/esm/tooling/check/run-tests.mjs.map +1 -0
  564. package/esm/tooling/check/security-conventions.mjs +648 -0
  565. package/esm/tooling/check/security-conventions.mjs.map +1 -0
  566. package/esm/tooling/check/source-ast.mjs +195 -0
  567. package/esm/tooling/check/source-ast.mjs.map +1 -0
  568. package/esm/tooling/check/source-files.mjs +27 -0
  569. package/esm/tooling/check/source-files.mjs.map +1 -0
  570. package/esm/tooling/check/tests-step.d.mts +34 -0
  571. package/esm/tooling/check/tests-step.d.mts.map +1 -0
  572. package/esm/tooling/check/tests-step.mjs +177 -0
  573. package/esm/tooling/check/tests-step.mjs.map +1 -0
  574. package/esm/tooling/dev-state/dev-server-state.d.mts +39 -0
  575. package/esm/tooling/dev-state/dev-server-state.d.mts.map +1 -0
  576. package/esm/tooling/dev-state/dev-server-state.mjs +67 -0
  577. package/esm/tooling/dev-state/dev-server-state.mjs.map +1 -0
  578. package/esm/tooling/devtools/devtools-client.d.mts +91 -0
  579. package/esm/tooling/devtools/devtools-client.d.mts.map +1 -0
  580. package/esm/tooling/devtools/devtools-client.mjs +155 -0
  581. package/esm/tooling/devtools/devtools-client.mjs.map +1 -0
  582. package/esm/tooling/generate/generation.d.mts +78 -0
  583. package/esm/tooling/generate/generation.d.mts.map +1 -0
  584. package/esm/tooling/generate/generation.mjs +123 -0
  585. package/esm/tooling/generate/generation.mjs.map +1 -0
  586. package/esm/tooling/generate/generator-spec.d.mts +57 -0
  587. package/esm/tooling/generate/generator-spec.d.mts.map +1 -0
  588. package/esm/tooling/generate/generator-spec.mjs +102 -0
  589. package/esm/tooling/generate/generator-spec.mjs.map +1 -0
  590. package/esm/tooling/generate/index.mjs +6 -0
  591. package/esm/tooling/generate/project-files.mjs +121 -0
  592. package/esm/tooling/generate/project-files.mjs.map +1 -0
  593. package/esm/tooling/generate/run-cli.d.mts +40 -0
  594. package/esm/tooling/generate/run-cli.d.mts.map +1 -0
  595. package/esm/tooling/generate/run-cli.mjs +93 -0
  596. package/esm/tooling/generate/run-cli.mjs.map +1 -0
  597. package/esm/tooling/generate/unified-diff.d.mts +37 -0
  598. package/esm/tooling/generate/unified-diff.d.mts.map +1 -0
  599. package/esm/tooling/generate/unified-diff.mjs +161 -0
  600. package/esm/tooling/generate/unified-diff.mjs.map +1 -0
  601. package/esm/tooling/index.d.mts +41 -0
  602. package/esm/tooling/index.mjs +45 -0
  603. package/esm/tooling/inspect/boot-for-inspect.d.mts +23 -0
  604. package/esm/tooling/inspect/boot-for-inspect.d.mts.map +1 -0
  605. package/esm/tooling/inspect/boot-for-inspect.mjs +63 -0
  606. package/esm/tooling/inspect/boot-for-inspect.mjs.map +1 -0
  607. package/esm/tooling/inspect/collect-config.mjs +77 -0
  608. package/esm/tooling/inspect/collect-config.mjs.map +1 -0
  609. package/esm/tooling/inspect/collect-models.d.mts +9 -0
  610. package/esm/tooling/inspect/collect-models.d.mts.map +1 -0
  611. package/esm/tooling/inspect/collect-models.mjs +154 -0
  612. package/esm/tooling/inspect/collect-models.mjs.map +1 -0
  613. package/esm/tooling/inspect/collect-packages.d.mts +10 -0
  614. package/esm/tooling/inspect/collect-packages.d.mts.map +1 -0
  615. package/esm/tooling/inspect/collect-packages.mjs +157 -0
  616. package/esm/tooling/inspect/collect-packages.mjs.map +1 -0
  617. package/esm/tooling/inspect/collect-pages.mjs +108 -0
  618. package/esm/tooling/inspect/collect-pages.mjs.map +1 -0
  619. package/esm/tooling/inspect/collect-routes.mjs +168 -0
  620. package/esm/tooling/inspect/collect-routes.mjs.map +1 -0
  621. package/esm/tooling/inspect/event-recorder.d.mts +37 -0
  622. package/esm/tooling/inspect/event-recorder.d.mts.map +1 -0
  623. package/esm/tooling/inspect/event-recorder.mjs +91 -0
  624. package/esm/tooling/inspect/event-recorder.mjs.map +1 -0
  625. package/esm/tooling/inspect/index.d.mts +7 -0
  626. package/esm/tooling/inspect/index.mjs +7 -0
  627. package/esm/tooling/inspect/inspect-app.d.mts +53 -0
  628. package/esm/tooling/inspect/inspect-app.d.mts.map +1 -0
  629. package/esm/tooling/inspect/inspect-app.mjs +92 -0
  630. package/esm/tooling/inspect/inspect-app.mjs.map +1 -0
  631. package/esm/tooling/inspect/inspect-report.schema.d.mts +15 -0
  632. package/esm/tooling/inspect/inspect-report.schema.d.mts.map +1 -0
  633. package/esm/tooling/inspect/inspect-report.schema.mjs +463 -0
  634. package/esm/tooling/inspect/inspect-report.schema.mjs.map +1 -0
  635. package/esm/tooling/inspect/inspect-report.types.d.mts +196 -0
  636. package/esm/tooling/inspect/inspect-report.types.d.mts.map +1 -0
  637. package/esm/tooling/inspect/inspect-report.types.mjs +33 -0
  638. package/esm/tooling/inspect/inspect-report.types.mjs.map +1 -0
  639. package/esm/tooling/mcp/create-mcp-context.d.mts +26 -0
  640. package/esm/tooling/mcp/create-mcp-context.d.mts.map +1 -0
  641. package/esm/tooling/mcp/create-mcp-context.mjs +75 -0
  642. package/esm/tooling/mcp/create-mcp-context.mjs.map +1 -0
  643. package/esm/tooling/mcp/db-schema.d.mts +49 -0
  644. package/esm/tooling/mcp/db-schema.d.mts.map +1 -0
  645. package/esm/tooling/mcp/db-schema.mjs +56 -0
  646. package/esm/tooling/mcp/db-schema.mjs.map +1 -0
  647. package/esm/tooling/mcp/docs-search.d.mts +72 -0
  648. package/esm/tooling/mcp/docs-search.d.mts.map +1 -0
  649. package/esm/tooling/mcp/docs-search.mjs +178 -0
  650. package/esm/tooling/mcp/docs-search.mjs.map +1 -0
  651. package/esm/tooling/mcp/index.mjs +9 -0
  652. package/esm/tooling/mcp/load-ai-tools.d.mts +62 -0
  653. package/esm/tooling/mcp/load-ai-tools.d.mts.map +1 -0
  654. package/esm/tooling/mcp/load-ai-tools.mjs +44 -0
  655. package/esm/tooling/mcp/load-ai-tools.mjs.map +1 -0
  656. package/esm/tooling/mcp/mcp-tools.d.mts +60 -0
  657. package/esm/tooling/mcp/mcp-tools.d.mts.map +1 -0
  658. package/esm/tooling/mcp/mcp-tools.mjs +513 -0
  659. package/esm/tooling/mcp/mcp-tools.mjs.map +1 -0
  660. package/esm/tooling/mcp/start-mcp-server.d.mts +56 -0
  661. package/esm/tooling/mcp/start-mcp-server.d.mts.map +1 -0
  662. package/esm/tooling/mcp/start-mcp-server.mjs +126 -0
  663. package/esm/tooling/mcp/start-mcp-server.mjs.map +1 -0
  664. package/esm/tooling/mcp/tool-input.d.mts +75 -0
  665. package/esm/tooling/mcp/tool-input.d.mts.map +1 -0
  666. package/esm/tooling/mcp/tool-input.mjs +72 -0
  667. package/esm/tooling/mcp/tool-input.mjs.map +1 -0
  668. package/esm/tooling/problem.d.mts +45 -0
  669. package/esm/tooling/problem.d.mts.map +1 -0
  670. package/esm/tooling/problem.mjs +28 -0
  671. package/esm/tooling/problem.mjs.map +1 -0
  672. package/esm/tooling/trace/trace-report.types.d.mts +71 -0
  673. package/esm/tooling/trace/trace-report.types.d.mts.map +1 -0
  674. package/esm/tooling/trace/trace-report.types.mjs +7 -0
  675. package/esm/tooling/trace/trace-report.types.mjs.map +1 -0
  676. package/esm/tooling/trace/trace-request.d.mts +83 -0
  677. package/esm/tooling/trace/trace-request.d.mts.map +1 -0
  678. package/esm/tooling/trace/trace-request.mjs +241 -0
  679. package/esm/tooling/trace/trace-request.mjs.map +1 -0
  680. package/esm/tooling/typecheck/index.d.mts +1 -0
  681. package/esm/tooling/typecheck/index.mjs +3 -0
  682. package/esm/tooling/typecheck/run-typecheck.d.mts +59 -0
  683. package/esm/tooling/typecheck/run-typecheck.d.mts.map +1 -0
  684. package/esm/tooling/typecheck/run-typecheck.mjs +153 -0
  685. package/esm/tooling/typecheck/run-typecheck.mjs.map +1 -0
  686. package/esm/upgrade/codemods/head-viewport.mjs +46 -0
  687. package/esm/upgrade/codemods/head-viewport.mjs.map +1 -0
  688. package/esm/upgrade/codemods/helpers.mjs +81 -0
  689. package/esm/upgrade/codemods/helpers.mjs.map +1 -0
  690. package/esm/upgrade/codemods/index.mjs +34 -0
  691. package/esm/upgrade/codemods/index.mjs.map +1 -0
  692. package/esm/upgrade/codemods/logger-sync-calls.mjs +57 -0
  693. package/esm/upgrade/codemods/logger-sync-calls.mjs.map +1 -0
  694. package/esm/upgrade/codemods/package-json.mjs +122 -0
  695. package/esm/upgrade/codemods/package-json.mjs.map +1 -0
  696. package/esm/upgrade/codemods/request-log-snapshot.mjs +82 -0
  697. package/esm/upgrade/codemods/request-log-snapshot.mjs.map +1 -0
  698. package/esm/upgrade/codemods/review-sites.mjs +262 -0
  699. package/esm/upgrade/codemods/review-sites.mjs.map +1 -0
  700. package/esm/upgrade/diff.mjs +119 -0
  701. package/esm/upgrade/diff.mjs.map +1 -0
  702. package/esm/upgrade/format-upgrade-report.mjs +32 -0
  703. package/esm/upgrade/format-upgrade-report.mjs.map +1 -0
  704. package/esm/upgrade/load-ts-morph.mjs +48 -0
  705. package/esm/upgrade/load-ts-morph.mjs.map +1 -0
  706. package/esm/upgrade/notes.mjs +16 -0
  707. package/esm/upgrade/notes.mjs.map +1 -0
  708. package/esm/upgrade/run-upgrade.mjs +246 -0
  709. package/esm/upgrade/run-upgrade.mjs.map +1 -0
  710. package/esm/upgrade/upgrade-command.action.mjs +37 -0
  711. package/esm/upgrade/upgrade-command.action.mjs.map +1 -0
  712. package/esm/upgrade/version.mjs +39 -0
  713. package/esm/upgrade/version.mjs.map +1 -0
  714. package/esm/use-cases/use-cases-registry.mjs.map +1 -1
  715. package/esm/utils/clock.d.mts +33 -0
  716. package/esm/utils/clock.d.mts.map +1 -0
  717. package/esm/utils/clock.mjs +27 -0
  718. package/esm/utils/clock.mjs.map +1 -0
  719. package/esm/utils/framework-vesion.mjs +1 -1
  720. package/esm/utils/framework-vesion.mjs.map +1 -1
  721. package/esm/utils/ids.d.mts +32 -0
  722. package/esm/utils/ids.d.mts.map +1 -0
  723. package/esm/utils/ids.mjs +33 -0
  724. package/esm/utils/ids.mjs.map +1 -0
  725. package/esm/utils/index.d.mts +3 -0
  726. package/esm/utils/index.mjs +3 -0
  727. package/esm/utils/runtime.d.mts +59 -0
  728. package/esm/utils/runtime.d.mts.map +1 -0
  729. package/esm/utils/runtime.mjs +85 -0
  730. package/esm/utils/runtime.mjs.map +1 -0
  731. package/esm/validation/index.d.mts +1 -1
  732. package/esm/validation/types.d.mts +57 -2
  733. package/esm/validation/types.d.mts.map +1 -1
  734. package/esm/validation/validateAll.mjs +19 -2
  735. package/esm/validation/validateAll.mjs.map +1 -1
  736. package/esm/validation/validation-failure-status.mjs +15 -0
  737. package/esm/validation/validation-failure-status.mjs.map +1 -0
  738. package/esm/validation/validators/file-validator.d.mts +0 -16
  739. package/esm/validation/validators/file-validator.d.mts.map +1 -1
  740. package/esm/warlock-config/bundle-config.mjs +1 -1
  741. package/esm/warlock-config/types.d.mts +27 -3
  742. package/esm/warlock-config/types.d.mts.map +1 -1
  743. package/llms-full.txt +3166 -736
  744. package/llms.txt +16 -6
  745. package/package.json +43 -13
  746. package/schemas/inspect-report.schema.json +554 -0
  747. package/skills/README.md +9 -0
  748. package/skills/add-connector/SKILL.md +26 -38
  749. package/skills/benchmark-code/SKILL.md +30 -24
  750. package/skills/build-restful/SKILL.md +14 -14
  751. package/skills/build-url/SKILL.md +18 -18
  752. package/skills/configure-app/SKILL.md +107 -14
  753. package/skills/create-controller/SKILL.md +25 -12
  754. package/skills/create-module/SKILL.md +3 -3
  755. package/skills/define-resource/SKILL.md +32 -29
  756. package/skills/encrypt-data/SKILL.md +21 -19
  757. package/skills/generate-openapi/SKILL.md +50 -24
  758. package/skills/hash-password/SKILL.md +2 -2
  759. package/skills/health-checks/SKILL.md +24 -7
  760. package/skills/index.md +9 -4
  761. package/skills/lower-stage3-decorators/SKILL.md +4 -4
  762. package/skills/make-endpoint/SKILL.md +110 -0
  763. package/skills/model-factories/SKILL.md +92 -0
  764. package/skills/process-image/SKILL.md +32 -30
  765. package/skills/register-route/SKILL.md +109 -10
  766. package/skills/request-memo/SKILL.md +1 -1
  767. package/skills/request-tracing/SKILL.md +4 -1
  768. package/skills/resolve-path/SKILL.md +45 -44
  769. package/skills/retry-operation/SKILL.md +20 -11
  770. package/skills/run-app/SKILL.md +106 -22
  771. package/skills/send-response/SKILL.md +179 -14
  772. package/skills/store-file/SKILL.md +93 -53
  773. package/skills/test-fakes/SKILL.md +123 -0
  774. package/skills/test-http/SKILL.md +125 -21
  775. package/skills/test-service/SKILL.md +41 -1
  776. package/skills/update-packages/SKILL.md +29 -18
  777. package/skills/upgrade-from-5-29/SKILL.md +413 -0
  778. package/skills/upload-file/SKILL.md +31 -33
  779. package/skills/use-app-context/SKILL.md +38 -31
  780. package/skills/use-middleware/SKILL.md +45 -25
  781. package/skills/use-model-transformers/SKILL.md +37 -28
  782. package/skills/use-repository/SKILL.md +2 -2
  783. package/skills/validate-input/SKILL.md +72 -28
  784. package/skills/warlock-agents-md/SKILL.md +96 -0
  785. package/skills/warlock-board/SKILL.md +123 -0
  786. package/skills/warlock-check/SKILL.md +132 -0
  787. package/skills/warlock-conventions/SKILL.md +115 -0
  788. package/skills/warlock-doctor/SKILL.md +55 -22
  789. package/skills/warlock-inspect/SKILL.md +134 -0
  790. package/skills/warlock-mcp/SKILL.md +120 -0
  791. package/skills/warlock-routes/SKILL.md +18 -11
  792. package/skills/warlock-trace/SKILL.md +81 -0
  793. package/skills/wire-socket/SKILL.md +8 -8
  794. package/skills/write-seeder/SKILL.md +46 -32
  795. package/skills/write-use-case/SKILL.md +40 -27
  796. package/esm/http/uploads/matches-if-none-match.mjs +0 -13
  797. package/esm/http/uploads/matches-if-none-match.mjs.map +0 -1
@@ -0,0 +1,246 @@
1
+ import { detectPackageManager, getInstallCommand } from "../updater/package-manager.mjs";
2
+ import { loadTsMorph } from "./load-ts-morph.mjs";
3
+ import { compareVersions, normalizeVersion, parseVersion } from "./version.mjs";
4
+ import { CODEMODS } from "./codemods/index.mjs";
5
+ import { unifiedDiff } from "./diff.mjs";
6
+ import { UPGRADE_NOTES } from "./notes.mjs";
7
+ import path from "node:path";
8
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
9
+ import glob from "fast-glob";
10
+
11
+ //#region ../../packages/core/src/upgrade/run-upgrade.ts
12
+ /** Thrown for a request the command cannot act on (bad versions, nothing to detect). */
13
+ var UpgradeUsageError = class extends Error {
14
+ constructor(..._args) {
15
+ super(..._args);
16
+ this.name = "UpgradeUsageError";
17
+ }
18
+ };
19
+ /**
20
+ * Apply the mechanical edits for every breaking change between two releases
21
+ * and list what needs a decision. Writes nothing with `dryRun`.
22
+ */
23
+ async function runUpgrade(options) {
24
+ const root = path.resolve(options.root ?? process.cwd());
25
+ const to = toVersion(options.to);
26
+ const from = options.from ? toVersion(options.from) : detectInstalledVersion(root);
27
+ if (compareVersions(from, to) >= 0) throw new UpgradeUsageError(notNewerMessage(from, to, options.from !== void 0));
28
+ const selected = (options.codemods ?? CODEMODS).filter((codemod) => codemod.version === "target" || compareVersions(codemod.version, from) > 0 && compareVersions(codemod.version, to) <= 0);
29
+ const tsMorph = await (options.loadTsMorph ?? loadTsMorph)(root);
30
+ const project = new tsMorph.Project({
31
+ skipAddingFilesFromTsConfig: true,
32
+ skipFileDependencyResolution: true,
33
+ compilerOptions: {
34
+ jsx: tsMorph.ts.JsxEmit.Preserve,
35
+ allowJs: false
36
+ }
37
+ });
38
+ const relativePaths = await glob("src/**/*.{ts,tsx}", {
39
+ cwd: root,
40
+ ignore: [
41
+ "**/node_modules/**",
42
+ "**/dist/**",
43
+ "**/.warlock/**",
44
+ "**/*.d.ts"
45
+ ],
46
+ dot: false
47
+ });
48
+ relativePaths.sort();
49
+ const originals = /* @__PURE__ */ new Map();
50
+ const sourceFiles = [];
51
+ for (const relative of relativePaths) {
52
+ const content = readFileSync(path.join(root, relative), "utf8");
53
+ originals.set(relative, content);
54
+ sourceFiles.push(project.createSourceFile(path.join(root, relative), content, { overwrite: true }));
55
+ }
56
+ const relativeOf = new Map(sourceFiles.map((sourceFile, index) => [sourceFile, relativePaths[index] ?? ""]));
57
+ const applied = [];
58
+ const manual = [];
59
+ const textFiles = createTextFiles(root);
60
+ let activeCodemod;
61
+ const context = {
62
+ tsMorph,
63
+ sourceFiles,
64
+ relativePath: (sourceFile) => relativeOf.get(sourceFile) ?? path.relative(root, sourceFile.getFilePath()).split(path.sep).join("/"),
65
+ text: {
66
+ read: (file) => textFiles.read(file),
67
+ write: (file, content, change) => {
68
+ textFiles.write(file, content);
69
+ if (activeCodemod) applied.push({
70
+ codemod: activeCodemod.id,
71
+ file,
72
+ ...change
73
+ });
74
+ }
75
+ },
76
+ targetVersion: to
77
+ };
78
+ const summary = [];
79
+ for (const codemod of selected) {
80
+ activeCodemod = codemod;
81
+ const appliedBefore = applied.length;
82
+ const output = codemod.run(context);
83
+ for (const finding of output.manual) manual.push({
84
+ ...finding,
85
+ codemod: codemod.id,
86
+ skill: codemod.skill
87
+ });
88
+ const byFile = /* @__PURE__ */ new Map();
89
+ for (const edit of output.edits) {
90
+ const list = byFile.get(edit.file) ?? [];
91
+ list.push(edit);
92
+ byFile.set(edit.file, list);
93
+ }
94
+ for (const [file, edits] of byFile) {
95
+ const sourceFile = sourceFiles[relativePaths.indexOf(file)];
96
+ if (!sourceFile) continue;
97
+ let content = sourceFile.getFullText();
98
+ let lowestStart = Number.POSITIVE_INFINITY;
99
+ for (const edit of [...edits].sort((left, right) => right.start - left.start)) {
100
+ if (edit.end > lowestStart) {
101
+ manual.push({
102
+ codemod: codemod.id,
103
+ skill: codemod.skill,
104
+ file,
105
+ line: edit.line,
106
+ hint: `Not edited automatically (overlaps another change): ${edit.description}. Run the upgrade again after reviewing.`
107
+ });
108
+ continue;
109
+ }
110
+ content = content.slice(0, edit.start) + edit.text + content.slice(edit.end);
111
+ lowestStart = edit.start;
112
+ applied.push({
113
+ codemod: codemod.id,
114
+ file,
115
+ line: edit.line,
116
+ description: edit.description
117
+ });
118
+ }
119
+ sourceFile.replaceWithText(content);
120
+ }
121
+ summary.push({
122
+ id: codemod.id,
123
+ version: codemod.version === "target" ? to : codemod.version,
124
+ title: codemod.title,
125
+ applied: applied.length - appliedBefore,
126
+ manual: manual.filter((item) => item.codemod === codemod.id).length
127
+ });
128
+ }
129
+ activeCodemod = void 0;
130
+ applied.sort(byFileAndLine);
131
+ manual.sort(byFileAndLine);
132
+ const changes = [];
133
+ sourceFiles.forEach((sourceFile, index) => {
134
+ const file = relativePaths[index];
135
+ if (file === void 0) return;
136
+ const before = originals.get(file) ?? "";
137
+ const after = sourceFile.getFullText();
138
+ if (before !== after) changes.push({
139
+ file,
140
+ before,
141
+ after
142
+ });
143
+ });
144
+ for (const change of textFiles.changes()) changes.push(change);
145
+ changes.sort((left, right) => left.file.localeCompare(right.file));
146
+ if (!options.dryRun) for (const change of changes) writeFileSync(path.join(root, change.file), change.after);
147
+ const packageJsonChanged = changes.some((change) => change.file === "package.json" && applied.some((item) => item.codemod === "warlock-versions" && item.file === "package.json"));
148
+ return {
149
+ from,
150
+ to,
151
+ dryRun: options.dryRun === true,
152
+ codemods: summary,
153
+ applied,
154
+ manual,
155
+ notes: UPGRADE_NOTES.filter((note) => compareVersions(note.version, from) > 0 && compareVersions(note.version, to) <= 0),
156
+ changedFiles: changes.map((change) => change.file),
157
+ diff: changes.map((change) => unifiedDiff(change.file, change.before, change.after)).join(""),
158
+ ...packageJsonChanged && { installHint: getInstallCommand(await detectPackageManager(root)) }
159
+ };
160
+ }
161
+ /**
162
+ * Explain why `--to` is not newer than the starting version. The usual cause
163
+ * is running the command after installing the new release: the starting
164
+ * version is read from the installed `@warlock.js/core`, which is then already
165
+ * the target, so the command needs `--from`.
166
+ */
167
+ function notNewerMessage(from, to, fromWasPassed) {
168
+ if (fromWasPassed) return `--from ${from} is not older than --to ${to}. Pass the version this app is upgrading from.`;
169
+ const example = `warlock upgrade --from ${previousMinor(to)} --to ${to}`;
170
+ if (compareVersions(from, to) === 0) return `The installed @warlock.js/core is already ${from}, the --to version, so the version this app is upgrading from cannot be detected. Pass it with --from <previous version>, e.g. ${example}.`;
171
+ return `This app is already on ${from}; --to ${to} is not newer. If the detected version is wrong, pass --from <previous version>, e.g. ${example}.`;
172
+ }
173
+ /** `5.31.0` → `5.30`. A major's first release has no minor to step back to, so it gets a placeholder. */
174
+ function previousMinor(version) {
175
+ const [major, minor] = parseVersion(version) ?? [
176
+ 0,
177
+ 0,
178
+ 0
179
+ ];
180
+ return minor > 0 ? `${major}.${minor - 1}` : "<previous version>";
181
+ }
182
+ function toVersion(value) {
183
+ try {
184
+ return normalizeVersion(value);
185
+ } catch (error) {
186
+ throw new UpgradeUsageError(error instanceof Error ? error.message : String(error));
187
+ }
188
+ }
189
+ /** The installed `@warlock.js/core`, or the version its package.json range names. */
190
+ function detectInstalledVersion(root) {
191
+ const installed = path.join(root, "node_modules", "@warlock.js", "core", "package.json");
192
+ if (existsSync(installed)) {
193
+ const version = JSON.parse(readFileSync(installed, "utf8")).version;
194
+ if (typeof version === "string" && parseVersion(version)) return normalizeVersion(stripRange(version));
195
+ }
196
+ const manifest = path.join(root, "package.json");
197
+ if (existsSync(manifest)) {
198
+ const pkg = JSON.parse(readFileSync(manifest, "utf8"));
199
+ const spec = pkg.dependencies?.["@warlock.js/core"] ?? pkg.devDependencies?.["@warlock.js/core"];
200
+ const parsed = typeof spec === "string" ? parseVersion(spec) : void 0;
201
+ if (parsed) return parsed.join(".");
202
+ }
203
+ throw new UpgradeUsageError("Could not tell which Warlock version this app is on (no installed @warlock.js/core). Pass it with --from, e.g. --from 5.29.");
204
+ }
205
+ function stripRange(version) {
206
+ return (parseVersion(version) ?? [
207
+ 0,
208
+ 0,
209
+ 0
210
+ ]).join(".");
211
+ }
212
+ function byFileAndLine(left, right) {
213
+ return left.file.localeCompare(right.file) || left.line - right.line;
214
+ }
215
+ /** Non-TypeScript files a codemod reads and rewrites, buffered until the end. */
216
+ function createTextFiles(root) {
217
+ const files = /* @__PURE__ */ new Map();
218
+ const entry = (file) => {
219
+ let existing = files.get(file);
220
+ if (!existing) {
221
+ const absolute = path.join(root, file);
222
+ const content = existsSync(absolute) ? readFileSync(absolute, "utf8") : void 0;
223
+ existing = {
224
+ before: content,
225
+ current: content
226
+ };
227
+ files.set(file, existing);
228
+ }
229
+ return existing;
230
+ };
231
+ return {
232
+ read: (file) => entry(file).current,
233
+ write: (file, content) => {
234
+ entry(file).current = content;
235
+ },
236
+ changes: () => [...files.entries()].filter(([, value]) => value.current !== void 0 && value.current !== value.before).map(([file, value]) => ({
237
+ file,
238
+ before: value.before ?? "",
239
+ after: value.current ?? ""
240
+ }))
241
+ };
242
+ }
243
+
244
+ //#endregion
245
+ export { UpgradeUsageError, runUpgrade };
246
+ //# sourceMappingURL=run-upgrade.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-upgrade.mjs","names":[],"sources":["../../../../../../../../packages/core/src/upgrade/run-upgrade.ts"],"sourcesContent":["import glob from \"fast-glob\";\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { detectPackageManager, getInstallCommand } from \"../updater/package-manager\";\nimport { CODEMODS } from \"./codemods\";\nimport { unifiedDiff } from \"./diff\";\nimport { loadTsMorph } from \"./load-ts-morph\";\nimport { UPGRADE_NOTES } from \"./notes\";\nimport type {\n AppliedChange,\n Codemod,\n CodemodContext,\n ManualItem,\n SourceEdit,\n SourceFile,\n TextFiles,\n TsMorphModule,\n UpgradeResult,\n} from \"./types\";\nimport { compareVersions, normalizeVersion, parseVersion } from \"./version\";\n\nexport type RunUpgradeOptions = {\n /** App root. Defaults to the current directory. */\n root?: string;\n /** Target version, e.g. `5.31` or `5.31.0`. */\n to: string;\n /** Version upgrading from; detected from the installed `@warlock.js/core` when omitted. */\n from?: string;\n /** Compute and report everything, write nothing. */\n dryRun?: boolean;\n /** Override the codemod list (tests). */\n codemods?: readonly Codemod[];\n /** Override how ts-morph is loaded (tests). */\n loadTsMorph?: (root: string) => Promise<TsMorphModule>;\n};\n\n/** Thrown for a request the command cannot act on (bad versions, nothing to detect). */\nexport class UpgradeUsageError extends Error {\n public override readonly name = \"UpgradeUsageError\";\n}\n\n/**\n * Apply the mechanical edits for every breaking change between two releases\n * and list what needs a decision. Writes nothing with `dryRun`.\n */\nexport async function runUpgrade(options: RunUpgradeOptions): Promise<UpgradeResult> {\n const root = path.resolve(options.root ?? process.cwd());\n const to = toVersion(options.to);\n const from = options.from ? toVersion(options.from) : detectInstalledVersion(root);\n\n if (compareVersions(from, to) >= 0) {\n throw new UpgradeUsageError(notNewerMessage(from, to, options.from !== undefined));\n }\n\n const selected = (options.codemods ?? CODEMODS).filter(\n (codemod) =>\n codemod.version === \"target\" ||\n (compareVersions(codemod.version, from) > 0 && compareVersions(codemod.version, to) <= 0),\n );\n\n const tsMorph = await (options.loadTsMorph ?? loadTsMorph)(root);\n const project = new tsMorph.Project({\n skipAddingFilesFromTsConfig: true,\n skipFileDependencyResolution: true,\n compilerOptions: { jsx: tsMorph.ts.JsxEmit.Preserve, allowJs: false },\n });\n\n const relativePaths = await glob(\"src/**/*.{ts,tsx}\", {\n cwd: root,\n ignore: [\"**/node_modules/**\", \"**/dist/**\", \"**/.warlock/**\", \"**/*.d.ts\"],\n dot: false,\n });\n relativePaths.sort();\n\n const originals = new Map<string, string>();\n const sourceFiles: SourceFile[] = [];\n for (const relative of relativePaths) {\n const content = readFileSync(path.join(root, relative), \"utf8\");\n originals.set(relative, content);\n sourceFiles.push(\n project.createSourceFile(path.join(root, relative), content, { overwrite: true }),\n );\n }\n\n const relativeOf = new Map<SourceFile, string>(\n sourceFiles.map((sourceFile, index) => [sourceFile, relativePaths[index] ?? \"\"]),\n );\n\n const applied: AppliedChange[] = [];\n const manual: ManualItem[] = [];\n const textFiles = createTextFiles(root);\n let activeCodemod: Codemod | undefined;\n\n const text: TextFiles = {\n read: (file) => textFiles.read(file),\n write: (file, content, change) => {\n textFiles.write(file, content);\n if (activeCodemod) {\n applied.push({ codemod: activeCodemod.id, file, ...change });\n }\n },\n };\n\n const context: CodemodContext = {\n tsMorph,\n sourceFiles,\n relativePath: (sourceFile) =>\n relativeOf.get(sourceFile) ??\n path.relative(root, sourceFile.getFilePath()).split(path.sep).join(\"/\"),\n text,\n targetVersion: to,\n };\n\n const summary: UpgradeResult[\"codemods\"] = [];\n\n for (const codemod of selected) {\n activeCodemod = codemod;\n const appliedBefore = applied.length;\n const output = codemod.run(context);\n\n for (const finding of output.manual) {\n manual.push({ ...finding, codemod: codemod.id, skill: codemod.skill });\n }\n\n const byFile = new Map<string, SourceEdit[]>();\n for (const edit of output.edits) {\n const list = byFile.get(edit.file) ?? [];\n list.push(edit);\n byFile.set(edit.file, list);\n }\n\n for (const [file, edits] of byFile) {\n const sourceFile = sourceFiles[relativePaths.indexOf(file)];\n if (!sourceFile) continue;\n\n let content = sourceFile.getFullText();\n let lowestStart = Number.POSITIVE_INFINITY;\n for (const edit of [...edits].sort((left, right) => right.start - left.start)) {\n // Overlapping edits (one inside another) would corrupt the file: keep the outer one.\n if (edit.end > lowestStart) {\n manual.push({\n codemod: codemod.id,\n skill: codemod.skill,\n file,\n line: edit.line,\n hint: `Not edited automatically (overlaps another change): ${edit.description}. Run the upgrade again after reviewing.`,\n });\n continue;\n }\n content = content.slice(0, edit.start) + edit.text + content.slice(edit.end);\n lowestStart = edit.start;\n applied.push({ codemod: codemod.id, file, line: edit.line, description: edit.description });\n }\n\n sourceFile.replaceWithText(content);\n }\n\n summary.push({\n id: codemod.id,\n version: codemod.version === \"target\" ? to : codemod.version,\n title: codemod.title,\n applied: applied.length - appliedBefore,\n manual: manual.filter((item) => item.codemod === codemod.id).length,\n });\n }\n activeCodemod = undefined;\n\n applied.sort(byFileAndLine);\n manual.sort(byFileAndLine);\n\n const changes: { file: string; before: string; after: string }[] = [];\n sourceFiles.forEach((sourceFile, index) => {\n const file = relativePaths[index];\n if (file === undefined) return;\n const before = originals.get(file) ?? \"\";\n const after = sourceFile.getFullText();\n if (before !== after) changes.push({ file, before, after });\n });\n for (const change of textFiles.changes()) changes.push(change);\n changes.sort((left, right) => left.file.localeCompare(right.file));\n\n if (!options.dryRun) {\n for (const change of changes) writeFileSync(path.join(root, change.file), change.after);\n }\n\n const packageJsonChanged = changes.some(\n (change) =>\n change.file === \"package.json\" &&\n applied.some((item) => item.codemod === \"warlock-versions\" && item.file === \"package.json\"),\n );\n\n return {\n from,\n to,\n dryRun: options.dryRun === true,\n codemods: summary,\n applied,\n manual,\n notes: UPGRADE_NOTES.filter(\n (note) => compareVersions(note.version, from) > 0 && compareVersions(note.version, to) <= 0,\n ),\n changedFiles: changes.map((change) => change.file),\n diff: changes.map((change) => unifiedDiff(change.file, change.before, change.after)).join(\"\"),\n ...(packageJsonChanged && {\n installHint: getInstallCommand(await detectPackageManager(root)),\n }),\n };\n}\n\n/**\n * Explain why `--to` is not newer than the starting version. The usual cause\n * is running the command after installing the new release: the starting\n * version is read from the installed `@warlock.js/core`, which is then already\n * the target, so the command needs `--from`.\n */\nfunction notNewerMessage(from: string, to: string, fromWasPassed: boolean): string {\n if (fromWasPassed) {\n return `--from ${from} is not older than --to ${to}. Pass the version this app is upgrading from.`;\n }\n\n const example = `warlock upgrade --from ${previousMinor(to)} --to ${to}`;\n\n if (compareVersions(from, to) === 0) {\n return `The installed @warlock.js/core is already ${from}, the --to version, so the version this app is upgrading from cannot be detected. Pass it with --from <previous version>, e.g. ${example}.`;\n }\n\n return `This app is already on ${from}; --to ${to} is not newer. If the detected version is wrong, pass --from <previous version>, e.g. ${example}.`;\n}\n\n/** `5.31.0` → `5.30`. A major's first release has no minor to step back to, so it gets a placeholder. */\nfunction previousMinor(version: string): string {\n const [major, minor] = parseVersion(version) ?? [0, 0, 0];\n\n return minor > 0 ? `${major}.${minor - 1}` : \"<previous version>\";\n}\n\nfunction toVersion(value: string): string {\n try {\n return normalizeVersion(value);\n } catch (error) {\n throw new UpgradeUsageError(error instanceof Error ? error.message : String(error));\n }\n}\n\n/** The installed `@warlock.js/core`, or the version its package.json range names. */\nexport function detectInstalledVersion(root: string): string {\n const installed = path.join(root, \"node_modules\", \"@warlock.js\", \"core\", \"package.json\");\n if (existsSync(installed)) {\n const version = (JSON.parse(readFileSync(installed, \"utf8\")) as { version?: unknown }).version;\n if (typeof version === \"string\" && parseVersion(version))\n return normalizeVersion(stripRange(version));\n }\n\n const manifest = path.join(root, \"package.json\");\n if (existsSync(manifest)) {\n const pkg = JSON.parse(readFileSync(manifest, \"utf8\")) as {\n dependencies?: Record<string, unknown>;\n devDependencies?: Record<string, unknown>;\n };\n const spec =\n pkg.dependencies?.[\"@warlock.js/core\"] ?? pkg.devDependencies?.[\"@warlock.js/core\"];\n const parsed = typeof spec === \"string\" ? parseVersion(spec) : undefined;\n if (parsed) return parsed.join(\".\");\n }\n\n throw new UpgradeUsageError(\n \"Could not tell which Warlock version this app is on (no installed @warlock.js/core). Pass it with --from, e.g. --from 5.29.\",\n );\n}\n\nfunction stripRange(version: string): string {\n return (parseVersion(version) ?? [0, 0, 0]).join(\".\");\n}\n\nfunction byFileAndLine(\n left: { file: string; line: number },\n right: { file: string; line: number },\n) {\n return left.file.localeCompare(right.file) || left.line - right.line;\n}\n\n/** Non-TypeScript files a codemod reads and rewrites, buffered until the end. */\nfunction createTextFiles(root: string) {\n const files = new Map<string, { before: string | undefined; current: string | undefined }>();\n\n const entry = (file: string) => {\n let existing = files.get(file);\n if (!existing) {\n const absolute = path.join(root, file);\n const content = existsSync(absolute) ? readFileSync(absolute, \"utf8\") : undefined;\n existing = { before: content, current: content };\n files.set(file, existing);\n }\n return existing;\n };\n\n return {\n read: (file: string) => entry(file).current,\n write: (file: string, content: string) => {\n entry(file).current = content;\n },\n changes: () =>\n [...files.entries()]\n .filter(([, value]) => value.current !== undefined && value.current !== value.before)\n .map(([file, value]) => ({ file, before: value.before ?? \"\", after: value.current ?? \"\" })),\n };\n}\n"],"mappings":";;;;;;;;;;;;AAqCA,IAAa,oBAAb,cAAuC,MAAM;;;cACX;;AAClC;;;;;AAMA,eAAsB,WAAW,SAAoD;CACnF,MAAM,OAAO,KAAK,QAAQ,QAAQ,QAAQ,QAAQ,IAAI,CAAC;CACvD,MAAM,KAAK,UAAU,QAAQ,EAAE;CAC/B,MAAM,OAAO,QAAQ,OAAO,UAAU,QAAQ,IAAI,IAAI,uBAAuB,IAAI;CAEjF,IAAI,gBAAgB,MAAM,EAAE,KAAK,GAC/B,MAAM,IAAI,kBAAkB,gBAAgB,MAAM,IAAI,QAAQ,SAAS,MAAS,CAAC;CAGnF,MAAM,YAAY,QAAQ,YAAY,SAAQ,CAAE,QAC7C,YACC,QAAQ,YAAY,YACnB,gBAAgB,QAAQ,SAAS,IAAI,IAAI,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Q,aAAa,OAAO,KAAK;EAAC;EAAG;EAAG;CAAC,EAAC,CAAE,KAAK,GAAG;AACtD;AAEA,SAAS,cACP,MACA,OACA;CACA,OAAO,KAAK,KAAK,cAAc,MAAM,IAAI,KAAK,KAAK,OAAO,MAAM;AAClE;;AAGA,SAAS,gBAAgB,MAAc;CACrC,MAAM,wBAAQ,IAAI,IAAyE;CAE3F,MAAM,SAAS,SAAiB;EAC9B,IAAI,WAAW,MAAM,IAAI,IAAI;EAC7B,IAAI,CAAC,UAAU;GACb,MAAM,WAAW,KAAK,KAAK,MAAM,IAAI;GACrC,MAAM,UAAU,WAAW,QAAQ,IAAI,aAAa,UAAU,MAAM,IAAI;GACxE,WAAW;IAAE,QAAQ;IAAS,SAAS;GAAQ;GAC/C,MAAM,IAAI,MAAM,QAAQ;EAC1B;EACA,OAAO;CACT;CAEA,OAAO;EACL,OAAO,SAAiB,MAAM,IAAI,CAAC,CAAC;EACpC,QAAQ,MAAc,YAAoB;GACxC,MAAM,IAAI,CAAC,CAAC,UAAU;EACxB;EACA,eACE,CAAC,GAAG,MAAM,QAAQ,CAAC,CAAC,CACjB,QAAQ,GAAG,WAAW,MAAM,YAAY,UAAa,MAAM,YAAY,MAAM,MAAM,CAAC,CACpF,KAAK,CAAC,MAAM,YAAY;GAAE;GAAM,QAAQ,MAAM,UAAU;GAAI,OAAO,MAAM,WAAW;EAAG,EAAE;CAChG;AACF"}
@@ -0,0 +1,37 @@
1
+ import { formatUpgradeReport } from "./format-upgrade-report.mjs";
2
+ import { TsMorphMissingError } from "./load-ts-morph.mjs";
3
+ import { UpgradeUsageError, runUpgrade } from "./run-upgrade.mjs";
4
+
5
+ //#region ../../packages/core/src/upgrade/upgrade-command.action.ts
6
+ /**
7
+ * The `warlock upgrade` action. Returns the exit code it set: 0 when it ran
8
+ * (even with places to review), 1 for unusable arguments or a missing ts-morph.
9
+ */
10
+ async function runUpgradeCommand(options, overrides = {}, output = console) {
11
+ const json = Boolean(options.json);
12
+ const fail = (message) => {
13
+ if (json) output.log(JSON.stringify({ error: message }, null, 2));
14
+ else output.error(message);
15
+ process.exitCode = 1;
16
+ return 1;
17
+ };
18
+ const to = typeof options.to === "string" || typeof options.to === "number" ? String(options.to) : "";
19
+ if (!to) return fail("Pass the version to upgrade to, and the version upgrading from once the new release is installed: warlock upgrade --from 5.30 --to 5.31.0");
20
+ try {
21
+ const result = await runUpgrade({
22
+ ...overrides,
23
+ to,
24
+ ...options.from !== void 0 && options.from !== true && { from: String(options.from) },
25
+ dryRun: Boolean(options.dryRun)
26
+ });
27
+ output.log(json ? JSON.stringify(result, null, 2) : formatUpgradeReport(result));
28
+ return 0;
29
+ } catch (error) {
30
+ if (error instanceof UpgradeUsageError || error instanceof TsMorphMissingError) return fail(error.message);
31
+ throw error;
32
+ }
33
+ }
34
+
35
+ //#endregion
36
+ export { runUpgradeCommand };
37
+ //# sourceMappingURL=upgrade-command.action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade-command.action.mjs","names":[],"sources":["../../../../../../../../packages/core/src/upgrade/upgrade-command.action.ts"],"sourcesContent":["import { formatUpgradeReport } from \"./format-upgrade-report\";\nimport { TsMorphMissingError } from \"./load-ts-morph\";\nimport { type RunUpgradeOptions, runUpgrade, UpgradeUsageError } from \"./run-upgrade\";\n\ntype Output = { log(message: string): void; error(message: string): void };\n\n/**\n * The `warlock upgrade` action. Returns the exit code it set: 0 when it ran\n * (even with places to review), 1 for unusable arguments or a missing ts-morph.\n */\nexport async function runUpgradeCommand(\n options: Record<string, string | boolean | number>,\n overrides: Pick<RunUpgradeOptions, \"root\" | \"codemods\" | \"loadTsMorph\"> = {},\n output: Output = console,\n): Promise<number> {\n const json = Boolean(options.json);\n const fail = (message: string): number => {\n if (json) output.log(JSON.stringify({ error: message }, null, 2));\n else output.error(message);\n process.exitCode = 1;\n return 1;\n };\n\n const to =\n typeof options.to === \"string\" || typeof options.to === \"number\" ? String(options.to) : \"\";\n if (!to) {\n return fail(\n \"Pass the version to upgrade to, and the version upgrading from once the new release is installed: warlock upgrade --from 5.30 --to 5.31.0\",\n );\n }\n\n try {\n const result = await runUpgrade({\n ...overrides,\n to,\n ...(options.from !== undefined && options.from !== true && { from: String(options.from) }),\n dryRun: Boolean(options.dryRun),\n });\n\n output.log(json ? JSON.stringify(result, null, 2) : formatUpgradeReport(result));\n return 0;\n } catch (error) {\n if (error instanceof UpgradeUsageError || error instanceof TsMorphMissingError) {\n return fail(error.message);\n }\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;AAUA,eAAsB,kBACpB,SACA,YAA0E,CAAC,GAC3E,SAAiB,SACA;CACjB,MAAM,OAAO,QAAQ,QAAQ,IAAI;CACjC,MAAM,QAAQ,YAA4B;EACxC,IAAI,MAAM,OAAO,IAAI,KAAK,UAAU,EAAE,OAAO,QAAQ,GAAG,MAAM,CAAC,CAAC;OAC3D,OAAO,MAAM,OAAO;EACzB,QAAQ,WAAW;EACnB,OAAO;CACT;CAEA,MAAM,KACJ,OAAO,QAAQ,OAAO,YAAY,OAAO,QAAQ,OAAO,WAAW,OAAO,QAAQ,EAAE,IAAI;CAC1F,IAAI,CAAC,IACH,OAAO,KACL,2IACF;CAGF,IAAI;EACF,MAAM,SAAS,MAAM,WAAW;GAC9B,GAAG;GACH;GACA,GAAI,QAAQ,SAAS,UAAa,QAAQ,SAAS,QAAQ,EAAE,MAAM,OAAO,QAAQ,IAAI,EAAE;GACxF,QAAQ,QAAQ,QAAQ,MAAM;EAChC,CAAC;EAED,OAAO,IAAI,OAAO,KAAK,UAAU,QAAQ,MAAM,CAAC,IAAI,oBAAoB,MAAM,CAAC;EAC/E,OAAO;CACT,SAAS,OAAO;EACd,IAAI,iBAAiB,qBAAqB,iBAAiB,qBACzD,OAAO,KAAK,MAAM,OAAO;EAE3B,MAAM;CACR;AACF"}
@@ -0,0 +1,39 @@
1
+ //#region ../../packages/core/src/upgrade/version.ts
2
+ /** Parse `5.31`, `5.31.0`, `v5.31.2`, `^5.30.0` into `[major, minor, patch]`. */
3
+ function parseVersion(value) {
4
+ const match = /(\d{1,6})(?:\.(\d{1,6}))?(?:\.(\d{1,6}))?/.exec(value.trim());
5
+ if (!match) return void 0;
6
+ return [
7
+ Number(match[1]),
8
+ Number(match[2] ?? 0),
9
+ Number(match[3] ?? 0)
10
+ ];
11
+ }
12
+ /** `5.31` → `5.31.0`; throws on something that is not a version. */
13
+ function normalizeVersion(value) {
14
+ const parsed = parseVersion(value);
15
+ if (!parsed || !/^v?\d{1,6}(\.\d{1,6}){0,2}$/.test(value.trim())) throw new Error(`"${value}" is not a version. Pass one like --to 5.31 or --to 5.31.0.`);
16
+ return parsed.join(".");
17
+ }
18
+ /** Negative when `left` is older than `right`, 0 when equal, positive when newer. */
19
+ function compareVersions(left, right) {
20
+ const a = parseVersion(left) ?? [
21
+ 0,
22
+ 0,
23
+ 0
24
+ ];
25
+ const b = parseVersion(right) ?? [
26
+ 0,
27
+ 0,
28
+ 0
29
+ ];
30
+ for (let index = 0; index < 3; index++) {
31
+ const difference = (a[index] ?? 0) - (b[index] ?? 0);
32
+ if (difference !== 0) return difference;
33
+ }
34
+ return 0;
35
+ }
36
+
37
+ //#endregion
38
+ export { compareVersions, normalizeVersion, parseVersion };
39
+ //# sourceMappingURL=version.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.mjs","names":[],"sources":["../../../../../../../../packages/core/src/upgrade/version.ts"],"sourcesContent":["/** Parse `5.31`, `5.31.0`, `v5.31.2`, `^5.30.0` into `[major, minor, patch]`. */\nexport function parseVersion(value: string): [number, number, number] | undefined {\n const match = /(\\d{1,6})(?:\\.(\\d{1,6}))?(?:\\.(\\d{1,6}))?/.exec(value.trim());\n if (!match) return undefined;\n\n return [Number(match[1]), Number(match[2] ?? 0), Number(match[3] ?? 0)];\n}\n\n/** `5.31` → `5.31.0`; throws on something that is not a version. */\nexport function normalizeVersion(value: string): string {\n const parsed = parseVersion(value);\n if (!parsed || !/^v?\\d{1,6}(\\.\\d{1,6}){0,2}$/.test(value.trim())) {\n throw new Error(`\"${value}\" is not a version. Pass one like --to 5.31 or --to 5.31.0.`);\n }\n\n return parsed.join(\".\");\n}\n\n/** Negative when `left` is older than `right`, 0 when equal, positive when newer. */\nexport function compareVersions(left: string, right: string): number {\n const a = parseVersion(left) ?? [0, 0, 0];\n const b = parseVersion(right) ?? [0, 0, 0];\n\n for (let index = 0; index < 3; index++) {\n const difference = (a[index] ?? 0) - (b[index] ?? 0);\n if (difference !== 0) return difference;\n }\n\n return 0;\n}\n"],"mappings":";;AACA,SAAgB,aAAa,OAAqD;CAChF,MAAM,QAAQ,4CAA4C,KAAK,MAAM,KAAK,CAAC;CAC3E,IAAI,CAAC,OAAO,OAAO;CAEnB,OAAO;EAAC,OAAO,MAAM,EAAE;EAAG,OAAO,MAAM,MAAM,CAAC;EAAG,OAAO,MAAM,MAAM,CAAC;CAAC;AACxE;;AAGA,SAAgB,iBAAiB,OAAuB;CACtD,MAAM,SAAS,aAAa,KAAK;CACjC,IAAI,CAAC,UAAU,CAAC,8BAA8B,KAAK,MAAM,KAAK,CAAC,GAC7D,MAAM,IAAI,MAAM,IAAI,MAAM,4DAA4D;CAGxF,OAAO,OAAO,KAAK,GAAG;AACxB;;AAGA,SAAgB,gBAAgB,MAAc,OAAuB;CACnE,MAAM,IAAI,aAAa,IAAI,KAAK;EAAC;EAAG;EAAG;CAAC;CACxC,MAAM,IAAI,aAAa,KAAK,KAAK;EAAC;EAAG;EAAG;CAAC;CAEzC,KAAK,IAAI,QAAQ,GAAG,QAAQ,GAAG,SAAS;EACtC,MAAM,cAAc,EAAE,UAAU,MAAM,EAAE,UAAU;EAClD,IAAI,eAAe,GAAG,OAAO;CAC/B;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-cases-registry.mjs","names":[],"sources":["../../../../../../../../packages/core/src/use-cases/use-cases-registry.ts"],"sourcesContent":["import { cache } from \"@warlock.js/cache\";\nimport { log } from \"@warlock.js/logger\";\nimport { config } from \"../config\";\nimport { type RegisteredUseCase, type UseCaseConfigurations, type UseCaseResult } from \"./types\";\n\n/**\n * Store registered use cases\n */\nconst useCaseRegister = new Map<string, RegisteredUseCase>();\n\n/**\n * Register a use case\n */\nexport function $registerUseCase<Output, Input>(\n name: string,\n useCase: RegisteredUseCase<Output, Input>,\n) {\n if (useCaseRegister.has(name) && process.env.NODE_ENV !== \"production\") {\n log.warn(\"use-cases\", \"registering\", `Use case \"${name}\" is already registered. Overwriting.`);\n }\n\n useCaseRegister.set(name, useCase);\n}\n\n/**\n * Unregister a use case.\n *\n * Dropping the history namespace is best-effort: `$cleanup` is synchronous, so the\n * async cache removal is fire-and-forget with a `.catch` guard — a rejecting cache\n * driver must never turn cleanup into an unhandled rejection.\n */\nexport function $unregisterUseCase(name: string) {\n useCaseRegister.delete(name);\n\n Promise.resolve(cache.removeNamespace(`use-case:history:${name}`)).catch((error) => {\n log.error(\"use-cases\", name, \"history namespace removal failed\", { error });\n });\n}\n\n/**\n * Get a use case.\n *\n * Returns the `RegisteredUseCase` shape — including the runtime `calls` counters\n * the registry actually stores — so consumers can read call stats without an\n * ad-hoc cast.\n */\nexport function getUseCase<Output, Input>(name: string) {\n return useCaseRegister.get(name) as RegisteredUseCase<Output, Input> | undefined;\n}\n\n/**\n * Get all use cases\n */\nexport function getUseCases() {\n return useCaseRegister;\n}\n\n/**\n * Increase use case success calls\n */\nexport function increaseUseCaseSuccessCalls(name: string): number {\n const useCase = useCaseRegister.get(name);\n if (useCase) {\n useCase.calls.success++;\n useCase.calls.total++;\n\n return useCase.calls.success;\n }\n\n return 0;\n}\n\n/**\n * Increase use case failed calls\n */\nexport function increaseUseCaseFailedCalls(name: string): number {\n const useCase = useCaseRegister.get(name);\n if (useCase) {\n useCase.calls.failed++;\n useCase.calls.total++;\n\n return useCase.calls.failed;\n }\n\n return 0;\n}\n\n/**\n * Resolve the history cache TTL (seconds) from config.\n * `false` means \"use the cache driver's default\", represented as `undefined`.\n */\nfunction resolveHistoryTtl(useCaseConfig?: UseCaseConfigurations): number | undefined {\n const ttlConfig = useCaseConfig?.history?.ttl ?? 3600; // 1 hour default\n\n return ttlConfig === false ? undefined : ttlConfig;\n}\n\n/**\n * Get use case history from cache.\n *\n * Prunes ids whose entries have expired so the list can't accumulate dead refs.\n */\nexport async function getUseCaseHistory(name: string): Promise<UseCaseResult<any>[]> {\n const listKey = `use-case:history:${name}:list`;\n const ids = (await cache.get<string[]>(listKey)) || [];\n\n const entries = await Promise.all(\n ids.map(async (id: string) => ({\n id,\n result: await cache.get<UseCaseResult<any>>(`use-case:history:${name}:${id}`),\n })),\n );\n\n const liveEntries = entries.filter((entry) => Boolean(entry.result));\n\n if (liveEntries.length !== ids.length) {\n const useCaseConfig = config.get<UseCaseConfigurations>(\"use-cases\");\n\n await cache.set(\n listKey,\n liveEntries.map((entry) => entry.id),\n resolveHistoryTtl(useCaseConfig),\n );\n }\n\n return liveEntries.map((entry) => entry.result) as UseCaseResult<any>[];\n}\n\n/**\n * Add use case history to cache, capping the per-use-case list so it can't grow\n * unbounded — oldest entries (and their ids) are evicted past MAX_HISTORY_ENTRIES.\n */\nexport async function addUseCaseHistory(name: string, result: UseCaseResult<any>) {\n const useCaseConfig = config.get<UseCaseConfigurations>(\"use-cases\");\n\n // On by default outside production; opt in to production with `history.enabled: true`.\n const enabled = useCaseConfig?.history?.enabled ?? process.env.NODE_ENV !== \"production\";\n\n if (!enabled) return;\n\n const previous = historyWrites.get(name) ?? Promise.resolve();\n const current = previous.catch(() => undefined).then(() => writeHistory(name, result));\n\n historyWrites.set(name, current);\n\n try {\n await current;\n } finally {\n if (historyWrites.get(name) === current) {\n historyWrites.delete(name);\n }\n }\n}\n\n/**\n * Per-use-case write chain so the list read-modify-write never interleaves\n * within a process (keeps the cap enforced under concurrency).\n */\nconst historyWrites = new Map<string, Promise<unknown>>();\n\nasync function writeHistory(name: string, result: UseCaseResult<any>) {\n const useCaseConfig = config.get<UseCaseConfigurations>(\"use-cases\");\n const ttl = resolveHistoryTtl(useCaseConfig);\n const maxEntries = useCaseConfig?.history?.maxEntries ?? 100;\n const key = `use-case:history:${name}:${result.id}`;\n const listKey = `use-case:history:${name}:list`;\n\n // Store a projection only: `output` and `ctx` (tokens, payloads) never reach the cache.\n const projection = { ...result, output: undefined, ctx: undefined } as unknown as UseCaseResult<any>;\n\n await cache.set(key, projection, ttl);\n\n const list = (await cache.get<string[]>(listKey)) || [];\n\n list.push(result.id);\n\n while (list.length > maxEntries) {\n const evictedId = list.shift();\n\n if (evictedId) {\n await cache.remove(`use-case:history:${name}:${evictedId}`);\n }\n }\n\n await cache.set(listKey, list, ttl);\n}\n"],"mappings":";;;;;;;;;AAQA,MAAM,kCAAkB,IAAI,IAA+B;;;;AAK3D,SAAgB,iBACd,MACA,SACA;CACA,IAAI,gBAAgB,IAAI,IAAI,KAAK,QAAQ,IAAI,aAAa,cACxD,IAAI,KAAK,aAAa,eAAe,aAAa,KAAK,sCAAsC;CAG/F,gBAAgB,IAAI,MAAM,OAAO;AACnC;;;;;;;;AASA,SAAgB,mBAAmB,MAAc;CAC/C,gBAAgB,OAAO,IAAI;CAE3B,QAAQ,QAAQ,MAAM,gBAAgB,oBAAoB,MAAM,CAAC,CAAC,CAAC,OAAO,UAAU;EAClF,IAAI,MAAM,aAAa,MAAM,oCAAoC,EAAE,MAAM,CAAC;CAC5E,CAAC;AACH;;;;;;;;AASA,SAAgB,WAA0B,MAAc;CACtD,OAAO,gBAAgB,IAAI,IAAI;AACjC;;;;AAKA,SAAgB,cAAc;CAC5B,OAAO;AACT;;;;AAKA,SAAgB,4BAA4B,MAAsB;CAChE,MAAM,UAAU,gBAAgB,IAAI,IAAI;CACxC,IAAI,SAAS;EACX,QAAQ,MAAM;EACd,QAAQ,MAAM;EAEd,OAAO,QAAQ,MAAM;CACvB;CAEA,OAAO;AACT;;;;AAKA,SAAgB,2BAA2B,MAAsB;CAC/D,MAAM,UAAU,gBAAgB,IAAI,IAAI;CACxC,IAAI,SAAS;EACX,QAA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MAAM,kBAAkB,aAAa;CAC3C,MAAM,aAAa,eAAe,SAAS,cAAc;CACzD,MAAM,MAAM,oBAAoB,KAAK,GAAG,OAAO;CAC/C,MAAM,UAAU,oBAAoB,KAAK;CAGzC,MAAM,aAAa;EAAE,GAAG;EAAQ,QAAQ;EAAW,KAAK;CAAU;CAElE,MAAM,MAAM,IAAI,KAAK,YAAY,GAAG;CAEpC,MAAM,OAAQ,MAAM,MAAM,IAAc,OAAO,KAAM,CAAC;CAEtD,KAAK,KAAK,OAAO,EAAE;CAEnB,OAAO,KAAK,SAAS,YAAY;EAC/B,MAAM,YAAY,KAAK,MAAM;EAE7B,IAAI,WACF,MAAM,MAAM,OAAO,oBAAoB,KAAK,GAAG,WAAW;CAE9D;CAEA,MAAM,MAAM,IAAI,SAAS,MAAM,GAAG;AACpC"}
1
+ {"version":3,"file":"use-cases-registry.mjs","names":[],"sources":["../../../../../../../../packages/core/src/use-cases/use-cases-registry.ts"],"sourcesContent":["import { cache } from \"@warlock.js/cache\";\nimport { log } from \"@warlock.js/logger\";\nimport { config } from \"../config\";\nimport { type RegisteredUseCase, type UseCaseConfigurations, type UseCaseResult } from \"./types\";\n\n/**\n * Store registered use cases\n */\nconst useCaseRegister = new Map<string, RegisteredUseCase>();\n\n/**\n * Register a use case\n */\nexport function $registerUseCase<Output, Input>(\n name: string,\n useCase: RegisteredUseCase<Output, Input>,\n) {\n if (useCaseRegister.has(name) && process.env.NODE_ENV !== \"production\") {\n log.warn(\"use-cases\", \"registering\", `Use case \"${name}\" is already registered. Overwriting.`);\n }\n\n useCaseRegister.set(name, useCase);\n}\n\n/**\n * Unregister a use case.\n *\n * Dropping the history namespace is best-effort: `$cleanup` is synchronous, so the\n * async cache removal is fire-and-forget with a `.catch` guard — a rejecting cache\n * driver must never turn cleanup into an unhandled rejection.\n */\nexport function $unregisterUseCase(name: string) {\n useCaseRegister.delete(name);\n\n Promise.resolve(cache.removeNamespace(`use-case:history:${name}`)).catch((error) => {\n log.error(\"use-cases\", name, \"history namespace removal failed\", { error });\n });\n}\n\n/**\n * Get a use case.\n *\n * Returns the `RegisteredUseCase` shape — including the runtime `calls` counters\n * the registry actually stores — so consumers can read call stats without an\n * ad-hoc cast.\n */\nexport function getUseCase<Output, Input>(name: string) {\n return useCaseRegister.get(name) as RegisteredUseCase<Output, Input> | undefined;\n}\n\n/**\n * Get all use cases\n */\nexport function getUseCases() {\n return useCaseRegister;\n}\n\n/**\n * Increase use case success calls\n */\nexport function increaseUseCaseSuccessCalls(name: string): number {\n const useCase = useCaseRegister.get(name);\n if (useCase) {\n useCase.calls.success++;\n useCase.calls.total++;\n\n return useCase.calls.success;\n }\n\n return 0;\n}\n\n/**\n * Increase use case failed calls\n */\nexport function increaseUseCaseFailedCalls(name: string): number {\n const useCase = useCaseRegister.get(name);\n if (useCase) {\n useCase.calls.failed++;\n useCase.calls.total++;\n\n return useCase.calls.failed;\n }\n\n return 0;\n}\n\n/**\n * Resolve the history cache TTL (seconds) from config.\n * `false` means \"use the cache driver's default\", represented as `undefined`.\n */\nfunction resolveHistoryTtl(useCaseConfig?: UseCaseConfigurations): number | undefined {\n const ttlConfig = useCaseConfig?.history?.ttl ?? 3600; // 1 hour default\n\n return ttlConfig === false ? undefined : ttlConfig;\n}\n\n/**\n * Get use case history from cache.\n *\n * Prunes ids whose entries have expired so the list can't accumulate dead refs.\n */\nexport async function getUseCaseHistory(name: string): Promise<UseCaseResult<any>[]> {\n const listKey = `use-case:history:${name}:list`;\n const ids = (await cache.get<string[]>(listKey)) || [];\n\n const entries = await Promise.all(\n ids.map(async (id: string) => ({\n id,\n result: await cache.get<UseCaseResult<any>>(`use-case:history:${name}:${id}`),\n })),\n );\n\n const liveEntries = entries.filter((entry) => Boolean(entry.result));\n\n if (liveEntries.length !== ids.length) {\n const useCaseConfig = config.get<UseCaseConfigurations>(\"use-cases\");\n\n await cache.set(\n listKey,\n liveEntries.map((entry) => entry.id),\n resolveHistoryTtl(useCaseConfig),\n );\n }\n\n return liveEntries.map((entry) => entry.result) as UseCaseResult<any>[];\n}\n\n/**\n * Add use case history to cache, capping the per-use-case list so it can't grow\n * unbounded — oldest entries (and their ids) are evicted past MAX_HISTORY_ENTRIES.\n */\nexport async function addUseCaseHistory(name: string, result: UseCaseResult<any>) {\n const useCaseConfig = config.get<UseCaseConfigurations>(\"use-cases\");\n\n // On by default outside production; opt in to production with `history.enabled: true`.\n const enabled = useCaseConfig?.history?.enabled ?? process.env.NODE_ENV !== \"production\";\n\n if (!enabled) return;\n\n const previous = historyWrites.get(name) ?? Promise.resolve();\n const current = previous.catch(() => undefined).then(() => writeHistory(name, result));\n\n historyWrites.set(name, current);\n\n try {\n await current;\n } finally {\n if (historyWrites.get(name) === current) {\n historyWrites.delete(name);\n }\n }\n}\n\n/**\n * Per-use-case write chain so the list read-modify-write never interleaves\n * within a process (keeps the cap enforced under concurrency).\n */\nconst historyWrites = new Map<string, Promise<unknown>>();\n\nasync function writeHistory(name: string, result: UseCaseResult<any>) {\n const useCaseConfig = config.get<UseCaseConfigurations>(\"use-cases\");\n const ttl = resolveHistoryTtl(useCaseConfig);\n const maxEntries = useCaseConfig?.history?.maxEntries ?? 100;\n const key = `use-case:history:${name}:${result.id}`;\n const listKey = `use-case:history:${name}:list`;\n\n // Store a projection only: `output` and `ctx` (tokens, payloads) never reach the cache.\n const projection = {\n ...result,\n output: undefined,\n ctx: undefined,\n } as unknown as UseCaseResult<any>;\n\n await cache.set(key, projection, ttl);\n\n const list = (await cache.get<string[]>(listKey)) || [];\n\n list.push(result.id);\n\n while (list.length > maxEntries) {\n const evictedId = list.shift();\n\n if (evictedId) {\n await cache.remove(`use-case:history:${name}:${evictedId}`);\n }\n }\n\n await cache.set(listKey, list, ttl);\n}\n"],"mappings":";;;;;;;;;AAQA,MAAM,kCAAkB,IAAI,IAA+B;;;;AAK3D,SAAgB,iBACd,MACA,SACA;CACA,IAAI,gBAAgB,IAAI,IAAI,KAAK,QAAQ,IAAI,aAAa,cACxD,IAAI,KAAK,aA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
2
+ /**
3
+ * The application clock.
4
+ *
5
+ * Read the current time through `clock` instead of `new Date()` / `Date.now()`
6
+ * where a test needs to control it: tokens that expire, "created 5 minutes
7
+ * ago", scheduled cut-offs. In the test environment the test kit swaps the
8
+ * source for a frozen one (`clockFake` from `@warlock.js/core/tests`); in
9
+ * every other environment it is the system clock.
10
+ *
11
+ * Only code that reads `clock` is affected — the global `Date` and timers are
12
+ * never patched, so a fake clock cannot stall `setTimeout` or a driver.
13
+ *
14
+ * @example
15
+ * import { clock } from "@warlock.js/core";
16
+ *
17
+ * const expiresAt = new Date(clock.timestamp() + 15 * 60_000);
18
+ */
19
+ type ClockSource = {
20
+ /** Milliseconds since the Unix epoch. */now(): number;
21
+ };
22
+ declare const clock: {
23
+ /** The current time as a `Date`. */now(): Date; /** The current time in milliseconds since the Unix epoch. */
24
+ timestamp(): number;
25
+ };
26
+ /**
27
+ * Replace the clock's source, or restore the system clock with `undefined`.
28
+ * The test kit's `clockFake` is built on this.
29
+ */
30
+ declare function setClockSource(next: ClockSource | undefined): void;
31
+ //#endregion
32
+ export { ClockSource, clock, setClockSource };
33
+ //# sourceMappingURL=clock.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clock.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/utils/clock.ts"],"mappings":";;AAiBA;;;;AAEK;AAeL;;;;;;;;;AAgBA;;KAjCY,WAAA;EAiCyB,yCA/BnC,GAAG;AAAA;AAAA,cAeQ,KAAA;6CAEJ,IAAI;;;;;;;iBAcG,cAAA,CAAe,IAA6B,EAAvB,WAAW"}
@@ -0,0 +1,27 @@
1
+ //#region ../../packages/core/src/utils/clock.ts
2
+ const systemClock = { now: () => Date.now() };
3
+ const SOURCE_KEY = Symbol.for("warlock.core.clockSource");
4
+ function source() {
5
+ return globalThis[SOURCE_KEY] ?? systemClock;
6
+ }
7
+ const clock = {
8
+ /** The current time as a `Date`. */
9
+ now() {
10
+ return new Date(source().now());
11
+ },
12
+ /** The current time in milliseconds since the Unix epoch. */
13
+ timestamp() {
14
+ return source().now();
15
+ }
16
+ };
17
+ /**
18
+ * Replace the clock's source, or restore the system clock with `undefined`.
19
+ * The test kit's `clockFake` is built on this.
20
+ */
21
+ function setClockSource(next) {
22
+ globalThis[SOURCE_KEY] = next;
23
+ }
24
+
25
+ //#endregion
26
+ export { clock, setClockSource };
27
+ //# sourceMappingURL=clock.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clock.mjs","names":[],"sources":["../../../../../../../../packages/core/src/utils/clock.ts"],"sourcesContent":["/**\n * The application clock.\n *\n * Read the current time through `clock` instead of `new Date()` / `Date.now()`\n * where a test needs to control it: tokens that expire, \"created 5 minutes\n * ago\", scheduled cut-offs. In the test environment the test kit swaps the\n * source for a frozen one (`clockFake` from `@warlock.js/core/tests`); in\n * every other environment it is the system clock.\n *\n * Only code that reads `clock` is affected — the global `Date` and timers are\n * never patched, so a fake clock cannot stall `setTimeout` or a driver.\n *\n * @example\n * import { clock } from \"@warlock.js/core\";\n *\n * const expiresAt = new Date(clock.timestamp() + 15 * 60_000);\n */\nexport type ClockSource = {\n /** Milliseconds since the Unix epoch. */\n now(): number;\n};\n\nconst systemClock: ClockSource = { now: () => Date.now() };\n\n// On `globalThis` so the framework loaded twice in one Vitest worker (native\n// and through vite-node) still reads one source.\nconst SOURCE_KEY = Symbol.for(\"warlock.core.clockSource\");\n\ntype SourceHolder = { [SOURCE_KEY]?: ClockSource };\n\nfunction source(): ClockSource {\n return (globalThis as SourceHolder)[SOURCE_KEY] ?? systemClock;\n}\n\nexport const clock = {\n /** The current time as a `Date`. */\n now(): Date {\n return new Date(source().now());\n },\n\n /** The current time in milliseconds since the Unix epoch. */\n timestamp(): number {\n return source().now();\n },\n};\n\n/**\n * Replace the clock's source, or restore the system clock with `undefined`.\n * The test kit's `clockFake` is built on this.\n */\nexport function setClockSource(next: ClockSource | undefined): void {\n (globalThis as SourceHolder)[SOURCE_KEY] = next;\n}\n"],"mappings":";AAsBA,MAAM,cAA2B,EAAE,WAAW,KAAK,IAAI,EAAE;AAIzD,MAAM,aAAa,OAAO,IAAI,0BAA0B;AAIxD,SAAS,SAAsB;CAC7B,OAAQ,WAA4B,eAAe;AACrD;AAEA,MAAa,QAAQ;;CAEnB,MAAY;EACV,OAAO,IAAI,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC;CAChC;;CAGA,YAAoB;EAClB,OAAO,OAAO,CAAC,CAAC,IAAI;CACtB;AACF;;;;;AAMA,SAAgB,eAAe,MAAqC;CAClE,AAAC,WAA4B,cAAc;AAC7C"}
@@ -11,7 +11,7 @@ let cachedVersion = null;
11
11
  */
12
12
  async function getWarlockVersion() {
13
13
  if (cachedVersion) return cachedVersion;
14
- const version = (await getJsonFileAsync(path.join(import.meta.dirname, "./../../package.json"))).version.replace(/\^|\~/g, "");
14
+ const version = (await getJsonFileAsync(path.join(import.meta.dirname, "./../../package.json"))).version.replace(/\^|~/g, "");
15
15
  cachedVersion = version;
16
16
  return version;
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"framework-vesion.mjs","names":[],"sources":["../../../../../../../../packages/core/src/utils/framework-vesion.ts"],"sourcesContent":["import { getJsonFileAsync } from \"@warlock.js/fs\";\nimport path from \"node:path\";\n\n/**\n * Cached version string\n */\nlet cachedVersion: string | null = null;\n\n/**\n * Get the framework version from package.json (cached)\n */\nexport async function getWarlockVersion(): Promise<string> {\n if (cachedVersion) return cachedVersion;\n\n const frameworkPackageJson = (await getJsonFileAsync(\n path.join(import.meta.dirname, \"./../../package.json\"),\n )) as { version: string };\n\n const version = frameworkPackageJson.version.replace(/\\^|\\~/g, \"\");\n cachedVersion = version;\n return version;\n}\n\nexport function getFrameworkVersion(): string | null {\n return cachedVersion;\n}\n"],"mappings":";;;;;;;AAMA,IAAI,gBAA+B;;;;AAKnC,eAAsB,oBAAqC;CACzD,IAAI,eAAe,OAAO;CAM1B,MAAM,WAAU,MAJoB,iBAClC,KAAK,KAAK,OAAO,KAAK,SAAS,sBAAsB,CACvD,EAEoC,CAAC,QAAQ,QAAQ,UAAU,EAAE;CACjE,gBAAgB;CAChB,OAAO;AACT;AAEA,SAAgB,sBAAqC;CACnD,OAAO;AACT"}
1
+ {"version":3,"file":"framework-vesion.mjs","names":[],"sources":["../../../../../../../../packages/core/src/utils/framework-vesion.ts"],"sourcesContent":["import { getJsonFileAsync } from \"@warlock.js/fs\";\nimport path from \"node:path\";\n\n/**\n * Cached version string\n */\nlet cachedVersion: string | null = null;\n\n/**\n * Get the framework version from package.json (cached)\n */\nexport async function getWarlockVersion(): Promise<string> {\n if (cachedVersion) return cachedVersion;\n\n const frameworkPackageJson = (await getJsonFileAsync(\n path.join(import.meta.dirname, \"./../../package.json\"),\n )) as { version: string };\n\n const version = frameworkPackageJson.version.replace(/\\^|~/g, \"\");\n cachedVersion = version;\n return version;\n}\n\nexport function getFrameworkVersion(): string | null {\n return cachedVersion;\n}\n"],"mappings":";;;;;;;AAMA,IAAI,gBAA+B;;;;AAKnC,eAAsB,oBAAqC;CACzD,IAAI,eAAe,OAAO;CAM1B,MAAM,WAAU,MAJoB,iBAClC,KAAK,KAAK,OAAO,KAAK,SAAS,sBAAsB,CACvD,EAEoC,CAAC,QAAQ,QAAQ,SAAS,EAAE;CAChE,gBAAgB;CAChB,OAAO;AACT;AAEA,SAAgB,sBAAqC;CACnD,OAAO;AACT"}
@@ -0,0 +1,32 @@
1
+ //#region ../../packages/core/src/utils/ids.d.ts
2
+ /**
3
+ * Identifier generation the test kit can make deterministic.
4
+ *
5
+ * Generate ids through `ids` instead of calling `crypto.randomUUID()` directly
6
+ * where a test needs to predict them (a snapshot, a file name, a link). In the
7
+ * test environment `idsFake` from `@warlock.js/core/tests` replaces the source
8
+ * with a numbered sequence; in every other environment the values come from
9
+ * `node:crypto`.
10
+ *
11
+ * @example
12
+ * import { ids } from "@warlock.js/core";
13
+ *
14
+ * const reference = ids.uuid();
15
+ * const resetToken = ids.token(48);
16
+ */
17
+ type IdsSource = {
18
+ /** A version 4 UUID. */uuid(): string; /** A URL-safe random string of exactly `length` characters. */
19
+ token(length: number): string;
20
+ };
21
+ declare const ids: {
22
+ /** A version 4 UUID. */uuid(): string; /** A URL-safe random string, 32 characters unless `length` says otherwise. */
23
+ token(length?: number): string;
24
+ };
25
+ /**
26
+ * Replace the id source, or restore `node:crypto` with `undefined`.
27
+ * The test kit's `idsFake` is built on this.
28
+ */
29
+ declare function setIdsSource(next: IdsSource | undefined): void;
30
+ //#endregion
31
+ export { IdsSource, ids, setIdsSource };
32
+ //# sourceMappingURL=ids.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/utils/ids.ts"],"mappings":";;AAiBA;;;;;;;;AAIsB;AAmBtB;;;;;KAvBY,SAAA;0BAEV,IAAA;EAEA,KAAA,CAAM,MAAA;AAAA;AAAA,cAmBK,GAAA;EAoBsB;;;;;;;iBAAnB,YAAA,CAAa,IAA2B,EAArB,SAAS"}
@@ -0,0 +1,33 @@
1
+ import { randomBytes, randomUUID } from "node:crypto";
2
+
3
+ //#region ../../packages/core/src/utils/ids.ts
4
+ const cryptoIds = {
5
+ uuid: () => randomUUID(),
6
+ token: (length) => randomBytes(Math.ceil(length * 3 / 4) + 1).toString("base64url").slice(0, length)
7
+ };
8
+ const SOURCE_KEY = Symbol.for("warlock.core.idsSource");
9
+ function source() {
10
+ return globalThis[SOURCE_KEY] ?? cryptoIds;
11
+ }
12
+ const ids = {
13
+ /** A version 4 UUID. */
14
+ uuid() {
15
+ return source().uuid();
16
+ },
17
+ /** A URL-safe random string, 32 characters unless `length` says otherwise. */
18
+ token(length = 32) {
19
+ if (!Number.isInteger(length) || length < 1) throw new RangeError(`ids.token(length) needs a positive integer, got ${String(length)}.`);
20
+ return source().token(length);
21
+ }
22
+ };
23
+ /**
24
+ * Replace the id source, or restore `node:crypto` with `undefined`.
25
+ * The test kit's `idsFake` is built on this.
26
+ */
27
+ function setIdsSource(next) {
28
+ globalThis[SOURCE_KEY] = next;
29
+ }
30
+
31
+ //#endregion
32
+ export { ids, setIdsSource };
33
+ //# sourceMappingURL=ids.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.mjs","names":[],"sources":["../../../../../../../../packages/core/src/utils/ids.ts"],"sourcesContent":["import { randomBytes, randomUUID } from \"node:crypto\";\n\n/**\n * Identifier generation the test kit can make deterministic.\n *\n * Generate ids through `ids` instead of calling `crypto.randomUUID()` directly\n * where a test needs to predict them (a snapshot, a file name, a link). In the\n * test environment `idsFake` from `@warlock.js/core/tests` replaces the source\n * with a numbered sequence; in every other environment the values come from\n * `node:crypto`.\n *\n * @example\n * import { ids } from \"@warlock.js/core\";\n *\n * const reference = ids.uuid();\n * const resetToken = ids.token(48);\n */\nexport type IdsSource = {\n /** A version 4 UUID. */\n uuid(): string;\n /** A URL-safe random string of exactly `length` characters. */\n token(length: number): string;\n};\n\nconst cryptoIds: IdsSource = {\n uuid: () => randomUUID(),\n token: (length) =>\n randomBytes(Math.ceil((length * 3) / 4) + 1)\n .toString(\"base64url\")\n .slice(0, length),\n};\n\nconst SOURCE_KEY = Symbol.for(\"warlock.core.idsSource\");\n\ntype SourceHolder = { [SOURCE_KEY]?: IdsSource };\n\nfunction source(): IdsSource {\n return (globalThis as SourceHolder)[SOURCE_KEY] ?? cryptoIds;\n}\n\nexport const ids = {\n /** A version 4 UUID. */\n uuid(): string {\n return source().uuid();\n },\n\n /** A URL-safe random string, 32 characters unless `length` says otherwise. */\n token(length = 32): string {\n if (!Number.isInteger(length) || length < 1) {\n throw new RangeError(`ids.token(length) needs a positive integer, got ${String(length)}.`);\n }\n\n return source().token(length);\n },\n};\n\n/**\n * Replace the id source, or restore `node:crypto` with `undefined`.\n * The test kit's `idsFake` is built on this.\n */\nexport function setIdsSource(next: IdsSource | undefined): void {\n (globalThis as SourceHolder)[SOURCE_KEY] = next;\n}\n"],"mappings":";;;AAwBA,MAAM,YAAuB;CAC3B,YAAY,WAAW;CACvB,QAAQ,WACN,YAAY,KAAK,KAAM,SAAS,IAAK,CAAC,IAAI,CAAC,CAAC,CACzC,SAAS,WAAW,CAAC,CACrB,MAAM,GAAG,MAAM;AACtB;AAEA,MAAM,aAAa,OAAO,IAAI,wBAAwB;AAItD,SAAS,SAAoB;CAC3B,OAAQ,WAA4B,eAAe;AACrD;AAEA,MAAa,MAAM;;CAEjB,OAAe;EACb,OAAO,OAAO,CAAC,CAAC,KAAK;CACvB;;CAGA,MAAM,SAAS,IAAY;EACzB,IAAI,CAAC,OAAO,UAAU,MAAM,KAAK,SAAS,GACxC,MAAM,IAAI,WAAW,mDAAmD,OAAO,MAAM,EAAE,EAAE;EAG3F,OAAO,OAAO,CAAC,CAAC,MAAM,MAAM;CAC9B;AACF;;;;;AAMA,SAAgB,aAAa,MAAmC;CAC9D,AAAC,WAA4B,cAAc;AAC7C"}
@@ -1,12 +1,15 @@
1
1
  import { LocalizedObject, getLocalized } from "./get-localized.mjs";
2
2
  import { Environment, RuntimeStrategy, environment, setEnvironment } from "./environment.mjs";
3
3
  import { appLog } from "./app-log.mjs";
4
+ import { ClockSource, clock, setClockSource } from "./clock.mjs";
4
5
  import { DatabaseLog, DatabaseLogOptions } from "./database-log.mjs";
6
+ import { IdsSource, ids, setIdsSource } from "./ids.mjs";
5
7
  import { Path } from "./normalized-path.mjs";
6
8
  import { fetchLatestVersion } from "./npm-registry.mjs";
7
9
  import { appPath, cachePath, configPath, logsPath, paths, publicPath, rootPath, sanitizePath, srcPath, storagePath, tempPath, uploadsPath, warlockPath } from "./paths.mjs";
8
10
  import { promiseAllObject } from "./promise-all-object.mjs";
9
11
  import { Queue } from "./queue.mjs";
12
+ import { JavaScriptRuntime, JavaScriptRuntimeName, SUPPORTED_RUNTIMES_DOCS_URL, assertNodeOnlyCommand, describeJavaScriptRuntime, detectJavaScriptRuntime, nodeOnlyCommandError, unverifiedBuildRuntimeNotice } from "./runtime.mjs";
10
13
  import { sleep } from "./sleep.mjs";
11
14
  import { sluggable } from "./sluggable.mjs";
12
15
  import { toJson } from "./to-json.mjs";
@@ -1,12 +1,15 @@
1
1
  import { appLog } from "./app-log.mjs";
2
+ import { clock, setClockSource } from "./clock.mjs";
2
3
  import { DatabaseLog } from "./database-log.mjs";
3
4
  import { environment, setEnvironment } from "./environment.mjs";
4
5
  import { getLocalized } from "./get-localized.mjs";
6
+ import { ids, setIdsSource } from "./ids.mjs";
5
7
  import { Path } from "./normalized-path.mjs";
6
8
  import { fetchLatestVersion } from "./npm-registry.mjs";
7
9
  import { appPath, cachePath, configPath, logsPath, paths, publicPath, rootPath, sanitizePath, srcPath, storagePath, tempPath, uploadsPath, warlockPath } from "./paths.mjs";
8
10
  import { promiseAllObject } from "./promise-all-object.mjs";
9
11
  import { Queue } from "./queue.mjs";
12
+ import { SUPPORTED_RUNTIMES_DOCS_URL, assertNodeOnlyCommand, describeJavaScriptRuntime, detectJavaScriptRuntime, nodeOnlyCommandError, unverifiedBuildRuntimeNotice } from "./runtime.mjs";
10
13
  import { sleep } from "./sleep.mjs";
11
14
  import { sluggable } from "./sluggable.mjs";
12
15
  import { toJson } from "./to-json.mjs";