@speedkit/cli 4.35.1 → 4.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +43 -34
- package/dist/commands/auto-prewarm.js +1 -1
- package/dist/commands/browser/clean.js +1 -2
- package/dist/commands/browser/list.js +1 -2
- package/dist/commands/browser/update.js +1 -2
- package/dist/commands/bulk-deploy.d.ts +19 -0
- package/dist/commands/bulk-deploy.js +52 -0
- package/dist/commands/config/setup.js +4 -3
- package/dist/commands/deploy.d.ts +2 -0
- package/dist/commands/deploy.js +34 -3
- package/dist/commands/diff-url-parameters.d.ts +2 -2
- package/dist/commands/diff-url-parameters.js +12 -5
- package/dist/commands/extension/add.js +1 -1
- package/dist/commands/extension/devtools.js +1 -1
- package/dist/commands/extension/list.js +1 -1
- package/dist/commands/extension/remove.js +1 -1
- package/dist/commands/extension/update.js +1 -1
- package/dist/commands/find-pops.js +3 -2
- package/dist/commands/generate-pop-config.js +9 -13
- package/dist/commands/onboarding.js +1 -1
- package/dist/commands/origin-request.js +1 -1
- package/dist/commands/pull.js +1 -1
- package/dist/commands/revalidate.js +4 -3
- package/dist/commands/wpt-launcher.js +3 -2
- package/dist/helpers/{chrome-flags.spec.js → spec/chrome-flags.spec.js} +1 -1
- package/dist/helpers/{origin-proxy.spec.js → spec/origin-proxy.spec.js} +1 -1
- package/dist/hooks/init/first-run.js +3 -3
- package/dist/hooks/{init → spec/init}/dns-result-order.spec.js +1 -1
- package/dist/hooks/{init → spec/init}/http1-global-dispatcher.spec.js +1 -1
- package/dist/models/cli-parameters.d.ts +0 -2
- package/dist/models/cli-parameters.js +0 -2
- package/dist/models/{cli-parameters.spec.js → spec/cli-parameters.spec.js} +1 -1
- package/dist/services/athena/athena-service-factory.d.ts +3 -1
- package/dist/services/athena/athena-service-factory.js +4 -2
- package/dist/services/athena/{athena-service.spec.js → spec/athena-service.spec.js} +1 -1
- package/dist/services/athena/{baqend-athena-service.spec.js → spec/baqend-athena-service.spec.js} +2 -2
- package/dist/services/browser-fetch/browser-origin-fetch.d.ts +1 -1
- package/dist/services/browser-fetch/browser-origin-fetcher.d.ts +1 -1
- package/dist/services/browser-fetch/{browser-origin-fetch.spec.js → spec/browser-origin-fetch.spec.js} +2 -2
- package/dist/services/browser-fetch/{browser-origin-fetcher.spec.js → spec/browser-origin-fetcher.spec.js} +1 -1
- package/dist/services/browser-fetch/{browser-response.spec.js → spec/browser-response.spec.js} +1 -1
- package/dist/services/browser-fetch/{device-emulation.spec.js → spec/device-emulation.spec.js} +2 -2
- package/dist/services/bundler/{bundle-service.spec.js → spec/bundle-service.spec.js} +1 -1
- package/dist/{helpers → services/cli}/cli-config.js +1 -1
- package/dist/services/cli/cli-service-factory.d.ts +10 -2
- package/dist/services/cli/cli-service-factory.js +11 -9
- package/dist/services/cli/cli-service-model.d.ts +10 -2
- package/dist/services/cli/cli-service.d.ts +37 -0
- package/dist/services/cli/cli-service.js +90 -3
- package/dist/{helpers/clipboard.d.ts → services/cli/clipboard/clipboard-service.d.ts} +3 -1
- package/dist/{helpers/clipboard.js → services/cli/clipboard/clipboard-service.js} +6 -1
- package/dist/services/cli/clipboard/index.d.ts +1 -0
- package/dist/services/cli/clipboard/index.js +1 -0
- package/dist/services/cli/index.d.ts +1 -0
- package/dist/services/cli/index.js +1 -0
- package/dist/{helpers → services/cli/spec}/cli-config.spec.js +1 -1
- package/dist/services/cli/{cli-service.spec.js → spec/cli-service.spec.js} +42 -1
- package/dist/{helpers → services/cli/spec}/environment.spec.js +1 -1
- package/dist/services/customer-config/customer-config-service-factory.d.ts +3 -1
- package/dist/services/customer-config/customer-config-service-factory.js +7 -3
- package/dist/services/customer-config/customer-config-service.d.ts +4 -2
- package/dist/services/customer-config/customer-config-service.js +4 -3
- package/dist/services/customer-config/site-analyzer/index.d.ts +3 -0
- package/dist/services/customer-config/site-analyzer/index.js +3 -0
- package/dist/{helpers/site-analyzer.d.ts → services/customer-config/site-analyzer/site-analyzer-model.d.ts} +0 -1
- package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.d.ts +7 -0
- package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.js +11 -0
- package/dist/services/customer-config/site-analyzer/site-analyzer-service.d.ts +16 -0
- package/dist/{helpers/site-analyzer.js → services/customer-config/site-analyzer/site-analyzer-service.js} +20 -5
- package/dist/services/deploy/bulk/bulk-deploy-model.d.ts +46 -0
- package/dist/services/deploy/bulk/bulk-deploy-model.js +27 -0
- package/dist/services/deploy/bulk/bulk-deploy-service-factory.d.ts +11 -0
- package/dist/services/deploy/bulk/bulk-deploy-service-factory.js +24 -0
- package/dist/services/deploy/bulk/bulk-deploy-service.d.ts +47 -0
- package/dist/services/deploy/bulk/bulk-deploy-service.js +201 -0
- package/dist/services/deploy/bulk/config-deploy-factory.d.ts +13 -0
- package/dist/services/deploy/bulk/config-deploy-factory.js +20 -0
- package/dist/services/deploy/bulk/index.d.ts +5 -0
- package/dist/services/deploy/bulk/index.js +5 -0
- package/dist/services/deploy/bulk/touched-configs.d.ts +12 -0
- package/dist/services/deploy/bulk/touched-configs.js +54 -0
- package/dist/services/deploy/checks/activation/customer-approval-check.d.ts +3 -1
- package/dist/services/deploy/checks/activation/customer-approval-check.js +5 -2
- package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.d.ts +4 -2
- package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.js +6 -3
- 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 +4 -2
- package/dist/services/deploy/checks/post-deploy/save-files-check.js +5 -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 +9 -5
- 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 +8 -5
- package/dist/services/deploy/context/deploy-context.d.ts +21 -1
- package/dist/services/deploy/context/deploy-context.js +30 -1
- package/dist/services/deploy/deploy-service-factory.d.ts +15 -2
- package/dist/services/deploy/deploy-service-factory.js +43 -20
- package/dist/services/deploy/deploy-service.d.ts +2 -2
- package/dist/services/deploy/error/deploy-aborted-error.d.ts +12 -0
- package/dist/services/deploy/error/deploy-aborted-error.js +16 -0
- package/dist/services/deploy/handler/customer-config-handler.d.ts +4 -2
- package/dist/services/deploy/handler/customer-config-handler.js +11 -7
- package/dist/services/deploy/handler/install-resource-handler.d.ts +4 -2
- package/dist/services/deploy/handler/install-resource-handler.js +12 -7
- package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.d.ts +4 -2
- package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +5 -2
- package/dist/services/deploy/handler/module-handler.d.ts +4 -2
- package/dist/services/deploy/handler/module-handler.js +7 -4
- package/dist/services/deploy/handler/server-config-handler.d.ts +4 -2
- package/dist/services/deploy/handler/server-config-handler.js +6 -3
- package/dist/services/deploy/mr/base-config-reader.d.ts +25 -0
- package/dist/services/deploy/mr/base-config-reader.js +55 -0
- package/dist/services/deploy/mr/index.d.ts +6 -0
- package/dist/services/deploy/mr/index.js +6 -0
- package/dist/services/deploy/mr/live-state-check.d.ts +38 -0
- package/dist/services/deploy/mr/live-state-check.js +81 -0
- package/dist/services/deploy/mr/merge-request-deploy-model.d.ts +59 -0
- package/dist/services/deploy/mr/merge-request-deploy-model.js +50 -0
- package/dist/services/deploy/mr/merge-request-deploy-service-factory.d.ts +20 -0
- package/dist/services/deploy/mr/merge-request-deploy-service-factory.js +46 -0
- package/dist/services/deploy/mr/merge-request-deploy-service.d.ts +61 -0
- package/dist/services/deploy/mr/merge-request-deploy-service.js +189 -0
- package/dist/services/deploy/mr/merge-request-description.d.ts +16 -0
- package/dist/services/deploy/mr/merge-request-description.js +27 -0
- package/dist/services/deploy/policy/auto-deploy-policy.d.ts +43 -0
- package/dist/services/deploy/policy/auto-deploy-policy.js +77 -0
- package/dist/services/deploy/policy/deploy-policy-model.d.ts +61 -0
- package/dist/services/deploy/policy/deploy-policy-model.js +41 -0
- package/dist/services/deploy/policy/index.d.ts +2 -0
- package/dist/services/deploy/policy/index.js +2 -0
- package/dist/services/deploy/policy/interactive-deploy-policy.d.ts +15 -0
- package/dist/services/deploy/policy/interactive-deploy-policy.js +16 -0
- package/dist/services/deploy/spec/bulk/bulk-deploy-service.spec.js +146 -0
- package/dist/services/deploy/spec/bulk/touched-configs.spec.js +77 -0
- package/dist/services/deploy/{checks → spec/checks}/activation/customer-approval-check.spec.js +20 -17
- package/dist/services/deploy/{checks → spec/checks}/post-deploy/refresh-deployment-job-check.spec.js +2 -2
- package/dist/services/deploy/spec/checks/pre-deploy/split-change-check.spec.js +55 -0
- package/dist/services/deploy/spec/handler/module-handler.spec.js +49 -0
- package/dist/services/deploy/{handler → spec/handler}/testing-installation-links.spec.js +1 -1
- package/dist/services/deploy/spec/mr/live-state-check.spec.js +74 -0
- package/dist/services/deploy/spec/mr/merge-request-description.spec.js +55 -0
- package/dist/services/deploy/spec/policy/auto-deploy-policy.spec.js +83 -0
- package/dist/services/diff/diff-model.d.ts +5 -1
- package/dist/services/diff/diff-model.js +5 -1
- package/dist/services/diff/diff-service-factory.d.ts +3 -1
- package/dist/services/diff/diff-service-factory.js +5 -3
- package/dist/services/diff/diff-service.d.ts +11 -2
- package/dist/services/diff/diff-service.js +32 -7
- package/dist/services/diff/index.d.ts +1 -0
- package/dist/services/diff/index.js +1 -0
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.d.ts +2 -14
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +0 -52
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +2 -2
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -11
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +6 -72
- package/dist/services/document-handler-runtime/{document-handler-abort.spec.js → spec/document-handler-abort.spec.js} +2 -2
- package/dist/services/git/git-repository-model.d.ts +13 -0
- package/dist/services/git/git-repository.d.ts +35 -0
- package/dist/services/git/git-repository.js +120 -0
- package/dist/services/git/index.d.ts +2 -0
- package/dist/services/git/index.js +2 -0
- package/dist/services/git/spec/git-repository.spec.js +87 -0
- package/dist/services/integration-api/handler/customer-config-handler.d.ts +2 -2
- package/dist/services/integration-api/integration-api-factory.d.ts +3 -2
- package/dist/services/integration-api/integration-api-factory.js +5 -3
- package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +1 -1
- package/dist/services/integration-api/struct/customer-config-file.js +1 -1
- package/dist/services/integration-api/virtual/virtual-file-handler.d.ts +2 -2
- package/dist/services/onboarding/browser/config/browser-config.d.ts +1 -1
- package/dist/services/onboarding/browser/executable/executable-validator.d.ts +1 -2
- package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +1 -2
- package/dist/services/onboarding/browser/extension/extension-validator.d.ts +1 -2
- package/dist/services/onboarding/dashboard/diff-against-current-page.d.ts +2 -2
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +1 -1
- package/dist/services/onboarding/dashboard/request-diff-service.d.ts +3 -1
- package/dist/services/onboarding/dashboard/request-diff-service.js +5 -3
- package/dist/services/onboarding/fetch-event-handler.d.ts +2 -2
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +3 -1
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +5 -3
- package/dist/services/onboarding/file-events/file-watcher.d.ts +2 -2
- package/dist/services/onboarding/file-events/file-watcher.js +2 -2
- package/dist/services/onboarding/onboarding-model.d.ts +1 -1
- package/dist/services/onboarding/onboarding-service-factory.d.ts +3 -2
- package/dist/services/onboarding/onboarding-service-factory.js +17 -17
- package/dist/services/onboarding/onboarding-service.d.ts +2 -2
- package/dist/services/onboarding/request-cache/cache.d.ts +2 -2
- package/dist/services/onboarding/server-config/index.d.ts +2 -2
- package/dist/services/onboarding/{browser → spec/browser}/executable/headed-user-agent.spec.js +1 -1
- package/dist/services/onboarding/{empty-service-worker.spec.js → spec/empty-service-worker.spec.js} +1 -1
- package/dist/services/onboarding/{onboarding-model.spec.js → spec/onboarding-model.spec.js} +2 -2
- package/dist/services/onboarding/{virtual-orestes-app → spec/virtual-orestes-app}/crawler.spec.js +1 -1
- package/dist/services/onboarding/{virtual-orestes-app → spec/virtual-orestes-app}/origin-error-cause.spec.js +1 -1
- package/dist/services/onboarding/virtual-orestes-app/crawler.d.ts +2 -2
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +2 -2
- package/dist/services/origin-request/asset-variations.js +1 -1
- package/dist/services/origin-request/origin-request-service-factory.d.ts +3 -2
- package/dist/services/origin-request/origin-request-service-factory.js +8 -6
- package/dist/services/origin-request/origin-request-service.d.ts +2 -2
- package/dist/services/origin-request/{asset-variations.spec.js → spec/asset-variations.spec.js} +1 -1
- package/dist/services/prewarm/assets/asset-api-client.d.ts +3 -1
- package/dist/services/prewarm/assets/asset-api-client.js +5 -3
- package/dist/services/prewarm/auto-pre-warm-factory.d.ts +3 -2
- package/dist/services/prewarm/auto-pre-warm-factory.js +8 -5
- package/dist/{helpers → services/prewarm}/normalize.d.ts +0 -6
- package/dist/{helpers → services/prewarm}/normalize.js +0 -8
- package/dist/services/prewarm/pre-warm-factory.d.ts +3 -1
- package/dist/services/prewarm/pre-warm-factory.js +7 -4
- package/dist/services/prewarm/{csv-reader.spec.js → spec/csv-reader.spec.js} +1 -1
- package/dist/services/prewarm/{prewarm-targets.spec.js → spec/prewarm-targets.spec.js} +1 -1
- package/dist/services/pull/pull-service-factory.d.ts +3 -2
- package/dist/services/pull/pull-service-factory.js +8 -6
- package/dist/services/query-builder/query-builder-factory.d.ts +3 -2
- package/dist/services/query-builder/query-builder-factory.js +9 -7
- package/dist/services/query-builder/query-builder-service.js +4 -5
- package/dist/services/query-builder/query-command.js +1 -1
- package/dist/services/query-builder/{queries/spec → spec/queries}/golden.spec.js +3 -3
- package/dist/services/query-builder/{queries/spec → spec/queries}/pops-query.spec.js +2 -2
- package/dist/services/query-builder/{queries/spec → spec/queries}/queries.spec.js +3 -3
- package/dist/services/query-builder/{queries/spec → spec/queries}/reported-bugs.spec.js +2 -2
- package/dist/services/query-builder/{query-builder-service.spec.js → spec/query-builder-service.spec.js} +4 -4
- package/dist/services/query-builder/{rules/spec → spec/rules}/pattern-language.spec.js +1 -1
- package/dist/services/query-builder/{rules/spec → spec/rules}/rule-parser.spec.js +1 -1
- package/dist/services/query-builder/{rules/spec → spec/rules}/rule-reducer.spec.js +2 -2
- package/dist/services/query-builder/{rules/spec → spec/rules}/rule-relevance.spec.js +2 -2
- package/dist/services/query-builder/{rules/spec → spec/rules}/rule-to-sql.spec.js +2 -2
- package/dist/services/query-builder/{rules/spec → spec/rules}/runtime-semantics.spec.js +1 -1
- package/dist/services/query-builder/spec/rules/strip-parameters.spec.d.ts +1 -0
- package/dist/services/query-builder/{rules/spec → spec/rules}/strip-parameters.spec.js +3 -3
- package/dist/services/query-builder/spec/sql/expression.spec.d.ts +1 -0
- package/dist/services/query-builder/{sql/spec → spec/sql}/expression.spec.js +2 -2
- package/dist/services/query-builder/spec/sql/format.spec.d.ts +1 -0
- package/dist/services/query-builder/{sql/spec → spec/sql}/format.spec.js +2 -2
- package/dist/services/query-builder/spec/sql/predicate.spec.d.ts +1 -0
- package/dist/services/query-builder/{sql/spec → spec/sql}/predicate.spec.js +1 -1
- package/dist/services/query-builder/spec/sql/regex.spec.d.ts +1 -0
- package/dist/services/query-builder/{sql/spec → spec/sql}/regex.spec.js +1 -1
- package/dist/services/revalidate/revalidate-factory.d.ts +3 -1
- package/dist/services/revalidate/revalidate-factory.js +6 -3
- package/dist/services/revalidate/revalidate-service.d.ts +2 -2
- package/dist/services/revalidate/spec/revalidate-service.spec.d.ts +1 -0
- package/dist/services/revalidate/{revalidate-service.spec.js → spec/revalidate-service.spec.js} +1 -1
- package/dist/services/setup/browser/browser-setup-service.d.ts +1 -2
- package/dist/services/setup/difftool/difftool-setup-service.d.ts +1 -2
- package/dist/services/setup/extension/extension-installer.d.ts +1 -1
- package/dist/services/setup/extension/extension-setup-service.d.ts +1 -2
- package/dist/services/setup/setup-service-factory.d.ts +3 -1
- package/dist/services/setup/setup-service-factory.js +5 -4
- package/dist/services/setup/setup-service.d.ts +1 -2
- package/dist/services/setup/spec/extension/crx.spec.d.ts +1 -0
- package/dist/services/setup/{extension → spec/extension}/crx.spec.js +1 -1
- package/dist/services/setup/spec/extension/webstore.spec.d.ts +1 -0
- 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 +139 -84
- package/package.json +3 -2
- package/dist/commands/document-handler.d.ts +0 -16
- package/dist/commands/document-handler.js +0 -32
- package/dist/helpers/customer-config.d.ts +0 -45
- package/dist/helpers/customer-config.js +0 -136
- package/dist/helpers/file-helper.d.ts +0 -8
- package/dist/helpers/file-helper.js +0 -28
- package/dist/helpers/is-directory.d.ts +0 -5
- package/dist/helpers/is-directory.js +0 -19
- package/dist/helpers/is-file.d.ts +0 -5
- package/dist/helpers/is-file.js +0 -19
- package/dist/helpers/logging-helper.d.ts +0 -15
- package/dist/helpers/logging-helper.js +0 -23
- package/dist/helpers/scrape.d.ts +0 -1
- package/dist/helpers/scrape.js +0 -8
- package/dist/helpers/speed-kit-rule-to-reg-exp.d.ts +0 -1
- package/dist/helpers/speed-kit-rule-to-reg-exp.js +0 -6
- package/dist/models/install.d.ts +0 -24
- package/dist/services/config-api-service.d.ts +0 -21
- package/dist/services/config-api-service.js +0 -107
- package/dist/services/diff-service.d.ts +0 -27
- package/dist/services/diff-service.js +0 -116
- package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +0 -31
- package/dist/services/document-handler-runtime/document-handler-runtime-service.js +0 -222
- package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.d.ts +0 -3
- package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.js +0 -3
- package/dist/services/document-handler-runtime/templates/execute-document-handler.d.ts +0 -6
- package/dist/services/document-handler-runtime/templates/execute-document-handler.js +0 -74
- package/dist/services/document-handler-runtime/templates/orestes-mock.d.ts +0 -9
- package/dist/services/document-handler-runtime/templates/orestes-mock.js +0 -166
- package/dist/services/document-handler-runtime/templates/package-json.d.ts +0 -6
- package/dist/services/document-handler-runtime/templates/package-json.js +0 -17
- package/dist/services/document-handler-runtime/templates/test.d.ts +0 -6
- package/dist/services/document-handler-runtime/templates/test.js +0 -64
- /package/dist/helpers/{chrome-flags.spec.d.ts → spec/chrome-flags.spec.d.ts} +0 -0
- /package/dist/helpers/{origin-proxy.spec.d.ts → spec/origin-proxy.spec.d.ts} +0 -0
- /package/dist/hooks/{init → spec/init}/dns-result-order.spec.d.ts +0 -0
- /package/dist/hooks/{init → spec/init}/http1-global-dispatcher.spec.d.ts +0 -0
- /package/dist/models/{cli-parameters.spec.d.ts → spec/cli-parameters.spec.d.ts} +0 -0
- /package/dist/services/athena/{athena-service.spec.d.ts → spec/athena-service.spec.d.ts} +0 -0
- /package/dist/services/athena/{baqend-athena-service.spec.d.ts → spec/baqend-athena-service.spec.d.ts} +0 -0
- /package/dist/services/browser-fetch/{browser-origin-fetch.spec.d.ts → spec/browser-origin-fetch.spec.d.ts} +0 -0
- /package/dist/services/browser-fetch/{browser-origin-fetcher.spec.d.ts → spec/browser-origin-fetcher.spec.d.ts} +0 -0
- /package/dist/services/browser-fetch/{browser-response.spec.d.ts → spec/browser-response.spec.d.ts} +0 -0
- /package/dist/services/browser-fetch/{device-emulation.spec.d.ts → spec/device-emulation.spec.d.ts} +0 -0
- /package/dist/services/bundler/{bundle-service.spec.d.ts → spec/bundle-service.spec.d.ts} +0 -0
- /package/dist/{helpers → services/cli}/cli-config.d.ts +0 -0
- /package/dist/{helpers → services/cli}/environment.d.ts +0 -0
- /package/dist/{helpers → services/cli}/environment.js +0 -0
- /package/dist/{helpers → services/cli/spec}/cli-config.spec.d.ts +0 -0
- /package/dist/services/cli/{cli-service.spec.d.ts → spec/cli-service.spec.d.ts} +0 -0
- /package/dist/{helpers → services/cli/spec}/environment.spec.d.ts +0 -0
- /package/dist/{models/install.js → services/customer-config/site-analyzer/site-analyzer-model.js} +0 -0
- /package/dist/services/deploy/{checks/activation/customer-approval-check.spec.d.ts → spec/bulk/bulk-deploy-service.spec.d.ts} +0 -0
- /package/dist/services/deploy/{checks/post-deploy/refresh-deployment-job-check.spec.d.ts → spec/bulk/touched-configs.spec.d.ts} +0 -0
- /package/dist/services/deploy/{handler/testing-installation-links.spec.d.ts → spec/checks/activation/customer-approval-check.spec.d.ts} +0 -0
- /package/dist/services/{document-handler-runtime/document-handler-abort.spec.d.ts → deploy/spec/checks/post-deploy/refresh-deployment-job-check.spec.d.ts} +0 -0
- /package/dist/services/{onboarding/browser/executable/headed-user-agent.spec.d.ts → deploy/spec/checks/pre-deploy/split-change-check.spec.d.ts} +0 -0
- /package/dist/services/{onboarding/empty-service-worker.spec.d.ts → deploy/spec/handler/module-handler.spec.d.ts} +0 -0
- /package/dist/services/{onboarding/onboarding-model.spec.d.ts → deploy/spec/handler/testing-installation-links.spec.d.ts} +0 -0
- /package/dist/services/{onboarding/virtual-orestes-app/crawler.spec.d.ts → deploy/spec/mr/live-state-check.spec.d.ts} +0 -0
- /package/dist/services/{onboarding/virtual-orestes-app/origin-error-cause.spec.d.ts → deploy/spec/mr/merge-request-description.spec.d.ts} +0 -0
- /package/dist/services/{origin-request/asset-variations.spec.d.ts → deploy/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/{prewarm/csv-reader.spec.d.ts → document-handler-runtime/spec/document-handler-abort.spec.d.ts} +0 -0
- /package/dist/services/{prewarm/prewarm-targets.spec.d.ts → git/git-repository-model.js} +0 -0
- /package/dist/services/{query-builder/queries/spec/golden.spec.d.ts → git/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/{query-builder/queries/spec/pops-query.spec.d.ts → onboarding/spec/browser/executable/headed-user-agent.spec.d.ts} +0 -0
- /package/dist/services/{query-builder/queries/spec/queries.spec.d.ts → onboarding/spec/empty-service-worker.spec.d.ts} +0 -0
- /package/dist/services/{query-builder/queries/spec/reported-bugs.spec.d.ts → onboarding/spec/onboarding-model.spec.d.ts} +0 -0
- /package/dist/services/{query-builder/query-builder-service.spec.d.ts → onboarding/spec/virtual-orestes-app/crawler.spec.d.ts} +0 -0
- /package/dist/services/{query-builder/rules/spec/pattern-language.spec.d.ts → onboarding/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/{query-builder/rules/spec/rule-parser.spec.d.ts → origin-request/spec/asset-variations.spec.d.ts} +0 -0
- /package/dist/services/{query-builder/rules/spec/rule-reducer.spec.d.ts → prewarm/spec/csv-reader.spec.d.ts} +0 -0
- /package/dist/services/{query-builder/rules/spec/rule-relevance.spec.d.ts → prewarm/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/{rules/spec/rule-to-sql.spec.d.ts → spec/queries/golden.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{rules/spec/runtime-semantics.spec.d.ts → spec/queries/pops-query.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{rules/spec/strip-parameters.spec.d.ts → spec/queries/queries.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{sql/spec/expression.spec.d.ts → spec/queries/reported-bugs.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{sql/spec/format.spec.d.ts → spec/query-builder-service.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{sql/spec/predicate.spec.d.ts → spec/rules/pattern-language.spec.d.ts} +0 -0
- /package/dist/services/query-builder/{sql/spec/regex.spec.d.ts → spec/rules/rule-parser.spec.d.ts} +0 -0
- /package/dist/services/{revalidate/revalidate-service.spec.d.ts → query-builder/spec/rules/rule-reducer.spec.d.ts} +0 -0
- /package/dist/services/{setup/extension/crx.spec.d.ts → query-builder/spec/rules/rule-relevance.spec.d.ts} +0 -0
- /package/dist/services/{setup/extension/webstore.spec.d.ts → query-builder/spec/rules/rule-to-sql.spec.d.ts} +0 -0
- /package/dist/services/{setup/os/tool-registry.spec.d.ts → query-builder/spec/rules/runtime-semantics.spec.d.ts} +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { CliServiceInterface } from "../cli/index.js";
|
|
1
2
|
import { DiffContext, DiffService } from "./index.js";
|
|
2
3
|
export declare class DiffServiceFactory {
|
|
3
4
|
private context;
|
|
5
|
+
private cli?;
|
|
4
6
|
service?: DiffService;
|
|
5
|
-
constructor(context: DiffContext);
|
|
7
|
+
constructor(context: DiffContext, cli?: CliServiceInterface);
|
|
6
8
|
getService(): DiffService;
|
|
7
9
|
}
|
|
@@ -2,14 +2,16 @@ import { CliServiceFactory } from "../cli/index.js";
|
|
|
2
2
|
import { DiffService } from "./index.js";
|
|
3
3
|
export class DiffServiceFactory {
|
|
4
4
|
context;
|
|
5
|
+
cli;
|
|
5
6
|
service = undefined;
|
|
6
|
-
constructor(context) {
|
|
7
|
+
constructor(context, cli) {
|
|
7
8
|
this.context = context;
|
|
9
|
+
this.cli = cli;
|
|
8
10
|
}
|
|
9
11
|
getService() {
|
|
10
12
|
if (!(this.service instanceof DiffService)) {
|
|
11
|
-
const cliService = new CliServiceFactory().getService();
|
|
12
|
-
this.service = new DiffService(cliService, this.context.executablePath, this.context.executableTemplate);
|
|
13
|
+
const cliService = this.cli ?? new CliServiceFactory().getService();
|
|
14
|
+
this.service = new DiffService(cliService, this.context.executablePath, this.context.executableTemplate, this.context.opensDiffTool);
|
|
13
15
|
}
|
|
14
16
|
return this.service;
|
|
15
17
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CliServiceInterface } from "../cli/index.js";
|
|
2
2
|
export declare class DiffService {
|
|
3
3
|
private cli;
|
|
4
4
|
private diffExecutablePath?;
|
|
5
5
|
private diffExecutableTemplate?;
|
|
6
|
+
private opensDiffTool;
|
|
6
7
|
private tempPath;
|
|
7
|
-
constructor(cli:
|
|
8
|
+
constructor(cli: CliServiceInterface, diffExecutablePath?: string, diffExecutableTemplate?: string, opensDiffTool?: boolean);
|
|
8
9
|
diff(localPath: string, fileName: string, temporaryContent: string): Promise<boolean>;
|
|
9
10
|
diffContent(fileName: string, firstContent: string, secondContent: string, diffSuffix?: string[]): Promise<{
|
|
10
11
|
updatedFile: string;
|
|
@@ -14,6 +15,14 @@ export declare class DiffService {
|
|
|
14
15
|
* Returns a temporal directory path.
|
|
15
16
|
*/
|
|
16
17
|
getTemporalDirectoryPath(): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* The temporary directory remote installation files are written to.
|
|
20
|
+
*
|
|
21
|
+
* Returns null instead of throwing, because the one caller turns that into a
|
|
22
|
+
* readable CLI error — an mkdtemp stack trace says less than "unable to
|
|
23
|
+
* create a temporary directory" does.
|
|
24
|
+
*/
|
|
25
|
+
private createTemporalDirectory;
|
|
17
26
|
writeContentToTemporalFile(temporaryFileName: string, content: string): Promise<string>;
|
|
18
27
|
/**
|
|
19
28
|
* @param localContent local file content.
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import pathModule from "node:path";
|
|
2
2
|
import fs, { readFile } from "node:fs/promises";
|
|
3
|
+
import { mkdtempSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
3
5
|
import { execSync } from "node:child_process";
|
|
4
|
-
import { createTemporalDirectory } from "../../helpers/file-helper.js";
|
|
5
|
-
import { unescapeSpaces } from "../../helpers/normalize.js";
|
|
6
6
|
import { DEFAULT_INTELLIJ_IDEA_PATH_MACOS } from "../../models/os.js";
|
|
7
|
+
import ApplicationError from "../error-handling/error/application-error.js";
|
|
8
|
+
/**
|
|
9
|
+
* Remove the backslashes a shell-quoted path carries before its spaces, so the
|
|
10
|
+
* value can be handed to a child process as a single argument again.
|
|
11
|
+
*/
|
|
12
|
+
function unescapeSpaces(string_) {
|
|
13
|
+
return string_.replaceAll("\\ ", " ");
|
|
14
|
+
}
|
|
7
15
|
export class DiffService {
|
|
8
16
|
cli;
|
|
9
17
|
diffExecutablePath;
|
|
10
18
|
diffExecutableTemplate;
|
|
19
|
+
opensDiffTool;
|
|
11
20
|
tempPath = null;
|
|
12
|
-
constructor(cli, diffExecutablePath, diffExecutableTemplate) {
|
|
21
|
+
constructor(cli, diffExecutablePath, diffExecutableTemplate, opensDiffTool = true) {
|
|
13
22
|
this.cli = cli;
|
|
14
23
|
this.diffExecutablePath = diffExecutablePath;
|
|
15
24
|
this.diffExecutableTemplate = diffExecutableTemplate;
|
|
25
|
+
this.opensDiffTool = opensDiffTool;
|
|
16
26
|
}
|
|
17
27
|
async diff(localPath, fileName, temporaryContent) {
|
|
18
28
|
const temporaryFilePath = await this.writeContentToTemporalFile(fileName, temporaryContent);
|
|
@@ -33,14 +43,29 @@ export class DiffService {
|
|
|
33
43
|
async getTemporalDirectoryPath() {
|
|
34
44
|
// create temporal directory for remote installationFiles so the diff can be generated
|
|
35
45
|
if (!this.tempPath) {
|
|
36
|
-
this.tempPath =
|
|
46
|
+
this.tempPath = this.createTemporalDirectory();
|
|
37
47
|
}
|
|
38
48
|
if (!this.tempPath) {
|
|
39
|
-
|
|
40
|
-
this.cli.exit(1);
|
|
49
|
+
throw new ApplicationError("No temporary directory found and unable to create a new temporary directory");
|
|
41
50
|
}
|
|
42
51
|
return this.tempPath;
|
|
43
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* The temporary directory remote installation files are written to.
|
|
55
|
+
*
|
|
56
|
+
* Returns null instead of throwing, because the one caller turns that into a
|
|
57
|
+
* readable CLI error — an mkdtemp stack trace says less than "unable to
|
|
58
|
+
* create a temporary directory" does.
|
|
59
|
+
*/
|
|
60
|
+
createTemporalDirectory() {
|
|
61
|
+
try {
|
|
62
|
+
return mkdtempSync(pathModule.join(tmpdir(), "speed-kit-cli-"));
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
this.cli.writeError(`Could not create a temporary directory: ${error}`);
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
44
69
|
async writeContentToTemporalFile(temporaryFileName, content) {
|
|
45
70
|
if (!content) {
|
|
46
71
|
content = "";
|
|
@@ -94,7 +119,7 @@ export class DiffService {
|
|
|
94
119
|
if (this.isContentEqual(firstContent, secondContent)) {
|
|
95
120
|
return true;
|
|
96
121
|
}
|
|
97
|
-
if (skipDiffExecution) {
|
|
122
|
+
if (skipDiffExecution || !this.opensDiffTool) {
|
|
98
123
|
return false;
|
|
99
124
|
}
|
|
100
125
|
// try custom diff tool
|
package/dist/services/document-handler-runtime/context/document-handler-runtime-context.d.ts
CHANGED
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
export declare const CUSTOMER_CONFIG = "config_customer";
|
|
2
1
|
export declare const LOCAL_DOCUMENT_HANDLER = "custom_documentHandler";
|
|
3
2
|
export declare const LOCAL_DOCUMENT_HANDLER_CONFIG = "config_documentHandler";
|
|
4
3
|
export declare const LOCAL_DYNAMIC_FETCHER = "custom_dynamicFetcher";
|
|
5
4
|
export declare const LOCAL_DYNAMIC_FETCHER_CONFIG = "config_dynamicBlocks";
|
|
6
5
|
export declare const LOCAL_STYLES = "config_dynamicStyles";
|
|
7
|
-
export declare const LATEST_DOCUMENT_HANDLER_URL = "https://www.baqend.com/speed-kit-handler/latest/DocumentHandler.js";
|
|
8
6
|
export declare const LATEST_DYNAMIC_FETCHER_URL = "https://www.baqend.com/speed-kit/latest/dynamic-fetcher.js";
|
|
9
7
|
export declare const LOCAL_TRIGGERED_BY = "STREAM:QA";
|
|
10
|
-
export
|
|
11
|
-
export declare const TEST_DATABASE_MOCK_FILE_NAME = "database-mock";
|
|
12
|
-
export declare const TEST_ORESTES_MOCK_FILE_NAME = "orestes-mock";
|
|
13
|
-
export declare const TEST_FILE_NAME_PREFIX = "document";
|
|
14
|
-
export declare const TEST_RUNTIME_FILE_NAME = "runtime";
|
|
15
|
-
export declare const TEST_PACKAGE_JSON = "package";
|
|
16
|
-
export default class DocumentHandlerRuntimeContext {
|
|
17
|
-
readonly verboseLevel: boolean;
|
|
18
|
-
readonly fileDependencies: string[];
|
|
8
|
+
export default interface DocumentHandlerRuntimeContext {
|
|
19
9
|
readonly customerPath: string;
|
|
20
10
|
readonly configName: string;
|
|
21
|
-
readonly
|
|
22
|
-
readonly requiredFiles: string[];
|
|
23
|
-
constructor(customerPath: string, configName: string, testNames?: string[], verboseLevel?: boolean);
|
|
11
|
+
readonly verboseLevel: boolean;
|
|
24
12
|
}
|
|
@@ -1,62 +1,10 @@
|
|
|
1
|
-
export const CUSTOMER_CONFIG = "config_customer";
|
|
2
1
|
export const LOCAL_DOCUMENT_HANDLER = "custom_documentHandler";
|
|
3
2
|
export const LOCAL_DOCUMENT_HANDLER_CONFIG = "config_documentHandler";
|
|
4
3
|
export const LOCAL_DYNAMIC_FETCHER = "custom_dynamicFetcher";
|
|
5
4
|
export const LOCAL_DYNAMIC_FETCHER_CONFIG = "config_dynamicBlocks";
|
|
6
5
|
export const LOCAL_STYLES = "config_dynamicStyles";
|
|
7
|
-
export const LATEST_DOCUMENT_HANDLER_URL = "https://www.baqend.com/speed-kit-handler/latest/DocumentHandler.js";
|
|
8
6
|
export const LATEST_DYNAMIC_FETCHER_URL = "https://www.baqend.com/speed-kit/latest/dynamic-fetcher.js";
|
|
9
7
|
// Local runs have no persistent cache, so an origin HTML is served straight to the developer and may
|
|
10
8
|
// legitimately be older than the default five minutes. STREAM:QA relaxes the document handler's
|
|
11
9
|
// Shopify staleness check to one hour, see ONE_HOUR_STALENESS_TRIGGERS in document-handler.
|
|
12
10
|
export const LOCAL_TRIGGERED_BY = "STREAM:QA";
|
|
13
|
-
export const TEST_DOCUMENT_HANDLER_FILE_NAME = "testDocumentHandler";
|
|
14
|
-
export const TEST_DATABASE_MOCK_FILE_NAME = "database-mock";
|
|
15
|
-
export const TEST_ORESTES_MOCK_FILE_NAME = "orestes-mock";
|
|
16
|
-
export const TEST_FILE_NAME_PREFIX = "document";
|
|
17
|
-
export const TEST_RUNTIME_FILE_NAME = "runtime";
|
|
18
|
-
export const TEST_PACKAGE_JSON = "package";
|
|
19
|
-
const FILE_DEPENDENCIES = [
|
|
20
|
-
LOCAL_DOCUMENT_HANDLER_CONFIG,
|
|
21
|
-
LOCAL_DYNAMIC_FETCHER_CONFIG,
|
|
22
|
-
LOCAL_STYLES,
|
|
23
|
-
TEST_DATABASE_MOCK_FILE_NAME,
|
|
24
|
-
TEST_ORESTES_MOCK_FILE_NAME,
|
|
25
|
-
TEST_DOCUMENT_HANDLER_FILE_NAME,
|
|
26
|
-
TEST_PACKAGE_JSON,
|
|
27
|
-
TEST_RUNTIME_FILE_NAME,
|
|
28
|
-
];
|
|
29
|
-
export default class DocumentHandlerRuntimeContext {
|
|
30
|
-
verboseLevel;
|
|
31
|
-
fileDependencies = [
|
|
32
|
-
...FILE_DEPENDENCIES,
|
|
33
|
-
LOCAL_DOCUMENT_HANDLER,
|
|
34
|
-
LOCAL_DYNAMIC_FETCHER,
|
|
35
|
-
];
|
|
36
|
-
customerPath;
|
|
37
|
-
configName;
|
|
38
|
-
testNames;
|
|
39
|
-
requiredFiles;
|
|
40
|
-
constructor(customerPath, configName, testNames, verboseLevel = false) {
|
|
41
|
-
this.verboseLevel = verboseLevel;
|
|
42
|
-
this.configName = configName;
|
|
43
|
-
this.customerPath = customerPath;
|
|
44
|
-
this.testNames = testNames;
|
|
45
|
-
let dependencies = [];
|
|
46
|
-
if (this.testNames && this.testNames.length > 0) {
|
|
47
|
-
for (const testName of this.testNames) {
|
|
48
|
-
dependencies = [
|
|
49
|
-
...dependencies,
|
|
50
|
-
`${TEST_FILE_NAME_PREFIX}-${testName}`,
|
|
51
|
-
];
|
|
52
|
-
}
|
|
53
|
-
this.fileDependencies = [...this.fileDependencies, ...dependencies];
|
|
54
|
-
}
|
|
55
|
-
this.requiredFiles = [
|
|
56
|
-
CUSTOMER_CONFIG,
|
|
57
|
-
LOCAL_DOCUMENT_HANDLER_CONFIG,
|
|
58
|
-
LOCAL_DYNAMIC_FETCHER_CONFIG,
|
|
59
|
-
LOCAL_STYLES,
|
|
60
|
-
];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BundleService } from "../bundler/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { CliServiceInterface } from "../cli/index.js";
|
|
3
3
|
import { CustomerConfig, FileListInterface } from "../integration-api/index.js";
|
|
4
4
|
import { EntityManager } from "baqend";
|
|
5
5
|
import { DocumentHandlerResponse } from "./server/document-handler-response.js";
|
|
@@ -20,7 +20,7 @@ export declare class DocumentHandlerServer {
|
|
|
20
20
|
/**
|
|
21
21
|
* @param workSpace - Directory the packages a customer config declares are installed into.
|
|
22
22
|
*/
|
|
23
|
-
constructor(customerConfig: CustomerConfig, files: FileListInterface, bundler: BundleService, cli:
|
|
23
|
+
constructor(customerConfig: CustomerConfig, files: FileListInterface, bundler: BundleService, cli: CliServiceInterface, workSpace: string, verboseLevel?: boolean, entityManager?: EntityManager);
|
|
24
24
|
transform(contentType: string, html: string, variation: string, url: string, headers: Record<string, string>): Promise<DocumentHandlerResponse>;
|
|
25
25
|
private getTransformFunctionWrapper;
|
|
26
26
|
buildDocumentHandler(): Promise<void>;
|
package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import { FileListInterface } from "../../integration-api/index.js";
|
|
2
2
|
import DocumentHandlerRuntimeContext from "../context/document-handler-runtime-context.js";
|
|
3
|
-
import
|
|
3
|
+
import { CliServiceInterface, UserCliConfig } from "../../cli/index.js";
|
|
4
4
|
import { DocumentHandlerServer } from "../document-handler-server.js";
|
|
5
|
-
import { UserCliConfig } from "../../../helpers/cli-config.js";
|
|
6
5
|
export default class DocumentHandlerRuntimeServiceFactory {
|
|
7
6
|
private readonly context;
|
|
8
7
|
private cliConfig;
|
|
9
8
|
private files?;
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
private cli?;
|
|
10
|
+
constructor(context: DocumentHandlerRuntimeContext, cliConfig: UserCliConfig, files?: FileListInterface, cli?: CliServiceInterface);
|
|
12
11
|
buildDocumentHandlerServer(): Promise<DocumentHandlerServer>;
|
|
13
|
-
private prepareIntegrationApi;
|
|
14
|
-
private getIntegrationFiles;
|
|
15
|
-
private checkRequiredFiles;
|
|
16
|
-
private createNeededFolderStructure;
|
|
17
|
-
private prepareLocalDocumentHandler;
|
|
18
|
-
private preparePackageJson;
|
|
19
|
-
private prepareTestCases;
|
|
20
12
|
private getCustomerConfig;
|
|
21
13
|
/**
|
|
22
14
|
* Gives the workspace its own manifest before anything is installed into it.
|
package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { IntegrationApiContext, IntegrationApiFactory, } from "../../integration-api/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import DocumentHandlerRuntimeService from "../document-handler-runtime-service.js";
|
|
4
|
-
import { CliServiceFactory } from "../../cli/index.js";
|
|
5
|
-
import RequiredFileNotFoundError from "../error/required-file-not-found-error.js";
|
|
2
|
+
import { CliServiceFactory, } from "../../cli/index.js";
|
|
6
3
|
import { DocumentHandlerServer } from "../document-handler-server.js";
|
|
7
4
|
import { BundleServiceFactory } from "../../bundler/index.js";
|
|
8
5
|
import { EntityManagerFactory } from "../../config-api/entity-manager-factory.js";
|
|
@@ -13,89 +10,26 @@ export default class DocumentHandlerRuntimeServiceFactory {
|
|
|
13
10
|
context;
|
|
14
11
|
cliConfig;
|
|
15
12
|
files;
|
|
16
|
-
|
|
13
|
+
cli;
|
|
14
|
+
constructor(context, cliConfig, files, cli) {
|
|
17
15
|
this.context = context;
|
|
18
16
|
this.cliConfig = cliConfig;
|
|
19
17
|
this.files = files;
|
|
20
|
-
|
|
21
|
-
async buildService() {
|
|
22
|
-
const integrationApi = this.prepareIntegrationApi();
|
|
23
|
-
const files = await this.getIntegrationFiles(integrationApi);
|
|
24
|
-
this.checkRequiredFiles(files);
|
|
25
|
-
const cliService = new CliServiceFactory().getService();
|
|
26
|
-
const customerConfig = this.getCustomerConfig(files);
|
|
27
|
-
this.preparePackageJson(integrationApi, customerConfig);
|
|
28
|
-
return new DocumentHandlerRuntimeService(files, customerConfig, cliService, { testNames: this.context.testNames || [] });
|
|
18
|
+
this.cli = cli;
|
|
29
19
|
}
|
|
30
20
|
async buildDocumentHandlerServer() {
|
|
31
21
|
const integrationApiContext = new IntegrationApiContext(this.context.customerPath, this.context.configName, []);
|
|
32
22
|
const files = this.files ||
|
|
33
|
-
(await new IntegrationApiFactory(integrationApiContext, this.cliConfig)
|
|
23
|
+
(await new IntegrationApiFactory(integrationApiContext, this.cliConfig, this.cli)
|
|
34
24
|
.buildService()
|
|
35
25
|
.run());
|
|
36
26
|
const customerConfig = this.getCustomerConfig(files);
|
|
37
|
-
const cliService = new CliServiceFactory().getService();
|
|
27
|
+
const cliService = this.cli ?? new CliServiceFactory().getService();
|
|
38
28
|
await this.installAdditionalDependencies(customerConfig, cliService);
|
|
39
29
|
const bundler = new BundleServiceFactory(this.context.customerPath).buildService();
|
|
40
30
|
const entityManagerResult = await safe(new EntityManagerFactory().getEntityManager(customerConfig.app));
|
|
41
31
|
return new DocumentHandlerServer(customerConfig, files, bundler, cliService, this.cliConfig.nodeModulesPath, this.context.verboseLevel, entityManagerResult.success ? entityManagerResult.data : null);
|
|
42
32
|
}
|
|
43
|
-
prepareIntegrationApi() {
|
|
44
|
-
const integrationApiContext = new IntegrationApiContext(this.context.customerPath, this.context.configName, this.context.fileDependencies, [".git", ".idea", "node_modules"]);
|
|
45
|
-
return new IntegrationApiFactory(integrationApiContext, this.cliConfig).buildService();
|
|
46
|
-
}
|
|
47
|
-
async getIntegrationFiles(integrationApi) {
|
|
48
|
-
this.createNeededFolderStructure(integrationApi);
|
|
49
|
-
this.prepareLocalDocumentHandler(integrationApi);
|
|
50
|
-
this.prepareTestCases(integrationApi);
|
|
51
|
-
return await integrationApi.run();
|
|
52
|
-
}
|
|
53
|
-
checkRequiredFiles(files) {
|
|
54
|
-
for (const requiredFile of this.context.requiredFiles) {
|
|
55
|
-
if (!files.hasFile(requiredFile)) {
|
|
56
|
-
throw new RequiredFileNotFoundError(`file ${requiredFile} not found`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
createNeededFolderStructure(integrationApi) {
|
|
61
|
-
integrationApi.createFolder(".local");
|
|
62
|
-
integrationApi.createFolder(".local/test");
|
|
63
|
-
integrationApi.createFolder(".local/test/src");
|
|
64
|
-
integrationApi.createFolder(".local/test/tmp");
|
|
65
|
-
integrationApi.createFolder(".local/test/tmp/server");
|
|
66
|
-
}
|
|
67
|
-
prepareLocalDocumentHandler(integrationApi) {
|
|
68
|
-
if (!integrationApi.fileExists(`.local/test/src/${TEST_DOCUMENT_HANDLER_FILE_NAME}`)) {
|
|
69
|
-
integrationApi.writeFile(`.local/test/src/${TEST_DOCUMENT_HANDLER_FILE_NAME}`);
|
|
70
|
-
}
|
|
71
|
-
if (!integrationApi.fileExists(`.local/test/src/${TEST_DATABASE_MOCK_FILE_NAME}`)) {
|
|
72
|
-
integrationApi.writeFile(`.local/test/src/${TEST_DATABASE_MOCK_FILE_NAME}`);
|
|
73
|
-
}
|
|
74
|
-
if (!integrationApi.fileExists(`.local/test/src/${TEST_ORESTES_MOCK_FILE_NAME}`)) {
|
|
75
|
-
integrationApi.writeFile(`.local/test/src/${TEST_ORESTES_MOCK_FILE_NAME}`);
|
|
76
|
-
}
|
|
77
|
-
if (!integrationApi.fileExists(`.local/test/src/${TEST_RUNTIME_FILE_NAME}`)) {
|
|
78
|
-
integrationApi.writeFile(`.local/test/src/${TEST_RUNTIME_FILE_NAME}`);
|
|
79
|
-
}
|
|
80
|
-
if (!integrationApi.fileExists(`.local/test/src/${TEST_PACKAGE_JSON}`, "json")) {
|
|
81
|
-
integrationApi.writeFile(`.local/test/src/${TEST_PACKAGE_JSON}`, "json");
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
preparePackageJson(integrationApi, customerConfig) {
|
|
85
|
-
if (customerConfig.dependencies &&
|
|
86
|
-
!integrationApi.fileExists(`.local/test/${TEST_PACKAGE_JSON}`, "json")) {
|
|
87
|
-
integrationApi.writeFile(`.local/test/${TEST_PACKAGE_JSON}`, "json");
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
prepareTestCases(integrationApi) {
|
|
91
|
-
if (this.context.testNames && this.context.testNames.length > 0) {
|
|
92
|
-
this.context.testNames.map(async (testName) => {
|
|
93
|
-
if (!integrationApi.fileExists(`.local/test/${TEST_FILE_NAME_PREFIX}-${testName}`)) {
|
|
94
|
-
integrationApi.writeFile(`.local/test/${TEST_FILE_NAME_PREFIX}-${testName}`);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
33
|
getCustomerConfig(files) {
|
|
100
34
|
const configFile = files.getByName("config_customer");
|
|
101
35
|
return configFile.config;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { describe, it } from "mocha";
|
|
3
|
-
import { ABORT_ERROR_CODE, ABORT_SERVER_TIMING, ABORT_STATUS_CODE, DocumentHandlerAbort, isDocumentHandlerAbort, } from "
|
|
4
|
-
import { DocumentHandlerTransformError } from "
|
|
3
|
+
import { ABORT_ERROR_CODE, ABORT_SERVER_TIMING, ABORT_STATUS_CODE, DocumentHandlerAbort, isDocumentHandlerAbort, } from "../document-handler-abort.js";
|
|
4
|
+
import { DocumentHandlerTransformError } from "../../onboarding/error/document-handler-transform-error.js";
|
|
5
5
|
/**
|
|
6
6
|
* Mirrors the service worker's `parseServerTimingHeader`, so the header this module
|
|
7
7
|
* emits is asserted against the parser that has to read it.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Runs a git command in the repository and returns its output. */
|
|
2
|
+
export type GitRunner = (args: string[]) => string;
|
|
3
|
+
/** A merge request that reached the default branch, as git recorded it. */
|
|
4
|
+
export interface MergedRequest {
|
|
5
|
+
/** The number the merge request has in GitLab. */
|
|
6
|
+
iid: number;
|
|
7
|
+
/** The merge commit. */
|
|
8
|
+
sha: string;
|
|
9
|
+
/** The state of the repository before the merge request. */
|
|
10
|
+
baseSha: string;
|
|
11
|
+
/** The first line of the merge commit body, which GitLab fills with the title. */
|
|
12
|
+
title: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GitRunner, MergedRequest } from "./git-repository-model.js";
|
|
2
|
+
/**
|
|
3
|
+
* The repository that holds the customer configurations.
|
|
4
|
+
*
|
|
5
|
+
* Every answer comes from the local clone. A merge request is found through
|
|
6
|
+
* the reference GitLab writes into the merge commit, so the lookup needs no
|
|
7
|
+
* token and no network.
|
|
8
|
+
*/
|
|
9
|
+
export declare class GitRepository {
|
|
10
|
+
readonly root: string;
|
|
11
|
+
private readonly run;
|
|
12
|
+
constructor(root: string, run: GitRunner);
|
|
13
|
+
/** The repository that contains `somePath`. */
|
|
14
|
+
static at(somePath: string, run?: GitRunner): GitRepository;
|
|
15
|
+
/** The path of `somePath` as git spells it. */
|
|
16
|
+
relative(somePath: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* The merge request with this number, as it was merged.
|
|
19
|
+
*
|
|
20
|
+
* @throws ApplicationError when the history holds no or several such merges
|
|
21
|
+
*/
|
|
22
|
+
mergeRequest(iid: number): MergedRequest;
|
|
23
|
+
/** The paths the merge request changed. */
|
|
24
|
+
changedPaths(request: MergedRequest): string[];
|
|
25
|
+
/** The paths below `directory` that the commit holds. */
|
|
26
|
+
pathsAt(sha: string, directory: string): string[];
|
|
27
|
+
/** The content of one file in the commit. */
|
|
28
|
+
contentAt(sha: string, filePath: string): string;
|
|
29
|
+
/** The paths below `directory` that changed between the commit and HEAD. */
|
|
30
|
+
changesSince(sha: string, directory: string): string[];
|
|
31
|
+
/** The paths below `directory` that the working tree changed. */
|
|
32
|
+
uncommittedChanges(directory: string): string[];
|
|
33
|
+
/** The title GitLab wrote into the merge commit. */
|
|
34
|
+
private titleOf;
|
|
35
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import ApplicationError from "../error-handling/error/application-error.js";
|
|
4
|
+
/**
|
|
5
|
+
* The repository that holds the customer configurations.
|
|
6
|
+
*
|
|
7
|
+
* Every answer comes from the local clone. A merge request is found through
|
|
8
|
+
* the reference GitLab writes into the merge commit, so the lookup needs no
|
|
9
|
+
* token and no network.
|
|
10
|
+
*/
|
|
11
|
+
export class GitRepository {
|
|
12
|
+
root;
|
|
13
|
+
run;
|
|
14
|
+
constructor(root, run) {
|
|
15
|
+
this.root = root;
|
|
16
|
+
this.run = run;
|
|
17
|
+
}
|
|
18
|
+
/** The repository that contains `somePath`. */
|
|
19
|
+
static at(somePath, run) {
|
|
20
|
+
const probe = run ?? runGit(somePath);
|
|
21
|
+
const root = probe(["rev-parse", "--show-toplevel"]).trim();
|
|
22
|
+
return new GitRepository(root, run ?? runGit(root));
|
|
23
|
+
}
|
|
24
|
+
/** The path of `somePath` as git spells it. */
|
|
25
|
+
relative(somePath) {
|
|
26
|
+
return path
|
|
27
|
+
.relative(this.root, path.resolve(somePath))
|
|
28
|
+
.replaceAll("\\", "/");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The merge request with this number, as it was merged.
|
|
32
|
+
*
|
|
33
|
+
* @throws ApplicationError when the history holds no or several such merges
|
|
34
|
+
*/
|
|
35
|
+
mergeRequest(iid) {
|
|
36
|
+
const commits = this.run([
|
|
37
|
+
"log",
|
|
38
|
+
"--extended-regexp",
|
|
39
|
+
`--grep=^See merge request [^ ]+!${iid}$`,
|
|
40
|
+
"--format=%H",
|
|
41
|
+
"HEAD",
|
|
42
|
+
])
|
|
43
|
+
.split("\n")
|
|
44
|
+
.filter((line) => line.length > 0);
|
|
45
|
+
if (commits.length === 0) {
|
|
46
|
+
throw new ApplicationError(`No merge of !${iid} found in this history`, [
|
|
47
|
+
"Merge requests are found through the reference in the merge commit",
|
|
48
|
+
`Pull the default branch of ${this.root} and try again`,
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
51
|
+
if (commits.length > 1) {
|
|
52
|
+
throw new ApplicationError(`The history holds ${commits.length} merges of !${iid}`);
|
|
53
|
+
}
|
|
54
|
+
const sha = commits[0];
|
|
55
|
+
const parents = this.run(["log", "-1", "--format=%P", sha])
|
|
56
|
+
.trim()
|
|
57
|
+
.split(" ");
|
|
58
|
+
if (parents.length < 2) {
|
|
59
|
+
throw new ApplicationError(`The merge of !${iid} is no merge commit, so its base is unknown`);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
iid,
|
|
63
|
+
sha,
|
|
64
|
+
baseSha: parents[0],
|
|
65
|
+
title: this.titleOf(sha, iid),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** The paths the merge request changed. */
|
|
69
|
+
changedPaths(request) {
|
|
70
|
+
return this.run(["diff", "--name-only", request.baseSha, request.sha])
|
|
71
|
+
.split("\n")
|
|
72
|
+
.filter((line) => line.length > 0);
|
|
73
|
+
}
|
|
74
|
+
/** The paths below `directory` that the commit holds. */
|
|
75
|
+
pathsAt(sha, directory) {
|
|
76
|
+
return this.run(["ls-tree", "-r", "--name-only", sha, "--", directory])
|
|
77
|
+
.split("\n")
|
|
78
|
+
.filter((line) => line.length > 0);
|
|
79
|
+
}
|
|
80
|
+
/** The content of one file in the commit. */
|
|
81
|
+
contentAt(sha, filePath) {
|
|
82
|
+
return this.run(["show", `${sha}:${filePath}`]);
|
|
83
|
+
}
|
|
84
|
+
/** The paths below `directory` that changed between the commit and HEAD. */
|
|
85
|
+
changesSince(sha, directory) {
|
|
86
|
+
return this.run(["diff", "--name-only", sha, "HEAD", "--", directory])
|
|
87
|
+
.split("\n")
|
|
88
|
+
.filter((line) => line.length > 0);
|
|
89
|
+
}
|
|
90
|
+
/** The paths below `directory` that the working tree changed. */
|
|
91
|
+
uncommittedChanges(directory) {
|
|
92
|
+
return this.run(["status", "--porcelain", "--", directory])
|
|
93
|
+
.split("\n")
|
|
94
|
+
.filter((line) => line.length > 0)
|
|
95
|
+
.map((line) => line.slice(3));
|
|
96
|
+
}
|
|
97
|
+
/** The title GitLab wrote into the merge commit. */
|
|
98
|
+
titleOf(sha, iid) {
|
|
99
|
+
const body = this.run(["log", "-1", "--format=%b", sha])
|
|
100
|
+
.split("\n")
|
|
101
|
+
.map((line) => line.trim())
|
|
102
|
+
.filter((line) => line.length > 0 && !line.startsWith("See merge request"));
|
|
103
|
+
return body[0] ?? `!${iid}`;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** Runs git in a directory, and reports a failure with the output of git. */
|
|
107
|
+
function runGit(cwd) {
|
|
108
|
+
return (args) => {
|
|
109
|
+
try {
|
|
110
|
+
return execFileSync("git", args, {
|
|
111
|
+
cwd,
|
|
112
|
+
encoding: "utf8",
|
|
113
|
+
maxBuffer: 32 * 1024 * 1024,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
throw new ApplicationError(`git ${args[0]} failed: ${error.stderr?.toString().trim() || error.message}`);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|