@speedkit/cli 4.51.0-run-control.5 → 4.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +14 -1426
- package/dist/commands/diff.d.ts +1 -7
- package/dist/commands/diff.js +3 -9
- package/dist/commands/login.d.ts +0 -3
- package/dist/commands/login.js +3 -14
- package/dist/commands/onboarding.d.ts +0 -26
- package/dist/commands/onboarding.js +4 -221
- package/dist/commands/origin-request.d.ts +0 -4
- package/dist/commands/origin-request.js +0 -4
- package/dist/services/browser-fetch/device-emulation.d.ts +0 -11
- package/dist/services/browser-fetch/device-emulation.js +0 -14
- package/dist/services/bundler/bundle-service-factory.d.ts +3 -0
- package/dist/services/bundler/bundle-service-factory.js +5 -1
- package/dist/services/bundler/bundle-service.d.ts +10 -1
- package/dist/services/bundler/bundle-service.js +16 -1
- package/dist/services/bundler/error/packjockel-error.d.ts +3 -0
- package/dist/services/bundler/error/packjockel-error.js +3 -0
- package/dist/services/bundler/index.d.ts +1 -0
- package/dist/services/bundler/index.js +1 -0
- package/dist/services/bundler/packjockel-service.d.ts +112 -0
- package/dist/services/bundler/packjockel-service.js +202 -0
- package/dist/services/bundler/spec/packjockel-service.spec.js +186 -0
- package/dist/services/cli/cli-environment-factory.d.ts +0 -3
- package/dist/services/cli/cli-environment-factory.js +0 -1
- package/dist/services/cli/cli-service-build-context.d.ts +0 -3
- package/dist/services/cli/cli-service-factory.js +1 -1
- package/dist/services/cli/cli-service-model.d.ts +10 -29
- package/dist/services/cli/cli-service.d.ts +11 -60
- package/dist/services/cli/cli-service.js +32 -196
- package/dist/services/cli/index.d.ts +0 -2
- package/dist/services/cli/index.js +0 -2
- package/dist/services/cli/spec/cli-service.spec.js +50 -113
- package/dist/services/deploy/checks/activation/customer-approval-check.js +1 -1
- package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +2 -3
- package/dist/services/deploy/checks/pre-deploy/split-change-check.js +2 -3
- package/dist/services/deploy/handler/customer-config-handler.d.ts +9 -0
- package/dist/services/deploy/handler/customer-config-handler.js +41 -6
- package/dist/services/deploy/interface/install.d.ts +7 -1
- package/dist/services/deploy/mr/live-state-check.js +21 -2
- package/dist/services/deploy/policy/auto-deploy-policy.js +2 -0
- package/dist/services/deploy/policy/deploy-policy-model.d.ts +4 -0
- package/dist/services/deploy/policy/deploy-policy-model.js +4 -0
- package/dist/services/deploy/policy/testing-deploy-policy.js +2 -0
- package/dist/services/deploy/spec/handler/customer-config-handler.spec.js +98 -0
- package/dist/services/deploy/spec/mr/live-state-check.spec.js +45 -4
- package/dist/services/deploy/spec/policy/auto-deploy-policy.spec.js +2 -0
- package/dist/services/deploy/spec/policy/testing-deploy-policy.spec.js +3 -1
- package/dist/services/diff/diff-service-build-context.d.ts +0 -12
- package/dist/services/diff/diff-service-build-context.js +1 -45
- package/dist/services/diff/diff-service-factory.d.ts +0 -2
- package/dist/services/diff/diff-service-factory.js +25 -65
- package/dist/services/diff/diff-service.d.ts +0 -11
- package/dist/services/diff/diff-service.js +11 -37
- package/dist/services/diff/page-source.d.ts +0 -12
- package/dist/services/diff/page-source.js +11 -16
- package/dist/services/diff/sinks/tool-diff-sink.d.ts +2 -3
- package/dist/services/diff/sinks/tool-diff-sink.js +2 -3
- package/dist/services/diff/spec/diff-service-build-context.spec.js +0 -19
- package/dist/services/diff/spec/diff-service.spec.js +0 -95
- package/dist/services/document-handler-runtime/document-handler-browser-mock.d.ts +13 -0
- package/dist/services/document-handler-runtime/document-handler-browser-mock.js +69 -0
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +27 -0
- package/dist/services/document-handler-runtime/document-handler-server.js +112 -19
- package/dist/services/document-handler-runtime/spec/document-handler-browser-mock.spec.js +34 -0
- package/dist/services/git/git-repository.d.ts +0 -2
- package/dist/services/git/git-repository.js +0 -6
- package/dist/services/integration-api/customer-config-flags.js +0 -1
- package/dist/services/integration-api/integration-api-model.d.ts +4 -1
- package/dist/services/integration-api/spec/customer-config-file.spec.js +56 -0
- package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +68 -8
- package/dist/services/integration-api/struct/customer-config-file.d.ts +15 -0
- package/dist/services/integration-api/struct/customer-config-file.js +42 -0
- package/dist/services/integration-api/struct/customer-config.d.ts +55 -1
- package/dist/services/integration-api/struct/customer-config.js +70 -3
- package/dist/services/integration-api/struct/speed-kit-config-file.d.ts +11 -4
- package/dist/services/integration-api/struct/speed-kit-config-file.js +31 -10
- package/dist/services/onboarding/browse/browse-service.d.ts +1 -13
- package/dist/services/onboarding/browse/browse-service.js +7 -43
- package/dist/services/onboarding/browser/baqend-response.d.ts +1 -17
- package/dist/services/onboarding/browser/baqend-response.js +0 -23
- package/dist/services/onboarding/browser/emulate-device.d.ts +1 -12
- package/dist/services/onboarding/browser/emulate-device.js +13 -68
- package/dist/services/onboarding/browser/executable/executable-validator.js +2 -4
- package/dist/services/onboarding/browser/extension/extension-bridge.js +3 -5
- package/dist/services/onboarding/browser/extension/extension-downloader.js +8 -17
- package/dist/services/onboarding/browser/extension/extension-validator.js +4 -9
- package/dist/services/onboarding/browser/launch-browser.d.ts +1 -2
- package/dist/services/onboarding/browser/launch-browser.js +1 -6
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +2 -0
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +29 -8
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +1 -3
- package/dist/services/onboarding/dashboard/index.js +2 -7
- package/dist/services/onboarding/fetch-event-handler.d.ts +5 -24
- package/dist/services/onboarding/fetch-event-handler.js +32 -103
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +2 -11
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +0 -14
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +0 -30
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +3 -14
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +10 -29
- package/dist/services/onboarding/file-events/file-watcher.d.ts +4 -43
- package/dist/services/onboarding/file-events/file-watcher.js +21 -119
- package/dist/services/onboarding/inject/inject-service.js +1 -1
- package/dist/services/onboarding/onboarding-model.d.ts +7 -40
- package/dist/services/onboarding/onboarding-model.js +9 -20
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +0 -4
- package/dist/services/onboarding/onboarding-service-build-context.js +1 -7
- package/dist/services/onboarding/onboarding-service-factory.d.ts +1 -17
- package/dist/services/onboarding/onboarding-service-factory.js +35 -152
- package/dist/services/onboarding/onboarding-service.d.ts +1 -40
- package/dist/services/onboarding/onboarding-service.js +23 -139
- package/dist/services/onboarding/request-cache/cache.d.ts +5 -62
- package/dist/services/onboarding/request-cache/cache.js +17 -128
- package/dist/services/onboarding/spec/file-events/file-watcher.spec.js +67 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +3 -39
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +1 -25
- package/dist/services/onboarding/templates/install-speed-kit-js-template.js +5 -0
- package/dist/services/onboarding/todo-collector.d.ts +2 -7
- package/dist/services/onboarding/todo-collector.js +12 -49
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +0 -38
- package/dist/services/onboarding/virtual-orestes-app/index.js +27 -113
- package/dist/services/origin-request/asset-variations.d.ts +0 -14
- package/dist/services/origin-request/asset-variations.js +4 -11
- package/dist/services/origin-request/origin-fetcher.d.ts +0 -7
- package/dist/services/origin-request/origin-fetcher.js +5 -43
- package/dist/services/origin-request/origin-request-service-build-context.d.ts +0 -17
- package/dist/services/origin-request/origin-request-service-build-context.js +0 -8
- package/dist/services/origin-request/origin-request-service-factory.d.ts +5 -0
- package/dist/services/origin-request/origin-request-service-factory.js +30 -2
- package/dist/services/origin-request/origin-request-service.d.ts +6 -121
- package/dist/services/origin-request/origin-request-service.js +49 -273
- package/dist/services/origin-request/runtime-config-source.d.ts +0 -6
- package/dist/services/origin-request/runtime-config-source.js +4 -15
- package/dist/services/origin-request/spec/asset-variations.spec.js +0 -20
- package/dist/services/origin-request/spec/origin-request-service.spec.js +6 -329
- package/dist/services/pull/pull-service.js +23 -5
- package/dist/services/query-builder/query-builder-factory.js +3 -3
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +288 -3409
- package/package.json +3 -20
- package/dist/base/run-control-command.d.ts +0 -15
- package/dist/base/run-control-command.js +0 -20
- package/dist/build-info.json +0 -6
- package/dist/commands/onboarding/browser/click.d.ts +0 -75
- package/dist/commands/onboarding/browser/click.js +0 -19
- package/dist/commands/onboarding/browser/emulate.d.ts +0 -105
- package/dist/commands/onboarding/browser/emulate.js +0 -26
- package/dist/commands/onboarding/browser/navigate.d.ts +0 -75
- package/dist/commands/onboarding/browser/navigate.js +0 -19
- package/dist/commands/onboarding/browser/panel.d.ts +0 -63
- package/dist/commands/onboarding/browser/panel.js +0 -12
- package/dist/commands/onboarding/browser/reinstall-sw.d.ts +0 -63
- package/dist/commands/onboarding/browser/reinstall-sw.js +0 -14
- package/dist/commands/onboarding/browser/reset.d.ts +0 -71
- package/dist/commands/onboarding/browser/reset.js +0 -18
- package/dist/commands/onboarding/browser/screenshot.d.ts +0 -77
- package/dist/commands/onboarding/browser/screenshot.js +0 -19
- package/dist/commands/onboarding/browser/state.d.ts +0 -63
- package/dist/commands/onboarding/browser/state.js +0 -12
- package/dist/commands/onboarding/browser/tabs.d.ts +0 -58
- package/dist/commands/onboarding/browser/tabs.js +0 -16
- package/dist/commands/onboarding/cache/clear.d.ts +0 -58
- package/dist/commands/onboarding/cache/clear.js +0 -12
- package/dist/commands/onboarding/cache/errors.d.ts +0 -58
- package/dist/commands/onboarding/cache/errors.js +0 -12
- package/dist/commands/onboarding/cache/evict.d.ts +0 -62
- package/dist/commands/onboarding/cache/evict.js +0 -15
- package/dist/commands/onboarding/cache/get.d.ts +0 -85
- package/dist/commands/onboarding/cache/get.js +0 -17
- package/dist/commands/onboarding/cache/list.d.ts +0 -58
- package/dist/commands/onboarding/cache/list.js +0 -15
- package/dist/commands/onboarding/cache/prewarm.d.ts +0 -73
- package/dist/commands/onboarding/cache/prewarm.js +0 -20
- package/dist/commands/onboarding/cache/refresh.d.ts +0 -62
- package/dist/commands/onboarding/cache/refresh.js +0 -18
- package/dist/commands/onboarding/cdp.d.ts +0 -81
- package/dist/commands/onboarding/cdp.js +0 -18
- package/dist/commands/onboarding/debug/arm.d.ts +0 -83
- package/dist/commands/onboarding/debug/arm.js +0 -19
- package/dist/commands/onboarding/debug/await.d.ts +0 -71
- package/dist/commands/onboarding/debug/await.js +0 -18
- package/dist/commands/onboarding/debug/disarm.d.ts +0 -63
- package/dist/commands/onboarding/debug/disarm.js +0 -12
- package/dist/commands/onboarding/debug/eval.d.ts +0 -75
- package/dist/commands/onboarding/debug/eval.js +0 -16
- package/dist/commands/onboarding/debug/release.d.ts +0 -63
- package/dist/commands/onboarding/debug/release.js +0 -12
- package/dist/commands/onboarding/debug/resume.d.ts +0 -63
- package/dist/commands/onboarding/debug/resume.js +0 -12
- package/dist/commands/onboarding/debug/status.d.ts +0 -63
- package/dist/commands/onboarding/debug/status.js +0 -12
- package/dist/commands/onboarding/debug/step.d.ts +0 -67
- package/dist/commands/onboarding/debug/step.js +0 -15
- package/dist/commands/onboarding/files/list.d.ts +0 -58
- package/dist/commands/onboarding/files/list.js +0 -12
- package/dist/commands/onboarding/files/read.d.ts +0 -73
- package/dist/commands/onboarding/files/read.js +0 -16
- package/dist/commands/onboarding/files/rebuild.d.ts +0 -63
- package/dist/commands/onboarding/files/rebuild.js +0 -18
- package/dist/commands/onboarding/files/validate.d.ts +0 -58
- package/dist/commands/onboarding/files/validate.js +0 -12
- package/dist/commands/onboarding/fouc.d.ts +0 -77
- package/dist/commands/onboarding/fouc.js +0 -16
- package/dist/commands/onboarding/inject/add.d.ts +0 -89
- package/dist/commands/onboarding/inject/add.js +0 -17
- package/dist/commands/onboarding/inject/clear.d.ts +0 -63
- package/dist/commands/onboarding/inject/clear.js +0 -12
- package/dist/commands/onboarding/inject/list.d.ts +0 -63
- package/dist/commands/onboarding/inject/list.js +0 -12
- package/dist/commands/onboarding/inject/read.d.ts +0 -75
- package/dist/commands/onboarding/inject/read.js +0 -18
- package/dist/commands/onboarding/inject/recipes.d.ts +0 -63
- package/dist/commands/onboarding/inject/recipes.js +0 -12
- package/dist/commands/onboarding/inject/remove.d.ts +0 -67
- package/dist/commands/onboarding/inject/remove.js +0 -15
- package/dist/commands/onboarding/list.d.ts +0 -13
- package/dist/commands/onboarding/list.js +0 -12
- package/dist/commands/onboarding/logs.d.ts +0 -41
- package/dist/commands/onboarding/logs.js +0 -257
- package/dist/commands/onboarding/navwalk.d.ts +0 -95
- package/dist/commands/onboarding/navwalk.js +0 -19
- package/dist/commands/onboarding/response.d.ts +0 -67
- package/dist/commands/onboarding/response.js +0 -18
- package/dist/commands/onboarding/rum/beacons.d.ts +0 -75
- package/dist/commands/onboarding/rum/beacons.js +0 -16
- package/dist/commands/onboarding/rum/get.d.ts +0 -77
- package/dist/commands/onboarding/rum/get.js +0 -18
- package/dist/commands/onboarding/rum/key.d.ts +0 -67
- package/dist/commands/onboarding/rum/key.js +0 -13
- package/dist/commands/onboarding/rum/previous.d.ts +0 -63
- package/dist/commands/onboarding/rum/previous.js +0 -12
- package/dist/commands/onboarding/status.d.ts +0 -13
- package/dist/commands/onboarding/status.js +0 -17
- package/dist/commands/onboarding/stop.d.ts +0 -13
- package/dist/commands/onboarding/stop.js +0 -17
- package/dist/commands/onboarding/todo.d.ts +0 -58
- package/dist/commands/onboarding/todo.js +0 -12
- package/dist/commands/onboarding/viewport.d.ts +0 -101
- package/dist/commands/onboarding/viewport.js +0 -18
- package/dist/commands/onboarding/watch.d.ts +0 -93
- package/dist/commands/onboarding/watch.js +0 -16
- package/dist/commands/spec/onboarding.spec.js +0 -127
- package/dist/services/cli/build-info.d.ts +0 -33
- package/dist/services/cli/build-info.js +0 -63
- package/dist/services/cli/sink.d.ts +0 -47
- package/dist/services/cli/sink.js +0 -31
- package/dist/services/cli/spec/build-identity.spec.js +0 -85
- package/dist/services/cli/spec/build-info.spec.js +0 -10
- package/dist/services/cli/spec/cli-service-log.spec.js +0 -133
- package/dist/services/cli/spec/memory-cli.d.ts +0 -9
- package/dist/services/cli/spec/memory-cli.js +0 -9
- package/dist/services/diff/config-at-ref.d.ts +0 -20
- package/dist/services/diff/config-at-ref.js +0 -33
- package/dist/services/diff/run-runtime-config.d.ts +0 -33
- package/dist/services/diff/run-runtime-config.js +0 -74
- package/dist/services/diff/spec/config-at-ref.spec.js +0 -46
- package/dist/services/diff/spec/run-runtime-config.spec.d.ts +0 -1
- package/dist/services/diff/spec/run-runtime-config.spec.js +0 -87
- package/dist/services/onboarding/browser/answer-dialogs.d.ts +0 -12
- package/dist/services/onboarding/browser/answer-dialogs.js +0 -25
- package/dist/services/onboarding/browser/console-log.d.ts +0 -9
- package/dist/services/onboarding/browser/console-log.js +0 -27
- package/dist/services/onboarding/browser/resume-restarted-workers.d.ts +0 -14
- package/dist/services/onboarding/browser/resume-restarted-workers.js +0 -26
- package/dist/services/onboarding/control/body-inspect.d.ts +0 -24
- package/dist/services/onboarding/control/body-inspect.js +0 -106
- package/dist/services/onboarding/control/browser-session.d.ts +0 -547
- package/dist/services/onboarding/control/browser-session.js +0 -1337
- package/dist/services/onboarding/control/config-validation.d.ts +0 -17
- package/dist/services/onboarding/control/config-validation.js +0 -46
- package/dist/services/onboarding/control/control-protocol.d.ts +0 -1430
- package/dist/services/onboarding/control/control-protocol.js +0 -58
- package/dist/services/onboarding/control/control-server.d.ts +0 -292
- package/dist/services/onboarding/control/control-server.js +0 -1629
- package/dist/services/onboarding/control/debug-session.d.ts +0 -219
- package/dist/services/onboarding/control/debug-session.js +0 -897
- package/dist/services/onboarding/control/fouc.d.ts +0 -23
- package/dist/services/onboarding/control/fouc.js +0 -151
- package/dist/services/onboarding/control/index.d.ts +0 -4
- package/dist/services/onboarding/control/index.js +0 -4
- package/dist/services/onboarding/control/navigate-wait.d.ts +0 -33
- package/dist/services/onboarding/control/navigate-wait.js +0 -56
- package/dist/services/onboarding/control/navwalk.d.ts +0 -65
- package/dist/services/onboarding/control/navwalk.js +0 -248
- package/dist/services/onboarding/control/preload-registry.d.ts +0 -150
- package/dist/services/onboarding/control/preload-registry.js +0 -829
- package/dist/services/onboarding/control/response-explainer.d.ts +0 -24
- package/dist/services/onboarding/control/response-explainer.js +0 -257
- package/dist/services/onboarding/control/rum.d.ts +0 -8
- package/dist/services/onboarding/control/rum.js +0 -220
- package/dist/services/onboarding/control/service-worker-tracker.d.ts +0 -68
- package/dist/services/onboarding/control/service-worker-tracker.js +0 -120
- package/dist/services/onboarding/control/viewport.d.ts +0 -45
- package/dist/services/onboarding/control/viewport.js +0 -344
- package/dist/services/onboarding/control/watch.d.ts +0 -26
- package/dist/services/onboarding/control/watch.js +0 -157
- package/dist/services/onboarding/request-cache/asset-key.d.ts +0 -61
- package/dist/services/onboarding/request-cache/asset-key.js +0 -115
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.js +0 -66
- package/dist/services/onboarding/spec/browser/console-log.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/browser/console-log.spec.js +0 -42
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.js +0 -45
- package/dist/services/onboarding/spec/control/browser-session.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/browser-session.spec.js +0 -753
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/control-server.spec.js +0 -371
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/debug-session.spec.js +0 -751
- package/dist/services/onboarding/spec/control/fakes.d.ts +0 -31
- package/dist/services/onboarding/spec/control/fakes.js +0 -67
- package/dist/services/onboarding/spec/control/fouc.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/fouc.spec.js +0 -167
- package/dist/services/onboarding/spec/control/navigate-wait.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/navigate-wait.spec.js +0 -47
- package/dist/services/onboarding/spec/control/navwalk.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/navwalk.spec.js +0 -222
- package/dist/services/onboarding/spec/control/preload-registry.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/preload-registry.spec.js +0 -432
- package/dist/services/onboarding/spec/control/response-explainer.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/response-explainer.spec.js +0 -324
- package/dist/services/onboarding/spec/control/rum.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/rum.spec.js +0 -222
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.js +0 -193
- package/dist/services/onboarding/spec/control/viewport.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/viewport.spec.js +0 -200
- package/dist/services/onboarding/spec/control/watch.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/control/watch.spec.js +0 -187
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +0 -219
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.js +0 -41
- package/dist/services/onboarding/spec/request-cache/cache.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/request-cache/cache.spec.js +0 -107
- package/dist/services/onboarding/spec/todo-collector.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/todo-collector.spec.js +0 -136
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.d.ts +0 -1
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.js +0 -65
- package/dist/services/query-builder/rules/rule-match.d.ts +0 -35
- package/dist/services/query-builder/rules/rule-match.js +0 -70
- package/dist/services/query-builder/spec/rules/rule-match.spec.d.ts +0 -1
- package/dist/services/query-builder/spec/rules/rule-match.spec.js +0 -121
- package/dist/services/run-control/browser/run-browser-contexts.d.ts +0 -557
- package/dist/services/run-control/browser/run-browser-contexts.js +0 -91
- package/dist/services/run-control/browser/run-browser-service-factory.d.ts +0 -5
- package/dist/services/run-control/browser/run-browser-service-factory.js +0 -7
- package/dist/services/run-control/browser/run-browser-service.d.ts +0 -68
- package/dist/services/run-control/browser/run-browser-service.js +0 -206
- package/dist/services/run-control/cache/run-cache-contexts.d.ts +0 -349
- package/dist/services/run-control/cache/run-cache-contexts.js +0 -51
- package/dist/services/run-control/cache/run-cache-service-factory.d.ts +0 -6
- package/dist/services/run-control/cache/run-cache-service-factory.js +0 -12
- package/dist/services/run-control/cache/run-cache-service.d.ts +0 -35
- package/dist/services/run-control/cache/run-cache-service.js +0 -151
- package/dist/services/run-control/control-client.d.ts +0 -36
- package/dist/services/run-control/control-client.js +0 -147
- package/dist/services/run-control/debug/run-debug-contexts.d.ts +0 -416
- package/dist/services/run-control/debug/run-debug-contexts.js +0 -47
- package/dist/services/run-control/debug/run-debug-service-factory.d.ts +0 -5
- package/dist/services/run-control/debug/run-debug-service-factory.js +0 -7
- package/dist/services/run-control/debug/run-debug-service.d.ts +0 -39
- package/dist/services/run-control/debug/run-debug-service.js +0 -164
- package/dist/services/run-control/files/run-files-contexts.d.ts +0 -238
- package/dist/services/run-control/files/run-files-contexts.js +0 -26
- package/dist/services/run-control/files/run-files-service-factory.d.ts +0 -5
- package/dist/services/run-control/files/run-files-service-factory.js +0 -7
- package/dist/services/run-control/files/run-files-service.d.ts +0 -29
- package/dist/services/run-control/files/run-files-service.js +0 -120
- package/dist/services/run-control/index.d.ts +0 -32
- package/dist/services/run-control/index.js +0 -31
- package/dist/services/run-control/inject/run-inject-contexts.d.ts +0 -319
- package/dist/services/run-control/inject/run-inject-contexts.js +0 -38
- package/dist/services/run-control/inject/run-inject-service-factory.d.ts +0 -5
- package/dist/services/run-control/inject/run-inject-service-factory.js +0 -7
- package/dist/services/run-control/inject/run-inject-service.d.ts +0 -31
- package/dist/services/run-control/inject/run-inject-service.js +0 -227
- package/dist/services/run-control/live-run.d.ts +0 -37
- package/dist/services/run-control/live-run.js +0 -56
- package/dist/services/run-control/probe/run-probe-contexts.d.ts +0 -333
- package/dist/services/run-control/probe/run-probe-contexts.js +0 -73
- package/dist/services/run-control/probe/run-probe-service-factory.d.ts +0 -5
- package/dist/services/run-control/probe/run-probe-service-factory.js +0 -7
- package/dist/services/run-control/probe/run-probe-service.d.ts +0 -54
- package/dist/services/run-control/probe/run-probe-service.js +0 -194
- package/dist/services/run-control/rum/run-rum-contexts.d.ts +0 -216
- package/dist/services/run-control/rum/run-rum-contexts.js +0 -34
- package/dist/services/run-control/rum/run-rum-service-factory.d.ts +0 -5
- package/dist/services/run-control/rum/run-rum-service-factory.js +0 -7
- package/dist/services/run-control/rum/run-rum-service.d.ts +0 -36
- package/dist/services/run-control/rum/run-rum-service.js +0 -122
- package/dist/services/run-control/run-answer.d.ts +0 -28
- package/dist/services/run-control/run-answer.js +0 -58
- package/dist/services/run-control/run-control-context.d.ts +0 -102
- package/dist/services/run-control/run-control-context.js +0 -36
- package/dist/services/run-control/run-control-flags.d.ts +0 -12
- package/dist/services/run-control/run-control-flags.js +0 -22
- package/dist/services/run-control/run-control-model.d.ts +0 -9
- package/dist/services/run-control/run-control-model.js +0 -1
- package/dist/services/run-control/run-control-service-factory.d.ts +0 -14
- package/dist/services/run-control/run-control-service-factory.js +0 -26
- package/dist/services/run-control/session/run-session-contexts.d.ts +0 -25
- package/dist/services/run-control/session/run-session-contexts.js +0 -20
- package/dist/services/run-control/session/run-session-service-factory.d.ts +0 -8
- package/dist/services/run-control/session/run-session-service-factory.js +0 -18
- package/dist/services/run-control/session/run-session-service.d.ts +0 -32
- package/dist/services/run-control/session/run-session-service.js +0 -151
- package/dist/services/run-control/spec/browser/run-browser-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/browser/run-browser-service.spec.js +0 -328
- package/dist/services/run-control/spec/cache/run-cache-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/cache/run-cache-service.spec.js +0 -454
- package/dist/services/run-control/spec/debug/run-debug-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/debug/run-debug-service.spec.js +0 -113
- package/dist/services/run-control/spec/files/run-files-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/files/run-files-service.spec.js +0 -234
- package/dist/services/run-control/spec/inject/run-inject-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/inject/run-inject-service.spec.js +0 -251
- package/dist/services/run-control/spec/live-run-fixture.d.ts +0 -32
- package/dist/services/run-control/spec/live-run-fixture.js +0 -109
- package/dist/services/run-control/spec/probe/run-probe-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/probe/run-probe-service.spec.js +0 -108
- package/dist/services/run-control/spec/rum/run-rum-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/rum/run-rum-service.spec.js +0 -47
- package/dist/services/run-control/spec/run-answer.spec.d.ts +0 -1
- package/dist/services/run-control/spec/run-answer.spec.js +0 -57
- package/dist/services/run-control/spec/session/run-session-service.spec.d.ts +0 -1
- package/dist/services/run-control/spec/session/run-session-service.spec.js +0 -150
- package/dist/services/run-log/crash-mirror.d.ts +0 -31
- package/dist/services/run-log/crash-mirror.js +0 -69
- package/dist/services/run-log/index.d.ts +0 -11
- package/dist/services/run-log/index.js +0 -11
- package/dist/services/run-log/jsonl-appender.d.ts +0 -46
- package/dist/services/run-log/jsonl-appender.js +0 -91
- package/dist/services/run-log/log-event-model.d.ts +0 -104
- package/dist/services/run-log/log-event-model.js +0 -56
- package/dist/services/run-log/log-query-service-factory.d.ts +0 -11
- package/dist/services/run-log/log-query-service-factory.js +0 -14
- package/dist/services/run-log/log-query-service.d.ts +0 -59
- package/dist/services/run-log/log-query-service.js +0 -111
- package/dist/services/run-log/log-reader.d.ts +0 -84
- package/dist/services/run-log/log-reader.js +0 -180
- package/dist/services/run-log/log-summary.d.ts +0 -72
- package/dist/services/run-log/log-summary.js +0 -208
- package/dist/services/run-log/redaction.d.ts +0 -34
- package/dist/services/run-log/redaction.js +0 -124
- package/dist/services/run-log/request-log.d.ts +0 -82
- package/dist/services/run-log/request-log.js +0 -69
- package/dist/services/run-log/request-summary.d.ts +0 -76
- package/dist/services/run-log/request-summary.js +0 -0
- package/dist/services/run-log/run-log.d.ts +0 -61
- package/dist/services/run-log/run-log.js +0 -102
- package/dist/services/run-log/spec/log-query-service.spec.d.ts +0 -1
- package/dist/services/run-log/spec/log-query-service.spec.js +0 -197
- package/dist/services/run-log/spec/log-reader.spec.d.ts +0 -1
- package/dist/services/run-log/spec/log-reader.spec.js +0 -109
- package/dist/services/run-log/spec/log-summary.spec.d.ts +0 -1
- package/dist/services/run-log/spec/log-summary.spec.js +0 -153
- package/dist/services/run-log/spec/redaction.spec.d.ts +0 -1
- package/dist/services/run-log/spec/redaction.spec.js +0 -61
- package/dist/services/run-log/spec/request-log.spec.d.ts +0 -1
- package/dist/services/run-log/spec/request-log.spec.js +0 -101
- package/dist/services/run-log/spec/request-summary.spec.d.ts +0 -1
- package/dist/services/run-log/spec/request-summary.spec.js +0 -171
- package/dist/services/run-log/spec/run-log.spec.d.ts +0 -1
- package/dist/services/run-log/spec/run-log.spec.js +0 -122
- package/dist/services/run-registry/exit-classification.d.ts +0 -39
- package/dist/services/run-registry/exit-classification.js +0 -42
- package/dist/services/run-registry/index.d.ts +0 -3
- package/dist/services/run-registry/index.js +0 -3
- package/dist/services/run-registry/process-identity.d.ts +0 -28
- package/dist/services/run-registry/process-identity.js +0 -80
- package/dist/services/run-registry/run-registry-model.d.ts +0 -128
- package/dist/services/run-registry/run-registry-model.js +0 -16
- package/dist/services/run-registry/run-registry.d.ts +0 -155
- package/dist/services/run-registry/run-registry.js +0 -430
- package/dist/services/run-registry/spec/exit-classification.spec.d.ts +0 -1
- package/dist/services/run-registry/spec/exit-classification.spec.js +0 -82
- package/dist/services/run-registry/spec/run-registry.spec.d.ts +0 -1
- package/dist/services/run-registry/spec/run-registry.spec.js +0 -526
- /package/dist/{commands/spec/onboarding.spec.d.ts → services/bundler/spec/packjockel-service.spec.d.ts} +0 -0
- /package/dist/services/{cli/spec/build-identity.spec.d.ts → deploy/spec/handler/customer-config-handler.spec.d.ts} +0 -0
- /package/dist/services/{cli/spec/build-info.spec.d.ts → document-handler-runtime/spec/document-handler-browser-mock.spec.d.ts} +0 -0
- /package/dist/services/{cli/spec/cli-service-log.spec.d.ts → integration-api/spec/customer-config-file.spec.d.ts} +0 -0
- /package/dist/services/{diff/spec/config-at-ref.spec.d.ts → onboarding/spec/file-events/file-watcher.spec.d.ts} +0 -0
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { beforeEach, describe, it } from "mocha";
|
|
3
|
-
import { EventEmitter } from "node:events";
|
|
4
|
-
import { MemoryRequestLog } from "../../run-log/index.js";
|
|
5
|
-
import { AbortResponse } from "../browser/abort-response.js";
|
|
6
|
-
import { FetchEventHandler } from "../fetch-event-handler.js";
|
|
7
|
-
import { BROWSER_EVENTS } from "../onboarding-model.js";
|
|
8
|
-
/** A CDP session that records what it was told to do and answers immediately. */
|
|
9
|
-
class StubSession extends EventEmitter {
|
|
10
|
-
sent = [];
|
|
11
|
-
async send(method, params) {
|
|
12
|
-
this.sent.push({ method, params });
|
|
13
|
-
return {};
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
/** A handler that claims one url pattern and answers it however the spec says. */
|
|
17
|
-
class TestHandler {
|
|
18
|
-
answer;
|
|
19
|
-
patterns = [{ urlPattern: ".*", requestStage: "Request" }];
|
|
20
|
-
constructor(answer) {
|
|
21
|
-
this.answer = answer;
|
|
22
|
-
}
|
|
23
|
-
async handle() {
|
|
24
|
-
return this.answer;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/** Named so a record's `handler` field has something recognisable in it. */
|
|
28
|
-
class SlowHandler extends TestHandler {
|
|
29
|
-
}
|
|
30
|
-
const cli = {
|
|
31
|
-
writeError: () => undefined,
|
|
32
|
-
writeWarning: () => undefined,
|
|
33
|
-
writeSuccess: () => undefined,
|
|
34
|
-
startAction: () => undefined,
|
|
35
|
-
successAction: () => undefined,
|
|
36
|
-
failAction: () => undefined,
|
|
37
|
-
};
|
|
38
|
-
const customerConfig = {
|
|
39
|
-
origins: [],
|
|
40
|
-
app: "spec",
|
|
41
|
-
};
|
|
42
|
-
function pausedEvent(patch = {}) {
|
|
43
|
-
return {
|
|
44
|
-
requestId: "1",
|
|
45
|
-
request: { url: "https://x.test/page", method: "GET" },
|
|
46
|
-
resourceType: "Document",
|
|
47
|
-
...patch,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
/** Drive one paused request through the handler and return what was recorded. */
|
|
51
|
-
async function intercept(handlers, event = pausedEvent()) {
|
|
52
|
-
const requestLog = new MemoryRequestLog();
|
|
53
|
-
const session = new StubSession();
|
|
54
|
-
const target = {
|
|
55
|
-
createCDPSession: async () => session,
|
|
56
|
-
url: () => "https://x.test/",
|
|
57
|
-
};
|
|
58
|
-
const fetchEventHandler = new FetchEventHandler({
|
|
59
|
-
browserFetchEvents: handlers,
|
|
60
|
-
customerConfig,
|
|
61
|
-
cli,
|
|
62
|
-
requestLog,
|
|
63
|
-
});
|
|
64
|
-
await fetchEventHandler.handleRequestFetchEvents(target);
|
|
65
|
-
session.emit(BROWSER_EVENTS.FETCH_REQUEST_PAUSED, event);
|
|
66
|
-
// The listener is async and the emit does not await it.
|
|
67
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
68
|
-
return { requestLog, session };
|
|
69
|
-
}
|
|
70
|
-
/** Drive one auth challenge through the handler and return what CDP was told. */
|
|
71
|
-
async function challenge(authentications) {
|
|
72
|
-
const session = new StubSession();
|
|
73
|
-
const target = {
|
|
74
|
-
createCDPSession: async () => session,
|
|
75
|
-
url: () => "https://x.test/",
|
|
76
|
-
};
|
|
77
|
-
const client = {
|
|
78
|
-
getServerConfig: async () => JSON.stringify({ speedKit: { authentications } }),
|
|
79
|
-
};
|
|
80
|
-
const fetchEventHandler = new FetchEventHandler({
|
|
81
|
-
browserFetchEvents: [],
|
|
82
|
-
customerConfig: {
|
|
83
|
-
origins: ["https://x.test"],
|
|
84
|
-
app: "spec",
|
|
85
|
-
},
|
|
86
|
-
cli,
|
|
87
|
-
client: client,
|
|
88
|
-
requestLog: new MemoryRequestLog(),
|
|
89
|
-
});
|
|
90
|
-
await fetchEventHandler.handleRequestFetchEvents(target);
|
|
91
|
-
session.emit(BROWSER_EVENTS.FETCH_AUTH_REQUIRED, {
|
|
92
|
-
requestId: "1",
|
|
93
|
-
request: { url: "https://x.test/page" },
|
|
94
|
-
authChallenge: { scheme: "basic", origin: "https://x.test" },
|
|
95
|
-
});
|
|
96
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
97
|
-
return session.sent.filter((call) => call.method === "Fetch.continueWithAuth");
|
|
98
|
-
}
|
|
99
|
-
describe("FetchEventHandler auth challenges", () => {
|
|
100
|
-
it("should answer a challenge exactly once when credentials are found", async () => {
|
|
101
|
-
// It used to send the credentials and then send `Default` for the same
|
|
102
|
-
// requestId. A challenge can only be answered once, so the second call
|
|
103
|
-
// always threw `Invalid state for continueInterceptedRequest` — logged at
|
|
104
|
-
// `error` level, one millisecond after the success line, and heading the
|
|
105
|
-
// run's problems list as though authentication had failed. It had not: the
|
|
106
|
-
// credentials went first.
|
|
107
|
-
const calls = await challenge([
|
|
108
|
-
{
|
|
109
|
-
uri: "https://x.test",
|
|
110
|
-
type: "basic",
|
|
111
|
-
user: "spec",
|
|
112
|
-
password: "spec-secret",
|
|
113
|
-
},
|
|
114
|
-
]);
|
|
115
|
-
expect(calls).to.have.lengthOf(1);
|
|
116
|
-
expect(calls[0].params.authChallengeResponse.response).to.equal("ProvideCredentials");
|
|
117
|
-
});
|
|
118
|
-
it("should fall back to the default behaviour when no credential matches", async () => {
|
|
119
|
-
// The other origin's credential must not be offered here, and the
|
|
120
|
-
// challenge still has to be answered, or the request hangs.
|
|
121
|
-
const calls = await challenge([
|
|
122
|
-
{ uri: "https://other.test", type: "basic", user: "u", password: "p" },
|
|
123
|
-
]);
|
|
124
|
-
expect(calls).to.have.lengthOf(1);
|
|
125
|
-
expect(calls[0].params.authChallengeResponse.response).to.equal("Default");
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
describe("FetchEventHandler request records", () => {
|
|
129
|
-
let handled;
|
|
130
|
-
describe("a request no handler claims", () => {
|
|
131
|
-
beforeEach(async () => {
|
|
132
|
-
handled = await intercept([]);
|
|
133
|
-
});
|
|
134
|
-
it("is recorded as continued", async () => {
|
|
135
|
-
// The one outcome with no other trace anywhere: "what did the CLI hand
|
|
136
|
-
// straight back to Chrome" is exactly what a disabledScopes or blacklist
|
|
137
|
-
// change moves, and nothing else in the run writes it down.
|
|
138
|
-
expect(handled.requestLog.records).to.have.length(1);
|
|
139
|
-
expect(handled.requestLog.records[0]).to.include({
|
|
140
|
-
outcome: "continued",
|
|
141
|
-
url: "https://x.test/page",
|
|
142
|
-
method: "GET",
|
|
143
|
-
resourceType: "Document",
|
|
144
|
-
stage: "Request",
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
it("still reaches Chrome untouched", async () => {
|
|
148
|
-
expect(handled.session.sent.map((call) => call.method)).to.contain("Fetch.continueRequest");
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
it("records the handler that answered, and the status", async () => {
|
|
152
|
-
const { requestLog } = await intercept([
|
|
153
|
-
new SlowHandler({ responseCode: 203, body: "" }),
|
|
154
|
-
]);
|
|
155
|
-
expect(requestLog.records[0]).to.include({
|
|
156
|
-
outcome: "fulfilled",
|
|
157
|
-
handler: "SlowHandler",
|
|
158
|
-
status: 203,
|
|
159
|
-
});
|
|
160
|
-
expect(requestLog.records[0].durationMs).to.be.a("number");
|
|
161
|
-
});
|
|
162
|
-
it("records a deliberate abort as failed, not as an error", async () => {
|
|
163
|
-
// An abort is a rule doing its job. Recording it as an error would put a
|
|
164
|
-
// working config at the top of the summary's problem list.
|
|
165
|
-
const { requestLog } = await intercept([
|
|
166
|
-
new TestHandler(new AbortResponse("Aborted")),
|
|
167
|
-
]);
|
|
168
|
-
expect(requestLog.records[0].outcome).to.equal("failed");
|
|
169
|
-
});
|
|
170
|
-
it("records a handler that threw, with the reason", async () => {
|
|
171
|
-
const thrower = {
|
|
172
|
-
patterns: [{ urlPattern: ".*", requestStage: "Request" }],
|
|
173
|
-
handle: async () => {
|
|
174
|
-
throw new Error("handler blew up");
|
|
175
|
-
},
|
|
176
|
-
};
|
|
177
|
-
const { requestLog } = await intercept([thrower]);
|
|
178
|
-
expect(requestLog.records[0]).to.include({ outcome: "error" });
|
|
179
|
-
expect(requestLog.records[0].error).to.contain("handler blew up");
|
|
180
|
-
});
|
|
181
|
-
it("records a request the page dropped as cancelled, not as an error", async () => {
|
|
182
|
-
// A navigation away while a handler works leaves Chrome's interception id
|
|
183
|
-
// stale. As an error it headed the problems list and read as a proxy fault.
|
|
184
|
-
const stale = {
|
|
185
|
-
patterns: [{ urlPattern: ".*", requestStage: "Request" }],
|
|
186
|
-
handle: async () => {
|
|
187
|
-
throw new Error("Protocol error (Fetch.continueRequest): Invalid InterceptionId.");
|
|
188
|
-
},
|
|
189
|
-
};
|
|
190
|
-
const errors = [];
|
|
191
|
-
cli.writeError = (text) => void errors.push(text);
|
|
192
|
-
const { requestLog, session } = await intercept([stale]);
|
|
193
|
-
cli.writeError = () => undefined;
|
|
194
|
-
expect(requestLog.records[0].outcome).to.equal("cancelled");
|
|
195
|
-
expect(errors).to.deep.equal([]);
|
|
196
|
-
expect(session.sent.map(({ method }) => method)).to.not.include("Fetch.failRequest");
|
|
197
|
-
});
|
|
198
|
-
it("distinguishes the response stage from the request stage", async () => {
|
|
199
|
-
const { requestLog } = await intercept([], pausedEvent({ responseHeaders: [{ name: "x", value: "y" }] }));
|
|
200
|
-
expect(requestLog.records[0].stage).to.equal("Response");
|
|
201
|
-
});
|
|
202
|
-
it("works without a request log at all", async () => {
|
|
203
|
-
// A run started with --no-log-file, and the test harness.
|
|
204
|
-
const session = new StubSession();
|
|
205
|
-
const target = {
|
|
206
|
-
createCDPSession: async () => session,
|
|
207
|
-
url: () => "https://x.test/",
|
|
208
|
-
};
|
|
209
|
-
const handler = new FetchEventHandler({
|
|
210
|
-
browserFetchEvents: [],
|
|
211
|
-
customerConfig,
|
|
212
|
-
cli,
|
|
213
|
-
});
|
|
214
|
-
await handler.handleRequestFetchEvents(target);
|
|
215
|
-
session.emit(BROWSER_EVENTS.FETCH_REQUEST_PAUSED, pausedEvent());
|
|
216
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
217
|
-
expect(session.sent.map((call) => call.method)).to.contain("Fetch.continueRequest");
|
|
218
|
-
});
|
|
219
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { describe, it } from "mocha";
|
|
3
|
-
import { createContext, runInContext } from "node:vm";
|
|
4
|
-
import { SpeedKitServiceWorkerJs, userAgentPrelude, } from "../../fetch-events/speed-kit-service-worker-js.js";
|
|
5
|
-
const MOBILE = "Mozilla/5.0 (Linux; Android 10; K) Mobile Safari/537.36";
|
|
6
|
-
/** A worker global whose navigator has the user agent on its prototype, as Chrome's does. */
|
|
7
|
-
function worker() {
|
|
8
|
-
const prototype = {};
|
|
9
|
-
Object.defineProperty(prototype, "userAgent", {
|
|
10
|
-
get: () => "Mozilla/5.0 (X11; Linux x86_64) Chrome/146",
|
|
11
|
-
configurable: true,
|
|
12
|
-
});
|
|
13
|
-
const navigator = Object.create(prototype);
|
|
14
|
-
const context = createContext({ self: { navigator }, navigator });
|
|
15
|
-
return { navigator, run: (source) => runInContext(source, context) };
|
|
16
|
-
}
|
|
17
|
-
describe("SpeedKitServiceWorkerJs under emulation", () => {
|
|
18
|
-
const handler = () => new SpeedKitServiceWorkerJs({ appDomain: "myapp.app.baqend.com" }, {
|
|
19
|
-
getContent: () => "/* speed kit */ self.ua = navigator.userAgent;",
|
|
20
|
-
});
|
|
21
|
-
const body = async (sw) => {
|
|
22
|
-
const response = await sw.handle();
|
|
23
|
-
return Buffer.from(String(response.body), "base64").toString("utf8");
|
|
24
|
-
};
|
|
25
|
-
it("should make the worker report the emulated user agent", () => {
|
|
26
|
-
// Speed Kit decides the device in its worker, from navigator.userAgent
|
|
27
|
-
// when no header says otherwise. A CDP override did not reach it.
|
|
28
|
-
const { navigator, run } = worker();
|
|
29
|
-
run(userAgentPrelude(MOBILE));
|
|
30
|
-
expect(navigator.userAgent).to.equal(MOBILE);
|
|
31
|
-
});
|
|
32
|
-
it("should prepend the override only while an emulation is active", async () => {
|
|
33
|
-
const sw = handler();
|
|
34
|
-
expect(await body(sw)).to.not.contain("sk onboarding browser emulate");
|
|
35
|
-
sw.userAgent = MOBILE;
|
|
36
|
-
const emulated = await body(sw);
|
|
37
|
-
// First, so it runs before any of Speed Kit's code reads the user agent.
|
|
38
|
-
expect(emulated.indexOf("sk onboarding browser emulate")).to.equal(3);
|
|
39
|
-
expect(emulated).to.contain("/* speed kit */");
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
3
|
-
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, } from "node:fs";
|
|
4
|
-
import { tmpdir } from "node:os";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
import { BaqendResponse } from "../../browser/baqend-response.js";
|
|
7
|
-
import { Cache } from "../../request-cache/cache.js";
|
|
8
|
-
import { memoryCli } from "../../../cli/spec/memory-cli.js";
|
|
9
|
-
const KEY = "https://myapp.app.baqend.com/v1/asset/https://shop.example.com/p?bqvariation=mobile";
|
|
10
|
-
const PAGE = "<html><body>hello</body></html>";
|
|
11
|
-
describe("Cache", () => {
|
|
12
|
-
let directory;
|
|
13
|
-
let cache;
|
|
14
|
-
const add = (key, body, status) => cache.addEntry(key, new BaqendResponse(body, "text/html; charset=utf-8", [], status), body);
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
directory = mkdtempSync(join(tmpdir(), "sk-cache-"));
|
|
17
|
-
cache = new Cache(memoryCli(), directory);
|
|
18
|
-
});
|
|
19
|
-
afterEach(() => {
|
|
20
|
-
rmSync(directory, { recursive: true, force: true });
|
|
21
|
-
});
|
|
22
|
-
it("should store the body decoded, so the file is simply readable", () => {
|
|
23
|
-
add(KEY, PAGE);
|
|
24
|
-
const [[, entry]] = [...cache.getAll()];
|
|
25
|
-
// Only Chrome's fulfillRequest needs base64; nothing else should pay for it.
|
|
26
|
-
expect(readFileSync(entry.path, "utf8")).to.equal(PAGE);
|
|
27
|
-
expect(entry.bytes).to.equal(PAGE.length);
|
|
28
|
-
});
|
|
29
|
-
it("should hand back a response Chrome can fulfil", () => {
|
|
30
|
-
add(KEY, PAGE);
|
|
31
|
-
const response = cache.getEntry(KEY);
|
|
32
|
-
expect(Buffer.from(response.body, "base64").toString("utf8")).to.equal(PAGE);
|
|
33
|
-
expect(response.responseCode).to.equal(200);
|
|
34
|
-
expect(response.contentLength).to.equal(PAGE.length);
|
|
35
|
-
});
|
|
36
|
-
it("should not accumulate headers, nor let a hit write back to the store", () => {
|
|
37
|
-
add(KEY, PAGE);
|
|
38
|
-
const first = cache.getEntry(KEY);
|
|
39
|
-
first.setHeader("x-cache", "POP, HIT");
|
|
40
|
-
const second = cache.getEntry(KEY);
|
|
41
|
-
// Rebuilding through the constructor would re-append `via` and friends on
|
|
42
|
-
// every hit, compounding for the life of the run.
|
|
43
|
-
expect(second.responseHeaders.filter((header) => header.name === "via")).to.have.lengthOf(1);
|
|
44
|
-
// And what one hit set must not leak into the next: the stored headers are
|
|
45
|
-
// copied out, not handed out.
|
|
46
|
-
expect(second.responseHeaders.find((header) => header.name === "x-cache")).to.equal(undefined);
|
|
47
|
-
});
|
|
48
|
-
it("should key a page apart from Speed Kit's bookkeeping on the request", () => {
|
|
49
|
-
// The page asks with its config and Speed Kit versions and a
|
|
50
|
-
// page-impression counter; `cache prewarm` builds the bare url. Keyed raw,
|
|
51
|
-
// the prewarmed entry was never the one the page read, and the page's own
|
|
52
|
-
// second request missed its first because the counter moved.
|
|
53
|
-
add(KEY, PAGE);
|
|
54
|
-
const fromPage = `${KEY}&bqcv=7f2b0065&bqsk=2.22.5&bqpi=1;sp=1&bqcache=if-cached`;
|
|
55
|
-
expect(cache.has(fromPage)).to.equal(true);
|
|
56
|
-
expect(cache.getEntry(fromPage)?.responseCode).to.equal(200);
|
|
57
|
-
expect([...cache.getAll()].map(([key]) => key)).to.deep.equal([KEY]);
|
|
58
|
-
});
|
|
59
|
-
it("should keep the variation and the page's own parameters in the key", () => {
|
|
60
|
-
add(KEY, PAGE);
|
|
61
|
-
expect(cache.has(KEY.replace("mobile", "tablet"))).to.equal(false);
|
|
62
|
-
expect(cache.has(`${KEY}&colour=red`)).to.equal(false);
|
|
63
|
-
});
|
|
64
|
-
it("should keep no body in memory", () => {
|
|
65
|
-
add(KEY, PAGE);
|
|
66
|
-
const [[, entry]] = [...cache.getAll()];
|
|
67
|
-
// The metadata is the whole in-memory footprint: the point of the change.
|
|
68
|
-
expect(Object.values(entry).join("")).to.not.contain("hello");
|
|
69
|
-
});
|
|
70
|
-
it("should treat a body that vanished as a miss, not a crash", () => {
|
|
71
|
-
add(KEY, PAGE);
|
|
72
|
-
const [[, entry]] = [...cache.getAll()];
|
|
73
|
-
rmSync(entry.path);
|
|
74
|
-
expect(cache.getEntry(KEY)).to.equal(null);
|
|
75
|
-
expect([...cache.getAll()]).to.have.lengthOf(0);
|
|
76
|
-
});
|
|
77
|
-
it("should give each key its own file, so evicting one keeps the other", () => {
|
|
78
|
-
// Content-addressing would share a file between these two and pull the body
|
|
79
|
-
// out from under the survivor.
|
|
80
|
-
add(`${KEY}&a=1`, PAGE);
|
|
81
|
-
add(`${KEY}&a=2`, PAGE);
|
|
82
|
-
cache.removeEntry("a=1");
|
|
83
|
-
expect([...cache.getAll()]).to.have.lengthOf(1);
|
|
84
|
-
expect(cache.getEntry(`${KEY}&a=2`)).to.not.equal(null);
|
|
85
|
-
});
|
|
86
|
-
it("should remove the files it wrote when cleared", () => {
|
|
87
|
-
add(`${KEY}&a=1`, PAGE);
|
|
88
|
-
add(`${KEY}&a=2`, PAGE);
|
|
89
|
-
cache.clear();
|
|
90
|
-
expect([...cache.getAll()]).to.have.lengthOf(0);
|
|
91
|
-
expect(readdirSync(directory)).to.deep.equal([]);
|
|
92
|
-
});
|
|
93
|
-
it("should overwrite an entry in place when it is cached again", () => {
|
|
94
|
-
add(KEY, PAGE);
|
|
95
|
-
const [[, first]] = [...cache.getAll()];
|
|
96
|
-
add(KEY, "<html>fresher</html>");
|
|
97
|
-
const [[, second]] = [...cache.getAll()];
|
|
98
|
-
expect(second.path).to.equal(first.path);
|
|
99
|
-
expect(second.sha).to.not.equal(first.sha);
|
|
100
|
-
expect(readdirSync(directory)).to.have.lengthOf(1);
|
|
101
|
-
});
|
|
102
|
-
it("should take the whole directory with it on destroy", () => {
|
|
103
|
-
add(KEY, PAGE);
|
|
104
|
-
cache.destroy();
|
|
105
|
-
expect(existsSync(directory)).to.equal(false);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { describe, it } from "mocha";
|
|
3
|
-
import { TodoCollector } from "../todo-collector.js";
|
|
4
|
-
import { FILE_TYPE } from "../../integration-api/index.js";
|
|
5
|
-
function resource(path, content, type = FILE_TYPE.CONFIG_FILE) {
|
|
6
|
-
return {
|
|
7
|
-
path,
|
|
8
|
-
type,
|
|
9
|
-
getContent: () => content,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
describe("TodoCollector", () => {
|
|
13
|
-
it("should find every task in a file, not only the first", () => {
|
|
14
|
-
// The original matched with a non-global regex through `String.replace`,
|
|
15
|
-
// which calls its replacer once. A file with four open tasks reported one
|
|
16
|
-
// and the rest were invisible — to the devtools panel and to anything else.
|
|
17
|
-
const collector = new TodoCollector([
|
|
18
|
-
resource("/customers/x/production/config_SpeedKit.js", [
|
|
19
|
-
"const a = 1;",
|
|
20
|
-
"// TODO ask about the split test",
|
|
21
|
-
"one",
|
|
22
|
-
"two",
|
|
23
|
-
"three",
|
|
24
|
-
"const b = 2;",
|
|
25
|
-
"// TODO confirm the asset list",
|
|
26
|
-
"four",
|
|
27
|
-
"five",
|
|
28
|
-
"six",
|
|
29
|
-
].join("\n")),
|
|
30
|
-
]);
|
|
31
|
-
const tasks = collector.getOpenTasks();
|
|
32
|
-
expect(tasks.map((task) => task.todo.trim())).to.deep.equal([
|
|
33
|
-
"TODO ask about the split test",
|
|
34
|
-
"TODO confirm the asset list",
|
|
35
|
-
]);
|
|
36
|
-
});
|
|
37
|
-
it("should give each task its own line, even when two read the same", () => {
|
|
38
|
-
// The line came from `indexOf(todoText)`, so a repeated task all pointed at
|
|
39
|
-
// the first occurrence — and the point of the line is to open the file at it.
|
|
40
|
-
const collector = new TodoCollector([
|
|
41
|
-
resource("/customers/x/production/config_documentHandler.js", [
|
|
42
|
-
"// TODO check this",
|
|
43
|
-
"a",
|
|
44
|
-
"b",
|
|
45
|
-
"c",
|
|
46
|
-
"// TODO check this",
|
|
47
|
-
"d",
|
|
48
|
-
"e",
|
|
49
|
-
"f",
|
|
50
|
-
].join("\n")),
|
|
51
|
-
]);
|
|
52
|
-
const [first, second] = collector.getOpenTasks();
|
|
53
|
-
expect(first.line).to.not.equal(second.line);
|
|
54
|
-
expect(second.line).to.be.greaterThan(first.line);
|
|
55
|
-
});
|
|
56
|
-
it("should not start one file where the last one stopped", () => {
|
|
57
|
-
// A shared global regex carries `lastIndex` between calls, so the second
|
|
58
|
-
// file would begin matching from an offset that means nothing in it.
|
|
59
|
-
const body = ["// TODO one", "a", "b", "c"].join("\n");
|
|
60
|
-
const collector = new TodoCollector([
|
|
61
|
-
resource("/customers/x/production/first.js", `${body}\n${body}`),
|
|
62
|
-
resource("/customers/x/production/second.js", body),
|
|
63
|
-
]);
|
|
64
|
-
const files = collector.getOpenTasks().map((task) => task.file);
|
|
65
|
-
expect(files.filter((file) => file.endsWith("second.js"))).to.have.lengthOf(1);
|
|
66
|
-
});
|
|
67
|
-
it("should carry the file and the three lines under the task", () => {
|
|
68
|
-
const collector = new TodoCollector([
|
|
69
|
-
resource("/customers/x/production/config_SpeedKit.js", ["// TODO ask", "context one", "context two", "context three"].join("\n")),
|
|
70
|
-
]);
|
|
71
|
-
const [task] = collector.getOpenTasks();
|
|
72
|
-
expect(task.file).to.equal("/customers/x/production/config_SpeedKit.js");
|
|
73
|
-
expect(decodeURI(task.context)).to.contain("context one");
|
|
74
|
-
expect(decodeURI(task.context)).to.contain("context three");
|
|
75
|
-
});
|
|
76
|
-
it("should skip virtual files, which nobody can open in an editor", () => {
|
|
77
|
-
const collector = new TodoCollector([
|
|
78
|
-
resource("bundle_install", ["// TODO generated", "a", "b", "c"].join("\n"), FILE_TYPE.VIRTUAL_FILE),
|
|
79
|
-
]);
|
|
80
|
-
expect(collector.getOpenTasks()).to.deep.equal([]);
|
|
81
|
-
});
|
|
82
|
-
it("should find a task written inside the previous one's context", () => {
|
|
83
|
-
// The context used to be consumed, not looked ahead at, so `lastIndex`
|
|
84
|
-
// moved past the three lines under a TODO and a second one written inside
|
|
85
|
-
// that window was swallowed into the first one's `context` string. Two
|
|
86
|
-
// notes in a row is the ordinary way people write them.
|
|
87
|
-
const collector = new TodoCollector([
|
|
88
|
-
resource("/customers/x/production/config_SpeedKit.js", [
|
|
89
|
-
"// TODO confirm this scope with the customer",
|
|
90
|
-
"// TODO check the split test id",
|
|
91
|
-
"const a = 1;",
|
|
92
|
-
].join("\n")),
|
|
93
|
-
]);
|
|
94
|
-
expect(collector.getOpenTasks().map((task) => task.todo.trim())).to.deep.equal([
|
|
95
|
-
"TODO confirm this scope with the customer",
|
|
96
|
-
"TODO check the split test id",
|
|
97
|
-
]);
|
|
98
|
-
});
|
|
99
|
-
it("should not lose a task because it or the lines under it contain parentheses", () => {
|
|
100
|
-
// The text and all three context lines were `[^\n\r()|]*`, so a `(`, `)`
|
|
101
|
-
// or `|` anywhere in them failed the whole match and the task vanished —
|
|
102
|
-
// and a JS config is full of them. Both of these were invisible.
|
|
103
|
-
const collector = new TodoCollector([
|
|
104
|
-
resource("/customers/x/production/config_SpeedKit.js", [
|
|
105
|
-
"// TODO check the split test id (ask the customer) first",
|
|
106
|
-
"a",
|
|
107
|
-
"b",
|
|
108
|
-
"c",
|
|
109
|
-
"// TODO confirm the wishlist pattern",
|
|
110
|
-
"/wish(-)?list/i,",
|
|
111
|
-
"d",
|
|
112
|
-
"e",
|
|
113
|
-
].join("\n")),
|
|
114
|
-
]);
|
|
115
|
-
expect(collector.getOpenTasks().map((task) => task.todo.trim())).to.deep.equal([
|
|
116
|
-
"TODO check the split test id (ask the customer) first",
|
|
117
|
-
"TODO confirm the wishlist pattern",
|
|
118
|
-
]);
|
|
119
|
-
});
|
|
120
|
-
it("should report a task in the last lines of a file", () => {
|
|
121
|
-
// `{3}` required three lines beneath the TODO, so one written at the end
|
|
122
|
-
// of a file matched nothing at all.
|
|
123
|
-
const collector = new TodoCollector([
|
|
124
|
-
resource("/customers/x/production/config_SpeedKit.js", ["const a = 1;", "// TODO the last word"].join("\n")),
|
|
125
|
-
]);
|
|
126
|
-
const [task] = collector.getOpenTasks();
|
|
127
|
-
expect(task.todo.trim()).to.equal("TODO the last word");
|
|
128
|
-
expect(task.line).to.equal(2);
|
|
129
|
-
});
|
|
130
|
-
it("should answer an empty list when nothing is open", () => {
|
|
131
|
-
const collector = new TodoCollector([
|
|
132
|
-
resource("/customers/x/production/clean.js", "const a = 1;\n"),
|
|
133
|
-
]);
|
|
134
|
-
expect(collector.getOpenTasks()).to.deep.equal([]);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { describe, it } from "mocha";
|
|
3
|
-
import { mkdtempSync, rmSync } from "node:fs";
|
|
4
|
-
import { tmpdir } from "node:os";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
import { memoryCli } from "../../../cli/spec/memory-cli.js";
|
|
7
|
-
import { MemorySink } from "../../../cli/sink.js";
|
|
8
|
-
import { Cache } from "../../request-cache/cache.js";
|
|
9
|
-
import { assetRequestUrl } from "../../request-cache/asset-key.js";
|
|
10
|
-
import { VirtualOrestesApp } from "../../virtual-orestes-app/index.js";
|
|
11
|
-
const APP_DOMAIN = "shop.app.baqend.com";
|
|
12
|
-
const PAGE = "https://shop.example.com/cart";
|
|
13
|
-
/** A local app whose origin fetcher names `variations` and must not be asked to fetch. */
|
|
14
|
-
function app(sink, variations = []) {
|
|
15
|
-
const directory = mkdtempSync(join(tmpdir(), "sk-orestes-"));
|
|
16
|
-
let fetched = false;
|
|
17
|
-
const originFetcher = {
|
|
18
|
-
namedVariations: () => variations,
|
|
19
|
-
fetch: async () => {
|
|
20
|
-
fetched = true;
|
|
21
|
-
return undefined;
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
const orestes = new VirtualOrestesApp({ appDomain: APP_DOMAIN }, originFetcher, {}, new Cache(memoryCli(), join(directory, "dh-cache")), memoryCli(sink), {});
|
|
25
|
-
return {
|
|
26
|
-
orestes,
|
|
27
|
-
fetched: () => fetched,
|
|
28
|
-
remove: () => rmSync(directory, { recursive: true, force: true }),
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
const request = (variation) => ({
|
|
32
|
-
request: { url: assetRequestUrl(APP_DOMAIN, PAGE, variation) },
|
|
33
|
-
});
|
|
34
|
-
describe("VirtualOrestesApp — the break variation", () => {
|
|
35
|
-
it("should answer a break page as Orestes does, so the worker serves it from origin", async () => {
|
|
36
|
-
const sink = new MemorySink();
|
|
37
|
-
const { orestes, fetched, remove } = app(sink);
|
|
38
|
-
try {
|
|
39
|
-
const response = (await orestes.fetchAssetResponse(request("break")));
|
|
40
|
-
await orestes.fetchAssetResponse(request("break"));
|
|
41
|
-
expect(response.responseCode).to.equal(400);
|
|
42
|
-
expect(response.responseHeaders).to.deep.include({
|
|
43
|
-
name: "server-timing",
|
|
44
|
-
value: "errorcode;desc=322",
|
|
45
|
-
});
|
|
46
|
-
expect(fetched()).to.equal(false);
|
|
47
|
-
const reported = sink.lines.filter((line) => line.includes("break"));
|
|
48
|
-
expect(reported).to.have.length(1);
|
|
49
|
-
expect(reported[0]).to.contain("served from origin");
|
|
50
|
-
}
|
|
51
|
-
finally {
|
|
52
|
-
remove();
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
it("should build a break page like any other when the runtime config defines break", async () => {
|
|
56
|
-
const { orestes, fetched, remove } = app(new MemorySink(), ["break"]);
|
|
57
|
-
try {
|
|
58
|
-
await orestes.fetchAssetResponse(request("break"));
|
|
59
|
-
expect(fetched()).to.equal(true);
|
|
60
|
-
}
|
|
61
|
-
finally {
|
|
62
|
-
remove();
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { NormalizedRule } from "./rule-model.js";
|
|
2
|
-
export interface RuleMatch {
|
|
3
|
-
readonly matched: boolean;
|
|
4
|
-
/**
|
|
5
|
-
* True when the rule carries a criterion this cannot evaluate — a cookie, a
|
|
6
|
-
* device, a storage value. The URL half may match while the whole rule does
|
|
7
|
-
* not, so `matched` is a maximum rather than an answer.
|
|
8
|
-
*/
|
|
9
|
-
readonly uncertain: boolean;
|
|
10
|
-
readonly source: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Does this rule match this URL, the way the runtime would?
|
|
14
|
-
*
|
|
15
|
-
* The query builder translates rules into SQL. This evaluates one against a
|
|
16
|
-
* single URL, which is the other question a config raises and the one a person
|
|
17
|
-
* actually asks: *why was this page not accelerated*.
|
|
18
|
-
*
|
|
19
|
-
* The matching itself is delegated to `testCondition` from `@speedkit/rules`,
|
|
20
|
-
* the same function the runtime's `ConditionRule.test` calls — and called the
|
|
21
|
-
* same way, **without** a version argument, because `ConditionRule.test` does
|
|
22
|
-
* not pass one either. That is subtle and deliberate: the rule-set version
|
|
23
|
-
* changes which *subject* a pathname condition is tested against, not whether a
|
|
24
|
-
* string is a prefix or an exact match. A reading that applies the version to
|
|
25
|
-
* both would call a v2 config stricter than the browser does.
|
|
26
|
-
*
|
|
27
|
-
* The subjects are computed here rather than through the package's own
|
|
28
|
-
* `destructURL`, which resolves against `location` and therefore cannot run
|
|
29
|
-
* outside a browser. `rule-match.spec.ts` pins all three against the real rule
|
|
30
|
-
* classes, so a change in the runtime fails there rather than in an
|
|
31
|
-
* explanation nobody re-reads.
|
|
32
|
-
*/
|
|
33
|
-
export declare function matchRule(rule: NormalizedRule, url: URL): RuleMatch;
|
|
34
|
-
/** Every rule of a set that matches, with the uncertain ones marked. */
|
|
35
|
-
export declare function matchRules(rules: readonly NormalizedRule[], url: URL): RuleMatch[];
|