@speedkit/cli 3.43.2 → 4.1.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 +38 -0
- package/README.md +6 -6
- package/bin/dev +2 -15
- package/bin/run +2 -2
- package/dist/commands/build-parameter-query.d.ts +3 -3
- package/dist/commands/build-parameter-query.js +12 -15
- package/dist/commands/build-prewarm-query.d.ts +4 -4
- package/dist/commands/build-prewarm-query.js +13 -16
- package/dist/commands/config/edit.js +7 -11
- package/dist/commands/deploy.d.ts +3 -5
- package/dist/commands/deploy.js +12 -16
- package/dist/commands/diff-url-parameters.d.ts +3 -3
- package/dist/commands/diff-url-parameters.js +27 -30
- package/dist/commands/document-handler.d.ts +4 -4
- package/dist/commands/document-handler.js +13 -17
- package/dist/commands/find-pops.d.ts +2 -2
- package/dist/commands/find-pops.js +22 -24
- package/dist/commands/generate-customer-config.d.ts +2 -2
- package/dist/commands/generate-customer-config.js +13 -16
- package/dist/commands/generate-pop-config.d.ts +7 -7
- package/dist/commands/generate-pop-config.js +32 -41
- package/dist/commands/login.d.ts +1 -1
- package/dist/commands/login.js +13 -17
- package/dist/commands/onboarding.d.ts +3 -5
- package/dist/commands/onboarding.js +10 -13
- package/dist/commands/prewarm.d.ts +9 -9
- package/dist/commands/prewarm.js +25 -28
- package/dist/commands/pull.d.ts +3 -3
- package/dist/commands/pull.js +11 -14
- package/dist/commands/wpt-launcher.d.ts +7 -7
- package/dist/commands/wpt-launcher.js +21 -26
- package/dist/helpers/array-helper.js +1 -4
- package/dist/helpers/build-query-helper.js +5 -12
- package/dist/helpers/cli-config.d.ts +3 -3
- package/dist/helpers/cli-config.js +11 -16
- package/dist/helpers/customer-config.d.ts +4 -8
- package/dist/helpers/customer-config.js +18 -23
- package/dist/helpers/evaluate-speed-kit-config.d.ts +1 -1
- package/dist/helpers/evaluate-speed-kit-config.js +42 -26
- package/dist/helpers/file-helper.js +8 -13
- package/dist/helpers/get-parsed-config.d.ts +1 -1
- package/dist/helpers/get-parsed-config.js +6 -10
- package/dist/helpers/html-format-helper.js +3 -6
- package/dist/helpers/is-directory.js +3 -6
- package/dist/helpers/is-file.js +3 -6
- package/dist/helpers/logging-helper.js +7 -13
- package/dist/helpers/normalize.js +10 -17
- package/dist/helpers/race.d.ts +1 -1
- package/dist/helpers/race.js +3 -9
- package/dist/helpers/safe.js +1 -4
- package/dist/helpers/scrape.d.ts +1 -1
- package/dist/helpers/scrape.js +3 -7
- package/dist/helpers/site-analyzer.js +5 -9
- package/dist/helpers/speed-kit-rule-to-reg-exp.js +1 -4
- package/dist/models/cli-parameters.d.ts +4 -4
- package/dist/models/cli-parameters.js +13 -16
- package/dist/models/files.js +1 -4
- package/dist/models/install.js +1 -2
- package/dist/models/os.js +1 -4
- package/dist/services/athena/athena-service-factory.d.ts +1 -1
- package/dist/services/athena/athena-service-factory.js +15 -19
- package/dist/services/athena/athena-service-model.js +2 -5
- package/dist/services/athena/athena-service.d.ts +1 -1
- package/dist/services/athena/athena-service.js +18 -23
- package/dist/services/athena/error/athena-query-error.d.ts +1 -1
- package/dist/services/athena/error/athena-query-error.js +2 -7
- package/dist/services/athena/error/fetch-credentials-error.d.ts +1 -1
- package/dist/services/athena/error/fetch-credentials-error.js +2 -7
- package/dist/services/athena/index.d.ts +4 -4
- package/dist/services/athena/index.js +4 -7
- package/dist/services/bundler/bundle-service-factory.d.ts +3 -1
- package/dist/services/bundler/bundle-service-factory.js +7 -7
- package/dist/services/bundler/bundle-service.d.ts +9 -12
- package/dist/services/bundler/bundle-service.js +42 -32
- package/dist/services/bundler/error/bundle-fetch-error.d.ts +1 -1
- package/dist/services/bundler/error/bundle-fetch-error.js +2 -7
- package/dist/services/bundler/error/bundle-resolve-error.d.ts +1 -1
- package/dist/services/bundler/error/bundle-resolve-error.js +2 -7
- package/dist/services/bundler/index.d.ts +2 -2
- package/dist/services/bundler/index.js +2 -5
- package/dist/services/cli/cli-service-factory.d.ts +2 -2
- package/dist/services/cli/cli-service-factory.js +6 -10
- package/dist/services/cli/cli-service-model.d.ts +21 -6
- package/dist/services/cli/cli-service-model.js +3 -7
- package/dist/services/cli/cli-service.d.ts +10 -8
- package/dist/services/cli/cli-service.js +64 -61
- package/dist/services/cli/error/cli-type-error.js +1 -4
- package/dist/services/cli/index.d.ts +3 -3
- package/dist/services/cli/index.js +3 -6
- package/dist/services/config-api/client.d.ts +2 -2
- package/dist/services/config-api/client.js +29 -34
- package/dist/services/config-api/config-api-factory.d.ts +2 -2
- package/dist/services/config-api/config-api-factory.js +15 -20
- package/dist/services/config-api/config-api-model.d.ts +2 -2
- package/dist/services/config-api/config-api-model.js +1 -5
- package/dist/services/config-api/config-api-service.d.ts +2 -2
- package/dist/services/config-api/config-api-service.js +1 -5
- package/dist/services/config-api/entity-manager-factory.js +3 -7
- package/dist/services/config-api/error/json-response-error.d.ts +1 -1
- package/dist/services/config-api/error/json-response-error.js +2 -7
- package/dist/services/config-api/error/login-error.d.ts +1 -1
- package/dist/services/config-api/error/login-error.js +2 -7
- package/dist/services/config-api/error/orestes-api-error.d.ts +1 -1
- package/dist/services/config-api/error/orestes-api-error.js +2 -7
- package/dist/services/config-api/index.d.ts +3 -3
- package/dist/services/config-api/index.js +3 -6
- package/dist/services/config-api-service.d.ts +1 -1
- package/dist/services/config-api-service.js +6 -11
- package/dist/services/customer-config/customer-config-service-context.js +3 -7
- package/dist/services/customer-config/customer-config-service-factory.d.ts +1 -1
- package/dist/services/customer-config/customer-config-service-factory.js +6 -10
- package/dist/services/customer-config/customer-config-service-model.js +6 -9
- package/dist/services/customer-config/customer-config-service.d.ts +3 -3
- package/dist/services/customer-config/customer-config-service.js +55 -55
- package/dist/services/customer-config/index.d.ts +4 -4
- package/dist/services/customer-config/index.js +4 -7
- package/dist/services/customer-config/templates/config_documentHandler.js.hbs +88 -1
- package/dist/services/deploy/builder/install-resource-builder.d.ts +2 -2
- package/dist/services/deploy/builder/install-resource-builder.js +3 -7
- package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.d.ts +4 -4
- package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.js +19 -24
- package/dist/services/deploy/checks/post-deploy/revalidated-module-check.d.ts +3 -3
- package/dist/services/deploy/checks/post-deploy/revalidated-module-check.js +10 -14
- package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +3 -3
- package/dist/services/deploy/checks/post-deploy/save-files-check.js +8 -12
- package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.d.ts +3 -3
- package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +14 -20
- package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +3 -3
- package/dist/services/deploy/checks/pre-deploy/split-change-check.js +19 -20
- package/dist/services/deploy/context/deploy-context.d.ts +2 -2
- package/dist/services/deploy/context/deploy-context.js +10 -14
- package/dist/services/deploy/deploy-service-factory.d.ts +3 -3
- package/dist/services/deploy/deploy-service-factory.js +36 -40
- package/dist/services/deploy/deploy-service-model.d.ts +10 -10
- package/dist/services/deploy/deploy-service-model.js +1 -2
- package/dist/services/deploy/deploy-service.d.ts +4 -4
- package/dist/services/deploy/deploy-service.js +10 -15
- package/dist/services/deploy/error/check-module-file-error.d.ts +1 -1
- package/dist/services/deploy/error/check-module-file-error.js +2 -7
- package/dist/services/deploy/error/deploy-install-resource-error.d.ts +1 -1
- package/dist/services/deploy/error/deploy-install-resource-error.js +2 -7
- package/dist/services/deploy/error/deploy-module-file-error.d.ts +1 -1
- package/dist/services/deploy/error/deploy-module-file-error.js +2 -7
- package/dist/services/deploy/error/deploy-server-config-error.d.ts +1 -1
- package/dist/services/deploy/error/deploy-server-config-error.js +2 -7
- package/dist/services/deploy/error/evaluate-sk-config-error.d.ts +1 -1
- package/dist/services/deploy/error/evaluate-sk-config-error.js +2 -7
- package/dist/services/deploy/error/file-handler-error.d.ts +1 -1
- package/dist/services/deploy/error/file-handler-error.js +2 -7
- package/dist/services/deploy/error/post-deploy-deployment-detection-error.d.ts +1 -1
- package/dist/services/deploy/error/post-deploy-deployment-detection-error.js +2 -7
- package/dist/services/deploy/error/safe-file-error.d.ts +1 -1
- package/dist/services/deploy/error/safe-file-error.js +2 -7
- package/dist/services/deploy/handler/customer-config-handler.d.ts +6 -6
- package/dist/services/deploy/handler/customer-config-handler.js +6 -10
- package/dist/services/deploy/handler/install-resource-handler.d.ts +7 -7
- package/dist/services/deploy/handler/install-resource-handler.js +22 -27
- package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.d.ts +4 -4
- package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +1 -4
- package/dist/services/deploy/handler/module-handler.d.ts +6 -6
- package/dist/services/deploy/handler/module-handler.js +12 -18
- package/dist/services/deploy/handler/server-config-handler.d.ts +5 -5
- package/dist/services/deploy/handler/server-config-handler.js +10 -14
- package/dist/services/deploy/interface/deploy-handler-interface.d.ts +1 -1
- package/dist/services/deploy/interface/deploy-handler-interface.js +1 -2
- package/dist/services/deploy/interface/install-configs.js +1 -2
- package/dist/services/deploy/interface/install-resource-processor-interface.d.ts +1 -1
- package/dist/services/deploy/interface/install-resource-processor-interface.js +1 -2
- package/dist/services/deploy/interface/install.d.ts +1 -1
- package/dist/services/deploy/interface/install.js +1 -2
- package/dist/services/deploy/interface/runtime-modifier.d.ts +1 -1
- package/dist/services/deploy/interface/runtime-modifier.js +1 -2
- package/dist/services/deploy/interface/validate-origins-response.js +1 -2
- package/dist/services/diff/diff-model.js +1 -5
- package/dist/services/diff/diff-service-factory.d.ts +1 -1
- package/dist/services/diff/diff-service-factory.js +6 -10
- package/dist/services/diff/diff-service.d.ts +1 -1
- package/dist/services/diff/diff-service.js +19 -24
- package/dist/services/diff/index.d.ts +3 -3
- package/dist/services/diff/index.js +3 -6
- package/dist/services/diff-service.d.ts +1 -1
- package/dist/services/diff-service.js +16 -21
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +30 -34
- package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +3 -3
- package/dist/services/document-handler-runtime/document-handler-runtime-service.js +38 -42
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +7 -11
- package/dist/services/document-handler-runtime/document-handler-server.js +77 -59
- package/dist/services/document-handler-runtime/error/required-file-not-found-error.js +1 -4
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +5 -5
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +42 -46
- package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.js +1 -4
- package/dist/services/document-handler-runtime/interface/template-context-interface.d.ts +2 -3
- package/dist/services/document-handler-runtime/interface/template-context-interface.js +1 -2
- package/dist/services/document-handler-runtime/interface/template-interface.d.ts +2 -2
- package/dist/services/document-handler-runtime/interface/template-interface.js +1 -2
- package/dist/services/document-handler-runtime/interface/template-parameter-interface.js +1 -2
- package/dist/services/document-handler-runtime/server/document-handler-response.d.ts +1 -3
- package/dist/services/document-handler-runtime/server/document-handler-response.js +1 -5
- package/dist/services/document-handler-runtime/server/request.d.ts +4 -10
- package/dist/services/document-handler-runtime/server/request.js +1 -5
- package/dist/services/document-handler-runtime/templates/abstract-template.d.ts +3 -3
- package/dist/services/document-handler-runtime/templates/abstract-template.js +3 -7
- package/dist/services/document-handler-runtime/templates/database-mock.d.ts +2 -2
- package/dist/services/document-handler-runtime/templates/database-mock.js +2 -6
- package/dist/services/document-handler-runtime/templates/execute-document-handler.d.ts +2 -2
- package/dist/services/document-handler-runtime/templates/execute-document-handler.js +2 -6
- package/dist/services/document-handler-runtime/templates/orestes-mock.d.ts +2 -2
- package/dist/services/document-handler-runtime/templates/orestes-mock.js +2 -6
- package/dist/services/document-handler-runtime/templates/package-json.d.ts +3 -5
- package/dist/services/document-handler-runtime/templates/package-json.js +2 -6
- package/dist/services/document-handler-runtime/templates/test.d.ts +2 -2
- package/dist/services/document-handler-runtime/templates/test.js +2 -6
- package/dist/services/error-handling/error/application-error.d.ts +1 -1
- package/dist/services/error-handling/error/application-error.js +1 -5
- package/dist/services/error-handling/error/config-file-error.d.ts +1 -1
- package/dist/services/error-handling/error/config-file-error.js +2 -7
- package/dist/services/error-handling/error/connection-error.d.ts +1 -1
- package/dist/services/error-handling/error/connection-error.js +2 -7
- package/dist/services/integration-api/error/customer-config-error.d.ts +1 -1
- package/dist/services/integration-api/error/customer-config-error.js +2 -5
- package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +1 -1
- package/dist/services/integration-api/error/customer-config-legacy-error.js +2 -6
- package/dist/services/integration-api/error/invalid-config-format-error.d.ts +1 -1
- package/dist/services/integration-api/error/invalid-config-format-error.js +4 -7
- package/dist/services/integration-api/error/mandatory-file-missing-error.d.ts +1 -1
- package/dist/services/integration-api/error/mandatory-file-missing-error.js +2 -6
- package/dist/services/integration-api/error/origin-error.d.ts +1 -1
- package/dist/services/integration-api/error/origin-error.js +2 -5
- package/dist/services/integration-api/error/read-files-error.d.ts +1 -1
- package/dist/services/integration-api/error/read-files-error.js +2 -7
- package/dist/services/integration-api/external/external-file-reader.d.ts +1 -1
- package/dist/services/integration-api/external/external-file-reader.js +9 -14
- package/dist/services/integration-api/file-list.d.ts +1 -1
- package/dist/services/integration-api/file-list.js +8 -11
- package/dist/services/integration-api/file-reader.js +11 -15
- package/dist/services/integration-api/file-writer.js +4 -8
- package/dist/services/integration-api/handler/customer-config-handler.d.ts +5 -5
- package/dist/services/integration-api/handler/customer-config-handler.js +17 -21
- package/dist/services/integration-api/handler/file-handler.d.ts +2 -2
- package/dist/services/integration-api/handler/file-handler.js +1 -4
- package/dist/services/integration-api/handler/install-resource-handler.d.ts +2 -2
- package/dist/services/integration-api/handler/install-resource-handler.js +6 -10
- package/dist/services/integration-api/handler/module-handler.d.ts +2 -2
- package/dist/services/integration-api/handler/module-handler.js +4 -8
- package/dist/services/integration-api/handler/server-config-handler.d.ts +2 -2
- package/dist/services/integration-api/handler/server-config-handler.js +4 -8
- package/dist/services/integration-api/index.d.ts +3 -3
- package/dist/services/integration-api/index.js +3 -6
- package/dist/services/integration-api/integration-api-factory.d.ts +3 -3
- package/dist/services/integration-api/integration-api-factory.js +23 -28
- package/dist/services/integration-api/integration-api-model.d.ts +17 -19
- package/dist/services/integration-api/integration-api-model.js +16 -21
- package/dist/services/integration-api/integration-api-service.d.ts +5 -5
- package/dist/services/integration-api/integration-api-service.js +6 -12
- package/dist/services/integration-api/spec/customer-config-validator.spec.js +29 -32
- package/dist/services/integration-api/spec/file-list.spec.js +107 -110
- package/dist/services/integration-api/spec/file-reader.spec.js +27 -30
- package/dist/services/integration-api/spec/file-writer.spec.js +34 -37
- package/dist/services/integration-api/spec/integration-api-service.spec.js +42 -45
- package/dist/services/integration-api/spec/mandatory-files-validator.spec.js +48 -51
- package/dist/services/integration-api/struct/customer-config-file.d.ts +1 -1
- package/dist/services/integration-api/struct/customer-config-file.js +10 -15
- package/dist/services/integration-api/struct/customer-config.d.ts +4 -8
- package/dist/services/integration-api/struct/customer-config.js +5 -10
- package/dist/services/integration-api/struct/file.d.ts +1 -1
- package/dist/services/integration-api/struct/file.js +9 -13
- package/dist/services/integration-api/struct/install-resource-file.d.ts +2 -2
- package/dist/services/integration-api/struct/install-resource-file.js +4 -8
- package/dist/services/integration-api/struct/module-file.d.ts +2 -2
- package/dist/services/integration-api/struct/module-file.js +4 -8
- package/dist/services/integration-api/struct/ro-file.d.ts +1 -1
- package/dist/services/integration-api/struct/ro-file.js +1 -5
- package/dist/services/integration-api/struct/server-config-file.d.ts +2 -2
- package/dist/services/integration-api/struct/server-config-file.js +4 -8
- package/dist/services/integration-api/struct/virtual-file.d.ts +1 -1
- package/dist/services/integration-api/struct/virtual-file.js +3 -7
- package/dist/services/integration-api/validator/customer-config-validator.d.ts +1 -1
- package/dist/services/integration-api/validator/customer-config-validator.js +8 -12
- package/dist/services/integration-api/validator/mandatory-files-validator.d.ts +2 -2
- package/dist/services/integration-api/validator/mandatory-files-validator.js +4 -8
- package/dist/services/integration-api/virtual/external-recipe.d.ts +2 -2
- package/dist/services/integration-api/virtual/external-recipe.js +1 -5
- package/dist/services/integration-api/virtual/static-recipe.d.ts +1 -1
- package/dist/services/integration-api/virtual/static-recipe.js +1 -5
- package/dist/services/integration-api/virtual/virtual-file-handler.d.ts +2 -2
- package/dist/services/integration-api/virtual/virtual-file-handler.js +8 -13
- package/dist/services/onboarding/browser/abort-response.js +1 -5
- package/dist/services/onboarding/browser/baqend-response.d.ts +1 -1
- package/dist/services/onboarding/browser/baqend-response.js +1 -5
- package/dist/services/onboarding/browser/config/browser-config.d.ts +1 -1
- package/dist/services/onboarding/browser/config/browser-config.js +15 -20
- package/dist/services/onboarding/browser/executable/executable-validator.d.ts +2 -2
- package/dist/services/onboarding/browser/executable/executable-validator.js +12 -17
- package/dist/services/onboarding/browser/extension/devtools-extension-api.d.ts +1 -1
- package/dist/services/onboarding/browser/extension/devtools-extension-api.js +1 -5
- package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +2 -2
- package/dist/services/onboarding/browser/extension/extension-downloader.js +24 -30
- package/dist/services/onboarding/browser/extension/extension-validator.d.ts +3 -3
- package/dist/services/onboarding/browser/extension/extension-validator.js +18 -23
- package/dist/services/onboarding/browser/origin-response.d.ts +1 -1
- package/dist/services/onboarding/browser/origin-response.js +1 -5
- package/dist/services/onboarding/config-renderer/install-file-recipe.d.ts +2 -2
- package/dist/services/onboarding/config-renderer/install-file-recipe.js +1 -5
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +3 -3
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +8 -11
- package/dist/services/onboarding/dashboard/diff-against-current-page.d.ts +4 -4
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +9 -14
- package/dist/services/onboarding/dashboard/index.d.ts +7 -7
- package/dist/services/onboarding/dashboard/index.js +8 -13
- package/dist/services/onboarding/dashboard/parameter-query-builder.d.ts +1 -1
- package/dist/services/onboarding/dashboard/parameter-query-builder.js +9 -13
- package/dist/services/onboarding/dashboard/request-diff-service.d.ts +3 -3
- package/dist/services/onboarding/dashboard/request-diff-service.js +14 -19
- package/dist/services/onboarding/error/browser-extension-error.d.ts +1 -1
- package/dist/services/onboarding/error/browser-extension-error.js +1 -5
- package/dist/services/onboarding/error/document-handler-transform-error.js +1 -5
- package/dist/services/onboarding/error/unsupported-encoding-error.d.ts +1 -1
- package/dist/services/onboarding/error/unsupported-encoding-error.js +2 -7
- package/dist/services/onboarding/error/validate-extension-error.d.ts +1 -1
- package/dist/services/onboarding/error/validate-extension-error.js +2 -7
- package/dist/services/onboarding/error/vm-empty-response-error.d.ts +1 -1
- package/dist/services/onboarding/error/vm-empty-response-error.js +2 -7
- package/dist/services/onboarding/error/vm-error.d.ts +1 -1
- package/dist/services/onboarding/error/vm-error.js +2 -7
- package/dist/services/onboarding/fetch-event-handler.d.ts +4 -4
- package/dist/services/onboarding/fetch-event-handler.js +19 -25
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +4 -4
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +15 -20
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +3 -3
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.js +4 -8
- package/dist/services/onboarding/fetch-events/dashboard-request.d.ts +3 -3
- package/dist/services/onboarding/fetch-events/dashboard-request.js +1 -5
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +5 -5
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +1 -5
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +4 -4
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.js +3 -7
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +5 -5
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +7 -11
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +6 -6
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +4 -8
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +3 -3
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +3 -7
- package/dist/services/onboarding/file-events/file-watcher.d.ts +5 -5
- package/dist/services/onboarding/file-events/file-watcher.js +24 -28
- package/dist/services/onboarding/index.d.ts +3 -3
- package/dist/services/onboarding/index.js +3 -8
- package/dist/services/onboarding/onboarding-model.d.ts +21 -23
- package/dist/services/onboarding/onboarding-model.js +22 -27
- package/dist/services/onboarding/onboarding-service-factory.d.ts +3 -3
- package/dist/services/onboarding/onboarding-service-factory.js +102 -108
- package/dist/services/onboarding/onboarding-service.d.ts +6 -6
- package/dist/services/onboarding/onboarding-service.js +12 -18
- package/dist/services/onboarding/request-cache/cache.d.ts +3 -3
- package/dist/services/onboarding/request-cache/cache.js +1 -5
- package/dist/services/onboarding/server-config/index.d.ts +3 -3
- package/dist/services/onboarding/server-config/index.js +6 -11
- package/dist/services/onboarding/templates/install-speed-kit-html-template.d.ts +1 -1
- package/dist/services/onboarding/templates/install-speed-kit-html-template.js +2 -7
- package/dist/services/onboarding/templates/install-speed-kit-js-template.d.ts +1 -1
- package/dist/services/onboarding/templates/install-speed-kit-js-template.js +2 -7
- package/dist/services/onboarding/todo-collector.d.ts +3 -3
- package/dist/services/onboarding/todo-collector.js +3 -7
- package/dist/services/onboarding/virtual-orestes-app/crawler.d.ts +2 -2
- package/dist/services/onboarding/virtual-orestes-app/crawler.js +12 -16
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +7 -7
- package/dist/services/onboarding/virtual-orestes-app/index.js +25 -32
- package/dist/services/pop-config/index.d.ts +3 -3
- package/dist/services/pop-config/index.js +3 -6
- package/dist/services/pop-config/pop-config-factory.d.ts +1 -1
- package/dist/services/pop-config/pop-config-factory.js +5 -9
- package/dist/services/pop-config/pop-config-model.d.ts +2 -2
- package/dist/services/pop-config/pop-config-model.js +1 -2
- package/dist/services/pop-config/pop-config-service.d.ts +2 -2
- package/dist/services/pop-config/pop-config-service.js +1 -5
- package/dist/services/prewarm/assets/asset-api-client.d.ts +2 -2
- package/dist/services/prewarm/assets/asset-api-client.js +18 -23
- package/dist/services/prewarm/assets/asset-item.d.ts +1 -1
- package/dist/services/prewarm/assets/asset-item.js +6 -10
- package/dist/services/prewarm/assets/asset-list.d.ts +2 -2
- package/dist/services/prewarm/assets/asset-list.js +6 -10
- package/dist/services/prewarm/csv-reader.js +6 -11
- package/dist/services/prewarm/error/invalid-origin-error.d.ts +1 -1
- package/dist/services/prewarm/error/invalid-origin-error.js +2 -7
- package/dist/services/prewarm/error/read-csv-error.d.ts +1 -1
- package/dist/services/prewarm/error/read-csv-error.js +2 -7
- package/dist/services/prewarm/index.d.ts +3 -3
- package/dist/services/prewarm/index.js +3 -6
- package/dist/services/prewarm/pre-warm-factory.d.ts +1 -1
- package/dist/services/prewarm/pre-warm-factory.js +13 -17
- package/dist/services/prewarm/pre-warm-model.js +16 -20
- package/dist/services/prewarm/pre-warm-service.d.ts +3 -3
- package/dist/services/prewarm/pre-warm-service.js +18 -22
- package/dist/services/pull/index.d.ts +3 -3
- package/dist/services/pull/index.js +3 -6
- package/dist/services/pull/pull-service-factory.d.ts +2 -2
- package/dist/services/pull/pull-service-factory.js +12 -16
- package/dist/services/pull/pull-service-model.js +4 -9
- package/dist/services/pull/pull-service.d.ts +3 -3
- package/dist/services/pull/pull-service.js +14 -19
- package/dist/services/query-builder/error/parse-config-speed-kit-error.d.ts +1 -1
- package/dist/services/query-builder/error/parse-config-speed-kit-error.js +2 -6
- package/dist/services/query-builder/query/parameter.js +1 -5
- package/dist/services/query-builder/query/prewarm.js +1 -5
- package/dist/services/query-builder/query-builder-factory.d.ts +3 -3
- package/dist/services/query-builder/query-builder-factory.js +16 -20
- package/dist/services/query-builder/query-builder-model.d.ts +6 -6
- package/dist/services/query-builder/query-builder-model.js +2 -5
- package/dist/services/query-builder/query-builder-service.d.ts +2 -2
- package/dist/services/query-builder/query-builder-service.js +24 -30
- package/oclif.manifest.json +15 -15
- package/package.json +63 -54
- package/dist/dummy.spec.d.ts +0 -1
- package/dist/dummy.spec.js +0 -18
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const csv_reader_1 = require("./csv-reader");
|
|
8
|
-
const config_api_1 = require("../config-api");
|
|
9
|
-
class PreWarmFactory {
|
|
1
|
+
import { CliContext, CliServiceFactory } from "../cli/index.js";
|
|
2
|
+
import { DEFAULT_VARIATION, PreWarmService, VARIATION_SEPARATOR, } from "./index.js";
|
|
3
|
+
import { AssetApiClient } from "./assets/asset-api-client.js";
|
|
4
|
+
import { CsvReader } from "./csv-reader.js";
|
|
5
|
+
import { ConfigApiContext, ConfigApiServiceFactory, } from "../config-api/index.js";
|
|
6
|
+
export class PreWarmFactory {
|
|
10
7
|
context;
|
|
11
8
|
constructor(context) {
|
|
12
9
|
this.context = context;
|
|
13
10
|
}
|
|
14
11
|
async getService() {
|
|
15
|
-
const cli = new
|
|
16
|
-
const configApi = new
|
|
12
|
+
const cli = new CliServiceFactory(new CliContext(this.context.quiet)).getService();
|
|
13
|
+
const configApi = new ConfigApiServiceFactory(new ConfigApiContext(this.context.app)).getService();
|
|
17
14
|
const entityManager = await configApi.client.getEntityManager();
|
|
18
|
-
const csvReader = new
|
|
19
|
-
const assetApiClient = new
|
|
15
|
+
const csvReader = new CsvReader();
|
|
16
|
+
const assetApiClient = new AssetApiClient(entityManager.token, this.context.app, this.context.keepParameterSorting);
|
|
20
17
|
const urls = this.getUrls(csvReader);
|
|
21
18
|
const variations = this.getVariations(csvReader);
|
|
22
|
-
return new
|
|
19
|
+
return new PreWarmService(assetApiClient, cli, urls, variations, this.context.verbose);
|
|
23
20
|
}
|
|
24
21
|
getUrls(csvReader) {
|
|
25
22
|
return csvReader.readPath(this.context.path);
|
|
26
23
|
}
|
|
27
24
|
getVariations(csvReader) {
|
|
28
|
-
let variations =
|
|
25
|
+
let variations = DEFAULT_VARIATION;
|
|
29
26
|
if (this.context.variation) {
|
|
30
|
-
variations = this.context.variation.split(
|
|
27
|
+
variations = this.context.variation.split(VARIATION_SEPARATOR);
|
|
31
28
|
}
|
|
32
29
|
if (this.context.variationPath) {
|
|
33
30
|
variations = csvReader.readPath(this.context.variationPath);
|
|
@@ -35,4 +32,3 @@ class PreWarmFactory {
|
|
|
35
32
|
return variations;
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
|
-
exports.PreWarmFactory = PreWarmFactory;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_VARIATIONS = exports.DEFAULT_VARIATION = exports.VARIATION_SEPARATOR = exports.PROGRESS_BAR_FORMAT = exports.TIMING_HEADER_KEY = exports.TIMING_HEADER_ERROR_CODE_SELECTOR = exports.RATE_LIMIT_CODES = exports.RATE_LIMIT_MULTIPLICATOR = exports.MAX_REQUESTS_PER_SECOND = exports.DEFAULT_REQUESTS_PER_SECOND = exports.TIMOUT_AFTER_DETECTED_RATE_LIMIT = exports.FETCH_TIMEOUT = exports.MIN_TIME_TO_FETCH_BATCH = exports.ItemStatus = exports.PreWarmContext = void 0;
|
|
4
|
-
class PreWarmContext {
|
|
1
|
+
export class PreWarmContext {
|
|
5
2
|
app;
|
|
6
3
|
path;
|
|
7
4
|
variation;
|
|
@@ -19,25 +16,24 @@ class PreWarmContext {
|
|
|
19
16
|
this.verbose = verbose;
|
|
20
17
|
}
|
|
21
18
|
}
|
|
22
|
-
|
|
23
|
-
var ItemStatus;
|
|
19
|
+
export var ItemStatus;
|
|
24
20
|
(function (ItemStatus) {
|
|
25
21
|
ItemStatus["DONE"] = "done";
|
|
26
22
|
ItemStatus["ERROR"] = "error";
|
|
27
23
|
ItemStatus["NEW"] = "new";
|
|
28
24
|
ItemStatus["RETRY"] = "retry";
|
|
29
|
-
})(ItemStatus || (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
})(ItemStatus || (ItemStatus = {}));
|
|
26
|
+
export const MIN_TIME_TO_FETCH_BATCH = 1000;
|
|
27
|
+
export const FETCH_TIMEOUT = 10_000;
|
|
28
|
+
export const TIMOUT_AFTER_DETECTED_RATE_LIMIT = 5000;
|
|
29
|
+
export const DEFAULT_REQUESTS_PER_SECOND = 10;
|
|
30
|
+
export const MAX_REQUESTS_PER_SECOND = 20;
|
|
31
|
+
export const RATE_LIMIT_MULTIPLICATOR = 0.8;
|
|
36
32
|
// we also use some codes that indicate some server overloads
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
export const RATE_LIMIT_CODES = ["306", "308", "310", "311", "314", "316"];
|
|
34
|
+
export const TIMING_HEADER_ERROR_CODE_SELECTOR = /errorcode;desc=([^,]*),/;
|
|
35
|
+
export const TIMING_HEADER_KEY = "server-timing";
|
|
36
|
+
export const PROGRESS_BAR_FORMAT = "[{bar}] {percentage}% | ETA: {eta_formatted}s | {value}/{total} | error:{errors} | rate: {rate} | retry: {retry} | batchDur: {batchDuration}";
|
|
37
|
+
export const VARIATION_SEPARATOR = ",";
|
|
38
|
+
export const DEFAULT_VARIATION = ["default"];
|
|
39
|
+
export const DEFAULT_VARIATIONS = ["mobile", "tablet", "tv"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CliServiceInterface } from "../cli";
|
|
2
|
-
import { AssetItemInterface } from "./";
|
|
3
|
-
import { AssetApiClient } from "./assets/asset-api-client";
|
|
1
|
+
import { CliServiceInterface } from "../cli/index.js";
|
|
2
|
+
import { AssetItemInterface } from "./index.js";
|
|
3
|
+
import { AssetApiClient } from "./assets/asset-api-client.js";
|
|
4
4
|
export declare class PreWarmService {
|
|
5
5
|
private assetClient;
|
|
6
6
|
private cli;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const asset_item_1 = require("./assets/asset-item");
|
|
7
|
-
const asset_list_1 = require("./assets/asset-list");
|
|
8
|
-
class PreWarmService {
|
|
1
|
+
import { safe } from "../../helpers/safe.js";
|
|
2
|
+
import { ItemStatus, PROGRESS_BAR_FORMAT, RATE_LIMIT_CODES, TIMING_HEADER_ERROR_CODE_SELECTOR, TIMING_HEADER_KEY, } from "./index.js";
|
|
3
|
+
import { AssetItem } from "./assets/asset-item.js";
|
|
4
|
+
import { AssetList } from "./assets/asset-list.js";
|
|
5
|
+
export class PreWarmService {
|
|
9
6
|
assetClient;
|
|
10
7
|
cli;
|
|
11
8
|
urls;
|
|
@@ -20,7 +17,7 @@ class PreWarmService {
|
|
|
20
17
|
this.verbose = verbose;
|
|
21
18
|
}
|
|
22
19
|
async handleAsset(assetClient, entry) {
|
|
23
|
-
const fetchUrlResponse = await
|
|
20
|
+
const fetchUrlResponse = await safe(assetClient.fetchURL(entry.url, entry.variation, this.verbose));
|
|
24
21
|
// a generic error occurred
|
|
25
22
|
if (fetchUrlResponse.success === false) {
|
|
26
23
|
entry.failed();
|
|
@@ -34,16 +31,16 @@ class PreWarmService {
|
|
|
34
31
|
return;
|
|
35
32
|
}
|
|
36
33
|
// got undefined errorCode
|
|
37
|
-
if (!response.headers.has(
|
|
38
|
-
!response.headers.get(
|
|
34
|
+
if (!response.headers.has(TIMING_HEADER_KEY) ||
|
|
35
|
+
!response.headers.get(TIMING_HEADER_KEY)?.includes("error")) {
|
|
39
36
|
entry.failed();
|
|
40
37
|
entry.setError(new Error(`status: ${response.status}`));
|
|
41
38
|
}
|
|
42
39
|
// get errorCode from server-timing-header
|
|
43
|
-
const serverTiming = response.headers.get(
|
|
44
|
-
const [, serverTimingErrorCode] = serverTiming.match(
|
|
40
|
+
const serverTiming = response.headers.get(TIMING_HEADER_KEY);
|
|
41
|
+
const [, serverTimingErrorCode] = serverTiming.match(TIMING_HEADER_ERROR_CODE_SELECTOR) || ["", "-"];
|
|
45
42
|
// rateLimiter detected, retry
|
|
46
|
-
if (
|
|
43
|
+
if (RATE_LIMIT_CODES.some((code) => serverTimingErrorCode.includes(code))) {
|
|
47
44
|
entry.retry();
|
|
48
45
|
return;
|
|
49
46
|
}
|
|
@@ -62,7 +59,7 @@ class PreWarmService {
|
|
|
62
59
|
// reset for minimal output
|
|
63
60
|
this.requestsSend = 0;
|
|
64
61
|
const urlsToRetry = assetList
|
|
65
|
-
.getByStatus(
|
|
62
|
+
.getByStatus(ItemStatus.RETRY)
|
|
66
63
|
.map((entry) => entry.url);
|
|
67
64
|
const retryList = this.generateAssetRequestList(urlsToRetry);
|
|
68
65
|
this.assetClient.setIsRetry();
|
|
@@ -82,7 +79,7 @@ class PreWarmService {
|
|
|
82
79
|
break;
|
|
83
80
|
}
|
|
84
81
|
await this.handleAsset(this.assetClient, value);
|
|
85
|
-
if (this.verbose && value.status !==
|
|
82
|
+
if (this.verbose && value.status !== ItemStatus.DONE) {
|
|
86
83
|
this.cli.write(`${value.toString()}\n`);
|
|
87
84
|
}
|
|
88
85
|
completed++;
|
|
@@ -113,10 +110,10 @@ class PreWarmService {
|
|
|
113
110
|
this.stopProgressBar();
|
|
114
111
|
}
|
|
115
112
|
generateAssetRequestList(urls) {
|
|
116
|
-
const assetList = new
|
|
113
|
+
const assetList = new AssetList();
|
|
117
114
|
for (const variation of this.variations) {
|
|
118
115
|
for (const url of urls) {
|
|
119
|
-
assetList.addItem(new
|
|
116
|
+
assetList.addItem(new AssetItem(url, variation));
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
119
|
return assetList;
|
|
@@ -131,7 +128,7 @@ class PreWarmService {
|
|
|
131
128
|
succeed: {},
|
|
132
129
|
});
|
|
133
130
|
if (await this.cli.confirm("show errors?", true)) {
|
|
134
|
-
const elements = assetList.getByStatus(
|
|
131
|
+
const elements = assetList.getByStatus(ItemStatus.ERROR);
|
|
135
132
|
this.cli.table(elements.map((element) => {
|
|
136
133
|
return { ...element };
|
|
137
134
|
}), {
|
|
@@ -150,7 +147,7 @@ class PreWarmService {
|
|
|
150
147
|
rate: this.assetClient.getRateLimit(),
|
|
151
148
|
retry: 0,
|
|
152
149
|
batchDuration: "-",
|
|
153
|
-
}, { format:
|
|
150
|
+
}, { format: PROGRESS_BAR_FORMAT, linewrap: !!this.verbose });
|
|
154
151
|
}
|
|
155
152
|
stopProgressBar() {
|
|
156
153
|
this.cli.stopProgress();
|
|
@@ -164,7 +161,7 @@ class PreWarmService {
|
|
|
164
161
|
});
|
|
165
162
|
}
|
|
166
163
|
updateRateLimit(batch) {
|
|
167
|
-
const retryCount = batch.filter((entry) => entry.status ===
|
|
164
|
+
const retryCount = batch.filter((entry) => entry.status === ItemStatus.RETRY).length;
|
|
168
165
|
// found rateLimiterResponse wait and reduce rateLimit
|
|
169
166
|
if (retryCount > 0) {
|
|
170
167
|
this.assetClient.reduceMaxRequestsPerSecond();
|
|
@@ -185,4 +182,3 @@ class PreWarmService {
|
|
|
185
182
|
this.cli.write(this.cli.style.gray(`${this.requestsSend}/${assetLength} | rate: ${currentRate} | success: ${success} | retry: ${retry} | errors: ${errors}`));
|
|
186
183
|
}
|
|
187
184
|
}
|
|
188
|
-
exports.PreWarmService = PreWarmService;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./pull-service-model";
|
|
2
|
-
export * from "./pull-service-factory";
|
|
3
|
-
export * from "./pull-service";
|
|
1
|
+
export * from "./pull-service-model.js";
|
|
2
|
+
export * from "./pull-service-factory.js";
|
|
3
|
+
export * from "./pull-service.js";
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./pull-service-model"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./pull-service-factory"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./pull-service"), exports);
|
|
1
|
+
export * from "./pull-service-model.js";
|
|
2
|
+
export * from "./pull-service-factory.js";
|
|
3
|
+
export * from "./pull-service.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PullContext, PullService } from "./";
|
|
2
|
-
import { UserCliConfig } from "../../helpers/cli-config";
|
|
1
|
+
import { PullContext, PullService } from "./index.js";
|
|
2
|
+
import { UserCliConfig } from "../../helpers/cli-config.js";
|
|
3
3
|
export declare class PullServiceFactory {
|
|
4
4
|
private readonly context;
|
|
5
5
|
private userConfig;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const _1 = require("./");
|
|
7
|
-
const config_api_1 = require("../config-api");
|
|
8
|
-
class PullServiceFactory {
|
|
1
|
+
import { IntegrationApiContext, IntegrationApiFactory, } from "../integration-api/index.js";
|
|
2
|
+
import { CliServiceFactory } from "../cli/index.js";
|
|
3
|
+
import { PullService } from "./index.js";
|
|
4
|
+
import { ConfigApiContext, ConfigApiServiceFactory, } from "../config-api/index.js";
|
|
5
|
+
export class PullServiceFactory {
|
|
9
6
|
context;
|
|
10
7
|
userConfig;
|
|
11
8
|
service = undefined;
|
|
@@ -15,7 +12,7 @@ class PullServiceFactory {
|
|
|
15
12
|
this.context = context;
|
|
16
13
|
}
|
|
17
14
|
async buildService() {
|
|
18
|
-
if (!(this.service instanceof
|
|
15
|
+
if (!(this.service instanceof PullService)) {
|
|
19
16
|
await this.build();
|
|
20
17
|
}
|
|
21
18
|
return this.service;
|
|
@@ -25,17 +22,16 @@ class PullServiceFactory {
|
|
|
25
22
|
const customer = files.getCustomerConfig().config;
|
|
26
23
|
const configName = customer.name || this.context.configName;
|
|
27
24
|
const configApi = this.getConfigApi(customer.app);
|
|
28
|
-
const cliService = new
|
|
29
|
-
this.service = new
|
|
25
|
+
const cliService = new CliServiceFactory().getService();
|
|
26
|
+
this.service = new PullService(files, cliService, configApi, configName, this.context.customerPath);
|
|
30
27
|
}
|
|
31
28
|
async getIntegrationFiles() {
|
|
32
|
-
const integrationApiContext = new
|
|
33
|
-
const integrationApi = new
|
|
29
|
+
const integrationApiContext = new IntegrationApiContext(this.context.customerPath, this.context.configName, []);
|
|
30
|
+
const integrationApi = new IntegrationApiFactory(integrationApiContext, this.userConfig).buildService();
|
|
34
31
|
return await integrationApi.run();
|
|
35
32
|
}
|
|
36
33
|
getConfigApi(app) {
|
|
37
|
-
const configApiContext = new
|
|
38
|
-
return new
|
|
34
|
+
const configApiContext = new ConfigApiContext(app);
|
|
35
|
+
return new ConfigApiServiceFactory(configApiContext).getService();
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
|
-
exports.PullServiceFactory = PullServiceFactory;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.InstallResourceToFileMapping = exports.PullContext = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const dotenv = tslib_1.__importStar(require("dotenv"));
|
|
6
|
-
dotenv.config();
|
|
1
|
+
import * as dotenv from "dotenv";
|
|
2
|
+
dotenv.config({ quiet: true });
|
|
7
3
|
const DEFAULT_CONFIG_NAME = "production";
|
|
8
|
-
class PullContext {
|
|
4
|
+
export class PullContext {
|
|
9
5
|
customerPath;
|
|
10
6
|
configName;
|
|
11
7
|
constructor(customerPath, configName = DEFAULT_CONFIG_NAME) {
|
|
@@ -13,8 +9,7 @@ class PullContext {
|
|
|
13
9
|
this.configName = configName;
|
|
14
10
|
}
|
|
15
11
|
}
|
|
16
|
-
|
|
17
|
-
exports.InstallResourceToFileMapping = {
|
|
12
|
+
export const InstallResourceToFileMapping = {
|
|
18
13
|
config: { fileName: "config_SpeedKit", extension: "js" },
|
|
19
14
|
documentHandlerConfig: {
|
|
20
15
|
fileName: "config_documentHandler",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CliServiceInterface } from "../cli";
|
|
2
|
-
import { FileListInterface } from "../integration-api";
|
|
3
|
-
import { ConfigApiService } from "../config-api";
|
|
1
|
+
import { CliServiceInterface } from "../cli/index.js";
|
|
2
|
+
import { FileListInterface } from "../integration-api/index.js";
|
|
3
|
+
import { ConfigApiService } from "../config-api/index.js";
|
|
4
4
|
export declare class PullService {
|
|
5
5
|
private fileList;
|
|
6
6
|
private cli;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const _1 = require("./");
|
|
7
|
-
const safe_1 = require("../../helpers/safe");
|
|
8
|
-
const node_child_process_1 = require("node:child_process");
|
|
9
|
-
class PullService {
|
|
1
|
+
import { InstallResourceFile, } from "../integration-api/index.js";
|
|
2
|
+
import { InstallResourceToFileMapping } from "./index.js";
|
|
3
|
+
import { safe } from "../../helpers/safe.js";
|
|
4
|
+
import { execSync } from "node:child_process";
|
|
5
|
+
export class PullService {
|
|
10
6
|
fileList;
|
|
11
7
|
cli;
|
|
12
8
|
configApi;
|
|
@@ -28,24 +24,24 @@ class PullService {
|
|
|
28
24
|
return;
|
|
29
25
|
}
|
|
30
26
|
}
|
|
31
|
-
this.cli.startAction("fetch active installResource");
|
|
32
|
-
const installResourceResult = await
|
|
27
|
+
this.cli.startAction("PULL:INSTALL_RESOURCE", "fetch active installResource");
|
|
28
|
+
const installResourceResult = await safe(this.configApi.getActiveInstall(this.configName));
|
|
33
29
|
if (installResourceResult.success === false) {
|
|
34
|
-
this.cli.
|
|
30
|
+
this.cli.failAction("PULL:INSTALL_RESOURCE");
|
|
35
31
|
this.cli.writeError(`An error happened try fetching the installResource ${installResourceResult.error}`);
|
|
36
32
|
return;
|
|
37
33
|
}
|
|
38
|
-
this.cli.
|
|
34
|
+
this.cli.successAction("PULL:INSTALL_RESOURCE");
|
|
39
35
|
const installResource = installResourceResult.data;
|
|
40
36
|
await this.handleConfigCustomer(installResource);
|
|
41
|
-
for (const key in
|
|
37
|
+
for (const key in InstallResourceToFileMapping) {
|
|
42
38
|
await this.updateLocalFileByInstallResource(installResource, key);
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
41
|
async updateLocalFileByInstallResource(installResource, key) {
|
|
46
42
|
const installResourceContent = installResource[key];
|
|
47
|
-
const fileName =
|
|
48
|
-
const extension =
|
|
43
|
+
const fileName = InstallResourceToFileMapping[key]["fileName"];
|
|
44
|
+
const extension = InstallResourceToFileMapping[key]["extension"];
|
|
49
45
|
// local and remote are empty. skip
|
|
50
46
|
if (this.isEmpty(installResourceContent) &&
|
|
51
47
|
!this.fileList.hasFile(fileName)) {
|
|
@@ -87,7 +83,7 @@ class PullService {
|
|
|
87
83
|
return this.fileList.getByName(fileName);
|
|
88
84
|
}
|
|
89
85
|
async createFile(fileName, extension, content, key) {
|
|
90
|
-
const resourceFile = new
|
|
86
|
+
const resourceFile = new InstallResourceFile(fileName, `${this.basePath}/${fileName}.${extension}`, content, key);
|
|
91
87
|
this.fileList.addFile(resourceFile);
|
|
92
88
|
await resourceFile.updateFile();
|
|
93
89
|
}
|
|
@@ -97,7 +93,7 @@ class PullService {
|
|
|
97
93
|
.filter((value) => value.length > 0)
|
|
98
94
|
.pop();
|
|
99
95
|
try {
|
|
100
|
-
const stdoutBuffer =
|
|
96
|
+
const stdoutBuffer = execSync("git diff --name-status");
|
|
101
97
|
const stdout = stdoutBuffer.toString("utf8");
|
|
102
98
|
{
|
|
103
99
|
return stdout.includes(customerName);
|
|
@@ -121,4 +117,3 @@ class PullService {
|
|
|
121
117
|
this.cli.writeSuccess("equal, skip: config_customer(origins)");
|
|
122
118
|
}
|
|
123
119
|
}
|
|
124
|
-
exports.PullService = PullService;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigFileError } from "../../error-handling/error/config-file-error";
|
|
1
|
+
import { ConfigFileError } from "../../error-handling/error/config-file-error.js";
|
|
2
2
|
export declare class ParseConfigSpeedKitError extends ConfigFileError {
|
|
3
3
|
constructor(message: string);
|
|
4
4
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ParseConfigSpeedKitError = void 0;
|
|
4
|
-
const config_file_error_1 = require("../../error-handling/error/config-file-error");
|
|
5
|
-
class ParseConfigSpeedKitError extends config_file_error_1.ConfigFileError {
|
|
1
|
+
import { ConfigFileError } from "../../error-handling/error/config-file-error.js";
|
|
2
|
+
export class ParseConfigSpeedKitError extends ConfigFileError {
|
|
6
3
|
constructor(message) {
|
|
7
4
|
super(message);
|
|
8
5
|
this.suggestions = ["please check file config_SpeedKit"];
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
|
-
exports.ParseConfigSpeedKitError = ParseConfigSpeedKitError;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Parameter = void 0;
|
|
4
|
-
class Parameter {
|
|
1
|
+
export class Parameter {
|
|
5
2
|
query;
|
|
6
3
|
constructor(app, parameterFilter, whitelistedFilter, blacklistedFilter, parameterReplaceFilter) {
|
|
7
4
|
const nowMinusOneMonth = new Date(new Date().setMonth(new Date().getMonth() - 1, new Date().getDate()));
|
|
@@ -46,4 +43,3 @@ where cardinality(paramKeys) > 0
|
|
|
46
43
|
order by potentialGain desc, cachedUrls desc, PIs desc`;
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
|
-
exports.Parameter = Parameter;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Prewarm = void 0;
|
|
4
|
-
class Prewarm {
|
|
1
|
+
export class Prewarm {
|
|
5
2
|
query;
|
|
6
3
|
constructor(app, whitelistedFilter, blacklistedFilter, parameterReplaceFilter) {
|
|
7
4
|
const now = new Date();
|
|
@@ -20,4 +17,3 @@ group by url
|
|
|
20
17
|
order by count(*) desc`;
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
|
-
exports.Prewarm = Prewarm;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { QueryBuilderService } from "./query-builder-service";
|
|
2
|
-
import { QueryBuilderFactoryContext, QueryTpe } from "./query-builder-model";
|
|
3
|
-
import { UserCliConfig } from "../../helpers/cli-config";
|
|
1
|
+
import { QueryBuilderService } from "./query-builder-service.js";
|
|
2
|
+
import { QueryBuilderFactoryContext, QueryTpe } from "./query-builder-model.js";
|
|
3
|
+
import { UserCliConfig } from "../../helpers/cli-config.js";
|
|
4
4
|
export declare class QueryBuilderFactory {
|
|
5
5
|
private context;
|
|
6
6
|
private userConfig;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const parse_config_speed_kit_error_1 = require("./error/parse-config-speed-kit-error");
|
|
10
|
-
const evaluate_speed_kit_config_1 = require("../../helpers/evaluate-speed-kit-config");
|
|
11
|
-
class QueryBuilderFactory {
|
|
1
|
+
import { QueryBuilderService } from "./query-builder-service.js";
|
|
2
|
+
import { IntegrationApiContext, IntegrationApiFactory, } from "../integration-api/index.js";
|
|
3
|
+
import { INTEGRATION_FILES } from "../../models/files.js";
|
|
4
|
+
import { CliServiceFactory } from "../cli/index.js";
|
|
5
|
+
import { safe } from "../../helpers/safe.js";
|
|
6
|
+
import { ParseConfigSpeedKitError } from "./error/parse-config-speed-kit-error.js";
|
|
7
|
+
import { evaluateLocalSpeedKitConfig } from "../../helpers/evaluate-speed-kit-config.js";
|
|
8
|
+
export class QueryBuilderFactory {
|
|
12
9
|
context;
|
|
13
10
|
userConfig;
|
|
14
11
|
constructor(context, userConfig) {
|
|
@@ -16,12 +13,12 @@ class QueryBuilderFactory {
|
|
|
16
13
|
this.userConfig = userConfig;
|
|
17
14
|
}
|
|
18
15
|
async buildService(queryType) {
|
|
19
|
-
const cli = new
|
|
16
|
+
const cli = new CliServiceFactory().getService();
|
|
20
17
|
const files = await this.getIntegrationFiles();
|
|
21
18
|
const customerConfig = files.getCustomerConfig().config;
|
|
22
19
|
const app = customerConfig.app;
|
|
23
20
|
const origin = customerConfig.origins[0];
|
|
24
|
-
const speedKitConfigFile = files.getByName(
|
|
21
|
+
const speedKitConfigFile = files.getByName(INTEGRATION_FILES.CONFIG.SPEED_KIT);
|
|
25
22
|
const speedKitConfig = await this.getSpeedKitConfig(app, origin, speedKitConfigFile);
|
|
26
23
|
const serviceContext = {
|
|
27
24
|
app,
|
|
@@ -29,21 +26,20 @@ class QueryBuilderFactory {
|
|
|
29
26
|
isWindows: this.context.isWindows,
|
|
30
27
|
quiet: this.context.quiet,
|
|
31
28
|
};
|
|
32
|
-
return new
|
|
29
|
+
return new QueryBuilderService(serviceContext, speedKitConfig, cli);
|
|
33
30
|
}
|
|
34
31
|
async getIntegrationFiles() {
|
|
35
|
-
const integrationApiContext = new
|
|
36
|
-
const integrationApi = new
|
|
32
|
+
const integrationApiContext = new IntegrationApiContext(this.context.customerPath, this.context.configName, ["config_SpeedKit"]);
|
|
33
|
+
const integrationApi = new IntegrationApiFactory(integrationApiContext, this.userConfig).buildService();
|
|
37
34
|
return await integrationApi.run();
|
|
38
35
|
}
|
|
39
36
|
getSpeedKitConfig(app, origin, speedKitConfigFile) {
|
|
40
|
-
const result =
|
|
41
|
-
return
|
|
37
|
+
const result = safe(() => {
|
|
38
|
+
return evaluateLocalSpeedKitConfig(app, origin, speedKitConfigFile);
|
|
42
39
|
});
|
|
43
40
|
if (result.success !== true) {
|
|
44
|
-
throw new
|
|
41
|
+
throw new ParseConfigSpeedKitError(result.error);
|
|
45
42
|
}
|
|
46
43
|
return result.data;
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
|
-
exports.QueryBuilderFactory = QueryBuilderFactory;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface QueryBuilderContext {
|
|
2
2
|
isWindows?: boolean;
|
|
3
3
|
quiet?: boolean;
|
|
4
4
|
queryType: QueryTpe;
|
|
5
5
|
app: string;
|
|
6
|
-
}
|
|
7
|
-
export
|
|
6
|
+
}
|
|
7
|
+
export interface QueryBuilderFactoryContext {
|
|
8
8
|
readonly customerPath: string;
|
|
9
9
|
readonly configName: string;
|
|
10
10
|
readonly isWindows?: boolean;
|
|
11
11
|
readonly quiet?: boolean;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
export declare enum QueryTpe {
|
|
14
14
|
prewarm = "prewarm",
|
|
15
15
|
parameter = "parameter"
|
|
16
16
|
}
|
|
17
|
-
export
|
|
17
|
+
export interface SpeedKitConfig {
|
|
18
18
|
ruleSetConfig?: {
|
|
19
19
|
version?: string;
|
|
20
20
|
};
|
|
21
21
|
[key: string]: any;
|
|
22
|
-
}
|
|
22
|
+
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QueryTpe = void 0;
|
|
4
|
-
var QueryTpe;
|
|
1
|
+
export var QueryTpe;
|
|
5
2
|
(function (QueryTpe) {
|
|
6
3
|
QueryTpe["prewarm"] = "prewarm";
|
|
7
4
|
QueryTpe["parameter"] = "parameter";
|
|
8
|
-
})(QueryTpe || (
|
|
5
|
+
})(QueryTpe || (QueryTpe = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { QueryBuilderContext, SpeedKitConfig } from "./query-builder-model";
|
|
2
|
-
import { CliServiceInterface } from "../cli";
|
|
1
|
+
import { QueryBuilderContext, SpeedKitConfig } from "./query-builder-model.js";
|
|
2
|
+
import { CliServiceInterface } from "../cli/index.js";
|
|
3
3
|
export declare class QueryBuilderService {
|
|
4
4
|
private context;
|
|
5
5
|
private speedKitConfig;
|