@speedkit/cli 2.38.0 → 2.40.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 (58) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +21 -5
  3. package/dist/commands/build-parameter-query.d.ts +1 -1
  4. package/dist/commands/build-prewarm-query.d.ts +1 -1
  5. package/dist/commands/config/edit.d.ts +6 -0
  6. package/dist/commands/config/edit.js +23 -0
  7. package/dist/commands/deploy.d.ts +1 -1
  8. package/dist/commands/document-handler.d.ts +1 -1
  9. package/dist/commands/find-pops.js +0 -1
  10. package/dist/commands/onboarding.d.ts +1 -1
  11. package/dist/commands/onboarding.js +1 -1
  12. package/dist/commands/prewarm.d.ts +1 -1
  13. package/dist/commands/pull.d.ts +1 -1
  14. package/dist/dummy.spec.js +2 -3
  15. package/dist/helpers/build-query-helper.js +5 -6
  16. package/dist/helpers/file-helper.js +2 -3
  17. package/dist/helpers/get-parsed-config.js +3 -4
  18. package/dist/helpers/is-directory.js +1 -2
  19. package/dist/helpers/is-file.js +1 -2
  20. package/dist/helpers/logging-helper.js +3 -4
  21. package/dist/helpers/normalize.d.ts +0 -1
  22. package/dist/helpers/normalize.js +4 -5
  23. package/dist/helpers/race.js +1 -2
  24. package/dist/helpers/safe.js +1 -2
  25. package/dist/helpers/scrape.js +1 -1
  26. package/dist/helpers/speed-kit-rule-to-reg-exp.js +1 -2
  27. package/dist/models/cli-parameters.d.ts +1 -1
  28. package/dist/services/athena/athena-service-factory.js +1 -1
  29. package/dist/services/athena/athena-service.d.ts +3 -1
  30. package/dist/services/athena/athena-service.js +14 -2
  31. package/dist/services/config-api-service.d.ts +1 -1
  32. package/dist/services/config-api-service.js +1 -0
  33. package/dist/services/integration-api/file-reader.d.ts +0 -1
  34. package/dist/services/onboarding/browser/extension/devtools-extension-api.d.ts +7 -0
  35. package/dist/services/onboarding/browser/extension/devtools-extension-api.js +16 -0
  36. package/dist/services/onboarding/browser/extension/extension-validator.d.ts +10 -0
  37. package/dist/services/onboarding/browser/extension/extension-validator.js +71 -0
  38. package/dist/services/onboarding/dashboard/index.d.ts +1 -0
  39. package/dist/services/onboarding/dashboard/index.js +23 -22
  40. package/dist/services/onboarding/dashboard/request-diff-service.d.ts +2 -1
  41. package/dist/services/onboarding/dashboard/request-diff-service.js +34 -6
  42. package/dist/services/onboarding/error/browser-extension-error.d.ts +5 -0
  43. package/dist/services/onboarding/error/browser-extension-error.js +12 -0
  44. package/dist/services/onboarding/fetch-event-handler.js +13 -14
  45. package/dist/services/onboarding/onboarding-model.d.ts +33 -3
  46. package/dist/services/onboarding/onboarding-model.js +32 -5
  47. package/dist/services/onboarding/onboarding-service-factory.d.ts +1 -0
  48. package/dist/services/onboarding/onboarding-service-factory.js +22 -4
  49. package/dist/services/onboarding/onboarding-service.d.ts +3 -3
  50. package/dist/services/onboarding/onboarding-service.js +35 -30
  51. package/dist/services/onboarding/todo-collector.d.ts +2 -2
  52. package/dist/services/onboarding/todo-collector.js +1 -1
  53. package/dist/services/prewarm/assets/asset-api-client.js +0 -1
  54. package/oclif.manifest.json +25 -1
  55. package/package.json +19 -19
  56. package/dist/services/onboarding/dashboard/frontend-dist/assets/index-e3bd4f6e.css +0 -1
  57. package/dist/services/onboarding/dashboard/frontend-dist/assets/main-215271c2.js +0 -9
  58. package/dist/services/onboarding/dashboard/frontend-dist/index.html +0 -18
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ # [2.40.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.39.0...v2.40.0) (2024-07-05)
2
+
3
+
4
+ ### Features
5
+
6
+ * **config:** add a command to easily edit cliConfigFile ([0094337](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/00943377f5b9d88d7d8da7c9ed90a88bfc43a6d8))
7
+
8
+ # [2.39.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.38.0...v2.39.0) (2024-07-05)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * failing tests ([9ebe257](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/9ebe25764f56e3b92881cb0b1d72b176a4297d6a))
14
+
15
+
16
+ ### Features
17
+
18
+ * **diffservice:** set speedKitUserAgent ([594acc8](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/594acc8578bfb6a65e78b487aaeceb9de88af44c))
19
+ * **onboarding:** fix bug - context not found ([8dde2e9](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/8dde2e9f83d02121e3ef7e160e5d736eb7c834dd))
20
+ * **onboarding:** integrate devtools ([d9ccfb8](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/d9ccfb8f1b0371f9ea6650646dc634b9e1241dd6))
21
+ * **onboarding:** reenable auth ([04a761f](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/04a761ff8321724594624dbee81dc7a19de69008))
22
+
1
23
  # [2.38.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.37.0...v2.38.0) (2024-07-04)
