@warlock.js/core 5.2.0 → 5.2.2

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 (1014) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/esm/application/app.d.mts +1 -1
  3. package/esm/application/app.d.mts.map +1 -1
  4. package/esm/application/app.mjs +1 -1
  5. package/esm/application/app.mjs.map +1 -1
  6. package/esm/application/application-config-types.d.mts +1 -1
  7. package/esm/application/application-config-types.d.mts.map +1 -1
  8. package/esm/application/application.d.mts +1 -1
  9. package/esm/application/application.d.mts.map +1 -1
  10. package/esm/application/application.mjs +1 -1
  11. package/esm/application/application.mjs.map +1 -1
  12. package/esm/application/boot-signal.d.mts +1 -1
  13. package/esm/application/boot-signal.d.mts.map +1 -1
  14. package/esm/application/boot-signal.mjs +1 -1
  15. package/esm/application/boot-signal.mjs.map +1 -1
  16. package/esm/benchmark/benchmark-snapshots.d.mts +1 -1
  17. package/esm/benchmark/benchmark-snapshots.d.mts.map +1 -1
  18. package/esm/benchmark/benchmark-snapshots.mjs +1 -1
  19. package/esm/benchmark/benchmark-snapshots.mjs.map +1 -1
  20. package/esm/benchmark/benchmark.d.mts +1 -1
  21. package/esm/benchmark/benchmark.d.mts.map +1 -1
  22. package/esm/benchmark/benchmark.mjs +1 -1
  23. package/esm/benchmark/benchmark.mjs.map +1 -1
  24. package/esm/benchmark/channels/console.channel.d.mts +1 -1
  25. package/esm/benchmark/channels/console.channel.d.mts.map +1 -1
  26. package/esm/benchmark/channels/console.channel.mjs +1 -1
  27. package/esm/benchmark/channels/console.channel.mjs.map +1 -1
  28. package/esm/benchmark/channels/noop.channel.d.mts +1 -1
  29. package/esm/benchmark/channels/noop.channel.d.mts.map +1 -1
  30. package/esm/benchmark/channels/noop.channel.mjs +1 -1
  31. package/esm/benchmark/channels/noop.channel.mjs.map +1 -1
  32. package/esm/benchmark/profiler.d.mts +1 -1
  33. package/esm/benchmark/profiler.d.mts.map +1 -1
  34. package/esm/benchmark/profiler.mjs +1 -1
  35. package/esm/benchmark/profiler.mjs.map +1 -1
  36. package/esm/benchmark/types.d.mts +1 -1
  37. package/esm/benchmark/types.d.mts.map +1 -1
  38. package/esm/bootstrap/setup.d.mts +1 -1
  39. package/esm/bootstrap/setup.d.mts.map +1 -1
  40. package/esm/bootstrap/setup.mjs +1 -1
  41. package/esm/bootstrap/setup.mjs.map +1 -1
  42. package/esm/bootstrap.d.mts +1 -1
  43. package/esm/bootstrap.d.mts.map +1 -1
  44. package/esm/bootstrap.mjs +1 -1
  45. package/esm/bootstrap.mjs.map +1 -1
  46. package/esm/cache/database-cache-driver.d.mts +1 -1
  47. package/esm/cache/database-cache-driver.d.mts.map +1 -1
  48. package/esm/cache/database-cache-driver.mjs +1 -1
  49. package/esm/cache/database-cache-driver.mjs.map +1 -1
  50. package/esm/cache/index.mjs +1 -1
  51. package/esm/cache/index.mjs.map +1 -1
  52. package/esm/cli/cli-commands.manager.mjs +1 -1
  53. package/esm/cli/cli-commands.manager.mjs.map +1 -1
  54. package/esm/cli/cli-commands.utils.mjs +1 -1
  55. package/esm/cli/cli-commands.utils.mjs.map +1 -1
  56. package/esm/cli/commands/add.command.mjs +1 -1
  57. package/esm/cli/commands/add.command.mjs.map +1 -1
  58. package/esm/cli/commands/build.command.mjs +1 -1
  59. package/esm/cli/commands/build.command.mjs.map +1 -1
  60. package/esm/cli/commands/create-database.command.mjs +1 -1
  61. package/esm/cli/commands/create-database.command.mjs.map +1 -1
  62. package/esm/cli/commands/dev-server.command.mjs +1 -1
  63. package/esm/cli/commands/dev-server.command.mjs.map +1 -1
  64. package/esm/cli/commands/doctor/boot-for-diagnostics.mjs +1 -1
  65. package/esm/cli/commands/doctor/boot-for-diagnostics.mjs.map +1 -1
  66. package/esm/cli/commands/doctor/checks/config.check.mjs +1 -1
  67. package/esm/cli/commands/doctor/checks/config.check.mjs.map +1 -1
  68. package/esm/cli/commands/doctor/checks/connectors.check.mjs +1 -1
  69. package/esm/cli/commands/doctor/checks/connectors.check.mjs.map +1 -1
  70. package/esm/cli/commands/doctor/checks/handler-signature.check.mjs +1 -1
  71. package/esm/cli/commands/doctor/checks/handler-signature.check.mjs.map +1 -1
  72. package/esm/cli/commands/doctor/checks/health.check.mjs +1 -1
  73. package/esm/cli/commands/doctor/checks/health.check.mjs.map +1 -1
  74. package/esm/cli/commands/doctor/checks/index.mjs +1 -1
  75. package/esm/cli/commands/doctor/checks/index.mjs.map +1 -1
  76. package/esm/cli/commands/doctor/checks/optional-peers.check.mjs +1 -1
  77. package/esm/cli/commands/doctor/checks/optional-peers.check.mjs.map +1 -1
  78. package/esm/cli/commands/doctor/checks/release-hygiene.check.mjs +1 -1
  79. package/esm/cli/commands/doctor/checks/release-hygiene.check.mjs.map +1 -1
  80. package/esm/cli/commands/doctor/checks/routes.check.mjs +1 -1
  81. package/esm/cli/commands/doctor/checks/routes.check.mjs.map +1 -1
  82. package/esm/cli/commands/doctor/doctor-command.action.mjs +1 -1
  83. package/esm/cli/commands/doctor/doctor-command.action.mjs.map +1 -1
  84. package/esm/cli/commands/doctor/format-report.mjs +1 -1
  85. package/esm/cli/commands/doctor/format-report.mjs.map +1 -1
  86. package/esm/cli/commands/doctor/run-checks.mjs +1 -1
  87. package/esm/cli/commands/doctor/run-checks.mjs.map +1 -1
  88. package/esm/cli/commands/doctor.command.mjs +1 -1
  89. package/esm/cli/commands/doctor.command.mjs.map +1 -1
  90. package/esm/cli/commands/drop-tables.command.mjs +1 -1
  91. package/esm/cli/commands/drop-tables.command.mjs.map +1 -1
  92. package/esm/cli/commands/generate/generate.command.mjs +1 -1
  93. package/esm/cli/commands/generate/generate.command.mjs.map +1 -1
  94. package/esm/cli/commands/generate/generators/column-dsl-parser.mjs +1 -1
  95. package/esm/cli/commands/generate/generators/column-dsl-parser.mjs.map +1 -1
  96. package/esm/cli/commands/generate/generators/controller.generator.mjs +1 -1
  97. package/esm/cli/commands/generate/generators/controller.generator.mjs.map +1 -1
  98. package/esm/cli/commands/generate/generators/migration.generator.mjs +1 -1
  99. package/esm/cli/commands/generate/generators/migration.generator.mjs.map +1 -1
  100. package/esm/cli/commands/generate/generators/model.generator.mjs +1 -1
  101. package/esm/cli/commands/generate/generators/model.generator.mjs.map +1 -1
  102. package/esm/cli/commands/generate/generators/module.generator.mjs +1 -1
  103. package/esm/cli/commands/generate/generators/module.generator.mjs.map +1 -1
  104. package/esm/cli/commands/generate/generators/repository.generator.mjs +1 -1
  105. package/esm/cli/commands/generate/generators/repository.generator.mjs.map +1 -1
  106. package/esm/cli/commands/generate/generators/resource.generator.mjs +1 -1
  107. package/esm/cli/commands/generate/generators/resource.generator.mjs.map +1 -1
  108. package/esm/cli/commands/generate/generators/service.generator.mjs +1 -1
  109. package/esm/cli/commands/generate/generators/service.generator.mjs.map +1 -1
  110. package/esm/cli/commands/generate/templates/stubs.mjs +1 -1
  111. package/esm/cli/commands/generate/templates/stubs.mjs.map +1 -1
  112. package/esm/cli/commands/generate/utils/name-parser.mjs +1 -1
  113. package/esm/cli/commands/generate/utils/name-parser.mjs.map +1 -1
  114. package/esm/cli/commands/generate/utils/path-resolver.mjs +1 -1
  115. package/esm/cli/commands/generate/utils/path-resolver.mjs.map +1 -1
  116. package/esm/cli/commands/generate/utils/prompt.mjs +1 -1
  117. package/esm/cli/commands/generate/utils/prompt.mjs.map +1 -1
  118. package/esm/cli/commands/generate/utils/writer.mjs +1 -1
  119. package/esm/cli/commands/generate/utils/writer.mjs.map +1 -1
  120. package/esm/cli/commands/migrate.command.mjs +1 -1
  121. package/esm/cli/commands/migrate.command.mjs.map +1 -1
  122. package/esm/cli/commands/routes/diff-page-routes.mjs +1 -1
  123. package/esm/cli/commands/routes/diff-page-routes.mjs.map +1 -1
  124. package/esm/cli/commands/routes/format-routes-table.mjs +1 -1
  125. package/esm/cli/commands/routes/format-routes-table.mjs.map +1 -1
  126. package/esm/cli/commands/routes/route-row.mjs +1 -1
  127. package/esm/cli/commands/routes/route-row.mjs.map +1 -1
  128. package/esm/cli/commands/routes/routes-command.action.mjs +1 -1
  129. package/esm/cli/commands/routes/routes-command.action.mjs.map +1 -1
  130. package/esm/cli/commands/routes/routes-diff.action.mjs +1 -1
  131. package/esm/cli/commands/routes/routes-diff.action.mjs.map +1 -1
  132. package/esm/cli/commands/routes.command.mjs +1 -1
  133. package/esm/cli/commands/routes.command.mjs.map +1 -1
  134. package/esm/cli/commands/seed.command.mjs +1 -1
  135. package/esm/cli/commands/seed.command.mjs.map +1 -1
  136. package/esm/cli/commands/start-production.command.mjs +1 -1
  137. package/esm/cli/commands/start-production.command.mjs.map +1 -1
  138. package/esm/cli/commands/storage-put.action.mjs +1 -1
  139. package/esm/cli/commands/storage-put.action.mjs.map +1 -1
  140. package/esm/cli/commands/storage-put.command.mjs +1 -1
  141. package/esm/cli/commands/storage-put.command.mjs.map +1 -1
  142. package/esm/cli/commands/typings-generator.command.mjs +1 -1
  143. package/esm/cli/commands/typings-generator.command.mjs.map +1 -1
  144. package/esm/cli/commands/update.command.mjs +1 -1
  145. package/esm/cli/commands/update.command.mjs.map +1 -1
  146. package/esm/cli/commands-loader.mjs +1 -1
  147. package/esm/cli/commands-loader.mjs.map +1 -1
  148. package/esm/cli/framework-cli-commands.mjs +1 -1
  149. package/esm/cli/framework-cli-commands.mjs.map +1 -1
  150. package/esm/cli/parse-cli-args.mjs +1 -1
  151. package/esm/cli/parse-cli-args.mjs.map +1 -1
  152. package/esm/cli/start.mjs +1 -1
  153. package/esm/cli/start.mjs.map +1 -1
  154. package/esm/cli/string-similarity.mjs +1 -1
  155. package/esm/cli/string-similarity.mjs.map +1 -1
  156. package/esm/commands/cli-command.d.mts +1 -1
  157. package/esm/commands/cli-command.d.mts.map +1 -1
  158. package/esm/commands/cli-command.mjs +1 -1
  159. package/esm/commands/cli-command.mjs.map +1 -1
  160. package/esm/commands/types.d.mts +1 -1
  161. package/esm/commands/types.d.mts.map +1 -1
  162. package/esm/config/config-getter.d.mts +1 -1
  163. package/esm/config/config-getter.d.mts.map +1 -1
  164. package/esm/config/config-getter.mjs +1 -1
  165. package/esm/config/config-getter.mjs.map +1 -1
  166. package/esm/config/config-handlers.d.mts +1 -1
  167. package/esm/config/config-handlers.d.mts.map +1 -1
  168. package/esm/config/config-handlers.mjs +1 -1
  169. package/esm/config/config-handlers.mjs.map +1 -1
  170. package/esm/config/config-loader.d.mts +1 -1
  171. package/esm/config/config-loader.d.mts.map +1 -1
  172. package/esm/config/config-loader.mjs +1 -1
  173. package/esm/config/config-loader.mjs.map +1 -1
  174. package/esm/config/config-manager.mjs +1 -1
  175. package/esm/config/config-manager.mjs.map +1 -1
  176. package/esm/config/config-setter.d.mts +1 -1
  177. package/esm/config/config-setter.d.mts.map +1 -1
  178. package/esm/config/config-setter.mjs +1 -1
  179. package/esm/config/config-setter.mjs.map +1 -1
  180. package/esm/config/config-special-handlers.d.mts +1 -1
  181. package/esm/config/config-special-handlers.d.mts.map +1 -1
  182. package/esm/config/config-special-handlers.mjs +1 -1
  183. package/esm/config/config-special-handlers.mjs.map +1 -1
  184. package/esm/config/load-config-files.mjs +1 -1
  185. package/esm/config/load-config-files.mjs.map +1 -1
  186. package/esm/config/locale-configuration.mjs +1 -1
  187. package/esm/config/locale-configuration.mjs.map +1 -1
  188. package/esm/config/types.d.mts +1 -1
  189. package/esm/config/types.d.mts.map +1 -1
  190. package/esm/connectors/access-connector.d.mts +1 -1
  191. package/esm/connectors/access-connector.d.mts.map +1 -1
  192. package/esm/connectors/access-connector.mjs +1 -1
  193. package/esm/connectors/access-connector.mjs.map +1 -1
  194. package/esm/connectors/ai-connector.d.mts +1 -1
  195. package/esm/connectors/ai-connector.d.mts.map +1 -1
  196. package/esm/connectors/ai-connector.mjs +1 -1
  197. package/esm/connectors/ai-connector.mjs.map +1 -1
  198. package/esm/connectors/assert-no-reserved-connector-names.d.mts +1 -1
  199. package/esm/connectors/assert-no-reserved-connector-names.d.mts.map +1 -1
  200. package/esm/connectors/assert-no-reserved-connector-names.mjs +1 -1
  201. package/esm/connectors/assert-no-reserved-connector-names.mjs.map +1 -1
  202. package/esm/connectors/assert-unique-connector-names.d.mts +1 -1
  203. package/esm/connectors/assert-unique-connector-names.d.mts.map +1 -1
  204. package/esm/connectors/assert-unique-connector-names.mjs +1 -1
  205. package/esm/connectors/assert-unique-connector-names.mjs.map +1 -1
  206. package/esm/connectors/base-connector.d.mts +1 -1
  207. package/esm/connectors/base-connector.d.mts.map +1 -1
  208. package/esm/connectors/base-connector.mjs +1 -1
  209. package/esm/connectors/base-connector.mjs.map +1 -1
  210. package/esm/connectors/cache-connector.d.mts +1 -1
  211. package/esm/connectors/cache-connector.d.mts.map +1 -1
  212. package/esm/connectors/cache-connector.mjs +1 -1
  213. package/esm/connectors/cache-connector.mjs.map +1 -1
  214. package/esm/connectors/connectors-manager.d.mts +1 -1
  215. package/esm/connectors/connectors-manager.d.mts.map +1 -1
  216. package/esm/connectors/connectors-manager.mjs +1 -1
  217. package/esm/connectors/connectors-manager.mjs.map +1 -1
  218. package/esm/connectors/database-connector.d.mts +1 -1
  219. package/esm/connectors/database-connector.d.mts.map +1 -1
  220. package/esm/connectors/database-connector.mjs +1 -1
  221. package/esm/connectors/database-connector.mjs.map +1 -1
  222. package/esm/connectors/describe-server-address.mjs +1 -1
  223. package/esm/connectors/describe-server-address.mjs.map +1 -1
  224. package/esm/connectors/herald-connector.d.mts +1 -1
  225. package/esm/connectors/herald-connector.d.mts.map +1 -1
  226. package/esm/connectors/herald-connector.mjs +1 -1
  227. package/esm/connectors/herald-connector.mjs.map +1 -1
  228. package/esm/connectors/http-connector.d.mts +1 -1
  229. package/esm/connectors/http-connector.d.mts.map +1 -1
  230. package/esm/connectors/http-connector.mjs +1 -1
  231. package/esm/connectors/http-connector.mjs.map +1 -1
  232. package/esm/connectors/logger-connector.d.mts +1 -1
  233. package/esm/connectors/logger-connector.d.mts.map +1 -1
  234. package/esm/connectors/logger-connector.mjs +1 -1
  235. package/esm/connectors/logger-connector.mjs.map +1 -1
  236. package/esm/connectors/mail-connector.d.mts +1 -1
  237. package/esm/connectors/mail-connector.d.mts.map +1 -1
  238. package/esm/connectors/mail-connector.mjs +1 -1
  239. package/esm/connectors/mail-connector.mjs.map +1 -1
  240. package/esm/connectors/notifications-connector.d.mts +1 -1
  241. package/esm/connectors/notifications-connector.d.mts.map +1 -1
  242. package/esm/connectors/notifications-connector.mjs +1 -1
  243. package/esm/connectors/notifications-connector.mjs.map +1 -1
  244. package/esm/connectors/register-configured-connectors.d.mts +1 -1
  245. package/esm/connectors/register-configured-connectors.d.mts.map +1 -1
  246. package/esm/connectors/register-configured-connectors.mjs +1 -1
  247. package/esm/connectors/register-configured-connectors.mjs.map +1 -1
  248. package/esm/connectors/socket-connector.d.mts +1 -1
  249. package/esm/connectors/socket-connector.d.mts.map +1 -1
  250. package/esm/connectors/socket-connector.mjs +1 -1
  251. package/esm/connectors/socket-connector.mjs.map +1 -1
  252. package/esm/connectors/storage.connector.d.mts +1 -1
  253. package/esm/connectors/storage.connector.d.mts.map +1 -1
  254. package/esm/connectors/storage.connector.mjs +1 -1
  255. package/esm/connectors/storage.connector.mjs.map +1 -1
  256. package/esm/connectors/types.d.mts +1 -1
  257. package/esm/connectors/types.d.mts.map +1 -1
  258. package/esm/connectors/types.mjs +1 -1
  259. package/esm/connectors/types.mjs.map +1 -1
  260. package/esm/container/index.d.mts +1 -1
  261. package/esm/container/index.d.mts.map +1 -1
  262. package/esm/container/index.mjs +1 -1
  263. package/esm/container/index.mjs.map +1 -1
  264. package/esm/database/create-database-action.mjs +1 -1
  265. package/esm/database/create-database-action.mjs.map +1 -1
  266. package/esm/database/drop-tables-action.mjs +1 -1
  267. package/esm/database/drop-tables-action.mjs.map +1 -1
  268. package/esm/database/migrate-action.mjs +1 -1
  269. package/esm/database/migrate-action.mjs.map +1 -1
  270. package/esm/database/models/database-log/database-log.d.mts +1 -1
  271. package/esm/database/models/database-log/database-log.d.mts.map +1 -1
  272. package/esm/database/models/database-log/database-log.mjs +1 -1
  273. package/esm/database/models/database-log/database-log.mjs.map +1 -1
  274. package/esm/database/pending-exit-code.mjs +1 -1
  275. package/esm/database/pending-exit-code.mjs.map +1 -1
  276. package/esm/database/resolve-pending-migrations.mjs +1 -1
  277. package/esm/database/resolve-pending-migrations.mjs.map +1 -1
  278. package/esm/database/seed-command-action.mjs +1 -1
  279. package/esm/database/seed-command-action.mjs.map +1 -1
  280. package/esm/database/seeds/seed-records-table-migration.mjs +1 -1
  281. package/esm/database/seeds/seed-records-table-migration.mjs.map +1 -1
  282. package/esm/database/seeds/seeder.d.mts +1 -1
  283. package/esm/database/seeds/seeder.d.mts.map +1 -1
  284. package/esm/database/seeds/seeder.errors.d.mts +1 -1
  285. package/esm/database/seeds/seeder.errors.d.mts.map +1 -1
  286. package/esm/database/seeds/seeder.errors.mjs +1 -1
  287. package/esm/database/seeds/seeder.errors.mjs.map +1 -1
  288. package/esm/database/seeds/seeder.mjs +1 -1
  289. package/esm/database/seeds/seeder.mjs.map +1 -1
  290. package/esm/database/seeds/seeders.manager.mjs +1 -1
  291. package/esm/database/seeds/seeders.manager.mjs.map +1 -1
  292. package/esm/database/seeds/seeds-table-migration.mjs +1 -1
  293. package/esm/database/seeds/seeds-table-migration.mjs.map +1 -1
  294. package/esm/database/seeds/types.d.mts +1 -1
  295. package/esm/database/seeds/types.d.mts.map +1 -1
  296. package/esm/database/seeds/utils.mjs +1 -1
  297. package/esm/database/seeds/utils.mjs.map +1 -1
  298. package/esm/database/utils.d.mts +1 -1
  299. package/esm/database/utils.d.mts.map +1 -1
  300. package/esm/database/utils.mjs +1 -1
  301. package/esm/database/utils.mjs.map +1 -1
  302. package/esm/dev-server/check-for-updates.mjs +1 -1
  303. package/esm/dev-server/check-for-updates.mjs.map +1 -1
  304. package/esm/dev-server/create-worker.mjs +1 -1
  305. package/esm/dev-server/create-worker.mjs.map +1 -1
  306. package/esm/dev-server/dependency-graph.d.mts +1 -1
  307. package/esm/dev-server/dependency-graph.d.mts.map +1 -1
  308. package/esm/dev-server/dependency-graph.mjs +1 -1
  309. package/esm/dev-server/dependency-graph.mjs.map +1 -1
  310. package/esm/dev-server/dev-logger.mjs +1 -1
  311. package/esm/dev-server/dev-logger.mjs.map +1 -1
  312. package/esm/dev-server/development-server.mjs +1 -1
  313. package/esm/dev-server/development-server.mjs.map +1 -1
  314. package/esm/dev-server/events.mjs +1 -1
  315. package/esm/dev-server/events.mjs.map +1 -1
  316. package/esm/dev-server/file-event-handler.mjs +1 -1
  317. package/esm/dev-server/file-event-handler.mjs.map +1 -1
  318. package/esm/dev-server/file-manager.d.mts +1 -1
  319. package/esm/dev-server/file-manager.d.mts.map +1 -1
  320. package/esm/dev-server/file-manager.mjs +1 -1
  321. package/esm/dev-server/file-manager.mjs.map +1 -1
  322. package/esm/dev-server/file-operations.d.mts +1 -1
  323. package/esm/dev-server/file-operations.d.mts.map +1 -1
  324. package/esm/dev-server/file-operations.mjs +1 -1
  325. package/esm/dev-server/file-operations.mjs.map +1 -1
  326. package/esm/dev-server/files-orchestrator.mjs +1 -1
  327. package/esm/dev-server/files-orchestrator.mjs.map +1 -1
  328. package/esm/dev-server/files-watcher.mjs +1 -1
  329. package/esm/dev-server/files-watcher.mjs.map +1 -1
  330. package/esm/dev-server/flags.mjs +1 -1
  331. package/esm/dev-server/flags.mjs.map +1 -1
  332. package/esm/dev-server/health-checker/checkers/base-health-checker.mjs +1 -1
  333. package/esm/dev-server/health-checker/checkers/base-health-checker.mjs.map +1 -1
  334. package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs +1 -1
  335. package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs.map +1 -1
  336. package/esm/dev-server/health-checker/checkers/typescript-health-checker.mjs +1 -1
  337. package/esm/dev-server/health-checker/checkers/typescript-health-checker.mjs.map +1 -1
  338. package/esm/dev-server/health-checker/file-health-checker.contract.d.mts +1 -1
  339. package/esm/dev-server/health-checker/file-health-checker.contract.d.mts.map +1 -1
  340. package/esm/dev-server/health-checker/file-health-result.d.mts +1 -1
  341. package/esm/dev-server/health-checker/file-health-result.d.mts.map +1 -1
  342. package/esm/dev-server/health-checker/file-health-result.mjs +1 -1
  343. package/esm/dev-server/health-checker/file-health-result.mjs.map +1 -1
  344. package/esm/dev-server/health-checker/files-healthcare.manager.mjs +1 -1
  345. package/esm/dev-server/health-checker/files-healthcare.manager.mjs.map +1 -1
  346. package/esm/dev-server/health-checker/workers/eslint-health.worker.mjs +1 -1
  347. package/esm/dev-server/health-checker/workers/eslint-health.worker.mjs.map +1 -1
  348. package/esm/dev-server/health-checker/workers/ts-health.worker.mjs +1 -1
  349. package/esm/dev-server/health-checker/workers/ts-health.worker.mjs.map +1 -1
  350. package/esm/dev-server/layer-executor.mjs +1 -1
  351. package/esm/dev-server/layer-executor.mjs.map +1 -1
  352. package/esm/dev-server/loader/build-transpile-init.mjs +1 -1
  353. package/esm/dev-server/loader/build-transpile-init.mjs.map +1 -1
  354. package/esm/dev-server/loader/hook-thread.d.mts +1 -1
  355. package/esm/dev-server/loader/hook-thread.d.mts.map +1 -1
  356. package/esm/dev-server/loader/hook-thread.mjs +1 -1
  357. package/esm/dev-server/loader/hook-thread.mjs.map +1 -1
  358. package/esm/dev-server/loader/load-hook.d.mts +1 -1
  359. package/esm/dev-server/loader/load-hook.d.mts.map +1 -1
  360. package/esm/dev-server/loader/load-hook.mjs +1 -1
  361. package/esm/dev-server/loader/load-hook.mjs.map +1 -1
  362. package/esm/dev-server/loader/own-resolver.mjs +1 -1
  363. package/esm/dev-server/loader/own-resolver.mjs.map +1 -1
  364. package/esm/dev-server/loader/register-loader.mjs +1 -1
  365. package/esm/dev-server/loader/register-loader.mjs.map +1 -1
  366. package/esm/dev-server/loader/resolve-capture.mjs +1 -1
  367. package/esm/dev-server/loader/resolve-capture.mjs.map +1 -1
  368. package/esm/dev-server/loader/resolve-hook.d.mts +1 -1
  369. package/esm/dev-server/loader/resolve-hook.d.mts.map +1 -1
  370. package/esm/dev-server/loader/resolve-hook.mjs +1 -1
  371. package/esm/dev-server/loader/resolve-hook.mjs.map +1 -1
  372. package/esm/dev-server/loader/source-slug.mjs +1 -1
  373. package/esm/dev-server/loader/source-slug.mjs.map +1 -1
  374. package/esm/dev-server/loader/transpile-cache.mjs +1 -1
  375. package/esm/dev-server/loader/transpile-cache.mjs.map +1 -1
  376. package/esm/dev-server/loader/version-registry.mjs +1 -1
  377. package/esm/dev-server/loader/version-registry.mjs.map +1 -1
  378. package/esm/dev-server/manifest-manager.d.mts +1 -1
  379. package/esm/dev-server/manifest-manager.d.mts.map +1 -1
  380. package/esm/dev-server/manifest-manager.mjs +1 -1
  381. package/esm/dev-server/manifest-manager.mjs.map +1 -1
  382. package/esm/dev-server/module-loader.mjs +1 -1
  383. package/esm/dev-server/module-loader.mjs.map +1 -1
  384. package/esm/dev-server/package-json-manager.mjs +1 -1
  385. package/esm/dev-server/package-json-manager.mjs.map +1 -1
  386. package/esm/dev-server/parse-imports.mjs +1 -1
  387. package/esm/dev-server/parse-imports.mjs.map +1 -1
  388. package/esm/dev-server/read-config-ast.mjs +1 -1
  389. package/esm/dev-server/read-config-ast.mjs.map +1 -1
  390. package/esm/dev-server/ready-block.mjs +1 -1
  391. package/esm/dev-server/ready-block.mjs.map +1 -1
  392. package/esm/dev-server/register-dev-shortcuts.mjs +1 -1
  393. package/esm/dev-server/register-dev-shortcuts.mjs.map +1 -1
  394. package/esm/dev-server/restart-dev-server.mjs +1 -1
  395. package/esm/dev-server/restart-dev-server.mjs.map +1 -1
  396. package/esm/dev-server/run-typings-generation.mjs +1 -1
  397. package/esm/dev-server/run-typings-generation.mjs.map +1 -1
  398. package/esm/dev-server/shortcuts.mjs +1 -1
  399. package/esm/dev-server/shortcuts.mjs.map +1 -1
  400. package/esm/dev-server/special-files-collector.d.mts +1 -1
  401. package/esm/dev-server/special-files-collector.d.mts.map +1 -1
  402. package/esm/dev-server/special-files-collector.mjs +1 -1
  403. package/esm/dev-server/special-files-collector.mjs.map +1 -1
  404. package/esm/dev-server/start-development-server.mjs +1 -1
  405. package/esm/dev-server/start-development-server.mjs.map +1 -1
  406. package/esm/dev-server/supervisor.mjs +1 -1
  407. package/esm/dev-server/supervisor.mjs.map +1 -1
  408. package/esm/dev-server/tsconfig-manager.mjs +1 -1
  409. package/esm/dev-server/tsconfig-manager.mjs.map +1 -1
  410. package/esm/dev-server/type-generator.mjs +1 -1
  411. package/esm/dev-server/type-generator.mjs.map +1 -1
  412. package/esm/dev-server/types.d.mts +1 -1
  413. package/esm/dev-server/types.d.mts.map +1 -1
  414. package/esm/dev-server/update-check-cache.mjs +1 -1
  415. package/esm/dev-server/update-check-cache.mjs.map +1 -1
  416. package/esm/dev-server/utils.mjs +1 -1
  417. package/esm/dev-server/utils.mjs.map +1 -1
  418. package/esm/encryption/encrypt.d.mts +1 -1
  419. package/esm/encryption/encrypt.d.mts.map +1 -1
  420. package/esm/encryption/encrypt.mjs +1 -1
  421. package/esm/encryption/encrypt.mjs.map +1 -1
  422. package/esm/encryption/hash.d.mts +1 -1
  423. package/esm/encryption/hash.d.mts.map +1 -1
  424. package/esm/encryption/hash.mjs +1 -1
  425. package/esm/encryption/hash.mjs.map +1 -1
  426. package/esm/encryption/password.d.mts +1 -1
  427. package/esm/encryption/password.d.mts.map +1 -1
  428. package/esm/encryption/password.mjs +1 -1
  429. package/esm/encryption/password.mjs.map +1 -1
  430. package/esm/encryption/types.d.mts +1 -1
  431. package/esm/encryption/types.d.mts.map +1 -1
  432. package/esm/generations/add-command.action.mjs +1 -1
  433. package/esm/generations/add-command.action.mjs.map +1 -1
  434. package/esm/generations/features/access.feature.mjs +1 -1
  435. package/esm/generations/features/access.feature.mjs.map +1 -1
  436. package/esm/generations/features/ai-anthropic.feature.mjs +1 -1
  437. package/esm/generations/features/ai-anthropic.feature.mjs.map +1 -1
  438. package/esm/generations/features/ai-bedrock.feature.mjs +1 -1
  439. package/esm/generations/features/ai-bedrock.feature.mjs.map +1 -1
  440. package/esm/generations/features/ai-google.feature.mjs +1 -1
  441. package/esm/generations/features/ai-google.feature.mjs.map +1 -1
  442. package/esm/generations/features/ai-ollama.feature.mjs +1 -1
  443. package/esm/generations/features/ai-ollama.feature.mjs.map +1 -1
  444. package/esm/generations/features/ai-openai.feature.mjs +1 -1
  445. package/esm/generations/features/ai-openai.feature.mjs.map +1 -1
  446. package/esm/generations/features/ai-panoptic.feature.mjs +1 -1
  447. package/esm/generations/features/ai-panoptic.feature.mjs.map +1 -1
  448. package/esm/generations/features/ai-tools.feature.mjs +1 -1
  449. package/esm/generations/features/ai-tools.feature.mjs.map +1 -1
  450. package/esm/generations/features/ai-workspace.feature.mjs +1 -1
  451. package/esm/generations/features/ai-workspace.feature.mjs.map +1 -1
  452. package/esm/generations/features/ai.feature.mjs +1 -1
  453. package/esm/generations/features/ai.feature.mjs.map +1 -1
  454. package/esm/generations/features/herald.feature.mjs +1 -1
  455. package/esm/generations/features/herald.feature.mjs.map +1 -1
  456. package/esm/generations/features/image.feature.mjs +1 -1
  457. package/esm/generations/features/image.feature.mjs.map +1 -1
  458. package/esm/generations/features/index.mjs +1 -1
  459. package/esm/generations/features/index.mjs.map +1 -1
  460. package/esm/generations/features/mail.feature.mjs +1 -1
  461. package/esm/generations/features/mail.feature.mjs.map +1 -1
  462. package/esm/generations/features/mongodb.feature.mjs +1 -1
  463. package/esm/generations/features/mongodb.feature.mjs.map +1 -1
  464. package/esm/generations/features/mysql.feature.mjs +1 -1
  465. package/esm/generations/features/mysql.feature.mjs.map +1 -1
  466. package/esm/generations/features/notifications.feature.mjs +1 -1
  467. package/esm/generations/features/notifications.feature.mjs.map +1 -1
  468. package/esm/generations/features/postgres.feature.mjs +1 -1
  469. package/esm/generations/features/postgres.feature.mjs.map +1 -1
  470. package/esm/generations/features/react-email.feature.mjs +1 -1
  471. package/esm/generations/features/react-email.feature.mjs.map +1 -1
  472. package/esm/generations/features/react.feature.mjs +1 -1
  473. package/esm/generations/features/react.feature.mjs.map +1 -1
  474. package/esm/generations/features/redis.feature.mjs +1 -1
  475. package/esm/generations/features/redis.feature.mjs.map +1 -1
  476. package/esm/generations/features/s3.feature.mjs +1 -1
  477. package/esm/generations/features/s3.feature.mjs.map +1 -1
  478. package/esm/generations/features/scheduler.feature.mjs +1 -1
  479. package/esm/generations/features/scheduler.feature.mjs.map +1 -1
  480. package/esm/generations/features/ses.feature.mjs +1 -1
  481. package/esm/generations/features/ses.feature.mjs.map +1 -1
  482. package/esm/generations/features/shadcn.feature.mjs +1 -1
  483. package/esm/generations/features/shadcn.feature.mjs.map +1 -1
  484. package/esm/generations/features/shared/link-ai-package-import.mjs +1 -1
  485. package/esm/generations/features/shared/link-ai-package-import.mjs.map +1 -1
  486. package/esm/generations/features/shared/migration-timestamp.mjs +1 -1
  487. package/esm/generations/features/shared/migration-timestamp.mjs.map +1 -1
  488. package/esm/generations/features/socket.feature.mjs +1 -1
  489. package/esm/generations/features/socket.feature.mjs.map +1 -1
  490. package/esm/generations/features/tailwind.feature.mjs +1 -1
  491. package/esm/generations/features/tailwind.feature.mjs.map +1 -1
  492. package/esm/generations/features/test.feature.mjs +1 -1
  493. package/esm/generations/features/test.feature.mjs.map +1 -1
  494. package/esm/generations/features/types.mjs +1 -1
  495. package/esm/generations/features/types.mjs.map +1 -1
  496. package/esm/generations/features/web.feature.mjs +1 -1
  497. package/esm/generations/features/web.feature.mjs.map +1 -1
  498. package/esm/generations/stubs.mjs +1 -1
  499. package/esm/generations/stubs.mjs.map +1 -1
  500. package/esm/http/boot-port-preflight.d.mts +1 -1
  501. package/esm/http/boot-port-preflight.d.mts.map +1 -1
  502. package/esm/http/boot-port-preflight.mjs +1 -1
  503. package/esm/http/boot-port-preflight.mjs.map +1 -1
  504. package/esm/http/build-cors-options.mjs +1 -1
  505. package/esm/http/build-cors-options.mjs.map +1 -1
  506. package/esm/http/config.d.mts +1 -1
  507. package/esm/http/config.d.mts.map +1 -1
  508. package/esm/http/config.mjs +1 -1
  509. package/esm/http/config.mjs.map +1 -1
  510. package/esm/http/context/request-context.d.mts +1 -1
  511. package/esm/http/context/request-context.d.mts.map +1 -1
  512. package/esm/http/context/request-context.mjs +1 -1
  513. package/esm/http/context/request-context.mjs.map +1 -1
  514. package/esm/http/context/request-memo.d.mts +1 -1
  515. package/esm/http/context/request-memo.d.mts.map +1 -1
  516. package/esm/http/context/request-memo.mjs +1 -1
  517. package/esm/http/context/request-memo.mjs.map +1 -1
  518. package/esm/http/createHttpApplication.d.mts +1 -1
  519. package/esm/http/createHttpApplication.d.mts.map +1 -1
  520. package/esm/http/createHttpApplication.mjs +1 -1
  521. package/esm/http/createHttpApplication.mjs.map +1 -1
  522. package/esm/http/database/RequestLog.d.mts +1 -1
  523. package/esm/http/database/RequestLog.d.mts.map +1 -1
  524. package/esm/http/database/RequestLog.mjs +1 -1
  525. package/esm/http/database/RequestLog.mjs.map +1 -1
  526. package/esm/http/error-codes.d.mts +1 -1
  527. package/esm/http/error-codes.d.mts.map +1 -1
  528. package/esm/http/error-codes.mjs +1 -1
  529. package/esm/http/error-codes.mjs.map +1 -1
  530. package/esm/http/errors/errors.d.mts +1 -1
  531. package/esm/http/errors/errors.d.mts.map +1 -1
  532. package/esm/http/errors/errors.mjs +1 -1
  533. package/esm/http/errors/errors.mjs.map +1 -1
  534. package/esm/http/events.d.mts +1 -1
  535. package/esm/http/events.d.mts.map +1 -1
  536. package/esm/http/events.mjs +1 -1
  537. package/esm/http/events.mjs.map +1 -1
  538. package/esm/http/health.d.mts +1 -1
  539. package/esm/http/health.d.mts.map +1 -1
  540. package/esm/http/health.mjs +1 -1
  541. package/esm/http/health.mjs.map +1 -1
  542. package/esm/http/middleware/cache-response-middleware.d.mts +1 -1
  543. package/esm/http/middleware/cache-response-middleware.d.mts.map +1 -1
  544. package/esm/http/middleware/cache-response-middleware.mjs +1 -1
  545. package/esm/http/middleware/cache-response-middleware.mjs.map +1 -1
  546. package/esm/http/middleware/concurrency-limit.middleware.d.mts +1 -1
  547. package/esm/http/middleware/concurrency-limit.middleware.d.mts.map +1 -1
  548. package/esm/http/middleware/concurrency-limit.middleware.mjs +1 -1
  549. package/esm/http/middleware/concurrency-limit.middleware.mjs.map +1 -1
  550. package/esm/http/middleware/idempotency.middleware.d.mts +1 -1
  551. package/esm/http/middleware/idempotency.middleware.d.mts.map +1 -1
  552. package/esm/http/middleware/idempotency.middleware.mjs +1 -1
  553. package/esm/http/middleware/idempotency.middleware.mjs.map +1 -1
  554. package/esm/http/middleware/inject-request-context.d.mts +1 -1
  555. package/esm/http/middleware/inject-request-context.d.mts.map +1 -1
  556. package/esm/http/middleware/inject-request-context.mjs +1 -1
  557. package/esm/http/middleware/inject-request-context.mjs.map +1 -1
  558. package/esm/http/middleware/ip-filter.middleware.d.mts +1 -1
  559. package/esm/http/middleware/ip-filter.middleware.d.mts.map +1 -1
  560. package/esm/http/middleware/ip-filter.middleware.mjs +1 -1
  561. package/esm/http/middleware/ip-filter.middleware.mjs.map +1 -1
  562. package/esm/http/middleware/maintenance.middleware.d.mts +1 -1
  563. package/esm/http/middleware/maintenance.middleware.d.mts.map +1 -1
  564. package/esm/http/middleware/maintenance.middleware.mjs +1 -1
  565. package/esm/http/middleware/maintenance.middleware.mjs.map +1 -1
  566. package/esm/http/middleware/max-body-size.middleware.d.mts +1 -1
  567. package/esm/http/middleware/max-body-size.middleware.d.mts.map +1 -1
  568. package/esm/http/middleware/max-body-size.middleware.mjs +1 -1
  569. package/esm/http/middleware/max-body-size.middleware.mjs.map +1 -1
  570. package/esm/http/middleware/middleware-list.d.mts +1 -1
  571. package/esm/http/middleware/middleware-list.d.mts.map +1 -1
  572. package/esm/http/middleware/middleware-list.mjs +1 -1
  573. package/esm/http/middleware/middleware-list.mjs.map +1 -1
  574. package/esm/http/middleware/rate-limit.middleware.d.mts +1 -1
  575. package/esm/http/middleware/rate-limit.middleware.d.mts.map +1 -1
  576. package/esm/http/middleware/rate-limit.middleware.mjs +1 -1
  577. package/esm/http/middleware/rate-limit.middleware.mjs.map +1 -1
  578. package/esm/http/middleware/utils/cidr-match.d.mts +1 -1
  579. package/esm/http/middleware/utils/cidr-match.d.mts.map +1 -1
  580. package/esm/http/middleware/utils/cidr-match.mjs +1 -1
  581. package/esm/http/middleware/utils/cidr-match.mjs.map +1 -1
  582. package/esm/http/middleware/utils/idempotency-key.d.mts +1 -1
  583. package/esm/http/middleware/utils/idempotency-key.d.mts.map +1 -1
  584. package/esm/http/middleware/utils/idempotency-key.mjs +1 -1
  585. package/esm/http/middleware/utils/idempotency-key.mjs.map +1 -1
  586. package/esm/http/middleware/utils/parse-size.d.mts +1 -1
  587. package/esm/http/middleware/utils/parse-size.d.mts.map +1 -1
  588. package/esm/http/middleware/utils/parse-size.mjs +1 -1
  589. package/esm/http/middleware/utils/parse-size.mjs.map +1 -1
  590. package/esm/http/plugins.d.mts +1 -1
  591. package/esm/http/plugins.d.mts.map +1 -1
  592. package/esm/http/plugins.mjs +1 -1
  593. package/esm/http/plugins.mjs.map +1 -1
  594. package/esm/http/port-preflight.d.mts +1 -1
  595. package/esm/http/port-preflight.d.mts.map +1 -1
  596. package/esm/http/port-preflight.mjs +1 -1
  597. package/esm/http/port-preflight.mjs.map +1 -1
  598. package/esm/http/ready-report.d.mts +1 -1
  599. package/esm/http/ready-report.d.mts.map +1 -1
  600. package/esm/http/ready-report.mjs +1 -1
  601. package/esm/http/ready-report.mjs.map +1 -1
  602. package/esm/http/request-controller.d.mts +1 -1
  603. package/esm/http/request-controller.d.mts.map +1 -1
  604. package/esm/http/request-controller.mjs +1 -1
  605. package/esm/http/request-controller.mjs.map +1 -1
  606. package/esm/http/request.d.mts +1 -1
  607. package/esm/http/request.d.mts.map +1 -1
  608. package/esm/http/request.mjs +1 -1
  609. package/esm/http/request.mjs.map +1 -1
  610. package/esm/http/response.d.mts +1 -1
  611. package/esm/http/response.d.mts.map +1 -1
  612. package/esm/http/response.mjs +1 -1
  613. package/esm/http/response.mjs.map +1 -1
  614. package/esm/http/server.d.mts +1 -1
  615. package/esm/http/server.d.mts.map +1 -1
  616. package/esm/http/server.mjs +1 -1
  617. package/esm/http/server.mjs.map +1 -1
  618. package/esm/http/types.d.mts +1 -1
  619. package/esm/http/types.d.mts.map +1 -1
  620. package/esm/http/uploaded-file.d.mts +1 -1
  621. package/esm/http/uploaded-file.d.mts.map +1 -1
  622. package/esm/http/uploaded-file.mjs +1 -1
  623. package/esm/http/uploaded-file.mjs.map +1 -1
  624. package/esm/http/uploads-config.d.mts +1 -1
  625. package/esm/http/uploads-config.d.mts.map +1 -1
  626. package/esm/http/uploads-config.mjs +1 -1
  627. package/esm/http/uploads-config.mjs.map +1 -1
  628. package/esm/http/uploads-types.d.mts +1 -1
  629. package/esm/http/uploads-types.d.mts.map +1 -1
  630. package/esm/image/image.d.mts +1 -1
  631. package/esm/image/image.d.mts.map +1 -1
  632. package/esm/image/image.mjs +1 -1
  633. package/esm/image/image.mjs.map +1 -1
  634. package/esm/logger/fatal-visibility.d.mts +1 -1
  635. package/esm/logger/fatal-visibility.d.mts.map +1 -1
  636. package/esm/logger/fatal-visibility.mjs +1 -1
  637. package/esm/logger/fatal-visibility.mjs.map +1 -1
  638. package/esm/logger/logger.d.mts +1 -1
  639. package/esm/logger/logger.d.mts.map +1 -1
  640. package/esm/logger/logger.mjs +1 -1
  641. package/esm/logger/logger.mjs.map +1 -1
  642. package/esm/logger/types.d.mts +1 -1
  643. package/esm/logger/types.d.mts.map +1 -1
  644. package/esm/mail/config.d.mts +1 -1
  645. package/esm/mail/config.d.mts.map +1 -1
  646. package/esm/mail/config.mjs +1 -1
  647. package/esm/mail/config.mjs.map +1 -1
  648. package/esm/mail/events.d.mts +1 -1
  649. package/esm/mail/events.d.mts.map +1 -1
  650. package/esm/mail/events.mjs +1 -1
  651. package/esm/mail/events.mjs.map +1 -1
  652. package/esm/mail/mail.d.mts +1 -1
  653. package/esm/mail/mail.d.mts.map +1 -1
  654. package/esm/mail/mail.mjs +1 -1
  655. package/esm/mail/mail.mjs.map +1 -1
  656. package/esm/mail/mailer-pool.d.mts +1 -1
  657. package/esm/mail/mailer-pool.d.mts.map +1 -1
  658. package/esm/mail/mailer-pool.mjs +1 -1
  659. package/esm/mail/mailer-pool.mjs.map +1 -1
  660. package/esm/mail/react-mail.d.mts +1 -1
  661. package/esm/mail/react-mail.d.mts.map +1 -1
  662. package/esm/mail/react-mail.mjs +1 -1
  663. package/esm/mail/react-mail.mjs.map +1 -1
  664. package/esm/mail/send-mail.d.mts +1 -1
  665. package/esm/mail/send-mail.d.mts.map +1 -1
  666. package/esm/mail/send-mail.mjs +1 -1
  667. package/esm/mail/send-mail.mjs.map +1 -1
  668. package/esm/mail/test-mailbox.d.mts +1 -1
  669. package/esm/mail/test-mailbox.d.mts.map +1 -1
  670. package/esm/mail/test-mailbox.mjs +1 -1
  671. package/esm/mail/test-mailbox.mjs.map +1 -1
  672. package/esm/mail/types.d.mts +1 -1
  673. package/esm/mail/types.d.mts.map +1 -1
  674. package/esm/mail/types.mjs +1 -1
  675. package/esm/mail/types.mjs.map +1 -1
  676. package/esm/manifest/manifest-manager.mjs +1 -1
  677. package/esm/manifest/manifest-manager.mjs.map +1 -1
  678. package/esm/production/assert-dist-ready-to-start.mjs +1 -1
  679. package/esm/production/assert-dist-ready-to-start.mjs.map +1 -1
  680. package/esm/production/assert-generated-imports.mjs +1 -1
  681. package/esm/production/assert-generated-imports.mjs.map +1 -1
  682. package/esm/production/build-app-production.mjs +1 -1
  683. package/esm/production/build-app-production.mjs.map +1 -1
  684. package/esm/production/build-contributions.mjs +1 -1
  685. package/esm/production/build-contributions.mjs.map +1 -1
  686. package/esm/production/dist-build-manifest.mjs +1 -1
  687. package/esm/production/dist-build-manifest.mjs.map +1 -1
  688. package/esm/production/esbuild-plugins.mjs +1 -1
  689. package/esm/production/esbuild-plugins.mjs.map +1 -1
  690. package/esm/production/production-builder.mjs +1 -1
  691. package/esm/production/production-builder.mjs.map +1 -1
  692. package/esm/production/production-supervisor.mjs +1 -1
  693. package/esm/production/production-supervisor.mjs.map +1 -1
  694. package/esm/production/promote-dist.mjs +1 -1
  695. package/esm/production/promote-dist.mjs.map +1 -1
  696. package/esm/production/resolve-build-config.d.mts +1 -1
  697. package/esm/production/resolve-build-config.d.mts.map +1 -1
  698. package/esm/production/resolve-build-config.mjs +1 -1
  699. package/esm/production/resolve-build-config.mjs.map +1 -1
  700. package/esm/react/index.d.mts +1 -1
  701. package/esm/react/index.d.mts.map +1 -1
  702. package/esm/react/index.mjs +1 -1
  703. package/esm/react/index.mjs.map +1 -1
  704. package/esm/repositories/adapters/cascade/cascade-adapter.d.mts +1 -1
  705. package/esm/repositories/adapters/cascade/cascade-adapter.d.mts.map +1 -1
  706. package/esm/repositories/adapters/cascade/cascade-adapter.mjs +1 -1
  707. package/esm/repositories/adapters/cascade/cascade-adapter.mjs.map +1 -1
  708. package/esm/repositories/adapters/cascade/cascade-query-builder.d.mts +1 -1
  709. package/esm/repositories/adapters/cascade/cascade-query-builder.d.mts.map +1 -1
  710. package/esm/repositories/adapters/cascade/cascade-query-builder.mjs +1 -1
  711. package/esm/repositories/adapters/cascade/cascade-query-builder.mjs.map +1 -1
  712. package/esm/repositories/adapters/cascade/filter-applicator.mjs +1 -1
  713. package/esm/repositories/adapters/cascade/filter-applicator.mjs.map +1 -1
  714. package/esm/repositories/contracts/query-builder.contract.d.mts +1 -1
  715. package/esm/repositories/contracts/query-builder.contract.d.mts.map +1 -1
  716. package/esm/repositories/contracts/repository-adapter.contract.d.mts +1 -1
  717. package/esm/repositories/contracts/repository-adapter.contract.d.mts.map +1 -1
  718. package/esm/repositories/contracts/types.d.mts +1 -1
  719. package/esm/repositories/contracts/types.d.mts.map +1 -1
  720. package/esm/repositories/repository.manager.d.mts +1 -1
  721. package/esm/repositories/repository.manager.d.mts.map +1 -1
  722. package/esm/repositories/repository.manager.mjs +1 -1
  723. package/esm/repositories/repository.manager.mjs.map +1 -1
  724. package/esm/resource/define-resource.d.mts +1 -1
  725. package/esm/resource/define-resource.d.mts.map +1 -1
  726. package/esm/resource/define-resource.mjs +1 -1
  727. package/esm/resource/define-resource.mjs.map +1 -1
  728. package/esm/resource/register-resource.d.mts +1 -1
  729. package/esm/resource/register-resource.d.mts.map +1 -1
  730. package/esm/resource/register-resource.mjs +1 -1
  731. package/esm/resource/register-resource.mjs.map +1 -1
  732. package/esm/resource/resource-field-builder.d.mts +1 -1
  733. package/esm/resource/resource-field-builder.d.mts.map +1 -1
  734. package/esm/resource/resource-field-builder.mjs +1 -1
  735. package/esm/resource/resource-field-builder.mjs.map +1 -1
  736. package/esm/resource/resource.d.mts +1 -1
  737. package/esm/resource/resource.d.mts.map +1 -1
  738. package/esm/resource/resource.mjs +1 -1
  739. package/esm/resource/resource.mjs.map +1 -1
  740. package/esm/resource/types.d.mts +1 -1
  741. package/esm/resource/types.d.mts.map +1 -1
  742. package/esm/restful/restful.d.mts +1 -1
  743. package/esm/restful/restful.d.mts.map +1 -1
  744. package/esm/restful/restful.mjs +1 -1
  745. package/esm/restful/restful.mjs.map +1 -1
  746. package/esm/router/describe-route-for-log.mjs +1 -1
  747. package/esm/router/describe-route-for-log.mjs.map +1 -1
  748. package/esm/router/log-request-lifecycle.mjs +1 -1
  749. package/esm/router/log-request-lifecycle.mjs.map +1 -1
  750. package/esm/router/normalize-request-path.d.mts +1 -1
  751. package/esm/router/normalize-request-path.d.mts.map +1 -1
  752. package/esm/router/normalize-request-path.mjs +1 -1
  753. package/esm/router/normalize-request-path.mjs.map +1 -1
  754. package/esm/router/normalize-route-path.d.mts +1 -1
  755. package/esm/router/normalize-route-path.d.mts.map +1 -1
  756. package/esm/router/normalize-route-path.mjs +1 -1
  757. package/esm/router/normalize-route-path.mjs.map +1 -1
  758. package/esm/router/positional-handler-diagnostics.d.mts +1 -1
  759. package/esm/router/positional-handler-diagnostics.d.mts.map +1 -1
  760. package/esm/router/positional-handler-diagnostics.mjs +1 -1
  761. package/esm/router/positional-handler-diagnostics.mjs.map +1 -1
  762. package/esm/router/route-builder.d.mts +1 -1
  763. package/esm/router/route-builder.d.mts.map +1 -1
  764. package/esm/router/route-builder.mjs +1 -1
  765. package/esm/router/route-builder.mjs.map +1 -1
  766. package/esm/router/route-name-method-suffix.d.mts +1 -1
  767. package/esm/router/route-name-method-suffix.d.mts.map +1 -1
  768. package/esm/router/route-name-method-suffix.mjs +1 -1
  769. package/esm/router/route-name-method-suffix.mjs.map +1 -1
  770. package/esm/router/route-registry.d.mts +1 -1
  771. package/esm/router/route-registry.d.mts.map +1 -1
  772. package/esm/router/route-registry.mjs +1 -1
  773. package/esm/router/route-registry.mjs.map +1 -1
  774. package/esm/router/router.d.mts +1 -1
  775. package/esm/router/router.d.mts.map +1 -1
  776. package/esm/router/router.mjs +1 -1
  777. package/esm/router/router.mjs.map +1 -1
  778. package/esm/router/types.d.mts +1 -1
  779. package/esm/router/types.d.mts.map +1 -1
  780. package/esm/socket/types.d.mts +1 -1
  781. package/esm/socket/types.d.mts.map +1 -1
  782. package/esm/socket/utils.d.mts +1 -1
  783. package/esm/socket/utils.d.mts.map +1 -1
  784. package/esm/socket/utils.mjs +1 -1
  785. package/esm/socket/utils.mjs.map +1 -1
  786. package/esm/storage/config.d.mts +1 -1
  787. package/esm/storage/config.d.mts.map +1 -1
  788. package/esm/storage/config.mjs +1 -1
  789. package/esm/storage/config.mjs.map +1 -1
  790. package/esm/storage/context/storage-driver-context.d.mts +1 -1
  791. package/esm/storage/context/storage-driver-context.d.mts.map +1 -1
  792. package/esm/storage/context/storage-driver-context.mjs +1 -1
  793. package/esm/storage/context/storage-driver-context.mjs.map +1 -1
  794. package/esm/storage/drivers/cloud-driver.d.mts +1 -1
  795. package/esm/storage/drivers/cloud-driver.d.mts.map +1 -1
  796. package/esm/storage/drivers/cloud-driver.mjs +1 -1
  797. package/esm/storage/drivers/cloud-driver.mjs.map +1 -1
  798. package/esm/storage/drivers/do-spaces-driver.d.mts +1 -1
  799. package/esm/storage/drivers/do-spaces-driver.d.mts.map +1 -1
  800. package/esm/storage/drivers/do-spaces-driver.mjs +1 -1
  801. package/esm/storage/drivers/do-spaces-driver.mjs.map +1 -1
  802. package/esm/storage/drivers/local-driver.d.mts +1 -1
  803. package/esm/storage/drivers/local-driver.d.mts.map +1 -1
  804. package/esm/storage/drivers/local-driver.mjs +1 -1
  805. package/esm/storage/drivers/local-driver.mjs.map +1 -1
  806. package/esm/storage/drivers/r2-driver.d.mts +1 -1
  807. package/esm/storage/drivers/r2-driver.d.mts.map +1 -1
  808. package/esm/storage/drivers/r2-driver.mjs +1 -1
  809. package/esm/storage/drivers/r2-driver.mjs.map +1 -1
  810. package/esm/storage/drivers/s3-driver.d.mts +1 -1
  811. package/esm/storage/drivers/s3-driver.d.mts.map +1 -1
  812. package/esm/storage/drivers/s3-driver.mjs +1 -1
  813. package/esm/storage/drivers/s3-driver.mjs.map +1 -1
  814. package/esm/storage/scoped-storage.d.mts +1 -1
  815. package/esm/storage/scoped-storage.d.mts.map +1 -1
  816. package/esm/storage/scoped-storage.mjs +1 -1
  817. package/esm/storage/scoped-storage.mjs.map +1 -1
  818. package/esm/storage/storage-file.d.mts +1 -1
  819. package/esm/storage/storage-file.d.mts.map +1 -1
  820. package/esm/storage/storage-file.mjs +1 -1
  821. package/esm/storage/storage-file.mjs.map +1 -1
  822. package/esm/storage/storage.d.mts +1 -1
  823. package/esm/storage/storage.d.mts.map +1 -1
  824. package/esm/storage/storage.mjs +1 -1
  825. package/esm/storage/storage.mjs.map +1 -1
  826. package/esm/storage/types.d.mts +1 -1
  827. package/esm/storage/types.d.mts.map +1 -1
  828. package/esm/storage/utils/contain-path.d.mts +1 -1
  829. package/esm/storage/utils/contain-path.d.mts.map +1 -1
  830. package/esm/storage/utils/contain-path.mjs +1 -1
  831. package/esm/storage/utils/contain-path.mjs.map +1 -1
  832. package/esm/storage/utils/mime.d.mts +1 -1
  833. package/esm/storage/utils/mime.d.mts.map +1 -1
  834. package/esm/storage/utils/mime.mjs +1 -1
  835. package/esm/storage/utils/mime.mjs.map +1 -1
  836. package/esm/storage/utils/safe-fetch.d.mts +1 -1
  837. package/esm/storage/utils/safe-fetch.d.mts.map +1 -1
  838. package/esm/storage/utils/safe-fetch.mjs +1 -1
  839. package/esm/storage/utils/safe-fetch.mjs.map +1 -1
  840. package/esm/storage/utils/storage-error.d.mts +1 -1
  841. package/esm/storage/utils/storage-error.d.mts.map +1 -1
  842. package/esm/storage/utils/storage-error.mjs +1 -1
  843. package/esm/storage/utils/storage-error.mjs.map +1 -1
  844. package/esm/tests/start-http-development-server.d.mts +1 -1
  845. package/esm/tests/start-http-development-server.d.mts.map +1 -1
  846. package/esm/tests/start-http-development-server.mjs +1 -1
  847. package/esm/tests/start-http-development-server.mjs.map +1 -1
  848. package/esm/tests/test-connectors-selection.d.mts +1 -1
  849. package/esm/tests/test-connectors-selection.d.mts.map +1 -1
  850. package/esm/tests/test-connectors-selection.mjs +1 -1
  851. package/esm/tests/test-connectors-selection.mjs.map +1 -1
  852. package/esm/tests/test-helpers.d.mts +1 -1
  853. package/esm/tests/test-helpers.d.mts.map +1 -1
  854. package/esm/tests/test-helpers.mjs +1 -1
  855. package/esm/tests/test-helpers.mjs.map +1 -1
  856. package/esm/tests/test-lifecycle-state.mjs +1 -1
  857. package/esm/tests/test-lifecycle-state.mjs.map +1 -1
  858. package/esm/tests/test-server-port-channel.mjs +1 -1
  859. package/esm/tests/test-server-port-channel.mjs.map +1 -1
  860. package/esm/tests/test-setup-timeout.mjs +1 -1
  861. package/esm/tests/test-setup-timeout.mjs.map +1 -1
  862. package/esm/tests/vitest-setup.d.mts +1 -1
  863. package/esm/tests/vitest-setup.d.mts.map +1 -1
  864. package/esm/tests/vitest-setup.mjs +1 -1
  865. package/esm/tests/vitest-setup.mjs.map +1 -1
  866. package/esm/updater/package-manager.mjs +1 -1
  867. package/esm/updater/package-manager.mjs.map +1 -1
  868. package/esm/updater/update-warlock-packages.mjs +1 -1
  869. package/esm/updater/update-warlock-packages.mjs.map +1 -1
  870. package/esm/use-cases/types.d.mts +1 -1
  871. package/esm/use-cases/types.d.mts.map +1 -1
  872. package/esm/use-cases/use-case-broadcast.d.mts +1 -1
  873. package/esm/use-cases/use-case-broadcast.d.mts.map +1 -1
  874. package/esm/use-cases/use-case-broadcast.mjs +1 -1
  875. package/esm/use-cases/use-case-broadcast.mjs.map +1 -1
  876. package/esm/use-cases/use-case-events.d.mts +1 -1
  877. package/esm/use-cases/use-case-events.d.mts.map +1 -1
  878. package/esm/use-cases/use-case-events.mjs +1 -1
  879. package/esm/use-cases/use-case-events.mjs.map +1 -1
  880. package/esm/use-cases/use-case-pipeline.d.mts +1 -1
  881. package/esm/use-cases/use-case-pipeline.d.mts.map +1 -1
  882. package/esm/use-cases/use-case-pipeline.mjs +1 -1
  883. package/esm/use-cases/use-case-pipeline.mjs.map +1 -1
  884. package/esm/use-cases/use-case.d.mts +1 -1
  885. package/esm/use-cases/use-case.d.mts.map +1 -1
  886. package/esm/use-cases/use-case.errors.d.mts +1 -1
  887. package/esm/use-cases/use-case.errors.d.mts.map +1 -1
  888. package/esm/use-cases/use-case.errors.mjs +1 -1
  889. package/esm/use-cases/use-case.errors.mjs.map +1 -1
  890. package/esm/use-cases/use-case.mjs +1 -1
  891. package/esm/use-cases/use-case.mjs.map +1 -1
  892. package/esm/use-cases/use-cases-registry.d.mts +1 -1
  893. package/esm/use-cases/use-cases-registry.d.mts.map +1 -1
  894. package/esm/use-cases/use-cases-registry.mjs +1 -1
  895. package/esm/use-cases/use-cases-registry.mjs.map +1 -1
  896. package/esm/utils/app-log.d.mts +1 -1
  897. package/esm/utils/app-log.d.mts.map +1 -1
  898. package/esm/utils/app-log.mjs +1 -1
  899. package/esm/utils/app-log.mjs.map +1 -1
  900. package/esm/utils/database-log.d.mts +1 -1
  901. package/esm/utils/database-log.d.mts.map +1 -1
  902. package/esm/utils/database-log.mjs +1 -1
  903. package/esm/utils/database-log.mjs.map +1 -1
  904. package/esm/utils/environment.d.mts +1 -1
  905. package/esm/utils/environment.d.mts.map +1 -1
  906. package/esm/utils/environment.mjs +1 -1
  907. package/esm/utils/environment.mjs.map +1 -1
  908. package/esm/utils/framework-vesion.mjs +1 -1
  909. package/esm/utils/framework-vesion.mjs.map +1 -1
  910. package/esm/utils/get-localized.d.mts +1 -1
  911. package/esm/utils/get-localized.d.mts.map +1 -1
  912. package/esm/utils/get-localized.mjs +1 -1
  913. package/esm/utils/get-localized.mjs.map +1 -1
  914. package/esm/utils/load-environment.mjs +1 -1
  915. package/esm/utils/load-environment.mjs.map +1 -1
  916. package/esm/utils/normalized-path.d.mts +1 -1
  917. package/esm/utils/normalized-path.d.mts.map +1 -1
  918. package/esm/utils/normalized-path.mjs +1 -1
  919. package/esm/utils/normalized-path.mjs.map +1 -1
  920. package/esm/utils/npm-registry.d.mts +1 -1
  921. package/esm/utils/npm-registry.d.mts.map +1 -1
  922. package/esm/utils/npm-registry.mjs +1 -1
  923. package/esm/utils/npm-registry.mjs.map +1 -1
  924. package/esm/utils/paths.d.mts +1 -1
  925. package/esm/utils/paths.d.mts.map +1 -1
  926. package/esm/utils/paths.mjs +1 -1
  927. package/esm/utils/paths.mjs.map +1 -1
  928. package/esm/utils/promise-all-object.d.mts +1 -1
  929. package/esm/utils/promise-all-object.d.mts.map +1 -1
  930. package/esm/utils/promise-all-object.mjs +1 -1
  931. package/esm/utils/promise-all-object.mjs.map +1 -1
  932. package/esm/utils/queue.d.mts +1 -1
  933. package/esm/utils/queue.d.mts.map +1 -1
  934. package/esm/utils/queue.mjs +1 -1
  935. package/esm/utils/queue.mjs.map +1 -1
  936. package/esm/utils/sleep.d.mts +1 -1
  937. package/esm/utils/sleep.d.mts.map +1 -1
  938. package/esm/utils/sleep.mjs +1 -1
  939. package/esm/utils/sleep.mjs.map +1 -1
  940. package/esm/utils/sluggable.d.mts +1 -1
  941. package/esm/utils/sluggable.d.mts.map +1 -1
  942. package/esm/utils/sluggable.mjs +1 -1
  943. package/esm/utils/sluggable.mjs.map +1 -1
  944. package/esm/utils/to-json.d.mts +1 -1
  945. package/esm/utils/to-json.d.mts.map +1 -1
  946. package/esm/utils/to-json.mjs +1 -1
  947. package/esm/utils/to-json.mjs.map +1 -1
  948. package/esm/utils/types.d.mts +1 -1
  949. package/esm/utils/types.d.mts.map +1 -1
  950. package/esm/utils/urls.d.mts +1 -1
  951. package/esm/utils/urls.d.mts.map +1 -1
  952. package/esm/utils/urls.mjs +1 -1
  953. package/esm/utils/urls.mjs.map +1 -1
  954. package/esm/utils/version-compare.d.mts +1 -1
  955. package/esm/utils/version-compare.d.mts.map +1 -1
  956. package/esm/utils/version-compare.mjs +1 -1
  957. package/esm/utils/version-compare.mjs.map +1 -1
  958. package/esm/validation/database/exists-except-current-id.d.mts +1 -1
  959. package/esm/validation/database/exists-except-current-id.d.mts.map +1 -1
  960. package/esm/validation/database/exists-except-current-id.mjs +1 -1
  961. package/esm/validation/database/exists-except-current-id.mjs.map +1 -1
  962. package/esm/validation/database/exists-except-current-user.d.mts +1 -1
  963. package/esm/validation/database/exists-except-current-user.d.mts.map +1 -1
  964. package/esm/validation/database/exists-except-current-user.mjs +1 -1
  965. package/esm/validation/database/exists-except-current-user.mjs.map +1 -1
  966. package/esm/validation/database/types.d.mts +1 -1
  967. package/esm/validation/database/types.d.mts.map +1 -1
  968. package/esm/validation/database/unique-except-current-id.d.mts +1 -1
  969. package/esm/validation/database/unique-except-current-id.d.mts.map +1 -1
  970. package/esm/validation/database/unique-except-current-id.mjs +1 -1
  971. package/esm/validation/database/unique-except-current-id.mjs.map +1 -1
  972. package/esm/validation/database/unique-except-current-user.d.mts +1 -1
  973. package/esm/validation/database/unique-except-current-user.d.mts.map +1 -1
  974. package/esm/validation/database/unique-except-current-user.mjs +1 -1
  975. package/esm/validation/database/unique-except-current-user.mjs.map +1 -1
  976. package/esm/validation/file/file.d.mts +1 -1
  977. package/esm/validation/file/file.d.mts.map +1 -1
  978. package/esm/validation/file/file.mjs +1 -1
  979. package/esm/validation/file/file.mjs.map +1 -1
  980. package/esm/validation/init.mjs +1 -1
  981. package/esm/validation/init.mjs.map +1 -1
  982. package/esm/validation/plugins/database-plugin.mjs +1 -1
  983. package/esm/validation/plugins/database-plugin.mjs.map +1 -1
  984. package/esm/validation/plugins/file-plugin.mjs +1 -1
  985. package/esm/validation/plugins/file-plugin.mjs.map +1 -1
  986. package/esm/validation/plugins/localized-plugin.mjs +1 -1
  987. package/esm/validation/plugins/localized-plugin.mjs.map +1 -1
  988. package/esm/validation/types.d.mts +1 -1
  989. package/esm/validation/types.d.mts.map +1 -1
  990. package/esm/validation/validateAll.mjs +1 -1
  991. package/esm/validation/validateAll.mjs.map +1 -1
  992. package/esm/validation/validators/file-validator.d.mts +1 -1
  993. package/esm/validation/validators/file-validator.d.mts.map +1 -1
  994. package/esm/validation/validators/file-validator.mjs +1 -1
  995. package/esm/validation/validators/file-validator.mjs.map +1 -1
  996. package/esm/vite/lower-stage3-decorators.d.mts +1 -1
  997. package/esm/vite/lower-stage3-decorators.d.mts.map +1 -1
  998. package/esm/vite/lower-stage3-decorators.mjs +1 -1
  999. package/esm/vite/lower-stage3-decorators.mjs.map +1 -1
  1000. package/esm/warlock-config/default-configurations.mjs +1 -1
  1001. package/esm/warlock-config/default-configurations.mjs.map +1 -1
  1002. package/esm/warlock-config/define-config.d.mts +1 -1
  1003. package/esm/warlock-config/define-config.d.mts.map +1 -1
  1004. package/esm/warlock-config/define-config.mjs +1 -1
  1005. package/esm/warlock-config/define-config.mjs.map +1 -1
  1006. package/esm/warlock-config/normalize-build-config.mjs +1 -1
  1007. package/esm/warlock-config/normalize-build-config.mjs.map +1 -1
  1008. package/esm/warlock-config/types.d.mts +1 -1
  1009. package/esm/warlock-config/types.d.mts.map +1 -1
  1010. package/esm/warlock-config/warlock-config.manager.d.mts +1 -1
  1011. package/esm/warlock-config/warlock-config.manager.d.mts.map +1 -1
  1012. package/esm/warlock-config/warlock-config.manager.mjs +1 -1
  1013. package/esm/warlock-config/warlock-config.manager.mjs.map +1 -1
  1014. package/package.json +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"vitest-setup.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/tests/vitest-setup.ts"],"sourcesContent":["/**\r\n * Worker test lifecycle — `setupTest` / `teardownTest`.\r\n *\r\n * Implements `contracts/2026-08-12-test-worker-lifecycle.md`. The pair is\r\n * context-scoped, not \"once per worker\": Vitest runs `setupFiles` before EVERY\r\n * test file and rebuilds the module registry each time, so the harness that\r\n * calls `setupTest` owns pairing it with `teardownTest` in the same runtime\r\n * context.\r\n *\r\n * Ownership, stated once because teardown is wider than it looks:\r\n *\r\n * - the runtime assumes exclusive ownership of the process-local\r\n * `connectorsManager` for its lifetime;\r\n * - it owns the framework bootstrap, the application shutdown hooks, and the\r\n * connectors it starts — including the `connectors: false` case, where\r\n * bootstrap still registers hooks;\r\n * - teardown is MANAGER-WIDE. `connectorsManager.shutdown()` has no selective\r\n * ownership handle, so a lifecycle that started two connectors still closes\r\n * every connector the manager holds. Mixing `setupTest` with manual connector\r\n * startup in the same process is unsupported for exactly that reason.\r\n * - HTTP global setup stays separately owned by `startHttpTestServer` /\r\n * `stopHttpTestServer`.\r\n */\r\nimport { Application } from \"../application/application\";\r\nimport { bootstrap } from \"../bootstrap\";\r\nimport { loadConfigFiles } from \"../config/load-config-files\";\r\nimport { connectorsManager } from \"../connectors\";\r\nimport { filesOrchestrator } from \"../dev-server/files-orchestrator\";\r\nimport { warlockConfigManager } from \"../warlock-config/warlock-config.manager\";\r\nimport {\r\n describeConnectorsSelection,\r\n isSameConnectorsSelection,\r\n normalizeConnectorNames,\r\n readRequestedConnectors,\r\n resolveEffectiveConnectors,\r\n} from \"./test-connectors-selection\";\r\nimport type {\r\n RequestedTestConnectors,\r\n TestConnectorsSelection,\r\n} from \"./test-connectors-selection\";\r\nimport { getTestLifecycleRegistry } from \"./test-lifecycle-state\";\r\nimport type { TestLifecycleRegistry, TestSetupAttempt } from \"./test-lifecycle-state\";\r\nimport {\r\n DEFAULT_TEST_SETUP_TIMEOUT,\r\n describeExpiredSetup,\r\n readConfiguredSetupTimeout,\r\n scheduleRealTimeout,\r\n} from \"./test-setup-timeout\";\r\nimport type { TestTimeoutHandle } from \"./test-setup-timeout\";\r\n\r\nexport type { TestConnectorsSelection } from \"./test-connectors-selection\";\r\n\r\nexport type TestSetupOptions = {\r\n /**\r\n * Which connectors to start.\r\n *\r\n * Precedence is `explicit non-undefined option > tests.connectors config >\r\n * true`. Omitting the property, or passing `undefined`, lets project config\r\n * apply — so an optional variable that happens to be `undefined` cannot erase\r\n * it.\r\n */\r\n connectors?: TestConnectorsSelection;\r\n};\r\n\r\n/**\r\n * Raised by the lifecycle itself, never by the runtime it manages — a conflict\r\n * between two calls, or a refusal to reuse a runtime that did not close.\r\n */\r\nexport class TestLifecycleError extends Error {\r\n public constructor(message: string) {\r\n super(message);\r\n\r\n this.name = \"TestLifecycleError\";\r\n }\r\n}\r\n\r\nconst POISONED_MESSAGE =\r\n \"setupTest() refuses to start a test runtime: an earlier teardownTest() reported a shutdown failure, so the connectors, ports and pools it owned are not known to be closed. Restart the Vitest worker before setting up again, or call teardownTest() to retry the shutdown — the lifecycle only returns to idle on a fully successful retry.\";\r\n\r\n/**\r\n * Bootstrap the test runtime and start the selected connectors.\r\n *\r\n * ⚠ Runs once per TEST FILE, not once per worker: `setupFiles` is executed for\r\n * every file and its module registry is rebuilt with it, measured across both\r\n * pools with isolation on and off. The lifecycle state lives on the runtime\r\n * context rather than in this module precisely so that a rebuild cannot hide a\r\n * runtime that is still up.\r\n *\r\n * Repeated calls:\r\n *\r\n * - concurrent calls with the same effective selection share one startup;\r\n * - while ready, the same effective selection is a no-op;\r\n * - while starting or ready, a DIFFERENT effective selection rejects and leaves\r\n * the live runtime untouched;\r\n * - a failed setup unwinds and returns to idle, so a clean retry is allowed;\r\n * - after a successful `teardownTest`, a later setup may use a different\r\n * selection.\r\n *\r\n * @example\r\n * // let project config decide, falling back to the default set\r\n * await setupTest();\r\n *\r\n * @example\r\n * // bootstrap only — no connectors, whatever config says\r\n * await setupTest({ connectors: false });\r\n */\r\nexport async function setupTest(options?: TestSetupOptions): Promise<void> {\r\n const registry = getTestLifecycleRegistry();\r\n const requested = readRequestedConnectors(options?.connectors);\r\n\r\n if (registry.state === \"poisoned\") {\r\n throw new TestLifecycleError(POISONED_MESSAGE);\r\n }\r\n\r\n if (registry.state === \"stopping\" && registry.teardownAttempt) {\r\n await settled(registry.teardownAttempt);\r\n\r\n return setupTest(options);\r\n }\r\n\r\n if (registry.state === \"ready\") {\r\n assertReadySelectionMatches(registry.activeSelection, requested);\r\n\r\n return;\r\n }\r\n\r\n if (registry.state === \"starting\" && registry.setupAttempt) {\r\n const attempt = registry.setupAttempt;\r\n\r\n await assertPendingSetupMatches(attempt, requested);\r\n\r\n return attempt.completion;\r\n }\r\n\r\n return startTestRuntime(requested);\r\n}\r\n\r\n/**\r\n * Shut the test runtime down and release the lifecycle.\r\n *\r\n * - idle is a no-op;\r\n * - concurrent calls share one attempt;\r\n * - a call made while setup is still running waits for that attempt to settle,\r\n * then closes the runtime if it succeeded;\r\n * - the local \"ready\" state is always cleared, including when shutdown rejects;\r\n * - a shutdown rejection is surfaced, never swallowed, and poisons the\r\n * lifecycle — a reported close failure is not proof that anything closed, so\r\n * later `setupTest` calls refuse until the worker is restarted or a retry\r\n * fully succeeds.\r\n *\r\n * ⚠ Individual connector shutdown failures are caught and logged inside\r\n * `connectorsManager.shutdown()`, so they never reach this function and never\r\n * poison anything. This lifecycle can only surface what that layer reports.\r\n */\r\nexport async function teardownTest(): Promise<void> {\r\n const registry = getTestLifecycleRegistry();\r\n\r\n if (registry.state === \"stopping\" && registry.teardownAttempt) {\r\n return registry.teardownAttempt;\r\n }\r\n\r\n if (registry.state === \"starting\" && registry.setupAttempt) {\r\n // A runtime that is still opening cannot be closed halfway. Wait for the\r\n // attempt to settle: a failed one has already unwound itself and left the\r\n // lifecycle idle, which the re-entry below then reads as \"nothing to do\".\r\n await settled(registry.setupAttempt.completion);\r\n\r\n return teardownTest();\r\n }\r\n\r\n if (registry.state === \"idle\") {\r\n return;\r\n }\r\n\r\n registry.state = \"stopping\";\r\n\r\n // Deferred by a microtask so the registry is fully published before the\r\n // attempt's first line runs — a synchronous throw would otherwise reach the\r\n // `finally` below, and reset the state, before this function had recorded\r\n // that a teardown was in flight at all.\r\n const attempt = Promise.resolve().then(() => runTestRuntimeShutdown());\r\n\r\n registry.teardownAttempt = attempt;\r\n\r\n return attempt;\r\n}\r\n\r\n/**\r\n * The setup attempt's hang guard, as the lifecycle consumes it.\r\n *\r\n * The bound's POLICY — the default, the config key, the message — lives in\r\n * `test-setup-timeout.ts`. What expiry MEANS lives here.\r\n *\r\n * @internal\r\n */\r\ntype SetupBound = {\r\n /**\r\n * Rejects with the expiry error. Never resolves: the attempt is the only side\r\n * of the race that can succeed.\r\n */\r\n readonly expiry: Promise<never>;\r\n\r\n /**\r\n * Re-aim the bound at `next` ms measured from when the ATTEMPT STARTED, once\r\n * config has made `tests.setupTimeout` readable.\r\n */\r\n rearm(next: number): void;\r\n\r\n /** The race is over — cancel whatever timer is still pending. */\r\n settle(): void;\r\n\r\n /** Whether the bound, rather than the attempt, won the race. */\r\n hasExpired(): boolean;\r\n};\r\n\r\n/**\r\n * Arm the hang guard for one setup attempt.\r\n *\r\n * Armed at the default BEFORE the attempt runs, because `tests.setupTimeout` is\r\n * not readable until the attempt has loaded config — and loading config is\r\n * itself one of the steps that can hang. `rearm` then narrows or widens it the\r\n * moment config arrives.\r\n */\r\nfunction armSetupBound(registry: TestLifecycleRegistry): SetupBound {\r\n const schedule = registry.scheduleTimeout ?? scheduleRealTimeout;\r\n const armedAt = Date.now();\r\n\r\n let handle: TestTimeoutHandle | undefined;\r\n let expired = false;\r\n let closed = false;\r\n let expire: (error: unknown) => void = () => undefined;\r\n\r\n const expiry = new Promise<never>((_resolve, reject) => {\r\n expire = reject;\r\n });\r\n\r\n // Only `awaitSetupWithinBound` observes this, and only until the attempt wins\r\n // — after that nobody is listening, and an unobserved rejection surfaces as an\r\n // unhandled rejection that fails an unrelated test file. Same reason as the\r\n // `effectiveSelection` barrier below.\r\n expiry.catch(() => undefined);\r\n\r\n const expireNow = (bound: number): void => {\r\n if (closed) {\r\n return;\r\n }\r\n\r\n closed = true;\r\n expired = true;\r\n\r\n handle?.cancel();\r\n handle = undefined;\r\n\r\n expire(new TestLifecycleError(describeExpiredSetup(bound)));\r\n };\r\n\r\n const armFor = (bound: number, delay: number): void => {\r\n if (closed) {\r\n return;\r\n }\r\n\r\n handle?.cancel();\r\n\r\n // Already overdue. A bound the attempt has ALREADY exceeded must fire now,\r\n // not be rescheduled for time that was spent before it was known.\r\n if (delay <= 0) {\r\n expireNow(bound);\r\n\r\n return;\r\n }\r\n\r\n handle = schedule(delay, () => expireNow(bound));\r\n };\r\n\r\n const initialBound = registry.setupTimeoutOverride ?? DEFAULT_TEST_SETUP_TIMEOUT;\r\n\r\n armFor(initialBound, initialBound);\r\n\r\n return {\r\n expiry,\r\n\r\n // Measured from `armedAt`, never from now: adding a configured bound to the\r\n // time already spent would make the real bound default-plus-configured, and\r\n // a project that lowered the key would get a LONGER guard than the default.\r\n rearm: (next) => armFor(next, next - (Date.now() - armedAt)),\r\n\r\n settle: () => {\r\n closed = true;\r\n\r\n handle?.cancel();\r\n handle = undefined;\r\n },\r\n\r\n hasExpired: () => expired,\r\n };\r\n}\r\n\r\n/**\r\n * Race one setup attempt against its bound.\r\n *\r\n * The losing attempt is NOT cancellable — nothing here can interrupt a bootstrap\r\n * stuck in a socket connect — so when the bound wins, the lifecycle is poisoned\r\n * and every later state write from that abandoned attempt is dropped. That\r\n * dropping happens in `runTestRuntimeStartup`, guarded on `hasExpired()`;\r\n * without it the still-running attempt would quietly overwrite `poisoned` with\r\n * `ready` or `idle` and hand the next caller a runtime nobody owns.\r\n */\r\nasync function awaitSetupWithinBound(\r\n attempt: Promise<void>,\r\n bound: SetupBound,\r\n registry: TestLifecycleRegistry,\r\n): Promise<void> {\r\n try {\r\n await Promise.race([attempt, bound.expiry]);\r\n } catch (error) {\r\n if (bound.hasExpired()) {\r\n registry.state = \"poisoned\";\r\n registry.activeSelection = undefined;\r\n registry.setupAttempt = undefined;\r\n }\r\n\r\n throw error;\r\n } finally {\r\n bound.settle();\r\n }\r\n}\r\n\r\n/**\r\n * Open a new setup attempt and publish it before it runs.\r\n */\r\nfunction startTestRuntime(requested: RequestedTestConnectors): Promise<void> {\r\n const registry = getTestLifecycleRegistry();\r\n\r\n let publishEffectiveSelection: (selection: TestConnectorsSelection) => void = () => undefined;\r\n let failEffectiveSelection: (error: unknown) => void = () => undefined;\r\n\r\n const effectiveSelection = new Promise<TestConnectorsSelection>((resolve, reject) => {\r\n publishEffectiveSelection = resolve;\r\n failEffectiveSelection = reject;\r\n });\r\n\r\n // Only the mixed explicit/config comparison ever awaits this barrier, so its\r\n // rejection is usually unobserved — and an unobserved rejection would surface\r\n // as an unhandled rejection and fail an unrelated test file.\r\n effectiveSelection.catch(() => undefined);\r\n\r\n const bound = armSetupBound(registry);\r\n\r\n const attempt = Promise.resolve().then(() =>\r\n runTestRuntimeStartup(requested, publishEffectiveSelection, failEffectiveSelection, bound),\r\n );\r\n\r\n // The attempt outlives a bound that beat it, and by then `completion` has\r\n // already rejected with the expiry error — so the attempt's own late rejection\r\n // has no observer. Same unhandled-rejection hazard as above.\r\n attempt.catch(() => undefined);\r\n\r\n // `teardownTest` waits on this same promise, which is how a teardown requested\r\n // during setup inherits the bound. There is deliberately no second timer and\r\n // no separate teardown deadline.\r\n const completion = awaitSetupWithinBound(attempt, bound, registry);\r\n\r\n registry.state = \"starting\";\r\n registry.setupAttempt = { requested, effectiveSelection, completion };\r\n\r\n return completion;\r\n}\r\n\r\n/**\r\n * The startup attempt itself.\r\n *\r\n * On failure: best-effort unwind, reset bookkeeping, rethrow the ORIGINAL error\r\n * unchanged. A cleanup failure is a secondary diagnostic and never replaces the\r\n * cause the caller needs to read.\r\n */\r\nasync function runTestRuntimeStartup(\r\n requested: RequestedTestConnectors,\r\n publishEffectiveSelection: (selection: TestConnectorsSelection) => void,\r\n failEffectiveSelection: (error: unknown) => void,\r\n bound: SetupBound,\r\n): Promise<void> {\r\n const registry = getTestLifecycleRegistry();\r\n\r\n try {\r\n Application.setEnvironment(\"test\");\r\n\r\n await warlockConfigManager.load();\r\n await bootstrap();\r\n\r\n await filesOrchestrator.init();\r\n await loadConfigFiles(true);\r\n\r\n // The first point at which `tests.setupTimeout` is readable at all. An\r\n // invalid value throws from here and takes the normal failure path — falling\r\n // back to the default would silently erase what the project configured.\r\n const configuredTimeout = readConfiguredSetupTimeout();\r\n\r\n if (configuredTimeout !== undefined) {\r\n bound.rearm(configuredTimeout);\r\n }\r\n\r\n // Resolved here and not at call time: the config layer is only readable once\r\n // the four steps above have run.\r\n const effectiveSelection = resolveEffectiveConnectors(requested);\r\n\r\n // Every state write below is conditional on this attempt still being the one\r\n // the lifecycle is waiting for. Once the bound has expired the lifecycle is\r\n // poisoned and this attempt is abandoned — it may still be running, but it\r\n // no longer speaks for the runtime.\r\n if (!bound.hasExpired()) {\r\n registry.activeSelection = effectiveSelection;\r\n }\r\n\r\n publishEffectiveSelection(effectiveSelection);\r\n\r\n await startSelectedConnectors(effectiveSelection);\r\n\r\n if (!bound.hasExpired()) {\r\n registry.state = \"ready\";\r\n registry.setupAttempt = undefined;\r\n }\r\n } catch (error) {\r\n failEffectiveSelection(error);\r\n\r\n await unwindPartialStartup();\r\n\r\n if (!bound.hasExpired()) {\r\n registry.state = \"idle\";\r\n registry.activeSelection = undefined;\r\n registry.setupAttempt = undefined;\r\n }\r\n\r\n console.error(\"[vitest-setup] Failed to setup test environment:\", error);\r\n\r\n throw error;\r\n }\r\n}\r\n\r\n/**\r\n * `false` means none at all. Everything else starts something: an array starts\r\n * exactly those, and `true` starts the default set — all but http, which is the\r\n * global setup's job and shared across every worker.\r\n */\r\nasync function startSelectedConnectors(selection: TestConnectorsSelection): Promise<void> {\r\n if (selection === false) {\r\n return;\r\n }\r\n\r\n if (Array.isArray(selection)) {\r\n await connectorsManager.start(normalizeConnectorNames(selection));\r\n\r\n return;\r\n }\r\n\r\n await connectorsManager.startWithout([\"http\"]);\r\n}\r\n\r\n/**\r\n * Best-effort teardown of whatever a failed startup managed to start.\r\n *\r\n * Runs while an error is already in flight, so no step here may throw and every\r\n * step is attempted independently.\r\n */\r\nasync function unwindPartialStartup(): Promise<void> {\r\n // Two steps rather than one: `connectorsManager.shutdown()` runs the\r\n // application hooks itself, but it runs them FIRST and does not isolate their\r\n // rejection — so a hook that rejects would take the connector teardown down\r\n // with it and leave every connector up. Both calls are idempotent, so running\r\n // the hooks on their own first costs nothing and means neither failure can\r\n // skip the other step.\r\n await attemptCleanupStep(\"application shutdown hooks\", () => Application.runShutdownHooks());\r\n await attemptCleanupStep(\"connectors shutdown\", () => connectorsManager.shutdown());\r\n}\r\n\r\n/**\r\n * Run one cleanup step, isolating its failure so the next step still runs.\r\n */\r\nasync function attemptCleanupStep(step: string, run: () => Promise<void>): Promise<void> {\r\n try {\r\n await run();\r\n } catch (error) {\r\n // Reported, not thrown — it is secondary to the startup error about to be\r\n // rethrown, and losing that one to this would be the worse outcome.\r\n console.error(`[vitest-setup] Cleanup after a failed setup did not complete (${step}):`, error);\r\n }\r\n}\r\n\r\n/**\r\n * The teardown attempt itself.\r\n */\r\nasync function runTestRuntimeShutdown(): Promise<void> {\r\n const registry = getTestLifecycleRegistry();\r\n let shutdownSucceeded = false;\r\n\r\n try {\r\n // Manager-wide, and deliberately called whatever the selection was: with\r\n // `connectors: false` nothing was started, but bootstrap still registered\r\n // application shutdown hooks, and the manager runs those first (see\r\n // `connectors-manager.ts` — `Application.runShutdownHooks()` is its first\r\n // line). Skipping the call to \"match\" an empty selection would leak them.\r\n await connectorsManager.shutdown();\r\n\r\n shutdownSucceeded = true;\r\n } finally {\r\n // In a `finally`, not after the `await`: a rejected shutdown must not leave\r\n // the lifecycle claiming a runtime it no longer owns. Poisoned rather than\r\n // idle, because a cleared flag does not prove that ports, sockets, pools or\r\n // timers closed.\r\n registry.activeSelection = undefined;\r\n registry.setupAttempt = undefined;\r\n registry.teardownAttempt = undefined;\r\n registry.state = shutdownSucceeded ? \"idle\" : \"poisoned\";\r\n }\r\n}\r\n\r\n/**\r\n * Reject when a ready runtime was set up with a different selection.\r\n */\r\nfunction assertReadySelectionMatches(\r\n activeSelection: TestConnectorsSelection | undefined,\r\n requested: RequestedTestConnectors,\r\n): void {\r\n if (activeSelection === undefined) {\r\n return;\r\n }\r\n\r\n // Config is loaded by the time anything is ready, so the config-derived layer\r\n // is resolvable right here.\r\n const requestedSelection = resolveEffectiveConnectors(requested);\r\n\r\n assertSelectionsMatch(activeSelection, requestedSelection);\r\n}\r\n\r\n/**\r\n * Reject when an in-flight setup attempt is starting a different selection.\r\n */\r\nasync function assertPendingSetupMatches(\r\n attempt: TestSetupAttempt,\r\n requested: RequestedTestConnectors,\r\n): Promise<void> {\r\n const pending = attempt.requested;\r\n\r\n // Two calls that both defer to project config resolve to the same thing by\r\n // construction — knowable without waiting for config to load.\r\n if (!pending.isExplicit && !requested.isExplicit) {\r\n return;\r\n }\r\n\r\n if (pending.isExplicit && requested.isExplicit) {\r\n assertSelectionsMatch(pending.selection, requested.selection);\r\n\r\n return;\r\n }\r\n\r\n // Mixed: one side is config-derived and config is not readable until the\r\n // running attempt has loaded it, so wait for that barrier first.\r\n const activeSelection = await attempt.effectiveSelection;\r\n const requestedSelection = resolveEffectiveConnectors(requested);\r\n\r\n assertSelectionsMatch(activeSelection, requestedSelection);\r\n}\r\n\r\n/**\r\n * Name both selections: a caller looking at this message has to be able to tell\r\n * which call to change without reading the framework's source.\r\n */\r\nfunction assertSelectionsMatch(\r\n activeSelection: TestConnectorsSelection,\r\n requestedSelection: TestConnectorsSelection,\r\n): void {\r\n if (isSameConnectorsSelection(activeSelection, requestedSelection)) {\r\n return;\r\n }\r\n\r\n throw new TestLifecycleError(\r\n `setupTest() is already using ${describeConnectorsSelection(activeSelection)}, and this call asked for ${describeConnectorsSelection(requestedSelection)}. One test runtime serves one connector selection — call teardownTest() before setting up a different one.`,\r\n );\r\n}\r\n\r\n/**\r\n * Await an attempt for its state transition only, not its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CAOnD,MAAM,mBAAmB,oCAAoC,YAAY,iBAAiB,CAAC;CAC3F,MAAM,mBAAmB,6BAA6B,kBAAkB,SAAS,CAAC;AACpF;;;;AAKA,eAAe,mBAAmB,MAAc,KAAyC;CACvF,IAAI;EACF,MAAM,IAAI;CACZ,SAAS,OAAO;EAGd,QAAQ,MAAM,iEAAiE,KAAK,KAAK,KAAK;CAChG;AACF;;;;AAKA,eAAe,yBAAwC;CACrD,MAAM,WAAW,yBAAyB;CAC1C,IAAI,oBAAoB;CAExB,IAAI;EAMF,MAAM,kBAAkB,SAAS;EAEjC,oBAAoB;CACtB,UAAU;EAKR,SAAS,kBAAkB;EAC3B,SAAS,eAAe;EACxB,SAAS,kBAAkB;EAC3B,SAAS,QAAQ,oBAAoB,SAAS;CAChD;AACF;;;;AAKA,SAAS,4BACP,iBACA,WACM;CACN,IAAI,oBAAoB,QACtB;CAOF,sBAAsB,iBAFK,2BAA2B,SAEE,CAAC;AAC3D;;;;AAKA,eAAe,0BACb,SACA,WACe;CACf,MAAM,UAAU,QAAQ;CAIxB,IAAI,CAAC,QAAQ,cAAc,CAAC,UAAU,YACpC;CAGF,IAAI,QAAQ,cAAc,UAAU,YAAY;EAC9C,sBAAsB,QAAQ,WAAW,UAAU,SAAS;EAE5D;CACF;CAOA,sBAAsB,MAHQ,QAAQ,oBACX,2BAA2B,SAEE,CAAC;AAC3D;;;;;AAMA,SAAS,sBACP,iBACA,oBACM;CACN,IAAI,0BAA0B,iBAAiB,kBAAkB,GAC/D;CAGF,MAAM,IAAI,mBACR,gCAAgC,4BAA4B,eAAe,EAAE,4BAA4B,4BAA4B,kBAAkB,EAAE,2GAC3J;AACF;;;;AAKA,SAAS,QAAQ,SAAuC;CACtD,OAAO,QAAQ,YAAY,MAAS;AACtC"}
