@speedkit/cli 4.44.0-beta.4 → 4.44.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 +35 -13
- package/README.md +68 -42
- package/dist/base/sk-command.d.ts +7 -0
- package/dist/base/sk-command.js +19 -0
- package/dist/commands/deploy.d.ts +1 -0
- package/dist/commands/deploy.js +5 -1
- package/dist/commands/diff.d.ts +47 -0
- package/dist/commands/diff.js +67 -0
- package/dist/commands/generate-pop-config.js +3 -7
- package/dist/helpers/race.js +4 -2
- package/dist/helpers/spec/race.spec.js +31 -0
- package/dist/models/files.d.ts +0 -1
- package/dist/models/files.js +0 -1
- package/dist/services/browser-fetch/browser-origin-fetch.js +1 -1
- package/dist/services/browser-fetch/browser-origin-fetcher.d.ts +1 -7
- package/dist/services/browser-fetch/browser-origin-fetcher.js +3 -26
- package/dist/services/bundler/bundle-service-factory.d.ts +0 -3
- package/dist/services/bundler/bundle-service-factory.js +1 -5
- package/dist/services/bundler/bundle-service.d.ts +1 -10
- package/dist/services/bundler/bundle-service.js +1 -16
- package/dist/services/bundler/index.d.ts +0 -1
- package/dist/services/bundler/index.js +0 -1
- package/dist/services/cli/cli-environment.d.ts +11 -0
- package/dist/services/cli/cli-environment.js +37 -0
- package/dist/services/cli/cli-service-model.d.ts +3 -1
- package/dist/services/cli/cli-service.d.ts +1 -1
- package/dist/services/cli/cli-service.js +4 -1
- package/dist/services/cli/spec/cli-environment.spec.js +30 -1
- package/dist/services/deploy/checks/activation/customer-approval-check.js +1 -1
- package/dist/services/deploy/checks/post-deploy/refresh-deployment-job-check.d.ts +2 -2
- package/dist/services/deploy/checks/post-deploy/refresh-deployment-job-check.js +8 -7
- package/dist/services/deploy/checks/post-deploy/revalidated-module-check.d.ts +2 -2
- package/dist/services/deploy/checks/post-deploy/revalidated-module-check.js +11 -7
- package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +2 -2
- package/dist/services/deploy/checks/post-deploy/save-files-check.js +3 -2
- package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +3 -2
- package/dist/services/deploy/checks/pre-deploy/split-change-check.js +3 -2
- package/dist/services/deploy/deploy-service-build-context.d.ts +2 -0
- package/dist/services/deploy/deploy-service-build-context.js +13 -2
- package/dist/services/deploy/deploy-service-factory.js +2 -9
- package/dist/services/deploy/deploy-service-model.d.ts +11 -1
- package/dist/services/deploy/deploy-service.d.ts +2 -0
- package/dist/services/deploy/deploy-service.js +26 -1
- package/dist/services/deploy/handler/customer-config-handler.d.ts +2 -2
- package/dist/services/deploy/handler/install-resource-handler.d.ts +2 -2
- package/dist/services/deploy/handler/install-resource-handler.js +6 -3
- package/dist/services/deploy/handler/module-handler.d.ts +2 -2
- package/dist/services/deploy/handler/module-handler.js +2 -2
- package/dist/services/deploy/handler/server-config-handler.d.ts +2 -2
- package/dist/services/deploy/handler/server-config-handler.js +2 -2
- package/dist/services/deploy/mr/live-state-check.d.ts +2 -2
- package/dist/services/deploy/mr/merge-request-deploy-service-factory.js +2 -7
- package/dist/services/deploy/policy/deploy-policy-model.d.ts +1 -5
- package/dist/services/deploy/policy/deploy-policy-model.js +0 -4
- package/dist/services/deploy/policy/index.d.ts +1 -0
- package/dist/services/deploy/policy/index.js +1 -0
- package/dist/services/deploy/policy/testing-deploy-policy.d.ts +16 -0
- package/dist/services/deploy/policy/testing-deploy-policy.js +42 -0
- package/dist/services/deploy/spec/checks/post-deploy/refresh-deployment-job-check.spec.js +5 -12
- package/dist/services/deploy/spec/deploy-service.spec.js +64 -0
- package/dist/services/deploy/spec/handler/install-resource-handler.spec.js +58 -0
- package/dist/services/deploy/spec/mr/live-state-check.spec.js +2 -2
- package/dist/services/deploy/spec/policy/auto-deploy-policy.spec.js +0 -2
- package/dist/services/deploy/spec/policy/testing-deploy-policy.spec.d.ts +1 -0
- package/dist/services/deploy/spec/policy/testing-deploy-policy.spec.js +46 -0
- package/dist/services/diff/create-diff-engine.d.ts +14 -0
- package/dist/services/diff/create-diff-engine.js +42 -0
- package/dist/services/diff/customer-origin.d.ts +9 -0
- package/dist/services/diff/customer-origin.js +19 -0
- package/dist/services/diff/diff-engine.d.ts +30 -0
- package/dist/services/diff/diff-engine.js +49 -0
- package/dist/services/diff/diff-log.d.ts +9 -0
- package/dist/services/diff/diff-log.js +18 -0
- package/dist/services/diff/diff-model.d.ts +68 -0
- package/dist/services/diff/diff-model.js +1 -0
- package/dist/services/diff/diff-service-build-context.d.ts +99 -9
- package/dist/services/diff/diff-service-build-context.js +299 -1
- package/dist/services/diff/diff-service-factory.d.ts +24 -2
- package/dist/services/diff/diff-service-factory.js +165 -3
- package/dist/services/diff/diff-service.d.ts +93 -33
- package/dist/services/diff/diff-service.js +274 -140
- package/dist/services/diff/index.d.ts +12 -1
- package/dist/services/diff/index.js +12 -1
- package/dist/services/diff/noise-baseline.d.ts +28 -0
- package/dist/services/diff/noise-baseline.js +105 -0
- package/dist/services/diff/page-source.d.ts +42 -0
- package/dist/services/diff/page-source.js +93 -0
- package/dist/services/diff/side-failure.d.ts +28 -0
- package/dist/services/diff/side-failure.js +100 -0
- package/dist/services/diff/sinks/json-diff-sink.d.ts +32 -0
- package/dist/services/diff/sinks/json-diff-sink.js +44 -0
- package/dist/services/diff/sinks/no-diff-sink.d.ts +5 -0
- package/dist/services/diff/sinks/no-diff-sink.js +6 -0
- package/dist/services/diff/sinks/patch-diff-sink.d.ts +19 -0
- package/dist/services/diff/sinks/patch-diff-sink.js +29 -0
- package/dist/services/diff/sinks/tool-diff-sink.d.ts +26 -0
- package/dist/services/diff/sinks/tool-diff-sink.js +88 -0
- package/dist/services/diff/sinks/unified-patch.d.ts +7 -0
- package/dist/services/diff/sinks/unified-patch.js +12 -0
- package/dist/services/diff/spec/customer-origin.spec.d.ts +1 -0
- package/dist/services/diff/spec/customer-origin.spec.js +27 -0
- package/dist/services/diff/spec/diff-engine.spec.d.ts +1 -0
- package/dist/services/diff/spec/diff-engine.spec.js +47 -0
- package/dist/services/diff/spec/diff-service-build-context.spec.d.ts +1 -0
- package/dist/services/diff/spec/diff-service-build-context.spec.js +185 -0
- package/dist/services/diff/spec/diff-service.spec.d.ts +1 -0
- package/dist/services/diff/spec/diff-service.spec.js +393 -0
- package/dist/services/diff/spec/noise-baseline.spec.d.ts +1 -0
- package/dist/services/diff/spec/noise-baseline.spec.js +95 -0
- package/dist/services/diff/spec/page-source.spec.d.ts +1 -0
- package/dist/services/diff/spec/page-source.spec.js +140 -0
- package/dist/services/diff/spec/sinks/json-diff-sink.spec.d.ts +1 -0
- package/dist/services/diff/spec/sinks/json-diff-sink.spec.js +72 -0
- package/dist/services/diff/spec/sinks/patch-diff-sink.spec.d.ts +1 -0
- package/dist/services/diff/spec/sinks/patch-diff-sink.spec.js +47 -0
- package/dist/services/diff/spec/sinks/tool-diff-sink.spec.d.ts +1 -0
- package/dist/services/diff/spec/sinks/tool-diff-sink.spec.js +61 -0
- package/dist/services/document-handler-runtime/document-handler-abort.d.ts +2 -0
- package/dist/services/document-handler-runtime/document-handler-abort.js +2 -0
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +0 -17
- package/dist/services/document-handler-runtime/document-handler-server.js +19 -81
- package/dist/services/document-handler-runtime/runtime-files.d.ts +9 -0
- package/dist/services/document-handler-runtime/runtime-files.js +17 -0
- package/dist/services/integration-api/integration-api-model.d.ts +1 -2
- package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +8 -68
- package/dist/services/integration-api/struct/customer-config.d.ts +1 -32
- package/dist/services/integration-api/struct/customer-config.js +3 -33
- package/dist/services/integration-api/struct/speed-kit-config-file.d.ts +4 -9
- package/dist/services/integration-api/struct/speed-kit-config-file.js +10 -27
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +8 -25
- package/dist/services/onboarding/dashboard/diff-against-current-page.d.ts +29 -7
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +24 -37
- package/dist/services/onboarding/dashboard/index.js +13 -6
- package/dist/services/onboarding/dashboard/request-diff-service.d.ts +21 -8
- package/dist/services/onboarding/dashboard/request-diff-service.js +21 -49
- package/dist/services/onboarding/onboarding-model.d.ts +0 -1
- package/dist/services/onboarding/onboarding-model.js +0 -1
- package/dist/services/onboarding/onboarding-service-factory.d.ts +0 -1
- package/dist/services/onboarding/onboarding-service-factory.js +24 -30
- package/dist/services/onboarding/spec/dashboard/request-diff-service.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/dashboard/request-diff-service.spec.js +57 -0
- package/dist/services/onboarding/templates/install-speed-kit-js-template.js +0 -5
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +3 -3
- package/dist/services/onboarding/virtual-orestes-app/index.js +5 -5
- package/dist/services/origin-request/index.d.ts +3 -0
- package/dist/services/origin-request/index.js +3 -0
- package/dist/services/origin-request/origin-fetcher.d.ts +52 -0
- package/dist/services/origin-request/origin-fetcher.js +93 -0
- package/dist/services/origin-request/origin-request-service-factory.js +19 -1
- package/dist/services/origin-request/origin-request-service.d.ts +6 -10
- package/dist/services/origin-request/origin-request-service.js +28 -70
- package/dist/services/origin-request/runtime-config-source.d.ts +36 -0
- package/dist/services/origin-request/runtime-config-source.js +59 -0
- package/dist/services/origin-request/spec/origin-error-cause.spec.d.ts +1 -0
- package/dist/services/{onboarding/spec/virtual-orestes-app → origin-request/spec}/origin-error-cause.spec.js +1 -1
- package/dist/services/origin-request/spec/origin-fetcher.spec.d.ts +1 -0
- package/dist/services/{onboarding/spec/virtual-orestes-app/crawler.spec.js → origin-request/spec/origin-fetcher.spec.js} +46 -15
- package/dist/services/prewarm/assets/asset-api-client.d.ts +6 -0
- package/dist/services/prewarm/assets/asset-api-client.js +6 -1
- package/dist/services/prewarm/pre-warm-service.d.ts +10 -0
- package/dist/services/prewarm/pre-warm-service.js +17 -0
- package/dist/services/prewarm/spec/pre-warm-service.spec.d.ts +1 -0
- package/dist/services/prewarm/spec/pre-warm-service.spec.js +72 -0
- package/dist/services/query-builder/query-builder-factory.js +3 -3
- package/dist/services/setup/os/tool-registry.d.ts +1 -1
- package/oclif.manifest.json +151 -19
- package/package.json +1 -2
- package/dist/commands/diff-url-parameters.d.ts +0 -19
- package/dist/commands/diff-url-parameters.js +0 -121
- package/dist/services/bundler/error/packjockel-error.d.ts +0 -3
- package/dist/services/bundler/error/packjockel-error.js +0 -3
- package/dist/services/bundler/packjockel-service.d.ts +0 -72
- package/dist/services/bundler/packjockel-service.js +0 -156
- package/dist/services/bundler/spec/packjockel-service.spec.js +0 -143
- package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.d.ts +0 -15
- package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.js +0 -70
- package/dist/services/deploy/error/check-module-file-error.d.ts +0 -4
- package/dist/services/deploy/error/check-module-file-error.js +0 -4
- package/dist/services/deploy/error/post-deploy-deployment-detection-error.d.ts +0 -4
- package/dist/services/deploy/error/post-deploy-deployment-detection-error.js +0 -4
- package/dist/services/onboarding/server-config/index.d.ts +0 -10
- package/dist/services/onboarding/server-config/index.js +0 -27
- package/dist/services/onboarding/virtual-orestes-app/crawler.d.ts +0 -31
- package/dist/services/onboarding/virtual-orestes-app/crawler.js +0 -98
- /package/dist/{services/bundler/spec/packjockel-service.spec.d.ts → helpers/spec/race.spec.d.ts} +0 -0
- /package/dist/services/{onboarding/spec/virtual-orestes-app/crawler.spec.d.ts → deploy/spec/deploy-service.spec.d.ts} +0 -0
- /package/dist/services/{onboarding/spec/virtual-orestes-app/origin-error-cause.spec.d.ts → deploy/spec/handler/install-resource-handler.spec.d.ts} +0 -0
- /package/dist/services/{onboarding/virtual-orestes-app → origin-request}/origin-error-cause.d.ts +0 -0
- /package/dist/services/{onboarding/virtual-orestes-app → origin-request}/origin-error-cause.js +0 -0
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
3
|
-
import { chmod, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
4
|
-
import { existsSync } from "node:fs";
|
|
5
|
-
import { tmpdir } from "node:os";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { PackjockelService } from "../packjockel-service.js";
|
|
8
|
-
import { PackjockelError } from "../error/packjockel-error.js";
|
|
9
|
-
/**
|
|
10
|
-
* A packjockel stand-in: it records its arguments, the content of every `file://` input and a
|
|
11
|
-
* piped stdin, and writes a fixed bundle to `--output`.
|
|
12
|
-
*/
|
|
13
|
-
const FAKE_PACKJOCKEL = `#!/bin/sh
|
|
14
|
-
if [ -p /dev/stdin ] || [ -f /dev/stdin ]; then
|
|
15
|
-
echo "piped" > "$RECORD_DIR/stdin"
|
|
16
|
-
fi
|
|
17
|
-
out=""
|
|
18
|
-
for arg in "$@"; do
|
|
19
|
-
echo "$arg" >> "$RECORD_DIR/args"
|
|
20
|
-
case "$arg" in
|
|
21
|
-
--output=*) out="\${arg#--output=}" ;;
|
|
22
|
-
esac
|
|
23
|
-
path=$(echo "$arg" | sed -n 's|.*file://||p')
|
|
24
|
-
if [ -n "$path" ]; then
|
|
25
|
-
echo "$(basename "$path"): $(cat "$path")" >> "$RECORD_DIR/inputs"
|
|
26
|
-
fi
|
|
27
|
-
done
|
|
28
|
-
if [ -n "$FAIL" ]; then
|
|
29
|
-
echo "time=\\"2026\\" level=info msg=starting" >&2
|
|
30
|
-
echo "invalid bundle: could not resolve x" >&2
|
|
31
|
-
exit 1
|
|
32
|
-
fi
|
|
33
|
-
echo "bundled" > "$out"
|
|
34
|
-
`;
|
|
35
|
-
describe("PackjockelService", () => {
|
|
36
|
-
let directory;
|
|
37
|
-
let service;
|
|
38
|
-
beforeEach(async () => {
|
|
39
|
-
directory = await mkdtemp(join(tmpdir(), "packjockel-spec-"));
|
|
40
|
-
const binary = join(directory, "packjockel");
|
|
41
|
-
await writeFile(binary, FAKE_PACKJOCKEL);
|
|
42
|
-
await chmod(binary, 0o755);
|
|
43
|
-
process.env.RECORD_DIR = directory;
|
|
44
|
-
service = new PackjockelService(() => binary);
|
|
45
|
-
});
|
|
46
|
-
afterEach(async () => {
|
|
47
|
-
delete process.env.RECORD_DIR;
|
|
48
|
-
delete process.env.FAIL;
|
|
49
|
-
await rm(directory, { recursive: true, force: true });
|
|
50
|
-
});
|
|
51
|
-
async function recorded() {
|
|
52
|
-
const args = (await readFile(join(directory, "args"), "utf8"))
|
|
53
|
-
.trim()
|
|
54
|
-
.split("\n");
|
|
55
|
-
const inputs = (await readFile(join(directory, "inputs"), "utf8"))
|
|
56
|
-
.trim()
|
|
57
|
-
.split("\n");
|
|
58
|
-
return { args, inputs };
|
|
59
|
-
}
|
|
60
|
-
it("should bundle the entry points in their order", async () => {
|
|
61
|
-
const bundle = await service.bundle({
|
|
62
|
-
entryPoints: { "rum.js": "rum()", "config.js": "SpeedKit.config = {}" },
|
|
63
|
-
versions: { configPluginsVersion: "@release", rumPluginVersion: "" },
|
|
64
|
-
define: { APP: '"shop"' },
|
|
65
|
-
platform: "browser",
|
|
66
|
-
});
|
|
67
|
-
const { args, inputs } = await recorded();
|
|
68
|
-
expect(bundle.trim()).to.equal("bundled");
|
|
69
|
-
expect(args.slice(0, 5)).to.deep.equal([
|
|
70
|
-
"bundle",
|
|
71
|
-
"--bundle",
|
|
72
|
-
"--platform=browser",
|
|
73
|
-
"--target=es5",
|
|
74
|
-
'--define=APP="shop"',
|
|
75
|
-
]);
|
|
76
|
-
expect(args).to.include("--config-plugins-version=@release");
|
|
77
|
-
expect(args.filter((arg) => arg.endsWith("-version=")), "a tag that is not set is left to packjockel").to.deep.equal([]);
|
|
78
|
-
expect(args).to.include("--embedded");
|
|
79
|
-
expect(inputs).to.deep.equal([
|
|
80
|
-
"rum.js: rum()",
|
|
81
|
-
"config.js: SpeedKit.config = {}",
|
|
82
|
-
]);
|
|
83
|
-
});
|
|
84
|
-
it("should bundle a document handler with every input it got", async () => {
|
|
85
|
-
await service.bundleDocumentHandler({
|
|
86
|
-
documentHandler: "var DocumentHandler = 1",
|
|
87
|
-
documentHandlerConfig: "export default new DocumentHandler()",
|
|
88
|
-
speedKitConfig: "SpeedKit.config = {}",
|
|
89
|
-
appName: "shop",
|
|
90
|
-
dynamicFetcherConfig: "window.dynamicBlockConfig = {}",
|
|
91
|
-
});
|
|
92
|
-
const { args, inputs } = await recorded();
|
|
93
|
-
expect(args.slice(0, 2)).to.deep.equal(["bundle", "document-handler"]);
|
|
94
|
-
expect(args).to.include("--app-name=shop");
|
|
95
|
-
expect(args.some((arg) => arg.startsWith("--dynamic-fetcher="))).to.equal(false);
|
|
96
|
-
expect(inputs).to.deep.equal([
|
|
97
|
-
"DocumentHandler.js: var DocumentHandler = 1",
|
|
98
|
-
"documentHandlerConfig.js: export default new DocumentHandler()",
|
|
99
|
-
"speedKitConfig.js: SpeedKit.config = {}",
|
|
100
|
-
"dynamicFetcherConfig.js: window.dynamicBlockConfig = {}",
|
|
101
|
-
]);
|
|
102
|
-
});
|
|
103
|
-
it("should leave the document handler to packjockel without one", async () => {
|
|
104
|
-
await service.bundleDocumentHandler({
|
|
105
|
-
documentHandlerConfig: "export default new DomDocumentHandler()",
|
|
106
|
-
speedKitConfig: "SpeedKit.config = {}",
|
|
107
|
-
appName: "shop",
|
|
108
|
-
versions: {
|
|
109
|
-
documentHandlerVersion: "1.8.0",
|
|
110
|
-
speedKitVersion: "2.22.4",
|
|
111
|
-
rumPluginVersion: "@release",
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
const { args, inputs } = await recorded();
|
|
115
|
-
expect(args.slice(0, 2)).to.deep.equal(["bundle", "document-handler"]);
|
|
116
|
-
expect(args[2], "no handler argument").to.match(/^--document-handler-config=/);
|
|
117
|
-
expect(args).to.include("--document-handler-version=1.8.0");
|
|
118
|
-
expect(args).to.include("--speed-kit-version=2.22.4");
|
|
119
|
-
expect(args).to.include("--rum-plugin-version=@release");
|
|
120
|
-
expect(existsSync(join(directory, "stdin")), "packjockel reads a piped stdin as the handler").to.equal(false);
|
|
121
|
-
expect(inputs).to.deep.equal([
|
|
122
|
-
"documentHandlerConfig.js: export default new DomDocumentHandler()",
|
|
123
|
-
"speedKitConfig.js: SpeedKit.config = {}",
|
|
124
|
-
]);
|
|
125
|
-
});
|
|
126
|
-
it("should report the error of packjockel without its log lines", async () => {
|
|
127
|
-
process.env.FAIL = "1";
|
|
128
|
-
const failure = await service
|
|
129
|
-
.bundle({ entryPoints: { "config.js": "x" } })
|
|
130
|
-
.catch((error) => error);
|
|
131
|
-
expect(failure).to.be.instanceOf(PackjockelError);
|
|
132
|
-
expect(failure.message).to.equal("packjockel failed: invalid bundle: could not resolve x");
|
|
133
|
-
});
|
|
134
|
-
it("should report a platform without a packjockel package", async () => {
|
|
135
|
-
const failure = await new PackjockelService(() => {
|
|
136
|
-
throw new Error("packjockel: @speedkit/packjockel-aix-ppc64 is not installed.");
|
|
137
|
-
})
|
|
138
|
-
.bundle({ entryPoints: { "config.js": "x" } })
|
|
139
|
-
.catch((error) => error);
|
|
140
|
-
expect(failure).to.be.instanceOf(PackjockelError);
|
|
141
|
-
expect(failure.message).to.contain("is not installed");
|
|
142
|
-
});
|
|
143
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PostDeployCheckInterface } from "../../deploy-service-model.js";
|
|
2
|
-
import { FileListInterface } from "../../../integration-api/index.js";
|
|
3
|
-
import { CliServiceInterface } from "../../../cli/index.js";
|
|
4
|
-
import { ConfigApiService } from "../../../config-api/index.js";
|
|
5
|
-
import { DeployPolicyInterface } from "../../policy/index.js";
|
|
6
|
-
export declare class DeprecatedDeploymentDetectionCheck implements PostDeployCheckInterface {
|
|
7
|
-
private fileList;
|
|
8
|
-
private cli;
|
|
9
|
-
private configApi;
|
|
10
|
-
private app;
|
|
11
|
-
private policy;
|
|
12
|
-
constructor(fileList: FileListInterface, cli: CliServiceInterface, configApi: ConfigApiService, app: string, policy: DeployPolicyInterface);
|
|
13
|
-
check(): Promise<void>;
|
|
14
|
-
private deleteDeploymentJobDefinition;
|
|
15
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { INTEGRATION_FILES } from "../../../../models/files.js";
|
|
2
|
-
import { safe } from "../../../../helpers/safe.js";
|
|
3
|
-
import { PostDeployDeploymentDetectionError } from "../../error/post-deploy-deployment-detection-error.js";
|
|
4
|
-
import { DeployQuestion } from "../../policy/index.js";
|
|
5
|
-
export class DeprecatedDeploymentDetectionCheck {
|
|
6
|
-
fileList;
|
|
7
|
-
cli;
|
|
8
|
-
configApi;
|
|
9
|
-
app;
|
|
10
|
-
policy;
|
|
11
|
-
constructor(fileList, cli, configApi, app, policy) {
|
|
12
|
-
this.fileList = fileList;
|
|
13
|
-
this.cli = cli;
|
|
14
|
-
this.configApi = configApi;
|
|
15
|
-
this.app = app;
|
|
16
|
-
this.policy = policy;
|
|
17
|
-
}
|
|
18
|
-
async check() {
|
|
19
|
-
this.cli.startAction("POST:CHECK:DEPLOYMENT_DETECTION", "[postDeployCheck] deploymentDetection");
|
|
20
|
-
const configFile = this.fileList.getByName(INTEGRATION_FILES.CONFIG.DOCUMENT_HANDLER);
|
|
21
|
-
const moduleFile = this.fileList.getByName(INTEGRATION_FILES.DEPRECATED.DEPLOYMENT_DETECTION);
|
|
22
|
-
// no config_documentHandler or module: deploymentDetection found
|
|
23
|
-
if (!configFile || moduleFile) {
|
|
24
|
-
this.cli.successAction("POST:CHECK:DEPLOYMENT_DETECTION");
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const content = configFile.getContent();
|
|
28
|
-
if (!content.includes("executeDeploymentDetection: true") &&
|
|
29
|
-
!content.includes("executeDeploymentDetection: {")) {
|
|
30
|
-
this.cli.successAction("POST:CHECK:DEPLOYMENT_DETECTION");
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const entityManager = await this.configApi.client.getEntityManager();
|
|
34
|
-
const deployCheckJob = await entityManager["jobs.Definition"]
|
|
35
|
-
.find()
|
|
36
|
-
.eq("id", "/db/jobs.Definition/deployment-check")
|
|
37
|
-
.singleResult();
|
|
38
|
-
const moduleResult = await safe(this.configApi.getModule(INTEGRATION_FILES.DEPRECATED.DEPLOYMENT_DETECTION));
|
|
39
|
-
this.cli.successAction("POST:CHECK:DEPLOYMENT_DETECTION");
|
|
40
|
-
if (deployCheckJob) {
|
|
41
|
-
this.cli.writeWarning(`Found active Job for ${this.cli.style.bold("deprecated")} deploymentDetection in app: ${this.app}`);
|
|
42
|
-
if (await this.policy.confirm(DeployQuestion.DeleteDeprecatedJob, "Delete job for deploymentDetection?")) {
|
|
43
|
-
await this.deleteDeploymentJobDefinition(deployCheckJob);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (moduleResult.success &&
|
|
47
|
-
moduleResult.data &&
|
|
48
|
-
moduleResult.data.length > 0) {
|
|
49
|
-
this.cli.writeWarning(`Found ${this.cli.style.bold("deprecated")} module deploymentDetection in app: ${this.app}`);
|
|
50
|
-
if (await this.policy.confirm(DeployQuestion.DeleteDeprecatedModule, "Delete module deploymentDetection?")) {
|
|
51
|
-
this.cli.startAction("POST:CHECK:DEPLOYMENT_DETECTION:DELETE", "Delete module deploymentDetection");
|
|
52
|
-
await this.configApi.deleteModule(INTEGRATION_FILES.DEPRECATED.DEPLOYMENT_DETECTION);
|
|
53
|
-
this.cli.successAction("POST:CHECK:DEPLOYMENT_DETECTION:DELETE");
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async deleteDeploymentJobDefinition(deployCheckJob) {
|
|
58
|
-
this.cli.startAction("POST:CHECK:DEPLOYMENT_DETECTION:DELETE_CRON", "Delete job deploymentDetection-check");
|
|
59
|
-
const result = await safe(deployCheckJob.delete());
|
|
60
|
-
if (result.success === true) {
|
|
61
|
-
this.cli.successAction("POST:CHECK:DEPLOYMENT_DETECTION:DELETE_CRON");
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
this.cli.failAction("POST:CHECK:DEPLOYMENT_DETECTION:DELETE_CRON");
|
|
65
|
-
throw new PostDeployDeploymentDetectionError(result.error, [
|
|
66
|
-
`check https://dashboard.baqend.com/app/${this.app}/db/jobs.Definition`,
|
|
67
|
-
"delete entry manual",
|
|
68
|
-
]);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CliServiceInterface } from "../../cli/index.js";
|
|
2
|
-
import { SpeedKitServerConfig } from "../onboarding-model.js";
|
|
3
|
-
import { ConfigApiService } from "../../config-api/index.js";
|
|
4
|
-
export declare class ServerConfig {
|
|
5
|
-
private cli;
|
|
6
|
-
private client?;
|
|
7
|
-
constructor(cli: CliServiceInterface, client?: ConfigApiService);
|
|
8
|
-
getServerSpeedKitConfig(): Promise<SpeedKitServerConfig | null>;
|
|
9
|
-
private getServerConfig;
|
|
10
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { safe } from "../../../helpers/safe.js";
|
|
2
|
-
export class ServerConfig {
|
|
3
|
-
cli;
|
|
4
|
-
client;
|
|
5
|
-
constructor(cli, client) {
|
|
6
|
-
this.cli = cli;
|
|
7
|
-
this.client = client;
|
|
8
|
-
}
|
|
9
|
-
async getServerSpeedKitConfig() {
|
|
10
|
-
const serverConfig = await this.getServerConfig();
|
|
11
|
-
if (!serverConfig) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
return JSON.parse(serverConfig);
|
|
15
|
-
}
|
|
16
|
-
async getServerConfig() {
|
|
17
|
-
this.cli.startAction("ONBOARDING:FETCH:RUNTIME_CONFIG", "wait for credentials from server-config");
|
|
18
|
-
const serverConfigResponse = await safe(this.client.getServerConfig());
|
|
19
|
-
if (serverConfigResponse.success === false) {
|
|
20
|
-
this.cli.failAction("ONBOARDING:FETCH:RUNTIME_CONFIG");
|
|
21
|
-
this.cli.writeError(`unable to load serverConfig: ${serverConfigResponse.error}`);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
this.cli.successAction("ONBOARDING:FETCH:RUNTIME_CONFIG");
|
|
25
|
-
return serverConfigResponse.data;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { SpeedKitServerConfig } from "../onboarding-model.js";
|
|
2
|
-
import { CliServiceInterface } from "../../cli/index.js";
|
|
3
|
-
export declare class Crawler {
|
|
4
|
-
private cli;
|
|
5
|
-
private speedKitServerConfig?;
|
|
6
|
-
/** Warnings already shown, so a per-fetch condition is reported once per session. */
|
|
7
|
-
private readonly warned;
|
|
8
|
-
constructor(cli: CliServiceInterface, speedKitServerConfig?: SpeedKitServerConfig);
|
|
9
|
-
private warnOnce;
|
|
10
|
-
fetchRemote(originUrl: string, variation: string): Promise<{
|
|
11
|
-
response: Response;
|
|
12
|
-
url: string;
|
|
13
|
-
} | undefined>;
|
|
14
|
-
/**
|
|
15
|
-
* Builds the origin request exactly as the Baqend asset server builds it, so a locally cached
|
|
16
|
-
* document matches what production would cache for the same variation.
|
|
17
|
-
*
|
|
18
|
-
* The resolution itself lives in `services/origin-request` and is shared with
|
|
19
|
-
* `sk origin-request`, so there is one owner for it and one place the server's behaviour is
|
|
20
|
-
* pinned by specs. That covers the base headers, the wildcard-then-variation order, the regex
|
|
21
|
-
* templates with their `${group}` substitution, and the query params.
|
|
22
|
-
*
|
|
23
|
-
* Two things stay local: origin basic auth, which no variation carries, and tolerance for a
|
|
24
|
-
* custom variation the config does not define — the server rejects that request, but failing a
|
|
25
|
-
* whole onboarding session over it would be unhelpful, so it falls back to the base headers and
|
|
26
|
-
* warns once. A missing runtime config is not reported here; the fetch that failed to load it
|
|
27
|
-
* says what it costs.
|
|
28
|
-
*/
|
|
29
|
-
private prepareOriginRequest;
|
|
30
|
-
private prepareAuthRequest;
|
|
31
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { safe } from "../../../helpers/safe.js";
|
|
2
|
-
import { resolveRequest, UndefinedVariationError, } from "../../origin-request/index.js";
|
|
3
|
-
import { originFetch } from "../../../helpers/origin-proxy.js";
|
|
4
|
-
import { randomUUID } from "node:crypto";
|
|
5
|
-
export class Crawler {
|
|
6
|
-
cli;
|
|
7
|
-
speedKitServerConfig;
|
|
8
|
-
/** Warnings already shown, so a per-fetch condition is reported once per session. */
|
|
9
|
-
warned = new Set();
|
|
10
|
-
constructor(cli, speedKitServerConfig) {
|
|
11
|
-
this.cli = cli;
|
|
12
|
-
this.speedKitServerConfig = speedKitServerConfig;
|
|
13
|
-
}
|
|
14
|
-
warnOnce(key, message) {
|
|
15
|
-
if (this.warned.has(key))
|
|
16
|
-
return;
|
|
17
|
-
this.warned.add(key);
|
|
18
|
-
this.cli.writeWarning(message);
|
|
19
|
-
}
|
|
20
|
-
async fetchRemote(originUrl, variation) {
|
|
21
|
-
// origin URL with the variation's query params applied — returned so callers compare it
|
|
22
|
-
// (not the bare originUrl) against response.url for redirect detection
|
|
23
|
-
const { url, init } = this.prepareOriginRequest(originUrl, variation);
|
|
24
|
-
const uuid = randomUUID();
|
|
25
|
-
this.cli.startAction(`DOCUMENTHANDLER:FETCH:${uuid}`, `[documentHandler:fetch]: ${url}`);
|
|
26
|
-
const fetchResponse = await safe(originFetch(url, init));
|
|
27
|
-
if (fetchResponse.success === true) {
|
|
28
|
-
this.cli.successAction(`DOCUMENTHANDLER:FETCH:${uuid}`);
|
|
29
|
-
return { response: fetchResponse.data, url };
|
|
30
|
-
}
|
|
31
|
-
this.cli.failAction(`DOCUMENTHANDLER:FETCH:${uuid}`, `error while fetching Asset: ${originUrl}`);
|
|
32
|
-
this.cli.writeError(fetchResponse.error);
|
|
33
|
-
this.cli.writeError(JSON.stringify(fetchResponse.errorObj));
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Builds the origin request exactly as the Baqend asset server builds it, so a locally cached
|
|
37
|
-
* document matches what production would cache for the same variation.
|
|
38
|
-
*
|
|
39
|
-
* The resolution itself lives in `services/origin-request` and is shared with
|
|
40
|
-
* `sk origin-request`, so there is one owner for it and one place the server's behaviour is
|
|
41
|
-
* pinned by specs. That covers the base headers, the wildcard-then-variation order, the regex
|
|
42
|
-
* templates with their `${group}` substitution, and the query params.
|
|
43
|
-
*
|
|
44
|
-
* Two things stay local: origin basic auth, which no variation carries, and tolerance for a
|
|
45
|
-
* custom variation the config does not define — the server rejects that request, but failing a
|
|
46
|
-
* whole onboarding session over it would be unhelpful, so it falls back to the base headers and
|
|
47
|
-
* warns once. A missing runtime config is not reported here; the fetch that failed to load it
|
|
48
|
-
* says what it costs.
|
|
49
|
-
*/
|
|
50
|
-
prepareOriginRequest(originUrl, variationParameter) {
|
|
51
|
-
const variations = this.speedKitServerConfig?.speedKit?.variations ?? {};
|
|
52
|
-
let resolved;
|
|
53
|
-
try {
|
|
54
|
-
resolved = resolveRequest(variations, originUrl, variationParameter);
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
// Only a custom variation reaches this branch: a device variation (default, mobile, tablet)
|
|
58
|
-
// never throws. It starts from its built-in default, and an entry for it in the runtime
|
|
59
|
-
// config is applied on top, so a configured user agent or header still wins.
|
|
60
|
-
if (!(error instanceof UndefinedVariationError))
|
|
61
|
-
throw error;
|
|
62
|
-
const defined = Object.keys(variations);
|
|
63
|
-
this.warnOnce(`undefined-variation:${variationParameter}`, `variation ${variationParameter} is not defined in the runtime config — ` +
|
|
64
|
-
(defined.length
|
|
65
|
-
? `defined are: ${defined.join(", ")}. `
|
|
66
|
-
: "it defines no variations at all. ") +
|
|
67
|
-
"Falling back to the base headers.");
|
|
68
|
-
resolved = resolveRequest({}, originUrl);
|
|
69
|
-
}
|
|
70
|
-
const init = { headers: { ...resolved.headers } };
|
|
71
|
-
// Only a request that matched no specific variation falls back to origin basic auth. The
|
|
72
|
-
// wildcard applies to every request, so it does not count as a match.
|
|
73
|
-
const matchedSpecificVariation = resolved.appliedKeys.some((key) => key !== "*" && !key.startsWith("device-default:"));
|
|
74
|
-
if (!matchedSpecificVariation) {
|
|
75
|
-
const authentication = this.prepareAuthRequest(originUrl);
|
|
76
|
-
if (authentication)
|
|
77
|
-
init.headers["Authorization"] = authentication;
|
|
78
|
-
}
|
|
79
|
-
return { url: resolved.url, init };
|
|
80
|
-
}
|
|
81
|
-
prepareAuthRequest(originUrl) {
|
|
82
|
-
// A missing `authentications` has to leave through the same door as an empty one. Comparing
|
|
83
|
-
// `undefined < 1` yields false, so the previous guard fell through and iterated undefined.
|
|
84
|
-
if (!this.speedKitServerConfig?.speedKit?.authentications?.length) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const origin = new URL(originUrl).origin;
|
|
88
|
-
for (const auth of this.speedKitServerConfig.speedKit.authentications) {
|
|
89
|
-
if (!auth.uri.includes(origin)) {
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (auth.type === "basic") {
|
|
93
|
-
return `Basic ${Buffer.from(`${auth.user}:${auth.password}`).toString("base64")}`;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
}
|
/package/dist/{services/bundler/spec/packjockel-service.spec.d.ts → helpers/spec/race.spec.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/services/{onboarding/virtual-orestes-app → origin-request}/origin-error-cause.d.ts
RENAMED
|
File without changes
|
/package/dist/services/{onboarding/virtual-orestes-app → origin-request}/origin-error-cause.js
RENAMED
|
File without changes
|