2
24
 
3
25
 
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @speedkit/cli
21
21
  $ sk COMMAND
22
22
  running command...
23
23
  $ sk (--version)
24
- @speedkit/cli/2.38.0 linux-x64 node-v20.15.0
24
+ @speedkit/cli/2.40.0 linux-x64 node-v20.15.0
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -68,6 +68,7 @@ By either...
68
68
  * [`sk autocomplete [SHELL]`](#sk-autocomplete-shell)
69
69
  * [`sk build-parameter-query CUSTOMERPATH`](#sk-build-parameter-query-customerpath)
70
70
  * [`sk build-prewarm-query CUSTOMERPATH`](#sk-build-prewarm-query-customerpath)
71
+ * [`sk config edit`](#sk-config-edit)
71
72
  * [`sk deploy CUSTOMERPATH`](#sk-deploy-customerpath)
72
73
  * [`sk diff-url-parameters PAGEURL`](#sk-diff-url-parameters-pageurl)
73
74
  * [`sk document-handler CUSTOMERPATH`](#sk-document-handler-customerpath)
@@ -159,6 +160,21 @@ EXAMPLES
159
160
  $ sk build-prewarm-query customers/decathlon.de -c production
160
161
  ```
161
162
 
163
+ ## `sk config edit`
164
+
165
+ Edit cli config
166
+
167
+ ```
168
+ USAGE
169
+ $ sk config edit
170
+
171
+ DESCRIPTION
172
+ Edit cli config
173
+
174
+ EXAMPLES
175
+ $ sk config edit
176
+ ```
177
+
162
178
  ## `sk deploy CUSTOMERPATH`
163
179
 
164
180
  Deploys the specified customer config while comparing to the live version before
@@ -217,7 +233,7 @@ Creates testable documentHandler in folder {CUSTOMER_PATH}/test/src/
217
233
 
218
234
  ```
219
235
  USAGE
220
- $ sk document-handler CUSTOMERPATH [-c <value>] [-t <value>]
236
+ $ sk document-handler CUSTOMERPATH [-c <value>] [-t <value>...]
221
237
 
222
238
  ARGUMENTS
223
239
  CUSTOMERPATH The customer config path
@@ -325,10 +341,10 @@ Display help for sk.
325
341
 
326
342
  ```
327
343
  USAGE
328
- $ sk help [COMMAND] [-n]
344
+ $ sk help [COMMAND...] [-n]
329
345
 
330
346
  ARGUMENTS
331
- COMMAND Command to show help for.
347
+ COMMAND... Command to show help for.
332
348
 
333
349
  FLAGS
334
350
  -n, --nested-commands Include all nested commands in the output.
@@ -337,7 +353,7 @@ DESCRIPTION
337
353
  Display help for sk.
338
354
  ```
339
355
 
340
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.18/src/commands/help.ts)_
356
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.3/src/commands/help.ts)_
341
357
 
342
358
  ## `sk login [APP]`
343
359
 
@@ -2,7 +2,7 @@ import { Command } from "@oclif/core";
2
2
  export default class BuildParameterQuery extends Command {
3
3
  static args: {
4
4
  customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
5
- exists?: boolean;
5
+ exists?: boolean | undefined;
6
6
  }>;
7
7
  };
8
8
  static description: string;
@@ -2,7 +2,7 @@ import { Command } from "@oclif/core";
2
2
  export default class BuildPrewarmQuery extends Command {
3
3
  static args: {
4
4
  customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
5
- exists?: boolean;
5
+ exists?: boolean | undefined;
6
6
  }>;
7
7
  };
8
8
  static description: string;
@@ -0,0 +1,6 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class Edit extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const path_1 = tslib_1.__importDefault(require("path"));
6
+ const child_process_1 = require("child_process");
7
+ const dotenv = tslib_1.__importStar(require("dotenv"));
8
+ dotenv.config();
9
+ class Edit extends core_1.Command {
10
+ static description = "Edit cli config";
11
+ static examples = [`$ sk config edit`];
12
+ async run() {
13
+ const editor = process.env.EDITOR || "nano";
14
+ const editorSpawn = (0, child_process_1.spawn)(editor, [path_1.default.resolve(this.config.configDir, "config.json")], {
15
+ stdio: "inherit",
16
+ detached: true,
17
+ });
18
+ editorSpawn.on("data", function (data) {
19
+ process.stdout.pipe(data);
20
+ });
21
+ }
22
+ }
23
+ exports.default = Edit;
@@ -2,7 +2,7 @@ import { Command } from "@oclif/core";
2
2
  export default class Deploy extends Command {
3
3
  static args: {
4
4
  customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
5
- exists?: boolean;
5
+ exists?: boolean | undefined;
6
6
  }>;
7
7
  };
8
8
  static description: string;
@@ -3,7 +3,7 @@ export default class DocumentHandler extends Command {
3
3
  static description: string;
4
4
  static args: {
5
5
  customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
6
- exists?: boolean;
6
+ exists?: boolean | undefined;
7
7
  }>;
8
8
  };
9
9
  static flags: {
@@ -68,7 +68,6 @@ class FindPops extends core_1.Command {
68
68
  Host: `${app}.app.baqend.com`,
69
69
  authorization: `BAT ${token}`,
70
70
  },
71
- timeout: 10_000,
72
71
  });
73
72
  const servedBy = resp.headers.get("x-served-by");
74
73
  if (resp.status !== 200 || !servedBy) {
@@ -6,7 +6,7 @@ export default class Onboarding extends Command {
6
6
  }>;
7
7
  static args: {
8
8
  customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
9
- exists?: boolean;
9
+ exists?: boolean | undefined;
10
10
  }>;
11
11
  };
12
12
  static examples: string[];
@@ -14,7 +14,7 @@ class Onboarding extends core_1.Command {
14
14
  ];
15
15
  async run() {
16
16
  const { args: { customerPath }, flags: { configName, domain, local, verboseLevel, ignoreContentSecurityPolicy, }, } = await this.parse(Onboarding);
17
- const service = await new onboarding_1.OnboardingServiceFactory(new onboarding_1.OnboardingContext(customerPath, configName, domain, local, verboseLevel, ignoreContentSecurityPolicy), new cli_config_1.CliConfig(this.config).load()).getService();
17
+ const service = await new onboarding_1.OnboardingServiceFactory(new onboarding_1.OnboardingContext(customerPath, configName, domain, local, ignoreContentSecurityPolicy, this.config.root, verboseLevel), new cli_config_1.CliConfig(this.config).load()).getService();
18
18
  await service.run();
19
19
  }
20
20
  }
@@ -4,7 +4,7 @@ export default class Prewarm extends Command {
4
4
  static args: {
5
5
  app: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
6
6
  path: import("@oclif/core/lib/interfaces").Arg<string, {
7
- exists?: boolean;
7
+ exists?: boolean | undefined;
8
8
  }>;
9
9
  };
10
10
  static flags: {
@@ -3,7 +3,7 @@ export default class Pull extends Command {
3
3
  static description: string;
4
4
  static args: {
5
5
  customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
6
- exists?: boolean;
6
+ exists?: boolean | undefined;
7
7
  }>;
8
8
  };
9
9
  static flags: {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // Require the assert module from Chai
4
- const { expect } = require("chai");
3
+ const chai_1 = require("chai");
5
4
  // Dummy function to test
6
5
  function add(a, b) {
7
6
  return a + b;
@@ -13,7 +12,7 @@ describe("(dummy) add function test", () => {
13
12
  // Call our function with some test inputs
14
13
  const result = add(2, 3);
15
14
  // Assert that our function returned the correct value
16
- expect(result).to.equal(5);
15
+ (0, chai_1.expect)(result).to.equal(5);
17
16
  });
18
17
  // Add more tests here
19
18
  });
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStrippedParameters = exports.getParameterReplaceFilter = exports.getParameterFilter = exports.getBlacklistedFilter = exports.getWhitelistedFilter = void 0;
3
+ exports.getWhitelistedFilter = getWhitelistedFilter;
4
+ exports.getBlacklistedFilter = getBlacklistedFilter;
5
+ exports.getParameterFilter = getParameterFilter;
6
+ exports.getParameterReplaceFilter = getParameterReplaceFilter;
7
+ exports.getStrippedParameters = getStrippedParameters;
4
8
  /**
5
9
  * Returns the string between a left bound and a right bound.
6
10
  *
@@ -69,7 +73,6 @@ function getWhitelistedFilter(parsedConfig) {
69
73
  }
70
74
  return `(${whitelistedFilter}) and (${enabledFilter})`;
71
75
  }
72
- exports.getWhitelistedFilter = getWhitelistedFilter;
73
76
  /**
74
77
  * Returns the blacklisted filter as a SQL query string.
75
78
  *
@@ -98,7 +101,6 @@ function getBlacklistedFilter(parsedConfig) {
98
101
  }
99
102
  return blacklistedFilter;
100
103
  }
101
- exports.getBlacklistedFilter = getBlacklistedFilter;
102
104
  /**
103
105
  * Returns the parameter filter as a SQL query string.
104
106
  *
@@ -120,7 +122,6 @@ function getParameterFilter(parameters, skConfigVersion = 1) {
120
122
  })
121
123
  .join("\nand ");
122
124
  }
123
- exports.getParameterFilter = getParameterFilter;
124
125
  /**
125
126
  * Returns the parameter replace (regexp_replace) as a SQL query string.
126
127
  *
@@ -182,7 +183,6 @@ function getParameterReplaceFilter(parameters, skConfigVersion = 1) {
182
183
  }
183
184
  return regExpQuery;
184
185
  }
185
- exports.getParameterReplaceFilter = getParameterReplaceFilter;
186
186
  function isRegExpIgnoringCase(regExp) {
187
187
  return /\/i$/.test(String(regExp));
188
188
  }
@@ -228,4 +228,3 @@ function getStrippedParameters(parsedConfig) {
228
228
  }
229
229
  return parameters;
230
230
  }
231
- exports.getStrippedParameters = getStrippedParameters;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readLocalFile = exports.createTemporalDirectory = void 0;
3
+ exports.createTemporalDirectory = createTemporalDirectory;
4
+ exports.readLocalFile = readLocalFile;
4
5
  const tslib_1 = require("tslib");
5
6
  const node_fs_1 = require("node:fs");
6
7
  const os = tslib_1.__importStar(require("node:os"));
@@ -18,7 +19,6 @@ async function createTemporalDirectory() {
18
19
  return null;
19
20
  }
20
21
  }
21
- exports.createTemporalDirectory = createTemporalDirectory;
22
22
  /**
23
23
  * @deprecated
24
24
  */
@@ -31,4 +31,3 @@ async function readLocalFile(basePath, fileName) {
31
31
  return null;
32
32
  }
33
33
  }
34
- exports.readLocalFile = readLocalFile;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSpeedKitConfigVersion = exports.getParsedConfig = exports.parseSpeedKitConfig = void 0;
3
+ exports.parseSpeedKitConfig = parseSpeedKitConfig;
4
+ exports.getParsedConfig = getParsedConfig;
5
+ exports.getSpeedKitConfigVersion = getSpeedKitConfigVersion;
4
6
  const tslib_1 = require("tslib");
5
7
  const vm = tslib_1.__importStar(require("node:vm"));
6
8
  /**
@@ -42,7 +44,6 @@ function parseSpeedKitConfig(config) {
42
44
  vm.runInNewContext(config, context);
43
45
  return window.speedKit;
44
46
  }
45
- exports.parseSpeedKitConfig = parseSpeedKitConfig;
46
47
  async function getParsedConfig(configFile) {
47
48
  const configString = configFile ? await configFile.readContent() : undefined;
48
49
  if (!configString) {
@@ -60,8 +61,6 @@ async function getParsedConfig(configFile) {
60
61
  }
61
62
  return parsedConfig;
62
63
  }
63
- exports.getParsedConfig = getParsedConfig;
64
64
  function getSpeedKitConfigVersion(config) {
65
65
  return Number(config.ruleSetConfig?.version) || 1;
66
66
  }
67
- exports.getSpeedKitConfigVersion = getSpeedKitConfigVersion;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDirectory = void 0;
3
+ exports.isDirectory = isDirectory;
4
4
  const promises_1 = require("node:fs/promises");
5
5
  /**
6
6
  * @deprecated
@@ -20,4 +20,3 @@ async function isDirectory(directory) {
20
20
  throw error;
21
21
  }
22
22
  }
23
- exports.isDirectory = isDirectory;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFile = void 0;
3
+ exports.isFile = isFile;
4
4
  const promises_1 = require("node:fs/promises");
5
5
  /**
6
6
  * @deprecated
@@ -20,4 +20,3 @@ async function isFile(filename) {
20
20
  throw error;
21
21
  }
22
22
  }
23
- exports.isFile = isFile;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logWarning = exports.logError = exports.logInfo = void 0;
3
+ exports.logInfo = logInfo;
4
+ exports.logError = logError;
5
+ exports.logWarning = logWarning;
4
6
  const tslib_1 = require("tslib");
5
7
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
8
  // TODO: use CliService instead
@@ -11,7 +13,6 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
11
13
  function logInfo(message, ...optionalParameters) {
12
14
  console.log(chalk_1.default.green(message), ...optionalParameters);
13
15
  }
14
- exports.logInfo = logInfo;
15
16
  /**
16
17
  * Logs the given message 'red' in the console.
17
18
  * @deprecated
@@ -19,7 +20,6 @@ exports.logInfo = logInfo;
19
20
  function logError(message, ...optionalParameters) {
20
21
  console.log(chalk_1.default.red(message), ...optionalParameters);
21
22
  }
22
- exports.logError = logError;
23
23
  /**
24
24
  * Logs the given message 'yellow' in the console.
25
25
  * @deprecated
@@ -27,4 +27,3 @@ exports.logError = logError;
27
27
  function logWarning(message, ...optionalParameters) {
28
28
  console.log(chalk_1.default.yellow(message), ...optionalParameters);
29
29
  }
30
- exports.logWarning = logWarning;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { URL } from "node:url";
3
2
  /**
4
3
  * Sorts all urls params manually.
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalize = exports.transformNoValueParameters = exports.convertNotEncodedParameters = exports.sortParameters = void 0;
3
+ exports.sortParameters = sortParameters;
4
+ exports.convertNotEncodedParameters = convertNotEncodedParameters;
5
+ exports.transformNoValueParameters = transformNoValueParameters;
6
+ exports.normalize = normalize;
4
7
  const node_url_1 = require("node:url");
5
8
  /**
6
9
  * Sorts all urls params manually.
@@ -21,7 +24,6 @@ function sortParameters(searchParameters) {
21
24
  for (const key of entries)
22
25
  searchParameters.append(key[0], key[1]);
23
26
  }
24
- exports.sortParameters = sortParameters;
25
27
  /**
26
28
  * Encodes the parameter key as URL object would encode query params.
27
29
  *
@@ -73,7 +75,6 @@ function convertNotEncodedParameters(url, manipulatedUrl) {
73
75
  });
74
76
  manipulatedUrl.search = `?${search.join("&")}`;
75
77
  }
76
- exports.convertNotEncodedParameters = convertNotEncodedParameters;
77
78
  /**
78
79
  * Removes the "=" char of query parameters that do not have a value.
79
80
  *
@@ -91,7 +92,6 @@ function transformNoValueParameters(url, manipulatedUrl) {
91
92
  manipulatedUrl.search = manipulatedUrl.search.replace(`${parameter}=`, parameter);
92
93
  }
93
94
  }
94
- exports.transformNoValueParameters = transformNoValueParameters;
95
95
  /**
96
96
  * Normalizes a given URL.
97
97
  *
@@ -113,4 +113,3 @@ function normalize(urlString, withParameterSorting) {
113
113
  transformNoValueParameters(new node_url_1.URL(urlString), url);
114
114
  return url.toString();
115
115
  }
116
- exports.normalize = normalize;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.race = void 0;
3
+ exports.race = race;
4
4
  const tslib_1 = require("tslib");
5
5
  const application_error_1 = tslib_1.__importDefault(require("../services/error-handling/error/application-error"));
6
6
  const DEFAULT_TIMEOUT = 5000;
@@ -14,4 +14,3 @@ async function race(promise, timeout = DEFAULT_TIMEOUT) {
14
14
  });
15
15
  return Promise.race([promise, timeOut]);
16
16
  }
17
- exports.race = race;
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.safe = void 0;
3
+ exports.safe = safe;
4
4
  function safe(promiseOrFunction) {
5
5
  if (promiseOrFunction instanceof Promise) {
6
6
  return safeAsync(promiseOrFunction);
7
7
  }
8
8
  return safeSync(promiseOrFunction);
9
9
  }
10
- exports.safe = safe;
11
10
  async function safeAsync(promise) {
12
11
  try {
13
12
  const data = await promise;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = scrape;
3
4
  const tslib_1 = require("tslib");
4
5
  const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
5
6
  async function scrape(url) {
@@ -9,4 +10,3 @@ async function scrape(url) {
9
10
  }
10
11
  return response.text();
11
12
  }
12
- exports.default = scrape;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.speedKitRuleToRegExp = void 0;
3
+ exports.speedKitRuleToRegExp = speedKitRuleToRegExp;
4
4
  function escapeRegExp(string_) {
5
5
  return string_.replaceAll(/[\s#$()*+,.?[\\\]^{|}-]/g, "\\$&");
6
6
  }
7
7
  function speedKitRuleToRegExp(url) {
8
8
  return new RegExp(`^${escapeRegExp(url).replaceAll("\\*", ".*")}$`);
9
9
  }
10
- exports.speedKitRuleToRegExp = speedKitRuleToRegExp;
@@ -74,6 +74,6 @@ export declare const CLI_CONFIG_NAME: {
74
74
  };
75
75
  export declare const CLI_CUSTOMER_CONFIG: {
76
76
  customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
77
- exists?: boolean;
77
+ exists?: boolean | undefined;
78
78
  }>;
79
79
  };
@@ -17,7 +17,7 @@ class AthenaServiceFactory {
17
17
  async createService() {
18
18
  const cli = new cli_1.CliServiceFactory().getService();
19
19
  const client = await this.getAthenaClient(cli);
20
- return new athena_service_1.AthenaService(client);
20
+ return new athena_service_1.AthenaService(client, cli);
21
21
  }
22
22
  /**
23
23
  * create awsAthenaClient
@@ -1,7 +1,9 @@
1
1
  import { AthenaClient } from "@aws-sdk/client-athena";
2
+ import { CliServiceInterface } from "../cli";
2
3
  export declare class AthenaService {
3
4
  private client;
4
- constructor(client: AthenaClient);
5
+ private cli;
6
+ constructor(client: AthenaClient, cli: CliServiceInterface);
5
7
  getResult<T>(query: string, parameters?: string[], maxAgeInMinutes?: number): Promise<T[]>;
6
8
  private castValueToType;
7
9
  /**
@@ -4,14 +4,26 @@ exports.AthenaService = void 0;
4
4
  const client_athena_1 = require("@aws-sdk/client-athena");
5
5
  const athena_service_model_1 = require("./athena-service-model");
6
6
  const athena_query_error_1 = require("./error/athena-query-error");
7
+ const cli_1 = require("../cli");
8
+ const safe_1 = require("../../helpers/safe");
7
9
  class AthenaService {
8
10
  client;
9
- constructor(client) {
11
+ cli;
12
+ constructor(client, cli) {
10
13
  this.client = client;
14
+ this.cli = cli;
11
15
  }
12
16
  async getResult(query, parameters = [], maxAgeInMinutes = athena_service_model_1.DEFAULT_MAX_AGE_IN_MINUTES) {
17
+ this.cli.startAction("execute athena query");
13
18
  const queryId = await this.runQuery(query, parameters, maxAgeInMinutes);
14
- return (await this.fetchResult(queryId));
19
+ const result = await (0, safe_1.safe)(this.fetchResult(queryId));
20
+ if (result.success === true) {
21
+ this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
22
+ return result.data;
23
+ }
24
+ this.cli.endAction(cli_1.CliActionStatus.FAILED);
25
+ this.cli.writeError(result.error);
26
+ return [];
15
27
  }
16
28
  castValueToType(value, type) {
17
29
  if (value === null)
@@ -17,5 +17,5 @@ export default class ConfigApiService {
17
17
  saveRemoteModule(moduleCode: string, moduleName: string): Promise<string>;
18
18
  getRemoteServerConfig(): Promise<string>;
19
19
  saveRemoteServerConfig(localPath: string, configurationVersion: string): Promise<void>;
20
- fetchAndGetBody(url: string, requestInit?: NonNullable<unknown>): Promise<any>;
20
+ fetchAndGetBody<T>(url: string, requestInit?: NonNullable<unknown>): Promise<T>;
21
21
  }
@@ -103,6 +103,7 @@ class ConfigApiService {
103
103
  const response = await (0, node_fetch_1.default)(url, requestInit);
104
104
  const body = await response.json();
105
105
  if (response.status !== 200) {
106
+ // @ts-expect-error unknown message in body
106
107
  throw new Error(body.message);
107
108
  }
108
109
  return body;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Dirent } from "node:fs";
3
2
  export default class FileReader {
4
3
  private fileSystem;
@@ -0,0 +1,7 @@
1
+ import { DevelopmentToolsMessage } from "../../onboarding-model";
2
+ export declare class DevtoolsExtensionApi {
3
+ messages: DevelopmentToolsMessage[];
4
+ getMessages(): DevelopmentToolsMessage[];
5
+ addMessage(message: DevelopmentToolsMessage): void;
6
+ clear(): void;
7
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DevtoolsExtensionApi = void 0;
4
+ class DevtoolsExtensionApi {
5
+ messages = [];
6
+ getMessages() {
7
+ return this.messages;
8
+ }
9
+ addMessage(message) {
10
+ this.messages.push(message);
11
+ }
12
+ clear() {
13
+ this.messages = [];
14
+ }
15
+ }
16
+ exports.DevtoolsExtensionApi = DevtoolsExtensionApi;
@@ -0,0 +1,10 @@
1
+ import { UserCliConfig } from "../../../../helpers/cli-config";
2
+ import { CliServiceInterface } from "../../../cli";
3
+ export declare class ExtensionValidator {
4
+ private cliConfig;
5
+ private cliBasePath;
6
+ private cli;
7
+ constructor(cliConfig: UserCliConfig, cliBasePath: string, cli: CliServiceInterface);
8
+ getValidBrowserExtensionPaths(): Promise<string[]>;
9
+ private getManifestConfig;
10
+ }