@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.
- package/CHANGELOG.md +7 -0
- package/README.md +36 -5
- package/dist/commands/build-parameter-query.js +5 -5
- package/dist/commands/build-prewarm-query.js +4 -4
- package/dist/commands/{param-diff.d.ts → diff-url-parameters.d.ts} +3 -1
- package/dist/commands/{param-diff.js → diff-url-parameters.js} +26 -24
- package/dist/commands/find-pops.js +9 -9
- package/dist/commands/generate-customer-config.d.ts +1 -1
- package/dist/commands/generate-customer-config.js +7 -7
- package/dist/commands/generate-pop-config.js +2 -2
- package/dist/commands/login.js +5 -4
- package/dist/commands/pop-prewarm.d.ts +3 -3
- package/dist/commands/pop-prewarm.js +19 -16
- package/dist/commands/prewarm.js +10 -10
- package/dist/commands/wpt-launcher.d.ts +1 -1
- package/dist/commands/wpt-launcher.js +9 -9
- package/dist/helpers/build-query-helper.d.ts +3 -3
- package/dist/helpers/build-query-helper.js +70 -69
- package/dist/helpers/cli-config.js +6 -5
- package/dist/helpers/{CustomerConfig.d.ts → customer-config.d.ts} +6 -6
- package/dist/helpers/{CustomerConfig.js → customer-config.js} +39 -39
- package/dist/helpers/file-helper.d.ts +1 -1
- package/dist/helpers/file-helper.js +5 -5
- package/dist/helpers/{getChromePath.js → get-chrome-path.js} +8 -8
- package/dist/helpers/get-parsed-config.d.ts +1 -1
- package/dist/helpers/get-parsed-config.js +7 -7
- package/dist/helpers/is-directory.d.ts +1 -0
- package/dist/helpers/{isDirectory.js → is-directory.js} +6 -6
- package/dist/helpers/{isExecutable.js → is-executable.js} +3 -3
- package/dist/helpers/{isFile.js → is-file.js} +4 -4
- package/dist/helpers/logging-helper.d.ts +3 -3
- package/dist/helpers/logging-helper.js +6 -6
- package/dist/helpers/normalize.d.ts +6 -6
- package/dist/helpers/normalize.js +35 -33
- package/dist/helpers/safe.d.ts +1 -1
- package/dist/helpers/safe.js +12 -12
- package/dist/helpers/{speedKitRuleToRegExp.js → speed-kit-rule-to-reg-exp.js} +3 -3
- package/dist/helpers/{watchFiles.js → watch-files.js} +2 -2
- package/dist/models/cli-parameters.d.ts +3 -3
- package/dist/models/cli-parameters.js +3 -3
- package/dist/services/athena/athena-service.js +2 -2
- package/dist/services/bundler/bundle-service.js +14 -14
- package/dist/services/cli/cli-service.js +8 -4
- package/dist/services/cli/hooks.js +3 -3
- package/dist/services/config-api/client.js +7 -6
- package/dist/services/config-api/factory/config-api-service-factory.js +4 -4
- package/dist/services/config-api/factory/entity-manager-factory.js +1 -1
- package/dist/services/config-api-service.d.ts +1 -1
- package/dist/services/config-api-service.js +7 -7
- package/dist/services/customer-config/customer-config-service-context.d.ts +2 -2
- package/dist/services/customer-config/customer-config-service-context.js +4 -4
- package/dist/services/customer-config/customer-config-service.js +45 -44
- package/dist/services/deploy/builder/install-resource-builder.d.ts +2 -2
- package/dist/services/deploy/builder/install-resource-builder.js +7 -7
- package/dist/services/deploy/checks/post-deploy/revalidated-module-check.js +1 -1
- package/dist/services/deploy/checks/post-deploy/save-files-check.js +4 -4
- package/dist/services/deploy/deploy-service.js +2 -4
- package/dist/services/deploy/error/create-find-temporary-directory-error.d.ts +4 -0
- package/dist/services/deploy/error/{create-find-temp-directory-error.js → create-find-temporary-directory-error.js} +2 -2
- package/dist/services/deploy/handler/customer-config-handler.js +1 -1
- package/dist/services/deploy/handler/install-resource-handler.js +8 -11
- package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +2 -2
- package/dist/services/deploy/handler/module-handler.js +8 -8
- package/dist/services/deploy/handler/server-config-handler.js +4 -4
- package/dist/services/diff/diff-service.d.ts +2 -2
- package/dist/services/diff/diff-service.js +22 -22
- package/dist/services/diff-service.d.ts +1 -1
- package/dist/services/diff-service.js +13 -13
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +10 -8
- package/dist/services/document-handler-runtime/document-handler-runtime-service.js +10 -10
- package/dist/services/document-handler-runtime/document-handler-server.js +12 -12
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +2 -2
- package/dist/services/document-handler-runtime/interface/template-interface.d.ts +2 -2
- package/dist/services/document-handler-runtime/interface/{template-param-interface.d.ts → template-parameter-interface.d.ts} +1 -1
- package/dist/services/document-handler-runtime/templates/abstract-template.d.ts +2 -2
- package/dist/services/document-handler-runtime/templates/abstract-template.js +3 -3
- package/dist/services/error-handling/factory/error-handling-factory.d.ts +1 -4
- package/dist/services/error-handling/factory/error-handling-factory.js +2 -1
- package/dist/services/integration-api/factory/integration-api-service-factory.js +1 -1
- package/dist/services/integration-api/file-list.js +4 -3
- package/dist/services/integration-api/file-reader.d.ts +1 -1
- package/dist/services/integration-api/file-reader.js +29 -26
- package/dist/services/integration-api/file-writer.js +3 -3
- package/dist/services/integration-api/handler/file-handler.js +1 -1
- package/dist/services/integration-api/handler/install-resource-handler.js +1 -1
- package/dist/services/integration-api/handler/module-handler.js +1 -1
- package/dist/services/integration-api/handler/server-config-handler.js +1 -1
- package/dist/services/integration-api/integration-api-service.js +2 -3
- package/dist/services/integration-api/struct/customer-config.d.ts +1 -1
- package/dist/services/integration-api/struct/customer-config.js +4 -4
- package/dist/services/integration-api/struct/file.js +1 -1
- package/dist/services/integration-api/validator/customer-config-validator.js +2 -2
- package/dist/services/integration-api/validator/mandatory-files-validator.js +7 -6
- package/dist/services/integration-api/virtual/external-recipe.js +2 -1
- package/dist/services/onboarding/browser/baqend-response.js +1 -2
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +1 -1
- package/dist/services/onboarding/dashboard/index.d.ts +3 -3
- package/dist/services/onboarding/dashboard/index.js +12 -12
- package/dist/services/onboarding/dashboard/{param-query-builder.d.ts → parameter-query-builder.d.ts} +1 -1
- package/dist/services/onboarding/dashboard/{param-query-builder.js → parameter-query-builder.js} +6 -6
- package/dist/services/onboarding/dashboard/request-diff-service.js +24 -22
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +8 -8
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +7 -7
- package/dist/services/onboarding/onboarding-model.js +4 -4
- package/dist/services/onboarding/onboarding-service-factory.js +3 -3
- package/dist/services/onboarding/onboarding-service.js +2 -1
- package/dist/services/onboarding/todo-collector.js +1 -1
- package/dist/services/prewarm-service.d.ts +1 -1
- package/dist/services/prewarm-service.js +8 -7
- package/dist/services/pull/pull-service.js +2 -2
- package/oclif.manifest.json +45 -42
- package/package.json +2 -1
- package/dist/helpers/isDirectory.d.ts +0 -1
- package/dist/services/context/app-context.d.ts +0 -1
- package/dist/services/deploy/error/create-find-temp-directory-error.d.ts +0 -4
- package/dist/services/document-handler-runtime/interface/template-param-interface.js +0 -2
- /package/dist/helpers/{getChromePath.d.ts → get-chrome-path.d.ts} +0 -0
- /package/dist/helpers/{isExecutable.d.ts → is-executable.d.ts} +0 -0
- /package/dist/helpers/{isFile.d.ts → is-file.d.ts} +0 -0
- /package/dist/helpers/{speedKitRuleToRegExp.d.ts → speed-kit-rule-to-reg-exp.d.ts} +0 -0
- /package/dist/helpers/{watchFiles.d.ts → watch-files.d.ts} +0 -0
- /package/dist/services/{context/app-context.js → document-handler-runtime/interface/template-parameter-interface.js} +0 -0
|
@@ -7,21 +7,21 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
|
7
7
|
/**
|
|
8
8
|
* Logs the given message 'green' in the console.
|
|
9
9
|
*/
|
|
10
|
-
function logInfo(message, ...
|
|
11
|
-
console.log(chalk_1.default.green(message), ...
|
|
10
|
+
function logInfo(message, ...optionalParameters) {
|
|
11
|
+
console.log(chalk_1.default.green(message), ...optionalParameters);
|
|
12
12
|
}
|
|
13
13
|
exports.logInfo = logInfo;
|
|
14
14
|
/**
|
|
15
15
|
* Logs the given message 'red' in the console.
|
|
16
16
|
*/
|
|
17
|
-
function logError(message, ...
|
|
18
|
-
console.log(chalk_1.default.red(message), ...
|
|
17
|
+
function logError(message, ...optionalParameters) {
|
|
18
|
+
console.log(chalk_1.default.red(message), ...optionalParameters);
|
|
19
19
|
}
|
|
20
20
|
exports.logError = logError;
|
|
21
21
|
/**
|
|
22
22
|
* Logs the given message 'yellow' in the console.
|
|
23
23
|
*/
|
|
24
|
-
function logWarning(message, ...
|
|
25
|
-
console.log(chalk_1.default.yellow(message), ...
|
|
24
|
+
function logWarning(message, ...optionalParameters) {
|
|
25
|
+
console.log(chalk_1.default.yellow(message), ...optionalParameters);
|
|
26
26
|
}
|
|
27
27
|
exports.logWarning = logWarning;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { URL } from "url";
|
|
2
|
+
import { URL } from "node:url";
|
|
3
3
|
/**
|
|
4
4
|
* Sorts all urls params manually.
|
|
5
5
|
*
|
|
6
|
-
* @param
|
|
6
|
+
* @param searchParameters - Params to sort.
|
|
7
7
|
*/
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function sortParameters(searchParameters: URLSearchParams): void;
|
|
9
9
|
/**
|
|
10
10
|
* Converts parameters back to origin form.
|
|
11
11
|
*
|
|
@@ -31,12 +31,12 @@ export declare function convertNotEncodedParameters(url: URL, manipulatedUrl: UR
|
|
|
31
31
|
* @param url - The original URL.
|
|
32
32
|
* @param manipulatedUrl - The manipulated URL to remove the "=" from.
|
|
33
33
|
*/
|
|
34
|
-
export declare function
|
|
34
|
+
export declare function transformNoValueParameters(url: URL, manipulatedUrl: URL): void;
|
|
35
35
|
/**
|
|
36
36
|
* Normalizes a given URL.
|
|
37
37
|
*
|
|
38
38
|
* @param urlString - The URL to be normalized.
|
|
39
|
-
* @param
|
|
39
|
+
* @param withParameterSorting - Activates alphabetical sorting of the URL parameters.
|
|
40
40
|
* @returns The normalized URL.
|
|
41
41
|
*/
|
|
42
|
-
export declare function normalize(urlString: string,
|
|
42
|
+
export declare function normalize(urlString: string, withParameterSorting: boolean): string;
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalize = exports.
|
|
4
|
-
const
|
|
3
|
+
exports.normalize = exports.transformNoValueParameters = exports.convertNotEncodedParameters = exports.sortParameters = void 0;
|
|
4
|
+
const node_url_1 = require("node:url");
|
|
5
5
|
/**
|
|
6
6
|
* Sorts all urls params manually.
|
|
7
7
|
*
|
|
8
|
-
* @param
|
|
8
|
+
* @param searchParameters - Params to sort.
|
|
9
9
|
*/
|
|
10
|
-
function
|
|
11
|
-
const entries = [...
|
|
10
|
+
function sortParameters(searchParameters) {
|
|
11
|
+
const entries = [...searchParameters.entries()].sort((a, b) => {
|
|
12
12
|
if (a[0] === b[0]) {
|
|
13
13
|
return a[1] < b[1] ? -1 : 1;
|
|
14
14
|
}
|
|
15
15
|
return a[0] < b[0] ? -1 : 1;
|
|
16
16
|
});
|
|
17
17
|
// Clear search params before appending sorted params
|
|
18
|
-
|
|
18
|
+
for (const key of entries)
|
|
19
|
+
searchParameters.delete(key[0]);
|
|
19
20
|
// Append sorted params without overwriting keys
|
|
20
|
-
|
|
21
|
+
for (const key of entries)
|
|
22
|
+
searchParameters.append(key[0], key[1]);
|
|
21
23
|
}
|
|
22
|
-
exports.
|
|
24
|
+
exports.sortParameters = sortParameters;
|
|
23
25
|
/**
|
|
24
26
|
* Encodes the parameter key as URL object would encode query params.
|
|
25
27
|
*
|
|
@@ -28,7 +30,7 @@ exports.sortParams = sortParams;
|
|
|
28
30
|
* @return The encoded parameter key and value without ?.
|
|
29
31
|
*/
|
|
30
32
|
function encodeUrlComponent(parameterKey, parameterValue) {
|
|
31
|
-
const url = new
|
|
33
|
+
const url = new node_url_1.URL("https://www.baqend.com/");
|
|
32
34
|
url.searchParams.append(parameterKey, parameterValue);
|
|
33
35
|
return url.search.replace(/\?/, "");
|
|
34
36
|
}
|
|
@@ -51,21 +53,21 @@ function convertNotEncodedParameters(url, manipulatedUrl) {
|
|
|
51
53
|
if (manipulatedUrl.search.length === 0) {
|
|
52
54
|
return;
|
|
53
55
|
}
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
+
const originalParametersMap = new Map();
|
|
57
|
+
const originalParameters = url.search.slice(1).split("&");
|
|
56
58
|
let index = 0;
|
|
57
|
-
url.searchParams.
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
|
|
59
|
+
for (const [parameter, value] of url.searchParams.entries()) {
|
|
60
|
+
const parameterWithValue = originalParameters[index];
|
|
61
|
+
if (parameterWithValue) {
|
|
62
|
+
originalParametersMap.set(encodeUrlComponent(parameter, value), parameterWithValue);
|
|
61
63
|
}
|
|
62
64
|
index += 1;
|
|
63
|
-
}
|
|
65
|
+
}
|
|
64
66
|
const search = [...manipulatedUrl.searchParams].map((entry) => {
|
|
65
67
|
const [key, value] = entry;
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
return `${
|
|
68
|
+
const originalParameterWithValue = originalParametersMap.get(encodeUrlComponent(key, value));
|
|
69
|
+
if (originalParameterWithValue) {
|
|
70
|
+
return `${originalParameterWithValue}`;
|
|
69
71
|
}
|
|
70
72
|
return `${key}=${value}`;
|
|
71
73
|
});
|
|
@@ -81,34 +83,34 @@ exports.convertNotEncodedParameters = convertNotEncodedParameters;
|
|
|
81
83
|
* @param url - The original URL.
|
|
82
84
|
* @param manipulatedUrl - The manipulated URL to remove the "=" from.
|
|
83
85
|
*/
|
|
84
|
-
function
|
|
85
|
-
const
|
|
86
|
-
.split(/[
|
|
87
|
-
.filter((
|
|
88
|
-
for (const
|
|
89
|
-
manipulatedUrl.search = manipulatedUrl.search.replace(`${
|
|
86
|
+
function transformNoValueParameters(url, manipulatedUrl) {
|
|
87
|
+
const parametersWithoutValue = url.search
|
|
88
|
+
.split(/[&?]/)
|
|
89
|
+
.filter((parameter) => parameter && !parameter.includes("="));
|
|
90
|
+
for (const parameter of parametersWithoutValue) {
|
|
91
|
+
manipulatedUrl.search = manipulatedUrl.search.replace(`${parameter}=`, parameter);
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
|
-
exports.
|
|
94
|
+
exports.transformNoValueParameters = transformNoValueParameters;
|
|
93
95
|
/**
|
|
94
96
|
* Normalizes a given URL.
|
|
95
97
|
*
|
|
96
98
|
* @param urlString - The URL to be normalized.
|
|
97
|
-
* @param
|
|
99
|
+
* @param withParameterSorting - Activates alphabetical sorting of the URL parameters.
|
|
98
100
|
* @returns The normalized URL.
|
|
99
101
|
*/
|
|
100
|
-
function normalize(urlString,
|
|
101
|
-
const url = new
|
|
102
|
+
function normalize(urlString, withParameterSorting) {
|
|
103
|
+
const url = new node_url_1.URL(urlString);
|
|
102
104
|
// Remove the hash part of the URL if exists
|
|
103
105
|
if (url.hash) {
|
|
104
106
|
url.hash = "";
|
|
105
107
|
}
|
|
106
|
-
if (!
|
|
108
|
+
if (!withParameterSorting) {
|
|
107
109
|
// Sort search params to normalize encoding and order of params
|
|
108
|
-
|
|
110
|
+
sortParameters(url.searchParams);
|
|
109
111
|
}
|
|
110
|
-
convertNotEncodedParameters(new
|
|
111
|
-
|
|
112
|
+
convertNotEncodedParameters(new node_url_1.URL(urlString), url);
|
|
113
|
+
transformNoValueParameters(new node_url_1.URL(urlString), url);
|
|
112
114
|
return url.toString();
|
|
113
115
|
}
|
|
114
116
|
exports.normalize = normalize;
|
package/dist/helpers/safe.d.ts
CHANGED
package/dist/helpers/safe.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.safe = void 0;
|
|
4
|
-
function safe(
|
|
5
|
-
if (
|
|
6
|
-
return safeAsync(
|
|
4
|
+
function safe(promiseOrFunction) {
|
|
5
|
+
if (promiseOrFunction instanceof Promise) {
|
|
6
|
+
return safeAsync(promiseOrFunction);
|
|
7
7
|
}
|
|
8
|
-
return safeSync(
|
|
8
|
+
return safeSync(promiseOrFunction);
|
|
9
9
|
}
|
|
10
10
|
exports.safe = safe;
|
|
11
11
|
async function safeAsync(promise) {
|
|
@@ -13,21 +13,21 @@ async function safeAsync(promise) {
|
|
|
13
13
|
const data = await promise;
|
|
14
14
|
return { data, success: true };
|
|
15
15
|
}
|
|
16
|
-
catch (
|
|
17
|
-
if (
|
|
18
|
-
return { success: false, error:
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (error instanceof Error) {
|
|
18
|
+
return { success: false, error: error.message, errorObj: error };
|
|
19
19
|
}
|
|
20
20
|
return { success: false, error: "Something went wrong" };
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function safeSync(
|
|
23
|
+
function safeSync(function_) {
|
|
24
24
|
try {
|
|
25
|
-
const data =
|
|
25
|
+
const data = function_();
|
|
26
26
|
return { data, success: true };
|
|
27
27
|
}
|
|
28
|
-
catch (
|
|
29
|
-
if (
|
|
30
|
-
return { success: false, error:
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (error instanceof Error) {
|
|
30
|
+
return { success: false, error: error.message, errorObj: error };
|
|
31
31
|
}
|
|
32
32
|
return { success: false, error: "Something went wrong" };
|
|
33
33
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.speedKitRuleToRegExp = void 0;
|
|
4
|
-
function escapeRegExp(
|
|
5
|
-
return
|
|
4
|
+
function escapeRegExp(string_) {
|
|
5
|
+
return string_.replaceAll(/[\s#$()*+,.?[\\\]^{|}-]/g, "\\$&");
|
|
6
6
|
}
|
|
7
7
|
function speedKitRuleToRegExp(url) {
|
|
8
|
-
return new RegExp(`^${escapeRegExp(url).
|
|
8
|
+
return new RegExp(`^${escapeRegExp(url).replaceAll("\\*", ".*")}$`);
|
|
9
9
|
}
|
|
10
10
|
exports.speedKitRuleToRegExp = speedKitRuleToRegExp;
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.watchFiles = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
-
const
|
|
6
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
7
7
|
function watchFiles(filenames, listener) {
|
|
8
8
|
for (const filename of filenames) {
|
|
9
9
|
if (!filename) {
|
|
10
10
|
// asset comes not from the local filesystem
|
|
11
11
|
continue;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
node_fs_1.default.watchFile(filename, async () => {
|
|
14
14
|
console.info((0, chalk_1.default) `Updated {bold ${filename}}`);
|
|
15
15
|
await listener();
|
|
16
16
|
});
|
|
@@ -6,7 +6,7 @@ export declare enum CLIParameters {
|
|
|
6
6
|
Cookies = "cookies",
|
|
7
7
|
CreateTests = "CreateTests",
|
|
8
8
|
CustomerPath = "customerPath",
|
|
9
|
-
|
|
9
|
+
CustomersDirectory = "customersDirectory",
|
|
10
10
|
Delay = "delay",
|
|
11
11
|
DryRun = "dryRun",
|
|
12
12
|
Group = "group",
|
|
@@ -30,7 +30,7 @@ export declare enum CLIParametersChar {
|
|
|
30
30
|
Cookies = "c",
|
|
31
31
|
CreateTests = "t",
|
|
32
32
|
CustomerPath = "p",
|
|
33
|
-
|
|
33
|
+
CustomersDirectory = "d",
|
|
34
34
|
Delay = "d",
|
|
35
35
|
DryRun = "d",
|
|
36
36
|
Group = "g",
|
|
@@ -50,7 +50,7 @@ export declare enum CLIParametersExample {
|
|
|
50
50
|
ContentTypes = "image,style",
|
|
51
51
|
Cookies = "consentCookies",
|
|
52
52
|
CustomerPath = "customer/decathlon.de",
|
|
53
|
-
|
|
53
|
+
CustomersDirectory = "customers",
|
|
54
54
|
Delay = "1200",
|
|
55
55
|
Group = "B",
|
|
56
56
|
Ips = "151.101.120.194",
|
|
@@ -11,7 +11,7 @@ var CLIParameters;
|
|
|
11
11
|
CLIParameters["Cookies"] = "cookies";
|
|
12
12
|
CLIParameters["CreateTests"] = "CreateTests";
|
|
13
13
|
CLIParameters["CustomerPath"] = "customerPath";
|
|
14
|
-
CLIParameters["
|
|
14
|
+
CLIParameters["CustomersDirectory"] = "customersDirectory";
|
|
15
15
|
CLIParameters["Delay"] = "delay";
|
|
16
16
|
CLIParameters["DryRun"] = "dryRun";
|
|
17
17
|
CLIParameters["Group"] = "group";
|
|
@@ -37,7 +37,7 @@ var CLIParametersChar;
|
|
|
37
37
|
CLIParametersChar["Cookies"] = "c";
|
|
38
38
|
CLIParametersChar["CreateTests"] = "t";
|
|
39
39
|
CLIParametersChar["CustomerPath"] = "p";
|
|
40
|
-
CLIParametersChar["
|
|
40
|
+
CLIParametersChar["CustomersDirectory"] = "d";
|
|
41
41
|
CLIParametersChar["Delay"] = "d";
|
|
42
42
|
CLIParametersChar["DryRun"] = "d";
|
|
43
43
|
CLIParametersChar["Group"] = "g";
|
|
@@ -59,7 +59,7 @@ var CLIParametersExample;
|
|
|
59
59
|
CLIParametersExample["ContentTypes"] = "image,style";
|
|
60
60
|
CLIParametersExample["Cookies"] = "consentCookies";
|
|
61
61
|
CLIParametersExample["CustomerPath"] = "customer/decathlon.de";
|
|
62
|
-
CLIParametersExample["
|
|
62
|
+
CLIParametersExample["CustomersDirectory"] = "customers";
|
|
63
63
|
CLIParametersExample["Delay"] = "1200";
|
|
64
64
|
CLIParametersExample["Group"] = "B";
|
|
65
65
|
CLIParametersExample["Ips"] = "151.101.120.194";
|
|
@@ -50,8 +50,8 @@ class AthenaService {
|
|
|
50
50
|
continue; // the first row contains the column names
|
|
51
51
|
}
|
|
52
52
|
const row = {};
|
|
53
|
-
for (let
|
|
54
|
-
row[columns[
|
|
53
|
+
for (let index = 0; index < rowRaw.Data.length; index++) {
|
|
54
|
+
row[columns[index]] = this.castValueToType(rowRaw.Data[index].VarCharValue, types[index]);
|
|
55
55
|
}
|
|
56
56
|
rows.push(row);
|
|
57
57
|
}
|
|
@@ -23,7 +23,7 @@ class BundleService {
|
|
|
23
23
|
logLevel,
|
|
24
24
|
});
|
|
25
25
|
return result.outputFiles
|
|
26
|
-
.map((
|
|
26
|
+
.map((outputFile) => outputFile.text)
|
|
27
27
|
.join("")
|
|
28
28
|
.trim();
|
|
29
29
|
}
|
|
@@ -31,18 +31,18 @@ class BundleService {
|
|
|
31
31
|
return {
|
|
32
32
|
name: "entryPoints",
|
|
33
33
|
setup(build) {
|
|
34
|
-
build.onResolve({ filter: /.*/ }, (
|
|
35
|
-
if (!entryPoints[
|
|
36
|
-
throw new Error("Could not resolve " +
|
|
34
|
+
build.onResolve({ filter: /.*/ }, (arguments_) => {
|
|
35
|
+
if (!entryPoints[arguments_.path]) {
|
|
36
|
+
throw new Error("Could not resolve " + arguments_.path);
|
|
37
37
|
}
|
|
38
38
|
return {
|
|
39
|
-
path:
|
|
39
|
+
path: arguments_.path,
|
|
40
40
|
namespace: "entryPoint",
|
|
41
41
|
};
|
|
42
42
|
});
|
|
43
|
-
build.onLoad({ filter: /.*/, namespace: "entryPoint" }, (
|
|
43
|
+
build.onLoad({ filter: /.*/, namespace: "entryPoint" }, (arguments_) => {
|
|
44
44
|
return {
|
|
45
|
-
contents: entryPoints[
|
|
45
|
+
contents: entryPoints[arguments_.path],
|
|
46
46
|
loader: "js",
|
|
47
47
|
};
|
|
48
48
|
});
|
|
@@ -54,8 +54,8 @@ class BundleService {
|
|
|
54
54
|
return {
|
|
55
55
|
name: "baqend",
|
|
56
56
|
setup(build) {
|
|
57
|
-
build.onResolve({ filter }, (
|
|
58
|
-
const [base, path] =
|
|
57
|
+
build.onResolve({ filter }, (arguments_) => {
|
|
58
|
+
const [base, path] = arguments_.path.split("/", 2);
|
|
59
59
|
const url = new node_url_1.URL(path, basePaths[base]).toString();
|
|
60
60
|
if (!url.startsWith(basePaths[base])) {
|
|
61
61
|
throw new Error(`Importing ${path} failed. Can't resolve the path`);
|
|
@@ -65,12 +65,12 @@ class BundleService {
|
|
|
65
65
|
namespace: "baqend-url",
|
|
66
66
|
};
|
|
67
67
|
});
|
|
68
|
-
build.onResolve({ filter: /.*/, namespace: "baqend-url" }, (
|
|
69
|
-
path: new node_url_1.URL(
|
|
70
|
-
namespace:
|
|
68
|
+
build.onResolve({ filter: /.*/, namespace: "baqend-url" }, (arguments_) => ({
|
|
69
|
+
path: new node_url_1.URL(arguments_.path, arguments_.importer).toString(),
|
|
70
|
+
namespace: arguments_.namespace,
|
|
71
71
|
}));
|
|
72
|
-
build.onLoad({ filter: /.*/, namespace: "baqend-url" }, async (
|
|
73
|
-
const url =
|
|
72
|
+
build.onLoad({ filter: /.*/, namespace: "baqend-url" }, async (arguments_) => {
|
|
73
|
+
const url = arguments_.path + (arguments_.path.endsWith(".js") ? "" : ".js");
|
|
74
74
|
if (importCache[url]) {
|
|
75
75
|
return { contents: importCache[url] };
|
|
76
76
|
}
|
|
@@ -92,17 +92,21 @@ class CliService {
|
|
|
92
92
|
}
|
|
93
93
|
endAction(status) {
|
|
94
94
|
switch (status) {
|
|
95
|
-
case cli_service_model_1.CliActionStatus.COMPLETED:
|
|
95
|
+
case cli_service_model_1.CliActionStatus.COMPLETED: {
|
|
96
96
|
core_1.ux.action.stop(this.style.green(cli_service_model_1.CliActionStatus.COMPLETED));
|
|
97
97
|
break;
|
|
98
|
-
|
|
98
|
+
}
|
|
99
|
+
case cli_service_model_1.CliActionStatus.FAILED: {
|
|
99
100
|
core_1.ux.action.stop(this.style.red(cli_service_model_1.CliActionStatus.FAILED));
|
|
100
101
|
break;
|
|
101
|
-
|
|
102
|
+
}
|
|
103
|
+
case cli_service_model_1.CliActionStatus.SKIPPED: {
|
|
102
104
|
core_1.ux.action.stop(this.style.yellow(cli_service_model_1.CliActionStatus.SKIPPED));
|
|
103
105
|
break;
|
|
104
|
-
|
|
106
|
+
}
|
|
107
|
+
default: {
|
|
105
108
|
core_1.ux.action.stop();
|
|
109
|
+
}
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
112
|
writeBuffer() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const node_child_process_1 = require("node:child_process");
|
|
4
4
|
class Hooks {
|
|
5
5
|
preHook;
|
|
6
6
|
postHook;
|
|
@@ -20,14 +20,14 @@ class Hooks {
|
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
this.cli.writeSuccess(this.preHook);
|
|
23
|
-
this.cli.write((0,
|
|
23
|
+
this.cli.write((0, node_child_process_1.execSync)(this.preHook) + "");
|
|
24
24
|
}
|
|
25
25
|
async runPostHook() {
|
|
26
26
|
if (!this.postHook) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
this.cli.writeSuccess(this.postHook);
|
|
30
|
-
this.cli.write((0,
|
|
30
|
+
this.cli.write((0, node_child_process_1.execSync)(this.postHook) + "");
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.default = Hooks;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
4
|
+
const node_https_1 = require("node:https");
|
|
5
5
|
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
6
6
|
const deepmerge_1 = tslib_1.__importDefault(require("deepmerge"));
|
|
7
7
|
const race_1 = require("../../helpers/race");
|
|
@@ -14,14 +14,15 @@ class Client {
|
|
|
14
14
|
constructor(app, entityManagerFactory) {
|
|
15
15
|
this.app = app;
|
|
16
16
|
this.entityManagerFactory = entityManagerFactory;
|
|
17
|
-
this.agent = new
|
|
17
|
+
this.agent = new node_https_1.Agent({ rejectUnauthorized: false, keepAlive: true });
|
|
18
18
|
}
|
|
19
19
|
async send(url, requestExtension = {}) {
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
|
|
20
|
+
const response = await (0, node_fetch_1.default)(url, await this.createRequest(requestExtension));
|
|
21
|
+
if (response.status !== 200) {
|
|
22
|
+
const json = await response.json();
|
|
23
|
+
throw new Error(json.message);
|
|
23
24
|
}
|
|
24
|
-
return await
|
|
25
|
+
return await response.json();
|
|
25
26
|
}
|
|
26
27
|
async getModule(moduleName) {
|
|
27
28
|
const entityManager = await this.getEntityManager();
|
|
@@ -6,8 +6,8 @@ const client_1 = tslib_1.__importDefault(require("../client"));
|
|
|
6
6
|
const entity_manager_factory_1 = tslib_1.__importDefault(require("./entity-manager-factory"));
|
|
7
7
|
const context_runtime_error_1 = tslib_1.__importDefault(require("../../context/error/context-runtime-error"));
|
|
8
8
|
const node_fs_1 = require("node:fs");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const node_os_1 = tslib_1.__importDefault(require("node:os"));
|
|
10
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
11
11
|
class ConfigApiServiceFactory {
|
|
12
12
|
context;
|
|
13
13
|
service = undefined;
|
|
@@ -30,8 +30,8 @@ class ConfigApiServiceFactory {
|
|
|
30
30
|
this.service = new config_api_service_1.default(this.context.app, client);
|
|
31
31
|
}
|
|
32
32
|
createLoginTokenFileIfNotExists() {
|
|
33
|
-
if (!(0, node_fs_1.existsSync)(
|
|
34
|
-
(0, node_fs_1.writeFileSync)(
|
|
33
|
+
if (!(0, node_fs_1.existsSync)(node_path_1.default.resolve(node_os_1.default.homedir(), ".baqend"))) {
|
|
34
|
+
(0, node_fs_1.writeFileSync)(node_path_1.default.resolve(node_os_1.default.homedir(), ".baqend"), "{}");
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -4,7 +4,7 @@ export default class ConfigApiService {
|
|
|
4
4
|
private db;
|
|
5
5
|
private readonly app;
|
|
6
6
|
private readonly requestInit;
|
|
7
|
-
constructor(
|
|
7
|
+
constructor(database: EntityManager, app: string);
|
|
8
8
|
fetchActiveInstall(configName: string): Promise<Install | null>;
|
|
9
9
|
activateInstall(install: Install): Promise<Install>;
|
|
10
10
|
updateInstall(install: Install): Promise<Install | null>;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
5
5
|
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
6
|
-
const
|
|
7
|
-
const agent = new
|
|
6
|
+
const node_https_1 = tslib_1.__importDefault(require("node:https"));
|
|
7
|
+
const agent = new node_https_1.default.Agent({
|
|
8
8
|
rejectUnauthorized: false,
|
|
9
9
|
keepAlive: true,
|
|
10
10
|
});
|
|
@@ -13,8 +13,8 @@ class ConfigApiService {
|
|
|
13
13
|
db;
|
|
14
14
|
app;
|
|
15
15
|
requestInit;
|
|
16
|
-
constructor(
|
|
17
|
-
this.db =
|
|
16
|
+
constructor(database, app) {
|
|
17
|
+
this.db = database;
|
|
18
18
|
this.app = app;
|
|
19
19
|
this.requestInit = {
|
|
20
20
|
agent,
|
|
@@ -97,9 +97,9 @@ class ConfigApiService {
|
|
|
97
97
|
await this.fetchAndGetBody(urlPath, putInit);
|
|
98
98
|
}
|
|
99
99
|
async fetchAndGetBody(url, requestInit = this.requestInit) {
|
|
100
|
-
const
|
|
101
|
-
const body = await
|
|
102
|
-
if (
|
|
100
|
+
const response = await (0, node_fetch_1.default)(url, requestInit);
|
|
101
|
+
const body = await response.json();
|
|
102
|
+
if (response.status !== 200) {
|
|
103
103
|
throw new Error(body.message);
|
|
104
104
|
}
|
|
105
105
|
return body;
|
|
@@ -4,12 +4,12 @@ exports.CustomerConfigServiceContext = void 0;
|
|
|
4
4
|
const cli_parameters_1 = require("../../models/cli-parameters");
|
|
5
5
|
class CustomerConfigServiceContext {
|
|
6
6
|
appName;
|
|
7
|
-
|
|
8
|
-
constructor(appName = "",
|
|
7
|
+
customersDirectory;
|
|
8
|
+
constructor(appName = "", customersDirectory = cli_parameters_1.CLIParametersExample.CustomersDirectory) {
|
|
9
9
|
this.appName = appName;
|
|
10
|
-
this.
|
|
10
|
+
this.customersDirectory = customersDirectory;
|
|
11
11
|
this.appName = appName;
|
|
12
|
-
this.
|
|
12
|
+
this.customersDirectory = customersDirectory;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.CustomerConfigServiceContext = CustomerConfigServiceContext;
|