@noego/wood 0.4.9 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/README.md +118 -42
  2. package/bin/axe.js +313 -98
  3. package/dist/{loader/__fixtures__/layouts/app.load.cjs → automation/actions.cjs} +3 -13
  4. package/dist/automation/actions.cjs.map +1 -0
  5. package/dist/automation/actions.d.cts +57 -0
  6. package/dist/automation/actions.d.ts +57 -0
  7. package/dist/automation/actions.js +1 -0
  8. package/dist/automation/actions.js.map +1 -0
  9. package/dist/automation/actions_executor.cjs +101 -0
  10. package/dist/automation/actions_executor.cjs.map +1 -0
  11. package/dist/automation/actions_executor.d.cts +16 -0
  12. package/dist/automation/actions_executor.d.ts +16 -0
  13. package/dist/automation/actions_executor.js +76 -0
  14. package/dist/automation/actions_executor.js.map +1 -0
  15. package/dist/automation/connection.cjs +86 -0
  16. package/dist/automation/connection.cjs.map +1 -0
  17. package/dist/automation/connection.d.cts +18 -0
  18. package/dist/automation/connection.d.ts +18 -0
  19. package/dist/automation/connection.js +51 -0
  20. package/dist/automation/connection.js.map +1 -0
  21. package/dist/{middleware/__fixtures__/middleware/sequence.cjs → automation/errors.cjs} +25 -22
  22. package/dist/automation/errors.cjs.map +1 -0
  23. package/dist/automation/errors.d.cts +31 -0
  24. package/dist/automation/errors.d.ts +31 -0
  25. package/dist/automation/errors.js +24 -0
  26. package/dist/automation/errors.js.map +1 -0
  27. package/dist/automation/index.cjs +49 -0
  28. package/dist/automation/index.cjs.map +1 -0
  29. package/dist/automation/index.d.cts +16 -0
  30. package/dist/automation/index.d.ts +16 -0
  31. package/dist/automation/index.js +15 -0
  32. package/dist/automation/index.js.map +1 -0
  33. package/dist/automation/introspection_reader.cjs +75 -0
  34. package/dist/automation/introspection_reader.cjs.map +1 -0
  35. package/dist/automation/introspection_reader.d.cts +20 -0
  36. package/dist/automation/introspection_reader.d.ts +20 -0
  37. package/dist/automation/introspection_reader.js +48 -0
  38. package/dist/automation/introspection_reader.js.map +1 -0
  39. package/dist/automation/locator.cjs +102 -0
  40. package/dist/automation/locator.cjs.map +1 -0
  41. package/dist/automation/locator.d.cts +51 -0
  42. package/dist/automation/locator.d.ts +51 -0
  43. package/dist/automation/locator.js +75 -0
  44. package/dist/automation/locator.js.map +1 -0
  45. package/dist/{loader/__fixtures__/views/test/page.load.cjs → automation/observation.cjs} +3 -13
  46. package/dist/automation/observation.cjs.map +1 -0
  47. package/dist/automation/observation.d.cts +44 -0
  48. package/dist/automation/observation.d.ts +44 -0
  49. package/dist/automation/observation.js +1 -0
  50. package/dist/automation/observation.js.map +1 -0
  51. package/dist/{controller/__fixtures__/controllers/test.cjs → automation/receipts.cjs} +3 -15
  52. package/dist/automation/receipts.cjs.map +1 -0
  53. package/dist/automation/receipts.d.cts +27 -0
  54. package/dist/automation/receipts.d.ts +27 -0
  55. package/dist/automation/receipts.js +1 -0
  56. package/dist/automation/receipts.js.map +1 -0
  57. package/dist/automation/scenario.cjs +696 -0
  58. package/dist/automation/scenario.cjs.map +1 -0
  59. package/dist/automation/scenario.d.cts +89 -0
  60. package/dist/automation/scenario.d.ts +89 -0
  61. package/dist/automation/scenario.js +660 -0
  62. package/dist/automation/scenario.js.map +1 -0
  63. package/dist/automation/scrolling.cjs +17 -0
  64. package/dist/automation/scrolling.cjs.map +1 -0
  65. package/dist/automation/scrolling.d.cts +51 -0
  66. package/dist/automation/scrolling.d.ts +51 -0
  67. package/dist/automation/scrolling.js +1 -0
  68. package/dist/automation/scrolling.js.map +1 -0
  69. package/dist/automation/scrolling_executor.cjs +109 -0
  70. package/dist/automation/scrolling_executor.cjs.map +1 -0
  71. package/dist/automation/scrolling_executor.d.cts +13 -0
  72. package/dist/automation/scrolling_executor.d.ts +13 -0
  73. package/dist/automation/scrolling_executor.js +84 -0
  74. package/dist/automation/scrolling_executor.js.map +1 -0
  75. package/dist/automation/target_identity.cjs +17 -0
  76. package/dist/automation/target_identity.cjs.map +1 -0
  77. package/dist/automation/target_identity.d.cts +28 -0
  78. package/dist/automation/target_identity.d.ts +28 -0
  79. package/dist/automation/target_identity.js +1 -0
  80. package/dist/automation/target_identity.js.map +1 -0
  81. package/dist/automation/target_registry.cjs +148 -0
  82. package/dist/automation/target_registry.cjs.map +1 -0
  83. package/dist/automation/target_registry.d.cts +32 -0
  84. package/dist/automation/target_registry.d.ts +32 -0
  85. package/dist/automation/target_registry.js +122 -0
  86. package/dist/automation/target_registry.js.map +1 -0
  87. package/dist/automation/waits.cjs +17 -0
  88. package/dist/automation/waits.cjs.map +1 -0
  89. package/dist/automation/waits.d.cts +44 -0
  90. package/dist/automation/waits.d.ts +44 -0
  91. package/dist/automation/waits.js +1 -0
  92. package/dist/automation/waits.js.map +1 -0
  93. package/dist/automation/waits_executor.cjs +104 -0
  94. package/dist/automation/waits_executor.cjs.map +1 -0
  95. package/dist/automation/waits_executor.d.cts +14 -0
  96. package/dist/automation/waits_executor.d.ts +14 -0
  97. package/dist/automation/waits_executor.js +79 -0
  98. package/dist/automation/waits_executor.js.map +1 -0
  99. package/dist/bridge/backend_bridge.cjs.map +1 -1
  100. package/dist/bridge/backend_bridge.js.map +1 -1
  101. package/dist/client/index.cjs +78 -21
  102. package/dist/client/index.cjs.map +1 -1
  103. package/dist/client/index.d.cts +19 -3
  104. package/dist/client/index.d.ts +19 -3
  105. package/dist/client/index.js +80 -22
  106. package/dist/client/index.js.map +1 -1
  107. package/dist/client/renderer_log_transport.cjs +151 -0
  108. package/dist/client/renderer_log_transport.cjs.map +1 -0
  109. package/dist/client/renderer_log_transport.d.cts +54 -0
  110. package/dist/client/renderer_log_transport.d.ts +54 -0
  111. package/dist/client/renderer_log_transport.js +123 -0
  112. package/dist/client/renderer_log_transport.js.map +1 -0
  113. package/dist/codegen/controller_registration_generator.cjs +13 -2
  114. package/dist/codegen/controller_registration_generator.cjs.map +1 -1
  115. package/dist/codegen/controller_registration_generator.d.cts +12 -1
  116. package/dist/codegen/controller_registration_generator.d.ts +12 -1
  117. package/dist/codegen/controller_registration_generator.js +10 -1
  118. package/dist/codegen/controller_registration_generator.js.map +1 -1
  119. package/dist/codegen/index.d.cts +1 -0
  120. package/dist/codegen/index.d.ts +1 -0
  121. package/dist/codegen/preload_generator.cjs +13 -6
  122. package/dist/codegen/preload_generator.cjs.map +1 -1
  123. package/dist/codegen/preload_generator.d.cts +11 -2
  124. package/dist/codegen/preload_generator.d.ts +11 -2
  125. package/dist/codegen/preload_generator.js +13 -6
  126. package/dist/codegen/preload_generator.js.map +1 -1
  127. package/dist/codegen/renderer_app_generator.cjs +95 -44
  128. package/dist/codegen/renderer_app_generator.cjs.map +1 -1
  129. package/dist/codegen/renderer_app_generator.js +95 -44
  130. package/dist/codegen/renderer_app_generator.js.map +1 -1
  131. package/dist/codegen/type_generator.cjs +1 -0
  132. package/dist/codegen/type_generator.cjs.map +1 -1
  133. package/dist/codegen/type_generator.js +1 -0
  134. package/dist/codegen/type_generator.js.map +1 -1
  135. package/dist/config/config_parser.cjs +95 -4
  136. package/dist/config/config_parser.cjs.map +1 -1
  137. package/dist/config/config_parser.d.cts +10 -2
  138. package/dist/config/config_parser.d.ts +10 -2
  139. package/dist/config/config_parser.js +92 -3
  140. package/dist/config/config_parser.js.map +1 -1
  141. package/dist/config/index.cjs +6 -2
  142. package/dist/config/index.cjs.map +1 -1
  143. package/dist/config/index.d.cts +2 -2
  144. package/dist/config/index.d.ts +2 -2
  145. package/dist/config/index.js +8 -2
  146. package/dist/config/index.js.map +1 -1
  147. package/dist/controller/controller_resolver.cjs +51 -3
  148. package/dist/controller/controller_resolver.cjs.map +1 -1
  149. package/dist/controller/controller_resolver.d.cts +27 -4
  150. package/dist/controller/controller_resolver.d.ts +27 -4
  151. package/dist/controller/controller_resolver.js +48 -2
  152. package/dist/controller/controller_resolver.js.map +1 -1
  153. package/dist/controller/index.cjs +6 -2
  154. package/dist/controller/index.cjs.map +1 -1
  155. package/dist/controller/index.d.cts +1 -1
  156. package/dist/controller/index.d.ts +1 -1
  157. package/dist/controller/index.js +4 -2
  158. package/dist/controller/index.js.map +1 -1
  159. package/dist/dev/wood_dev_server.cjs +4 -1
  160. package/dist/dev/wood_dev_server.cjs.map +1 -1
  161. package/dist/dev/wood_dev_server.js +5 -2
  162. package/dist/dev/wood_dev_server.js.map +1 -1
  163. package/dist/dev/yaml_watcher.cjs +1 -1
  164. package/dist/dev/yaml_watcher.cjs.map +1 -1
  165. package/dist/dev/yaml_watcher.d.cts +4 -0
  166. package/dist/dev/yaml_watcher.d.ts +4 -0
  167. package/dist/dev/yaml_watcher.js +1 -1
  168. package/dist/dev/yaml_watcher.js.map +1 -1
  169. package/dist/frontend/frontend_lifecycle.cjs +74 -0
  170. package/dist/frontend/frontend_lifecycle.cjs.map +1 -0
  171. package/dist/frontend/frontend_lifecycle.d.cts +50 -0
  172. package/dist/frontend/frontend_lifecycle.d.ts +50 -0
  173. package/dist/frontend/frontend_lifecycle.js +50 -0
  174. package/dist/frontend/frontend_lifecycle.js.map +1 -0
  175. package/dist/frontend/frontend_page.cjs +122 -0
  176. package/dist/frontend/frontend_page.cjs.map +1 -0
  177. package/dist/frontend/frontend_page.d.cts +62 -0
  178. package/dist/frontend/frontend_page.d.ts +62 -0
  179. package/dist/frontend/frontend_page.js +98 -0
  180. package/dist/frontend/frontend_page.js.map +1 -0
  181. package/dist/frontend/frontend_surface.cjs +249 -0
  182. package/dist/frontend/frontend_surface.cjs.map +1 -0
  183. package/dist/frontend/frontend_surface.d.cts +64 -0
  184. package/dist/frontend/frontend_surface.d.ts +64 -0
  185. package/dist/frontend/frontend_surface.js +224 -0
  186. package/dist/frontend/frontend_surface.js.map +1 -0
  187. package/dist/frontend/index.cjs +52 -0
  188. package/dist/frontend/index.cjs.map +1 -0
  189. package/dist/frontend/index.d.cts +10 -0
  190. package/dist/frontend/index.d.ts +10 -0
  191. package/dist/frontend/index.js +19 -0
  192. package/dist/frontend/index.js.map +1 -0
  193. package/dist/frontend/page_catalog.cjs +135 -0
  194. package/dist/frontend/page_catalog.cjs.map +1 -0
  195. package/dist/frontend/page_catalog.d.cts +56 -0
  196. package/dist/frontend/page_catalog.d.ts +56 -0
  197. package/dist/frontend/page_catalog.js +108 -0
  198. package/dist/frontend/page_catalog.js.map +1 -0
  199. package/dist/frontend/tracked_transport.cjs +55 -0
  200. package/dist/frontend/tracked_transport.cjs.map +1 -0
  201. package/dist/frontend/tracked_transport.d.cts +36 -0
  202. package/dist/frontend/tracked_transport.d.ts +36 -0
  203. package/dist/frontend/tracked_transport.js +31 -0
  204. package/dist/frontend/tracked_transport.js.map +1 -0
  205. package/dist/frontend/work_registry.cjs +153 -0
  206. package/dist/frontend/work_registry.cjs.map +1 -0
  207. package/dist/frontend/work_registry.d.cts +70 -0
  208. package/dist/frontend/work_registry.d.ts +70 -0
  209. package/dist/frontend/work_registry.js +128 -0
  210. package/dist/frontend/work_registry.js.map +1 -0
  211. package/dist/index.cjs +24 -0
  212. package/dist/index.cjs.map +1 -1
  213. package/dist/index.d.cts +11 -7
  214. package/dist/index.d.ts +11 -7
  215. package/dist/index.js +27 -4
  216. package/dist/index.js.map +1 -1
  217. package/dist/main/index.cjs +10 -0
  218. package/dist/main/index.cjs.map +1 -1
  219. package/dist/main/index.d.cts +14 -2
  220. package/dist/main/index.d.ts +14 -2
  221. package/dist/main/index.js +16 -0
  222. package/dist/main/index.js.map +1 -1
  223. package/dist/middleware/middleware_resolver.cjs +22 -1
  224. package/dist/middleware/middleware_resolver.cjs.map +1 -1
  225. package/dist/middleware/middleware_resolver.d.cts +13 -1
  226. package/dist/middleware/middleware_resolver.d.ts +13 -1
  227. package/dist/middleware/middleware_resolver.js +22 -1
  228. package/dist/middleware/middleware_resolver.js.map +1 -1
  229. package/dist/navigation/automation_introspection.cjs +110 -0
  230. package/dist/navigation/automation_introspection.cjs.map +1 -0
  231. package/dist/navigation/automation_introspection.d.cts +60 -0
  232. package/dist/navigation/automation_introspection.d.ts +60 -0
  233. package/dist/navigation/automation_introspection.js +85 -0
  234. package/dist/navigation/automation_introspection.js.map +1 -0
  235. package/dist/navigation/index.cjs +10 -2
  236. package/dist/navigation/index.cjs.map +1 -1
  237. package/dist/navigation/index.d.cts +27 -1
  238. package/dist/navigation/index.d.ts +27 -1
  239. package/dist/navigation/index.js +6 -1
  240. package/dist/navigation/index.js.map +1 -1
  241. package/dist/{middleware/__fixtures__/middleware/auth.cjs → navigation/layout_preservation.cjs} +18 -20
  242. package/dist/navigation/layout_preservation.cjs.map +1 -0
  243. package/dist/navigation/layout_preservation.d.cts +2 -0
  244. package/dist/navigation/layout_preservation.d.ts +2 -0
  245. package/dist/navigation/layout_preservation.js +18 -0
  246. package/dist/navigation/layout_preservation.js.map +1 -0
  247. package/dist/parser/index.cjs +2 -0
  248. package/dist/parser/index.cjs.map +1 -1
  249. package/dist/parser/index.d.cts +1 -1
  250. package/dist/parser/index.d.ts +1 -1
  251. package/dist/parser/index.js +2 -1
  252. package/dist/parser/index.js.map +1 -1
  253. package/dist/parser/operations_parser.cjs +6 -0
  254. package/dist/parser/operations_parser.cjs.map +1 -1
  255. package/dist/parser/operations_parser.d.cts +9 -2
  256. package/dist/parser/operations_parser.d.ts +9 -2
  257. package/dist/parser/operations_parser.js +5 -0
  258. package/dist/parser/operations_parser.js.map +1 -1
  259. package/dist/parser/views_parser.cjs.map +1 -1
  260. package/dist/parser/views_parser.js.map +1 -1
  261. package/dist/router/index.d.cts +1 -0
  262. package/dist/router/index.d.ts +1 -0
  263. package/dist/router/wood_router.cjs +35 -3
  264. package/dist/router/wood_router.cjs.map +1 -1
  265. package/dist/router/wood_router.d.cts +15 -0
  266. package/dist/router/wood_router.d.ts +15 -0
  267. package/dist/router/wood_router.js +36 -4
  268. package/dist/router/wood_router.js.map +1 -1
  269. package/dist/runtime/get_container.cjs +9 -34
  270. package/dist/runtime/get_container.cjs.map +1 -1
  271. package/dist/runtime/get_container.d.cts +24 -4
  272. package/dist/runtime/get_container.d.ts +24 -4
  273. package/dist/runtime/get_container.js +8 -23
  274. package/dist/runtime/get_container.js.map +1 -1
  275. package/dist/runtime/index.cjs +9 -0
  276. package/dist/runtime/index.cjs.map +1 -1
  277. package/dist/runtime/index.d.cts +5 -2
  278. package/dist/runtime/index.d.ts +5 -2
  279. package/dist/runtime/index.js +10 -1
  280. package/dist/runtime/index.js.map +1 -1
  281. package/dist/runtime/renderer_config_extension.cjs +50 -0
  282. package/dist/runtime/renderer_config_extension.cjs.map +1 -0
  283. package/dist/runtime/renderer_config_extension.d.cts +19 -0
  284. package/dist/runtime/renderer_config_extension.d.ts +19 -0
  285. package/dist/runtime/renderer_config_extension.js +24 -0
  286. package/dist/runtime/renderer_config_extension.js.map +1 -0
  287. package/dist/runtime/renderer_log_batch_receiver.cjs +73 -0
  288. package/dist/runtime/renderer_log_batch_receiver.cjs.map +1 -0
  289. package/dist/runtime/renderer_log_batch_receiver.d.cts +29 -0
  290. package/dist/runtime/renderer_log_batch_receiver.d.ts +29 -0
  291. package/dist/runtime/renderer_log_batch_receiver.js +48 -0
  292. package/dist/runtime/renderer_log_batch_receiver.js.map +1 -0
  293. package/dist/runtime/renderer_trace_batch_receiver_registry.d.cts +1 -1
  294. package/dist/runtime/renderer_trace_batch_receiver_registry.d.ts +1 -1
  295. package/dist/runtime/runtime.cjs +14 -0
  296. package/dist/runtime/runtime.cjs.map +1 -1
  297. package/dist/runtime/runtime.d.cts +2 -1
  298. package/dist/runtime/runtime.d.ts +2 -1
  299. package/dist/runtime/runtime.js +14 -0
  300. package/dist/runtime/runtime.js.map +1 -1
  301. package/dist/stick/index.cjs.map +1 -1
  302. package/dist/stick/index.js.map +1 -1
  303. package/dist/testing/automation_assertions.cjs +417 -0
  304. package/dist/testing/automation_assertions.cjs.map +1 -0
  305. package/dist/testing/automation_assertions.d.cts +44 -0
  306. package/dist/testing/automation_assertions.d.ts +44 -0
  307. package/dist/testing/automation_assertions.js +385 -0
  308. package/dist/testing/automation_assertions.js.map +1 -0
  309. package/dist/testing/browser.cjs +130 -57
  310. package/dist/testing/browser.cjs.map +1 -1
  311. package/dist/testing/browser.d.cts +10 -4
  312. package/dist/testing/browser.d.ts +10 -4
  313. package/dist/testing/browser.js +132 -53
  314. package/dist/testing/browser.js.map +1 -1
  315. package/dist/testing/create_controller_harness.cjs +28 -8
  316. package/dist/testing/create_controller_harness.cjs.map +1 -1
  317. package/dist/testing/create_controller_harness.d.cts +18 -2
  318. package/dist/testing/create_controller_harness.d.ts +18 -2
  319. package/dist/testing/create_controller_harness.js +28 -8
  320. package/dist/testing/create_controller_harness.js.map +1 -1
  321. package/dist/testing/create_router_bridge.d.cts +1 -0
  322. package/dist/testing/create_router_bridge.d.ts +1 -0
  323. package/dist/testing/create_test_router.d.cts +1 -0
  324. package/dist/testing/create_test_router.d.ts +1 -0
  325. package/dist/testing/geometry.cjs +109 -0
  326. package/dist/testing/geometry.cjs.map +1 -0
  327. package/dist/testing/geometry.d.cts +45 -0
  328. package/dist/testing/geometry.d.ts +45 -0
  329. package/dist/testing/geometry.js +79 -0
  330. package/dist/testing/geometry.js.map +1 -0
  331. package/dist/testing/index.cjs +62 -2
  332. package/dist/testing/index.cjs.map +1 -1
  333. package/dist/testing/index.d.cts +23 -4
  334. package/dist/testing/index.d.ts +23 -4
  335. package/dist/testing/index.js +50 -2
  336. package/dist/testing/index.js.map +1 -1
  337. package/dist/{controller/__fixtures__/controllers/not_a_class.cjs → testing/test_wood.cjs} +15 -7
  338. package/dist/testing/test_wood.cjs.map +1 -0
  339. package/dist/testing/test_wood.d.cts +16 -0
  340. package/dist/testing/test_wood.d.ts +16 -0
  341. package/dist/testing/test_wood.js +12 -0
  342. package/dist/testing/test_wood.js.map +1 -0
  343. package/dist/testing/test_wood_config.cjs +272 -0
  344. package/dist/testing/test_wood_config.cjs.map +1 -0
  345. package/dist/testing/test_wood_config.d.cts +111 -0
  346. package/dist/testing/test_wood_config.d.ts +111 -0
  347. package/dist/testing/test_wood_config.js +247 -0
  348. package/dist/testing/test_wood_config.js.map +1 -0
  349. package/dist/testing/wood_config_source.cjs +146 -0
  350. package/dist/testing/wood_config_source.cjs.map +1 -0
  351. package/dist/testing/wood_config_source.d.cts +36 -0
  352. package/dist/testing/wood_config_source.d.ts +36 -0
  353. package/dist/testing/wood_config_source.js +112 -0
  354. package/dist/testing/wood_config_source.js.map +1 -0
  355. package/dist/testing/wood_env_renderer.cjs +210 -0
  356. package/dist/testing/wood_env_renderer.cjs.map +1 -0
  357. package/dist/testing/wood_env_renderer.d.cts +74 -0
  358. package/dist/testing/wood_env_renderer.d.ts +74 -0
  359. package/dist/testing/wood_env_renderer.js +188 -0
  360. package/dist/testing/wood_env_renderer.js.map +1 -0
  361. package/dist/testing/wood_test_selection.cjs +94 -0
  362. package/dist/testing/wood_test_selection.cjs.map +1 -0
  363. package/dist/testing/wood_test_selection.d.cts +39 -0
  364. package/dist/testing/wood_test_selection.d.ts +39 -0
  365. package/dist/testing/wood_test_selection.js +68 -0
  366. package/dist/testing/wood_test_selection.js.map +1 -0
  367. package/dist/trace-testing/index.d.cts +1 -2
  368. package/dist/trace-testing/index.d.ts +1 -2
  369. package/dist/trace-testing/trace_recorder.cjs +1 -1
  370. package/dist/trace-testing/trace_recorder.cjs.map +1 -1
  371. package/dist/trace-testing/trace_recorder.d.cts +1 -2
  372. package/dist/trace-testing/trace_recorder.d.ts +1 -2
  373. package/dist/trace-testing/trace_recorder.js +1 -1
  374. package/dist/trace-testing/trace_recorder.js.map +1 -1
  375. package/dist/trace-transport/index.d.cts +1 -1
  376. package/dist/trace-transport/index.d.ts +1 -1
  377. package/dist/{trace_hub-Cob54qRx.d.cts → trace_hub-Cpo_nVze.d.cts} +21 -1
  378. package/dist/{trace_hub-Cob54qRx.d.ts → trace_hub-Cpo_nVze.d.ts} +21 -1
  379. package/dist/tracing/index.cjs +9 -2
  380. package/dist/tracing/index.cjs.map +1 -1
  381. package/dist/tracing/index.d.cts +3 -2
  382. package/dist/tracing/index.d.ts +3 -2
  383. package/dist/tracing/index.js +7 -1
  384. package/dist/tracing/index.js.map +1 -1
  385. package/dist/tracing/renderer_trace_batch_host.d.cts +1 -1
  386. package/dist/tracing/renderer_trace_batch_host.d.ts +1 -1
  387. package/dist/tracing/renderer_trace_batch_transport.cjs +48 -6
  388. package/dist/tracing/renderer_trace_batch_transport.cjs.map +1 -1
  389. package/dist/tracing/renderer_trace_batch_transport.d.cts +17 -1
  390. package/dist/tracing/renderer_trace_batch_transport.d.ts +17 -1
  391. package/dist/tracing/renderer_trace_batch_transport.js +48 -6
  392. package/dist/tracing/renderer_trace_batch_transport.js.map +1 -1
  393. package/dist/tracing/trace_batch_adapter.cjs +110 -0
  394. package/dist/tracing/trace_batch_adapter.cjs.map +1 -0
  395. package/dist/tracing/trace_batch_adapter.d.cts +36 -0
  396. package/dist/tracing/trace_batch_adapter.d.ts +36 -0
  397. package/dist/tracing/trace_batch_adapter.js +86 -0
  398. package/dist/tracing/trace_batch_adapter.js.map +1 -0
  399. package/dist/tracing/trace_commit_writer.d.cts +1 -1
  400. package/dist/tracing/trace_commit_writer.d.ts +1 -1
  401. package/dist/tracing/trace_hub.cjs +87 -20
  402. package/dist/tracing/trace_hub.cjs.map +1 -1
  403. package/dist/tracing/trace_hub.d.cts +1 -1
  404. package/dist/tracing/trace_hub.d.ts +1 -1
  405. package/dist/tracing/trace_hub.js +85 -20
  406. package/dist/tracing/trace_hub.js.map +1 -1
  407. package/dist/tracing/trace_provider.cjs +21 -6
  408. package/dist/tracing/trace_provider.cjs.map +1 -1
  409. package/dist/tracing/trace_provider.d.cts +13 -4
  410. package/dist/tracing/trace_provider.d.ts +13 -4
  411. package/dist/tracing/trace_provider.js +22 -7
  412. package/dist/tracing/trace_provider.js.map +1 -1
  413. package/dist/tracing/types/wood_trace_batch.types.cjs.map +1 -1
  414. package/dist/tracing/types/wood_trace_batch.types.d.cts +15 -1
  415. package/dist/tracing/types/wood_trace_batch.types.d.ts +15 -1
  416. package/dist/tracing/types/wood_trace_sink.types.d.cts +1 -1
  417. package/dist/tracing/types/wood_trace_sink.types.d.ts +1 -1
  418. package/dist/tracing/wood_trace_batch_contract.cjs +2 -0
  419. package/dist/tracing/wood_trace_batch_contract.cjs.map +1 -1
  420. package/dist/tracing/wood_trace_batch_contract.d.cts +1 -1
  421. package/dist/tracing/wood_trace_batch_contract.d.ts +1 -1
  422. package/dist/tracing/wood_trace_batch_contract.js +2 -0
  423. package/dist/tracing/wood_trace_batch_contract.js.map +1 -1
  424. package/dist/transport/build_transport_bridge.cjs +4 -2
  425. package/dist/transport/build_transport_bridge.cjs.map +1 -1
  426. package/dist/transport/build_transport_bridge.d.cts +7 -1
  427. package/dist/transport/build_transport_bridge.d.ts +7 -1
  428. package/dist/transport/build_transport_bridge.js +2 -1
  429. package/dist/transport/build_transport_bridge.js.map +1 -1
  430. package/dist/transport/in_process_router_transport.d.cts +1 -0
  431. package/dist/transport/in_process_router_transport.d.ts +1 -0
  432. package/dist/transport/index.d.cts +1 -0
  433. package/dist/transport/index.d.ts +1 -0
  434. package/dist/types/config.cjs.map +1 -1
  435. package/dist/types/config.d.cts +47 -1
  436. package/dist/types/config.d.ts +47 -1
  437. package/dist/types/context.cjs +12 -0
  438. package/dist/types/context.cjs.map +1 -1
  439. package/dist/types/context.d.cts +27 -1
  440. package/dist/types/context.d.ts +27 -1
  441. package/dist/types/context.js +4 -0
  442. package/dist/types/context.js.map +1 -1
  443. package/dist/types/index.d.cts +2 -2
  444. package/dist/types/index.d.ts +2 -2
  445. package/dist/types/operations.cjs.map +1 -1
  446. package/dist/types/operations.d.cts +2 -0
  447. package/dist/types/operations.d.ts +2 -0
  448. package/docs/axe.md +706 -0
  449. package/package.json +19 -5
  450. package/src/components/NavigationShell.scopes.browser.test.ts +363 -0
  451. package/src/components/NavigationShell.svelte +126 -49
  452. package/dist/controller/__fixtures__/controllers/chat.cjs +0 -32
  453. package/dist/controller/__fixtures__/controllers/chat.cjs.map +0 -1
  454. package/dist/controller/__fixtures__/controllers/chat.d.cts +0 -11
  455. package/dist/controller/__fixtures__/controllers/chat.d.ts +0 -11
  456. package/dist/controller/__fixtures__/controllers/chat.js +0 -12
  457. package/dist/controller/__fixtures__/controllers/chat.js.map +0 -1
  458. package/dist/controller/__fixtures__/controllers/not_a_class.cjs.map +0 -1
  459. package/dist/controller/__fixtures__/controllers/not_a_class.d.cts +0 -3
  460. package/dist/controller/__fixtures__/controllers/not_a_class.d.ts +0 -3
  461. package/dist/controller/__fixtures__/controllers/not_a_class.js +0 -5
  462. package/dist/controller/__fixtures__/controllers/not_a_class.js.map +0 -1
  463. package/dist/controller/__fixtures__/controllers/settings.controller.cjs +0 -32
  464. package/dist/controller/__fixtures__/controllers/settings.controller.cjs.map +0 -1
  465. package/dist/controller/__fixtures__/controllers/settings.controller.d.cts +0 -12
  466. package/dist/controller/__fixtures__/controllers/settings.controller.d.ts +0 -12
  467. package/dist/controller/__fixtures__/controllers/settings.controller.js +0 -12
  468. package/dist/controller/__fixtures__/controllers/settings.controller.js.map +0 -1
  469. package/dist/controller/__fixtures__/controllers/test.cjs.map +0 -1
  470. package/dist/controller/__fixtures__/controllers/test.d.cts +0 -7
  471. package/dist/controller/__fixtures__/controllers/test.d.ts +0 -7
  472. package/dist/controller/__fixtures__/controllers/test.js +0 -9
  473. package/dist/controller/__fixtures__/controllers/test.js.map +0 -1
  474. package/dist/loader/__fixtures__/layouts/app.load.cjs.map +0 -1
  475. package/dist/loader/__fixtures__/layouts/app.load.d.cts +0 -5
  476. package/dist/loader/__fixtures__/layouts/app.load.d.ts +0 -5
  477. package/dist/loader/__fixtures__/layouts/app.load.js +0 -7
  478. package/dist/loader/__fixtures__/layouts/app.load.js.map +0 -1
  479. package/dist/loader/__fixtures__/views/test/page.load.cjs.map +0 -1
  480. package/dist/loader/__fixtures__/views/test/page.load.d.cts +0 -6
  481. package/dist/loader/__fixtures__/views/test/page.load.d.ts +0 -6
  482. package/dist/loader/__fixtures__/views/test/page.load.js +0 -7
  483. package/dist/loader/__fixtures__/views/test/page.load.js.map +0 -1
  484. package/dist/middleware/__fixtures__/middleware/auth.cjs.map +0 -1
  485. package/dist/middleware/__fixtures__/middleware/auth.d.cts +0 -6
  486. package/dist/middleware/__fixtures__/middleware/auth.d.ts +0 -6
  487. package/dist/middleware/__fixtures__/middleware/auth.js +0 -19
  488. package/dist/middleware/__fixtures__/middleware/auth.js.map +0 -1
  489. package/dist/middleware/__fixtures__/middleware/sequence.cjs.map +0 -1
  490. package/dist/middleware/__fixtures__/middleware/sequence.d.cts +0 -7
  491. package/dist/middleware/__fixtures__/middleware/sequence.d.ts +0 -7
  492. package/dist/middleware/__fixtures__/middleware/sequence.js +0 -21
  493. package/dist/middleware/__fixtures__/middleware/sequence.js.map +0 -1
