@speedkit/cli 2.26.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 (144) hide show
  1. package/CHANGELOG.md +18 -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/deploy/checks/post-deploy/save-files-check.d.ts +1 -1
  11. package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +1 -2
  12. package/dist/services/deploy/deploy-service-factory.js +3 -4
  13. package/dist/services/deploy/deploy-service.d.ts +3 -2
  14. package/dist/services/deploy/deploy-service.js +23 -1
  15. package/dist/services/deploy/handler/customer-config-handler.d.ts +4 -5
  16. package/dist/services/deploy/handler/customer-config-handler.js +2 -2
  17. package/dist/services/deploy/handler/install-resource-handler.d.ts +3 -4
  18. package/dist/services/deploy/handler/install-resource-handler.js +2 -3
  19. package/dist/services/deploy/handler/module-handler.d.ts +8 -5
  20. package/dist/services/deploy/handler/module-handler.js +2 -3
  21. package/dist/services/deploy/handler/server-config-handler.d.ts +9 -6
  22. package/dist/services/deploy/handler/server-config-handler.js +6 -4
  23. package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +2 -3
  24. package/dist/services/document-handler-runtime/document-handler-runtime-service.js +2 -6
  25. package/dist/services/document-handler-runtime/document-handler-server.d.ts +1 -2
  26. package/dist/services/document-handler-runtime/document-handler-server.js +2 -5
  27. package/dist/services/document-handler-runtime/error/required-file-not-found-error.d.ts +1 -2
  28. package/dist/services/document-handler-runtime/error/required-file-not-found-error.js +1 -3
  29. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -6
  30. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +9 -18
  31. package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +1 -2
  32. package/dist/services/integration-api/error/customer-config-legacy-error.js +1 -3
  33. package/dist/services/integration-api/error/handler/customer-config-legacy-handler.d.ts +1 -2
  34. package/dist/services/integration-api/error/handler/customer-config-legacy-handler.js +1 -1
  35. package/dist/services/integration-api/error/handler/origin-handler.d.ts +1 -2
  36. package/dist/services/integration-api/error/handler/origin-handler.js +1 -1
  37. package/dist/services/integration-api/error/origin-error.d.ts +1 -2
  38. package/dist/services/integration-api/error/origin-error.js +1 -3
  39. package/dist/services/integration-api/file-list.d.ts +3 -5
  40. package/dist/services/integration-api/file-list.js +6 -10
  41. package/dist/services/integration-api/file-reader.d.ts +14 -6
  42. package/dist/services/integration-api/file-reader.js +8 -8
  43. package/dist/services/integration-api/file-writer.d.ts +10 -2
  44. package/dist/services/integration-api/file-writer.js +9 -6
  45. package/dist/services/integration-api/handler/customer-config-handler.js +6 -8
  46. package/dist/services/integration-api/handler/install-resource-handler.js +3 -4
  47. package/dist/services/integration-api/handler/module-handler.js +2 -2
  48. package/dist/services/integration-api/handler/server-config-handler.js +2 -2
  49. package/dist/services/integration-api/index.d.ts +3 -0
  50. package/dist/services/integration-api/index.js +6 -0
  51. package/dist/services/integration-api/integration-api-factory.d.ts +13 -0
  52. package/dist/services/integration-api/integration-api-factory.js +50 -0
  53. package/dist/services/integration-api/integration-api-model.d.ts +33 -14
  54. package/dist/services/integration-api/integration-api-model.js +37 -0
  55. package/dist/services/integration-api/integration-api-service.d.ts +1 -2
  56. package/dist/services/integration-api/integration-api-service.js +3 -23
  57. package/dist/services/integration-api/spec/customer-config-validator.spec.d.ts +1 -0
  58. package/dist/services/integration-api/spec/customer-config-validator.spec.js +50 -0
  59. package/dist/services/integration-api/spec/file-list.spec.d.ts +1 -0
  60. package/dist/services/integration-api/spec/file-list.spec.js +163 -0
  61. package/dist/services/integration-api/spec/file-reader.spec.d.ts +1 -0
  62. package/dist/services/integration-api/spec/file-reader.spec.js +71 -0
  63. package/dist/services/integration-api/spec/file-writer.spec.d.ts +1 -0
  64. package/dist/services/integration-api/spec/file-writer.spec.js +55 -0
  65. package/dist/services/integration-api/spec/integration-api-service.spec.d.ts +1 -0
  66. package/dist/services/integration-api/spec/integration-api-service.spec.js +122 -0
  67. package/dist/services/integration-api/spec/mandatory-files-validator.spec.d.ts +1 -0
  68. package/dist/services/integration-api/spec/mandatory-files-validator.spec.js +105 -0
  69. package/dist/services/integration-api/struct/customer-config-file.d.ts +3 -4
  70. package/dist/services/integration-api/struct/customer-config-file.js +7 -6
  71. package/dist/services/integration-api/struct/customer-config.d.ts +3 -5
  72. package/dist/services/integration-api/struct/customer-config.js +5 -8
  73. package/dist/services/integration-api/struct/file.d.ts +4 -4
  74. package/dist/services/integration-api/struct/file.js +6 -6
  75. package/dist/services/integration-api/struct/install-resource-file.d.ts +4 -3
  76. package/dist/services/integration-api/struct/install-resource-file.js +7 -5
  77. package/dist/services/integration-api/struct/module-file.d.ts +4 -3
  78. package/dist/services/integration-api/struct/module-file.js +7 -5
  79. package/dist/services/integration-api/struct/ro-file.d.ts +2 -2
  80. package/dist/services/integration-api/struct/ro-file.js +1 -1
  81. package/dist/services/integration-api/struct/server-config-file.d.ts +5 -4
  82. package/dist/services/integration-api/struct/server-config-file.js +7 -5
  83. package/dist/services/integration-api/struct/virtual-file.d.ts +2 -2
  84. package/dist/services/integration-api/struct/virtual-file.js +2 -1
  85. package/dist/services/integration-api/validator/customer-config-validator.d.ts +5 -1
  86. package/dist/services/integration-api/validator/customer-config-validator.js +28 -17
  87. package/dist/services/integration-api/virtual/static-recipe.d.ts +6 -0
  88. package/dist/services/integration-api/virtual/static-recipe.js +14 -0
  89. package/dist/services/integration-api/virtual/virtual-file-handler.js +2 -2
  90. package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +1 -2
  91. package/dist/services/onboarding/dashboard/index.d.ts +1 -1
  92. package/dist/services/onboarding/dashboard/parameter-query-builder.d.ts +1 -2
  93. package/dist/services/onboarding/fetch-event-handler.d.ts +1 -1
  94. package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +1 -2
  95. package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +1 -1
  96. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +1 -1
  97. package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +1 -1
  98. package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +1 -2
  99. package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +1 -1
  100. package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +1 -2
  101. package/dist/services/onboarding/file-events/file-watcher.d.ts +1 -2
  102. package/dist/services/onboarding/file-events/file-watcher.js +3 -3
  103. package/dist/services/onboarding/onboarding-service-factory.js +9 -13
  104. package/dist/services/onboarding/onboarding-service.d.ts +1 -1
  105. package/dist/services/onboarding/todo-collector.js +2 -2
  106. package/dist/services/pull/pull-service-factory.js +3 -4
  107. package/dist/services/pull/pull-service.d.ts +1 -1
  108. package/dist/services/pull/pull-service.js +2 -3
  109. package/oclif.manifest.json +1 -1
  110. package/package.json +5 -5
  111. package/dist/services/context/error/context-runtime-error.d.ts +0 -3
  112. package/dist/services/context/error/context-runtime-error.js +0 -7
  113. package/dist/services/context/interface/context-interface.d.ts +0 -2
  114. package/dist/services/context/interface/context-interface.js +0 -2
  115. package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.d.ts +0 -6
  116. package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.js +0 -14
  117. package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.d.ts +0 -6
  118. package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.js +0 -19
  119. package/dist/services/error-handling/abstract/abstract-async-error-handling-service.d.ts +0 -6
  120. package/dist/services/error-handling/abstract/abstract-async-error-handling-service.js +0 -18
  121. package/dist/services/error-handling/abstract/abstract-error-handling-factory.d.ts +0 -6
  122. package/dist/services/error-handling/abstract/abstract-error-handling-factory.js +0 -19
  123. package/dist/services/error-handling/abstract/abstract-error-handling-service.d.ts +0 -6
  124. package/dist/services/error-handling/abstract/abstract-error-handling-service.js +0 -19
  125. package/dist/services/error-handling/error/application-error.d.ts +0 -5
  126. package/dist/services/error-handling/error/application-error.js +0 -11
  127. package/dist/services/error-handling/error-handling-service.d.ts +0 -7
  128. package/dist/services/error-handling/error-handling-service.js +0 -27
  129. package/dist/services/error-handling/factory/error-handling-factory.d.ts +0 -5
  130. package/dist/services/error-handling/factory/error-handling-factory.js +0 -22
  131. package/dist/services/error-handling/interface/error-context-interface.d.ts +0 -6
  132. package/dist/services/error-handling/interface/error-context-interface.js +0 -2
  133. package/dist/services/error-handling/interface/error-handler-interface.d.ts +0 -5
  134. package/dist/services/error-handling/interface/error-handler-interface.js +0 -2
  135. package/dist/services/error-handling/interface/error-handling-factory-interface.d.ts +0 -8
  136. package/dist/services/error-handling/interface/error-handling-factory-interface.js +0 -2
  137. package/dist/services/error-handling/interface/error-handling-service-interface.d.ts +0 -8
  138. package/dist/services/error-handling/interface/error-handling-service-interface.js +0 -2
  139. package/dist/services/integration-api/context/integration-api-context.d.ts +0 -9
  140. package/dist/services/integration-api/context/integration-api-context.js +0 -20
  141. package/dist/services/integration-api/error/handler/customer-config-handler.d.ts +0 -5
  142. package/dist/services/integration-api/error/handler/customer-config-handler.js +0 -19
  143. package/dist/services/integration-api/factory/integration-api-service-factory.d.ts +0 -13
  144. package/dist/services/integration-api/factory/integration-api-service-factory.js +0 -55
