@speedkit/cli 2.26.0 → 2.27.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 +18 -0
- package/README.md +1 -1
- package/dist/models/files.d.ts +4 -0
- package/dist/models/files.js +4 -0
- package/dist/services/cli/error/cli-type-error.d.ts +1 -2
- package/dist/services/cli/error/cli-type-error.js +1 -3
- package/dist/services/config-api/context/config-api-context.d.ts +1 -2
- package/dist/services/config-api/factory/config-api-service-factory.js +1 -2
- package/dist/services/config-api/interface/config-api-context-interface.d.ts +1 -2
- package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +1 -1
- package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +1 -2
- package/dist/services/deploy/deploy-service-factory.js +3 -4
- package/dist/services/deploy/deploy-service.d.ts +3 -2
- package/dist/services/deploy/deploy-service.js +23 -1
- package/dist/services/deploy/handler/customer-config-handler.d.ts +4 -5
- package/dist/services/deploy/handler/customer-config-handler.js +2 -2
- package/dist/services/deploy/handler/install-resource-handler.d.ts +3 -4
- package/dist/services/deploy/handler/install-resource-handler.js +2 -3
- package/dist/services/deploy/handler/module-handler.d.ts +8 -5
- package/dist/services/deploy/handler/module-handler.js +2 -3
- package/dist/services/deploy/handler/server-config-handler.d.ts +9 -6
- package/dist/services/deploy/handler/server-config-handler.js +6 -4
- package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +2 -3
- package/dist/services/document-handler-runtime/document-handler-runtime-service.js +2 -6
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +1 -2
- package/dist/services/document-handler-runtime/document-handler-server.js +2 -5
- package/dist/services/document-handler-runtime/error/required-file-not-found-error.d.ts +1 -2
- package/dist/services/document-handler-runtime/error/required-file-not-found-error.js +1 -3
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -6
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +9 -18
- package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +1 -2
- package/dist/services/integration-api/error/customer-config-legacy-error.js +1 -3
- package/dist/services/integration-api/error/handler/customer-config-legacy-handler.d.ts +1 -2
- package/dist/services/integration-api/error/handler/customer-config-legacy-handler.js +1 -1
- package/dist/services/integration-api/error/handler/origin-handler.d.ts +1 -2
- package/dist/services/integration-api/error/handler/origin-handler.js +1 -1
- package/dist/services/integration-api/error/origin-error.d.ts +1 -2
- package/dist/services/integration-api/error/origin-error.js +1 -3
- package/dist/services/integration-api/file-list.d.ts +3 -5
- package/dist/services/integration-api/file-list.js +6 -10
- package/dist/services/integration-api/file-reader.d.ts +14 -6
- package/dist/services/integration-api/file-reader.js +8 -8
- package/dist/services/integration-api/file-writer.d.ts +10 -2
- package/dist/services/integration-api/file-writer.js +9 -6
- package/dist/services/integration-api/handler/customer-config-handler.js +6 -8
- package/dist/services/integration-api/handler/install-resource-handler.js +3 -4
- package/dist/services/integration-api/handler/module-handler.js +2 -2
- package/dist/services/integration-api/handler/server-config-handler.js +2 -2
- package/dist/services/integration-api/index.d.ts +3 -0
- package/dist/services/integration-api/index.js +6 -0
- package/dist/services/integration-api/integration-api-factory.d.ts +13 -0
- package/dist/services/integration-api/integration-api-factory.js +50 -0
- package/dist/services/integration-api/integration-api-model.d.ts +33 -14
- package/dist/services/integration-api/integration-api-model.js +37 -0
- package/dist/services/integration-api/integration-api-service.d.ts +1 -2
- package/dist/services/integration-api/integration-api-service.js +3 -23
- package/dist/services/integration-api/spec/customer-config-validator.spec.d.ts +1 -0
- package/dist/services/integration-api/spec/customer-config-validator.spec.js +50 -0
- package/dist/services/integration-api/spec/file-list.spec.d.ts +1 -0
- package/dist/services/integration-api/spec/file-list.spec.js +163 -0
- package/dist/services/integration-api/spec/file-reader.spec.d.ts +1 -0
- package/dist/services/integration-api/spec/file-reader.spec.js +71 -0
- package/dist/services/integration-api/spec/file-writer.spec.d.ts +1 -0
- package/dist/services/integration-api/spec/file-writer.spec.js +55 -0
- package/dist/services/integration-api/spec/integration-api-service.spec.d.ts +1 -0
- package/dist/services/integration-api/spec/integration-api-service.spec.js +122 -0
- package/dist/services/integration-api/spec/mandatory-files-validator.spec.d.ts +1 -0
- package/dist/services/integration-api/spec/mandatory-files-validator.spec.js +105 -0
- package/dist/services/integration-api/struct/customer-config-file.d.ts +3 -4
- package/dist/services/integration-api/struct/customer-config-file.js +7 -6
- package/dist/services/integration-api/struct/customer-config.d.ts +3 -5
- package/dist/services/integration-api/struct/customer-config.js +5 -8
- package/dist/services/integration-api/struct/file.d.ts +4 -4
- package/dist/services/integration-api/struct/file.js +6 -6
- package/dist/services/integration-api/struct/install-resource-file.d.ts +4 -3
- package/dist/services/integration-api/struct/install-resource-file.js +7 -5
- package/dist/services/integration-api/struct/module-file.d.ts +4 -3
- package/dist/services/integration-api/struct/module-file.js +7 -5
- package/dist/services/integration-api/struct/ro-file.d.ts +2 -2
- package/dist/services/integration-api/struct/ro-file.js +1 -1
- package/dist/services/integration-api/struct/server-config-file.d.ts +5 -4
- package/dist/services/integration-api/struct/server-config-file.js +7 -5
- package/dist/services/integration-api/struct/virtual-file.d.ts +2 -2
- package/dist/services/integration-api/struct/virtual-file.js +2 -1
- package/dist/services/integration-api/validator/customer-config-validator.d.ts +5 -1
- package/dist/services/integration-api/validator/customer-config-validator.js +28 -17
- package/dist/services/integration-api/virtual/static-recipe.d.ts +6 -0
- package/dist/services/integration-api/virtual/static-recipe.js +14 -0
- package/dist/services/integration-api/virtual/virtual-file-handler.js +2 -2
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +1 -2
- package/dist/services/onboarding/dashboard/index.d.ts +1 -1
- package/dist/services/onboarding/dashboard/parameter-query-builder.d.ts +1 -2
- package/dist/services/onboarding/fetch-event-handler.d.ts +1 -1
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +1 -2
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +1 -1
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +1 -1
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +1 -1
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +1 -2
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +1 -1
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +1 -2
- package/dist/services/onboarding/file-events/file-watcher.d.ts +1 -2
- package/dist/services/onboarding/file-events/file-watcher.js +3 -3
- package/dist/services/onboarding/onboarding-service-factory.js +9 -13
- package/dist/services/onboarding/onboarding-service.d.ts +1 -1
- package/dist/services/onboarding/todo-collector.js +2 -2
- package/dist/services/pull/pull-service-factory.js +3 -4
- package/dist/services/pull/pull-service.d.ts +1 -1
- package/dist/services/pull/pull-service.js +2 -3
- package/oclif.manifest.json +1 -1
- package/package.json +5 -5
- package/dist/services/context/error/context-runtime-error.d.ts +0 -3
- package/dist/services/context/error/context-runtime-error.js +0 -7
- package/dist/services/context/interface/context-interface.d.ts +0 -2
- package/dist/services/context/interface/context-interface.js +0 -2
- package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.d.ts +0 -6
- package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.js +0 -14
- package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.d.ts +0 -6
- package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.js +0 -19
- package/dist/services/error-handling/abstract/abstract-async-error-handling-service.d.ts +0 -6
- package/dist/services/error-handling/abstract/abstract-async-error-handling-service.js +0 -18
- package/dist/services/error-handling/abstract/abstract-error-handling-factory.d.ts +0 -6
- package/dist/services/error-handling/abstract/abstract-error-handling-factory.js +0 -19
- package/dist/services/error-handling/abstract/abstract-error-handling-service.d.ts +0 -6
- package/dist/services/error-handling/abstract/abstract-error-handling-service.js +0 -19
- package/dist/services/error-handling/error/application-error.d.ts +0 -5
- package/dist/services/error-handling/error/application-error.js +0 -11
- package/dist/services/error-handling/error-handling-service.d.ts +0 -7
- package/dist/services/error-handling/error-handling-service.js +0 -27
- package/dist/services/error-handling/factory/error-handling-factory.d.ts +0 -5
- package/dist/services/error-handling/factory/error-handling-factory.js +0 -22
- package/dist/services/error-handling/interface/error-context-interface.d.ts +0 -6
- package/dist/services/error-handling/interface/error-context-interface.js +0 -2
- package/dist/services/error-handling/interface/error-handler-interface.d.ts +0 -5
- package/dist/services/error-handling/interface/error-handler-interface.js +0 -2
- package/dist/services/error-handling/interface/error-handling-factory-interface.d.ts +0 -8
- package/dist/services/error-handling/interface/error-handling-factory-interface.js +0 -2
- package/dist/services/error-handling/interface/error-handling-service-interface.d.ts +0 -8
- package/dist/services/error-handling/interface/error-handling-service-interface.js +0 -2
- package/dist/services/integration-api/context/integration-api-context.d.ts +0 -9
- package/dist/services/integration-api/context/integration-api-context.js +0 -20
- package/dist/services/integration-api/error/handler/customer-config-handler.d.ts +0 -5
- package/dist/services/integration-api/error/handler/customer-config-handler.js +0 -19
- package/dist/services/integration-api/factory/integration-api-service-factory.d.ts +0 -13
- package/dist/services/integration-api/factory/integration-api-service-factory.js +0 -55
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomerConfig = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const customer_config_error_1 = tslib_1.__importDefault(require("../error/customer-config-error"));
|
|
5
6
|
class CustomerConfig {
|
|
@@ -15,9 +16,7 @@ class CustomerConfig {
|
|
|
15
16
|
forceInstall;
|
|
16
17
|
chromeFlags;
|
|
17
18
|
dependencies;
|
|
18
|
-
|
|
19
|
-
skCliPost;
|
|
20
|
-
constructor(app, origins, domain, swPath, scope, appDomain, installPath, installParameters, name, forceInstall, chromeFlags, dependencies, skCliPre, skCliPost) {
|
|
19
|
+
constructor(app, origins, domain, swPath, scope, appDomain, installPath, installParameters, name, forceInstall, chromeFlags, dependencies) {
|
|
21
20
|
this.app = app;
|
|
22
21
|
this.origins = origins;
|
|
23
22
|
this.domain = domain;
|
|
@@ -30,16 +29,14 @@ class CustomerConfig {
|
|
|
30
29
|
this.forceInstall = forceInstall;
|
|
31
30
|
this.chromeFlags = chromeFlags;
|
|
32
31
|
this.dependencies = dependencies;
|
|
33
|
-
this.skCliPre = skCliPre;
|
|
34
|
-
this.skCliPost = skCliPost;
|
|
35
32
|
}
|
|
36
33
|
static createFrom(configFile, configName) {
|
|
37
|
-
const { app, origins, domain, swPath, scope, appDomain, installPath, installParams, name, forceInstall, chromeFlags, dependencies,
|
|
34
|
+
const { app, origins, domain, swPath, scope, appDomain, installPath, installParams, name, forceInstall, chromeFlags, dependencies, } = configFile;
|
|
38
35
|
return new CustomerConfig(new RequiredParameter("app", app).isString().getValue(), new RequiredParameter("origins", origins).isArray().getValue(), new RequiredParameter("domain", domain).isString().getValue(), new RequiredParameter("swPath", swPath).isString().getValue(), new RequiredParameter("scope", scope).isString().getValue(), appDomain || `${app}.app.baqend.com`, installPath ||
|
|
39
|
-
`https://${app}.app.baqend.com/v1/speedkit/install.js?d=${name || configName}`, installParams || 'async="" crossorigin="anonymous"', name, forceInstall, chromeFlags, dependencies
|
|
36
|
+
`https://${app}.app.baqend.com/v1/speedkit/install.js?d=${name || configName}`, installParams || 'async="" crossorigin="anonymous"', name, forceInstall || true, chromeFlags, dependencies || {});
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
|
-
exports.
|
|
39
|
+
exports.CustomerConfig = CustomerConfig;
|
|
43
40
|
class RequiredParameter {
|
|
44
41
|
key;
|
|
45
42
|
value;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ConfigFileInterface, FileInterface } from "../integration-api-model";
|
|
2
|
-
export
|
|
1
|
+
import { ConfigFileInterface, FILE_TYPE, FileInterface } from "../integration-api-model";
|
|
2
|
+
export declare class File implements ConfigFileInterface, FileInterface {
|
|
3
3
|
readonly name: string;
|
|
4
4
|
readonly path: string;
|
|
5
|
-
readonly type: string;
|
|
6
5
|
private content;
|
|
7
6
|
private skip;
|
|
8
7
|
private updated;
|
|
9
|
-
|
|
8
|
+
readonly type: FILE_TYPE;
|
|
9
|
+
constructor(name: string, path: string, content: string);
|
|
10
10
|
skipFile(): void;
|
|
11
11
|
shouldSkipFile(): boolean;
|
|
12
12
|
getContent(): string;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.File = void 0;
|
|
3
4
|
const promises_1 = require("node:fs/promises");
|
|
4
|
-
const
|
|
5
|
+
const integration_api_model_1 = require("../integration-api-model");
|
|
5
6
|
class File {
|
|
6
7
|
name;
|
|
7
8
|
path;
|
|
8
|
-
type;
|
|
9
9
|
content;
|
|
10
10
|
skip = false;
|
|
11
11
|
updated = false;
|
|
12
|
-
|
|
12
|
+
type = integration_api_model_1.FILE_TYPE.CONFIG_FILE;
|
|
13
|
+
constructor(name, path, content) {
|
|
13
14
|
this.name = name;
|
|
14
15
|
this.path = path;
|
|
15
16
|
this.content = content;
|
|
16
|
-
this.type = type;
|
|
17
17
|
}
|
|
18
18
|
skipFile() {
|
|
19
19
|
this.skip = true;
|
|
@@ -55,7 +55,7 @@ class File {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
async delete() {
|
|
58
|
-
await (0,
|
|
58
|
+
await (0, promises_1.unlink)(this.path);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
exports.
|
|
61
|
+
exports.File = File;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import File from "./file";
|
|
2
|
-
import { InstallResourceInterface } from "../integration-api-model";
|
|
3
|
-
export
|
|
1
|
+
import { File } from "./file";
|
|
2
|
+
import { FILE_TYPE, InstallResourceInterface } from "../integration-api-model";
|
|
3
|
+
export declare class InstallResourceFile extends File implements InstallResourceInterface {
|
|
4
4
|
readonly remoteKey: string;
|
|
5
|
+
readonly type = FILE_TYPE.INSTALL_FILE;
|
|
5
6
|
constructor(name: string, path: string, content: string, remoteKey: string);
|
|
6
7
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const file_1 =
|
|
5
|
-
|
|
3
|
+
exports.InstallResourceFile = void 0;
|
|
4
|
+
const file_1 = require("./file");
|
|
5
|
+
const integration_api_model_1 = require("../integration-api-model");
|
|
6
|
+
class InstallResourceFile extends file_1.File {
|
|
6
7
|
remoteKey;
|
|
8
|
+
type = integration_api_model_1.FILE_TYPE.INSTALL_FILE;
|
|
7
9
|
constructor(name, path, content, remoteKey) {
|
|
8
|
-
super(name, path, content
|
|
10
|
+
super(name, path, content);
|
|
9
11
|
this.remoteKey = remoteKey;
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
|
-
exports.
|
|
14
|
+
exports.InstallResourceFile = InstallResourceFile;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import File from "./file";
|
|
2
|
-
import { ModuleInterface } from "../integration-api-model";
|
|
3
|
-
export
|
|
1
|
+
import { File } from "./file";
|
|
2
|
+
import { FILE_TYPE, ModuleInterface } from "../integration-api-model";
|
|
3
|
+
export declare class ModuleFile extends File implements ModuleInterface {
|
|
4
|
+
readonly type = FILE_TYPE.MODULE_FILE;
|
|
4
5
|
constructor(name: string, path: string, content: string, config: NonNullable<unknown>);
|
|
5
6
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const file_1 =
|
|
5
|
-
|
|
3
|
+
exports.ModuleFile = void 0;
|
|
4
|
+
const file_1 = require("./file");
|
|
5
|
+
const integration_api_model_1 = require("../integration-api-model");
|
|
6
|
+
class ModuleFile extends file_1.File {
|
|
7
|
+
type = integration_api_model_1.FILE_TYPE.MODULE_FILE;
|
|
6
8
|
constructor(name, path, content,
|
|
7
9
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
10
|
config) {
|
|
9
|
-
super(name, path, content
|
|
11
|
+
super(name, path, content);
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
|
-
exports.
|
|
14
|
+
exports.ModuleFile = ModuleFile;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { FileInterface } from "../integration-api-model";
|
|
1
|
+
import { FILE_TYPE, FileInterface } from "../integration-api-model";
|
|
2
2
|
export declare class RoFile implements FileInterface {
|
|
3
3
|
readonly name: string;
|
|
4
4
|
readonly path: string;
|
|
5
5
|
protected content: string;
|
|
6
6
|
protected skip: boolean;
|
|
7
7
|
protected updated: boolean;
|
|
8
|
-
readonly type:
|
|
8
|
+
readonly type: FILE_TYPE.READONLY_FILE;
|
|
9
9
|
constructor(name: string, path: string, content: string);
|
|
10
10
|
skipFile(): void;
|
|
11
11
|
shouldSkipFile(): boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import File from "./file";
|
|
2
|
-
import { ServerConfigInterface } from "../integration-api-model";
|
|
3
|
-
export
|
|
4
|
-
config:
|
|
1
|
+
import { File } from "./file";
|
|
2
|
+
import { FILE_TYPE, ServerConfigInterface } from "../integration-api-model";
|
|
3
|
+
export declare class ServerConfigFile extends File implements ServerConfigInterface {
|
|
4
|
+
config: NonNullable<unknown>;
|
|
5
|
+
readonly type = FILE_TYPE.SERVER_FILE;
|
|
5
6
|
constructor(name: string, path: string, content: string, config: NonNullable<unknown>);
|
|
6
7
|
getContent(): string;
|
|
7
8
|
setContent(content: string): void;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const file_1 =
|
|
5
|
-
|
|
3
|
+
exports.ServerConfigFile = void 0;
|
|
4
|
+
const file_1 = require("./file");
|
|
5
|
+
const integration_api_model_1 = require("../integration-api-model");
|
|
6
|
+
class ServerConfigFile extends file_1.File {
|
|
6
7
|
config;
|
|
8
|
+
type = integration_api_model_1.FILE_TYPE.SERVER_FILE;
|
|
7
9
|
constructor(name, path, content, config) {
|
|
8
|
-
super(name, path, content
|
|
10
|
+
super(name, path, content);
|
|
9
11
|
this.config = config;
|
|
10
12
|
}
|
|
11
13
|
getContent() {
|
|
@@ -19,4 +21,4 @@ class ServerConfigFile extends file_1.default {
|
|
|
19
21
|
return JSON.stringify(this.config);
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
|
-
exports.
|
|
24
|
+
exports.ServerConfigFile = ServerConfigFile;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { FileInterface, VirtualFileInterface, VirtualFileRecipe } from "../integration-api-model";
|
|
1
|
+
import { FILE_TYPE, FileInterface, VirtualFileInterface, VirtualFileRecipe } from "../integration-api-model";
|
|
2
2
|
export declare class VirtualFile implements VirtualFileInterface, FileInterface {
|
|
3
3
|
readonly name: string;
|
|
4
4
|
private recipe;
|
|
5
5
|
protected skip: boolean;
|
|
6
6
|
protected updated: boolean;
|
|
7
7
|
protected content: string;
|
|
8
|
-
readonly type
|
|
8
|
+
readonly type = FILE_TYPE.VIRTUAL_FILE;
|
|
9
9
|
constructor(name: string, recipe: VirtualFileRecipe);
|
|
10
10
|
skipFile(): void;
|
|
11
11
|
shouldSkipFile(): boolean;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VirtualFile = void 0;
|
|
4
|
+
const integration_api_model_1 = require("../integration-api-model");
|
|
4
5
|
class VirtualFile {
|
|
5
6
|
name;
|
|
6
7
|
recipe;
|
|
7
8
|
skip = false;
|
|
8
9
|
updated = false;
|
|
9
10
|
content;
|
|
10
|
-
type =
|
|
11
|
+
type = integration_api_model_1.FILE_TYPE.VIRTUAL_FILE;
|
|
11
12
|
constructor(name, recipe) {
|
|
12
13
|
this.name = name;
|
|
13
14
|
this.recipe = recipe;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import CustomerConfig from "../struct/customer-config";
|
|
1
|
+
import { CustomerConfig } from "../struct/customer-config";
|
|
2
2
|
export default class CustomerConfigValidator {
|
|
3
3
|
validate(config: CustomerConfig): void;
|
|
4
|
+
private checkAppNameStartsWithNumber;
|
|
5
|
+
private validateOrigins;
|
|
4
6
|
private checkIfDuplicateExists;
|
|
7
|
+
private hasPathCheck;
|
|
8
|
+
private hasProtocol;
|
|
5
9
|
}
|
|
@@ -4,29 +4,40 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const origin_error_1 = tslib_1.__importDefault(require("../error/origin-error"));
|
|
5
5
|
class CustomerConfigValidator {
|
|
6
6
|
validate(config) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (withoutProtocol.length > 0) {
|
|
10
|
-
throw new origin_error_1.default({
|
|
11
|
-
app: config.app,
|
|
12
|
-
message: "There was at least one origin configured in the local customer_config.js not having a protocol.",
|
|
13
|
-
});
|
|
7
|
+
if (this.checkAppNameStartsWithNumber(config)) {
|
|
8
|
+
throw new Error("appName can't start with a number");
|
|
14
9
|
}
|
|
10
|
+
this.validateOrigins(config);
|
|
11
|
+
}
|
|
12
|
+
checkAppNameStartsWithNumber(config) {
|
|
13
|
+
return /^\d/.test(config.app);
|
|
14
|
+
}
|
|
15
|
+
validateOrigins(config) {
|
|
15
16
|
if (config.origins.length === 0) {
|
|
16
|
-
throw new origin_error_1.default(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
throw new origin_error_1.default("No origins were found in local config_customer.js! Add origins and restart deploy!");
|
|
18
|
+
}
|
|
19
|
+
if (this.hasProtocol(config.origins)) {
|
|
20
|
+
throw new origin_error_1.default("There was at least one origin configured in the local customer_config.js not having a protocol.");
|
|
20
21
|
}
|
|
21
22
|
if (this.checkIfDuplicateExists(config.origins)) {
|
|
22
|
-
throw new origin_error_1.default(
|
|
23
|
-
app: config.app,
|
|
24
|
-
message: "Duplicate origins found! Remove duplicates and restart deploy!",
|
|
25
|
-
});
|
|
23
|
+
throw new origin_error_1.default("Duplicate origins found! Remove duplicates and restart deploy!");
|
|
26
24
|
}
|
|
25
|
+
if (this.hasPathCheck(config.origins)) {
|
|
26
|
+
throw new origin_error_1.default("There was at least one origin having a path. Origin must have the following format: https://domain.tld");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
checkIfDuplicateExists(origins) {
|
|
30
|
+
return new Set(origins).size !== origins.length;
|
|
31
|
+
}
|
|
32
|
+
hasPathCheck(origins) {
|
|
33
|
+
return origins.some((origin) => {
|
|
34
|
+
const countSlashes = origin.split("/").length - 1;
|
|
35
|
+
return countSlashes >= 3;
|
|
36
|
+
});
|
|
27
37
|
}
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
hasProtocol(origins) {
|
|
39
|
+
const withoutProtocol = origins.filter((origin) => !origin.startsWith("http"));
|
|
40
|
+
return withoutProtocol.length > 0;
|
|
30
41
|
}
|
|
31
42
|
}
|
|
32
43
|
exports.default = CustomerConfigValidator;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StaticRecipe = void 0;
|
|
4
|
+
class StaticRecipe {
|
|
5
|
+
content;
|
|
6
|
+
constructor(content) {
|
|
7
|
+
this.content = content;
|
|
8
|
+
}
|
|
9
|
+
createContent() {
|
|
10
|
+
// @ts-expect-error is not a promise
|
|
11
|
+
return this.content;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.StaticRecipe = StaticRecipe;
|
|
@@ -16,12 +16,12 @@ class VirtualFileHandler {
|
|
|
16
16
|
this.cli.write(`use localFile for ${fileName}`);
|
|
17
17
|
continue;
|
|
18
18
|
}
|
|
19
|
-
this.cli.startAction(`get
|
|
19
|
+
this.cli.startAction(`get content of virtualFile ${fileName}`);
|
|
20
20
|
const virtualFile = new virtual_file_1.VirtualFile(fileName, fileConfig.recipe);
|
|
21
21
|
const result = await (0, safe_1.safe)(virtualFile.buildContent());
|
|
22
22
|
if (result.success === true) {
|
|
23
23
|
if (fileList.hasFile(fileName) && fileConfig.overrideLocalFile) {
|
|
24
|
-
this.cli.write(`use
|
|
24
|
+
this.cli.write(`use virtualFile for ${fileName}`);
|
|
25
25
|
fileList.replace(virtualFile);
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { InstallSpeedKitJsTemplate } from "../templates/install-speed-kit-js-template";
|
|
2
|
-
import CustomerConfig from "../../integration-api/struct/customer-config";
|
|
3
2
|
import { BundleService } from "../../bundler";
|
|
4
|
-
import { FileListInterface } from "../../integration-api
|
|
3
|
+
import { FileListInterface, CustomerConfig } from "../../integration-api";
|
|
5
4
|
export declare class SpeedKitInstallContext {
|
|
6
5
|
private customerConfig;
|
|
7
6
|
private configName;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaqendResponse } from "../browser/baqend-response";
|
|
2
2
|
import { Protocol } from "devtools-protocol";
|
|
3
3
|
import { ParameterQueryBuilder } from "./parameter-query-builder";
|
|
4
|
-
import CustomerConfig from "../../integration-api
|
|
4
|
+
import { CustomerConfig } from "../../integration-api";
|
|
5
5
|
import { RequestDiffService } from "./request-diff-service";
|
|
6
6
|
import { Cache } from "../request-cache/cache";
|
|
7
7
|
import { AthenaService } from "../../athena";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ConfigFileInterface } from "../../integration-api
|
|
2
|
-
import CustomerConfig from "../../integration-api/struct/customer-config";
|
|
1
|
+
import { CustomerConfig, ConfigFileInterface } from "../../integration-api";
|
|
3
2
|
export declare class ParameterQueryBuilder {
|
|
4
3
|
private customerConfig;
|
|
5
4
|
private speedKitConfigFile;
|
|
@@ -2,7 +2,7 @@ import { FetchRequestPausedEventHandler } from "./onboarding-model";
|
|
|
2
2
|
import { Protocol } from "puppeteer-core";
|
|
3
3
|
import { CDPSession, Target } from "puppeteer";
|
|
4
4
|
import { CliService } from "../cli";
|
|
5
|
-
import CustomerConfig from "../integration-api
|
|
5
|
+
import { CustomerConfig } from "../integration-api";
|
|
6
6
|
import ConfigApiService from "../config-api/config-api-service";
|
|
7
7
|
export declare class FetchEventHandler {
|
|
8
8
|
private browserFetchEvents;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import Protocol from "devtools-protocol";
|
|
2
2
|
import { FetchRequestPausedEventHandler } from "../onboarding-model";
|
|
3
|
-
import CustomerConfig from "../../integration-api
|
|
3
|
+
import { CustomerConfig, ConfigFileInterface } from "../../integration-api";
|
|
4
4
|
import { CDPSession } from "puppeteer";
|
|
5
|
-
import { ConfigFileInterface } from "../../integration-api/integration-api-model";
|
|
6
5
|
/**
|
|
7
6
|
* Intercepts any request to the customersOrigin and equivalent requests to baqendAssetApi
|
|
8
7
|
* @implements {FetchRequestPausedEventHandler}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Protocol from "devtools-protocol";
|
|
2
2
|
import { FetchRequestPausedEventHandler } from "../onboarding-model";
|
|
3
|
-
import CustomerConfig from "../../integration-api
|
|
3
|
+
import { CustomerConfig } from "../../integration-api";
|
|
4
4
|
/**
|
|
5
5
|
* Intercepts request to /wrapper-sw.js
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Protocol from "devtools-protocol";
|
|
2
2
|
import { FetchRequestPausedEventHandler, SpeedKitServerConfig } from "../onboarding-model";
|
|
3
|
-
import CustomerConfig from "../../integration-api
|
|
3
|
+
import { CustomerConfig } from "../../integration-api";
|
|
4
4
|
import { DocumentHandlerServer } from "../../document-handler-runtime/document-handler-server";
|
|
5
5
|
import { AbortResponse } from "../browser/abort-response";
|
|
6
6
|
import { Cache } from "../request-cache/cache";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Protocol from "devtools-protocol";
|
|
2
2
|
import { BrowserContext, FetchRequestPausedEventHandler } from "../onboarding-model";
|
|
3
|
-
import CustomerConfig from "../../integration-api
|
|
3
|
+
import { CustomerConfig } from "../../integration-api";
|
|
4
4
|
import { InstallSpeedKitHtmlTemplate } from "../templates/install-speed-kit-html-template";
|
|
5
5
|
/**
|
|
6
6
|
* Represents a class that handles the installation of Speed Kit HTML.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Protocol from "devtools-protocol";
|
|
2
2
|
import { CDPSession } from "puppeteer";
|
|
3
|
-
import CustomerConfig from "../../integration-api
|
|
4
|
-
import { VirtualFile } from "../../integration-api/struct/virtual-file";
|
|
3
|
+
import { CustomerConfig, VirtualFile } from "../../integration-api";
|
|
5
4
|
import { AbortResponse } from "../browser/abort-response";
|
|
6
5
|
import { FetchRequestPausedEventHandler } from "../onboarding-model";
|
|
7
6
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CDPSession } from "puppeteer";
|
|
2
2
|
import { Protocol } from "puppeteer-core";
|
|
3
3
|
import { CliService } from "../../cli";
|
|
4
|
-
import CustomerConfig from "../../integration-api
|
|
4
|
+
import { CustomerConfig } from "../../integration-api";
|
|
5
5
|
import { AbortResponse } from "../browser/abort-response";
|
|
6
6
|
import { FetchRequestPausedEventHandler } from "../onboarding-model";
|
|
7
7
|
import { Cache } from "../request-cache/cache";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Protocol from "devtools-protocol";
|
|
2
|
-
import { FileInterface } from "../../integration-api
|
|
3
|
-
import CustomerConfig from "../../integration-api/struct/customer-config";
|
|
2
|
+
import { CustomerConfig, FileInterface } from "../../integration-api";
|
|
4
3
|
import { FetchRequestPausedEventHandler } from "../onboarding-model";
|
|
5
4
|
/**
|
|
6
5
|
* SpeedKitServiceWorkerJs class is responsible for handling fetch requests for the SpeedKit service worker.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { CliService } from "../../cli";
|
|
2
2
|
import { Page } from "puppeteer";
|
|
3
|
-
import CustomerConfig from "../../integration-api/struct/customer-config";
|
|
4
3
|
import { DocumentHandlerServer } from "../../document-handler-runtime/document-handler-server";
|
|
5
4
|
import { Cache } from "../request-cache/cache";
|
|
6
|
-
import { ConfigFileInterface, FileListInterface } from "../../integration-api
|
|
5
|
+
import { ConfigFileInterface, CustomerConfig, FileListInterface } from "../../integration-api";
|
|
7
6
|
import { BrowserContext } from "../onboarding-model";
|
|
8
7
|
/**
|
|
9
8
|
* Add different callbacks that will be executed if a local file is changed.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileWatcher = void 0;
|
|
4
4
|
const safe_1 = require("../../../helpers/safe");
|
|
5
|
-
const
|
|
5
|
+
const integration_api_1 = require("../../integration-api");
|
|
6
6
|
const files_1 = require("../../../models/files");
|
|
7
7
|
/**
|
|
8
8
|
* Add different callbacks that will be executed if a local file is changed.
|
|
@@ -41,7 +41,7 @@ class FileWatcher {
|
|
|
41
41
|
continue;
|
|
42
42
|
}
|
|
43
43
|
const file = this.files.getByName(dependency);
|
|
44
|
-
if (file.type ===
|
|
44
|
+
if (file.type === integration_api_1.FILE_TYPE.VIRTUAL_FILE) {
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
47
|
file.onChange(async (file) => {
|
|
@@ -65,7 +65,7 @@ class FileWatcher {
|
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
67
|
const file = this.files.getByName(configFile);
|
|
68
|
-
if (file.type ===
|
|
68
|
+
if (file.type === integration_api_1.FILE_TYPE.VIRTUAL_FILE) {
|
|
69
69
|
continue;
|
|
70
70
|
}
|
|
71
71
|
file.onChange(async (file) => {
|
|
@@ -11,11 +11,6 @@ const config_api_context_1 = tslib_1.__importDefault(require("../config-api/cont
|
|
|
11
11
|
const config_api_service_factory_1 = tslib_1.__importDefault(require("../config-api/factory/config-api-service-factory"));
|
|
12
12
|
const diff_1 = require("../diff");
|
|
13
13
|
const document_handler_runtime_service_factory_1 = tslib_1.__importDefault(require("../document-handler-runtime/factory/document-handler-runtime-service-factory"));
|
|
14
|
-
const integration_api_context_1 = tslib_1.__importDefault(require("../integration-api/context/integration-api-context"));
|
|
15
|
-
const external_file_reader_1 = require("../integration-api/external/external-file-reader");
|
|
16
|
-
const integration_api_service_factory_1 = tslib_1.__importDefault(require("../integration-api/factory/integration-api-service-factory"));
|
|
17
|
-
const virtual_file_1 = require("../integration-api/struct/virtual-file");
|
|
18
|
-
const external_recipe_1 = require("../integration-api/virtual/external-recipe");
|
|
19
14
|
const install_file_recipe_1 = require("./config-renderer/install-file-recipe");
|
|
20
15
|
const speed_kit_install_context_1 = require("./config-renderer/speed-kit-install-context");
|
|
21
16
|
const dashboard_1 = require("./dashboard");
|
|
@@ -37,6 +32,7 @@ const cache_1 = require("./request-cache/cache");
|
|
|
37
32
|
const install_speed_kit_html_template_1 = require("./templates/install-speed-kit-html-template");
|
|
38
33
|
const install_speed_kit_js_template_1 = require("./templates/install-speed-kit-js-template");
|
|
39
34
|
const todo_collector_1 = require("./todo-collector");
|
|
35
|
+
const integration_api_1 = require("../integration-api");
|
|
40
36
|
class OnboardingServiceFactory {
|
|
41
37
|
context;
|
|
42
38
|
cliConfig;
|
|
@@ -70,7 +66,7 @@ class OnboardingServiceFactory {
|
|
|
70
66
|
}
|
|
71
67
|
async buildInstallResource(speedKitInstallContext, files, cli) {
|
|
72
68
|
cli.startAction("build file install_resource");
|
|
73
|
-
const installResourceFile = new
|
|
69
|
+
const installResourceFile = new integration_api_1.VirtualFile(files_1.INTEGRATION_FILES.BUILD.INSTALL, new install_file_recipe_1.InstallFileRecipe(speedKitInstallContext));
|
|
74
70
|
const result = await (0, safe_1.safe)(installResourceFile.buildContent());
|
|
75
71
|
if (result.success === true) {
|
|
76
72
|
files.addFile(installResourceFile);
|
|
@@ -119,25 +115,25 @@ class OnboardingServiceFactory {
|
|
|
119
115
|
return new fetch_event_handler_1.FetchEventHandler(handlers, customerConfig, cli, configApi);
|
|
120
116
|
}
|
|
121
117
|
async getIntegrationFiles() {
|
|
122
|
-
const integrationApiContext = new
|
|
123
|
-
const integrationApi = new
|
|
124
|
-
const externalFileReader = new
|
|
118
|
+
const integrationApiContext = new integration_api_1.IntegrationApiContext(this.context.customerPath, this.context.configName, []);
|
|
119
|
+
const integrationApi = new integration_api_1.IntegrationApiFactory(integrationApiContext, this.cliConfig).buildService();
|
|
120
|
+
const externalFileReader = new integration_api_1.ExternalFileReader();
|
|
125
121
|
return integrationApi.run([
|
|
126
122
|
{
|
|
127
123
|
name: files_1.INTEGRATION_FILES.CUSTOM.SW,
|
|
128
|
-
recipe: new
|
|
124
|
+
recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_SW_PATH, externalFileReader),
|
|
129
125
|
},
|
|
130
126
|
{
|
|
131
127
|
name: files_1.INTEGRATION_FILES.CUSTOM.DYNAMIC_FETCHER,
|
|
132
|
-
recipe: new
|
|
128
|
+
recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_DF_PATH, externalFileReader),
|
|
133
129
|
},
|
|
134
130
|
{
|
|
135
131
|
name: files_1.INTEGRATION_FILES.CUSTOM.LOADER,
|
|
136
|
-
recipe: new
|
|
132
|
+
recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_SNIPPET_PATH, externalFileReader),
|
|
137
133
|
},
|
|
138
134
|
{
|
|
139
135
|
name: files_1.INTEGRATION_FILES.CUSTOM.DOCUMENT_HANDLER,
|
|
140
|
-
recipe: new
|
|
136
|
+
recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_DOCUMENT_HANDLER_PATH, externalFileReader),
|
|
141
137
|
},
|
|
142
138
|
]);
|
|
143
139
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import CustomerConfig from "../integration-api
|
|
1
|
+
import { CustomerConfig } from "../integration-api";
|
|
2
2
|
import { BrowserContext } from "./onboarding-model";
|
|
3
3
|
import { FetchEventHandler } from "./fetch-event-handler";
|
|
4
4
|
import { FileWatcher } from "./file-events/file-watcher";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TodoCollector = void 0;
|
|
4
|
-
const
|
|
4
|
+
const integration_api_model_1 = require("../integration-api/integration-api-model");
|
|
5
5
|
const TODO_MATCH = /(todo[^\n\r()|]*)((?:(?:\r\n|\r|\n)[^\n\r()|]*){3})/i;
|
|
6
6
|
/**
|
|
7
7
|
* Represents a TodoCollector class that collects open tasks from files.
|
|
@@ -14,7 +14,7 @@ class TodoCollector {
|
|
|
14
14
|
}
|
|
15
15
|
getOpenTasks() {
|
|
16
16
|
const configFiles = this.files.filter((file) => {
|
|
17
|
-
return !(file.type
|
|
17
|
+
return !(file.type === integration_api_model_1.FILE_TYPE.VIRTUAL_FILE);
|
|
18
18
|
});
|
|
19
19
|
const tasks = [];
|
|
20
20
|
for (const configFile of configFiles) {
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PullServiceFactory = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const integration_api_service_factory_1 = tslib_1.__importDefault(require("../integration-api/factory/integration-api-service-factory"));
|
|
5
|
+
const integration_api_1 = require("../integration-api");
|
|
7
6
|
const config_api_service_factory_1 = tslib_1.__importDefault(require("../config-api/factory/config-api-service-factory"));
|
|
8
7
|
const config_api_context_1 = tslib_1.__importDefault(require("../config-api/context/config-api-context"));
|
|
9
8
|
const cli_1 = require("../cli");
|
|
@@ -32,8 +31,8 @@ class PullServiceFactory {
|
|
|
32
31
|
this.service = new _1.PullService(files, cliService, configApi, configName, this.context.customerPath);
|
|
33
32
|
}
|
|
34
33
|
async getIntegrationFiles() {
|
|
35
|
-
const integrationApiContext = new
|
|
36
|
-
const integrationApi = new
|
|
34
|
+
const integrationApiContext = new integration_api_1.IntegrationApiContext(this.context.customerPath, this.context.configName, []);
|
|
35
|
+
const integrationApi = new integration_api_1.IntegrationApiFactory(integrationApiContext, this.userConfig).buildService();
|
|
37
36
|
return await integrationApi.run();
|
|
38
37
|
}
|
|
39
38
|
getConfigApi(app) {
|