@celonis/content-cli 0.5.4 → 0.5.5
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/api/data-pool-api.js +28 -0
- package/commands/connection.command.js +40 -0
- package/content-cli-get.js +52 -0
- package/content-cli-list.js +15 -1
- package/content-cli-set.js +54 -0
- package/content-cli.js +2 -0
- package/lib/api/data-pool-api.d.ts +4 -0
- package/lib/commands/connection.command.d.ts +5 -0
- package/lib/content-cli-get.d.ts +1 -0
- package/lib/content-cli-list.d.ts +1 -0
- package/lib/content-cli-set.d.ts +1 -0
- package/lib/services/connection/connection.service.d.ts +7 -0
- package/package.json +1 -1
- package/services/connection/connection.service.js +82 -0
package/api/data-pool-api.js
CHANGED
|
@@ -42,6 +42,34 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
+
listConnections(poolId) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
return http_client_service_v2_1.httpClientV2.get(`/integration/api/pools/${poolId}/overviews/data-sources`).catch(e => {
|
|
48
|
+
throw new logger_1.FatalError(`Can not list connections: : ${e}`);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
getConnection(poolId, connectionId) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
return http_client_service_v2_1.httpClientV2.get(`/integration/api/pools/${poolId}/data-sources/${connectionId}`).catch(e => {
|
|
55
|
+
throw new logger_1.FatalError(`Can not get connection: : ${e}`);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
getTypedConnection(poolId, connectionId, type) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return http_client_service_v2_1.httpClientV2.get(`/integration/api/datasource/${type}/${connectionId}`).catch(e => {
|
|
62
|
+
throw new logger_1.FatalError(`Can get typed connection: : ${e}`);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
updateTypedConnection(poolId, connectionId, type, data) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
return http_client_service_v2_1.httpClientV2.put(`/integration/api/datasource/${type}/${connectionId}`, data).catch(e => {
|
|
69
|
+
throw new logger_1.FatalError(`Can not update typed connection: ${e}`);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
45
73
|
}
|
|
46
74
|
DataPoolApi.INSTANCE = new DataPoolApi();
|
|
47
75
|
exports.dataPoolApi = DataPoolApi.INSTANCE;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
(function (factory) {
|
|
11
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
12
|
+
var v = factory(require, exports);
|
|
13
|
+
if (v !== undefined) module.exports = v;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof define === "function" && define.amd) {
|
|
16
|
+
define(["require", "exports", "../services/connection/connection.service"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const connection_service_1 = require("../services/connection/connection.service");
|
|
22
|
+
class ConnectionCommand {
|
|
23
|
+
updateProperty(profile, dataPoolId, connectionId, property, value) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
yield connection_service_1.connectionService.updateProperty(dataPoolId, connectionId, property, value);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
getProperties(profile, dataPoolId, connectionId) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
yield connection_service_1.connectionService.listProperties(dataPoolId, connectionId);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
listConnections(profile, dataPoolId) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return yield connection_service_1.connectionService.findAllConnections(dataPoolId);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.ConnectionCommand = ConnectionCommand;
|
|
40
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
(function (factory) {
|
|
11
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
12
|
+
var v = factory(require, exports);
|
|
13
|
+
if (v !== undefined) module.exports = v;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof define === "function" && define.amd) {
|
|
16
|
+
define(["require", "exports", "./commands/connection.command", "commander", "./util/context-initializer", "./util/logger"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const connection_command_1 = require("./commands/connection.command");
|
|
22
|
+
const commander = require("commander");
|
|
23
|
+
const context_initializer_1 = require("./util/context-initializer");
|
|
24
|
+
const logger_1 = require("./util/logger");
|
|
25
|
+
class Get {
|
|
26
|
+
static connection(program) {
|
|
27
|
+
program
|
|
28
|
+
.command("connection")
|
|
29
|
+
.description("Programmatically read properties of your connections")
|
|
30
|
+
.option("-p, --profile <profile>", "Profile which you want to use to update the data pool configuration")
|
|
31
|
+
.requiredOption("--dataPoolId <dataPoolId>", "Id of the data pool you want to update")
|
|
32
|
+
.requiredOption("--connectionId <connectionId>", "Id of the connection you want to update")
|
|
33
|
+
.action((cmd) => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
yield new connection_command_1.ConnectionCommand().getProperties(cmd.profile, cmd.dataPoolId, cmd.connectionId);
|
|
35
|
+
process.exit();
|
|
36
|
+
}));
|
|
37
|
+
return program;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
context_initializer_1.ContextInitializer.initContext()
|
|
41
|
+
.then(() => {
|
|
42
|
+
Get.connection(commander);
|
|
43
|
+
commander.parse(process.argv);
|
|
44
|
+
})
|
|
45
|
+
.catch(e => {
|
|
46
|
+
logger_1.logger.error(e);
|
|
47
|
+
});
|
|
48
|
+
if (!process.argv.slice(2).length) {
|
|
49
|
+
commander.outputHelp();
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
});
|
package/content-cli-list.js
CHANGED
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
if (v !== undefined) module.exports = v;
|
|
14
14
|
}
|
|
15
15
|
else if (typeof define === "function" && define.amd) {
|
|
16
|
-
define(["require", "exports", "./commands/package.command", "./commands/space.command", "./commands/data-pool.command", "./commands/asset.command", "./util/logger", "commander", "./util/context-initializer", "./commands/variable.command"], factory);
|
|
16
|
+
define(["require", "exports", "./commands/package.command", "./commands/space.command", "./commands/data-pool.command", "./commands/asset.command", "./util/logger", "commander", "./util/context-initializer", "./commands/connection.command", "./commands/variable.command"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -25,6 +25,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
25
25
|
const logger_1 = require("./util/logger");
|
|
26
26
|
const commander = require("commander");
|
|
27
27
|
const context_initializer_1 = require("./util/context-initializer");
|
|
28
|
+
const connection_command_1 = require("./commands/connection.command");
|
|
28
29
|
const variable_command_1 = require("./commands/variable.command");
|
|
29
30
|
class List {
|
|
30
31
|
static packages(program) {
|
|
@@ -65,6 +66,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
65
66
|
}));
|
|
66
67
|
return program;
|
|
67
68
|
}
|
|
69
|
+
static connections(program) {
|
|
70
|
+
program
|
|
71
|
+
.command("connection")
|
|
72
|
+
.description("Command to list all connections in a Data Pool")
|
|
73
|
+
.option("-p, --profile <profile>", "Profile which you want to use to list connections")
|
|
74
|
+
.requiredOption("--dataPoolId <dataPoolId>", "ID of the data pool")
|
|
75
|
+
.action((cmd) => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
yield new connection_command_1.ConnectionCommand().listConnections(cmd.profile, cmd.dataPoolId);
|
|
77
|
+
process.exit();
|
|
78
|
+
}));
|
|
79
|
+
return program;
|
|
80
|
+
}
|
|
68
81
|
static assets(program) {
|
|
69
82
|
program
|
|
70
83
|
.command("assets")
|
|
@@ -102,6 +115,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
102
115
|
List.spaces(commander);
|
|
103
116
|
List.dataPools(commander);
|
|
104
117
|
List.assets(commander);
|
|
118
|
+
List.connections(commander);
|
|
105
119
|
List.assignments(commander);
|
|
106
120
|
commander.parse(process.argv);
|
|
107
121
|
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
(function (factory) {
|
|
11
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
12
|
+
var v = factory(require, exports);
|
|
13
|
+
if (v !== undefined) module.exports = v;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof define === "function" && define.amd) {
|
|
16
|
+
define(["require", "exports", "./commands/connection.command", "commander", "./util/context-initializer", "./util/logger"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const connection_command_1 = require("./commands/connection.command");
|
|
22
|
+
const commander = require("commander");
|
|
23
|
+
const context_initializer_1 = require("./util/context-initializer");
|
|
24
|
+
const logger_1 = require("./util/logger");
|
|
25
|
+
class Set {
|
|
26
|
+
static connection(program) {
|
|
27
|
+
program
|
|
28
|
+
.command("connection")
|
|
29
|
+
.description("Programmatically update properties of your connections")
|
|
30
|
+
.option("-p, --profile <profile>", "Profile which you want to use to update the data pool configuration")
|
|
31
|
+
.requiredOption("--dataPoolId <dataPoolId>", "Id of the data pool you want to update")
|
|
32
|
+
.requiredOption("--connectionId <connectionId>", "Id of the connection you want to update")
|
|
33
|
+
.requiredOption("--property <property>", "The property you want to update")
|
|
34
|
+
.requiredOption("--value <value>", "The value you want to update")
|
|
35
|
+
.action((cmd) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
yield new connection_command_1.ConnectionCommand().updateProperty(cmd.profile, cmd.dataPoolId, cmd.connectionId, cmd.property, cmd.value);
|
|
37
|
+
process.exit();
|
|
38
|
+
}));
|
|
39
|
+
return program;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
context_initializer_1.ContextInitializer.initContext()
|
|
43
|
+
.then(() => {
|
|
44
|
+
Set.connection(commander);
|
|
45
|
+
commander.parse(process.argv);
|
|
46
|
+
})
|
|
47
|
+
.catch(e => {
|
|
48
|
+
logger_1.logger.error(e);
|
|
49
|
+
});
|
|
50
|
+
if (!process.argv.slice(2).length) {
|
|
51
|
+
commander.outputHelp();
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
});
|
package/content-cli.js
CHANGED
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
program.command("push", "Commands to push content.");
|
|
27
27
|
program.command("update", "Commands to update content.");
|
|
28
28
|
program.command("list", "Commands to list content.").alias("ls");
|
|
29
|
+
program.command("get", "Commands to get configuration properties.");
|
|
30
|
+
program.command("set", "Commands to set configuration properties.");
|
|
29
31
|
program.version(version_1.VersionUtils.getCurrentCliVersion());
|
|
30
32
|
program.parse(process.argv);
|
|
31
33
|
if (!process.argv.slice(2).length) {
|
|
@@ -4,6 +4,10 @@ declare class DataPoolApi {
|
|
|
4
4
|
findAllPagedPools(limit: string, page: string): Promise<DataPoolPageTransport>;
|
|
5
5
|
executeDataPoolsBatchImport(importRequest: string): Promise<DataPoolInstallVersionReport>;
|
|
6
6
|
exportDataPool(poolId: string): Promise<string>;
|
|
7
|
+
listConnections(poolId: string): Promise<any>;
|
|
8
|
+
getConnection(poolId: string, connectionId: string): Promise<any>;
|
|
9
|
+
getTypedConnection(poolId: string, connectionId: string, type: string): Promise<any>;
|
|
10
|
+
updateTypedConnection(poolId: string, connectionId: string, type: string, data: any): Promise<any>;
|
|
7
11
|
}
|
|
8
12
|
export declare const dataPoolApi: DataPoolApi;
|
|
9
13
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare class ConnectionCommand {
|
|
2
|
+
updateProperty(profile: string, dataPoolId: string, connectionId: string, property: string, value: string): Promise<void>;
|
|
3
|
+
getProperties(profile: string, dataPoolId: string, connectionId: string): Promise<void>;
|
|
4
|
+
listConnections(profile: string, dataPoolId: string): Promise<any>;
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,6 +4,7 @@ export declare class List {
|
|
|
4
4
|
static packages(program: CommanderStatic): CommanderStatic;
|
|
5
5
|
static spaces(program: CommanderStatic): CommanderStatic;
|
|
6
6
|
static dataPools(program: CommanderStatic): CommanderStatic;
|
|
7
|
+
static connections(program: CommanderStatic): CommanderStatic;
|
|
7
8
|
static assets(program: CommanderStatic): CommanderStatic;
|
|
8
9
|
static assignments(program: CommanderStatic): CommanderStatic;
|
|
9
10
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare class ConnectionService {
|
|
2
|
+
findAllConnections(dataPoolId: string): Promise<any[]>;
|
|
3
|
+
listProperties(dataPoolId: string, connectionId: string): Promise<any[]>;
|
|
4
|
+
updateProperty(dataPoolId: string, connectionId: string, property: string, value: string): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare const connectionService: ConnectionService;
|
|
7
|
+
export {};
|
package/package.json
CHANGED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
(function (factory) {
|
|
11
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
12
|
+
var v = factory(require, exports);
|
|
13
|
+
if (v !== undefined) module.exports = v;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof define === "function" && define.amd) {
|
|
16
|
+
define(["require", "exports", "../../api/data-pool-api", "../../util/logger"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const data_pool_api_1 = require("../../api/data-pool-api");
|
|
22
|
+
const logger_1 = require("../../util/logger");
|
|
23
|
+
class ConnectionService {
|
|
24
|
+
findAllConnections(dataPoolId) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const connections = yield data_pool_api_1.dataPoolApi.listConnections(dataPoolId);
|
|
27
|
+
connections.forEach(connection => {
|
|
28
|
+
logger_1.logger.info(`Connection ID: ${connection.id} - Name: ${connection.name} - Type: ${connection.type}`);
|
|
29
|
+
});
|
|
30
|
+
return connections;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
listProperties(dataPoolId, connectionId) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const connection = yield data_pool_api_1.dataPoolApi.getConnection(dataPoolId, connectionId);
|
|
36
|
+
const type = connection.type;
|
|
37
|
+
const typedConnection = yield data_pool_api_1.dataPoolApi.getTypedConnection(dataPoolId, connectionId, type);
|
|
38
|
+
logger_1.logger.info(`Connection ID: ${connection.id} - Name: ${connection.name} - Type: ${connection.type}`);
|
|
39
|
+
logger_1.logger.info(`Properties:`);
|
|
40
|
+
for (let k in typedConnection) {
|
|
41
|
+
if (typeof typedConnection[k] === 'object') {
|
|
42
|
+
for (let o in typedConnection[k]) {
|
|
43
|
+
logger_1.logger.info(` ${k}.${o} : ${typeof typedConnection[k][o]} := ${typedConnection[k][o]}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
logger_1.logger.info(` ${k} : ${typeof typedConnection[k]} := ${typedConnection[k]}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return typedConnection;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
updateProperty(dataPoolId, connectionId, property, value) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const connection = yield data_pool_api_1.dataPoolApi.getConnection(dataPoolId, connectionId);
|
|
56
|
+
const type = connection.type;
|
|
57
|
+
const typedConnection = yield data_pool_api_1.dataPoolApi.getTypedConnection(dataPoolId, connectionId, type);
|
|
58
|
+
const parts = property.split(".");
|
|
59
|
+
// update the typed connection object
|
|
60
|
+
let currentObject = typedConnection;
|
|
61
|
+
for (let i = 0; i < parts.length; i++) {
|
|
62
|
+
const part = parts[i];
|
|
63
|
+
if (currentObject.hasOwnProperty(part)) {
|
|
64
|
+
if (i < parts.length - 1) {
|
|
65
|
+
currentObject = currentObject[part];
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
currentObject[part] = value;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
logger_1.logger.error(`Property ${property} not found on connection.`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
yield data_pool_api_1.dataPoolApi.updateTypedConnection(dataPoolId, connectionId, type, typedConnection);
|
|
77
|
+
logger_1.logger.info(`Property ${property} updated.`);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.connectionService = new ConnectionService();
|
|
82
|
+
});
|