@speedkit/cli 2.25.0 → 2.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/dist/models/files.d.ts +4 -0
  4. package/dist/models/files.js +4 -0
  5. package/dist/services/cli/error/cli-type-error.d.ts +1 -2
  6. package/dist/services/cli/error/cli-type-error.js +1 -3
  7. package/dist/services/config-api/context/config-api-context.d.ts +1 -2
  8. package/dist/services/config-api/factory/config-api-service-factory.js +1 -2
  9. package/dist/services/config-api/interface/config-api-context-interface.d.ts +1 -2
  10. package/dist/services/customer-config/templates/deploymentDetection.es6.hbs +44 -3
  11. package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +1 -1
  12. package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +1 -2
  13. package/dist/services/deploy/deploy-service-factory.js +3 -4
  14. package/dist/services/deploy/deploy-service.d.ts +3 -2
  15. package/dist/services/deploy/deploy-service.js +23 -1
  16. package/dist/services/deploy/handler/customer-config-handler.d.ts +4 -5
  17. package/dist/services/deploy/handler/customer-config-handler.js +2 -2
  18. package/dist/services/deploy/handler/install-resource-handler.d.ts +3 -4
  19. package/dist/services/deploy/handler/install-resource-handler.js +2 -3
  20. package/dist/services/deploy/handler/module-handler.d.ts +8 -5
  21. package/dist/services/deploy/handler/module-handler.js +2 -3
  22. package/dist/services/deploy/handler/server-config-handler.d.ts +9 -6
  23. package/dist/services/deploy/handler/server-config-handler.js +6 -4
  24. package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +2 -3
  25. package/dist/services/document-handler-runtime/document-handler-runtime-service.js +2 -6
  26. package/dist/services/document-handler-runtime/document-handler-server.d.ts +1 -2
  27. package/dist/services/document-handler-runtime/document-handler-server.js +2 -5
  28. package/dist/services/document-handler-runtime/error/required-file-not-found-error.d.ts +1 -2
  29. package/dist/services/document-handler-runtime/error/required-file-not-found-error.js +1 -3
  30. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -6
  31. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +9 -18
  32. package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +1 -2
  33. package/dist/services/integration-api/error/customer-config-legacy-error.js +1 -3
  34. package/dist/services/integration-api/error/handler/customer-config-legacy-handler.d.ts +1 -2
  35. package/dist/services/integration-api/error/handler/customer-config-legacy-handler.js +1 -1
  36. package/dist/services/integration-api/error/handler/origin-handler.d.ts +1 -2
  37. package/dist/services/integration-api/error/handler/origin-handler.js +1 -1
  38. package/dist/services/integration-api/error/origin-error.d.ts +1 -2
  39. package/dist/services/integration-api/error/origin-error.js +1 -3
  40. package/dist/services/integration-api/file-list.d.ts +3 -5
  41. package/dist/services/integration-api/file-list.js +6 -10
  42. package/dist/services/integration-api/file-reader.d.ts +14 -6
  43. package/dist/services/integration-api/file-reader.js +8 -8
  44. package/dist/services/integration-api/file-writer.d.ts +10 -2
  45. package/dist/services/integration-api/file-writer.js +9 -6
  46. package/dist/services/integration-api/handler/customer-config-handler.js +6 -8
  47. package/dist/services/integration-api/handler/install-resource-handler.js +3 -4
  48. package/dist/services/integration-api/handler/module-handler.js +2 -2
  49. package/dist/services/integration-api/handler/server-config-handler.js +2 -2
  50. package/dist/services/integration-api/index.d.ts +3 -0
  51. package/dist/services/integration-api/index.js +6 -0
  52. package/dist/services/integration-api/integration-api-factory.d.ts +13 -0
  53. package/dist/services/integration-api/integration-api-factory.js +50 -0
  54. package/dist/services/integration-api/integration-api-model.d.ts +33 -14
  55. package/dist/services/integration-api/integration-api-model.js +37 -0
  56. package/dist/services/integration-api/integration-api-service.d.ts +1 -2
  57. package/dist/services/integration-api/integration-api-service.js +3 -23
  58. package/dist/services/integration-api/spec/customer-config-validator.spec.d.ts +1 -0
  59. package/dist/services/integration-api/spec/customer-config-validator.spec.js +50 -0
  60. package/dist/services/integration-api/spec/file-list.spec.d.ts +1 -0
  61. package/dist/services/integration-api/spec/file-list.spec.js +163 -0
  62. package/dist/services/integration-api/spec/file-reader.spec.d.ts +1 -0
  63. package/dist/services/integration-api/spec/file-reader.spec.js +71 -0
  64. package/dist/services/integration-api/spec/file-writer.spec.d.ts +1 -0
  65. package/dist/services/integration-api/spec/file-writer.spec.js +55 -0
  66. package/dist/services/integration-api/spec/integration-api-service.spec.d.ts +1 -0
  67. package/dist/services/integration-api/spec/integration-api-service.spec.js +122 -0
  68. package/dist/services/integration-api/spec/mandatory-files-validator.spec.d.ts +1 -0
  69. package/dist/services/integration-api/spec/mandatory-files-validator.spec.js +105 -0
  70. package/dist/services/integration-api/struct/customer-config-file.d.ts +3 -4
  71. package/dist/services/integration-api/struct/customer-config-file.js +7 -6
  72. package/dist/services/integration-api/struct/customer-config.d.ts +3 -5
  73. package/dist/services/integration-api/struct/customer-config.js +5 -8
  74. package/dist/services/integration-api/struct/file.d.ts +4 -4
  75. package/dist/services/integration-api/struct/file.js +6 -6
  76. package/dist/services/integration-api/struct/install-resource-file.d.ts +4 -3
  77. package/dist/services/integration-api/struct/install-resource-file.js +7 -5
  78. package/dist/services/integration-api/struct/module-file.d.ts +4 -3
  79. package/dist/services/integration-api/struct/module-file.js +7 -5
  80. package/dist/services/integration-api/struct/ro-file.d.ts +2 -2
  81. package/dist/services/integration-api/struct/ro-file.js +1 -1
  82. package/dist/services/integration-api/struct/server-config-file.d.ts +5 -4
  83. package/dist/services/integration-api/struct/server-config-file.js +7 -5
  84. package/dist/services/integration-api/struct/virtual-file.d.ts +2 -2
  85. package/dist/services/integration-api/struct/virtual-file.js +2 -1
  86. package/dist/services/integration-api/validator/customer-config-validator.d.ts +5 -1
  87. package/dist/services/integration-api/validator/customer-config-validator.js +28 -17
  88. package/dist/services/integration-api/virtual/static-recipe.d.ts +6 -0
  89. package/dist/services/integration-api/virtual/static-recipe.js +14 -0
  90. package/dist/services/integration-api/virtual/virtual-file-handler.js +2 -2
  91. package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +1 -2
  92. package/dist/services/onboarding/dashboard/index.d.ts +1 -1
  93. package/dist/services/onboarding/dashboard/parameter-query-builder.d.ts +1 -2
  94. package/dist/services/onboarding/fetch-event-handler.d.ts +1 -1
  95. package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +1 -2
  96. package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +1 -1
  97. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +1 -1
  98. package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +1 -1
  99. package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +1 -2
  100. package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +1 -1
  101. package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +1 -2
  102. package/dist/services/onboarding/file-events/file-watcher.d.ts +1 -2
  103. package/dist/services/onboarding/file-events/file-watcher.js +3 -3
  104. package/dist/services/onboarding/onboarding-service-factory.js +9 -13
  105. package/dist/services/onboarding/onboarding-service.d.ts +1 -1
  106. package/dist/services/onboarding/todo-collector.js +2 -2
  107. package/dist/services/pull/pull-service-factory.js +3 -4
  108. package/dist/services/pull/pull-service.d.ts +1 -1
  109. package/dist/services/pull/pull-service.js +2 -3
  110. package/oclif.manifest.json +1 -1
  111. package/package.json +5 -5
  112. package/dist/services/context/error/context-runtime-error.d.ts +0 -3
  113. package/dist/services/context/error/context-runtime-error.js +0 -7
  114. package/dist/services/context/interface/context-interface.d.ts +0 -2
  115. package/dist/services/context/interface/context-interface.js +0 -2
  116. package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.d.ts +0 -6
  117. package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.js +0 -14
  118. package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.d.ts +0 -6
  119. package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.js +0 -19
  120. package/dist/services/error-handling/abstract/abstract-async-error-handling-service.d.ts +0 -6
  121. package/dist/services/error-handling/abstract/abstract-async-error-handling-service.js +0 -18
  122. package/dist/services/error-handling/abstract/abstract-error-handling-factory.d.ts +0 -6
  123. package/dist/services/error-handling/abstract/abstract-error-handling-factory.js +0 -19
  124. package/dist/services/error-handling/abstract/abstract-error-handling-service.d.ts +0 -6
  125. package/dist/services/error-handling/abstract/abstract-error-handling-service.js +0 -19
  126. package/dist/services/error-handling/error/application-error.d.ts +0 -5
  127. package/dist/services/error-handling/error/application-error.js +0 -11
  128. package/dist/services/error-handling/error-handling-service.d.ts +0 -7
  129. package/dist/services/error-handling/error-handling-service.js +0 -27
  130. package/dist/services/error-handling/factory/error-handling-factory.d.ts +0 -5
  131. package/dist/services/error-handling/factory/error-handling-factory.js +0 -22
  132. package/dist/services/error-handling/interface/error-context-interface.d.ts +0 -6
  133. package/dist/services/error-handling/interface/error-context-interface.js +0 -2
  134. package/dist/services/error-handling/interface/error-handler-interface.d.ts +0 -5
  135. package/dist/services/error-handling/interface/error-handler-interface.js +0 -2
  136. package/dist/services/error-handling/interface/error-handling-factory-interface.d.ts +0 -8
  137. package/dist/services/error-handling/interface/error-handling-factory-interface.js +0 -2
  138. package/dist/services/error-handling/interface/error-handling-service-interface.d.ts +0 -8
  139. package/dist/services/error-handling/interface/error-handling-service-interface.js +0 -2
  140. package/dist/services/integration-api/context/integration-api-context.d.ts +0 -9
  141. package/dist/services/integration-api/context/integration-api-context.js +0 -20
  142. package/dist/services/integration-api/error/handler/customer-config-handler.d.ts +0 -5
  143. package/dist/services/integration-api/error/handler/customer-config-handler.js +0 -19
  144. package/dist/services/integration-api/factory/integration-api-service-factory.d.ts +0 -13
  145. package/dist/services/integration-api/factory/integration-api-service-factory.js +0 -55
