@speedkit/cli 2.10.0 → 2.11.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 +14 -0
- package/README.md +39 -58
- package/dist/commands/build-parameter-query.d.ts +4 -4
- package/dist/commands/build-parameter-query.js +38 -38
- package/dist/commands/build-prewarm-query.d.ts +4 -4
- package/dist/commands/build-prewarm-query.js +33 -34
- package/dist/commands/deploy.d.ts +4 -4
- package/dist/commands/deploy.js +14 -15
- package/dist/helpers/cli-config.d.ts +8 -7
- package/dist/helpers/cli-config.js +50 -44
- package/dist/services/cli/cli-service.d.ts +1 -1
- package/dist/services/deploy/context/deploy-context.d.ts +1 -4
- package/dist/services/deploy/context/deploy-context.js +6 -7
- package/dist/services/deploy/deploy-service-factory.d.ts +4 -5
- package/dist/services/deploy/deploy-service-factory.js +19 -18
- package/dist/services/integration-api/handler/customer-config-handler.d.ts +3 -3
- package/dist/services/integration-api/handler/customer-config-handler.js +20 -14
- package/dist/services/integration-api/struct/customer-config-file.d.ts +4 -3
- package/dist/services/integration-api/struct/customer-config-file.js +7 -5
- package/dist/services/onboarding/browser/abort-response.js +1 -1
- package/dist/services/onboarding/browser/baqend-response.d.ts +4 -4
- package/dist/services/onboarding/browser/baqend-response.js +33 -25
- package/dist/services/onboarding/browser/origin-response.d.ts +1 -1
- package/dist/services/onboarding/browser/origin-response.js +2 -3
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +4 -4
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +44 -32
- package/dist/services/onboarding/dashboard/athena-service.d.ts +2 -2
- package/dist/services/onboarding/dashboard/athena-service.js +28 -23
- package/dist/services/onboarding/dashboard/index.d.ts +3 -3
- package/dist/services/onboarding/dashboard/index.js +48 -36
- package/dist/services/onboarding/dashboard/param-query-builder.d.ts +2 -2
- package/dist/services/onboarding/dashboard/param-query-builder.js +2 -2
- package/dist/services/onboarding/dashboard/request-diff-service.d.ts +1 -1
- package/dist/services/onboarding/dashboard/request-diff-service.js +32 -28
- package/dist/services/onboarding/fetch-event-handler.d.ts +6 -6
- package/dist/services/onboarding/fetch-event-handler.js +72 -62
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +8 -8
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +51 -49
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +3 -3
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.js +6 -6
- package/dist/services/onboarding/fetch-events/dashboard-request.d.ts +2 -2
- package/dist/services/onboarding/fetch-events/dashboard-request.js +3 -3
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +7 -7
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +76 -59
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +3 -3
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.js +14 -14
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +6 -6
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +12 -10
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +7 -7
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +3 -3
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +4 -4
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +6 -4
- package/dist/services/onboarding/file-events/{fileWatcher.d.ts → file-watcher.d.ts} +9 -8
- package/dist/services/onboarding/file-events/{fileWatcher.js → file-watcher.js} +74 -56
- package/dist/services/onboarding/index.d.ts +3 -3
- package/dist/services/onboarding/onboarding-model.d.ts +36 -34
- package/dist/services/onboarding/onboarding-model.js +19 -19
- package/dist/services/onboarding/onboarding-service-factory.d.ts +6 -6
- package/dist/services/onboarding/onboarding-service-factory.js +80 -75
- package/dist/services/onboarding/onboarding-service.d.ts +7 -7
- package/dist/services/onboarding/onboarding-service.js +54 -48
- package/dist/services/onboarding/request-cache/cache.d.ts +3 -3
- package/dist/services/onboarding/request-cache/cache.js +7 -7
- package/dist/services/onboarding/server-config/index.js +2 -2
- package/dist/services/onboarding/todo-collector.d.ts +1 -1
- package/dist/services/onboarding/todo-collector.js +8 -6
- package/oclif.manifest.json +9 -9
- package/package.json +4 -3
|
@@ -19,7 +19,7 @@ class SpeedKitRumPiRequest {
|
|
|
19
19
|
this.cli = cli;
|
|
20
20
|
this.patterns = [
|
|
21
21
|
{
|
|
22
|
-
requestStage:
|
|
22
|
+
requestStage: "Request",
|
|
23
23
|
urlPattern: `https://${this.customerConfig.appDomain}/v1/rum/pi*`,
|
|
24
24
|
},
|
|
25
25
|
];
|
|
@@ -32,10 +32,10 @@ class SpeedKitRumPiRequest {
|
|
|
32
32
|
if (result.success === false) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
if (!(
|
|
35
|
+
if (!("changeDetection" in result.data)) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
const changeDetection = result.data.changeDetection;
|
|
38
|
+
const changeDetection = (result.data.changeDetection);
|
|
39
39
|
this.cache.removeEntry(changeDetection.url);
|
|
40
40
|
this.cli.write(`changeDetection triggered for url: ${changeDetection.url} - cleared from dh-cache`);
|
|
41
41
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Protocol from
|
|
2
|
-
import { FileInterface } from
|
|
3
|
-
import CustomerConfig from
|
|
4
|
-
import { FetchRequestPausedEventHandler } from
|
|
1
|
+
import Protocol from "devtools-protocol";
|
|
2
|
+
import { FileInterface } from "../../integration-api/integration-api-model";
|
|
3
|
+
import CustomerConfig from "../../integration-api/struct/customer-config";
|
|
4
|
+
import { FetchRequestPausedEventHandler } from "../onboarding-model";
|
|
5
5
|
/**
|
|
6
6
|
* SpeedKitServiceWorkerJs class is responsible for handling fetch requests for the SpeedKit service worker.
|
|
7
7
|
* Injects serviceWorker from local file, if custom_sw is present.
|
|
@@ -15,13 +15,15 @@ class SpeedKitServiceWorkerJs {
|
|
|
15
15
|
constructor(customerConfig, serviceWorker) {
|
|
16
16
|
this.customerConfig = customerConfig;
|
|
17
17
|
this.serviceWorker = serviceWorker;
|
|
18
|
-
this.patterns = [
|
|
19
|
-
|
|
18
|
+
this.patterns = [
|
|
19
|
+
{
|
|
20
|
+
requestStage: "Request",
|
|
20
21
|
urlPattern: `https://${this.customerConfig.appDomain}/v1/speedkit/sw.js*`,
|
|
21
|
-
}
|
|
22
|
+
},
|
|
23
|
+
];
|
|
22
24
|
}
|
|
23
25
|
async handle() {
|
|
24
|
-
return new baqend_response_1.BaqendResponse(this.serviceWorker.getContent(),
|
|
26
|
+
return new baqend_response_1.BaqendResponse(this.serviceWorker.getContent(), "text/javascript; charset=utf-8");
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
exports.SpeedKitServiceWorkerJs = SpeedKitServiceWorkerJs;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CliService } from "../../cli";
|
|
2
1
|
import { Page } from "puppeteer";
|
|
3
|
-
import
|
|
2
|
+
import { CliService } from "../../cli";
|
|
4
3
|
import { DocumentHandlerServer } from "../../document-handler-runtime/document-handler-server";
|
|
5
|
-
import { Cache } from "../request-cache/cache";
|
|
6
4
|
import { ConfigFileInterface, FileListInterface } from "../../integration-api/integration-api-model";
|
|
5
|
+
import CustomerConfig from "../../integration-api/struct/customer-config";
|
|
7
6
|
import { BrowserContext } from "../onboarding-model";
|
|
7
|
+
import { Cache } from "../request-cache/cache";
|
|
8
8
|
/**
|
|
9
9
|
* Add different callbacks that will be executed if a local file is changed.
|
|
10
10
|
*/
|
|
@@ -17,12 +17,13 @@ export declare class FileWatcher {
|
|
|
17
17
|
private cache;
|
|
18
18
|
constructor(cli: CliService, customerConfig: CustomerConfig, files: FileListInterface, documentHandler: DocumentHandlerServer, browserContext: BrowserContext, cache: Cache);
|
|
19
19
|
addCallbackOnFileChange(page: Page, serviceWorkerReinstallCallback: (file: ConfigFileInterface) => Promise<void>): void;
|
|
20
|
-
private
|
|
21
|
-
private
|
|
20
|
+
private clearPageFunction;
|
|
21
|
+
private clearServiceWorker;
|
|
22
22
|
private handleDynamicStyles;
|
|
23
|
-
private
|
|
23
|
+
private handleGenericConfigFiles;
|
|
24
|
+
private handleServiceWorkerDependencies;
|
|
24
25
|
private onChangeConfigFileCallback;
|
|
25
26
|
private onChangeDynamicStyleCallback;
|
|
26
|
-
private
|
|
27
|
-
private
|
|
27
|
+
private onChangeServiceWorkerCallback;
|
|
28
|
+
private updateStyles;
|
|
28
29
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileWatcher = void 0;
|
|
4
4
|
const safe_1 = require("../../../helpers/safe");
|
|
5
|
-
const virtual_file_1 = require("../../integration-api/struct/virtual-file");
|
|
6
5
|
const files_1 = require("../../../models/files");
|
|
6
|
+
const virtual_file_1 = require("../../integration-api/struct/virtual-file");
|
|
7
7
|
/**
|
|
8
8
|
* Add different callbacks that will be executed if a local file is changed.
|
|
9
9
|
*/
|
|
@@ -28,66 +28,88 @@ class FileWatcher {
|
|
|
28
28
|
this.handleGenericConfigFiles(page, installResource);
|
|
29
29
|
this.handleDynamicStyles(page);
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
async clearPageFunction(page) {
|
|
32
|
+
const client = await page.target().createCDPSession();
|
|
33
|
+
const cacheResponse = await client.send("CacheStorage.requestCacheNames", {
|
|
34
|
+
securityOrigin: this.browserContext.domain,
|
|
35
|
+
});
|
|
36
|
+
for (const cache of cacheResponse.caches) {
|
|
37
|
+
if (cache.cacheName.includes("baqend")) {
|
|
38
|
+
await client.send("CacheStorage.deleteCache", {
|
|
39
|
+
cacheId: cache.cacheId,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async clearServiceWorker(page) {
|
|
45
|
+
const client = await page.target().createCDPSession();
|
|
46
|
+
await client.send("ServiceWorker.enable");
|
|
47
|
+
await client.send("ServiceWorker.unregister", {
|
|
48
|
+
scopeURL: `https://${this.customerConfig.domain}`,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
handleDynamicStyles(page) {
|
|
52
|
+
if (!this.files.hasFile(files_1.INTEGRATION_FILES.CONFIG.DYNAMIC_STYLES)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
// add watcher that will instantly add changes to current page
|
|
56
|
+
this.files
|
|
57
|
+
.getByName(files_1.INTEGRATION_FILES.CONFIG.DYNAMIC_STYLES)
|
|
58
|
+
.onChange(async (file) => {
|
|
59
|
+
const result = await (0, safe_1.safe)(this.onChangeDynamicStyleCallback(file, page));
|
|
60
|
+
if (result.success === false) {
|
|
61
|
+
this.cli.writeError(`error after fileChange: ${file.name}: ${result.error}`);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
handleGenericConfigFiles(page, installResource) {
|
|
66
|
+
// add watcher to configFiles
|
|
67
|
+
const generalConfigFiles = [
|
|
68
|
+
files_1.INTEGRATION_FILES.CONFIG.DYNAMIC_BLOCKS,
|
|
69
|
+
files_1.INTEGRATION_FILES.CONFIG.DOCUMENT_HANDLER,
|
|
70
|
+
files_1.INTEGRATION_FILES.CUSTOM.DYNAMIC_FETCHER,
|
|
71
|
+
files_1.INTEGRATION_FILES.CUSTOM.DOCUMENT_HANDLER,
|
|
72
|
+
];
|
|
73
|
+
for (const configFile of generalConfigFiles) {
|
|
74
|
+
if (!this.files.hasFile(configFile)) {
|
|
36
75
|
continue;
|
|
37
76
|
}
|
|
38
|
-
const file = this.files.getByName(
|
|
77
|
+
const file = this.files.getByName(configFile);
|
|
39
78
|
if (file.type === virtual_file_1.VirtualFile) {
|
|
40
79
|
continue;
|
|
41
80
|
}
|
|
42
81
|
file.onChange(async (file) => {
|
|
43
|
-
const result = await (0, safe_1.safe)(this.
|
|
82
|
+
const result = await (0, safe_1.safe)(this.onChangeConfigFileCallback(page, installResource, file));
|
|
44
83
|
if (result.success === false) {
|
|
45
84
|
this.cli.writeError(`error after fileChange: ${file.name}: ${result.error}`);
|
|
46
85
|
}
|
|
47
86
|
});
|
|
48
87
|
}
|
|
49
88
|
}
|
|
50
|
-
|
|
51
|
-
// add watcher to
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
89
|
+
handleServiceWorkerDependencies(page, installResource, serviceWorkerReinstallCallback) {
|
|
90
|
+
// add watcher to serviceWorker related files
|
|
91
|
+
const serviceWorkerDependencies = [
|
|
92
|
+
files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT,
|
|
93
|
+
files_1.INTEGRATION_FILES.CONFIG.LOAD_HANDLER,
|
|
94
|
+
files_1.INTEGRATION_FILES.CUSTOM.LOADER,
|
|
95
|
+
files_1.INTEGRATION_FILES.CUSTOM.SW,
|
|
96
|
+
];
|
|
97
|
+
for (const dependency of serviceWorkerDependencies) {
|
|
98
|
+
if (!this.files.hasFile(dependency)) {
|
|
55
99
|
continue;
|
|
56
100
|
}
|
|
57
|
-
const file = this.files.getByName(
|
|
101
|
+
const file = this.files.getByName(dependency);
|
|
58
102
|
if (file.type === virtual_file_1.VirtualFile) {
|
|
59
103
|
continue;
|
|
60
104
|
}
|
|
61
105
|
file.onChange(async (file) => {
|
|
62
|
-
const result = await (0, safe_1.safe)(this.
|
|
106
|
+
const result = await (0, safe_1.safe)(this.onChangeServiceWorkerCallback(file, page, installResource, serviceWorkerReinstallCallback));
|
|
63
107
|
if (result.success === false) {
|
|
64
108
|
this.cli.writeError(`error after fileChange: ${file.name}: ${result.error}`);
|
|
65
109
|
}
|
|
66
110
|
});
|
|
67
111
|
}
|
|
68
112
|
}
|
|
69
|
-
handleDynamicStyles(page) {
|
|
70
|
-
if (!this.files.hasFile(files_1.INTEGRATION_FILES.CONFIG.DYNAMIC_STYLES)) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
// add watcher that will instantly add changes to current page
|
|
74
|
-
this.files.getByName(files_1.INTEGRATION_FILES.CONFIG.DYNAMIC_STYLES).onChange(async (file) => {
|
|
75
|
-
const result = await (0, safe_1.safe)(this.onChangeDynamicStyleCallback(file, page));
|
|
76
|
-
if (result.success === false) {
|
|
77
|
-
this.cli.writeError(`error after fileChange: ${file.name}: ${result.error}`);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
async onChangeServiceWorkerCallback(file, page, installResource, serviceWorkerReinstallCallback) {
|
|
82
|
-
this.cli.writeWarning(`changed file: ${file.name} (reinstall serviceWorker)`);
|
|
83
|
-
// clear speed-kit-service-worker-caches and uninstall serviceWorker
|
|
84
|
-
await this.clearPageFunction(page);
|
|
85
|
-
await this.clearServiceWorker(page);
|
|
86
|
-
// rebuild installResource
|
|
87
|
-
await installResource.buildContent();
|
|
88
|
-
// tell puppeteer to reinstall serviceworker on next navigate
|
|
89
|
-
await serviceWorkerReinstallCallback(file);
|
|
90
|
-
}
|
|
91
113
|
async onChangeConfigFileCallback(page, installResource, file) {
|
|
92
114
|
await this.clearPageFunction(page);
|
|
93
115
|
await this.documentHandler.buildDocumentHandler();
|
|
@@ -98,13 +120,7 @@ class FileWatcher {
|
|
|
98
120
|
async onChangeDynamicStyleCallback(file, page) {
|
|
99
121
|
this.cli.writeWarning(`changed file: ${file.name} (update styles on page)`);
|
|
100
122
|
const escapedStyles = encodeURI(file.getContent());
|
|
101
|
-
|
|
102
|
-
const styleElement = document.querySelector('#speed-kit-df-styles');
|
|
103
|
-
if (styleElement) {
|
|
104
|
-
styleElement.textContent = decodeURI(styles);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
const evaluateResult = await (0, safe_1.safe)(page.evaluate(`(${updateStyles.toString()})("${escapedStyles}");`));
|
|
123
|
+
const evaluateResult = await (0, safe_1.safe)(page.evaluate(`(${this.updateStyles.toString()})("${escapedStyles}");`));
|
|
108
124
|
if (evaluateResult.success === false) {
|
|
109
125
|
this.cli.writeError(evaluateResult.error);
|
|
110
126
|
}
|
|
@@ -115,19 +131,21 @@ class FileWatcher {
|
|
|
115
131
|
await this.documentHandler.buildDocumentHandler();
|
|
116
132
|
this.cache.clear();
|
|
117
133
|
}
|
|
118
|
-
async
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
134
|
+
async onChangeServiceWorkerCallback(file, page, installResource, serviceWorkerReinstallCallback) {
|
|
135
|
+
this.cli.writeWarning(`changed file: ${file.name} (reinstall serviceWorker)`);
|
|
136
|
+
// clear speed-kit-service-worker-caches and uninstall serviceWorker
|
|
137
|
+
await this.clearPageFunction(page);
|
|
138
|
+
await this.clearServiceWorker(page);
|
|
139
|
+
// rebuild installResource
|
|
140
|
+
await installResource.buildContent();
|
|
141
|
+
// tell puppeteer to reinstall serviceworker on next navigate
|
|
142
|
+
await serviceWorkerReinstallCallback(file);
|
|
126
143
|
}
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
144
|
+
updateStyles(styles) {
|
|
145
|
+
const styleElement = document.querySelector("#speed-kit-df-styles");
|
|
146
|
+
if (styleElement) {
|
|
147
|
+
styleElement.textContent = decodeURI(styles);
|
|
148
|
+
}
|
|
131
149
|
}
|
|
132
150
|
}
|
|
133
151
|
exports.FileWatcher = FileWatcher;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { OnboardingContext } from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export { OnboardingContext } from "./onboarding-model";
|
|
2
|
+
export * from "./onboarding-service";
|
|
3
|
+
export * from "./onboarding-service-factory";
|
|
@@ -1,69 +1,71 @@
|
|
|
1
|
-
import { Protocol } from "puppeteer-core";
|
|
2
1
|
import { CDPSession } from "puppeteer";
|
|
2
|
+
import { Protocol } from "puppeteer-core";
|
|
3
|
+
import { UserCliConfig } from "../../helpers/cli-config";
|
|
3
4
|
import { AbortResponse } from "./browser/abort-response";
|
|
4
5
|
export declare class BrowserContext {
|
|
5
6
|
readonly domain: string;
|
|
6
7
|
readonly chromeFlags?: string[];
|
|
8
|
+
readonly userConfig?: UserCliConfig;
|
|
7
9
|
readonly browserArgs: string[];
|
|
8
10
|
readonly chromePath: string;
|
|
9
11
|
startParameterDashboard: boolean;
|
|
10
|
-
constructor(domain: string, chromeFlags?: string[]);
|
|
12
|
+
constructor(domain: string, chromeFlags?: string[], userConfig?: UserCliConfig);
|
|
11
13
|
}
|
|
12
14
|
export interface FetchRequestPausedEventHandler {
|
|
15
|
+
handle(event: Protocol.Fetch.RequestPausedEvent, client: CDPSession): Promise<AbortResponse | Partial<Protocol.Fetch.FulfillRequestRequest> | void>;
|
|
13
16
|
readonly patterns: Protocol.Fetch.RequestPattern[];
|
|
14
|
-
handle(event: Protocol.Fetch.RequestPausedEvent, client: CDPSession): Promise<Partial<Protocol.Fetch.FulfillRequestRequest> | AbortResponse | void>;
|
|
15
17
|
}
|
|
16
18
|
export declare class OnboardingContext {
|
|
17
19
|
readonly customerPath: string;
|
|
18
20
|
readonly configName: string;
|
|
19
21
|
readonly local: boolean;
|
|
20
22
|
readonly verboseLevel?: boolean;
|
|
21
|
-
readonly DEFAULT_SW_PATH = "https://www.baqend.com/speed-kit/latest/sw.js";
|
|
22
|
-
readonly DEFAULT_SNIPPET_PATH = "https://www.baqend.com/speed-kit/latest/snippet.js";
|
|
23
23
|
readonly DEFAULT_DF_PATH = "https://www.baqend.com/speed-kit/latest/dynamic-fetcher.js";
|
|
24
24
|
readonly DEFAULT_DOCUMENT_HANDLER_PATH = "https://www.baqend.com/speed-kit-handler/latest/DocumentHandler.js";
|
|
25
|
+
readonly DEFAULT_SNIPPET_PATH = "https://www.baqend.com/speed-kit/latest/snippet.js";
|
|
26
|
+
readonly DEFAULT_SW_PATH = "https://www.baqend.com/speed-kit/latest/sw.js";
|
|
25
27
|
constructor(customerPath: string, configName: string, local: boolean, verboseLevel?: boolean);
|
|
26
28
|
}
|
|
27
29
|
export type awsCredentials = {
|
|
28
|
-
region: string;
|
|
29
30
|
accessKeyId: string;
|
|
31
|
+
region: string;
|
|
30
32
|
secretAccessKey: string;
|
|
31
33
|
};
|
|
32
34
|
export type SpeedKitServerConfigAuthentication = {
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
password: string;
|
|
36
|
+
type: "basic";
|
|
37
|
+
uri: string;
|
|
38
|
+
user: string;
|
|
37
39
|
};
|
|
38
40
|
export type SpeedKitServerConfigVariation = {
|
|
39
41
|
[key: string]: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
encodePrefixedUrl?: boolean;
|
|
43
|
+
headers?: {
|
|
44
|
+
cookie?: string;
|
|
42
45
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"regex"?: null | string;
|
|
46
|
+
queryParams?: [];
|
|
47
|
+
regex?: null | string;
|
|
48
|
+
urlPrefix?: string;
|
|
47
49
|
};
|
|
48
50
|
};
|
|
49
51
|
export type SpeedKitServerConfig = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
speedKit: {
|
|
53
|
+
assetRequestRateLimitLowerTTFBLimit: number;
|
|
54
|
+
assetRequestRateLimitUpperTTFBLimit: number;
|
|
55
|
+
assetRequestRateScaleDownFactor: number;
|
|
56
|
+
assetRequestRateScaleUpStep: number;
|
|
57
|
+
assetStreamingRateLimitTimeoutMs: 2000;
|
|
58
|
+
authentications: SpeedKitServerConfigAuthentication[];
|
|
59
|
+
defaultAssetRequestsPerSecond: number;
|
|
60
|
+
globalMaxAssetRequestsPerSecond: number;
|
|
61
|
+
globalMinAssetRequestsPerSecond: number;
|
|
62
|
+
httpAuthPass: null | string;
|
|
63
|
+
httpAuthType: "basic";
|
|
64
|
+
httpAuthURI: null | string;
|
|
65
|
+
httpAuthUser: null | string;
|
|
66
|
+
maxRevalidationWindowSize: number;
|
|
67
|
+
minMaxAge: number;
|
|
68
|
+
streamRateLimit: number;
|
|
69
|
+
variations: SpeedKitServerConfigVariation;
|
|
68
70
|
};
|
|
69
71
|
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OnboardingContext = exports.BrowserContext = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const dotenv = tslib_1.__importStar(require("dotenv"));
|
|
6
|
-
dotenv.config();
|
|
7
4
|
const DEFAULT_BROWSER_ARGS = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
"--enable-features=NetworkService",
|
|
6
|
+
"--no-first-run",
|
|
7
|
+
"--disable-infobars",
|
|
11
8
|
];
|
|
12
|
-
if (process.env.SPEED_KIT_EXTENSION_PATH) {
|
|
13
|
-
DEFAULT_BROWSER_ARGS.push(`--load-extension=${process.env.SPEED_KIT_EXTENSION_PATH}`, `--disable-extensions-except=${process.env.SPEED_KIT_EXTENSION_PATH}`);
|
|
14
|
-
}
|
|
15
|
-
if (process.env.CHROME_USER_PROFILE_PATH) {
|
|
16
|
-
DEFAULT_BROWSER_ARGS.push(`--user-data-dir=${process.env.CHROME_USER_PROFILE_PATH}`);
|
|
17
|
-
}
|
|
18
9
|
class BrowserContext {
|
|
19
10
|
domain;
|
|
20
11
|
chromeFlags;
|
|
12
|
+
userConfig;
|
|
21
13
|
browserArgs;
|
|
22
14
|
chromePath;
|
|
23
15
|
startParameterDashboard = false;
|
|
24
|
-
constructor(domain, chromeFlags) {
|
|
16
|
+
constructor(domain, chromeFlags, userConfig) {
|
|
25
17
|
this.domain = domain;
|
|
26
18
|
this.chromeFlags = chromeFlags;
|
|
19
|
+
this.userConfig = userConfig;
|
|
27
20
|
this.domain = domain;
|
|
28
21
|
this.chromeFlags = chromeFlags || [];
|
|
29
|
-
this.chromePath =
|
|
22
|
+
this.chromePath = userConfig.chromePath;
|
|
23
|
+
const browserArgs = DEFAULT_BROWSER_ARGS;
|
|
24
|
+
if (userConfig?.chromeExtensionPaths) {
|
|
25
|
+
browserArgs.push(`--load-extension=${userConfig?.chromeExtensionPaths}`, `--disable-extensions-except=${userConfig?.chromeExtensionPaths}`);
|
|
26
|
+
}
|
|
27
|
+
if (userConfig?.chromeUserProfilePath) {
|
|
28
|
+
browserArgs.push(`--user-data-dir=${userConfig?.chromeUserProfilePath}`);
|
|
29
|
+
}
|
|
30
30
|
this.browserArgs = [
|
|
31
|
-
...
|
|
31
|
+
...browserArgs,
|
|
32
32
|
`--unsafely-treat-insecure-origin-as-secure=${domain}`,
|
|
33
33
|
...this.chromeFlags,
|
|
34
34
|
];
|
|
@@ -40,10 +40,10 @@ class OnboardingContext {
|
|
|
40
40
|
configName;
|
|
41
41
|
local;
|
|
42
42
|
verboseLevel;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
DEFAULT_DF_PATH = "https://www.baqend.com/speed-kit/latest/dynamic-fetcher.js";
|
|
44
|
+
DEFAULT_DOCUMENT_HANDLER_PATH = "https://www.baqend.com/speed-kit-handler/latest/DocumentHandler.js";
|
|
45
|
+
DEFAULT_SNIPPET_PATH = "https://www.baqend.com/speed-kit/latest/snippet.js";
|
|
46
|
+
DEFAULT_SW_PATH = "https://www.baqend.com/speed-kit/latest/sw.js";
|
|
47
47
|
constructor(customerPath, configName, local, verboseLevel) {
|
|
48
48
|
this.customerPath = customerPath;
|
|
49
49
|
this.configName = configName;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { OnboardingService } from "./onboarding-service";
|
|
2
|
-
import { OnboardingContext } from "./onboarding-model";
|
|
3
1
|
import { UserCliConfig } from "../../helpers/cli-config";
|
|
2
|
+
import { OnboardingContext } from "./onboarding-model";
|
|
3
|
+
import { OnboardingService } from "./onboarding-service";
|
|
4
4
|
export declare class OnboardingServiceFactory {
|
|
5
5
|
private readonly context;
|
|
6
6
|
private cliConfig;
|
|
7
7
|
constructor(context: OnboardingContext, cliConfig: UserCliConfig);
|
|
8
8
|
getService(): Promise<OnboardingService>;
|
|
9
|
-
private getUrlForTest;
|
|
10
9
|
private buildInstallResource;
|
|
11
|
-
private getFetchEventHandler;
|
|
12
|
-
private getIntegrationFiles;
|
|
13
|
-
private getConfigApi;
|
|
14
10
|
private getAthenaClient;
|
|
11
|
+
private getConfigApi;
|
|
15
12
|
private getCredentials;
|
|
13
|
+
private getFetchEventHandler;
|
|
14
|
+
private getIntegrationFiles;
|
|
15
|
+
private getUrlForTest;
|
|
16
16
|
}
|