@speedkit/cli 4.36.0 → 4.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +3 -29
- package/dist/commands/auto-prewarm.js +1 -1
- package/dist/commands/browser/clean.js +1 -2
- package/dist/commands/browser/list.js +1 -2
- package/dist/commands/browser/update.js +1 -2
- package/dist/commands/bulk-deploy.js +1 -1
- package/dist/commands/config/setup.js +4 -3
- package/dist/commands/deploy.js +3 -2
- package/dist/commands/diff-url-parameters.d.ts +2 -2
- package/dist/commands/diff-url-parameters.js +12 -5
- package/dist/commands/extension/add.js +1 -1
- package/dist/commands/extension/devtools.js +1 -1
- package/dist/commands/extension/list.js +1 -1
- package/dist/commands/extension/remove.js +1 -1
- package/dist/commands/extension/update.js +1 -1
- package/dist/commands/find-pops.js +3 -2
- package/dist/commands/generate-pop-config.js +9 -13
- package/dist/commands/onboarding.js +1 -1
- package/dist/commands/origin-request.js +1 -1
- package/dist/commands/pull.js +1 -1
- package/dist/commands/revalidate.js +4 -3
- package/dist/commands/wpt-launcher.js +3 -2
- package/dist/helpers/{chrome-flags.spec.js → spec/chrome-flags.spec.js} +1 -1
- package/dist/helpers/{origin-proxy.spec.js → spec/origin-proxy.spec.js} +1 -1
- package/dist/hooks/init/first-run.js +3 -3
- package/dist/hooks/{init → spec/init}/dns-result-order.spec.js +1 -1
- package/dist/hooks/{init → spec/init}/http1-global-dispatcher.spec.js +1 -1
- package/dist/models/cli-parameters.d.ts +0 -2
- package/dist/models/cli-parameters.js +0 -2
- package/dist/models/{cli-parameters.spec.js → spec/cli-parameters.spec.js} +1 -1
- package/dist/services/athena/athena-service-factory.d.ts +3 -1
- package/dist/services/athena/athena-service-factory.js +4 -2
- package/dist/services/athena/{athena-service.spec.js → spec/athena-service.spec.js} +1 -1
- package/dist/services/athena/{baqend-athena-service.spec.js → spec/baqend-athena-service.spec.js} +2 -2
- package/dist/services/browser-fetch/browser-origin-fetch.d.ts +1 -1
- package/dist/services/browser-fetch/browser-origin-fetcher.d.ts +1 -1
- package/dist/services/browser-fetch/{browser-origin-fetch.spec.js → spec/browser-origin-fetch.spec.js} +2 -2
- package/dist/services/browser-fetch/{browser-origin-fetcher.spec.js → spec/browser-origin-fetcher.spec.js} +1 -1
- package/dist/services/browser-fetch/{browser-response.spec.js → spec/browser-response.spec.js} +1 -1
- package/dist/services/browser-fetch/{device-emulation.spec.js → spec/device-emulation.spec.js} +2 -2
- package/dist/services/bundler/{bundle-service.spec.js → spec/bundle-service.spec.js} +1 -1
- package/dist/{helpers → services/cli}/cli-config.js +1 -1
- package/dist/services/cli/cli-service-factory.d.ts +10 -2
- package/dist/services/cli/cli-service-factory.js +11 -9
- package/dist/services/cli/cli-service-model.d.ts +10 -2
- package/dist/services/cli/cli-service.d.ts +37 -0
- package/dist/services/cli/cli-service.js +48 -1
- package/dist/{helpers/clipboard.d.ts → services/cli/clipboard/clipboard-service.d.ts} +3 -1
- package/dist/{helpers/clipboard.js → services/cli/clipboard/clipboard-service.js} +6 -1
- package/dist/services/cli/clipboard/index.d.ts +1 -0
- package/dist/services/cli/clipboard/index.js +1 -0
- package/dist/services/cli/index.d.ts +1 -0
- package/dist/services/cli/index.js +1 -0
- package/dist/{helpers → services/cli/spec}/cli-config.spec.js +1 -1
- package/dist/services/cli/{cli-service.spec.js → spec/cli-service.spec.js} +1 -1
- package/dist/{helpers → services/cli/spec}/environment.spec.js +1 -1
- package/dist/services/customer-config/customer-config-service-factory.d.ts +3 -1
- package/dist/services/customer-config/customer-config-service-factory.js +7 -3
- package/dist/services/customer-config/customer-config-service.d.ts +4 -2
- package/dist/services/customer-config/customer-config-service.js +4 -3
- package/dist/services/customer-config/site-analyzer/index.d.ts +3 -0
- package/dist/services/customer-config/site-analyzer/index.js +3 -0
- package/dist/{helpers/site-analyzer.d.ts → services/customer-config/site-analyzer/site-analyzer-model.d.ts} +0 -1
- package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.d.ts +7 -0
- package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.js +11 -0
- package/dist/services/customer-config/site-analyzer/site-analyzer-service.d.ts +16 -0
- package/dist/{helpers/site-analyzer.js → services/customer-config/site-analyzer/site-analyzer-service.js} +20 -5
- package/dist/services/deploy/bulk/bulk-deploy-service-factory.d.ts +1 -1
- package/dist/services/deploy/bulk/config-deploy-factory.d.ts +1 -1
- package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.d.ts +2 -2
- package/dist/services/deploy/checks/post-deploy/refresh-deployment-job-check.d.ts +2 -2
- package/dist/services/deploy/checks/post-deploy/revalidated-module-check.d.ts +2 -2
- package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +2 -2
- package/dist/services/deploy/context/deploy-context.js +1 -1
- package/dist/services/deploy/deploy-service-factory.d.ts +3 -2
- package/dist/services/deploy/deploy-service-factory.js +9 -7
- package/dist/services/deploy/deploy-service.d.ts +2 -2
- package/dist/services/deploy/handler/customer-config-handler.d.ts +2 -2
- package/dist/services/deploy/handler/install-resource-handler.d.ts +2 -2
- package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.d.ts +2 -2
- package/dist/services/deploy/handler/module-handler.d.ts +2 -2
- package/dist/services/deploy/handler/server-config-handler.d.ts +2 -2
- package/dist/services/deploy/mr/base-config-reader.d.ts +1 -1
- package/dist/services/deploy/mr/base-config-reader.js +8 -5
- package/dist/services/deploy/mr/merge-request-deploy-service-factory.d.ts +1 -1
- package/dist/services/deploy/{bulk → spec/bulk}/bulk-deploy-service.spec.js +5 -5
- package/dist/services/deploy/{bulk → spec/bulk}/touched-configs.spec.js +2 -2
- package/dist/services/deploy/{checks → spec/checks}/activation/customer-approval-check.spec.js +2 -2
- package/dist/services/deploy/{checks → spec/checks}/post-deploy/refresh-deployment-job-check.spec.js +2 -2
- package/dist/services/deploy/{checks → spec/checks}/pre-deploy/split-change-check.spec.js +3 -3
- package/dist/services/deploy/{handler → spec/handler}/module-handler.spec.js +2 -2
- package/dist/services/deploy/{handler → spec/handler}/testing-installation-links.spec.js +1 -1
- package/dist/services/deploy/{mr → spec/mr}/live-state-check.spec.js +2 -2
- package/dist/services/deploy/{mr → spec/mr}/merge-request-description.spec.js +1 -1
- package/dist/services/deploy/{policy → spec/policy}/auto-deploy-policy.spec.js +2 -2
- package/dist/services/diff/diff-service-factory.d.ts +3 -1
- package/dist/services/diff/diff-service-factory.js +4 -2
- package/dist/services/diff/diff-service.d.ts +10 -2
- package/dist/services/diff/diff-service.js +26 -3
- package/dist/services/diff/index.d.ts +1 -0
- package/dist/services/diff/index.js +1 -0
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.d.ts +2 -14
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +0 -52
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +2 -2
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -11
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +6 -72
- package/dist/services/document-handler-runtime/{document-handler-abort.spec.js → spec/document-handler-abort.spec.js} +2 -2
- package/dist/services/git/{git-repository.spec.js → spec/git-repository.spec.js} +1 -1
- package/dist/services/integration-api/handler/customer-config-handler.d.ts +2 -2
- package/dist/services/integration-api/integration-api-factory.d.ts +3 -2
- package/dist/services/integration-api/integration-api-factory.js +5 -3
- package/dist/services/integration-api/struct/customer-config-file.js +1 -1
- package/dist/services/integration-api/virtual/virtual-file-handler.d.ts +2 -2
- package/dist/services/onboarding/browser/config/browser-config.d.ts +1 -1
- package/dist/services/onboarding/browser/executable/executable-validator.d.ts +1 -2
- package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +1 -2
- package/dist/services/onboarding/browser/extension/extension-validator.d.ts +1 -2
- package/dist/services/onboarding/dashboard/diff-against-current-page.d.ts +2 -2
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +1 -1
- package/dist/services/onboarding/dashboard/request-diff-service.d.ts +3 -1
- package/dist/services/onboarding/dashboard/request-diff-service.js +5 -3
- package/dist/services/onboarding/fetch-event-handler.d.ts +2 -2
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +3 -1
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +5 -3
- package/dist/services/onboarding/file-events/file-watcher.d.ts +2 -2
- package/dist/services/onboarding/file-events/file-watcher.js +2 -2
- package/dist/services/onboarding/onboarding-model.d.ts +1 -1
- package/dist/services/onboarding/onboarding-service-factory.d.ts +3 -2
- package/dist/services/onboarding/onboarding-service-factory.js +17 -17
- package/dist/services/onboarding/onboarding-service.d.ts +2 -2
- package/dist/services/onboarding/request-cache/cache.d.ts +2 -2
- package/dist/services/onboarding/server-config/index.d.ts +2 -2
- package/dist/services/onboarding/{browser → spec/browser}/executable/headed-user-agent.spec.js +1 -1
- package/dist/services/onboarding/{empty-service-worker.spec.js → spec/empty-service-worker.spec.js} +1 -1
- package/dist/services/onboarding/{onboarding-model.spec.js → spec/onboarding-model.spec.js} +2 -2
- package/dist/services/onboarding/{virtual-orestes-app → spec/virtual-orestes-app}/crawler.spec.js +1 -1
- package/dist/services/onboarding/{virtual-orestes-app → spec/virtual-orestes-app}/origin-error-cause.spec.js +1 -1
- package/dist/services/onboarding/virtual-orestes-app/crawler.d.ts +2 -2
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +2 -2
- package/dist/services/origin-request/asset-variations.js +1 -1
- package/dist/services/origin-request/origin-request-service-factory.d.ts +3 -2
- package/dist/services/origin-request/origin-request-service-factory.js +8 -6
- package/dist/services/origin-request/origin-request-service.d.ts +2 -2
- package/dist/services/origin-request/{asset-variations.spec.js → spec/asset-variations.spec.js} +1 -1
- package/dist/services/prewarm/assets/asset-api-client.d.ts +3 -1
- package/dist/services/prewarm/assets/asset-api-client.js +5 -3
- package/dist/services/prewarm/auto-pre-warm-factory.d.ts +3 -2
- package/dist/services/prewarm/auto-pre-warm-factory.js +8 -5
- package/dist/{helpers → services/prewarm}/normalize.d.ts +0 -6
- package/dist/{helpers → services/prewarm}/normalize.js +0 -8
- package/dist/services/prewarm/pre-warm-factory.d.ts +3 -1
- package/dist/services/prewarm/pre-warm-factory.js +7 -4
- package/dist/services/prewarm/{csv-reader.spec.js → spec/csv-reader.spec.js} +1 -1
- package/dist/services/prewarm/{prewarm-targets.spec.js → spec/prewarm-targets.spec.js} +1 -1
- package/dist/services/pull/pull-service-factory.d.ts +3 -2
- package/dist/services/pull/pull-service-factory.js +8 -6
- package/dist/services/query-builder/query-builder-factory.d.ts +3 -2
- package/dist/services/query-builder/query-builder-factory.js +9 -7
- package/dist/services/query-builder/query-builder-service.js +4 -5
- package/dist/services/query-builder/query-command.js +1 -1
- package/dist/services/query-builder/{queries/spec → spec/queries}/golden.spec.js +3 -3
- package/dist/services/query-builder/{queries/spec → spec/queries}/pops-query.spec.js +2 -2
- package/dist/services/query-builder/{queries/spec → spec/queries}/queries.spec.js +3 -3
- package/dist/services/query-builder/{queries/spec → spec/queries}/reported-bugs.spec.js +2 -2
- package/dist/services/query-builder/{query-builder-service.spec.js → spec/query-builder-service.spec.js} +4 -4
- package/dist/services/query-builder/{rules/spec → spec/rules}/pattern-language.spec.js +1 -1
- package/dist/services/query-builder/{rules/spec → spec/rules}/rule-parser.spec.js +1 -1
- package/dist/services/query-builder/{rules/spec → spec/rules}/rule-reducer.spec.js +2 -2
- package/dist/services/query-builder/{rules/spec → spec/rules}/rule-relevance.spec.js +2 -2
- package/dist/services/query-builder/{rules/spec → spec/rules}/rule-to-sql.spec.js +2 -2
- package/dist/services/query-builder/{rules/spec → spec/rules}/runtime-semantics.spec.js +1 -1
- package/dist/services/query-builder/{rules/spec → spec/rules}/strip-parameters.spec.js +3 -3
- package/dist/services/query-builder/{sql/spec → spec/sql}/expression.spec.js +2 -2
- package/dist/services/query-builder/{sql/spec → spec/sql}/format.spec.js +2 -2
- package/dist/services/query-builder/{sql/spec → spec/sql}/predicate.spec.js +1 -1
- package/dist/services/query-builder/{sql/spec → spec/sql}/regex.spec.js +1 -1
- package/dist/services/revalidate/revalidate-factory.d.ts +3 -1
- package/dist/services/revalidate/revalidate-factory.js +6 -3
- package/dist/services/revalidate/revalidate-service.d.ts +2 -2
- package/dist/services/revalidate/{revalidate-service.spec.js → spec/revalidate-service.spec.js} +1 -1
- package/dist/services/setup/browser/browser-setup-service.d.ts +1 -2
- package/dist/services/setup/difftool/difftool-setup-service.d.ts +1 -2
- package/dist/services/setup/extension/extension-installer.d.ts +1 -1
- package/dist/services/setup/extension/extension-setup-service.d.ts +1 -2
- package/dist/services/setup/setup-service-factory.d.ts +3 -1
- package/dist/services/setup/setup-service-factory.js +5 -4
- package/dist/services/setup/setup-service.d.ts +1 -2
- package/dist/services/setup/{extension → spec/extension}/crx.spec.js +1 -1
- package/dist/services/setup/{extension → spec/extension}/webstore.spec.js +1 -1
- package/dist/services/setup/{os → spec/os}/tool-registry.spec.js +1 -1
- package/oclif.manifest.json +1 -52
- package/package.json +3 -2
- package/dist/commands/document-handler.d.ts +0 -16
- package/dist/commands/document-handler.js +0 -32
- package/dist/helpers/customer-config.d.ts +0 -45
- package/dist/helpers/customer-config.js +0 -136
- package/dist/helpers/file-helper.d.ts +0 -8
- package/dist/helpers/file-helper.js +0 -28
- package/dist/helpers/is-directory.d.ts +0 -5
- package/dist/helpers/is-directory.js +0 -19
- package/dist/helpers/is-file.d.ts +0 -5
- package/dist/helpers/is-file.js +0 -19
- package/dist/helpers/logging-helper.d.ts +0 -15
- package/dist/helpers/logging-helper.js +0 -23
- package/dist/helpers/scrape.d.ts +0 -1
- package/dist/helpers/scrape.js +0 -8
- package/dist/helpers/speed-kit-rule-to-reg-exp.d.ts +0 -1
- package/dist/helpers/speed-kit-rule-to-reg-exp.js +0 -6
- package/dist/models/install.d.ts +0 -24
- package/dist/services/config-api-service.d.ts +0 -21
- package/dist/services/config-api-service.js +0 -107
- package/dist/services/diff-service.d.ts +0 -27
- package/dist/services/diff-service.js +0 -116
- package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +0 -31
- package/dist/services/document-handler-runtime/document-handler-runtime-service.js +0 -222
- package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.d.ts +0 -3
- package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.js +0 -3
- package/dist/services/document-handler-runtime/templates/execute-document-handler.d.ts +0 -6
- package/dist/services/document-handler-runtime/templates/execute-document-handler.js +0 -74
- package/dist/services/document-handler-runtime/templates/orestes-mock.d.ts +0 -9
- package/dist/services/document-handler-runtime/templates/orestes-mock.js +0 -166
- package/dist/services/document-handler-runtime/templates/package-json.d.ts +0 -6
- package/dist/services/document-handler-runtime/templates/package-json.js +0 -17
- package/dist/services/document-handler-runtime/templates/test.d.ts +0 -6
- package/dist/services/document-handler-runtime/templates/test.js +0 -64
- /package/dist/helpers/{chrome-flags.spec.d.ts → spec/chrome-flags.spec.d.ts} +0 -0
- /package/dist/helpers/{origin-proxy.spec.d.ts → spec/origin-proxy.spec.d.ts} +0 -0
- /package/dist/hooks/{init → spec/init}/dns-result-order.spec.d.ts +0 -0
- /package/dist/hooks/{init → spec/init}/http1-global-dispatcher.spec.d.ts +0 -0
- /package/dist/models/{cli-parameters.spec.d.ts → spec/cli-parameters.spec.d.ts} +0 -0
- /package/dist/services/athena/{athena-service.spec.d.ts → spec/athena-service.spec.d.ts} +0 -0
- /package/dist/services/athena/{baqend-athena-service.spec.d.ts → spec/baqend-athena-service.spec.d.ts} +0 -0
- /package/dist/services/browser-fetch/{browser-origin-fetch.spec.d.ts → spec/browser-origin-fetch.spec.d.ts} +0 -0
- /package/dist/services/browser-fetch/{browser-origin-fetcher.spec.d.ts → spec/browser-origin-fetcher.spec.d.ts} +0 -0
- /package/dist/services/browser-fetch/{browser-response.spec.d.ts → spec/browser-response.spec.d.ts} +0 -0
- /package/dist/services/browser-fetch/{device-emulation.spec.d.ts → spec/device-emulation.spec.d.ts} +0 -0
- /package/dist/services/bundler/{bundle-service.spec.d.ts → spec/bundle-service.spec.d.ts} +0 -0
- /package/dist/{helpers → services/cli}/cli-config.d.ts +0 -0
- /package/dist/{helpers → services/cli}/environment.d.ts +0 -0
- /package/dist/{helpers → services/cli}/environment.js +0 -0
- /package/dist/{helpers → services/cli/spec}/cli-config.spec.d.ts +0 -0
- /package/dist/services/cli/{cli-service.spec.d.ts → spec/cli-service.spec.d.ts} +0 -0
- /package/dist/{helpers → services/cli/spec}/environment.spec.d.ts +0 -0
- /package/dist/{models/install.js → services/customer-config/site-analyzer/site-analyzer-model.js} +0 -0
- /package/dist/services/deploy/{bulk → spec/bulk}/bulk-deploy-service.spec.d.ts +0 -0
- /package/dist/services/deploy/{bulk → spec/bulk}/touched-configs.spec.d.ts +0 -0
- /package/dist/services/deploy/{checks → spec/checks}/activation/customer-approval-check.spec.d.ts +0 -0
- /package/dist/services/deploy/{checks → spec/checks}/post-deploy/refresh-deployment-job-check.spec.d.ts +0 -0
- /package/dist/services/deploy/{checks → spec/checks}/pre-deploy/split-change-check.spec.d.ts +0 -0
- /package/dist/services/deploy/{handler → spec/handler}/module-handler.spec.d.ts +0 -0
- /package/dist/services/deploy/{handler → spec/handler}/testing-installation-links.spec.d.ts +0 -0
- /package/dist/services/deploy/{mr → spec/mr}/live-state-check.spec.d.ts +0 -0
- /package/dist/services/deploy/{mr → spec/mr}/merge-request-description.spec.d.ts +0 -0
- /package/dist/services/deploy/{policy → spec/policy}/auto-deploy-policy.spec.d.ts +0 -0
- /package/dist/{helpers/html-format-helper.d.ts → services/diff/html-format.d.ts} +0 -0
- /package/dist/{helpers/html-format-helper.js → services/diff/html-format.js} +0 -0
- /package/dist/services/document-handler-runtime/{document-handler-abort.spec.d.ts → spec/document-handler-abort.spec.d.ts} +0 -0
- /package/dist/services/git/{git-repository.spec.d.ts → spec/git-repository.spec.d.ts} +0 -0
- /package/dist/{helpers → services/integration-api}/array-helper.d.ts +0 -0
- /package/dist/{helpers → services/integration-api}/array-helper.js +0 -0
- /package/dist/services/onboarding/{browser → spec/browser}/executable/headed-user-agent.spec.d.ts +0 -0
- /package/dist/services/onboarding/{empty-service-worker.spec.d.ts → spec/empty-service-worker.spec.d.ts} +0 -0
- /package/dist/services/onboarding/{onboarding-model.spec.d.ts → spec/onboarding-model.spec.d.ts} +0 -0
- /package/dist/services/onboarding/{virtual-orestes-app → spec/virtual-orestes-app}/crawler.spec.d.ts +0 -0
- /package/dist/services/onboarding/{virtual-orestes-app → spec/virtual-orestes-app}/origin-error-cause.spec.d.ts +0 -0
- /package/dist/{helpers → services/origin-request}/java-regex.d.ts +0 -0
- /package/dist/{helpers → services/origin-request}/java-regex.js +0 -0
- /package/dist/services/origin-request/{asset-variations.spec.d.ts → spec/asset-variations.spec.d.ts} +0 -0
- /package/dist/services/prewarm/{csv-reader.spec.d.ts → spec/csv-reader.spec.d.ts} +0 -0
- /package/dist/services/prewarm/{prewarm-targets.spec.d.ts → spec/prewarm-targets.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{queries/spec → spec/queries}/golden-configs.d.ts +0 -0
- /package/dist/services/query-builder/{queries/spec → spec/queries}/golden-configs.js +0 -0
- /package/dist/services/query-builder/{queries/spec → spec/queries}/golden.spec.d.ts +0 -0
- /package/dist/services/query-builder/{queries/spec → spec/queries}/pops-query.spec.d.ts +0 -0
- /package/dist/services/query-builder/{queries/spec → spec/queries}/queries.spec.d.ts +0 -0
- /package/dist/services/query-builder/{queries/spec → spec/queries}/reported-bugs.spec.d.ts +0 -0
- /package/dist/services/query-builder/{query-builder-service.spec.d.ts → spec/query-builder-service.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{rules/spec → spec/rules}/pattern-language.spec.d.ts +0 -0
- /package/dist/services/query-builder/{rules/spec → spec/rules}/rule-parser.spec.d.ts +0 -0
- /package/dist/services/query-builder/{rules/spec → spec/rules}/rule-reducer.spec.d.ts +0 -0
- /package/dist/services/query-builder/{rules/spec → spec/rules}/rule-relevance.spec.d.ts +0 -0
- /package/dist/services/query-builder/{rules/spec → spec/rules}/rule-to-sql.spec.d.ts +0 -0
- /package/dist/services/query-builder/{rules/spec → spec/rules}/runtime-semantics.spec.d.ts +0 -0
- /package/dist/services/query-builder/{rules/spec → spec/rules}/strip-parameters.spec.d.ts +0 -0
- /package/dist/services/query-builder/{sql/spec → spec/sql}/expression.spec.d.ts +0 -0
- /package/dist/services/query-builder/{sql/spec → spec/sql}/format.spec.d.ts +0 -0
- /package/dist/services/query-builder/{sql/spec → spec/sql}/predicate.spec.d.ts +0 -0
- /package/dist/services/query-builder/{sql/spec → spec/sql}/regex.spec.d.ts +0 -0
- /package/dist/services/revalidate/{revalidate-service.spec.d.ts → spec/revalidate-service.spec.d.ts} +0 -0
- /package/dist/services/setup/{extension → spec/extension}/crx.spec.d.ts +0 -0
- /package/dist/services/setup/{extension → spec/extension}/webstore.spec.d.ts +0 -0
- /package/dist/services/setup/{os → spec/os}/tool-registry.spec.d.ts +0 -0
package/dist/services/onboarding/{virtual-orestes-app → spec/virtual-orestes-app}/crawler.spec.js
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, beforeEach, afterEach, it } from "mocha";
|
|
3
3
|
import http from "node:http";
|
|
4
|
-
import { Crawler } from "
|
|
4
|
+
import { Crawler } from "../../virtual-orestes-app/crawler.js";
|
|
5
5
|
/** Records the lines the crawler reports, so a spec can assert on them. */
|
|
6
6
|
function stubCli() {
|
|
7
7
|
const warnings = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { BLOCKED_ORIGIN_STATUSES, isBlockedOriginStatus, ORIGIN_ERROR_CODE, ORIGIN_ERROR_STATUS_CODE, originErrorCauseName, originErrorCode, originErrorServerTiming, } from "
|
|
3
|
+
import { BLOCKED_ORIGIN_STATUSES, isBlockedOriginStatus, ORIGIN_ERROR_CODE, ORIGIN_ERROR_STATUS_CODE, originErrorCauseName, originErrorCode, originErrorServerTiming, } from "../../virtual-orestes-app/origin-error-cause.js";
|
|
4
4
|
/**
|
|
5
5
|
* Mirrors the service worker's `parseServerTimingHeader`, so the header this module emits is
|
|
6
6
|
* asserted against the parser that has to read it.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SpeedKitServerConfig } from "../onboarding-model.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CliServiceInterface } from "../../cli/index.js";
|
|
3
3
|
export declare class Crawler {
|
|
4
4
|
private cli;
|
|
5
5
|
private speedKitServerConfig?;
|
|
6
6
|
/** Warnings already shown, so a per-fetch condition is reported once per session. */
|
|
7
7
|
private readonly warned;
|
|
8
|
-
constructor(cli:
|
|
8
|
+
constructor(cli: CliServiceInterface, speedKitServerConfig?: SpeedKitServerConfig);
|
|
9
9
|
private warnOnce;
|
|
10
10
|
fetchRemote(originUrl: string, variation: string): Promise<{
|
|
11
11
|
response: Response;
|
|
@@ -2,7 +2,7 @@ import { Protocol } from "devtools-protocol";
|
|
|
2
2
|
import { AbortResponse } from "../browser/abort-response.js";
|
|
3
3
|
import { DocumentHandlerServer } from "../../document-handler-runtime/document-handler-server.js";
|
|
4
4
|
import { Cache } from "../request-cache/cache.js";
|
|
5
|
-
import {
|
|
5
|
+
import { CliServiceInterface } from "../../cli/index.js";
|
|
6
6
|
import { Crawler } from "./crawler.js";
|
|
7
7
|
import { CustomerConfig } from "../../integration-api/index.js";
|
|
8
8
|
import { DevtoolsExtensionApi } from "../browser/extension/devtools-extension-api.js";
|
|
@@ -15,7 +15,7 @@ export declare class VirtualOrestesApp {
|
|
|
15
15
|
private developmentToolsMessages;
|
|
16
16
|
private removeContentSecurityPolicy;
|
|
17
17
|
private localCacheErrors;
|
|
18
|
-
constructor(customerConfig: CustomerConfig, crawler: Crawler, documentHandler: DocumentHandlerServer, cache: Cache, cli:
|
|
18
|
+
constructor(customerConfig: CustomerConfig, crawler: Crawler, documentHandler: DocumentHandlerServer, cache: Cache, cli: CliServiceInterface, developmentToolsMessages: DevtoolsExtensionApi, removeContentSecurityPolicy?: boolean);
|
|
19
19
|
fetchAssetResponse(event: Protocol.Fetch.RequestPausedEvent): Promise<Partial<Protocol.Fetch.FulfillRequestRequest> | AbortResponse>;
|
|
20
20
|
/**
|
|
21
21
|
* Re-warm all cached entries for the given origin url in the background.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Keep this file free of I/O so the resolution stays unit-testable.
|
|
12
12
|
*/
|
|
13
|
-
import { javaRegexToJs } from "
|
|
13
|
+
import { javaRegexToJs } from "./java-regex.js";
|
|
14
14
|
export const DEFAULT_TYPE = "default";
|
|
15
15
|
const WILD_CARD = "*";
|
|
16
16
|
/** User agents the server falls back to. Keep in sync with AssetVariations.kt. */
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { UserCliConfig } from "
|
|
1
|
+
import { CliServiceInterface, UserCliConfig } from "../cli/index.js";
|
|
2
2
|
import { OriginRequestContext } from "./origin-request-context.js";
|
|
3
3
|
import { OriginRequestService } from "./origin-request-service.js";
|
|
4
4
|
export declare class OriginRequestServiceFactory {
|
|
5
5
|
private readonly context;
|
|
6
6
|
private readonly userConfig;
|
|
7
|
+
private readonly cli?;
|
|
7
8
|
private service?;
|
|
8
|
-
constructor(context: OriginRequestContext, userConfig: UserCliConfig);
|
|
9
|
+
constructor(context: OriginRequestContext, userConfig: UserCliConfig, cli?: CliServiceInterface);
|
|
9
10
|
buildService(): Promise<OriginRequestService>;
|
|
10
11
|
private build;
|
|
11
12
|
private getIntegrationFiles;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CliServiceFactory } from "../cli/index.js";
|
|
1
|
+
import { CliServiceFactory, } from "../cli/index.js";
|
|
2
2
|
import { ConfigApiContext, ConfigApiServiceFactory, } from "../config-api/index.js";
|
|
3
3
|
import { IntegrationApiContext, IntegrationApiFactory, } from "../integration-api/index.js";
|
|
4
4
|
import { applyOriginProxy } from "../../helpers/origin-proxy.js";
|
|
@@ -6,10 +6,12 @@ import { OriginRequestService } from "./origin-request-service.js";
|
|
|
6
6
|
export class OriginRequestServiceFactory {
|
|
7
7
|
context;
|
|
8
8
|
userConfig;
|
|
9
|
+
cli;
|
|
9
10
|
service = undefined;
|
|
10
|
-
constructor(context, userConfig) {
|
|
11
|
+
constructor(context, userConfig, cli) {
|
|
11
12
|
this.context = context;
|
|
12
13
|
this.userConfig = userConfig;
|
|
14
|
+
this.cli = cli;
|
|
13
15
|
}
|
|
14
16
|
async buildService() {
|
|
15
17
|
if (!(this.service instanceof OriginRequestService)) {
|
|
@@ -18,16 +20,16 @@ export class OriginRequestServiceFactory {
|
|
|
18
20
|
return this.service;
|
|
19
21
|
}
|
|
20
22
|
async build() {
|
|
21
|
-
const
|
|
23
|
+
const cli = this.cli ?? new CliServiceFactory().getService();
|
|
24
|
+
const files = await this.getIntegrationFiles(cli);
|
|
22
25
|
const customer = files.getCustomerConfig().config;
|
|
23
|
-
const cli = new CliServiceFactory().getService();
|
|
24
26
|
// `--json` owns stdout, so the proxy line stays out of a machine-readable run.
|
|
25
27
|
applyOriginProxy(customer.chromeFlags, this.context.json ? undefined : cli);
|
|
26
28
|
this.service = new OriginRequestService(this.context, cli, this.getConfigApi(customer.app));
|
|
27
29
|
}
|
|
28
|
-
async getIntegrationFiles() {
|
|
30
|
+
async getIntegrationFiles(cli) {
|
|
29
31
|
const integrationApiContext = new IntegrationApiContext(this.context.customerPath, this.context.configName, []);
|
|
30
|
-
const integrationApi = new IntegrationApiFactory(integrationApiContext, this.userConfig).buildService();
|
|
32
|
+
const integrationApi = new IntegrationApiFactory(integrationApiContext, this.userConfig, cli).buildService();
|
|
31
33
|
return await integrationApi.run();
|
|
32
34
|
}
|
|
33
35
|
getConfigApi(app) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CliServiceInterface } from "../cli/index.js";
|
|
2
2
|
import { ConfigApiService } from "../config-api/index.js";
|
|
3
3
|
import { OriginRequestContext } from "./origin-request-context.js";
|
|
4
4
|
/**
|
|
@@ -20,7 +20,7 @@ export declare class OriginRequestService {
|
|
|
20
20
|
private readonly context;
|
|
21
21
|
private readonly cli;
|
|
22
22
|
private readonly configApi;
|
|
23
|
-
constructor(context: OriginRequestContext, cli:
|
|
23
|
+
constructor(context: OriginRequestContext, cli: CliServiceInterface, configApi: ConfigApiService);
|
|
24
24
|
run(): Promise<void>;
|
|
25
25
|
/**
|
|
26
26
|
* Reads `speedKit.variations` from the app's deployed runtime config, or from a local file when
|
package/dist/services/origin-request/{asset-variations.spec.js → spec/asset-variations.spec.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { getVariations, resolveRequest, UndefinedVariationError, } from "
|
|
3
|
+
import { getVariations, resolveRequest, UndefinedVariationError, } from "../asset-variations.js";
|
|
4
4
|
/**
|
|
5
5
|
* These cases mirror the server's own expectations, so a change here means the simulation and the
|
|
6
6
|
* server have drifted apart. The reference tests live in orestes:
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CliServiceInterface } from "../../cli/index.js";
|
|
1
2
|
export interface SimpleResponse {
|
|
2
3
|
headers: Headers;
|
|
3
4
|
status: number;
|
|
@@ -7,12 +8,13 @@ export declare class AssetApiClient {
|
|
|
7
8
|
private authenticationToken;
|
|
8
9
|
private app;
|
|
9
10
|
private sortParameters;
|
|
11
|
+
private cli;
|
|
10
12
|
private sessions;
|
|
11
13
|
private rateLimit;
|
|
12
14
|
private lowestRateLimit;
|
|
13
15
|
private isRetry;
|
|
14
16
|
private lastRequestTime;
|
|
15
|
-
constructor(authenticationToken: string, app: string, sortParameters: boolean);
|
|
17
|
+
constructor(authenticationToken: string, app: string, sortParameters: boolean, cli: CliServiceInterface);
|
|
16
18
|
fetchURL(url: string, variation: string, verbose: boolean): Promise<SimpleResponse>;
|
|
17
19
|
private makeHttp2Request;
|
|
18
20
|
destroy(): void;
|
|
@@ -2,21 +2,23 @@ import { URL } from "node:url";
|
|
|
2
2
|
import http2 from "node:http2";
|
|
3
3
|
import { MAX_REQUESTS_PER_SECOND, DEFAULT_REQUESTS_PER_SECOND, RATE_LIMIT_MULTIPLICATOR, TIMING_HEADER_KEY, } from "../index.js";
|
|
4
4
|
import { DEVICE_VARIATIONS, } from "../../query-builder/queries/device.js";
|
|
5
|
-
import { normalize } from "
|
|
5
|
+
import { normalize } from "../normalize.js";
|
|
6
6
|
import { InvalidOriginError } from "../error/invalid-origin-error.js";
|
|
7
7
|
export class AssetApiClient {
|
|
8
8
|
authenticationToken;
|
|
9
9
|
app;
|
|
10
10
|
sortParameters;
|
|
11
|
+
cli;
|
|
11
12
|
sessions = new Map();
|
|
12
13
|
rateLimit = DEFAULT_REQUESTS_PER_SECOND;
|
|
13
14
|
lowestRateLimit = DEFAULT_REQUESTS_PER_SECOND;
|
|
14
15
|
isRetry = false;
|
|
15
16
|
lastRequestTime = Date.now();
|
|
16
|
-
constructor(authenticationToken, app, sortParameters) {
|
|
17
|
+
constructor(authenticationToken, app, sortParameters, cli) {
|
|
17
18
|
this.authenticationToken = authenticationToken;
|
|
18
19
|
this.app = app;
|
|
19
20
|
this.sortParameters = sortParameters;
|
|
21
|
+
this.cli = cli;
|
|
20
22
|
}
|
|
21
23
|
async fetchURL(url, variation, verbose) {
|
|
22
24
|
await this.sleepByRate();
|
|
@@ -28,7 +30,7 @@ export class AssetApiClient {
|
|
|
28
30
|
const start = Date.now();
|
|
29
31
|
const result = await this.makeHttp2Request(origin, `/v1/asset/${assetUrl.toString()}`, assetUrl.origin);
|
|
30
32
|
if (verbose) {
|
|
31
|
-
|
|
33
|
+
this.cli.comment(`fetch ${url} - ${variation} took ${Date.now() - start}ms, cdnTime: ${result.headers.get("x-timer") || "-"}, status: ${result.status}, cache: ${result.headers.get("x-cache")}, timings: ${result.headers.get(TIMING_HEADER_KEY)}`);
|
|
32
34
|
}
|
|
33
35
|
return result;
|
|
34
36
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UserCliConfig } from "
|
|
1
|
+
import { CliServiceInterface, UserCliConfig } from "../cli/index.js";
|
|
2
2
|
import { QueryFilterOptions } from "../query-builder/query-builder-model.js";
|
|
3
3
|
import { PreWarmService } from "./pre-warm-service.js";
|
|
4
4
|
export interface AutoPreWarmContext extends QueryFilterOptions {
|
|
@@ -40,6 +40,7 @@ export interface AutoPreWarmContext extends QueryFilterOptions {
|
|
|
40
40
|
export declare class AutoPreWarmFactory {
|
|
41
41
|
private context;
|
|
42
42
|
private userConfig;
|
|
43
|
-
|
|
43
|
+
private cli?;
|
|
44
|
+
constructor(context: AutoPreWarmContext, userConfig: UserCliConfig, cli?: CliServiceInterface);
|
|
44
45
|
getService(): Promise<PreWarmService>;
|
|
45
46
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CliContext, CliServiceFactory } from "../cli/index.js";
|
|
1
|
+
import { CliContext, CliServiceFactory, } from "../cli/index.js";
|
|
2
2
|
import { QueryBuilderFactory } from "../query-builder/query-builder-factory.js";
|
|
3
3
|
import { QueryType, } from "../query-builder/query-builder-model.js";
|
|
4
4
|
import { normalizeDevices } from "../query-builder/queries/device.js";
|
|
@@ -22,12 +22,15 @@ import { toPrewarmTargets } from "./prewarm-targets.js";
|
|
|
22
22
|
export class AutoPreWarmFactory {
|
|
23
23
|
context;
|
|
24
24
|
userConfig;
|
|
25
|
-
|
|
25
|
+
cli;
|
|
26
|
+
constructor(context, userConfig, cli) {
|
|
26
27
|
this.context = context;
|
|
27
28
|
this.userConfig = userConfig;
|
|
29
|
+
this.cli = cli;
|
|
28
30
|
}
|
|
29
31
|
async getService() {
|
|
30
|
-
const cli =
|
|
32
|
+
const cli = this.cli ??
|
|
33
|
+
new CliServiceFactory(new CliContext(this.context.quiet)).getService();
|
|
31
34
|
const queryService = await new QueryBuilderFactory({
|
|
32
35
|
configName: this.context.configName,
|
|
33
36
|
customerPath: this.context.customerPath,
|
|
@@ -46,12 +49,12 @@ export class AutoPreWarmFactory {
|
|
|
46
49
|
variations: this.context.variation,
|
|
47
50
|
workgroup: this.context.workgroup,
|
|
48
51
|
catalog: this.context.catalog,
|
|
49
|
-
}, this.userConfig).buildService(QueryType.prewarm);
|
|
52
|
+
}, this.userConfig, cli).buildService(QueryType.prewarm);
|
|
50
53
|
const app = queryService.app;
|
|
51
54
|
const rows = await queryService.execute();
|
|
52
55
|
const configApi = new ConfigApiServiceFactory(new ConfigApiContext(app)).getService();
|
|
53
56
|
const entityManager = await configApi.client.getEntityManager();
|
|
54
|
-
const assetApiClient = new AssetApiClient(entityManager.token, app, this.context.sortParameters);
|
|
57
|
+
const assetApiClient = new AssetApiClient(entityManager.token, app, this.context.sortParameters, cli);
|
|
55
58
|
const csvReader = new CsvReader();
|
|
56
59
|
return new PreWarmService(assetApiClient, cli, toPrewarmTargets(rows.filter((row) => row.url),
|
|
57
60
|
// `--variation` was answered by the query already; a variations file
|
|
@@ -39,9 +39,3 @@ export declare function transformNoValueParameters(url: URL, manipulatedUrl: URL
|
|
|
39
39
|
* @returns The normalized URL.
|
|
40
40
|
*/
|
|
41
41
|
export declare function normalize(urlString: string, withParameterSorting: boolean): string;
|
|
42
|
-
/**
|
|
43
|
-
* Remove backslashes before spaces from given string.
|
|
44
|
-
*
|
|
45
|
-
* @param string_
|
|
46
|
-
*/
|
|
47
|
-
export declare function unescapeSpaces(string_: string): string;
|
|
@@ -107,11 +107,3 @@ export function normalize(urlString, withParameterSorting) {
|
|
|
107
107
|
transformNoValueParameters(new URL(urlString), url);
|
|
108
108
|
return url.toString();
|
|
109
109
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Remove backslashes before spaces from given string.
|
|
112
|
-
*
|
|
113
|
-
* @param string_
|
|
114
|
-
*/
|
|
115
|
-
export function unescapeSpaces(string_) {
|
|
116
|
-
return string_.replaceAll("\\ ", " ");
|
|
117
|
-
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { CliServiceInterface } from "../cli/index.js";
|
|
1
2
|
import { PreWarmContext, PreWarmService } from "./index.js";
|
|
2
3
|
import { CsvReader } from "./csv-reader.js";
|
|
3
4
|
export declare class PreWarmFactory {
|
|
4
5
|
private context;
|
|
5
|
-
|
|
6
|
+
private cli?;
|
|
7
|
+
constructor(context: PreWarmContext, cli?: CliServiceInterface);
|
|
6
8
|
getService(): Promise<PreWarmService>;
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { CliContext, CliServiceFactory } from "../cli/index.js";
|
|
1
|
+
import { CliContext, CliServiceFactory, } from "../cli/index.js";
|
|
2
2
|
import { DEFAULT_VARIATION, PreWarmService, toPrewarmTargets, VARIATION_SEPARATOR, } from "./index.js";
|
|
3
3
|
import { AssetApiClient } from "./assets/asset-api-client.js";
|
|
4
4
|
import { CsvReader } from "./csv-reader.js";
|
|
5
5
|
import { ConfigApiContext, ConfigApiServiceFactory, } from "../config-api/index.js";
|
|
6
6
|
export class PreWarmFactory {
|
|
7
7
|
context;
|
|
8
|
-
|
|
8
|
+
cli;
|
|
9
|
+
constructor(context, cli) {
|
|
9
10
|
this.context = context;
|
|
11
|
+
this.cli = cli;
|
|
10
12
|
}
|
|
11
13
|
async getService() {
|
|
12
|
-
const cli =
|
|
14
|
+
const cli = this.cli ??
|
|
15
|
+
new CliServiceFactory(new CliContext(this.context.quiet)).getService();
|
|
13
16
|
const configApi = new ConfigApiServiceFactory(new ConfigApiContext(this.context.app)).getService();
|
|
14
17
|
const entityManager = await configApi.client.getEntityManager();
|
|
15
18
|
const csvReader = new CsvReader();
|
|
16
|
-
const assetApiClient = new AssetApiClient(entityManager.token, this.context.app, this.context.keepParameterSorting);
|
|
19
|
+
const assetApiClient = new AssetApiClient(entityManager.token, this.context.app, this.context.keepParameterSorting, cli);
|
|
17
20
|
const rows = csvReader.readList(this.context.path);
|
|
18
21
|
const named = this.context.variation ?? this.context.variationPath;
|
|
19
22
|
if (named && rows.some((row) => row.variation)) {
|
|
@@ -3,7 +3,7 @@ import { tmpdir } from "node:os";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { expect } from "chai";
|
|
5
5
|
import { describe, it } from "mocha";
|
|
6
|
-
import { CsvReader } from "
|
|
6
|
+
import { CsvReader } from "../csv-reader.js";
|
|
7
7
|
function write(content) {
|
|
8
8
|
const file = join(mkdtempSync(join(tmpdir(), "sk-csv-")), "urls.csv");
|
|
9
9
|
writeFileSync(file, content, "utf8");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { toPrewarmTargets } from "
|
|
3
|
+
import { toPrewarmTargets } from "../prewarm-targets.js";
|
|
4
4
|
describe("toPrewarmTargets", () => {
|
|
5
5
|
it("should keep a paired list in the order it was given", () => {
|
|
6
6
|
// The order is the query's interleaving of the variations by hit count:
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { CliServiceInterface, UserCliConfig } from "../cli/index.js";
|
|
1
2
|
import { PullContext, PullService } from "./index.js";
|
|
2
|
-
import { UserCliConfig } from "../../helpers/cli-config.js";
|
|
3
3
|
export declare class PullServiceFactory {
|
|
4
4
|
private readonly context;
|
|
5
5
|
private userConfig;
|
|
6
|
+
private readonly cli?;
|
|
6
7
|
private service?;
|
|
7
|
-
constructor(context: PullContext, userConfig: UserCliConfig);
|
|
8
|
+
constructor(context: PullContext, userConfig: UserCliConfig, cli?: CliServiceInterface);
|
|
8
9
|
buildService(): Promise<PullService>;
|
|
9
10
|
private build;
|
|
10
11
|
private getIntegrationFiles;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { IntegrationApiContext, IntegrationApiFactory, } from "../integration-api/index.js";
|
|
2
|
-
import { CliServiceFactory } from "../cli/index.js";
|
|
2
|
+
import { CliServiceFactory, } from "../cli/index.js";
|
|
3
3
|
import { PullService } from "./index.js";
|
|
4
4
|
import { ConfigApiContext, ConfigApiServiceFactory, } from "../config-api/index.js";
|
|
5
5
|
export class PullServiceFactory {
|
|
6
6
|
context;
|
|
7
7
|
userConfig;
|
|
8
|
+
cli;
|
|
8
9
|
service = undefined;
|
|
9
|
-
constructor(context, userConfig) {
|
|
10
|
+
constructor(context, userConfig, cli) {
|
|
10
11
|
this.context = context;
|
|
11
12
|
this.userConfig = userConfig;
|
|
13
|
+
this.cli = cli;
|
|
12
14
|
this.context = context;
|
|
13
15
|
}
|
|
14
16
|
async buildService() {
|
|
@@ -18,16 +20,16 @@ export class PullServiceFactory {
|
|
|
18
20
|
return this.service;
|
|
19
21
|
}
|
|
20
22
|
async build() {
|
|
21
|
-
const
|
|
23
|
+
const cliService = this.cli ?? new CliServiceFactory().getService();
|
|
24
|
+
const files = await this.getIntegrationFiles(cliService);
|
|
22
25
|
const customer = files.getCustomerConfig().config;
|
|
23
26
|
const configName = customer.name || this.context.configName;
|
|
24
27
|
const configApi = this.getConfigApi(customer.app);
|
|
25
|
-
const cliService = new CliServiceFactory().getService();
|
|
26
28
|
this.service = new PullService(files, cliService, configApi, configName, this.context.customerPath);
|
|
27
29
|
}
|
|
28
|
-
async getIntegrationFiles() {
|
|
30
|
+
async getIntegrationFiles(cli) {
|
|
29
31
|
const integrationApiContext = new IntegrationApiContext(this.context.customerPath, this.context.configName, []);
|
|
30
|
-
const integrationApi = new IntegrationApiFactory(integrationApiContext, this.userConfig).buildService();
|
|
32
|
+
const integrationApi = new IntegrationApiFactory(integrationApiContext, this.userConfig, cli).buildService();
|
|
31
33
|
return await integrationApi.run();
|
|
32
34
|
}
|
|
33
35
|
getConfigApi(app) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { QueryBuilderService } from "./query-builder-service.js";
|
|
2
2
|
import { QueryBuilderFactoryContext, QueryType } from "./query-builder-model.js";
|
|
3
|
-
import { UserCliConfig } from "
|
|
3
|
+
import { CliServiceInterface, UserCliConfig } from "../cli/index.js";
|
|
4
4
|
export declare class QueryBuilderFactory {
|
|
5
5
|
private context;
|
|
6
6
|
private userConfig;
|
|
7
|
-
|
|
7
|
+
private cli?;
|
|
8
|
+
constructor(context: QueryBuilderFactoryContext, userConfig: UserCliConfig, cli?: CliServiceInterface);
|
|
8
9
|
buildService(queryType: QueryType): Promise<QueryBuilderService>;
|
|
9
10
|
private getIntegrationFiles;
|
|
10
11
|
private getSpeedKitConfig;
|
|
@@ -2,20 +2,22 @@ import { QueryBuilderService } from "./query-builder-service.js";
|
|
|
2
2
|
import { parseRuleSets } from "./rules/index.js";
|
|
3
3
|
import { IntegrationApiContext, IntegrationApiFactory, } from "../integration-api/index.js";
|
|
4
4
|
import { INTEGRATION_FILES } from "../../models/files.js";
|
|
5
|
-
import { CliServiceFactory } from "../cli/index.js";
|
|
5
|
+
import { CliServiceFactory, } from "../cli/index.js";
|
|
6
6
|
import { AthenaServiceFactory } from "../athena/index.js";
|
|
7
7
|
import { safe } from "../../helpers/safe.js";
|
|
8
8
|
import { ParseConfigSpeedKitError } from "./error/parse-config-speed-kit-error.js";
|
|
9
9
|
export class QueryBuilderFactory {
|
|
10
10
|
context;
|
|
11
11
|
userConfig;
|
|
12
|
-
|
|
12
|
+
cli;
|
|
13
|
+
constructor(context, userConfig, cli) {
|
|
13
14
|
this.context = context;
|
|
14
15
|
this.userConfig = userConfig;
|
|
16
|
+
this.cli = cli;
|
|
15
17
|
}
|
|
16
18
|
async buildService(queryType) {
|
|
17
|
-
const cli = new CliServiceFactory().getService();
|
|
18
|
-
const files = await this.getIntegrationFiles();
|
|
19
|
+
const cli = this.cli ?? new CliServiceFactory().getService();
|
|
20
|
+
const files = await this.getIntegrationFiles(cli);
|
|
19
21
|
const customerConfig = files.getCustomerConfig().config;
|
|
20
22
|
const app = customerConfig.app;
|
|
21
23
|
const origins = customerConfig.origins ?? [];
|
|
@@ -46,13 +48,13 @@ export class QueryBuilderFactory {
|
|
|
46
48
|
// The Athena service is only needed when the query is executed directly —
|
|
47
49
|
// which `--count` is, a count query being of no use as text.
|
|
48
50
|
const athenaService = this.context.execute || this.context.count
|
|
49
|
-
? await new AthenaServiceFactory(app, this.context.workgroup, this.context.catalog).getService()
|
|
51
|
+
? await new AthenaServiceFactory(app, this.context.workgroup, this.context.catalog, cli).getService()
|
|
50
52
|
: undefined;
|
|
51
53
|
return new QueryBuilderService(serviceContext, parseRuleSets(speedKitConfig), cli, athenaService);
|
|
52
54
|
}
|
|
53
|
-
async getIntegrationFiles() {
|
|
55
|
+
async getIntegrationFiles(cli) {
|
|
54
56
|
const integrationApiContext = new IntegrationApiContext(this.context.customerPath, this.context.configName, [INTEGRATION_FILES.CONFIG.SPEED_KIT]);
|
|
55
|
-
const integrationApi = new IntegrationApiFactory(integrationApiContext, this.userConfig).buildService();
|
|
57
|
+
const integrationApi = new IntegrationApiFactory(integrationApiContext, this.userConfig, cli).buildService();
|
|
56
58
|
return await integrationApi.run();
|
|
57
59
|
}
|
|
58
60
|
async getSpeedKitConfig(app, origin, speedKitConfigFile) {
|
|
@@ -4,7 +4,6 @@ import json2Csv from "json2csv";
|
|
|
4
4
|
import { QueryType } from "./query-builder-model.js";
|
|
5
5
|
import { buildParameterQuery, buildPrewarmQuery, DEFAULT_QUERY_DAYS, } from "./queries/index.js";
|
|
6
6
|
import { AthenaBucket } from "../athena/index.js";
|
|
7
|
-
import { copyToClipboard } from "../../helpers/clipboard.js";
|
|
8
7
|
import { safe } from "../../helpers/safe.js";
|
|
9
8
|
/**
|
|
10
9
|
* The notes as unique lines. Each phase of the reduction reports on its own,
|
|
@@ -66,9 +65,9 @@ export class QueryBuilderService {
|
|
|
66
65
|
// The query goes to stdout so it can be piped; an accounting the caller
|
|
67
66
|
// asked for goes next to it, on stderr.
|
|
68
67
|
if (this.context.explain) {
|
|
69
|
-
|
|
68
|
+
this.cli.note(this.reportLines(query).join("\n"));
|
|
70
69
|
}
|
|
71
|
-
|
|
70
|
+
this.cli.pipe(query.sql);
|
|
72
71
|
return;
|
|
73
72
|
}
|
|
74
73
|
this.report(query);
|
|
@@ -78,7 +77,7 @@ export class QueryBuilderService {
|
|
|
78
77
|
if (this.context.isWindows) {
|
|
79
78
|
return;
|
|
80
79
|
}
|
|
81
|
-
if (await copyToClipboard(query.sql)) {
|
|
80
|
+
if (await this.cli.copyToClipboard(query.sql)) {
|
|
82
81
|
this.cli.writeSuccess("Result has been copied to the clipboard 📋");
|
|
83
82
|
return;
|
|
84
83
|
}
|
|
@@ -214,7 +213,7 @@ export class QueryBuilderService {
|
|
|
214
213
|
}
|
|
215
214
|
if (this.context.quiet) {
|
|
216
215
|
const columns = Object.keys(rows[0]);
|
|
217
|
-
|
|
216
|
+
this.cli.pipe([
|
|
218
217
|
columns.join("\t"),
|
|
219
218
|
...rows.map((row) => columns.map((name) => row[name]).join("\t")),
|
|
220
219
|
].join("\n") + "\n");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CliConfig } from "../../helpers/cli-config.js";
|
|
2
1
|
import { QueryBuilderFactory } from "./query-builder-factory.js";
|
|
3
2
|
import { normalizeDevices } from "./queries/device.js";
|
|
3
|
+
import { CliConfig } from "../cli/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* Builds one of the config-derived queries and hands it over.
|
|
6
6
|
*
|
|
@@ -5,9 +5,9 @@ import { expect } from "chai";
|
|
|
5
5
|
import { describe, it } from "mocha";
|
|
6
6
|
import { parseRuleSets } from "../../rules/index.js";
|
|
7
7
|
import { SpeedKitConfig } from "../../../integration-api/struct/speed-kit-config.js";
|
|
8
|
-
import { buildParameterQuery } from "
|
|
9
|
-
import { buildPopsQuery } from "
|
|
10
|
-
import { buildPrewarmQuery } from "
|
|
8
|
+
import { buildParameterQuery } from "../../queries/parameter-query.js";
|
|
9
|
+
import { buildPopsQuery } from "../../queries/pops-query.js";
|
|
10
|
+
import { buildPrewarmQuery } from "../../queries/prewarm-query.js";
|
|
11
11
|
import { GOLDEN_CONFIGS } from "./golden-configs.js";
|
|
12
12
|
/**
|
|
13
13
|
* The queries these configs produce, in full, checked in beside them.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { buildPopsQuery } from "
|
|
4
|
-
import { sinceDate, today } from "
|
|
3
|
+
import { buildPopsQuery } from "../../queries/pops-query.js";
|
|
4
|
+
import { sinceDate, today } from "../../queries/query-model.js";
|
|
5
5
|
describe("buildPopsQuery", () => {
|
|
6
6
|
it("should read the request log, not the page impressions", () => {
|
|
7
7
|
const { sql } = buildPopsQuery({ app: "shop-de" });
|
|
@@ -2,9 +2,9 @@ import { expect } from "chai";
|
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
3
|
import { parseRuleSets } from "../../rules/index.js";
|
|
4
4
|
import { SpeedKitConfig, } from "../../../integration-api/struct/speed-kit-config.js";
|
|
5
|
-
import { buildParameterQuery } from "
|
|
6
|
-
import { buildPrewarmQuery } from "
|
|
7
|
-
import { sinceDate } from "
|
|
5
|
+
import { buildParameterQuery } from "../../queries/parameter-query.js";
|
|
6
|
+
import { buildPrewarmQuery } from "../../queries/prewarm-query.js";
|
|
7
|
+
import { sinceDate } from "../../queries/query-model.js";
|
|
8
8
|
function inputFor(config, options = {}) {
|
|
9
9
|
return {
|
|
10
10
|
app: "shop-de",
|
|
@@ -2,8 +2,8 @@ import { expect } from "chai";
|
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
3
|
import { parseRuleSets } from "../../rules/index.js";
|
|
4
4
|
import { SpeedKitConfig, } from "../../../integration-api/struct/speed-kit-config.js";
|
|
5
|
-
import { buildParameterQuery } from "
|
|
6
|
-
import { buildPrewarmQuery } from "
|
|
5
|
+
import { buildParameterQuery } from "../../queries/parameter-query.js";
|
|
6
|
+
import { buildPrewarmQuery } from "../../queries/prewarm-query.js";
|
|
7
7
|
/**
|
|
8
8
|
* The bugs that prompted the rework, each with the config that reported it.
|
|
9
9
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { QueryBuilderService } from "
|
|
4
|
-
import { QueryType } from "
|
|
5
|
-
import { parseRuleSets } from "
|
|
6
|
-
import { SpeedKitConfig } from "
|
|
3
|
+
import { QueryBuilderService } from "../query-builder-service.js";
|
|
4
|
+
import { QueryType } from "../query-builder-model.js";
|
|
5
|
+
import { parseRuleSets } from "../rules/index.js";
|
|
6
|
+
import { SpeedKitConfig } from "../../integration-api/struct/speed-kit-config.js";
|
|
7
7
|
/** Records the actions so a left-running spinner shows up as a missing fail. */
|
|
8
8
|
function recordingCli() {
|
|
9
9
|
const calls = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { conditionLanguage, isInside, languagesDisjoint, outsideOf, } from "
|
|
3
|
+
import { conditionLanguage, isInside, languagesDisjoint, outsideOf, } from "../../rules/pattern-language.js";
|
|
4
4
|
function condition(...patterns) {
|
|
5
5
|
return {
|
|
6
6
|
patterns: patterns.map((value) => typeof value === "string"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vm from "node:vm";
|
|
2
2
|
import { expect } from "chai";
|
|
3
3
|
import { describe, it } from "mocha";
|
|
4
|
-
import { parseCondition, parseRuleSets, parseStripQueryParams, } from "
|
|
4
|
+
import { parseCondition, parseRuleSets, parseStripQueryParams, } from "../../rules/rule-parser.js";
|
|
5
5
|
import { SpeedKitConfig, } from "../../../integration-api/struct/speed-kit-config.js";
|
|
6
6
|
/** The rule sets of a config, the way the query builder reads one. */
|
|
7
7
|
function ruleSetsOf(config) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { parseRuleSets } from "
|
|
3
|
+
import { parseRuleSets } from "../../rules/rule-parser.js";
|
|
4
4
|
import { SpeedKitConfig } from "../../../integration-api/struct/speed-kit-config.js";
|
|
5
|
-
import { absorbRules, dropUnreachableRules, findShadowedRules, reductionBudget, } from "
|
|
5
|
+
import { absorbRules, dropUnreachableRules, findShadowedRules, reductionBudget, } from "../../rules/rule-reducer.js";
|
|
6
6
|
function rulesOf(config, version = 2) {
|
|
7
7
|
return parseRuleSets(SpeedKitConfig.createFrom({ ruleSetConfig: { version }, ...config }));
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { parseRuleSets } from "
|
|
3
|
+
import { parseRuleSets } from "../../rules/rule-parser.js";
|
|
4
4
|
import { SpeedKitConfig } from "../../../integration-api/struct/speed-kit-config.js";
|
|
5
|
-
import { keepRelevantRules } from "
|
|
5
|
+
import { keepRelevantRules } from "../../rules/rule-relevance.js";
|
|
6
6
|
function blacklist(...rules) {
|
|
7
7
|
return parseRuleSets(SpeedKitConfig.createFrom({ blacklist: rules }))
|
|
8
8
|
.blacklist;
|