@speedkit/cli 2.18.0 → 2.19.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 (122) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +36 -5
  3. package/dist/commands/build-parameter-query.js +5 -5
  4. package/dist/commands/build-prewarm-query.js +4 -4
  5. package/dist/commands/{param-diff.d.ts → diff-url-parameters.d.ts} +3 -1
  6. package/dist/commands/{param-diff.js → diff-url-parameters.js} +26 -24
  7. package/dist/commands/find-pops.js +9 -9
  8. package/dist/commands/generate-customer-config.d.ts +1 -1
  9. package/dist/commands/generate-customer-config.js +7 -7
  10. package/dist/commands/generate-pop-config.js +2 -2
  11. package/dist/commands/login.js +5 -4
  12. package/dist/commands/pop-prewarm.d.ts +3 -3
  13. package/dist/commands/pop-prewarm.js +19 -16
  14. package/dist/commands/prewarm.js +10 -10
  15. package/dist/commands/wpt-launcher.d.ts +1 -1
  16. package/dist/commands/wpt-launcher.js +9 -9
  17. package/dist/helpers/build-query-helper.d.ts +3 -3
  18. package/dist/helpers/build-query-helper.js +70 -69
  19. package/dist/helpers/cli-config.js +6 -5
  20. package/dist/helpers/{CustomerConfig.d.ts → customer-config.d.ts} +6 -6
  21. package/dist/helpers/{CustomerConfig.js → customer-config.js} +39 -39
  22. package/dist/helpers/file-helper.d.ts +1 -1
  23. package/dist/helpers/file-helper.js +5 -5
  24. package/dist/helpers/{getChromePath.js → get-chrome-path.js} +8 -8
  25. package/dist/helpers/get-parsed-config.d.ts +1 -1
  26. package/dist/helpers/get-parsed-config.js +7 -7
  27. package/dist/helpers/is-directory.d.ts +1 -0
  28. package/dist/helpers/{isDirectory.js → is-directory.js} +6 -6
  29. package/dist/helpers/{isExecutable.js → is-executable.js} +3 -3
  30. package/dist/helpers/{isFile.js → is-file.js} +4 -4
  31. package/dist/helpers/logging-helper.d.ts +3 -3
  32. package/dist/helpers/logging-helper.js +6 -6
  33. package/dist/helpers/normalize.d.ts +6 -6
  34. package/dist/helpers/normalize.js +35 -33
  35. package/dist/helpers/safe.d.ts +1 -1
  36. package/dist/helpers/safe.js +12 -12
  37. package/dist/helpers/{speedKitRuleToRegExp.js → speed-kit-rule-to-reg-exp.js} +3 -3
  38. package/dist/helpers/{watchFiles.js → watch-files.js} +2 -2
  39. package/dist/models/cli-parameters.d.ts +3 -3
  40. package/dist/models/cli-parameters.js +3 -3
  41. package/dist/services/athena/athena-service.js +2 -2
  42. package/dist/services/bundler/bundle-service.js +14 -14
  43. package/dist/services/cli/cli-service.js +8 -4
  44. package/dist/services/cli/hooks.js +3 -3
  45. package/dist/services/config-api/client.js +7 -6
  46. package/dist/services/config-api/factory/config-api-service-factory.js +4 -4
  47. package/dist/services/config-api/factory/entity-manager-factory.js +1 -1
  48. package/dist/services/config-api-service.d.ts +1 -1
  49. package/dist/services/config-api-service.js +7 -7
  50. package/dist/services/customer-config/customer-config-service-context.d.ts +2 -2
  51. package/dist/services/customer-config/customer-config-service-context.js +4 -4
  52. package/dist/services/customer-config/customer-config-service.js +45 -44
  53. package/dist/services/deploy/builder/install-resource-builder.d.ts +2 -2
  54. package/dist/services/deploy/builder/install-resource-builder.js +7 -7
  55. package/dist/services/deploy/checks/post-deploy/revalidated-module-check.js +1 -1
  56. package/dist/services/deploy/checks/post-deploy/save-files-check.js +4 -4
  57. package/dist/services/deploy/deploy-service.js +2 -4
  58. package/dist/services/deploy/error/create-find-temporary-directory-error.d.ts +4 -0
  59. package/dist/services/deploy/error/{create-find-temp-directory-error.js → create-find-temporary-directory-error.js} +2 -2
  60. package/dist/services/deploy/handler/customer-config-handler.js +1 -1
  61. package/dist/services/deploy/handler/install-resource-handler.js +8 -11
  62. package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +2 -2
  63. package/dist/services/deploy/handler/module-handler.js +8 -8
  64. package/dist/services/deploy/handler/server-config-handler.js +4 -4
  65. package/dist/services/diff/diff-service.d.ts +2 -2
  66. package/dist/services/diff/diff-service.js +22 -22
  67. package/dist/services/diff-service.d.ts +1 -1
  68. package/dist/services/diff-service.js +13 -13
  69. package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +10 -8
  70. package/dist/services/document-handler-runtime/document-handler-runtime-service.js +10 -10
  71. package/dist/services/document-handler-runtime/document-handler-server.js +12 -12
  72. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +2 -2
  73. package/dist/services/document-handler-runtime/interface/template-interface.d.ts +2 -2
  74. package/dist/services/document-handler-runtime/interface/{template-param-interface.d.ts → template-parameter-interface.d.ts} +1 -1
  75. package/dist/services/document-handler-runtime/templates/abstract-template.d.ts +2 -2
  76. package/dist/services/document-handler-runtime/templates/abstract-template.js +3 -3
  77. package/dist/services/error-handling/factory/error-handling-factory.d.ts +1 -4
  78. package/dist/services/error-handling/factory/error-handling-factory.js +2 -1
  79. package/dist/services/integration-api/factory/integration-api-service-factory.js +1 -1
  80. package/dist/services/integration-api/file-list.js +4 -3
  81. package/dist/services/integration-api/file-reader.d.ts +1 -1
  82. package/dist/services/integration-api/file-reader.js +29 -26
  83. package/dist/services/integration-api/file-writer.js +3 -3
  84. package/dist/services/integration-api/handler/file-handler.js +1 -1
  85. package/dist/services/integration-api/handler/install-resource-handler.js +1 -1
  86. package/dist/services/integration-api/handler/module-handler.js +1 -1
  87. package/dist/services/integration-api/handler/server-config-handler.js +1 -1
  88. package/dist/services/integration-api/integration-api-service.js +2 -3
  89. package/dist/services/integration-api/struct/customer-config.d.ts +1 -1
  90. package/dist/services/integration-api/struct/customer-config.js +4 -4
  91. package/dist/services/integration-api/struct/file.js +1 -1
  92. package/dist/services/integration-api/validator/customer-config-validator.js +2 -2
  93. package/dist/services/integration-api/validator/mandatory-files-validator.js +7 -6
  94. package/dist/services/integration-api/virtual/external-recipe.js +2 -1
  95. package/dist/services/onboarding/browser/baqend-response.js +1 -2
  96. package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +1 -1
  97. package/dist/services/onboarding/dashboard/index.d.ts +3 -3
  98. package/dist/services/onboarding/dashboard/index.js +12 -12
  99. package/dist/services/onboarding/dashboard/{param-query-builder.d.ts → parameter-query-builder.d.ts} +1 -1
  100. package/dist/services/onboarding/dashboard/{param-query-builder.js → parameter-query-builder.js} +6 -6
  101. package/dist/services/onboarding/dashboard/request-diff-service.js +24 -22
  102. package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +8 -8
  103. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +7 -7
  104. package/dist/services/onboarding/onboarding-model.js +4 -4
  105. package/dist/services/onboarding/onboarding-service-factory.js +3 -3
  106. package/dist/services/onboarding/onboarding-service.js +2 -1
  107. package/dist/services/onboarding/todo-collector.js +1 -1
  108. package/dist/services/prewarm-service.d.ts +1 -1
  109. package/dist/services/prewarm-service.js +8 -7
  110. package/dist/services/pull/pull-service.js +2 -2
  111. package/oclif.manifest.json +45 -42
  112. package/package.json +2 -1
  113. package/dist/helpers/isDirectory.d.ts +0 -1
  114. package/dist/services/context/app-context.d.ts +0 -1
  115. package/dist/services/deploy/error/create-find-temp-directory-error.d.ts +0 -4
  116. package/dist/services/document-handler-runtime/interface/template-param-interface.js +0 -2
  117. /package/dist/helpers/{getChromePath.d.ts → get-chrome-path.d.ts} +0 -0
  118. /package/dist/helpers/{isExecutable.d.ts → is-executable.d.ts} +0 -0
  119. /package/dist/helpers/{isFile.d.ts → is-file.d.ts} +0 -0
  120. /package/dist/helpers/{speedKitRuleToRegExp.d.ts → speed-kit-rule-to-reg-exp.d.ts} +0 -0
  121. /package/dist/helpers/{watchFiles.d.ts → watch-files.d.ts} +0 -0
  122. /package/dist/services/{context/app-context.js → document-handler-runtime/interface/template-parameter-interface.js} +0 -0
