@speedkit/cli 3.43.1 → 4.0.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/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 +7 -12
- 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,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const safe_1 = require("../../../helpers/safe");
|
|
6
|
-
const cli_1 = require("../../cli");
|
|
7
|
-
class Crawler {
|
|
1
|
+
import { USER_AGENT } from "../onboarding-model.js";
|
|
2
|
+
import { safe } from "../../../helpers/safe.js";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
export class Crawler {
|
|
8
5
|
cli;
|
|
9
6
|
agentConfig;
|
|
10
7
|
speedKitServerConfig;
|
|
@@ -24,25 +21,25 @@ class Crawler {
|
|
|
24
21
|
}),
|
|
25
22
|
agent: this.agentConfig,
|
|
26
23
|
};
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
const uuid = randomUUID();
|
|
25
|
+
this.cli.startAction(`DOCUMENTHANDLER:FETCH:${uuid}`, `[documentHandler:fetch]: ${originUrl}`);
|
|
26
|
+
const fetchResponse = await safe(fetch(originUrl, requestInit));
|
|
29
27
|
if (fetchResponse.success === true) {
|
|
30
|
-
this.cli.
|
|
28
|
+
this.cli.successAction(`DOCUMENTHANDLER:FETCH:${uuid}`);
|
|
31
29
|
return fetchResponse.data;
|
|
32
30
|
}
|
|
33
|
-
this.cli.
|
|
34
|
-
this.cli.writeError(`error while fetching Asset: ${originUrl}`);
|
|
31
|
+
this.cli.failAction(`DOCUMENTHANDLER:FETCH:${uuid}`, `error while fetching Asset: ${originUrl}`);
|
|
35
32
|
this.cli.writeError(fetchResponse.error);
|
|
36
33
|
this.cli.writeError(JSON.stringify(fetchResponse.errorObj));
|
|
37
34
|
}
|
|
38
35
|
setDefaultUserAgent(variation) {
|
|
39
36
|
if (/^mobile$/is.test(variation)) {
|
|
40
|
-
return
|
|
37
|
+
return USER_AGENT.MOBILE;
|
|
41
38
|
}
|
|
42
39
|
if (/^tablet$/is.test(variation)) {
|
|
43
|
-
return
|
|
40
|
+
return USER_AGENT.TABLET;
|
|
44
41
|
}
|
|
45
|
-
return
|
|
42
|
+
return USER_AGENT.DESKTOP;
|
|
46
43
|
}
|
|
47
44
|
prepareOriginRequest(originUrl, variationParameter, init) {
|
|
48
45
|
if (!this.speedKitServerConfig) {
|
|
@@ -85,4 +82,3 @@ class Crawler {
|
|
|
85
82
|
return;
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
|
-
exports.Crawler = Crawler;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import Protocol from "devtools-protocol";
|
|
2
|
-
import { AbortResponse } from "../browser/abort-response";
|
|
3
|
-
import { DocumentHandlerServer } from "../../document-handler-runtime/document-handler-server";
|
|
4
|
-
import { Cache } from "../request-cache/cache";
|
|
5
|
-
import { CliService } from "../../cli";
|
|
6
|
-
import { Crawler } from "./crawler";
|
|
7
|
-
import { CustomerConfig } from "../../integration-api";
|
|
1
|
+
import { Protocol } from "devtools-protocol";
|
|
2
|
+
import { AbortResponse } from "../browser/abort-response.js";
|
|
3
|
+
import { DocumentHandlerServer } from "../../document-handler-runtime/document-handler-server.js";
|
|
4
|
+
import { Cache } from "../request-cache/cache.js";
|
|
5
|
+
import { CliService } from "../../cli/index.js";
|
|
6
|
+
import { Crawler } from "./crawler.js";
|
|
7
|
+
import { CustomerConfig } from "../../integration-api/index.js";
|
|
8
8
|
export declare class VirtualOrestesApp {
|
|
9
9
|
private customerConfig;
|
|
10
10
|
private crawler;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const safe_1 = require("../../../helpers/safe");
|
|
7
|
-
const onboarding_model_1 = require("../onboarding-model");
|
|
8
|
-
const iconv_lite_1 = tslib_1.__importDefault(require("iconv-lite"));
|
|
9
|
-
const unsupported_encoding_error_1 = require("../error/unsupported-encoding-error");
|
|
1
|
+
import { BaqendResponse } from "../browser/baqend-response.js";
|
|
2
|
+
import { safe } from "../../../helpers/safe.js";
|
|
3
|
+
import { META_CONTENT_TYPE_REGEX, SpeedKitInstallRegex, } from "../onboarding-model.js";
|
|
4
|
+
import iconv from "iconv-lite";
|
|
5
|
+
import { UnsupportedEncodingError } from "../error/unsupported-encoding-error.js";
|
|
10
6
|
// for none encodable chars use a space, so the broken char is invisible.
|
|
11
7
|
// We are using the same trick in our node.js server
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class VirtualOrestesApp {
|
|
8
|
+
iconv.defaultCharSingleByte = " ";
|
|
9
|
+
iconv.defaultCharUnicode = " ";
|
|
10
|
+
export class VirtualOrestesApp {
|
|
15
11
|
customerConfig;
|
|
16
12
|
crawler;
|
|
17
13
|
documentHandler;
|
|
@@ -31,7 +27,7 @@ class VirtualOrestesApp {
|
|
|
31
27
|
? UrlObject.searchParams.get("bqvariation").trim()
|
|
32
28
|
: "default";
|
|
33
29
|
const cachedResponse = this.getCachedResponse(event.request.url);
|
|
34
|
-
if (cachedResponse instanceof
|
|
30
|
+
if (cachedResponse instanceof BaqendResponse) {
|
|
35
31
|
return cachedResponse;
|
|
36
32
|
}
|
|
37
33
|
const response = await this.crawler.fetchRemote(originUrl, variation);
|
|
@@ -54,11 +50,11 @@ class VirtualOrestesApp {
|
|
|
54
50
|
const { responseContent, textEncoding } = await this.getResponseText(response);
|
|
55
51
|
if (!this.isHtmlContentHeader(response?.headers) ||
|
|
56
52
|
!this.isValidHtmlContent(responseContent)) {
|
|
57
|
-
const customResponse = new
|
|
53
|
+
const customResponse = new BaqendResponse(responseContent, `text/html; charset=${textEncoding}`, customHeaders);
|
|
58
54
|
this.cache.addEntry(event.request.url, customResponse);
|
|
59
55
|
return customResponse;
|
|
60
56
|
}
|
|
61
|
-
const customResponse = await
|
|
57
|
+
const customResponse = await safe(this.documentHandler.transform(`text/html;charset=${textEncoding}`, responseContent, variation, originUrl, this.convertResponseHeadersToOrestesFormat(response)));
|
|
62
58
|
if (customResponse.success === false) {
|
|
63
59
|
return this.returnErrorResponse(customResponse, customHeaders);
|
|
64
60
|
}
|
|
@@ -73,7 +69,6 @@ class VirtualOrestesApp {
|
|
|
73
69
|
});
|
|
74
70
|
}
|
|
75
71
|
const originHeaders = [];
|
|
76
|
-
// eslint-disable-next-line unicorn/no-array-for-each
|
|
77
72
|
response?.headers.forEach((value, key) => {
|
|
78
73
|
originHeaders.push({ name: `x-origin-${key}`, value: value });
|
|
79
74
|
});
|
|
@@ -81,9 +76,9 @@ class VirtualOrestesApp {
|
|
|
81
76
|
name: "x-sk-detected-encoding",
|
|
82
77
|
value: textEncoding,
|
|
83
78
|
});
|
|
84
|
-
const baqendResponse = new
|
|
79
|
+
const baqendResponse = new BaqendResponse(Buffer.isBuffer(skResponse.body)
|
|
85
80
|
? skResponse.body
|
|
86
|
-
:
|
|
81
|
+
: iconv.encode(skResponse.body, textEncoding), skResponse.headers["content-type"] ?? `text/html;charset=${textEncoding}`, [...customHeaders, ...originHeaders]);
|
|
87
82
|
this.cache.addEntry(event.request.url, baqendResponse);
|
|
88
83
|
return baqendResponse;
|
|
89
84
|
}
|
|
@@ -94,19 +89,19 @@ class VirtualOrestesApp {
|
|
|
94
89
|
const encodingFromHeader = (contentType && charsetRegex.test(contentType)
|
|
95
90
|
? charsetRegex.exec(contentType)[1]
|
|
96
91
|
: null) ?? "utf-8";
|
|
97
|
-
if (!
|
|
98
|
-
throw new
|
|
92
|
+
if (!iconv.encodingExists(encodingFromHeader)) {
|
|
93
|
+
throw new UnsupportedEncodingError(`encoding is not supported by cli: "${encodingFromHeader}"`);
|
|
99
94
|
}
|
|
100
|
-
let encodedBody =
|
|
101
|
-
const metaSelector =
|
|
95
|
+
let encodedBody = iconv.decode(buffer, encodingFromHeader);
|
|
96
|
+
const metaSelector = META_CONTENT_TYPE_REGEX;
|
|
102
97
|
const encodingFromBodyMeta = metaSelector.test(encodedBody)
|
|
103
98
|
? metaSelector.exec(encodedBody)[1]
|
|
104
99
|
: null;
|
|
105
100
|
if (encodingFromBodyMeta && encodingFromBodyMeta !== encodingFromHeader) {
|
|
106
|
-
if (!
|
|
107
|
-
throw new
|
|
101
|
+
if (!iconv.encodingExists(encodingFromBodyMeta)) {
|
|
102
|
+
throw new UnsupportedEncodingError(`encoding is not supported by cli: "${encodingFromBodyMeta}"`);
|
|
108
103
|
}
|
|
109
|
-
encodedBody =
|
|
104
|
+
encodedBody = iconv.decode(buffer, encodingFromBodyMeta);
|
|
110
105
|
}
|
|
111
106
|
return {
|
|
112
107
|
responseContent: encodedBody,
|
|
@@ -119,11 +114,10 @@ class VirtualOrestesApp {
|
|
|
119
114
|
this.cli.comment(customResponse.errorObj.stack);
|
|
120
115
|
this.cli.writeWarning("Suggestion: check files: config_documentHandler.es6 | custom_documentHandler.js");
|
|
121
116
|
customHeaders.push({ name: "x-error", value: message });
|
|
122
|
-
return new
|
|
117
|
+
return new BaqendResponse(message, null, customHeaders, 500);
|
|
123
118
|
}
|
|
124
119
|
convertResponseHeadersToOrestesFormat(response) {
|
|
125
120
|
const convertedResponseHeaders = {};
|
|
126
|
-
// eslint-disable-next-line unicorn/no-array-for-each
|
|
127
121
|
response?.headers?.forEach((value, key) => {
|
|
128
122
|
convertedResponseHeaders[key] = value;
|
|
129
123
|
});
|
|
@@ -134,7 +128,7 @@ class VirtualOrestesApp {
|
|
|
134
128
|
name: "location",
|
|
135
129
|
value: response?.headers.get("location") || "",
|
|
136
130
|
});
|
|
137
|
-
const redirectResponse = new
|
|
131
|
+
const redirectResponse = new BaqendResponse("", null, customHeaders, response.status);
|
|
138
132
|
this.cache.addEntry(event.request.url, redirectResponse);
|
|
139
133
|
return redirectResponse;
|
|
140
134
|
}
|
|
@@ -150,7 +144,7 @@ class VirtualOrestesApp {
|
|
|
150
144
|
return header.name === "server-timing";
|
|
151
145
|
});
|
|
152
146
|
serverTimingHeader.value += ",error;desc=202";
|
|
153
|
-
const redirectResponse = new
|
|
147
|
+
const redirectResponse = new BaqendResponse("", null, customHeaders, 400);
|
|
154
148
|
this.cache.addEntry(event.request.url, redirectResponse);
|
|
155
149
|
return redirectResponse;
|
|
156
150
|
}
|
|
@@ -170,7 +164,7 @@ class VirtualOrestesApp {
|
|
|
170
164
|
}
|
|
171
165
|
getCachedResponse(requestUrl) {
|
|
172
166
|
const response = this.cache.getEntry(requestUrl);
|
|
173
|
-
if (!(response instanceof
|
|
167
|
+
if (!(response instanceof BaqendResponse)) {
|
|
174
168
|
return;
|
|
175
169
|
}
|
|
176
170
|
response.setHeader("x-cache", "POP, HIT");
|
|
@@ -218,10 +212,9 @@ class VirtualOrestesApp {
|
|
|
218
212
|
return text.includes("<html");
|
|
219
213
|
}
|
|
220
214
|
rewriteInstallResource(text) {
|
|
221
|
-
text = text.replace(
|
|
215
|
+
text = text.replace(SpeedKitInstallRegex, "");
|
|
222
216
|
return text.replace(/<\s*head\b[^>]*>/, (head) => {
|
|
223
217
|
return `${head}\n<script src="${this.customerConfig.installPath}" ${this.customerConfig.installParams}></script>`;
|
|
224
218
|
});
|
|
225
219
|
}
|
|
226
220
|
}
|
|
227
|
-
exports.VirtualOrestesApp = VirtualOrestesApp;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./pop-config-service";
|
|
2
|
-
export * from "./pop-config-factory";
|
|
3
|
-
export * from "./pop-config-model";
|
|
1
|
+
export * from "./pop-config-service.js";
|
|
2
|
+
export * from "./pop-config-factory.js";
|
|
3
|
+
export * from "./pop-config-model.js";
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./pop-config-service"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./pop-config-factory"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./pop-config-model"), exports);
|
|
1
|
+
export * from "./pop-config-service.js";
|
|
2
|
+
export * from "./pop-config-factory.js";
|
|
3
|
+
export * from "./pop-config-model.js";
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const pop_config_service_1 = require("./pop-config-service");
|
|
5
|
-
const athena_1 = require("../athena");
|
|
6
|
-
class PopConfigFactory {
|
|
1
|
+
import { PopConfigService } from "./pop-config-service.js";
|
|
2
|
+
import { AthenaServiceFactory } from "../athena/index.js";
|
|
3
|
+
export class PopConfigFactory {
|
|
7
4
|
async getService() {
|
|
8
|
-
const athenaService = await new
|
|
9
|
-
return new
|
|
5
|
+
const athenaService = await new AthenaServiceFactory().getService();
|
|
6
|
+
return new PopConfigService(athenaService);
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
|
-
exports.PopConfigFactory = PopConfigFactory;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UsedPopsPerOrigin } from "./";
|
|
2
|
-
import { AthenaService } from "../athena";
|
|
1
|
+
import { UsedPopsPerOrigin } from "./index.js";
|
|
2
|
+
import { AthenaService } from "../athena/index.js";
|
|
3
3
|
export declare class PopConfigService {
|
|
4
4
|
private athenaService;
|
|
5
5
|
constructor(athenaService: AthenaService);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PopConfigService = void 0;
|
|
4
|
-
class PopConfigService {
|
|
1
|
+
export class PopConfigService {
|
|
5
2
|
athenaService;
|
|
6
3
|
constructor(athenaService) {
|
|
7
4
|
this.athenaService = athenaService;
|
|
@@ -36,4 +33,3 @@ class PopConfigService {
|
|
|
36
33
|
return await this.athenaService.getResult(query, [start, end, app], 12 * 60);
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
|
-
exports.PopConfigService = PopConfigService;
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const __1 = require("../");
|
|
8
|
-
const normalize_1 = require("../../../helpers/normalize");
|
|
9
|
-
const invalid_origin_error_1 = require("../error/invalid-origin-error");
|
|
10
|
-
class AssetApiClient {
|
|
1
|
+
import { URL } from "node:url";
|
|
2
|
+
import http2 from "node:http2";
|
|
3
|
+
import { MAX_REQUESTS_PER_SECOND, DEFAULT_REQUESTS_PER_SECOND, RATE_LIMIT_MULTIPLICATOR, DEFAULT_VARIATIONS, TIMING_HEADER_KEY, } from "../index.js";
|
|
4
|
+
import { normalize } from "../../../helpers/normalize.js";
|
|
5
|
+
import { InvalidOriginError } from "../error/invalid-origin-error.js";
|
|
6
|
+
export class AssetApiClient {
|
|
11
7
|
authenticationToken;
|
|
12
8
|
app;
|
|
13
9
|
sortParameters;
|
|
14
10
|
sessions = new Map();
|
|
15
|
-
rateLimit =
|
|
16
|
-
lowestRateLimit =
|
|
11
|
+
rateLimit = DEFAULT_REQUESTS_PER_SECOND;
|
|
12
|
+
lowestRateLimit = DEFAULT_REQUESTS_PER_SECOND;
|
|
17
13
|
isRetry = false;
|
|
18
14
|
lastRequestTime = Date.now();
|
|
19
15
|
constructor(authenticationToken, app, sortParameters) {
|
|
@@ -24,14 +20,14 @@ class AssetApiClient {
|
|
|
24
20
|
async fetchURL(url, variation, verbose) {
|
|
25
21
|
await this.sleepByRate();
|
|
26
22
|
this.isValidUrl(url);
|
|
27
|
-
const assetUrl = new
|
|
23
|
+
const assetUrl = new URL(normalize(url, this.sortParameters));
|
|
28
24
|
this.setVariationParameter(variation, assetUrl);
|
|
29
25
|
assetUrl.searchParams.set("bqpass", "1");
|
|
30
26
|
const origin = `https://${this.app}.app.baqend.com`;
|
|
31
27
|
const start = Date.now();
|
|
32
28
|
const result = await this.makeHttp2Request(origin, `/v1/asset/${assetUrl.toString()}`, assetUrl.origin);
|
|
33
29
|
if (verbose) {
|
|
34
|
-
console.log(`fetch ${url} - ${variation} took ${Date.now() - start}ms, cdnTime: ${result.headers.get("x-timer") || "-"}, status: ${result.status}, cache: ${result.headers.get("x-cache")}, timings: ${result.headers.get(
|
|
30
|
+
console.log(`fetch ${url} - ${variation} took ${Date.now() - start}ms, cdnTime: ${result.headers.get("x-timer") || "-"}, status: ${result.status}, cache: ${result.headers.get("x-cache")}, timings: ${result.headers.get(TIMING_HEADER_KEY)}`);
|
|
35
31
|
}
|
|
36
32
|
return result;
|
|
37
33
|
}
|
|
@@ -47,7 +43,7 @@ class AssetApiClient {
|
|
|
47
43
|
}
|
|
48
44
|
let session = sessions?.shift();
|
|
49
45
|
if (!session || session.destroyed || session.closed) {
|
|
50
|
-
session =
|
|
46
|
+
session = http2.connect(origin, {
|
|
51
47
|
rejectUnauthorized: false,
|
|
52
48
|
});
|
|
53
49
|
session.on("error", (error) => {
|
|
@@ -55,8 +51,8 @@ class AssetApiClient {
|
|
|
55
51
|
});
|
|
56
52
|
}
|
|
57
53
|
const request = session.request({
|
|
58
|
-
[
|
|
59
|
-
[
|
|
54
|
+
[http2.constants.HTTP2_HEADER_METHOD]: "HEAD",
|
|
55
|
+
[http2.constants.HTTP2_HEADER_PATH]: path,
|
|
60
56
|
authorization: `BAT ${this.authenticationToken}`,
|
|
61
57
|
origin: assetOrigin,
|
|
62
58
|
"accept-encoding": "gzip, deflate, br, dcb",
|
|
@@ -96,19 +92,19 @@ class AssetApiClient {
|
|
|
96
92
|
return this.rateLimit;
|
|
97
93
|
}
|
|
98
94
|
reduceMaxRequestsPerSecond() {
|
|
99
|
-
this.setRateLimit(this.rateLimit *
|
|
95
|
+
this.setRateLimit(this.rateLimit * RATE_LIMIT_MULTIPLICATOR);
|
|
100
96
|
if (this.rateLimit < this.lowestRateLimit) {
|
|
101
97
|
this.lowestRateLimit = this.rateLimit;
|
|
102
98
|
}
|
|
103
99
|
}
|
|
104
100
|
increaseMaxRequestsPerSecond() {
|
|
105
|
-
if (this.rateLimit + 1 <=
|
|
101
|
+
if (this.rateLimit + 1 <= MAX_REQUESTS_PER_SECOND && !this.isRetry) {
|
|
106
102
|
this.setRateLimit(this.rateLimit + 1);
|
|
107
103
|
}
|
|
108
104
|
}
|
|
109
105
|
isValidUrl(url) {
|
|
110
|
-
if (!
|
|
111
|
-
throw new
|
|
106
|
+
if (!URL.canParse(url)) {
|
|
107
|
+
throw new InvalidOriginError(`Invalid url`);
|
|
112
108
|
}
|
|
113
109
|
}
|
|
114
110
|
setRateLimit(limit) {
|
|
@@ -135,7 +131,7 @@ class AssetApiClient {
|
|
|
135
131
|
return;
|
|
136
132
|
}
|
|
137
133
|
// on tv|tablet|mobile set variation as lowerCase
|
|
138
|
-
if (
|
|
134
|
+
if (DEFAULT_VARIATIONS.includes(variation.toLowerCase())) {
|
|
139
135
|
assetUrl.searchParams.set("bqvariation", variation.toLowerCase());
|
|
140
136
|
return;
|
|
141
137
|
}
|
|
@@ -151,4 +147,3 @@ class AssetApiClient {
|
|
|
151
147
|
await new Promise((resolve) => setTimeout(resolve, sleepTime));
|
|
152
148
|
}
|
|
153
149
|
}
|
|
154
|
-
exports.AssetApiClient = AssetApiClient;
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.AssetItem = void 0;
|
|
4
|
-
const __1 = require("../");
|
|
5
|
-
class AssetItem {
|
|
1
|
+
import { ItemStatus } from "../index.js";
|
|
2
|
+
export class AssetItem {
|
|
6
3
|
url;
|
|
7
4
|
variation;
|
|
8
5
|
error = null;
|
|
9
|
-
status =
|
|
6
|
+
status = ItemStatus.NEW;
|
|
10
7
|
constructor(url, variation) {
|
|
11
8
|
this.url = url;
|
|
12
9
|
this.variation = variation;
|
|
13
10
|
}
|
|
14
11
|
done() {
|
|
15
|
-
this.status =
|
|
12
|
+
this.status = ItemStatus.DONE;
|
|
16
13
|
}
|
|
17
14
|
failed() {
|
|
18
|
-
this.status =
|
|
15
|
+
this.status = ItemStatus.ERROR;
|
|
19
16
|
}
|
|
20
17
|
retry() {
|
|
21
|
-
this.status =
|
|
18
|
+
this.status = ItemStatus.RETRY;
|
|
22
19
|
}
|
|
23
20
|
setError(error) {
|
|
24
21
|
this.error = error;
|
|
@@ -27,4 +24,3 @@ class AssetItem {
|
|
|
27
24
|
return `${this.url} - ${this.variation} -> ${this.status}: ${this.error?.message ?? ""}`;
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
exports.AssetItem = AssetItem;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AssetItemInterface, ItemStatus } from "../";
|
|
2
|
-
import { AssetItem } from "./asset-item";
|
|
1
|
+
import { AssetItemInterface, ItemStatus } from "../index.js";
|
|
2
|
+
import { AssetItem } from "./asset-item.js";
|
|
3
3
|
export declare class AssetList implements Iterable<AssetItem> {
|
|
4
4
|
private elements;
|
|
5
5
|
[Symbol.iterator](): Iterator<AssetItem>;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.AssetList = void 0;
|
|
4
|
-
const __1 = require("../");
|
|
5
|
-
class AssetList {
|
|
1
|
+
import { ItemStatus } from "../index.js";
|
|
2
|
+
export class AssetList {
|
|
6
3
|
elements = [];
|
|
7
4
|
[Symbol.iterator]() {
|
|
8
5
|
return this.elements[Symbol.iterator]();
|
|
@@ -14,19 +11,18 @@ class AssetList {
|
|
|
14
11
|
return this.elements.filter((element) => element.status === status);
|
|
15
12
|
}
|
|
16
13
|
getErrorCount() {
|
|
17
|
-
return this.getByStatus(
|
|
14
|
+
return this.getByStatus(ItemStatus.ERROR).length;
|
|
18
15
|
}
|
|
19
16
|
getErrors() {
|
|
20
|
-
return this.getByStatus(
|
|
17
|
+
return this.getByStatus(ItemStatus.ERROR).map((element) => element.error);
|
|
21
18
|
}
|
|
22
19
|
getLength() {
|
|
23
20
|
return this.elements.length;
|
|
24
21
|
}
|
|
25
22
|
getRetryCount() {
|
|
26
|
-
return this.getByStatus(
|
|
23
|
+
return this.getByStatus(ItemStatus.RETRY).length;
|
|
27
24
|
}
|
|
28
25
|
getSuccessCount() {
|
|
29
|
-
return this.getByStatus(
|
|
26
|
+
return this.getByStatus(ItemStatus.DONE).length;
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
exports.AssetList = AssetList;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
6
|
-
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
7
|
-
const read_csv_error_1 = require("./error/read-csv-error");
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { ReadCsvError } from "./error/read-csv-error.js";
|
|
8
4
|
const ENCODING = "utf8";
|
|
9
5
|
const LINE_BREAK = /\r?\n/;
|
|
10
|
-
class CsvReader {
|
|
6
|
+
export class CsvReader {
|
|
11
7
|
readPath(filePath) {
|
|
12
8
|
try {
|
|
13
9
|
const entries = this.getEntries(filePath);
|
|
14
10
|
return this.cleanUpEntries(entries);
|
|
15
11
|
}
|
|
16
12
|
catch (error) {
|
|
17
|
-
throw new
|
|
13
|
+
throw new ReadCsvError(error.message);
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
16
|
cleanUpEntries(entries) {
|
|
@@ -25,8 +21,7 @@ class CsvReader {
|
|
|
25
21
|
.filter(Boolean);
|
|
26
22
|
}
|
|
27
23
|
getEntries(filePath) {
|
|
28
|
-
const fileContent =
|
|
24
|
+
const fileContent = fs.readFileSync(path.resolve(filePath), ENCODING);
|
|
29
25
|
return fileContent.split(LINE_BREAK);
|
|
30
26
|
}
|
|
31
27
|
}
|
|
32
|
-
exports.CsvReader = CsvReader;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.InvalidOriginError = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const customer_config_error_1 = tslib_1.__importDefault(require("../../integration-api/error/customer-config-error"));
|
|
6
|
-
class InvalidOriginError extends customer_config_error_1.default {
|
|
1
|
+
import CustomerConfigError from "../../integration-api/error/customer-config-error.js";
|
|
2
|
+
export class InvalidOriginError extends CustomerConfigError {
|
|
7
3
|
}
|
|
8
|
-
exports.InvalidOriginError = InvalidOriginError;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ApplicationError from "../../error-handling/error/application-error";
|
|
1
|
+
import ApplicationError from "../../error-handling/error/application-error.js";
|
|
2
2
|
export declare class ReadCsvError extends ApplicationError {
|
|
3
3
|
readonly message: string;
|
|
4
4
|
readonly code = "SK_CLI_CSV_READ";
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ReadCsvError = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
|
|
6
|
-
class ReadCsvError extends application_error_1.default {
|
|
1
|
+
import ApplicationError from "../../error-handling/error/application-error.js";
|
|
2
|
+
export class ReadCsvError extends ApplicationError {
|
|
7
3
|
message;
|
|
8
4
|
code = "SK_CLI_CSV_READ";
|
|
9
5
|
suggestions = ["check arguments for correct filePath"];
|
|
@@ -12,4 +8,3 @@ class ReadCsvError extends application_error_1.default {
|
|
|
12
8
|
this.message = message;
|
|
13
9
|
}
|
|
14
10
|
}
|
|
15
|
-
exports.ReadCsvError = ReadCsvError;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./pre-warm-service";
|
|
2
|
-
export * from "./pre-warm-factory";
|
|
3
|
-
export * from "./pre-warm-model";
|
|
1
|
+
export * from "./pre-warm-service.js";
|
|
2
|
+
export * from "./pre-warm-factory.js";
|
|
3
|
+
export * from "./pre-warm-model.js";
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./pre-warm-service"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./pre-warm-factory"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./pre-warm-model"), exports);
|
|
1
|
+
export * from "./pre-warm-service.js";
|
|
2
|
+
export * from "./pre-warm-factory.js";
|
|
3
|
+
export * from "./pre-warm-model.js";
|