@extrahorizon/exh-cli 1.5.0 → 1.5.1-dev-27-7bdff2e
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 +56 -53
- package/README.md +0 -12
- package/build/commands/completion.d.ts +5 -5
- package/build/commands/completion.js +38 -38
- package/build/commands/data/schemas/delete.d.ts +10 -10
- package/build/commands/data/schemas/delete.js +29 -29
- package/build/commands/data/schemas/list.d.ts +8 -8
- package/build/commands/data/schemas/list.js +20 -20
- package/build/commands/data/schemas/sync/statusHelpers.d.ts +3 -3
- package/build/commands/data/schemas/sync/statusHelpers.js +49 -49
- package/build/commands/data/schemas/sync.d.ts +35 -35
- package/build/commands/data/schemas/sync.js +72 -72
- package/build/commands/data/schemas/util/listFilesInDir.d.ts +1 -1
- package/build/commands/data/schemas/util/listFilesInDir.js +25 -25
- package/build/commands/data/schemas/util/metaschema.json +455 -455
- package/build/commands/data/schemas/util/readJson.d.ts +1 -1
- package/build/commands/data/schemas/util/readJson.js +11 -11
- package/build/commands/data/schemas/util/schemaverify.d.ts +28 -28
- package/build/commands/data/schemas/util/schemaverify.js +202 -202
- package/build/commands/data/schemas/util/syncSchema.d.ts +20 -20
- package/build/commands/data/schemas/util/syncSchema.js +276 -276
- package/build/commands/data/schemas/util/tests/listFilesInDir.test.d.ts +1 -1
- package/build/commands/data/schemas/util/tests/listFilesInDir.test.js +40 -40
- package/build/commands/data/schemas/verify.d.ts +18 -18
- package/build/commands/data/schemas/verify.js +82 -82
- package/build/commands/data/schemas.d.ts +5 -5
- package/build/commands/data/schemas.js +10 -10
- package/build/commands/data.d.ts +5 -5
- package/build/commands/data.js +10 -10
- package/build/commands/dispatchers/sync.d.ts +21 -21
- package/build/commands/dispatchers/sync.js +24 -24
- package/build/commands/dispatchers.d.ts +5 -5
- package/build/commands/dispatchers.js +10 -10
- package/build/commands/login.d.ts +37 -37
- package/build/commands/login.js +59 -59
- package/build/commands/sync.d.ts +55 -55
- package/build/commands/sync.js +107 -107
- package/build/commands/tasks/createrepo.d.ts +22 -22
- package/build/commands/tasks/createrepo.js +70 -70
- package/build/commands/tasks/delete.d.ts +10 -10
- package/build/commands/tasks/delete.js +29 -29
- package/build/commands/tasks/list.d.ts +8 -8
- package/build/commands/tasks/list.js +27 -27
- package/build/commands/tasks/sync.d.ts +56 -56
- package/build/commands/tasks/sync.js +122 -122
- package/build/commands/tasks/taskConfig.d.ts +24 -24
- package/build/commands/tasks/taskConfig.js +169 -169
- package/build/commands/tasks/util.d.ts +1 -1
- package/build/commands/tasks/util.js +27 -27
- package/build/commands/tasks.d.ts +5 -5
- package/build/commands/tasks.js +10 -10
- package/build/commands/templates/delete.d.ts +19 -19
- package/build/commands/templates/delete.js +48 -48
- package/build/commands/templates/get.d.ts +19 -19
- package/build/commands/templates/get.js +37 -37
- package/build/commands/templates/list.d.ts +9 -9
- package/build/commands/templates/list.js +25 -25
- package/build/commands/templates/sync.d.ts +22 -22
- package/build/commands/templates/sync.js +65 -65
- package/build/commands/templates/util/buildTemplates.d.ts +2 -2
- package/build/commands/templates/util/buildTemplates.js +50 -50
- package/build/commands/templates/util/readTemplateFiles.d.ts +3 -3
- package/build/commands/templates/util/readTemplateFiles.js +52 -52
- package/build/commands/templates/util/templateService.d.ts +8 -8
- package/build/commands/templates/util/templateService.js +18 -18
- package/build/commands/templates/util/uploadTemplate.d.ts +2 -2
- package/build/commands/templates/util/uploadTemplate.js +20 -20
- package/build/commands/templates/util/utils.d.ts +4 -4
- package/build/commands/templates/util/utils.js +22 -22
- package/build/commands/templates.d.ts +5 -5
- package/build/commands/templates.js +10 -10
- package/build/constants.d.ts +13 -13
- package/build/constants.js +37 -37
- package/build/exh.d.ts +3 -3
- package/build/exh.js +65 -65
- package/build/helpers/error.d.ts +2 -2
- package/build/helpers/error.js +6 -6
- package/build/helpers/repoConfig.d.ts +2 -2
- package/build/helpers/repoConfig.js +60 -60
- package/build/helpers/util.d.ts +3 -3
- package/build/helpers/util.js +36 -36
- package/build/index.d.ts +2 -2
- package/build/index.js +33 -33
- package/build/repositories/dispatchers.d.ts +8 -8
- package/build/repositories/dispatchers.js +31 -31
- package/build/repositories/functions.d.ts +24 -24
- package/build/repositories/functions.js +28 -28
- package/build/repositories/schemas.d.ts +44 -44
- package/build/repositories/schemas.js +86 -86
- package/build/services/dispatchers.d.ts +3 -3
- package/build/services/dispatchers.js +132 -132
- package/package.json +53 -53
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
export declare const command = "verify";
|
|
3
|
-
export declare const desc = "Syntactically verify a local schema";
|
|
4
|
-
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, "file" | "dir"> & import("yargs").InferredOptionTypes<{
|
|
5
|
-
file: {
|
|
6
|
-
describe: string;
|
|
7
|
-
type: "string";
|
|
8
|
-
};
|
|
9
|
-
dir: {
|
|
10
|
-
describe: string;
|
|
11
|
-
type: "string";
|
|
12
|
-
};
|
|
13
|
-
}>>;
|
|
14
|
-
export declare const handler: ({ file, dir, ignoreVerificationErrors }: {
|
|
15
|
-
file: any;
|
|
16
|
-
dir: any;
|
|
17
|
-
ignoreVerificationErrors: any;
|
|
18
|
-
}) => Promise<void>;
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
export declare const command = "verify";
|
|
3
|
+
export declare const desc = "Syntactically verify a local schema";
|
|
4
|
+
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, "file" | "dir"> & import("yargs").InferredOptionTypes<{
|
|
5
|
+
file: {
|
|
6
|
+
describe: string;
|
|
7
|
+
type: "string";
|
|
8
|
+
};
|
|
9
|
+
dir: {
|
|
10
|
+
describe: string;
|
|
11
|
+
type: "string";
|
|
12
|
+
};
|
|
13
|
+
}>>;
|
|
14
|
+
export declare const handler: ({ file, dir, ignoreVerificationErrors }: {
|
|
15
|
+
file: any;
|
|
16
|
+
dir: any;
|
|
17
|
+
ignoreVerificationErrors: any;
|
|
18
|
+
}) => Promise<void>;
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const ajv_1 = require("ajv");
|
|
7
|
-
const chalk = require("chalk");
|
|
8
|
-
const error_1 = require("../../../helpers/error");
|
|
9
|
-
const util_1 = require("../../../helpers/util");
|
|
10
|
-
const listFilesInDir_1 = require("./util/listFilesInDir");
|
|
11
|
-
const metaschema = require("./util/metaschema.json");
|
|
12
|
-
const schemaverify_1 = require("./util/schemaverify");
|
|
13
|
-
exports.command = 'verify';
|
|
14
|
-
exports.desc = 'Syntactically verify a local schema';
|
|
15
|
-
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({
|
|
16
|
-
file: {
|
|
17
|
-
describe: 'schema json file which needs to be verified',
|
|
18
|
-
type: 'string',
|
|
19
|
-
},
|
|
20
|
-
dir: {
|
|
21
|
-
describe: 'directory containing schemas to be verified',
|
|
22
|
-
type: 'string',
|
|
23
|
-
},
|
|
24
|
-
}).check(({ file, dir }) => {
|
|
25
|
-
if (file && (!fs.existsSync(path.resolve(file)) || !fs.lstatSync(path.resolve(file)).isFile())) {
|
|
26
|
-
throw new Error('Schema file does not exist, please make sure you provided the correct file path');
|
|
27
|
-
}
|
|
28
|
-
if (dir === undefined && file === undefined) {
|
|
29
|
-
throw new Error('Must either specify --file or --dir');
|
|
30
|
-
}
|
|
31
|
-
else if (dir !== undefined && file !== undefined) {
|
|
32
|
-
throw new Error('Cannot specify both --file and --dir');
|
|
33
|
-
}
|
|
34
|
-
return true;
|
|
35
|
-
});
|
|
36
|
-
exports.builder = builder;
|
|
37
|
-
const handler = async ({ file, dir, ignoreVerificationErrors }) => {
|
|
38
|
-
let files = [];
|
|
39
|
-
if (dir) {
|
|
40
|
-
files = await (0, listFilesInDir_1.flatListFiles)(dir, '.json');
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
files = [file];
|
|
44
|
-
}
|
|
45
|
-
const checkFile = (schemaPath) => {
|
|
46
|
-
let schema = {};
|
|
47
|
-
console.log(chalk.bold('Checking', schemaPath));
|
|
48
|
-
try {
|
|
49
|
-
schema = require(path.resolve(schemaPath));
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
console.log(chalk.red(`Failed to load schema file ${file}. Possibly not a valid JSON file`));
|
|
53
|
-
console.log(err);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const ajv = new ajv_1.default();
|
|
57
|
-
for (const result of (new schemaverify_1.SchemaVerify(ajv, schema, metaschema)).RunChecks()) {
|
|
58
|
-
if (result.ok) {
|
|
59
|
-
console.log(chalk.green(`${result.test}... ✓`));
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
console.log(chalk.red(`${result.test}... x`));
|
|
63
|
-
for (const error of result.errors) {
|
|
64
|
-
if (typeof error === 'object') {
|
|
65
|
-
console.log('\t', chalk.red(JSON.stringify(error, null, 4)));
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
console.log('\t', chalk.red(error));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (!ignoreVerificationErrors) {
|
|
72
|
-
throw new error_1.CommandError(`Schema ${schemaPath} contains error, please fix`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
console.log();
|
|
77
|
-
};
|
|
78
|
-
for (const f of files) {
|
|
79
|
-
checkFile(f);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
exports.handler = handler;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const ajv_1 = require("ajv");
|
|
7
|
+
const chalk = require("chalk");
|
|
8
|
+
const error_1 = require("../../../helpers/error");
|
|
9
|
+
const util_1 = require("../../../helpers/util");
|
|
10
|
+
const listFilesInDir_1 = require("./util/listFilesInDir");
|
|
11
|
+
const metaschema = require("./util/metaschema.json");
|
|
12
|
+
const schemaverify_1 = require("./util/schemaverify");
|
|
13
|
+
exports.command = 'verify';
|
|
14
|
+
exports.desc = 'Syntactically verify a local schema';
|
|
15
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({
|
|
16
|
+
file: {
|
|
17
|
+
describe: 'schema json file which needs to be verified',
|
|
18
|
+
type: 'string',
|
|
19
|
+
},
|
|
20
|
+
dir: {
|
|
21
|
+
describe: 'directory containing schemas to be verified',
|
|
22
|
+
type: 'string',
|
|
23
|
+
},
|
|
24
|
+
}).check(({ file, dir }) => {
|
|
25
|
+
if (file && (!fs.existsSync(path.resolve(file)) || !fs.lstatSync(path.resolve(file)).isFile())) {
|
|
26
|
+
throw new Error('Schema file does not exist, please make sure you provided the correct file path');
|
|
27
|
+
}
|
|
28
|
+
if (dir === undefined && file === undefined) {
|
|
29
|
+
throw new Error('Must either specify --file or --dir');
|
|
30
|
+
}
|
|
31
|
+
else if (dir !== undefined && file !== undefined) {
|
|
32
|
+
throw new Error('Cannot specify both --file and --dir');
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
});
|
|
36
|
+
exports.builder = builder;
|
|
37
|
+
const handler = async ({ file, dir, ignoreVerificationErrors }) => {
|
|
38
|
+
let files = [];
|
|
39
|
+
if (dir) {
|
|
40
|
+
files = await (0, listFilesInDir_1.flatListFiles)(dir, '.json');
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
files = [file];
|
|
44
|
+
}
|
|
45
|
+
const checkFile = (schemaPath) => {
|
|
46
|
+
let schema = {};
|
|
47
|
+
console.log(chalk.bold('Checking', schemaPath));
|
|
48
|
+
try {
|
|
49
|
+
schema = require(path.resolve(schemaPath));
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
console.log(chalk.red(`Failed to load schema file ${file}. Possibly not a valid JSON file`));
|
|
53
|
+
console.log(err);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const ajv = new ajv_1.default();
|
|
57
|
+
for (const result of (new schemaverify_1.SchemaVerify(ajv, schema, metaschema)).RunChecks()) {
|
|
58
|
+
if (result.ok) {
|
|
59
|
+
console.log(chalk.green(`${result.test}... ✓`));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
console.log(chalk.red(`${result.test}... x`));
|
|
63
|
+
for (const error of result.errors) {
|
|
64
|
+
if (typeof error === 'object') {
|
|
65
|
+
console.log('\t', chalk.red(JSON.stringify(error, null, 4)));
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
console.log('\t', chalk.red(error));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (!ignoreVerificationErrors) {
|
|
72
|
+
throw new error_1.CommandError(`Schema ${schemaPath} contains error, please fix`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
console.log();
|
|
77
|
+
};
|
|
78
|
+
for (const f of files) {
|
|
79
|
+
checkFile(f);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.handler = handler;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
export declare const command = "schemas <command>";
|
|
3
|
-
export declare const desc = "Manage data schemas";
|
|
4
|
-
export declare const builder: (yargs: any) => import("yargs").Argv<{}>;
|
|
5
|
-
export declare const handler: () => void;
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
export declare const command = "schemas <command>";
|
|
3
|
+
export declare const desc = "Manage data schemas";
|
|
4
|
+
export declare const builder: (yargs: any) => import("yargs").Argv<{}>;
|
|
5
|
+
export declare const handler: () => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
-
const util_1 = require("../../helpers/util");
|
|
5
|
-
exports.command = 'schemas <command>';
|
|
6
|
-
exports.desc = 'Manage data schemas';
|
|
7
|
-
const builder = (yargs) => (0, util_1.epilogue)(yargs).commandDir('schemas');
|
|
8
|
-
exports.builder = builder;
|
|
9
|
-
const handler = () => { };
|
|
10
|
-
exports.handler = handler;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const util_1 = require("../../helpers/util");
|
|
5
|
+
exports.command = 'schemas <command>';
|
|
6
|
+
exports.desc = 'Manage data schemas';
|
|
7
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).commandDir('schemas');
|
|
8
|
+
exports.builder = builder;
|
|
9
|
+
const handler = () => { };
|
|
10
|
+
exports.handler = handler;
|
package/build/commands/data.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
export declare const command = "data <command>";
|
|
3
|
-
export declare const desc = "Manage data";
|
|
4
|
-
export declare const builder: (yargs: any) => import("yargs").Argv<{}>;
|
|
5
|
-
export declare const handler: () => void;
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
export declare const command = "data <command>";
|
|
3
|
+
export declare const desc = "Manage data";
|
|
4
|
+
export declare const builder: (yargs: any) => import("yargs").Argv<{}>;
|
|
5
|
+
export declare const handler: () => void;
|
package/build/commands/data.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
-
const util_1 = require("../helpers/util");
|
|
5
|
-
exports.command = 'data <command>';
|
|
6
|
-
exports.desc = 'Manage data';
|
|
7
|
-
const builder = (yargs) => (0, util_1.epilogue)(yargs).commandDir('data');
|
|
8
|
-
exports.builder = builder;
|
|
9
|
-
const handler = () => { };
|
|
10
|
-
exports.handler = handler;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const util_1 = require("../helpers/util");
|
|
5
|
+
exports.command = 'data <command>';
|
|
6
|
+
exports.desc = 'Manage data';
|
|
7
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).commandDir('data');
|
|
8
|
+
exports.builder = builder;
|
|
9
|
+
const handler = () => { };
|
|
10
|
+
exports.handler = handler;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { OAuth1Client } from '@extrahorizon/javascript-sdk';
|
|
2
|
-
import { Argv } from 'yargs';
|
|
3
|
-
export declare const command = "sync";
|
|
4
|
-
export declare const desc = "Synchronize Dispatchers, if a declared Dispatcher does not exist, it will be created";
|
|
5
|
-
export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, "file" | "clean"> & import("yargs").InferredOptionTypes<{
|
|
6
|
-
file: {
|
|
7
|
-
demandOption: true;
|
|
8
|
-
describe: string;
|
|
9
|
-
type: "string";
|
|
10
|
-
};
|
|
11
|
-
clean: {
|
|
12
|
-
demandOption: false;
|
|
13
|
-
describe: string;
|
|
14
|
-
type: "boolean";
|
|
15
|
-
};
|
|
16
|
-
}>>;
|
|
17
|
-
export declare const handler: ({ sdk, file, clean }: {
|
|
18
|
-
sdk: OAuth1Client;
|
|
19
|
-
file: string;
|
|
20
|
-
clean: boolean;
|
|
21
|
-
}) => Promise<void>;
|
|
1
|
+
import { OAuth1Client } from '@extrahorizon/javascript-sdk';
|
|
2
|
+
import { Argv } from 'yargs';
|
|
3
|
+
export declare const command = "sync";
|
|
4
|
+
export declare const desc = "Synchronize Dispatchers, if a declared Dispatcher does not exist, it will be created";
|
|
5
|
+
export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, "file" | "clean"> & import("yargs").InferredOptionTypes<{
|
|
6
|
+
file: {
|
|
7
|
+
demandOption: true;
|
|
8
|
+
describe: string;
|
|
9
|
+
type: "string";
|
|
10
|
+
};
|
|
11
|
+
clean: {
|
|
12
|
+
demandOption: false;
|
|
13
|
+
describe: string;
|
|
14
|
+
type: "boolean";
|
|
15
|
+
};
|
|
16
|
+
}>>;
|
|
17
|
+
export declare const handler: ({ sdk, file, clean }: {
|
|
18
|
+
sdk: OAuth1Client;
|
|
19
|
+
file: string;
|
|
20
|
+
clean: boolean;
|
|
21
|
+
}) => Promise<void>;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
-
const util_1 = require("../../helpers/util");
|
|
5
|
-
const dispatchersService = require("../../services/dispatchers");
|
|
6
|
-
exports.command = 'sync';
|
|
7
|
-
exports.desc = 'Synchronize Dispatchers, if a declared Dispatcher does not exist, it will be created';
|
|
8
|
-
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({
|
|
9
|
-
file: {
|
|
10
|
-
demandOption: true,
|
|
11
|
-
describe: 'Path to the file containing the Dispatcher(s) configuration',
|
|
12
|
-
type: 'string',
|
|
13
|
-
},
|
|
14
|
-
clean: {
|
|
15
|
-
demandOption: false,
|
|
16
|
-
describe: 'Delete Dispatchers created using the CLI, that are no longer present in the local Dispatcher file',
|
|
17
|
-
type: 'boolean',
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
exports.builder = builder;
|
|
21
|
-
const handler = async ({ sdk, file, clean }) => {
|
|
22
|
-
await dispatchersService.sync(sdk, file, clean);
|
|
23
|
-
};
|
|
24
|
-
exports.handler = handler;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const util_1 = require("../../helpers/util");
|
|
5
|
+
const dispatchersService = require("../../services/dispatchers");
|
|
6
|
+
exports.command = 'sync';
|
|
7
|
+
exports.desc = 'Synchronize Dispatchers, if a declared Dispatcher does not exist, it will be created';
|
|
8
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({
|
|
9
|
+
file: {
|
|
10
|
+
demandOption: true,
|
|
11
|
+
describe: 'Path to the file containing the Dispatcher(s) configuration',
|
|
12
|
+
type: 'string',
|
|
13
|
+
},
|
|
14
|
+
clean: {
|
|
15
|
+
demandOption: false,
|
|
16
|
+
describe: 'Delete Dispatchers created using the CLI, that are no longer present in the local Dispatcher file',
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
exports.builder = builder;
|
|
21
|
+
const handler = async ({ sdk, file, clean }) => {
|
|
22
|
+
await dispatchersService.sync(sdk, file, clean);
|
|
23
|
+
};
|
|
24
|
+
exports.handler = handler;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Argv } from 'yargs';
|
|
2
|
-
export declare const command = "dispatchers <command>";
|
|
3
|
-
export declare const desc = "Manage Dispatchers within Extra Horizon";
|
|
4
|
-
export declare const builder: (yargs: Argv) => Argv<{}>;
|
|
5
|
-
export declare const handler: () => void;
|
|
1
|
+
import { Argv } from 'yargs';
|
|
2
|
+
export declare const command = "dispatchers <command>";
|
|
3
|
+
export declare const desc = "Manage Dispatchers within Extra Horizon";
|
|
4
|
+
export declare const builder: (yargs: Argv) => Argv<{}>;
|
|
5
|
+
export declare const handler: () => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
-
const util_1 = require("../helpers/util");
|
|
5
|
-
exports.command = 'dispatchers <command>';
|
|
6
|
-
exports.desc = 'Manage Dispatchers within Extra Horizon';
|
|
7
|
-
const builder = (yargs) => (0, util_1.epilogue)(yargs).commandDir('dispatchers');
|
|
8
|
-
exports.builder = builder;
|
|
9
|
-
const handler = () => { };
|
|
10
|
-
exports.handler = handler;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const util_1 = require("../helpers/util");
|
|
5
|
+
exports.command = 'dispatchers <command>';
|
|
6
|
+
exports.desc = 'Manage Dispatchers within Extra Horizon';
|
|
7
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).commandDir('dispatchers');
|
|
8
|
+
exports.builder = builder;
|
|
9
|
+
const handler = () => { };
|
|
10
|
+
exports.handler = handler;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
export declare const command = "login";
|
|
3
|
-
export declare const desc = "Retrieve credentials from ExH";
|
|
4
|
-
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, "password" | "host" | "email" | "consumerKey" | "consumerSecret"> & import("yargs").InferredOptionTypes<{
|
|
5
|
-
host: {
|
|
6
|
-
demandOption: true;
|
|
7
|
-
type: "string";
|
|
8
|
-
describe: string;
|
|
9
|
-
};
|
|
10
|
-
email: {
|
|
11
|
-
demandOption: true;
|
|
12
|
-
type: "string";
|
|
13
|
-
describe: string;
|
|
14
|
-
};
|
|
15
|
-
password: {
|
|
16
|
-
demandOption: true;
|
|
17
|
-
type: "string";
|
|
18
|
-
describe: string;
|
|
19
|
-
};
|
|
20
|
-
consumerKey: {
|
|
21
|
-
demandOption: true;
|
|
22
|
-
type: "string";
|
|
23
|
-
describe: string;
|
|
24
|
-
};
|
|
25
|
-
consumerSecret: {
|
|
26
|
-
demandOption: true;
|
|
27
|
-
type: "string";
|
|
28
|
-
describe: string;
|
|
29
|
-
};
|
|
30
|
-
}>>;
|
|
31
|
-
export declare const handler: ({ host, email, password, consumerKey, consumerSecret }: {
|
|
32
|
-
host: string;
|
|
33
|
-
email: string;
|
|
34
|
-
password: string;
|
|
35
|
-
consumerKey: string;
|
|
36
|
-
consumerSecret: string;
|
|
37
|
-
}) => Promise<void>;
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
export declare const command = "login";
|
|
3
|
+
export declare const desc = "Retrieve credentials from ExH";
|
|
4
|
+
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, "password" | "host" | "email" | "consumerKey" | "consumerSecret"> & import("yargs").InferredOptionTypes<{
|
|
5
|
+
host: {
|
|
6
|
+
demandOption: true;
|
|
7
|
+
type: "string";
|
|
8
|
+
describe: string;
|
|
9
|
+
};
|
|
10
|
+
email: {
|
|
11
|
+
demandOption: true;
|
|
12
|
+
type: "string";
|
|
13
|
+
describe: string;
|
|
14
|
+
};
|
|
15
|
+
password: {
|
|
16
|
+
demandOption: true;
|
|
17
|
+
type: "string";
|
|
18
|
+
describe: string;
|
|
19
|
+
};
|
|
20
|
+
consumerKey: {
|
|
21
|
+
demandOption: true;
|
|
22
|
+
type: "string";
|
|
23
|
+
describe: string;
|
|
24
|
+
};
|
|
25
|
+
consumerSecret: {
|
|
26
|
+
demandOption: true;
|
|
27
|
+
type: "string";
|
|
28
|
+
describe: string;
|
|
29
|
+
};
|
|
30
|
+
}>>;
|
|
31
|
+
export declare const handler: ({ host, email, password, consumerKey, consumerSecret }: {
|
|
32
|
+
host: string;
|
|
33
|
+
email: string;
|
|
34
|
+
password: string;
|
|
35
|
+
consumerKey: string;
|
|
36
|
+
consumerSecret: string;
|
|
37
|
+
}) => Promise<void>;
|
package/build/commands/login.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
-
const fs = require("fs/promises");
|
|
5
|
-
const chalk = require("chalk");
|
|
6
|
-
const constants_1 = require("../constants");
|
|
7
|
-
const exh_1 = require("../exh");
|
|
8
|
-
const util_1 = require("../helpers/util");
|
|
9
|
-
exports.command = 'login';
|
|
10
|
-
exports.desc = 'Retrieve credentials from ExH';
|
|
11
|
-
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({
|
|
12
|
-
host: {
|
|
13
|
-
demandOption: true,
|
|
14
|
-
type: 'string',
|
|
15
|
-
describe: 'the address of your ExH cloud instance (eg. https://api.dev.my-instance.extrahorizon.io)',
|
|
16
|
-
},
|
|
17
|
-
email: {
|
|
18
|
-
demandOption: true,
|
|
19
|
-
type: 'string',
|
|
20
|
-
describe: 'email address of your ExH account',
|
|
21
|
-
},
|
|
22
|
-
password: {
|
|
23
|
-
demandOption: true,
|
|
24
|
-
type: 'string',
|
|
25
|
-
describe: 'password of your ExH account',
|
|
26
|
-
},
|
|
27
|
-
consumerKey: {
|
|
28
|
-
demandOption: true,
|
|
29
|
-
type: 'string',
|
|
30
|
-
describe: 'Consumer key',
|
|
31
|
-
},
|
|
32
|
-
consumerSecret: {
|
|
33
|
-
demandOption: true,
|
|
34
|
-
type: 'string',
|
|
35
|
-
describe: 'Consumer secret',
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
exports.builder = builder;
|
|
39
|
-
const handler = async ({ host, email, password, consumerKey, consumerSecret }) => {
|
|
40
|
-
const sdk = (0, exh_1.sdkInitOnly)(host, consumerKey, consumerSecret);
|
|
41
|
-
const response = await sdk.auth.authenticate({
|
|
42
|
-
email,
|
|
43
|
-
password,
|
|
44
|
-
});
|
|
45
|
-
try {
|
|
46
|
-
await fs.stat(constants_1.EXH_CONFIG_FILE_DIR);
|
|
47
|
-
}
|
|
48
|
-
catch (err) {
|
|
49
|
-
await fs.mkdir(constants_1.EXH_CONFIG_FILE_DIR);
|
|
50
|
-
}
|
|
51
|
-
await fs.writeFile(constants_1.EXH_CONFIG_FILE, `API_HOST=${host}
|
|
52
|
-
API_OAUTH_CONSUMER_KEY=${consumerKey}
|
|
53
|
-
API_OAUTH_CONSUMER_SECRET=${consumerSecret}
|
|
54
|
-
API_OAUTH_TOKEN=${response.token}
|
|
55
|
-
API_OAUTH_TOKEN_SECRET=${response.tokenSecret}
|
|
56
|
-
`);
|
|
57
|
-
console.log(chalk.green('Wrote credentials to', constants_1.EXH_CONFIG_FILE));
|
|
58
|
-
};
|
|
59
|
-
exports.handler = handler;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const fs = require("fs/promises");
|
|
5
|
+
const chalk = require("chalk");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
7
|
+
const exh_1 = require("../exh");
|
|
8
|
+
const util_1 = require("../helpers/util");
|
|
9
|
+
exports.command = 'login';
|
|
10
|
+
exports.desc = 'Retrieve credentials from ExH';
|
|
11
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({
|
|
12
|
+
host: {
|
|
13
|
+
demandOption: true,
|
|
14
|
+
type: 'string',
|
|
15
|
+
describe: 'the address of your ExH cloud instance (eg. https://api.dev.my-instance.extrahorizon.io)',
|
|
16
|
+
},
|
|
17
|
+
email: {
|
|
18
|
+
demandOption: true,
|
|
19
|
+
type: 'string',
|
|
20
|
+
describe: 'email address of your ExH account',
|
|
21
|
+
},
|
|
22
|
+
password: {
|
|
23
|
+
demandOption: true,
|
|
24
|
+
type: 'string',
|
|
25
|
+
describe: 'password of your ExH account',
|
|
26
|
+
},
|
|
27
|
+
consumerKey: {
|
|
28
|
+
demandOption: true,
|
|
29
|
+
type: 'string',
|
|
30
|
+
describe: 'Consumer key',
|
|
31
|
+
},
|
|
32
|
+
consumerSecret: {
|
|
33
|
+
demandOption: true,
|
|
34
|
+
type: 'string',
|
|
35
|
+
describe: 'Consumer secret',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
exports.builder = builder;
|
|
39
|
+
const handler = async ({ host, email, password, consumerKey, consumerSecret }) => {
|
|
40
|
+
const sdk = (0, exh_1.sdkInitOnly)(host, consumerKey, consumerSecret);
|
|
41
|
+
const response = await sdk.auth.authenticate({
|
|
42
|
+
email,
|
|
43
|
+
password,
|
|
44
|
+
});
|
|
45
|
+
try {
|
|
46
|
+
await fs.stat(constants_1.EXH_CONFIG_FILE_DIR);
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
await fs.mkdir(constants_1.EXH_CONFIG_FILE_DIR);
|
|
50
|
+
}
|
|
51
|
+
await fs.writeFile(constants_1.EXH_CONFIG_FILE, `API_HOST=${host}
|
|
52
|
+
API_OAUTH_CONSUMER_KEY=${consumerKey}
|
|
53
|
+
API_OAUTH_CONSUMER_SECRET=${consumerSecret}
|
|
54
|
+
API_OAUTH_TOKEN=${response.token}
|
|
55
|
+
API_OAUTH_TOKEN_SECRET=${response.tokenSecret}
|
|
56
|
+
`);
|
|
57
|
+
console.log(chalk.green('Wrote credentials to', constants_1.EXH_CONFIG_FILE));
|
|
58
|
+
};
|
|
59
|
+
exports.handler = handler;
|