@speedkit/cli 2.37.0 → 2.39.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.
- package/CHANGELOG.md +22 -0
- package/README.md +5 -5
- package/dist/commands/build-parameter-query.d.ts +1 -1
- package/dist/commands/build-prewarm-query.d.ts +1 -1
- package/dist/commands/deploy.d.ts +1 -1
- package/dist/commands/document-handler.d.ts +1 -1
- package/dist/commands/find-pops.js +0 -1
- package/dist/commands/onboarding.d.ts +1 -1
- package/dist/commands/onboarding.js +1 -1
- package/dist/commands/prewarm.d.ts +1 -1
- package/dist/commands/pull.d.ts +1 -1
- package/dist/dummy.spec.js +2 -3
- package/dist/helpers/build-query-helper.js +5 -6
- package/dist/helpers/file-helper.js +2 -3
- package/dist/helpers/get-parsed-config.js +3 -4
- package/dist/helpers/is-directory.js +1 -2
- package/dist/helpers/is-file.js +1 -2
- package/dist/helpers/logging-helper.js +3 -4
- package/dist/helpers/normalize.d.ts +0 -1
- package/dist/helpers/normalize.js +4 -5
- package/dist/helpers/race.js +1 -2
- package/dist/helpers/safe.js +1 -2
- package/dist/helpers/scrape.js +1 -1
- package/dist/helpers/speed-kit-rule-to-reg-exp.js +1 -2
- package/dist/models/cli-parameters.d.ts +1 -1
- package/dist/services/athena/athena-service-factory.js +1 -1
- package/dist/services/athena/athena-service.d.ts +3 -1
- package/dist/services/athena/athena-service.js +14 -2
- package/dist/services/config-api-service.d.ts +1 -1
- package/dist/services/config-api-service.js +1 -0
- package/dist/services/customer-config/templates/config_customer.js.hbs +5 -1
- package/dist/services/integration-api/file-reader.d.ts +0 -1
- package/dist/services/onboarding/browser/extension/devtools-extension-api.d.ts +7 -0
- package/dist/services/onboarding/browser/extension/devtools-extension-api.js +16 -0
- package/dist/services/onboarding/browser/extension/extension-validator.d.ts +10 -0
- package/dist/services/onboarding/browser/extension/extension-validator.js +71 -0
- package/dist/services/onboarding/dashboard/index.d.ts +1 -0
- package/dist/services/onboarding/dashboard/index.js +23 -22
- package/dist/services/onboarding/dashboard/request-diff-service.d.ts +2 -1
- package/dist/services/onboarding/dashboard/request-diff-service.js +34 -6
- package/dist/services/onboarding/error/browser-extension-error.d.ts +5 -0
- package/dist/services/onboarding/error/browser-extension-error.js +12 -0
- package/dist/services/onboarding/fetch-event-handler.js +13 -14
- package/dist/services/onboarding/onboarding-model.d.ts +33 -3
- package/dist/services/onboarding/onboarding-model.js +32 -5
- package/dist/services/onboarding/onboarding-service-factory.d.ts +1 -0
- package/dist/services/onboarding/onboarding-service-factory.js +22 -4
- package/dist/services/onboarding/onboarding-service.d.ts +3 -3
- package/dist/services/onboarding/onboarding-service.js +35 -30
- package/dist/services/onboarding/todo-collector.d.ts +2 -2
- package/dist/services/onboarding/todo-collector.js +1 -1
- package/dist/services/prewarm/assets/asset-api-client.js +0 -1
- package/oclif.manifest.json +1 -1
- package/package.json +19 -19
- package/dist/services/onboarding/dashboard/frontend-dist/assets/index-e3bd4f6e.css +0 -1
- package/dist/services/onboarding/dashboard/frontend-dist/assets/main-215271c2.js +0 -9
- package/dist/services/onboarding/dashboard/frontend-dist/index.html +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
# [2.39.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.38.0...v2.39.0) (2024-07-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* failing tests ([9ebe257](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/9ebe25764f56e3b92881cb0b1d72b176a4297d6a))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **diffservice:** set speedKitUserAgent ([594acc8](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/594acc8578bfb6a65e78b487aaeceb9de88af44c))
|
|
12
|
+
* **onboarding:** fix bug - context not found ([8dde2e9](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/8dde2e9f83d02121e3ef7e160e5d736eb7c834dd))
|
|
13
|
+
* **onboarding:** integrate devtools ([d9ccfb8](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/d9ccfb8f1b0371f9ea6650646dc634b9e1241dd6))
|
|
14
|
+
* **onboarding:** reenable auth ([04a761f](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/04a761ff8321724594624dbee81dc7a19de69008))
|
|
15
|
+
|
|
16
|
+
# [2.38.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.37.0...v2.38.0) (2024-07-04)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* **config-wizzard:** add specialCase for shopifyName ([16915a9](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/16915a9ce46bd046d4e2c53025c06203ce69fb2c))
|
|
22
|
+
|
|
1
23
|
# [2.37.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.36.0...v2.37.0) (2024-07-03)
|
|
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.
|
|
24
|
+
@speedkit/cli/2.39.0 linux-x64 node-v20.15.0
|
|
25
25
|
$ sk --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ sk COMMAND
|
|
@@ -217,7 +217,7 @@ Creates testable documentHandler in folder {CUSTOMER_PATH}/test/src/
|
|
|
217
217
|
|
|
218
218
|
```
|
|
219
219
|
USAGE
|
|
220
|
-
$ sk document-handler CUSTOMERPATH [-c <value>] [-t <value
|
|
220
|
+
$ sk document-handler CUSTOMERPATH [-c <value>] [-t <value>...]
|
|
221
221
|
|
|
222
222
|
ARGUMENTS
|
|
223
223
|
CUSTOMERPATH The customer config path
|
|
@@ -325,10 +325,10 @@ Display help for sk.
|
|
|
325
325
|
|
|
326
326
|
```
|
|
327
327
|
USAGE
|
|
328
|
-
$ sk help [COMMAND] [-n]
|
|
328
|
+
$ sk help [COMMAND...] [-n]
|
|
329
329
|
|
|
330
330
|
ARGUMENTS
|
|
331
|
-
COMMAND Command to show help for.
|
|
331
|
+
COMMAND... Command to show help for.
|
|
332
332
|
|
|
333
333
|
FLAGS
|
|
334
334
|
-n, --nested-commands Include all nested commands in the output.
|
|
@@ -337,7 +337,7 @@ DESCRIPTION
|
|
|
337
337
|
Display help for sk.
|
|
338
338
|
```
|
|
339
339
|
|
|
340
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.
|
|
340
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.3/src/commands/help.ts)_
|
|
341
341
|
|
|
342
342
|
## `sk login [APP]`
|
|
343
343
|
|
|
@@ -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;
|
|
@@ -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,
|
|
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: {
|
package/dist/commands/pull.d.ts
CHANGED
package/dist/dummy.spec.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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 =
|
|
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;
|
package/dist/helpers/is-file.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isFile =
|
|
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.
|
|
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,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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;
|
package/dist/helpers/race.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.race =
|
|
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;
|
package/dist/helpers/safe.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.safe =
|
|
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;
|
package/dist/helpers/scrape.js
CHANGED
|
@@ -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 =
|
|
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;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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<
|
|
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;
|
|
@@ -53,7 +53,11 @@ module.exports = {
|
|
|
53
53
|
{{/if}}
|
|
54
54
|
production: {
|
|
55
55
|
...shared,
|
|
56
|
-
|
|
56
|
+
{{#if isShopify}}
|
|
57
|
+
name: "{{production.host}}",
|
|
58
|
+
{{else}}
|
|
59
|
+
name: "production",
|
|
60
|
+
{{/if}}
|
|
57
61
|
forceInstall: {{production.forceInstall}}, // use when our setup is not present yet
|
|
58
62
|
// bypassDeactivation: false, // comment out when SK deactivation should not be bypassed
|
|
59
63
|
},
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtensionValidator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
6
|
+
const promises_1 = require("node:fs/promises");
|
|
7
|
+
const cli_1 = require("../../../cli");
|
|
8
|
+
const safe_1 = require("../../../../helpers/safe");
|
|
9
|
+
const node_fs_1 = require("node:fs");
|
|
10
|
+
const browser_extension_error_1 = require("../../error/browser-extension-error");
|
|
11
|
+
const SPEED_KIT_EXTENSION_NAME = "Speed Kit DevTools Extension";
|
|
12
|
+
class ExtensionValidator {
|
|
13
|
+
cliConfig;
|
|
14
|
+
cliBasePath;
|
|
15
|
+
cli;
|
|
16
|
+
constructor(cliConfig, cliBasePath, cli) {
|
|
17
|
+
this.cliConfig = cliConfig;
|
|
18
|
+
this.cliBasePath = cliBasePath;
|
|
19
|
+
this.cli = cli;
|
|
20
|
+
}
|
|
21
|
+
async getValidBrowserExtensionPaths() {
|
|
22
|
+
const validExtensions = [];
|
|
23
|
+
const validPaths = [];
|
|
24
|
+
let addIncludedExtension = true;
|
|
25
|
+
this.cli.startAction("resolve browserExtensions");
|
|
26
|
+
const browserExtensions = this.cliConfig.chromeExtensionPaths
|
|
27
|
+
.split(",")
|
|
28
|
+
.filter((entry) => {
|
|
29
|
+
return entry.trim().length > 0;
|
|
30
|
+
});
|
|
31
|
+
for (const extensionPath of browserExtensions) {
|
|
32
|
+
const cleanedExtensionPath = node_path_1.default.resolve(extensionPath.trim());
|
|
33
|
+
const manifestConfig = await this.getManifestConfig(cleanedExtensionPath);
|
|
34
|
+
if (!manifestConfig) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (manifestConfig.name.includes(SPEED_KIT_EXTENSION_NAME)) {
|
|
38
|
+
addIncludedExtension = false;
|
|
39
|
+
}
|
|
40
|
+
validExtensions.push({
|
|
41
|
+
path: cleanedExtensionPath,
|
|
42
|
+
name: manifestConfig.name,
|
|
43
|
+
version: manifestConfig.version,
|
|
44
|
+
});
|
|
45
|
+
validPaths.push(cleanedExtensionPath);
|
|
46
|
+
}
|
|
47
|
+
this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
|
|
48
|
+
if (validExtensions.length > 0) {
|
|
49
|
+
this.cli.table(validExtensions, { name: {}, version: {}, path: {} });
|
|
50
|
+
}
|
|
51
|
+
if (addIncludedExtension) {
|
|
52
|
+
validPaths.push(node_path_1.default.resolve(this.cliBasePath, "chrome-dist", "devtools"));
|
|
53
|
+
}
|
|
54
|
+
return validPaths;
|
|
55
|
+
}
|
|
56
|
+
async getManifestConfig(cleanedExtensionPath) {
|
|
57
|
+
const manifestPath = node_path_1.default.resolve(cleanedExtensionPath, "manifest.json");
|
|
58
|
+
if (!(0, node_fs_1.existsSync)(manifestPath)) {
|
|
59
|
+
throw new browser_extension_error_1.BrowserExtensionError(`Could not find browserExtensionPath: "${cleanedExtensionPath}"`);
|
|
60
|
+
}
|
|
61
|
+
const manifestFile = await (0, promises_1.readFile)(manifestPath, "utf8");
|
|
62
|
+
const result = (0, safe_1.safe)(() => {
|
|
63
|
+
return JSON.parse(manifestFile);
|
|
64
|
+
});
|
|
65
|
+
if (result.success !== true) {
|
|
66
|
+
throw new browser_extension_error_1.BrowserExtensionError(`could not find valid manifestFile in: "${manifestPath}"`);
|
|
67
|
+
}
|
|
68
|
+
return result.data;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.ExtensionValidator = ExtensionValidator;
|
|
@@ -14,4 +14,5 @@ export declare class Dashboard {
|
|
|
14
14
|
private athenaLastResult;
|
|
15
15
|
constructor(customerConfig: CustomerConfig, parameterQueryBuilder: ParameterQueryBuilder, athenaClient: AthenaService, requestDiffService: RequestDiffService, cache: Cache);
|
|
16
16
|
getResponse(request: Protocol.Network.Request): Promise<BaqendResponse>;
|
|
17
|
+
private createBaqendResponse;
|
|
17
18
|
}
|