@@ -1,6 +1,5 @@
1
1
  import Protocol from "devtools-protocol";
2
- import { FileInterface } from "../../integration-api/integration-api-model";
3
- import CustomerConfig from "../../integration-api/struct/customer-config";
2
+ import { CustomerConfig, FileInterface } from "../../integration-api";
4
3
  import { FetchRequestPausedEventHandler } from "../onboarding-model";
5
4
  /**
6
5
  * SpeedKitServiceWorkerJs class is responsible for handling fetch requests for the SpeedKit service worker.
@@ -1,9 +1,8 @@
1
1
  import { CliService } from "../../cli";
2
2
  import { Page } from "puppeteer";
3
- import CustomerConfig from "../../integration-api/struct/customer-config";
4
3
  import { DocumentHandlerServer } from "../../document-handler-runtime/document-handler-server";
5
4
  import { Cache } from "../request-cache/cache";
6
- import { ConfigFileInterface, FileListInterface } from "../../integration-api/integration-api-model";
5
+ import { ConfigFileInterface, CustomerConfig, FileListInterface } from "../../integration-api";
7
6
  import { BrowserContext } from "../onboarding-model";
8
7
  /**
9
8
  * Add different callbacks that will be executed if a local file is changed.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FileWatcher = void 0;
4
4
  const safe_1 = require("../../../helpers/safe");
5
- const virtual_file_1 = require("../../integration-api/struct/virtual-file");
5
+ const integration_api_1 = require("../../integration-api");
6
6
  const files_1 = require("../../../models/files");
7
7
  /**
8
8
  * Add different callbacks that will be executed if a local file is changed.
@@ -41,7 +41,7 @@ class FileWatcher {
41
41
  continue;
42
42
  }
43
43
  const file = this.files.getByName(dependency);
44
- if (file.type === virtual_file_1.VirtualFile) {
44
+ if (file.type === integration_api_1.FILE_TYPE.VIRTUAL_FILE) {
45
45
  continue;
46
46
  }
47
47
  file.onChange(async (file) => {
@@ -65,7 +65,7 @@ class FileWatcher {
65
65
  continue;
66
66
  }
67
67
  const file = this.files.getByName(configFile);
68
- if (file.type === virtual_file_1.VirtualFile) {
68
+ if (file.type === integration_api_1.FILE_TYPE.VIRTUAL_FILE) {
69
69
  continue;
70
70
  }
71
71
  file.onChange(async (file) => {
@@ -11,11 +11,6 @@ const config_api_context_1 = tslib_1.__importDefault(require("../config-api/cont
11
11
  const config_api_service_factory_1 = tslib_1.__importDefault(require("../config-api/factory/config-api-service-factory"));
12
12
  const diff_1 = require("../diff");
13
13
  const document_handler_runtime_service_factory_1 = tslib_1.__importDefault(require("../document-handler-runtime/factory/document-handler-runtime-service-factory"));
14
- const integration_api_context_1 = tslib_1.__importDefault(require("../integration-api/context/integration-api-context"));
15
- const external_file_reader_1 = require("../integration-api/external/external-file-reader");
16
- const integration_api_service_factory_1 = tslib_1.__importDefault(require("../integration-api/factory/integration-api-service-factory"));
17
- const virtual_file_1 = require("../integration-api/struct/virtual-file");
18
- const external_recipe_1 = require("../integration-api/virtual/external-recipe");
19
14
  const install_file_recipe_1 = require("./config-renderer/install-file-recipe");
20
15
  const speed_kit_install_context_1 = require("./config-renderer/speed-kit-install-context");
21
16
  const dashboard_1 = require("./dashboard");
@@ -37,6 +32,7 @@ const cache_1 = require("./request-cache/cache");
37
32
  const install_speed_kit_html_template_1 = require("./templates/install-speed-kit-html-template");
38
33
  const install_speed_kit_js_template_1 = require("./templates/install-speed-kit-js-template");
39
34
  const todo_collector_1 = require("./todo-collector");
35
+ const integration_api_1 = require("../integration-api");
40
36
  class OnboardingServiceFactory {
41
37
  context;
42
38
  cliConfig;
@@ -70,7 +66,7 @@ class OnboardingServiceFactory {
70
66
  }
71
67
  async buildInstallResource(speedKitInstallContext, files, cli) {
72
68
  cli.startAction("build file install_resource");
73
- const installResourceFile = new virtual_file_1.VirtualFile(files_1.INTEGRATION_FILES.BUILD.INSTALL, new install_file_recipe_1.InstallFileRecipe(speedKitInstallContext));
69
+ const installResourceFile = new integration_api_1.VirtualFile(files_1.INTEGRATION_FILES.BUILD.INSTALL, new install_file_recipe_1.InstallFileRecipe(speedKitInstallContext));
74
70
  const result = await (0, safe_1.safe)(installResourceFile.buildContent());
75
71
  if (result.success === true) {
76
72
  files.addFile(installResourceFile);
@@ -119,25 +115,25 @@ class OnboardingServiceFactory {
119
115
  return new fetch_event_handler_1.FetchEventHandler(handlers, customerConfig, cli, configApi);
120
116
  }
121
117
  async getIntegrationFiles() {
122
- const integrationApiContext = new integration_api_context_1.default(this.context.customerPath, this.context.configName, []);
123
- const integrationApi = new integration_api_service_factory_1.default(integrationApiContext, this.cliConfig).buildService();
124
- const externalFileReader = new external_file_reader_1.ExternalFileReader();
118
+ const integrationApiContext = new integration_api_1.IntegrationApiContext(this.context.customerPath, this.context.configName, []);
119
+ const integrationApi = new integration_api_1.IntegrationApiFactory(integrationApiContext, this.cliConfig).buildService();
120
+ const externalFileReader = new integration_api_1.ExternalFileReader();
125
121
  return integrationApi.run([
126
122
  {
127
123
  name: files_1.INTEGRATION_FILES.CUSTOM.SW,
128
- recipe: new external_recipe_1.ExternalRecipe(this.context.DEFAULT_SW_PATH, externalFileReader),
124
+ recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_SW_PATH, externalFileReader),
129
125
  },
130
126
  {
131
127
  name: files_1.INTEGRATION_FILES.CUSTOM.DYNAMIC_FETCHER,
132
- recipe: new external_recipe_1.ExternalRecipe(this.context.DEFAULT_DF_PATH, externalFileReader),
128
+ recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_DF_PATH, externalFileReader),
133
129
  },
134
130
  {
135
131
  name: files_1.INTEGRATION_FILES.CUSTOM.LOADER,
136
- recipe: new external_recipe_1.ExternalRecipe(this.context.DEFAULT_SNIPPET_PATH, externalFileReader),
132
+ recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_SNIPPET_PATH, externalFileReader),
137
133
  },
138
134
  {
139
135
  name: files_1.INTEGRATION_FILES.CUSTOM.DOCUMENT_HANDLER,
140
- recipe: new external_recipe_1.ExternalRecipe(this.context.DEFAULT_DOCUMENT_HANDLER_PATH, externalFileReader),
136
+ recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_DOCUMENT_HANDLER_PATH, externalFileReader),
141
137
  },
142
138
  ]);
143
139
  }
@@ -1,4 +1,4 @@
1
- import CustomerConfig from "../integration-api/struct/customer-config";
1
+ import { CustomerConfig } from "../integration-api";
2
2
  import { BrowserContext } from "./onboarding-model";
3
3
  import { FetchEventHandler } from "./fetch-event-handler";
4
4
  import { FileWatcher } from "./file-events/file-watcher";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TodoCollector = void 0;
4
- const virtual_file_1 = require("../integration-api/struct/virtual-file");
4
+ const integration_api_model_1 = require("../integration-api/integration-api-model");
5
5
  const TODO_MATCH = /(todo[^\n\r()|]*)((?:(?:\r\n|\r|\n)[^\n\r()|]*){3})/i;
6
6
  /**
7
7
  * Represents a TodoCollector class that collects open tasks from files.
@@ -14,7 +14,7 @@ class TodoCollector {
14
14
  }
15
15
  getOpenTasks() {
16
16
  const configFiles = this.files.filter((file) => {
17
- return !(file.type instanceof virtual_file_1.VirtualFile);
17
+ return !(file.type === integration_api_model_1.FILE_TYPE.VIRTUAL_FILE);
18
18
  });
19
19
  const tasks = [];
20
20
  for (const configFile of configFiles) {
@@ -2,8 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PullServiceFactory = void 0;
4
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"));
5
+ const integration_api_1 = require("../integration-api");
7
6
  const config_api_service_factory_1 = tslib_1.__importDefault(require("../config-api/factory/config-api-service-factory"));
8
7
  const config_api_context_1 = tslib_1.__importDefault(require("../config-api/context/config-api-context"));
9
8
  const cli_1 = require("../cli");
@@ -32,8 +31,8 @@ class PullServiceFactory {
32
31
  this.service = new _1.PullService(files, cliService, configApi, configName, this.context.customerPath);
33
32
  }
34
33
  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();
34
+ const integrationApiContext = new integration_api_1.IntegrationApiContext(this.context.customerPath, this.context.configName, []);
35
+ const integrationApi = new integration_api_1.IntegrationApiFactory(integrationApiContext, this.userConfig).buildService();
37
36
  return await integrationApi.run();
38
37
  }
39
38
  getConfigApi(app) {
@@ -1,5 +1,5 @@
1
1
  import { CliServiceInterface } from "../cli";
2
- import { FileListInterface } from "../integration-api/integration-api-model";
2
+ import { FileListInterface } from "../integration-api";
3
3
  import ConfigApiService from "../config-api/config-api-service";
4
4
  export declare class PullService {
5
5
  private fileList;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PullService = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const cli_1 = require("../cli");
6
- const install_resource_file_1 = tslib_1.__importDefault(require("../integration-api/struct/install-resource-file"));
5
+ const integration_api_1 = require("../integration-api");
7
6
  const _1 = require("./");
8
7
  const safe_1 = require("../../helpers/safe");
9
8
  const node_child_process_1 = require("node:child_process");
@@ -87,7 +86,7 @@ class PullService {
87
86
  return this.fileList.getByName(fileName);
88
87
  }
89
88
  async createFile(fileName, extension, content, key) {
90
- const resourceFile = new install_resource_file_1.default(fileName, `${this.basePath}/${fileName}.${extension}`, content, key);
89
+ const resourceFile = new integration_api_1.InstallResourceFile(fileName, `${this.basePath}/${fileName}.${extension}`, content, key);
91
90
  this.fileList.addFile(resourceFile);
92
91
  await resourceFile.updateFile();
93
92
  }
@@ -667,5 +667,5 @@
667
667
  ]
668
668
  }
669
669
  },
670
- "version": "2.25.0"
670
+ "version": "2.27.0"
671
671
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "2.25.0",
4
+ "version": "2.27.0",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"
@@ -26,7 +26,7 @@
26
26
  "build:dashboard": "copyfiles -u 1 src/services/onboarding/dashboard/frontend-dist/**/*.html dist && copyfiles -u 1 src/services/onboarding/dashboard/frontend-dist/**/*.js dist && copyfiles -u 1 src/services/onboarding/dashboard/frontend-dist/**/*.css dist",