@@ -0,0 +1,660 @@
1
+ import { mkdir } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { executeAction } from "./actions_executor.js";
4
+ import { automationError, automationOk } from "./errors.js";
5
+ import { discoverTargets, selectTarget } from "./target_registry.js";
6
+ import { awaitCondition } from "./waits_executor.js";
7
+ const EXPECT_TIMEOUT_MS = 2e3;
8
+ const ACTION_KINDS = [
9
+ "click",
10
+ "double_click",
11
+ "fill",
12
+ "type",
13
+ "press",
14
+ "select",
15
+ "toggle",
16
+ "scroll",
17
+ "back",
18
+ "forward",
19
+ "reload",
20
+ "wait"
21
+ ];
22
+ const WAIT_KINDS = [
23
+ "route",
24
+ "url",
25
+ "target",
26
+ "visible",
27
+ "hidden",
28
+ "attached",
29
+ "detached",
30
+ "enabled",
31
+ "trace",
32
+ "scroll_edge",
33
+ "visual_stable",
34
+ "app_idle"
35
+ ];
36
+ function valid(value) {
37
+ return { ok: true, value };
38
+ }
39
+ function invalid(message) {
40
+ return { ok: false, message };
41
+ }
42
+ function isRecord(value) {
43
+ return typeof value === "object" && value !== null && !Array.isArray(value);
44
+ }
45
+ function requireRecord(value, at) {
46
+ return isRecord(value) ? valid(value) : invalid(`${at} must be an object.`);
47
+ }
48
+ function requireString(value, at) {
49
+ return typeof value === "string" && value.length > 0 ? valid(value) : invalid(`${at} must be a non-empty string.`);
50
+ }
51
+ function optionalBoolean(value, at) {
52
+ return value === void 0 || typeof value === "boolean" ? valid(value) : invalid(`${at} must be a boolean when provided.`);
53
+ }
54
+ function optionalNumber(value, at) {
55
+ return value === void 0 || typeof value === "number" && Number.isFinite(value) ? valid(value) : invalid(`${at} must be a finite number when provided.`);
56
+ }
57
+ function stringRecord(value, at) {
58
+ if (value === void 0) return valid(void 0);
59
+ if (!isRecord(value)) return invalid(`${at} must be an object of string values.`);
60
+ const result = {};
61
+ for (const [key, item] of Object.entries(value)) {
62
+ if (typeof item !== "string") return invalid(`${at}.${key} must be a string.`);
63
+ result[key] = item;
64
+ }
65
+ return valid(result);
66
+ }
67
+ function parseLocator(value, at) {
68
+ const object = requireRecord(value, at);
69
+ if (!object.ok) return object;
70
+ const kind = object.value.kind;
71
+ if (kind === "role") {
72
+ const role = requireString(object.value.role, `${at}.role`);
73
+ if (!role.ok) return role;
74
+ if (object.value.name !== void 0 && typeof object.value.name !== "string") {
75
+ return invalid(`${at}.name must be a string when provided.`);
76
+ }
77
+ const exact2 = optionalBoolean(object.value.exact, `${at}.exact`);
78
+ if (!exact2.ok) return exact2;
79
+ return valid({
80
+ kind,
81
+ role: role.value,
82
+ ...object.value.name !== void 0 ? { name: object.value.name } : {},
83
+ ...exact2.value !== void 0 ? { exact: exact2.value } : {}
84
+ });
85
+ }
86
+ if (!["test_id", "label", "placeholder", "text", "css"].includes(String(kind))) {
87
+ return invalid(`${at}.kind must be one of test_id, role, label, placeholder, text, css.`);
88
+ }
89
+ const text = requireString(object.value.value, `${at}.value`);
90
+ if (!text.ok) return text;
91
+ if (kind === "css" || kind === "test_id") return valid({ kind, value: text.value });
92
+ const exact = optionalBoolean(object.value.exact, `${at}.exact`);
93
+ if (!exact.ok) return exact;
94
+ return valid({
95
+ kind,
96
+ value: text.value,
97
+ ...exact.value !== void 0 ? { exact: exact.value } : {}
98
+ });
99
+ }
100
+ function parseContainer(value, at) {
101
+ const object = requireRecord(value, at);
102
+ if (!object.ok) return object;
103
+ if (object.value.kind === "viewport") return valid({ kind: "viewport" });
104
+ if (object.value.kind !== "locator") {
105
+ return invalid(`${at}.kind must be viewport or locator.`);
106
+ }
107
+ const target = parseLocator(object.value.target, `${at}.target`);
108
+ return target.ok ? valid({ kind: "locator", target: target.value }) : target;
109
+ }
110
+ function parseScroll(value, at) {
111
+ const object = requireRecord(value, at);
112
+ if (!object.ok) return object;
113
+ const mode = object.value.mode;
114
+ if (mode === "into_view") {
115
+ const target2 = parseLocator(object.value.target, `${at}.target`);
116
+ if (!target2.ok) return target2;
117
+ const block = object.value.block;
118
+ if (block !== void 0 && !["start", "center", "end", "nearest"].includes(String(block))) {
119
+ return invalid(`${at}.block must be start, center, end, or nearest.`);
120
+ }
121
+ return valid({
122
+ mode,
123
+ target: target2.value,
124
+ ...block !== void 0 ? { block } : {}
125
+ });
126
+ }
127
+ if (!["wheel", "position", "until"].includes(String(mode))) {
128
+ return invalid(`${at}.mode must be wheel, position, into_view, or until.`);
129
+ }
130
+ const container = parseContainer(object.value.container, `${at}.container`);
131
+ if (!container.ok) return container;
132
+ if (mode === "wheel") {
133
+ const deltaX = optionalNumber(object.value.deltaX, `${at}.deltaX`);
134
+ if (!deltaX.ok) return deltaX;
135
+ const deltaY = optionalNumber(object.value.deltaY, `${at}.deltaY`);
136
+ if (!deltaY.ok) return deltaY;
137
+ return valid({
138
+ mode,
139
+ container: container.value,
140
+ ...deltaX.value !== void 0 ? { deltaX: deltaX.value } : {},
141
+ ...deltaY.value !== void 0 ? { deltaY: deltaY.value } : {}
142
+ });
143
+ }
144
+ if (mode === "position") {
145
+ const x = optionalNumber(object.value.x, `${at}.x`);
146
+ if (!x.ok) return x;
147
+ const y = optionalNumber(object.value.y, `${at}.y`);
148
+ if (!y.ok) return y;
149
+ const edge = object.value.edge;
150
+ if (edge !== void 0 && !["top", "bottom", "left", "right"].includes(String(edge))) {
151
+ return invalid(`${at}.edge must be top, bottom, left, or right.`);
152
+ }
153
+ return valid({
154
+ mode,
155
+ container: container.value,
156
+ ...x.value !== void 0 ? { x: x.value } : {},
157
+ ...y.value !== void 0 ? { y: y.value } : {},
158
+ ...edge !== void 0 ? { edge } : {}
159
+ });
160
+ }
161
+ const target = parseLocator(object.value.target, `${at}.target`);
162
+ if (!target.ok) return target;
163
+ const direction = object.value.direction;
164
+ if (!["up", "down", "left", "right"].includes(String(direction))) {
165
+ return invalid(`${at}.direction must be up, down, left, or right.`);
166
+ }
167
+ const stepPx = object.value.stepPx;
168
+ if (typeof stepPx !== "number" || !Number.isFinite(stepPx) || stepPx <= 0) {
169
+ return invalid(`${at}.stepPx must be a positive number.`);
170
+ }
171
+ const maxSteps = object.value.maxSteps;
172
+ if (!Number.isInteger(maxSteps) || maxSteps <= 0) {
173
+ return invalid(`${at}.maxSteps must be a positive integer.`);
174
+ }
175
+ return valid({
176
+ mode: "until",
177
+ container: container.value,
178
+ target: target.value,
179
+ direction,
180
+ stepPx,
181
+ maxSteps
182
+ });
183
+ }
184
+ function parseWait(value, at) {
185
+ const object = requireRecord(value, at);
186
+ if (!object.ok) return object;
187
+ const kind = object.value.kind;
188
+ if (!WAIT_KINDS.includes(kind)) {
189
+ return invalid(`${at}.kind must be one of ${WAIT_KINDS.join(", ")}.`);
190
+ }
191
+ if (kind === "route") {
192
+ const page = requireString(object.value.page, `${at}.page`);
193
+ if (!page.ok) return page;
194
+ const params = stringRecord(object.value.params, `${at}.params`);
195
+ if (!params.ok) return params;
196
+ const query = stringRecord(object.value.query, `${at}.query`);
197
+ if (!query.ok) return query;
198
+ return valid({
199
+ kind,
200
+ page: page.value,
201
+ ...params.value ? { params: params.value } : {},
202
+ ...query.value ? { query: query.value } : {}
203
+ });
204
+ }
205
+ if (kind === "url") {
206
+ const text = requireString(object.value.value, `${at}.value`);
207
+ if (!text.ok) return text;
208
+ const match = object.value.match;
209
+ if (match !== void 0 && !["exact", "glob", "regex"].includes(String(match))) {
210
+ return invalid(`${at}.match must be exact, glob, or regex.`);
211
+ }
212
+ return valid({
213
+ kind,
214
+ value: text.value,
215
+ ...match !== void 0 ? { match } : {}
216
+ });
217
+ }
218
+ if (kind === "target") {
219
+ const windowId = requireString(object.value.windowId, `${at}.windowId`);
220
+ if (!windowId.ok) return windowId;
221
+ const state = object.value.state;
222
+ if (!["present", "active", "closed"].includes(String(state))) {
223
+ return invalid(`${at}.state must be present, active, or closed.`);
224
+ }
225
+ return valid({ kind, windowId: windowId.value, state });
226
+ }
227
+ if (["visible", "hidden", "attached", "detached", "enabled"].includes(String(kind))) {
228
+ const target = parseLocator(object.value.target, `${at}.target`);
229
+ return target.ok ? valid({ kind, target: target.value }) : target;
230
+ }
231
+ if (kind === "trace") {
232
+ const type = requireString(object.value.type, `${at}.type`);
233
+ if (!type.ok) return type;
234
+ if (object.value.source !== void 0 && typeof object.value.source !== "string") {
235
+ return invalid(`${at}.source must be a string when provided.`);
236
+ }
237
+ if (object.value.count !== void 0 && (!Number.isInteger(object.value.count) || object.value.count < 1)) {
238
+ return invalid(`${at}.count must be a positive integer when provided.`);
239
+ }
240
+ return valid({
241
+ kind,
242
+ type: type.value,
243
+ ...object.value.source !== void 0 ? { source: object.value.source } : {},
244
+ ...object.value.count !== void 0 ? { count: object.value.count } : {}
245
+ });
246
+ }
247
+ if (kind === "scroll_edge") {
248
+ const container = parseContainer(object.value.container, `${at}.container`);
249
+ if (!container.ok) return container;
250
+ const edge = object.value.edge;
251
+ if (!["top", "bottom", "left", "right"].includes(String(edge))) {
252
+ return invalid(`${at}.edge must be top, bottom, left, or right.`);
253
+ }
254
+ return valid({ kind, container: container.value, edge });
255
+ }
256
+ if (kind === "visual_stable") {
257
+ const target = object.value.target === void 0 ? valid(void 0) : parseLocator(object.value.target, `${at}.target`);
258
+ if (!target.ok) return target;
259
+ if (object.value.frames !== void 0 && (!Number.isInteger(object.value.frames) || object.value.frames < 1)) {
260
+ return invalid(`${at}.frames must be a positive integer when provided.`);
261
+ }
262
+ return valid({
263
+ kind,
264
+ ...target.value ? { target: target.value } : {},
265
+ ...object.value.frames !== void 0 ? { frames: object.value.frames } : {}
266
+ });
267
+ }
268
+ return valid({ kind: "app_idle" });
269
+ }
270
+ function parseAction(value, at) {
271
+ const object = requireRecord(value, at);
272
+ if (!object.ok) return object;
273
+ const kind = object.value.kind;
274
+ if (!ACTION_KINDS.includes(kind)) {
275
+ return invalid(`${at}.kind must be one of ${ACTION_KINDS.join(", ")}.`);
276
+ }
277
+ if (kind === "back" || kind === "forward" || kind === "reload") return valid({ kind });
278
+ if (kind === "scroll") {
279
+ const command = parseScroll(object.value.command, `${at}.command`);
280
+ return command.ok ? valid({ kind, command: command.value }) : command;
281
+ }
282
+ if (kind === "wait") {
283
+ const condition = parseWait(object.value.condition, `${at}.condition`);
284
+ return condition.ok ? valid({ kind, condition: condition.value }) : condition;
285
+ }
286
+ if (kind === "press") {
287
+ let target2 = valid(void 0);
288
+ if (object.value.target !== void 0) target2 = parseLocator(object.value.target, `${at}.target`);
289
+ if (!target2.ok) return target2;
290
+ if (!Array.isArray(object.value.keys) || object.value.keys.length === 0) {
291
+ return invalid(`${at}.keys must be a non-empty array of strings.`);
292
+ }
293
+ for (let index = 0; index < object.value.keys.length; index += 1) {
294
+ if (typeof object.value.keys[index] !== "string" || object.value.keys[index].length === 0) {
295
+ return invalid(`${at}.keys[${index}] must be a non-empty string.`);
296
+ }
297
+ }
298
+ return valid({
299
+ kind,
300
+ ...target2.value ? { target: target2.value } : {},
301
+ keys: object.value.keys
302
+ });
303
+ }
304
+ const target = parseLocator(object.value.target, `${at}.target`);
305
+ if (!target.ok) return target;
306
+ if (kind === "click") {
307
+ const button = object.value.button;
308
+ if (button !== void 0 && button !== "left" && button !== "middle") {
309
+ return invalid(`${at}.button must be left or middle when provided.`);
310
+ }
311
+ return valid({ kind, target: target.value, ...button ? { button } : {} });
312
+ }
313
+ if (kind === "double_click") return valid({ kind, target: target.value });
314
+ if (kind === "fill" || kind === "type") {
315
+ if (typeof object.value.value !== "string") return invalid(`${at}.value must be a string.`);
316
+ if (kind === "type") {
317
+ const delayMs = optionalNumber(object.value.delayMs, `${at}.delayMs`);
318
+ if (!delayMs.ok) return delayMs;
319
+ return valid({
320
+ kind,
321
+ target: target.value,
322
+ value: object.value.value,
323
+ ...delayMs.value !== void 0 ? { delayMs: delayMs.value } : {}
324
+ });
325
+ }
326
+ return valid({ kind, target: target.value, value: object.value.value });
327
+ }
328
+ if (kind === "select") {
329
+ if (typeof object.value.option !== "string") return invalid(`${at}.option must be a string.`);
330
+ return valid({ kind, target: target.value, option: object.value.option });
331
+ }
332
+ if (typeof object.value.checked !== "boolean") return invalid(`${at}.checked must be a boolean.`);
333
+ return valid({ kind: "toggle", target: target.value, checked: object.value.checked });
334
+ }
335
+ function parseScenario(json) {
336
+ const root = requireRecord(json, "$");
337
+ if (!root.ok) return automationError("ACTION_FAILED", root.message);
338
+ if (root.value.version !== 1) {
339
+ return automationError("UNSUPPORTED", "$.version must equal 1.");
340
+ }
341
+ if (!Array.isArray(root.value.steps)) {
342
+ return automationError("ACTION_FAILED", "$.steps must be an array.");
343
+ }
344
+ if (root.value.steps.length === 0) {
345
+ return automationError("ACTION_FAILED", "$.steps must contain at least one step.");
346
+ }
347
+ let target;
348
+ if (root.value.target !== void 0) {
349
+ const object = requireRecord(root.value.target, "$.target");
350
+ if (!object.ok) return automationError("ACTION_FAILED", object.message);
351
+ if (object.value.windowId !== void 0 && (typeof object.value.windowId !== "string" || object.value.windowId.length === 0)) {
352
+ return automationError("ACTION_FAILED", "$.target.windowId must be a non-empty string when provided.");
353
+ }
354
+ target = object.value.windowId === void 0 ? {} : { windowId: object.value.windowId };
355
+ }
356
+ let evidence;
357
+ if (root.value.evidence !== void 0) {
358
+ const object = requireRecord(root.value.evidence, "$.evidence");
359
+ if (!object.ok) return automationError("ACTION_FAILED", object.message);
360
+ const screenshot = object.value.screenshot;
361
+ if (screenshot !== void 0 && !["on-failure", "always", "off"].includes(String(screenshot))) {
362
+ return automationError("ACTION_FAILED", "$.evidence.screenshot must be on-failure, always, or off.");
363
+ }
364
+ const consoleCapture = optionalBoolean(object.value.console, "$.evidence.console");
365
+ if (!consoleCapture.ok) return automationError("ACTION_FAILED", consoleCapture.message);
366
+ evidence = {
367
+ ...screenshot !== void 0 ? { screenshot } : {},
368
+ ...consoleCapture.value !== void 0 ? { console: consoleCapture.value } : {}
369
+ };
370
+ }
371
+ const steps = [];
372
+ for (let index = 0; index < root.value.steps.length; index += 1) {
373
+ const at = `$.steps[${index}]`;
374
+ const step = requireRecord(root.value.steps[index], at);
375
+ if (!step.ok) return automationError("ACTION_FAILED", step.message);
376
+ if (step.value.name !== void 0 && (typeof step.value.name !== "string" || step.value.name.length === 0)) {
377
+ return automationError("ACTION_FAILED", `${at}.name must be a non-empty string when provided.`);
378
+ }
379
+ const action = parseAction(step.value.action, `${at}.action`);
380
+ if (!action.ok) return automationError("ACTION_FAILED", action.message);
381
+ const wait = step.value.wait === void 0 ? valid(void 0) : parseWait(step.value.wait, `${at}.wait`);
382
+ if (!wait.ok) return automationError("ACTION_FAILED", wait.message);
383
+ if (step.value.expect !== void 0 && !Array.isArray(step.value.expect)) {
384
+ return automationError("ACTION_FAILED", `${at}.expect must be an array when provided.`);
385
+ }
386
+ const expect = [];
387
+ for (let expectIndex = 0; expectIndex < step.value.expect?.length; expectIndex += 1) {
388
+ const condition = parseWait(
389
+ step.value.expect[expectIndex],
390
+ `${at}.expect[${expectIndex}]`
391
+ );
392
+ if (!condition.ok) return automationError("ACTION_FAILED", condition.message);
393
+ expect.push(condition.value);
394
+ }
395
+ steps.push({
396
+ ...step.value.name !== void 0 ? { name: step.value.name } : {},
397
+ action: action.value,
398
+ ...wait.value ? { wait: wait.value } : {},
399
+ ...step.value.expect !== void 0 ? { expect } : {}
400
+ });
401
+ }
402
+ return automationOk({
403
+ version: 1,
404
+ ...target ? { target } : {},
405
+ ...evidence ? { evidence } : {},
406
+ steps
407
+ });
408
+ }
409
+ function safeEvidenceName(stepIndex, stepName, suffix) {
410
+ const name = (stepName ?? "step").replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "step";
411
+ return `${String(stepIndex + 1).padStart(3, "0")}-${name}-${suffix}.png`;
412
+ }
413
+ async function captureScreenshot(page, hooks, stepIndex, stepName, suffix) {
414
+ if (!hooks.evidenceDir) return void 0;
415
+ await mkdir(hooks.evidenceDir, { recursive: true });
416
+ const outputPath = path.join(hooks.evidenceDir, safeEvidenceName(stepIndex, stepName, suffix));
417
+ await page.screenshot({ path: outputPath });
418
+ return outputPath;
419
+ }
420
+ function attachConsoleCapture(page, entries) {
421
+ const add = (type, message) => {
422
+ entries.push({ type, message, occurredAt: (/* @__PURE__ */ new Date()).toISOString() });
423
+ };
424
+ const onConsole = (message) => {
425
+ if (message.type() === "error") add("console_error", message.text());
426
+ };
427
+ const onPageError = (error) => add("page_error", error.message);
428
+ const onRequestFailed = (request) => {
429
+ add("request_failed", `${request.method()} ${request.url()}: ${request.failure()?.errorText ?? "request failed"}`);
430
+ };
431
+ page.on("console", onConsole);
432
+ page.on("pageerror", onPageError);
433
+ page.on("requestfailed", onRequestFailed);
434
+ return () => {
435
+ page.off("console", onConsole);
436
+ page.off("pageerror", onPageError);
437
+ page.off("requestfailed", onRequestFailed);
438
+ };
439
+ }
440
+ function emit(hooks, event) {
441
+ hooks.onEvent(event);
442
+ }
443
+ function classifyThrown(error, message) {
444
+ return {
445
+ code: "ACTION_FAILED",
446
+ message,
447
+ details: { cause: error instanceof Error ? error.message : String(error) }
448
+ };
449
+ }
450
+ async function runScenarioOnPage(page, scenario, hooks) {
451
+ const started = /* @__PURE__ */ new Date();
452
+ const receipts = [];
453
+ const steps = [];
454
+ const evidence = [];
455
+ const consoleEntries = [];
456
+ const detach = scenario.evidence?.console === false ? () => void 0 : attachConsoleCapture(page, consoleEntries);
457
+ emit(hooks, { kind: "scenario_started", startedAt: started.toISOString(), stepCount: scenario.steps.length });
458
+ try {
459
+ for (let index = 0; index < scenario.steps.length; index += 1) {
460
+ const step = scenario.steps[index];
461
+ const stepStarted = /* @__PURE__ */ new Date();
462
+ const stepEvidence = [];
463
+ let receipt;
464
+ emit(hooks, {
465
+ kind: "step_started",
466
+ stepIndex: index,
467
+ ...step.name ? { stepName: step.name } : {},
468
+ startedAt: stepStarted.toISOString()
469
+ });
470
+ let failure;
471
+ const action = await executeAction(page, step.action, { wait: step.wait });
472
+ if (!action.ok) {
473
+ failure = action.error;
474
+ } else {
475
+ receipt = action.value;
476
+ for (let expectIndex = 0; expectIndex < (step.expect?.length ?? 0); expectIndex += 1) {
477
+ const condition = step.expect[expectIndex];
478
+ const result = await awaitCondition(page, condition, { timeoutMs: EXPECT_TIMEOUT_MS });
479
+ if (!result.ok) {
480
+ failure = {
481
+ ...result.error,
482
+ message: `Step expectation ${expectIndex + 1} (${condition.kind}) failed: ${result.error.message}`,
483
+ details: {
484
+ ...result.error.details,
485
+ condition,
486
+ expectIndex
487
+ }
488
+ };
489
+ break;
490
+ }
491
+ }
492
+ }
493
+ if (failure) {
494
+ if (scenario.evidence?.screenshot !== "off") {
495
+ try {
496
+ const screenshot = await captureScreenshot(page, hooks, index, step.name, "failure");
497
+ if (screenshot) {
498
+ stepEvidence.push(screenshot);
499
+ evidence.push(screenshot);
500
+ }
501
+ } catch (error) {
502
+ failure = {
503
+ ...failure,
504
+ details: {
505
+ ...failure.details,
506
+ screenshotError: error instanceof Error ? error.message : String(error)
507
+ }
508
+ };
509
+ }
510
+ }
511
+ const durationMs2 = Date.now() - stepStarted.getTime();
512
+ emit(hooks, {
513
+ kind: "step_failed",
514
+ stepIndex: index,
515
+ ...step.name ? { stepName: step.name } : {},
516
+ error: failure,
517
+ durationMs: durationMs2,
518
+ evidence: stepEvidence
519
+ });
520
+ const completed2 = /* @__PURE__ */ new Date();
521
+ emit(hooks, {
522
+ kind: "scenario_completed",
523
+ stepIndex: index,
524
+ ...step.name ? { stepName: step.name } : {},
525
+ ...receipt ? { receipt } : {},
526
+ error: failure,
527
+ startedAt: started.toISOString(),
528
+ completedAt: completed2.toISOString(),
529
+ durationMs: completed2.getTime() - started.getTime(),
530
+ success: false
531
+ });
532
+ return automationError(failure.code, failure.message, {
533
+ requiredAction: failure.requiredAction,
534
+ details: {
535
+ ...failure.details,
536
+ stepIndex: index,
537
+ ...step.name ? { stepName: step.name } : {},
538
+ receipts,
539
+ steps,
540
+ evidence,
541
+ console: consoleEntries
542
+ }
543
+ });
544
+ }
545
+ if (scenario.evidence?.screenshot === "always") {
546
+ try {
547
+ const screenshot = await captureScreenshot(page, hooks, index, step.name, "completed");
548
+ if (screenshot) {
549
+ stepEvidence.push(screenshot);
550
+ evidence.push(screenshot);
551
+ }
552
+ } catch (error) {
553
+ const screenshotFailure = classifyThrown(error, "Scenario evidence screenshot failed.");
554
+ emit(hooks, {
555
+ kind: "step_failed",
556
+ stepIndex: index,
557
+ ...step.name ? { stepName: step.name } : {},
558
+ error: screenshotFailure,
559
+ durationMs: Date.now() - stepStarted.getTime(),
560
+ evidence: stepEvidence
561
+ });
562
+ const completed2 = /* @__PURE__ */ new Date();
563
+ emit(hooks, {
564
+ kind: "scenario_completed",
565
+ stepIndex: index,
566
+ ...step.name ? { stepName: step.name } : {},
567
+ receipt,
568
+ error: screenshotFailure,
569
+ startedAt: started.toISOString(),
570
+ completedAt: completed2.toISOString(),
571
+ durationMs: completed2.getTime() - started.getTime(),
572
+ success: false
573
+ });
574
+ return automationError(screenshotFailure.code, screenshotFailure.message, {
575
+ details: {
576
+ ...screenshotFailure.details,
577
+ stepIndex: index,
578
+ receipts,
579
+ steps,
580
+ evidence,
581
+ console: consoleEntries
582
+ }
583
+ });
584
+ }
585
+ }
586
+ const durationMs = Date.now() - stepStarted.getTime();
587
+ receipts.push(receipt);
588
+ const stepReport = {
589
+ index,
590
+ ...step.name ? { name: step.name } : {},
591
+ startedAt: stepStarted.toISOString(),
592
+ durationMs,
593
+ receipt,
594
+ evidence: stepEvidence
595
+ };
596
+ steps.push(stepReport);
597
+ emit(hooks, {
598
+ kind: "step_completed",
599
+ stepIndex: index,
600
+ ...step.name ? { stepName: step.name } : {},
601
+ receipt,
602
+ durationMs,
603
+ evidence: stepEvidence
604
+ });
605
+ }
606
+ const completed = /* @__PURE__ */ new Date();
607
+ const report = {
608
+ startedAt: started.toISOString(),
609
+ completedAt: completed.toISOString(),
610
+ durationMs: completed.getTime() - started.getTime(),
611
+ success: true,
612
+ receipts,
613
+ steps,
614
+ evidence,
615
+ console: consoleEntries
616
+ };
617
+ const lastStep = scenario.steps.at(-1);
618
+ emit(hooks, {
619
+ kind: "scenario_completed",
620
+ ...lastStep ? {
621
+ stepIndex: scenario.steps.length - 1,
622
+ ...lastStep.name ? { stepName: lastStep.name } : {},
623
+ receipt: receipts.at(-1)
624
+ } : {},
625
+ startedAt: report.startedAt,
626
+ completedAt: report.completedAt,
627
+ durationMs: report.durationMs,
628
+ success: true
629
+ });
630
+ return automationOk(report);
631
+ } catch (error) {
632
+ const failure = classifyThrown(error, "Scenario runner failed unexpectedly.");
633
+ const completed = /* @__PURE__ */ new Date();
634
+ emit(hooks, {
635
+ kind: "scenario_completed",
636
+ error: failure,
637
+ startedAt: started.toISOString(),
638
+ completedAt: completed.toISOString(),
639
+ durationMs: completed.getTime() - started.getTime(),
640
+ success: false
641
+ });
642
+ return automationError(failure.code, failure.message, {
643
+ details: { ...failure.details, receipts, steps, evidence, console: consoleEntries }
644
+ });
645
+ } finally {
646
+ detach();
647
+ }
648
+ }
649
+ async function runScenario(connection, scenario, hooks) {
650
+ const entries = await discoverTargets(connection.browser);
651
+ const selected = selectTarget(entries, scenario.target?.windowId);
652
+ if (!selected.ok) return selected;
653
+ return runScenarioOnPage(selected.value.page, scenario, hooks);
654
+ }
655
+ export {
656
+ parseScenario,
657
+ runScenario,
658
+ runScenarioOnPage
659
+ };
660
+ //# sourceMappingURL=scenario.js.map