@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,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstallSpeedKitJsTemplate = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const abstract_template_1 = tslib_1.__importDefault(require("../../document-handler-runtime/templates/abstract-template"));
|
|
6
|
+
class InstallSpeedKitJsTemplate extends abstract_template_1.default {
|
|
7
|
+
getTemplate() {
|
|
8
|
+
return `
|
|
9
|
+
// Config
|
|
10
|
+
{{{config}}}
|
|
11
|
+
|
|
12
|
+
// Reset potential split test parameters
|
|
13
|
+
speedKit.split = 1.0;
|
|
14
|
+
speedKit.splitTestId = 'debug';
|
|
15
|
+
|
|
16
|
+
// Force installation on the Onboarding install resource
|
|
17
|
+
speedKit.disabled = speedKit.disabled && !location.pathname.includes('/speed-kit-install.html');
|
|
18
|
+
// speedKit.sw = '/speed-kit-install-sw.js';
|
|
19
|
+
|
|
20
|
+
{{#if forceInstall}}
|
|
21
|
+
// inject installation resource in all pages
|
|
22
|
+
speedKit.forceInstall = {{forceInstall}}
|
|
23
|
+
speedKit.installPath = '{{{installPath}}}';
|
|
24
|
+
speedKit.installParams = '{{{installParams}}}';
|
|
25
|
+
{{/if}}
|
|
26
|
+
|
|
27
|
+
document.addEventListener('speed-kit-loaded', function(event) {
|
|
28
|
+
var blocks = SpeedKit.dynamicBlocks || {};
|
|
29
|
+
var errors = SpeedKit.dynamicBlocks.errors || [];
|
|
30
|
+
|
|
31
|
+
console.log(\`[SKOnboarding]: Merged \${blocks.mergedBlocks || 0} blocks from \${blocks.remoteBlocks || 0} remote into \${blocks.localBlocks || 0} local blocks\`);
|
|
32
|
+
errors.forEach(function(error) {
|
|
33
|
+
console.error(\`[SKOnboarding]: Merging block with id \${error.id} failed with error:\\n\${error.stackTrace}\`);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
// Inject BypassDeactivation into install.js to persist after navigations
|
|
37
|
+
navigator?.serviceWorker?.controller?.postMessage({ type: 'bypass-deactivation', data: true });
|
|
38
|
+
`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.InstallSpeedKitJsTemplate = InstallSpeedKitJsTemplate;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FileInterface } from "../integration-api/integration-api-model";
|
|
2
|
+
export type task = {
|
|
3
|
+
todo: string;
|
|
4
|
+
context: string;
|
|
5
|
+
file: string;
|
|
6
|
+
line: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Represents a TodoCollector class that collects open tasks from files.
|
|
10
|
+
* This files will then be injected to the current open page, so you or the browser-extension can access and display them
|
|
11
|
+
*/
|
|
12
|
+
export declare class TodoCollector {
|
|
13
|
+
private files;
|
|
14
|
+
constructor(files: FileInterface[]);
|
|
15
|
+
getOpenTasks(): task[];
|
|
16
|
+
lineNumber(needle: string, haystack: string): number;
|
|
17
|
+
lineNumberByIndex(index: number, string: string): number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TodoCollector = void 0;
|
|
4
|
+
const virtual_file_1 = require("../integration-api/struct/virtual-file");
|
|
5
|
+
const TODO_MATCH = /(todo[^(\r\n|\r|\n)]*)((?:\r\n|\r|\n)[^(\r\n|\r|\n)]*(?:\r\n|\r|\n)[^(\r\n|\r|\n)]*(?:\r\n|\r|\n)[^(\r\n|\r|\n)]*)/i;
|
|
6
|
+
/**
|
|
7
|
+
* Represents a TodoCollector class that collects open tasks from files.
|
|
8
|
+
* This files will then be injected to the current open page, so you or the browser-extension can access and display them
|
|
9
|
+
*/
|
|
10
|
+
class TodoCollector {
|
|
11
|
+
files;
|
|
12
|
+
constructor(files) {
|
|
13
|
+
this.files = files;
|
|
14
|
+
}
|
|
15
|
+
getOpenTasks() {
|
|
16
|
+
const configFiles = this.files.filter(file => {
|
|
17
|
+
return !(file.type instanceof virtual_file_1.VirtualFile);
|
|
18
|
+
});
|
|
19
|
+
const tasks = [];
|
|
20
|
+
for (const configFile of configFiles) {
|
|
21
|
+
const content = configFile.getContent();
|
|
22
|
+
content.replace(TODO_MATCH, (taskString, task, taskContext) => {
|
|
23
|
+
tasks.push({
|
|
24
|
+
todo: task,
|
|
25
|
+
context: encodeURI(taskContext),
|
|
26
|
+
file: configFile.name,
|
|
27
|
+
line: this.lineNumber(task, content)
|
|
28
|
+
});
|
|
29
|
+
return taskString;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return tasks;
|
|
33
|
+
}
|
|
34
|
+
lineNumber(needle, haystack) {
|
|
35
|
+
return this.lineNumberByIndex(haystack.indexOf(needle), haystack);
|
|
36
|
+
}
|
|
37
|
+
lineNumberByIndex(index, string) {
|
|
38
|
+
// RegExp
|
|
39
|
+
var line = 0, match, re = /(^)[\S\s]/gm;
|
|
40
|
+
while (match = re.exec(string)) {
|
|
41
|
+
if (match.index > index)
|
|
42
|
+
break;
|
|
43
|
+
line++;
|
|
44
|
+
}
|
|
45
|
+
return line;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.TodoCollector = TodoCollector;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export default class PrewarmService {
|
|
2
|
+
static fetchURLByIp(ip: string, url: string, origin: string, variation: string, app: string, token: string): Promise<any>;
|
|
3
|
+
static fetchURL(url: string, origin: string, variation: string, app: string, token: string, sortParameters: boolean): Promise<any>;
|
|
4
|
+
static chunk(arr: any[], len: number): any[];
|
|
5
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const normalize_1 = require("../helpers/normalize");
|
|
4
|
+
const fetch = require('node-fetch');
|
|
5
|
+
const https = require('https');
|
|
6
|
+
const agent = new https.Agent({
|
|
7
|
+
rejectUnauthorized: false,
|
|
8
|
+
keepAlive: true,
|
|
9
|
+
});
|
|
10
|
+
class PrewarmService {
|
|
11
|
+
// eslint-disable-next-line max-params
|
|
12
|
+
static async fetchURLByIp(ip, url, origin, variation, app, token) {
|
|
13
|
+
if (variation && variation !== 'DEFAULT' && variation !== 'DESKTOP') {
|
|
14
|
+
url = url + (url.includes('?') ? '&' : '?') + `bqvariation=${variation.toLowerCase()}`;
|
|
15
|
+
}
|
|
16
|
+
url += (url.includes('?') ? '&' : '?') + `bqpass=1`;
|
|
17
|
+
return fetch(`https://${ip}/v1/asset/${url}`, {
|
|
18
|
+
agent,
|
|
19
|
+
method: 'HEAD',
|
|
20
|
+
headers: {
|
|
21
|
+
Host: `${app}.app.baqend.com`,
|
|
22
|
+
Origin: origin,
|
|
23
|
+
authorization: `BAT ${token}`,
|
|
24
|
+
'Accept-Encoding': 'gzip, deflate, br',
|
|
25
|
+
},
|
|
26
|
+
timeout: 10000,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
// eslint-disable-next-line max-params
|
|
30
|
+
static async fetchURL(url, origin, variation, app, token, sortParameters) {
|
|
31
|
+
let normalizedUrl = (0, normalize_1.normalize)(url, sortParameters);
|
|
32
|
+
if (variation && variation !== 'DEFAULT' && variation !== 'DESKTOP') {
|
|
33
|
+
normalizedUrl += (normalizedUrl.includes('?') ? '&' : '?') + `bqvariation=${variation.toLowerCase()}`;
|
|
34
|
+
}
|
|
35
|
+
normalizedUrl += (normalizedUrl.includes('?') ? '&' : '?') + `bqpass=1`;
|
|
36
|
+
return fetch(`https://${app}.app.baqend.com/v1/asset/${normalizedUrl}`, {
|
|
37
|
+
agent,
|
|
38
|
+
method: 'HEAD',
|
|
39
|
+
headers: {
|
|
40
|
+
Origin: origin,
|
|
41
|
+
authorization: `BAT ${token}`,
|
|
42
|
+
'Accept-Encoding': 'gzip, deflate, br',
|
|
43
|
+
},
|
|
44
|
+
timeout: 10000,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
static chunk(arr, len) {
|
|
48
|
+
const chunks = [];
|
|
49
|
+
const n = arr.length;
|
|
50
|
+
let i = 0;
|
|
51
|
+
while (i < n) {
|
|
52
|
+
chunks.push(arr.slice(i, i += len));
|
|
53
|
+
}
|
|
54
|
+
return chunks;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.default = PrewarmService;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./pull-service-model"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./pull-service-factory"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./pull-service"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PullContext, PullService } from "./";
|
|
2
|
+
import { UserCliConfig } from "../../helpers/cli-config";
|
|
3
|
+
export declare class PullServiceFactory {
|
|
4
|
+
private readonly context;
|
|
5
|
+
private userConfig;
|
|
6
|
+
private service?;
|
|
7
|
+
constructor(context: PullContext, userConfig: UserCliConfig);
|
|
8
|
+
buildService(): Promise<PullService>;
|
|
9
|
+
private build;
|
|
10
|
+
private getIntegrationFiles;
|
|
11
|
+
private getConfigApi;
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PullServiceFactory = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const integration_api_context_1 = tslib_1.__importDefault(require("../integration-api/context/integration-api-context"));
|
|
6
|
+
const integration_api_service_factory_1 = tslib_1.__importDefault(require("../integration-api/factory/integration-api-service-factory"));
|
|
7
|
+
const config_api_service_factory_1 = tslib_1.__importDefault(require("../config-api/factory/config-api-service-factory"));
|
|
8
|
+
const config_api_context_1 = tslib_1.__importDefault(require("../config-api/context/config-api-context"));
|
|
9
|
+
const cli_1 = require("../cli");
|
|
10
|
+
const _1 = require("./");
|
|
11
|
+
class PullServiceFactory {
|
|
12
|
+
context;
|
|
13
|
+
userConfig;
|
|
14
|
+
service = undefined;
|
|
15
|
+
constructor(context, userConfig) {
|
|
16
|
+
this.context = context;
|
|
17
|
+
this.userConfig = userConfig;
|
|
18
|
+
this.context = context;
|
|
19
|
+
}
|
|
20
|
+
async buildService() {
|
|
21
|
+
if (!(this.service instanceof _1.PullService)) {
|
|
22
|
+
await this.build();
|
|
23
|
+
}
|
|
24
|
+
return this.service;
|
|
25
|
+
}
|
|
26
|
+
async build() {
|
|
27
|
+
const files = await this.getIntegrationFiles();
|
|
28
|
+
const customer = files.getCustomerConfig().config;
|
|
29
|
+
const configName = customer.name || this.context.configName;
|
|
30
|
+
const configApi = this.getConfigApi(customer.app);
|
|
31
|
+
const cliService = new cli_1.CliServiceFactory().getService();
|
|
32
|
+
this.service = new _1.PullService(files, cliService, configApi, configName, this.context.customerPath);
|
|
33
|
+
}
|
|
34
|
+
async getIntegrationFiles() {
|
|
35
|
+
const integrationApiContext = new integration_api_context_1.default(this.context.customerPath, this.context.configName, []);
|
|
36
|
+
const integrationApi = new integration_api_service_factory_1.default(integrationApiContext, this.userConfig).buildService();
|
|
37
|
+
return await integrationApi.run();
|
|
38
|
+
}
|
|
39
|
+
getConfigApi(app) {
|
|
40
|
+
const configApiContext = new config_api_context_1.default(app);
|
|
41
|
+
return new config_api_service_factory_1.default(configApiContext).getService();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.PullServiceFactory = PullServiceFactory;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare class PullContext {
|
|
2
|
+
readonly customerPath: string;
|
|
3
|
+
readonly configName: string;
|
|
4
|
+
constructor(customerPath: string, configName?: string);
|
|
5
|
+
}
|
|
6
|
+
export declare const InstallResourceToFileMapping: {
|
|
7
|
+
config: {
|
|
8
|
+
fileName: string;
|
|
9
|
+
extension: string;
|
|
10
|
+
};
|
|
11
|
+
documentHandlerConfig: {
|
|
12
|
+
fileName: string;
|
|
13
|
+
extension: string;
|
|
14
|
+
};
|
|
15
|
+
dynamicFetcherConfig: {
|
|
16
|
+
fileName: string;
|
|
17
|
+
extension: string;
|
|
18
|
+
};
|
|
19
|
+
custom: {
|
|
20
|
+
fileName: string;
|
|
21
|
+
extension: string;
|
|
22
|
+
};
|
|
23
|
+
loader: {
|
|
24
|
+
fileName: string;
|
|
25
|
+
extension: string;
|
|
26
|
+
};
|
|
27
|
+
sw: {
|
|
28
|
+
fileName: string;
|
|
29
|
+
extension: string;
|
|
30
|
+
};
|
|
31
|
+
documentHandler: {
|
|
32
|
+
fileName: string;
|
|
33
|
+
extension: string;
|
|
34
|
+
};
|
|
35
|
+
dynamicFetcher: {
|
|
36
|
+
fileName: string;
|
|
37
|
+
extension: string;
|
|
38
|
+
};
|
|
39
|
+
customStyle: {
|
|
40
|
+
fileName: string;
|
|
41
|
+
extension: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstallResourceToFileMapping = exports.PullContext = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const dotenv = tslib_1.__importStar(require("dotenv"));
|
|
6
|
+
dotenv.config();
|
|
7
|
+
const DEFAULT_CONFIG_NAME = 'production';
|
|
8
|
+
class PullContext {
|
|
9
|
+
customerPath;
|
|
10
|
+
configName;
|
|
11
|
+
constructor(customerPath, configName = DEFAULT_CONFIG_NAME) {
|
|
12
|
+
this.customerPath = customerPath;
|
|
13
|
+
this.configName = configName;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.PullContext = PullContext;
|
|
17
|
+
exports.InstallResourceToFileMapping = {
|
|
18
|
+
'config': { fileName: "config_SpeedKit", extension: "js" },
|
|
19
|
+
'documentHandlerConfig': { fileName: "config_documentHandler", extension: "js" },
|
|
20
|
+
'dynamicFetcherConfig': { fileName: "config_dynamicBlocks", extension: "es6" },
|
|
21
|
+
'custom': { fileName: "config_loadHandler", extension: "js" },
|
|
22
|
+
'loader': { fileName: "custom_loader", extension: "js" },
|
|
23
|
+
'sw': { fileName: "custom_sw", extension: "js" },
|
|
24
|
+
'documentHandler': { fileName: "custom_documentHandler", extension: "js" },
|
|
25
|
+
'dynamicFetcher': { fileName: "custom_dynamicFetcher", extension: "js" },
|
|
26
|
+
'customStyle': { fileName: "config_dynamicStyles", extension: "css" },
|
|
27
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CliServiceInterface } from "../cli";
|
|
2
|
+
import { FileListInterface } from "../integration-api/integration-api-model";
|
|
3
|
+
import ConfigApiService from "../config-api/config-api-service";
|
|
4
|
+
export declare class PullService {
|
|
5
|
+
private fileList;
|
|
6
|
+
private cli;
|
|
7
|
+
private configApi;
|
|
8
|
+
private configName;
|
|
9
|
+
private basePath;
|
|
10
|
+
constructor(fileList: FileListInterface, cli: CliServiceInterface, configApi: ConfigApiService, configName: string, basePath: string);
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
private updateLocalFileByInstallResource;
|
|
13
|
+
private isEqualContent;
|
|
14
|
+
private isEmpty;
|
|
15
|
+
private readLocalFile;
|
|
16
|
+
private createFile;
|
|
17
|
+
private hasGitChanges;
|
|
18
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PullService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cli_1 = require("../cli");
|
|
6
|
+
const install_resource_file_1 = tslib_1.__importDefault(require("../integration-api/struct/install-resource-file"));
|
|
7
|
+
const _1 = require("./");
|
|
8
|
+
const safe_1 = require("../../helpers/safe");
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
10
|
+
class PullService {
|
|
11
|
+
fileList;
|
|
12
|
+
cli;
|
|
13
|
+
configApi;
|
|
14
|
+
configName;
|
|
15
|
+
basePath;
|
|
16
|
+
constructor(fileList, cli, configApi, configName, basePath) {
|
|
17
|
+
this.fileList = fileList;
|
|
18
|
+
this.cli = cli;
|
|
19
|
+
this.configApi = configApi;
|
|
20
|
+
this.configName = configName;
|
|
21
|
+
this.basePath = basePath;
|
|
22
|
+
}
|
|
23
|
+
async run() {
|
|
24
|
+
if (this.hasGitChanges()) {
|
|
25
|
+
this.cli.writeWarning(`You have unStashed changes in folder ${this.basePath}`);
|
|
26
|
+
const shouldContinue = await this.cli.confirm(`Do you want to override your changes`, true);
|
|
27
|
+
if (!shouldContinue) {
|
|
28
|
+
this.cli.exit(0);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
this.cli.startAction("fetch active installResource");
|
|
33
|
+
const installResourceResult = await (0, safe_1.safe)(this.configApi.getActiveInstall(this.configName));
|
|
34
|
+
if (installResourceResult.success === false) {
|
|
35
|
+
this.cli.endAction(cli_1.CliActionStatus.FAILED);
|
|
36
|
+
this.cli.writeError(`An error happened try fetching the installResource ${installResourceResult.error}`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
|
|
40
|
+
const installResource = installResourceResult.data;
|
|
41
|
+
for (const key in _1.InstallResourceToFileMapping) {
|
|
42
|
+
await this.updateLocalFileByInstallResource(installResource, key);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async updateLocalFileByInstallResource(installResource, key) {
|
|
46
|
+
const installResourceContent = installResource[key];
|
|
47
|
+
const fileName = _1.InstallResourceToFileMapping[key]['fileName'];
|
|
48
|
+
const extension = _1.InstallResourceToFileMapping[key]['extension'];
|
|
49
|
+
// local and remote are empty. skip
|
|
50
|
+
if (this.isEmpty(installResourceContent) && !this.fileList.hasFile(fileName)) {
|
|
51
|
+
this.cli.writeSuccess(`empty, skip: ${fileName}`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
// local file doesn't exist. create it
|
|
55
|
+
if (!this.isEmpty(installResourceContent) && !this.fileList.hasFile(fileName)) {
|
|
56
|
+
this.cli.writeSuccess(`create: ${fileName}`);
|
|
57
|
+
await this.createFile(fileName, extension, installResourceContent, key);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const file = this.readLocalFile(fileName);
|
|
61
|
+
// local file exists but remote is empty. delete
|
|
62
|
+
if (this.isEmpty(installResourceContent) && this.fileList.hasFile(fileName)) {
|
|
63
|
+
this.cli.writeError(`delete: ${fileName}`);
|
|
64
|
+
await file.delete();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
// same content, skip
|
|
68
|
+
if (this.isEqualContent(installResourceContent, file.getContent())) {
|
|
69
|
+
this.cli.writeSuccess(`equal, skip: ${fileName}`);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
// local and remote exists. update
|
|
73
|
+
this.cli.writeWarning(`update: ${fileName}`);
|
|
74
|
+
file.setContent(installResourceContent);
|
|
75
|
+
await file.updateFile();
|
|
76
|
+
}
|
|
77
|
+
isEqualContent(installResourceContent, remoteContent) {
|
|
78
|
+
return installResourceContent === remoteContent;
|
|
79
|
+
}
|
|
80
|
+
isEmpty(installResourceContent) {
|
|
81
|
+
return !installResourceContent || installResourceContent.length === 0;
|
|
82
|
+
}
|
|
83
|
+
readLocalFile(fileName) {
|
|
84
|
+
return this.fileList.getByName(fileName);
|
|
85
|
+
}
|
|
86
|
+
async createFile(fileName, extension, content, key) {
|
|
87
|
+
const resourceFile = new install_resource_file_1.default(fileName, `${this.basePath}/${fileName}.${extension}`, content, key);
|
|
88
|
+
this.fileList.addFile(resourceFile);
|
|
89
|
+
await resourceFile.updateFile();
|
|
90
|
+
}
|
|
91
|
+
hasGitChanges() {
|
|
92
|
+
const customerName = this.basePath.split('/').filter((value) => value.length > 0).pop();
|
|
93
|
+
try {
|
|
94
|
+
const stdoutBuffer = (0, child_process_1.execSync)("git diff --name-status");
|
|
95
|
+
const stdout = stdoutBuffer.toString("utf8");
|
|
96
|
+
{
|
|
97
|
+
return stdout.includes(customerName);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
this.cli.writeError(error.message);
|
|
102
|
+
this.cli.exit(1);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.PullService = PullService;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
const POP = {
|
|
2
|
+
"BRU": "151.101.10.8",
|
|
3
|
+
"BFI": "151.101.22.8",
|
|
4
|
+
"LGB": "151.101.26.8",
|
|
5
|
+
"SYD": "151.101.30.8",
|
|
6
|
+
"AMS": "151.101.38.8",
|
|
7
|
+
"SJC": "151.101.42.8",
|
|
8
|
+
"NYC": "151.101.46.8",
|
|
9
|
+
"WVI": "151.101.50.8",
|
|
10
|
+
"IAH": "151.101.58.8",
|
|
11
|
+
"LHR": "151.101.62.8",
|
|
12
|
+
"DEN": "151.101.70.8",
|
|
13
|
+
"HKG": "151.101.78.8",
|
|
14
|
+
"MEL": "151.101.82.8",
|
|
15
|
+
"BMA": "151.101.86.8",
|
|
16
|
+
"ITM": "151.101.90.8",
|
|
17
|
+
"BNE": "151.101.98.8",
|
|
18
|
+
"PER": "151.101.106.8",
|
|
19
|
+
"TYO": "151.101.110.8",
|
|
20
|
+
"BOS": "151.101.118.8",
|
|
21
|
+
"YYZ": "151.101.126.8",
|
|
22
|
+
"MAD": "151.101.134.8",
|
|
23
|
+
"YUL": "151.101.138.8",
|
|
24
|
+
"FJR": "151.101.142.8",
|
|
25
|
+
"CMH": "151.101.146.8",
|
|
26
|
+
"MSP": "151.101.150.8",
|
|
27
|
+
"BOM": "151.101.154.8",
|
|
28
|
+
"MAA": "151.101.158.8",
|
|
29
|
+
"AKL": "151.101.166.8",
|
|
30
|
+
"JNB": "151.101.174.8",
|
|
31
|
+
"GIG": "151.101.178.8",
|
|
32
|
+
"PAO": "151.101.202.8",
|
|
33
|
+
"PDK": "151.101.206.8",
|
|
34
|
+
"EWR": "151.101.210.8",
|
|
35
|
+
"YVR": "151.101.214.8",
|
|
36
|
+
"EZE": "151.101.218.8",
|
|
37
|
+
"SCL": "151.101.222.8",
|
|
38
|
+
"CPT": "151.101.226.8",
|
|
39
|
+
"HND": "151.101.230.8",
|
|
40
|
+
"WLG": "151.101.234.8",
|
|
41
|
+
"OSL": "151.101.238.8",
|
|
42
|
+
"MXP": "151.101.242.8",
|
|
43
|
+
"HEL": "151.101.246.8",
|
|
44
|
+
"GRU": "151.101.250.8",
|
|
45
|
+
"CWB": "151.101.254.8",
|
|
46
|
+
"DAL": "199.232.10.8",
|
|
47
|
+
"VIE": "199.232.18.8",
|
|
48
|
+
"DEL": "199.232.22.8",
|
|
49
|
+
"DUB": "199.232.26.8",
|
|
50
|
+
"STP": "199.232.30.8",
|
|
51
|
+
"FTY": "199.232.34.8",
|
|
52
|
+
"LGA": "199.232.38.8",
|
|
53
|
+
"CPH": "199.232.42.8",
|
|
54
|
+
"QPG": "199.232.46.8",
|
|
55
|
+
"BOG": "199.232.50.8",
|
|
56
|
+
"MAN": "199.232.54.8",
|
|
57
|
+
"LON": "199.232.58.8",
|
|
58
|
+
"STL": "199.232.70.8",
|
|
59
|
+
"MCI": "199.232.74.8",
|
|
60
|
+
"MRS": "199.232.82.8",
|
|
61
|
+
"LCK": "199.232.98.8",
|
|
62
|
+
"CCU": "199.232.102.8",
|
|
63
|
+
"HYD": "199.232.106.8",
|
|
64
|
+
"CGH": "199.232.114.8",
|
|
65
|
+
"LIM": "199.232.134.8",
|
|
66
|
+
"PDX": "199.232.146.8",
|
|
67
|
+
"PHX": "199.232.154.8",
|
|
68
|
+
"BKK": "199.232.166.8",
|
|
69
|
+
"PAR": "199.232.170.8",
|
|
70
|
+
"MUC": "199.232.190.8",
|
|
71
|
+
"SOF": "146.75.2.8",
|
|
72
|
+
"FOR": "146.75.6.8",
|
|
73
|
+
"DTW": "146.75.10.8",
|
|
74
|
+
"CHC": "146.75.14.8",
|
|
75
|
+
"ACC": "146.75.18.8",
|
|
76
|
+
"MNL": "146.75.22.8",
|
|
77
|
+
"KUL": "146.75.26.8",
|
|
78
|
+
"IAD": "146.75.30.8",
|
|
79
|
+
"ATL": "146.75.46.8",
|
|
80
|
+
"ICN": "146.75.50.8",
|
|
81
|
+
"LIN": "146.75.54.8",
|
|
82
|
+
"PMO": "146.75.58.8",
|
|
83
|
+
"FCO": "146.75.62.8",
|
|
84
|
+
"DXB": "146.75.66.8",
|
|
85
|
+
"LCY": "146.75.74.8",
|
|
86
|
+
"CHI": "146.75.78.8",
|
|
87
|
+
"GNV": "146.75.86.8",
|
|
88
|
+
"LIS": "146.75.90.8",
|
|
89
|
+
"BUR": "146.75.94.8",
|
|
90
|
+
"HNL": "146.75.98.8",
|
|
91
|
+
"ADL": "146.75.102.8",
|
|
92
|
+
"DFW": "146.75.106.8",
|
|
93
|
+
"YYC": "146.75.110.8",
|
|
94
|
+
"NRT": "146.75.114.8",
|
|
95
|
+
"FRA": "146.75.118.8",
|
|
96
|
+
"MIA": "146.75.126.8"
|
|
97
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const fetch = require('node-fetch')
|
|
2
|
+
const https = require('node:https')
|
|
3
|
+
|
|
4
|
+
/* global Abort, ORIGIN_POPS */
|
|
5
|
+
|
|
6
|
+
const agent = new https.Agent({rejectUnauthorized: false})
|
|
7
|
+
|
|
8
|
+
{{config}} // eslint-disable-line
|
|
9
|
+
|
|
10
|
+
const ORIGIN_PATHS = Object.keys(ORIGIN_POPS).filter(origin => origin.endsWith('/'))
|
|
11
|
+
|
|
12
|
+
const fetchURL = async (ip, url, origin, variation, db) => {
|
|
13
|
+
if (variation && variation !== 'DEFAULT') {
|
|
14
|
+
url = url + (url.includes('?') ? '&' : '?') + `bqvariation=${variation.toLowerCase()}`
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const app = db.connection.host
|
|
18
|
+
try {
|
|
19
|
+
await fetch(`https://${ip}/v1/asset/${url}`, {
|
|
20
|
+
agent,
|
|
21
|
+
headers: {
|
|
22
|
+
'Accept-Encoding': 'gzip, deflate, br',
|
|
23
|
+
Host: `${app}.app.baqend.com`,
|
|
24
|
+
Origin: origin,
|
|
25
|
+
authorization: `BAT ${db.token}`,
|
|
26
|
+
'baqend-prewarm': '1',
|
|
27
|
+
},
|
|
28
|
+
method: 'HEAD',
|
|
29
|
+
timeout: 3000,
|
|
30
|
+
})
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.log(`error fetching https://${ip}/v1/asset/${url}`, error)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const fetchAssets = async (ip, assets, db) => {
|
|
37
|
+
const fetches = []
|
|
38
|
+
for (const asset of assets) {
|
|
39
|
+
let {extendedURL, origin, url, variation} = asset
|
|
40
|
+
url += (extendedURL || '')
|
|
41
|
+
fetches.push(fetchURL(ip, url, origin, variation, db))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
await Promise.all(fetches)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @param {EntityManager} db - The baqend entity manager
|
|
50
|
+
* @param {Array<{ extendedURL: string, origin: string, url: string, variation: string }>} assets - list of assets to prewar
|
|
51
|
+
* @return {Promise<void>}
|
|
52
|
+
*/
|
|
53
|
+
exports.call = async (db, assets) => {
|
|
54
|
+
if (!db.User.me || db.User.me.key !== '1') {
|
|
55
|
+
throw new Abort('Not logged in.')
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const originBuckets = {}
|
|
59
|
+
for (const asset of assets) {
|
|
60
|
+
let bucket = 'DEFAULT'
|
|
61
|
+
|
|
62
|
+
if (ORIGIN_POPS[asset.origin]) {
|
|
63
|
+
bucket = asset.origin
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// if there is a path specific prewarm list, overwrite the default prewarm list.
|
|
67
|
+
const path = ORIGIN_PATHS.find(path => asset.url.startsWith(path))
|
|
68
|
+
if (path) {
|
|
69
|
+
bucket = path
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
originBuckets[bucket] = originBuckets[bucket] || []
|
|
73
|
+
originBuckets[bucket].push(asset)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// wait for fastly purge
|
|
77
|
+
setTimeout(async () => {
|
|
78
|
+
for (const bucket of Object.keys(originBuckets)) {
|
|
79
|
+
for (const pop of ORIGIN_POPS[bucket]) {
|
|
80
|
+
if (pop) { // prevent np when the pop is not defined
|
|
81
|
+
await fetchAssets(pop, originBuckets[bucket], db)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, 5000)
|
|
86
|
+
}
|