@celonis/content-cli 0.3.3 → 0.3.4
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 +34 -0
- package/commands/data-pool.command.js +12 -1
- package/content-cli-list.js +15 -1
- package/interfaces/data-pool-manager.interfaces.js +12 -0
- package/lib/api/data-pool-api.d.ts +7 -0
- package/lib/commands/data-pool.command.d.ts +1 -0
- package/lib/content-cli-list.d.ts +1 -0
- package/lib/interfaces/data-pool-manager.interfaces.d.ts +24 -0
- package/lib/services/data-pool/data-pool-service.d.ts +8 -0
- package/package.json +1 -1
- package/services/data-pool/data-pool-service.js +59 -0
|
@@ -0,0 +1,34 @@
|
|
|
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/http-client-service.v2", "../util/logger"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const http_client_service_v2_1 = require("../services/http-client-service.v2");
|
|
22
|
+
const logger_1 = require("../util/logger");
|
|
23
|
+
class DataPoolApi {
|
|
24
|
+
findAllPagedPools(limit, page) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return http_client_service_v2_1.httpClientV2.get(`/integration/api/pools/paged?limit=${limit}&page=${page}`).catch(e => {
|
|
27
|
+
throw new logger_1.FatalError(`Problem getting data pools: : ${e}`);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
DataPoolApi.INSTANCE = new DataPoolApi();
|
|
33
|
+
exports.dataPoolApi = DataPoolApi.INSTANCE;
|
|
34
|
+
});
|
|
@@ -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/content.service", "../content/factory/data-pool-manager.factory"], factory);
|
|
16
|
+
define(["require", "exports", "../services/content.service", "../content/factory/data-pool-manager.factory", "../services/data-pool/data-pool-service"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
const content_service_1 = require("../services/content.service");
|
|
22
22
|
const data_pool_manager_factory_1 = require("../content/factory/data-pool-manager.factory");
|
|
23
|
+
const data_pool_service_1 = require("../services/data-pool/data-pool-service");
|
|
23
24
|
class DataPoolCommand {
|
|
24
25
|
constructor() {
|
|
25
26
|
this.contentService = new content_service_1.ContentService();
|
|
@@ -45,6 +46,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
45
46
|
yield this.contentService.update(profile, this.dataPoolManagerFactory.createManager(id, filename));
|
|
46
47
|
});
|
|
47
48
|
}
|
|
49
|
+
listDataPools(profile, jsonResponse) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
if (jsonResponse) {
|
|
52
|
+
yield data_pool_service_1.dataPoolService.findAndExportAllPools();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
yield data_pool_service_1.dataPoolService.listDataPools();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
48
59
|
}
|
|
49
60
|
exports.DataPoolCommand = DataPoolCommand;
|
|
50
61
|
});
|
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/asset.command", "commander", "./services/context.service", "./util/logger"], factory);
|
|
16
|
+
define(["require", "exports", "./commands/package.command", "./commands/space.command", "./commands/data-pool.command", "./commands/asset.command", "commander", "./services/context.service", "./util/logger"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -21,6 +21,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
const package_command_1 = require("./commands/package.command");
|
|
23
23
|
const space_command_1 = require("./commands/space.command");
|
|
24
|
+
const data_pool_command_1 = require("./commands/data-pool.command");
|
|
24
25
|
const asset_command_1 = require("./commands/asset.command");
|
|
25
26
|
const commander = require("commander");
|
|
26
27
|
const context_service_1 = require("./services/context.service");
|
|
@@ -51,6 +52,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
51
52
|
}));
|
|
52
53
|
return program;
|
|
53
54
|
}
|
|
55
|
+
static dataPools(program) {
|
|
56
|
+
program
|
|
57
|
+
.command("data-pools")
|
|
58
|
+
.description("Command to list all Data Pools")
|
|
59
|
+
.option("-p, --profile <profile>", "Profile which you want to use to list data pools")
|
|
60
|
+
.option("--json", "Return response as json type", "")
|
|
61
|
+
.action((cmd) => __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
yield new data_pool_command_1.DataPoolCommand().listDataPools(cmd.profile, cmd.json);
|
|
63
|
+
process.exit();
|
|
64
|
+
}));
|
|
65
|
+
return program;
|
|
66
|
+
}
|
|
54
67
|
static assets(program) {
|
|
55
68
|
program
|
|
56
69
|
.command("assets")
|
|
@@ -74,6 +87,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
74
87
|
context_service_1.contextService.resolveProfile(options.unknown[indexOfProfileOption + 1]).then(() => {
|
|
75
88
|
List.packages(commander);
|
|
76
89
|
List.spaces(commander);
|
|
90
|
+
List.dataPools(commander);
|
|
77
91
|
List.assets(commander);
|
|
78
92
|
commander.parse(process.argv);
|
|
79
93
|
}).catch(e => {
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataPoolPageTransport } from "../interfaces/data-pool-manager.interfaces";
|
|
2
|
+
declare class DataPoolApi {
|
|
3
|
+
static readonly INSTANCE: DataPoolApi;
|
|
4
|
+
findAllPagedPools(limit: string, page: string): Promise<DataPoolPageTransport>;
|
|
5
|
+
}
|
|
6
|
+
export declare const dataPoolApi: DataPoolApi;
|
|
7
|
+
export {};
|
|
@@ -5,4 +5,5 @@ export declare class DataPoolCommand {
|
|
|
5
5
|
pushDataPool(profile: string, filename: string): Promise<void>;
|
|
6
6
|
pushDataPools(profile: string): Promise<void>;
|
|
7
7
|
updateDataPool(profile: string, id: string, filename: string): Promise<any>;
|
|
8
|
+
listDataPools(profile: string, jsonResponse: boolean): Promise<any>;
|
|
8
9
|
}
|
|
@@ -3,6 +3,7 @@ declare type CommanderStatic = commander.CommanderStatic;
|
|
|
3
3
|
export declare class List {
|
|
4
4
|
static packages(program: CommanderStatic): CommanderStatic;
|
|
5
5
|
static spaces(program: CommanderStatic): CommanderStatic;
|
|
6
|
+
static dataPools(program: CommanderStatic): CommanderStatic;
|
|
6
7
|
static assets(program: CommanderStatic): CommanderStatic;
|
|
7
8
|
}
|
|
8
9
|
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare type DataPoolStatus = "CANCEL" | "FAIL" | "QUEUED" | "RUNNING" | "SKIPPED" | "SUCCESS" | "UNCONFIGURED";
|
|
2
|
+
export declare type Tag = {};
|
|
3
|
+
export declare class DataSourceSlimTransport {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
imported: boolean;
|
|
7
|
+
importedPoolId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface DataPoolSlimTransport {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
status: DataPoolStatus;
|
|
13
|
+
lastExecutionStartDate: Date;
|
|
14
|
+
createdBy: string;
|
|
15
|
+
tags: Tag[];
|
|
16
|
+
rawDataSize: number;
|
|
17
|
+
dataSources: DataSourceSlimTransport[];
|
|
18
|
+
}
|
|
19
|
+
export declare class DataPoolPageTransport {
|
|
20
|
+
content: DataPoolSlimTransport[];
|
|
21
|
+
pageSize: number;
|
|
22
|
+
pageNumber: number;
|
|
23
|
+
totalCount: number;
|
|
24
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
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", "uuid", "../file-service"], 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
|
+
const uuid_1 = require("uuid");
|
|
24
|
+
const file_service_1 = require("../file-service");
|
|
25
|
+
class DataPoolService {
|
|
26
|
+
listDataPools() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const dataPools = yield this.findAllPools();
|
|
29
|
+
dataPools.forEach(pool => {
|
|
30
|
+
logger_1.logger.info(`Pool Id: ${pool.id} - Pool Name: ${pool.name}`);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
findAndExportAllPools() {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const dataPools = yield this.findAllPools();
|
|
37
|
+
this.exportListOfPools(dataPools);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
findAllPools() {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
let page = 0;
|
|
43
|
+
const dataPools = [];
|
|
44
|
+
let tmpPage = yield data_pool_api_1.dataPoolApi.findAllPagedPools("100", page.toString());
|
|
45
|
+
while (tmpPage.pageNumber < tmpPage.totalCount) {
|
|
46
|
+
dataPools.push(...tmpPage.content);
|
|
47
|
+
tmpPage = yield data_pool_api_1.dataPoolApi.findAllPagedPools("100", (++page).toString());
|
|
48
|
+
}
|
|
49
|
+
return dataPools;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exportListOfPools(nodes) {
|
|
53
|
+
const filename = uuid_1.v4() + ".json";
|
|
54
|
+
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(nodes), filename);
|
|
55
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.dataPoolService = new DataPoolService();
|
|
59
|
+
});
|