@speedkit/cli 4.50.5 → 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/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/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/onboarding-model.d.ts +30 -0
- package/dist/services/onboarding/onboarding-model.js +10 -0
- 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/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 +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/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 +82 -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.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 +20 -2
|
@@ -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;
|
|
@@ -18,6 +19,26 @@ export declare class VirtualOrestesApp {
|
|
|
18
19
|
private prerendererHintShown;
|
|
19
20
|
constructor(customerConfig: CustomerConfig, originFetcher: OriginFetcher, documentHandler: DocumentHandlerServer, cache: Cache, cli: CliServiceInterface, developmentToolsMessages: DevtoolsExtensionApi, removeContentSecurityPolicy?: boolean);
|
|
20
21
|
fetchAssetResponse(event: Protocol.Fetch.RequestPausedEvent): Promise<Partial<Protocol.Fetch.FulfillRequestRequest> | AbortResponse>;
|
|
22
|
+
/** The variations the runtime config names: see {@link OriginFetcher.namedVariations}. */
|
|
23
|
+
namedVariations(): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Build and cache one variation of a url without the browser asking for it.
|
|
26
|
+
*
|
|
27
|
+
* The same path a real asset request takes — {@link buildResponse} fetches
|
|
28
|
+
* the origin with the variation's headers, runs the documentHandler over it
|
|
29
|
+
* and caches the result — with the request synthesised rather than
|
|
30
|
+
* intercepted. That is what makes a variation reachable at all: a browser is
|
|
31
|
+
* one device at a time, so mobile and desktop can never both be in the cache
|
|
32
|
+
* from browsing, and the comparison everyone wants to make is between exactly
|
|
33
|
+
* those two.
|
|
34
|
+
*
|
|
35
|
+
* Throws what the build threw. The caller is asking for one specific entry,
|
|
36
|
+
* so a failure is the answer to its question, not a background detail —
|
|
37
|
+
* unlike {@link refreshEntry}, which is fire-and-forget and logs instead.
|
|
38
|
+
*
|
|
39
|
+
* @returns the cache key the entry was stored under.
|
|
40
|
+
*/
|
|
41
|
+
prewarm(originUrl: string, variation: string): Promise<string>;
|
|
21
42
|
/**
|
|
22
43
|
* Re-warm all cached entries for the given origin url in the background.
|
|
23
44
|
*
|
|
@@ -49,6 +70,19 @@ export declare class VirtualOrestesApp {
|
|
|
49
70
|
private refreshEntry;
|
|
50
71
|
private buildResponse;
|
|
51
72
|
private getResponseText;
|
|
73
|
+
/**
|
|
74
|
+
* The urls the local documentHandler could not build, as they stand now.
|
|
75
|
+
*
|
|
76
|
+
* Already collected for the devtools panel; this is the same list for a
|
|
77
|
+
* reader without one. State rather than history: an entry disappears once the
|
|
78
|
+
* same url and variation builds successfully, so an empty list means nothing
|
|
79
|
+
* is currently failing, not that nothing ever did.
|
|
80
|
+
*
|
|
81
|
+
* `occurredAt` is converted to ISO on the way out — the panel wants epoch
|
|
82
|
+
* milliseconds to sort by, a reader wants a timestamp it can compare against
|
|
83
|
+
* a log line.
|
|
84
|
+
*/
|
|
85
|
+
getLocalCacheErrors(): LocalCacheErrorEntry[];
|
|
52
86
|
private localCacheErrorKey;
|
|
53
87
|
private recordLocalCacheError;
|
|
54
88
|
private clearLocalCacheError;
|
|
@@ -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";
|
|
@@ -51,6 +52,32 @@ export class VirtualOrestesApp {
|
|
|
51
52
|
}
|
|
52
53
|
return this.buildResponse(event.request.url);
|
|
53
54
|
}
|
|
55
|
+
/** The variations the runtime config names: see {@link OriginFetcher.namedVariations}. */
|
|
56
|
+
namedVariations() {
|
|
57
|
+
return this.originFetcher.namedVariations();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Build and cache one variation of a url without the browser asking for it.
|
|
61
|
+
*
|
|
62
|
+
* The same path a real asset request takes — {@link buildResponse} fetches
|
|
63
|
+
* the origin with the variation's headers, runs the documentHandler over it
|
|
64
|
+
* and caches the result — with the request synthesised rather than
|
|
65
|
+
* intercepted. That is what makes a variation reachable at all: a browser is
|
|
66
|
+
* one device at a time, so mobile and desktop can never both be in the cache
|
|
67
|
+
* from browsing, and the comparison everyone wants to make is between exactly
|
|
68
|
+
* those two.
|
|
69
|
+
*
|
|
70
|
+
* Throws what the build threw. The caller is asking for one specific entry,
|
|
71
|
+
* so a failure is the answer to its question, not a background detail —
|
|
72
|
+
* unlike {@link refreshEntry}, which is fire-and-forget and logs instead.
|
|
73
|
+
*
|
|
74
|
+
* @returns the cache key the entry was stored under.
|
|
75
|
+
*/
|
|
76
|
+
async prewarm(originUrl, variation) {
|
|
77
|
+
const requestUrl = assetRequestUrl(this.customerConfig.appDomain, originUrl, variation);
|
|
78
|
+
await this.buildResponse(requestUrl);
|
|
79
|
+
return requestUrl;
|
|
80
|
+
}
|
|
54
81
|
/**
|
|
55
82
|
* Re-warm all cached entries for the given origin url in the background.
|
|
56
83
|
*
|
|
@@ -66,10 +93,13 @@ export class VirtualOrestesApp {
|
|
|
66
93
|
.map(([key]) => key)
|
|
67
94
|
.filter((key) => key.includes(originUrl));
|
|
68
95
|
if (matchingKeys.length === 0) {
|
|
69
|
-
this.cli.write(`changeDetection for url: ${originUrl} - nothing cached to refresh
|
|
96
|
+
this.cli.write(`changeDetection for url: ${originUrl} - nothing cached to refresh`, false, { scope: "cache", data: { url: originUrl, refreshed: 0 } });
|
|
70
97
|
return;
|
|
71
98
|
}
|
|
72
|
-
this.cli.write(`changeDetection triggered for url: ${originUrl} - refreshing dh-cache in background
|
|
99
|
+
this.cli.write(`changeDetection triggered for url: ${originUrl} - refreshing dh-cache in background`, false, {
|
|
100
|
+
scope: "cache",
|
|
101
|
+
data: { url: originUrl, refreshed: matchingKeys.length },
|
|
102
|
+
});
|
|
73
103
|
for (const key of matchingKeys) {
|
|
74
104
|
await this.refreshEntry(key);
|
|
75
105
|
}
|
|
@@ -91,7 +121,10 @@ export class VirtualOrestesApp {
|
|
|
91
121
|
if (matchingKeys.length === 0) {
|
|
92
122
|
return;
|
|
93
123
|
}
|
|
94
|
-
this.cli.write(`refreshing ${matchingKeys.length} dh-cache entries for current url ${currentUrl} in background
|
|
124
|
+
this.cli.write(`refreshing ${matchingKeys.length} dh-cache entries for current url ${currentUrl} in background`, false, {
|
|
125
|
+
scope: "cache",
|
|
126
|
+
data: { url: currentUrl, refreshed: matchingKeys.length },
|
|
127
|
+
});
|
|
95
128
|
for (const key of matchingKeys) {
|
|
96
129
|
await this.refreshEntry(key);
|
|
97
130
|
}
|
|
@@ -107,7 +140,7 @@ export class VirtualOrestesApp {
|
|
|
107
140
|
const result = await safe(this.buildResponse(requestUrl));
|
|
108
141
|
if (result.success === false) {
|
|
109
142
|
this.cache.removeEntry(requestUrl);
|
|
110
|
-
this.cli.writeError(`failed to refresh dh-cache entry ${requestUrl}: ${result.error}
|
|
143
|
+
this.cli.writeError(`failed to refresh dh-cache entry ${requestUrl}: ${result.error}`, false, { scope: "cache", data: { url: requestUrl, error: result.error } });
|
|
111
144
|
}
|
|
112
145
|
}
|
|
113
146
|
async buildResponse(requestUrl) {
|
|
@@ -145,7 +178,7 @@ export class VirtualOrestesApp {
|
|
|
145
178
|
if (!this.isHtmlContentHeader(response?.headers) ||
|
|
146
179
|
!this.isValidHtmlContent(responseContent)) {
|
|
147
180
|
const customResponse = new BaqendResponse(responseContent, `text/html; charset=${textEncoding}`, customHeaders);
|
|
148
|
-
this.cache.addEntry(requestUrl, customResponse);
|
|
181
|
+
this.cache.addEntry(requestUrl, customResponse, responseContent);
|
|
149
182
|
return customResponse;
|
|
150
183
|
}
|
|
151
184
|
const customResponse = await safe(this.documentHandler.transform(`text/html;charset=${textEncoding}`, responseContent, variation, originUrl, this.convertResponseHeadersToOrestesFormat(response)));
|
|
@@ -183,16 +216,36 @@ export class VirtualOrestesApp {
|
|
|
183
216
|
name: "x-sk-detected-encoding",
|
|
184
217
|
value: textEncoding,
|
|
185
218
|
});
|
|
186
|
-
|
|
219
|
+
// Decoded, and cached decoded: only Chrome needs the base64.
|
|
220
|
+
const decodedBody = Buffer.isBuffer(skResponse.body)
|
|
187
221
|
? skResponse.body
|
|
188
|
-
: iconv.encode(skResponse.body, textEncoding)
|
|
189
|
-
|
|
222
|
+
: iconv.encode(skResponse.body, textEncoding);
|
|
223
|
+
const baqendResponse = new BaqendResponse(decodedBody, skResponse.headers["content-type"] ?? `text/html;charset=${textEncoding}`, [...customHeaders, ...originHeaders]);
|
|
224
|
+
this.cache.addEntry(requestUrl, baqendResponse, decodedBody);
|
|
190
225
|
return baqendResponse;
|
|
191
226
|
}
|
|
192
227
|
async getResponseText(response) {
|
|
193
228
|
const { text, charset } = decodeHtml(response?.headers.get("content-type") || "", Buffer.from(await response.arrayBuffer()));
|
|
194
229
|
return { responseContent: text, textEncoding: charset };
|
|
195
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* The urls the local documentHandler could not build, as they stand now.
|
|
233
|
+
*
|
|
234
|
+
* Already collected for the devtools panel; this is the same list for a
|
|
235
|
+
* reader without one. State rather than history: an entry disappears once the
|
|
236
|
+
* same url and variation builds successfully, so an empty list means nothing
|
|
237
|
+
* is currently failing, not that nothing ever did.
|
|
238
|
+
*
|
|
239
|
+
* `occurredAt` is converted to ISO on the way out — the panel wants epoch
|
|
240
|
+
* milliseconds to sort by, a reader wants a timestamp it can compare against
|
|
241
|
+
* a log line.
|
|
242
|
+
*/
|
|
243
|
+
getLocalCacheErrors() {
|
|
244
|
+
return [...this.localCacheErrors.values()].map((error) => ({
|
|
245
|
+
...error,
|
|
246
|
+
occurredAt: new Date(error.occurredAt).toISOString(),
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
196
249
|
localCacheErrorKey(url, variation) {
|
|
197
250
|
return `${url}|${variation}`;
|
|
198
251
|
}
|
|
@@ -238,13 +291,17 @@ export class VirtualOrestesApp {
|
|
|
238
291
|
this.warnPrerendererUnreachable();
|
|
239
292
|
return;
|
|
240
293
|
}
|
|
294
|
+
const meta = {
|
|
295
|
+
scope: "documentHandler",
|
|
296
|
+
data: { aborted: true, status: ABORT_STATUS_CODE, error: message },
|
|
297
|
+
};
|
|
241
298
|
const failure = prerenderFailure(error);
|
|
242
299
|
if (failure) {
|
|
243
300
|
this.cli.writeError(`[DocumentHandler:local]: SSR failed for ${failure.url} (${failure.variation}): ` +
|
|
244
|
-
`${failure.detailMessage ?? "no error message"}
|
|
301
|
+
`${failure.detailMessage ?? "no error message"}`, false, meta);
|
|
245
302
|
return;
|
|
246
303
|
}
|
|
247
|
-
this.cli.writeWarning(`[DocumentHandler:local]: ${message}
|
|
304
|
+
this.cli.writeWarning(`[DocumentHandler:local]: ${message}`, false, meta);
|
|
248
305
|
}
|
|
249
306
|
warnPrerendererUnreachable() {
|
|
250
307
|
const unreachable = `no pre-renderer is listening on localhost:${LOCAL_PRERENDERER_PORT}`;
|
|
@@ -291,9 +348,18 @@ export class VirtualOrestesApp {
|
|
|
291
348
|
return this.returnAbortResponse(customResponse, customHeaders);
|
|
292
349
|
}
|
|
293
350
|
const message = `Could not transform html: - ${customResponse.error}`;
|
|
294
|
-
this.cli.writeError(`[VirtualOrestes]: ${message}
|
|
295
|
-
|
|
296
|
-
|
|
351
|
+
this.cli.writeError(`[VirtualOrestes]: ${message}`, false, {
|
|
352
|
+
scope: "documentHandler",
|
|
353
|
+
data: {
|
|
354
|
+
error: customResponse.error,
|
|
355
|
+
stack: customResponse.errorObj.stack,
|
|
356
|
+
},
|
|
357
|
+
});
|
|
358
|
+
this.cli.comment(customResponse.errorObj.stack, false, {
|
|
359
|
+
scope: "documentHandler",
|
|
360
|
+
level: "debug",
|
|
361
|
+
});
|
|
362
|
+
this.cli.writeWarning("Suggestion: check files: config_documentHandler.es6 | custom_documentHandler.js", false, { scope: "documentHandler" });
|
|
297
363
|
customHeaders.push({ name: "x-error", value: message });
|
|
298
364
|
return new BaqendResponse(message, null, customHeaders, 500);
|
|
299
365
|
}
|
|
@@ -310,7 +376,7 @@ export class VirtualOrestesApp {
|
|
|
310
376
|
value: response?.headers.get("location") || "",
|
|
311
377
|
});
|
|
312
378
|
const redirectResponse = new BaqendResponse("", null, customHeaders, response.status);
|
|
313
|
-
this.cache.addEntry(requestUrl, redirectResponse);
|
|
379
|
+
this.cache.addEntry(requestUrl, redirectResponse, "");
|
|
314
380
|
return redirectResponse;
|
|
315
381
|
}
|
|
316
382
|
handleCdnRedirect(customHeaders, response, requestUrl) {
|
|
@@ -328,22 +394,11 @@ export class VirtualOrestesApp {
|
|
|
328
394
|
// the CDN redirect surfaced as a bare ClientError (`AssetAPIHandler.ts:200-205`).
|
|
329
395
|
serverTimingHeader.value += ",errorcode;desc=202";
|
|
330
396
|
const redirectResponse = new BaqendResponse("", null, customHeaders, 400);
|
|
331
|
-
this.cache.addEntry(requestUrl, redirectResponse);
|
|
397
|
+
this.cache.addEntry(requestUrl, redirectResponse, "");
|
|
332
398
|
return redirectResponse;
|
|
333
399
|
}
|
|
334
400
|
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];
|
|
401
|
+
return assetOriginUrl(requestUrl);
|
|
347
402
|
}
|
|
348
403
|
getCachedResponse(requestUrl) {
|
|
349
404
|
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
|
}
|
|
@@ -11,6 +11,8 @@ declare const flags: {
|
|
|
11
11
|
host: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
12
12
|
body: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
13
13
|
grep: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
14
|
+
select: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
15
|
+
maxMatches: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
14
16
|
json: Interfaces.BooleanFlag<boolean>;
|
|
15
17
|
variations: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
16
18
|
raw: Interfaces.BooleanFlag<boolean>;
|
|
@@ -26,8 +28,21 @@ export interface OriginRequestOptions {
|
|
|
26
28
|
readonly host?: string;
|
|
27
29
|
readonly bodyFile?: string;
|
|
28
30
|
readonly grep?: string;
|
|
31
|
+
readonly select?: string;
|
|
32
|
+
readonly maxMatches?: number;
|
|
29
33
|
readonly json?: boolean;
|
|
30
34
|
readonly variationsFile?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The origin a relative {@link pageUrl} is resolved against, when the
|
|
37
|
+
* caller knows one the config cannot supply.
|
|
38
|
+
*
|
|
39
|
+
* A customer with several origins and no `domain` has no base in its
|
|
40
|
+
* config, and picking `origins[0]` would answer about the wrong site. But
|
|
41
|
+
* a run *is* on one of them — the one `-d` or the startup prompt chose —
|
|
42
|
+
* and that is the origin whoever is asking means. Passed in rather than
|
|
43
|
+
* looked up, because this service has no idea a run exists.
|
|
44
|
+
*/
|
|
45
|
+
readonly base?: string;
|
|
31
46
|
}
|
|
32
47
|
export interface OriginRequestServiceBuildContextValues extends CommandContextValues, OriginRequestOptions {
|
|
33
48
|
}
|
|
@@ -45,6 +60,8 @@ export declare class OriginRequestServiceBuildContext extends OriginRequestServi
|
|
|
45
60
|
host: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
46
61
|
body: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
47
62
|
grep: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
63
|
+
select: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
64
|
+
maxMatches: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
48
65
|
json: Interfaces.BooleanFlag<boolean>;
|
|
49
66
|
variations: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
50
67
|
raw: Interfaces.BooleanFlag<boolean>;
|
|
@@ -34,6 +34,12 @@ const flags = {
|
|
|
34
34
|
grep: Flags.string({
|
|
35
35
|
description: "Print body lines matching this regex, case-insensitive",
|
|
36
36
|
}),
|
|
37
|
+
select: Flags.string({
|
|
38
|
+
description: "Count and sample what this CSS selector matches in the body, e.g. 'script[src*=\"analytics\"]'",
|
|
39
|
+
}),
|
|
40
|
+
maxMatches: Flags.integer({
|
|
41
|
+
description: "How many --select and --grep matches to show. Default 10",
|
|
42
|
+
}),
|
|
37
43
|
json: Flags.boolean({
|
|
38
44
|
description: "Machine-readable output",
|
|
39
45
|
}),
|
|
@@ -72,6 +78,8 @@ export class OriginRequestServiceBuildContext extends Context() {
|
|
|
72
78
|
host: parsedFlags.host,
|
|
73
79
|
bodyFile: parsedFlags.body,
|
|
74
80
|
grep: parsedFlags.grep,
|
|
81
|
+
select: parsedFlags.select,
|
|
82
|
+
maxMatches: parsedFlags.maxMatches,
|
|
75
83
|
json: parsedFlags.json,
|
|
76
84
|
variationsFile: parsedFlags.variations,
|
|
77
85
|
});
|
|
@@ -6,11 +6,6 @@ export declare class OriginRequestServiceFactory {
|
|
|
6
6
|
constructor(context: OriginRequestServiceBuildContext);
|
|
7
7
|
buildService(): Promise<OriginRequestService>;
|
|
8
8
|
private build;
|
|
9
|
-
/**
|
|
10
|
-
* The runtime config: a local file when one is named, else the app's. Without a customer there is
|
|
11
|
-
* no app, and the request carries Speed Kit's device defaults only.
|
|
12
|
-
*/
|
|
13
|
-
private loadRuntimeConfig;
|
|
14
9
|
private getIntegrationFiles;
|
|
15
10
|
private getConfigApi;
|
|
16
11
|
}
|
|
@@ -2,8 +2,6 @@ import { ConfigApiContext, ConfigApiServiceFactory, } from "../config-api/index.
|
|
|
2
2
|
import { IntegrationApiServiceBuildContext, IntegrationApiFactory, } from "../integration-api/index.js";
|
|
3
3
|
import { applyOriginProxy } from "../../helpers/origin-proxy.js";
|
|
4
4
|
import { OriginRequestService } from "./origin-request-service.js";
|
|
5
|
-
import { OriginFetcher } from "./origin-fetcher.js";
|
|
6
|
-
import { RuntimeConfigSource, } from "./runtime-config-source.js";
|
|
7
5
|
export class OriginRequestServiceFactory {
|
|
8
6
|
context;
|
|
9
7
|
service = undefined;
|
|
@@ -18,39 +16,13 @@ export class OriginRequestServiceFactory {
|
|
|
18
16
|
}
|
|
19
17
|
async build() {
|
|
20
18
|
const cli = this.context.environment.cli;
|
|
19
|
+
// `sk origin-request --raw <url>` names no customer: no app, so no runtime config.
|
|
21
20
|
const customer = this.context.customerPath
|
|
22
21
|
? (await this.getIntegrationFiles(this.context.customerPath)).getCustomerConfig().config
|
|
23
22
|
: undefined;
|
|
24
23
|
// `--json` owns stdout, so the proxy line stays out of a machine-readable run.
|
|
25
24
|
applyOriginProxy(customer?.chromeFlags, this.context.json ? undefined : cli);
|
|
26
|
-
|
|
27
|
-
const config = await this.loadRuntimeConfig(customer?.app);
|
|
28
|
-
this.service = new OriginRequestService(this.context, cli, config
|
|
29
|
-
? new OriginFetcher({
|
|
30
|
-
cli,
|
|
31
|
-
config,
|
|
32
|
-
host: this.context.host,
|
|
33
|
-
strict: true,
|
|
34
|
-
})
|
|
35
|
-
: undefined);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* The runtime config: a local file when one is named, else the app's. Without a customer there is
|
|
39
|
-
* no app, and the request carries Speed Kit's device defaults only.
|
|
40
|
-
*/
|
|
41
|
-
async loadRuntimeConfig(app) {
|
|
42
|
-
const cli = this.context.environment.cli;
|
|
43
|
-
if (!app && !this.context.variationsFile) {
|
|
44
|
-
if (!this.context.json) {
|
|
45
|
-
cli.writeWarning("no customer: the request carries Speed Kit's device defaults only, no variation of an app");
|
|
46
|
-
}
|
|
47
|
-
return { variations: {}, authentications: [], originMap: {} };
|
|
48
|
-
}
|
|
49
|
-
return new RuntimeConfigSource({
|
|
50
|
-
cli,
|
|
51
|
-
configApi: app ? this.getConfigApi(app) : undefined,
|
|
52
|
-
fileFlag: "--variations",
|
|
53
|
-
}).load(this.context.variationsFile);
|
|
25
|
+
this.service = new OriginRequestService(this.context, cli, customer ? this.getConfigApi(customer.app) : undefined, customer);
|
|
54
26
|
}
|
|
55
27
|
async getIntegrationFiles(customerPath) {
|
|
56
28
|
const integrationApiContext = new IntegrationApiServiceBuildContext({
|