@speedkit/cli 4.50.4 → 4.51.0-run-control.1
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/CHANGELOG.md +7 -0
- package/README.md +1369 -10
- 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 +6 -1
- package/dist/commands/diff.js +9 -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 +93 -0
- package/dist/commands/onboarding/browser/emulate.js +23 -0
- package/dist/commands/onboarding/browser/navigate.d.ts +67 -0
- package/dist/commands/onboarding/browser/navigate.js +18 -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 +77 -0
- package/dist/commands/onboarding/debug/arm.js +18 -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 +256 -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/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 +220 -3
- 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 +8 -0
- package/dist/services/diff/diff-service-build-context.js +40 -1
- package/dist/services/diff/diff-service-factory.d.ts +2 -0
- package/dist/services/diff/diff-service-factory.js +48 -20
- 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/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/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/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/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/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 +521 -0
- package/dist/services/onboarding/control/browser-session.js +1273 -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 +1390 -0
- package/dist/services/onboarding/control/control-protocol.js +69 -0
- package/dist/services/onboarding/control/control-server.d.ts +284 -0
- package/dist/services/onboarding/control/control-server.js +1609 -0
- package/dist/services/onboarding/control/debug-session.d.ts +190 -0
- package/dist/services/onboarding/control/debug-session.js +801 -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/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 +119 -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 +149 -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 +94 -32
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +4 -25
- 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/html-charset.d.ts +28 -0
- package/dist/services/onboarding/html-charset.js +57 -0
- package/dist/services/onboarding/onboarding-model.d.ts +30 -1
- package/dist/services/onboarding/onboarding-model.js +10 -1
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +4 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +6 -0
- package/dist/services/onboarding/onboarding-service-factory.d.ts +17 -1
- package/dist/services/onboarding/onboarding-service-factory.js +131 -17
- package/dist/services/onboarding/onboarding-service.d.ts +40 -1
- package/dist/services/onboarding/onboarding-service.js +135 -22
- 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/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 +526 -0
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/control-server.spec.js +338 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.js +693 -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/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 +172 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +202 -0
- package/dist/services/onboarding/spec/fetch-events/customer-domain-document-response.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-events/customer-domain-document-response.spec.js +39 -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/html-charset.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/html-charset.spec.js +58 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +37 -0
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +1 -0
- 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/index.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/index.spec.js +19 -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 +34 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +85 -53
- 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.js +9 -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 +541 -0
- package/dist/services/run-control/browser/run-browser-contexts.js +78 -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 +64 -0
- package/dist/services/run-control/browser/run-browser-service.js +199 -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 +411 -0
- package/dist/services/run-control/debug/run-debug-contexts.js +44 -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 +38 -0
- package/dist/services/run-control/debug/run-debug-service.js +161 -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 +32 -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 +203 -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 +193 -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 +25 -0
- package/dist/services/run-control/session/run-session-service.js +95 -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 +224 -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 +101 -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 +80 -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 +150 -0
- package/dist/services/run-registry/run-registry.js +409 -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 +509 -0
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +3293 -272
- package/package.json +21 -3
|
@@ -20,7 +20,9 @@ export class DiffAgainstCurrentPage {
|
|
|
20
20
|
* between the two is ignored; the current page has one response only.
|
|
21
21
|
*/
|
|
22
22
|
async postDiff({ currentHtml, currentUrl, variant = "default", transform = false, baseline = false, }) {
|
|
23
|
-
this.cli.writeWarning(`received diff for url: ${currentUrl}
|
|
23
|
+
this.cli.writeWarning(`received diff for url: ${currentUrl}`, false, {
|
|
24
|
+
data: { url: currentUrl, variant, transform },
|
|
25
|
+
});
|
|
24
26
|
const raw = !transform;
|
|
25
27
|
const remote = await this.pages.fetch(currentUrl, variant, `remote-${variant}.html`, { raw, baseline });
|
|
26
28
|
const current = await this.pages.fromHtml(currentHtml, currentUrl, variant, {
|
|
@@ -128,9 +128,14 @@ export class Dashboard {
|
|
|
128
128
|
return this.createBaqendResponse(requestOrigin, JSON.stringify({ success: false, error: diffResult.error }), "application/json; charset=UTF-8", [], 500);
|
|
129
129
|
}
|
|
130
130
|
if (url.pathname.startsWith("/cache/get")) {
|
|
131
|
+
// Reads every body back off disk, which is what this endpoint has always
|
|
132
|
+
// effectively done — it serialises them all into one payload.
|
|
131
133
|
const response = [];
|
|
132
|
-
for (const [url
|
|
133
|
-
|
|
134
|
+
for (const [url] of this.cache.getAll()) {
|
|
135
|
+
const baqendResponse = this.cache.getEntry(url);
|
|
136
|
+
if (baqendResponse) {
|
|
137
|
+
response.push({ url, response: baqendResponse });
|
|
138
|
+
}
|
|
134
139
|
}
|
|
135
140
|
return this.createBaqendResponse(requestOrigin, JSON.stringify(response), "application/json; charset=UTF-8");
|
|
136
141
|
}
|
|
@@ -4,14 +4,33 @@ import { CDPSession, Target } from "puppeteer";
|
|
|
4
4
|
import { CliServiceInterface } from "../cli/index.js";
|
|
5
5
|
import { CustomerConfig } from "../integration-api/index.js";
|
|
6
6
|
import { ConfigApiService } from "../config-api/index.js";
|
|
7
|
+
import { RequestLogInterface } from "../run-log/index.js";
|
|
8
|
+
/** What a {@link FetchEventHandler} works with. */
|
|
9
|
+
export interface FetchEventHandlerDeps {
|
|
10
|
+
/** The handlers an intercepted request is offered to, in order. */
|
|
11
|
+
browserFetchEvents: FetchRequestPausedEventHandler[];
|
|
12
|
+
customerConfig: CustomerConfig;
|
|
13
|
+
cli: CliServiceInterface;
|
|
14
|
+
/** Answers an auth challenge with the app's credentials; absent in tests. */
|
|
15
|
+
client?: ConfigApiService;
|
|
16
|
+
/**
|
|
17
|
+
* Where every intercepted request is recorded.
|
|
18
|
+
*
|
|
19
|
+
* Absent when the run is not writing to disk, and in the test harness.
|
|
20
|
+
* This is the only place that sees the whole stream — which handler
|
|
21
|
+
* matched, what it answered with, and how long it took — and none of it
|
|
22
|
+
* reaches the terminal, because a navigation produces hundreds of these
|
|
23
|
+
* and a human reading along wants none of them.
|
|
24
|
+
*/
|
|
25
|
+
requestLog?: RequestLogInterface;
|
|
26
|
+
}
|
|
7
27
|
export declare class FetchEventHandler {
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
private cli;
|
|
11
|
-
private client?;
|
|
12
|
-
constructor(browserFetchEvents: FetchRequestPausedEventHandler[], customerConfig: CustomerConfig, cli: CliServiceInterface, client?: ConfigApiService);
|
|
28
|
+
private readonly deps;
|
|
29
|
+
constructor(deps: FetchEventHandlerDeps);
|
|
13
30
|
handleRequestFetchEvents(target: Target): Promise<void>;
|
|
14
31
|
private canHandlePattern;
|
|
32
|
+
/** The fields of a record that are known before anything has decided. */
|
|
33
|
+
private describe;
|
|
15
34
|
private onFetchRequestPaused;
|
|
16
35
|
getAuthPattern(): Protocol.Fetch.RequestPattern[];
|
|
17
36
|
private onFetchAuthRequired;
|
|
@@ -4,15 +4,9 @@ import { AbortResponse } from "./browser/abort-response.js";
|
|
|
4
4
|
import { safe } from "../../helpers/safe.js";
|
|
5
5
|
import { LoginError } from "../config-api/error/login-error.js";
|
|
6
6
|
export class FetchEventHandler {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
client;
|
|
11
|
-
constructor(browserFetchEvents, customerConfig, cli, client) {
|
|
12
|
-
this.browserFetchEvents = browserFetchEvents;
|
|
13
|
-
this.customerConfig = customerConfig;
|
|
14
|
-
this.cli = cli;
|
|
15
|
-
this.client = client;
|
|
7
|
+
deps;
|
|
8
|
+
constructor(deps) {
|
|
9
|
+
this.deps = deps;
|
|
16
10
|
}
|
|
17
11
|
async handleRequestFetchEvents(target) {
|
|
18
12
|
const cdpSession = await target.createCDPSession();
|
|
@@ -20,7 +14,7 @@ export class FetchEventHandler {
|
|
|
20
14
|
handleAuthRequests: true,
|
|
21
15
|
//see: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#type-RequestPattern
|
|
22
16
|
patterns: [
|
|
23
|
-
...this.browserFetchEvents.flatMap((handler) => {
|
|
17
|
+
...this.deps.browserFetchEvents.flatMap((handler) => {
|
|
24
18
|
return handler.patterns;
|
|
25
19
|
}),
|
|
26
20
|
...this.getAuthPattern(),
|
|
@@ -31,20 +25,38 @@ export class FetchEventHandler {
|
|
|
31
25
|
if (response.success === true) {
|
|
32
26
|
return response.data;
|
|
33
27
|
}
|
|
34
|
-
this.cli.writeError(response.error);
|
|
28
|
+
this.deps.cli.writeError(response.error);
|
|
35
29
|
});
|
|
36
30
|
cdpSession.on(BROWSER_EVENTS.FETCH_REQUEST_PAUSED, async (event) => {
|
|
37
31
|
const response = await safe(this.onFetchRequestPaused(event, cdpSession));
|
|
38
32
|
if (response.success === true) {
|
|
39
33
|
return;
|
|
40
34
|
}
|
|
35
|
+
const failure = response.errorObj
|
|
36
|
+
? response.errorObj.message
|
|
37
|
+
: JSON.stringify(response.errorObj);
|
|
38
|
+
this.deps.requestLog?.record({
|
|
39
|
+
...this.describe(event),
|
|
40
|
+
outcome: "error",
|
|
41
|
+
error: failure,
|
|
42
|
+
});
|
|
41
43
|
if (response.errorObj) {
|
|
42
|
-
this.cli.writeError(`error on ${event.request.url}
|
|
43
|
-
|
|
44
|
+
this.deps.cli.writeError(`error on ${event.request.url}`, false, {
|
|
45
|
+
scope: "fetch",
|
|
46
|
+
data: { url: event.request.url, resourceType: event.resourceType },
|
|
47
|
+
});
|
|
48
|
+
this.deps.cli.writeError(`${response.errorObj.message}`, false, {
|
|
49
|
+
scope: "fetch",
|
|
50
|
+
});
|
|
44
51
|
}
|
|
45
52
|
else {
|
|
46
|
-
this.cli.writeError(`error on ${target.url()}
|
|
47
|
-
|
|
53
|
+
this.deps.cli.writeError(`error on ${target.url()}`, false, {
|
|
54
|
+
scope: "fetch",
|
|
55
|
+
data: { url: target.url() },
|
|
56
|
+
});
|
|
57
|
+
this.deps.cli.writeError(JSON.stringify(response.errorObj), false, {
|
|
58
|
+
scope: "fetch",
|
|
59
|
+
});
|
|
48
60
|
}
|
|
49
61
|
// A request left in paused state hangs until the browser times out.
|
|
50
62
|
// Fail it explicitly so the page sees a network error instead.
|
|
@@ -65,28 +77,67 @@ export class FetchEventHandler {
|
|
|
65
77
|
return !pattern.resourceType || pattern.resourceType === resourceType;
|
|
66
78
|
});
|
|
67
79
|
}
|
|
80
|
+
/** The fields of a record that are known before anything has decided. */
|
|
81
|
+
describe(event) {
|
|
82
|
+
return {
|
|
83
|
+
url: event.request.url,
|
|
84
|
+
method: event.request.method,
|
|
85
|
+
resourceType: String(event.resourceType),
|
|
86
|
+
// Chrome pauses at the response stage only when a pattern asked it to,
|
|
87
|
+
// and the presence of response headers is what distinguishes the two.
|
|
88
|
+
stage: (event.responseHeaders ? "Response" : "Request"),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
68
91
|
async onFetchRequestPaused(event, cdpSession) {
|
|
69
92
|
const requestId = event.requestId;
|
|
70
|
-
for (const fetchEvent of this.browserFetchEvents) {
|
|
93
|
+
for (const fetchEvent of this.deps.browserFetchEvents) {
|
|
71
94
|
// check if current request could be handled
|
|
72
95
|
if (!this.canHandlePattern(fetchEvent, event.request.url, event.resourceType, event.responseHeaders ? "Response" : "Request")) {
|
|
73
96
|
continue;
|
|
74
97
|
}
|
|
98
|
+
const startedAt = Date.now();
|
|
75
99
|
const response = await fetchEvent.handle(event, cdpSession);
|
|
76
100
|
if (!response) {
|
|
77
101
|
continue;
|
|
78
102
|
}
|
|
103
|
+
// The handler is named by its class, which is what a reader needs to go
|
|
104
|
+
// and look at the rule that matched. Timing covers the handler only, not
|
|
105
|
+
// the CDP round trip back into Chrome, because that is the part a config
|
|
106
|
+
// change can move.
|
|
107
|
+
const handler = fetchEvent.constructor.name;
|
|
108
|
+
const durationMs = Date.now() - startedAt;
|
|
79
109
|
if (response instanceof AbortResponse) {
|
|
110
|
+
this.deps.requestLog?.record({
|
|
111
|
+
...this.describe(event),
|
|
112
|
+
outcome: "failed",
|
|
113
|
+
handler,
|
|
114
|
+
durationMs,
|
|
115
|
+
});
|
|
80
116
|
return cdpSession.send("Fetch.failRequest", {
|
|
81
117
|
requestId: requestId,
|
|
82
118
|
errorReason: response.errorReason,
|
|
83
119
|
});
|
|
84
120
|
}
|
|
121
|
+
const fulfillment = response;
|
|
122
|
+
this.deps.requestLog?.record({
|
|
123
|
+
...this.describe(event),
|
|
124
|
+
outcome: "fulfilled",
|
|
125
|
+
handler,
|
|
126
|
+
status: fulfillment.responseCode,
|
|
127
|
+
durationMs,
|
|
128
|
+
});
|
|
85
129
|
return cdpSession.send("Fetch.fulfillRequest", {
|
|
86
|
-
...
|
|
130
|
+
...fulfillment,
|
|
87
131
|
requestId,
|
|
88
132
|
});
|
|
89
133
|
}
|
|
134
|
+
// Nothing matched, so Chrome gets it back untouched. Recorded because
|
|
135
|
+
// "what did the CLI *not* take" is the question a `disabledScopes` or
|
|
136
|
+
// `blacklist` change is asking, and it has no other trace anywhere.
|
|
137
|
+
this.deps.requestLog?.record({
|
|
138
|
+
...this.describe(event),
|
|
139
|
+
outcome: "continued",
|
|
140
|
+
});
|
|
90
141
|
//see: https://chromedevtools.github.io/devtools-protocol/tot/Fetch#method-continueRequest
|
|
91
142
|
return cdpSession.send("Fetch.continueRequest", {
|
|
92
143
|
requestId: requestId,
|
|
@@ -94,7 +145,7 @@ export class FetchEventHandler {
|
|
|
94
145
|
}
|
|
95
146
|
getAuthPattern() {
|
|
96
147
|
const result = [];
|
|
97
|
-
for (const origin of this.customerConfig.origins) {
|
|
148
|
+
for (const origin of this.deps.customerConfig.origins) {
|
|
98
149
|
const pattern = [
|
|
99
150
|
{
|
|
100
151
|
urlPattern: `${origin}*`,
|
|
@@ -106,16 +157,16 @@ export class FetchEventHandler {
|
|
|
106
157
|
return result;
|
|
107
158
|
}
|
|
108
159
|
async onFetchAuthRequired(event, browserClient) {
|
|
109
|
-
this.cli.writeWarning(`auth requested for ${event.request.url}`);
|
|
110
|
-
if (!this.customerConfig.origins.some((origin) => {
|
|
160
|
+
this.deps.cli.writeWarning(`auth requested for ${event.request.url}`);
|
|
161
|
+
if (!this.deps.customerConfig.origins.some((origin) => {
|
|
111
162
|
return event.request.url.includes(origin);
|
|
112
163
|
}) ||
|
|
113
|
-
!this.client) {
|
|
114
|
-
this.cli.writeWarning(`incorrect origin for auth request: -> ${this.customerConfig.origins.join("|")}`);
|
|
164
|
+
!this.deps.client) {
|
|
165
|
+
this.deps.cli.writeWarning(`incorrect origin for auth request: -> ${this.deps.customerConfig.origins.join("|")}`);
|
|
115
166
|
return { response: "Default" };
|
|
116
167
|
}
|
|
117
|
-
this.cli.startAction("BROWSER:AUTHENTICATE", "wait for credentials from server-config");
|
|
118
|
-
const serverConfigResponse = await safe(this.client.getServerConfig());
|
|
168
|
+
this.deps.cli.startAction("BROWSER:AUTHENTICATE", "wait for credentials from server-config");
|
|
169
|
+
const serverConfigResponse = await safe(this.deps.client.getServerConfig());
|
|
119
170
|
if (serverConfigResponse.success === true) {
|
|
120
171
|
const config = JSON.parse(serverConfigResponse.data);
|
|
121
172
|
const authUrlOrigin = new URL(event.request.url).origin;
|
|
@@ -130,27 +181,38 @@ export class FetchEventHandler {
|
|
|
130
181
|
password: auth.password,
|
|
131
182
|
},
|
|
132
183
|
});
|
|
133
|
-
this.cli.successAction("BROWSER:AUTHENTICATE");
|
|
134
|
-
this.cli.writeSuccess(`auth provided for ${event.request.url}`);
|
|
135
|
-
|
|
184
|
+
this.deps.cli.successAction("BROWSER:AUTHENTICATE");
|
|
185
|
+
this.deps.cli.writeSuccess(`auth provided for ${event.request.url}`);
|
|
186
|
+
// No `sendDefaultAuthBehaviour` here. The challenge has just been
|
|
187
|
+
// answered with the credentials, and a challenge can only be answered
|
|
188
|
+
// once — a second `Fetch.continueWithAuth` for the same requestId
|
|
189
|
+
// always threw `Invalid state for continueInterceptedRequest`, one
|
|
190
|
+
// millisecond after the success line, every time credentials were
|
|
191
|
+
// supplied. Login still worked, because the credentials went first,
|
|
192
|
+
// but the throw was logged at `error` level and headed the run's
|
|
193
|
+
// problems list, reading as though authentication had failed.
|
|
136
194
|
return;
|
|
137
195
|
}
|
|
138
196
|
}
|
|
139
|
-
this.cli.failAction("BROWSER:AUTHENTICATE", `error providing auth: no credentials found in runtimeConfig of app ${this.customerConfig.app}`);
|
|
197
|
+
this.deps.cli.failAction("BROWSER:AUTHENTICATE", `error providing auth: no credentials found in runtimeConfig of app ${this.deps.customerConfig.app}`);
|
|
140
198
|
await this.sendDefaultAuthBehaviour(browserClient, event.requestId);
|
|
141
199
|
return;
|
|
142
200
|
}
|
|
143
|
-
this.cli.failAction("BROWSER:AUTHENTICATE");
|
|
201
|
+
this.deps.cli.failAction("BROWSER:AUTHENTICATE");
|
|
144
202
|
if (serverConfigResponse.errorObj instanceof ProtocolError) {
|
|
145
|
-
//
|
|
203
|
+
// The challenge was already answered — by a competing handler, or by the
|
|
204
|
+
// browser giving up on it — so there is nothing left to respond to and
|
|
205
|
+
// `sendDefaultAuthBehaviour` would throw in its turn. Bailing out is
|
|
206
|
+
// right. (This is *not* the double-answer that used to fire on the
|
|
207
|
+
// success path above; that one was unconditional, not a race.)
|
|
146
208
|
return;
|
|
147
209
|
}
|
|
148
210
|
if (serverConfigResponse.errorObj instanceof LoginError) {
|
|
149
|
-
this.cli.writeError(`could not login to app ${this.customerConfig.app} to gather credentials. Try run sk login`);
|
|
211
|
+
this.deps.cli.writeError(`could not login to app ${this.deps.customerConfig.app} to gather credentials. Try run sk login`);
|
|
150
212
|
await this.sendDefaultAuthBehaviour(browserClient, event.requestId);
|
|
151
213
|
return;
|
|
152
214
|
}
|
|
153
|
-
this.cli.writeError(`error providing auth: ${JSON.stringify(serverConfigResponse.errorObj)}`);
|
|
215
|
+
this.deps.cli.writeError(`error providing auth: ${JSON.stringify(serverConfigResponse.errorObj)}`);
|
|
154
216
|
await this.sendDefaultAuthBehaviour(browserClient, event.requestId);
|
|
155
217
|
}
|
|
156
218
|
async sendDefaultAuthBehaviour(browserClient, requestId) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { META_CONTENT_TYPE_REGEX, } from "../onboarding-model.js";
|
|
2
1
|
import { OriginResponse } from "../browser/origin-response.js";
|
|
3
2
|
import iconv from "iconv-lite";
|
|
4
|
-
import
|
|
5
|
-
import { UnsupportedEncodingError } from "../error/unsupported-encoding-error.js";
|
|
3
|
+
import { decodeHtml } from "../html-charset.js";
|
|
6
4
|
/**
|
|
7
5
|
* Intercepts any request to the customersOrigin and equivalent requests to baqendAssetApi
|
|
8
6
|
* @implements {FetchRequestPausedEventHandler}
|
|
@@ -93,33 +91,14 @@ export class CustomerDomainDocumentResponse {
|
|
|
93
91
|
const contentType = event.responseHeaders.find((headerRecord) => {
|
|
94
92
|
return headerRecord.name.toLowerCase() === "content-type";
|
|
95
93
|
})?.["value"] || "";
|
|
96
|
-
const charsetRegex = /charset=([^\s"(),./:;<=>?@[\]]*)/i;
|
|
97
|
-
const encodingFromHeader = contentType && charsetRegex.test(contentType)
|
|
98
|
-
? charsetRegex.exec(contentType)[1]
|
|
99
|
-
: null;
|
|
100
94
|
// create text from base64Encoded
|
|
101
95
|
if (base64Encoded) {
|
|
102
|
-
const
|
|
103
|
-
const encodingFromBuffer = Encoding.detect(buffer);
|
|
104
|
-
const encodedBody = iconv
|
|
105
|
-
.decode(buffer, encodingFromHeader ?? "utf-8")
|
|
106
|
-
.toString();
|
|
107
|
-
const metaSelector = META_CONTENT_TYPE_REGEX;
|
|
108
|
-
const encodingFromBodyMeta = metaSelector.test(encodedBody)
|
|
109
|
-
? metaSelector.exec(encodedBody)[1]
|
|
110
|
-
: "";
|
|
111
|
-
const detectedEncoding = encodingFromHeader ||
|
|
112
|
-
encodingFromBodyMeta ||
|
|
113
|
-
encodingFromBuffer ||
|
|
114
|
-
"utf-8";
|
|
115
|
-
if (!iconv.encodingExists(detectedEncoding)) {
|
|
116
|
-
throw new UnsupportedEncodingError(`encoding is not supported by cli: "${detectedEncoding}"`);
|
|
117
|
-
}
|
|
96
|
+
const { text, charset } = decodeHtml(contentType, Buffer.from(body, "base64"));
|
|
118
97
|
event.responseHeaders.push({
|
|
119
98
|
name: "x-sk-detected-encoding",
|
|
120
|
-
value:
|
|
99
|
+
value: charset,
|
|
121
100
|
});
|
|
122
|
-
return
|
|
101
|
+
return text;
|
|
123
102
|
}
|
|
124
103
|
return body;
|
|
125
104
|
}
|
|
@@ -25,7 +25,10 @@ export class SpeedKitInstallJs {
|
|
|
25
25
|
}
|
|
26
26
|
async handle(event, client) {
|
|
27
27
|
if (!event.request.url.includes(this.customerConfig.appDomain)) {
|
|
28
|
-
this.cli.comment(`abort: ${event.request.url}
|
|
28
|
+
this.cli.comment(`abort: ${event.request.url}`, false, {
|
|
29
|
+
scope: "fetch",
|
|
30
|
+
data: { url: event.request.url, aborted: true },
|
|
31
|
+
});
|
|
29
32
|
return new AbortResponse("Aborted");
|
|
30
33
|
}
|
|
31
34
|
if (!this.isValidResponse(event)) {
|
|
@@ -50,7 +53,13 @@ export class SpeedKitInstallJs {
|
|
|
50
53
|
async extractConfigVersion(client, event) {
|
|
51
54
|
const originBodyResponse = await safe(this.getContent(client, event));
|
|
52
55
|
if (originBodyResponse.success !== true) {
|
|
53
|
-
this.cli.writeError(`could not fetch install resource: "${event.request.url}": ${originBodyResponse.error}
|
|
56
|
+
this.cli.writeError(`could not fetch install resource: "${event.request.url}": ${originBodyResponse.error}`, false, {
|
|
57
|
+
scope: "fetch",
|
|
58
|
+
data: {
|
|
59
|
+
url: event.request.url,
|
|
60
|
+
error: originBodyResponse.error,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
54
63
|
return;
|
|
55
64
|
}
|
|
56
65
|
const [, configVersion] = originBodyResponse.data.match(/sw:[^?]*(\?[^"]*)"/s) || [];
|
|
@@ -3,6 +3,7 @@ import { Protocol } from "puppeteer-core";
|
|
|
3
3
|
import { CustomerConfig } from "../../integration-api/index.js";
|
|
4
4
|
import { AbortResponse } from "../browser/abort-response.js";
|
|
5
5
|
import { FetchRequestPausedEventHandler } from "../onboarding-model.js";
|
|
6
|
+
import { RumBeacon } from "../control/control-protocol.js";
|
|
6
7
|
import { VirtualOrestesApp } from "../virtual-orestes-app/index.js";
|
|
7
8
|
/**
|
|
8
9
|
* Intercepts v1/rum/pi requests,
|
|
@@ -11,10 +12,23 @@ import { VirtualOrestesApp } from "../virtual-orestes-app/index.js";
|
|
|
11
12
|
*
|
|
12
13
|
* @implements FetchRequestPausedEventHandler
|
|
13
14
|
*/
|
|
15
|
+
/** How many beacons the run keeps for `rum beacons`. */
|
|
16
|
+
export declare const BEACON_LIMIT = 200;
|
|
14
17
|
export declare class SpeedKitRumPiRequest implements FetchRequestPausedEventHandler {
|
|
15
18
|
private customerConfig;
|
|
16
19
|
private orestesApp;
|
|
17
20
|
readonly patterns: Protocol.Fetch.RequestPattern[];
|
|
21
|
+
/**
|
|
22
|
+
* The last beacons, as they left the page.
|
|
23
|
+
*
|
|
24
|
+
* `rum get` reads what Speed Kit merged; which beacon carried a field, and
|
|
25
|
+
* when — the question when a click should have tracked something — is only
|
|
26
|
+
* answerable from the beacons themselves.
|
|
27
|
+
*/
|
|
28
|
+
private readonly kept;
|
|
29
|
+
private seq;
|
|
30
|
+
beacons(): RumBeacon[];
|
|
18
31
|
constructor(customerConfig: CustomerConfig, orestesApp: VirtualOrestesApp);
|
|
19
32
|
handle(event: Protocol.Fetch.RequestPausedEvent, _: CDPSession): Promise<AbortResponse | Partial<Protocol.Fetch.FulfillRequestRequest> | null>;
|
|
33
|
+
private keep;
|
|
20
34
|
}
|
|
@@ -6,10 +6,24 @@ import { safe } from "../../../helpers/safe.js";
|
|
|
6
6
|
*
|
|
7
7
|
* @implements FetchRequestPausedEventHandler
|
|
8
8
|
*/
|
|
9
|
+
/** How many beacons the run keeps for `rum beacons`. */
|
|
10
|
+
export const BEACON_LIMIT = 200;
|
|
9
11
|
export class SpeedKitRumPiRequest {
|
|
10
12
|
customerConfig;
|
|
11
13
|
orestesApp;
|
|
12
14
|
patterns;
|
|
15
|
+
/**
|
|
16
|
+
* The last beacons, as they left the page.
|
|
17
|
+
*
|
|
18
|
+
* `rum get` reads what Speed Kit merged; which beacon carried a field, and
|
|
19
|
+
* when — the question when a click should have tracked something — is only
|
|
20
|
+
* answerable from the beacons themselves.
|
|
21
|
+
*/
|
|
22
|
+
kept = [];
|
|
23
|
+
seq = 0;
|
|
24
|
+
beacons() {
|
|
25
|
+
return [...this.kept];
|
|
26
|
+
}
|
|
13
27
|
constructor(customerConfig, orestesApp) {
|
|
14
28
|
this.customerConfig = customerConfig;
|
|
15
29
|
this.orestesApp = orestesApp;
|
|
@@ -25,6 +39,9 @@ export class SpeedKitRumPiRequest {
|
|
|
25
39
|
return;
|
|
26
40
|
}
|
|
27
41
|
const result = safe(() => JSON.parse(event.request.postData));
|
|
42
|
+
this.keep(event, result.success === true && result.data && typeof result.data === "object"
|
|
43
|
+
? result.data
|
|
44
|
+
: null);
|
|
28
45
|
if (result.success === false) {
|
|
29
46
|
return;
|
|
30
47
|
}
|
|
@@ -35,4 +52,17 @@ export class SpeedKitRumPiRequest {
|
|
|
35
52
|
// refresh in the background - do not block the intercepted rum/pi request
|
|
36
53
|
void this.orestesApp.refreshUrl(changeDetection.url);
|
|
37
54
|
}
|
|
55
|
+
keep(event, data) {
|
|
56
|
+
this.seq += 1;
|
|
57
|
+
this.kept.push({
|
|
58
|
+
seq: this.seq,
|
|
59
|
+
at: new Date().toISOString(),
|
|
60
|
+
url: event.request.url,
|
|
61
|
+
bytes: event.request.postData?.length ?? 0,
|
|
62
|
+
data,
|
|
63
|
+
});
|
|
64
|
+
if (this.kept.length > BEACON_LIMIT) {
|
|
65
|
+
this.kept.shift();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
38
68
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Protocol } from "devtools-protocol";
|
|
2
2
|
import { CustomerConfig, FileInterface } from "../../integration-api/index.js";
|
|
3
3
|
import { FetchRequestPausedEventHandler } from "../onboarding-model.js";
|
|
4
|
+
/** Makes the worker report `userAgent` as its own, for an emulated device. */
|
|
5
|
+
export declare function userAgentPrelude(userAgent: string): string;
|
|
4
6
|
/**
|
|
5
7
|
* SpeedKitServiceWorkerJs class is responsible for handling fetch requests for the SpeedKit service worker.
|
|
6
8
|
* Injects serviceWorker from local file, if custom_sw is present.
|
|
@@ -19,6 +21,17 @@ export declare class SpeedKitServiceWorkerJs implements FetchRequestPausedEventH
|
|
|
19
21
|
* OnboardingService uses this timestamp to detect and repair it.
|
|
20
22
|
*/
|
|
21
23
|
lastServedAt: number;
|
|
24
|
+
/**
|
|
25
|
+
* The user agent the served worker should see as its own, while a device
|
|
26
|
+
* emulation is active; undefined otherwise.
|
|
27
|
+
*
|
|
28
|
+
* Speed Kit decides the device in its worker, from the request's user-agent
|
|
29
|
+
* header — which a browser never exposes there — or else from
|
|
30
|
+
* `navigator.userAgent`. A CDP override on the worker target did not change
|
|
31
|
+
* the latter, so the worker script itself says it: prepended, so it runs
|
|
32
|
+
* before any of Speed Kit's code reads it.
|
|
33
|
+
*/
|
|
34
|
+
userAgent?: string;
|
|
22
35
|
constructor(customerConfig: CustomerConfig, serviceWorker: FileInterface);
|
|
23
36
|
handle(): Promise<Partial<Protocol.Fetch.FulfillRequestRequest>>;
|
|
24
37
|
}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { BaqendResponse } from "../browser/baqend-response.js";
|
|
2
|
+
/** Makes the worker report `userAgent` as its own, for an emulated device. */
|
|
3
|
+
export function userAgentPrelude(userAgent) {
|
|
4
|
+
return `/* sk onboarding browser emulate */
|
|
5
|
+
(function () {
|
|
6
|
+
try {
|
|
7
|
+
Object.defineProperty(self.navigator, "userAgent", {
|
|
8
|
+
get: function () { return ${JSON.stringify(userAgent)}; },
|
|
9
|
+
configurable: true
|
|
10
|
+
});
|
|
11
|
+
} catch (ignored) {
|
|
12
|
+
// A worker that refuses the override still runs; emulate reports it.
|
|
13
|
+
}
|
|
14
|
+
})();`;
|
|
15
|
+
}
|
|
2
16
|
/**
|
|
3
17
|
* SpeedKitServiceWorkerJs class is responsible for handling fetch requests for the SpeedKit service worker.
|
|
4
18
|
* Injects serviceWorker from local file, if custom_sw is present.
|
|
@@ -17,6 +31,17 @@ export class SpeedKitServiceWorkerJs {
|
|
|
17
31
|
* OnboardingService uses this timestamp to detect and repair it.
|
|
18
32
|
*/
|
|
19
33
|
lastServedAt = 0;
|
|
34
|
+
/**
|
|
35
|
+
* The user agent the served worker should see as its own, while a device
|
|
36
|
+
* emulation is active; undefined otherwise.
|
|
37
|
+
*
|
|
38
|
+
* Speed Kit decides the device in its worker, from the request's user-agent
|
|
39
|
+
* header — which a browser never exposes there — or else from
|
|
40
|
+
* `navigator.userAgent`. A CDP override on the worker target did not change
|
|
41
|
+
* the latter, so the worker script itself says it: prepended, so it runs
|
|
42
|
+
* before any of Speed Kit's code reads it.
|
|
43
|
+
*/
|
|
44
|
+
userAgent;
|
|
20
45
|
constructor(customerConfig, serviceWorker) {
|
|
21
46
|
this.customerConfig = customerConfig;
|
|
22
47
|
this.serviceWorker = serviceWorker;
|
|
@@ -29,6 +54,8 @@ export class SpeedKitServiceWorkerJs {
|
|
|
29
54
|
}
|
|
30
55
|
async handle() {
|
|
31
56
|
this.lastServedAt = Date.now();
|
|
32
|
-
return new BaqendResponse(this.
|
|
57
|
+
return new BaqendResponse(this.userAgent
|
|
58
|
+
? `${userAgentPrelude(this.userAgent)}\n${this.serviceWorker.getContent()}`
|
|
59
|
+
: this.serviceWorker.getContent(), "text/javascript; charset=utf-8");
|
|
33
60
|
}
|
|
34
61
|
}
|
|
@@ -5,6 +5,17 @@ import { Cache } from "../request-cache/cache.js";
|
|
|
5
5
|
import { ConfigFileInterface, CustomerConfig, FileListInterface } from "../../integration-api/index.js";
|
|
6
6
|
import { BrowserContext } from "../onboarding-model.js";
|
|
7
7
|
import { VirtualOrestesApp } from "../virtual-orestes-app/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* A rebuild asked for before the run wired its watchers.
|
|
10
|
+
*
|
|
11
|
+
* Typed rather than a bare `Error` so the control server can answer it as
|
|
12
|
+
* `NO_REBUILD` — "ask again once the page is up" is a different instruction to
|
|
13
|
+
* the caller than "the rebuild failed", and the two are indistinguishable once
|
|
14
|
+
* they are both a message string.
|
|
15
|
+
*/
|
|
16
|
+
export declare class NoRebuildContextError extends Error {
|
|
17
|
+
constructor();
|
|
18
|
+
}
|
|
8
19
|
/**
|
|
9
20
|
* Add different callbacks that will be executed if a local file is changed.
|
|
10
21
|
*/
|
|
@@ -16,6 +27,8 @@ export declare class FileWatcher {
|
|
|
16
27
|
private browserContext;
|
|
17
28
|
private cache;
|
|
18
29
|
private cacheRefresher?;
|
|
30
|
+
/** What the watchers were wired with, so a rebuild can reuse it. */
|
|
31
|
+
private rebuildContext?;
|
|
19
32
|
constructor(cli: CliServiceInterface, customerConfig: CustomerConfig, files: FileListInterface, documentHandler: DocumentHandlerServer, browserContext: BrowserContext, cache: Cache);
|
|
20
33
|
setCacheRefresher(cacheRefresher: VirtualOrestesApp): void;
|
|
21
34
|
/**
|
|
@@ -33,7 +46,7 @@ export declare class FileWatcher {
|
|
|
33
46
|
* @param page
|
|
34
47
|
* @param serviceWorkerReinstallCallback
|
|
35
48
|
*/
|
|
36
|
-
addCallbackOnFileChange(page: Page, serviceWorkerReinstallCallback: (file
|
|
49
|
+
addCallbackOnFileChange(page: Page, serviceWorkerReinstallCallback: (file?: ConfigFileInterface) => Promise<void>, signal: AbortSignal): void;
|
|
37
50
|
/**
|
|
38
51
|
* changes on these files will trigger
|
|
39
52
|
* - a rebuild of the serviceWorker
|
|
@@ -79,6 +92,34 @@ export declare class FileWatcher {
|
|
|
79
92
|
* @private
|
|
80
93
|
*/
|
|
81
94
|
private onChangeServiceWorkerCallback;
|
|
95
|
+
/**
|
|
96
|
+
* The service-worker group's effects, without a file having changed.
|
|
97
|
+
*
|
|
98
|
+
* Split out of the callback above rather than reimplemented beside it: the
|
|
99
|
+
* blast radius of this group is the thing a caller is asking for when it
|
|
100
|
+
* asks for a rebuild, and a second copy of it would drift from the one the
|
|
101
|
+
* watcher actually runs — at which point `sk onboarding files rebuild` would be
|
|
102
|
+
* reproducing something the run never does.
|
|
103
|
+
*/
|
|
104
|
+
private rebuildServiceWorkerGroup;
|
|
105
|
+
/** The generic-config group's effects, without a file having changed. */
|
|
106
|
+
private rebuildDocumentHandlerGroup;
|
|
107
|
+
/**
|
|
108
|
+
* Run a rebuild group on demand, as if one of its files had changed.
|
|
109
|
+
*
|
|
110
|
+
* The groups are the run's own, so what this does to the browser and the
|
|
111
|
+
* caches is exactly what an edit to one of those files does — which is the
|
|
112
|
+
* point. It reports what it did rather than returning void, because the
|
|
113
|
+
* effects reach past the files: a documentHandler rebuild empties the
|
|
114
|
+
* dh-cache, and a caller comparing two measurements across one of these has
|
|
115
|
+
* to know that the second is against a cold cache.
|
|
116
|
+
*
|
|
117
|
+
* @returns what each group did, in the order it ran.
|
|
118
|
+
*/
|
|
119
|
+
rebuild(target: "install" | "documentHandler" | "all"): Promise<{
|
|
120
|
+
target: "install" | "documentHandler";
|
|
121
|
+
did: string[];
|
|
122
|
+
}[]>;
|
|
82
123
|
/**
|
|
83
124
|
* fileWatcherCallback that will rebuild the local documentHandler
|
|
84
125
|
*
|