@speedkit/cli 4.36.0 → 4.36.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +3 -29
- package/dist/base/sk-command.d.ts +41 -0
- package/dist/base/sk-command.js +56 -0
- package/dist/commands/auto-prewarm.d.ts +6 -4
- package/dist/commands/auto-prewarm.js +13 -66
- package/dist/commands/autocomplete/fish.d.ts +2 -2
- package/dist/commands/autocomplete/fish.js +3 -2
- package/dist/commands/browser/clean.d.ts +2 -2
- package/dist/commands/browser/clean.js +6 -7
- package/dist/commands/browser/list.d.ts +2 -2
- package/dist/commands/browser/list.js +6 -8
- package/dist/commands/browser/update.d.ts +2 -2
- package/dist/commands/browser/update.js +9 -12
- package/dist/commands/bulk-deploy.d.ts +4 -2
- package/dist/commands/bulk-deploy.js +7 -37
- package/dist/commands/config/edit.d.ts +2 -2
- package/dist/commands/config/edit.js +2 -2
- package/dist/commands/config/setup.d.ts +5 -2
- package/dist/commands/config/setup.js +10 -19
- package/dist/commands/deploy.d.ts +12 -3
- package/dist/commands/deploy.js +14 -19
- package/dist/commands/diff-url-parameters.d.ts +5 -4
- package/dist/commands/diff-url-parameters.js +28 -18
- package/dist/commands/extension/add.d.ts +2 -2
- package/dist/commands/extension/add.js +6 -6
- package/dist/commands/extension/devtools.d.ts +2 -2
- package/dist/commands/extension/devtools.js +6 -7
- package/dist/commands/extension/list.d.ts +2 -2
- package/dist/commands/extension/list.js +5 -6
- package/dist/commands/extension/remove.d.ts +2 -2
- package/dist/commands/extension/remove.js +6 -6
- package/dist/commands/extension/update.d.ts +2 -2
- package/dist/commands/extension/update.js +5 -6
- package/dist/commands/find-pops.d.ts +2 -2
- package/dist/commands/find-pops.js +11 -11
- package/dist/commands/generate-customer-config.d.ts +5 -2
- package/dist/commands/generate-customer-config.js +9 -27
- package/dist/commands/generate-pop-config.d.ts +2 -2
- package/dist/commands/generate-pop-config.js +26 -26
- package/dist/commands/login.d.ts +2 -2
- package/dist/commands/login.js +6 -9
- package/dist/commands/onboarding.d.ts +18 -3
- package/dist/commands/onboarding.js +13 -11
- package/dist/commands/origin-request.d.ts +4 -2
- package/dist/commands/origin-request.js +10 -42
- package/dist/commands/prewarm.d.ts +4 -2
- package/dist/commands/prewarm.js +12 -56
- package/dist/commands/pull.d.ts +4 -2
- package/dist/commands/pull.js +9 -14
- package/dist/commands/query/parameter.d.ts +4 -2
- package/dist/commands/query/parameter.js +12 -19
- package/dist/commands/query/prewarm.d.ts +4 -2
- package/dist/commands/query/prewarm.js +16 -23
- package/dist/commands/revalidate.d.ts +4 -2
- package/dist/commands/revalidate.js +14 -56
- package/dist/commands/wpt-launcher.d.ts +2 -2
- package/dist/commands/wpt-launcher.js +17 -17
- 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 +9 -10
- 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/context.d.ts +24 -0
- package/dist/models/context.js +31 -0
- package/dist/services/athena/athena-flags.d.ts +18 -0
- package/dist/services/athena/athena-flags.js +29 -0
- package/dist/services/athena/athena-service-build-context.d.ts +25 -0
- package/dist/services/athena/athena-service-build-context.js +4 -0
- package/dist/services/athena/athena-service-factory.d.ts +3 -14
- package/dist/services/athena/athena-service-factory.js +11 -25
- package/dist/services/athena/baqend-athena-service.d.ts +3 -14
- package/dist/services/athena/baqend-athena-service.js +8 -16
- package/dist/services/athena/index.d.ts +1 -0
- package/dist/services/athena/index.js +1 -0
- 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} +4 -4
- package/dist/services/browser-fetch/browser-origin-fetch.d.ts +2 -2
- package/dist/services/browser-fetch/browser-origin-fetch.js +1 -1
- package/dist/services/browser-fetch/browser-origin-fetcher.d.ts +3 -3
- package/dist/services/browser-fetch/browser-origin-fetcher.js +5 -5
- package/dist/services/browser-fetch/{browser-origin-fetch.spec.js → spec/browser-origin-fetch.spec.js} +12 -12
- 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/services/cli/cli-environment-factory.d.ts +25 -0
- package/dist/services/cli/cli-environment-factory.js +30 -0
- package/dist/services/cli/cli-environment.d.ts +73 -0
- package/dist/services/cli/cli-environment.js +216 -0
- package/dist/services/cli/cli-service-build-context.d.ts +10 -0
- package/dist/services/cli/cli-service-build-context.js +4 -0
- package/dist/services/cli/cli-service-factory.d.ts +12 -4
- package/dist/services/cli/cli-service-factory.js +11 -9
- package/dist/services/cli/cli-service-model.d.ts +10 -6
- package/dist/services/cli/cli-service-model.js +0 -6
- package/dist/services/cli/cli-service.d.ts +52 -1
- package/dist/services/cli/cli-service.js +60 -14
- package/dist/services/cli/cli-settings.d.ts +37 -0
- package/dist/services/cli/cli-settings.js +23 -0
- 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/command-build-context.d.ts +23 -0
- package/dist/services/cli/index.d.ts +5 -0
- package/dist/services/cli/index.js +5 -0
- package/dist/services/cli/spec/cli-environment-detection.spec.js +52 -0
- package/dist/services/cli/spec/cli-environment.spec.js +125 -0
- package/dist/services/cli/{cli-service.spec.js → spec/cli-service.spec.js} +10 -20
- package/dist/services/config-api/client.d.ts +3 -3
- package/dist/services/config-api/client.js +4 -4
- package/dist/services/config-api/config-api-factory.js +3 -3
- package/dist/services/config-api/entity-manager-provider.d.ts +11 -0
- package/dist/services/config-api/{entity-manager-factory.js → entity-manager-provider.js} +7 -1
- package/dist/services/customer-config/customer-config-service-build-context.d.ts +33 -0
- package/dist/services/customer-config/customer-config-service-build-context.js +36 -0
- package/dist/services/customer-config/customer-config-service-factory.d.ts +3 -2
- package/dist/services/customer-config/customer-config-service-factory.js +5 -4
- package/dist/services/customer-config/customer-config-service.d.ts +5 -3
- package/dist/services/customer-config/customer-config-service.js +4 -3
- package/dist/services/customer-config/index.d.ts +1 -1
- package/dist/services/customer-config/index.js +1 -1
- package/dist/services/customer-config/site-analyzer/index.d.ts +4 -0
- package/dist/services/customer-config/site-analyzer/index.js +4 -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-build-context.d.ts +6 -0
- package/dist/services/customer-config/site-analyzer/site-analyzer-service-build-context.js +4 -0
- 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 +10 -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-model.d.ts +0 -25
- package/dist/services/deploy/bulk/bulk-deploy-model.js +1 -27
- package/dist/services/deploy/bulk/bulk-deploy-service-build-context.d.ts +51 -0
- package/dist/services/deploy/bulk/bulk-deploy-service-build-context.js +50 -0
- package/dist/services/deploy/bulk/bulk-deploy-service-factory.d.ts +2 -4
- package/dist/services/deploy/bulk/bulk-deploy-service-factory.js +2 -5
- package/dist/services/deploy/bulk/bulk-deploy-service.d.ts +3 -2
- package/dist/services/deploy/bulk/config-deploy-factory.d.ts +3 -3
- package/dist/services/deploy/bulk/config-deploy-factory.js +16 -8
- package/dist/services/deploy/bulk/index.d.ts +1 -0
- package/dist/services/deploy/bulk/index.js +1 -0
- package/dist/services/deploy/checks/activation/customer-approval-check.d.ts +3 -1
- package/dist/services/deploy/checks/activation/customer-approval-check.js +4 -2
- 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/checks/pre-deploy/device-detection-changed-check.d.ts +3 -1
- package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +4 -2
- package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +3 -1
- package/dist/services/deploy/checks/pre-deploy/split-change-check.js +4 -2
- package/dist/services/deploy/deploy-service-build-context.d.ts +63 -0
- package/dist/services/deploy/deploy-service-build-context.js +64 -0
- package/dist/services/deploy/deploy-service-factory.d.ts +4 -6
- package/dist/services/deploy/deploy-service-factory.js +25 -14
- 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 +6 -4
- package/dist/services/deploy/mr/base-config-reader.js +14 -13
- package/dist/services/deploy/mr/index.d.ts +1 -0
- package/dist/services/deploy/mr/index.js +1 -0
- package/dist/services/deploy/mr/merge-request-deploy-model.d.ts +0 -35
- package/dist/services/deploy/mr/merge-request-deploy-model.js +0 -34
- package/dist/services/deploy/mr/merge-request-deploy-service-build-context.d.ts +32 -0
- package/dist/services/deploy/mr/merge-request-deploy-service-build-context.js +20 -0
- package/dist/services/deploy/mr/merge-request-deploy-service-factory.d.ts +2 -4
- package/dist/services/deploy/mr/merge-request-deploy-service-factory.js +31 -10
- package/dist/services/deploy/mr/merge-request-deploy-service.d.ts +3 -2
- package/dist/services/deploy/{bulk → spec/bulk}/bulk-deploy-service.spec.js +18 -7
- 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 +9 -7
- 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 +5 -4
- 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-build-context.d.ts +14 -0
- package/dist/services/diff/diff-service-build-context.js +4 -0
- package/dist/services/diff/diff-service-factory.d.ts +4 -3
- package/dist/services/diff/diff-service-factory.js +3 -4
- 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 +2 -1
- package/dist/services/diff/index.js +2 -1
- package/dist/services/document-handler-runtime/document-handler-runtime-model.d.ts +7 -0
- package/dist/services/document-handler-runtime/document-handler-runtime-model.js +10 -0
- package/dist/services/document-handler-runtime/document-handler-runtime-service-build-context.d.ts +11 -0
- package/dist/services/document-handler-runtime/document-handler-runtime-service-build-context.js +4 -0
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +2 -2
- package/dist/services/document-handler-runtime/document-handler-server.js +2 -2
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -14
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +14 -80
- package/dist/services/document-handler-runtime/server/request.js +1 -1
- package/dist/services/document-handler-runtime/{document-handler-abort.spec.js → spec/document-handler-abort.spec.js} +2 -2
- package/dist/services/document-handler-runtime/templates/database-mock.d.ts +1 -1
- package/dist/services/document-handler-runtime/templates/database-mock.js +1 -1
- package/dist/services/git/{git-repository.spec.js → spec/git-repository.spec.js} +1 -1
- package/dist/services/integration-api/customer-config-flags.d.ts +16 -0
- package/dist/services/integration-api/customer-config-flags.js +30 -0
- package/dist/services/integration-api/handler/customer-config-handler.d.ts +2 -2
- package/dist/services/integration-api/handler/install-resource-handler.d.ts +8 -0
- package/dist/services/integration-api/handler/install-resource-handler.js +10 -1
- package/dist/services/integration-api/index.d.ts +1 -0
- package/dist/services/integration-api/index.js +1 -0
- package/dist/services/integration-api/integration-api-factory.d.ts +4 -5
- package/dist/services/integration-api/integration-api-factory.js +11 -9
- package/dist/services/integration-api/integration-api-model.d.ts +0 -9
- package/dist/services/integration-api/integration-api-model.js +0 -16
- package/dist/services/integration-api/integration-api-service-build-context.d.ts +19 -0
- package/dist/services/integration-api/integration-api-service-build-context.js +4 -0
- package/dist/services/integration-api/spec/config-plugin.spec.js +1 -1
- package/dist/services/integration-api/spec/integration-api-service.spec.js +7 -3
- package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +9 -2
- package/dist/services/integration-api/struct/config-plugin.d.ts +1 -1
- package/dist/services/integration-api/struct/config-plugin.js +12 -7
- package/dist/services/integration-api/struct/customer-config-file.js +1 -1
- package/dist/services/integration-api/struct/speed-kit-config-file.d.ts +18 -2
- package/dist/services/integration-api/struct/speed-kit-config-file.js +22 -12
- package/dist/services/integration-api/struct/speed-kit-config.d.ts +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 +3 -3
- package/dist/services/onboarding/browser/config/browser-config.js +5 -5
- package/dist/services/onboarding/browser/executable/executable-validator.d.ts +3 -4
- package/dist/services/onboarding/browser/executable/executable-validator.js +17 -15
- package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +3 -4
- package/dist/services/onboarding/browser/extension/extension-downloader.js +6 -6
- package/dist/services/onboarding/browser/extension/extension-validator.d.ts +3 -4
- package/dist/services/onboarding/browser/extension/extension-validator.js +4 -4
- 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 +3 -2
- package/dist/services/onboarding/index.d.ts +1 -1
- package/dist/services/onboarding/index.js +1 -1
- package/dist/services/onboarding/onboarding-model.d.ts +8 -24
- package/dist/services/onboarding/onboarding-model.js +19 -87
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +57 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +67 -0
- package/dist/services/onboarding/onboarding-service-factory.d.ts +2 -4
- package/dist/services/onboarding/onboarding-service-factory.js +50 -37
- 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} +13 -8
- 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/index.d.ts +1 -1
- package/dist/services/origin-request/index.js +1 -1
- package/dist/services/origin-request/origin-request-service-build-context.d.ts +52 -0
- package/dist/services/origin-request/origin-request-service-build-context.js +54 -0
- package/dist/services/origin-request/origin-request-service-factory.d.ts +2 -4
- package/dist/services/origin-request/origin-request-service-factory.js +10 -8
- package/dist/services/origin-request/origin-request-service.d.ts +3 -3
- package/dist/services/origin-request/{asset-variations.spec.js → spec/asset-variations.spec.js} +1 -1
- package/dist/services/pop-config/index.d.ts +1 -0
- package/dist/services/pop-config/index.js +1 -0
- package/dist/services/pop-config/pop-config-factory.d.ts +4 -1
- package/dist/services/pop-config/pop-config-factory.js +10 -3
- package/dist/services/pop-config/pop-config-service-build-context.d.ts +10 -0
- package/dist/services/pop-config/pop-config-service-build-context.js +4 -0
- 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 -30
- package/dist/services/prewarm/auto-pre-warm-factory.js +7 -9
- package/dist/services/prewarm/auto-pre-warm-service-build-context.d.ts +84 -0
- package/dist/services/prewarm/auto-pre-warm-service-build-context.js +68 -0
- package/dist/services/prewarm/index.d.ts +2 -0
- package/dist/services/prewarm/index.js +2 -0
- 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 +4 -3
- package/dist/services/prewarm/pre-warm-factory.js +5 -4
- package/dist/services/prewarm/pre-warm-model.d.ts +0 -10
- package/dist/services/prewarm/pre-warm-model.js +0 -18
- package/dist/services/prewarm/pre-warm-service-build-context.d.ts +47 -0
- package/dist/services/prewarm/pre-warm-service-build-context.js +64 -0
- 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/index.d.ts +1 -0
- package/dist/services/pull/index.js +1 -0
- package/dist/services/pull/pull-service-build-context.d.ts +28 -0
- package/dist/services/pull/pull-service-build-context.js +17 -0
- package/dist/services/pull/pull-service-factory.d.ts +3 -4
- package/dist/services/pull/pull-service-factory.js +11 -10
- package/dist/services/pull/pull-service-model.d.ts +0 -5
- package/dist/services/pull/pull-service-model.js +0 -9
- package/dist/services/query-builder/query-builder-factory.d.ts +9 -6
- package/dist/services/query-builder/query-builder-factory.js +24 -11
- package/dist/{models/cli-parameters.d.ts → services/query-builder/query-builder-flags.d.ts} +1 -122
- package/dist/services/query-builder/query-builder-flags.js +150 -0
- package/dist/services/query-builder/query-builder-model.d.ts +1 -14
- package/dist/services/query-builder/query-builder-service-build-context.d.ts +113 -0
- package/dist/services/query-builder/query-builder-service-build-context.js +68 -0
- package/dist/services/query-builder/query-builder-service.d.ts +3 -3
- package/dist/services/query-builder/query-builder-service.js +4 -5
- 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/{models/cli-parameters.spec.js → services/query-builder/spec/query-builder-flags.spec.js} +1 -1
- 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/index.d.ts +1 -0
- package/dist/services/revalidate/index.js +1 -0
- package/dist/services/revalidate/revalidate-factory.d.ts +3 -3
- package/dist/services/revalidate/revalidate-factory.js +1 -2
- package/dist/services/revalidate/revalidate-model.d.ts +0 -9
- package/dist/services/revalidate/revalidate-model.js +0 -8
- package/dist/services/revalidate/revalidate-service-build-context.d.ts +38 -0
- package/dist/services/revalidate/revalidate-service-build-context.js +59 -0
- 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 +3 -5
- package/dist/services/setup/browser/browser-setup-service.js +16 -18
- package/dist/services/setup/difftool/difftool-setup-service.d.ts +3 -5
- package/dist/services/setup/difftool/difftool-setup-service.js +5 -7
- package/dist/services/setup/extension/extension-installer.d.ts +1 -1
- package/dist/services/setup/extension/extension-setup-service.d.ts +3 -5
- package/dist/services/setup/extension/extension-setup-service.js +8 -10
- package/dist/services/setup/index.d.ts +1 -1
- package/dist/services/setup/index.js +1 -1
- package/dist/services/setup/setup-service-build-context.d.ts +27 -0
- package/dist/services/setup/setup-service-build-context.js +26 -0
- package/dist/services/setup/setup-service-factory.d.ts +2 -4
- package/dist/services/setup/setup-service-factory.js +10 -17
- package/dist/services/setup/setup-service.d.ts +4 -6
- package/dist/services/setup/setup-service.js +6 -7
- 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/spec/os/tool-registry.spec.d.ts +1 -0
- package/dist/services/setup/{os → spec/os}/tool-registry.spec.js +1 -1
- package/oclif.manifest.json +1 -52
- package/package.json +6 -3
- package/dist/commands/document-handler.d.ts +0 -16
- package/dist/commands/document-handler.js +0 -32
- package/dist/helpers/cli-config.d.ts +0 -59
- package/dist/helpers/cli-config.js +0 -180
- package/dist/helpers/cli-config.spec.js +0 -117
- package/dist/helpers/customer-config.d.ts +0 -45
- package/dist/helpers/customer-config.js +0 -136
- package/dist/helpers/environment.d.ts +0 -15
- package/dist/helpers/environment.js +0 -40
- package/dist/helpers/environment.spec.js +0 -28
- 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/cli-parameters.js +0 -299
- package/dist/models/install.d.ts +0 -24
- package/dist/services/config-api/entity-manager-factory.d.ts +0 -5
- package/dist/services/config-api-service.d.ts +0 -21
- package/dist/services/config-api-service.js +0 -107
- package/dist/services/customer-config/customer-config-service-context.d.ts +0 -13
- package/dist/services/customer-config/customer-config-service-context.js +0 -21
- package/dist/services/deploy/context/deploy-context.d.ts +0 -32
- package/dist/services/deploy/context/deploy-context.js +0 -72
- package/dist/services/diff/diff-model.d.ts +0 -9
- package/dist/services/diff/diff-model.js +0 -12
- package/dist/services/diff-service.d.ts +0 -27
- package/dist/services/diff-service.js +0 -116
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.d.ts +0 -24
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +0 -62
- 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/services/origin-request/origin-request-context.d.ts +0 -13
- package/dist/services/origin-request/origin-request-context.js +0 -23
- package/dist/services/query-builder/query-command.d.ts +0 -28
- package/dist/services/query-builder/query-command.js +0 -37
- package/dist/services/setup/setup-context.d.ts +0 -14
- package/dist/services/setup/setup-context.js +0 -15
- /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/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/cli-config.spec.d.ts → services/cli/command-build-context.js} +0 -0
- /package/dist/{helpers/environment.spec.d.ts → services/cli/spec/cli-environment-detection.spec.d.ts} +0 -0
- /package/dist/{models/cli-parameters.spec.d.ts → services/cli/spec/cli-environment.spec.d.ts} +0 -0
- /package/dist/services/cli/{cli-service.spec.d.ts → spec/cli-service.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-flags.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{rules/spec/pattern-language.spec.d.ts → spec/query-builder-service.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{rules/spec/rule-parser.spec.d.ts → spec/rules/pattern-language.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{rules/spec/rule-reducer.spec.d.ts → spec/rules/rule-parser.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{rules/spec/rule-relevance.spec.d.ts → spec/rules/rule-reducer.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{rules/spec/rule-to-sql.spec.d.ts → spec/rules/rule-relevance.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{rules/spec/runtime-semantics.spec.d.ts → spec/rules/rule-to-sql.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{rules/spec/strip-parameters.spec.d.ts → spec/rules/runtime-semantics.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{sql/spec/expression.spec.d.ts → spec/rules/strip-parameters.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{sql/spec/format.spec.d.ts → spec/sql/expression.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{sql/spec/predicate.spec.d.ts → spec/sql/format.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{sql/spec/regex.spec.d.ts → spec/sql/predicate.spec.d.ts} +0 -0
- /package/dist/services/{revalidate/revalidate-service.spec.d.ts → query-builder/spec/sql/regex.spec.d.ts} +0 -0
- /package/dist/services/{setup/extension/crx.spec.d.ts → revalidate/spec/revalidate-service.spec.d.ts} +0 -0
- /package/dist/services/setup/{extension/webstore.spec.d.ts → spec/extension/crx.spec.d.ts} +0 -0
- /package/dist/services/setup/{os/tool-registry.spec.d.ts → spec/extension/webstore.spec.d.ts} +0 -0
|
@@ -2,7 +2,7 @@ import { expect } from "chai";
|
|
|
2
2
|
import { after, before, describe, it } from "mocha";
|
|
3
3
|
import tls from "node:tls";
|
|
4
4
|
import { Agent, getGlobalDispatcher, setGlobalDispatcher } from "undici";
|
|
5
|
-
import hook from "
|
|
5
|
+
import hook from "../../init/http1-global-dispatcher.js";
|
|
6
6
|
describe("http1-global-dispatcher hook", () => {
|
|
7
7
|
const previousDispatcher = getGlobalDispatcher();
|
|
8
8
|
let server;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base of every build context: a class whose fields are exactly the values
|
|
3
|
+
* it is built from, taken as one object.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* export interface PullServiceBuildContextValues extends CommandContextValues {
|
|
7
|
+
* readonly customerPath: string;
|
|
8
|
+
* }
|
|
9
|
+
*
|
|
10
|
+
* export class PullServiceBuildContext extends Context<PullServiceBuildContextValues>() {
|
|
11
|
+
* static create(args, flags, environment: CliEnvironment): PullServiceBuildContext {
|
|
12
|
+
* return new PullServiceBuildContext({ environment, customerPath: args.customerPath, … });
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* The fields are declared once, in the values interface, and a caller names
|
|
18
|
+
* each value it passes, so two neighbouring booleans cannot swap places. A
|
|
19
|
+
* build context adds nothing but `static` members: its `flags`, and `create`,
|
|
20
|
+
* which maps a command's input onto the values. It carries the invocation's
|
|
21
|
+
* environment (`CommandContextValues`, in services/cli) and is named after the
|
|
22
|
+
* service it builds: `<Service>BuildContext`. See docs/architecture.md.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Context<Values extends object>(): new (values: Values) => Readonly<Values>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base of every build context: a class whose fields are exactly the values
|
|
3
|
+
* it is built from, taken as one object.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* export interface PullServiceBuildContextValues extends CommandContextValues {
|
|
7
|
+
* readonly customerPath: string;
|
|
8
|
+
* }
|
|
9
|
+
*
|
|
10
|
+
* export class PullServiceBuildContext extends Context<PullServiceBuildContextValues>() {
|
|
11
|
+
* static create(args, flags, environment: CliEnvironment): PullServiceBuildContext {
|
|
12
|
+
* return new PullServiceBuildContext({ environment, customerPath: args.customerPath, … });
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* The fields are declared once, in the values interface, and a caller names
|
|
18
|
+
* each value it passes, so two neighbouring booleans cannot swap places. A
|
|
19
|
+
* build context adds nothing but `static` members: its `flags`, and `create`,
|
|
20
|
+
* which maps a command's input onto the values. It carries the invocation's
|
|
21
|
+
* environment (`CommandContextValues`, in services/cli) and is named after the
|
|
22
|
+
* service it builds: `<Service>BuildContext`. See docs/architecture.md.
|
|
23
|
+
*/
|
|
24
|
+
export function Context() {
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class -- the base of every context: it only copies the values in
|
|
26
|
+
return class {
|
|
27
|
+
constructor(values) {
|
|
28
|
+
Object.assign(this, values);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The flags that say where an Athena query runs. */
|
|
2
|
+
/**
|
|
3
|
+
* Where a query that is executed actually runs.
|
|
4
|
+
*
|
|
5
|
+
* The catalog is the account's, not the query's: our own logins reach the rum
|
|
6
|
+
* tables under `live`, while a role scoped to one account reaches the same
|
|
7
|
+
* tables under `AwsDataCatalog`. `SK_ATHENA_CATALOG` lets a CI job say so once.
|
|
8
|
+
*
|
|
9
|
+
* Athena resolves the account's default workgroup when none is named, which is
|
|
10
|
+
* only right where the credentials are allowed to use it — a role scoped to one
|
|
11
|
+
* workgroup is refused on any other, and the result location is a workgroup
|
|
12
|
+
* setting too. `SK_ATHENA_WORKGROUP` lets a CI job set it once for every
|
|
13
|
+
* command in the job.
|
|
14
|
+
*/
|
|
15
|
+
export declare const CLI_ATHENA: {
|
|
16
|
+
catalog: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
workgroup: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { DEFAULT_ATHENA_CATALOG } from "./athena-service-model.js";
|
|
3
|
+
/** The flags that say where an Athena query runs. */
|
|
4
|
+
/**
|
|
5
|
+
* Where a query that is executed actually runs.
|
|
6
|
+
*
|
|
7
|
+
* The catalog is the account's, not the query's: our own logins reach the rum
|
|
8
|
+
* tables under `live`, while a role scoped to one account reaches the same
|
|
9
|
+
* tables under `AwsDataCatalog`. `SK_ATHENA_CATALOG` lets a CI job say so once.
|
|
10
|
+
*
|
|
11
|
+
* Athena resolves the account's default workgroup when none is named, which is
|
|
12
|
+
* only right where the credentials are allowed to use it — a role scoped to one
|
|
13
|
+
* workgroup is refused on any other, and the result location is a workgroup
|
|
14
|
+
* setting too. `SK_ATHENA_WORKGROUP` lets a CI job set it once for every
|
|
15
|
+
* command in the job.
|
|
16
|
+
*/
|
|
17
|
+
export const CLI_ATHENA = {
|
|
18
|
+
catalog: Flags.string({
|
|
19
|
+
default: DEFAULT_ATHENA_CATALOG,
|
|
20
|
+
description: "Athena data catalog holding the rum tables. Names the catalog both in the query and in the context it runs in, so the two always agree",
|
|
21
|
+
env: "SK_ATHENA_CATALOG",
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
workgroup: Flags.string({
|
|
25
|
+
description: "Athena workgroup to run the query in, e.g. 'prewarming'. Defaults to the account's default workgroup",
|
|
26
|
+
env: "SK_ATHENA_WORKGROUP",
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CommandContextValues } from "../cli/index.js";
|
|
2
|
+
export interface AthenaServiceBuildContextValues extends CommandContextValues {
|
|
3
|
+
/**
|
|
4
|
+
* The app to query. Enables the Baqend native query path (app token only) as
|
|
5
|
+
* a fallback when no AWS login is present. Without it, only the AWS path is
|
|
6
|
+
* available.
|
|
7
|
+
*/
|
|
8
|
+
readonly app?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Athena workgroup for the AWS path. The Baqend path has no such notion, so
|
|
11
|
+
* it is ignored there.
|
|
12
|
+
*/
|
|
13
|
+
readonly workgroup?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The data catalog the tables live in. The Baqend path is told so it can
|
|
16
|
+
* recognise the prefix, not so it can use it: the server resolves the
|
|
17
|
+
* catalog itself.
|
|
18
|
+
*/
|
|
19
|
+
readonly catalog?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const AthenaServiceBuildContext_base: new (values: AthenaServiceBuildContextValues) => Readonly<AthenaServiceBuildContextValues>;
|
|
22
|
+
/** Which app, workgroup and catalog an Athena query goes to. */
|
|
23
|
+
export declare class AthenaServiceBuildContext extends AthenaServiceBuildContext_base {
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
+
import { AthenaServiceBuildContext } from "./athena-service-build-context.js";
|
|
1
2
|
import { AthenaService } from "./athena-query-service.js";
|
|
2
3
|
export declare class AthenaServiceFactory {
|
|
3
|
-
private
|
|
4
|
-
private workgroup?;
|
|
5
|
-
private catalog?;
|
|
4
|
+
private readonly context;
|
|
6
5
|
service?: AthenaService;
|
|
7
|
-
|
|
8
|
-
* @param app - the app to query. Enables the Baqend native query path (app
|
|
9
|
-
* token only) as a fallback when no AWS login is present. Without it, only
|
|
10
|
-
* the AWS path is available.
|
|
11
|
-
* @param workgroup - Athena workgroup for the AWS path. The Baqend path has
|
|
12
|
-
* no such notion, so it is ignored there.
|
|
13
|
-
* @param catalog - the data catalog the tables live in. The Baqend path is
|
|
14
|
-
* told so it can recognise the prefix, not so it can use it: the server
|
|
15
|
-
* resolves the catalog itself.
|
|
16
|
-
*/
|
|
17
|
-
constructor(app?: string, workgroup?: string, catalog?: string);
|
|
6
|
+
constructor(context: AthenaServiceBuildContext);
|
|
18
7
|
getService(): Promise<AthenaService>;
|
|
19
8
|
/**
|
|
20
9
|
* Prefer direct AWS Athena whenever AWS credentials are present — they
|
|
@@ -1,30 +1,15 @@
|
|
|
1
1
|
import { AthenaClient } from "@aws-sdk/client-athena";
|
|
2
2
|
import { safe } from "../../helpers/safe.js";
|
|
3
|
-
import { CliServiceFactory } from "../cli/index.js";
|
|
4
3
|
import { ATHENA_CONFIG } from "./athena-service-model.js";
|
|
5
4
|
import { FetchCredentialsError } from "./error/fetch-credentials-error.js";
|
|
6
5
|
import { AwsAthenaService } from "./athena-service.js";
|
|
7
6
|
import { BaqendAthenaService } from "./baqend-athena-service.js";
|
|
8
|
-
import {
|
|
7
|
+
import { EntityManagerProvider } from "../config-api/entity-manager-provider.js";
|
|
9
8
|
export class AthenaServiceFactory {
|
|
10
|
-
|
|
11
|
-
workgroup;
|
|
12
|
-
catalog;
|
|
9
|
+
context;
|
|
13
10
|
service;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* token only) as a fallback when no AWS login is present. Without it, only
|
|
17
|
-
* the AWS path is available.
|
|
18
|
-
* @param workgroup - Athena workgroup for the AWS path. The Baqend path has
|
|
19
|
-
* no such notion, so it is ignored there.
|
|
20
|
-
* @param catalog - the data catalog the tables live in. The Baqend path is
|
|
21
|
-
* told so it can recognise the prefix, not so it can use it: the server
|
|
22
|
-
* resolves the catalog itself.
|
|
23
|
-
*/
|
|
24
|
-
constructor(app, workgroup, catalog) {
|
|
25
|
-
this.app = app;
|
|
26
|
-
this.workgroup = workgroup;
|
|
27
|
-
this.catalog = catalog;
|
|
11
|
+
constructor(context) {
|
|
12
|
+
this.context = context;
|
|
28
13
|
}
|
|
29
14
|
async getService() {
|
|
30
15
|
if (!this.service) {
|
|
@@ -39,16 +24,17 @@ export class AthenaServiceFactory {
|
|
|
39
24
|
* path (which needs an `app`).
|
|
40
25
|
*/
|
|
41
26
|
async createService() {
|
|
42
|
-
const cli =
|
|
27
|
+
const cli = this.context.environment.cli;
|
|
28
|
+
const { app, workgroup, catalog } = this.context;
|
|
43
29
|
const client = await this.tryGetAthenaClient();
|
|
44
30
|
if (client) {
|
|
45
|
-
cli.comment(
|
|
46
|
-
? `Using AWS credentials for Athena queries, workgroup ${
|
|
31
|
+
cli.comment(workgroup
|
|
32
|
+
? `Using AWS credentials for Athena queries, workgroup ${workgroup}.`
|
|
47
33
|
: "Using AWS credentials for Athena queries.");
|
|
48
|
-
return new AwsAthenaService(client, cli,
|
|
34
|
+
return new AwsAthenaService(client, cli, workgroup, catalog);
|
|
49
35
|
}
|
|
50
|
-
if (
|
|
51
|
-
return new BaqendAthenaService(
|
|
36
|
+
if (app) {
|
|
37
|
+
return new BaqendAthenaService(app, new EntityManagerProvider(), cli, catalog);
|
|
52
38
|
}
|
|
53
39
|
throw new FetchCredentialsError("Cannot send Athena queries: no AWS credentials found and no app given for the Baqend API.");
|
|
54
40
|
}
|
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
import { AthenaBucket, AthenaParameter, AthenaService } from "./athena-query-service.js";
|
|
2
|
-
import {
|
|
2
|
+
import { EntityManagerProvider } from "../config-api/entity-manager-provider.js";
|
|
3
3
|
import { CliServiceInterface } from "../cli/index.js";
|
|
4
|
-
/**
|
|
5
|
-
* Runs Athena SQL through the Baqend API, authenticated by the app token only
|
|
6
|
-
* (no AWS login). Hits the native query path via
|
|
7
|
-
* `db["<bucket>"].executeQuery(sql, triggeredBy, ttl)`.
|
|
8
|
-
*
|
|
9
|
-
* Two normalizations vs the AWS path:
|
|
10
|
-
* - `?` placeholders are inlined (the native path has no parameter binding).
|
|
11
|
-
* - the catalog prefix is stripped — the server derives catalog and database
|
|
12
|
-
* itself, and a 3-part `<catalog>.<db>.<table>` reference fails there
|
|
13
|
-
* (verified against a live app), whereas 2-part `<db>.<table>` works.
|
|
14
|
-
*/
|
|
15
4
|
export declare class BaqendAthenaService implements AthenaService {
|
|
16
5
|
private app;
|
|
17
|
-
private
|
|
6
|
+
private entityManagerProvider;
|
|
18
7
|
private cli;
|
|
19
8
|
private static readonly TRIGGERED_BY;
|
|
20
9
|
/** A catalog qualifier in front of a `<db>.<table>` reference. */
|
|
21
10
|
private readonly catalogPrefix;
|
|
22
11
|
/** The catalog whose qualifier has to come back out of the query. */
|
|
23
12
|
private readonly catalog;
|
|
24
|
-
constructor(app: string,
|
|
13
|
+
constructor(app: string, entityManagerProvider: EntityManagerProvider, cli: CliServiceInterface,
|
|
25
14
|
/**
|
|
26
15
|
* The catalog the queries name. Whichever one the caller runs under, the
|
|
27
16
|
* prefix has to come back out here — so the name is read rather than
|
|
@@ -4,27 +4,16 @@ import { safe } from "../../helpers/safe.js";
|
|
|
4
4
|
function escapeRegExp(value) {
|
|
5
5
|
return value.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw `\$&`);
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Runs Athena SQL through the Baqend API, authenticated by the app token only
|
|
9
|
-
* (no AWS login). Hits the native query path via
|
|
10
|
-
* `db["<bucket>"].executeQuery(sql, triggeredBy, ttl)`.
|
|
11
|
-
*
|
|
12
|
-
* Two normalizations vs the AWS path:
|
|
13
|
-
* - `?` placeholders are inlined (the native path has no parameter binding).
|
|
14
|
-
* - the catalog prefix is stripped — the server derives catalog and database
|
|
15
|
-
* itself, and a 3-part `<catalog>.<db>.<table>` reference fails there
|
|
16
|
-
* (verified against a live app), whereas 2-part `<db>.<table>` works.
|
|
17
|
-
*/
|
|
18
7
|
export class BaqendAthenaService {
|
|
19
8
|
app;
|
|
20
|
-
|
|
9
|
+
entityManagerProvider;
|
|
21
10
|
cli;
|
|
22
11
|
static TRIGGERED_BY = "speed-kit-cli";
|
|
23
12
|
/** A catalog qualifier in front of a `<db>.<table>` reference. */
|
|
24
13
|
catalogPrefix;
|
|
25
14
|
/** The catalog whose qualifier has to come back out of the query. */
|
|
26
15
|
catalog;
|
|
27
|
-
constructor(app,
|
|
16
|
+
constructor(app, entityManagerProvider, cli,
|
|
28
17
|
/**
|
|
29
18
|
* The catalog the queries name. Whichever one the caller runs under, the
|
|
30
19
|
* prefix has to come back out here — so the name is read rather than
|
|
@@ -32,7 +21,7 @@ export class BaqendAthenaService {
|
|
|
32
21
|
*/
|
|
33
22
|
catalog) {
|
|
34
23
|
this.app = app;
|
|
35
|
-
this.
|
|
24
|
+
this.entityManagerProvider = entityManagerProvider;
|
|
36
25
|
this.cli = cli;
|
|
37
26
|
this.catalog = athenaCatalog(catalog);
|
|
38
27
|
this.catalogPrefix = new RegExp(`^${escapeRegExp(this.catalog)}\\.[a-z_]\\w*\\.[a-z_]`, "i");
|
|
@@ -42,10 +31,13 @@ export class BaqendAthenaService {
|
|
|
42
31
|
throw new Error("BaqendAthenaService.getResult requires a bucket to target");
|
|
43
32
|
}
|
|
44
33
|
this.cli.startAction("ATHENA:QUERY", "execute athena query via baqend");
|
|
45
|
-
const db = await this.
|
|
34
|
+
const db = await this.entityManagerProvider.getEntityManager(this.app);
|
|
46
35
|
const sql = this.prepareQuery(query, parameters);
|
|
47
36
|
const ttl = `${maxAgeInMinutes}m`;
|
|
48
|
-
|
|
37
|
+
// The bucket entities are not in the SDK's types: an app has the ones its
|
|
38
|
+
// schema declares.
|
|
39
|
+
const entity = db[bucket];
|
|
40
|
+
const result = await safe(entity.executeQuery(sql, BaqendAthenaService.TRIGGERED_BY, ttl));
|
|
49
41
|
if (result.success === true) {
|
|
50
42
|
this.cli.successAction("ATHENA:QUERY");
|
|
51
43
|
return result.data;
|
|
@@ -2,5 +2,6 @@ export * from "./athena-query-service.js";
|
|
|
2
2
|
export * from "./athena-service.js";
|
|
3
3
|
export * from "./baqend-athena-service.js";
|
|
4
4
|
export * from "./athena-service-factory.js";
|
|
5
|
+
export * from "./athena-service-build-context.js";
|
|
5
6
|
export * from "./athena-service-model.js";
|
|
6
7
|
export * from "./error/fetch-credentials-error.js";
|
|
@@ -2,5 +2,6 @@ export * from "./athena-query-service.js";
|
|
|
2
2
|
export * from "./athena-service.js";
|
|
3
3
|
export * from "./baqend-athena-service.js";
|
|
4
4
|
export * from "./athena-service-factory.js";
|
|
5
|
+
export * from "./athena-service-build-context.js";
|
|
5
6
|
export * from "./athena-service-model.js";
|
|
6
7
|
export * from "./error/fetch-credentials-error.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GetQueryResultsCommand, StartQueryExecutionCommand, } from "@aws-sdk/client-athena";
|
|
2
2
|
import { expect } from "chai";
|
|
3
3
|
import { describe, it } from "mocha";
|
|
4
|
-
import { AwsAthenaService } from "
|
|
4
|
+
import { AwsAthenaService } from "../athena-service.js";
|
|
5
5
|
/** The cli calls the service makes, in the order it made them. */
|
|
6
6
|
function recordingCli() {
|
|
7
7
|
const calls = [];
|
package/dist/services/athena/{baqend-athena-service.spec.js → spec/baqend-athena-service.spec.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { AthenaBucket } from "
|
|
4
|
-
import { BaqendAthenaService } from "
|
|
3
|
+
import { AthenaBucket } from "../athena-query-service.js";
|
|
4
|
+
import { BaqendAthenaService } from "../baqend-athena-service.js";
|
|
5
5
|
const cli = {
|
|
6
6
|
failAction: () => undefined,
|
|
7
7
|
startAction: () => undefined,
|
|
@@ -9,7 +9,7 @@ const cli = {
|
|
|
9
9
|
writeError: () => undefined,
|
|
10
10
|
};
|
|
11
11
|
/** An entity manager that records the sql it was asked to run. */
|
|
12
|
-
function
|
|
12
|
+
function providerCapturing(sent) {
|
|
13
13
|
return {
|
|
14
14
|
getEntityManager: async () => ({
|
|
15
15
|
[AthenaBucket.RumPi]: {
|
|
@@ -24,7 +24,7 @@ function factoryCapturing(sent) {
|
|
|
24
24
|
/** The sql that reached the Baqend API for a query run under `catalog`. */
|
|
25
25
|
async function sentFor(query, catalog) {
|
|
26
26
|
const sent = [];
|
|
27
|
-
const service = new BaqendAthenaService("shop-de",
|
|
27
|
+
const service = new BaqendAthenaService("shop-de", providerCapturing(sent), cli, catalog);
|
|
28
28
|
await service.getResult(query, [], 60, AthenaBucket.RumPi);
|
|
29
29
|
return sent[0];
|
|
30
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CliEnvironment } from "../cli/index.js";
|
|
2
2
|
import { directOriginFetch } from "../../helpers/origin-proxy.js";
|
|
3
3
|
import { BrowserFetchLogger, BrowserOriginFetcher } from "./browser-origin-fetcher.js";
|
|
4
4
|
/**
|
|
@@ -17,7 +17,7 @@ export interface BrowserOriginFetchHandle {
|
|
|
17
17
|
close(): Promise<void>;
|
|
18
18
|
}
|
|
19
19
|
export interface BrowserOriginFetchOptions {
|
|
20
|
-
|
|
20
|
+
environment: CliEnvironment;
|
|
21
21
|
logger?: BrowserFetchLogger;
|
|
22
22
|
mode?: BrowserFetchMode;
|
|
23
23
|
/**
|
|
@@ -18,7 +18,7 @@ export function installBrowserOriginFetch(options) {
|
|
|
18
18
|
const mode = options.mode ?? "auto";
|
|
19
19
|
const direct = options.direct ?? directOriginFetch;
|
|
20
20
|
const fetcher = options.fetcher ??
|
|
21
|
-
new BrowserOriginFetcher(options.
|
|
21
|
+
new BrowserOriginFetcher(options.environment, options.logger);
|
|
22
22
|
/** Hosts a network fetch was refused by, which the browser serves from then on. */
|
|
23
23
|
const browserHosts = new Set();
|
|
24
24
|
const transport = async (url, init, fetchOptions) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Frame, HTTPRequest } from "puppeteer";
|
|
2
|
-
import {
|
|
2
|
+
import { CliEnvironment } from "../cli/index.js";
|
|
3
3
|
import { OriginFetchOptions } from "../../helpers/origin-proxy.js";
|
|
4
4
|
/** Only the writers this fetcher uses, so it does not depend on the whole CLI service. */
|
|
5
5
|
export interface BrowserFetchLogger {
|
|
@@ -45,7 +45,7 @@ export declare function isDocumentRequest(request: Pick<HTTPRequest, "isNavigati
|
|
|
45
45
|
* the access this fetcher exists to get. See `device-emulation.ts`.
|
|
46
46
|
*/
|
|
47
47
|
export declare class BrowserOriginFetcher {
|
|
48
|
-
private readonly
|
|
48
|
+
private readonly environment;
|
|
49
49
|
private readonly logger?;
|
|
50
50
|
private readonly navigationTimeout;
|
|
51
51
|
private browser?;
|
|
@@ -69,7 +69,7 @@ export declare class BrowserOriginFetcher {
|
|
|
69
69
|
private profile?;
|
|
70
70
|
/** When the session was last thrown away, so recovery cannot run per request. */
|
|
71
71
|
private lastRecycle;
|
|
72
|
-
constructor(
|
|
72
|
+
constructor(environment: CliEnvironment, logger?: BrowserFetchLogger, navigationTimeout?: number);
|
|
73
73
|
/**
|
|
74
74
|
* Fetches one origin URL through the browser.
|
|
75
75
|
*
|
|
@@ -105,7 +105,7 @@ export function isDocumentRequest(request, mainFrame) {
|
|
|
105
105
|
* the access this fetcher exists to get. See `device-emulation.ts`.
|
|
106
106
|
*/
|
|
107
107
|
export class BrowserOriginFetcher {
|
|
108
|
-
|
|
108
|
+
environment;
|
|
109
109
|
logger;
|
|
110
110
|
navigationTimeout;
|
|
111
111
|
browser;
|
|
@@ -129,8 +129,8 @@ export class BrowserOriginFetcher {
|
|
|
129
129
|
profile;
|
|
130
130
|
/** When the session was last thrown away, so recovery cannot run per request. */
|
|
131
131
|
lastRecycle = 0;
|
|
132
|
-
constructor(
|
|
133
|
-
this.
|
|
132
|
+
constructor(environment, logger, navigationTimeout = DEFAULT_NAVIGATION_TIMEOUT) {
|
|
133
|
+
this.environment = environment;
|
|
134
134
|
this.logger = logger;
|
|
135
135
|
this.navigationTimeout = navigationTimeout;
|
|
136
136
|
}
|
|
@@ -472,7 +472,7 @@ export class BrowserOriginFetcher {
|
|
|
472
472
|
const proxy = currentOriginProxy();
|
|
473
473
|
const browser = await puppeteer.launch({
|
|
474
474
|
headless: true,
|
|
475
|
-
executablePath: path.resolve(this.
|
|
475
|
+
executablePath: path.resolve(this.environment.settings.chromePath),
|
|
476
476
|
defaultViewport: null,
|
|
477
477
|
acceptInsecureCerts: true,
|
|
478
478
|
timeout: this.navigationTimeout,
|
|
@@ -500,7 +500,7 @@ export class BrowserOriginFetcher {
|
|
|
500
500
|
* once, and one must not delete the profile the other is holding open.
|
|
501
501
|
*/
|
|
502
502
|
async createProfile() {
|
|
503
|
-
const parent = path.resolve(this.
|
|
503
|
+
const parent = path.resolve(this.environment.cacheDir, PROFILE_FOLDER);
|
|
504
504
|
mkdirSync(parent, { recursive: true });
|
|
505
505
|
this.pruneProfiles(parent);
|
|
506
506
|
return mkdtemp(path.join(parent, "profile-"));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
3
|
-
import { originFetch, resetOriginProxy, setOriginFetchTransport, } from "
|
|
4
|
-
import { installBrowserOriginFetch, } from "
|
|
3
|
+
import { originFetch, resetOriginProxy, setOriginFetchTransport, } from "../../../helpers/origin-proxy.js";
|
|
4
|
+
import { installBrowserOriginFetch, } from "../browser-origin-fetch.js";
|
|
5
5
|
/** Records what each leg was asked for, so the policy can be asserted on the calls it made. */
|
|
6
6
|
class FetchLog {
|
|
7
7
|
direct = [];
|
|
@@ -22,7 +22,7 @@ const logger = {
|
|
|
22
22
|
comment: () => undefined,
|
|
23
23
|
};
|
|
24
24
|
/** The fetcher is always stubbed in these specs, so no Chrome is ever launched from them. */
|
|
25
|
-
const
|
|
25
|
+
const environment = {};
|
|
26
26
|
describe("installBrowserOriginFetch", () => {
|
|
27
27
|
let handle;
|
|
28
28
|
let log;
|
|
@@ -39,7 +39,7 @@ describe("installBrowserOriginFetch", () => {
|
|
|
39
39
|
describe("auto mode", () => {
|
|
40
40
|
it("leaves an origin that answers on the network alone", async () => {
|
|
41
41
|
handle = installBrowserOriginFetch({
|
|
42
|
-
|
|
42
|
+
environment,
|
|
43
43
|
logger,
|
|
44
44
|
fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
|
|
45
45
|
direct: (url) => {
|
|
@@ -53,7 +53,7 @@ describe("installBrowserOriginFetch", () => {
|
|
|
53
53
|
});
|
|
54
54
|
it("retries through the browser once the origin refuses the request", async () => {
|
|
55
55
|
handle = installBrowserOriginFetch({
|
|
56
|
-
|
|
56
|
+
environment,
|
|
57
57
|
logger,
|
|
58
58
|
fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
|
|
59
59
|
direct: (url) => {
|
|
@@ -67,7 +67,7 @@ describe("installBrowserOriginFetch", () => {
|
|
|
67
67
|
});
|
|
68
68
|
it("keeps a refused host on the browser, instead of paying for the network leg again", async () => {
|
|
69
69
|
handle = installBrowserOriginFetch({
|
|
70
|
-
|
|
70
|
+
environment,
|
|
71
71
|
logger,
|
|
72
72
|
fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
|
|
73
73
|
direct: (url) => {
|
|
@@ -85,7 +85,7 @@ describe("installBrowserOriginFetch", () => {
|
|
|
85
85
|
});
|
|
86
86
|
it("leaves another host on the network, because only the refused one is rerouted", async () => {
|
|
87
87
|
handle = installBrowserOriginFetch({
|
|
88
|
-
|
|
88
|
+
environment,
|
|
89
89
|
logger,
|
|
90
90
|
fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
|
|
91
91
|
direct: (url) => {
|
|
@@ -101,7 +101,7 @@ describe("installBrowserOriginFetch", () => {
|
|
|
101
101
|
});
|
|
102
102
|
it("does not reroute an ordinary origin error", async () => {
|
|
103
103
|
handle = installBrowserOriginFetch({
|
|
104
|
-
|
|
104
|
+
environment,
|
|
105
105
|
logger,
|
|
106
106
|
fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
|
|
107
107
|
direct: () => Promise.resolve(new Response("gone", { status: 404 })),
|
|
@@ -112,7 +112,7 @@ describe("installBrowserOriginFetch", () => {
|
|
|
112
112
|
});
|
|
113
113
|
it("answers the refusal when the browser cannot reach the origin either", async () => {
|
|
114
114
|
handle = installBrowserOriginFetch({
|
|
115
|
-
|
|
115
|
+
environment,
|
|
116
116
|
logger,
|
|
117
117
|
fetcher: stubFetcher(log, () => Promise.reject(new Error("navigation timeout"))),
|
|
118
118
|
direct: () => Promise.resolve(new Response("blocked", { status: 403 })),
|
|
@@ -126,7 +126,7 @@ describe("installBrowserOriginFetch", () => {
|
|
|
126
126
|
describe("always mode", () => {
|
|
127
127
|
it("sends the first request through the browser", async () => {
|
|
128
128
|
handle = installBrowserOriginFetch({
|
|
129
|
-
|
|
129
|
+
environment,
|
|
130
130
|
logger,
|
|
131
131
|
mode: "always",
|
|
132
132
|
fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
|
|
@@ -141,7 +141,7 @@ describe("installBrowserOriginFetch", () => {
|
|
|
141
141
|
});
|
|
142
142
|
it("falls back to the network when the browser fails", async () => {
|
|
143
143
|
handle = installBrowserOriginFetch({
|
|
144
|
-
|
|
144
|
+
environment,
|
|
145
145
|
logger,
|
|
146
146
|
mode: "always",
|
|
147
147
|
fetcher: stubFetcher(log, () => Promise.reject(new Error("no chrome"))),
|
|
@@ -157,7 +157,7 @@ describe("installBrowserOriginFetch", () => {
|
|
|
157
157
|
});
|
|
158
158
|
it("restores the direct transport when the handle is closed", async () => {
|
|
159
159
|
const installed = installBrowserOriginFetch({
|
|
160
|
-
|
|
160
|
+
environment,
|
|
161
161
|
logger,
|
|
162
162
|
mode: "always",
|
|
163
163
|
fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { isDocumentRequest } from "
|
|
3
|
+
import { isDocumentRequest } from "../browser-origin-fetcher.js";
|
|
4
4
|
const mainFrame = { name: "main" };
|
|
5
5
|
const childFrame = { name: "child" };
|
|
6
6
|
function request(isNavigation, frame) {
|
package/dist/services/browser-fetch/{browser-response.spec.js → spec/browser-response.spec.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { toFetchResponse, toPlainHeaders } from "
|
|
3
|
+
import { toFetchResponse, toPlainHeaders } from "../browser-response.js";
|
|
4
4
|
/**
|
|
5
5
|
* The four accessors `toFetchResponse` reads. Chrome reports repeated headers newline-joined in a
|
|
6
6
|
* flat map, which is the shape this stands in for.
|
package/dist/services/browser-fetch/{device-emulation.spec.js → spec/device-emulation.spec.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { DEFAULT_USER_AGENT, MOBILE_USER_AGENT, TABLET_USER_AGENT, } from "
|
|
4
|
-
import { deviceEmulation, deviceForUserAgent, isSpeedKitUserAgent, } from "
|
|
3
|
+
import { DEFAULT_USER_AGENT, MOBILE_USER_AGENT, TABLET_USER_AGENT, } from "../../origin-request/asset-variations.js";
|
|
4
|
+
import { deviceEmulation, deviceForUserAgent, isSpeedKitUserAgent, } from "../device-emulation.js";
|
|
5
5
|
const CHROME_VERSION = "Chrome/146.0.7680.165";
|
|
6
6
|
describe("deviceForUserAgent", () => {
|
|
7
7
|
it("maps the three user agents of the Asset API's device variations", () => {
|
|
@@ -3,7 +3,7 @@ import { after, before, describe, it } from "mocha";
|
|
|
3
3
|
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { join } from "node:path";
|
|
6
|
-
import { BundleService } from "
|
|
6
|
+
import { BundleService } from "../bundle-service.js";
|
|
7
7
|
describe("BundleService resolve fallback", () => {
|
|
8
8
|
const bundleWithFallback = (source, fallback, moduleDiscoveryDir = process.cwd()) => new BundleService(moduleDiscoveryDir).bundle({
|
|
9
9
|
entryPoints: { "handler.js": source },
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Config } from "@oclif/core";
|
|
2
|
+
import { CliEnvironment } from "./cli-environment.js";
|
|
3
|
+
export interface CliEnvironmentOptions {
|
|
4
|
+
/** The customer the command works on, for its documentHandler's node modules. */
|
|
5
|
+
readonly customerPath?: string;
|
|
6
|
+
/** Keep the CLI to what `--quiet` allows: no spinners, default answers. */
|
|
7
|
+
readonly quiet?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Builds the environment of one invocation, with its one CLI.
|
|
11
|
+
*
|
|
12
|
+
* The CLI asks the environment whether it runs in CI and whether it may prompt,
|
|
13
|
+
* and the environment hands the CLI out, so the settings are loaded first, the
|
|
14
|
+
* CLI is built against them, and only then is the environment complete.
|
|
15
|
+
*/
|
|
16
|
+
export declare class CliEnvironmentFactory {
|
|
17
|
+
private readonly oclif;
|
|
18
|
+
private readonly options;
|
|
19
|
+
/**
|
|
20
|
+
* @param oclif the oclif config of the running command
|
|
21
|
+
* @param options what the command knows about its invocation
|
|
22
|
+
*/
|
|
23
|
+
constructor(oclif: Config, options?: CliEnvironmentOptions);
|
|
24
|
+
buildEnvironment(): CliEnvironment;
|
|
25
|
+
}
|