27
27
  "postbuild": "oclif manifest && oclif readme",
28
28
  "prepack": "npm run build",
29
- "test": "mocha --reporter mocha-junit-reporter --reporter-options mochaFile=junit.xml",
29
+ "test": "mocha --config ./.mocharc.cjs --reporter mocha-junit-reporter --reporter-options mochaFile=junit.xml",
30
30
  "coverage": "nyc mocha",
31
31
  "coverage:report": "nyc --reporter cobertura mocha"
32
32
  },
@@ -83,6 +83,7 @@
83
83
  "domhandler": "5.0.3",
84
84
  "domutils": "^3.1",
85
85
  "dotenv": "^16.4",
86
+ "esbuild": "^0.20",
86
87
  "extract-zip": "^2.0.1",
87
88
  "fs-extra": "^10.1.0",
88
89
  "handlebars": "^4.7",
@@ -96,8 +97,7 @@
96
97
  "puppeteer-extra": "^3.3",
97
98
  "puppeteer-extra-plugin-user-preferences": "^2.4",
98
99
  "strip-comments": "^2.0.1",
99
- "uuid": "^8.3.2",
100
- "esbuild": "^0.20"
100
+ "uuid": "^8.3.2"
101
101
  },
102
102
  "devDependencies": {
103
103
  "@commitlint/cli": "^17.7.1",
@@ -121,9 +121,9 @@
121
121
  "globby": "^11",
122
122
  "husky": "^8.0.3",
123
123
  "lint-staged": "^14.0.1",
124
+ "memfs": "^4.8.0",
124
125
  "mocha": "^10.1.0",
125
126
  "mocha-junit-reporter": "^2.2.1",
126
- "mock-fs": "^5.2.0",
127
127
  "nock": "^13.5",
128
128
  "nyc": "^15.1.0",
129
129
  "oclif": "^4.5",
@@ -1,3 +0,0 @@
1
- import ApplicationError from "../../error-handling/error/application-error";
2
- export default class ContextRuntimeError extends ApplicationError {
3
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
5
- class ContextRuntimeError extends application_error_1.default {
6
- }
7
- exports.default = ContextRuntimeError;
@@ -1,2 +0,0 @@
1
- export default interface ContextInterface {
2
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- import ErrorHandlerInterface from "../../../error-handling/interface/error-handler-interface";
2
- import RequiredFileNotFoundError from "../required-file-not-found-error";
3
- export default class RequiredFileNotFoundHandler implements ErrorHandlerInterface {
4
- canHandle(error: any): boolean;
5
- handle(error: RequiredFileNotFoundError): any;
6
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const required_file_not_found_error_1 = tslib_1.__importDefault(require("../required-file-not-found-error"));
5
- class RequiredFileNotFoundHandler {
6
- canHandle(error) {
7
- return error instanceof required_file_not_found_error_1.default;
8
- }
9
- handle(error) {
10
- console.error(error.message);
11
- console.warn("Did you choose the correct folder?");
12
- }
13
- }
14
- exports.default = RequiredFileNotFoundHandler;
@@ -1,6 +0,0 @@
1
- import { AsyncErrorHandlingFactory } from "../interface/error-handling-factory-interface";
2
- export default abstract class AbstractAsyncErrorHandlingFactory implements AsyncErrorHandlingFactory {
3
- buildService(): Promise<any>;
4
- abstract _buildService(): Promise<any>;
5
- private getErrorHandler;
6
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const error_handling_factory_1 = tslib_1.__importDefault(require("../factory/error-handling-factory"));
5
- class AbstractAsyncErrorHandlingFactory {
6
- async buildService() {
7
- const errorHandler = this.getErrorHandler();
8
- try {
9
- return await this._buildService();
10
- }
11
- catch (error) {
12
- errorHandler.handle(error);
13
- }
14
- }
15
- getErrorHandler() {
16
- return new error_handling_factory_1.default().buildService();
17
- }
18
- }
19
- exports.default = AbstractAsyncErrorHandlingFactory;
@@ -1,6 +0,0 @@
1
- import { ErrorHandlingServiceInterface } from "../interface/error-handling-service-interface";
2
- export default abstract class AbstractAsyncErrorHandlingService implements ErrorHandlingServiceInterface {
3
- run(): Promise<any>;
4
- abstract _run(): Promise<any>;
5
- private getErrorHandler;
6
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const error_handling_factory_1 = tslib_1.__importDefault(require("../factory/error-handling-factory"));
5
- class AbstractAsyncErrorHandlingService {
6
- async run() {
7
- try {
8
- return await this._run();
9
- }
10
- catch (error) {
11
- this.getErrorHandler().handle(error);
12
- }
13
- }
14
- getErrorHandler() {
15
- return new error_handling_factory_1.default().buildService();
16
- }
17
- }
18
- exports.default = AbstractAsyncErrorHandlingService;
@@ -1,6 +0,0 @@
1
- import { ErrorHandlingFactoryInterface } from "../interface/error-handling-factory-interface";
2
- export default abstract class AbstractErrorHandlingFactory implements ErrorHandlingFactoryInterface {
3
- buildService(): any;
4
- abstract _buildService(): any;
5
- private getErrorHandler;
6
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const error_handling_factory_1 = tslib_1.__importDefault(require("../factory/error-handling-factory"));
5
- class AbstractErrorHandlingFactory {
6
- buildService() {
7
- const errorHandler = this.getErrorHandler();
8
- try {
9
- return this._buildService();
10
- }
11
- catch (error) {
12
- errorHandler.handle(error);
13
- }
14
- }
15
- getErrorHandler() {
16
- return new error_handling_factory_1.default().buildService();
17
- }
18
- }
19
- exports.default = AbstractErrorHandlingFactory;
@@ -1,6 +0,0 @@
1
- import { ErrorHandlingServiceInterface } from "../interface/error-handling-service-interface";
2
- export default abstract class AbstractErrorHandlingService implements ErrorHandlingServiceInterface {
3
- run(): any;
4
- abstract _run(): any;
5
- private getErrorHandler;
6
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const error_handling_factory_1 = tslib_1.__importDefault(require("../factory/error-handling-factory"));
5
- class AbstractErrorHandlingService {
6
- run() {
7
- const errorHandler = this.getErrorHandler();
8
- try {
9
- return this._run();
10
- }
11
- catch (error) {
12
- errorHandler.handle(error);
13
- }
14
- }
15
- getErrorHandler() {
16
- return new error_handling_factory_1.default().buildService();
17
- }
18
- }
19
- exports.default = AbstractErrorHandlingService;
@@ -1,5 +0,0 @@
1
- import ErrorContextInterface from "../interface/error-context-interface";
2
- export default class ApplicationError extends Error {
3
- readonly context: ErrorContextInterface;
4
- constructor(context?: ErrorContextInterface);
5
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class ApplicationError extends Error {
4
- context;
5
- constructor(context = {}) {
6
- const { message } = context;
7
- super(message);
8
- this.context = context;
9
- }
10
- }
11
- exports.default = ApplicationError;
@@ -1,7 +0,0 @@
1
- import ErrorHandlerInterface from "./interface/error-handler-interface";
2
- import ApplicationError from "./error/application-error";
3
- export default class ErrorHandlingService {
4
- handlers: ErrorHandlerInterface[];
5
- constructor(handlers: ErrorHandlerInterface[]);
6
- handle(error: ApplicationError | any): void;
7
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
4
- class ErrorHandlingService {
5
- handlers;
6
- constructor(handlers) {
7
- this.handlers = handlers;
8
- }
9
- handle(error) {
10
- core_1.ux.log(` ===========================`);
11
- core_1.ux.log(` === An error appeared =====`);
12
- core_1.ux.log(` ===========================\n`);
13
- for (let iterator = 0; iterator < this.handlers.length; iterator++) {
14
- const handler = this.handlers[iterator];
15
- if (handler.canHandle(error)) {
16
- handler.handle(error);
17
- core_1.ux.exit(1);
18
- return;
19
- }
20
- }
21
- core_1.ux.warn("unhandled error:");
22
- core_1.ux.info(`type of error: ${typeof error}`);
23
- core_1.ux.log(error);
24
- core_1.ux.exit(1);
25
- }
26
- }
27
- exports.default = ErrorHandlingService;
@@ -1,5 +0,0 @@
1
- import ErrorHandlingService from "../error-handling-service";
2
- export default class ErrorHandlingFactory {
3
- buildService(): ErrorHandlingService;
4
- importHandlers(): import("../interface/error-handler-interface").default[];
5
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const error_handling_service_1 = tslib_1.__importDefault(require("../error-handling-service"));
5
- const customer_config_legacy_handler_1 = tslib_1.__importDefault(require("../../integration-api/error/handler/customer-config-legacy-handler"));
6
- const origin_handler_1 = tslib_1.__importDefault(require("../../integration-api/error/handler/origin-handler"));
7
- const document_handler_runtime_service_factory_1 = tslib_1.__importDefault(require("../../document-handler-runtime/factory/document-handler-runtime-service-factory"));
8
- const customer_config_handler_1 = require("../../integration-api/error/handler/customer-config-handler");
9
- class ErrorHandlingFactory {
10
- buildService() {
11
- return new error_handling_service_1.default(this.importHandlers());
12
- }
13
- importHandlers() {
14
- return [
15
- new customer_config_legacy_handler_1.default(),
16
- new origin_handler_1.default(),
17
- new customer_config_handler_1.CustomerConfigHandler(),
18
- ...document_handler_runtime_service_factory_1.default.getErrorHandlers(),
19
- ];
20
- }
21
- }
22
- exports.default = ErrorHandlingFactory;
@@ -1,6 +0,0 @@
1
- export default interface ErrorContextInterface {
2
- app?: string;
3
- configName?: string;
4
- path?: string;
5
- message?: string;
6
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- import ApplicationError from "../error/application-error";
2
- export default interface ErrorHandlerInterface {
3
- canHandle(error: Error | ApplicationError | any): boolean;
4
- handle(error: Error | ApplicationError | any): any;
5
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- export interface ErrorHandlingFactoryInterface {
2
- buildService(): any;
3
- _buildService(): any;
4
- }
5
- export interface AsyncErrorHandlingFactory {
6
- buildService(): Promise<any>;
7
- _buildService(): Promise<any>;
8
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- export interface ErrorHandlingServiceInterface {
2
- run(): any;
3
- _run(): any;
4
- }
5
- export interface AsyncErrorHandlingService {
6
- run(): Promise<any>;
7
- _run(): Promise<any>;
8
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
1
- import { IntegrationApiContextInterface } from "../integration-api-model";
2
- export declare const DEFAULT_BLOCKED_FOLDERS: string[];
3
- export default class IntegrationApiContext implements IntegrationApiContextInterface {
4
- readonly basePath: string;
5
- readonly configName: string;
6
- readonly whiteList: string[];
7
- readonly blockedFolders: string[];
8
- constructor(basePath: string, configName: string, whitelist: string[], blockedFolders?: string[]);
9
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_BLOCKED_FOLDERS = void 0;
4
- const tslib_1 = require("tslib");
5
- const dotenv = tslib_1.__importStar(require("dotenv"));
6
- dotenv.config();
7
- exports.DEFAULT_BLOCKED_FOLDERS = ["test", ".local", ".git", ".idea"];
8
- class IntegrationApiContext {
9
- basePath;
10
- configName;
11
- whiteList;
12
- blockedFolders;
13
- constructor(basePath, configName, whitelist, blockedFolders) {
14
- this.basePath = basePath;
15
- this.configName = configName;
16
- this.whiteList = whitelist;
17
- this.blockedFolders = blockedFolders || exports.DEFAULT_BLOCKED_FOLDERS;
18
- }
19
- }
20
- exports.default = IntegrationApiContext;
@@ -1,5 +0,0 @@
1
- import ErrorHandlerInterface from "../../../error-handling/interface/error-handler-interface";
2
- export declare class CustomerConfigHandler implements ErrorHandlerInterface {
3
- canHandle(error: any): boolean;
4
- handle(error: any): any;
5
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CustomerConfigHandler = void 0;
4
- const tslib_1 = require("tslib");
5
- const customer_config_error_1 = tslib_1.__importDefault(require("../customer-config-error"));
6
- const core_1 = require("@oclif/core");
7
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
8
- class CustomerConfigHandler {
9
- canHandle(error) {
10
- return error instanceof customer_config_error_1.default;
11
- }
12
- handle(error) {
13
- core_1.ux.log();
14
- core_1.ux.log(chalk_1.default.red(error.message));
15
- core_1.ux.log();
16
- core_1.ux.exit(1);
17
- }
18
- }
19
- exports.CustomerConfigHandler = CustomerConfigHandler;
@@ -1,13 +0,0 @@
1
- import IntegrationApiService from "../integration-api-service";
2
- import { IntegrationApiContextInterface } from "../integration-api-model";
3
- import { UserCliConfig } from "../../../helpers/cli-config";
4
- export default class IntegrationApiServiceFactory {
5
- private context;
6
- private cliConfig;
7
- service?: IntegrationApiService;
8
- private fileReader?;
9
- constructor(context: IntegrationApiContextInterface, cliConfig: UserCliConfig);
10
- buildService(): IntegrationApiService;
11
- private build;
12
- private getFileReader;
13
- }