@speedkit/cli 2.26.0 → 2.28.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 (147) hide show
  1. package/CHANGELOG.md +25 -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/customer-config-service.js +0 -3
  11. package/dist/services/customer-config/templates/config_documentHandler.js.hbs +0 -4
  12. package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +1 -1
  13. package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +1 -2
  14. package/dist/services/deploy/deploy-service-factory.js +3 -4
  15. package/dist/services/deploy/deploy-service.d.ts +3 -2
  16. package/dist/services/deploy/deploy-service.js +23 -1
  17. package/dist/services/deploy/handler/customer-config-handler.d.ts +4 -5
  18. package/dist/services/deploy/handler/customer-config-handler.js +2 -2
  19. package/dist/services/deploy/handler/install-resource-handler.d.ts +3 -4
  20. package/dist/services/deploy/handler/install-resource-handler.js +2 -3
  21. package/dist/services/deploy/handler/module-handler.d.ts +8 -5
  22. package/dist/services/deploy/handler/module-handler.js +2 -3
  23. package/dist/services/deploy/handler/server-config-handler.d.ts +9 -6
  24. package/dist/services/deploy/handler/server-config-handler.js +6 -4
  25. package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +2 -3
  26. package/dist/services/document-handler-runtime/document-handler-runtime-service.js +2 -6
  27. package/dist/services/document-handler-runtime/document-handler-server.d.ts +1 -2
  28. package/dist/services/document-handler-runtime/document-handler-server.js +2 -5
  29. package/dist/services/document-handler-runtime/error/required-file-not-found-error.d.ts +1 -2
  30. package/dist/services/document-handler-runtime/error/required-file-not-found-error.js +1 -3
  31. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -6
  32. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +9 -18
  33. package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +1 -2
  34. package/dist/services/integration-api/error/customer-config-legacy-error.js +1 -3
  35. package/dist/services/integration-api/error/handler/customer-config-legacy-handler.d.ts +1 -2
  36. package/dist/services/integration-api/error/handler/customer-config-legacy-handler.js +1 -1
  37. package/dist/services/integration-api/error/handler/origin-handler.d.ts +1 -2
  38. package/dist/services/integration-api/error/handler/origin-handler.js +1 -1
  39. package/dist/services/integration-api/error/origin-error.d.ts +1 -2
  40. package/dist/services/integration-api/error/origin-error.js +1 -3
  41. package/dist/services/integration-api/file-list.d.ts +3 -5
  42. package/dist/services/integration-api/file-list.js +6 -10
  43. package/dist/services/integration-api/file-reader.d.ts +14 -6
  44. package/dist/services/integration-api/file-reader.js +8 -8
  45. package/dist/services/integration-api/file-writer.d.ts +10 -2
  46. package/dist/services/integration-api/file-writer.js +9 -6
  47. package/dist/services/integration-api/handler/customer-config-handler.js +6 -8
  48. package/dist/services/integration-api/handler/install-resource-handler.js +3 -4
  49. package/dist/services/integration-api/handler/module-handler.js +2 -2
  50. package/dist/services/integration-api/handler/server-config-handler.js +2 -2
  51. package/dist/services/integration-api/index.d.ts +3 -0
  52. package/dist/services/integration-api/index.js +6 -0
  53. package/dist/services/integration-api/integration-api-factory.d.ts +13 -0
  54. package/dist/services/integration-api/integration-api-factory.js +50 -0
  55. package/dist/services/integration-api/integration-api-model.d.ts +33 -14
  56. package/dist/services/integration-api/integration-api-model.js +37 -0
  57. package/dist/services/integration-api/integration-api-service.d.ts +1 -2
  58. package/dist/services/integration-api/integration-api-service.js +3 -23
  59. package/dist/services/integration-api/spec/customer-config-validator.spec.d.ts +1 -0
  60. package/dist/services/integration-api/spec/customer-config-validator.spec.js +50 -0
  61. package/dist/services/integration-api/spec/file-list.spec.d.ts +1 -0
  62. package/dist/services/integration-api/spec/file-list.spec.js +163 -0
  63. package/dist/services/integration-api/spec/file-reader.spec.d.ts +1 -0
  64. package/dist/services/integration-api/spec/file-reader.spec.js +71 -0
  65. package/dist/services/integration-api/spec/file-writer.spec.d.ts +1 -0
  66. package/dist/services/integration-api/spec/file-writer.spec.js +55 -0
  67. package/dist/services/integration-api/spec/integration-api-service.spec.d.ts +1 -0
  68. package/dist/services/integration-api/spec/integration-api-service.spec.js +122 -0
  69. package/dist/services/integration-api/spec/mandatory-files-validator.spec.d.ts +1 -0
  70. package/dist/services/integration-api/spec/mandatory-files-validator.spec.js +105 -0
  71. package/dist/services/integration-api/struct/customer-config-file.d.ts +3 -4
  72. package/dist/services/integration-api/struct/customer-config-file.js +7 -6
  73. package/dist/services/integration-api/struct/customer-config.d.ts +3 -5
  74. package/dist/services/integration-api/struct/customer-config.js +5 -8
  75. package/dist/services/integration-api/struct/file.d.ts +4 -4
  76. package/dist/services/integration-api/struct/file.js +6 -6
  77. package/dist/services/integration-api/struct/install-resource-file.d.ts +4 -3
  78. package/dist/services/integration-api/struct/install-resource-file.js +7 -5
  79. package/dist/services/integration-api/struct/module-file.d.ts +4 -3
  80. package/dist/services/integration-api/struct/module-file.js +7 -5
  81. package/dist/services/integration-api/struct/ro-file.d.ts +2 -2
  82. package/dist/services/integration-api/struct/ro-file.js +1 -1
  83. package/dist/services/integration-api/struct/server-config-file.d.ts +5 -4
  84. package/dist/services/integration-api/struct/server-config-file.js +7 -5
  85. package/dist/services/integration-api/struct/virtual-file.d.ts +2 -2
  86. package/dist/services/integration-api/struct/virtual-file.js +2 -1
  87. package/dist/services/integration-api/validator/customer-config-validator.d.ts +5 -1
  88. package/dist/services/integration-api/validator/customer-config-validator.js +28 -17
  89. package/dist/services/integration-api/virtual/static-recipe.d.ts +6 -0
  90. package/dist/services/integration-api/virtual/static-recipe.js +14 -0
  91. package/dist/services/integration-api/virtual/virtual-file-handler.js +2 -2
  92. package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +1 -2
  93. package/dist/services/onboarding/dashboard/index.d.ts +1 -1
  94. package/dist/services/onboarding/dashboard/parameter-query-builder.d.ts +1 -2
  95. package/dist/services/onboarding/fetch-event-handler.d.ts +1 -1
  96. package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +1 -2
  97. package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +1 -1
  98. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +1 -1
  99. package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +1 -1
  100. package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +1 -2
  101. package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +1 -1
  102. package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +1 -2
  103. package/dist/services/onboarding/file-events/file-watcher.d.ts +1 -2
  104. package/dist/services/onboarding/file-events/file-watcher.js +3 -3
  105. package/dist/services/onboarding/onboarding-service-factory.js +9 -13
  106. package/dist/services/onboarding/onboarding-service.d.ts +1 -1
  107. package/dist/services/onboarding/todo-collector.js +2 -2
  108. package/dist/services/pull/pull-service-factory.js +3 -4
  109. package/dist/services/pull/pull-service.d.ts +1 -1
  110. package/dist/services/pull/pull-service.js +2 -3
  111. package/oclif.manifest.json +1 -1
  112. package/package.json +5 -5
  113. package/dist/services/context/error/context-runtime-error.d.ts +0 -3
  114. package/dist/services/context/error/context-runtime-error.js +0 -7
  115. package/dist/services/context/interface/context-interface.d.ts +0 -2
  116. package/dist/services/context/interface/context-interface.js +0 -2
  117. package/dist/services/customer-config/templates/deploymentDetection.es6.hbs +0 -303
  118. package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.d.ts +0 -6
  119. package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.js +0 -14
  120. package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.d.ts +0 -6
  121. package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.js +0 -19
  122. package/dist/services/error-handling/abstract/abstract-async-error-handling-service.d.ts +0 -6
  123. package/dist/services/error-handling/abstract/abstract-async-error-handling-service.js +0 -18
  124. package/dist/services/error-handling/abstract/abstract-error-handling-factory.d.ts +0 -6
  125. package/dist/services/error-handling/abstract/abstract-error-handling-factory.js +0 -19
  126. package/dist/services/error-handling/abstract/abstract-error-handling-service.d.ts +0 -6
  127. package/dist/services/error-handling/abstract/abstract-error-handling-service.js +0 -19
  128. package/dist/services/error-handling/error/application-error.d.ts +0 -5
  129. package/dist/services/error-handling/error/application-error.js +0 -11
  130. package/dist/services/error-handling/error-handling-service.d.ts +0 -7
  131. package/dist/services/error-handling/error-handling-service.js +0 -27
  132. package/dist/services/error-handling/factory/error-handling-factory.d.ts +0 -5
  133. package/dist/services/error-handling/factory/error-handling-factory.js +0 -22
  134. package/dist/services/error-handling/interface/error-context-interface.d.ts +0 -6
  135. package/dist/services/error-handling/interface/error-context-interface.js +0 -2
  136. package/dist/services/error-handling/interface/error-handler-interface.d.ts +0 -5
  137. package/dist/services/error-handling/interface/error-handler-interface.js +0 -2
  138. package/dist/services/error-handling/interface/error-handling-factory-interface.d.ts +0 -8
  139. package/dist/services/error-handling/interface/error-handling-factory-interface.js +0 -2
  140. package/dist/services/error-handling/interface/error-handling-service-interface.d.ts +0 -8
  141. package/dist/services/error-handling/interface/error-handling-service-interface.js +0 -2
  142. package/dist/services/integration-api/context/integration-api-context.d.ts +0 -9
  143. package/dist/services/integration-api/context/integration-api-context.js +0 -20
  144. package/dist/services/integration-api/error/handler/customer-config-handler.d.ts +0 -5
  145. package/dist/services/integration-api/error/handler/customer-config-handler.js +0 -19
  146. package/dist/services/integration-api/factory/integration-api-service-factory.d.ts +0 -13
  147. package/dist/services/integration-api/factory/integration-api-service-factory.js +0 -55
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const chai_1 = require("chai");
5
+ const mocha_1 = require("mocha");
6
+ const mandatory_files_validator_1 = tslib_1.__importDefault(require("../validator/mandatory-files-validator"));
7
+ const file_list_1 = tslib_1.__importDefault(require("../file-list"));
8
+ const customer_config_file_1 = require("../struct/customer-config-file");
9
+ const install_resource_file_1 = require("../struct/install-resource-file");
10
+ const files_1 = require("../../../models/files");
11
+ function addFileCustomerConfig(fileList) {
12
+ fileList.addFile(new customer_config_file_1.CustomerConfigFile(files_1.INTEGRATION_FILES.CONFIG.CUSTOMER, "", "", {}, "test"));
13
+ }
14
+ function addFileDynamicStyles(fileList) {
15
+ fileList.addFile(new install_resource_file_1.InstallResourceFile(files_1.INTEGRATION_FILES.CONFIG.DYNAMIC_STYLES, "", "", ""));
16
+ }
17
+ function addFileAssetHandler(fileList) {
18
+ fileList.addFile(new install_resource_file_1.InstallResourceFile(files_1.INTEGRATION_FILES.DEPRECATED.ASSET_HANDLER, "", "", ""));
19
+ }
20
+ function addFileDynamicBlocks(fileList) {
21
+ fileList.addFile(new install_resource_file_1.InstallResourceFile(files_1.INTEGRATION_FILES.CONFIG.DYNAMIC_BLOCKS, "", "", ""));
22
+ }
23
+ function addFileSpeedKit(fileList) {
24
+ fileList.addFile(new install_resource_file_1.InstallResourceFile(files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT, "", "", ""));
25
+ }
26
+ function addFileDocumentHandler(fileList) {
27
+ fileList.addFile(new install_resource_file_1.InstallResourceFile(files_1.INTEGRATION_FILES.CONFIG.DOCUMENT_HANDLER, "", "", ""));
28
+ }
29
+ (0, mocha_1.describe)("mandatory_files_validator validate", () => {
30
+ (0, mocha_1.it)("documentHandler -> should have no errors", () => {
31
+ const validator = new mandatory_files_validator_1.default();
32
+ const fileList = new file_list_1.default();
33
+ addFileCustomerConfig(fileList);
34
+ addFileDynamicStyles(fileList);
35
+ addFileDynamicBlocks(fileList);
36
+ addFileSpeedKit(fileList);
37
+ addFileDocumentHandler(fileList);
38
+ validator.validate(fileList);
39
+ (0, chai_1.expect)(true).to.be.true;
40
+ });
41
+ (0, mocha_1.it)("assetHandler -> should have no errors", () => {
42
+ const validator = new mandatory_files_validator_1.default();
43
+ const fileList = new file_list_1.default();
44
+ addFileCustomerConfig(fileList);
45
+ addFileSpeedKit(fileList);
46
+ addFileAssetHandler(fileList);
47
+ validator.validate(fileList);
48
+ (0, chai_1.expect)(true).to.be.true;
49
+ });
50
+ (0, mocha_1.it)("throw error -> customerConfigMissing", () => {
51
+ const validator = new mandatory_files_validator_1.default();
52
+ const fileList = new file_list_1.default();
53
+ addFileDynamicStyles(fileList);
54
+ addFileAssetHandler(fileList);
55
+ addFileDynamicBlocks(fileList);
56
+ addFileSpeedKit(fileList);
57
+ (0, chai_1.expect)(() => {
58
+ validator.validate(fileList);
59
+ }).to.throw(`Mandatory file "${files_1.INTEGRATION_FILES.CONFIG.CUSTOMER}" is missing`);
60
+ });
61
+ (0, mocha_1.it)("throw error -> skConfigMissing", () => {
62
+ const validator = new mandatory_files_validator_1.default();
63
+ const fileList = new file_list_1.default();
64
+ addFileCustomerConfig(fileList);
65
+ addFileDynamicStyles(fileList);
66
+ addFileAssetHandler(fileList);
67
+ addFileDynamicBlocks(fileList);
68
+ (0, chai_1.expect)(() => {
69
+ validator.validate(fileList);
70
+ }).to.throw(`Mandatory file "${files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT}" is missing`);
71
+ });
72
+ (0, mocha_1.it)("throw error -> skStyles are missing", () => {
73
+ const validator = new mandatory_files_validator_1.default();
74
+ const fileList = new file_list_1.default();
75
+ addFileCustomerConfig(fileList);
76
+ addFileDocumentHandler(fileList);
77
+ addFileDynamicBlocks(fileList);
78
+ addFileSpeedKit(fileList);
79
+ (0, chai_1.expect)(() => {
80
+ validator.validate(fileList);
81
+ }).to.throw(`Please implement config_documentHandler, config_dynamicBlocks, config_dynamicStyles or speedKit.Asset`);
82
+ });
83
+ (0, mocha_1.it)("throw error -> dynamicBlocks are missing", () => {
84
+ const validator = new mandatory_files_validator_1.default();
85
+ const fileList = new file_list_1.default();
86
+ addFileCustomerConfig(fileList);
87
+ addFileDocumentHandler(fileList);
88
+ addFileDynamicStyles(fileList);
89
+ addFileSpeedKit(fileList);
90
+ (0, chai_1.expect)(() => {
91
+ validator.validate(fileList);
92
+ }).to.throw(`Please implement config_documentHandler, config_dynamicBlocks, config_dynamicStyles or speedKit.Asset`);
93
+ });
94
+ (0, mocha_1.it)("throw error -> documentHandler is missing", () => {
95
+ const validator = new mandatory_files_validator_1.default();
96
+ const fileList = new file_list_1.default();
97
+ addFileCustomerConfig(fileList);
98
+ addFileDynamicBlocks(fileList);
99
+ addFileDynamicStyles(fileList);
100
+ addFileSpeedKit(fileList);
101
+ (0, chai_1.expect)(() => {
102
+ validator.validate(fileList);
103
+ }).to.throw(`Please implement config_documentHandler, config_dynamicBlocks, config_dynamicStyles or speedKit.Asset`);
104
+ });
105
+ });
@@ -1,10 +1,9 @@
1
- import { CustomerConfigInterface } from "../integration-api-model";
2
- import CustomerConfig from "./customer-config";
3
- import File from "./file";
4
- export default class CustomerConfigFile extends File implements CustomerConfigInterface {
1
+ import { CustomerConfig, File, CustomerConfigInterface, FILE_TYPE } from "../integration-api-model";
2
+ export declare class CustomerConfigFile extends File implements CustomerConfigInterface {
5
3
  config: CustomerConfig;
6
4
  readonly configName: string;
7
5
  readonly testApp?: string;
6
+ readonly type = FILE_TYPE.CUSTOMER_FILE;
8
7
  constructor(name: string, path: string, content: string, config: CustomerConfig, configName: string, testApp?: string);
9
8
  setContent(content: string): void;
10
9
  private updateConfigByContent;
@@ -1,15 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomerConfigFile = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  const vm = tslib_1.__importStar(require("node:vm"));
5
- const customer_config_1 = tslib_1.__importDefault(require("./customer-config"));
6
- const file_1 = tslib_1.__importDefault(require("./file"));
7
- class CustomerConfigFile extends file_1.default {
6
+ const integration_api_model_1 = require("../integration-api-model");
7
+ class CustomerConfigFile extends integration_api_model_1.File {
8
8
  config;
9
9
  configName;
10
10
  testApp;
11
+ type = integration_api_model_1.FILE_TYPE.CUSTOMER_FILE;
11
12
  constructor(name, path, content, config, configName, testApp) {
12
- super(name, path, content, CustomerConfigFile);
13
+ super(name, path, content);
13
14
  this.config = config;
14
15
  this.configName = configName;
15
16
  this.testApp = testApp;
@@ -30,8 +31,8 @@ class CustomerConfigFile extends file_1.default {
30
31
  displayErrors: true,
31
32
  });
32
33
  if (this.configName in customerConfigContext.module.exports) {
33
- this.config = customer_config_1.default.createFrom(customerConfigContext.module.exports[this.configName], this.configName);
34
+ this.config = integration_api_model_1.CustomerConfig.createFrom(customerConfigContext.module.exports[this.configName], this.configName);
34
35
  }
35
36
  }
36
37
  }
37
- exports.default = CustomerConfigFile;
38
+ exports.CustomerConfigFile = CustomerConfigFile;
@@ -1,4 +1,4 @@
1
- export default class CustomerConfig {
1
+ export declare class CustomerConfig {
2
2
  readonly app: string;
3
3
  readonly origins: string[];
4
4
  readonly domain: string;
@@ -13,10 +13,8 @@ export default class CustomerConfig {
13
13
  readonly dependencies?: {
14
14
  [dependency: string]: string;
15
15
  };
16
- readonly skCliPre?: string;
17
- readonly skCliPost?: string;
18
16
  constructor(app: string, origins: string[], domain: string, swPath: string, scope: string, appDomain?: string, installPath?: string, installParameters?: string, name?: string, forceInstall?: boolean, chromeFlags?: string[], dependencies?: {
19
17
  [dependency: string]: string;
20
- }, skCliPre?: string, skCliPost?: string);
21
- static createFrom(configFile: any, configName?: string): CustomerConfig;
18
+ });
19
+ static createFrom(configFile: Partial<CustomerConfig>, configName?: string): CustomerConfig;
22
20
  }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomerConfig = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  const customer_config_error_1 = tslib_1.__importDefault(require("../error/customer-config-error"));
5
6
  class CustomerConfig {
@@ -15,9 +16,7 @@ class CustomerConfig {
15
16
  forceInstall;
16
17
  chromeFlags;
17
18
  dependencies;
18
- skCliPre;
19
- skCliPost;
20
- constructor(app, origins, domain, swPath, scope, appDomain, installPath, installParameters, name, forceInstall, chromeFlags, dependencies, skCliPre, skCliPost) {
19
+ constructor(app, origins, domain, swPath, scope, appDomain, installPath, installParameters, name, forceInstall, chromeFlags, dependencies) {
21
20
  this.app = app;
22
21
  this.origins = origins;
23
22
  this.domain = domain;
@@ -30,16 +29,14 @@ class CustomerConfig {
30
29
  this.forceInstall = forceInstall;
31
30
  this.chromeFlags = chromeFlags;
32
31
  this.dependencies = dependencies;
33
- this.skCliPre = skCliPre;
34
- this.skCliPost = skCliPost;
35
32
  }
36
33
  static createFrom(configFile, configName) {
37
- const { app, origins, domain, swPath, scope, appDomain, installPath, installParams, name, forceInstall, chromeFlags, dependencies, skCliPre, skCliPost, } = configFile;
34
+ const { app, origins, domain, swPath, scope, appDomain, installPath, installParams, name, forceInstall, chromeFlags, dependencies, } = configFile;
38
35
  return new CustomerConfig(new RequiredParameter("app", app).isString().getValue(), new RequiredParameter("origins", origins).isArray().getValue(), new RequiredParameter("domain", domain).isString().getValue(), new RequiredParameter("swPath", swPath).isString().getValue(), new RequiredParameter("scope", scope).isString().getValue(), appDomain || `${app}.app.baqend.com`, installPath ||
39
- `https://${app}.app.baqend.com/v1/speedkit/install.js?d=${name || configName}`, installParams || 'async="" crossorigin="anonymous"', name, forceInstall, chromeFlags, dependencies, skCliPre, skCliPost);
36
+ `https://${app}.app.baqend.com/v1/speedkit/install.js?d=${name || configName}`, installParams || 'async="" crossorigin="anonymous"', name, forceInstall || true, chromeFlags, dependencies || {});
40
37
  }
41
38
  }
42
- exports.default = CustomerConfig;
39
+ exports.CustomerConfig = CustomerConfig;
43
40
  class RequiredParameter {
44
41
  key;
45
42
  value;
@@ -1,12 +1,12 @@
1
- import { ConfigFileInterface, FileInterface } from "../integration-api-model";
2
- export default class File implements ConfigFileInterface, FileInterface {
1
+ import { ConfigFileInterface, FILE_TYPE, FileInterface } from "../integration-api-model";
2
+ export declare class File implements ConfigFileInterface, FileInterface {
3
3
  readonly name: string;
4
4
  readonly path: string;
5
- readonly type: string;
6
5
  private content;
7
6
  private skip;
8
7
  private updated;
9
- constructor(name: string, path: string, content: string, type?: any);
8
+ readonly type: FILE_TYPE;
9
+ constructor(name: string, path: string, content: string);
10
10
  skipFile(): void;
11
11
  shouldSkipFile(): boolean;
12
12
  getContent(): string;
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.File = void 0;
3
4
  const promises_1 = require("node:fs/promises");
4
- const promises_2 = require("node:fs/promises");
5
+ const integration_api_model_1 = require("../integration-api-model");
5
6
  class File {
6
7
  name;
7
8
  path;
8
- type;
9
9
  content;
10
10
  skip = false;
11
11
  updated = false;
12
- constructor(name, path, content, type = File) {
12
+ type = integration_api_model_1.FILE_TYPE.CONFIG_FILE;
13
+ constructor(name, path, content) {
13
14
  this.name = name;
14
15
  this.path = path;
15
16
  this.content = content;
16
- this.type = type;
17
17
  }
18
18
  skipFile() {
19
19
  this.skip = true;
@@ -55,7 +55,7 @@ class File {
55
55
  }
56
56
  }
57
57
  async delete() {
58
- await (0, promises_2.unlink)(this.path);
58
+ await (0, promises_1.unlink)(this.path);
59
59
  }
60
60
  }
61
- exports.default = File;
61
+ exports.File = File;
@@ -1,6 +1,7 @@
1
- import File from "./file";
2
- import { InstallResourceInterface } from "../integration-api-model";
3
- export default class InstallResourceFile extends File implements InstallResourceInterface {
1
+ import { File } from "./file";
2
+ import { FILE_TYPE, InstallResourceInterface } from "../integration-api-model";
3
+ export declare class InstallResourceFile extends File implements InstallResourceInterface {
4
4
  readonly remoteKey: string;
5
+ readonly type = FILE_TYPE.INSTALL_FILE;
5
6
  constructor(name: string, path: string, content: string, remoteKey: string);
6
7
  }
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const file_1 = tslib_1.__importDefault(require("./file"));
5
- class InstallResourceFile extends file_1.default {
3
+ exports.InstallResourceFile = void 0;
4
+ const file_1 = require("./file");
5
+ const integration_api_model_1 = require("../integration-api-model");
6
+ class InstallResourceFile extends file_1.File {
6
7
  remoteKey;
8
+ type = integration_api_model_1.FILE_TYPE.INSTALL_FILE;
7
9
  constructor(name, path, content, remoteKey) {
8
- super(name, path, content, InstallResourceFile);
10
+ super(name, path, content);
9
11
  this.remoteKey = remoteKey;
10
12
  }
11
13
  }
12
- exports.default = InstallResourceFile;
14
+ exports.InstallResourceFile = InstallResourceFile;
@@ -1,5 +1,6 @@
1
- import File from "./file";
2
- import { ModuleInterface } from "../integration-api-model";
3
- export default class ModuleFile extends File implements ModuleInterface {
1
+ import { File } from "./file";
2
+ import { FILE_TYPE, ModuleInterface } from "../integration-api-model";
3
+ export declare class ModuleFile extends File implements ModuleInterface {
4
+ readonly type = FILE_TYPE.MODULE_FILE;
4
5
  constructor(name: string, path: string, content: string, config: NonNullable<unknown>);
5
6
  }
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const file_1 = tslib_1.__importDefault(require("./file"));
5
- class ModuleFile extends file_1.default {
3
+ exports.ModuleFile = void 0;
4
+ const file_1 = require("./file");
5
+ const integration_api_model_1 = require("../integration-api-model");
6
+ class ModuleFile extends file_1.File {
7
+ type = integration_api_model_1.FILE_TYPE.MODULE_FILE;
6
8
  constructor(name, path, content,
7
9
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
8
10
  config) {
9
- super(name, path, content, ModuleFile);
11
+ super(name, path, content);
10
12
  }
11
13
  }
12
- exports.default = ModuleFile;
14
+ exports.ModuleFile = ModuleFile;
@@ -1,11 +1,11 @@
1
- import { FileInterface } from "../integration-api-model";
1
+ import { FILE_TYPE, FileInterface } from "../integration-api-model";
2
2
  export declare class RoFile implements FileInterface {
3
3
  readonly name: string;
4
4
  readonly path: string;
5
5
  protected content: string;
6
6
  protected skip: boolean;
7
7
  protected updated: boolean;
8
- readonly type: any;
8
+ readonly type: FILE_TYPE.READONLY_FILE;
9
9
  constructor(name: string, path: string, content: string);
10
10
  skipFile(): void;
11
11
  shouldSkipFile(): boolean;
@@ -7,7 +7,7 @@ class RoFile {
7
7
  content;
8
8
  skip = false;
9
9
  updated = false;
10
- type = RoFile;
10
+ type;
11
11
  constructor(name, path, content) {
12
12
  this.name = name;
13
13
  this.path = path;
@@ -1,7 +1,8 @@
1
- import File from "./file";
2
- import { ServerConfigInterface } from "../integration-api-model";
3
- export default class ServerConfigFile extends File implements ServerConfigInterface {
4
- config: any;
1
+ import { File } from "./file";
2
+ import { FILE_TYPE, ServerConfigInterface } from "../integration-api-model";
3
+ export declare class ServerConfigFile extends File implements ServerConfigInterface {
4
+ config: NonNullable<unknown>;
5
+ readonly type = FILE_TYPE.SERVER_FILE;
5
6
  constructor(name: string, path: string, content: string, config: NonNullable<unknown>);
6
7
  getContent(): string;
7
8
  setContent(content: string): void;
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const file_1 = tslib_1.__importDefault(require("./file"));
5
- class ServerConfigFile extends file_1.default {
3
+ exports.ServerConfigFile = void 0;
4
+ const file_1 = require("./file");
5
+ const integration_api_model_1 = require("../integration-api-model");
6
+ class ServerConfigFile extends file_1.File {
6
7
  config;
8
+ type = integration_api_model_1.FILE_TYPE.SERVER_FILE;
7
9
  constructor(name, path, content, config) {
8
- super(name, path, content, ServerConfigFile);
10
+ super(name, path, content);
9
11
  this.config = config;
10
12
  }
11
13
  getContent() {
@@ -19,4 +21,4 @@ class ServerConfigFile extends file_1.default {
19
21
  return JSON.stringify(this.config);
20
22
  }
21
23
  }
22
- exports.default = ServerConfigFile;
24
+ exports.ServerConfigFile = ServerConfigFile;
@@ -1,11 +1,11 @@
1
- import { FileInterface, VirtualFileInterface, VirtualFileRecipe } from "../integration-api-model";
1
+ import { FILE_TYPE, FileInterface, VirtualFileInterface, VirtualFileRecipe } from "../integration-api-model";
2
2
  export declare class VirtualFile implements VirtualFileInterface, FileInterface {
3
3
  readonly name: string;
4
4
  private recipe;
5
5
  protected skip: boolean;
6
6
  protected updated: boolean;
7
7
  protected content: string;
8
- readonly type: any;
8
+ readonly type = FILE_TYPE.VIRTUAL_FILE;
9
9
  constructor(name: string, recipe: VirtualFileRecipe);
10
10
  skipFile(): void;
11
11
  shouldSkipFile(): boolean;
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VirtualFile = void 0;
4
+ const integration_api_model_1 = require("../integration-api-model");
4
5
  class VirtualFile {
5
6
  name;
6
7
  recipe;
7
8
  skip = false;
8
9
  updated = false;
9
10
  content;
10
- type = VirtualFile;
11
+ type = integration_api_model_1.FILE_TYPE.VIRTUAL_FILE;
11
12
  constructor(name, recipe) {
12
13
  this.name = name;
13
14
  this.recipe = recipe;
@@ -1,5 +1,9 @@
1
- import CustomerConfig from "../struct/customer-config";
1
+ import { CustomerConfig } from "../struct/customer-config";
2
2
  export default class CustomerConfigValidator {
3
3
  validate(config: CustomerConfig): void;
4
+ private checkAppNameStartsWithNumber;
5
+ private validateOrigins;
4
6
  private checkIfDuplicateExists;
7
+ private hasPathCheck;
8
+ private hasProtocol;
5
9
  }
@@ -4,29 +4,40 @@ const tslib_1 = require("tslib");
4
4
  const origin_error_1 = tslib_1.__importDefault(require("../error/origin-error"));
5
5
  class CustomerConfigValidator {
6
6
  validate(config) {
7
- const withoutProtocol = config.origins.filter((origin) => !origin.startsWith("http"));
8
- // There was at least one origin not having a protocol => Do not allow creation of install resource.
9
- if (withoutProtocol.length > 0) {
10
- throw new origin_error_1.default({
11
- app: config.app,
12
- message: "There was at least one origin configured in the local customer_config.js not having a protocol.",
13
- });
7
+ if (this.checkAppNameStartsWithNumber(config)) {
8
+ throw new Error("appName can't start with a number");
14
9
  }
10
+ this.validateOrigins(config);
11
+ }
12
+ checkAppNameStartsWithNumber(config) {
13
+ return /^\d/.test(config.app);
14
+ }
15
+ validateOrigins(config) {
15
16
  if (config.origins.length === 0) {
16
- throw new origin_error_1.default({
17
- app: config.app,
18
- message: "No origins were found in local config_customer.js! Add origins and restart deploy!",
19
- });
17
+ throw new origin_error_1.default("No origins were found in local config_customer.js! Add origins and restart deploy!");
18
+ }
19
+ if (this.hasProtocol(config.origins)) {
20
+ throw new origin_error_1.default("There was at least one origin configured in the local customer_config.js not having a protocol.");
20
21
  }
21
22
  if (this.checkIfDuplicateExists(config.origins)) {
22
- throw new origin_error_1.default({
23
- app: config.app,
24
- message: "Duplicate origins found! Remove duplicates and restart deploy!",
25
- });
23
+ throw new origin_error_1.default("Duplicate origins found! Remove duplicates and restart deploy!");
26
24
  }
25
+ if (this.hasPathCheck(config.origins)) {
26
+ throw new origin_error_1.default("There was at least one origin having a path. Origin must have the following format: https://domain.tld");
27
+ }
28
+ }
29
+ checkIfDuplicateExists(origins) {
30
+ return new Set(origins).size !== origins.length;
31
+ }
32
+ hasPathCheck(origins) {
33
+ return origins.some((origin) => {
34
+ const countSlashes = origin.split("/").length - 1;
35
+ return countSlashes >= 3;
36
+ });
27
37
  }
28
- checkIfDuplicateExists(array) {
29
- return new Set(array).size !== array.length;
38
+ hasProtocol(origins) {
39
+ const withoutProtocol = origins.filter((origin) => !origin.startsWith("http"));
40
+ return withoutProtocol.length > 0;
30
41
  }
31
42
  }
32
43
  exports.default = CustomerConfigValidator;
@@ -0,0 +1,6 @@
1
+ import { VirtualFileRecipe } from "../integration-api-model";
2
+ export declare class StaticRecipe implements VirtualFileRecipe {
3
+ private content;
4
+ constructor(content: string);
5
+ createContent(): Promise<string>;
6
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StaticRecipe = void 0;
4
+ class StaticRecipe {
5
+ content;
6
+ constructor(content) {
7
+ this.content = content;
8
+ }
9
+ createContent() {
10
+ // @ts-expect-error is not a promise
11
+ return this.content;
12
+ }
13
+ }
14
+ exports.StaticRecipe = StaticRecipe;
@@ -16,12 +16,12 @@ class VirtualFileHandler {
16
16
  this.cli.write(`use localFile for ${fileName}`);
17
17
  continue;
18
18
  }
19
- this.cli.startAction(`get remote file ${fileName}`);
19
+ this.cli.startAction(`get content of virtualFile ${fileName}`);
20
20
  const virtualFile = new virtual_file_1.VirtualFile(fileName, fileConfig.recipe);
21
21
  const result = await (0, safe_1.safe)(virtualFile.buildContent());
22
22
  if (result.success === true) {
23
23
  if (fileList.hasFile(fileName) && fileConfig.overrideLocalFile) {
24
- this.cli.write(`use remoteFile for ${fileName}`);
24
+ this.cli.write(`use virtualFile for ${fileName}`);
25
25
  fileList.replace(virtualFile);
26
26
  }
27
27
  else {
@@ -1,7 +1,6 @@
1
1
  import { InstallSpeedKitJsTemplate } from "../templates/install-speed-kit-js-template";
2
- import CustomerConfig from "../../integration-api/struct/customer-config";
3
2
  import { BundleService } from "../../bundler";
4
- import { FileListInterface } from "../../integration-api/integration-api-model";
3
+ import { FileListInterface, CustomerConfig } from "../../integration-api";
5
4
  export declare class SpeedKitInstallContext {
6
5
  private customerConfig;
7
6
  private configName;
@@ -1,7 +1,7 @@
1
1
  import { BaqendResponse } from "../browser/baqend-response";
2
2
  import { Protocol } from "devtools-protocol";
3
3
  import { ParameterQueryBuilder } from "./parameter-query-builder";
4
- import CustomerConfig from "../../integration-api/struct/customer-config";
4
+ import { CustomerConfig } from "../../integration-api";
5
5
  import { RequestDiffService } from "./request-diff-service";
6
6
  import { Cache } from "../request-cache/cache";
7
7
  import { AthenaService } from "../../athena";
@@ -1,5 +1,4 @@
1
- import { ConfigFileInterface } from "../../integration-api/integration-api-model";
2
- import CustomerConfig from "../../integration-api/struct/customer-config";
1
+ import { CustomerConfig, ConfigFileInterface } from "../../integration-api";
3
2
  export declare class ParameterQueryBuilder {
4
3
  private customerConfig;
5
4
  private speedKitConfigFile;
@@ -2,7 +2,7 @@ import { FetchRequestPausedEventHandler } from "./onboarding-model";
2
2
  import { Protocol } from "puppeteer-core";
3
3
  import { CDPSession, Target } from "puppeteer";
4
4
  import { CliService } from "../cli";
5
- import CustomerConfig from "../integration-api/struct/customer-config";
5
+ import { CustomerConfig } from "../integration-api";
6
6
  import ConfigApiService from "../config-api/config-api-service";
7
7
  export declare class FetchEventHandler {
8
8
  private browserFetchEvents;
@@ -1,8 +1,7 @@
1
1
  import Protocol from "devtools-protocol";
2
2
  import { FetchRequestPausedEventHandler } from "../onboarding-model";
3
- import CustomerConfig from "../../integration-api/struct/customer-config";
3
+ import { CustomerConfig, ConfigFileInterface } from "../../integration-api";
4
4
  import { CDPSession } from "puppeteer";
5
- import { ConfigFileInterface } from "../../integration-api/integration-api-model";
6
5
  /**
7
6
  * Intercepts any request to the customersOrigin and equivalent requests to baqendAssetApi
8
7
  * @implements {FetchRequestPausedEventHandler}
@@ -1,6 +1,6 @@
1
1
  import Protocol from "devtools-protocol";
2
2
  import { FetchRequestPausedEventHandler } from "../onboarding-model";
3
- import CustomerConfig from "../../integration-api/struct/customer-config";
3
+ import { CustomerConfig } from "../../integration-api";
4
4
  /**
5
5
  * Intercepts request to /wrapper-sw.js
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import Protocol from "devtools-protocol";
2
2
  import { FetchRequestPausedEventHandler, SpeedKitServerConfig } from "../onboarding-model";
3
- import CustomerConfig from "../../integration-api/struct/customer-config";
3
+ import { CustomerConfig } from "../../integration-api";
4
4
  import { DocumentHandlerServer } from "../../document-handler-runtime/document-handler-server";
5
5
  import { AbortResponse } from "../browser/abort-response";
6
6
  import { Cache } from "../request-cache/cache";
@@ -1,6 +1,6 @@
1
1
  import Protocol from "devtools-protocol";
2
2
  import { BrowserContext, FetchRequestPausedEventHandler } from "../onboarding-model";
3
- import CustomerConfig from "../../integration-api/struct/customer-config";
3
+ import { CustomerConfig } from "../../integration-api";
4
4
  import { InstallSpeedKitHtmlTemplate } from "../templates/install-speed-kit-html-template";
5
5
  /**
6
6
  * Represents a class that handles the installation of Speed Kit HTML.
@@ -1,7 +1,6 @@
1
1
  import Protocol from "devtools-protocol";
2
2
  import { CDPSession } from "puppeteer";
3
- import CustomerConfig from "../../integration-api/struct/customer-config";
4
- import { VirtualFile } from "../../integration-api/struct/virtual-file";
3
+ import { CustomerConfig, VirtualFile } from "../../integration-api";
5
4
  import { AbortResponse } from "../browser/abort-response";
6
5
  import { FetchRequestPausedEventHandler } from "../onboarding-model";
7
6
  /**
@@ -1,7 +1,7 @@
1
1
  import { CDPSession } from "puppeteer";
2
2
  import { Protocol } from "puppeteer-core";
3
3
  import { CliService } from "../../cli";
4
- import CustomerConfig from "../../integration-api/struct/customer-config";
4
+ import { CustomerConfig } from "../../integration-api";
5
5
  import { AbortResponse } from "../browser/abort-response";
6
6
  import { FetchRequestPausedEventHandler } from "../onboarding-model";
7
7
  import { Cache } from "../request-cache/cache";