@speedkit/cli 4.36.1 → 4.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +12 -5
- 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 -6
- package/dist/commands/browser/list.d.ts +2 -2
- package/dist/commands/browser/list.js +6 -7
- package/dist/commands/browser/update.d.ts +2 -2
- package/dist/commands/browser/update.js +9 -11
- 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 +9 -19
- package/dist/commands/deploy.d.ts +12 -3
- package/dist/commands/deploy.js +14 -20
- package/dist/commands/diff-url-parameters.d.ts +3 -2
- package/dist/commands/diff-url-parameters.js +19 -16
- 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 +10 -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 +19 -15
- package/dist/commands/login.d.ts +2 -2
- package/dist/commands/login.js +6 -9
- package/dist/commands/onboarding.d.ts +19 -3
- package/dist/commands/onboarding.js +15 -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 +13 -56
- package/dist/commands/wpt-launcher.d.ts +2 -2
- package/dist/commands/wpt-launcher.js +16 -17
- package/dist/hooks/init/first-run.js +9 -10
- 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 -16
- package/dist/services/athena/athena-service-factory.js +11 -27
- 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/spec/baqend-athena-service.spec.js +2 -2
- 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/spec/browser-origin-fetch.spec.js +10 -10
- 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 +7 -7
- package/dist/services/cli/cli-service-factory.js +7 -7
- package/dist/services/cli/cli-service-model.d.ts +0 -4
- package/dist/services/cli/cli-service-model.js +0 -6
- package/dist/services/cli/cli-service.d.ts +16 -2
- package/dist/services/cli/cli-service.js +17 -18
- package/dist/services/cli/cli-settings.d.ts +37 -0
- package/dist/services/cli/cli-settings.js +23 -0
- package/dist/services/cli/command-build-context.d.ts +23 -0
- package/dist/services/cli/index.d.ts +5 -1
- package/dist/services/cli/index.js +5 -1
- 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/spec/cli-service.spec.js +9 -19
- 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 -4
- package/dist/services/customer-config/customer-config-service-factory.js +5 -8
- package/dist/services/customer-config/customer-config-service.d.ts +2 -2
- 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 +1 -0
- package/dist/services/customer-config/site-analyzer/index.js +1 -0
- 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 +3 -3
- package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.js +4 -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/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 +5 -8
- package/dist/services/deploy/deploy-service-factory.js +28 -19
- package/dist/services/deploy/mr/base-config-reader.d.ts +6 -4
- package/dist/services/deploy/mr/base-config-reader.js +6 -8
- 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/spec/bulk/bulk-deploy-service.spec.js +14 -3
- package/dist/services/deploy/spec/checks/activation/customer-approval-check.spec.js +7 -5
- package/dist/services/deploy/spec/checks/pre-deploy/split-change-check.spec.js +2 -1
- 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 -5
- package/dist/services/diff/diff-service-factory.js +4 -7
- package/dist/services/diff/index.d.ts +1 -1
- package/dist/services/diff/index.js +1 -1
- package/dist/services/document-handler-runtime/{context/document-handler-runtime-context.d.ts → document-handler-runtime-model.d.ts} +0 -5
- 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.js +2 -2
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -6
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +14 -14
- package/dist/services/document-handler-runtime/server/request.js +1 -1
- 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/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/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 -6
- package/dist/services/integration-api/integration-api-factory.js +11 -11
- 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/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/onboarding/browse/browse-service.d.ts +18 -0
- package/dist/services/onboarding/browse/browse-service.js +61 -0
- package/dist/services/onboarding/browse/browse-url.d.ts +10 -0
- package/dist/services/onboarding/browse/browse-url.js +19 -0
- 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 -3
- package/dist/services/onboarding/browser/executable/executable-validator.js +20 -16
- package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +3 -3
- package/dist/services/onboarding/browser/extension/extension-downloader.js +8 -6
- package/dist/services/onboarding/browser/extension/extension-validator.d.ts +3 -3
- package/dist/services/onboarding/browser/extension/extension-validator.js +4 -4
- package/dist/services/onboarding/browser/launch-browser.d.ts +9 -0
- package/dist/services/onboarding/browser/launch-browser.js +20 -0
- package/dist/services/onboarding/error/browse-domain-error.d.ts +6 -0
- package/dist/services/onboarding/error/browse-domain-error.js +11 -0
- package/dist/services/onboarding/error/missing-customer-path-error.d.ts +6 -0
- package/dist/services/onboarding/error/missing-customer-path-error.js +11 -0
- package/dist/services/onboarding/file-events/file-watcher.js +1 -0
- 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 +61 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +79 -0
- package/dist/services/onboarding/onboarding-service-factory.d.ts +31 -6
- package/dist/services/onboarding/onboarding-service-factory.js +120 -48
- package/dist/services/onboarding/onboarding-service.d.ts +2 -0
- package/dist/services/onboarding/onboarding-service.js +5 -16
- package/dist/services/onboarding/spec/browse/browse-url.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browse/browse-url.spec.js +28 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +11 -6
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +155 -0
- 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 -5
- package/dist/services/origin-request/origin-request-service-factory.js +12 -12
- package/dist/services/origin-request/origin-request-service.d.ts +2 -2
- 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/auto-pre-warm-factory.d.ts +3 -31
- package/dist/services/prewarm/auto-pre-warm-factory.js +6 -11
- 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/services/prewarm/pre-warm-factory.d.ts +4 -5
- package/dist/services/prewarm/pre-warm-factory.js +6 -8
- 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/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 -5
- package/dist/services/pull/pull-service-factory.js +13 -14
- 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 -7
- package/dist/services/query-builder/query-builder-factory.js +26 -15
- package/dist/{models/cli-parameters.d.ts → services/query-builder/query-builder-flags.d.ts} +1 -120
- 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/spec/query-builder-flags.spec.d.ts +1 -0
- package/dist/{models/spec/cli-parameters.spec.js → services/query-builder/spec/query-builder-flags.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 -5
- package/dist/services/revalidate/revalidate-factory.js +2 -6
- 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/setup/browser/browser-setup-service.d.ts +3 -4
- package/dist/services/setup/browser/browser-setup-service.js +16 -18
- package/dist/services/setup/difftool/difftool-setup-service.d.ts +3 -4
- package/dist/services/setup/difftool/difftool-setup-service.js +5 -7
- package/dist/services/setup/extension/extension-setup-service.d.ts +3 -4
- 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 -6
- package/dist/services/setup/setup-service-factory.js +10 -18
- package/dist/services/setup/setup-service.d.ts +4 -5
- package/dist/services/setup/setup-service.js +6 -7
- package/oclif.manifest.json +155 -147
- package/package.json +4 -2
- package/dist/models/cli-parameters.js +0 -297
- package/dist/services/cli/cli-config.d.ts +0 -59
- package/dist/services/cli/cli-config.js +0 -180
- package/dist/services/cli/environment.d.ts +0 -15
- package/dist/services/cli/environment.js +0 -40
- package/dist/services/cli/spec/cli-config.spec.js +0 -117
- package/dist/services/cli/spec/environment.spec.js +0 -28
- package/dist/services/config-api/entity-manager-factory.d.ts +0 -5
- 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/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/{models/spec/cli-parameters.spec.d.ts → services/cli/command-build-context.js} +0 -0
- /package/dist/services/cli/spec/{cli-config.spec.d.ts → cli-environment-detection.spec.d.ts} +0 -0
- /package/dist/services/cli/spec/{environment.spec.d.ts → cli-environment.spec.d.ts} +0 -0
- /package/dist/services/document-handler-runtime/{context/document-handler-runtime-context.js → document-handler-runtime-model.js} +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { after, before, describe, it } from "mocha";
|
|
3
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { BrowseService } from "../browse/browse-service.js";
|
|
7
|
+
import { BrowseDomainError } from "../error/browse-domain-error.js";
|
|
8
|
+
import { MissingCustomerPathError } from "../error/missing-customer-path-error.js";
|
|
9
|
+
import { BrowserContext } from "../onboarding-model.js";
|
|
10
|
+
import { OnboardingServiceBuildContext, } from "../onboarding-service-build-context.js";
|
|
11
|
+
import { OnboardingServiceFactory } from "../onboarding-service-factory.js";
|
|
12
|
+
const cli = new Proxy({}, {
|
|
13
|
+
get: (_target, property) => property === "nonInteractive" ? true : () => undefined,
|
|
14
|
+
});
|
|
15
|
+
function environment() {
|
|
16
|
+
// chromeUserProfilePath keeps BrowserContext off the filesystem.
|
|
17
|
+
return {
|
|
18
|
+
cli,
|
|
19
|
+
settings: {
|
|
20
|
+
chromePath: "/usr/bin/google-chrome",
|
|
21
|
+
chromeUserProfilePath: "/tmp/sk-test-profile",
|
|
22
|
+
chromeExtensionPaths: "/tmp/sk-test-devtools",
|
|
23
|
+
chromeFlags: ["--lang=de"],
|
|
24
|
+
testApp: "",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function buildContext(values = {}) {
|
|
29
|
+
return new OnboardingServiceBuildContext({
|
|
30
|
+
environment: environment(),
|
|
31
|
+
customerPath: undefined,
|
|
32
|
+
configName: "production",
|
|
33
|
+
domain: undefined,
|
|
34
|
+
local: false,
|
|
35
|
+
ignoreContentSecurityPolicy: false,
|
|
36
|
+
cliPath: "/tmp",
|
|
37
|
+
verboseLevel: false,
|
|
38
|
+
useTestConfig: false,
|
|
39
|
+
debuggingPort: false,
|
|
40
|
+
headless: true,
|
|
41
|
+
debugPort: 9290,
|
|
42
|
+
browserFetch: false,
|
|
43
|
+
browse: false,
|
|
44
|
+
...values,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** Records what browse mode would launch, instead of resolving extensions and Chrome. */
|
|
48
|
+
class RecordingFactory extends OnboardingServiceFactory {
|
|
49
|
+
launched;
|
|
50
|
+
async prepareBrowser(domain, customerChromeFlags) {
|
|
51
|
+
this.launched = { domain, customerChromeFlags };
|
|
52
|
+
return {
|
|
53
|
+
browserContext: this.buildBrowserContext({
|
|
54
|
+
domain,
|
|
55
|
+
browserVersionString: "Google Chrome 146.0.7680.165",
|
|
56
|
+
customerChromeFlags,
|
|
57
|
+
}),
|
|
58
|
+
browserExtensions: { paths: [], hasDevtoolsExtension: false },
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
describe("OnboardingServiceFactory", () => {
|
|
63
|
+
describe("CUSTOMERPATH", () => {
|
|
64
|
+
it("is required without --browse", async () => {
|
|
65
|
+
const factory = new OnboardingServiceFactory(buildContext());
|
|
66
|
+
const error = await factory.getService().catch((error_) => error_);
|
|
67
|
+
expect(error).to.be.instanceOf(MissingCustomerPathError);
|
|
68
|
+
});
|
|
69
|
+
it("is optional with --browse", async () => {
|
|
70
|
+
const factory = new RecordingFactory(buildContext({ browse: true, domain: "www.example.com" }));
|
|
71
|
+
const service = await factory.getService();
|
|
72
|
+
expect(service).to.be.instanceOf(BrowseService);
|
|
73
|
+
expect(factory.launched).to.deep.equal({
|
|
74
|
+
domain: "https://www.example.com/",
|
|
75
|
+
customerChromeFlags: undefined,
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
it("fails in browse mode without a domain and without a CUSTOMERPATH", async () => {
|
|
79
|
+
const factory = new RecordingFactory(buildContext({ browse: true }));
|
|
80
|
+
const error = await factory.getService().catch((error_) => error_);
|
|
81
|
+
expect(error).to.be.instanceOf(BrowseDomainError);
|
|
82
|
+
expect(factory.launched).to.equal(undefined);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
describe("browse mode with a CUSTOMERPATH", () => {
|
|
86
|
+
let customerPath;
|
|
87
|
+
before(() => {
|
|
88
|
+
customerPath = mkdtempSync(join(tmpdir(), "sk-browse-"));
|
|
89
|
+
writeFileSync(join(customerPath, "config_customer.json"), JSON.stringify({
|
|
90
|
+
production: {
|
|
91
|
+
app: "example-shop",
|
|
92
|
+
domain: "www.example.com",
|
|
93
|
+
origins: ["https://www.example.com"],
|
|
94
|
+
swPath: "/sw.js",
|
|
95
|
+
scope: "/",
|
|
96
|
+
chromeFlags: ["--lang=fr"],
|
|
97
|
+
},
|
|
98
|
+
}));
|
|
99
|
+
});
|
|
100
|
+
after(() => rmSync(customerPath, { recursive: true, force: true }));
|
|
101
|
+
it("opens the domain and passes the chromeFlags of config_customer.json", async () => {
|
|
102
|
+
const factory = new RecordingFactory(buildContext({ browse: true, customerPath }));
|
|
103
|
+
await factory.getService();
|
|
104
|
+
expect(factory.launched).to.deep.equal({
|
|
105
|
+
domain: "https://www.example.com/",
|
|
106
|
+
customerChromeFlags: ["--lang=fr"],
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
it("lets --domain win over config_customer.json", async () => {
|
|
110
|
+
const factory = new RecordingFactory(buildContext({
|
|
111
|
+
browse: true,
|
|
112
|
+
customerPath,
|
|
113
|
+
domain: "shop.example.com",
|
|
114
|
+
}));
|
|
115
|
+
await factory.getService();
|
|
116
|
+
expect(factory.launched?.domain).to.equal("https://shop.example.com/");
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
describe("buildBrowserContext", () => {
|
|
120
|
+
const inputs = {
|
|
121
|
+
domain: "https://www.example.com/",
|
|
122
|
+
browserVersionString: "Google Chrome 146.0.7680.165",
|
|
123
|
+
customerChromeFlags: ["--lang=fr"],
|
|
124
|
+
};
|
|
125
|
+
function launchOptions(values) {
|
|
126
|
+
return new OnboardingServiceFactory(buildContext(values))
|
|
127
|
+
.buildBrowserContext(inputs)
|
|
128
|
+
.getPuppeteerLaunchOptions();
|
|
129
|
+
}
|
|
130
|
+
for (const mode of [
|
|
131
|
+
{ headless: true, debuggingPort: false },
|
|
132
|
+
{ headless: false, debuggingPort: true },
|
|
133
|
+
{ headless: false, debuggingPort: false },
|
|
134
|
+
]) {
|
|
135
|
+
it(`launches the same Chrome in browse mode as in onboarding (${JSON.stringify(mode)})`, () => {
|
|
136
|
+
expect(launchOptions({ ...mode, browse: true })).to.deep.equal(launchOptions({ ...mode, browse: false }));
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
it("keeps the extensions and a TCP debug port next to the pipe", () => {
|
|
140
|
+
const options = launchOptions({ browse: true, headless: true });
|
|
141
|
+
expect(options).to.include({ pipe: true, headless: true });
|
|
142
|
+
expect(options["enableExtensions"]).to.deep.equal([
|
|
143
|
+
"/tmp/sk-test-devtools",
|
|
144
|
+
]);
|
|
145
|
+
expect(options.args).to.include("--remote-debugging-port=9290");
|
|
146
|
+
expect(options.args).to.include("--lang=fr");
|
|
147
|
+
expect(options.args).to.include("--lang=de");
|
|
148
|
+
});
|
|
149
|
+
it("is a BrowserContext for the given domain", () => {
|
|
150
|
+
const browserContext = new OnboardingServiceFactory(buildContext({ browse: true })).buildBrowserContext(inputs);
|
|
151
|
+
expect(browserContext).to.be.instanceOf(BrowserContext);
|
|
152
|
+
expect(browserContext.domain).to.equal(inputs.domain);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Interfaces } from "@oclif/core";
|
|
2
|
+
import { CommandContextValues, CliEnvironment } from "../cli/index.js";
|
|
3
|
+
declare const args: {
|
|
4
|
+
pageUrl: Interfaces.Arg<string, Record<string, unknown>>;
|
|
5
|
+
customerPath: Interfaces.Arg<string, {
|
|
6
|
+
exists?: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
declare const flags: {
|
|
10
|
+
variation: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
11
|
+
host: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
12
|
+
body: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
13
|
+
grep: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
14
|
+
json: Interfaces.BooleanFlag<boolean>;
|
|
15
|
+
variations: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
16
|
+
configName: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
17
|
+
};
|
|
18
|
+
/** What `sk origin-request` asks for, as the service reads it. */
|
|
19
|
+
export interface OriginRequestOptions {
|
|
20
|
+
readonly customerPath: string;
|
|
21
|
+
readonly configName: string;
|
|
22
|
+
readonly pageUrl: string;
|
|
23
|
+
readonly variation?: string;
|
|
24
|
+
readonly host?: string;
|
|
25
|
+
readonly bodyFile?: string;
|
|
26
|
+
readonly grep?: string;
|
|
27
|
+
readonly json?: boolean;
|
|
28
|
+
readonly variationsFile?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface OriginRequestServiceBuildContextValues extends CommandContextValues, OriginRequestOptions {
|
|
31
|
+
}
|
|
32
|
+
declare const OriginRequestServiceBuildContext_base: new (values: OriginRequestServiceBuildContextValues) => Readonly<OriginRequestServiceBuildContextValues>;
|
|
33
|
+
/** What an origin request is built from. */
|
|
34
|
+
export declare class OriginRequestServiceBuildContext extends OriginRequestServiceBuildContext_base {
|
|
35
|
+
static readonly args: {
|
|
36
|
+
pageUrl: Interfaces.Arg<string, Record<string, unknown>>;
|
|
37
|
+
customerPath: Interfaces.Arg<string, {
|
|
38
|
+
exists?: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
static readonly flags: {
|
|
42
|
+
variation: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
43
|
+
host: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
44
|
+
body: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
45
|
+
grep: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
46
|
+
json: Interfaces.BooleanFlag<boolean>;
|
|
47
|
+
variations: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
48
|
+
configName: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
49
|
+
};
|
|
50
|
+
static create(parsedArgs: Interfaces.InferredArgs<typeof args>, parsedFlags: Interfaces.InferredFlags<typeof flags>, environment: CliEnvironment): OriginRequestServiceBuildContext;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Args, Flags } from "@oclif/core";
|
|
2
|
+
import { CLI_CONFIG_NAME, CLI_CUSTOMER_CONFIG, } from "../integration-api/customer-config-flags.js";
|
|
3
|
+
import { Context } from "../../models/context.js";
|
|
4
|
+
const args = {
|
|
5
|
+
...CLI_CUSTOMER_CONFIG,
|
|
6
|
+
pageUrl: Args.string({
|
|
7
|
+
name: "pageUrl",
|
|
8
|
+
required: true,
|
|
9
|
+
description: "Page to request from origin",
|
|
10
|
+
example: "https://www.decathlon.de/",
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
const flags = {
|
|
14
|
+
...CLI_CONFIG_NAME,
|
|
15
|
+
variation: Flags.string({
|
|
16
|
+
char: "v",
|
|
17
|
+
description: "Cache variation to simulate, e.g. desktop-fmarkt-variant-e_1907090. Omitted means the default variation",
|
|
18
|
+
}),
|
|
19
|
+
host: Flags.string({
|
|
20
|
+
description: "Send this Host header, emulating an origin-map host override",
|
|
21
|
+
}),
|
|
22
|
+
body: Flags.string({
|
|
23
|
+
description: "Write the response body to this file",
|
|
24
|
+
}),
|
|
25
|
+
grep: Flags.string({
|
|
26
|
+
description: "Print body lines matching this regex, case-insensitive",
|
|
27
|
+
}),
|
|
28
|
+
json: Flags.boolean({
|
|
29
|
+
description: "Machine-readable output",
|
|
30
|
+
}),
|
|
31
|
+
variations: Flags.string({
|
|
32
|
+
description: "Simulate against a runtime config in a local file instead of the app's deployed one",
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
/** What an origin request is built from. */
|
|
36
|
+
export class OriginRequestServiceBuildContext extends Context() {
|
|
37
|
+
static args = args;
|
|
38
|
+
static flags = flags;
|
|
39
|
+
static create(parsedArgs, parsedFlags, environment) {
|
|
40
|
+
return new OriginRequestServiceBuildContext({
|
|
41
|
+
environment,
|
|
42
|
+
customerPath: parsedArgs.customerPath,
|
|
43
|
+
configName: parsedFlags.configName,
|
|
44
|
+
pageUrl: parsedArgs.pageUrl,
|
|
45
|
+
variation: parsedFlags.variation,
|
|
46
|
+
host: parsedFlags.host,
|
|
47
|
+
bodyFile: parsedFlags.body,
|
|
48
|
+
grep: parsedFlags.grep,
|
|
49
|
+
json: parsedFlags.json,
|
|
50
|
+
variationsFile: parsedFlags.variations,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
OriginRequestServiceBuildContext;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OriginRequestContext } from "./origin-request-context.js";
|
|
1
|
+
import { OriginRequestServiceBuildContext } from "./origin-request-service-build-context.js";
|
|
3
2
|
import { OriginRequestService } from "./origin-request-service.js";
|
|
4
3
|
export declare class OriginRequestServiceFactory {
|
|
5
4
|
private readonly context;
|
|
6
|
-
private readonly userConfig;
|
|
7
|
-
private readonly cli?;
|
|
8
5
|
private service?;
|
|
9
|
-
constructor(context:
|
|
6
|
+
constructor(context: OriginRequestServiceBuildContext);
|
|
10
7
|
buildService(): Promise<OriginRequestService>;
|
|
11
8
|
private build;
|
|
12
9
|
private getIntegrationFiles;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import { CliServiceFactory, } from "../cli/index.js";
|
|
2
1
|
import { ConfigApiContext, ConfigApiServiceFactory, } from "../config-api/index.js";
|
|
3
|
-
import {
|
|
2
|
+
import { IntegrationApiServiceBuildContext, IntegrationApiFactory, } from "../integration-api/index.js";
|
|
4
3
|
import { applyOriginProxy } from "../../helpers/origin-proxy.js";
|
|
5
4
|
import { OriginRequestService } from "./origin-request-service.js";
|
|
6
5
|
export class OriginRequestServiceFactory {
|
|
7
6
|
context;
|
|
8
|
-
userConfig;
|
|
9
|
-
cli;
|
|
10
7
|
service = undefined;
|
|
11
|
-
constructor(context
|
|
8
|
+
constructor(context) {
|
|
12
9
|
this.context = context;
|
|
13
|
-
this.userConfig = userConfig;
|
|
14
|
-
this.cli = cli;
|
|
15
10
|
}
|
|
16
11
|
async buildService() {
|
|
17
12
|
if (!(this.service instanceof OriginRequestService)) {
|
|
@@ -20,16 +15,21 @@ export class OriginRequestServiceFactory {
|
|
|
20
15
|
return this.service;
|
|
21
16
|
}
|
|
22
17
|
async build() {
|
|
23
|
-
const cli = this.cli
|
|
24
|
-
const files = await this.getIntegrationFiles(
|
|
18
|
+
const cli = this.context.environment.cli;
|
|
19
|
+
const files = await this.getIntegrationFiles();
|
|
25
20
|
const customer = files.getCustomerConfig().config;
|
|
26
21
|
// `--json` owns stdout, so the proxy line stays out of a machine-readable run.
|
|
27
22
|
applyOriginProxy(customer.chromeFlags, this.context.json ? undefined : cli);
|
|
28
23
|
this.service = new OriginRequestService(this.context, cli, this.getConfigApi(customer.app));
|
|
29
24
|
}
|
|
30
|
-
async getIntegrationFiles(
|
|
31
|
-
const integrationApiContext = new
|
|
32
|
-
|
|
25
|
+
async getIntegrationFiles() {
|
|
26
|
+
const integrationApiContext = new IntegrationApiServiceBuildContext({
|
|
27
|
+
environment: this.context.environment,
|
|
28
|
+
basePath: this.context.customerPath,
|
|
29
|
+
configName: this.context.configName,
|
|
30
|
+
whitelist: [],
|
|
31
|
+
});
|
|
32
|
+
const integrationApi = new IntegrationApiFactory(integrationApiContext).buildService();
|
|
33
33
|
return await integrationApi.run();
|
|
34
34
|
}
|
|
35
35
|
getConfigApi(app) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CliServiceInterface } from "../cli/index.js";
|
|
2
2
|
import { ConfigApiService } from "../config-api/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { OriginRequestOptions } from "./origin-request-service-build-context.js";
|
|
4
4
|
/**
|
|
5
5
|
* Fetches a page from origin with exactly the headers Speed Kit's server would send for a cache
|
|
6
6
|
* variation, then reports what the origin answered.
|
|
@@ -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:
|
|
23
|
+
constructor(context: OriginRequestOptions, 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
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { PopConfigService } from "./pop-config-service.js";
|
|
2
|
+
import { PopConfigServiceBuildContext } from "./pop-config-service-build-context.js";
|
|
2
3
|
export declare class PopConfigFactory {
|
|
3
|
-
|
|
4
|
+
private readonly context;
|
|
5
|
+
constructor(context: PopConfigServiceBuildContext);
|
|
6
|
+
getService(): Promise<PopConfigService>;
|
|
4
7
|
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { PopConfigService } from "./pop-config-service.js";
|
|
2
|
-
import { AthenaServiceFactory } from "../athena/index.js";
|
|
2
|
+
import { AthenaServiceBuildContext, AthenaServiceFactory, } from "../athena/index.js";
|
|
3
3
|
export class PopConfigFactory {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
context;
|
|
5
|
+
constructor(context) {
|
|
6
|
+
this.context = context;
|
|
7
|
+
}
|
|
8
|
+
async getService() {
|
|
9
|
+
const athenaService = await new AthenaServiceFactory(new AthenaServiceBuildContext({
|
|
10
|
+
environment: this.context.environment,
|
|
11
|
+
app: this.context.app,
|
|
12
|
+
})).getService();
|
|
6
13
|
return new PopConfigService(athenaService);
|
|
7
14
|
}
|
|
8
15
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CommandContextValues } from "../cli/index.js";
|
|
2
|
+
export interface PopConfigServiceBuildContextValues extends CommandContextValues {
|
|
3
|
+
/** The app whose POPs are read, for the Baqend Athena path. */
|
|
4
|
+
readonly app?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const PopConfigServiceBuildContext_base: new (values: PopConfigServiceBuildContextValues) => Readonly<PopConfigServiceBuildContextValues>;
|
|
7
|
+
/** Which app the POP config is read for. */
|
|
8
|
+
export declare class PopConfigServiceBuildContext extends PopConfigServiceBuildContext_base {
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
import { CliServiceInterface, UserCliConfig } from "../cli/index.js";
|
|
2
|
-
import { QueryFilterOptions } from "../query-builder/query-builder-model.js";
|
|
3
1
|
import { PreWarmService } from "./pre-warm-service.js";
|
|
4
|
-
|
|
5
|
-
readonly customerPath: string;
|
|
6
|
-
readonly configName: string;
|
|
7
|
-
/** Device classes to warm each url in the variations it was requested in. */
|
|
8
|
-
readonly device?: readonly string[];
|
|
9
|
-
/** Drop urls the origin mostly answers with a 404. */
|
|
10
|
-
readonly excludeNotFound?: boolean;
|
|
11
|
-
/** Keep only the most requested urls. */
|
|
12
|
-
readonly limit?: number;
|
|
13
|
-
/** Regular expressions the pre-warmed urls have to match. */
|
|
14
|
-
readonly match?: readonly string[];
|
|
15
|
-
/** Keep only urls requested at least this often in the window. */
|
|
16
|
-
readonly minHits?: number;
|
|
17
|
-
/** Athena workgroup the query runs in. */
|
|
18
|
-
readonly workgroup?: string;
|
|
19
|
-
/** Athena data catalog the rum tables live in. */
|
|
20
|
-
readonly catalog?: string;
|
|
21
|
-
/** Variations to pair every url with, when no traffic can reveal them. */
|
|
22
|
-
readonly variation?: readonly string[];
|
|
23
|
-
readonly variationPath?: string;
|
|
24
|
-
readonly sortParameters?: boolean;
|
|
25
|
-
readonly quiet?: boolean;
|
|
26
|
-
readonly verbose?: boolean;
|
|
27
|
-
readonly isWindows?: boolean;
|
|
28
|
-
}
|
|
2
|
+
import { AutoPreWarmServiceBuildContext } from "./auto-pre-warm-service-build-context.js";
|
|
29
3
|
/**
|
|
30
4
|
* Wires a {@link PreWarmService} that gets its URLs from a freshly built and
|
|
31
5
|
* executed prewarm query instead of a CSV file. Reads the app from the customer
|
|
@@ -38,9 +12,7 @@ export interface AutoPreWarmContext extends QueryFilterOptions {
|
|
|
38
12
|
* list is crossed with `--variationPath` or the default variation, as before.
|
|
39
13
|
*/
|
|
40
14
|
export declare class AutoPreWarmFactory {
|
|
41
|
-
private context;
|
|
42
|
-
|
|
43
|
-
private cli?;
|
|
44
|
-
constructor(context: AutoPreWarmContext, userConfig: UserCliConfig, cli?: CliServiceInterface);
|
|
15
|
+
private readonly context;
|
|
16
|
+
constructor(context: AutoPreWarmServiceBuildContext);
|
|
45
17
|
getService(): Promise<PreWarmService>;
|
|
46
18
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { CliContext, CliServiceFactory, } from "../cli/index.js";
|
|
2
1
|
import { QueryBuilderFactory } from "../query-builder/query-builder-factory.js";
|
|
3
|
-
import {
|
|
2
|
+
import { PrewarmQueryServiceBuildContext } from "../query-builder/query-builder-service-build-context.js";
|
|
4
3
|
import { normalizeDevices } from "../query-builder/queries/device.js";
|
|
5
4
|
import { ConfigApiContext, ConfigApiServiceFactory, } from "../config-api/index.js";
|
|
6
5
|
import { AssetApiClient } from "./assets/asset-api-client.js";
|
|
@@ -21,17 +20,13 @@ import { toPrewarmTargets } from "./prewarm-targets.js";
|
|
|
21
20
|
*/
|
|
22
21
|
export class AutoPreWarmFactory {
|
|
23
22
|
context;
|
|
24
|
-
|
|
25
|
-
cli;
|
|
26
|
-
constructor(context, userConfig, cli) {
|
|
23
|
+
constructor(context) {
|
|
27
24
|
this.context = context;
|
|
28
|
-
this.userConfig = userConfig;
|
|
29
|
-
this.cli = cli;
|
|
30
25
|
}
|
|
31
26
|
async getService() {
|
|
32
|
-
const cli = this.cli
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
const cli = this.context.environment.cli;
|
|
28
|
+
const queryService = await new QueryBuilderFactory(new PrewarmQueryServiceBuildContext({
|
|
29
|
+
environment: this.context.environment,
|
|
35
30
|
configName: this.context.configName,
|
|
36
31
|
customerPath: this.context.customerPath,
|
|
37
32
|
days: this.context.days,
|
|
@@ -49,7 +44,7 @@ export class AutoPreWarmFactory {
|
|
|
49
44
|
variations: this.context.variation,
|
|
50
45
|
workgroup: this.context.workgroup,
|
|
51
46
|
catalog: this.context.catalog,
|
|
52
|
-
}
|
|
47
|
+
})).buildService();
|
|
53
48
|
const app = queryService.app;
|
|
54
49
|
const rows = await queryService.execute();
|
|
55
50
|
const configApi = new ConfigApiServiceFactory(new ConfigApiContext(app)).getService();
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Interfaces } from "@oclif/core";
|
|
2
|
+
import { CommandContextValues, CliEnvironment } from "../cli/index.js";
|
|
3
|
+
import { QueryFilterOptions } from "../query-builder/query-builder-model.js";
|
|
4
|
+
declare const args: {
|
|
5
|
+
customerPath: Interfaces.Arg<string, {
|
|
6
|
+
exists?: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
declare const flags: {
|
|
10
|
+
variationPath: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
11
|
+
keepParameterSorting: Interfaces.BooleanFlag<boolean>;
|
|
12
|
+
quiet: Interfaces.BooleanFlag<boolean>;
|
|
13
|
+
verbose: Interfaces.BooleanFlag<boolean>;
|
|
14
|
+
excludeNotFound: Interfaces.BooleanFlag<boolean>;
|
|
15
|
+
limit: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
16
|
+
match: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
17
|
+
minHits: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
18
|
+
device: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
19
|
+
variation: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
20
|
+
excludeNoindex: Interfaces.BooleanFlag<boolean>;
|
|
21
|
+
excludeSuspicious: Interfaces.BooleanFlag<boolean>;
|
|
22
|
+
explain: Interfaces.BooleanFlag<boolean>;
|
|
23
|
+
hardNavigationsOnly: Interfaces.BooleanFlag<boolean>;
|
|
24
|
+
days: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
25
|
+
configName: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
26
|
+
catalog: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
27
|
+
workgroup: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
28
|
+
};
|
|
29
|
+
export interface AutoPreWarmServiceBuildContextValues extends CommandContextValues, QueryFilterOptions {
|
|
30
|
+
readonly customerPath: string;
|
|
31
|
+
readonly configName: string;
|
|
32
|
+
/** Device classes to warm each url in the variations it was requested in. */
|
|
33
|
+
readonly device?: readonly string[];
|
|
34
|
+
/** Drop urls the origin mostly answers with a 404. */
|
|
35
|
+
readonly excludeNotFound?: boolean;
|
|
36
|
+
/** Keep only the most requested urls. */
|
|
37
|
+
readonly limit?: number;
|
|
38
|
+
/** Regular expressions the pre-warmed urls have to match. */
|
|
39
|
+
readonly match?: readonly string[];
|
|
40
|
+
/** Keep only urls requested at least this often in the window. */
|
|
41
|
+
readonly minHits?: number;
|
|
42
|
+
/** Athena workgroup the query runs in. */
|
|
43
|
+
readonly workgroup?: string;
|
|
44
|
+
/** Athena data catalog the rum tables live in. */
|
|
45
|
+
readonly catalog?: string;
|
|
46
|
+
/** Variations to pair every url with, when no traffic can reveal them. */
|
|
47
|
+
readonly variation?: readonly string[];
|
|
48
|
+
readonly variationPath?: string;
|
|
49
|
+
readonly sortParameters?: boolean;
|
|
50
|
+
readonly quiet?: boolean;
|
|
51
|
+
readonly verbose?: boolean;
|
|
52
|
+
readonly isWindows?: boolean;
|
|
53
|
+
}
|
|
54
|
+
declare const AutoPreWarmServiceBuildContext_base: new (values: AutoPreWarmServiceBuildContextValues) => Readonly<AutoPreWarmServiceBuildContextValues>;
|
|
55
|
+
/** What `sk auto-prewarm` queries for and warms. */
|
|
56
|
+
export declare class AutoPreWarmServiceBuildContext extends AutoPreWarmServiceBuildContext_base {
|
|
57
|
+
static readonly args: {
|
|
58
|
+
customerPath: Interfaces.Arg<string, {
|
|
59
|
+
exists?: boolean;
|
|
60
|
+
}>;
|
|
61
|
+
};
|
|
62
|
+
static readonly flags: {
|
|
63
|
+
variationPath: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
64
|
+
keepParameterSorting: Interfaces.BooleanFlag<boolean>;
|
|
65
|
+
quiet: Interfaces.BooleanFlag<boolean>;
|
|
66
|
+
verbose: Interfaces.BooleanFlag<boolean>;
|
|
67
|
+
excludeNotFound: Interfaces.BooleanFlag<boolean>;
|
|
68
|
+
limit: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
69
|
+
match: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
70
|
+
minHits: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
71
|
+
device: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
72
|
+
variation: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
73
|
+
excludeNoindex: Interfaces.BooleanFlag<boolean>;
|
|
74
|
+
excludeSuspicious: Interfaces.BooleanFlag<boolean>;
|
|
75
|
+
explain: Interfaces.BooleanFlag<boolean>;
|
|
76
|
+
hardNavigationsOnly: Interfaces.BooleanFlag<boolean>;
|
|
77
|
+
days: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
|
|
78
|
+
configName: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
79
|
+
catalog: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
80
|
+
workgroup: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
81
|
+
};
|
|
82
|
+
static create(parsedArgs: Interfaces.InferredArgs<typeof args>, parsedFlags: Interfaces.InferredFlags<typeof flags>, environment: CliEnvironment): AutoPreWarmServiceBuildContext;
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { CLI_ATHENA } from "../athena/athena-flags.js";
|
|
3
|
+
import { CLI_CONFIG_NAME, CLI_CUSTOMER_CONFIG, } from "../integration-api/customer-config-flags.js";
|
|
4
|
+
import { CLI_QUERY_DAYS, CLI_QUERY_FILTERS, CLI_QUERY_PREWARM_LIST, } from "../query-builder/query-builder-flags.js";
|
|
5
|
+
import { Context } from "../../models/context.js";
|
|
6
|
+
const args = { ...CLI_CUSTOMER_CONFIG };
|
|
7
|
+
const flags = {
|
|
8
|
+
...CLI_ATHENA,
|
|
9
|
+
...CLI_CONFIG_NAME,
|
|
10
|
+
...CLI_QUERY_DAYS,
|
|
11
|
+
...CLI_QUERY_FILTERS,
|
|
12
|
+
// Every flag that shapes the pre-warm list, not a subset of them: this
|
|
13
|
+
// command builds the same query `sk query prewarm` does, and a list it
|
|
14
|
+
// could not narrow the same way could not be counted by that command
|
|
15
|
+
// either — the two would describe different runs. `--count` is not among
|
|
16
|
+
// them: this command warms the list rather than reporting its size.
|
|
17
|
+
...CLI_QUERY_PREWARM_LIST,
|
|
18
|
+
// A variations file says what `--variation` says, read from disk.
|
|
19
|
+
variationPath: Flags.file({
|
|
20
|
+
char: "p",
|
|
21
|
+
description: "path to variations.csv",
|
|
22
|
+
exclusive: ["device", "variation"],
|
|
23
|
+
}),
|
|
24
|
+
keepParameterSorting: Flags.boolean({
|
|
25
|
+
char: "k",
|
|
26
|
+
default: false,
|
|
27
|
+
description: "Prevents alphabetical sorting of the URL parameters",
|
|
28
|
+
}),
|
|
29
|
+
quiet: Flags.boolean({
|
|
30
|
+
char: "q",
|
|
31
|
+
default: false,
|
|
32
|
+
description: "less output non interactive",
|
|
33
|
+
}),
|
|
34
|
+
verbose: Flags.boolean({
|
|
35
|
+
default: false,
|
|
36
|
+
description: "Log information about failed requests",
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
/** What `sk auto-prewarm` queries for and warms. */
|
|
40
|
+
export class AutoPreWarmServiceBuildContext extends Context() {
|
|
41
|
+
static args = args;
|
|
42
|
+
static flags = flags;
|
|
43
|
+
static create(parsedArgs, parsedFlags, environment) {
|
|
44
|
+
return new AutoPreWarmServiceBuildContext({
|
|
45
|
+
environment,
|
|
46
|
+
customerPath: parsedArgs.customerPath,
|
|
47
|
+
configName: parsedFlags.configName,
|
|
48
|
+
days: parsedFlags.days,
|
|
49
|
+
device: parsedFlags.device,
|
|
50
|
+
excludeNoindex: parsedFlags.excludeNoindex,
|
|
51
|
+
excludeNotFound: parsedFlags.excludeNotFound,
|
|
52
|
+
excludeSuspicious: parsedFlags.excludeSuspicious,
|
|
53
|
+
hardNavigationsOnly: parsedFlags.hardNavigationsOnly,
|
|
54
|
+
limit: parsedFlags.limit,
|
|
55
|
+
match: parsedFlags.match,
|
|
56
|
+
minHits: parsedFlags.minHits,
|
|
57
|
+
variation: parsedFlags.variation,
|
|
58
|
+
variationPath: parsedFlags.variationPath,
|
|
59
|
+
sortParameters: !parsedFlags.keepParameterSorting,
|
|
60
|
+
quiet: parsedFlags.quiet,
|
|
61
|
+
verbose: parsedFlags.verbose,
|
|
62
|
+
workgroup: parsedFlags.workgroup,
|
|
63
|
+
catalog: parsedFlags.catalog,
|
|
64
|
+
isWindows: environment.oclif.windows,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
AutoPreWarmServiceBuildContext;
|