@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,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DiffService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
+
const promises_1 = tslib_1.__importStar(require("fs/promises"));
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const file_helper_1 = require("../../helpers/file-helper");
|
|
9
|
+
class DiffService {
|
|
10
|
+
cli;
|
|
11
|
+
diffExecutablePath;
|
|
12
|
+
diffExecutableTemplate;
|
|
13
|
+
tempPath = null;
|
|
14
|
+
constructor(cli, diffExecutablePath, diffExecutableTemplate) {
|
|
15
|
+
this.cli = cli;
|
|
16
|
+
this.diffExecutablePath = diffExecutablePath;
|
|
17
|
+
this.diffExecutableTemplate = diffExecutableTemplate;
|
|
18
|
+
}
|
|
19
|
+
async diff(localPath, fileName, tmpContent) {
|
|
20
|
+
let tmpFilePath = await this.writeContentToTemporalFile(fileName, tmpContent);
|
|
21
|
+
return await this.executeDiff(tmpFilePath, localPath);
|
|
22
|
+
}
|
|
23
|
+
async diffContent(fileName, localContent, remoteContent) {
|
|
24
|
+
let tmpLocalFilePath = await this.writeContentToTemporalFile(`${fileName}-local`, localContent);
|
|
25
|
+
let tmpRemoteFilePath = await this.writeContentToTemporalFile(`${fileName}-remote`, remoteContent);
|
|
26
|
+
const diff = await this.executeDiff(tmpLocalFilePath, tmpRemoteFilePath);
|
|
27
|
+
const changedFile = await (0, promises_1.readFile)(tmpLocalFilePath, 'utf-8');
|
|
28
|
+
return { changedFile, diff };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns a temporal directory path.
|
|
32
|
+
*/
|
|
33
|
+
async getTemporalDirectoryPath() {
|
|
34
|
+
// create temporal directory for remote installationFiles so the diff can be generated
|
|
35
|
+
if (!this.tempPath) {
|
|
36
|
+
this.tempPath = await (0, file_helper_1.createTemporalDir)();
|
|
37
|
+
}
|
|
38
|
+
if (!this.tempPath) {
|
|
39
|
+
this.cli.writeError('No temporary Directory found and unable to create a new temporary Directory');
|
|
40
|
+
this.cli.exit(1);
|
|
41
|
+
}
|
|
42
|
+
return this.tempPath;
|
|
43
|
+
}
|
|
44
|
+
async writeContentToTemporalFile(tempFileName, content) {
|
|
45
|
+
if (!content) {
|
|
46
|
+
content = 'No file was found';
|
|
47
|
+
}
|
|
48
|
+
const resolveFilePath = path_1.default.join(await this.getTemporalDirectoryPath() + `/${tempFileName}`);
|
|
49
|
+
await promises_1.default.writeFile(resolveFilePath, content.replace(/\r?\n/gm, '\n'));
|
|
50
|
+
return resolveFilePath;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @param localContent local file content.
|
|
54
|
+
* @param remoteContent remote content.
|
|
55
|
+
* @description removes whitespaces, newlines and compares both params content for equality.
|
|
56
|
+
* @return returns true if both localContent and remoteContent are equal otherwise returns false.
|
|
57
|
+
*/
|
|
58
|
+
isContentEqual(localContent = '', remoteContent = '') {
|
|
59
|
+
const trimLocalContent = localContent.replace(/[\n\r\s]/g, '');
|
|
60
|
+
const trimRemoteContent = remoteContent.replace(/[\n\r\s]/g, '');
|
|
61
|
+
return trimLocalContent === trimRemoteContent;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* check if content of two files are equal
|
|
66
|
+
*
|
|
67
|
+
* @param localPath
|
|
68
|
+
* @param remotePath
|
|
69
|
+
* @param skipDiffExecution
|
|
70
|
+
*/
|
|
71
|
+
async executeDiff(localPath, remotePath, skipDiffExecution = false) {
|
|
72
|
+
let localContent;
|
|
73
|
+
let remoteContent;
|
|
74
|
+
try {
|
|
75
|
+
localContent = await promises_1.default.readFile(localPath, { encoding: 'utf8', flag: 'r' });
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
remoteContent = await promises_1.default.readFile(remotePath, { encoding: 'utf8', flag: 'r' });
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
this.cli.writeError(`Error reading remote file ${remoteContent}: ${error.message}`);
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
// Returning if no difference
|
|
88
|
+
if (this.isContentEqual(localContent, remoteContent)) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
if (skipDiffExecution) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
// try custom diff tool
|
|
95
|
+
if (this.diffExecutablePath !== null && this.diffExecutablePath.length > 0 && this.diffExecutableTemplate !== null) {
|
|
96
|
+
try {
|
|
97
|
+
const command = this.diffExecutableTemplate
|
|
98
|
+
.replace("$exec", this.diffExecutablePath)
|
|
99
|
+
.replace("$file1", localPath)
|
|
100
|
+
.replace("$file2", remotePath);
|
|
101
|
+
(0, child_process_1.execSync)(command, { stdio: 'pipe' });
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
this.cli.code(error.stdout.toString());
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
let isWindows = process.platform.startsWith('win');
|
|
109
|
+
let ideaCommandAvailable;
|
|
110
|
+
try {
|
|
111
|
+
(0, child_process_1.execSync)(`idea diff "${localPath}" "${remotePath}"`);
|
|
112
|
+
ideaCommandAvailable = true;
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
ideaCommandAvailable = false;
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
if (!ideaCommandAvailable) {
|
|
119
|
+
if (isWindows) {
|
|
120
|
+
(0, child_process_1.execSync)(`"%IDEA_INITIAL_DIRECTORY%\\idea" diff ${localPath} ${remotePath}`, { stdio: 'pipe' });
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
(0, child_process_1.execSync)(`"$IDEA_INITIAL_DIRECTORY/idea" diff ${localPath} ${remotePath}`, { stdio: 'pipe' });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
this.cli.writeError(`Error executing diff command: ${error.message}`);
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.DiffService = DiffService;
|
|
@@ -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("./diff-service"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./diff-service-factory"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./diff-model"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CliService } from './cli';
|
|
2
|
+
export declare class DiffService {
|
|
3
|
+
private cli;
|
|
4
|
+
private tempPath;
|
|
5
|
+
constructor(cli: CliService);
|
|
6
|
+
/**
|
|
7
|
+
* Returns a temporal directory path.
|
|
8
|
+
*/
|
|
9
|
+
getTemporalDirectoryPath(): Promise<string>;
|
|
10
|
+
writeContentToTemporalFile(tempFileName: string, content: string): Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* @description removes whitespaces, newlines and compares both params content for equality.
|
|
13
|
+
* @param content
|
|
14
|
+
*/
|
|
15
|
+
trimContent(content: any): string;
|
|
16
|
+
/**
|
|
17
|
+
* @param content1
|
|
18
|
+
* @param content2
|
|
19
|
+
* @return returns true if both contents are equal otherwise returns false.
|
|
20
|
+
*/
|
|
21
|
+
isContentEqual(content1?: string, content2?: string): boolean;
|
|
22
|
+
shouldDeployModule(moduleName: string, remoteModule: string, localFilePath: string): Promise<boolean>;
|
|
23
|
+
executeDiff(filePath1: string, filePath2: string, hide?: boolean): Promise<boolean>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DiffService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs/promises"));
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
+
const file_helper_1 = require("../helpers/file-helper");
|
|
9
|
+
class DiffService {
|
|
10
|
+
cli;
|
|
11
|
+
tempPath = null;
|
|
12
|
+
constructor(cli) {
|
|
13
|
+
this.cli = cli;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns a temporal directory path.
|
|
17
|
+
*/
|
|
18
|
+
async getTemporalDirectoryPath() {
|
|
19
|
+
// create temporal directory for remote installationFiles so the diff can be generated
|
|
20
|
+
if (!this.tempPath) {
|
|
21
|
+
this.tempPath = await (0, file_helper_1.createTemporalDir)();
|
|
22
|
+
}
|
|
23
|
+
if (!this.tempPath) {
|
|
24
|
+
this.cli.writeError('No temporary Directory found and unable to create a new temporary Directory');
|
|
25
|
+
this.cli.exit(1);
|
|
26
|
+
}
|
|
27
|
+
return this.tempPath;
|
|
28
|
+
}
|
|
29
|
+
async writeContentToTemporalFile(tempFileName, content) {
|
|
30
|
+
if (!content) {
|
|
31
|
+
content = 'No file was found';
|
|
32
|
+
}
|
|
33
|
+
const resolveFilePath = path_1.default.join(await this.getTemporalDirectoryPath() + `/${tempFileName}`);
|
|
34
|
+
await fs.writeFile(resolveFilePath, content.replace(/\r?\n/gm, '\n'));
|
|
35
|
+
return resolveFilePath;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @description removes whitespaces, newlines and compares both params content for equality.
|
|
39
|
+
* @param content
|
|
40
|
+
*/
|
|
41
|
+
trimContent(content) {
|
|
42
|
+
return content.replace(/[\n\r\s]/g, '');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @param content1
|
|
46
|
+
* @param content2
|
|
47
|
+
* @return returns true if both contents are equal otherwise returns false.
|
|
48
|
+
*/
|
|
49
|
+
isContentEqual(content1 = '', content2 = '') {
|
|
50
|
+
return this.trimContent(content1) === this.trimContent(content2);
|
|
51
|
+
}
|
|
52
|
+
async shouldDeployModule(moduleName, remoteModule, localFilePath) {
|
|
53
|
+
const remoteModulePath = await this.writeContentToTemporalFile(moduleName, remoteModule);
|
|
54
|
+
// Starts diff and do not show user input prompt if there were no changes found
|
|
55
|
+
const hasChanges = await this.executeDiff(localFilePath, remoteModulePath);
|
|
56
|
+
if (!hasChanges) {
|
|
57
|
+
this.cli.writeWarning(`Skipped ${moduleName} because it has no changes or was not present locally`);
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return await this.cli.confirm(`Update ${moduleName}?`);
|
|
61
|
+
}
|
|
62
|
+
async executeDiff(filePath1, filePath2, hide = false) {
|
|
63
|
+
let content1;
|
|
64
|
+
let content2;
|
|
65
|
+
try {
|
|
66
|
+
content1 = await fs.readFile(filePath1, { encoding: 'utf8', flag: 'r' });
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
this.cli.writeError(`Error reading ${path_1.default.basename(filePath1)}: ${error.message}`);
|
|
70
|
+
this.cli.exit(1);
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
content2 = await fs.readFile(filePath2, { encoding: 'utf8', flag: 'r' });
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
this.cli.writeError(`Error reading ${path_1.default.basename(filePath2)}: ${error.message}`);
|
|
77
|
+
this.cli.exit(1);
|
|
78
|
+
}
|
|
79
|
+
// Returning if no difference
|
|
80
|
+
if (this.isContentEqual(content1, content2)) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
else if (hide) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
let isWindows = process.platform.startsWith('win');
|
|
87
|
+
let ideaCommandAvailable;
|
|
88
|
+
try {
|
|
89
|
+
(0, child_process_1.execSync)(`idea diff "${filePath1}" "${filePath2}"`, { stdio: 'pipe' });
|
|
90
|
+
ideaCommandAvailable = true;
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
ideaCommandAvailable = false;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
if (!ideaCommandAvailable) {
|
|
97
|
+
if (isWindows) {
|
|
98
|
+
(0, child_process_1.execSync)(`"%IDEA_INITIAL_DIRECTORY%\\idea" diff ${filePath1} ${filePath2}`, { stdio: 'pipe' });
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
(0, child_process_1.execSync)(`"$IDEA_INITIAL_DIRECTORY/idea" diff ${filePath1} ${filePath2}`, { stdio: 'pipe' });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
this.cli.writeError(`Error executing diff command: ${error.message}`);
|
|
107
|
+
this.cli.exit(1);
|
|
108
|
+
}
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.DiffService = DiffService;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const CUSTOMER_CONFIG = "config_customer";
|
|
2
|
+
export declare const LOCAL_DOCUMENT_HANDLER = "custom_documentHandler";
|
|
3
|
+
export declare const LOCAL_DOCUMENT_HANDLER_CONFIG = "config_documentHandler";
|
|
4
|
+
export declare const LOCAL_DYNAMIC_FETCHER = "custom_dynamicFetcher";
|
|
5
|
+
export declare const LOCAL_DYNAMIC_FETCHER_CONFIG = "config_dynamicBlocks";
|
|
6
|
+
export declare const LOCAL_STYLES = "config_dynamicStyles";
|
|
7
|
+
export declare const LATEST_DOCUMENT_HANDLER_URL = "https://www.baqend.com/speed-kit-handler/latest/DocumentHandler.js";
|
|
8
|
+
export declare const LATEST_DYNAMIC_FETCHER_URL = "https://www.baqend.com/speed-kit/latest/dynamic-fetcher.js";
|
|
9
|
+
export declare const TEST_DOCUMENT_HANDLER_FILE_NAME = "testDocumentHandler";
|
|
10
|
+
export declare const TEST_DATABASE_MOCK_FILE_NAME = "database-mock";
|
|
11
|
+
export declare const TEST_ORESTES_MOCK_FILE_NAME = "orestes-mock";
|
|
12
|
+
export declare const TEST_FILE_NAME_PREFIX = "document";
|
|
13
|
+
export declare const TEST_RUNTIME_FILE_NAME = "runtime";
|
|
14
|
+
export declare const TEST_PACKAGE_JSON = "package";
|
|
15
|
+
export default class DocumentHandlerRuntimeContext {
|
|
16
|
+
readonly verboseLevel: boolean;
|
|
17
|
+
readonly fileDependencies: string[];
|
|
18
|
+
readonly customerPath: string;
|
|
19
|
+
readonly configName: string;
|
|
20
|
+
readonly testNames: string[] | [];
|
|
21
|
+
readonly requiredFiles: string[];
|
|
22
|
+
constructor(customerPath: string, configName: string, testNames?: string[], verboseLevel?: boolean);
|
|
23
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEST_PACKAGE_JSON = exports.TEST_RUNTIME_FILE_NAME = exports.TEST_FILE_NAME_PREFIX = exports.TEST_ORESTES_MOCK_FILE_NAME = exports.TEST_DATABASE_MOCK_FILE_NAME = exports.TEST_DOCUMENT_HANDLER_FILE_NAME = exports.LATEST_DYNAMIC_FETCHER_URL = exports.LATEST_DOCUMENT_HANDLER_URL = exports.LOCAL_STYLES = exports.LOCAL_DYNAMIC_FETCHER_CONFIG = exports.LOCAL_DYNAMIC_FETCHER = exports.LOCAL_DOCUMENT_HANDLER_CONFIG = exports.LOCAL_DOCUMENT_HANDLER = exports.CUSTOMER_CONFIG = void 0;
|
|
4
|
+
exports.CUSTOMER_CONFIG = 'config_customer';
|
|
5
|
+
exports.LOCAL_DOCUMENT_HANDLER = 'custom_documentHandler';
|
|
6
|
+
exports.LOCAL_DOCUMENT_HANDLER_CONFIG = 'config_documentHandler';
|
|
7
|
+
exports.LOCAL_DYNAMIC_FETCHER = 'custom_dynamicFetcher';
|
|
8
|
+
exports.LOCAL_DYNAMIC_FETCHER_CONFIG = 'config_dynamicBlocks';
|
|
9
|
+
exports.LOCAL_STYLES = 'config_dynamicStyles';
|
|
10
|
+
exports.LATEST_DOCUMENT_HANDLER_URL = 'https://www.baqend.com/speed-kit-handler/latest/DocumentHandler.js';
|
|
11
|
+
exports.LATEST_DYNAMIC_FETCHER_URL = 'https://www.baqend.com/speed-kit/latest/dynamic-fetcher.js';
|
|
12
|
+
exports.TEST_DOCUMENT_HANDLER_FILE_NAME = 'testDocumentHandler';
|
|
13
|
+
exports.TEST_DATABASE_MOCK_FILE_NAME = 'database-mock';
|
|
14
|
+
exports.TEST_ORESTES_MOCK_FILE_NAME = 'orestes-mock';
|
|
15
|
+
exports.TEST_FILE_NAME_PREFIX = 'document';
|
|
16
|
+
exports.TEST_RUNTIME_FILE_NAME = 'runtime';
|
|
17
|
+
exports.TEST_PACKAGE_JSON = 'package';
|
|
18
|
+
const FILE_DEPENDENCIES = [exports.LOCAL_DOCUMENT_HANDLER_CONFIG, exports.LOCAL_DYNAMIC_FETCHER_CONFIG, exports.LOCAL_STYLES, exports.TEST_DATABASE_MOCK_FILE_NAME, exports.TEST_ORESTES_MOCK_FILE_NAME, exports.TEST_DOCUMENT_HANDLER_FILE_NAME, exports.TEST_PACKAGE_JSON, exports.TEST_RUNTIME_FILE_NAME];
|
|
19
|
+
class DocumentHandlerRuntimeContext {
|
|
20
|
+
verboseLevel;
|
|
21
|
+
fileDependencies = FILE_DEPENDENCIES.concat([exports.LOCAL_DOCUMENT_HANDLER, exports.LOCAL_DYNAMIC_FETCHER]);
|
|
22
|
+
customerPath;
|
|
23
|
+
configName;
|
|
24
|
+
testNames;
|
|
25
|
+
requiredFiles;
|
|
26
|
+
constructor(customerPath, configName, testNames, verboseLevel = false) {
|
|
27
|
+
this.verboseLevel = verboseLevel;
|
|
28
|
+
this.configName = configName;
|
|
29
|
+
this.customerPath = customerPath;
|
|
30
|
+
this.testNames = testNames;
|
|
31
|
+
let dependencies = [];
|
|
32
|
+
if (this.testNames && this.testNames.length >= 1) {
|
|
33
|
+
this.testNames.forEach((testName) => {
|
|
34
|
+
dependencies = dependencies.concat([`${exports.TEST_FILE_NAME_PREFIX}-${testName}`]);
|
|
35
|
+
});
|
|
36
|
+
this.fileDependencies = this.fileDependencies.concat(dependencies);
|
|
37
|
+
}
|
|
38
|
+
this.requiredFiles = [exports.CUSTOMER_CONFIG, exports.LOCAL_DOCUMENT_HANDLER_CONFIG, exports.LOCAL_DYNAMIC_FETCHER_CONFIG, exports.LOCAL_STYLES];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.default = DocumentHandlerRuntimeContext;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import CustomerConfig from "../integration-api/struct/customer-config";
|
|
2
|
+
import DocumentHandlerRuntimeConfigInterface from "./interface/document-handler-runtime-config-interface";
|
|
3
|
+
import { CliService } from "../cli";
|
|
4
|
+
import { FileListInterface } from "../integration-api/integration-api-model";
|
|
5
|
+
export default class DocumentHandlerRuntimeService {
|
|
6
|
+
private files;
|
|
7
|
+
private readonly customerConfig;
|
|
8
|
+
protected cli: CliService;
|
|
9
|
+
config?: DocumentHandlerRuntimeConfigInterface;
|
|
10
|
+
constructor(files: FileListInterface, customerConfig: CustomerConfig, cli: CliService, config?: DocumentHandlerRuntimeConfigInterface, preHook?: string, postHook?: string);
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
private outputInstructionMessage;
|
|
13
|
+
private createDocumentHandlerFile;
|
|
14
|
+
private createDataBaseMockFile;
|
|
15
|
+
private createTestCases;
|
|
16
|
+
private createTestCase;
|
|
17
|
+
private createLocalRuntime;
|
|
18
|
+
private createOrestesMockFile;
|
|
19
|
+
private createPackageJson;
|
|
20
|
+
private getDocumentHandler;
|
|
21
|
+
private getDynamicFetcher;
|
|
22
|
+
private getDynamicFetcherConfig;
|
|
23
|
+
private getStyles;
|
|
24
|
+
private getDocumentHandlerConfig;
|
|
25
|
+
private getTestDocHandlerFile;
|
|
26
|
+
private escapeFileContent;
|
|
27
|
+
private escapeFileContent2;
|
|
28
|
+
private getContextVars;
|
|
29
|
+
private getConfigTransformSearchTemplate;
|
|
30
|
+
private getConfigTransformReplaceTemplate;
|
|
31
|
+
private getSeparator;
|
|
32
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const document_handler_runtime_context_1 = require("./context/document-handler-runtime-context");
|
|
5
|
+
const database_mock_1 = tslib_1.__importDefault(require("./templates/database-mock"));
|
|
6
|
+
const test_1 = tslib_1.__importDefault(require("./templates/test"));
|
|
7
|
+
const orestes_mock_1 = tslib_1.__importDefault(require("./templates/orestes-mock"));
|
|
8
|
+
const package_json_1 = tslib_1.__importDefault(require("./templates/package-json"));
|
|
9
|
+
const execute_document_handler_1 = tslib_1.__importDefault(require("./templates/execute-document-handler"));
|
|
10
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
11
|
+
const required_file_not_found_error_1 = tslib_1.__importDefault(require("./error/required-file-not-found-error"));
|
|
12
|
+
class DocumentHandlerRuntimeService {
|
|
13
|
+
files;
|
|
14
|
+
customerConfig;
|
|
15
|
+
cli;
|
|
16
|
+
config;
|
|
17
|
+
constructor(files, customerConfig, cli, config, preHook, postHook) {
|
|
18
|
+
this.files = files;
|
|
19
|
+
this.customerConfig = customerConfig;
|
|
20
|
+
this.cli = cli;
|
|
21
|
+
this.config = config;
|
|
22
|
+
}
|
|
23
|
+
async run() {
|
|
24
|
+
await this.createDocumentHandlerFile();
|
|
25
|
+
await this.createLocalRuntime();
|
|
26
|
+
await this.createOrestesMockFile();
|
|
27
|
+
await this.createPackageJson();
|
|
28
|
+
if (this.config) {
|
|
29
|
+
await this.createDataBaseMockFile();
|
|
30
|
+
await this.createTestCases(this.config.testNames);
|
|
31
|
+
}
|
|
32
|
+
this.outputInstructionMessage();
|
|
33
|
+
}
|
|
34
|
+
outputInstructionMessage() {
|
|
35
|
+
this.cli.spacer();
|
|
36
|
+
this.cli.writeSuccess('check files in: ./.local/test/');
|
|
37
|
+
this.cli.spacer();
|
|
38
|
+
if (this.config) {
|
|
39
|
+
this.cli.writeWarning('### generated testCases:');
|
|
40
|
+
this.cli.write('to run testCases either open testFile in ./.local/test/ and use intelliJ to run currentFile');
|
|
41
|
+
this.cli.write('or switch to folder `cd ./.local/test/` and run `node ./.local/test/TEST_CASE.js`');
|
|
42
|
+
this.cli.spacer();
|
|
43
|
+
}
|
|
44
|
+
this.cli.writeWarning('### usage of runtime.js:');
|
|
45
|
+
this.cli.write('open file `./.local/src/runtime.js` customize your testCases as needed');
|
|
46
|
+
this.cli.write('f.e.: add more testCases, change the variation or set a custom header');
|
|
47
|
+
this.cli.code(`
|
|
48
|
+
// defaultTestCase
|
|
49
|
+
const files = [
|
|
50
|
+
{
|
|
51
|
+
url: 'https://www.testDomain.com',
|
|
52
|
+
file: 'test',
|
|
53
|
+
variation: 'DEFAULT',
|
|
54
|
+
headers: JSON.stringify(DEFAULT_HEADERS),
|
|
55
|
+
},
|
|
56
|
+
]`);
|
|
57
|
+
this.cli.spacer();
|
|
58
|
+
this.cli.write('run current file with intellij or run node ./.local/src/runtime.js');
|
|
59
|
+
this.cli.write('the runtime will now loop your given files, download them, and write the output to');
|
|
60
|
+
this.cli.write('./.local/$FILE$ITERATION$VARIATION_processed.html');
|
|
61
|
+
this.cli.spacer();
|
|
62
|
+
this.cli.writeWarning('### usage of debugger with runtime.js:');
|
|
63
|
+
this.cli.write('Its also possible to set breakpoints in the generated file: ./.local/src/testDocumentHandler.js');
|
|
64
|
+
this.cli.write('1. set breakpoints as you wish');
|
|
65
|
+
this.cli.write('2. open file ./.local/src/runtime.js');
|
|
66
|
+
this.cli.write('3. debug current file with intellij');
|
|
67
|
+
}
|
|
68
|
+
async createDocumentHandlerFile() {
|
|
69
|
+
const docHandler = await this.getDocumentHandler();
|
|
70
|
+
const docHandlerConfig = this.getDocumentHandlerConfig()
|
|
71
|
+
.replace('APP', this.escapeFileContent(this.customerConfig.app))
|
|
72
|
+
.replace('DYNAMIC_FETCHER', await this.getDynamicFetcher())
|
|
73
|
+
.replace('DYNAMIC_FETCHER_CONFIG', this.getDynamicFetcherConfig())
|
|
74
|
+
.replace('CUSTOM_STYLES', this.getStyles())
|
|
75
|
+
.replace(this.getConfigTransformSearchTemplate(), this.getConfigTransformReplaceTemplate());
|
|
76
|
+
const file = this.getTestDocHandlerFile();
|
|
77
|
+
const isNew = file.getContent().length < 1;
|
|
78
|
+
file.setContent(`${this.getSeparator('Context')} ${this.getContextVars()} ${docHandler} ${this.getSeparator('start config_documentHandler')} ${docHandlerConfig}`);
|
|
79
|
+
await file.updateFile();
|
|
80
|
+
this.cli.writeSuccess(`${isNew ? 'created' : 'updated'} documentHandler from config`);
|
|
81
|
+
}
|
|
82
|
+
async createDataBaseMockFile() {
|
|
83
|
+
const file = this.files.getByName(document_handler_runtime_context_1.TEST_DATABASE_MOCK_FILE_NAME);
|
|
84
|
+
if (file.getContent().length > 0) {
|
|
85
|
+
const response = await this.cli.confirm(`override file ${document_handler_runtime_context_1.TEST_DATABASE_MOCK_FILE_NAME}.js?`, false);
|
|
86
|
+
if (!response) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const dataBaseMock = new database_mock_1.default();
|
|
91
|
+
file.setContent(dataBaseMock.render(dataBaseMock.buildContext(this.customerConfig.origins[0], this.customerConfig.app)));
|
|
92
|
+
await file.updateFile();
|
|
93
|
+
this.cli.writeSuccess('created db-mock file');
|
|
94
|
+
}
|
|
95
|
+
async createTestCases(names) {
|
|
96
|
+
names.map(async (name) => this.createTestCase(name));
|
|
97
|
+
}
|
|
98
|
+
async createTestCase(name) {
|
|
99
|
+
const file = this.files.getByName(`${document_handler_runtime_context_1.TEST_FILE_NAME_PREFIX}-${name}`);
|
|
100
|
+
const test = new test_1.default();
|
|
101
|
+
if (file.getContent().length > 0) {
|
|
102
|
+
const response = await this.cli.confirm(`override file ${document_handler_runtime_context_1.TEST_FILE_NAME_PREFIX}-${name}.js?`);
|
|
103
|
+
if (!response) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
file.setContent(test.render(test.buildContext(this.customerConfig.origins[0], name)));
|
|
108
|
+
await file.updateFile();
|
|
109
|
+
this.cli.writeSuccess(`created testCase file: ${document_handler_runtime_context_1.TEST_FILE_NAME_PREFIX}-${name}`);
|
|
110
|
+
}
|
|
111
|
+
async createLocalRuntime() {
|
|
112
|
+
const file = this.files.getByName(document_handler_runtime_context_1.TEST_RUNTIME_FILE_NAME);
|
|
113
|
+
const runtime = new execute_document_handler_1.default();
|
|
114
|
+
if (file.getContent().length > 0) {
|
|
115
|
+
const response = await this.cli.confirm(`override file ${document_handler_runtime_context_1.TEST_RUNTIME_FILE_NAME}.js?`, false);
|
|
116
|
+
if (!response) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
file.setContent(runtime.render(runtime.buildContext(this.customerConfig.origins[0], 'test')));
|
|
121
|
+
await file.updateFile();
|
|
122
|
+
this.cli.writeSuccess(`created runtime file: ${document_handler_runtime_context_1.TEST_RUNTIME_FILE_NAME}`);
|
|
123
|
+
}
|
|
124
|
+
async createOrestesMockFile() {
|
|
125
|
+
const file = this.files.getByName(document_handler_runtime_context_1.TEST_ORESTES_MOCK_FILE_NAME);
|
|
126
|
+
const orestesMock = new orestes_mock_1.default();
|
|
127
|
+
if (file.getContent().length > 0) {
|
|
128
|
+
const response = await this.cli.confirm(`override file ${document_handler_runtime_context_1.TEST_ORESTES_MOCK_FILE_NAME}.js?`, false);
|
|
129
|
+
if (!response) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
file.setContent(orestesMock.render(orestesMock.buildContext()));
|
|
134
|
+
await file.updateFile();
|
|
135
|
+
}
|
|
136
|
+
async createPackageJson() {
|
|
137
|
+
if (!this.customerConfig.dependencies) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const file = this.files.getByName(`${document_handler_runtime_context_1.TEST_PACKAGE_JSON}`);
|
|
141
|
+
if (file.getContent().length > 0) {
|
|
142
|
+
const shouldUpdateFile = await this.cli.confirm(`override file ${document_handler_runtime_context_1.TEST_PACKAGE_JSON}.json?`, false);
|
|
143
|
+
if (!shouldUpdateFile) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const packageJson = new package_json_1.default();
|
|
148
|
+
const context = packageJson.buildContext(this.customerConfig.dependencies);
|
|
149
|
+
file.setContent(packageJson.render(context));
|
|
150
|
+
await file.updateFile();
|
|
151
|
+
this.cli.writeSuccess(`created testCase file: ${document_handler_runtime_context_1.TEST_PACKAGE_JSON}.json`);
|
|
152
|
+
}
|
|
153
|
+
async getDocumentHandler() {
|
|
154
|
+
if (!this.files.hasFile(document_handler_runtime_context_1.LOCAL_DOCUMENT_HANDLER)) {
|
|
155
|
+
const response = await (0, node_fetch_1.default)(document_handler_runtime_context_1.LATEST_DOCUMENT_HANDLER_URL);
|
|
156
|
+
return await response.text();
|
|
157
|
+
}
|
|
158
|
+
return this.files.getByName(document_handler_runtime_context_1.LOCAL_DOCUMENT_HANDLER).getContent();
|
|
159
|
+
}
|
|
160
|
+
async getDynamicFetcher() {
|
|
161
|
+
if (!this.files.hasFile(document_handler_runtime_context_1.LOCAL_DYNAMIC_FETCHER)) {
|
|
162
|
+
const response = await (0, node_fetch_1.default)(document_handler_runtime_context_1.LATEST_DYNAMIC_FETCHER_URL);
|
|
163
|
+
return this.escapeFileContent2(await response.text());
|
|
164
|
+
}
|
|
165
|
+
return this.escapeFileContent(this.files.getByName(document_handler_runtime_context_1.LOCAL_DYNAMIC_FETCHER).getContent());
|
|
166
|
+
}
|
|
167
|
+
getDynamicFetcherConfig() {
|
|
168
|
+
return this.escapeFileContent(this.files.getByName(document_handler_runtime_context_1.LOCAL_DYNAMIC_FETCHER_CONFIG).getContent());
|
|
169
|
+
}
|
|
170
|
+
getStyles() {
|
|
171
|
+
return this.escapeFileContent(this.files.getByName(document_handler_runtime_context_1.LOCAL_STYLES).getContent());
|
|
172
|
+
}
|
|
173
|
+
getDocumentHandlerConfig() {
|
|
174
|
+
const docHandlerFile = this.files.getByName(document_handler_runtime_context_1.LOCAL_DOCUMENT_HANDLER_CONFIG);
|
|
175
|
+
if (!docHandlerFile) {
|
|
176
|
+
throw new required_file_not_found_error_1.default({ message: `file ${document_handler_runtime_context_1.LOCAL_DOCUMENT_HANDLER_CONFIG} not found` });
|
|
177
|
+
}
|
|
178
|
+
return docHandlerFile.getContent();
|
|
179
|
+
}
|
|
180
|
+
getTestDocHandlerFile() {
|
|
181
|
+
return this.files.getByName(document_handler_runtime_context_1.TEST_DOCUMENT_HANDLER_FILE_NAME);
|
|
182
|
+
}
|
|
183
|
+
escapeFileContent(content) {
|
|
184
|
+
const escapedContent = content
|
|
185
|
+
.replace(/\$\{/g, "\\${")
|
|
186
|
+
.replace(/`/g, "\\`");
|
|
187
|
+
return `\`${escapedContent}\``;
|
|
188
|
+
}
|
|
189
|
+
escapeFileContent2(content) {
|
|
190
|
+
const escapedContent = content
|
|
191
|
+
.replace(/'/g, "\\'");
|
|
192
|
+
return `'${escapedContent}'`;
|
|
193
|
+
}
|
|
194
|
+
getContextVars() {
|
|
195
|
+
let template = '';
|
|
196
|
+
for (let key in this.customerConfig) {
|
|
197
|
+
template += `var ${key.toUpperCase()} = '${this.customerConfig[key]}';\n`;
|
|
198
|
+
}
|
|
199
|
+
return template;
|
|
200
|
+
}
|
|
201
|
+
getConfigTransformSearchTemplate() {
|
|
202
|
+
return /export.const.post(?:.|\n)*?documentHandler\.transform(?:.|\n)*?}/;
|
|
203
|
+
}
|
|
204
|
+
getConfigTransformReplaceTemplate() {
|
|
205
|
+
return this.getSeparator('end config_documentHandler') + `\n \n
|
|
206
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
207
|
+
module.exports = documentHandler
|
|
208
|
+
`;
|
|
209
|
+
}
|
|
210
|
+
getSeparator(headline = '') {
|
|
211
|
+
return `
|
|
212
|
+
/*
|
|
213
|
+
* ====================================================================
|
|
214
|
+
* ${headline}
|
|
215
|
+
* ====================================================================
|
|
216
|
+
*/
|
|
217
|
+
`;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
exports.default = DocumentHandlerRuntimeService;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import CustomerConfig from "../integration-api/struct/customer-config";
|
|
2
|
+
import { BundleService } from "../bundler";
|
|
3
|
+
import { CliService } from "../cli";
|
|
4
|
+
import { FileListInterface } from "../integration-api/integration-api-model";
|
|
5
|
+
export declare class DocumentHandlerServer {
|
|
6
|
+
private customerConfig;
|
|
7
|
+
private files;
|
|
8
|
+
private bundler;
|
|
9
|
+
private cli;
|
|
10
|
+
private verboseLevel;
|
|
11
|
+
private documentHandlerCode;
|
|
12
|
+
private database;
|
|
13
|
+
constructor(customerConfig: CustomerConfig, files: FileListInterface, bundler: BundleService, cli: CliService, verboseLevel?: boolean);
|
|
14
|
+
transform(html: string, variation: string, url: string, headers: {
|
|
15
|
+
[name: string]: string;
|
|
16
|
+
}): Promise<string>;
|
|
17
|
+
private getTransformFunctionWrapper;
|
|
18
|
+
buildDocumentHandler(): Promise<void>;
|
|
19
|
+
private createDocumentHandlerFile;
|
|
20
|
+
private getDocumentHandler;
|
|
21
|
+
private getDynamicFetcher;
|
|
22
|
+
private getDynamicFetcherConfig;
|
|
23
|
+
private getStyles;
|
|
24
|
+
private getDocumentHandlerConfig;
|
|
25
|
+
private getContextVars;
|
|
26
|
+
private createDataBaseMock;
|
|
27
|
+
private createNodeVmContext;
|
|
28
|
+
private createRequireMock;
|
|
29
|
+
private createProcessPartial;
|
|
30
|
+
/**
|
|
31
|
+
* Fetches and returns the latest dynamic fetcher from the code repository. If a new version is available online it is
|
|
32
|
+
* downloaded and cached, otherwise the fetcher id returned from cache. The resulting module gets minified afterwards.
|
|
33
|
+
*
|
|
34
|
+
* @param {Map<string, string>} basePaths tha path mapping to resolve imports from
|
|
35
|
+
* @param {string} dynamicFetcher the dynamic fetcher to bundle the config with
|
|
36
|
+
*
|
|
37
|
+
* @returns {Promise<string>} a Promise which resolves to the latest dynamic fetcher
|
|
38
|
+
*/
|
|
39
|
+
bundleDynamicFetcher(basePaths: {
|
|
40
|
+
[k: string]: string;
|
|
41
|
+
}, dynamicFetcher: string): Promise<string>;
|
|
42
|
+
}
|