@speedkit/cli 3.9.0 → 3.9.1
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 +1 -1
- package/dist/services/onboarding/error/unsupported-encoding-error.d.ts +5 -0
- package/dist/services/onboarding/error/unsupported-encoding-error.js +14 -0
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +4 -4
- package/dist/services/onboarding/onboarding-model.d.ts +1 -0
- package/dist/services/onboarding/onboarding-model.js +2 -1
- package/dist/services/onboarding/virtual-orestes-app/index.js +6 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.9.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.9.0...v3.9.1) (2025-10-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **onboarding:** encoding could not be detected cause of a whitespace ([680cc2d](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/680cc2d27ecf9e09421a71bf135b9ac3968d658c))
|
|
7
|
+
|
|
1
8
|
# [3.9.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.8.0...v3.9.0) (2025-10-14)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnsupportedEncodingError = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
|
|
6
|
+
class UnsupportedEncodingError extends application_error_1.default {
|
|
7
|
+
code = "REQUEST_ENCODING_UNSUPPORTED";
|
|
8
|
+
suggestions = [
|
|
9
|
+
"Needs to be fixed by a developer.",
|
|
10
|
+
"Currently we use iconv to encode anything",
|
|
11
|
+
"If iconv can't handle it we need a special library",
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
exports.UnsupportedEncodingError = UnsupportedEncodingError;
|
|
@@ -6,6 +6,7 @@ const onboarding_model_1 = require("../onboarding-model");
|
|
|
6
6
|
const origin_response_1 = require("../browser/origin-response");
|
|
7
7
|
const iconv_lite_1 = tslib_1.__importDefault(require("iconv-lite"));
|
|
8
8
|
const encoding_japanese_1 = tslib_1.__importDefault(require("encoding-japanese"));
|
|
9
|
+
const unsupported_encoding_error_1 = require("../error/unsupported-encoding-error");
|
|
9
10
|
/**
|
|
10
11
|
* Intercepts any request to the customersOrigin and equivalent requests to baqendAssetApi
|
|
11
12
|
* @implements {FetchRequestPausedEventHandler}
|
|
@@ -119,9 +120,9 @@ class CustomerDomainDocumentResponse {
|
|
|
119
120
|
const buffer = Buffer.from(body, "base64");
|
|
120
121
|
const encodingFromBuffer = encoding_japanese_1.default.detect(buffer);
|
|
121
122
|
const encodedBody = iconv_lite_1.default
|
|
122
|
-
.decode(buffer, encodingFromHeader ??
|
|
123
|
+
.decode(buffer, encodingFromHeader ?? "utf-8")
|
|
123
124
|
.toString();
|
|
124
|
-
const metaSelector =
|
|
125
|
+
const metaSelector = onboarding_model_1.META_CONTENT_TYPE_REGEX;
|
|
125
126
|
const encodingFromBodyMeta = metaSelector.test(encodedBody)
|
|
126
127
|
? metaSelector.exec(encodedBody)[1]
|
|
127
128
|
: "";
|
|
@@ -130,8 +131,7 @@ class CustomerDomainDocumentResponse {
|
|
|
130
131
|
encodingFromBuffer ||
|
|
131
132
|
"utf-8";
|
|
132
133
|
if (!iconv_lite_1.default.encodingExists(detectedEncoding)) {
|
|
133
|
-
|
|
134
|
-
return encodedBody;
|
|
134
|
+
throw new unsupported_encoding_error_1.UnsupportedEncodingError(`encoding is not supported by cli: "${detectedEncoding}"`);
|
|
135
135
|
}
|
|
136
136
|
event.responseHeaders.push({
|
|
137
137
|
name: "x-sk-detected-encoding",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SpeedKitInstallRegex = exports.USER_AGENT = exports.OnboardingContext = exports.BrowserContext = exports.CDP_SESSION = exports.BROWSER_EVENTS = void 0;
|
|
3
|
+
exports.META_CONTENT_TYPE_REGEX = exports.SpeedKitInstallRegex = exports.USER_AGENT = exports.OnboardingContext = exports.BrowserContext = exports.CDP_SESSION = exports.BROWSER_EVENTS = void 0;
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const cli_parameters_1 = require("../../models/cli-parameters");
|
|
6
6
|
const browser_config_1 = require("./browser/config/browser-config");
|
|
@@ -156,3 +156,4 @@ exports.USER_AGENT = {
|
|
|
156
156
|
TV: "Mozilla/5.0 (Linux; NetCast; U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36 SmartTV/10.0 Colt/2.0 (compatible; SpeedKit/1.0)",
|
|
157
157
|
};
|
|
158
158
|
exports.SpeedKitInstallRegex = /<script[^>]*src[^>]*app\.baqend\.com\/v1\/speedkit\/install.js[^>]*>(?:(?!<\/script>).)*<\/script>/s;
|
|
159
|
+
exports.META_CONTENT_TYPE_REGEX = /<meta[^"]*http-equiv="content-type"[^"]*content="text\/html;[^"]*charset=([^\s"(),./:;<=>?@[\]]*)"/is;
|
|
@@ -8,6 +8,7 @@ const onboarding_model_1 = require("../onboarding-model");
|
|
|
8
8
|
const iconv_lite_1 = tslib_1.__importDefault(require("iconv-lite"));
|
|
9
9
|
const encoding_japanese_1 = tslib_1.__importDefault(require("encoding-japanese"));
|
|
10
10
|
const iconv_lite_2 = tslib_1.__importDefault(require("iconv-lite"));
|
|
11
|
+
const unsupported_encoding_error_1 = require("../error/unsupported-encoding-error");
|
|
11
12
|
class VirtualOrestesApp {
|
|
12
13
|
customerConfig;
|
|
13
14
|
crawler;
|
|
@@ -95,9 +96,9 @@ class VirtualOrestesApp {
|
|
|
95
96
|
: null;
|
|
96
97
|
const encodingFromBuffer = encoding_japanese_1.default.detect(buffer);
|
|
97
98
|
const encodedBody = iconv_lite_2.default
|
|
98
|
-
.decode(buffer, encodingFromHeader ??
|
|
99
|
+
.decode(buffer, encodingFromHeader ?? "utf-8")
|
|
99
100
|
.toString();
|
|
100
|
-
const metaSelector =
|
|
101
|
+
const metaSelector = onboarding_model_1.META_CONTENT_TYPE_REGEX;
|
|
101
102
|
const encodingFromBodyMeta = metaSelector.test(encodedBody)
|
|
102
103
|
? metaSelector.exec(encodedBody)[1]
|
|
103
104
|
: "";
|
|
@@ -105,6 +106,9 @@ class VirtualOrestesApp {
|
|
|
105
106
|
encodingFromBodyMeta ||
|
|
106
107
|
encodingFromBuffer ||
|
|
107
108
|
"utf-8";
|
|
109
|
+
if (!iconv_lite_2.default.encodingExists(detectedEncoding)) {
|
|
110
|
+
throw new unsupported_encoding_error_1.UnsupportedEncodingError(`encoding is not supported by cli: "${detectedEncoding}"`);
|
|
111
|
+
}
|
|
108
112
|
return {
|
|
109
113
|
responseContent: iconv_lite_1.default.decode(Buffer.from(buffer), detectedEncoding),
|
|
110
114
|
responseEncoding: detectedEncoding,
|
package/oclif.manifest.json
CHANGED