@speedkit/cli 4.50.5 → 4.51.0-run-control.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1425 -14
- package/dist/base/run-control-command.d.ts +15 -0
- package/dist/base/run-control-command.js +20 -0
- package/dist/build-info.json +6 -0
- package/dist/commands/diff.d.ts +7 -1
- package/dist/commands/diff.js +9 -3
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.js +14 -3
- package/dist/commands/onboarding/browser/click.d.ts +75 -0
- package/dist/commands/onboarding/browser/click.js +19 -0
- package/dist/commands/onboarding/browser/emulate.d.ts +105 -0
- package/dist/commands/onboarding/browser/emulate.js +26 -0
- package/dist/commands/onboarding/browser/navigate.d.ts +75 -0
- package/dist/commands/onboarding/browser/navigate.js +19 -0
- package/dist/commands/onboarding/browser/panel.d.ts +63 -0
- package/dist/commands/onboarding/browser/panel.js +12 -0
- package/dist/commands/onboarding/browser/reinstall-sw.d.ts +63 -0
- package/dist/commands/onboarding/browser/reinstall-sw.js +14 -0
- package/dist/commands/onboarding/browser/reset.d.ts +71 -0
- package/dist/commands/onboarding/browser/reset.js +18 -0
- package/dist/commands/onboarding/browser/screenshot.d.ts +77 -0
- package/dist/commands/onboarding/browser/screenshot.js +19 -0
- package/dist/commands/onboarding/browser/state.d.ts +63 -0
- package/dist/commands/onboarding/browser/state.js +12 -0
- package/dist/commands/onboarding/browser/tabs.d.ts +58 -0
- package/dist/commands/onboarding/browser/tabs.js +16 -0
- package/dist/commands/onboarding/cache/clear.d.ts +58 -0
- package/dist/commands/onboarding/cache/clear.js +12 -0
- package/dist/commands/onboarding/cache/errors.d.ts +58 -0
- package/dist/commands/onboarding/cache/errors.js +12 -0
- package/dist/commands/onboarding/cache/evict.d.ts +62 -0
- package/dist/commands/onboarding/cache/evict.js +15 -0
- package/dist/commands/onboarding/cache/get.d.ts +85 -0
- package/dist/commands/onboarding/cache/get.js +17 -0
- package/dist/commands/onboarding/cache/list.d.ts +58 -0
- package/dist/commands/onboarding/cache/list.js +15 -0
- package/dist/commands/onboarding/cache/prewarm.d.ts +73 -0
- package/dist/commands/onboarding/cache/prewarm.js +20 -0
- package/dist/commands/onboarding/cache/refresh.d.ts +62 -0
- package/dist/commands/onboarding/cache/refresh.js +18 -0
- package/dist/commands/onboarding/cdp.d.ts +81 -0
- package/dist/commands/onboarding/cdp.js +18 -0
- package/dist/commands/onboarding/debug/arm.d.ts +83 -0
- package/dist/commands/onboarding/debug/arm.js +19 -0
- package/dist/commands/onboarding/debug/await.d.ts +71 -0
- package/dist/commands/onboarding/debug/await.js +18 -0
- package/dist/commands/onboarding/debug/disarm.d.ts +63 -0
- package/dist/commands/onboarding/debug/disarm.js +12 -0
- package/dist/commands/onboarding/debug/eval.d.ts +75 -0
- package/dist/commands/onboarding/debug/eval.js +16 -0
- package/dist/commands/onboarding/debug/release.d.ts +63 -0
- package/dist/commands/onboarding/debug/release.js +12 -0
- package/dist/commands/onboarding/debug/resume.d.ts +63 -0
- package/dist/commands/onboarding/debug/resume.js +12 -0
- package/dist/commands/onboarding/debug/status.d.ts +63 -0
- package/dist/commands/onboarding/debug/status.js +12 -0
- package/dist/commands/onboarding/debug/step.d.ts +67 -0
- package/dist/commands/onboarding/debug/step.js +15 -0
- package/dist/commands/onboarding/files/list.d.ts +58 -0
- package/dist/commands/onboarding/files/list.js +12 -0
- package/dist/commands/onboarding/files/read.d.ts +73 -0
- package/dist/commands/onboarding/files/read.js +16 -0
- package/dist/commands/onboarding/files/rebuild.d.ts +63 -0
- package/dist/commands/onboarding/files/rebuild.js +18 -0
- package/dist/commands/onboarding/files/validate.d.ts +58 -0
- package/dist/commands/onboarding/files/validate.js +12 -0
- package/dist/commands/onboarding/fouc.d.ts +77 -0
- package/dist/commands/onboarding/fouc.js +16 -0
- package/dist/commands/onboarding/inject/add.d.ts +89 -0
- package/dist/commands/onboarding/inject/add.js +17 -0
- package/dist/commands/onboarding/inject/clear.d.ts +63 -0
- package/dist/commands/onboarding/inject/clear.js +12 -0
- package/dist/commands/onboarding/inject/list.d.ts +63 -0
- package/dist/commands/onboarding/inject/list.js +12 -0
- package/dist/commands/onboarding/inject/read.d.ts +75 -0
- package/dist/commands/onboarding/inject/read.js +18 -0
- package/dist/commands/onboarding/inject/recipes.d.ts +63 -0
- package/dist/commands/onboarding/inject/recipes.js +12 -0
- package/dist/commands/onboarding/inject/remove.d.ts +67 -0
- package/dist/commands/onboarding/inject/remove.js +15 -0
- package/dist/commands/onboarding/list.d.ts +13 -0
- package/dist/commands/onboarding/list.js +12 -0
- package/dist/commands/onboarding/logs.d.ts +41 -0
- package/dist/commands/onboarding/logs.js +257 -0
- package/dist/commands/onboarding/navwalk.d.ts +95 -0
- package/dist/commands/onboarding/navwalk.js +19 -0
- package/dist/commands/onboarding/response.d.ts +67 -0
- package/dist/commands/onboarding/response.js +18 -0
- package/dist/commands/onboarding/rum/beacons.d.ts +75 -0
- package/dist/commands/onboarding/rum/beacons.js +16 -0
- package/dist/commands/onboarding/rum/get.d.ts +77 -0
- package/dist/commands/onboarding/rum/get.js +18 -0
- package/dist/commands/onboarding/rum/key.d.ts +67 -0
- package/dist/commands/onboarding/rum/key.js +13 -0
- package/dist/commands/onboarding/rum/previous.d.ts +63 -0
- package/dist/commands/onboarding/rum/previous.js +12 -0
- package/dist/commands/onboarding/status.d.ts +13 -0
- package/dist/commands/onboarding/status.js +17 -0
- package/dist/commands/onboarding/stop.d.ts +13 -0
- package/dist/commands/onboarding/stop.js +17 -0
- package/dist/commands/onboarding/todo.d.ts +58 -0
- package/dist/commands/onboarding/todo.js +12 -0
- package/dist/commands/onboarding/viewport.d.ts +101 -0
- package/dist/commands/onboarding/viewport.js +18 -0
- package/dist/commands/onboarding/watch.d.ts +93 -0
- package/dist/commands/onboarding/watch.js +16 -0
- package/dist/commands/onboarding.d.ts +26 -0
- package/dist/commands/onboarding.js +221 -4
- package/dist/commands/origin-request.d.ts +4 -0
- package/dist/commands/origin-request.js +4 -0
- package/dist/commands/spec/onboarding.spec.d.ts +1 -0
- package/dist/commands/spec/onboarding.spec.js +127 -0
- package/dist/services/cli/build-info.d.ts +33 -0
- package/dist/services/cli/build-info.js +63 -0
- package/dist/services/cli/cli-environment-factory.d.ts +3 -0
- package/dist/services/cli/cli-environment-factory.js +1 -0
- package/dist/services/cli/cli-service-build-context.d.ts +3 -0
- package/dist/services/cli/cli-service-factory.js +1 -1
- package/dist/services/cli/cli-service-model.d.ts +29 -10
- package/dist/services/cli/cli-service.d.ts +60 -11
- package/dist/services/cli/cli-service.js +196 -32
- package/dist/services/cli/index.d.ts +2 -0
- package/dist/services/cli/index.js +2 -0
- package/dist/services/cli/sink.d.ts +47 -0
- package/dist/services/cli/sink.js +31 -0
- package/dist/services/cli/spec/build-identity.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-identity.spec.js +85 -0
- package/dist/services/cli/spec/build-info.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-info.spec.js +10 -0
- package/dist/services/cli/spec/cli-service-log.spec.d.ts +1 -0
- package/dist/services/cli/spec/cli-service-log.spec.js +133 -0
- package/dist/services/cli/spec/cli-service.spec.js +113 -50
- package/dist/services/cli/spec/memory-cli.d.ts +9 -0
- package/dist/services/cli/spec/memory-cli.js +9 -0
- package/dist/services/diff/config-at-ref.d.ts +20 -0
- package/dist/services/diff/config-at-ref.js +33 -0
- package/dist/services/diff/diff-service-build-context.d.ts +12 -0
- package/dist/services/diff/diff-service-build-context.js +45 -1
- package/dist/services/diff/diff-service-factory.d.ts +2 -0
- package/dist/services/diff/diff-service-factory.js +65 -25
- package/dist/services/diff/diff-service.d.ts +11 -0
- package/dist/services/diff/diff-service.js +37 -11
- package/dist/services/diff/page-source.d.ts +12 -0
- package/dist/services/diff/page-source.js +16 -11
- package/dist/services/diff/run-runtime-config.d.ts +33 -0
- package/dist/services/diff/run-runtime-config.js +74 -0
- package/dist/services/diff/sinks/tool-diff-sink.d.ts +3 -2
- package/dist/services/diff/sinks/tool-diff-sink.js +3 -2
- package/dist/services/diff/spec/config-at-ref.spec.d.ts +1 -0
- package/dist/services/diff/spec/config-at-ref.spec.js +46 -0
- package/dist/services/diff/spec/diff-service-build-context.spec.js +19 -0
- package/dist/services/diff/spec/diff-service.spec.js +95 -0
- package/dist/services/diff/spec/run-runtime-config.spec.d.ts +1 -0
- package/dist/services/diff/spec/run-runtime-config.spec.js +87 -0
- package/dist/services/git/git-repository.d.ts +2 -0
- package/dist/services/git/git-repository.js +6 -0
- package/dist/services/integration-api/customer-config-flags.js +1 -0
- package/dist/services/onboarding/browse/browse-service.d.ts +13 -1
- package/dist/services/onboarding/browse/browse-service.js +40 -7
- package/dist/services/onboarding/browser/answer-dialogs.d.ts +12 -0
- package/dist/services/onboarding/browser/answer-dialogs.js +25 -0
- package/dist/services/onboarding/browser/baqend-response.d.ts +17 -1
- package/dist/services/onboarding/browser/baqend-response.js +23 -0
- package/dist/services/onboarding/browser/console-log.d.ts +9 -0
- package/dist/services/onboarding/browser/console-log.js +27 -0
- package/dist/services/onboarding/browser/emulate-device.d.ts +12 -1
- package/dist/services/onboarding/browser/emulate-device.js +33 -6
- package/dist/services/onboarding/browser/executable/executable-validator.js +4 -2
- package/dist/services/onboarding/browser/extension/extension-bridge.js +5 -3
- package/dist/services/onboarding/browser/extension/extension-downloader.js +17 -8
- package/dist/services/onboarding/browser/extension/extension-validator.js +9 -4
- package/dist/services/onboarding/browser/launch-browser.d.ts +2 -1
- package/dist/services/onboarding/browser/launch-browser.js +3 -1
- package/dist/services/onboarding/control/body-inspect.d.ts +24 -0
- package/dist/services/onboarding/control/body-inspect.js +106 -0
- package/dist/services/onboarding/control/browser-session.d.ts +535 -0
- package/dist/services/onboarding/control/browser-session.js +1300 -0
- package/dist/services/onboarding/control/config-validation.d.ts +17 -0
- package/dist/services/onboarding/control/config-validation.js +46 -0
- package/dist/services/onboarding/control/control-protocol.d.ts +1428 -0
- package/dist/services/onboarding/control/control-protocol.js +58 -0
- package/dist/services/onboarding/control/control-server.d.ts +292 -0
- package/dist/services/onboarding/control/control-server.js +1629 -0
- package/dist/services/onboarding/control/debug-session.d.ts +219 -0
- package/dist/services/onboarding/control/debug-session.js +897 -0
- package/dist/services/onboarding/control/fouc.d.ts +23 -0
- package/dist/services/onboarding/control/fouc.js +151 -0
- package/dist/services/onboarding/control/index.d.ts +4 -0
- package/dist/services/onboarding/control/index.js +4 -0
- package/dist/services/onboarding/control/navigate-wait.d.ts +33 -0
- package/dist/services/onboarding/control/navigate-wait.js +56 -0
- package/dist/services/onboarding/control/navwalk.d.ts +65 -0
- package/dist/services/onboarding/control/navwalk.js +248 -0
- package/dist/services/onboarding/control/preload-registry.d.ts +150 -0
- package/dist/services/onboarding/control/preload-registry.js +829 -0
- package/dist/services/onboarding/control/response-explainer.d.ts +24 -0
- package/dist/services/onboarding/control/response-explainer.js +257 -0
- package/dist/services/onboarding/control/rum.d.ts +8 -0
- package/dist/services/onboarding/control/rum.js +220 -0
- package/dist/services/onboarding/control/service-worker-tracker.d.ts +68 -0
- package/dist/services/onboarding/control/service-worker-tracker.js +120 -0
- package/dist/services/onboarding/control/viewport.d.ts +45 -0
- package/dist/services/onboarding/control/viewport.js +344 -0
- package/dist/services/onboarding/control/watch.d.ts +26 -0
- package/dist/services/onboarding/control/watch.js +157 -0
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +3 -1
- package/dist/services/onboarding/dashboard/index.js +7 -2
- package/dist/services/onboarding/fetch-event-handler.d.ts +24 -5
- package/dist/services/onboarding/fetch-event-handler.js +103 -32
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +11 -2
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +14 -0
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +30 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +13 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +28 -1
- package/dist/services/onboarding/file-events/file-watcher.d.ts +42 -1
- package/dist/services/onboarding/file-events/file-watcher.js +117 -12
- package/dist/services/onboarding/inject/inject-service.js +1 -1
- package/dist/services/onboarding/onboarding-model.d.ts +30 -0
- package/dist/services/onboarding/onboarding-model.js +12 -1
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +4 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +7 -1
- package/dist/services/onboarding/onboarding-service-factory.d.ts +17 -1
- package/dist/services/onboarding/onboarding-service-factory.js +150 -23
- package/dist/services/onboarding/onboarding-service.d.ts +40 -1
- package/dist/services/onboarding/onboarding-service.js +136 -23
- package/dist/services/onboarding/request-cache/asset-key.d.ts +61 -0
- package/dist/services/onboarding/request-cache/asset-key.js +115 -0
- package/dist/services/onboarding/request-cache/cache.d.ts +62 -5
- package/dist/services/onboarding/request-cache/cache.js +128 -17
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.js +66 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.js +42 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.js +651 -0
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/control-server.spec.js +371 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.js +751 -0
- package/dist/services/onboarding/spec/control/fakes.d.ts +31 -0
- package/dist/services/onboarding/spec/control/fakes.js +66 -0
- package/dist/services/onboarding/spec/control/fouc.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/fouc.spec.js +167 -0
- package/dist/services/onboarding/spec/control/navigate-wait.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navigate-wait.spec.js +47 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.js +222 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.js +432 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.js +324 -0
- package/dist/services/onboarding/spec/control/rum.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/rum.spec.js +222 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.js +193 -0
- package/dist/services/onboarding/spec/control/viewport.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/viewport.spec.js +200 -0
- package/dist/services/onboarding/spec/control/watch.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/watch.spec.js +187 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +219 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.js +41 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +39 -3
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +25 -1
- package/dist/services/onboarding/spec/request-cache/cache.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/request-cache/cache.spec.js +107 -0
- package/dist/services/onboarding/spec/todo-collector.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/todo-collector.spec.js +136 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.js +65 -0
- package/dist/services/onboarding/todo-collector.d.ts +7 -2
- package/dist/services/onboarding/todo-collector.js +49 -12
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +38 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +113 -27
- package/dist/services/origin-request/asset-variations.d.ts +14 -0
- package/dist/services/origin-request/asset-variations.js +11 -4
- package/dist/services/origin-request/origin-fetcher.d.ts +7 -0
- package/dist/services/origin-request/origin-fetcher.js +43 -5
- package/dist/services/origin-request/origin-request-service-build-context.d.ts +17 -0
- package/dist/services/origin-request/origin-request-service-build-context.js +8 -0
- package/dist/services/origin-request/origin-request-service-factory.d.ts +0 -5
- package/dist/services/origin-request/origin-request-service-factory.js +2 -30
- package/dist/services/origin-request/origin-request-service.d.ts +121 -6
- package/dist/services/origin-request/origin-request-service.js +273 -49
- package/dist/services/origin-request/runtime-config-source.d.ts +6 -0
- package/dist/services/origin-request/runtime-config-source.js +15 -4
- package/dist/services/origin-request/spec/asset-variations.spec.js +20 -0
- package/dist/services/origin-request/spec/origin-request-service.spec.js +329 -6
- package/dist/services/query-builder/rules/rule-match.d.ts +35 -0
- package/dist/services/query-builder/rules/rule-match.js +70 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.d.ts +1 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.js +121 -0
- package/dist/services/run-control/browser/run-browser-contexts.d.ts +557 -0
- package/dist/services/run-control/browser/run-browser-contexts.js +91 -0
- package/dist/services/run-control/browser/run-browser-service-factory.d.ts +5 -0
- package/dist/services/run-control/browser/run-browser-service-factory.js +7 -0
- package/dist/services/run-control/browser/run-browser-service.d.ts +68 -0
- package/dist/services/run-control/browser/run-browser-service.js +206 -0
- package/dist/services/run-control/cache/run-cache-contexts.d.ts +349 -0
- package/dist/services/run-control/cache/run-cache-contexts.js +51 -0
- package/dist/services/run-control/cache/run-cache-service-factory.d.ts +6 -0
- package/dist/services/run-control/cache/run-cache-service-factory.js +12 -0
- package/dist/services/run-control/cache/run-cache-service.d.ts +35 -0
- package/dist/services/run-control/cache/run-cache-service.js +151 -0
- package/dist/services/run-control/control-client.d.ts +36 -0
- package/dist/services/run-control/control-client.js +147 -0
- package/dist/services/run-control/debug/run-debug-contexts.d.ts +416 -0
- package/dist/services/run-control/debug/run-debug-contexts.js +47 -0
- package/dist/services/run-control/debug/run-debug-service-factory.d.ts +5 -0
- package/dist/services/run-control/debug/run-debug-service-factory.js +7 -0
- package/dist/services/run-control/debug/run-debug-service.d.ts +39 -0
- package/dist/services/run-control/debug/run-debug-service.js +164 -0
- package/dist/services/run-control/files/run-files-contexts.d.ts +238 -0
- package/dist/services/run-control/files/run-files-contexts.js +26 -0
- package/dist/services/run-control/files/run-files-service-factory.d.ts +5 -0
- package/dist/services/run-control/files/run-files-service-factory.js +7 -0
- package/dist/services/run-control/files/run-files-service.d.ts +29 -0
- package/dist/services/run-control/files/run-files-service.js +120 -0
- package/dist/services/run-control/index.d.ts +32 -0
- package/dist/services/run-control/index.js +31 -0
- package/dist/services/run-control/inject/run-inject-contexts.d.ts +319 -0
- package/dist/services/run-control/inject/run-inject-contexts.js +38 -0
- package/dist/services/run-control/inject/run-inject-service-factory.d.ts +5 -0
- package/dist/services/run-control/inject/run-inject-service-factory.js +7 -0
- package/dist/services/run-control/inject/run-inject-service.d.ts +31 -0
- package/dist/services/run-control/inject/run-inject-service.js +227 -0
- package/dist/services/run-control/live-run.d.ts +37 -0
- package/dist/services/run-control/live-run.js +56 -0
- package/dist/services/run-control/probe/run-probe-contexts.d.ts +333 -0
- package/dist/services/run-control/probe/run-probe-contexts.js +73 -0
- package/dist/services/run-control/probe/run-probe-service-factory.d.ts +5 -0
- package/dist/services/run-control/probe/run-probe-service-factory.js +7 -0
- package/dist/services/run-control/probe/run-probe-service.d.ts +54 -0
- package/dist/services/run-control/probe/run-probe-service.js +194 -0
- package/dist/services/run-control/rum/run-rum-contexts.d.ts +216 -0
- package/dist/services/run-control/rum/run-rum-contexts.js +34 -0
- package/dist/services/run-control/rum/run-rum-service-factory.d.ts +5 -0
- package/dist/services/run-control/rum/run-rum-service-factory.js +7 -0
- package/dist/services/run-control/rum/run-rum-service.d.ts +36 -0
- package/dist/services/run-control/rum/run-rum-service.js +122 -0
- package/dist/services/run-control/run-answer.d.ts +28 -0
- package/dist/services/run-control/run-answer.js +58 -0
- package/dist/services/run-control/run-control-context.d.ts +102 -0
- package/dist/services/run-control/run-control-context.js +36 -0
- package/dist/services/run-control/run-control-flags.d.ts +12 -0
- package/dist/services/run-control/run-control-flags.js +22 -0
- package/dist/services/run-control/run-control-model.d.ts +9 -0
- package/dist/services/run-control/run-control-model.js +1 -0
- package/dist/services/run-control/run-control-service-factory.d.ts +14 -0
- package/dist/services/run-control/run-control-service-factory.js +26 -0
- package/dist/services/run-control/session/run-session-contexts.d.ts +25 -0
- package/dist/services/run-control/session/run-session-contexts.js +20 -0
- package/dist/services/run-control/session/run-session-service-factory.d.ts +8 -0
- package/dist/services/run-control/session/run-session-service-factory.js +18 -0
- package/dist/services/run-control/session/run-session-service.d.ts +32 -0
- package/dist/services/run-control/session/run-session-service.js +151 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.js +327 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.js +454 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.js +113 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.js +234 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.js +251 -0
- package/dist/services/run-control/spec/live-run-fixture.d.ts +32 -0
- package/dist/services/run-control/spec/live-run-fixture.js +109 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.js +108 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.js +47 -0
- package/dist/services/run-control/spec/run-answer.spec.d.ts +1 -0
- package/dist/services/run-control/spec/run-answer.spec.js +57 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.js +150 -0
- package/dist/services/run-log/crash-mirror.d.ts +31 -0
- package/dist/services/run-log/crash-mirror.js +69 -0
- package/dist/services/run-log/index.d.ts +11 -0
- package/dist/services/run-log/index.js +11 -0
- package/dist/services/run-log/jsonl-appender.d.ts +46 -0
- package/dist/services/run-log/jsonl-appender.js +91 -0
- package/dist/services/run-log/log-event-model.d.ts +104 -0
- package/dist/services/run-log/log-event-model.js +56 -0
- package/dist/services/run-log/log-query-service-factory.d.ts +11 -0
- package/dist/services/run-log/log-query-service-factory.js +14 -0
- package/dist/services/run-log/log-query-service.d.ts +59 -0
- package/dist/services/run-log/log-query-service.js +111 -0
- package/dist/services/run-log/log-reader.d.ts +84 -0
- package/dist/services/run-log/log-reader.js +180 -0
- package/dist/services/run-log/log-summary.d.ts +72 -0
- package/dist/services/run-log/log-summary.js +208 -0
- package/dist/services/run-log/redaction.d.ts +34 -0
- package/dist/services/run-log/redaction.js +124 -0
- package/dist/services/run-log/request-log.d.ts +82 -0
- package/dist/services/run-log/request-log.js +69 -0
- package/dist/services/run-log/request-summary.d.ts +76 -0
- package/dist/services/run-log/request-summary.js +0 -0
- package/dist/services/run-log/run-log.d.ts +61 -0
- package/dist/services/run-log/run-log.js +102 -0
- package/dist/services/run-log/spec/log-query-service.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-query-service.spec.js +197 -0
- package/dist/services/run-log/spec/log-reader.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-reader.spec.js +109 -0
- package/dist/services/run-log/spec/log-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-summary.spec.js +153 -0
- package/dist/services/run-log/spec/redaction.spec.d.ts +1 -0
- package/dist/services/run-log/spec/redaction.spec.js +61 -0
- package/dist/services/run-log/spec/request-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-log.spec.js +101 -0
- package/dist/services/run-log/spec/request-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-summary.spec.js +171 -0
- package/dist/services/run-log/spec/run-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/run-log.spec.js +122 -0
- package/dist/services/run-registry/exit-classification.d.ts +39 -0
- package/dist/services/run-registry/exit-classification.js +42 -0
- package/dist/services/run-registry/index.d.ts +3 -0
- package/dist/services/run-registry/index.js +3 -0
- package/dist/services/run-registry/process-identity.d.ts +28 -0
- package/dist/services/run-registry/process-identity.js +80 -0
- package/dist/services/run-registry/run-registry-model.d.ts +128 -0
- package/dist/services/run-registry/run-registry-model.js +16 -0
- package/dist/services/run-registry/run-registry.d.ts +155 -0
- package/dist/services/run-registry/run-registry.js +430 -0
- package/dist/services/run-registry/spec/exit-classification.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/exit-classification.spec.js +82 -0
- package/dist/services/run-registry/spec/run-registry.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/run-registry.spec.js +526 -0
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +3409 -288
- package/package.json +20 -2
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { describe, it } from "mocha";
|
|
3
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { memoryCli } from "../../../cli/spec/memory-cli.js";
|
|
7
|
+
import { MemorySink } from "../../../cli/sink.js";
|
|
8
|
+
import { Cache } from "../../request-cache/cache.js";
|
|
9
|
+
import { assetRequestUrl } from "../../request-cache/asset-key.js";
|
|
10
|
+
import { VirtualOrestesApp } from "../../virtual-orestes-app/index.js";
|
|
11
|
+
const APP_DOMAIN = "shop.app.baqend.com";
|
|
12
|
+
const PAGE = "https://shop.example.com/cart";
|
|
13
|
+
/** A local app whose origin fetcher names `variations` and must not be asked to fetch. */
|
|
14
|
+
function app(sink, variations = []) {
|
|
15
|
+
const directory = mkdtempSync(join(tmpdir(), "sk-orestes-"));
|
|
16
|
+
let fetched = false;
|
|
17
|
+
const originFetcher = {
|
|
18
|
+
namedVariations: () => variations,
|
|
19
|
+
fetch: async () => {
|
|
20
|
+
fetched = true;
|
|
21
|
+
return undefined;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
const orestes = new VirtualOrestesApp({ appDomain: APP_DOMAIN }, originFetcher, {}, new Cache(memoryCli(), join(directory, "dh-cache")), memoryCli(sink), {});
|
|
25
|
+
return {
|
|
26
|
+
orestes,
|
|
27
|
+
fetched: () => fetched,
|
|
28
|
+
remove: () => rmSync(directory, { recursive: true, force: true }),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const request = (variation) => ({
|
|
32
|
+
request: { url: assetRequestUrl(APP_DOMAIN, PAGE, variation) },
|
|
33
|
+
});
|
|
34
|
+
describe("VirtualOrestesApp — the break variation", () => {
|
|
35
|
+
it("should answer a break page as Orestes does, so the worker serves it from origin", async () => {
|
|
36
|
+
const sink = new MemorySink();
|
|
37
|
+
const { orestes, fetched, remove } = app(sink);
|
|
38
|
+
try {
|
|
39
|
+
const response = (await orestes.fetchAssetResponse(request("break")));
|
|
40
|
+
await orestes.fetchAssetResponse(request("break"));
|
|
41
|
+
expect(response.responseCode).to.equal(400);
|
|
42
|
+
expect(response.responseHeaders).to.deep.include({
|
|
43
|
+
name: "server-timing",
|
|
44
|
+
value: "errorcode;desc=322",
|
|
45
|
+
});
|
|
46
|
+
expect(fetched()).to.equal(false);
|
|
47
|
+
const reported = sink.lines.filter((line) => line.includes("break"));
|
|
48
|
+
expect(reported).to.have.length(1);
|
|
49
|
+
expect(reported[0]).to.contain("served from origin");
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
remove();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
it("should build a break page like any other when the runtime config defines break", async () => {
|
|
56
|
+
const { orestes, fetched, remove } = app(new MemorySink(), ["break"]);
|
|
57
|
+
try {
|
|
58
|
+
await orestes.fetchAssetResponse(request("break"));
|
|
59
|
+
expect(fetched()).to.equal(true);
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
remove();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { InstallResourceInterface } from "../integration-api/integration-api-model.js";
|
|
2
2
|
export interface task {
|
|
3
3
|
todo: string;
|
|
4
|
+
/** The three lines beneath it, URI-encoded — see {@link TodoCollector}. */
|
|
4
5
|
context: string;
|
|
5
6
|
file: string;
|
|
6
7
|
line: number;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* Collects the open tasks written into a customer's config files.
|
|
11
|
+
*
|
|
12
|
+
* Read by two consumers with different needs: the devtools panel, which the
|
|
13
|
+
* messages are shaped for, and `sk onboarding todo` over the control socket. `context` is
|
|
14
|
+
* URI-encoded because the panel's transport expects it that way; the control
|
|
15
|
+
* handler decodes it again rather than handing an agent percent-escapes.
|
|
11
16
|
*/
|
|
12
17
|
export declare class TodoCollector {
|
|
13
18
|
private files;
|
|
@@ -1,8 +1,35 @@
|
|
|
1
1
|
import { FILE_TYPE } from "../integration-api/index.js";
|
|
2
|
-
const TODO_MATCH = /(todo[^\n\r()|]*)((?:(?:\r\n|\r|\n)[^\n\r()|]*){3})/i;
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* A `TODO` and the three lines under it.
|
|
4
|
+
*
|
|
5
|
+
* Global on purpose. It used to be matched with a non-global regex through
|
|
6
|
+
* `String.replace`, which calls its replacer once — so a file with four open
|
|
7
|
+
* tasks reported one, and the other three were invisible to both the devtools
|
|
8
|
+
* panel and anything else that asked.
|
|
9
|
+
*
|
|
10
|
+
* Three further things that each silently dropped a task, all of them found
|
|
11
|
+
* against a real config:
|
|
12
|
+
*
|
|
13
|
+
* - **The context is a lookahead.** Consuming the three lines moved
|
|
14
|
+
* `lastIndex` past them, so a second `TODO` written inside that window was
|
|
15
|
+
* swallowed into the first one's context and never reported. Two notes in a
|
|
16
|
+
* row is the ordinary way people write them.
|
|
17
|
+
* - **Parentheses are allowed.** The text and the context lines used to be
|
|
18
|
+
* `[^\n\r()|]*`, so a `(`, `)` or `|` anywhere in the task or in the three
|
|
19
|
+
* lines beneath it failed the whole match and the task vanished — and a JS
|
|
20
|
+
* config is full of them. `// TODO confirm the wishlist pattern` sitting one
|
|
21
|
+
* line above `/wish(-)?list/i` was invisible.
|
|
22
|
+
* - **Fewer than three lines is enough.** `{3}` required them, so a `TODO` in
|
|
23
|
+
* the last lines of a file matched nothing.
|
|
24
|
+
*/
|
|
25
|
+
const TODO_MATCH = /(todo[^\n\r]*)(?=((?:(?:\r\n|\r|\n)[^\n\r]*){0,3}))/gi;
|
|
26
|
+
/**
|
|
27
|
+
* Collects the open tasks written into a customer's config files.
|
|
28
|
+
*
|
|
29
|
+
* Read by two consumers with different needs: the devtools panel, which the
|
|
30
|
+
* messages are shaped for, and `sk onboarding todo` over the control socket. `context` is
|
|
31
|
+
* URI-encoded because the panel's transport expects it that way; the control
|
|
32
|
+
* handler decodes it again rather than handing an agent percent-escapes.
|
|
6
33
|
*/
|
|
7
34
|
export class TodoCollector {
|
|
8
35
|
files;
|
|
@@ -10,21 +37,31 @@ export class TodoCollector {
|
|
|
10
37
|
this.files = files;
|
|
11
38
|
}
|
|
12
39
|
getOpenTasks() {
|
|
13
|
-
const configFiles = this.files.filter((file) =>
|
|
14
|
-
return !(file.type === FILE_TYPE.VIRTUAL_FILE);
|
|
15
|
-
});
|
|
40
|
+
const configFiles = this.files.filter((file) => file.type !== FILE_TYPE.VIRTUAL_FILE);
|
|
16
41
|
const tasks = [];
|
|
17
42
|
for (const configFile of configFiles) {
|
|
18
43
|
const content = configFile.getContent();
|
|
19
|
-
|
|
44
|
+
// A fresh regex per file: a global one carries `lastIndex` between
|
|
45
|
+
// calls, so sharing the constant would make every second file start
|
|
46
|
+
// matching from wherever the previous one stopped.
|
|
47
|
+
const pattern = new RegExp(TODO_MATCH.source, TODO_MATCH.flags);
|
|
48
|
+
let match;
|
|
49
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
20
50
|
tasks.push({
|
|
21
|
-
todo:
|
|
22
|
-
context: encodeURI(
|
|
51
|
+
todo: match[1],
|
|
52
|
+
context: encodeURI(match[2]),
|
|
23
53
|
file: configFile.path,
|
|
24
|
-
|
|
54
|
+
// From the match position, not from a text search. Two identical
|
|
55
|
+
// TODOs in one file both reported the first one's line.
|
|
56
|
+
line: this.lineNumberByIndex(match.index, content),
|
|
25
57
|
});
|
|
26
|
-
|
|
27
|
-
|
|
58
|
+
// A zero-length match would otherwise spin here forever. The context
|
|
59
|
+
// is a lookahead, so `lastIndex` sits at the end of the TODO's own
|
|
60
|
+
// line — which is what leaves the lines beneath it open to match.
|
|
61
|
+
if (match.index === pattern.lastIndex) {
|
|
62
|
+
pattern.lastIndex += 1;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
28
65
|
}
|
|
29
66
|
return tasks;
|
|
30
67
|
}
|
|
@@ -5,6 +5,7 @@ import { Cache } from "../request-cache/cache.js";
|
|
|
5
5
|
import { CliServiceInterface } from "../../cli/index.js";
|
|
6
6
|
import { OriginFetcher } from "../../origin-request/index.js";
|
|
7
7
|
import { CustomerConfig } from "../../integration-api/index.js";
|
|
8
|
+
import { LocalCacheErrorEntry } from "../control/control-protocol.js";
|
|
8
9
|
import { DevtoolsExtensionApi } from "../browser/extension/devtools-extension-api.js";
|
|
9
10
|
export declare class VirtualOrestesApp {
|
|
10
11
|
private customerConfig;
|
|
@@ -16,8 +17,30 @@ export declare class VirtualOrestesApp {
|
|
|
16
17
|
private removeContentSecurityPolicy;
|
|
17
18
|
private localCacheErrors;
|
|
18
19
|
private prerendererHintShown;
|
|
20
|
+
/** The pages already reported as `break` pages, so each is reported once. */
|
|
21
|
+
private readonly breakPages;
|
|
19
22
|
constructor(customerConfig: CustomerConfig, originFetcher: OriginFetcher, documentHandler: DocumentHandlerServer, cache: Cache, cli: CliServiceInterface, developmentToolsMessages: DevtoolsExtensionApi, removeContentSecurityPolicy?: boolean);
|
|
20
23
|
fetchAssetResponse(event: Protocol.Fetch.RequestPausedEvent): Promise<Partial<Protocol.Fetch.FulfillRequestRequest> | AbortResponse>;
|
|
24
|
+
/** The variations the runtime config names: see {@link OriginFetcher.namedVariations}. */
|
|
25
|
+
namedVariations(): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Build and cache one variation of a url without the browser asking for it.
|
|
28
|
+
*
|
|
29
|
+
* The same path a real asset request takes — {@link buildResponse} fetches
|
|
30
|
+
* the origin with the variation's headers, runs the documentHandler over it
|
|
31
|
+
* and caches the result — with the request synthesised rather than
|
|
32
|
+
* intercepted. That is what makes a variation reachable at all: a browser is
|
|
33
|
+
* one device at a time, so mobile and desktop can never both be in the cache
|
|
34
|
+
* from browsing, and the comparison everyone wants to make is between exactly
|
|
35
|
+
* those two.
|
|
36
|
+
*
|
|
37
|
+
* Throws what the build threw. The caller is asking for one specific entry,
|
|
38
|
+
* so a failure is the answer to its question, not a background detail —
|
|
39
|
+
* unlike {@link refreshEntry}, which is fire-and-forget and logs instead.
|
|
40
|
+
*
|
|
41
|
+
* @returns the cache key the entry was stored under.
|
|
42
|
+
*/
|
|
43
|
+
prewarm(originUrl: string, variation: string): Promise<string>;
|
|
21
44
|
/**
|
|
22
45
|
* Re-warm all cached entries for the given origin url in the background.
|
|
23
46
|
*
|
|
@@ -49,6 +72,19 @@ export declare class VirtualOrestesApp {
|
|
|
49
72
|
private refreshEntry;
|
|
50
73
|
private buildResponse;
|
|
51
74
|
private getResponseText;
|
|
75
|
+
/**
|
|
76
|
+
* The urls the local documentHandler could not build, as they stand now.
|
|
77
|
+
*
|
|
78
|
+
* Already collected for the devtools panel; this is the same list for a
|
|
79
|
+
* reader without one. State rather than history: an entry disappears once the
|
|
80
|
+
* same url and variation builds successfully, so an empty list means nothing
|
|
81
|
+
* is currently failing, not that nothing ever did.
|
|
82
|
+
*
|
|
83
|
+
* `occurredAt` is converted to ISO on the way out — the panel wants epoch
|
|
84
|
+
* milliseconds to sort by, a reader wants a timestamp it can compare against
|
|
85
|
+
* a log line.
|
|
86
|
+
*/
|
|
87
|
+
getLocalCacheErrors(): LocalCacheErrorEntry[];
|
|
52
88
|
private localCacheErrorKey;
|
|
53
89
|
private recordLocalCacheError;
|
|
54
90
|
private clearLocalCacheError;
|
|
@@ -60,6 +96,8 @@ export declare class VirtualOrestesApp {
|
|
|
60
96
|
* `ServerDocumentHandlerAbort`. Answering 500 instead makes the service worker treat
|
|
61
97
|
* the page as an infrastructure failure and disconnect Speed Kit.
|
|
62
98
|
*/
|
|
99
|
+
/** What Orestes answers for an undefined variation: the service worker serves from origin. */
|
|
100
|
+
private returnBreakResponse;
|
|
63
101
|
private returnAbortResponse;
|
|
64
102
|
private reportAbort;
|
|
65
103
|
private warnPrerendererUnreachable;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assetOriginUrl, assetRequestUrl } from "../request-cache/asset-key.js";
|
|
1
2
|
import { BaqendResponse } from "../browser/baqend-response.js";
|
|
2
3
|
import { ABORT_SERVER_TIMING, ABORT_STATUS_CODE, isDocumentHandlerAbort, isLocalPrerendererUnreachable, LOCAL_PRERENDERER_PORT, prerenderFailure, } from "../../document-handler-runtime/document-handler-abort.js";
|
|
3
4
|
import { isBlockedOriginStatus, ORIGIN_ERROR_STATUS_CODE, originErrorCauseName, originErrorCode, originErrorServerTiming, } from "../../origin-request/index.js";
|
|
@@ -20,6 +21,13 @@ const SECURITY_HEADERS = [
|
|
|
20
21
|
"strict-transport-security",
|
|
21
22
|
"x-frame-options",
|
|
22
23
|
];
|
|
24
|
+
/**
|
|
25
|
+
* The reserved variation a `customVariation` returns to serve a page from origin. Orestes
|
|
26
|
+
* defines no such variation, so it answers a Bad Request and the service worker falls back.
|
|
27
|
+
*/
|
|
28
|
+
const BREAK_VARIATION = "break";
|
|
29
|
+
/** Orestes' `ServerVariationNotDefined`, the error code a `break` request gets. */
|
|
30
|
+
const VARIATION_NOT_DEFINED_CODE = "322";
|
|
23
31
|
export class VirtualOrestesApp {
|
|
24
32
|
customerConfig;
|
|
25
33
|
originFetcher;
|
|
@@ -35,6 +43,8 @@ export class VirtualOrestesApp {
|
|
|
35
43
|
localCacheErrors = new Map();
|
|
36
44
|
// The hint to start the pre-renderer is shown once; every later page gets one line.
|
|
37
45
|
prerendererHintShown = false;
|
|
46
|
+
/** The pages already reported as `break` pages, so each is reported once. */
|
|
47
|
+
breakPages = new Set();
|
|
38
48
|
constructor(customerConfig, originFetcher, documentHandler, cache, cli, developmentToolsMessages, removeContentSecurityPolicy = false) {
|
|
39
49
|
this.customerConfig = customerConfig;
|
|
40
50
|
this.originFetcher = originFetcher;
|
|
@@ -51,6 +61,32 @@ export class VirtualOrestesApp {
|
|
|
51
61
|
}
|
|
52
62
|
return this.buildResponse(event.request.url);
|
|
53
63
|
}
|
|
64
|
+
/** The variations the runtime config names: see {@link OriginFetcher.namedVariations}. */
|
|
65
|
+
namedVariations() {
|
|
66
|
+
return this.originFetcher.namedVariations();
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Build and cache one variation of a url without the browser asking for it.
|
|
70
|
+
*
|
|
71
|
+
* The same path a real asset request takes — {@link buildResponse} fetches
|
|
72
|
+
* the origin with the variation's headers, runs the documentHandler over it
|
|
73
|
+
* and caches the result — with the request synthesised rather than
|
|
74
|
+
* intercepted. That is what makes a variation reachable at all: a browser is
|
|
75
|
+
* one device at a time, so mobile and desktop can never both be in the cache
|
|
76
|
+
* from browsing, and the comparison everyone wants to make is between exactly
|
|
77
|
+
* those two.
|
|
78
|
+
*
|
|
79
|
+
* Throws what the build threw. The caller is asking for one specific entry,
|
|
80
|
+
* so a failure is the answer to its question, not a background detail —
|
|
81
|
+
* unlike {@link refreshEntry}, which is fire-and-forget and logs instead.
|
|
82
|
+
*
|
|
83
|
+
* @returns the cache key the entry was stored under.
|
|
84
|
+
*/
|
|
85
|
+
async prewarm(originUrl, variation) {
|
|
86
|
+
const requestUrl = assetRequestUrl(this.customerConfig.appDomain, originUrl, variation);
|
|
87
|
+
await this.buildResponse(requestUrl);
|
|
88
|
+
return requestUrl;
|
|
89
|
+
}
|
|
54
90
|
/**
|
|
55
91
|
* Re-warm all cached entries for the given origin url in the background.
|
|
56
92
|
*
|
|
@@ -66,10 +102,13 @@ export class VirtualOrestesApp {
|
|
|
66
102
|
.map(([key]) => key)
|
|
67
103
|
.filter((key) => key.includes(originUrl));
|
|
68
104
|
if (matchingKeys.length === 0) {
|
|
69
|
-
this.cli.write(`changeDetection for url: ${originUrl} - nothing cached to refresh
|
|
105
|
+
this.cli.write(`changeDetection for url: ${originUrl} - nothing cached to refresh`, false, { scope: "cache", data: { url: originUrl, refreshed: 0 } });
|
|
70
106
|
return;
|
|
71
107
|
}
|
|
72
|
-
this.cli.write(`changeDetection triggered for url: ${originUrl} - refreshing dh-cache in background
|
|
108
|
+
this.cli.write(`changeDetection triggered for url: ${originUrl} - refreshing dh-cache in background`, false, {
|
|
109
|
+
scope: "cache",
|
|
110
|
+
data: { url: originUrl, refreshed: matchingKeys.length },
|
|
111
|
+
});
|
|
73
112
|
for (const key of matchingKeys) {
|
|
74
113
|
await this.refreshEntry(key);
|
|
75
114
|
}
|
|
@@ -91,7 +130,10 @@ export class VirtualOrestesApp {
|
|
|
91
130
|
if (matchingKeys.length === 0) {
|
|
92
131
|
return;
|
|
93
132
|
}
|
|
94
|
-
this.cli.write(`refreshing ${matchingKeys.length} dh-cache entries for current url ${currentUrl} in background
|
|
133
|
+
this.cli.write(`refreshing ${matchingKeys.length} dh-cache entries for current url ${currentUrl} in background`, false, {
|
|
134
|
+
scope: "cache",
|
|
135
|
+
data: { url: currentUrl, refreshed: matchingKeys.length },
|
|
136
|
+
});
|
|
95
137
|
for (const key of matchingKeys) {
|
|
96
138
|
await this.refreshEntry(key);
|
|
97
139
|
}
|
|
@@ -107,7 +149,7 @@ export class VirtualOrestesApp {
|
|
|
107
149
|
const result = await safe(this.buildResponse(requestUrl));
|
|
108
150
|
if (result.success === false) {
|
|
109
151
|
this.cache.removeEntry(requestUrl);
|
|
110
|
-
this.cli.writeError(`failed to refresh dh-cache entry ${requestUrl}: ${result.error}
|
|
152
|
+
this.cli.writeError(`failed to refresh dh-cache entry ${requestUrl}: ${result.error}`, false, { scope: "cache", data: { url: requestUrl, error: result.error } });
|
|
111
153
|
}
|
|
112
154
|
}
|
|
113
155
|
async buildResponse(requestUrl) {
|
|
@@ -116,6 +158,10 @@ export class VirtualOrestesApp {
|
|
|
116
158
|
const variation = UrlObject.searchParams.has("bqvariation")
|
|
117
159
|
? UrlObject.searchParams.get("bqvariation").trim()
|
|
118
160
|
: "default";
|
|
161
|
+
if (variation === BREAK_VARIATION &&
|
|
162
|
+
!this.originFetcher.namedVariations().includes(BREAK_VARIATION)) {
|
|
163
|
+
return this.returnBreakResponse(originUrl);
|
|
164
|
+
}
|
|
119
165
|
const fetchResult = await this.originFetcher.fetch(originUrl, variation);
|
|
120
166
|
const response = fetchResult?.response;
|
|
121
167
|
// URL we actually fetched (origin + variation query params); used for the redirect check below
|
|
@@ -145,7 +191,7 @@ export class VirtualOrestesApp {
|
|
|
145
191
|
if (!this.isHtmlContentHeader(response?.headers) ||
|
|
146
192
|
!this.isValidHtmlContent(responseContent)) {
|
|
147
193
|
const customResponse = new BaqendResponse(responseContent, `text/html; charset=${textEncoding}`, customHeaders);
|
|
148
|
-
this.cache.addEntry(requestUrl, customResponse);
|
|
194
|
+
this.cache.addEntry(requestUrl, customResponse, responseContent);
|
|
149
195
|
return customResponse;
|
|
150
196
|
}
|
|
151
197
|
const customResponse = await safe(this.documentHandler.transform(`text/html;charset=${textEncoding}`, responseContent, variation, originUrl, this.convertResponseHeadersToOrestesFormat(response)));
|
|
@@ -183,16 +229,36 @@ export class VirtualOrestesApp {
|
|
|
183
229
|
name: "x-sk-detected-encoding",
|
|
184
230
|
value: textEncoding,
|
|
185
231
|
});
|
|
186
|
-
|
|
232
|
+
// Decoded, and cached decoded: only Chrome needs the base64.
|
|
233
|
+
const decodedBody = Buffer.isBuffer(skResponse.body)
|
|
187
234
|
? skResponse.body
|
|
188
|
-
: iconv.encode(skResponse.body, textEncoding)
|
|
189
|
-
|
|
235
|
+
: iconv.encode(skResponse.body, textEncoding);
|
|
236
|
+
const baqendResponse = new BaqendResponse(decodedBody, skResponse.headers["content-type"] ?? `text/html;charset=${textEncoding}`, [...customHeaders, ...originHeaders]);
|
|
237
|
+
this.cache.addEntry(requestUrl, baqendResponse, decodedBody);
|
|
190
238
|
return baqendResponse;
|
|
191
239
|
}
|
|
192
240
|
async getResponseText(response) {
|
|
193
241
|
const { text, charset } = decodeHtml(response?.headers.get("content-type") || "", Buffer.from(await response.arrayBuffer()));
|
|
194
242
|
return { responseContent: text, textEncoding: charset };
|
|
195
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* The urls the local documentHandler could not build, as they stand now.
|
|
246
|
+
*
|
|
247
|
+
* Already collected for the devtools panel; this is the same list for a
|
|
248
|
+
* reader without one. State rather than history: an entry disappears once the
|
|
249
|
+
* same url and variation builds successfully, so an empty list means nothing
|
|
250
|
+
* is currently failing, not that nothing ever did.
|
|
251
|
+
*
|
|
252
|
+
* `occurredAt` is converted to ISO on the way out — the panel wants epoch
|
|
253
|
+
* milliseconds to sort by, a reader wants a timestamp it can compare against
|
|
254
|
+
* a log line.
|
|
255
|
+
*/
|
|
256
|
+
getLocalCacheErrors() {
|
|
257
|
+
return [...this.localCacheErrors.values()].map((error) => ({
|
|
258
|
+
...error,
|
|
259
|
+
occurredAt: new Date(error.occurredAt).toISOString(),
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
196
262
|
localCacheErrorKey(url, variation) {
|
|
197
263
|
return `${url}|${variation}`;
|
|
198
264
|
}
|
|
@@ -227,6 +293,24 @@ export class VirtualOrestesApp {
|
|
|
227
293
|
* `ServerDocumentHandlerAbort`. Answering 500 instead makes the service worker treat
|
|
228
294
|
* the page as an infrastructure failure and disconnect Speed Kit.
|
|
229
295
|
*/
|
|
296
|
+
/** What Orestes answers for an undefined variation: the service worker serves from origin. */
|
|
297
|
+
returnBreakResponse(originUrl) {
|
|
298
|
+
if (!this.breakPages.has(originUrl)) {
|
|
299
|
+
this.breakPages.add(originUrl);
|
|
300
|
+
this.cli.comment(`${originUrl} has the variation break: served from origin, not accelerated`, false, {
|
|
301
|
+
scope: "cache",
|
|
302
|
+
data: { url: originUrl, variation: BREAK_VARIATION },
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
const message = `Variation ${BREAK_VARIATION} not found.`;
|
|
306
|
+
return new BaqendResponse(message, null, [
|
|
307
|
+
{ name: "x-error", value: message },
|
|
308
|
+
{
|
|
309
|
+
name: "server-timing",
|
|
310
|
+
value: originErrorServerTiming(VARIATION_NOT_DEFINED_CODE),
|
|
311
|
+
},
|
|
312
|
+
], ORIGIN_ERROR_STATUS_CODE);
|
|
313
|
+
}
|
|
230
314
|
returnAbortResponse(customResponse, customHeaders) {
|
|
231
315
|
const message = customResponse.error;
|
|
232
316
|
this.reportAbort(message, customResponse.errorObj);
|
|
@@ -238,13 +322,17 @@ export class VirtualOrestesApp {
|
|
|
238
322
|
this.warnPrerendererUnreachable();
|
|
239
323
|
return;
|
|
240
324
|
}
|
|
325
|
+
const meta = {
|
|
326
|
+
scope: "documentHandler",
|
|
327
|
+
data: { aborted: true, status: ABORT_STATUS_CODE, error: message },
|
|
328
|
+
};
|
|
241
329
|
const failure = prerenderFailure(error);
|
|
242
330
|
if (failure) {
|
|
243
331
|
this.cli.writeError(`[DocumentHandler:local]: SSR failed for ${failure.url} (${failure.variation}): ` +
|
|
244
|
-
`${failure.detailMessage ?? "no error message"}
|
|
332
|
+
`${failure.detailMessage ?? "no error message"}`, false, meta);
|
|
245
333
|
return;
|
|
246
334
|
}
|
|
247
|
-
this.cli.writeWarning(`[DocumentHandler:local]: ${message}
|
|
335
|
+
this.cli.writeWarning(`[DocumentHandler:local]: ${message}`, false, meta);
|
|
248
336
|
}
|
|
249
337
|
warnPrerendererUnreachable() {
|
|
250
338
|
const unreachable = `no pre-renderer is listening on localhost:${LOCAL_PRERENDERER_PORT}`;
|
|
@@ -291,9 +379,18 @@ export class VirtualOrestesApp {
|
|
|
291
379
|
return this.returnAbortResponse(customResponse, customHeaders);
|
|
292
380
|
}
|
|
293
381
|
const message = `Could not transform html: - ${customResponse.error}`;
|
|
294
|
-
this.cli.writeError(`[VirtualOrestes]: ${message}
|
|
295
|
-
|
|
296
|
-
|
|
382
|
+
this.cli.writeError(`[VirtualOrestes]: ${message}`, false, {
|
|
383
|
+
scope: "documentHandler",
|
|
384
|
+
data: {
|
|
385
|
+
error: customResponse.error,
|
|
386
|
+
stack: customResponse.errorObj.stack,
|
|
387
|
+
},
|
|
388
|
+
});
|
|
389
|
+
this.cli.comment(customResponse.errorObj.stack, false, {
|
|
390
|
+
scope: "documentHandler",
|
|
391
|
+
level: "debug",
|
|
392
|
+
});
|
|
393
|
+
this.cli.writeWarning("Suggestion: check files: config_documentHandler.es6 | custom_documentHandler.js", false, { scope: "documentHandler" });
|
|
297
394
|
customHeaders.push({ name: "x-error", value: message });
|
|
298
395
|
return new BaqendResponse(message, null, customHeaders, 500);
|
|
299
396
|
}
|
|
@@ -310,7 +407,7 @@ export class VirtualOrestesApp {
|
|
|
310
407
|
value: response?.headers.get("location") || "",
|
|
311
408
|
});
|
|
312
409
|
const redirectResponse = new BaqendResponse("", null, customHeaders, response.status);
|
|
313
|
-
this.cache.addEntry(requestUrl, redirectResponse);
|
|
410
|
+
this.cache.addEntry(requestUrl, redirectResponse, "");
|
|
314
411
|
return redirectResponse;
|
|
315
412
|
}
|
|
316
413
|
handleCdnRedirect(customHeaders, response, requestUrl) {
|
|
@@ -328,22 +425,11 @@ export class VirtualOrestesApp {
|
|
|
328
425
|
// the CDN redirect surfaced as a bare ClientError (`AssetAPIHandler.ts:200-205`).
|
|
329
426
|
serverTimingHeader.value += ",errorcode;desc=202";
|
|
330
427
|
const redirectResponse = new BaqendResponse("", null, customHeaders, 400);
|
|
331
|
-
this.cache.addEntry(requestUrl, redirectResponse);
|
|
428
|
+
this.cache.addEntry(requestUrl, redirectResponse, "");
|
|
332
429
|
return redirectResponse;
|
|
333
430
|
}
|
|
334
431
|
getAssetUrl(requestUrl) {
|
|
335
|
-
|
|
336
|
-
const parametersToDelete = [];
|
|
337
|
-
for (const [name] of url.searchParams.entries()) {
|
|
338
|
-
if (name.startsWith("bq")) {
|
|
339
|
-
parametersToDelete.push(name);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
for (const parameter of parametersToDelete) {
|
|
343
|
-
url.searchParams.delete(parameter);
|
|
344
|
-
}
|
|
345
|
-
const cleanedUrl = url.toString();
|
|
346
|
-
return cleanedUrl.split("app.baqend.com/v1/asset/")[1];
|
|
432
|
+
return assetOriginUrl(requestUrl);
|
|
347
433
|
}
|
|
348
434
|
getCachedResponse(requestUrl) {
|
|
349
435
|
const response = this.cache.getEntry(requestUrl);
|
|
@@ -19,6 +19,13 @@ export interface AssetVariation {
|
|
|
19
19
|
regex?: string | null;
|
|
20
20
|
/** Which config key produced this entry. Set during resolution, for reporting. */
|
|
21
21
|
matchedKey?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Set during resolution, for reporting: the entry came from a regex key that
|
|
24
|
+
* matched the requested variation, not from a key of that name. Carried on
|
|
25
|
+
* the entry because only the resolution knows it — reading it back off the
|
|
26
|
+
* finished chain cannot tell a named key from a matched template.
|
|
27
|
+
*/
|
|
28
|
+
viaTemplate?: boolean;
|
|
22
29
|
}
|
|
23
30
|
export type AssetVariationMap = Record<string, AssetVariation>;
|
|
24
31
|
/** An entry of the runtime config's `speedKit.originMap`, keyed by origin or by host. */
|
|
@@ -48,6 +55,13 @@ export declare const DEFAULT_TYPE = "default";
|
|
|
48
55
|
export declare const DEFAULT_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Safari/605.1.15 (compatible; SpeedKit/1.0)";
|
|
49
56
|
export declare const MOBILE_USER_AGENT = "Mozilla/5.0 (iPhone; CPU iPhone OS 18_6_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Mobile/15E148 Safari/604.1 (compatible; SpeedKit/1.0)";
|
|
50
57
|
export declare const TABLET_USER_AGENT = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 (compatible; SpeedKit/1.0)";
|
|
58
|
+
/**
|
|
59
|
+
* The variation types the server resolves whether a config defines them or not.
|
|
60
|
+
*
|
|
61
|
+
* Exported because "which variations exist" is otherwise answered with the config's own keys alone,
|
|
62
|
+
* and a config that defines none reads as "nothing can be passed" while these three still work.
|
|
63
|
+
*/
|
|
64
|
+
export declare const DEVICE_DEFAULT_TYPES: string[];
|
|
51
65
|
/** Thrown where the server would throw UndefinedVariationException. */
|
|
52
66
|
export declare class UndefinedVariationError extends Error {
|
|
53
67
|
constructor(variationType: string);
|
|
@@ -22,6 +22,13 @@ const DEVICE_DEFAULTS = {
|
|
|
22
22
|
mobile: { headers: { "user-agent": MOBILE_USER_AGENT } },
|
|
23
23
|
tablet: { headers: { "user-agent": TABLET_USER_AGENT } },
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* The variation types the server resolves whether a config defines them or not.
|
|
27
|
+
*
|
|
28
|
+
* Exported because "which variations exist" is otherwise answered with the config's own keys alone,
|
|
29
|
+
* and a config that defines none reads as "nothing can be passed" while these three still work.
|
|
30
|
+
*/
|
|
31
|
+
export const DEVICE_DEFAULT_TYPES = Object.keys(DEVICE_DEFAULTS);
|
|
25
32
|
/** Group names a template captures, e.g. `storeId` from `(?<storeId>.*)`. */
|
|
26
33
|
const CAPTURING_TEMPLATES = /<(\w+)>/g;
|
|
27
34
|
/** Thrown where the server would throw UndefinedVariationException. */
|
|
@@ -64,6 +71,7 @@ function applyTemplate(entry, variationType) {
|
|
|
64
71
|
};
|
|
65
72
|
return {
|
|
66
73
|
matchedKey: entry.matchedKey,
|
|
74
|
+
viaTemplate: true,
|
|
67
75
|
urlPrefix: entry.urlPrefix ? substitute(entry.urlPrefix) : entry.urlPrefix,
|
|
68
76
|
encodePrefixedUrl: entry.encodePrefixedUrl,
|
|
69
77
|
queryParams: (entry.queryParams ?? []).map(substitute),
|
|
@@ -180,16 +188,15 @@ export function resolveRequest(custom, url, variationType, { hostOverride, origi
|
|
|
180
188
|
const originalHost = originEntry?.origin && originEntry.overrideHostHeader
|
|
181
189
|
? parsed.hostname
|
|
182
190
|
: undefined;
|
|
183
|
-
const isTemplate = chain.some((config) => config.matchedKey !== WILD_CARD &&
|
|
184
|
-
!DEVICE_DEFAULTS[config.matchedKey ?? ""]) &&
|
|
185
|
-
!chain.some((config) => config.matchedKey?.startsWith("device-default:"));
|
|
186
191
|
const headers = buildHeaders(chain, hostOverride, originEntry, originalHost);
|
|
187
192
|
const originMapHeaders = Object.entries(originEntry?.headers ?? {})
|
|
188
193
|
.filter(([key, value]) => headers[key.toLowerCase()] === String(value))
|
|
189
194
|
.map(([key]) => key.toLowerCase());
|
|
190
195
|
return {
|
|
191
196
|
appliedKeys: chain.map((config) => config.matchedKey ?? "?"),
|
|
192
|
-
resolutionPath:
|
|
197
|
+
resolutionPath: chain.some((config) => config.viaTemplate)
|
|
198
|
+
? "template"
|
|
199
|
+
: "named",
|
|
193
200
|
...(originMapKey ? { originMapKey, originMapHeaders } : {}),
|
|
194
201
|
url: buildUrl(requestUrl, chain),
|
|
195
202
|
headers,
|
|
@@ -35,6 +35,13 @@ export declare class OriginFetcher {
|
|
|
35
35
|
/** Warnings already shown, so a per-fetch condition is reported once per session. */
|
|
36
36
|
private readonly warned;
|
|
37
37
|
constructor(deps: OriginFetcherDeps);
|
|
38
|
+
/**
|
|
39
|
+
* The variations the runtime config names. The wildcard and the regex
|
|
40
|
+
* templates are not variations of their own, and the device defaults are
|
|
41
|
+
* left out: whether a config ever produces `tablet` is decided in the
|
|
42
|
+
* browser, by `detectDevice` or the user agent, and nothing here can tell.
|
|
43
|
+
*/
|
|
44
|
+
namedVariations(): string[];
|
|
38
45
|
/** The request, without sending it. */
|
|
39
46
|
prepare(originUrl: string, variation?: string): PreparedOriginRequest;
|
|
40
47
|
/**
|
|
@@ -18,6 +18,18 @@ export class OriginFetcher {
|
|
|
18
18
|
constructor(deps) {
|
|
19
19
|
this.deps = deps;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* The variations the runtime config names. The wildcard and the regex
|
|
23
|
+
* templates are not variations of their own, and the device defaults are
|
|
24
|
+
* left out: whether a config ever produces `tablet` is decided in the
|
|
25
|
+
* browser, by `detectDevice` or the user agent, and nothing here can tell.
|
|
26
|
+
*/
|
|
27
|
+
namedVariations() {
|
|
28
|
+
const variations = this.deps.config?.variations ?? {};
|
|
29
|
+
return Object.entries(variations)
|
|
30
|
+
.filter(([key, entry]) => key !== "*" && !key.startsWith("device-default:") && !entry?.regex)
|
|
31
|
+
.map(([key]) => key);
|
|
32
|
+
}
|
|
21
33
|
/** The request, without sending it. */
|
|
22
34
|
prepare(originUrl, variation) {
|
|
23
35
|
// A missing runtime config is not reported here; the load that failed says what it costs.
|
|
@@ -42,15 +54,38 @@ export class OriginFetcher {
|
|
|
42
54
|
async fetch(originUrl, variation) {
|
|
43
55
|
const { url, init } = this.prepare(originUrl, variation);
|
|
44
56
|
const action = `ORIGIN:FETCH:${randomUUID()}`;
|
|
45
|
-
this.deps.cli.startAction(action, `[documentHandler:fetch]: ${url}
|
|
57
|
+
this.deps.cli.startAction(action, `[documentHandler:fetch]: ${url}`, {
|
|
58
|
+
scope: "documentHandler",
|
|
59
|
+
data: { url, originUrl, variation },
|
|
60
|
+
});
|
|
61
|
+
const startedAt = Date.now();
|
|
46
62
|
try {
|
|
47
63
|
const response = await originFetch(url, init);
|
|
48
|
-
this.deps.cli.successAction(action
|
|
64
|
+
this.deps.cli.successAction(action, undefined, {
|
|
65
|
+
scope: "documentHandler",
|
|
66
|
+
data: {
|
|
67
|
+
url,
|
|
68
|
+
variation,
|
|
69
|
+
status: response.status,
|
|
70
|
+
durationMs: Date.now() - startedAt,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
49
73
|
return { response, url };
|
|
50
74
|
}
|
|
51
75
|
catch (error) {
|
|
52
|
-
this.deps.cli.failAction(action, `error while fetching Asset: ${originUrl}
|
|
53
|
-
|
|
76
|
+
this.deps.cli.failAction(action, `error while fetching Asset: ${originUrl}`, {
|
|
77
|
+
scope: "documentHandler",
|
|
78
|
+
data: {
|
|
79
|
+
url,
|
|
80
|
+
originUrl,
|
|
81
|
+
variation,
|
|
82
|
+
durationMs: Date.now() - startedAt,
|
|
83
|
+
error: String(error),
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
this.deps.cli.writeError(String(error), false, {
|
|
87
|
+
scope: "documentHandler",
|
|
88
|
+
});
|
|
54
89
|
return undefined;
|
|
55
90
|
}
|
|
56
91
|
}
|
|
@@ -94,6 +129,9 @@ export class OriginFetcher {
|
|
|
94
129
|
if (this.warned.has(key))
|
|
95
130
|
return;
|
|
96
131
|
this.warned.add(key);
|
|
97
|
-
this.deps.cli.writeWarning(message
|
|
132
|
+
this.deps.cli.writeWarning(message, false, {
|
|
133
|
+
scope: "documentHandler",
|
|
134
|
+
data: { once: key },
|
|
135
|
+
});
|
|
98
136
|
}
|
|
99
137
|
}
|