@celonis/content-cli 0.5.3 → 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/api/variable-assignment-apis.js +20 -0
- package/api/variables-api.js +14 -1
- package/commands/connection.command.js +40 -0
- package/commands/variable.command.js +35 -0
- package/content-cli-get.js +52 -0
- package/content-cli-list.js +31 -1
- package/content-cli-set.js +54 -0
- package/content-cli.js +2 -0
- package/interfaces/variable-assignment-api.interface.js +12 -0
- package/lib/api/data-pool-api.d.ts +4 -0
- package/lib/api/variable-assignment-apis.d.ts +4 -0
- package/lib/api/variables-api.d.ts +6 -0
- package/lib/commands/connection.command.d.ts +5 -0
- package/lib/commands/variable.command.d.ts +3 -0
- package/lib/content-cli-get.d.ts +1 -0
- package/lib/content-cli-list.d.ts +2 -0
- package/lib/content-cli-set.d.ts +1 -0
- package/lib/interfaces/variable-assignment-api.interface.d.ts +3 -0
- package/lib/services/connection/connection.service.d.ts +7 -0
- package/lib/services/package-manager/variable-service.d.ts +3 -0
- package/package.json +1 -1
- package/services/connection/connection.service.js +82 -0
- package/services/package-manager/variable-service.js +38 -1
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,20 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.variableAssignmentApis = {
|
|
13
|
+
DATA_MODEL: {
|
|
14
|
+
url: "/package-manager/api/compute-pools/pools-with-data-models"
|
|
15
|
+
},
|
|
16
|
+
CONNECTION: {
|
|
17
|
+
url: "/process-automation-v2/api/connections"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
});
|
package/api/variables-api.js
CHANGED
|
@@ -13,13 +13,14 @@ 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", "../services/http-client-service.v2", "../util/logger"], factory);
|
|
16
|
+
define(["require", "exports", "../services/http-client-service.v2", "../util/logger", "./variable-assignment-apis"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
const http_client_service_v2_1 = require("../services/http-client-service.v2");
|
|
22
22
|
const logger_1 = require("../util/logger");
|
|
23
|
+
const variable_assignment_apis_1 = require("./variable-assignment-apis");
|
|
23
24
|
class VariablesApi {
|
|
24
25
|
assignVariableValues(packageKey, variablesAssignments) {
|
|
25
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -28,7 +29,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
28
29
|
});
|
|
29
30
|
});
|
|
30
31
|
}
|
|
32
|
+
getCandidateAssignments(type, params) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
if (!VariablesApi.ASSIGNMENT_APIS[type]) {
|
|
35
|
+
throw new logger_1.FatalError(`Variable type ${type} not supported.`);
|
|
36
|
+
}
|
|
37
|
+
const apiUrl = VariablesApi.ASSIGNMENT_APIS[type].url + (params.toString().length ? `?${params.toString()}` : "");
|
|
38
|
+
return http_client_service_v2_1.httpClientV2.get(apiUrl).catch(e => {
|
|
39
|
+
throw new logger_1.FatalError(`Problem getting variables assignment values for type ${type}: ${e}`);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
31
43
|
}
|
|
32
44
|
VariablesApi.INSTANCE = new VariablesApi();
|
|
45
|
+
VariablesApi.ASSIGNMENT_APIS = variable_assignment_apis_1.variableAssignmentApis;
|
|
33
46
|
exports.variablesApi = VariablesApi.INSTANCE;
|
|
34
47
|
});
|
|
@@ -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,35 @@
|
|
|
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/package-manager/variable-service"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const variable_service_1 = require("../services/package-manager/variable-service");
|
|
22
|
+
class VariableCommand {
|
|
23
|
+
listAssignments(variableType, jsonResponse, params) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
if (jsonResponse) {
|
|
26
|
+
yield variable_service_1.variableService.findAndExportCandidateAssignments(variableType, params);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
yield variable_service_1.variableService.listCandidateAssignments(variableType, params);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.VariableCommand = VariableCommand;
|
|
35
|
+
});
|
|
@@ -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"], 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,8 @@ 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");
|
|
29
|
+
const variable_command_1 = require("./commands/variable.command");
|
|
28
30
|
class List {
|
|
29
31
|
static packages(program) {
|
|
30
32
|
program
|
|
@@ -64,6 +66,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
64
66
|
}));
|
|
65
67
|
return program;
|
|
66
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
|
+
}
|
|
67
81
|
static assets(program) {
|
|
68
82
|
program
|
|
69
83
|
.command("assets")
|
|
@@ -77,6 +91,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
77
91
|
}));
|
|
78
92
|
return program;
|
|
79
93
|
}
|
|
94
|
+
static assignments(program) {
|
|
95
|
+
program
|
|
96
|
+
.command("assignments")
|
|
97
|
+
.description("Command to list possible variable assignments for a type")
|
|
98
|
+
.option("-p, --profile <profile>", "Profile which you want to use to list possible variable assignments")
|
|
99
|
+
.option("--json", "Return response as json type", "")
|
|
100
|
+
.requiredOption("--type <type>", "Type of variable")
|
|
101
|
+
.option("--params <params>", "Variable query params")
|
|
102
|
+
.action((cmd) => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
yield new variable_command_1.VariableCommand().listAssignments(cmd.type, cmd.json, cmd.params);
|
|
104
|
+
process.exit();
|
|
105
|
+
}));
|
|
106
|
+
return program;
|
|
107
|
+
}
|
|
80
108
|
}
|
|
81
109
|
exports.List = List;
|
|
82
110
|
process.on("unhandledRejection", (e, promise) => {
|
|
@@ -87,6 +115,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
87
115
|
List.spaces(commander);
|
|
88
116
|
List.dataPools(commander);
|
|
89
117
|
List.assets(commander);
|
|
118
|
+
List.connections(commander);
|
|
119
|
+
List.assignments(commander);
|
|
90
120
|
commander.parse(process.argv);
|
|
91
121
|
};
|
|
92
122
|
context_initializer_1.ContextInitializer.initContext()
|
|
@@ -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) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
|
@@ -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 {};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { ContentNodeTransport, VariablesAssignments } from "../interfaces/package-manager.interfaces";
|
|
3
|
+
import { URLSearchParams } from "url";
|
|
2
4
|
declare class VariablesApi {
|
|
3
5
|
static readonly INSTANCE: VariablesApi;
|
|
6
|
+
static readonly ASSIGNMENT_APIS: {
|
|
7
|
+
[key: string]: import("../interfaces/variable-assignment-api.interface").VariableAssignmentApi;
|
|
8
|
+
};
|
|
4
9
|
assignVariableValues(packageKey: string, variablesAssignments: VariablesAssignments[]): Promise<ContentNodeTransport[]>;
|
|
10
|
+
getCandidateAssignments(type: string, params: URLSearchParams): Promise<object[]>;
|
|
5
11
|
}
|
|
6
12
|
export declare const variablesApi: VariablesApi;
|
|
7
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,8 @@ 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;
|
|
9
|
+
static assignments(program: CommanderStatic): CommanderStatic;
|
|
8
10
|
}
|
|
9
11
|
export {};
|
|
@@ -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 {};
|
|
@@ -2,6 +2,9 @@ import { PackageManagerVariableType, PackageWithVariableAssignments, VariablesAs
|
|
|
2
2
|
declare class VariableService {
|
|
3
3
|
getVariableAssignmentsForNodes(type?: PackageManagerVariableType): Promise<PackageWithVariableAssignments[]>;
|
|
4
4
|
assignVariableValues(packageKey: string, variablesAssignments: VariablesAssignments[]): Promise<void>;
|
|
5
|
+
listCandidateAssignments(type: string, params: string): Promise<void>;
|
|
6
|
+
findAndExportCandidateAssignments(type: string, params: string): Promise<void>;
|
|
7
|
+
private parseParams;
|
|
5
8
|
}
|
|
6
9
|
export declare const variableService: VariableService;
|
|
7
10
|
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
|
+
});
|
|
@@ -13,13 +13,17 @@ 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", "../../api/package-api", "../../api/variables-api"], factory);
|
|
16
|
+
define(["require", "exports", "../../api/package-api", "../../api/variables-api", "uuid", "../../util/logger", "../file-service", "url"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
const package_api_1 = require("../../api/package-api");
|
|
22
22
|
const variables_api_1 = require("../../api/variables-api");
|
|
23
|
+
const uuid_1 = require("uuid");
|
|
24
|
+
const logger_1 = require("../../util/logger");
|
|
25
|
+
const file_service_1 = require("../file-service");
|
|
26
|
+
const url_1 = require("url");
|
|
23
27
|
class VariableService {
|
|
24
28
|
getVariableAssignmentsForNodes(type) {
|
|
25
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -31,6 +35,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
35
|
yield variables_api_1.variablesApi.assignVariableValues(packageKey, variablesAssignments);
|
|
32
36
|
});
|
|
33
37
|
}
|
|
38
|
+
listCandidateAssignments(type, params) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const parsedParams = this.parseParams(params);
|
|
41
|
+
const assignments = yield variables_api_1.variablesApi.getCandidateAssignments(type, parsedParams);
|
|
42
|
+
assignments.forEach(assignment => {
|
|
43
|
+
logger_1.logger.info(JSON.stringify(assignment));
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
findAndExportCandidateAssignments(type, params) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const parsedParams = this.parseParams(params);
|
|
50
|
+
const assignments = yield variables_api_1.variablesApi.getCandidateAssignments(type, parsedParams);
|
|
51
|
+
const filename = uuid_1.v4() + ".json";
|
|
52
|
+
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(assignments), filename);
|
|
53
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
parseParams(params) {
|
|
57
|
+
const queryParams = new url_1.URLSearchParams();
|
|
58
|
+
if (params) {
|
|
59
|
+
try {
|
|
60
|
+
params.split(",").forEach((param) => {
|
|
61
|
+
const paramKeyValuePair = param.split("=");
|
|
62
|
+
queryParams.set(paramKeyValuePair[0], paramKeyValuePair[1]);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
throw new logger_1.FatalError(`Problem parsing query params: ${e}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return queryParams;
|
|
70
|
+
}
|
|
34
71
|
}
|
|
35
72
|
exports.variableService = new VariableService();
|
|
36
73
|
});
|