@@ -27,10 +27,11 @@ const FILE_DEPENDENCIES = [
27
27
  ];
28
28
  class DocumentHandlerRuntimeContext {
29
29
  verboseLevel;
30
- fileDependencies = FILE_DEPENDENCIES.concat([
30
+ fileDependencies = [
31
+ ...FILE_DEPENDENCIES,
31
32
  exports.LOCAL_DOCUMENT_HANDLER,
32
33
  exports.LOCAL_DYNAMIC_FETCHER,
33
- ]);
34
+ ];
34
35
  customerPath;
35
36
  configName;
36
37
  testNames;
@@ -41,13 +42,14 @@ class DocumentHandlerRuntimeContext {
41
42
  this.customerPath = customerPath;
42
43
  this.testNames = testNames;
43
44
  let dependencies = [];
44
- if (this.testNames && this.testNames.length >= 1) {
45
- this.testNames.forEach((testName) => {
46
- dependencies = dependencies.concat([
45
+ if (this.testNames && this.testNames.length > 0) {
46
+ for (const testName of this.testNames) {
47
+ dependencies = [
48
+ ...dependencies,
47
49
  `${exports.TEST_FILE_NAME_PREFIX}-${testName}`,
48
- ]);
49
- });
50
- this.fileDependencies = this.fileDependencies.concat(dependencies);
50
+ ];
51
+ }
52
+ this.fileDependencies = [...this.fileDependencies, ...dependencies];
51
53
  }
52
54
  this.requiredFiles = [
53
55
  exports.CUSTOMER_CONFIG,
@@ -68,16 +68,16 @@ class DocumentHandlerRuntimeService {
68
68
  this.cli.write("3. debug current file with intellij");
69
69
  }
70
70
  async createDocumentHandlerFile() {
71
- const docHandler = await this.getDocumentHandler();
72
- const docHandlerConfig = this.getDocumentHandlerConfig()
71
+ const documentHandler = await this.getDocumentHandler();
72
+ const documentHandlerConfig = this.getDocumentHandlerConfig()
73
73
  .replace("APP", this.escapeFileContent(this.customerConfig.app))
74
74
  .replace("DYNAMIC_FETCHER", await this.getDynamicFetcher())
75
75
  .replace("DYNAMIC_FETCHER_CONFIG", this.getDynamicFetcherConfig())
76
76
  .replace("CUSTOM_STYLES", this.getStyles())
77
77
  .replace(this.getConfigTransformSearchTemplate(), this.getConfigTransformReplaceTemplate());
78
78
  const file = this.getTestDocHandlerFile();
79
- const isNew = file.getContent().length < 1;
80
- file.setContent(`${this.getSeparator("Context")} ${this.getContextVars()} ${docHandler} ${this.getSeparator("start config_documentHandler")} ${docHandlerConfig}`);
79
+ const isNew = file.getContent().length === 0;
80
+ file.setContent(`${this.getSeparator("Context")} ${this.getContextVars()} ${documentHandler} ${this.getSeparator("start config_documentHandler")} ${documentHandlerConfig}`);
81
81
  await file.updateFile();
82
82
  this.cli.writeSuccess(`${isNew ? "created" : "updated"} documentHandler from config`);
83
83
  }
@@ -179,25 +179,25 @@ class DocumentHandlerRuntimeService {
179
179
  return this.escapeFileContent(this.files.getByName(document_handler_runtime_context_1.LOCAL_STYLES).getContent());
180
180
  }
181
181
  getDocumentHandlerConfig() {
182
- const docHandlerFile = this.files.getByName(document_handler_runtime_context_1.LOCAL_DOCUMENT_HANDLER_CONFIG);
183
- if (!docHandlerFile) {
182
+ const documentHandlerFile = this.files.getByName(document_handler_runtime_context_1.LOCAL_DOCUMENT_HANDLER_CONFIG);
183
+ if (!documentHandlerFile) {
184
184
  throw new required_file_not_found_error_1.default({
185
185
  message: `file ${document_handler_runtime_context_1.LOCAL_DOCUMENT_HANDLER_CONFIG} not found`,
186
186
  });
187
187
  }
188
- return docHandlerFile.getContent();
188
+ return documentHandlerFile.getContent();
189
189
  }
190
190
  getTestDocHandlerFile() {
191
191
  return this.files.getByName(document_handler_runtime_context_1.TEST_DOCUMENT_HANDLER_FILE_NAME);
192
192
  }
193
193
  escapeFileContent(content) {
194
194
  const escapedContent = content
195
- .replace(/\$\{/g, "\\${")
196
- .replace(/`/g, "\\`");
195
+ .replaceAll("${", "\\${")
196
+ .replaceAll("`", "\\`");
197
197
  return `\`${escapedContent}\``;
198
198
  }
199
199
  escapeFileContent2(content) {
200
- const escapedContent = content.replace(/'/g, "\\'");
200
+ const escapedContent = content.replaceAll("'", "\\'");
201
201
  return `'${escapedContent}'`;
202
202
  }
203
203
  getContextVars() {
@@ -5,9 +5,9 @@ const tslib_1 = require("tslib");
5
5
  const document_handler_runtime_context_1 = require("./context/document-handler-runtime-context");
6
6
  const required_file_not_found_error_1 = tslib_1.__importDefault(require("./error/required-file-not-found-error"));
7
7
  const database_mock_1 = tslib_1.__importDefault(require("./templates/database-mock"));
8
- const vm = tslib_1.__importStar(require("vm"));
8
+ const vm = tslib_1.__importStar(require("node:vm"));
9
9
  const vm_error_1 = require("../onboarding/error/vm-error");
10
- const path_1 = tslib_1.__importDefault(require("path"));
10
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
11
11
  const files_1 = require("../../models/files");
12
12
  // documentHandlerDependencies
13
13
  const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
@@ -76,9 +76,9 @@ class DocumentHandlerServer {
76
76
  this.cli.writeSuccess("rebuild documentHandler");
77
77
  }
78
78
  async createDocumentHandlerFile() {
79
- const docHandler = await this.getDocumentHandler();
80
- const docHandlerConfig = this.getDocumentHandlerConfig().replace("export const post", "const post");
81
- return `${this.getContextVars()} ${docHandler} ${docHandlerConfig}`;
79
+ const documentHandler = await this.getDocumentHandler();
80
+ const documentHandlerConfig = this.getDocumentHandlerConfig().replace("export const post", "const post");
81
+ return `${this.getContextVars()} ${documentHandler} ${documentHandlerConfig}`;
82
82
  }
83
83
  async getDocumentHandler() {
84
84
  return this.files
@@ -104,13 +104,13 @@ class DocumentHandlerServer {
104
104
  return this.files.getByName(document_handler_runtime_context_1.LOCAL_STYLES).getContent();
105
105
  }
106
106
  getDocumentHandlerConfig() {
107
- const docHandlerFile = this.files.getByName(document_handler_runtime_context_1.LOCAL_DOCUMENT_HANDLER_CONFIG);
108
- if (!docHandlerFile) {
107
+ const documentHandlerFile = this.files.getByName(document_handler_runtime_context_1.LOCAL_DOCUMENT_HANDLER_CONFIG);
108
+ if (!documentHandlerFile) {
109
109
  throw new required_file_not_found_error_1.default({
110
110
  message: `file ${document_handler_runtime_context_1.LOCAL_DOCUMENT_HANDLER_CONFIG} not found`,
111
111
  });
112
112
  }
113
- return docHandlerFile.getContent();
113
+ return documentHandlerFile.getContent();
114
114
  }
115
115
  getContextVars() {
116
116
  let template = "";
@@ -139,9 +139,9 @@ class DocumentHandlerServer {
139
139
  };
140
140
  if (!this.database) {
141
141
  const dataBaseMock = new database_mock_1.default();
142
- const dbCode = dataBaseMock.render(dataBaseMock.buildContext(this.customerConfig.origins[0], this.customerConfig.app));
142
+ const databaseCode = dataBaseMock.render(dataBaseMock.buildContext(this.customerConfig.origins[0], this.customerConfig.app));
143
143
  const vmContext = { console: vmConsole, module: { exports: {} } };
144
- vm.runInNewContext(dbCode, vmContext);
144
+ vm.runInNewContext(databaseCode, vmContext);
145
145
  this.database = vmContext.module.exports;
146
146
  }
147
147
  return this.database;
@@ -167,8 +167,8 @@ class DocumentHandlerServer {
167
167
  if (module.includes("fetch")) {
168
168
  return this.createFetchMock();
169
169
  }
170
- const fileExtension = path_1.default.extname(module);
171
- const moduleFileName = path_1.default.basename(module, fileExtension);
170
+ const fileExtension = node_path_1.default.extname(module);
171
+ const moduleFileName = node_path_1.default.basename(module, fileExtension);
172
172
  if (this.files.hasFile(moduleFileName)) {
173
173
  const vmContext = {
174
174
  module: { exports: {} },
@@ -52,13 +52,13 @@ class DocumentHandlerRuntimeServiceFactory extends abstract_async_error_handling
52
52
  return await integrationApi.run();
53
53
  }
54
54
  checkRequiredFiles(files) {
55
- this.context.requiredFiles.forEach((requiredFile) => {
55
+ for (const requiredFile of this.context.requiredFiles) {
56
56
  if (!files.hasFile(requiredFile)) {
57
57
  throw new required_file_not_found_error_1.default({
58
58
  message: `file ${requiredFile} not found`,
59
59
  });
60
60
  }
61
- });
61
+ }
62
62
  }
63
63
  createNeededFolderStructure(integrationApi) {
64
64
  integrationApi.createFolder(".local");
@@ -1,6 +1,6 @@
1
- import TemplateParam from "./template-param-interface";
1
+ import TemplateParameter from "./template-parameter-interface";
2
2
  import TemplateContextInterface from "./template-context-interface";
3
3
  export default interface TemplateInterface {
4
- _buildContext(...params: TemplateParam[]): TemplateContextInterface;
4
+ _buildContext(...parameters: TemplateParameter[]): TemplateContextInterface;
5
5
  render(context: TemplateContextInterface): string;
6
6
  }
@@ -1,4 +1,4 @@
1
- export default interface TemplateParam {
1
+ export default interface TemplateParameter {
2
2
  key: string;
3
3
  value: string | number | object;
4
4
  }
@@ -1,9 +1,9 @@
1
1
  import TemplateInterface from "../interface/template-interface";
2
- import TemplateParam from "../interface/template-param-interface";
2
+ import TemplateParameter from "../interface/template-parameter-interface";
3
3
  import TemplateContextInterface from "../interface/template-context-interface";
4
4
  import { Template } from "handlebars";
5
5
  export default abstract class AbstractTemplate implements TemplateInterface {
6
- _buildContext(...params: TemplateParam[]): TemplateContextInterface;
6
+ _buildContext(...parameters: TemplateParameter[]): TemplateContextInterface;
7
7
  render(context: TemplateContextInterface): string;
8
8
  protected abstract getTemplate(): Template;
9
9
  }
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const handlebars_1 = tslib_1.__importDefault(require("handlebars"));
5
5
  class AbstractTemplate {
6
- _buildContext(...params) {
6
+ _buildContext(...parameters) {
7
7
  const context = {};
8
- params.forEach(({ key, value }) => {
8
+ for (const { key, value } of parameters) {
9
9
  context[key] = value;
10
- });
10
+ }
11
11
  return context;
12
12
  }
13
13
  render(context) {
@@ -1,8 +1,5 @@
1
1
  import ErrorHandlingService from "../error-handling-service";
2
- import CustomerConfigLegacyHandler from "../../integration-api/error/handler/customer-config-legacy-handler";
3
- import OriginHandler from "../../integration-api/error/handler/origin-handler";
4
- import { CustomerConfigHandler } from "../../integration-api/error/handler/customer-config-handler";
5
2
  export default class ErrorHandlingFactory {
6
3
  buildService(): ErrorHandlingService;
7
- importHandlers(): (CustomerConfigLegacyHandler | OriginHandler | CustomerConfigHandler)[];
4
+ importHandlers(): import("../interface/error-handler-interface").default[];
8
5
  }
@@ -15,7 +15,8 @@ class ErrorHandlingFactory {
15
15
  new customer_config_legacy_handler_1.default(),
16
16
  new origin_handler_1.default(),
17
17
  new customer_config_handler_1.CustomerConfigHandler(),
18
- ].concat(document_handler_runtime_service_factory_1.default.getErrorHandlers());
18
+ ...document_handler_runtime_service_factory_1.default.getErrorHandlers(),
19
+ ];
19
20
  }
20
21
  }
21
22
  exports.default = ErrorHandlingFactory;
@@ -43,7 +43,7 @@ class IntegrationApiServiceFactory {
43
43
  new install_resource_handler_1.default(fileReader),
44
44
  new server_config_handler_1.default(fileReader),
45
45
  new module_handler_1.default(fileReader),
46
- ], new file_writer_1.default(this.context.basePath), this.context.whiteList.length < 1);
46
+ ], new file_writer_1.default(this.context.basePath), this.context.whiteList.length === 0);
47
47
  }
48
48
  getFileReader() {
49
49
  if (!this.fileReader) {
@@ -55,16 +55,17 @@ class FileList {
55
55
  });
56
56
  }
57
57
  getByName(name) {
58
- const files = this.files.filter((file) => {
58
+ const file_ = this.files.find((file) => {
59
59
  return file.name === name;
60
60
  });
61
- return files[0];
61
+ return file_;
62
62
  }
63
63
  filter(callback) {
64
64
  this.files = this.files.filter((file) => callback(file));
65
65
  }
66
66
  concat(fileList) {
67
- fileList.files.forEach((file) => this.files.push(file));
67
+ for (const file of fileList.files)
68
+ this.files.push(file);
68
69
  }
69
70
  replace(replaceWith) {
70
71
  const files = [];
@@ -5,7 +5,7 @@ export default class FileReader {
5
5
  private readonly blockedFolders;
6
6
  allowedExtensions: string[];
7
7
  constructor(configName: string, basePath: string, whiteList?: string[], blockedFolders?: string[]);
8
- getFileList(dirName?: string): Promise<string[]>;
8
+ getFileList(directoryName?: string): Promise<string[]>;
9
9
  getContent(path: string): Promise<string>;
10
10
  isAllowedFolder(folderName: string): boolean;
11
11
  isAllowedFile(fileName: string): boolean;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const fs_1 = require("fs");
5
- const path_1 = tslib_1.__importDefault(require("path"));
6
- const promises_1 = require("fs/promises");
4
+ const node_fs_1 = require("node:fs");
5
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
6
+ const promises_1 = require("node:fs/promises");
7
7
  const CUSTOMER_CONFIG_FILE = "config_customer";
8
8
  const DEFAULT_ENV = "production";
9
9
  class FileReader {
@@ -18,21 +18,23 @@ class FileReader {
18
18
  this.whiteList = whiteList;
19
19
  this.blockedFolders = blockedFolders;
20
20
  }
21
- async getFileList(dirName = this.basePath) {
21
+ async getFileList(directoryName = this.basePath) {
22
22
  let files = [];
23
- const items = await fs_1.promises.readdir(dirName, { withFileTypes: true });
23
+ const items = await node_fs_1.promises.readdir(directoryName, {
24
+ withFileTypes: true,
25
+ });
24
26
  for (const item of items) {
25
27
  if (item.isDirectory()) {
26
28
  if (this.isAllowedFolder(item.name)) {
27
29
  files = [
28
30
  ...files,
29
- ...(await this.getFileList(path_1.default.resolve(dirName, item.name))),
31
+ ...(await this.getFileList(node_path_1.default.resolve(directoryName, item.name))),
30
32
  ];
31
33
  }
32
34
  continue;
33
35
  }
34
36
  if (this.isAllowedFile(item.name)) {
35
- files.push(path_1.default.resolve(dirName, item.name));
37
+ files.push(node_path_1.default.resolve(directoryName, item.name));
36
38
  }
37
39
  }
38
40
  return this.mapEnvironment(files);
@@ -47,8 +49,7 @@ class FileReader {
47
49
  }
48
50
  isAllowedFile(fileName) {
49
51
  const extension = this.getFileExtension(fileName);
50
- return (this.allowedExtensions.indexOf(extension) !== -1 &&
51
- this.isWhiteListed(fileName));
52
+ return (this.allowedExtensions.includes(extension) && this.isWhiteListed(fileName));
52
53
  }
53
54
  getFileExtension(fileName) {
54
55
  return fileName.slice(((fileName.lastIndexOf(".") - 1) >>> 0) + 2);
@@ -67,33 +68,35 @@ class FileReader {
67
68
  });
68
69
  }
69
70
  mapEnvironment(fileList) {
70
- const envFileList = {};
71
+ const environmentFileList = {};
71
72
  // create mapped object with all environment versions of a file
72
- for (let index = 0; index < fileList.length; index++) {
73
- const shortFileName = path_1.default.basename(fileList[index]);
74
- const fullFileName = fileList[index];
73
+ for (const fullFileName of fileList) {
74
+ const shortFileName = node_path_1.default.basename(fullFileName);
75
75
  const fileName = shortFileName.split(".").slice(0, -1).join(".");
76
- let env = fileName.split(".").pop();
77
- if (env === fileName) {
78
- env = DEFAULT_ENV;
76
+ let environment = fileName.split(".").pop();
77
+ if (environment === fileName) {
78
+ environment = DEFAULT_ENV;
79
79
  }
80
- const fileKey = env === DEFAULT_ENV
80
+ const fileKey = environment === DEFAULT_ENV
81
81
  ? fileName
82
82
  : fileName.split(".").slice(0, -1).join(".");
83
- envFileList[fileKey] = { ...envFileList[fileKey], [env]: fullFileName };
83
+ environmentFileList[fileKey] = {
84
+ ...environmentFileList[fileKey],
85
+ [environment]: fullFileName,
86
+ };
84
87
  }
85
88
  // map object to current environment with fallback on production
86
- return Array.from(Object.values(envFileList))
87
- .map((envFile) => {
88
- if (this.configName in envFile) {
89
- return envFile[this.configName];
89
+ return Object.values(environmentFileList)
90
+ .map((environmentFile) => {
91
+ if (this.configName in environmentFile) {
92
+ return environmentFile[this.configName];
90
93
  }
91
- if (DEFAULT_ENV in envFile) {
92
- return envFile[DEFAULT_ENV];
94
+ if (DEFAULT_ENV in environmentFile) {
95
+ return environmentFile[DEFAULT_ENV];
93
96
  }
94
97
  // if no env was found return original fileName
95
- for (const key in envFile) {
96
- return envFile[key];
98
+ for (const key in environmentFile) {
99
+ return environmentFile[key];
97
100
  }
98
101
  })
99
102
  .filter((value) => !!value);
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const node_fs_1 = require("node:fs");
5
- const path_1 = tslib_1.__importDefault(require("path"));
5
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
6
6
  class FileWriter {
7
7
  basePath;
8
8
  constructor(basePath) {
@@ -12,7 +12,7 @@ class FileWriter {
12
12
  (0, node_fs_1.writeFileSync)(this.getPath(fileName, extension), content);
13
13
  }
14
14
  mkdir(directoryPath) {
15
- (0, node_fs_1.mkdirSync)(path_1.default.resolve(this.basePath, directoryPath), { recursive: true });
15
+ (0, node_fs_1.mkdirSync)(node_path_1.default.resolve(this.basePath, directoryPath), { recursive: true });
16
16
  }
17
17
  hasFile(fileName, extension) {
18
18
  return (0, node_fs_1.existsSync)(this.getPath(fileName, extension));
@@ -21,7 +21,7 @@ class FileWriter {
21
21
  (0, node_fs_1.unlinkSync)(this.getPath(fileName, extension));
22
22
  }
23
23
  getPath(fileName, extension) {
24
- return path_1.default.resolve(this.basePath, `${fileName}.${extension}`);
24
+ return node_path_1.default.resolve(this.basePath, `${fileName}.${extension}`);
25
25
  }
26
26
  }
27
27
  exports.default = FileWriter;
@@ -10,7 +10,7 @@ class FileHandler {
10
10
  }
11
11
  getFileName(path) {
12
12
  let fileName = path
13
- .replace(/^.*[\\/]/, "")
13
+ .replace(/^.*[/\\]/, "")
14
14
  .split(".")
15
15
  .slice(0, -1)
16
16
  .join(".");
@@ -29,7 +29,7 @@ class InstallResourceHandler extends file_handler_1.default {
29
29
  config_dynamicStyles: "customStyle",
30
30
  };
31
31
  canHandle(filePath) {
32
- return this.allowedFiles.indexOf(this.getFileName(filePath)) !== -1;
32
+ return this.allowedFiles.includes(this.getFileName(filePath));
33
33
  }
34
34
  async handle(filePath) {
35
35
  const fileName = this.getFileName(filePath);
@@ -11,7 +11,7 @@ class ModuleHandler extends file_handler_1.default {
11
11
  * @param filePath
12
12
  */
13
13
  canHandle(filePath) {
14
- return this.blackList.indexOf(this.getFileName(filePath)) === -1;
14
+ return !this.blackList.includes(this.getFileName(filePath));
15
15
  }
16
16
  async handle(filePath) {
17
17
  return new module_file_1.default(this.getFileName(filePath), filePath, await this.fileReader.getContent(filePath), module_file_1.default);
@@ -6,7 +6,7 @@ const server_config_file_1 = tslib_1.__importDefault(require("../struct/server-c
6
6
  class ServerConfigHandler extends file_handler_1.default {
7
7
  allowedFiles = ["orestes_config"];
8
8
  canHandle(filePath) {
9
- return this.allowedFiles.indexOf(this.getFileName(filePath)) !== -1;
9
+ return this.allowedFiles.includes(this.getFileName(filePath));
10
10
  }
11
11
  async handle(filePath) {
12
12
  const fileContent = await this.fileReader.getContent(filePath);
@@ -36,8 +36,7 @@ class IntegrationApiService {
36
36
  async collectFiles() {
37
37
  const files = await this.fileReader.getFileList();
38
38
  const fileList = new file_list_1.default();
39
- for (let iteration = 0; iteration < files.length; iteration++) {
40
- const file = files[iteration];
39
+ for (const file of files) {
41
40
  fileList.addFile(await this.processFile(file));
42
41
  }
43
42
  if (this.shouldValidate) {
@@ -53,7 +52,7 @@ class IntegrationApiService {
53
52
  return await handler.handle(file);
54
53
  }
55
54
  }
56
- throw Error(`No handler found for file: ${file}`);
55
+ throw new Error(`No handler found for file: ${file}`);
57
56
  }
58
57
  filterFilesToProcess(fileList) {
59
58
  fileList.filter((file) => {
@@ -15,7 +15,7 @@ export default class CustomerConfig {
15
15
  };
16
16
  readonly skCliPre?: string;
17
17
  readonly skCliPost?: string;
18
- constructor(app: string, origins: string[], domain: string, swPath: string, scope: string, appDomain?: string, installPath?: string, installParams?: string, name?: string, forceInstall?: boolean, chromeFlags?: string[], dependencies?: {
18
+ 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
19
  [dependency: string]: string;
20
20
  }, skCliPre?: string, skCliPost?: string);
21
21
  static createFrom(configFile: any, configName?: string): CustomerConfig;
@@ -17,7 +17,7 @@ class CustomerConfig {
17
17
  dependencies;
18
18
  skCliPre;
19
19
  skCliPost;
20
- constructor(app, origins, domain, swPath, scope, appDomain, installPath, installParams, name, forceInstall, chromeFlags, dependencies, skCliPre, skCliPost) {
20
+ constructor(app, origins, domain, swPath, scope, appDomain, installPath, installParameters, name, forceInstall, chromeFlags, dependencies, skCliPre, skCliPost) {
21
21
  this.app = app;
22
22
  this.origins = origins;
23
23
  this.domain = domain;
@@ -25,7 +25,7 @@ class CustomerConfig {
25
25
  this.scope = scope;
26
26
  this.appDomain = appDomain;
27
27
  this.installPath = installPath;
28
- this.installParams = installParams;
28
+ this.installParams = installParameters;
29
29
  this.name = name;
30
30
  this.forceInstall = forceInstall;
31
31
  this.chromeFlags = chromeFlags;
@@ -35,12 +35,12 @@ class CustomerConfig {
35
35
  }
36
36
  static createFrom(configFile, configName) {
37
37
  const { app, origins, domain, swPath, scope, appDomain, installPath, installParams, name, forceInstall, chromeFlags, dependencies, skCliPre, skCliPost, } = configFile;
38
- return new CustomerConfig(new RequiredParam("app", app).isString().getValue(), new RequiredParam("origins", origins).isArray().getValue(), new RequiredParam("domain", domain).isString().getValue(), new RequiredParam("swPath", swPath).isString().getValue(), new RequiredParam("scope", scope).isString().getValue(), appDomain || `${app}.app.baqend.com`, installPath ||
38
+ 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
39
  `https://${app}.app.baqend.com/v1/speedkit/install.js?d=${name || configName}`, installParams || 'async="" crossorigin="anonymous"', name, forceInstall, chromeFlags, dependencies, skCliPre, skCliPost);
40
40
  }
41
41
  }
42
42
  exports.default = CustomerConfig;
43
- class RequiredParam {
43
+ class RequiredParameter {
44
44
  key;
45
45
  value;
46
46
  constructor(key, value) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const promises_1 = require("node:fs/promises");
4
- const promises_2 = require("fs/promises");
4
+ const promises_2 = require("node:fs/promises");
5
5
  class File {
6
6
  name;
7
7
  path;
@@ -25,8 +25,8 @@ class CustomerConfigValidator {
25
25
  });
26
26
  }
27
27
  }
28
- checkIfDuplicateExists(arr) {
29
- return new Set(arr).size !== arr.length;
28
+ checkIfDuplicateExists(array) {
29
+ return new Set(array).size !== array.length;
30
30
  }
31
31
  }
32
32
  exports.default = CustomerConfigValidator;
@@ -15,26 +15,27 @@ class MandatoryFilesValidator {
15
15
  },
16
16
  };
17
17
  validate(files) {
18
- this.mandatoryFilesConfig.required.forEach((fileName) => {
18
+ for (const fileName of this.mandatoryFilesConfig.required) {
19
19
  if (!files.hasFile(fileName)) {
20
20
  throw new mandatory_file_missing_error_1.default(fileName);
21
21
  }
22
- });
22
+ }
23
23
  this.validateConditionally(files);
24
24
  }
25
25
  validateConditionally(files) {
26
26
  let hasRequiredFiles = true;
27
- this.mandatoryFilesConfig.conditionallyRequired.this.forEach((fileName) => {
27
+ for (const fileName of this.mandatoryFilesConfig.conditionallyRequired
28
+ .this) {
28
29
  if (!files.hasFile(fileName)) {
29
30
  hasRequiredFiles = false;
30
31
  }
31
- });
32
+ }
32
33
  let hasConditionallyRequiredFiles = true;
33
- this.mandatoryFilesConfig.conditionallyRequired.or.forEach((fileName) => {
34
+ for (const fileName of this.mandatoryFilesConfig.conditionallyRequired.or) {
34
35
  if (!files.hasFile(fileName)) {
35
36
  hasConditionallyRequiredFiles = false;
36
37
  }
37
- });
38
+ }
38
39
  if (!hasRequiredFiles && !hasConditionallyRequiredFiles) {
39
40
  throw new Error(`Please implement ${this.mandatoryFilesConfig.conditionallyRequired.this.join(", ")} or ${this.mandatoryFilesConfig.conditionallyRequired.or.join(", ")}`);
40
41
  }
@@ -11,7 +11,8 @@ class ExternalRecipe {
11
11
  }
12
12
  async createContent() {
13
13
  if (!this.content) {
14
- this.content = (await this.externalFileReader.load(this.filePath)).getContent();
14
+ const file = await this.externalFileReader.load(this.filePath);
15
+ this.content = file.getContent();
15
16
  }
16
17
  return this.content;
17
18
  }
@@ -53,8 +53,7 @@ class BaqendResponse {
53
53
  if (!headers?.find((o) => o.name === "Content-Type")) {
54
54
  headers.push({ name: "Content-Type", value: String(this.contentType) });
55
55
  }
56
- headers.push({ name: "via", value: "sk-onboarding" });
57
- headers.push({ name: "Service-Worker-Allowed", value: "/" });
56
+ headers.push({ name: "via", value: "sk-onboarding" }, { name: "Service-Worker-Allowed", value: "/" });
58
57
  return headers;
59
58
  }
60
59
  }
@@ -59,7 +59,7 @@ class SpeedKitInstallContext {
59
59
  return configString;
60
60
  }
61
61
  if (configString.includes("delayRacedOrigin")) {
62
- return configString.replace(/delayRacedOrigin:[^,|\d](\d*)[^,]*,/, (config, value) => {
62
+ return configString.replace(/delayRacedOrigin:[^\d,|](\d*)[^,]*,/, (config, value) => {
63
63
  return config.replace(value, "100");
64
64
  });
65
65
  }
@@ -1,17 +1,17 @@
1
1
  import { BaqendResponse } from "../browser/baqend-response";
2
2
  import { Protocol } from "devtools-protocol";
3
- import { ParamQueryBuilder } from "./param-query-builder";
3
+ import { ParameterQueryBuilder } from "./parameter-query-builder";
4
4
  import CustomerConfig from "../../integration-api/struct/customer-config";
5
5
  import { RequestDiffService } from "./request-diff-service";
6
6
  import { Cache } from "../request-cache/cache";
7
7
  import { AthenaService } from "../../athena";
8
8
  export declare class Dashboard {
9
9
  private customerConfig;
10
- private paramQueryBuilder;
10
+ private parameterQueryBuilder;
11
11
  private athenaClient;
12
12
  private requestDiffService;
13
13
  private cache;
14
14
  private athenaLastResult;
15
- constructor(customerConfig: CustomerConfig, paramQueryBuilder: ParamQueryBuilder, athenaClient: AthenaService, requestDiffService: RequestDiffService, cache: Cache);
15
+ constructor(customerConfig: CustomerConfig, parameterQueryBuilder: ParameterQueryBuilder, athenaClient: AthenaService, requestDiffService: RequestDiffService, cache: Cache);
16
16
  getResponse(request: Protocol.Network.Request): Promise<BaqendResponse>;
17
17
  }