1
+ {"version":3,"file":"vitest-setup.mjs","names":[],"sources":["../../../../../../../core/src/tests/vitest-setup.ts"],"sourcesContent":["/**\r\n * Worker test lifecycle — `setupTest` / `teardownTest`.\r\n *\r\n * Implements `contracts/2026-08-12-test-worker-lifecycle.md`. The pair is\r\n * context-scoped, not \"once per worker\": Vitest runs `setupFiles` before EVERY\r\n * test file and rebuilds the module registry each time, so the harness that\r\n * calls `setupTest` owns pairing it with `teardownTest` in the same runtime\r\n * context.\r\n *\r\n * Ownership, stated once because teardown is wider than it looks:\r\n *\r\n * - the runtime assumes exclusive ownership of the process-local\r\n * `connectorsManager` for its lifetime;\r\n * - it owns the framework bootstrap, the application shutdown hooks, and the\r\n * connectors it starts — including the `connectors: false` case, where\r\n * bootstrap still registers hooks;\r\n * - teardown is MANAGER-WIDE. `connectorsManager.shutdown()` has no selective\r\n * ownership handle, so a lifecycle that started two connectors still closes\r\n * every connector the manager holds. Mixing `setupTest` with manual connector\r\n * startup in the same process is unsupported for exactly that reason.\r\n * - HTTP global setup stays separately owned by `startHttpTestServer` /\r\n * `stopHttpTestServer`.\r\n */\r\nimport { Application } from \"../application/application\";\r\nimport { bootstrap } from \"../bootstrap\";\r\nimport { loadConfigFiles } from \"../config/load-config-files\";\r\nimport { connectorsManager } from \"../connectors\";\r\nimport { filesOrchestrator } from \"../dev-server/files-orchestrator\";\r\nimport { warlockConfigManager } from \"../warlock-config/warlock-config.manager\";\r\nimport {\r\n describeConnectorsSelection,\r\n isSameConnectorsSelection,\r\n normalizeConnectorNames,\r\n readRequestedConnectors,\r\n resolveEffectiveConnectors,\r\n} from \"./test-connectors-selection\";\r\nimport type {\r\n RequestedTestConnectors,\r\n TestConnectorsSelection,\r\n} from \"./test-connectors-selection\";\r\nimport { getTestLifecycleRegistry } from \"./test-lifecycle-state\";\r\nimport type { TestLifecycleRegistry, TestSetupAttempt } from \"./test-lifecycle-state\";\r\nimport {\r\n DEFAULT_TEST_SETUP_TIMEOUT,\r\n describeExpiredSetup,\r\n readConfiguredSetupTimeout,\r\n scheduleRealTimeout,\r\n} from \"./test-setup-timeout\";\r\nimport type { TestTimeoutHandle } from \"./test-setup-timeout\";\r\n\r\nexport type { TestConnectorsSelection } from \"./test-connectors-selection\";\r\n\r\nexport type TestSetupOptions = {\r\n /**\r\n * Which connectors to start.\r\n *\r\n * Precedence is `explicit non-undefined option > tests.connectors config >\r\n * true`. Omitting the property, or passing `undefined`, lets project config\r\n * apply — so an optional variable that happens to be `undefined` cannot erase\r\n * it.\r\n */\r\n connectors?: TestConnectorsSelection;\r\n};\r\n\r\n/**\r\n * Raised by the lifecycle itself, never by the runtime it manages — a conflict\r\n * between two calls, or a refusal to reuse a runtime that did not close.\r\n */\r\nexport class TestLifecycleError extends Error {\r\n public constructor(message: string) {\r\n super(message);\r\n\r\n this.name = \"TestLifecycleError\";\r\n }\r\n}\r\n\r\nconst POISONED_MESSAGE =\r\n \"setupTest() refuses to start a test runtime: an earlier teardownTest() reported a shutdown failure, so the connectors, ports and pools it owned are not known to be closed. Restart the Vitest worker before setting up again, or call teardownTest() to retry the shutdown — the lifecycle only returns to idle on a fully successful retry.\";\r\n\r\n/**\r\n * Bootstrap the test runtime and start the selected connectors.\r\n *\r\n * ⚠ Runs once per TEST FILE, not once per worker: `setupFiles` is executed for\r\n * every file and its module registry is rebuilt with it, measured across both\r\n * pools with isolation on and off. The lifecycle state lives on the runtime\r\n * context rather than in this module precisely so that a rebuild cannot hide a\r\n * runtime that is still up.\r\n *\r\n * Repeated calls:\r\n *\r\n * - concurrent calls with the same effective selection share one startup;\r\n * - while ready, the same effective selection is a no-op;\r\n * - while starting or ready, a DIFFERENT effective selection rejects and leaves\r\n * the live runtime untouched;\r\n * - a failed setup unwinds and returns to idle, so a clean retry is allowed;\r\n * - after a successful `teardownTest`, a later setup may use a different\r\n * selection.\r\n *\r\n * @example\r\n * // let project config decide, falling back to the default set\r\n * await setupTest();\r\n *\r\n * @example\r\n * // bootstrap only — no connectors, whatever config says\r\n * await setupTest({ connectors: false });\r\n */\r\nexport async function setupTest(options?: TestSetupOptions): Promise<void> {\r\n const registry = getTestLifecycleRegistry();\r\n const requested = readRequestedConnectors(options?.connectors);\r\n\r\n if (registry.state === \"poisoned\") {\r\n throw new TestLifecycleError(POISONED_MESSAGE);\r\n }\r\n\r\n if (registry.state === \"stopping\" && registry.teardownAttempt) {\r\n await settled(registry.teardownAttempt);\r\n\r\n return setupTest(options);\r\n }\r\n\r\n if (registry.state === \"ready\") {\r\n assertReadySelectionMatches(registry.activeSelection, requested);\r\n\r\n return;\r\n }\r\n\r\n if (registry.state === \"starting\" && registry.setupAttempt) {\r\n const attempt = registry.setupAttempt;\r\n\r\n await assertPendingSetupMatches(attempt, requested);\r\n\r\n return attempt.completion;\r\n }\r\n\r\n return startTestRuntime(requested);\r\n}\r\n\r\n/**\r\n * Shut the test runtime down and release the lifecycle.\r\n *\r\n * - idle is a no-op;\r\n * - concurrent calls share one attempt;\r\n * - a call made while setup is still running waits for that attempt to settle,\r\n * then closes the runtime if it succeeded;\r\n * - the local \"ready\" state is always cleared, including when shutdown rejects;\r\n * - a shutdown rejection is surfaced, never swallowed, and poisons the\r\n * lifecycle — a reported close failure is not proof that anything closed, so\r\n * later `setupTest` calls refuse until the worker is restarted or a retry\r\n * fully succeeds.\r\n *\r\n * ⚠ Individual connector shutdown failures are caught and logged inside\r\n * `connectorsManager.shutdown()`, so they never reach this function and never\r\n * poison anything. This lifecycle can only surface what that layer reports.\r\n */\r\nexport async function teardownTest(): Promise<void> {\r\n const registry = getTestLifecycleRegistry();\r\n\r\n if (registry.state === \"stopping\" && registry.teardownAttempt) {\r\n return registry.teardownAttempt;\r\n }\r\n\r\n if (registry.state === \"starting\" && registry.setupAttempt) {\r\n // A runtime that is still opening cannot be closed halfway. Wait for the\r\n // attempt to settle: a failed one has already unwound itself and left the\r\n // lifecycle idle, which the re-entry below then reads as \"nothing to do\".\r\n await settled(registry.setupAttempt.completion);\r\n\r\n return teardownTest();\r\n }\r\n\r\n if (registry.state === \"idle\") {\r\n return;\r\n }\r\n\r\n registry.state = \"stopping\";\r\n\r\n // Deferred by a microtask so the registry is fully published before the\r\n // attempt's first line runs — a synchronous throw would otherwise reach the\r\n // `finally` below, and reset the state, before this function had recorded\r\n // that a teardown was in flight at all.\r\n const attempt = Promise.resolve().then(() => runTestRuntimeShutdown());\r\n\r\n registry.teardownAttempt = attempt;\r\n\r\n return attempt;\r\n}\r\n\r\n/**\r\n * The setup attempt's hang guard, as the lifecycle consumes it.\r\n *\r\n * The bound's POLICY — the default, the config key, the message — lives in\r\n * `test-setup-timeout.ts`. What expiry MEANS lives here.\r\n *\r\n * @internal\r\n */\r\ntype SetupBound = {\r\n /**\r\n * Rejects with the expiry error. Never resolves: the attempt is the only side\r\n * of the race that can succeed.\r\n */\r\n readonly expiry: Promise<never>;\r\n\r\n /**\r\n * Re-aim the bound at `next` ms measured from when the ATTEMPT STARTED, once\r\n * config has made `tests.setupTimeout` readable.\r\n */\r\n rearm(next: number): void;\r\n\r\n /** The race is over — cancel whatever timer is still pending. */\r\n settle(): void;\r\n\r\n /** Whether the bound, rather than the attempt, won the race. */\r\n hasExpired(): boolean;\r\n};\r\n\r\n/**\r\n * Arm the hang guard for one setup attempt.\r\n *\r\n * Armed at the default BEFORE the attempt runs, because `tests.setupTimeout` is\r\n * not readable until the attempt has loaded config — and loading config is\r\n * itself one of the steps that can hang. `rearm` then narrows or widens it the\r\n * moment config arrives.\r\n */\r\nfunction armSetupBound(registry: TestLifecycleRegistry): SetupBound {\r\n const schedule = registry.scheduleTimeout ?? scheduleRealTimeout;\r\n const armedAt = Date.now();\r\n\r\n let handle: TestTimeoutHandle | undefined;\r\n let expired = false;\r\n let closed = false;\r\n let expire: (error: unknown) => void = () => undefined;\r\n\r\n const expiry = new Promise<never>((_resolve, reject) => {\r\n expire = reject;\r\n });\r\n\r\n // Only `awaitSetupWithinBound` observes this, and only until the attempt wins\r\n // — after that nobody is listening, and an unobserved rejection surfaces as an\r\n // unhandled rejection that fails an unrelated test file. Same reason as the\r\n // `effectiveSelection` barrier below.\r\n expiry.catch(() => undefined);\r\n\r\n const expireNow = (bound: number): void => {\r\n if (closed) {\r\n return;\r\n }\r\n\r\n closed = true;\r\n expired = true;\r\n\r\n handle?.cancel();\r\n handle = undefined;\r\n\r\n expire(new TestLifecycleError(describeExpiredSetup(bound)));\r\n };\r\n\r\n const armFor = (bound: number, delay: number): void => {\r\n if (closed) {\r\n return;\r\n }\r\n\r\n handle?.cancel();\r\n\r\n // Already overdue. A bound the attempt has ALREADY exceeded must fire now,\r\n // not be rescheduled for time that was spent before it was known.\r\n if (delay <= 0) {\r\n expireNow(bound);\r\n\r\n return;\r\n }\r\n\r\n handle = schedule(delay, () => expireNow(bound));\r\n };\r\n\r\n const initialBound = registry.setupTimeoutOverride ?? DEFAULT_TEST_SETUP_TIMEOUT;\r\n\r\n armFor(initialBound, initialBound);\r\n\r\n return {\r\n expiry,\r\n\r\n // Measured from `armedAt`, never from now: adding a configured bound to the\r\n // time already spent would make the real bound default-plus-configured, and\r\n // a project that lowered the key would get a LONGER guard than the default.\r\n rearm: (next) => armFor(next, next - (Date.now() - armedAt)),\r\n\r\n settle: () => {\r\n closed = true;\r\n\r\n handle?.cancel();\r\n handle = undefined;\r\n },\r\n\r\n hasExpired: () => expired,\r\n };\r\n}\r\n\r\n/**\r\n * Race one setup attempt against its bound.\r\n *\r\n * The losing attempt is NOT cancellable — nothing here can interrupt a bootstrap\r\n * stuck in a socket connect — so when the bound wins, the lifecycle is poisoned\r\n * and every later state write from that abandoned attempt is dropped. That\r\n * dropping happens in `runTestRuntimeStartup`, guarded on `hasExpired()`;\r\n * without it the still-running attempt would quietly overwrite `poisoned` with\r\n * `ready` or `idle` and hand the next caller a runtime nobody owns.\r\n */\r\nasync function awaitSetupWithinBound(\r\n attempt: Promise<void>,\r\n bound: SetupBound,\r\n registry: TestLifecycleRegistry,\r\n): Promise<void> {\r\n try {\r\n await Promise.race([attempt, bound.expiry]);\r\n } catch (error) {\r\n if (bound.hasExpired()) {\r\n registry.state = \"poisoned\";\r\n registry.activeSelection = undefined;\r\n registry.setupAttempt = undefined;\r\n }\r\n\r\n throw error;\r\n } finally {\r\n bound.settle();\r\n }\r\n}\r\n\r\n/**\r\n * Open a new setup attempt and publish it before it runs.\r\n */\r\nfunction startTestRuntime(requested: RequestedTestConnectors): Promise<void> {\r\n const registry = getTestLifecycleRegistry();\r\n\r\n let publishEffectiveSelection: (selection: TestConnectorsSelection) => void = () => undefined;\r\n let failEffectiveSelection: (error: unknown) => void = () => undefined;\r\n\r\n const effectiveSelection = new Promise<TestConnectorsSelection>((resolve, reject) => {\r\n publishEffectiveSelection = resolve;\r\n failEffectiveSelection = reject;\r\n });\r\n\r\n // Only the mixed explicit/config comparison ever awaits this barrier, so its\r\n // rejection is usually unobserved — and an unobserved rejection would surface\r\n // as an unhandled rejection and fail an unrelated test file.\r\n effectiveSelection.catch(() => undefined);\r\n\r\n const bound = armSetupBound(registry);\r\n\r\n const attempt = Promise.resolve().then(() =>\r\n runTestRuntimeStartup(requested, publishEffectiveSelection, failEffectiveSelection, bound),\r\n );\r\n\r\n // The attempt outlives a bound that beat it, and by then `completion` has\r\n // already rejected with the expiry error — so the attempt's own late rejection\r\n // has no observer. Same unhandled-rejection hazard as above.\r\n attempt.catch(() => undefined);\r\n\r\n // `teardownTest` waits on this same promise, which is how a teardown requested\r\n // during setup inherits the bound. There is deliberately no second timer and\r\n // no separate teardown deadline.\r\n const completion = awaitSetupWithinBound(attempt, bound, registry);\r\n\r\n registry.state = \"starting\";\r\n registry.setupAttempt = { requested, effectiveSelection, completion };\r\n\r\n return completion;\r\n}\r\n\r\n/**\r\n * The startup attempt itself.\r\n *\r\n * On failure: best-effort unwind, reset bookkeeping, rethrow the ORIGINAL error\r\n * unchanged. A cleanup failure is a secondary diagnostic and never replaces the\r\n * cause the caller needs to read.\r\n */\r\nasync function runTestRuntimeStartup(\r\n requested: RequestedTestConnectors,\r\n publishEffectiveSelection: (selection: TestConnectorsSelection) => void,\r\n failEffectiveSelection: (error: unknown) => void,\r\n bound: SetupBound,\r\n): Promise<void> {\r\n const registry = getTestLifecycleRegistry();\r\n\r\n try {\r\n Application.setEnvironment(\"test\");\r\n\r\n await warlockConfigManager.load();\r\n await bootstrap();\r\n\r\n await filesOrchestrator.init();\r\n await loadConfigFiles(true);\r\n\r\n // The first point at which `tests.setupTimeout` is readable at all. An\r\n // invalid value throws from here and takes the normal failure path — falling\r\n // back to the default would silently erase what the project configured.\r\n const configuredTimeout = readConfiguredSetupTimeout();\r\n\r\n if (configuredTimeout !== undefined) {\r\n bound.rearm(configuredTimeout);\r\n }\r\n\r\n // Resolved here and not at call time: the config layer is only readable once\r\n // the four steps above have run.\r\n const effectiveSelection = resolveEffectiveConnectors(requested);\r\n\r\n // Every state write below is conditional on this attempt still being the one\r\n // the lifecycle is waiting for. Once the bound has expired the lifecycle is\r\n // poisoned and this attempt is abandoned — it may still be running, but it\r\n // no longer speaks for the runtime.\r\n if (!bound.hasExpired()) {\r\n registry.activeSelection = effectiveSelection;\r\n }\r\n\r\n publishEffectiveSelection(effectiveSelection);\r\n\r\n await startSelectedConnectors(effectiveSelection);\r\n\r\n if (!bound.hasExpired()) {\r\n registry.state = \"ready\";\r\n registry.setupAttempt = undefined;\r\n }\r\n } catch (error) {\r\n failEffectiveSelection(error);\r\n\r\n await unwindPartialStartup();\r\n\r\n if (!bound.hasExpired()) {\r\n registry.state = \"idle\";\r\n registry.activeSelection = undefined;\r\n registry.setupAttempt = undefined;\r\n }\r\n\r\n console.error(\"[vitest-setup] Failed to setup test environment:\", error);\r\n\r\n throw error;\r\n }\r\n}\r\n\r\n/**\r\n * `false` means none at all. Everything else starts something: an array starts\r\n * exactly those, and `true` starts the default set — all but http, which is the\r\n * global setup's job and shared across every worker.\r\n */\r\nasync function startSelectedConnectors(selection: TestConnectorsSelection): Promise<void> {\r\n if (selection === false) {\r\n return;\r\n }\r\n\r\n if (Array.isArray(selection)) {\r\n await connectorsManager.start(normalizeConnectorNames(selection));\r\n\r\n return;\r\n }\r\n\r\n await connectorsManager.startWithout([\"http\"]);\r\n}\r\n\r\n/**\r\n * Best-effort teardown of whatever a failed startup managed to start.\r\n *\r\n * Runs while an error is already in flight, so no step here may throw and every\r\n * step is attempted independently.\r\n */\r\nasync function unwindPartialStartup(): Promise<void> {\r\n // Two steps rather than one: `connectorsManager.shutdown()` runs the\r\n // application hooks itself, but it runs them FIRST and does not isolate their\r\n // rejection — so a hook that rejects would take the connector teardown down\r\n // with it and leave every connector up. Both calls are idempotent, so running\r\n // the hooks on their own first costs nothing and means neither failure can\r\n // skip the other step.\r\n await attemptCleanupStep(\"application shutdown hooks\", () => Application.runShutdownHooks());\r\n await attemptCleanupStep(\"connectors shutdown\", () => connectorsManager.shutdown());\r\n}\r\n\r\n/**\r\n * Run one cleanup step, isolating its failure so the next step still runs.\r\n */\r\nasync function attemptCleanupStep(step: string, run: () => Promise<void>): Promise<void> {\r\n try {\r\n await run();\r\n } catch (error) {\r\n // Reported, not thrown — it is secondary to the startup error about to be\r\n // rethrown, and losing that one to this would be the worse outcome.\r\n console.error(`[vitest-setup] Cleanup after a failed setup did not complete (${step}):`, error);\r\n }\r\n}\r\n\r\n/**\r\n * The teardown attempt itself.\r\n */\r\nasync function runTestRuntimeShutdown(): Promise<void> {\r\n const registry = getTestLifecycleRegistry();\r\n let shutdownSucceeded = false;\r\n\r\n try {\r\n // Manager-wide, and deliberately called whatever the selection was: with\r\n // `connectors: false` nothing was started, but bootstrap still registered\r\n // application shutdown hooks, and the manager runs those first (see\r\n // `connectors-manager.ts` — `Application.runShutdownHooks()` is its first\r\n // line). Skipping the call to \"match\" an empty selection would leak them.\r\n await connectorsManager.shutdown();\r\n\r\n shutdownSucceeded = true;\r\n } finally {\r\n // In a `finally`, not after the `await`: a rejected shutdown must not leave\r\n // the lifecycle claiming a runtime it no longer owns. Poisoned rather than\r\n // idle, because a cleared flag does not prove that ports, sockets, pools or\r\n // timers closed.\r\n registry.activeSelection = undefined;\r\n registry.setupAttempt = undefined;\r\n registry.teardownAttempt = undefined;\r\n registry.state = shutdownSucceeded ? \"idle\" : \"poisoned\";\r\n }\r\n}\r\n\r\n/**\r\n * Reject when a ready runtime was set up with a different selection.\r\n */\r\nfunction assertReadySelectionMatches(\r\n activeSelection: TestConnectorsSelection | undefined,\r\n requested: RequestedTestConnectors,\r\n): void {\r\n if (activeSelection === undefined) {\r\n return;\r\n }\r\n\r\n // Config is loaded by the time anything is ready, so the config-derived layer\r\n // is resolvable right here.\r\n const requestedSelection = resolveEffectiveConnectors(requested);\r\n\r\n assertSelectionsMatch(activeSelection, requestedSelection);\r\n}\r\n\r\n/**\r\n * Reject when an in-flight setup attempt is starting a different selection.\r\n */\r\nasync function assertPendingSetupMatches(\r\n attempt: TestSetupAttempt,\r\n requested: RequestedTestConnectors,\r\n): Promise<void> {\r\n const pending = attempt.requested;\r\n\r\n // Two calls that both defer to project config resolve to the same thing by\r\n // construction — knowable without waiting for config to load.\r\n if (!pending.isExplicit && !requested.isExplicit) {\r\n return;\r\n }\r\n\r\n if (pending.isExplicit && requested.isExplicit) {\r\n assertSelectionsMatch(pending.selection, requested.selection);\r\n\r\n return;\r\n }\r\n\r\n // Mixed: one side is config-derived and config is not readable until the\r\n // running attempt has loaded it, so wait for that barrier first.\r\n const activeSelection = await attempt.effectiveSelection;\r\n const requestedSelection = resolveEffectiveConnectors(requested);\r\n\r\n assertSelectionsMatch(activeSelection, requestedSelection);\r\n}\r\n\r\n/**\r\n * Name both selections: a caller looking at this message has to be able to tell\r\n * which call to change without reading the framework's source.\r\n */\r\nfunction assertSelectionsMatch(\r\n activeSelection: TestConnectorsSelection,\r\n requestedSelection: TestConnectorsSelection,\r\n): void {\r\n if (isSameConnectorsSelection(activeSelection, requestedSelection)) {\r\n return;\r\n }\r\n\r\n throw new TestLifecycleError(\r\n `setupTest() is already using ${describeConnectorsSelection(activeSelection)}, and this call asked for ${describeConnectorsSelection(requestedSelection)}. One test runtime serves one connector selection — call teardownTest() before setting up a different one.`,\r\n );\r\n}\r\n\r\n/**\r\n * Await an attempt for its state transition only, not its result.\r\n */\r\nfunction settled(attempt: Promise<void>): Promise<void> {\r\n return attempt.cat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3F,MAAM,mBAAmB,6BAA6B,kBAAkB,SAAS,CAAC;AACpF;;;;AAKA,eAAe,mBAAmB,MAAc,KAAyC;CACvF,IAAI;EACF,MAAM,IAAI;CACZ,SAAS,OAAO;EAGd,QAAQ,MAAM,iEAAiE,KAAK,KAAK,KAAK;CAChG;AACF;;;;AAKA,eAAe,yBAAwC;CACrD,MAAM,WAAW,yBAAyB;CAC1C,IAAI,oBAAoB;CAExB,IAAI;EAMF,MAAM,kBAAkB,SAAS;EAEjC,oBAAoB;CACtB,UAAU;EAKR,SAAS,kBAAkB;EAC3B,SAAS,eAAe;EACxB,SAAS,kBAAkB;EAC3B,SAAS,QAAQ,oBAAoB,SAAS;CAChD;AACF;;;;AAKA,SAAS,4BACP,iBACA,WACM;CACN,IAAI,oBAAoB,QACtB;CAOF,sBAAsB,iBAFK,2BAA2B,SAEE,CAAC;AAC3D;;;;AAKA,eAAe,0BACb,SACA,WACe;CACf,MAAM,UAAU,QAAQ;CAIxB,IAAI,CAAC,QAAQ,cAAc,CAAC,UAAU,YACpC;CAGF,IAAI,QAAQ,cAAc,UAAU,YAAY;EAC9C,sBAAsB,QAAQ,WAAW,UAAU,SAAS;EAE5D;CACF;CAOA,sBAAsB,MAHQ,QAAQ,oBACX,2BAA2B,SAEE,CAAC;AAC3D;;;;;AAMA,SAAS,sBACP,iBACA,oBACM;CACN,IAAI,0BAA0B,iBAAiB,kBAAkB,GAC/D;CAGF,MAAM,IAAI,mBACR,gCAAgC,4BAA4B,eAAe,EAAE,4BAA4B,4BAA4B,kBAAkB,EAAE,2GAC3J;AACF;;;;AAKA,SAAS,QAAQ,SAAuC;CACtD,OAAO,QAAQ,YAAY,MAAS;AACtC"}
@@ -2,7 +2,7 @@ import { rootPath } from "../utils/paths.mjs";
2
2
  import "../utils/index.mjs";
3
3
  import { fileExistsAsync } from "@warlock.js/fs";
4
4
 
5
- //#region core/src/updater/package-manager.ts
5
+ //#region ../core/src/updater/package-manager.ts
6
6
  /**
7
7
  * The lockfile that identifies each package manager, in detection order.
8
8
  * Bun is checked first because a Bun project may also carry a `yarn.lock`
@@ -1 +1 @@
1
- {"version":3,"file":"package-manager.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/updater/package-manager.ts"],"sourcesContent":["import { fileExistsAsync } from \"@warlock.js/fs\";\nimport { rootPath } from \"../utils\";\n\n/** Package managers the framework knows how to drive. */\nexport type PackageManager = \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n/**\n * The lockfile that identifies each package manager, in detection order.\n * Bun is checked first because a Bun project may also carry a `yarn.lock`\n * (Bun writes one for tooling compatibility) — matching yarn there would run\n * the wrong installer against the wrong lockfile.\n */\nconst LOCKFILES: ReadonlyArray<{ file: string; packageManager: PackageManager }> = [\n { file: \"bun.lock\", packageManager: \"bun\" },\n { file: \"bun.lockb\", packageManager: \"bun\" },\n { file: \"package-lock.json\", packageManager: \"npm\" },\n { file: \"yarn.lock\", packageManager: \"yarn\" },\n { file: \"pnpm-lock.yaml\", packageManager: \"pnpm\" },\n];\n\n/**\n * Detect the project's package manager from its lockfile, falling back to\n * npm when none is present. Shared by `warlock update` and `warlock add` so\n * both agree on a project that happens to carry more than one lockfile.\n */\nexport async function detectPackageManager(): Promise<PackageManager> {\n for (const { file, packageManager } of LOCKFILES) {\n if (await fileExistsAsync(rootPath(file))) {\n return packageManager;\n }\n }\n\n return \"npm\";\n}\n\n/**\n * The lockfile-syncing install command for the given manager. No package\n * arguments — `warlock update` rewrites the versions in package.json first,\n * then a plain install reconciles `node_modules` to match.\n */\nexport function getInstallCommand(packageManager: PackageManager): string {\n switch (packageManager) {\n case \"yarn\":\n return \"yarn install\";\n\n case \"pnpm\":\n return \"pnpm install\";\n\n case \"bun\":\n return \"bun install\";\n\n default:\n return \"npm install\";\n }\n}\n\n/**\n * The command that installs *specific* packages — what `warlock add` needs.\n * Distinct from {@link getInstallCommand}, which only reconciles what is\n * already written into package.json.\n */\nexport function getAddCommand(packageManager: PackageManager): string {\n switch (packageManager) {\n case \"yarn\":\n return \"yarn add\";\n\n case \"pnpm\":\n return \"pnpm add\";\n\n case \"bun\":\n return \"bun add\";\n\n default:\n return \"npm install\";\n }\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,YAA6E;CACjF;EAAE,MAAM;EAAY,gBAAgB;CAAM;CAC1C;EAAE,MAAM;EAAa,gBAAgB;CAAM;CAC3C;EAAE,MAAM;EAAqB,gBAAgB;CAAM;CACnD;EAAE,MAAM;EAAa,gBAAgB;CAAO;CAC5C;EAAE,MAAM;EAAkB,gBAAgB;CAAO;AACnD;;;;;;AAOA,eAAsB,uBAAgD;CACpE,KAAK,MAAM,EAAE,MAAM,oBAAoB,WACrC,IAAI,MAAM,gBAAgB,SAAS,IAAI,CAAC,GACtC,OAAO;CAIX,OAAO;AACT;;;;;;AAOA,SAAgB,kBAAkB,gBAAwC;CACxE,QAAQ,gBAAR;EACE,KAAK,QACH,OAAO;EAET,KAAK,QACH,OAAO;EAET,KAAK,OACH,OAAO;EAET,SACE,OAAO;CACX;AACF;;;;;;AAOA,SAAgB,cAAc,gBAAwC;CACpE,QAAQ,gBAAR;EACE,KAAK,QACH,OAAO;EAET,KAAK,QACH,OAAO;EAET,KAAK,OACH,OAAO;EAET,SACE,OAAO;CACX;AACF"}
1
+ {"version":3,"file":"package-manager.mjs","names":[],"sources":["../../../../../../../core/src/updater/package-manager.ts"],"sourcesContent":["import { fileExistsAsync } from \"@warlock.js/fs\";\nimport { rootPath } from \"../utils\";\n\n/** Package managers the framework knows how to drive. */\nexport type PackageManager = \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n/**\n * The lockfile that identifies each package manager, in detection order.\n * Bun is checked first because a Bun project may also carry a `yarn.lock`\n * (Bun writes one for tooling compatibility) — matching yarn there would run\n * the wrong installer against the wrong lockfile.\n */\nconst LOCKFILES: ReadonlyArray<{ file: string; packageManager: PackageManager }> = [\n { file: \"bun.lock\", packageManager: \"bun\" },\n { file: \"bun.lockb\", packageManager: \"bun\" },\n { file: \"package-lock.json\", packageManager: \"npm\" },\n { file: \"yarn.lock\", packageManager: \"yarn\" },\n { file: \"pnpm-lock.yaml\", packageManager: \"pnpm\" },\n];\n\n/**\n * Detect the project's package manager from its lockfile, falling back to\n * npm when none is present. Shared by `warlock update` and `warlock add` so\n * both agree on a project that happens to carry more than one lockfile.\n */\nexport async function detectPackageManager(): Promise<PackageManager> {\n for (const { file, packageManager } of LOCKFILES) {\n if (await fileExistsAsync(rootPath(file))) {\n return packageManager;\n }\n }\n\n return \"npm\";\n}\n\n/**\n * The lockfile-syncing install command for the given manager. No package\n * arguments — `warlock update` rewrites the versions in package.json first,\n * then a plain install reconciles `node_modules` to match.\n */\nexport function getInstallCommand(packageManager: PackageManager): string {\n switch (packageManager) {\n case \"yarn\":\n return \"yarn install\";\n\n case \"pnpm\":\n return \"pnpm install\";\n\n case \"bun\":\n return \"bun install\";\n\n default:\n return \"npm install\";\n }\n}\n\n/**\n * The command that installs *specific* packages — what `warlock add` needs.\n * Distinct from {@link getInstallCommand}, which only reconciles what is\n * already written into package.json.\n */\nexport function getAddCommand(packageManager: PackageManager): string {\n switch (packageManager) {\n case \"yarn\":\n return \"yarn add\";\n\n case \"pnpm\":\n return \"pnpm add\";\n\n case \"bun\":\n return \"bun add\";\n\n default:\n return \"npm install\";\n }\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,YAA6E;CACjF;EAAE,MAAM;EAAY,gBAAgB;CAAM;CAC1C;EAAE,MAAM;EAAa,gBAAgB;CAAM;CAC3C;EAAE,MAAM;EAAqB,gBAAgB;CAAM;CACnD;EAAE,MAAM;EAAa,gBAAgB;CAAO;CAC5C;EAAE,MAAM;EAAkB,gBAAgB;CAAO;AACnD;;;;;;AAOA,eAAsB,uBAAgD;CACpE,KAAK,MAAM,EAAE,MAAM,oBAAoB,WACrC,IAAI,MAAM,gBAAgB,SAAS,IAAI,CAAC,GACtC,OAAO;CAIX,OAAO;AACT;;;;;;AAOA,SAAgB,kBAAkB,gBAAwC;CACxE,QAAQ,gBAAR;EACE,KAAK,QACH,OAAO;EAET,KAAK,QACH,OAAO;EAET,KAAK,OACH,OAAO;EAET,SACE,OAAO;CACX;AACF;;;;;;AAOA,SAAgB,cAAc,gBAAwC;CACpE,QAAQ,gBAAR;EACE,KAAK,QACH,OAAO;EAET,KAAK,QACH,OAAO;EAET,KAAK,OACH,OAAO;EAET,SACE,OAAO;CACX;AACF"}
@@ -7,7 +7,7 @@ import { colors } from "@mongez/copper";
7
7
  import { fileExistsAsync, getJsonFileAsync, putJsonFileAsync } from "@warlock.js/fs";
8
8
  import { execSync } from "node:child_process";
9
9
 
10
- //#region core/src/updater/update-warlock-packages.ts
10
+ //#region ../core/src/updater/update-warlock-packages.ts
11
11
  /** Scope prefix that identifies a Warlock framework package. */
12
12
  const WARLOCK_SCOPE = "@warlock.js/";
13
13
  /** The dependency maps in package.json we update, in display order. */
@@ -1 +1 @@
1
- {"version":3,"file":"update-warlock-packages.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/updater/update-warlock-packages.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { fileExistsAsync, getJsonFileAsync, putJsonFileAsync } from \"@warlock.js/fs\";\nimport { execSync } from \"node:child_process\";\nimport { rootPath } from \"../utils\";\nimport { fetchLatestVersion } from \"../utils/npm-registry\";\nimport { isNewerVersion } from \"../utils/version-compare\";\nimport { detectPackageManager, getInstallCommand } from \"./package-manager\";\n\n/** Scope prefix that identifies a Warlock framework package. */\nconst WARLOCK_SCOPE = \"@warlock.js/\";\n\n/** The dependency maps in package.json we update, in display order. */\nconst DEPENDENCY_SECTIONS = [\"dependencies\", \"devDependencies\"] as const;\n\ntype DependencySection = (typeof DEPENDENCY_SECTIONS)[number];\n\ntype DependencyMap = Record<string, string>;\n\ntype PackageJson = Record<string, unknown> & {\n dependencies?: DependencyMap;\n devDependencies?: DependencyMap;\n};\n\n/** A `@warlock.js/*` dependency found in package.json. */\ntype WarlockDependency = {\n name: string;\n section: DependencySection;\n /** The current spec exactly as written, e.g. `^4.2.0`. */\n current: string;\n};\n\n/** A dependency whose latest version has been resolved from the registry. */\nexport type ResolvedDependency = WarlockDependency & {\n /** Latest version from npm, or `undefined` when the lookup failed. */\n latest: string | undefined;\n};\n\n/** A concrete version bump to write back into package.json. */\nexport type PackageUpdate = {\n name: string;\n section: DependencySection;\n /** Existing spec, e.g. `^4.2.0`. */\n from: string;\n /** New spec with the original range operator preserved, e.g. `^4.3.0`. */\n to: string;\n};\n\n/** Options accepted by {@link updateWarlockPackages}. */\nexport type UpdateWarlockPackagesOptions = {\n /** Run the package manager install after rewriting versions (default true). */\n install?: boolean;\n /**\n * Report what would change without touching package.json or node_modules.\n * Resolves with the `outdated` outcome instead of `updated`.\n */\n dryRun?: boolean;\n};\n\n/**\n * How an update run ended. Callers branch on this instead of re-deriving the\n * situation from the printed output — the dev-server `u` shortcut needs to\n * know whether restarting is warranted, and whether it may offer a retry.\n */\nexport type UpdateOutcome =\n /** No package.json at the project root — nothing to do. */\n | \"no-package-json\"\n /** package.json carries no `@warlock.js/*` dependency. */\n | \"no-packages\"\n /** Every registry lookup failed — offline, DNS down, or npm unreachable. */\n | \"registry-unreachable\"\n /** Every package is already at (or ahead of) its latest published version. */\n | \"up-to-date\"\n /** Newer versions exist, and a dry run left everything untouched. */\n | \"outdated\"\n /** Versions were rewritten (and installed, unless `install: false`). */\n | \"updated\"\n /** Versions were rewritten but the package manager install failed. */\n | \"install-failed\";\n\n/** The result of an update run. */\nexport type UpdateWarlockPackagesResult = {\n outcome: UpdateOutcome;\n /** The bumps written to package.json — empty unless `outcome` wrote any. */\n updates: PackageUpdate[];\n /** The install failure, present only for `install-failed`. */\n error?: Error;\n};\n\n/**\n * Update every `@warlock.js/*` package listed in the project's root\n * package.json to its latest published version, then reconcile `node_modules`\n * via the detected package manager.\n *\n * The original range operator on each dependency (`^`, `~`, or an exact pin)\n * is preserved; specs that aren't a plain semver — `workspace:*`, `*`,\n * `latest`, git/file URLs — are left untouched. Only genuine upgrades are\n * written, so re-running on an already-current project is a no-op.\n *\n * Resolves rather than throws on the two failures a caller is expected to\n * survive — an unreachable registry and a failed install — so the dev-server\n * shortcut can report them and keep serving.\n */\nexport async function updateWarlockPackages(\n options: UpdateWarlockPackagesOptions = {},\n): Promise<UpdateWarlockPackagesResult> {\n const runInstall = options.install ?? true;\n const packageJsonPath = rootPath(\"package.json\");\n\n if (!(await fileExistsAsync(packageJsonPath))) {\n console.log(`${colors.red(\"✖\")} No package.json found at the project root.`);\n return { outcome: \"no-package-json\", updates: [] };\n }\n\n const packageJson = (await getJsonFileAsync(packageJsonPath)) as PackageJson;\n const dependencies = collectWarlockDependencies(packageJson);\n\n if (dependencies.length === 0) {\n console.log(`${colors.yellow(\"⚠\")} No @warlock.js packages found in package.json.`);\n return { outcome: \"no-packages\", updates: [] };\n }\n\n console.log(\n `${colors.cyan(\"›\")} Checking ${colors.bold(String(dependencies.length))} ` +\n `@warlock.js package(s) for updates…`,\n );\n\n const resolved = await resolveLatestVersions(dependencies);\n\n // Distinguish \"nothing newer\" from \"we never got an answer\". Without this,\n // an offline run reports every package as up to date, which is a lie.\n if (isRegistryUnreachable(resolved)) {\n console.log(\n `${colors.yellow(\"⚠\")} Could not reach the npm registry — ` +\n `no versions were changed. Check your connection and try again.`,\n );\n return { outcome: \"registry-unreachable\", updates: [] };\n }\n\n const updates = resolvePackageUpdates(resolved);\n\n if (updates.length === 0) {\n console.log(`${colors.green(\"✓\")} All @warlock.js packages are already up to date.`);\n return { outcome: \"up-to-date\", updates: [] };\n }\n\n if (options.dryRun) {\n printUpdates(updates, { pending: true });\n return { outcome: \"outdated\", updates };\n }\n\n applyUpdates(packageJson, updates);\n await putJsonFileAsync(packageJsonPath, packageJson);\n\n printUpdates(updates);\n\n if (!runInstall) {\n console.log(\n colors.dim(\"Skipped install (--no-install). Run your package manager to apply the changes.\"),\n );\n return { outcome: \"updated\", updates };\n }\n\n try {\n await installDependencies();\n } catch (error) {\n console.log(\n `${colors.red(\"✖\")} The install failed. package.json is already updated — ` +\n `re-run your package manager install to finish.`,\n );\n return { outcome: \"install-failed\", updates, error: error as Error };\n }\n\n return { outcome: \"updated\", updates };\n}\n\n/**\n * Whether *every* lookup came back empty, which in practice means the\n * registry was never reached. A single failed package (unpublished, renamed,\n * private) leaves the rest resolvable and is not treated as an outage.\n */\nexport function isRegistryUnreachable(resolved: ResolvedDependency[]): boolean {\n return resolved.length > 0 && resolved.every((dependency) => !dependency.latest);\n}\n\n/** Collect every `@warlock.js/*` dependency across the relevant sections. */\nfunction collectWarlockDependencies(packageJson: PackageJson): WarlockDependency[] {\n const dependencies: WarlockDependency[] = [];\n\n for (const section of DEPENDENCY_SECTIONS) {\n const map = packageJson[section];\n\n if (!map) {\n continue;\n }\n\n for (const [name, current] of Object.entries(map)) {\n if (name.startsWith(WARLOCK_SCOPE)) {\n dependencies.push({ name, section, current });\n }\n }\n }\n\n return dependencies;\n}\n\n/** Resolve each dependency's latest version from the registry in parallel. */\nasync function resolveLatestVersions(\n dependencies: WarlockDependency[],\n): Promise<ResolvedDependency[]> {\n return Promise.all(\n dependencies.map(async (dependency) => ({\n ...dependency,\n latest: await fetchLatestVersion(dependency.name),\n })),\n );\n}\n\n/**\n * Turn resolved dependencies into the concrete set of version bumps to write.\n * Pure (no I/O) so it can be unit-tested directly: skips lookups that failed,\n * non-semver specs, and anything already at (or ahead of) the latest version,\n * and preserves the original range operator on everything it does rewrite.\n */\nexport function resolvePackageUpdates(resolved: ResolvedDependency[]): PackageUpdate[] {\n const updates: PackageUpdate[] = [];\n\n for (const dependency of resolved) {\n if (!dependency.latest) {\n continue;\n }\n\n const parsed = parseSpec(dependency.current);\n\n if (!parsed) {\n continue;\n }\n\n if (!isNewerVersion(dependency.latest, parsed.version)) {\n continue;\n }\n\n updates.push({\n name: dependency.name,\n section: dependency.section,\n from: dependency.current,\n to: `${parsed.operator}${dependency.latest}`,\n });\n }\n\n return updates;\n}\n\n/**\n * Split a dependency spec into its range operator and concrete version.\n * Returns `undefined` for specs we won't touch — `workspace:*`, `*`,\n * `latest`, multi-part ranges, or git/file URLs — leaving them exactly as\n * the author wrote them.\n */\nfunction parseSpec(spec: string): { operator: string; version: string } | undefined {\n const match = spec.trim().match(/^(\\^|~)?(\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?)$/);\n\n if (!match) {\n return undefined;\n }\n\n return { operator: match[1] ?? \"\", version: match[2] };\n}\n\n/** Write the resolved bumps back into the package.json object in place. */\nfunction applyUpdates(packageJson: PackageJson, updates: PackageUpdate[]): void {\n for (const update of updates) {\n const map = packageJson[update.section];\n\n if (map) {\n map[update.name] = update.to;\n }\n }\n}\n\n/** Print the version bumps — applied, or pending on a dry run. */\nfunction printUpdates(updates: PackageUpdate[], { pending = false } = {}): void {\n const headline = pending\n ? `${colors.yellow(\"↑\")} ${colors.bold(String(updates.length))} package(s) can be updated:`\n : `${colors.green(\"✓\")} Updated ${colors.bold(String(updates.length))} package(s):`;\n\n console.log(headline);\n\n for (const update of updates) {\n console.log(\n ` ${colors.cyan(update.name)} ` +\n `${colors.dim(update.from)} ${colors.dim(\"→\")} ${colors.greenBright(update.to)}`,\n );\n }\n}\n\n/** Reconcile node_modules to the rewritten package.json via the project PM. */\nasync function installDependencies(): Promise<void> {\n const packageManager = await detectPackageManager();\n const installCommand = getInstallCommand(packageManager);\n\n console.log(`${colors.cyan(\"›\")} Running ${colors.bold(installCommand)}…`);\n\n execSync(installCommand, { cwd: process.cwd(), stdio: \"inherit\" });\n}\n"],"mappings":";;;;;;;;;;;AASA,MAAM,gBAAgB;;AAGtB,MAAM,sBAAsB,CAAC,gBAAgB,iBAAiB;;;;;;;;;;;;;;;AA0F9D,eAAsB,sBACpB,UAAwC,CAAC,GACH;CACtC,MAAM,aAAa,QAAQ,WAAW;CACtC,MAAM,kBAAkB,SAAS,cAAc;CAE/C,IAAI,CAAE,MAAM,gBAAgB,eAAe,GAAI;EAC7C,QAAQ,IAAI,GAAG,OAAO,IAA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AO;EAE/B,IAAI,KACF,IAAI,OAAO,QAAQ,OAAO;CAE9B;AACF;;AAGA,SAAS,aAAa,SAA0B,EAAE,UAAU,UAAU,CAAC,GAAS;CAC9E,MAAM,WAAW,UACb,GAAG,OAAO,OAAO,GAAG,EAAE,GAAG,OAAO,KAAK,OAAO,QAAQ,MAAM,CAAC,EAAE,+BAC7D,GAAG,OAAO,MAAM,GAAG,EAAE,WAAW,OAAO,KAAK,OAAO,QAAQ,MAAM,CAAC,EAAE;CAExE,QAAQ,IAAI,QAAQ;CAEpB,KAAK,MAAM,UAAU,SACnB,QAAQ,IACN,MAAM,OAAO,KAAK,OAAO,IAAI,EAAE,IAC1B,OAAO,IAAI,OAAO,IAAI,EAAE,GAAG,OAAO,IAAI,GAAG,EAAE,GAAG,OAAO,YAAY,OAAO,EAAE,GACjF;AAEJ;;AAGA,eAAe,sBAAqC;CAElD,MAAM,iBAAiB,kBAAkB,MADZ,qBAAqB,CACK;CAEvD,QAAQ,IAAI,GAAG,OAAO,KAAK,GAAG,EAAE,WAAW,OAAO,KAAK,cAAc,EAAE,EAAE;CAEzE,SAAS,gBAAgB;EAAE,KAAK,QAAQ,IAAI;EAAG,OAAO;CAAU,CAAC;AACnE"}
1
+ {"version":3,"file":"update-warlock-packages.mjs","names":[],"sources":["../../../../../../../core/src/updater/update-warlock-packages.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { fileExistsAsync, getJsonFileAsync, putJsonFileAsync } from \"@warlock.js/fs\";\nimport { execSync } from \"node:child_process\";\nimport { rootPath } from \"../utils\";\nimport { fetchLatestVersion } from \"../utils/npm-registry\";\nimport { isNewerVersion } from \"../utils/version-compare\";\nimport { detectPackageManager, getInstallCommand } from \"./package-manager\";\n\n/** Scope prefix that identifies a Warlock framework package. */\nconst WARLOCK_SCOPE = \"@warlock.js/\";\n\n/** The dependency maps in package.json we update, in display order. */\nconst DEPENDENCY_SECTIONS = [\"dependencies\", \"devDependencies\"] as const;\n\ntype DependencySection = (typeof DEPENDENCY_SECTIONS)[number];\n\ntype DependencyMap = Record<string, string>;\n\ntype PackageJson = Record<string, unknown> & {\n dependencies?: DependencyMap;\n devDependencies?: DependencyMap;\n};\n\n/** A `@warlock.js/*` dependency found in package.json. */\ntype WarlockDependency = {\n name: string;\n section: DependencySection;\n /** The current spec exactly as written, e.g. `^4.2.0`. */\n current: string;\n};\n\n/** A dependency whose latest version has been resolved from the registry. */\nexport type ResolvedDependency = WarlockDependency & {\n /** Latest version from npm, or `undefined` when the lookup failed. */\n latest: string | undefined;\n};\n\n/** A concrete version bump to write back into package.json. */\nexport type PackageUpdate = {\n name: string;\n section: DependencySection;\n /** Existing spec, e.g. `^4.2.0`. */\n from: string;\n /** New spec with the original range operator preserved, e.g. `^4.3.0`. */\n to: string;\n};\n\n/** Options accepted by {@link updateWarlockPackages}. */\nexport type UpdateWarlockPackagesOptions = {\n /** Run the package manager install after rewriting versions (default true). */\n install?: boolean;\n /**\n * Report what would change without touching package.json or node_modules.\n * Resolves with the `outdated` outcome instead of `updated`.\n */\n dryRun?: boolean;\n};\n\n/**\n * How an update run ended. Callers branch on this instead of re-deriving the\n * situation from the printed output — the dev-server `u` shortcut needs to\n * know whether restarting is warranted, and whether it may offer a retry.\n */\nexport type UpdateOutcome =\n /** No package.json at the project root — nothing to do. */\n | \"no-package-json\"\n /** package.json carries no `@warlock.js/*` dependency. */\n | \"no-packages\"\n /** Every registry lookup failed — offline, DNS down, or npm unreachable. */\n | \"registry-unreachable\"\n /** Every package is already at (or ahead of) its latest published version. */\n | \"up-to-date\"\n /** Newer versions exist, and a dry run left everything untouched. */\n | \"outdated\"\n /** Versions were rewritten (and installed, unless `install: false`). */\n | \"updated\"\n /** Versions were rewritten but the package manager install failed. */\n | \"install-failed\";\n\n/** The result of an update run. */\nexport type UpdateWarlockPackagesResult = {\n outcome: UpdateOutcome;\n /** The bumps written to package.json — empty unless `outcome` wrote any. */\n updates: PackageUpdate[];\n /** The install failure, present only for `install-failed`. */\n error?: Error;\n};\n\n/**\n * Update every `@warlock.js/*` package listed in the project's root\n * package.json to its latest published version, then reconcile `node_modules`\n * via the detected package manager.\n *\n * The original range operator on each dependency (`^`, `~`, or an exact pin)\n * is preserved; specs that aren't a plain semver — `workspace:*`, `*`,\n * `latest`, git/file URLs — are left untouched. Only genuine upgrades are\n * written, so re-running on an already-current project is a no-op.\n *\n * Resolves rather than throws on the two failures a caller is expected to\n * survive — an unreachable registry and a failed install — so the dev-server\n * shortcut can report them and keep serving.\n */\nexport async function updateWarlockPackages(\n options: UpdateWarlockPackagesOptions = {},\n): Promise<UpdateWarlockPackagesResult> {\n const runInstall = options.install ?? true;\n const packageJsonPath = rootPath(\"package.json\");\n\n if (!(await fileExistsAsync(packageJsonPath))) {\n console.log(`${colors.red(\"✖\")} No package.json found at the project root.`);\n return { outcome: \"no-package-json\", updates: [] };\n }\n\n const packageJson = (await getJsonFileAsync(packageJsonPath)) as PackageJson;\n const dependencies = collectWarlockDependencies(packageJson);\n\n if (dependencies.length === 0) {\n console.log(`${colors.yellow(\"⚠\")} No @warlock.js packages found in package.json.`);\n return { outcome: \"no-packages\", updates: [] };\n }\n\n console.log(\n `${colors.cyan(\"›\")} Checking ${colors.bold(String(dependencies.length))} ` +\n `@warlock.js package(s) for updates…`,\n );\n\n const resolved = await resolveLatestVersions(dependencies);\n\n // Distinguish \"nothing newer\" from \"we never got an answer\". Without this,\n // an offline run reports every package as up to date, which is a lie.\n if (isRegistryUnreachable(resolved)) {\n console.log(\n `${colors.yellow(\"⚠\")} Could not reach the npm registry — ` +\n `no versions were changed. Check your connection and try again.`,\n );\n return { outcome: \"registry-unreachable\", updates: [] };\n }\n\n const updates = resolvePackageUpdates(resolved);\n\n if (updates.length === 0) {\n console.log(`${colors.green(\"✓\")} All @warlock.js packages are already up to date.`);\n return { outcome: \"up-to-date\", updates: [] };\n }\n\n if (options.dryRun) {\n printUpdates(updates, { pending: true });\n return { outcome: \"outdated\", updates };\n }\n\n applyUpdates(packageJson, updates);\n await putJsonFileAsync(packageJsonPath, packageJson);\n\n printUpdates(updates);\n\n if (!runInstall) {\n console.log(\n colors.dim(\"Skipped install (--no-install). Run your package manager to apply the changes.\"),\n );\n return { outcome: \"updated\", updates };\n }\n\n try {\n await installDependencies();\n } catch (error) {\n console.log(\n `${colors.red(\"✖\")} The install failed. package.json is already updated — ` +\n `re-run your package manager install to finish.`,\n );\n return { outcome: \"install-failed\", updates, error: error as Error };\n }\n\n return { outcome: \"updated\", updates };\n}\n\n/**\n * Whether *every* lookup came back empty, which in practice means the\n * registry was never reached. A single failed package (unpublished, renamed,\n * private) leaves the rest resolvable and is not treated as an outage.\n */\nexport function isRegistryUnreachable(resolved: ResolvedDependency[]): boolean {\n return resolved.length > 0 && resolved.every((dependency) => !dependency.latest);\n}\n\n/** Collect every `@warlock.js/*` dependency across the relevant sections. */\nfunction collectWarlockDependencies(packageJson: PackageJson): WarlockDependency[] {\n const dependencies: WarlockDependency[] = [];\n\n for (const section of DEPENDENCY_SECTIONS) {\n const map = packageJson[section];\n\n if (!map) {\n continue;\n }\n\n for (const [name, current] of Object.entries(map)) {\n if (name.startsWith(WARLOCK_SCOPE)) {\n dependencies.push({ name, section, current });\n }\n }\n }\n\n return dependencies;\n}\n\n/** Resolve each dependency's latest version from the registry in parallel. */\nasync function resolveLatestVersions(\n dependencies: WarlockDependency[],\n): Promise<ResolvedDependency[]> {\n return Promise.all(\n dependencies.map(async (dependency) => ({\n ...dependency,\n latest: await fetchLatestVersion(dependency.name),\n })),\n );\n}\n\n/**\n * Turn resolved dependencies into the concrete set of version bumps to write.\n * Pure (no I/O) so it can be unit-tested directly: skips lookups that failed,\n * non-semver specs, and anything already at (or ahead of) the latest version,\n * and preserves the original range operator on everything it does rewrite.\n */\nexport function resolvePackageUpdates(resolved: ResolvedDependency[]): PackageUpdate[] {\n const updates: PackageUpdate[] = [];\n\n for (const dependency of resolved) {\n if (!dependency.latest) {\n continue;\n }\n\n const parsed = parseSpec(dependency.current);\n\n if (!parsed) {\n continue;\n }\n\n if (!isNewerVersion(dependency.latest, parsed.version)) {\n continue;\n }\n\n updates.push({\n name: dependency.name,\n section: dependency.section,\n from: dependency.current,\n to: `${parsed.operator}${dependency.latest}`,\n });\n }\n\n return updates;\n}\n\n/**\n * Split a dependency spec into its range operator and concrete version.\n * Returns `undefined` for specs we won't touch — `workspace:*`, `*`,\n * `latest`, multi-part ranges, or git/file URLs — leaving them exactly as\n * the author wrote them.\n */\nfunction parseSpec(spec: string): { operator: string; version: string } | undefined {\n const match = spec.trim().match(/^(\\^|~)?(\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?)$/);\n\n if (!match) {\n return undefined;\n }\n\n return { operator: match[1] ?? \"\", version: match[2] };\n}\n\n/** Write the resolved bumps back into the package.json object in place. */\nfunction applyUpdates(packageJson: PackageJson, updates: PackageUpdate[]): void {\n for (const update of updates) {\n const map = packageJson[update.section];\n\n if (map) {\n map[update.name] = update.to;\n }\n }\n}\n\n/** Print the version bumps — applied, or pending on a dry run. */\nfunction printUpdates(updates: PackageUpdate[], { pending = false } = {}): void {\n const headline = pending\n ? `${colors.yellow(\"↑\")} ${colors.bold(String(updates.length))} package(s) can be updated:`\n : `${colors.green(\"✓\")} Updated ${colors.bold(String(updates.length))} package(s):`;\n\n console.log(headline);\n\n for (const update of updates) {\n console.log(\n ` ${colors.cyan(update.name)} ` +\n `${colors.dim(update.from)} ${colors.dim(\"→\")} ${colors.greenBright(update.to)}`,\n );\n }\n}\n\n/** Reconcile node_modules to the rewritten package.json via the project PM. */\nasync function installDependencies(): Promise<void> {\n const packageManager = await detectPackageManager();\n const installCommand = getInstallCommand(packageManager);\n\n console.log(`${colors.cyan(\"›\")} Running ${colors.bold(installCommand)}…`);\n\n execSync(installCommand, { cwd: process.cwd(), stdio: \"inherit\" });\n}\n"],"mappings":";;;;;;;;;;;AASA,MAAM,gBAAgB;;AAGtB,MAAM,sBAAsB,CAAC,gBAAgB,iBAAiB;;;;;;;;;;;;;;;AA0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CAE9E,IAAI,CAAC,OACH;CAGF,OAAO;EAAE,UAAU,MAAM,MAAM;EAAI,SAAS,MAAM;CAAG;AACvD;;AAGA,SAAS,aAAa,aAA0B,SAAgC;CAC9E,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,MAAM,YAAY,OAAO;EAE/B,IAAI,KACF,IAAI,OAAO,QAAQ,OAAO;CAE9B;AACF;;AAGA,SAAS,aAAa,SAA0B,EAAE,UAAU,UAAU,CAAC,GAAS;CAC9E,MAAM,WAAW,UACb,GAAG,OAAO,OAAO,GAAG,EAAE,GAAG,OAAO,KAAK,OAAO,QAAQ,MAAM,CAAC,EAAE,+BAC7D,GAAG,OAAO,MAAM,GAAG,EAAE,WAAW,OAAO,KAAK,OAAO,QAAQ,MAAM,CAAC,EAAE;CAExE,QAAQ,IAAI,QAAQ;CAEpB,KAAK,MAAM,UAAU,SACnB,QAAQ,IACN,MAAM,OAAO,KAAK,OAAO,IAAI,EAAE,IAC1B,OAAO,IAAI,OAAO,IAAI,EAAE,GAAG,OAAO,IAAI,GAAG,EAAE,GAAG,OAAO,YAAY,OAAO,EAAE,GACjF;AAEJ;;AAGA,eAAe,sBAAqC;CAElD,MAAM,iBAAiB,kBAAkB,MADZ,qBAAqB,CACK;CAEvD,QAAQ,IAAI,GAAG,OAAO,KAAK,GAAG,EAAE,WAAW,OAAO,KAAK,cAAc,EAAE,EAAE;CAEzE,SAAS,gBAAgB;EAAE,KAAK,QAAQ,IAAI;EAAG,OAAO;CAAU,CAAC;AACnE"}
@@ -2,7 +2,7 @@ import { BenchmarkOptions } from "../benchmark/types.mjs";
2
2
  import { Infer, ObjectValidator } from "@warlock.js/seal";
3
3
  import { RetryOptions } from "@mongez/reinforcements";
4
4
 
5
- //#region core/src/use-cases/types.d.ts
5
+ //#region ../core/src/use-cases/types.d.ts
6
6
  /**
7
7
  * Shared context object passed through the entire use case pipeline.
8
8
  * Contains the optional schema and can be enriched by guards/middleware
@@ -1 +1 @@
1
- {"version":3,"file":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;KASG,aAAA;EAvDA,2DAyDV,MAAA,GAAS,MAAA,EAzDkB;EA2D3B,GAAA,EAAK,cAAA,EA3DoE;EA6DzE,SAAA,EAAW,IAAA,EA7DqD;EA+DhE,OAAA,EAAS,IAAA,EA/DmB;EAiE5B,EAAA,UAjEyD;EAmEzD,IAAA,UAnEyE;EAqEzE,KAAA,UAjEE;EAmEF,OAAA;IA/DE,qDAiEA,QAAA,UAjEK;IAmEL,KAAA,WAhD6B;IAkD7B,YAAA;EAAA,GA5CkB;EA+CpB,eAAA;IA7CuB,qCA+CrB,OAAA,UA7CgC;IA+ChC,KAAA;EAAA;AAAA;;;;;KAQQ,yBAAA;EACV,WAAA,IAAe,GAAA,EAAK,yBAAA;EACpB,WAAA,IAAe,MAAA,EAAQ,aAAA;EACvB,OAAA,IAAW,GAAA,EAAK,kBAAA;AAAA;;;;;AA1DkB;AAOpC;;;;;;;;;;KAqEY,qBAAA;EAnEH;;AAAK;AASd;EA+DE,KAAA,GAAQ,YAAA;EA/De;;;;EAoEvB,SAAA,aAAsB,gBAAA,EA5DT;EA8Db,SAAA;IAtEwB,uEAwEtB,OAAA,YAtEO;IAwEP,QAAA,GAAW,uBAAA;EAAA,GApEb;EAuEA,GAAA,YArEA;EAuEA,OAAA;IArEA,qDAuEE,OAAA,YAnEF;IAqEE,GAAA,mBAjEA;IAmEA,UAAA;EAAA;AAAA"}
@@ -1,6 +1,6 @@
1
1
  import { UseCaseBroadcastOption, UseCaseConfigurations, UseCaseResult } from "./types.mjs";
2
2
 
3
- //#region core/src/use-cases/use-case-broadcast.d.ts
3
+ //#region ../core/src/use-cases/use-case-broadcast.d.ts
4
4
  /**
5
5
  * Broadcast a successful use-case result through the globally-configured channels.
6
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"use-case-broadcast.d.mts","names":[],"sources":["C:/Work/Warlock.js/core/src/use-cases/use-case-broadcast.ts"],"mappings":";;;;;AAkBA;;;;;;;;iBAAsB,sBAAA,QAAA,CAA+B,MAAA;EACnD,IAAA;EACA,EAAA;EACA,MAAA,EAAQ,MAAA;EACR,MAAA,EAAQ,aAAA,CAAc,MAAA;EACtB,SAAA,GAAY,sBAAA,CAAuB,MAAA;EACnC,MAAA,GAAS,qBAAA;AAAA,IACP,OAAA"}
1
+ {"version":3,"file":"use-case-broadcast.d.mts","names":[],"sources":["../../../../../../../core/src/use-cases/use-case-broadcast.ts"],"mappings":";;;;;AAkBA;;;;;;;;iBAAsB,sBAAA,QAAA,CAA+B,MAAA;EACnD,IAAA;EACA,EAAA;EACA,MAAA,EAAQ,MAAA;EACR,MAAA,EAAQ,aAAA,CAAc,MAAA;EACtB,SAAA,GAAY,sBAAA,CAAuB,MAAA;EACnC,MAAA,GAAS,qBAAA;AAAA,IACP,OAAA"}
@@ -1,6 +1,6 @@
1
1
  import { log } from "@warlock.js/logger";
2
2
 
3
- //#region core/src/use-cases/use-case-broadcast.ts
3
+ //#region ../core/src/use-cases/use-case-broadcast.ts
4
4
  /**
5
5
  * Broadcast a successful use-case result through the globally-configured channels.
6
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"use-case-broadcast.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/use-cases/use-case-broadcast.ts"],"sourcesContent":["import { log } from \"@warlock.js/logger\";\nimport type {\n UseCaseBroadcastEvent,\n UseCaseBroadcastOption,\n UseCaseConfigurations,\n UseCaseResult,\n} from \"./types\";\n\n/**\n * Broadcast a successful use-case result through the globally-configured channels.\n *\n * Fires only when the use case opted in (`broadcast`) and the global transport is\n * enabled with at least one channel. Fan-out is isolated via `Promise.allSettled` —\n * a failing channel is logged and never affects the use case or sibling channels.\n *\n * @example\n * await broadcastUseCaseResult({ name, id, output, result, broadcast, config });\n */\nexport async function broadcastUseCaseResult<Output>(params: {\n name: string;\n id: string;\n output: Output;\n result: UseCaseResult<Output>;\n broadcast?: UseCaseBroadcastOption<Output>;\n config?: UseCaseConfigurations[\"broadcast\"];\n}): Promise<void> {\n const { name, id, output, result, broadcast, config } = params;\n\n if (!broadcast) {\n return;\n }\n\n if (config?.enabled === false) {\n return;\n }\n\n const channels = config?.channels;\n\n if (!channels || channels.length === 0) {\n return;\n }\n\n const projector = typeof broadcast === \"object\" ? broadcast.output : undefined;\n const event = typeof broadcast === \"object\" && broadcast.event ? broadcast.event : name;\n const payload = projector ? projector(output, result) : output;\n\n const broadcastEvent: UseCaseBroadcastEvent = {\n useCase: name,\n event,\n id,\n at: new Date(),\n payload,\n };\n\n const outcomes = await Promise.allSettled(\n channels.map((channel) => channel.broadcast(broadcastEvent)),\n );\n\n for (const outcome of outcomes) {\n if (outcome.status === \"rejected\") {\n log.error(\"use-cases\", name, \"broadcast channel failed\", { error: outcome.reason });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,eAAsB,uBAA+B,QAOnC;CAChB,MAAM,EAAE,MAAM,IAAI,QAAQ,QAAQ,WAAW,WAAW;CAExD,IAAI,CAAC,WACH;CAGF,IAAI,QAAQ,YAAY,OACtB;CAGF,MAAM,WAAW,QAAQ;CAEzB,IAAI,CAAC,YAAY,SAAS,WAAW,GACnC;CAGF,MAAM,YAAY,OAAO,cAAc,WAAW,UAAU,SAAS;CACrE,MAAM,QAAQ,OAAO,cAAc,YAAY,UAAU,QAAQ,UAAU,QAAQ;CACnF,MAAM,UAAU,YAAY,UAAU,QAAQ,MAAM,IAAI;CAExD,MAAM,iBAAwC;EAC5C,SAAS;EACT;EACA;EACA,oBAAI,IAAI,KAAK;EACb;CACF;CAEA,MAAM,WAAW,MAAM,QAAQ,WAC7B,SAAS,KAAK,YAAY,QAAQ,UAAU,cAAc,CAAC,CAC7D;CAEA,KAAK,MAAM,WAAW,UACpB,IAAI,QAAQ,WAAW,YACrB,IAAI,MAAM,aAAa,MAAM,4BAA4B,EAAE,OAAO,QAAQ,OAAO,CAAC;AAGxF"}
1
+ {"version":3,"file":"use-case-broadcast.mjs","names":[],"sources":["../../../../../../../core/src/use-cases/use-case-broadcast.ts"],"sourcesContent":["import { log } from \"@warlock.js/logger\";\nimport type {\n UseCaseBroadcastEvent,\n UseCaseBroadcastOption,\n UseCaseConfigurations,\n UseCaseResult,\n} from \"./types\";\n\n/**\n * Broadcast a successful use-case result through the globally-configured channels.\n *\n * Fires only when the use case opted in (`broadcast`) and the global transport is\n * enabled with at least one channel. Fan-out is isolated via `Promise.allSettled` —\n * a failing channel is logged and never affects the use case or sibling channels.\n *\n * @example\n * await broadcastUseCaseResult({ name, id, output, result, broadcast, config });\n */\nexport async function broadcastUseCaseResult<Output>(params: {\n name: string;\n id: string;\n output: Output;\n result: UseCaseResult<Output>;\n broadcast?: UseCaseBroadcastOption<Output>;\n config?: UseCaseConfigurations[\"broadcast\"];\n}): Promise<void> {\n const { name, id, output, result, broadcast, config } = params;\n\n if (!broadcast) {\n return;\n }\n\n if (config?.enabled === false) {\n return;\n }\n\n const channels = config?.channels;\n\n if (!channels || channels.length === 0) {\n return;\n }\n\n const projector = typeof broadcast === \"object\" ? broadcast.output : undefined;\n const event = typeof broadcast === \"object\" && broadcast.event ? broadcast.event : name;\n const payload = projector ? projector(output, result) : output;\n\n const broadcastEvent: UseCaseBroadcastEvent = {\n useCase: name,\n event,\n id,\n at: new Date(),\n payload,\n };\n\n const outcomes = await Promise.allSettled(\n channels.map((channel) => channel.broadcast(broadcastEvent)),\n );\n\n for (const outcome of outcomes) {\n if (outcome.status === \"rejected\") {\n log.error(\"use-cases\", name, \"broadcast channel failed\", { error: outcome.reason });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,eAAsB,uBAA+B,QAOnC;CAChB,MAAM,EAAE,MAAM,IAAI,QAAQ,QAAQ,WAAW,WAAW;CAExD,IAAI,CAAC,WACH;CAGF,IAAI,QAAQ,YAAY,OACtB;CAGF,MAAM,WAAW,QAAQ;CAEzB,IAAI,CAAC,YAAY,SAAS,WAAW,GACnC;CAGF,MAAM,YAAY,OAAO,cAAc,WAAW,UAAU,SAAS;CACrE,MAAM,QAAQ,OAAO,cAAc,YAAY,UAAU,QAAQ,UAAU,QAAQ;CACnF,MAAM,UAAU,YAAY,UAAU,QAAQ,MAAM,IAAI;CAExD,MAAM,iBAAwC;EAC5C,SAAS;EACT;EACA;EACA,oBAAI,IAAI,KAAK;EACb;CACF;CAEA,MAAM,WAAW,MAAM,QAAQ,WAC7B,SAAS,KAAK,YAAY,QAAQ,UAAU,cAAc,CAAC,CAC7D;CAEA,KAAK,MAAM,WAAW,UACpB,IAAI,QAAQ,WAAW,YACrB,IAAI,MAAM,aAAa,MAAM,4BAA4B,EAAE,OAAO,QAAQ,OAAO,CAAC;AAGxF"}
@@ -1,6 +1,6 @@
1
1
  import { UseCaseErrorResult, UseCaseEventsCallbacksMap, UseCaseOnExecutingContext, UseCaseResult } from "./types.mjs";
2
2
 
3
- //#region core/src/use-cases/use-case-events.d.ts
3
+ //#region ../core/src/use-cases/use-case-events.d.ts
4
4
  /**
5
5
  * Global event callbacks — shared across all use case instances.
6
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"use-case-events.d.mts","names":[],"sources":["C:/Work/Warlock.js/core/src/use-cases/use-case-events.ts"],"mappings":";;;;;AAWA;cAAa,wBAAA,EAA0B,yBAItC;;;AAAA;AASD;;;;cAAa,oBAAA;yBACY,GAAA,EAAK,yBAAA;;;sBASV,QAAA,GAAa,MAAA,EAAQ,aAAA,CAAc,MAAA;;;qBASlC,GAAA,EAAK,kBAAA;;;;;;;;;;;iBAkBJ,kBAAA,UAAA,CACpB,GAAA,EAAK,QAAA,EACL,SAAA;EACE,UAAA,KAAe,GAAA,EAAK,QAAA,YAAoB,OAAA;EACxC,OAAA,KAAY,GAAA,EAAK,QAAA,YAAoB,OAAA;EACrC,MAAA,KAAW,GAAA,EAAK,QAAA,YAAoB,OAAA;AAAA,IACrC,OAAA"}
1
+ {"version":3,"file":"use-case-events.d.mts","names":[],"sources":["../../../../../../../core/src/use-cases/use-case-events.ts"],"mappings":";;;;;AAWA;cAAa,wBAAA,EAA0B,yBAItC;;;AAAA;AASD;;;;cAAa,oBAAA;yBACY,GAAA,EAAK,yBAAA;;;sBASV,QAAA,GAAa,MAAA,EAAQ,aAAA,CAAc,MAAA;;;qBASlC,GAAA,EAAK,kBAAA;;;;;;;;;;;iBAkBJ,kBAAA,UAAA,CACpB,GAAA,EAAK,QAAA,EACL,SAAA;EACE,UAAA,KAAe,GAAA,EAAK,QAAA,YAAoB,OAAA;EACxC,OAAA,KAAY,GAAA,EAAK,QAAA,YAAoB,OAAA;EACrC,MAAA,KAAW,GAAA,EAAK,QAAA,YAAoB,OAAA;AAAA,IACrC,OAAA"}
@@ -1,6 +1,6 @@
1
1
  import { log } from "@warlock.js/logger";
2
2
 
3
- //#region core/src/use-cases/use-case-events.ts
3
+ //#region ../core/src/use-cases/use-case-events.ts
4
4
  /**
5
5
  * Global event callbacks — shared across all use case instances.
6
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"use-case-events.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/use-cases/use-case-events.ts"],"sourcesContent":["import { log } from \"@warlock.js/logger\";\r\nimport type {\r\n UseCaseErrorResult,\r\n UseCaseEventsCallbacksMap,\r\n UseCaseOnExecutingContext,\r\n UseCaseResult,\r\n} from \"./types\";\r\n\r\n/**\r\n * Global event callbacks — shared across all use case instances.\r\n */\r\nexport const globalEventsCallbacksMap: UseCaseEventsCallbacksMap = {\r\n onExecuting: [],\r\n onCompleted: [],\r\n onError: [],\r\n};\r\n\r\n/**\r\n * Subscribe to lifecycle events fired by any use case.\r\n *\r\n * @example\r\n * globalUseCasesEvents.onCompleted((result) => metrics.track(result.name, result.benchmarkResult));\r\n * globalUseCasesEvents.onError((ctx) => logger.error(ctx.name, ctx.error));\r\n */\r\nexport const globalUseCasesEvents = {\r\n onExecuting(callback: (ctx: UseCaseOnExecutingContext) => void) {\r\n globalEventsCallbacksMap.onExecuting.push(callback);\r\n return {\r\n unsubscribe: () => {\r\n const idx = globalEventsCallbacksMap.onExecuting.indexOf(callback);\r\n if (idx !== -1) globalEventsCallbacksMap.onExecuting.splice(idx, 1);\r\n },\r\n };\r\n },\r\n onCompleted<Output>(callback: (result: UseCaseResult<Output>) => void) {\r\n globalEventsCallbacksMap.onCompleted.push(callback);\r\n return {\r\n unsubscribe: () => {\r\n const idx = globalEventsCallbacksMap.onCompleted.indexOf(callback);\r\n if (idx !== -1) globalEventsCallbacksMap.onCompleted.splice(idx, 1);\r\n },\r\n };\r\n },\r\n onError(callback: (ctx: UseCaseErrorResult) => void) {\r\n globalEventsCallbacksMap.onError.push(callback);\r\n return {\r\n unsubscribe: () => {\r\n const idx = globalEventsCallbacksMap.onError.indexOf(callback);\r\n if (idx !== -1) globalEventsCallbacksMap.onError.splice(idx, 1);\r\n },\r\n };\r\n },\r\n};\r\n\r\n/**\r\n * Dispatches a lifecycle event to invocation → use-case → global observers, in that order.\r\n *\r\n * Each observer is awaited sequentially and isolated in its own try/catch — a slow\r\n * observer can't stall the others, and a throwing one can't break the pipeline (e.g.\r\n * a successful use case must not fail because a metrics/broadcast observer threw).\r\n */\r\nexport async function fireLifecycleEvent<EventCtx>(\r\n ctx: EventCtx,\r\n observers: {\r\n invocation?: ((ctx: EventCtx) => void | Promise<void>)[];\r\n useCase?: ((ctx: EventCtx) => void | Promise<void>)[];\r\n global?: ((ctx: EventCtx) => void | Promise<void>)[];\r\n },\r\n) {\r\n const tiers = [observers.invocation, observers.useCase, observers.global];\r\n\r\n for (const tier of tiers) {\r\n if (!tier) {\r\n continue;\r\n }\r\n\r\n for (const observer of tier) {\r\n try {\r\n await observer(ctx);\r\n } catch (observerError) {\r\n log.error(\"use-cases\", \"lifecycle\", \"observer failed\", { error: observerError });\r\n }\r\n }\r\n }\r\n}\r\n"],"mappings":";;;;;;AAWA,MAAa,2BAAsD;CACjE,aAAa,CAAC;CACd,aAAa,CAAC;CACd,SAAS,CAAC;AACZ;;;;;;;;AASA,MAAa,uBAAuB;CAClC,YAAY,UAAoD;EAC9D,yBAAyB,YAAY,KAAK,QAAQ;EAClD,OAAO,EACL,mBAAmB;GACjB,MAAM,MAAM,yBAAyB,YAAY,QAAQ,QAAQ;GACjE,IAAI,QAAQ,IAAI,yBAAyB,YAAY,OAAO,KAAK,CAAC;EACpE,EACF;CACF;CACA,YAAoB,UAAmD;EACrE,yBAAyB,YAAY,KAAK,QAAQ;EAClD,OAAO,EACL,mBAAmB;GACjB,MAAM,MAAM,yBAAyB,YAAY,QAAQ,QAAQ;GACjE,IAAI,QAAQ,IAAI,yBAAyB,YAAY,OAAO,KAAK,CAAC;EACpE,EACF;CACF;CACA,QAAQ,UAA6C;EACnD,yBAAyB,QAAQ,KAAK,QAAQ;EAC9C,OAAO,EACL,mBAAmB;GACjB,MAAM,MAAM,yBAAyB,QAAQ,QAAQ,QAAQ;GAC7D,IAAI,QAAQ,IAAI,yBAAyB,QAAQ,OAAO,KAAK,CAAC;EAChE,EACF;CACF;AACF;;;;;;;;AASA,eAAsB,mBACpB,KACA,WAKA;CACA,MAAM,QAAQ;EAAC,UAAU;EAAY,UAAU;EAAS,UAAU;CAAM;CAExE,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,CAAC,MACH;EAGF,KAAK,MAAM,YAAY,MACrB,IAAI;GACF,MAAM,SAAS,GAAG;EACpB,SAAS,eAAe;GACtB,IAAI,MAAM,aAAa,aAAa,mBAAmB,EAAE,OAAO,cAAc,CAAC;EACjF;CAEJ;AACF"}
1
+ {"version":3,"file":"use-case-events.mjs","names":[],"sources":["../../../../../../../core/src/use-cases/use-case-events.ts"],"sourcesContent":["import { log } from \"@warlock.js/logger\";\r\nimport type {\r\n UseCaseErrorResult,\r\n UseCaseEventsCallbacksMap,\r\n UseCaseOnExecutingContext,\r\n UseCaseResult,\r\n} from \"./types\";\r\n\r\n/**\r\n * Global event callbacks — shared across all use case instances.\r\n */\r\nexport const globalEventsCallbacksMap: UseCaseEventsCallbacksMap = {\r\n onExecuting: [],\r\n onCompleted: [],\r\n onError: [],\r\n};\r\n\r\n/**\r\n * Subscribe to lifecycle events fired by any use case.\r\n *\r\n * @example\r\n * globalUseCasesEvents.onCompleted((result) => metrics.track(result.name, result.benchmarkResult));\r\n * globalUseCasesEvents.onError((ctx) => logger.error(ctx.name, ctx.error));\r\n */\r\nexport const globalUseCasesEvents = {\r\n onExecuting(callback: (ctx: UseCaseOnExecutingContext) => void) {\r\n globalEventsCallbacksMap.onExecuting.push(callback);\r\n return {\r\n unsubscribe: () => {\r\n const idx = globalEventsCallbacksMap.onExecuting.indexOf(callback);\r\n if (idx !== -1) globalEventsCallbacksMap.onExecuting.splice(idx, 1);\r\n },\r\n };\r\n },\r\n onCompleted<Output>(callback: (result: UseCaseResult<Output>) => void) {\r\n globalEventsCallbacksMap.onCompleted.push(callback);\r\n return {\r\n unsubscribe: () => {\r\n const idx = globalEventsCallbacksMap.onCompleted.indexOf(callback);\r\n if (idx !== -1) globalEventsCallbacksMap.onCompleted.splice(idx, 1);\r\n },\r\n };\r\n },\r\n onError(callback: (ctx: UseCaseErrorResult) => void) {\r\n globalEventsCallbacksMap.onError.push(callback);\r\n return {\r\n unsubscribe: () => {\r\n const idx = globalEventsCallbacksMap.onError.indexOf(callback);\r\n if (idx !== -1) globalEventsCallbacksMap.onError.splice(idx, 1);\r\n },\r\n };\r\n },\r\n};\r\n\r\n/**\r\n * Dispatches a lifecycle event to invocation → use-case → global observers, in that order.\r\n *\r\n * Each observer is awaited sequentially and isolated in its own try/catch — a slow\r\n * observer can't stall the others, and a throwing one can't break the pipeline (e.g.\r\n * a successful use case must not fail because a metrics/broadcast observer threw).\r\n */\r\nexport async function fireLifecycleEvent<EventCtx>(\r\n ctx: EventCtx,\r\n observers: {\r\n invocation?: ((ctx: EventCtx) => void | Promise<void>)[];\r\n useCase?: ((ctx: EventCtx) => void | Promise<void>)[];\r\n global?: ((ctx: EventCtx) => void | Promise<void>)[];\r\n },\r\n) {\r\n const tiers = [observers.invocation, observers.useCase, observers.global];\r\n\r\n for (const tier of tiers) {\r\n if (!tier) {\r\n continue;\r\n }\r\n\r\n for (const observer of tier) {\r\n try {\r\n await observer(ctx);\r\n } catch (observerError) {\r\n log.error(\"use-cases\", \"lifecycle\", \"observer failed\", { error: observerError });\r\n }\r\n }\r\n }\r\n}\r\n"],"mappings":";;;;;;AAWA,MAAa,2BAAsD;CACjE,aAAa,CAAC;CACd,aAAa,CAAC;CACd,SAAS,CAAC;AACZ;;;;;;;;AASA,MAAa,uBAAuB;CAClC,YAAY,UAAoD;EAC9D,yBAAyB,YAAY,KAAK,QAAQ;EAClD,OAAO,EACL,mBAAmB;GACjB,MAAM,MAAM,yBAAyB,YAAY,QAAQ,QAAQ;GACjE,IAAI,QAAQ,IAAI,yBAAyB,YAAY,OAAO,KAAK,CAAC;EACpE,EACF;CACF;CACA,YAAoB,UAAmD;EACrE,yBAAyB,YAAY,KAAK,QAAQ;EAClD,OAAO,EACL,mBAAmB;GACjB,MAAM,MAAM,yBAAyB,YAAY,QAAQ,QAAQ;GACjE,IAAI,QAAQ,IAAI,yBAAyB,YAAY,OAAO,KAAK,CAAC;EACpE,EACF;CACF;CACA,QAAQ,UAA6C;EACnD,yBAAyB,QAAQ,KAAK,QAAQ;EAC9C,OAAO,EACL,mBAAmB;GACjB,MAAM,MAAM,yBAAyB,QAAQ,QAAQ,QAAQ;GAC7D,IAAI,QAAQ,IAAI,yBAAyB,QAAQ,OAAO,KAAK,CAAC;EAChE,EACF;CACF;AACF;;;;;;;;AASA,eAAsB,mBACpB,KACA,WAKA;CACA,MAAM,QAAQ;EAAC,UAAU;EAAY,UAAU;EAAS,UAAU;CAAM;CAExE,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,CAAC,MACH;EAGF,KAAK,MAAM,YAAY,MACrB,IAAI;GACF,MAAM,SAAS,GAAG;EACpB,SAAS,eAAe;GACtB,IAAI,MAAM,aAAa,aAAa,mBAAmB,EAAE,OAAO,cAAc,CAAC;EACjF;CAEJ;AACF"}
@@ -1,7 +1,7 @@
1
1
  import { UseCaseBeforeMiddleware, UseCaseContext, UseCaseGuard, UseCaseOnExecutingContext } from "./types.mjs";
2
2
  import { ObjectValidator } from "@warlock.js/seal";
3
3
 
4
- //#region core/src/use-cases/use-case-pipeline.d.ts
4
+ //#region ../core/src/use-cases/use-case-pipeline.d.ts
5
5
  type PipelineOptions<Input> = {
6
6
  name: string;
7
7
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"use-case-pipeline.d.mts","names":[],"sources":["C:/Work/Warlock.js/core/src/use-cases/use-case-pipeline.ts"],"mappings":";;;;KAWY,eAAA;EACV,IAAA;EACA,EAAA;EACA,IAAA,EAAM,KAAA;EACN,GAAA,EAAK,cAAA;EACL,SAAA,EAAW,IAAA;EACX,MAAA,GAAS,eAAA;EACT,MAAA,GAAS,YAAA,CAAa,KAAA;EACtB,MAAA,GAAS,uBAAA,CAAwB,KAAA,KADX;EAGtB,WAAA,IAAe,GAAA,EAAK,yBAAA,WAFa;EAIjC,aAAA,IAAiB,GAAA,EAAK,yBAAA;AAAA;;;;;;;;;;;;;;iBAgBF,WAAA,OAAA,CAAmB,IAAA,EAAM,eAAA,CAAgB,KAAA,IAAS,OAAA,CAAQ,KAAA"}
1
+ {"version":3,"file":"use-case-pipeline.d.mts","names":[],"sources":["../../../../../../../core/src/use-cases/use-case-pipeline.ts"],"mappings":";;;;KAWY,eAAA;EACV,IAAA;EACA,EAAA;EACA,IAAA,EAAM,KAAA;EACN,GAAA,EAAK,cAAA;EACL,SAAA,EAAW,IAAA;EACX,MAAA,GAAS,eAAA;EACT,MAAA,GAAS,YAAA,CAAa,KAAA;EACtB,MAAA,GAAS,uBAAA,CAAwB,KAAA,KADX;EAGtB,WAAA,IAAe,GAAA,EAAK,yBAAA,WAFa;EAIjC,aAAA,IAAiB,GAAA,EAAK,yBAAA;AAAA;;;;;;;;;;;;;;iBAgBF,WAAA,OAAA,CAAmB,IAAA,EAAM,eAAA,CAAgB,KAAA,IAAS,OAAA,CAAQ,KAAA"}
@@ -2,7 +2,7 @@ import { fireLifecycleEvent, globalEventsCallbacksMap } from "./use-case-events.
2
2
  import { BadSchemaUseCaseError } from "./use-case.errors.mjs";
3
3
  import { v } from "@warlock.js/seal";
4
4
 
5
- //#region core/src/use-cases/use-case-pipeline.ts
5
+ //#region ../core/src/use-cases/use-case-pipeline.ts
6
6
  /**
7
7
  * Runs the pre-handler pipeline in order:
8
8
  * onExecuting event → guards → validation → before middleware.
@@ -1 +1 @@
1
- {"version":3,"file":"use-case-pipeline.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/use-cases/use-case-pipeline.ts"],"sourcesContent":["import type { ObjectValidator } from \"@warlock.js/seal\";\nimport { v } from \"@warlock.js/seal\";\nimport type {\n UseCaseBeforeMiddleware,\n UseCaseContext,\n UseCaseGuard,\n UseCaseOnExecutingContext,\n} from \"./types\";\nimport { fireLifecycleEvent, globalEventsCallbacksMap } from \"./use-case-events\";\nimport { BadSchemaUseCaseError } from \"./use-case.errors\";\n\nexport type PipelineOptions<Input> = {\n name: string;\n id: string;\n data: Input;\n ctx: UseCaseContext;\n startedAt: Date;\n schema?: ObjectValidator;\n guards?: UseCaseGuard<Input>[];\n before?: UseCaseBeforeMiddleware<Input>[];\n /** Invocation-level onExecuting override */\n onExecuting?: (ctx: UseCaseOnExecutingContext) => void;\n /** Use-case-level onExecuting */\n ucOnExecuting?: (ctx: UseCaseOnExecutingContext) => void;\n};\n\n/**\n * Runs the pre-handler pipeline in order:\n * onExecuting event → guards → validation → before middleware.\n *\n * Returns the validated, transformed data ready for the handler. The handler is\n * invoked by the caller so retry/benchmark can wrap it in isolation — keeping\n * guards, validation, and onExecuting from re-running on each retry attempt.\n *\n * Throws on guard failure or validation failure.\n *\n * @example\n * const data = await runPipeline({ name, id, data, ctx, startedAt, schema, guards, before });\n */\nexport async function runPipeline<Input>(opts: PipelineOptions<Input>): Promise<Input> {\n const { name, id, ctx, startedAt, schema, guards, before, onExecuting, ucOnExecuting } = opts;\n let data = opts.data;\n\n await fireLifecycleEvent<UseCaseOnExecutingContext>(\n { name, id, data, schema, ctx, startedAt },\n {\n invocation: onExecuting ? [onExecuting] : undefined,\n useCase: ucOnExecuting ? [ucOnExecuting] : undefined,\n global: globalEventsCallbacksMap.onExecuting.length\n ? globalEventsCallbacksMap.onExecuting\n : undefined,\n },\n );\n\n if (guards) {\n // Guards get a frozen SHALLOW CLONE so a guard can't mutate the input, while\n // the original `data` (and the reference that reaches before-middleware and the\n // handler) stays writable. Freezing `data` in place would leak the frozen ref\n // downstream and make a handler mutating its input throw under strict mode.\n // The guard contract is read-only by design; the clone is shallow (deep-freeze\n // is optional and intentionally not done here).\n const frozenData = Object.freeze(\n Array.isArray(data) ? [...data] : { ...(data as object) },\n ) as Readonly<Input>;\n\n for (const guard of guards) {\n await guard(frozenData, ctx);\n }\n }\n\n if (schema) {\n const result = await v.validate(schema, data);\n\n if (!result.isValid) {\n throw new BadSchemaUseCaseError(result);\n }\n\n data = result.data;\n }\n\n let transformed = data;\n\n if (before) {\n for (const middleware of before) {\n transformed = await middleware(transformed, ctx);\n }\n }\n\n return transformed;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,eAAsB,YAAmB,MAA8C;CACrF,MAAM,EAAE,MAAM,IAAI,KAAK,WAAW,QAAQ,QAAQ,QAAQ,aAAa,kBAAkB;CACzF,IAAI,OAAO,KAAK;CAEhB,MAAM,mBACJ;EAAE;EAAM;EAAI;EAAM;EAAQ;EAAK;CAAU,GACzC;EACE,YAAY,cAAc,CAAC,WAAW,IAAI;EAC1C,SAAS,gBAAgB,CAAC,aAAa,IAAI;EAC3C,QAAQ,yBAAyB,YAAY,SACzC,yBAAyB,cACzB;CACN,CACF;CAEA,IAAI,QAAQ;EAOV,MAAM,aAAa,OAAO,OACxB,MAAM,QAAQ,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,EAAE,GAAI,KAAgB,CAC1D;EAEA,KAAK,MAAM,SAAS,QAClB,MAAM,MAAM,YAAY,GAAG;CAE/B;CAEA,IAAI,QAAQ;EACV,MAAM,SAAS,MAAM,EAAE,SAAS,QAAQ,IAAI;EAE5C,IAAI,CAAC,OAAO,SACV,MAAM,IAAI,sBAAsB,MAAM;EAGxC,OAAO,OAAO;CAChB;CAEA,IAAI,cAAc;CAElB,IAAI,QACF,KAAK,MAAM,cAAc,QACvB,cAAc,MAAM,WAAW,aAAa,GAAG;CAInD,OAAO;AACT"}
1
+ {"version":3,"file":"use-case-pipeline.mjs","names":[],"sources":["../../../../../../../core/src/use-cases/use-case-pipeline.ts"],"sourcesContent":["import type { ObjectValidator } from \"@warlock.js/seal\";\nimport { v } from \"@warlock.js/seal\";\nimport type {\n UseCaseBeforeMiddleware,\n UseCaseContext,\n UseCaseGuard,\n UseCaseOnExecutingContext,\n} from \"./types\";\nimport { fireLifecycleEvent, globalEventsCallbacksMap } from \"./use-case-events\";\nimport { BadSchemaUseCaseError } from \"./use-case.errors\";\n\nexport type PipelineOptions<Input> = {\n name: string;\n id: string;\n data: Input;\n ctx: UseCaseContext;\n startedAt: Date;\n schema?: ObjectValidator;\n guards?: UseCaseGuard<Input>[];\n before?: UseCaseBeforeMiddleware<Input>[];\n /** Invocation-level onExecuting override */\n onExecuting?: (ctx: UseCaseOnExecutingContext) => void;\n /** Use-case-level onExecuting */\n ucOnExecuting?: (ctx: UseCaseOnExecutingContext) => void;\n};\n\n/**\n * Runs the pre-handler pipeline in order:\n * onExecuting event → guards → validation → before middleware.\n *\n * Returns the validated, transformed data ready for the handler. The handler is\n * invoked by the caller so retry/benchmark can wrap it in isolation — keeping\n * guards, validation, and onExecuting from re-running on each retry attempt.\n *\n * Throws on guard failure or validation failure.\n *\n * @example\n * const data = await runPipeline({ name, id, data, ctx, startedAt, schema, guards, before });\n */\nexport async function runPipeline<Input>(opts: PipelineOptions<Input>): Promise<Input> {\n const { name, id, ctx, startedAt, schema, guards, before, onExecuting, ucOnExecuting } = opts;\n let data = opts.data;\n\n await fireLifecycleEvent<UseCaseOnExecutingContext>(\n { name, id, data, schema, ctx, startedAt },\n {\n invocation: onExecuting ? [onExecuting] : undefined,\n useCase: ucOnExecuting ? [ucOnExecuting] : undefined,\n global: globalEventsCallbacksMap.onExecuting.length\n ? globalEventsCallbacksMap.onExecuting\n : undefined,\n },\n );\n\n if (guards) {\n // Guards get a frozen SHALLOW CLONE so a guard can't mutate the input, while\n // the original `data` (and the reference that reaches before-middleware and the\n // handler) stays writable. Freezing `data` in place would leak the frozen ref\n // downstream and make a handler mutating its input throw under strict mode.\n // The guard contract is read-only by design; the clone is shallow (deep-freeze\n // is optional and intentionally not done here).\n const frozenData = Object.freeze(\n Array.isArray(data) ? [...data] : { ...(data as object) },\n ) as Readonly<Input>;\n\n for (const guard of guards) {\n await guard(frozenData, ctx);\n }\n }\n\n if (schema) {\n const result = await v.validate(schema, data);\n\n if (!result.isValid) {\n throw new BadSchemaUseCaseError(result);\n }\n\n data = result.data;\n }\n\n let transformed = data;\n\n if (before) {\n for (const middleware of before) {\n transformed = await middleware(transformed, ctx);\n }\n }\n\n return transformed;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,eAAsB,YAAmB,MAA8C;CACrF,MAAM,EAAE,MAAM,IAAI,KAAK,WAAW,QAAQ,QAAQ,QAAQ,aAAa,kBAAkB;CACzF,IAAI,OAAO,KAAK;CAEhB,MAAM,mBACJ;EAAE;EAAM;EAAI;EAAM;EAAQ;EAAK;CAAU,GACzC;EACE,YAAY,cAAc,CAAC,WAAW,IAAI;EAC1C,SAAS,gBAAgB,CAAC,aAAa,IAAI;EAC3C,QAAQ,yBAAyB,YAAY,SACzC,yBAAyB,cACzB;CACN,CACF;CAEA,IAAI,QAAQ;EAOV,MAAM,aAAa,OAAO,OACxB,MAAM,QAAQ,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,EAAE,GAAI,KAAgB,CAC1D;EAEA,KAAK,MAAM,SAAS,QAClB,MAAM,MAAM,YAAY,GAAG;CAE/B;CAEA,IAAI,QAAQ;EACV,MAAM,SAAS,MAAM,EAAE,SAAS,QAAQ,IAAI;EAE5C,IAAI,CAAC,OAAO,SACV,MAAM,IAAI,sBAAsB,MAAM;EAGxC,OAAO,OAAO;CAChB;CAEA,IAAI,cAAc;CAElB,IAAI,QACF,KAAK,MAAM,cAAc,QACvB,cAAc,MAAM,WAAW,aAAa,GAAG;CAInD,OAAO;AACT"}
@@ -1,7 +1,7 @@
1
1
  import { UseCase, UseCaseContext, UseCaseHandler, UseCaseWithSchema } from "./types.mjs";
2
2
  import { Infer, ObjectValidator } from "@warlock.js/seal";
3
3
 
4
- //#region core/src/use-cases/use-case.d.ts
4
+ //#region ../core/src/use-cases/use-case.d.ts
5
5
  /**
6
6
  * Defines and registers a use case.
7
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"use-case.d.mts","names":[],"sources":["C:/Work/Warlock.js/core/src/use-cases/use-case.ts"],"mappings":";;;;;;AAwDA;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,OAAA,wBAEC,eAAA,cACH,cAAA,GAAiB,cAAA,CAAA,CAC7B,OAAA,EAAS,iBAAA,CAAkB,MAAA,EAAQ,MAAA,EAAQ,GAAA,IAAO,cAAA,CAAe,MAAA,EAAQ,KAAA,CAAM,MAAA;AAAA,iBACjE,OAAA,wCAA+C,cAAA,GAAiB,cAAA,CAAA,CAC9E,OAAA,EAAS,OAAA,CAAQ,MAAA,EAAQ,KAAA,EAAO,GAAA,IAC/B,cAAA,CAAe,MAAA,EAAQ,KAAA"}
1
+ {"version":3,"file":"use-case.d.mts","names":[],"sources":["../../../../../../../core/src/use-cases/use-case.ts"],"mappings":";;;;;;AAwDA;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,OAAA,wBAEC,eAAA,cACH,cAAA,GAAiB,cAAA,CAAA,CAC7B,OAAA,EAAS,iBAAA,CAAkB,MAAA,EAAQ,MAAA,EAAQ,GAAA,IAAO,cAAA,CAAe,MAAA,EAAQ,KAAA,CAAM,MAAA;AAAA,iBACjE,OAAA,wCAA+C,cAAA,GAAiB,cAAA,CAAA,CAC9E,OAAA,EAAS,OAAA,CAAQ,MAAA,EAAQ,KAAA,EAAO,GAAA,IAC/B,cAAA,CAAe,MAAA,EAAQ,KAAA"}
@@ -1,7 +1,7 @@
1
1
  import { HttpError } from "../http/errors/errors.mjs";
2
2
  import { ValidationResult } from "@warlock.js/seal";
3
3
 
4
- //#region core/src/use-cases/use-case.errors.d.ts
4
+ //#region ../core/src/use-cases/use-case.errors.d.ts
5
5
  declare class BadSchemaUseCaseError extends HttpError {
6
6
  constructor(result: ValidationResult);
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-case.errors.d.mts","names":[],"sources":["C:/Work/Warlock.js/core/src/use-cases/use-case.errors.ts"],"mappings":";;;;cAGa,qBAAA,SAA8B,SAAS;cAC/B,MAAA,EAAQ,gBAAA;AAAA"}
1
+ {"version":3,"file":"use-case.errors.d.mts","names":[],"sources":["../../../../../../../core/src/use-cases/use-case.errors.ts"],"mappings":";;;;cAGa,qBAAA,SAA8B,SAAS;cAC/B,MAAA,EAAQ,gBAAA;AAAA"}
@@ -1,6 +1,6 @@
1
1
  import { HttpError } from "../http/errors/errors.mjs";
2
2
 
3
- //#region core/src/use-cases/use-case.errors.ts
3
+ //#region ../core/src/use-cases/use-case.errors.ts
4
4
  var BadSchemaUseCaseError = class extends HttpError {
5
5
  constructor(result) {
6
6
  super(400, `Invalid input data`, {
@@ -1 +1 @@
1
- {"version":3,"file":"use-case.errors.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/use-cases/use-case.errors.ts"],"sourcesContent":["import type { ValidationResult } from \"@warlock.js/seal\";\nimport { HttpError } from \"../http/errors/errors\";\n\nexport class BadSchemaUseCaseError extends HttpError {\n public constructor(result: ValidationResult) {\n super(400, `Invalid input data`, {\n code: \"BAD_SCHEMA_USE_CASE\",\n errors: result.errors,\n });\n }\n}\n"],"mappings":";;;AAGA,IAAa,wBAAb,cAA2C,UAAU;CACnD,AAAO,YAAY,QAA0B;EAC3C,MAAM,KAAK,sBAAsB;GAC/B,MAAM;GACN,QAAQ,OAAO;EACjB,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"use-case.errors.mjs","names":[],"sources":["../../../../../../../core/src/use-cases/use-case.errors.ts"],"sourcesContent":["import type { ValidationResult } from \"@warlock.js/seal\";\nimport { HttpError } from \"../http/errors/errors\";\n\nexport class BadSchemaUseCaseError extends HttpError {\n public constructor(result: ValidationResult) {\n super(400, `Invalid input data`, {\n code: \"BAD_SCHEMA_USE_CASE\",\n errors: result.errors,\n });\n }\n}\n"],"mappings":";;;AAGA,IAAa,wBAAb,cAA2C,UAAU;CACnD,AAAO,YAAY,QAA0B;EAC3C,MAAM,KAAK,sBAAsB;GAC/B,MAAM;GACN,QAAQ,OAAO;EACjB,CAAC;CACH;AACF"}
@@ -9,7 +9,7 @@ import { $registerUseCase, $unregisterUseCase, addUseCaseHistory, increaseUseCas
9
9
  import { log } from "@warlock.js/logger";
10
10
  import { Random, except, retry } from "@mongez/reinforcements";
11
11
 
12
- //#region core/src/use-cases/use-case.ts
12
+ //#region ../core/src/use-cases/use-case.ts
13
13
  const defaultUseCaseOptions = { benchmark: true };
14
14
  function useCase(options) {
15
15
  const { name, handler, schema, guards, before, after, onExecuting, onCompleted, onError } = options;
@@ -1 +1 @@
1
- {"version":3,"file":"use-case.mjs","names":["runWithRetry"],"sources":["C:/Work/Warlock.js/core/src/use-cases/use-case.ts"],"sourcesContent":["import { except, Random, retry as runWithRetry } from \"@mongez/reinforcements\";\nimport { log } from \"@warlock.js/logger\";\nimport type { Infer, ObjectValidator } from \"@warlock.js/seal\";\nimport { measure } from \"../benchmark\";\nimport { config } from \"../config\";\nimport type {\n UseCase,\n UseCaseConfigurations,\n UseCaseContext,\n UseCaseErrorResult,\n UseCaseHandler,\n UseCaseResult,\n UseCaseRuntimeOptions,\n UseCaseWithSchema,\n} from \"./types\";\nimport { broadcastUseCaseResult } from \"./use-case-broadcast\";\nimport { fireLifecycleEvent, globalEventsCallbacksMap } from \"./use-case-events\";\nimport { runPipeline } from \"./use-case-pipeline\";\nimport {\n $registerUseCase,\n $unregisterUseCase,\n addUseCaseHistory,\n increaseUseCaseFailedCalls,\n increaseUseCaseSuccessCalls,\n} from \"./use-cases-registry\";\n\nconst defaultUseCaseOptions: UseCaseConfigurations = {\n benchmark: true,\n};\n\n/**\n * Defines and registers a use case.\n *\n * A use case is a named, observable, optionally benchmarked unit of business logic.\n * The returned handler is a typed async function you call with the input data.\n *\n * Execution order: onExecuting → guards → validation → before → handler → after →\n * onCompleted → broadcast. Retry and benchmark wrap the **handler** only.\n *\n * When a `schema` is provided, the handler's input is inferred from it — no manual\n * `Input` generic needed.\n *\n * @example\n * export const createOrderUseCase = useCase({\n * name: \"create_order\",\n * schema: createOrderSchema, // handler `data` is inferred from this\n * guards: [authGuard],\n * handler: async (data, ctx) => orderService.create(data),\n * after: [sendConfirmationEmail],\n * retry: { attempts: 3, delay: 500, backoff: \"exponential\" },\n * broadcast: true,\n * });\n *\n * // In a controller:\n * const output = await createOrderUseCase({ ...validated, user_id: req.user.id });\n */\nexport function useCase<\n Output,\n Schema extends ObjectValidator,\n Ctx extends UseCaseContext = UseCaseContext,\n>(options: UseCaseWithSchema<Output, Schema, Ctx>): UseCaseHandler<Output, Infer<Schema>>;\nexport function useCase<Output = any, Input = any, Ctx extends UseCaseContext = UseCaseContext>(\n options: UseCase<Output, Input, Ctx>,\n): UseCaseHandler<Output, Input>;\nexport function useCase<Output = any, Input = any>(\n options: UseCase<Output, Input>,\n): UseCaseHandler<Output, Input> {\n const { name, handler, schema, guards, before, after, onExecuting, onCompleted, onError } =\n options;\n\n // Merge per-use-case options with global config defaults\n const useCaseConfig = config.get<UseCaseConfigurations>(\"use-cases\", defaultUseCaseOptions);\n const benchmark = options.benchmark ?? useCaseConfig?.benchmark ?? true;\n const retryConfig = options.retry ?? useCaseConfig?.retry;\n const broadcast = options.broadcast;\n const broadcastConfig = useCaseConfig?.broadcast;\n const logEnabled = useCaseConfig?.log === true;\n\n $registerUseCase(name, {\n ...options,\n calls: { success: 0, failed: 0, total: 0 },\n });\n\n const useCaseHandler = async (\n data: Input,\n {\n ctx = {},\n id = `uc-${name}-` + Random.string(),\n onExecuting: invocationOnExecuting,\n onCompleted: invocationOnCompleted,\n onError: invocationOnError,\n }: UseCaseRuntimeOptions = {},\n ): Promise<Output> => {\n ctx.schema = schema;\n ctx.id = id;\n\n const startedAt = new Date();\n let output: Output | undefined;\n let error: Error | undefined;\n let benchmarkResult: { latency: number; state: \"excellent\" | \"good\" | \"poor\" } | undefined;\n // 1-based count of failed attempts (reinforcements' `attempt` arg). Translated\n // into \"retries performed\" at snapshot time — see the `currentRetry` derivation.\n let failedAttempts = 0;\n\n if (logEnabled) {\n log.debug(\"use-cases\", name, \"executing\", { id });\n }\n\n try {\n const transformed = await runPipeline<Input>({\n name,\n id,\n data,\n ctx,\n startedAt,\n schema,\n guards,\n before,\n onExecuting: invocationOnExecuting,\n ucOnExecuting: onExecuting,\n });\n\n // Benchmark wraps ONLY the handler (per attempt) so latency reflects business\n // logic — not the guard/validation prelude, and not the retry backoff delays.\n const runHandler = async (): Promise<Output> => {\n if (!benchmark) {\n return handler(transformed, ctx);\n }\n\n const measured = await measure(\n name,\n () => handler(transformed, ctx),\n benchmark === true ? undefined : benchmark,\n );\n\n benchmarkResult = { latency: measured.latency, state: measured.state };\n\n // measure() never throws — it returns an error result. Re-throw so retry\n // and the outer catch handle failures uniformly.\n if (!measured.success) {\n throw measured.error;\n }\n\n return measured.value;\n };\n\n output = retryConfig\n ? await runWithRetry(runHandler, {\n ...retryConfig,\n onError: (retryError, attempt) => {\n failedAttempts = attempt;\n retryConfig.onError?.(retryError, attempt);\n },\n })\n : await runHandler();\n } catch (err) {\n error = err as Error;\n }\n\n const endedAt = new Date();\n\n // After middleware — fire-and-forget side effects, only on success.\n // Keyed off the error flag alone so void handlers (which return undefined)\n // still run their after middleware.\n if (!error && after) {\n for (const middleware of after) {\n try {\n // On the success path `output` holds the handler's return value; for a\n // void handler that's undefined, which the middleware receives as-is.\n await middleware(output as Output, ctx);\n } catch (afterError) {\n log.error(\"use-cases\", name, \"after middleware failed\", { error: afterError });\n }\n }\n }\n\n // Retries actually performed (0 = succeeded on the first try). On success every\n // failed attempt was followed by a retry; on failure the final failed attempt\n // was NOT retried, so it doesn't count as a retry performed.\n const currentRetry = error ? Math.max(failedAttempts - 1, 0) : failedAttempts;\n\n const snapshot: UseCaseResult<Output> = {\n output,\n ctx,\n startedAt,\n endedAt,\n id,\n name,\n retries: retryConfig\n ? { attempts: retryConfig.attempts ?? 3, delay: retryConfig.delay, currentRetry }\n : undefined,\n benchmarkResult,\n // Set per-branch below so the counter reflects the actual outcome —\n // a failure must never increment the success tally.\n calls: 0,\n };\n\n if (error) {\n snapshot.calls = increaseUseCaseFailedCalls(name);\n\n if (logEnabled) {\n log.error(\"use-cases\", name, \"failed\", { id, error });\n }\n\n await fireLifecycleEvent<UseCaseErrorResult>(\n { ...except(snapshot, [\"output\"]), error },\n {\n invocation: invocationOnError ? [invocationOnError] : undefined,\n useCase: onError ? [onError] : undefined,\n global: globalEventsCallbacksMap.onError.length\n ? globalEventsCallbacksMap.onError\n : undefined,\n },\n );\n\n throw error;\n }\n\n snapshot.calls = increaseUseCaseSuccessCalls(name);\n\n if (logEnabled) {\n log.debug(\"use-cases\", name, \"completed\", { id, latency: benchmarkResult?.latency });\n }\n\n // History is best-effort — a cache rejection must not turn a successful run\n // into a thrown error or skip onCompleted/broadcast.\n try {\n await addUseCaseHistory(name, snapshot);\n } catch (historyError) {\n log.error(\"use-cases\", name, \"history persistence failed\", { id, error: historyError });\n }\n\n await fireLifecycleEvent<UseCaseResult<Output>>(snapshot, {\n invocation: invocationOnCompleted ? [invocationOnCompleted] : undefined,\n useCase: onCompleted ? [onCompleted] : undefined,\n global: globalEventsCallbacksMap.onCompleted.length\n ? globalEventsCallbacksMap.onCompleted\n : undefined,\n });\n\n await broadcastUseCaseResult({\n name,\n id,\n // A void handler resolves to undefined — broadcast it as-is rather than\n // asserting a non-null value that would fabricate a bogus payload.\n output: output as Output,\n result: snapshot,\n broadcast,\n config: broadcastConfig,\n });\n\n return output as Output;\n };\n\n useCaseHandler.$cleanup = () => {\n $unregisterUseCase(name);\n };\n\n return useCaseHandler;\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAM,wBAA+C,EACnD,WAAW,KACb;AAoCA,SAAgB,QACd,SAC+B;CAC/B,MAAM,EAAE,MAAM,SAAS,QAAQ,QAAQ,QAAQ,OAAO,aAAa,aAAa,YAC9E;CAGF,MAAM,gBAAgB,OAAO,IAA2B,aAAa,qBAAqB;CAC1F,MAAM,YAAY,QAAQ,aAAa,eAAe,aAAa;CACnE,MAAM,cAAc,QAAQ,SAAS,eAAe;CACpD,MAAM,YAAY,QAAQ;CAC1B,MAAM,kBAAkB,eAAe;CACvC,MAAM,aAAa,eAAe,QAAQ;CAE1C,iBAAiB,MAAM;EACrB,GAAG;EACH,OAAO;GAAE,SAAS;GAAG,QAAQ;GAAG,OAAO;EAAE;CAC3C,CAAC;CAED,MAAM,iBAAiB,OACrB,MACA,EACE,MAAM,CAAC,GACP,KAAK,MAAM,KAAK,KAAK,OAAO,OAAO,GACnC,aAAa,uBACb,aAAa,uBACb,SAAS,sBACgB,CAAC,MACR;EACpB,IAAI,SAAS;EACb,IAAI,KAAK;EAET,MAAM,4BAAY,IAAI,KAAK;EAC3B,IAAI;EACJ,IAAI;EACJ,IAAI;EAGJ,IAAI,iBAAiB;EAErB,IAAI,YACF,IAAI,MAAM,aAAa,MAAM,aAAa,EAAE,GAAG,CAAC;EAGlD,IAAI;GACF,MAAM,cAAc,MAAM,YAAmB;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,aAAa;IACb,eAAe;GACjB,CAAC;GAID,MAAM,aAAa,YAA6B;IAC9C,IAAI,CAAC,WACH,OAAO,QAAQ,aAAa,GAAG;IAGjC,MAAM,WAAW,MAAM,QACrB,YACM,QAAQ,aAAa,GAAG,GAC9B,cAAc,OAAO,SAAY,SACnC;IAEA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MAAM,kBAAkB,MAAM,QAAQ;EACxC,SAAS,cAAc;GACrB,IAAI,MAAM,aAAa,MAAM,8BAA8B;IAAE;IAAI,OAAO;GAAa,CAAC;EACxF;EAEA,MAAM,mBAA0C,UAAU;GACxD,YAAY,wBAAwB,CAAC,qBAAqB,IAAI;GAC9D,SAAS,cAAc,CAAC,WAAW,IAAI;GACvC,QAAQ,yBAAyB,YAAY,SACzC,yBAAyB,cACzB;EACN,CAAC;EAED,MAAM,uBAAuB;GAC3B;GACA;GAGQ;GACR,QAAQ;GACR;GACA,QAAQ;EACV,CAAC;EAED,OAAO;CACT;CAEA,eAAe,iBAAiB;EAC9B,mBAAmB,IAAI;CACzB;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"use-case.mjs","names":["runWithRetry"],"sources":["../../../../../../../core/src/use-cases/use-case.ts"],"sourcesContent":["import { except, Random, retry as runWithRetry } from \"@mongez/reinforcements\";\nimport { log } from \"@warlock.js/logger\";\nimport type { Infer, ObjectValidator } from \"@warlock.js/seal\";\nimport { measure } from \"../benchmark\";\nimport { config } from \"../config\";\nimport type {\n UseCase,\n UseCaseConfigurations,\n UseCaseContext,\n UseCaseErrorResult,\n UseCaseHandler,\n UseCaseResult,\n UseCaseRuntimeOptions,\n UseCaseWithSchema,\n} from \"./types\";\nimport { broadcastUseCaseResult } from \"./use-case-broadcast\";\nimport { fireLifecycleEvent, globalEventsCallbacksMap } from \"./use-case-events\";\nimport { runPipeline } from \"./use-case-pipeline\";\nimport {\n $registerUseCase,\n $unregisterUseCase,\n addUseCaseHistory,\n increaseUseCaseFailedCalls,\n increaseUseCaseSuccessCalls,\n} from \"./use-cases-registry\";\n\nconst defaultUseCaseOptions: UseCaseConfigurations = {\n benchmark: true,\n};\n\n/**\n * Defines and registers a use case.\n *\n * A use case is a named, observable, optionally benchmarked unit of business logic.\n * The returned handler is a typed async function you call with the input data.\n *\n * Execution order: onExecuting → guards → validation → before → handler → after →\n * onCompleted → broadcast. Retry and benchmark wrap the **handler** only.\n *\n * When a `schema` is provided, the handler's input is inferred from it — no manual\n * `Input` generic needed.\n *\n * @example\n * export const createOrderUseCase = useCase({\n * name: \"create_order\",\n * schema: createOrderSchema, // handler `data` is inferred from this\n * guards: [authGuard],\n * handler: async (data, ctx) => orderService.create(data),\n * after: [sendConfirmationEmail],\n * retry: { attempts: 3, delay: 500, backoff: \"exponential\" },\n * broadcast: true,\n * });\n *\n * // In a controller:\n * const output = await createOrderUseCase({ ...validated, user_id: req.user.id });\n */\nexport function useCase<\n Output,\n Schema extends ObjectValidator,\n Ctx extends UseCaseContext = UseCaseContext,\n>(options: UseCaseWithSchema<Output, Schema, Ctx>): UseCaseHandler<Output, Infer<Schema>>;\nexport function useCase<Output = any, Input = any, Ctx extends UseCaseContext = UseCaseContext>(\n options: UseCase<Output, Input, Ctx>,\n): UseCaseHandler<Output, Input>;\nexport function useCase<Output = any, Input = any>(\n options: UseCase<Output, Input>,\n): UseCaseHandler<Output, Input> {\n const { name, handler, schema, guards, before, after, onExecuting, onCompleted, onError } =\n options;\n\n // Merge per-use-case options with global config defaults\n const useCaseConfig = config.get<UseCaseConfigurations>(\"use-cases\", defaultUseCaseOptions);\n const benchmark = options.benchmark ?? useCaseConfig?.benchmark ?? true;\n const retryConfig = options.retry ?? useCaseConfig?.retry;\n const broadcast = options.broadcast;\n const broadcastConfig = useCaseConfig?.broadcast;\n const logEnabled = useCaseConfig?.log === true;\n\n $registerUseCase(name, {\n ...options,\n calls: { success: 0, failed: 0, total: 0 },\n });\n\n const useCaseHandler = async (\n data: Input,\n {\n ctx = {},\n id = `uc-${name}-` + Random.string(),\n onExecuting: invocationOnExecuting,\n onCompleted: invocationOnCompleted,\n onError: invocationOnError,\n }: UseCaseRuntimeOptions = {},\n ): Promise<Output> => {\n ctx.schema = schema;\n ctx.id = id;\n\n const startedAt = new Date();\n let output: Output | undefined;\n let error: Error | undefined;\n let benchmarkResult: { latency: number; state: \"excellent\" | \"good\" | \"poor\" } | undefined;\n // 1-based count of failed attempts (reinforcements' `attempt` arg). Translated\n // into \"retries performed\" at snapshot time — see the `currentRetry` derivation.\n let failedAttempts = 0;\n\n if (logEnabled) {\n log.debug(\"use-cases\", name, \"executing\", { id });\n }\n\n try {\n const transformed = await runPipeline<Input>({\n name,\n id,\n data,\n ctx,\n startedAt,\n schema,\n guards,\n before,\n onExecuting: invocationOnExecuting,\n ucOnExecuting: onExecuting,\n });\n\n // Benchmark wraps ONLY the handler (per attempt) so latency reflects business\n // logic — not the guard/validation prelude, and not the retry backoff delays.\n const runHandler = async (): Promise<Output> => {\n if (!benchmark) {\n return handler(transformed, ctx);\n }\n\n const measured = await measure(\n name,\n () => handler(transformed, ctx),\n benchmark === true ? undefined : benchmark,\n );\n\n benchmarkResult = { latency: measured.latency, state: measured.state };\n\n // measure() never throws — it returns an error result. Re-throw so retry\n // and the outer catch handle failures uniformly.\n if (!measured.success) {\n throw measured.error;\n }\n\n return measured.value;\n };\n\n output = retryConfig\n ? await runWithRetry(runHandler, {\n ...retryConfig,\n onError: (retryError, attempt) => {\n failedAttempts = attempt;\n retryConfig.onError?.(retryError, attempt);\n },\n })\n : await runHandler();\n } catch (err) {\n error = err as Error;\n }\n\n const endedAt = new Date();\n\n // After middleware — fire-and-forget side effects, only on success.\n // Keyed off the error flag alone so void handlers (which return undefined)\n // still run their after middleware.\n if (!error && after) {\n for (const middleware of after) {\n try {\n // On the success path `output` holds the handler's return value; for a\n // void handler that's undefined, which the middleware receives as-is.\n await middleware(output as Output, ctx);\n } catch (afterError) {\n log.error(\"use-cases\", name, \"after middleware failed\", { error: afterError });\n }\n }\n }\n\n // Retries actually performed (0 = succeeded on the first try). On success every\n // failed attempt was followed by a retry; on failure the final failed attempt\n // was NOT retried, so it doesn't count as a retry performed.\n const currentRetry = error ? Math.max(failedAttempts - 1, 0) : failedAttempts;\n\n const snapshot: UseCaseResult<Output> = {\n output,\n ctx,\n startedAt,\n endedAt,\n id,\n name,\n retries: retryConfig\n ? { attempts: retryConfig.attempts ?? 3, delay: retryConfig.delay, currentRetry }\n : undefined,\n benchmarkResult,\n // Set per-branch below so the counter reflects the actual outcome —\n // a failure must never increment the success tally.\n calls: 0,\n };\n\n if (error) {\n snapshot.calls = increaseUseCaseFailedCalls(name);\n\n if (logEnabled) {\n log.error(\"use-cases\", name, \"failed\", { id, error });\n }\n\n await fireLifecycleEvent<UseCaseErrorResult>(\n { ...except(snapshot, [\"output\"]), error },\n {\n invocation: invocationOnError ? [invocationOnError] : undefined,\n useCase: onError ? [onError] : undefined,\n global: globalEventsCallbacksMap.onError.length\n ? globalEventsCallbacksMap.onError\n : undefined,\n },\n );\n\n throw error;\n }\n\n snapshot.calls = increaseUseCaseSuccessCalls(name);\n\n if (logEnabled) {\n log.debug(\"use-cases\", name, \"completed\", { id, latency: benchmarkResult?.latency });\n }\n\n // History is best-effort — a cache rejection must not turn a successful run\n // into a thrown error or skip onCompleted/broadcast.\n try {\n await addUseCaseHistory(name, snapshot);\n } catch (historyError) {\n log.error(\"use-cases\", name, \"history persistence failed\", { id, error: historyError });\n }\n\n await fireLifecycleEvent<UseCaseResult<Output>>(snapshot, {\n invocation: invocationOnCompleted ? [invocationOnCompleted] : undefined,\n useCase: onCompleted ? [onCompleted] : undefined,\n global: globalEventsCallbacksMap.onCompleted.length\n ? globalEventsCallbacksMap.onCompleted\n : undefined,\n });\n\n await broadcastUseCaseResult({\n name,\n id,\n // A void handler resolves to undefined — broadcast it as-is rather than\n // asserting a non-null value that would fabricate a bogus payload.\n output: output as Output,\n result: snapshot,\n broadcast,\n config: broadcastConfig,\n });\n\n return output as Output;\n };\n\n useCaseHandler.$cleanup = () => {\n $unregisterUseCase(name);\n };\n\n return useCaseHandler;\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAM,wBAA+C,EACnD,WAAW,KACb;AAoCA,SAAgB,QACd,SAC+B;CAC/B,MAAM,EAAE,MAAM,SAAS,QAAQ,QAAQ,QAAQ,OAAO,aAAa,aAAa,YAC9E;CAGF,MAAM,gBA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Q;GACR,QAAQ;GACR;GACA,QAAQ;EACV,CAAC;EAED,OAAO;CACT;CAEA,eAAe,iBAAiB;EAC9B,mBAAmB,IAAI;CACzB;CAEA,OAAO;AACT"}
@@ -1,6 +1,6 @@
1
1
  import { RegisteredUseCase, UseCaseResult } from "./types.mjs";
2
2
 
3
- //#region core/src/use-cases/use-cases-registry.d.ts
3
+ //#region ../core/src/use-cases/use-cases-registry.d.ts
4
4
  /**
5
5
  * Register a use case
6
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"use-cases-registry.d.mts","names":[],"sources":["C:/Work/Warlock.js/core/src/use-cases/use-cases-registry.ts"],"mappings":";;;;;AAaA;iBAAgB,gBAAA,eAAA,CACd,IAAA,UACA,OAAA,EAAS,iBAAA,CAAkB,MAAA,EAAQ,KAAA;;;;;;;;iBAoBrB,kBAAA,CAAmB,IAAY;;;;;;;AApBJ;iBAmC3B,UAAA,eAAA,CAA0B,IAAA,WACJ,iBAAA,CAAkB,MAAA,EAAQ,KAAA;;;;iBAMhD,WAAA,CAAA,GAAW,GAAA,SAAA,iBAAA;AAP3B;;;AAAA,iBAcgB,2BAAA,CAA4B,IAAY;;;;iBAexC,0BAAA,CAA2B,IAAY;;;;;;iBA2BjC,iBAAA,CAAkB,IAAA,WAAe,OAAO,CAAC,aAAA;;AAvDM;AAMrE;;iBA+EsB,iBAAA,CAAkB,IAAA,UAAc,MAAA,EAAQ,aAAA,QAAkB,OAAA"}
1
+ {"version":3,"file":"use-cases-registry.d.mts","names":[],"sources":["../../../../../../../core/src/use-cases/use-cases-registry.ts"],"mappings":";;;;;AAaA;iBAAgB,gBAAA,eAAA,CACd,IAAA,UACA,OAAA,EAAS,iBAAA,CAAkB,MAAA,EAAQ,KAAA;;;;;;;;iBAoBrB,kBAAA,CAAmB,IAAY;;;;;;;AApBJ;iBAmC3B,UAAA,eAAA,CAA0B,IAAA,WACJ,iBAAA,CAAkB,MAAA,EAAQ,KAAA;;;;iBAMhD,WAAA,CAAA,GAAW,GAAA,SAAA,iBAAA;AAP3B;;;AAAA,iBAcgB,2BAAA,CAA4B,IAAY;;;;iBAexC,0BAAA,CAA2B,IAAY;;;;;;iBA2BjC,iBAAA,CAAkB,IAAA,WAAe,OAAO,CAAC,aAAA;;AAvDM;AAMrE;;iBA+EsB,iBAAA,CAAkB,IAAA,UAAc,MAAA,EAAQ,aAAA,QAAkB,OAAA"}
@@ -3,7 +3,7 @@ import "../config/index.mjs";
3
3
  import { log } from "@warlock.js/logger";
4
4
  import { cache } from "@warlock.js/cache";
5
5
 
6
- //#region core/src/use-cases/use-cases-registry.ts
6
+ //#region ../core/src/use-cases/use-cases-registry.ts
7
7
  /**
8
8
  * Store registered use cases
9
9
  */