@extrahorizon/exh-cli 1.12.0-dev-134-0b76e07 → 1.12.0-dev-135-55b05fe
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.
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
4
|
const chalk = require("chalk");
|
|
5
|
-
const exh_1 = require("../../exh");
|
|
6
5
|
const util_1 = require("../../helpers/util");
|
|
6
|
+
const templateRepository = require("../../repositories/templates");
|
|
7
7
|
exports.command = 'delete';
|
|
8
8
|
exports.desc = 'Delete a template';
|
|
9
9
|
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({
|
|
@@ -25,17 +25,17 @@ exports.builder = builder;
|
|
|
25
25
|
const handler = async function list({ name, id }) {
|
|
26
26
|
let template = null;
|
|
27
27
|
if (name) {
|
|
28
|
-
template = await
|
|
28
|
+
template = await templateRepository.findByName(name);
|
|
29
29
|
}
|
|
30
30
|
if (id) {
|
|
31
|
-
template = await
|
|
31
|
+
template = await templateRepository.findById(id);
|
|
32
32
|
}
|
|
33
33
|
if (!template) {
|
|
34
34
|
console.log(chalk.red('Template not found!'));
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
try {
|
|
38
|
-
const { affectedRecords } = await
|
|
38
|
+
const { affectedRecords } = await templateRepository.remove(template.id);
|
|
39
39
|
if (!affectedRecords) {
|
|
40
40
|
console.log(chalk.red('Failed to remove template', name));
|
|
41
41
|
return;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function findByName(name: string): Promise<import("@extrahorizon/javascript-sdk").TemplateOut>;
|
|
2
|
+
export declare function findById(id: string): Promise<import("@extrahorizon/javascript-sdk").TemplateOut>;
|
|
3
|
+
export declare function remove(id: string): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.remove = exports.findById = exports.findByName = void 0;
|
|
4
|
+
const exh_1 = require("../exh");
|
|
5
|
+
async function findByName(name) {
|
|
6
|
+
return await (0, exh_1.getSdk)().templates.findByName(name);
|
|
7
|
+
}
|
|
8
|
+
exports.findByName = findByName;
|
|
9
|
+
async function findById(id) {
|
|
10
|
+
return await (0, exh_1.getSdk)().templates.findById(id);
|
|
11
|
+
}
|
|
12
|
+
exports.findById = findById;
|
|
13
|
+
async function remove(id) {
|
|
14
|
+
return await (0, exh_1.getSdk)().templates.remove(id);
|
|
15
|
+
}
|
|
16
|
+
exports.remove = remove;
|