@speedkit/cli 2.46.0 → 2.47.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 +8 -0
- package/README.md +1 -1
- package/dist/models/files.js +1 -1
- package/dist/services/config-api/client.d.ts +1 -0
- package/dist/services/config-api/client.js +7 -0
- package/dist/services/config-api/config-api-model.d.ts +3 -0
- package/dist/services/config-api/config-api-service.d.ts +1 -0
- package/dist/services/config-api/config-api-service.js +3 -0
- package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.d.ts +13 -0
- package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.js +72 -0
- package/dist/services/deploy/deploy-service-factory.js +2 -0
- package/dist/services/deploy/deploy-service.js +2 -3
- package/dist/services/deploy/error/post-deploy-deployment-detection-error.d.ts +4 -0
- package/dist/services/deploy/error/post-deploy-deployment-detection-error.js +9 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# [2.47.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.46.0...v2.47.0) (2024-07-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **deploy:** add postDeploymentCheck for deploymentDetection ([d7f60dc](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/d7f60dc68e3f4dab45df347f7d4a9d416e9c6625))
|
|
7
|
+
* **deploy:** change styling of postDeployCheck ([0b37d77](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/0b37d771fea61d9a5b00b6ebd000b61ebecad1d2))
|
|
8
|
+
|
|
1
9
|
# [2.46.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.45.0...v2.46.0) (2024-07-22)
|
|
2
10
|
|
|
3
11
|
|
package/README.md
CHANGED
package/dist/models/files.js
CHANGED
|
@@ -11,4 +11,5 @@ export declare class Client {
|
|
|
11
11
|
getModule(moduleName: string): Promise<string>;
|
|
12
12
|
send<T>(url: string, requestExtension?: RequestExtensionInterface): Promise<T>;
|
|
13
13
|
setModule(moduleName: string, moduleCode: string): Promise<string>;
|
|
14
|
+
deleteModule(moduleName: string): Promise<void>;
|
|
14
15
|
}
|
|
@@ -83,5 +83,12 @@ class Client {
|
|
|
83
83
|
}
|
|
84
84
|
return moduleResponse.data;
|
|
85
85
|
}
|
|
86
|
+
async deleteModule(moduleName) {
|
|
87
|
+
const entityManager = await this.getEntityManager();
|
|
88
|
+
const moduleResponse = await (0, safe_1.safe)(entityManager.code.deleteCode(moduleName, "module"));
|
|
89
|
+
if (moduleResponse.success !== true) {
|
|
90
|
+
throw new connection_error_1.ConnectionError(`Could not delete module "${moduleName}" to app "${this.app}" - ${moduleResponse.error}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
86
93
|
}
|
|
87
94
|
exports.Client = Client;
|
|
@@ -13,4 +13,5 @@ export declare class ConfigApiService {
|
|
|
13
13
|
setModule(moduleCode: string, moduleName: string): Promise<string>;
|
|
14
14
|
getServerConfig(): Promise<string>;
|
|
15
15
|
setServerConfig(localServerConfig: string, configurationVersion: string): Promise<void>;
|
|
16
|
+
deleteModule(moduleName: string): Promise<void>;
|
|
16
17
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PostDeployCheckInterface } from "../../deploy-service-model";
|
|
2
|
+
import { FileListInterface } from "../../../integration-api";
|
|
3
|
+
import { CliService } from "../../../cli";
|
|
4
|
+
import { ConfigApiService } from "../../../config-api";
|
|
5
|
+
export declare class DeprecatedDeploymentDetectionCheck implements PostDeployCheckInterface {
|
|
6
|
+
private fileList;
|
|
7
|
+
private cli;
|
|
8
|
+
private configApi;
|
|
9
|
+
private app;
|
|
10
|
+
constructor(fileList: FileListInterface, cli: CliService, configApi: ConfigApiService, app: string);
|
|
11
|
+
check(): Promise<void>;
|
|
12
|
+
private deleteDeploymentJobDefinition;
|
|
13
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeprecatedDeploymentDetectionCheck = void 0;
|
|
4
|
+
const cli_1 = require("../../../cli");
|
|
5
|
+
const files_1 = require("../../../../models/files");
|
|
6
|
+
const safe_1 = require("../../../../helpers/safe");
|
|
7
|
+
const post_deploy_deployment_detection_error_1 = require("../../error/post-deploy-deployment-detection-error");
|
|
8
|
+
class DeprecatedDeploymentDetectionCheck {
|
|
9
|
+
fileList;
|
|
10
|
+
cli;
|
|
11
|
+
configApi;
|
|
12
|
+
app;
|
|
13
|
+
constructor(fileList, cli, configApi, app) {
|
|
14
|
+
this.fileList = fileList;
|
|
15
|
+
this.cli = cli;
|
|
16
|
+
this.configApi = configApi;
|
|
17
|
+
this.app = app;
|
|
18
|
+
}
|
|
19
|
+
async check() {
|
|
20
|
+
this.cli.startAction("[postDeployCheck] deploymentDetection");
|
|
21
|
+
const configFile = this.fileList.getByName(files_1.INTEGRATION_FILES.CONFIG.DOCUMENT_HANDLER);
|
|
22
|
+
const moduleFile = this.fileList.getByName(files_1.INTEGRATION_FILES.DEPRECATED.DEPLOYMENT_DETECTION);
|
|
23
|
+
// no config_documentHandler or module: deploymentDetection found
|
|
24
|
+
if (!configFile || moduleFile) {
|
|
25
|
+
this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const content = configFile.getContent();
|
|
29
|
+
if (!content.includes("executeDeploymentDetection: true") &&
|
|
30
|
+
!content.includes("executeDeploymentDetection: {")) {
|
|
31
|
+
this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const entityManager = await this.configApi.client.getEntityManager();
|
|
35
|
+
const deployCheckJob = await entityManager["jobs.Definition"]
|
|
36
|
+
.find()
|
|
37
|
+
.eq("id", "/db/jobs.Definition/deployment-check")
|
|
38
|
+
.singleResult();
|
|
39
|
+
const moduleResult = await (0, safe_1.safe)(this.configApi.getModule(files_1.INTEGRATION_FILES.DEPRECATED.DEPLOYMENT_DETECTION));
|
|
40
|
+
this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
|
|
41
|
+
if (deployCheckJob) {
|
|
42
|
+
this.cli.writeWarning(`Found active Job for ${this.cli.style.bold("deprecated")} deploymentDetection in app: ${this.app}`);
|
|
43
|
+
if (await this.cli.confirm("Delete job for deploymentDetection?")) {
|
|
44
|
+
await this.deleteDeploymentJobDefinition(deployCheckJob);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (moduleResult.success &&
|
|
48
|
+
moduleResult.data &&
|
|
49
|
+
moduleResult.data.length > 0) {
|
|
50
|
+
this.cli.writeWarning(`Found ${this.cli.style.bold("deprecated")} module deploymentDetection in app: ${this.app}`);
|
|
51
|
+
if (await this.cli.confirm("Delete module deploymentDetection?")) {
|
|
52
|
+
this.cli.startAction("Delete module deploymentDetection");
|
|
53
|
+
await this.configApi.deleteModule(files_1.INTEGRATION_FILES.DEPRECATED.DEPLOYMENT_DETECTION);
|
|
54
|
+
this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async deleteDeploymentJobDefinition(deployCheckJob) {
|
|
59
|
+
this.cli.startAction("Delete job deploymentDetection-check");
|
|
60
|
+
const result = await (0, safe_1.safe)(deployCheckJob.delete());
|
|
61
|
+
if (result.success === true) {
|
|
62
|
+
this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this.cli.endAction(cli_1.CliActionStatus.FAILED);
|
|
66
|
+
throw new post_deploy_deployment_detection_error_1.PostDeployDeploymentDetectionError(result.error, [
|
|
67
|
+
`check https://dashboard.baqend.com/app/${this.app}/db/jobs.Definition`,
|
|
68
|
+
"delete entry manual",
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.DeprecatedDeploymentDetectionCheck = DeprecatedDeploymentDetectionCheck;
|
|
@@ -16,6 +16,7 @@ const server_config_handler_1 = tslib_1.__importDefault(require("./handler/serve
|
|
|
16
16
|
const integration_api_1 = require("../integration-api");
|
|
17
17
|
const split_change_check_1 = require("./checks/pre-deploy/split-change-check");
|
|
18
18
|
const config_api_1 = require("../config-api");
|
|
19
|
+
const deprecated_deployment_detection_check_1 = require("./checks/post-deploy/deprecated-deployment-detection-check");
|
|
19
20
|
class DeployServiceFactory {
|
|
20
21
|
context;
|
|
21
22
|
cliConfig;
|
|
@@ -64,6 +65,7 @@ class DeployServiceFactory {
|
|
|
64
65
|
return [
|
|
65
66
|
new save_files_check_1.default(files, cliService),
|
|
66
67
|
new revalidated_module_check_1.default(configApi, cliService, app),
|
|
68
|
+
new deprecated_deployment_detection_check_1.DeprecatedDeploymentDetectionCheck(files, cliService, configApi, app),
|
|
67
69
|
];
|
|
68
70
|
}
|
|
69
71
|
}
|
|
@@ -59,9 +59,8 @@ class DeployService {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
async runPostDeployChecks() {
|
|
62
|
-
for (
|
|
63
|
-
|
|
64
|
-
await check.check();
|
|
62
|
+
for (const postDeployCheck of this.postDeployChecks) {
|
|
63
|
+
await postDeployCheck.check();
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
filterFilesToProcess() {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostDeployDeploymentDetectionError = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
|
|
6
|
+
class PostDeployDeploymentDetectionError extends application_error_1.default {
|
|
7
|
+
code = "POST_DEPLOY";
|
|
8
|
+
}
|
|
9
|
+
exports.PostDeployDeploymentDetectionError = PostDeployDeploymentDetectionError;
|
package/oclif.manifest.json
CHANGED