@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,72 +1,72 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.syncTargetDir = exports.syncTargetFile = exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const chalk = require("chalk");
|
|
6
|
-
const util_1 = require("../../../helpers/util");
|
|
7
|
-
const listFilesInDir_1 = require("./util/listFilesInDir");
|
|
8
|
-
const readJson_1 = require("./util/readJson");
|
|
9
|
-
const syncSchema_1 = require("./util/syncSchema");
|
|
10
|
-
const verify_1 = require("./verify");
|
|
11
|
-
exports.command = 'sync';
|
|
12
|
-
exports.desc = 'Sync all schemas in a directory with the ExH cloud';
|
|
13
|
-
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({
|
|
14
|
-
dir: {
|
|
15
|
-
demandOption: false,
|
|
16
|
-
describe: 'Directory containing the schemas which need to be synced',
|
|
17
|
-
type: 'string',
|
|
18
|
-
},
|
|
19
|
-
file: {
|
|
20
|
-
demandOption: false,
|
|
21
|
-
describe: 'File containing a schema which needs to be synced',
|
|
22
|
-
type: 'string',
|
|
23
|
-
},
|
|
24
|
-
dry: {
|
|
25
|
-
demandOption: false,
|
|
26
|
-
describe: 'When set, a dry-run will be performed. Only output will be printed, but no changes will be pushed to the back-end.',
|
|
27
|
-
type: 'boolean',
|
|
28
|
-
},
|
|
29
|
-
ignoreVerificationErrors: {
|
|
30
|
-
demandOption: false,
|
|
31
|
-
describe: 'Allow synchronization to proceed with validation errors.',
|
|
32
|
-
type: 'boolean',
|
|
33
|
-
default: false,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
exports.builder = builder;
|
|
37
|
-
const handler = async ({ sdk, dir, file, dry, ignoreVerificationErrors }) => {
|
|
38
|
-
if (!file && !dir) {
|
|
39
|
-
console.log(chalk.red('No target is chosen to be synced. Please use flags "--file" or "--dir" when syncing'));
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
if (dir) {
|
|
43
|
-
await syncTargetDir(sdk, path.resolve(dir || '.'), dry, ignoreVerificationErrors);
|
|
44
|
-
}
|
|
45
|
-
if (file) {
|
|
46
|
-
await syncTargetFile(sdk, path.resolve(file), dry, ignoreVerificationErrors);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
exports.handler = handler;
|
|
50
|
-
async function syncTargetFile(sdk, targetFile, dry, ignoreVerificationErrors) {
|
|
51
|
-
await (0, verify_1.handler)({ dir: null, file: targetFile, ignoreVerificationErrors });
|
|
52
|
-
const filePath = path.resolve(targetFile);
|
|
53
|
-
if (!filePath.endsWith('.json')) {
|
|
54
|
-
console.log(`Ignored ${path.basename(filePath)}, not a JSON file (needs .json extension)`);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
console.log(chalk.bold(`Synchronizing ${path.basename(filePath)}`));
|
|
58
|
-
const targetSchema = await (0, readJson_1.readJsonFile)(filePath);
|
|
59
|
-
const syncSchema = syncSchema_1.SyncSchema.createSchemaSync(sdk, dry);
|
|
60
|
-
await syncSchema.sync(targetSchema);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.syncTargetFile = syncTargetFile;
|
|
64
|
-
async function syncTargetDir(sdk, targetDir, dry, ignoreVerificationErrors) {
|
|
65
|
-
await (0, verify_1.handler)({ dir: targetDir, file: null, ignoreVerificationErrors });
|
|
66
|
-
const targetFiles = (0, listFilesInDir_1.flatListFiles)(targetDir, '.json');
|
|
67
|
-
for (const filePath of targetFiles) {
|
|
68
|
-
await syncTargetFile(sdk, filePath, dry, ignoreVerificationErrors);
|
|
69
|
-
process.stdout.write('\n');
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.syncTargetDir = syncTargetDir;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.syncTargetDir = exports.syncTargetFile = exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const chalk = require("chalk");
|
|
6
|
+
const util_1 = require("../../../helpers/util");
|
|
7
|
+
const listFilesInDir_1 = require("./util/listFilesInDir");
|
|
8
|
+
const readJson_1 = require("./util/readJson");
|
|
9
|
+
const syncSchema_1 = require("./util/syncSchema");
|
|
10
|
+
const verify_1 = require("./verify");
|
|
11
|
+
exports.command = 'sync';
|
|
12
|
+
exports.desc = 'Sync all schemas in a directory with the ExH cloud';
|
|
13
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({
|
|
14
|
+
dir: {
|
|
15
|
+
demandOption: false,
|
|
16
|
+
describe: 'Directory containing the schemas which need to be synced',
|
|
17
|
+
type: 'string',
|
|
18
|
+
},
|
|
19
|
+
file: {
|
|
20
|
+
demandOption: false,
|
|
21
|
+
describe: 'File containing a schema which needs to be synced',
|
|
22
|
+
type: 'string',
|
|
23
|
+
},
|
|
24
|
+
dry: {
|
|
25
|
+
demandOption: false,
|
|
26
|
+
describe: 'When set, a dry-run will be performed. Only output will be printed, but no changes will be pushed to the back-end.',
|
|
27
|
+
type: 'boolean',
|
|
28
|
+
},
|
|
29
|
+
ignoreVerificationErrors: {
|
|
30
|
+
demandOption: false,
|
|
31
|
+
describe: 'Allow synchronization to proceed with validation errors.',
|
|
32
|
+
type: 'boolean',
|
|
33
|
+
default: false,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
exports.builder = builder;
|
|
37
|
+
const handler = async ({ sdk, dir, file, dry, ignoreVerificationErrors }) => {
|
|
38
|
+
if (!file && !dir) {
|
|
39
|
+
console.log(chalk.red('No target is chosen to be synced. Please use flags "--file" or "--dir" when syncing'));
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
if (dir) {
|
|
43
|
+
await syncTargetDir(sdk, path.resolve(dir || '.'), dry, ignoreVerificationErrors);
|
|
44
|
+
}
|
|
45
|
+
if (file) {
|
|
46
|
+
await syncTargetFile(sdk, path.resolve(file), dry, ignoreVerificationErrors);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.handler = handler;
|
|
50
|
+
async function syncTargetFile(sdk, targetFile, dry, ignoreVerificationErrors) {
|
|
51
|
+
await (0, verify_1.handler)({ dir: null, file: targetFile, ignoreVerificationErrors });
|
|
52
|
+
const filePath = path.resolve(targetFile);
|
|
53
|
+
if (!filePath.endsWith('.json')) {
|
|
54
|
+
console.log(`Ignored ${path.basename(filePath)}, not a JSON file (needs .json extension)`);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
console.log(chalk.bold(`Synchronizing ${path.basename(filePath)}`));
|
|
58
|
+
const targetSchema = await (0, readJson_1.readJsonFile)(filePath);
|
|
59
|
+
const syncSchema = syncSchema_1.SyncSchema.createSchemaSync(sdk, dry);
|
|
60
|
+
await syncSchema.sync(targetSchema);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.syncTargetFile = syncTargetFile;
|
|
64
|
+
async function syncTargetDir(sdk, targetDir, dry, ignoreVerificationErrors) {
|
|
65
|
+
await (0, verify_1.handler)({ dir: targetDir, file: null, ignoreVerificationErrors });
|
|
66
|
+
const targetFiles = (0, listFilesInDir_1.flatListFiles)(targetDir, '.json');
|
|
67
|
+
for (const filePath of targetFiles) {
|
|
68
|
+
await syncTargetFile(sdk, filePath, dry, ignoreVerificationErrors);
|
|
69
|
+
process.stdout.write('\n');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.syncTargetDir = syncTargetDir;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function flatListFiles(dirPath: string, extensionFilter?: string): string[];
|
|
1
|
+
export declare function flatListFiles(dirPath: string, extensionFilter?: string): string[];
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flatListFiles = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
function flatListFiles(dirPath, extensionFilter) {
|
|
7
|
-
const files = (0, fs_1.readdirSync)(dirPath);
|
|
8
|
-
return files.flatMap(file => {
|
|
9
|
-
const filePath = path.join(dirPath, file);
|
|
10
|
-
const fileStat = (0, fs_1.statSync)(filePath);
|
|
11
|
-
if (fileStat.isDirectory()) {
|
|
12
|
-
return flatListFiles(filePath, extensionFilter);
|
|
13
|
-
}
|
|
14
|
-
if (fileStat.isFile()) {
|
|
15
|
-
if (!extensionFilter) {
|
|
16
|
-
return filePath;
|
|
17
|
-
}
|
|
18
|
-
if (filePath.endsWith(extensionFilter)) {
|
|
19
|
-
return filePath;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}).filter(file => file);
|
|
24
|
-
}
|
|
25
|
-
exports.flatListFiles = flatListFiles;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flatListFiles = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
function flatListFiles(dirPath, extensionFilter) {
|
|
7
|
+
const files = (0, fs_1.readdirSync)(dirPath);
|
|
8
|
+
return files.flatMap(file => {
|
|
9
|
+
const filePath = path.join(dirPath, file);
|
|
10
|
+
const fileStat = (0, fs_1.statSync)(filePath);
|
|
11
|
+
if (fileStat.isDirectory()) {
|
|
12
|
+
return flatListFiles(filePath, extensionFilter);
|
|
13
|
+
}
|
|
14
|
+
if (fileStat.isFile()) {
|
|
15
|
+
if (!extensionFilter) {
|
|
16
|
+
return filePath;
|
|
17
|
+
}
|
|
18
|
+
if (filePath.endsWith(extensionFilter)) {
|
|
19
|
+
return filePath;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}).filter(file => file);
|
|
24
|
+
}
|
|
25
|
+
exports.flatListFiles = flatListFiles;
|