@@ -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.26.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.26.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
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const context_runtime_error_1 = tslib_1.__importDefault(require("../../context/error/context-runtime-error"));
5
- const integration_api_service_1 = tslib_1.__importDefault(require("../integration-api-service"));
6
- const file_reader_1 = tslib_1.__importDefault(require("../file-reader"));
7
- const mandatory_files_validator_1 = tslib_1.__importDefault(require("../validator/mandatory-files-validator"));
8
- const customer_config_handler_1 = tslib_1.__importDefault(require("../handler/customer-config-handler"));
9
- const customer_config_validator_1 = tslib_1.__importDefault(require("../validator/customer-config-validator"));
10
- const install_resource_handler_1 = tslib_1.__importDefault(require("../handler/install-resource-handler"));
11
- const module_handler_1 = tslib_1.__importDefault(require("../handler/module-handler"));
12
- const server_config_handler_1 = tslib_1.__importDefault(require("../handler/server-config-handler"));
13
- const file_writer_1 = tslib_1.__importDefault(require("../file-writer"));
14
- const cli_1 = require("../../cli");
15
- const virtual_file_handler_1 = require("../virtual/virtual-file-handler");
16
- class IntegrationApiServiceFactory {
17
- context;
18
- cliConfig;
19
- service = undefined;
20
- fileReader;
21
- constructor(context, cliConfig) {
22
- this.context = context;
23
- this.cliConfig = cliConfig;
24
- }
25
- buildService() {
26
- if (!(this.service instanceof integration_api_service_1.default)) {
27
- this.build();
28
- }
29
- return this.service;
30
- }
31
- build() {
32
- if (!this.context.basePath) {
33
- throw new context_runtime_error_1.default({ message: "basePath is undefined" });
34
- }
35
- if (!this.context.configName) {
36
- throw new context_runtime_error_1.default({ message: "configName is undefined" });
37
- }
38
- const fileReader = this.getFileReader();
39
- const cli = new cli_1.CliServiceFactory().getService();
40
- const virtualFileHandler = new virtual_file_handler_1.VirtualFileHandler(cli);
41
- this.service = new integration_api_service_1.default(fileReader, virtualFileHandler, new mandatory_files_validator_1.default(), [
42
- new customer_config_handler_1.default(fileReader, cli, new customer_config_validator_1.default(), this.context.configName, this.cliConfig.testApp),
43
- new install_resource_handler_1.default(fileReader),
44
- new server_config_handler_1.default(fileReader),
45
- new module_handler_1.default(fileReader),
46
- ], new file_writer_1.default(this.context.basePath), this.context.whiteList.length === 0);
47
- }
48
- getFileReader() {
49
- if (!this.fileReader) {
50
- this.fileReader = new file_reader_1.default(this.context.configName, this.context.basePath, this.context.whiteList, this.context.blockedFolders);
51
- }
52
- return this.fileReader;
53
- }
54
- }
55
- exports.default = IntegrationApiServiceFactory;