@speedkit/cli 2.31.1 → 2.32.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 (94) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +1 -1
  3. package/dist/helpers/file-helper.d.ts +6 -0
  4. package/dist/helpers/file-helper.js +6 -0
  5. package/dist/helpers/race.d.ts +1 -1
  6. package/dist/helpers/race.js +8 -9
  7. package/dist/helpers/safe.js +2 -2
  8. package/dist/models/cli-parameters.js +4 -3
  9. package/dist/services/athena/athena-service.js +3 -2
  10. package/dist/services/athena/error/athena-query-error.d.ts +4 -0
  11. package/dist/services/athena/error/athena-query-error.js +9 -0
  12. package/dist/services/athena/error/fetch-credentials-error.d.ts +5 -1
  13. package/dist/services/athena/error/fetch-credentials-error.js +9 -1
  14. package/dist/services/bundler/bundle-service.js +5 -3
  15. package/dist/services/bundler/error/bundle-fetch-error.d.ts +3 -0
  16. package/dist/services/bundler/error/bundle-fetch-error.js +8 -0
  17. package/dist/services/bundler/error/bundle-resolve-error.d.ts +3 -0
  18. package/dist/services/bundler/error/bundle-resolve-error.js +8 -0
  19. package/dist/services/config-api/client.d.ts +1 -1
  20. package/dist/services/config-api/client.js +29 -7
  21. package/dist/services/config-api/error/json-response-error.d.ts +3 -1
  22. package/dist/services/config-api/error/json-response-error.js +4 -1
  23. package/dist/services/config-api/error/login-error.d.ts +3 -3
  24. package/dist/services/config-api/error/login-error.js +3 -4
  25. package/dist/services/config-api/factory/config-api-service-factory.js +2 -1
  26. package/dist/services/config-api-service.d.ts +3 -0
  27. package/dist/services/config-api-service.js +3 -0
  28. package/dist/services/customer-config/customer-config-service-model.d.ts +2 -0
  29. package/dist/services/customer-config/customer-config-service.js +10 -2
  30. package/dist/services/customer-config/templates/config_SpeedKit.js.hbs +35 -1
  31. package/dist/services/customer-config/templates/config_documentHandler.js.hbs +112 -112
  32. package/dist/services/customer-config/templates/config_dynamicBlocks.es6.hbs +290 -108
  33. package/dist/services/customer-config/templates/config_dynamicStyles.css.hbs +8 -8
  34. package/dist/services/customer-config/templates/config_loadHandler.js.hbs +61 -0
  35. package/dist/services/deploy/error/file-handler-error.d.ts +4 -0
  36. package/dist/services/deploy/error/file-handler-error.js +9 -0
  37. package/dist/services/diff-service.d.ts +3 -0
  38. package/dist/services/diff-service.js +3 -0
  39. package/dist/services/document-handler-runtime/document-handler-server.js +2 -4
  40. package/dist/services/error-handling/error/application-error.d.ts +18 -0
  41. package/dist/services/error-handling/error/application-error.js +28 -0
  42. package/dist/services/error-handling/error/config-file-error.d.ts +4 -0
  43. package/dist/services/error-handling/error/config-file-error.js +9 -0
  44. package/dist/services/error-handling/error/connection-error.d.ts +4 -0
  45. package/dist/services/error-handling/error/connection-error.js +9 -0
  46. package/dist/services/integration-api/error/customer-config-error.d.ts +2 -1
  47. package/dist/services/integration-api/error/customer-config-error.js +2 -1
  48. package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +3 -1
  49. package/dist/services/integration-api/error/customer-config-legacy-error.js +4 -1
  50. package/dist/services/integration-api/error/mandatory-file-missing-error.d.ts +3 -2
  51. package/dist/services/integration-api/error/mandatory-file-missing-error.js +4 -4
  52. package/dist/services/integration-api/error/origin-error.d.ts +2 -1
  53. package/dist/services/integration-api/error/origin-error.js +2 -1
  54. package/dist/services/integration-api/error/read-files-error.d.ts +5 -0
  55. package/dist/services/integration-api/error/read-files-error.js +10 -0
  56. package/dist/services/integration-api/external/external-file-reader.js +8 -2
  57. package/dist/services/integration-api/file-reader.js +12 -4
  58. package/dist/services/integration-api/handler/customer-config-handler.d.ts +1 -0
  59. package/dist/services/integration-api/handler/customer-config-handler.js +22 -5
  60. package/dist/services/integration-api/handler/install-resource-handler.js +2 -1
  61. package/dist/services/integration-api/integration-api-service.js +2 -1
  62. package/dist/services/integration-api/spec/mandatory-files-validator.spec.js +4 -3
  63. package/dist/services/integration-api/validator/customer-config-validator.js +1 -1
  64. package/dist/services/integration-api/validator/mandatory-files-validator.js +6 -2
  65. package/dist/services/onboarding/error/vm-error.d.ts +3 -1
  66. package/dist/services/onboarding/error/vm-error.js +4 -1
  67. package/dist/services/onboarding/fetch-event-handler.js +1 -1
  68. package/dist/services/onboarding/todo-collector.d.ts +1 -1
  69. package/dist/services/onboarding/todo-collector.js +2 -2
  70. package/dist/services/prewarm/csv-reader.js +1 -3
  71. package/dist/services/prewarm/error/invalid-origin-error.d.ts +2 -1
  72. package/dist/services/prewarm/error/invalid-origin-error.js +3 -1
  73. package/dist/services/prewarm/error/read-csv-error.d.ts +4 -5
  74. package/dist/services/prewarm/error/read-csv-error.js +5 -8
  75. package/oclif.manifest.json +7 -1
  76. package/package.json +1 -1
  77. package/dist/helpers/get-chrome-path.d.ts +0 -7
  78. package/dist/helpers/get-chrome-path.js +0 -31
  79. package/dist/helpers/is-executable.d.ts +0 -1
  80. package/dist/helpers/is-executable.js +0 -15
  81. package/dist/helpers/watch-files.d.ts +0 -1
  82. package/dist/helpers/watch-files.js +0 -20
  83. package/dist/services/deploy/error/create-find-temporary-directory-error.d.ts +0 -4
  84. package/dist/services/deploy/error/create-find-temporary-directory-error.js +0 -10
  85. package/dist/services/deploy/error/deploy-app-error.d.ts +0 -2
  86. package/dist/services/deploy/error/deploy-app-error.js +0 -5
  87. package/dist/services/deploy/error/no-active-installation-error.d.ts +0 -4
  88. package/dist/services/deploy/error/no-active-installation-error.js +0 -10
  89. package/dist/services/integration-api/error/handler/customer-config-legacy-handler.d.ts +0 -5
  90. package/dist/services/integration-api/error/handler/customer-config-legacy-handler.js +0 -24
  91. package/dist/services/integration-api/error/handler/origin-handler.d.ts +0 -5
  92. package/dist/services/integration-api/error/handler/origin-handler.js +0 -22
  93. package/dist/services/integration-api/error/load-customer-error.d.ts +0 -4
  94. package/dist/services/integration-api/error/load-customer-error.js +0 -10
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfigFileError = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const application_error_1 = tslib_1.__importDefault(require("./application-error"));
6
+ class ConfigFileError extends application_error_1.default {
7
+ code = "CONFIG_FILE_ERROR";
8
+ }
9
+ exports.ConfigFileError = ConfigFileError;
@@ -0,0 +1,4 @@
1
+ import ApplicationError from "../../error-handling/error/application-error";
2
+ export declare class ConnectionError extends ApplicationError {
3
+ readonly code = "CONNECTION_ERROR";
4
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectionError = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
6
+ class ConnectionError extends application_error_1.default {
7
+ code = "CONNECTION_ERROR";
8
+ }
9
+ exports.ConnectionError = ConnectionError;
@@ -1,2 +1,3 @@
1
- export default class CustomerConfigError extends Error {
1
+ import { ConfigFileError } from "../../error-handling/error/config-file-error";
2
+ export default class CustomerConfigError extends ConfigFileError {
2
3
  }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- class CustomerConfigError extends Error {
3
+ const config_file_error_1 = require("../../error-handling/error/config-file-error");
4
+ class CustomerConfigError extends config_file_error_1.ConfigFileError {
4
5
  }
5
6
  exports.default = CustomerConfigError;
@@ -1,2 +1,4 @@
1
- export default class CustomerConfigLegacyError extends Error {
1
+ import ApplicationError from "../../error-handling/error/application-error";
2
+ export default class CustomerConfigLegacyError extends ApplicationError {
3
+ readonly code = "INVALID_CONFIG_CUSTOMER";
2
4
  }
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- class CustomerConfigLegacyError extends Error {
3
+ const tslib_1 = require("tslib");
4
+ const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
5
+ class CustomerConfigLegacyError extends application_error_1.default {
6
+ code = "INVALID_CONFIG_CUSTOMER";
4
7
  }
5
8
  exports.default = CustomerConfigLegacyError;
@@ -1,3 +1,4 @@
1
- export default class MandatoryFileMissingError extends Error {
2
- constructor(fileName: string);
1
+ import ApplicationError from "../../error-handling/error/application-error";
2
+ export default class MandatoryFileMissingError extends ApplicationError {
3
+ readonly code = "MANDATORY_CONFIG_FILE_IS_MISSING";
3
4
  }
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- class MandatoryFileMissingError extends Error {
4
- constructor(fileName) {
5
- super(`Mandatory file "${fileName}" is missing`);
6
- }
3
+ const tslib_1 = require("tslib");
4
+ const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
5
+ class MandatoryFileMissingError extends application_error_1.default {
6
+ code = "MANDATORY_CONFIG_FILE_IS_MISSING";
7
7
  }
8
8
  exports.default = MandatoryFileMissingError;
@@ -1,2 +1,3 @@
1
- export default class OriginError extends Error {
1
+ import { ConfigFileError } from "../../error-handling/error/config-file-error";
2
+ export default class OriginError extends ConfigFileError {
2
3
  }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- class OriginError extends Error {
3
+ const config_file_error_1 = require("../../error-handling/error/config-file-error");
4
+ class OriginError extends config_file_error_1.ConfigFileError {
4
5
  }
5
6
  exports.default = OriginError;
@@ -0,0 +1,5 @@
1
+ import ApplicationError from "../../error-handling/error/application-error";
2
+ export declare class ReadFilesError extends ApplicationError {
3
+ readonly code = "READ_FILES_ERROR";
4
+ readonly suggestions: string[];
5
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReadFilesError = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
6
+ class ReadFilesError extends application_error_1.default {
7
+ code = "READ_FILES_ERROR";
8
+ suggestions = ["check if argument filePath is correct"];
9
+ }
10
+ exports.ReadFilesError = ReadFilesError;
@@ -4,11 +4,17 @@ exports.ExternalFileReader = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
6
6
  const ro_file_1 = require("../struct/ro-file");
7
+ const safe_1 = require("../../../helpers/safe");
8
+ const connection_error_1 = require("../../error-handling/error/connection-error");
7
9
  class ExternalFileReader {
8
10
  async load(assetName) {
9
- const response = await (0, node_fetch_1.default)(assetName);
11
+ const fetchResponse = await (0, safe_1.safe)((0, node_fetch_1.default)(assetName));
12
+ if (fetchResponse.success !== true) {
13
+ throw new connection_error_1.ConnectionError(`Unable to fetch file from ${assetName}`);
14
+ }
15
+ const response = fetchResponse.data;
10
16
  if (!response.ok) {
11
- throw new Error(`Could not retrieve asset "${assetName}". Server respond with ${response.status} ${response.statusText}`);
17
+ throw new connection_error_1.ConnectionError(`Could not retrieve asset "${assetName}". Server respond with ${response.status} ${response.statusText}`);
12
18
  }
13
19
  const [fileName] = assetName.split("/").pop().split(".");
14
20
  return new ro_file_1.RoFile(fileName, assetName, await response.text());
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const node_path_1 = tslib_1.__importDefault(require("node:path"));
5
- const CUSTOMER_CONFIG_FILE = "config_customer";
5
+ const safe_1 = require("../../helpers/safe");
6
+ const read_files_error_1 = require("./error/read-files-error");
7
+ const files_1 = require("../../models/files");
6
8
  const DEFAULT_ENV = "production";
7
9
  class FileReader {
8
10
  fileSystem;
@@ -20,9 +22,15 @@ class FileReader {
20
22
  }
21
23
  getFileList(basePath = this.basePath) {
22
24
  let files = [];
23
- const items = this.fileSystem.readdirSync(basePath, {
24
- withFileTypes: true,
25
+ const itemsResult = (0, safe_1.safe)(() => {
26
+ return this.fileSystem.readdirSync(basePath, {
27
+ withFileTypes: true,
28
+ });
25
29
  });
30
+ if (itemsResult.success !== true) {
31
+ throw new read_files_error_1.ReadFilesError(`can not read files in path "${this.basePath}"`);
32
+ }
33
+ const items = itemsResult.data;
26
34
  for (const item of items) {
27
35
  if (item.isDirectory()) {
28
36
  if (this.isAllowedFolder(item.name)) {
@@ -60,7 +68,7 @@ class FileReader {
60
68
  return true;
61
69
  }
62
70
  // customer_config is always whitelisted
63
- if (fileName.includes(CUSTOMER_CONFIG_FILE)) {
71
+ if (fileName.includes(files_1.INTEGRATION_FILES.CONFIG.CUSTOMER)) {
64
72
  return true;
65
73
  }
66
74
  return this.whiteList.some((entry) => {
@@ -13,4 +13,5 @@ export default class CustomerConfigHandler extends FileHandler {
13
13
  canHandle(filePath: string): boolean;
14
14
  handle(filePath: string): Promise<CustomerConfigInterface>;
15
15
  private loadConfig;
16
+ private createCustomerConfigFromSelected;
16
17
  }
@@ -7,6 +7,8 @@ const customer_config_legacy_error_1 = tslib_1.__importDefault(require("../error
7
7
  const customer_config_1 = require("../struct/customer-config");
8
8
  const customer_config_file_1 = require("../struct/customer-config-file");
9
9
  const file_handler_1 = tslib_1.__importDefault(require("./file-handler"));
10
+ const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
11
+ const safe_1 = require("../../../helpers/safe");
10
12
  class CustomerConfigHandler extends file_handler_1.default {
11
13
  cli;
12
14
  validator;
@@ -32,7 +34,7 @@ class CustomerConfigHandler extends file_handler_1.default {
32
34
  async loadConfig(fileContent, filePath) {
33
35
  if ((fileContent.includes("process.env.TEST_APP") && this.testApp === null) ||
34
36
  this.testApp.length === 0) {
35
- throw new customer_config_error_1.default("please specify env TEST_APP in your .env or configFile file");
37
+ throw new application_error_1.default("please specify env TEST_APP in your .env or configFile file");
36
38
  }
37
39
  const customerConfigContext = {
38
40
  module: { exports: {} }, // make TEST_APP available for vm
@@ -49,14 +51,29 @@ class CustomerConfigHandler extends file_handler_1.default {
49
51
  typeof configs === "string" ||
50
52
  "origins" in configs ||
51
53
  "name" in configs) {
52
- throw new customer_config_legacy_error_1.default(this.configName);
54
+ throw new customer_config_legacy_error_1.default(`Config "${this.configName}" not found`, [
55
+ `Check file ${filePath}`,
56
+ `module.exports must be an array of customerConfigObjects`,
57
+ ]);
53
58
  }
54
59
  if (this.configName in configs) {
55
- return customer_config_1.CustomerConfig.createFrom(configs[this.configName], this.configName);
60
+ return this.createCustomerConfigFromSelected(configs, this.configName, filePath);
56
61
  }
57
62
  this.cli.writeWarning(`config: ${this.configName} does not exist.`);
58
- const selectedConfig = await this.cli.select("please select config: ", Object.keys(configs).map((option) => ({ name: option, value: option })));
59
- return customer_config_1.CustomerConfig.createFrom(configs[selectedConfig], selectedConfig);
63
+ const selectedConfig = await this.cli.select("Please select config: ", Object.keys(configs).map((option) => ({ name: option, value: option })));
64
+ return this.createCustomerConfigFromSelected(configs, selectedConfig, filePath);
65
+ }
66
+ createCustomerConfigFromSelected(configs, selectedConfig, filePath) {
67
+ const configResponse = (0, safe_1.safe)(() => {
68
+ return customer_config_1.CustomerConfig.createFrom(configs[selectedConfig], selectedConfig);
69
+ });
70
+ if (configResponse.success === true) {
71
+ return configResponse.data;
72
+ }
73
+ throw new customer_config_error_1.default(configResponse.error, [
74
+ `Check file ${filePath}`,
75
+ `Validate config: ${selectedConfig}`,
76
+ ]);
60
77
  }
61
78
  }
62
79
  exports.default = CustomerConfigHandler;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const file_handler_1 = tslib_1.__importDefault(require("./file-handler"));
5
5
  const integration_api_model_1 = require("../integration-api-model");
6
+ const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
6
7
  const PREDICTIVE_PRELOADING = "predictive-preloading";
7
8
  class InstallResourceHandler extends file_handler_1.default {
8
9
  allowedFiles = [
@@ -36,7 +37,7 @@ class InstallResourceHandler extends file_handler_1.default {
36
37
  }
37
38
  getRemoteKey(fileName) {
38
39
  if (!this.remoteKeyMapping[fileName]) {
39
- throw new Error(`unknown fileName ${fileName}`);
40
+ throw new application_error_1.default(`unknown fileName ${fileName}`);
40
41
  }
41
42
  return this.remoteKeyMapping[fileName];
42
43
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IntegrationApiService = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const file_list_1 = tslib_1.__importDefault(require("./file-list"));
6
+ const file_handler_error_1 = require("../deploy/error/file-handler-error");
6
7
  class IntegrationApiService {
7
8
  fileReader;
8
9
  virtualFileHandler;
@@ -52,7 +53,7 @@ class IntegrationApiService {
52
53
  return await handler.handle(file);
53
54
  }
54
55
  }
55
- throw new Error(`No handler found for file: ${file}`);
56
+ throw new file_handler_error_1.FileHandlerError(`No handler found for file: ${file}`);
56
57
  }
57
58
  }
58
59
  exports.IntegrationApiService = IntegrationApiService;
@@ -8,6 +8,7 @@ const file_list_1 = tslib_1.__importDefault(require("../file-list"));
8
8
  const customer_config_file_1 = require("../struct/customer-config-file");
9
9
  const install_resource_file_1 = require("../struct/install-resource-file");
10
10
  const files_1 = require("../../../models/files");
11
+ const mandatory_file_missing_error_1 = tslib_1.__importDefault(require("../error/mandatory-file-missing-error"));
11
12
  function addFileCustomerConfig(fileList) {
12
13
  fileList.addFile(new customer_config_file_1.CustomerConfigFile(files_1.INTEGRATION_FILES.CONFIG.CUSTOMER, "", "", {}, "test"));
13
14
  }
@@ -78,7 +79,7 @@ function addFileDocumentHandler(fileList) {
78
79
  addFileSpeedKit(fileList);
79
80
  (0, chai_1.expect)(() => {
80
81
  validator.validate(fileList);
81
- }).to.throw(`Please implement config_documentHandler, config_dynamicBlocks, config_dynamicStyles or speedKit.Asset`);
82
+ }).to.throw(mandatory_file_missing_error_1.default);
82
83
  });
83
84
  (0, mocha_1.it)("throw error -> dynamicBlocks are missing", () => {
84
85
  const validator = new mandatory_files_validator_1.default();
@@ -89,7 +90,7 @@ function addFileDocumentHandler(fileList) {
89
90
  addFileSpeedKit(fileList);
90
91
  (0, chai_1.expect)(() => {
91
92
  validator.validate(fileList);
92
- }).to.throw(`Please implement config_documentHandler, config_dynamicBlocks, config_dynamicStyles or speedKit.Asset`);
93
+ }).to.throw(mandatory_file_missing_error_1.default);
93
94
  });
94
95
  (0, mocha_1.it)("throw error -> documentHandler is missing", () => {
95
96
  const validator = new mandatory_files_validator_1.default();
@@ -100,6 +101,6 @@ function addFileDocumentHandler(fileList) {
100
101
  addFileSpeedKit(fileList);
101
102
  (0, chai_1.expect)(() => {
102
103
  validator.validate(fileList);
103
- }).to.throw(`Please implement config_documentHandler, config_dynamicBlocks, config_dynamicStyles or speedKit.Asset`);
104
+ }).to.throw(mandatory_file_missing_error_1.default);
104
105
  });
105
106
  });
@@ -5,7 +5,7 @@ const origin_error_1 = tslib_1.__importDefault(require("../error/origin-error"))
5
5
  class CustomerConfigValidator {
6
6
  validate(config) {
7
7
  if (this.checkAppNameStartsWithNumber(config)) {
8
- throw new Error("appName can't start with a number");
8
+ throw new origin_error_1.default("appName can't start with a number");
9
9
  }
10
10
  this.validateOrigins(config);
11
11
  }
@@ -17,7 +17,7 @@ class MandatoryFilesValidator {
17
17
  validate(files) {
18
18
  for (const fileName of this.mandatoryFilesConfig.required) {
19
19
  if (!files.hasFile(fileName)) {
20
- throw new mandatory_file_missing_error_1.default(fileName);
20
+ throw new mandatory_file_missing_error_1.default(`Mandatory file "${fileName}" is missing`, [`Add file ${fileName} to config`]);
21
21
  }
22
22
  }
23
23
  this.validateConditionally(files);
@@ -37,7 +37,11 @@ class MandatoryFilesValidator {
37
37
  }
38
38
  }
39
39
  if (!hasRequiredFiles && !hasConditionallyRequiredFiles) {
40
- throw new Error(`Please implement ${this.mandatoryFilesConfig.conditionallyRequired.this.join(", ")} or ${this.mandatoryFilesConfig.conditionallyRequired.or.join(", ")}`);
40
+ throw new mandatory_file_missing_error_1.default(`Mandatory files are missing`, [
41
+ `Implement ${this.mandatoryFilesConfig.conditionallyRequired.this.join(", ")}`,
42
+ "or",
43
+ `${this.mandatoryFilesConfig.conditionallyRequired.or.join(", ")}`,
44
+ ]);
41
45
  }
42
46
  }
43
47
  }
@@ -1,2 +1,4 @@
1
- export declare class VmError extends Error {
1
+ import ApplicationError from "../../error-handling/error/application-error";
2
+ export declare class VmError extends ApplicationError {
3
+ readonly code = "VM_FILE_ERROR";
2
4
  }
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VmError = void 0;
4
- class VmError extends Error {
4
+ const tslib_1 = require("tslib");
5
+ const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
6
+ class VmError extends application_error_1.default {
7
+ code = "VM_FILE_ERROR";
5
8
  }
6
9
  exports.VmError = VmError;
@@ -146,7 +146,7 @@ class FetchEventHandler {
146
146
  return;
147
147
  }
148
148
  if (serverConfigResponse.errorObj instanceof login_error_1.default) {
149
- this.cli.writeError(`could not login to app ${serverConfigResponse.errorObj.app} to gather credentials. Try run sk login`);
149
+ this.cli.writeError(`could not login to app ${this.customerConfig.app} to gather credentials. Try run sk login`);
150
150
  await this.sendDefaultAuthBehaviour(browserClient, event.requestId);
151
151
  return;
152
152
  }
@@ -1,4 +1,4 @@
1
- import { FileInterface } from "../integration-api/integration-api-model";
1
+ import { FileInterface } from "../integration-api";
2
2
  export type task = {
3
3
  todo: string;
4
4
  context: string;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TodoCollector = void 0;
4
- const integration_api_model_1 = require("../integration-api/integration-api-model");
4
+ const integration_api_1 = require("../integration-api");
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 === integration_api_model_1.FILE_TYPE.VIRTUAL_FILE);
17
+ return !(file.type === integration_api_1.FILE_TYPE.VIRTUAL_FILE);
18
18
  });
19
19
  const tasks = [];
20
20
  for (const configFile of configFiles) {
@@ -14,9 +14,7 @@ class CsvReader {
14
14
  return this.cleanUpEntries(entries);
15
15
  }
16
16
  catch (error) {
17
- throw new read_csv_error_1.ReadCsvError(error.message, [
18
- "check arguments for correct filePath",
19
- ]);
17
+ throw new read_csv_error_1.ReadCsvError(error.message);
20
18
  }
21
19
  }
22
20
  cleanUpEntries(entries) {
@@ -1,2 +1,3 @@
1
- export declare class InvalidOriginError extends Error {
1
+ import CustomerConfigError from "../../integration-api/error/customer-config-error";
2
+ export declare class InvalidOriginError extends CustomerConfigError {
2
3
  }
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InvalidOriginError = void 0;
4
- class InvalidOriginError extends Error {
4
+ const tslib_1 = require("tslib");
5
+ const customer_config_error_1 = tslib_1.__importDefault(require("../../integration-api/error/customer-config-error"));
6
+ class InvalidOriginError extends customer_config_error_1.default {
5
7
  }
6
8
  exports.InvalidOriginError = InvalidOriginError;
@@ -1,8 +1,7 @@
1
- import { PrettyPrintableError } from "@oclif/core/lib/errors";
2
- export declare class ReadCsvError extends Error implements PrettyPrintableError {
1
+ import ApplicationError from "../../error-handling/error/application-error";
2
+ export declare class ReadCsvError extends ApplicationError {
3
3
  readonly message: string;
4
- readonly suggestions?: string[];
5
- readonly ref?: string;
6
4
  readonly code = "SK_CLI_CSV_READ";
7
- constructor(message: string, suggestions?: string[], ref?: string);
5
+ readonly suggestions: string[];
6
+ constructor(message: string);
8
7
  }
@@ -1,18 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReadCsvError = void 0;
4
- class ReadCsvError extends Error {
4
+ const tslib_1 = require("tslib");
5
+ const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
6
+ class ReadCsvError extends application_error_1.default {
5
7
  message;
6
- suggestions;
7
- ref;
8
8
  code = "SK_CLI_CSV_READ";
9
- constructor(message, suggestions,
10
- // eslint-disable-next-line unicorn/prevent-abbreviations
11
- ref) {
9
+ suggestions = ["check arguments for correct filePath"];
10
+ constructor(message) {
12
11
  super(message);
13
12
  this.message = message;
14
- this.suggestions = suggestions;
15
- this.ref = ref;
16
13
  }
17
14
  }
18
15
  exports.ReadCsvError = ReadCsvError;
@@ -19,6 +19,7 @@
19
19
  "char": "c",
20
20
  "description": "The costumer config name",
21
21
  "name": "configName",
22
+ "required": false,
22
23
  "default": "production",
23
24
  "hasDynamicHelp": false,
24
25
  "multiple": false,
@@ -59,6 +60,7 @@
59
60
  "char": "c",
60
61
  "description": "The costumer config name",
61
62
  "name": "configName",
63
+ "required": false,
62
64
  "default": "production",
63
65
  "hasDynamicHelp": false,
64
66
  "multiple": false,
@@ -99,6 +101,7 @@
99
101
  "char": "c",
100
102
  "description": "The costumer config name",
101
103
  "name": "configName",
104
+ "required": false,
102
105
  "default": "production",
103
106
  "hasDynamicHelp": false,
104
107
  "multiple": false,
@@ -203,6 +206,7 @@
203
206
  "char": "c",
204
207
  "description": "The costumer config name",
205
208
  "name": "configName",
209
+ "required": false,
206
210
  "default": "production",
207
211
  "hasDynamicHelp": false,
208
212
  "multiple": false,
@@ -441,6 +445,7 @@
441
445
  "char": "c",
442
446
  "description": "The costumer config name",
443
447
  "name": "configName",
448
+ "required": false,
444
449
  "default": "production",
445
450
  "hasDynamicHelp": false,
446
451
  "multiple": false,
@@ -594,6 +599,7 @@
594
599
  "char": "c",
595
600
  "description": "The costumer config name",
596
601
  "name": "configName",
602
+ "required": false,
597
603
  "default": "production",
598
604
  "hasDynamicHelp": false,
599
605
  "multiple": false,
@@ -675,5 +681,5 @@
675
681
  ]
676
682
  }
677
683
  },
678
- "version": "2.31.1"
684
+ "version": "2.32.0"
679
685
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "2.31.1",
4
+ "version": "2.32.0",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"
@@ -1,7 +0,0 @@
1
- /**
2
- * Gets chrome-path of .env file in skonboarding project.
3
- * If path is not set or falsy, uses default chrome-path.
4
- *
5
- * @param customerPath - Path to customer in skonboarding-project.
6
- */
7
- export declare function getChromePath(customerPath: string): Promise<string>;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getChromePath = void 0;
4
- const customer_config_1 = require("./customer-config");
5
- const is_file_1 = require("./is-file");
6
- const CHROME_PATHS = {
7
- darwin: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
8
- win32: "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
9
- linux: "/usr/bin/google-chrome",
10
- };
11
- const ENV_CHROME_REGEX = new RegExp(/^\s*CHROME_PATH=(.*)$/mu);
12
- /**
13
- * Gets chrome-path of .env file in skonboarding project.
14
- * If path is not set or falsy, uses default chrome-path.
15
- *
16
- * @param customerPath - Path to customer in skonboarding-project.
17
- */
18
- async function getChromePath(customerPath) {
19
- const environmentFile = await customer_config_1.ConfigFile.loadFile(customerPath, "../../.env");
20
- if (!environmentFile) {
21
- return CHROME_PATHS[process.platform];
22
- }
23
- const environmentContent = await environmentFile.readContent();
24
- const chromePath = ENV_CHROME_REGEX.test(environmentContent)
25
- ? environmentContent.match(ENV_CHROME_REGEX)[1]
26
- : "";
27
- return (await (0, is_file_1.isFile)(chromePath))
28
- ? chromePath
29
- : CHROME_PATHS[process.platform];
30
- }
31
- exports.getChromePath = getChromePath;
@@ -1 +0,0 @@
1
- export declare function isExecutable(filename: string): Promise<boolean>;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isExecutable = void 0;
4
- const promises_1 = require("node:fs/promises");
5
- const node_fs_1 = require("node:fs");
6
- async function isExecutable(filename) {
7
- try {
8
- await (0, promises_1.access)(filename, node_fs_1.constants.X_OK);
9
- return true;
10
- }
11
- catch {
12
- return false;
13
- }
14
- }
15
- exports.isExecutable = isExecutable;
@@ -1 +0,0 @@
1
- export declare function watchFiles(filenames: (string | undefined)[], listener: () => Promise<void>): void;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.watchFiles = void 0;
4
- const tslib_1 = require("tslib");
5
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
- const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
7
- function watchFiles(filenames, listener) {
8
- for (const filename of filenames) {
9
- if (!filename) {
10
- // asset comes not from the local filesystem
11
- continue;
12
- }
13
- node_fs_1.default.watchFile(filename, async () => {
14
- console.info((0, chalk_1.default) `Updated {bold ${filename}}`);
15
- await listener();
16
- });
17
- console.info((0, chalk_1.default) `Listening for changes on {bold ${filename}}`);
18
- }
19
- }
20
- exports.watchFiles = watchFiles;
@@ -1,4 +0,0 @@
1
- import DeployAppError from "./deploy-app-error";
2
- export default class CreateFindTemporaryDirectoryError extends DeployAppError {
3
- constructor();
4
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const deploy_app_error_1 = tslib_1.__importDefault(require("./deploy-app-error"));
5
- class CreateFindTemporaryDirectoryError extends deploy_app_error_1.default {
6
- constructor() {
7
- super(`No temporary Directory found and unable to create a new temporary Directory`);
8
- }
9
- }
10
- exports.default = CreateFindTemporaryDirectoryError;