waygraph 0.15.53 → 0.16.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.
- package/README.md +8 -3
- package/bin/waygraph +2 -2
- package/dist/analysis/check.d.ts +38 -0
- package/dist/analysis/check.js +87 -0
- package/dist/analysis/coverage-gap.d.ts +1 -1
- package/dist/analysis/coverage-gap.js +14 -37
- package/dist/analysis/flow-source.d.ts +9 -0
- package/dist/analysis/flow-source.js +25 -0
- package/dist/analysis/graph.d.ts +13 -14
- package/dist/analysis/graph.js +48 -371
- package/dist/analysis/map-check.js +4 -39
- package/dist/analysis/practices-check.d.ts +1 -1
- package/dist/analysis/practices-check.js +24 -45
- package/dist/cli/args.d.ts +23 -0
- package/dist/cli/args.js +20 -0
- package/dist/{cli.d.ts → cli/cli.d.ts} +0 -1
- package/dist/{cli.js → cli/cli.js} +10 -9
- package/dist/{commands → cli/commands}/agent-dive-scaffold.js +35 -64
- package/dist/cli/commands/agent-dive.js +42 -0
- package/dist/{commands → cli/commands}/check.d.ts +0 -1
- package/dist/cli/commands/check.js +104 -0
- package/dist/cli/commands/codemod-checkpoints.d.ts +18 -0
- package/dist/cli/commands/codemod-checkpoints.js +186 -0
- package/dist/cli/commands/codemod-flows.d.ts +18 -0
- package/dist/cli/commands/codemod-flows.js +284 -0
- package/dist/cli/commands/codemod-stubs.d.ts +10 -0
- package/dist/cli/commands/codemod-stubs.js +187 -0
- package/dist/{commands → cli/commands}/extensions.js +5 -4
- package/dist/{commands → cli/commands}/init.js +1 -2
- package/dist/{commands → cli/commands}/list.js +9 -7
- package/dist/cli/commands/manifest.d.ts +2 -0
- package/dist/cli/commands/manifest.js +20 -0
- package/dist/cli/commands/map.js +57 -0
- package/dist/{commands → cli/commands}/run.d.ts +0 -1
- package/dist/cli/commands/run.js +64 -0
- package/dist/{commands → cli/commands}/session.js +61 -88
- package/dist/{commands → cli/commands}/test.js +11 -14
- package/dist/cli/commands/traverse.js +105 -0
- package/dist/{commands → cli/commands}/try.js +29 -25
- package/dist/{commands → cli/commands}/upgrade.js +40 -4
- package/dist/cli/flags.d.ts +193 -16
- package/dist/cli/flags.js +179 -234
- package/dist/cli/run-chain.d.ts +1 -0
- package/dist/cli/run-chain.js +42 -7
- package/dist/cli/usage.d.ts +1 -1
- package/dist/cli/usage.js +21 -53
- package/dist/cli/util.d.ts +2 -2
- package/dist/cli/util.js +2 -3
- package/dist/{highlights → demo/narration}/css.d.ts +1 -1
- package/dist/{highlights → demo/narration}/css.js +2 -3
- package/dist/{highlights → demo/narration}/demo-pace.d.ts +7 -11
- package/dist/{highlights → demo/narration}/demo-pace.js +9 -11
- package/dist/{highlights → demo/narration}/device.d.ts +4 -2
- package/dist/{highlights → demo/narration}/device.js +3 -1
- package/dist/demo/narration/merge.d.ts +8 -0
- package/dist/demo/narration/merge.js +71 -0
- package/dist/{highlights/run-phase.d.ts → demo/narration/narration.d.ts} +10 -14
- package/dist/{highlights/run-phase.js → demo/narration/narration.js} +25 -94
- package/dist/{highlights → demo/narration}/shorthand.d.ts +1 -1
- package/dist/demo/narration/stub-ctx.d.ts +8 -0
- package/dist/demo/narration/stub-ctx.js +164 -0
- package/dist/{highlights → demo/narration}/style.d.ts +1 -7
- package/dist/{highlights → demo/narration}/style.js +1 -41
- package/dist/{highlights → demo/narration}/todo-dock.d.ts +3 -3
- package/dist/{highlights → demo/narration}/todo-dock.js +13 -30
- package/dist/demo/overlay/auto-chrome.d.ts +7 -0
- package/dist/demo/overlay/auto-chrome.js +97 -0
- package/dist/{session/overlay-beacon.d.ts → demo/overlay/beacon.d.ts} +7 -0
- package/dist/{session/overlay-beacon.js → demo/overlay/beacon.js} +5 -0
- package/dist/demo/overlay/cursor.d.ts +12 -0
- package/dist/demo/overlay/cursor.js +142 -0
- package/dist/demo/overlay/device-stage.d.ts +13 -0
- package/dist/demo/overlay/device-stage.js +396 -0
- package/dist/demo/overlay/inpage/banner.d.ts +1 -0
- package/dist/demo/overlay/inpage/banner.js +160 -0
- package/dist/demo/overlay/inpage/caption.d.ts +2 -0
- package/dist/demo/overlay/inpage/caption.js +24 -0
- package/dist/demo/overlay/inpage/core.d.ts +1 -0
- package/dist/demo/overlay/inpage/core.js +345 -0
- package/dist/demo/overlay/inpage/device-chip.d.ts +1 -0
- package/dist/demo/overlay/inpage/device-chip.js +191 -0
- package/dist/demo/overlay/inpage/network.d.ts +9 -0
- package/dist/demo/overlay/inpage/network.js +200 -0
- package/dist/demo/overlay/inpage/panel-chrome.d.ts +1 -0
- package/dist/demo/overlay/inpage/panel-chrome.js +203 -0
- package/dist/demo/overlay/inpage/stamp.d.ts +1 -0
- package/dist/demo/overlay/inpage/stamp.js +46 -0
- package/dist/demo/overlay/inpage/swipe-zoom.d.ts +1 -0
- package/dist/demo/overlay/inpage/swipe-zoom.js +220 -0
- package/dist/demo/overlay/inpage/todos.d.ts +1 -0
- package/dist/demo/overlay/inpage/todos.js +294 -0
- package/dist/demo/overlay/locator-theater.d.ts +25 -0
- package/dist/demo/overlay/locator-theater.js +76 -0
- package/dist/demo/overlay/network-capture.d.ts +22 -0
- package/dist/demo/overlay/network-capture.js +127 -0
- package/dist/demo/overlay/overlay-css.d.ts +3 -0
- package/dist/demo/overlay/overlay-css.js +369 -0
- package/dist/demo/overlay/overlay-stage.d.ts +23 -0
- package/dist/demo/overlay/overlay-stage.js +106 -0
- package/dist/demo/overlay/overlay.d.ts +10 -0
- package/dist/demo/overlay/overlay.js +89 -0
- package/dist/{pilot-overlay/overlay-fixtures.d.ts → demo/overlay/phase-fixtures.d.ts} +2 -2
- package/dist/{pilot-overlay/overlay-fixtures.js → demo/overlay/phase-fixtures.js} +2 -2
- package/dist/{pilot-overlay/action-ring.js → demo/overlay/pilot/actions.js} +2 -1
- package/dist/{pilot-overlay → demo/overlay/pilot}/fixtures.d.ts +6 -5
- package/dist/{pilot-overlay → demo/overlay/pilot}/fixtures.js +19 -18
- package/dist/{pilot-overlay → demo/overlay/pilot}/shell.d.ts +2 -2
- package/dist/{pilot-overlay → demo/overlay/pilot}/shell.js +13 -22
- package/dist/demo/overlay/reattach.d.ts +7 -0
- package/dist/demo/overlay/reattach.js +23 -0
- package/dist/demo/overlay/rings.d.ts +33 -0
- package/dist/demo/overlay/rings.js +448 -0
- package/dist/{ui → demo/overlay/ui}/components/ring.js +2 -2
- package/dist/{ui → demo/overlay/ui}/overlay.css +4 -4
- package/dist/{ui → demo/overlay/ui}/shadow.d.ts +1 -1
- package/dist/{ui → demo/overlay/ui}/shadow.js +39 -2
- package/dist/demo/stepper/after.d.ts +3 -0
- package/dist/demo/stepper/after.js +113 -0
- package/dist/demo/stepper/banner-log.d.ts +37 -0
- package/dist/demo/stepper/banner-log.js +63 -0
- package/dist/demo/stepper/before.d.ts +4 -0
- package/dist/demo/stepper/before.js +110 -0
- package/dist/demo/stepper/demo-log.d.ts +31 -0
- package/dist/demo/stepper/demo-log.js +309 -0
- package/dist/demo/stepper/gate.d.ts +11 -0
- package/dist/demo/stepper/gate.js +78 -0
- package/dist/demo/stepper/interaction-patch.d.ts +3 -0
- package/dist/demo/stepper/interaction-patch.js +323 -0
- package/dist/demo/stepper/pacing.d.ts +21 -0
- package/dist/demo/stepper/pacing.js +23 -0
- package/dist/demo/stepper/slides.d.ts +11 -0
- package/dist/demo/stepper/slides.js +233 -0
- package/dist/demo/stepper/step-panels.d.ts +21 -0
- package/dist/demo/stepper/step-panels.js +589 -0
- package/dist/demo/stepper/stepper.d.ts +24 -0
- package/dist/demo/stepper/stepper.js +122 -0
- package/dist/demo/stepper/teardown.d.ts +48 -0
- package/dist/demo/stepper/teardown.js +179 -0
- package/dist/demo/stepper/todo-advance.d.ts +14 -0
- package/dist/demo/stepper/todo-advance.js +110 -0
- package/dist/demo/stepper/view.d.ts +68 -0
- package/dist/demo/stepper/view.js +31 -0
- package/dist/demo/types.d.ts +17 -0
- package/dist/demo/verbose-log.js +15 -0
- package/dist/{types.d.ts → engine/block/block.d.ts} +106 -91
- package/dist/{core → engine/block}/block.js +10 -53
- package/dist/{core → engine/block}/compose.d.ts +10 -7
- package/dist/{core → engine/block}/compose.js +1 -1
- package/dist/{core/blocks → engine/block/kinds}/api.d.ts +17 -12
- package/dist/{core/blocks → engine/block/kinds}/api.js +26 -18
- package/dist/{core/blocks → engine/block/kinds}/effect.d.ts +13 -18
- package/dist/engine/block/kinds/effect.js +17 -0
- package/dist/{core/blocks → engine/block/kinds}/method.d.ts +19 -29
- package/dist/{core/blocks → engine/block/kinds}/method.js +7 -21
- package/dist/{core/blocks → engine/block/kinds}/nav.d.ts +22 -31
- package/dist/{core/blocks → engine/block/kinds}/nav.js +6 -12
- package/dist/{core/blocks → engine/block/kinds}/page.d.ts +15 -20
- package/dist/{core/blocks → engine/block/kinds}/page.js +5 -7
- package/dist/engine/checkpoint/checkpoint.d.ts +22 -0
- package/dist/engine/checkpoint/checkpoint.js +8 -0
- package/dist/engine/checkpoint/route.d.ts +28 -0
- package/dist/engine/checkpoint/route.js +28 -0
- package/dist/{core → engine}/config.d.ts +7 -2
- package/dist/engine/config.js +6 -0
- package/dist/engine/engine.d.ts +45 -0
- package/dist/{core → engine}/engine.js +6 -10
- package/dist/engine/env.d.ts +59 -0
- package/dist/engine/env.js +83 -0
- package/dist/{errors.d.ts → engine/errors.d.ts} +23 -22
- package/dist/{errors.js → engine/errors.js} +22 -22
- package/dist/{core → engine/flow}/branch-regression.d.ts +8 -7
- package/dist/{core → engine/flow}/branch-regression.js +4 -3
- package/dist/engine/flow/flow.d.ts +162 -0
- package/dist/engine/flow/flow.js +244 -0
- package/dist/{core → engine/flow}/map-builder.d.ts +42 -40
- package/dist/{core → engine/flow}/map-builder.js +46 -48
- package/dist/{core → engine}/locate.d.ts +1 -1
- package/dist/{core → engine}/locate.js +1 -2
- package/dist/{mem-stub.d.ts → engine/mem/mem-stub.d.ts} +9 -8
- package/dist/{mem-stub.js → engine/mem/mem-stub.js} +2 -2
- package/dist/{mem-page.d.ts → engine/mem/mem.d.ts} +1 -1
- package/dist/{mem-page.js → engine/mem/mem.js} +2 -1
- package/dist/engine/page-gone.d.ts +5 -0
- package/dist/engine/page-gone.js +20 -0
- package/dist/engine/run/connect.d.ts +28 -0
- package/dist/{types.js → engine/run/connect.js} +11 -10
- package/dist/engine/run/events.d.ts +67 -0
- package/dist/engine/run/events.js +90 -0
- package/dist/engine/run/hooks.d.ts +16 -0
- package/dist/engine/run/hooks.js +8 -0
- package/dist/engine/run/launch.d.ts +13 -0
- package/dist/engine/run/launch.js +27 -0
- package/dist/{core/run-graph.d.ts → engine/run/run.d.ts} +9 -11
- package/dist/{core/run-graph.js → engine/run/run.js} +22 -11
- package/dist/engine/stub/pace.d.ts +12 -0
- package/dist/engine/stub/pace.js +2 -0
- package/dist/engine/stub/ring.d.ts +130 -0
- package/dist/engine/stub/ring.js +41 -0
- package/dist/engine/stub/stub.d.ts +268 -0
- package/dist/engine/stub/stub.js +1 -0
- package/dist/engine/stub/todos.d.ts +104 -0
- package/dist/engine/stub/todos.js +2 -0
- package/dist/engine/stub/viewport.d.ts +26 -0
- package/dist/engine/stub/viewport.js +2 -0
- package/dist/{trait.d.ts → engine/trait/trait.d.ts} +1 -1
- package/dist/index.d.ts +84 -36
- package/dist/index.js +44 -19
- package/dist/{session/auto-explore-run.d.ts → live/auto/auto.d.ts} +10 -16
- package/dist/{session/auto-explore-run.js → live/auto/auto.js} +164 -248
- package/dist/{session/auto-explore.d.ts → live/auto/explore.d.ts} +4 -14
- package/dist/{session/auto-explore.js → live/auto/explore.js} +21 -127
- package/dist/{auto-session/session.d.ts → live/auto-session/auto-session.d.ts} +1 -1
- package/dist/{auto-session/session.js → live/auto-session/auto-session.js} +27 -24
- package/dist/{auto-session → live/auto-session}/helpers.d.ts +16 -5
- package/dist/{auto-session → live/auto-session}/helpers.js +1 -1
- package/dist/{session/auto-session-ipc.d.ts → live/auto-session/ipc.d.ts} +7 -5
- package/dist/{session/auto-session-ipc.js → live/auto-session/ipc.js} +31 -16
- package/dist/{session/browser.d.ts → live/auto-session/start.d.ts} +1 -2
- package/dist/{session/browser.js → live/auto-session/start.js} +2 -3
- package/dist/{pilot-overlay → live/pilot}/panel.d.ts +1 -1
- package/dist/{pilot-overlay → live/pilot}/panel.js +23 -31
- package/dist/{session → live/pilot}/pilot.d.ts +4 -3
- package/dist/{session → live/pilot}/pilot.js +4 -4
- package/dist/{traverse → live/traverse}/coverage.d.ts +4 -0
- package/dist/{traverse → live/traverse}/coverage.js +3 -0
- package/dist/{traverse → live/traverse}/lease.d.ts +1 -0
- package/dist/{traverse → live/traverse}/lease.js +1 -0
- package/dist/{traverse/run.d.ts → live/traverse/traverse.d.ts} +4 -1
- package/dist/{traverse/run.js → live/traverse/traverse.js} +26 -43
- package/dist/manifest/manifest.d.ts +52 -0
- package/dist/manifest/manifest.js +93 -0
- package/dist/manifest/map-imports.d.ts +7 -0
- package/dist/manifest/map-imports.js +22 -0
- package/dist/manifest/maps.d.ts +33 -0
- package/dist/manifest/maps.js +62 -0
- package/dist/manifest/pack.d.ts +21 -0
- package/dist/manifest/pack.js +109 -0
- package/dist/manifest/project.d.ts +60 -0
- package/dist/manifest/project.js +101 -0
- package/dist/{session/block-inject.js → manifest/roots.js} +1 -18
- package/dist/manifest/scan.d.ts +19 -0
- package/dist/manifest/scan.js +57 -0
- package/dist/{blocks-select.d.ts → manifest/select.d.ts} +3 -0
- package/dist/{blocks-select.js → manifest/select.js} +2 -0
- package/dist/manifest/source.d.ts +23 -0
- package/dist/manifest/source.js +86 -0
- package/dist/runner/mode.d.ts +71 -0
- package/dist/runner/mode.js +1 -0
- package/dist/runner/modes/branches.d.ts +5 -0
- package/dist/runner/modes/branches.js +37 -0
- package/dist/runner/modes/demo.d.ts +3 -0
- package/dist/runner/modes/demo.js +13 -0
- package/dist/runner/modes/report.d.ts +2 -0
- package/dist/runner/modes/report.js +54 -0
- package/dist/runner/modes/run.d.ts +2 -0
- package/dist/runner/modes/run.js +3 -0
- package/dist/runner/options.d.ts +31 -0
- package/dist/runner/options.js +42 -0
- package/dist/runner/plan/find.d.ts +18 -0
- package/dist/runner/plan/find.js +65 -0
- package/dist/runner/plan/plan.d.ts +11 -0
- package/dist/runner/plan/plan.js +97 -0
- package/dist/runner/plan/seed-mem.d.ts +12 -0
- package/dist/runner/plan/seed-mem.js +98 -0
- package/dist/runner/plan/spec.d.ts +5 -0
- package/dist/runner/plan/spec.js +17 -0
- package/dist/runner/play-steps.d.ts +2 -0
- package/dist/runner/play-steps.js +59 -0
- package/dist/runner/runner.d.ts +4 -0
- package/dist/runner/runner.js +64 -0
- package/dist/runner/session.d.ts +9 -0
- package/dist/runner/session.js +87 -0
- package/dist/{browser.js → runtime/browser.js} +4 -2
- package/dist/{env-file.js → runtime/env-file.js} +7 -12
- package/dist/{extensions.d.ts → runtime/extensions.d.ts} +2 -5
- package/dist/{extensions.js → runtime/extensions.js} +3 -1
- package/dist/runtime/full-launch.d.ts +1 -0
- package/dist/runtime/full-launch.js +34 -0
- package/dist/runtime/global-flag.d.ts +5 -0
- package/dist/runtime/global-flag.js +18 -0
- package/dist/{playwright-config.d.ts → runtime/playwright-config.d.ts} +1 -1
- package/dist/{playwright.config.js → runtime/playwright.config.js} +3 -2
- package/dist/runtime/run-log.d.ts +2 -0
- package/dist/runtime/run-log.js +17 -0
- package/dist/{video-dir.js → runtime/video-dir.js} +3 -2
- package/dist/{config.d.ts → runtime/waygraph-config.d.ts} +8 -9
- package/dist/{config.js → runtime/waygraph-config.js} +21 -51
- package/dist/{webserver.js → runtime/webserver.js} +5 -30
- package/examples/routed-demo/config/waygraph.config.ts +20 -0
- package/examples/routed-demo/package.json +1 -4
- package/examples/routed-demo/scripts/fixture-server.mjs +1 -1
- package/examples/routed-demo/src/flows/routed-demo-map.flow.ts +2 -4
- package/examples/routed-demo/src/flows/routed-demo.flow.ts +2 -3
- package/examples/routed-demo/src/map/(app_base)/dashboard/_methods/click-widget.block.ts +5 -4
- package/examples/routed-demo/src/map/(app_base)/dashboard/_nav.block.ts +3 -3
- package/examples/routed-demo/src/map/(app_base)/dashboard/_page.block.ts +3 -3
- package/examples/routed-demo/src/map/(external)/docs/_nav.block.ts +3 -3
- package/examples/routed-demo/src/map/(external)/docs/_page.block.ts +3 -3
- package/examples/routed-demo/src/states/routed-demo.states.ts +5 -3
- package/examples/routed-demo/tests/routed-demo.spec.ts +4 -4
- package/examples/routed-demo/tsconfig.json +1 -1
- package/examples/saucedemo/README.md +11 -12
- package/examples/saucedemo/config/waygraph.config.ts +17 -0
- package/examples/saucedemo/docs/CONVENTION.md +5 -7
- package/examples/saucedemo/docs/HELPERS.md +12 -12
- package/examples/saucedemo/package-lock.json +10 -3
- package/examples/saucedemo/package.json +12 -29
- package/examples/saucedemo/src/blocks/SITE-MAP.md +0 -1
- package/examples/saucedemo/src/blocks/saucedemo-web/NAV.md +1 -5
- package/examples/saucedemo/src/blocks/saucedemo-web/cart/nav-cart.block.ts +3 -52
- package/examples/saucedemo/src/blocks/saucedemo-web/cart/nav-checkout-info.block.ts +3 -3
- package/examples/saucedemo/src/blocks/saucedemo-web/checkout-step-one/methods/fill-first-name.method.block.ts +5 -4
- package/examples/saucedemo/src/blocks/saucedemo-web/checkout-step-one/methods/fill-last-name.method.block.ts +5 -4
- package/examples/saucedemo/src/blocks/saucedemo-web/checkout-step-one/methods/fill-postal-code.method.block.ts +5 -4
- package/examples/saucedemo/src/blocks/saucedemo-web/checkout-step-one/methods/submit-checkout-info.method.block.ts +5 -4
- package/examples/saucedemo/src/blocks/saucedemo-web/checkout-step-two/methods/finish-order.method.block.ts +21 -27
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory/inventory.page.block.ts +3 -9
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory/methods/add-all-to-cart.method.block.ts +4 -6
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory/methods/add-to-cart.effect.block.ts +10 -76
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory/methods/remove-all-from-cart.method.block.ts +4 -6
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory/methods/remove-from-cart.effect.block.ts +4 -3
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory/nav-item-detail.block.ts +3 -3
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory-item/nav-back-to-inventory.block.ts +3 -3
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory-item/nav-back-to-products.block.ts +3 -3
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory-item/nav-continue-shopping.block.ts +3 -3
- package/examples/saucedemo/src/blocks/saucedemo-web/methods/fill-password.method.block.ts +5 -29
- package/examples/saucedemo/src/blocks/saucedemo-web/methods/fill-username.method.block.ts +5 -48
- package/examples/saucedemo/src/blocks/saucedemo-web/methods/submit-login.method.block.ts +13 -77
- package/examples/saucedemo/src/blocks/saucedemo-web/methods/submit-logout.method.block.ts +5 -4
- package/examples/saucedemo/src/blocks/saucedemo-web/nav-login.block.ts +3 -3
- package/examples/saucedemo/src/flows/api-demo.flow.ts +26 -18
- package/examples/saucedemo/src/flows/cart-bulk.flow.ts +19 -14
- package/examples/saucedemo/src/flows/cart-continue.flow.ts +10 -8
- package/examples/saucedemo/src/flows/cart-mem.flow.ts +7 -7
- package/examples/saucedemo/src/flows/catalog-logout.flow.ts +13 -8
- package/examples/saucedemo/src/flows/checkout-then-browse-again.flow.ts +26 -48
- package/examples/saucedemo/src/flows/checkout.flow.ts +70 -86
- package/examples/saucedemo/src/flows/device-showcase.flow.ts +24 -25
- package/examples/saucedemo/src/flows/login.flow.ts +11 -18
- package/examples/saucedemo/src/flows/mem-stub-demo.flow.ts +9 -20
- package/examples/saucedemo/src/flows/shop.flow.ts +15 -20
- package/examples/saucedemo/src/flows/smoke.flow.ts +12 -27
- package/examples/saucedemo/src/flows/stub-on-error.flow.ts +24 -43
- package/examples/saucedemo/src/flows/viewer-blocked.flow.ts +26 -34
- package/examples/saucedemo/src/states/checkout.mem-stubs.ts +11 -0
- package/examples/saucedemo/src/states/checkout.states.ts +21 -11
- package/examples/saucedemo/src/stubs/device-showcase.ts +191 -0
- package/examples/saucedemo/src/stubs/login.ts +37 -0
- package/examples/saucedemo/tests/auto-graph.spec.ts +4 -12
- package/examples/saucedemo/tests/chain-flow-episodes.spec.ts +7 -9
- package/examples/saucedemo/tests/submit-login-branch.spec.ts +18 -5
- package/package.json +12 -7
- package/templates/agents/waygraph-planner.agent.md +2 -2
- package/templates/quickstart/README.md +4 -7
- package/templates/quickstart/config/waygraph.config.ts +17 -0
- package/templates/quickstart/docs/CONVENTION.md +5 -6
- package/templates/quickstart/docs/HELPERS.md +11 -9
- package/templates/quickstart/package.json +14 -17
- package/templates/quickstart/src/blocks/SITE-MAP.md +13 -3
- package/templates/quickstart/src/blocks/saucedemo-web/NAV.md +1 -5
- package/templates/quickstart/src/blocks/saucedemo-web/cart/nav-cart.block.ts +3 -52
- package/templates/quickstart/src/blocks/saucedemo-web/cart/nav-checkout-info.block.ts +3 -3
- package/templates/quickstart/src/blocks/saucedemo-web/checkout-step-one/methods/fill-first-name.method.block.ts +5 -4
- package/templates/quickstart/src/blocks/saucedemo-web/checkout-step-one/methods/fill-last-name.method.block.ts +5 -4
- package/templates/quickstart/src/blocks/saucedemo-web/checkout-step-one/methods/fill-postal-code.method.block.ts +5 -4
- package/templates/quickstart/src/blocks/saucedemo-web/checkout-step-one/methods/submit-checkout-info.method.block.ts +5 -4
- package/templates/quickstart/src/blocks/saucedemo-web/checkout-step-two/methods/finish-order.method.block.ts +21 -27
- package/templates/quickstart/src/blocks/saucedemo-web/inventory/inventory.page.block.ts +3 -9
- package/templates/quickstart/src/blocks/saucedemo-web/inventory/methods/add-all-to-cart.method.block.ts +4 -6
- package/templates/quickstart/src/blocks/saucedemo-web/inventory/methods/add-to-cart.effect.block.ts +10 -76
- package/templates/quickstart/src/blocks/saucedemo-web/inventory/methods/remove-all-from-cart.method.block.ts +4 -6
- package/templates/quickstart/src/blocks/saucedemo-web/inventory/methods/remove-from-cart.effect.block.ts +4 -3
- package/templates/quickstart/src/blocks/saucedemo-web/inventory/nav-item-detail.block.ts +3 -3
- package/templates/quickstart/src/blocks/saucedemo-web/inventory-item/nav-back-to-inventory.block.ts +3 -3
- package/templates/quickstart/src/blocks/saucedemo-web/inventory-item/nav-back-to-products.block.ts +3 -3
- package/templates/quickstart/src/blocks/saucedemo-web/inventory-item/nav-continue-shopping.block.ts +3 -3
- package/templates/quickstart/src/blocks/saucedemo-web/methods/fill-password.method.block.ts +5 -29
- package/templates/quickstart/src/blocks/saucedemo-web/methods/fill-username.method.block.ts +5 -48
- package/templates/quickstart/src/blocks/saucedemo-web/methods/submit-login.method.block.ts +13 -77
- package/templates/quickstart/src/blocks/saucedemo-web/methods/submit-logout.method.block.ts +5 -4
- package/templates/quickstart/src/blocks/saucedemo-web/nav-login.block.ts +3 -3
- package/templates/quickstart/src/flows/api-demo.flow.ts +45 -0
- package/templates/quickstart/src/flows/cart-bulk.flow.ts +19 -14
- package/templates/quickstart/src/flows/cart-continue.flow.ts +10 -8
- package/templates/quickstart/src/flows/cart-mem.flow.ts +7 -7
- package/templates/quickstart/src/flows/catalog-logout.flow.ts +13 -8
- package/templates/quickstart/src/flows/checkout-then-browse-again.flow.ts +26 -48
- package/templates/quickstart/src/flows/checkout.flow.ts +70 -63
- package/templates/quickstart/src/flows/device-showcase.flow.ts +24 -25
- package/templates/quickstart/src/flows/login.flow.ts +11 -18
- package/templates/quickstart/src/flows/mem-stub-demo.flow.ts +12 -0
- package/templates/quickstart/src/flows/shop.flow.ts +15 -20
- package/templates/quickstart/src/flows/smoke.flow.ts +12 -27
- package/templates/quickstart/src/flows/stub-on-error.flow.ts +31 -0
- package/templates/quickstart/src/flows/viewer-blocked.flow.ts +26 -34
- package/templates/quickstart/src/states/checkout.mem-stubs.ts +11 -0
- package/templates/quickstart/src/states/checkout.states.ts +21 -11
- package/templates/quickstart/src/stubs/device-showcase.ts +191 -0
- package/templates/quickstart/src/stubs/login.ts +37 -0
- package/templates/quickstart/tests/chain-flow.spec.ts +7 -10
- package/templates/scaffold/README.md +2 -1
- package/templates/scaffold/STRUCTURE.md +5 -4
- package/templates/scaffold/config/waygraph.config.ts +1 -0
- package/templates/scaffold/gitignore +1 -0
- package/templates/scaffold/src/flows/README.md +2 -2
- package/templates/scaffold/src/map/(app_base)/docs/_nav.block.ts +3 -3
- package/templates/scaffold/src/map/(app_base)/docs/_page.block.ts +3 -3
- package/templates/scaffold/src/map/(app_base)/home/_methods/add-item.effect.block.ts +4 -4
- package/templates/scaffold/src/map/(app_base)/home/_methods/assert-hello.method.block.ts +3 -3
- package/templates/scaffold/src/map/(app_base)/home/_methods/assert-item-added.method.block.ts +3 -3
- package/templates/scaffold/src/map/(app_base)/home/_methods/clear-cart.method.block.ts +5 -4
- package/templates/scaffold/src/map/(app_base)/home/_methods/remove-item.effect.block.ts +4 -4
- package/templates/scaffold/src/map/(app_base)/home/_nav.block.ts +3 -3
- package/templates/scaffold/src/map/(app_base)/home/_page.block.ts +3 -3
- package/templates/scaffold/src/map/(app_base)/home/nav-verification-link.block.ts +4 -4
- package/templates/scaffold/src/map/(external)/hoppscotch/_keys.ts +21 -0
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/assert-response-body.method.block.ts +4 -4
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/assert-response-header.method.block.ts +4 -4
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/assert-status.method.block.ts +4 -4
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/pick-extension-interceptor.method.block.ts +5 -4
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/read-response-body.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/read-response-headers.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/send-request.method.block.ts +5 -4
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/set-bearer-token.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/set-headers.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/set-json-body.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/set-method.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/set-query-params.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/set-url.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_nav.block.ts +3 -3
- package/templates/scaffold/src/map/(external)/hoppscotch/_page.block.ts +3 -3
- package/templates/scaffold/src/map/(external)/hoppscotch/_states.ts +6 -0
- package/templates/scaffold/src/map/(external)/hoppscotch/settings/_nav.block.ts +3 -3
- package/templates/scaffold/src/map/(external)/mailpit/_keys.ts +13 -0
- package/templates/scaffold/src/map/(external)/mailpit/_methods/assert-email-content.method.block.ts +4 -4
- package/templates/scaffold/src/map/(external)/mailpit/_methods/assert-email-received.method.block.ts +4 -4
- package/templates/scaffold/src/map/(external)/mailpit/_methods/extract-email-link.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/mailpit/_methods/open-message.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/mailpit/_nav.block.ts +3 -3
- package/templates/scaffold/src/map/(external)/mailpit/_page.block.ts +3 -3
- package/templates/scaffold/src/map/(external)/mailpit/_states.ts +9 -0
- package/templates/scaffold/src/map/README.md +7 -0
- package/templates/scaffold/src/states/README.md +4 -1
- package/templates/scaffold/src/states/demo.mem-keys.ts +1 -29
- package/templates/scaffold/src/states/demo.states.ts +14 -20
- package/templates/scaffold/tests/hoppscotch.spec.ts +1 -11
- package/templates/scaffold/tests/mail-verify.spec.ts +2 -2
- package/templates/skills/waygraph-blind-pilot.skill.md +2 -6
- package/templates/skills/waygraph-convention.skill.md +23 -14
- package/templates/skills/waygraph-pilot.skill.md +7 -4
- package/dist/auto-session/verbose-log.js +0 -16
- package/dist/auto-session.d.ts +0 -2
- package/dist/auto-session.js +0 -3
- package/dist/cli/discover.d.ts +0 -40
- package/dist/cli/discover.js +0 -148
- package/dist/commands/agent-dive.js +0 -52
- package/dist/commands/check.js +0 -192
- package/dist/commands/map.js +0 -29
- package/dist/commands/run.js +0 -104
- package/dist/commands/traverse.js +0 -177
- package/dist/core/block.d.ts +0 -109
- package/dist/core/blocks/effect.js +0 -23
- package/dist/core/config.js +0 -17
- package/dist/core/engine.d.ts +0 -198
- package/dist/core/flow.d.ts +0 -293
- package/dist/core/flow.js +0 -432
- package/dist/core.d.ts +0 -14
- package/dist/core.js +0 -15
- package/dist/highlights/merge.d.ts +0 -8
- package/dist/highlights/merge.js +0 -173
- package/dist/highlights/stub-ctx.d.ts +0 -10
- package/dist/highlights/stub-ctx.js +0 -331
- package/dist/highlights/types.d.ts +0 -607
- package/dist/highlights.d.ts +0 -9
- package/dist/highlights.js +0 -10
- package/dist/pilot-overlay.d.ts +0 -5
- package/dist/pilot-overlay.js +0 -6
- package/dist/runner/banner-log.js +0 -63
- package/dist/runner/chain-run.js +0 -102
- package/dist/runner/cursor.js +0 -140
- package/dist/runner/demo-log.js +0 -316
- package/dist/runner/device-stage.d.ts +0 -9
- package/dist/runner/device-stage.js +0 -420
- package/dist/runner/discovery.js +0 -105
- package/dist/runner/index.js +0 -2
- package/dist/runner/inpage/banner.d.ts +0 -21
- package/dist/runner/inpage/banner.js +0 -156
- package/dist/runner/inpage/caption.d.ts +0 -3
- package/dist/runner/inpage/caption.js +0 -23
- package/dist/runner/inpage/core.d.ts +0 -4
- package/dist/runner/inpage/core.js +0 -316
- package/dist/runner/inpage/device.d.ts +0 -3
- package/dist/runner/inpage/device.js +0 -211
- package/dist/runner/inpage/network.d.ts +0 -15
- package/dist/runner/inpage/network.js +0 -217
- package/dist/runner/inpage/panel-chrome.js +0 -192
- package/dist/runner/inpage/stamp.js +0 -46
- package/dist/runner/inpage/swipe-zoom.js +0 -220
- package/dist/runner/inpage/todos.js +0 -337
- package/dist/runner/interaction-patch.js +0 -384
- package/dist/runner/main.js +0 -469
- package/dist/runner/network-capture.d.ts +0 -9
- package/dist/runner/network-capture.js +0 -126
- package/dist/runner/overlay-css.d.ts +0 -3
- package/dist/runner/overlay-css.js +0 -377
- package/dist/runner/overlay-install.js +0 -90
- package/dist/runner/overlay-stage.js +0 -110
- package/dist/runner/rings.js +0 -514
- package/dist/runner/seed-mem.js +0 -110
- package/dist/runner/slides.js +0 -278
- package/dist/runner/step-mode.js +0 -703
- package/dist/runner/step-panels.js +0 -729
- package/dist/runner/teardown.js +0 -202
- package/dist/runner/todo-dock.js +0 -142
- package/dist/session/step-overlay.d.ts +0 -37
- package/dist/session/step-overlay.js +0 -244
- package/examples/routed-demo/playwright.config.ts +0 -21
- package/examples/saucedemo/playwright.config.ts +0 -19
- package/examples/saucedemo/scripts/drive-auto-cli.mjs +0 -93
- package/examples/saucedemo/scripts/prove-add-to-cart-menu.mjs +0 -126
- package/examples/saucedemo/scripts/prove-auto-graph.mjs +0 -92
- package/examples/saucedemo/scripts/prove-wrong-login-runtime.mjs +0 -63
- package/examples/saucedemo/src/blocks/saucedemo-web/ff-owner-auth.block.ts +0 -22
- package/templates/quickstart/playwright.config.ts +0 -14
- package/templates/quickstart/scripts/drive-auto-cli.mjs +0 -93
- package/templates/quickstart/src/blocks/saucedemo-web/ff-owner-auth.block.ts +0 -22
- /package/dist/{commands → cli/commands}/agent-dive-scaffold.d.ts +0 -0
- /package/dist/{commands → cli/commands}/agent-dive.d.ts +0 -0
- /package/dist/{commands → cli/commands}/extensions.d.ts +0 -0
- /package/dist/{commands → cli/commands}/init.d.ts +0 -0
- /package/dist/{commands → cli/commands}/list.d.ts +0 -0
- /package/dist/{commands → cli/commands}/map.d.ts +0 -0
- /package/dist/{commands → cli/commands}/session.d.ts +0 -0
- /package/dist/{commands → cli/commands}/test.d.ts +0 -0
- /package/dist/{commands → cli/commands}/traverse.d.ts +0 -0
- /package/dist/{commands → cli/commands}/try.d.ts +0 -0
- /package/dist/{commands → cli/commands}/upgrade.d.ts +0 -0
- /package/dist/{highlights → demo/narration}/shorthand.js +0 -0
- /package/dist/{pilot-overlay/action-ring.d.ts → demo/overlay/pilot/actions.d.ts} +0 -0
- /package/dist/{ui → demo/overlay/ui}/components/ring.d.ts +0 -0
- /package/dist/{ui → demo/overlay/ui}/stylesheet.d.ts +0 -0
- /package/dist/{ui → demo/overlay/ui}/stylesheet.js +0 -0
- /package/dist/{ui → demo/overlay/ui}/tokens.d.ts +0 -0
- /package/dist/{ui → demo/overlay/ui}/tokens.js +0 -0
- /package/dist/{highlights → demo}/types.js +0 -0
- /package/dist/{auto-session → demo}/verbose-log.d.ts +0 -0
- /package/dist/{selector.d.ts → engine/trait/selector.d.ts} +0 -0
- /package/dist/{selector.js → engine/trait/selector.js} +0 -0
- /package/dist/{trait.js → engine/trait/trait.js} +0 -0
- /package/dist/{session/block-inject.d.ts → manifest/roots.d.ts} +0 -0
- /package/dist/{browser.d.ts → runtime/browser.d.ts} +0 -0
- /package/dist/{env-file.d.ts → runtime/env-file.d.ts} +0 -0
- /package/dist/{playwright-config.js → runtime/playwright-config.js} +0 -0
- /package/dist/{playwright.config.d.ts → runtime/playwright.config.d.ts} +0 -0
- /package/dist/{video-dir.d.ts → runtime/video-dir.d.ts} +0 -0
- /package/dist/{webserver.d.ts → runtime/webserver.d.ts} +0 -0
package/dist/core/flow.js
DELETED
|
@@ -1,432 +0,0 @@
|
|
|
1
|
-
// Split out of the former 2,900-line engine.ts (see src/ARCHITECTURE.md). Behavior unchanged.
|
|
2
|
-
import { connect } from "../types.js";
|
|
3
|
-
import { chromiumExecutablePath, extensionPathsFromEnv, launchContext } from "../browser.js";
|
|
4
|
-
import { resolveExtensions } from "../extensions.js";
|
|
5
|
-
import { loadWaygraphConfig } from "../config.js";
|
|
6
|
-
import { WaygraphError, MSG_CHAINFLOW_BLOCK_NOT_FOUND_BY_INDEX, MSG_CHAINFLOW_BLOCK_NOT_FOUND_BY_NAME, MSG_CHAINFLOW_EMPTY, } from "../errors.js";
|
|
7
|
-
import { preflight, runGraph } from "./run-graph.js";
|
|
8
|
-
import { resolveLauncher } from "./config.js";
|
|
9
|
-
import { MemPage } from "../mem-page.js";
|
|
10
|
-
import { copyWaygraphRuntime, findBlockIndex, modVerify, withVerify } from "./block.js";
|
|
11
|
-
import { normalizeHighlightSize, normalizeHighlightTone, normalizeHighlightWeight } from "../highlights.js";
|
|
12
|
-
/** Launches the browser and context an Engine uses when the caller gave none, from its config. */
|
|
13
|
-
async function openOwnContext(engineConfig) {
|
|
14
|
-
// A config chosen with `--config` / WAYGRAPH_CONFIG wins over the one the Engine was built with, so a flow that imports
|
|
15
|
-
// an engine from one config file still follows the config the run selected.
|
|
16
|
-
const chosen = process.env.WAYGRAPH_CONFIG ? await loadWaygraphConfig(process.cwd()) : undefined;
|
|
17
|
-
const config = chosen
|
|
18
|
-
? {
|
|
19
|
-
...engineConfig,
|
|
20
|
-
...(chosen.baseUrl !== undefined ? { baseUrl: chosen.baseUrl } : {}),
|
|
21
|
-
...(chosen.extensions !== undefined ? { extensions: chosen.extensions } : {}),
|
|
22
|
-
}
|
|
23
|
-
: engineConfig;
|
|
24
|
-
const browserName = config?.browserName ?? "chromium";
|
|
25
|
-
const executablePath = browserName === "chromium" ? chromiumExecutablePath() : undefined;
|
|
26
|
-
const baseURL = config?.baseUrl ?? process.env.WAYGRAPH_BASE_URL;
|
|
27
|
-
return launchContext({
|
|
28
|
-
launcher: resolveLauncher(browserName, config),
|
|
29
|
-
launch: {
|
|
30
|
-
headless: config?.headless ?? true,
|
|
31
|
-
...(config?.slowMo !== undefined ? { slowMo: config.slowMo } : {}),
|
|
32
|
-
...(executablePath ? { executablePath } : {}),
|
|
33
|
-
},
|
|
34
|
-
context: {
|
|
35
|
-
...(baseURL ? { baseURL } : {}),
|
|
36
|
-
...(config?.recordVideo ? { recordVideo: config.recordVideo } : {}),
|
|
37
|
-
},
|
|
38
|
-
extensions: await resolveExtensions(config?.extensions ?? extensionPathsFromEnv(), process.cwd()),
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
export function buildFlow(middle, engineConfig) {
|
|
42
|
-
// resetSession/title start false/unset here - defineFlow itself carries
|
|
43
|
-
// no such options anymore. They're set by wrapping the result in
|
|
44
|
-
// withSessionReset()/withTitle() instead (non-destructive decorators,
|
|
45
|
-
// same pattern as withVerify), which also re-apply themselves after any
|
|
46
|
-
// further withBlockVerify/modBlockVerify patch so the flag survives.
|
|
47
|
-
// Layouts have to be threaded into every pairwise connect(), not just the
|
|
48
|
-
// trailing runGraph call - see connect()'s own doc comment in types.ts:
|
|
49
|
-
// buildFlow's reduce IS the only place a defineFlow-built Flow's
|
|
50
|
-
// intermediate (non-final) Checkpoints are ever verified at all.
|
|
51
|
-
const chain = middle.reduce((a, b) => connect(a, b, engineConfig.layouts));
|
|
52
|
-
// Declared separately (not as the object-literal method below) so the
|
|
53
|
-
// three-overload `Flow.run` signature can be checked against the actual
|
|
54
|
-
// per-call-shape behavior, then attached with a cast - object-literal
|
|
55
|
-
// methods can't satisfy TS's per-overload implementation check the way a
|
|
56
|
-
// standalone function assigned to the property can.
|
|
57
|
-
const run = async function run(contextOrMem, memOrConfig, options) {
|
|
58
|
-
if (contextOrMem instanceof MemPage) {
|
|
59
|
-
const mem = contextOrMem;
|
|
60
|
-
const config = { ...engineConfig, ...memOrConfig };
|
|
61
|
-
// Checked again inside runGraph too, but doing it here first means a
|
|
62
|
-
// missing key fails before a browser process even launches, not just
|
|
63
|
-
// before a page opens - the same "fail loud, cheaply" guarantee
|
|
64
|
-
// run(context, mem) already has via an existing context.
|
|
65
|
-
preflight(mem, chain);
|
|
66
|
-
const { context, close } = await openOwnContext(config);
|
|
67
|
-
try {
|
|
68
|
-
try {
|
|
69
|
-
return await runGraph(chain, undefined, context, mem, 5000, {
|
|
70
|
-
...(config.layouts !== undefined ? { layouts: config.layouts } : {}),
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
finally {
|
|
74
|
-
// Playwright finalizes recordVideo on context.close(); skip when
|
|
75
|
-
// not recording so mem-only runs with stub contexts stay unchanged.
|
|
76
|
-
if (config.recordVideo) {
|
|
77
|
-
await context.close();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
finally {
|
|
82
|
-
await close();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
const context = contextOrMem;
|
|
86
|
-
const mem = memOrConfig;
|
|
87
|
-
// Open (or reuse) the page here, not inside runGraph, so this method -
|
|
88
|
-
// not runGraph - decides whether to close it once the run is over; the
|
|
89
|
-
// page reference has to survive past runGraph's own return either way.
|
|
90
|
-
const gotOwnPage = options?.page === undefined;
|
|
91
|
-
const page = options?.page ?? (await context.newPage());
|
|
92
|
-
// Defaulting close-on-finish to `true` unconditionally would close a
|
|
93
|
-
// page the *caller* opened and handed in via `options.page` - the exact
|
|
94
|
-
// thing this option exists to let a caller keep driving. Only default to
|
|
95
|
-
// closing when this call opened the page itself (no `options.page`
|
|
96
|
-
// given), which is the one case that matches every `run(context, mem)`
|
|
97
|
-
// call from before this option existed. An explicit `closeOnFinish`
|
|
98
|
-
// always wins either way.
|
|
99
|
-
const closeOnFinish = options?.closeOnFinish ?? gotOwnPage;
|
|
100
|
-
const resolvedLayouts = options?.layouts ?? engineConfig.layouts;
|
|
101
|
-
const result = await runGraph(chain, undefined, context, mem, 5000, {
|
|
102
|
-
page,
|
|
103
|
-
closeOnFinish: false,
|
|
104
|
-
...(resolvedLayouts !== undefined ? { layouts: resolvedLayouts } : {}),
|
|
105
|
-
});
|
|
106
|
-
if (closeOnFinish) {
|
|
107
|
-
await page.close();
|
|
108
|
-
}
|
|
109
|
-
// The return *shape* only changes on an explicit `closeOnFinish: false`
|
|
110
|
-
// (the literal the `{ result, page }` overload is typed against) - not
|
|
111
|
-
// on the computed `closeOnFinish` default above. A caller who passed
|
|
112
|
-
// their own `page` and left `closeOnFinish` unset already holds that
|
|
113
|
-
// page reference; handing it back again in a different return shape
|
|
114
|
-
// would silently break the plain-`Out` overload their call actually
|
|
115
|
-
// matched at the type level.
|
|
116
|
-
if (options?.closeOnFinish === false) {
|
|
117
|
-
return { result, page };
|
|
118
|
-
}
|
|
119
|
-
return result;
|
|
120
|
-
};
|
|
121
|
-
return {
|
|
122
|
-
resetSession: false,
|
|
123
|
-
blocks: () => middle.map((b) => ({
|
|
124
|
-
name: b.name,
|
|
125
|
-
block: b,
|
|
126
|
-
...(b.routes ? { routes: b.routes } : {}),
|
|
127
|
-
...(b.__waygraphResetBefore ? { resetSessionBefore: true } : {}),
|
|
128
|
-
})),
|
|
129
|
-
run: run,
|
|
130
|
-
withBlockVerify(block, verify) {
|
|
131
|
-
const index = findBlockIndex(middle, block);
|
|
132
|
-
const patched = [...middle];
|
|
133
|
-
patched[index] = withVerify(middle[index], verify);
|
|
134
|
-
return buildFlow(patched, engineConfig);
|
|
135
|
-
},
|
|
136
|
-
modBlockVerify(block, nameOrIndex, newCheck) {
|
|
137
|
-
const index = findBlockIndex(middle, block);
|
|
138
|
-
const patched = [...middle];
|
|
139
|
-
patched[index] = modVerify(middle[index], nameOrIndex, newCheck);
|
|
140
|
-
return buildFlow(patched, engineConfig);
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Marks a Flow as expecting to start from a genuinely fresh, unauthenticated
|
|
146
|
-
* browser state - e.g. a login flow meant to be re-entered later in a longer
|
|
147
|
-
* showcase. Non-destructive, same pattern as {@link withVerify}: returns a
|
|
148
|
-
* new Flow: the original is untouched, and the flag survives any further
|
|
149
|
-
* `withBlockVerify`/`modBlockVerify` patch applied to the result.
|
|
150
|
-
*
|
|
151
|
-
* By itself this does nothing - `Flow.run()` never reads `resetSession`.
|
|
152
|
-
* It's a hint {@link chainFlow} looks for: right before this Flow's first
|
|
153
|
-
* Block runs (skipped if it's the very first thing in the chain - nothing
|
|
154
|
-
* to reset yet), chainFlow clears cookies and storage so this Flow starts
|
|
155
|
-
* exactly as if a human had opened the app fresh, not wherever the
|
|
156
|
-
* previous Flow in the chain happened to leave the page.
|
|
157
|
-
* @example const loginFlow = withSessionReset(engine.defineFlow([start, LoginBlock, end]));
|
|
158
|
-
* @deprecated Use `map().flow(sub, { reset: true })`; the reset belongs to where flows are joined.
|
|
159
|
-
*/
|
|
160
|
-
export function withSessionReset(flow) {
|
|
161
|
-
return {
|
|
162
|
-
...flow,
|
|
163
|
-
resetSession: true,
|
|
164
|
-
withBlockVerify: (block, verify) => withSessionReset(flow.withBlockVerify(block, verify)),
|
|
165
|
-
modBlockVerify: (block, nameOrIndex, newCheck) => withSessionReset(flow.modBlockVerify(block, nameOrIndex, newCheck)),
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Names a Flow for display - a step-through overlay/showcase (waygraph's
|
|
170
|
-
* `chain --step`) shows this as the running banner while this Flow's own
|
|
171
|
-
* Blocks are executing, instead of one fixed title for the whole run.
|
|
172
|
-
* Non-destructive, same pattern as {@link withSessionReset}.
|
|
173
|
-
* @example const ticket123 = withTitle(loginFlow, "Ticket #123 - Sales rep signs in");
|
|
174
|
-
* @deprecated Name a flow with `ctx.title(...)` in a stub on its first step.
|
|
175
|
-
*/
|
|
176
|
-
export function withTitle(flow, title) {
|
|
177
|
-
return {
|
|
178
|
-
...flow,
|
|
179
|
-
title,
|
|
180
|
-
withBlockVerify: (block, verify) => withTitle(flow.withBlockVerify(block, verify), title),
|
|
181
|
-
modBlockVerify: (block, nameOrIndex, newCheck) => withTitle(flow.modBlockVerify(block, nameOrIndex, newCheck), title),
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Opts this Flow into memStub: `requires` keys the caller didn't supply get
|
|
186
|
-
* filled from `registerMemStub`'s registry (`src/mem-stub.ts`) instead of
|
|
187
|
-
* failing preflight, for any key that has a registered fake generator - a
|
|
188
|
-
* required key with no registration still fails exactly as before.
|
|
189
|
-
* Non-destructive, same pattern as {@link withTitle}. `run()` never reads
|
|
190
|
-
* this itself - the CLI's `--data`/`--mem-stub` seeding, or a bare-library
|
|
191
|
-
* caller's own explicit `seedMemStub(mem, flow)` call, does the filling.
|
|
192
|
-
* @example const demoLogin = withMemStub(loginFlow);
|
|
193
|
-
* @deprecated Use `engine.map({ memStub: true })`.
|
|
194
|
-
*/
|
|
195
|
-
export function withMemStub(flow) {
|
|
196
|
-
return {
|
|
197
|
-
...flow,
|
|
198
|
-
memStub: true,
|
|
199
|
-
withBlockVerify: (block, verify) => withMemStub(flow.withBlockVerify(block, verify)),
|
|
200
|
-
modBlockVerify: (block, nameOrIndex, newCheck) => withMemStub(flow.modBlockVerify(block, nameOrIndex, newCheck)),
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Demo pacing for a whole Flow episode (fast review vs slow gap/wrong walkthrough).
|
|
205
|
-
* Non-destructive. `fastForwardComposeBlock` is always blitz for its own step;
|
|
206
|
-
* use this when an entire episode should be fast or slow.
|
|
207
|
-
* @example withDemoPace(withTitle(gapFlow, "Episode 2 - gaps"), "slow")
|
|
208
|
-
* @example withDemoPace(happyFlow, 0.5) // 2x faster than normal
|
|
209
|
-
* @example withDemoPace(gapFlow, 2.5) // 2.5x slower
|
|
210
|
-
* @example withDemoPace(gapFlow, 4500) // absolute ~4.5s gates/dwells
|
|
211
|
-
* @deprecated Use `engine.map({ demoPace })`, a step `{ pace }`, or `demo.pace` in the config.
|
|
212
|
-
*/
|
|
213
|
-
export function withDemoPace(flow, pace) {
|
|
214
|
-
const demoPace = pace;
|
|
215
|
-
return {
|
|
216
|
-
...flow,
|
|
217
|
-
demoPace,
|
|
218
|
-
withBlockVerify: (block, verify) => withDemoPace(flow.withBlockVerify(block, verify), demoPace),
|
|
219
|
-
modBlockVerify: (block, nameOrIndex, newCheck) => withDemoPace(flow.modBlockVerify(block, nameOrIndex, newCheck), demoPace),
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Default highlight look for a Flow episode (size / weight / optional tone).
|
|
224
|
-
* Per-slot stub or {@link withHighlightFixtures} values win when set.
|
|
225
|
-
* @example withHighlightStyle(withDemoPace(gapFlow, "slow"), { size: "lg", weight: "bold" })
|
|
226
|
-
* @deprecated Use `engine.map({ highlightStyle })`.
|
|
227
|
-
*/
|
|
228
|
-
export function withHighlightStyle(flow, style) {
|
|
229
|
-
const highlightStyle = {
|
|
230
|
-
...(style.tone !== undefined ? { tone: normalizeHighlightTone(style.tone) } : {}),
|
|
231
|
-
...(style.size !== undefined ? { size: normalizeHighlightSize(style.size) } : {}),
|
|
232
|
-
...(style.weight !== undefined ? { weight: normalizeHighlightWeight(style.weight) } : {}),
|
|
233
|
-
};
|
|
234
|
-
return {
|
|
235
|
-
...flow,
|
|
236
|
-
highlightStyle,
|
|
237
|
-
withBlockVerify: (block, verify) => withHighlightStyle(flow.withBlockVerify(block, verify), highlightStyle),
|
|
238
|
-
modBlockVerify: (block, nameOrIndex, newCheck) => withHighlightStyle(flow.modBlockVerify(block, nameOrIndex, newCheck), highlightStyle),
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Demo pacing for one Block or compose unit (not FF - use fastForwardComposeBlock for blitz).
|
|
243
|
-
* @example withBlockPace(composeBlock("gap-review", [...]), "slow")
|
|
244
|
-
* @deprecated Use a step option: `.method(Block, { pace })`.
|
|
245
|
-
*/
|
|
246
|
-
export function withBlockPace(block, pace) {
|
|
247
|
-
const next = { ...block, demoPace: pace };
|
|
248
|
-
copyWaygraphRuntime(block, next);
|
|
249
|
-
return next;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Marks a Flow as one that's SUPPOSED to throw - e.g. a locked-out user's
|
|
253
|
-
* login attempt genuinely failing, demonstrating the app's own real
|
|
254
|
-
* behavior rather than a bug in the demo. Non-destructive, same pattern as
|
|
255
|
-
* {@link withTitle}.
|
|
256
|
-
*
|
|
257
|
-
* By itself this changes nothing about how the Flow runs - it still throws
|
|
258
|
-
* Marks a Flow whose last step is an intentional product failure (demo overlay).
|
|
259
|
-
* Step mode shows stubOnError rings + an amber "expected outcome" panel when:
|
|
260
|
-
* - the last block **throws**, or
|
|
261
|
-
* - the last block **succeeds** on the fail branch (e.g. LoginPage + error banner
|
|
262
|
-
* after submit-login branched instead of throwing).
|
|
263
|
-
* Headless `run()` is unchanged - branching success returns the checkpoint.
|
|
264
|
-
* @example const viewerBlockedFlow = withExpectedFailure(
|
|
265
|
-
* engine.defineFlow([start, NavLoginBlock, SubmitLoginActionBlock, end]),
|
|
266
|
-
* "locked_out_user stays on LoginPage with the error banner - working as intended.",
|
|
267
|
-
* );
|
|
268
|
-
* @deprecated Use `engine.map({ expectedFailure: reason })`.
|
|
269
|
-
*/
|
|
270
|
-
export function withExpectedFailure(flow, reason) {
|
|
271
|
-
return {
|
|
272
|
-
...flow,
|
|
273
|
-
expectedFailureReason: reason,
|
|
274
|
-
withBlockVerify: (block, verify) => withExpectedFailure(flow.withBlockVerify(block, verify), reason),
|
|
275
|
-
modBlockVerify: (block, nameOrIndex, newCheck) => withExpectedFailure(flow.modBlockVerify(block, nameOrIndex, newCheck), reason),
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Attaches demo highlight fixtures to a Flow - unlimited purposes on `.flow.ts`
|
|
280
|
-
* (AC copy, BUG/GATE tags, detail) merged onto each block's stubBefore/stubAfter/
|
|
281
|
-
* stubOnError slots. Non-destructive, same pattern as {@link withTitle}.
|
|
282
|
-
* Demo/`chain --step` reads `flow.highlightFixtures`; `run()` ignores it.
|
|
283
|
-
* @example withHighlightFixtures(issueFlow, { "submit-login": { stubBefore: { email: { label: "AC-1" } } } })
|
|
284
|
-
* @deprecated Chain ctx stubs on the Block: `Block.stubAfter((ctx) => …)`.
|
|
285
|
-
*/
|
|
286
|
-
export function withHighlightFixtures(flow, fixtures) {
|
|
287
|
-
return {
|
|
288
|
-
...flow,
|
|
289
|
-
highlightFixtures: fixtures,
|
|
290
|
-
withBlockVerify: (block, verify) => withHighlightFixtures(flow.withBlockVerify(block, verify), fixtures),
|
|
291
|
-
modBlockVerify: (block, nameOrIndex, newCheck) => withHighlightFixtures(flow.modBlockVerify(block, nameOrIndex, newCheck), fixtures),
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
/** Applies each set option through its `with*` wrapper, so both spellings produce the same Flow. */
|
|
295
|
-
export function applyFlowOptions(flow, options) {
|
|
296
|
-
if (!options)
|
|
297
|
-
return flow;
|
|
298
|
-
let f = flow;
|
|
299
|
-
if (options.sessionReset)
|
|
300
|
-
f = withSessionReset(f);
|
|
301
|
-
if (options.title !== undefined)
|
|
302
|
-
f = withTitle(f, options.title);
|
|
303
|
-
if (options.demoPace)
|
|
304
|
-
f = withDemoPace(f, options.demoPace);
|
|
305
|
-
if (options.highlightStyle)
|
|
306
|
-
f = withHighlightStyle(f, options.highlightStyle);
|
|
307
|
-
if (options.expectedFailure !== undefined)
|
|
308
|
-
f = withExpectedFailure(f, options.expectedFailure);
|
|
309
|
-
if (options.memStub)
|
|
310
|
-
f = withMemStub(f);
|
|
311
|
-
return f;
|
|
312
|
-
}
|
|
313
|
-
function locateInChain(flows, block) {
|
|
314
|
-
if (typeof block === "number") {
|
|
315
|
-
let remaining = block;
|
|
316
|
-
for (let fi = 0; fi < flows.length; fi++) {
|
|
317
|
-
const len = flows[fi].blocks().length;
|
|
318
|
-
if (remaining < len)
|
|
319
|
-
return { flowIndex: fi, localIndex: remaining };
|
|
320
|
-
remaining -= len;
|
|
321
|
-
}
|
|
322
|
-
throw new WaygraphError("WG_FLOW_BLOCK_NOT_FOUND", MSG_CHAINFLOW_BLOCK_NOT_FOUND_BY_INDEX(block, flows.length));
|
|
323
|
-
}
|
|
324
|
-
const blockName = typeof block === "string" ? block : block.name;
|
|
325
|
-
for (let fi = 0; fi < flows.length; fi++) {
|
|
326
|
-
const localIndex = flows[fi].blocks().findIndex((bi) => bi.name === blockName);
|
|
327
|
-
if (localIndex !== -1)
|
|
328
|
-
return { flowIndex: fi, localIndex };
|
|
329
|
-
}
|
|
330
|
-
throw new WaygraphError("WG_FLOW_BLOCK_NOT_FOUND", MSG_CHAINFLOW_BLOCK_NOT_FOUND_BY_NAME(blockName));
|
|
331
|
-
}
|
|
332
|
-
export async function clearSessionState(context, page) {
|
|
333
|
-
await context.clearCookies().catch(() => { });
|
|
334
|
-
await page
|
|
335
|
-
.evaluate(() => {
|
|
336
|
-
try {
|
|
337
|
-
localStorage.clear();
|
|
338
|
-
sessionStorage.clear();
|
|
339
|
-
}
|
|
340
|
-
catch {
|
|
341
|
-
/* storage blocked (e.g. about:blank) - nothing to clear anyway */
|
|
342
|
-
}
|
|
343
|
-
})
|
|
344
|
-
.catch(() => { });
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Runs several complete, independent Flows one after another, reusing the
|
|
348
|
-
* same page/context/mem in order - each remains its own validated
|
|
349
|
-
* start-to-end unit (a Flow's own `[start, ...blocks, end]` contract is
|
|
350
|
-
* untouched), this only sequences whole Flows. Deliberately NOT the same
|
|
351
|
-
* thing as {@link composeBlock}: composeBlock nests several Blocks into
|
|
352
|
-
* one Block that can drop back into another `defineFlow([...])` - a
|
|
353
|
-
* chainFlow result is a Flow, but not meant to be nested inside another
|
|
354
|
-
* Flow's own Block list. Recursive nesting stays composeBlock's job alone;
|
|
355
|
-
* chainFlow is a flat, one-level sequencing of complete showcases (e.g.
|
|
356
|
-
* "ticket #123 end to end, then ticket #456 end to end").
|
|
357
|
-
*
|
|
358
|
-
* A sub-flow wrapped in {@link withSessionReset} gets its cookies/storage
|
|
359
|
-
* cleared right before it runs (skipped for the very first flow in the
|
|
360
|
-
* chain - nothing to reset yet). The combined result is whatever the LAST
|
|
361
|
-
* flow resolved to.
|
|
362
|
-
* @example chainFlow(ticket123Flow, ticket456Flow).run(context, mem)
|
|
363
|
-
* @deprecated Nest flows with `map().flow(a).flow(b, { reset: true })`.
|
|
364
|
-
*/
|
|
365
|
-
export function chainFlow(...flows) {
|
|
366
|
-
if (flows.length === 0) {
|
|
367
|
-
throw new WaygraphError("WG_CHAINFLOW_EMPTY", MSG_CHAINFLOW_EMPTY);
|
|
368
|
-
}
|
|
369
|
-
const run = async function run(contextOrMem, memOrConfig, options) {
|
|
370
|
-
if (contextOrMem instanceof MemPage) {
|
|
371
|
-
const mem = contextOrMem;
|
|
372
|
-
const config = memOrConfig;
|
|
373
|
-
// One browser for the WHOLE chain - each sub-flow's own run(mem,
|
|
374
|
-
// config) would otherwise each launch a separate browser, defeating
|
|
375
|
-
// the point of sequencing them (a fresh browser is itself a full
|
|
376
|
-
// session reset, silently making withSessionReset a no-op).
|
|
377
|
-
const { context, close } = await openOwnContext(config);
|
|
378
|
-
try {
|
|
379
|
-
try {
|
|
380
|
-
return await run(context, mem, { closeOnFinish: true });
|
|
381
|
-
}
|
|
382
|
-
finally {
|
|
383
|
-
await context.close();
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
finally {
|
|
387
|
-
await close();
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
const context = contextOrMem;
|
|
391
|
-
const mem = memOrConfig;
|
|
392
|
-
const gotOwnPage = options?.page === undefined;
|
|
393
|
-
const page = options?.page ?? (await context.newPage());
|
|
394
|
-
const closeOnFinish = options?.closeOnFinish ?? gotOwnPage;
|
|
395
|
-
let result;
|
|
396
|
-
for (let i = 0; i < flows.length; i++) {
|
|
397
|
-
const flow = flows[i];
|
|
398
|
-
if (i > 0 && flow.resetSession) {
|
|
399
|
-
await clearSessionState(context, page);
|
|
400
|
-
}
|
|
401
|
-
const outcome = (await flow.run(context, mem, { page, closeOnFinish: false }));
|
|
402
|
-
result = outcome.result;
|
|
403
|
-
}
|
|
404
|
-
if (closeOnFinish) {
|
|
405
|
-
await page.close();
|
|
406
|
-
}
|
|
407
|
-
if (options?.closeOnFinish === false) {
|
|
408
|
-
return { result, page };
|
|
409
|
-
}
|
|
410
|
-
return result;
|
|
411
|
-
};
|
|
412
|
-
return {
|
|
413
|
-
resetSession: false,
|
|
414
|
-
blocks: () => flows.flatMap((flow, idx) => flow.blocks().map((bi, i) => ({
|
|
415
|
-
...bi,
|
|
416
|
-
...(i === 0 && idx > 0 && flow.resetSession ? { resetSessionBefore: true } : {}),
|
|
417
|
-
}))),
|
|
418
|
-
run: run,
|
|
419
|
-
withBlockVerify(block, verify) {
|
|
420
|
-
const { flowIndex, localIndex } = locateInChain(flows, block);
|
|
421
|
-
const patched = [...flows];
|
|
422
|
-
patched[flowIndex] = patched[flowIndex].withBlockVerify(localIndex, verify);
|
|
423
|
-
return chainFlow(...patched);
|
|
424
|
-
},
|
|
425
|
-
modBlockVerify(block, nameOrIndex, newCheck) {
|
|
426
|
-
const { flowIndex, localIndex } = locateInChain(flows, block);
|
|
427
|
-
const patched = [...flows];
|
|
428
|
-
patched[flowIndex] = patched[flowIndex].modBlockVerify(localIndex, nameOrIndex, newCheck);
|
|
429
|
-
return chainFlow(...patched);
|
|
430
|
-
},
|
|
431
|
-
};
|
|
432
|
-
}
|
package/dist/core.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export * from "./core/config.js";
|
|
2
|
-
export * from "./core/run-graph.js";
|
|
3
|
-
export * from "./core/flow.js";
|
|
4
|
-
export * from "./core/block.js";
|
|
5
|
-
export * from "./core/compose.js";
|
|
6
|
-
export * from "./core/engine.js";
|
|
7
|
-
export * from "./core/map-builder.js";
|
|
8
|
-
export * from "./core/blocks/nav.js";
|
|
9
|
-
export * from "./core/blocks/method.js";
|
|
10
|
-
export * from "./core/blocks/page.js";
|
|
11
|
-
export * from "./core/blocks/effect.js";
|
|
12
|
-
export * from "./core/blocks/api.js";
|
|
13
|
-
export * from "./core/locate.js";
|
|
14
|
-
export * from "./core/branch-regression.js";
|
package/dist/core.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Barrel: the engine lives in src/core/ (see src/ARCHITECTURE.md). Kept so existing imports of "./core.js" don't change.
|
|
2
|
-
export * from "./core/config.js";
|
|
3
|
-
export * from "./core/run-graph.js";
|
|
4
|
-
export * from "./core/flow.js";
|
|
5
|
-
export * from "./core/block.js";
|
|
6
|
-
export * from "./core/compose.js";
|
|
7
|
-
export * from "./core/engine.js";
|
|
8
|
-
export * from "./core/map-builder.js";
|
|
9
|
-
export * from "./core/blocks/nav.js";
|
|
10
|
-
export * from "./core/blocks/method.js";
|
|
11
|
-
export * from "./core/blocks/page.js";
|
|
12
|
-
export * from "./core/blocks/effect.js";
|
|
13
|
-
export * from "./core/blocks/api.js";
|
|
14
|
-
export * from "./core/locate.js";
|
|
15
|
-
export * from "./core/branch-regression.js";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { HighlightStubPhase, HighlightStubPhaseName, HighlightStubPhaseOrFn, ResolvedHighlight, WaygraphHighlightFixture } from "./types.js";
|
|
2
|
-
import type { Block, Checkpoint } from "../types.js";
|
|
3
|
-
export declare function isStubPhase(v: unknown): v is HighlightStubPhase;
|
|
4
|
-
export declare function applyDefaultZoom(slots: ResolvedHighlight[], defaultZoom?: number): ResolvedHighlight[];
|
|
5
|
-
export declare function applyDefaultZoomOut(slots: ResolvedHighlight[], defaultZoomOut?: boolean): ResolvedHighlight[];
|
|
6
|
-
export declare function mergePhaseMaps(phaseMap: HighlightStubPhase, fixturePhase: Record<string, WaygraphHighlightFixture> | undefined): ResolvedHighlight[];
|
|
7
|
-
export declare function readStubRaw(block: Block<any, any>, phase: HighlightStubPhaseName): HighlightStubPhaseOrFn<any> | undefined;
|
|
8
|
-
export declare function applyLegacyHighlightsShim(block: Block<any, any>, phase: HighlightStubPhaseName, phaseMap: HighlightStubPhase, out?: Checkpoint<string>): HighlightStubPhase;
|
package/dist/highlights/merge.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { normalizeHighlightSize, normalizeHighlightTone, normalizeHighlightWeight } from "./style.js";
|
|
2
|
-
export function isStubPhase(v) {
|
|
3
|
-
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
4
|
-
}
|
|
5
|
-
function pickDurationFields(base, patch) {
|
|
6
|
-
const out = {};
|
|
7
|
-
const duration = patch?.duration !== undefined ? patch.duration : base?.duration;
|
|
8
|
-
const fastMode = patch?.fastMode !== undefined ? patch.fastMode : base?.fastMode;
|
|
9
|
-
if (duration !== undefined)
|
|
10
|
-
out.duration = duration;
|
|
11
|
-
if (fastMode !== undefined)
|
|
12
|
-
out.fastMode = fastMode;
|
|
13
|
-
return out;
|
|
14
|
-
}
|
|
15
|
-
function pickStyleFields(base, patch) {
|
|
16
|
-
const out = {};
|
|
17
|
-
const tone = patch?.tone !== undefined ? patch.tone : base?.tone;
|
|
18
|
-
const size = patch?.size !== undefined ? patch.size : base?.size;
|
|
19
|
-
const weight = patch?.weight !== undefined ? patch.weight : base?.weight;
|
|
20
|
-
if (tone !== undefined)
|
|
21
|
-
out.tone = normalizeHighlightTone(tone);
|
|
22
|
-
if (size !== undefined)
|
|
23
|
-
out.size = normalizeHighlightSize(size);
|
|
24
|
-
if (weight !== undefined)
|
|
25
|
-
out.weight = normalizeHighlightWeight(weight);
|
|
26
|
-
return out;
|
|
27
|
-
}
|
|
28
|
-
function pickZoom(base, patch) {
|
|
29
|
-
const zoom = patch?.zoom !== undefined ? patch.zoom : base?.zoom;
|
|
30
|
-
if (zoom !== undefined && Number.isFinite(zoom) && zoom > 0)
|
|
31
|
-
return { zoom };
|
|
32
|
-
return {};
|
|
33
|
-
}
|
|
34
|
-
function pickFxFields(base, patch) {
|
|
35
|
-
const out = {};
|
|
36
|
-
const focus = patch?.focus !== undefined ? patch.focus : base?.focus;
|
|
37
|
-
const color = patch?.color !== undefined ? patch.color : base?.color;
|
|
38
|
-
const cursor = patch?.cursor !== undefined ? patch.cursor : base?.cursor;
|
|
39
|
-
const todo = patch?.todo !== undefined ? patch.todo : base?.todo;
|
|
40
|
-
const gesture = patch?.gesture !== undefined ? patch.gesture : base?.gesture;
|
|
41
|
-
if (focus !== undefined)
|
|
42
|
-
out.focus = !!focus;
|
|
43
|
-
if (color !== undefined && String(color).trim())
|
|
44
|
-
out.color = String(color).trim();
|
|
45
|
-
if (cursor !== undefined)
|
|
46
|
-
out.cursor = !!cursor;
|
|
47
|
-
if (todo !== undefined && String(todo).trim())
|
|
48
|
-
out.todo = String(todo).trim();
|
|
49
|
-
if (gesture === "tap" || gesture === "hold" || gesture === "click" || gesture === "swipe") {
|
|
50
|
-
out.gesture = gesture;
|
|
51
|
-
}
|
|
52
|
-
return out;
|
|
53
|
-
}
|
|
54
|
-
function mergeSlot(base, patch) {
|
|
55
|
-
if (!base && !patch)
|
|
56
|
-
return null;
|
|
57
|
-
const dwell = pickDurationFields(base, patch);
|
|
58
|
-
const style = pickStyleFields(base, patch);
|
|
59
|
-
const zoom = pickZoom(base, patch);
|
|
60
|
-
const fx = pickFxFields(base, patch);
|
|
61
|
-
if (!base && patch) {
|
|
62
|
-
if (!patch.selector)
|
|
63
|
-
return null;
|
|
64
|
-
return {
|
|
65
|
-
selector: patch.selector,
|
|
66
|
-
label: patch.label,
|
|
67
|
-
...(patch.detail ? { detail: patch.detail } : {}),
|
|
68
|
-
...(patch.tag ? { tag: patch.tag } : {}),
|
|
69
|
-
...style,
|
|
70
|
-
...dwell,
|
|
71
|
-
...zoom,
|
|
72
|
-
...fx,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
if (base && !patch) {
|
|
76
|
-
return {
|
|
77
|
-
...base,
|
|
78
|
-
...(base.tone ? { tone: normalizeHighlightTone(base.tone) } : {}),
|
|
79
|
-
...(base.size ? { size: normalizeHighlightSize(base.size) } : {}),
|
|
80
|
-
...(base.weight ? { weight: normalizeHighlightWeight(base.weight) } : {}),
|
|
81
|
-
...pickZoom(base, undefined),
|
|
82
|
-
...pickFxFields(base, undefined),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
selector: patch.selector ?? base.selector,
|
|
87
|
-
label: patch.label,
|
|
88
|
-
...(patch.detail !== undefined
|
|
89
|
-
? { detail: patch.detail }
|
|
90
|
-
: base.detail
|
|
91
|
-
? { detail: base.detail }
|
|
92
|
-
: {}),
|
|
93
|
-
...(patch.tag !== undefined ? { tag: patch.tag } : base.tag ? { tag: base.tag } : {}),
|
|
94
|
-
...style,
|
|
95
|
-
...dwell,
|
|
96
|
-
...zoom,
|
|
97
|
-
...fx,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
export function applyDefaultZoom(slots, defaultZoom) {
|
|
101
|
-
if (defaultZoom === undefined || !(defaultZoom > 0))
|
|
102
|
-
return slots;
|
|
103
|
-
return slots.map((h) => (h.zoom !== undefined && h.zoom > 0 ? h : { ...h, zoom: defaultZoom }));
|
|
104
|
-
}
|
|
105
|
-
export function applyDefaultZoomOut(slots, defaultZoomOut) {
|
|
106
|
-
if (defaultZoomOut === undefined)
|
|
107
|
-
return slots;
|
|
108
|
-
return slots.map((h) => h.zoomOut !== undefined ? h : { ...h, zoomOut: defaultZoomOut });
|
|
109
|
-
}
|
|
110
|
-
export function mergePhaseMaps(phaseMap, fixturePhase) {
|
|
111
|
-
const phaseKeys = Object.keys(phaseMap);
|
|
112
|
-
const fixtureKeys = Object.keys(fixturePhase || {});
|
|
113
|
-
const allKeys = [...new Set([...phaseKeys, ...fixtureKeys])];
|
|
114
|
-
const allNumeric = allKeys.length > 0 && allKeys.every((k) => Number.isFinite(Number(k)) && String(Number(k)) === k);
|
|
115
|
-
// Numeric stub ids (legacy "0","1") sort by number. Named stubs keep author
|
|
116
|
-
// insertion order - localeCompare used to reorder password/submit/username
|
|
117
|
-
// and advance the wrong todo index on fill.
|
|
118
|
-
const ordered = allNumeric
|
|
119
|
-
? [...allKeys].sort((a, b) => Number(a) - Number(b))
|
|
120
|
-
: [...phaseKeys, ...fixtureKeys.filter((k) => !phaseKeys.includes(k))];
|
|
121
|
-
const resolved = [];
|
|
122
|
-
for (const id of ordered) {
|
|
123
|
-
const merged = mergeSlot(phaseMap[id], fixturePhase?.[id]);
|
|
124
|
-
if (merged) {
|
|
125
|
-
resolved.push({
|
|
126
|
-
...merged,
|
|
127
|
-
slotId: id,
|
|
128
|
-
...(merged.todo ? { todo: merged.todo } : {}),
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return resolved;
|
|
133
|
-
}
|
|
134
|
-
function phaseFromLegacyHighlights(highlights) {
|
|
135
|
-
const out = {};
|
|
136
|
-
if (!highlights)
|
|
137
|
-
return out;
|
|
138
|
-
highlights.forEach((h, i) => {
|
|
139
|
-
if (h && typeof h.selector === "string" && typeof h.label === "string") {
|
|
140
|
-
out[String(i)] = {
|
|
141
|
-
selector: h.selector,
|
|
142
|
-
label: h.label,
|
|
143
|
-
...(h.tone ? { tone: normalizeHighlightTone(h.tone) } : {}),
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
return out;
|
|
148
|
-
}
|
|
149
|
-
export function readStubRaw(block, phase) {
|
|
150
|
-
const instr = block.instruction;
|
|
151
|
-
if (phase === "stubBefore")
|
|
152
|
-
return instr.stubBefore;
|
|
153
|
-
if (phase === "stubAfter")
|
|
154
|
-
return instr.stubAfter;
|
|
155
|
-
return instr.stubOnError;
|
|
156
|
-
}
|
|
157
|
-
export function applyLegacyHighlightsShim(block, phase, phaseMap, out) {
|
|
158
|
-
if (phase !== "stubAfter" || Object.keys(phaseMap).length > 0)
|
|
159
|
-
return phaseMap;
|
|
160
|
-
const instr = block.instruction;
|
|
161
|
-
if (!instr.highlights)
|
|
162
|
-
return phaseMap;
|
|
163
|
-
let legacy = instr.highlights;
|
|
164
|
-
if (typeof legacy === "function") {
|
|
165
|
-
try {
|
|
166
|
-
legacy = legacy(out ?? { __state: "" });
|
|
167
|
-
}
|
|
168
|
-
catch {
|
|
169
|
-
legacy = [];
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return phaseFromLegacyHighlights(Array.isArray(legacy) ? legacy : []);
|
|
173
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { StubBagState, StubCtx } from "./types.js";
|
|
2
|
-
import type { Checkpoint } from "../types.js";
|
|
3
|
-
import type { MemPage } from "../mem-page.js";
|
|
4
|
-
export declare function createStubCtx<Out extends Checkpoint<string>>(bag: StubBagState, opts: {
|
|
5
|
-
out?: Out;
|
|
6
|
-
error?: unknown;
|
|
7
|
-
mem?: MemPage;
|
|
8
|
-
}): StubCtx<Out>;
|
|
9
|
-
/** Lift legacy per-slot todos (0.12.23) onto the phase bag once. */
|
|
10
|
-
export declare function liftLegacySlotTodos(bag: StubBagState): void;
|