@speedkit/cli 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +775 -0
- package/bin/dev +18 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +4 -0
- package/bin/run.cmd +3 -0
- package/dist/commands/airports_iata.json +1 -0
- package/dist/commands/build-parameter-query.d.ts +15 -0
- package/dist/commands/build-parameter-query.js +95 -0
- package/dist/commands/build-prewarm-query.d.ts +15 -0
- package/dist/commands/build-prewarm-query.js +69 -0
- package/dist/commands/deploy.d.ts +17 -0
- package/dist/commands/deploy.js +39 -0
- package/dist/commands/document-handler.d.ts +16 -0
- package/dist/commands/document-handler.js +36 -0
- package/dist/commands/find-pops.d.ts +17 -0
- package/dist/commands/find-pops.js +84 -0
- package/dist/commands/generate-customer-config.d.ts +10 -0
- package/dist/commands/generate-customer-config.js +29 -0
- package/dist/commands/generate-pop-config.d.ts +27 -0
- package/dist/commands/generate-pop-config.js +231 -0
- package/dist/commands/login.d.ts +10 -0
- package/dist/commands/login.js +35 -0
- package/dist/commands/onboarding.d.ts +16 -0
- package/dist/commands/onboarding.js +25 -0
- package/dist/commands/param-diff.d.ts +16 -0
- package/dist/commands/param-diff.js +111 -0
- package/dist/commands/pop-prewarm.d.ts +17 -0
- package/dist/commands/pop-prewarm.js +80 -0
- package/dist/commands/prewarm.d.ts +40 -0
- package/dist/commands/prewarm.js +127 -0
- package/dist/commands/pull.d.ts +14 -0
- package/dist/commands/pull.js +24 -0
- package/dist/commands/wpt-launcher.d.ts +21 -0
- package/dist/commands/wpt-launcher.js +79 -0
- package/dist/helpers/CustomerConfig.d.ts +51 -0
- package/dist/helpers/CustomerConfig.js +150 -0
- package/dist/helpers/build-query-helper.d.ts +32 -0
- package/dist/helpers/build-query-helper.js +216 -0
- package/dist/helpers/cli-config.d.ts +22 -0
- package/dist/helpers/cli-config.js +85 -0
- package/dist/helpers/file-helper.d.ts +8 -0
- package/dist/helpers/file-helper.js +63 -0
- package/dist/helpers/get-parsed-config.d.ts +11 -0
- package/dist/helpers/get-parsed-config.js +63 -0
- package/dist/helpers/getChromePath.d.ts +7 -0
- package/dist/helpers/getChromePath.js +27 -0
- package/dist/helpers/isDirectory.d.ts +1 -0
- package/dist/helpers/isDirectory.js +17 -0
- package/dist/helpers/isExecutable.d.ts +1 -0
- package/dist/helpers/isExecutable.js +15 -0
- package/dist/helpers/isFile.d.ts +1 -0
- package/dist/helpers/isFile.js +17 -0
- package/dist/helpers/logging-helper.d.ts +12 -0
- package/dist/helpers/logging-helper.js +27 -0
- package/dist/helpers/normalize.d.ts +40 -0
- package/dist/helpers/normalize.js +112 -0
- package/dist/helpers/race.d.ts +1 -0
- package/dist/helpers/race.js +16 -0
- package/dist/helpers/safe.d.ts +10 -0
- package/dist/helpers/safe.js +34 -0
- package/dist/helpers/scrape.d.ts +1 -0
- package/dist/helpers/scrape.js +11 -0
- package/dist/helpers/speedKitRuleToRegExp.d.ts +1 -0
- package/dist/helpers/speedKitRuleToRegExp.js +10 -0
- package/dist/helpers/watchFiles.d.ts +1 -0
- package/dist/helpers/watchFiles.js +20 -0
- package/dist/models/cli-parameters.d.ts +73 -0
- package/dist/models/cli-parameters.js +82 -0
- package/dist/models/files.d.ts +20 -0
- package/dist/models/files.js +23 -0
- package/dist/models/install.d.ts +24 -0
- package/dist/models/install.js +2 -0
- package/dist/services/athena-service.d.ts +30 -0
- package/dist/services/athena-service.js +139 -0
- package/dist/services/bundler/bundle-service-factory.d.ts +4 -0
- package/dist/services/bundler/bundle-service-factory.js +10 -0
- package/dist/services/bundler/bundle-service.d.ts +25 -0
- package/dist/services/bundler/bundle-service.js +84 -0
- package/dist/services/bundler/index.d.ts +2 -0
- package/dist/services/bundler/index.js +5 -0
- package/dist/services/cli/cli-service-factory.d.ts +5 -0
- package/dist/services/cli/cli-service-factory.js +14 -0
- package/dist/services/cli/cli-service-model.d.ts +27 -0
- package/dist/services/cli/cli-service-model.js +9 -0
- package/dist/services/cli/cli-service.d.ts +37 -0
- package/dist/services/cli/cli-service.js +123 -0
- package/dist/services/cli/error/cli-type-error.d.ts +3 -0
- package/dist/services/cli/error/cli-type-error.js +7 -0
- package/dist/services/cli/hooks.d.ts +11 -0
- package/dist/services/cli/hooks.js +33 -0
- package/dist/services/cli/index.d.ts +3 -0
- package/dist/services/cli/index.js +6 -0
- package/dist/services/config-api/client.d.ts +16 -0
- package/dist/services/config-api/client.js +54 -0
- package/dist/services/config-api/config-api-service.d.ts +16 -0
- package/dist/services/config-api/config-api-service.js +56 -0
- package/dist/services/config-api/context/config-api-context.d.ts +5 -0
- package/dist/services/config-api/context/config-api-context.js +9 -0
- package/dist/services/config-api/error/json-response-error.d.ts +2 -0
- package/dist/services/config-api/error/json-response-error.js +5 -0
- package/dist/services/config-api/error/login-error.d.ts +5 -0
- package/dist/services/config-api/error/login-error.js +12 -0
- package/dist/services/config-api/factory/config-api-service-factory.d.ts +10 -0
- package/dist/services/config-api/factory/config-api-service-factory.js +38 -0
- package/dist/services/config-api/factory/entity-manager-factory.d.ts +5 -0
- package/dist/services/config-api/factory/entity-manager-factory.js +21 -0
- package/dist/services/config-api/interface/config-api-context-interface.d.ts +4 -0
- package/dist/services/config-api/interface/config-api-context-interface.js +2 -0
- package/dist/services/config-api/interface/request-extension-interface.d.ts +5 -0
- package/dist/services/config-api/interface/request-extension-interface.js +2 -0
- package/dist/services/config-api-service.d.ts +18 -0
- package/dist/services/config-api-service.js +96 -0
- package/dist/services/context/app-context.d.ts +1 -0
- package/dist/services/context/app-context.js +2 -0
- package/dist/services/context/error/context-runtime-error.d.ts +3 -0
- package/dist/services/context/error/context-runtime-error.js +7 -0
- package/dist/services/context/interface/context-interface.d.ts +2 -0
- package/dist/services/context/interface/context-interface.js +2 -0
- package/dist/services/customer-config/customer-config-service-context.d.ts +5 -0
- package/dist/services/customer-config/customer-config-service-context.js +15 -0
- package/dist/services/customer-config/customer-config-service-factory.d.ts +8 -0
- package/dist/services/customer-config/customer-config-service-factory.js +24 -0
- package/dist/services/customer-config/customer-config-service-model.d.ts +39 -0
- package/dist/services/customer-config/customer-config-service-model.js +23 -0
- package/dist/services/customer-config/customer-config-service.d.ts +27 -0
- package/dist/services/customer-config/customer-config-service.js +263 -0
- package/dist/services/customer-config/index.d.ts +4 -0
- package/dist/services/customer-config/index.js +7 -0
- package/dist/services/customer-config/templates/config_SpeedKit.js.hbs +351 -0
- package/dist/services/customer-config/templates/config_customer.js.hbs +75 -0
- package/dist/services/customer-config/templates/config_documentHandler.js.hbs +162 -0
- package/dist/services/customer-config/templates/config_dynamicBlocks.es6.hbs +263 -0
- package/dist/services/customer-config/templates/config_dynamicStyles.css.hbs +116 -0
- package/dist/services/customer-config/templates/config_loadHandler.js.hbs +394 -0
- package/dist/services/customer-config/templates/deploymentDetection.es6.hbs +262 -0
- package/dist/services/customer-config/templates/downtimeDetection.js.hbs +110 -0
- package/dist/services/deploy/builder/install-resource-builder.d.ts +14 -0
- package/dist/services/deploy/builder/install-resource-builder.js +48 -0
- package/dist/services/deploy/checks/post-deploy/revalidated-module-check.d.ts +11 -0
- package/dist/services/deploy/checks/post-deploy/revalidated-module-check.js +30 -0
- package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +9 -0
- package/dist/services/deploy/checks/post-deploy/save-files-check.js +25 -0
- package/dist/services/deploy/context/deploy-context.d.ts +12 -0
- package/dist/services/deploy/context/deploy-context.js +26 -0
- package/dist/services/deploy/deploy-service-factory.d.ts +15 -0
- package/dist/services/deploy/deploy-service-factory.js +68 -0
- package/dist/services/deploy/deploy-service.d.ts +17 -0
- package/dist/services/deploy/deploy-service.js +63 -0
- package/dist/services/deploy/error/create-find-temp-directory-error.d.ts +4 -0
- package/dist/services/deploy/error/create-find-temp-directory-error.js +10 -0
- package/dist/services/deploy/error/deploy-app-error.d.ts +2 -0
- package/dist/services/deploy/error/deploy-app-error.js +5 -0
- package/dist/services/deploy/error/no-active-installation-error.d.ts +4 -0
- package/dist/services/deploy/error/no-active-installation-error.js +10 -0
- package/dist/services/deploy/handler/customer-config-handler.d.ts +21 -0
- package/dist/services/deploy/handler/customer-config-handler.js +85 -0
- package/dist/services/deploy/handler/install-resource-handler.d.ts +25 -0
- package/dist/services/deploy/handler/install-resource-handler.js +104 -0
- package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.d.ts +13 -0
- package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +51 -0
- package/dist/services/deploy/handler/module-handler.d.ts +14 -0
- package/dist/services/deploy/handler/module-handler.js +81 -0
- package/dist/services/deploy/handler/module-modifier/deployment-detection-modifier.d.ts +9 -0
- package/dist/services/deploy/handler/module-modifier/deployment-detection-modifier.js +24 -0
- package/dist/services/deploy/handler/server-config-handler.d.ts +12 -0
- package/dist/services/deploy/handler/server-config-handler.js +63 -0
- package/dist/services/deploy/interface/deploy-handler-interface.d.ts +6 -0
- package/dist/services/deploy/interface/deploy-handler-interface.js +2 -0
- package/dist/services/deploy/interface/install-configs.d.ts +11 -0
- package/dist/services/deploy/interface/install-configs.js +2 -0
- package/dist/services/deploy/interface/install-resource-processor-interface.d.ts +5 -0
- package/dist/services/deploy/interface/install-resource-processor-interface.js +2 -0
- package/dist/services/deploy/interface/install.d.ts +14 -0
- package/dist/services/deploy/interface/install.js +2 -0
- package/dist/services/deploy/interface/post-deploy-check-interface.d.ts +3 -0
- package/dist/services/deploy/interface/post-deploy-check-interface.js +2 -0
- package/dist/services/deploy/interface/runtime-modifier.d.ts +6 -0
- package/dist/services/deploy/interface/runtime-modifier.js +2 -0
- package/dist/services/deploy/interface/validate-origins-response.d.ts +4 -0
- package/dist/services/deploy/interface/validate-origins-response.js +2 -0
- package/dist/services/diff/diff-model.d.ts +5 -0
- package/dist/services/diff/diff-model.js +12 -0
- package/dist/services/diff/diff-service-factory.d.ts +7 -0
- package/dist/services/diff/diff-service-factory.js +20 -0
- package/dist/services/diff/diff-service.d.ts +34 -0
- package/dist/services/diff/diff-service.js +134 -0
- package/dist/services/diff/index.d.ts +3 -0
- package/dist/services/diff/index.js +6 -0
- package/dist/services/diff-service.d.ts +24 -0
- package/dist/services/diff-service.js +112 -0
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.d.ts +23 -0
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +41 -0
- package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +32 -0
- package/dist/services/document-handler-runtime/document-handler-runtime-service.js +220 -0
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +42 -0
- package/dist/services/document-handler-runtime/document-handler-server.js +225 -0
- package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.d.ts +6 -0
- package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.js +14 -0
- package/dist/services/document-handler-runtime/error/required-file-not-found-error.d.ts +3 -0
- package/dist/services/document-handler-runtime/error/required-file-not-found-error.js +7 -0
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +24 -0
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +106 -0
- package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.d.ts +3 -0
- package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.js +6 -0
- package/dist/services/document-handler-runtime/interface/template-context-interface.d.ts +3 -0
- package/dist/services/document-handler-runtime/interface/template-context-interface.js +2 -0
- package/dist/services/document-handler-runtime/interface/template-interface.d.ts +6 -0
- package/dist/services/document-handler-runtime/interface/template-interface.js +2 -0
- package/dist/services/document-handler-runtime/interface/template-param-interface.d.ts +4 -0
- package/dist/services/document-handler-runtime/interface/template-param-interface.js +2 -0
- package/dist/services/document-handler-runtime/templates/abstract-template.d.ts +9 -0
- package/dist/services/document-handler-runtime/templates/abstract-template.js +18 -0
- package/dist/services/document-handler-runtime/templates/database-mock.d.ts +6 -0
- package/dist/services/document-handler-runtime/templates/database-mock.js +111 -0
- package/dist/services/document-handler-runtime/templates/execute-document-handler.d.ts +6 -0
- package/dist/services/document-handler-runtime/templates/execute-document-handler.js +76 -0
- package/dist/services/document-handler-runtime/templates/orestes-mock.d.ts +9 -0
- package/dist/services/document-handler-runtime/templates/orestes-mock.js +168 -0
- package/dist/services/document-handler-runtime/templates/package-json.d.ts +8 -0
- package/dist/services/document-handler-runtime/templates/package-json.js +21 -0
- package/dist/services/document-handler-runtime/templates/test.d.ts +6 -0
- package/dist/services/document-handler-runtime/templates/test.js +63 -0
- package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.d.ts +6 -0
- package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.js +19 -0
- package/dist/services/error-handling/abstract/abstract-async-error-handling-service.d.ts +6 -0
- package/dist/services/error-handling/abstract/abstract-async-error-handling-service.js +18 -0
- package/dist/services/error-handling/abstract/abstract-error-handling-factory.d.ts +6 -0
- package/dist/services/error-handling/abstract/abstract-error-handling-factory.js +19 -0
- package/dist/services/error-handling/abstract/abstract-error-handling-service.d.ts +6 -0
- package/dist/services/error-handling/abstract/abstract-error-handling-service.js +19 -0
- package/dist/services/error-handling/error/application-error.d.ts +5 -0
- package/dist/services/error-handling/error/application-error.js +11 -0
- package/dist/services/error-handling/error/handler/default-error-handler.d.ts +5 -0
- package/dist/services/error-handling/error/handler/default-error-handler.js +13 -0
- package/dist/services/error-handling/error-handling-service.d.ts +7 -0
- package/dist/services/error-handling/error-handling-service.js +27 -0
- package/dist/services/error-handling/factory/error-handling-factory.d.ts +8 -0
- package/dist/services/error-handling/factory/error-handling-factory.js +21 -0
- package/dist/services/error-handling/interface/error-context-interface.d.ts +6 -0
- package/dist/services/error-handling/interface/error-context-interface.js +2 -0
- package/dist/services/error-handling/interface/error-handler-interface.d.ts +5 -0
- package/dist/services/error-handling/interface/error-handler-interface.js +2 -0
- package/dist/services/error-handling/interface/error-handling-factory-interface.d.ts +8 -0
- package/dist/services/error-handling/interface/error-handling-factory-interface.js +2 -0
- package/dist/services/error-handling/interface/error-handling-service-interface.d.ts +8 -0
- package/dist/services/error-handling/interface/error-handling-service-interface.js +2 -0
- package/dist/services/integration-api/context/integration-api-context.d.ts +9 -0
- package/dist/services/integration-api/context/integration-api-context.js +20 -0
- package/dist/services/integration-api/error/customer-config-error.d.ts +2 -0
- package/dist/services/integration-api/error/customer-config-error.js +5 -0
- package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +3 -0
- package/dist/services/integration-api/error/customer-config-legacy-error.js +7 -0
- package/dist/services/integration-api/error/handler/customer-config-handler.d.ts +5 -0
- package/dist/services/integration-api/error/handler/customer-config-handler.js +19 -0
- package/dist/services/integration-api/error/handler/customer-config-legacy-handler.d.ts +6 -0
- package/dist/services/integration-api/error/handler/customer-config-legacy-handler.js +24 -0
- package/dist/services/integration-api/error/handler/origin-handler.d.ts +6 -0
- package/dist/services/integration-api/error/handler/origin-handler.js +22 -0
- package/dist/services/integration-api/error/load-customer-error.d.ts +4 -0
- package/dist/services/integration-api/error/load-customer-error.js +10 -0
- package/dist/services/integration-api/error/mandatory-file-missing-error.d.ts +3 -0
- package/dist/services/integration-api/error/mandatory-file-missing-error.js +8 -0
- package/dist/services/integration-api/error/origin-error.d.ts +3 -0
- package/dist/services/integration-api/error/origin-error.js +7 -0
- package/dist/services/integration-api/external/external-file-reader.d.ts +4 -0
- package/dist/services/integration-api/external/external-file-reader.js +17 -0
- package/dist/services/integration-api/factory/integration-api-service-factory.d.ts +13 -0
- package/dist/services/integration-api/factory/integration-api-service-factory.js +55 -0
- package/dist/services/integration-api/file-list.d.ts +18 -0
- package/dist/services/integration-api/file-list.js +79 -0
- package/dist/services/integration-api/file-reader.d.ts +15 -0
- package/dist/services/integration-api/file-reader.js +97 -0
- package/dist/services/integration-api/file-writer.d.ts +9 -0
- package/dist/services/integration-api/file-writer.js +27 -0
- package/dist/services/integration-api/handler/customer-config-handler.d.ts +16 -0
- package/dist/services/integration-api/handler/customer-config-handler.js +55 -0
- package/dist/services/integration-api/handler/file-handler.d.ts +9 -0
- package/dist/services/integration-api/handler/file-handler.js +20 -0
- package/dist/services/integration-api/handler/install-resource-handler.d.ts +33 -0
- package/dist/services/integration-api/handler/install-resource-handler.js +67 -0
- package/dist/services/integration-api/handler/module-handler.d.ts +12 -0
- package/dist/services/integration-api/handler/module-handler.js +20 -0
- package/dist/services/integration-api/handler/server-config-handler.d.ts +8 -0
- package/dist/services/integration-api/handler/server-config-handler.js +21 -0
- package/dist/services/integration-api/integration-api-model.d.ts +89 -0
- package/dist/services/integration-api/integration-api-model.js +2 -0
- package/dist/services/integration-api/integration-api-service.d.ts +21 -0
- package/dist/services/integration-api/integration-api-service.js +76 -0
- package/dist/services/integration-api/struct/customer-config-file.d.ts +10 -0
- package/dist/services/integration-api/struct/customer-config-file.js +32 -0
- package/dist/services/integration-api/struct/customer-config.d.ts +22 -0
- package/dist/services/integration-api/struct/customer-config.js +67 -0
- package/dist/services/integration-api/struct/file.d.ts +19 -0
- package/dist/services/integration-api/struct/file.js +61 -0
- package/dist/services/integration-api/struct/install-resource-file.d.ts +6 -0
- package/dist/services/integration-api/struct/install-resource-file.js +12 -0
- package/dist/services/integration-api/struct/module-file.d.ts +5 -0
- package/dist/services/integration-api/struct/module-file.js +10 -0
- package/dist/services/integration-api/struct/ro-file.d.ts +13 -0
- package/dist/services/integration-api/struct/ro-file.js +26 -0
- package/dist/services/integration-api/struct/server-config-file.d.ts +9 -0
- package/dist/services/integration-api/struct/server-config-file.js +22 -0
- package/dist/services/integration-api/struct/virtual-file.d.ts +14 -0
- package/dist/services/integration-api/struct/virtual-file.js +28 -0
- package/dist/services/integration-api/validator/customer-config-validator.d.ts +5 -0
- package/dist/services/integration-api/validator/customer-config-validator.js +23 -0
- package/dist/services/integration-api/validator/mandatory-files-validator.d.ts +7 -0
- package/dist/services/integration-api/validator/mandatory-files-validator.js +39 -0
- package/dist/services/integration-api/virtual/external-recipe.d.ts +9 -0
- package/dist/services/integration-api/virtual/external-recipe.js +19 -0
- package/dist/services/integration-api/virtual/virtual-file-handler.d.ts +7 -0
- package/dist/services/integration-api/virtual/virtual-file-handler.js +38 -0
- package/dist/services/onboarding/browser/abort-response.d.ts +5 -0
- package/dist/services/onboarding/browser/abort-response.js +10 -0
- package/dist/services/onboarding/browser/baqend-response.d.ts +12 -0
- package/dist/services/onboarding/browser/baqend-response.js +52 -0
- package/dist/services/onboarding/browser/origin-response.d.ts +8 -0
- package/dist/services/onboarding/browser/origin-response.js +20 -0
- package/dist/services/onboarding/config-renderer/install-file-recipe.d.ts +7 -0
- package/dist/services/onboarding/config-renderer/install-file-recipe.js +13 -0
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +22 -0
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +78 -0
- package/dist/services/onboarding/dashboard/athena-service.d.ts +11 -0
- package/dist/services/onboarding/dashboard/athena-service.js +70 -0
- package/dist/services/onboarding/dashboard/frontend-dist/assets/index-87b53ed4.css +1 -0
- package/dist/services/onboarding/dashboard/frontend-dist/assets/main-274b5625.js +9 -0
- package/dist/services/onboarding/dashboard/frontend-dist/index.html +18 -0
- package/dist/services/onboarding/dashboard/index.d.ts +16 -0
- package/dist/services/onboarding/dashboard/index.js +78 -0
- package/dist/services/onboarding/dashboard/param-query-builder.d.ts +9 -0
- package/dist/services/onboarding/dashboard/param-query-builder.js +67 -0
- package/dist/services/onboarding/dashboard/request-diff-service.d.ts +11 -0
- package/dist/services/onboarding/dashboard/request-diff-service.js +59 -0
- package/dist/services/onboarding/error/vm-error.d.ts +2 -0
- package/dist/services/onboarding/error/vm-error.js +6 -0
- package/dist/services/onboarding/fetch-event-handler.d.ts +19 -0
- package/dist/services/onboarding/fetch-event-handler.js +155 -0
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +24 -0
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +118 -0
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +14 -0
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.js +30 -0
- package/dist/services/onboarding/fetch-events/dashboard-request.d.ts +15 -0
- package/dist/services/onboarding/fetch-events/dashboard-request.js +29 -0
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +26 -0
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +138 -0
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +15 -0
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.js +49 -0
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +22 -0
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +62 -0
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +21 -0
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +43 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +17 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +27 -0
- package/dist/services/onboarding/file-events/fileWatcher.d.ts +28 -0
- package/dist/services/onboarding/file-events/fileWatcher.js +133 -0
- package/dist/services/onboarding/index.d.ts +3 -0
- package/dist/services/onboarding/index.js +8 -0
- package/dist/services/onboarding/onboarding-model.d.ts +30 -0
- package/dist/services/onboarding/onboarding-model.js +53 -0
- package/dist/services/onboarding/onboarding-service-factory.d.ts +16 -0
- package/dist/services/onboarding/onboarding-service-factory.js +163 -0
- package/dist/services/onboarding/onboarding-service.d.ts +31 -0
- package/dist/services/onboarding/onboarding-service.js +130 -0
- package/dist/services/onboarding/request-cache/cache.d.ts +15 -0
- package/dist/services/onboarding/request-cache/cache.js +32 -0
- package/dist/services/onboarding/templates/install-speed-kit-html-template.d.ts +4 -0
- package/dist/services/onboarding/templates/install-speed-kit-html-template.js +264 -0
- package/dist/services/onboarding/templates/install-speed-kit-js-template.d.ts +4 -0
- package/dist/services/onboarding/templates/install-speed-kit-js-template.js +41 -0
- package/dist/services/onboarding/todo-collector.d.ts +18 -0
- package/dist/services/onboarding/todo-collector.js +48 -0
- package/dist/services/prewarm-service.d.ts +5 -0
- package/dist/services/prewarm-service.js +57 -0
- package/dist/services/pull/index.d.ts +3 -0
- package/dist/services/pull/index.js +6 -0
- package/dist/services/pull/pull-service-factory.d.ts +12 -0
- package/dist/services/pull/pull-service-factory.js +44 -0
- package/dist/services/pull/pull-service-model.d.ts +43 -0
- package/dist/services/pull/pull-service-model.js +27 -0
- package/dist/services/pull/pull-service.d.ts +18 -0
- package/dist/services/pull/pull-service.js +106 -0
- package/dist/templates/pops.js +97 -0
- package/dist/templates/speedKit.Revalidated.js +86 -0
- package/oclif.manifest.json +700 -0
- package/package.json +128 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const cli_1 = require("baqend/cli");
|
|
6
|
+
const promises_1 = require("node:fs/promises");
|
|
7
|
+
const file_helper_1 = require("../helpers/file-helper");
|
|
8
|
+
const cli_parameters_1 = require("../models/cli-parameters");
|
|
9
|
+
const athena_service_1 = require("../services/athena-service");
|
|
10
|
+
const cli_2 = require("../services/cli");
|
|
11
|
+
const config_api_service_1 = tslib_1.__importDefault(require("../services/config-api-service"));
|
|
12
|
+
const diff_service_1 = require("../services/diff-service");
|
|
13
|
+
const POP_REMAPPING = {
|
|
14
|
+
HHN: 'FRA',
|
|
15
|
+
};
|
|
16
|
+
const SHIELDS = [
|
|
17
|
+
{ condition: () => true, pop: 'FRA', shield: 'Default Shield' },
|
|
18
|
+
{ condition: ({ region }) => region.startsWith('US'), pop: 'LGA', shield: 'United States Shield' },
|
|
19
|
+
{ condition: ({ region }) => region.startsWith('SA'), pop: 'GRU', shield: 'South America Shield' },
|
|
20
|
+
{ condition: ({ region }) => region.startsWith('APAC'), pop: 'SYD', shield: 'APAC Shield' },
|
|
21
|
+
{ condition: ({ pop }) => ['KUL', 'QPG'].includes(pop), pop: 'QPG', shield: 'Singapore Shield' },
|
|
22
|
+
{ condition: ({ pop }) => ['HKG', 'ICN', 'MNL'].includes(pop), pop: 'HKG', shield: 'Hongkong Shield' },
|
|
23
|
+
{ condition: ({ region }) => region === 'Asia-South', pop: 'DEL', shield: 'Asia South Shield' },
|
|
24
|
+
{ condition: ({ region }) => region === 'North-America', pop: 'YYZ', shield: 'North America Shield' },
|
|
25
|
+
{ condition: ({ pop }) => ['DXB', 'FJR'].includes(pop), pop: 'FJR', shield: 'United Arab Emirates Shield' },
|
|
26
|
+
{ condition: ({ region }) => region === 'South-Africa', pop: 'JNB', shield: 'South Africa Shield' },
|
|
27
|
+
];
|
|
28
|
+
const percentageFormatter = new Intl.NumberFormat('en-US', { minimumFractionDigits: 1, style: 'percent' });
|
|
29
|
+
class GeneratePopConfig extends core_1.Command {
|
|
30
|
+
static args = {
|
|
31
|
+
[cli_parameters_1.CLIParameters.AppName]: core_1.Args.string({
|
|
32
|
+
description: 'The customers appName',
|
|
33
|
+
hidden: false,
|
|
34
|
+
name: cli_parameters_1.CLIParameters.AppName,
|
|
35
|
+
required: true, // make the arg required with `required: true`
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
static description = 'Generate a pop config for the given app';
|
|
39
|
+
static examples = [
|
|
40
|
+
`$ sk generate-pop-config <${cli_parameters_1.CLIParameters.AppName}>`,
|
|
41
|
+
`$ sk generate-pop-config --use-rum <${cli_parameters_1.CLIParameters.AppName}>`,
|
|
42
|
+
'$ sk generate-pop-config --coverage 95 appName',
|
|
43
|
+
'$ sk generate-pop-config --no-deploy appName',
|
|
44
|
+
'$ sk generate-pop-config --deploy appName',
|
|
45
|
+
'$ sk generate-pop-config --coverage 95 --pop-limit 6 --traffic-share 2 --deploy appName',
|
|
46
|
+
];
|
|
47
|
+
static flags = {
|
|
48
|
+
coverage: core_1.Flags.integer({ char: 'c', default: 95, description: 'The percentage of traffic which should be covered through prewarming.' }),
|
|
49
|
+
deploy: core_1.Flags.boolean({ allowNo: true, char: 'd', description: 'Default it diffs with the deployed config and ask for deployment. If the flag is passed deployment will be skipped or forced.' }),
|
|
50
|
+
'pop-limit': core_1.Flags.integer({ char: 'p', default: 5, description: 'The maximal pop count which should prewarmed.' }),
|
|
51
|
+
'traffic-share': core_1.Flags.integer({ char: 't', default: 5, description: 'The minimum traffic share in percent a pop must have to be actually prewarmed.' }),
|
|
52
|
+
'use-rum': core_1.Flags.boolean({ char: 'r', default: false, description: 'Compute the pop statistics based on RUM. Otherwise the real Speed Kit traffic is used.' }),
|
|
53
|
+
};
|
|
54
|
+
async createPopPrewarmingCode(popConfig) {
|
|
55
|
+
const revalidationTemplate = await (0, file_helper_1.readLocalFile)(__dirname, '../templates/speedKit.Revalidated.js');
|
|
56
|
+
const pops = await (0, file_helper_1.readLocalFile)(__dirname, '../templates/pops.js');
|
|
57
|
+
popConfig = pops + popConfig;
|
|
58
|
+
return revalidationTemplate.replace('{{config}}', popConfig);
|
|
59
|
+
}
|
|
60
|
+
async deployPrewarmingConfig(app, config, deploy) {
|
|
61
|
+
const moduleName = 'speedKit.Revalidated';
|
|
62
|
+
const db = await cli_1.account.login({ app });
|
|
63
|
+
const configService = new config_api_service_1.default(db, app);
|
|
64
|
+
const cliService = new cli_2.CliServiceFactory().getService();
|
|
65
|
+
const diffService = new diff_service_1.DiffService(cliService);
|
|
66
|
+
const popPrewarmingCode = await this.createPopPrewarmingCode(config);
|
|
67
|
+
const popPrewarmingCodePath = await diffService.writeContentToTemporalFile(`generated_${moduleName}`, popPrewarmingCode);
|
|
68
|
+
const remoteConfig = await configService.getRemoteModule(moduleName);
|
|
69
|
+
const doDeploy = deploy ?? await diffService.shouldDeployModule(moduleName, remoteConfig, popPrewarmingCodePath);
|
|
70
|
+
if (doDeploy) {
|
|
71
|
+
const content = await (0, promises_1.readFile)(popPrewarmingCodePath, { encoding: 'utf8' });
|
|
72
|
+
await configService.saveRemoteModule(content, moduleName);
|
|
73
|
+
this.log(`Changes for module ${moduleName} were updated successfully`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async run() {
|
|
77
|
+
const { args: { app }, flags: { coverage, deploy, 'pop-limit': popLimit, 'traffic-share': minimalShare, 'use-rum': useRum } } = await this.parse(GeneratePopConfig);
|
|
78
|
+
const athenaService = new athena_service_1.AthenaService();
|
|
79
|
+
const result = await athenaService.getUsedPopsPerOrigin(app, useRum);
|
|
80
|
+
const originStats = this.generateOriginStats(result)
|
|
81
|
+
.filter(stats => stats.hits > 1000);
|
|
82
|
+
this.printStats(originStats, coverage / 100, minimalShare / 100, popLimit);
|
|
83
|
+
const popConfig = this.generatePopConfig(originStats, coverage / 100, minimalShare / 100, popLimit);
|
|
84
|
+
await this.deployPrewarmingConfig(app, popConfig, deploy);
|
|
85
|
+
}
|
|
86
|
+
byHitsDesc(a, b) {
|
|
87
|
+
return b.hits - a.hits;
|
|
88
|
+
}
|
|
89
|
+
computeCoverageAndShare(totalHits, segmentedStats) {
|
|
90
|
+
segmentedStats = segmentedStats.sort(this.byHitsDesc);
|
|
91
|
+
let segmentHits = 0;
|
|
92
|
+
return segmentedStats.map(segment => {
|
|
93
|
+
segmentHits += segment.hits;
|
|
94
|
+
return { ...segment, coverage: segmentHits / totalHits, share: segment.hits / totalHits };
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
generateOriginStats(result) {
|
|
98
|
+
const originStats = {};
|
|
99
|
+
for (let { hits, origin, pop, region } of result) {
|
|
100
|
+
pop = POP_REMAPPING[pop] ?? pop;
|
|
101
|
+
const shieldInfo = this.getShieldInfo(region, pop);
|
|
102
|
+
const stats = originStats[origin] = originStats[origin] ?? {
|
|
103
|
+
hits: 0,
|
|
104
|
+
origin,
|
|
105
|
+
pops: {},
|
|
106
|
+
regions: {},
|
|
107
|
+
shields: {},
|
|
108
|
+
};
|
|
109
|
+
stats.hits += hits;
|
|
110
|
+
const regionStats = stats.regions[region] = stats.regions[region] ?? { hits: 0, region };
|
|
111
|
+
regionStats.hits += hits;
|
|
112
|
+
const shieldStats = stats.shields[shieldInfo.shield] = stats.shields[shieldInfo.shield] ?? { ...shieldInfo, hits: 0 };
|
|
113
|
+
shieldStats.hits += hits;
|
|
114
|
+
const popStats = stats.pops[pop] = stats.pops[pop] ?? { hits: 0, pop, region, shield: shieldInfo.pop };
|
|
115
|
+
popStats.hits += hits;
|
|
116
|
+
}
|
|
117
|
+
return Object.values(originStats).map(stats => ({
|
|
118
|
+
hits: stats.hits,
|
|
119
|
+
origin: stats.origin,
|
|
120
|
+
pops: this.computeCoverageAndShare(stats.hits, Object.values(stats.pops)),
|
|
121
|
+
regions: this.computeCoverageAndShare(stats.hits, Object.values(stats.regions)),
|
|
122
|
+
shields: this.computeCoverageAndShare(stats.hits, Object.values(stats.shields)),
|
|
123
|
+
})).sort(this.byHitsDesc);
|
|
124
|
+
}
|
|
125
|
+
generatePopConfig(originStats, coverage, minimalShare, popLimit) {
|
|
126
|
+
const originConfigs = { DEFAULT: [] };
|
|
127
|
+
for (const originStat of originStats) {
|
|
128
|
+
originConfigs[originStat.origin] = this.generatePrewarmingConfig(originStat, coverage, minimalShare, popLimit).pops
|
|
129
|
+
.map(pop => 'POP.' + pop);
|
|
130
|
+
}
|
|
131
|
+
const serializedConfig = JSON.stringify(originConfigs, null, ' ')
|
|
132
|
+
.replaceAll(/"(POP.*?)"/g, '$1')
|
|
133
|
+
.replaceAll(/\[(.*?)]/gs, match => match.replaceAll(/\s+/gs, ' '));
|
|
134
|
+
return `/* global POP */
|
|
135
|
+
/** @type PopConfig */
|
|
136
|
+
const ORIGIN_POPS = ${serializedConfig}`;
|
|
137
|
+
}
|
|
138
|
+
generatePopListByPops(originStat, coverage, minimalShare) {
|
|
139
|
+
const pops = [];
|
|
140
|
+
let edgeCoverage = 0;
|
|
141
|
+
for (const popStats of originStat.pops) {
|
|
142
|
+
pops.push(popStats.pop);
|
|
143
|
+
edgeCoverage += popStats.share;
|
|
144
|
+
if (popStats.coverage >= coverage || popStats.share < minimalShare)
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
return { edgeCoverage, pops, requiresShielding: false };
|
|
148
|
+
}
|
|
149
|
+
generatePopListByShields(originStat, coverage, minimalShare, popLimit) {
|
|
150
|
+
const pops = [];
|
|
151
|
+
let edgeCoverage = 0;
|
|
152
|
+
let shieldCoverage = 0;
|
|
153
|
+
for (const shieldStats of originStat.shields) {
|
|
154
|
+
// if we are pre warming the shield through an edge pop we increase the edge coverage of the edge and the shield pop
|
|
155
|
+
const shieldPop = originStat.pops.find(pop => pop.pop === shieldStats.pop);
|
|
156
|
+
edgeCoverage += shieldPop?.share ?? 0; // in the case the shield pop does not receive any direct traffic
|
|
157
|
+
shieldCoverage += shieldStats.share;
|
|
158
|
+
let { pop } = shieldStats;
|
|
159
|
+
// We try to use the top edge pop of the shield, if that pop still has enough traffic
|
|
160
|
+
const bestEdgePopOfShield = originStat.pops.find(popStats => popStats.shield == pop && popStats.pop != pop && popStats.share > minimalShare);
|
|
161
|
+
if (bestEdgePopOfShield) {
|
|
162
|
+
edgeCoverage += bestEdgePopOfShield.share;
|
|
163
|
+
pop = bestEdgePopOfShield.pop;
|
|
164
|
+
}
|
|
165
|
+
pops.push(pop);
|
|
166
|
+
if (shieldStats.coverage >= coverage)
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
for (const pop of originStat.pops) {
|
|
170
|
+
if (pops.length < popLimit // when the shield pre warming list is short, we can add additional big traffic pops
|
|
171
|
+
&& pop.share > minimalShare && !pops.includes(pop.pop) && pop.shield != pop.pop) {
|
|
172
|
+
pops.push(pop.pop);
|
|
173
|
+
edgeCoverage += pop.share;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return { edgeCoverage, pops, requiresShielding: true, shieldCoverage };
|
|
177
|
+
}
|
|
178
|
+
generatePrewarmingConfig(originStat, coverage, minimalShare, popLimit) {
|
|
179
|
+
// Use shields if we need to prewar more than 5 pops to achieve the coverage
|
|
180
|
+
const useShieldPrewarming = originStat.pops[popLimit - 1]?.coverage < coverage;
|
|
181
|
+
if (useShieldPrewarming) {
|
|
182
|
+
return this.generatePopListByShields(originStat, coverage, minimalShare, popLimit);
|
|
183
|
+
}
|
|
184
|
+
return this.generatePopListByPops(originStat, coverage, minimalShare);
|
|
185
|
+
}
|
|
186
|
+
getShieldInfo(region, pop) {
|
|
187
|
+
let s;
|
|
188
|
+
for (const shield of SHIELDS) {
|
|
189
|
+
if (shield.condition({ pop, region })) {
|
|
190
|
+
s = shield;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return { pop: s.pop, shield: s.shield };
|
|
194
|
+
}
|
|
195
|
+
printStats(originStats, coverage, minimalShare, popLimit) {
|
|
196
|
+
let shieldingRequired = false;
|
|
197
|
+
for (const originStat of originStats) {
|
|
198
|
+
this.log(`${originStat.origin} ${originStat.hits}`);
|
|
199
|
+
this.log(' Regions:');
|
|
200
|
+
for (const regionStats of originStat.regions) {
|
|
201
|
+
this.log(` ${regionStats.region} ${regionStats.hits} ${percentageFormatter.format(regionStats.coverage)}`);
|
|
202
|
+
if (regionStats.coverage >= coverage || regionStats.share < minimalShare)
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
this.log(' Shields:');
|
|
206
|
+
for (const shieldStats of originStat.shields) {
|
|
207
|
+
this.log(` ${shieldStats.shield} (${shieldStats.pop}) ${shieldStats.hits} ${percentageFormatter.format(shieldStats.coverage)}`);
|
|
208
|
+
if (shieldStats.coverage >= coverage || shieldStats.share < minimalShare)
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
this.log(' Pops:');
|
|
212
|
+
for (const popStats of originStat.pops) {
|
|
213
|
+
this.log(` ${popStats.pop} ${popStats.hits} ${percentageFormatter.format(popStats.coverage)} - shield: ${popStats.shield}`);
|
|
214
|
+
if (popStats.coverage >= coverage || popStats.share < minimalShare)
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
const config = this.generatePrewarmingConfig(originStat, coverage, minimalShare, popLimit);
|
|
218
|
+
this.log(' --------------------');
|
|
219
|
+
if (config.requiresShielding)
|
|
220
|
+
this.log(' Final shield coverage: ' + percentageFormatter.format(config.shieldCoverage));
|
|
221
|
+
this.log(' Final edge coverage: ' + percentageFormatter.format(config.edgeCoverage));
|
|
222
|
+
this.log(' Final pop list: ' + config.pops.join(', '));
|
|
223
|
+
this.log('');
|
|
224
|
+
shieldingRequired ||= config.requiresShielding;
|
|
225
|
+
}
|
|
226
|
+
if (shieldingRequired) {
|
|
227
|
+
this.warn('The prewarming configuration needs enabled shielding to work properly!');
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
exports.default = GeneratePopConfig;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Login extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
app: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static examples: string[];
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
private createLoginTokenFileIfNotExists;
|
|
10
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const cli_1 = require("baqend/cli");
|
|
6
|
+
const cli_parameters_1 = require("../models/cli-parameters");
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
|
+
class Login extends core_1.Command {
|
|
10
|
+
static description = 'Login to your app';
|
|
11
|
+
static args = {
|
|
12
|
+
[cli_parameters_1.CLIParameters.AppName]: core_1.Args.string({
|
|
13
|
+
name: cli_parameters_1.CLIParameters.AppName,
|
|
14
|
+
required: false,
|
|
15
|
+
default: 'bbq',
|
|
16
|
+
description: 'The customers appName', // help description
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
static examples = [
|
|
20
|
+
`$ sk login <${cli_parameters_1.CLIParameters.AppName}>`,
|
|
21
|
+
'$ sk login appName',
|
|
22
|
+
];
|
|
23
|
+
async run() {
|
|
24
|
+
const { app } = (await this.parse(Login)).args;
|
|
25
|
+
this.createLoginTokenFileIfNotExists();
|
|
26
|
+
await cli_1.account.persistLogin({ app });
|
|
27
|
+
}
|
|
28
|
+
createLoginTokenFileIfNotExists() {
|
|
29
|
+
if (!(0, node_fs_1.existsSync)(path_1.default.resolve(this.config.home, ".baqend"))) {
|
|
30
|
+
(0, node_fs_1.writeFileSync)(path_1.default.resolve(this.config.home, ".baqend"), "{}");
|
|
31
|
+
(0, node_fs_1.writeFileSync)("~/.baqend", "{}");
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.default = Login;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Onboarding extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
local: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
|
+
verboseLevel: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
configName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
};
|
|
9
|
+
static args: {
|
|
10
|
+
customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
|
|
11
|
+
exists?: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
static examples: string[];
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const cli_parameters_1 = require("../models/cli-parameters");
|
|
5
|
+
const onboarding_1 = require("../services/onboarding");
|
|
6
|
+
const cli_config_1 = require("../helpers/cli-config");
|
|
7
|
+
class Onboarding extends core_1.Command {
|
|
8
|
+
static description = 'Start a local dev environment for building and testing the Speed Kit configuration';
|
|
9
|
+
static flags = {
|
|
10
|
+
...cli_parameters_1.CLI_CONFIG_NAME,
|
|
11
|
+
'local': core_1.Flags.boolean({ char: 'l', default: false, description: 'Run with local documentHandler' }),
|
|
12
|
+
'verboseLevel': core_1.Flags.boolean({ char: 'v', default: false, description: 'Show all messages' }),
|
|
13
|
+
};
|
|
14
|
+
static args = cli_parameters_1.CLI_CUSTOMER_CONFIG;
|
|
15
|
+
static examples = [
|
|
16
|
+
`$ sk onboarding <${cli_parameters_1.CLIParameters.CustomerPath}> -${cli_parameters_1.CLIParametersChar.ConfigName} <${cli_parameters_1.CLIParameters.ConfigName}>`,
|
|
17
|
+
`$ sk onboarding ${cli_parameters_1.CLIParametersExample.CustomerPath} -${cli_parameters_1.CLIParametersChar.ConfigName} ${cli_parameters_1.CLIParametersExample.ConfigName}`,
|
|
18
|
+
];
|
|
19
|
+
async run() {
|
|
20
|
+
const { args: { customerPath }, flags: { configName, local, verboseLevel } } = await this.parse(Onboarding);
|
|
21
|
+
const service = await new onboarding_1.OnboardingServiceFactory(new onboarding_1.OnboardingContext(customerPath, configName, local, verboseLevel), new cli_config_1.CliConfig(this.config).load()).getService();
|
|
22
|
+
await service.run();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = Onboarding;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { CliService } from "../services/cli";
|
|
3
|
+
export default class ParamDiff extends Command {
|
|
4
|
+
cli: CliService;
|
|
5
|
+
static description: string;
|
|
6
|
+
static args: {
|
|
7
|
+
pageUrl: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
hideDiff: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static examples: string[];
|
|
13
|
+
constructor(argv: string[], config: any);
|
|
14
|
+
logError(message: any): void;
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const scrape_1 = tslib_1.__importDefault(require("../helpers/scrape"));
|
|
6
|
+
const cli_parameters_1 = require("../models/cli-parameters");
|
|
7
|
+
const cli_1 = require("../services/cli");
|
|
8
|
+
const url = tslib_1.__importStar(require("url"));
|
|
9
|
+
const diff_1 = require("../services/diff");
|
|
10
|
+
const cli_config_1 = require("../helpers/cli-config");
|
|
11
|
+
class ParamDiff extends core_1.Command {
|
|
12
|
+
cli;
|
|
13
|
+
static description = 'Shows difference in documents with query parameters on/off';
|
|
14
|
+
static args = {
|
|
15
|
+
[cli_parameters_1.CLIParameters.PageUrl]: core_1.Args.string({
|
|
16
|
+
name: cli_parameters_1.CLIParameters.PageUrl,
|
|
17
|
+
required: true,
|
|
18
|
+
description: 'Link of the page',
|
|
19
|
+
example: cli_parameters_1.CLIParametersExample.PageUrl
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
static flags = {
|
|
23
|
+
[cli_parameters_1.CLIParameters.HideDiff]: core_1.Flags.boolean({
|
|
24
|
+
char: cli_parameters_1.CLIParametersChar.HideDiff,
|
|
25
|
+
description: 'Hide the code diff in IDE code diff window'
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
static examples = [
|
|
29
|
+
`$ sk prewarm <${cli_parameters_1.CLIParameters.PageUrl}> -${cli_parameters_1.CLIParametersChar.HideDiff}`,
|
|
30
|
+
`$ sk prewarm ${cli_parameters_1.CLIParametersExample.PageUrl} -${cli_parameters_1.CLIParametersChar.HideDiff}`,
|
|
31
|
+
];
|
|
32
|
+
constructor(argv, config) {
|
|
33
|
+
super(argv, config);
|
|
34
|
+
this.cli = new cli_1.CliServiceFactory().getService();
|
|
35
|
+
}
|
|
36
|
+
logError(message) {
|
|
37
|
+
this.cli.spacer();
|
|
38
|
+
this.cli.writeError(message);
|
|
39
|
+
this.cli.exit(1);
|
|
40
|
+
}
|
|
41
|
+
async run() {
|
|
42
|
+
const { args, flags } = await this.parse(ParamDiff);
|
|
43
|
+
const { pageUrl: originalUrl } = args;
|
|
44
|
+
const originalData = await (0, scrape_1.default)(originalUrl);
|
|
45
|
+
if (!originalData) {
|
|
46
|
+
this.logError('Failed to fetch original document');
|
|
47
|
+
}
|
|
48
|
+
const parsedUrl = url.parse(originalUrl, true);
|
|
49
|
+
const withoutAnyParamsUrl = url.format({
|
|
50
|
+
protocol: parsedUrl.protocol,
|
|
51
|
+
host: parsedUrl.host,
|
|
52
|
+
pathname: parsedUrl.pathname,
|
|
53
|
+
});
|
|
54
|
+
const withoutAnyParamsData = await (0, scrape_1.default)(withoutAnyParamsUrl);
|
|
55
|
+
if (!withoutAnyParamsData) {
|
|
56
|
+
this.logError('Failed to fetch document without any params');
|
|
57
|
+
}
|
|
58
|
+
const userConfig = new cli_config_1.CliConfig(this.config).load();
|
|
59
|
+
const context = new diff_1.DiffContext(userConfig.diffExec, userConfig.diffExecTemplate);
|
|
60
|
+
const diffService = new diff_1.DiffServiceFactory(context).getService();
|
|
61
|
+
const originalFilePath = await diffService.writeContentToTemporalFile('original.html', originalData);
|
|
62
|
+
const withoutAnyParamsFilePath = await diffService.writeContentToTemporalFile('without-any-params.html', withoutAnyParamsData);
|
|
63
|
+
this.cli.spacer();
|
|
64
|
+
this.cli.write(`Checking any parameter...`);
|
|
65
|
+
this.cli.write(`- with: ${originalUrl}`);
|
|
66
|
+
this.cli.write(`- without: ${withoutAnyParamsUrl}`);
|
|
67
|
+
const isEqual = await diffService.executeDiff(originalFilePath, withoutAnyParamsFilePath, flags.hideDiff);
|
|
68
|
+
if (isEqual) {
|
|
69
|
+
this.cli.writeSuccess(`✅ No diff found`);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this.cli.writeWarning('⚠️ Found diff');
|
|
73
|
+
// If there is more than one query params given &
|
|
74
|
+
// there's a difference in the general check, do a detailed check:
|
|
75
|
+
if (Object.keys(parsedUrl.query).length === 1)
|
|
76
|
+
return;
|
|
77
|
+
for (let param in parsedUrl.query) {
|
|
78
|
+
const withoutCurrentParamQuery = { ...parsedUrl.query };
|
|
79
|
+
delete withoutCurrentParamQuery[param]; // Remove the current parameter
|
|
80
|
+
const withoutCurrentParamUrl = url.format({
|
|
81
|
+
protocol: parsedUrl.protocol,
|
|
82
|
+
host: parsedUrl.host,
|
|
83
|
+
pathname: parsedUrl.pathname,
|
|
84
|
+
query: withoutCurrentParamQuery
|
|
85
|
+
});
|
|
86
|
+
const withoutCurrentParamData = await (0, scrape_1.default)(withoutCurrentParamUrl);
|
|
87
|
+
if (!withoutCurrentParamData) {
|
|
88
|
+
this.logError(`Failed to fetch document without "${param}" parameter`);
|
|
89
|
+
}
|
|
90
|
+
const withoutCurrentParamFilePath = await diffService.writeContentToTemporalFile(`without-${param}-param.html`, withoutCurrentParamData);
|
|
91
|
+
this.cli.spacer();
|
|
92
|
+
this.cli.write(`Checking "${param}" parameter...`);
|
|
93
|
+
this.cli.write(`- with: ${originalUrl}`);
|
|
94
|
+
this.cli.write(`- without: ${withoutCurrentParamUrl}`);
|
|
95
|
+
const hasSpecificDiff = !await diffService.executeDiff(originalFilePath, withoutCurrentParamFilePath, flags.hideDiff);
|
|
96
|
+
if (hasSpecificDiff) {
|
|
97
|
+
const hasDiffWithoutAnyParams = !await diffService.executeDiff(withoutAnyParamsFilePath, withoutCurrentParamFilePath, true);
|
|
98
|
+
if (hasDiffWithoutAnyParams) {
|
|
99
|
+
this.cli.writeWarning('⚠️ Found diff');
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
this.cli.writeWarning('⚠️ Found diff (identical with having all params removed)');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this.cli.writeSuccess(`✅ No diff found`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.default = ParamDiff;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { EntityManager } from 'baqend';
|
|
3
|
+
export default class PopPrewarm extends Command {
|
|
4
|
+
static description: string;
|
|
5
|
+
static args: {
|
|
6
|
+
app: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
ips: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
contentTypes: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
static examples: string[];
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
getCount(db: EntityManager, contentTypes: string[]): Promise<any>;
|
|
15
|
+
queryDb(db: EntityManager, contentTypes: string[], lastId?: string): Promise<any>;
|
|
16
|
+
fetchAssets(db: EntityManager, ips: string[], contentTypes: string[], app: string, progress: any, lastId?: string): Promise<any>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const cli_1 = require("baqend/cli");
|
|
6
|
+
const core_2 = require("@oclif/core");
|
|
7
|
+
const prewarm_service_1 = tslib_1.__importDefault(require("../services/prewarm-service"));
|
|
8
|
+
const cli_parameters_1 = require("../models/cli-parameters");
|
|
9
|
+
const logging_helper_1 = require("../helpers/logging-helper");
|
|
10
|
+
class PopPrewarm extends core_1.Command {
|
|
11
|
+
static description = 'Pre-warm Fastly PoPs';
|
|
12
|
+
static args = {
|
|
13
|
+
[cli_parameters_1.CLIParameters.AppName]: core_1.Args.string({
|
|
14
|
+
name: cli_parameters_1.CLIParameters.AppName,
|
|
15
|
+
required: true,
|
|
16
|
+
description: 'The customers appName',
|
|
17
|
+
hidden: false, // hide this arg from help
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
20
|
+
static flags = {
|
|
21
|
+
[cli_parameters_1.CLIParameters.Ips]: core_1.Flags.string({ default: '151.101.120.194', char: cli_parameters_1.CLIParametersChar.Ips }),
|
|
22
|
+
[cli_parameters_1.CLIParameters.ContentTypes]: core_1.Flags.string({ default: 'image', char: cli_parameters_1.CLIParametersChar.ContentTypes }),
|
|
23
|
+
};
|
|
24
|
+
static examples = [
|
|
25
|
+
`$ sk pop-prewarm <${cli_parameters_1.CLIParameters.AppName}> -${cli_parameters_1.CLIParametersChar.ContentTypes} <${cli_parameters_1.CLIParameters.ContentTypes}> -${cli_parameters_1.CLIParametersChar.Ips} <${cli_parameters_1.CLIParameters.Ips}>`,
|
|
26
|
+
`$ sk pop-prewarm decathlon -${cli_parameters_1.CLIParametersChar.ContentTypes} ${cli_parameters_1.CLIParametersExample.ContentTypes} -${cli_parameters_1.CLIParametersChar.Ips} ${cli_parameters_1.CLIParametersExample.Ips}`,
|
|
27
|
+
];
|
|
28
|
+
async run() {
|
|
29
|
+
const { args: { app }, flags: { ips, contentTypes } } = await this.parse(PopPrewarm);
|
|
30
|
+
const db = await cli_1.account.login({ app });
|
|
31
|
+
const contentTypeArr = contentTypes.split(',');
|
|
32
|
+
const ipsArr = ips.split(',');
|
|
33
|
+
const count = await this.getCount(db, contentTypeArr);
|
|
34
|
+
const progress = core_2.ux.progress();
|
|
35
|
+
progress.start(count * ips.length, 0);
|
|
36
|
+
await this.fetchAssets(db, ipsArr, contentTypeArr, app, progress);
|
|
37
|
+
progress.stop();
|
|
38
|
+
}
|
|
39
|
+
async getCount(db, contentTypes) {
|
|
40
|
+
return db['speedKit.Asset'].find().in('contentType', contentTypes).count();
|
|
41
|
+
}
|
|
42
|
+
async queryDb(db, contentTypes, lastId = '') {
|
|
43
|
+
let qb = db['speedKit.Asset'].find().in('contentType', contentTypes);
|
|
44
|
+
if (lastId) {
|
|
45
|
+
qb = qb.gt('id', lastId);
|
|
46
|
+
}
|
|
47
|
+
return qb.limit(100).sort({ id: 1 }).resultList();
|
|
48
|
+
}
|
|
49
|
+
async fetchAssets(db, ips, contentTypes, app, progress, lastId = '') {
|
|
50
|
+
const resultList = await this.queryDb(db, contentTypes, lastId);
|
|
51
|
+
if (resultList.length === 0) {
|
|
52
|
+
return Promise.resolve();
|
|
53
|
+
}
|
|
54
|
+
const assetChunks = prewarm_service_1.default.chunk(resultList, 50);
|
|
55
|
+
let fetches = [];
|
|
56
|
+
for (const assets of assetChunks) {
|
|
57
|
+
for (const ip of ips) {
|
|
58
|
+
for (const asset of assets) {
|
|
59
|
+
let { url } = asset;
|
|
60
|
+
const { origin, variation, extendedURL } = asset;
|
|
61
|
+
url += (extendedURL || '');
|
|
62
|
+
fetches.push(prewarm_service_1.default.fetchURLByIp(ip, url, origin, variation, app, db.token));
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
// eslint-disable-next-line no-await-in-loop
|
|
66
|
+
await Promise.all(fetches);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
(0, logging_helper_1.logWarning)(error);
|
|
70
|
+
}
|
|
71
|
+
progress.increment(fetches.length);
|
|
72
|
+
fetches = [];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
db.clear();
|
|
76
|
+
this.log(resultList[resultList.length - 1].url);
|
|
77
|
+
return this.fetchAssets(db, ips, contentTypes, app, progress, resultList[resultList.length - 1].id);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.default = PopPrewarm;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Prewarm extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
app: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
path: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
variation: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
variationPath: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
delay: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
keepParameterSorting: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
static examples: string[];
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Pre-warms a list of URLs with the given variations.
|
|
18
|
+
*
|
|
19
|
+
* @param variations - Variations to be prewarmed.
|
|
20
|
+
* @param urls - The URLs to be prewarmed.
|
|
21
|
+
* @param app - The baqend app to prewarm on.
|
|
22
|
+
* @param token - The baqend token to authorize the user.
|
|
23
|
+
* @param delay - The delay between requests in ms.
|
|
24
|
+
* @param sortParameters - Activates alphabetical sorting of the URL parameters.
|
|
25
|
+
*/
|
|
26
|
+
prewarmVariations(variations: string[], urls: {
|
|
27
|
+
url: string;
|
|
28
|
+
origin: string;
|
|
29
|
+
}[], app: string, token: string, delay: number, sortParameters: boolean): Promise<void>;
|
|
30
|
+
loadAssets(path: string, origin?: string): ({
|
|
31
|
+
url: string;
|
|
32
|
+
origin: string;
|
|
33
|
+
} | null)[];
|
|
34
|
+
/**
|
|
35
|
+
* Extracts variations line by line from a given file.
|
|
36
|
+
* @param path - path to the csv containing variations
|
|
37
|
+
*/
|
|
38
|
+
loadVariations(path: string): (string[]);
|
|
39
|
+
sleep(ms: any): Promise<unknown>;
|
|
40
|
+
}
|