@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
package/CHANGELOG.md
CHANGED
|
@@ -1,53 +1,56 @@
|
|
|
1
|
-
# Extra Horizon CLI changelog
|
|
2
|
-
|
|
3
|
-
### v1.5.
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* Added
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* Added
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* Added
|
|
32
|
-
* Added
|
|
33
|
-
* Added
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
### v1.0.
|
|
39
|
-
*
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
### v1.0.
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
### v1.0.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
*
|
|
1
|
+
# Extra Horizon CLI changelog
|
|
2
|
+
|
|
3
|
+
### v1.5.1
|
|
4
|
+
* Now also publishing to the NPM registry, no longer needing to authenticate with GitHub Packages to install the CLI
|
|
5
|
+
|
|
6
|
+
### v1.5.0
|
|
7
|
+
* Updated the supported runtimes for task functions
|
|
8
|
+
* `exh data schemas verify` and `exh tasks create-repo` no longer require you to be authenticated
|
|
9
|
+
* `@extra-horizon/javascript-sdk` has been updated to `8.2.0`
|
|
10
|
+
* Unused dependencies have been removed
|
|
11
|
+
|
|
12
|
+
### v1.4.0
|
|
13
|
+
* Added a validation check for `id` properties in objects within arrays in data schemas, this will now be reported as an error if present.
|
|
14
|
+
* Added validation for duplicate transition names in data schemas, this will now be reported as an error if present.
|
|
15
|
+
* Changed the strictness of validation for properties of input conditions. Modifiers such as `enum`, `minLength`, `maxLength`, etc... will no longer produce an error if not present in the condition property.
|
|
16
|
+
|
|
17
|
+
### v1.3.0
|
|
18
|
+
* Added a command to synchronize Dispatchers `exh dispatchers sync --file=<path>` the file argument must point to a JSON file containing an array of Dispatchers to be synchronized.
|
|
19
|
+
* Added Dispatchers to the general `exh sync` command, this will synchronize all Dispatchers within a file named `dispatchers.json` in the working directory or within the provided `path` argument directory.
|
|
20
|
+
* Added an argument `exh sync --dispatchers` to synchronize only Dispatchers.
|
|
21
|
+
* Added arguments to clean up Extra Horizon Dispatchers during synchronization `exh dispatchers sync --clean` and `exh sync --cleanDispatchers`. These arguments will remove all Dispatchers created by the CLI that are no longer present in the local Dispatchers file.
|
|
22
|
+
|
|
23
|
+
### v1.2.0
|
|
24
|
+
* Added a sync argument `exh sync ... --ignoreSchemaVerificationErrors` to bypass schema verification errors, this allows schemas to be synced even if errors are reported
|
|
25
|
+
* Added a schema sync argument `exh data schemas sync ... --ignoreVerificationErrors` to bypass schema verification errors, this allows schemas to be synced even if errors are reported
|
|
26
|
+
* Fixed an issue synchronizing statuses with an existing schema, excess properties should now be correctly removed from statuses
|
|
27
|
+
* Updated the supported runtimes for tasks
|
|
28
|
+
* The `--help` information now correctly displays `exh` rather than `index.js` as the command.
|
|
29
|
+
|
|
30
|
+
### v1.1.0
|
|
31
|
+
* Added single file sync command for schemas with `exh data schemas sync --file=<path>`
|
|
32
|
+
* Added a dry run argument for schema sync `exh data schemas sync --file=<path> --dry`. This will report the properties to be added, removed and updated in the terminal, without persisting schema changes.
|
|
33
|
+
* Added verification and validation for statuses that are defined, but not present in transitions.
|
|
34
|
+
* Added validation to ensure that properties in a creation transition exist in the schema properties.
|
|
35
|
+
* Added verification and validation of transition conditions.
|
|
36
|
+
* Added terminal notifications for if a newer release of the CLI available.
|
|
37
|
+
|
|
38
|
+
### v1.0.4
|
|
39
|
+
* Security update
|
|
40
|
+
|
|
41
|
+
### v1.0.3
|
|
42
|
+
* Fix setting of execution permission
|
|
43
|
+
* Set credentials as environment variables as well, but only if they're not defined yet
|
|
44
|
+
|
|
45
|
+
### v1.0.2
|
|
46
|
+
* Fix JSON schema for transition where `configuration` was marked as mandatory
|
|
47
|
+
|
|
48
|
+
### v1.0.1
|
|
49
|
+
* Fixed broken environment variables
|
|
50
|
+
|
|
51
|
+
### v1.0.0
|
|
52
|
+
|
|
53
|
+
* Add support for setting execution permission when syncing a task. Options are `permissionRequired`, `allUsers` or `public`.
|
|
54
|
+
* Remove implicit settings from task config syncing: some settings, such as `memoryLimit` or `timeLimit`, were given default values when not specified in task config. This can give undesired results, for example overriding custom values in the backend. __This change causes the backend defaults to be used if not specified in the task-config.json. Please verify that this is the desired behaviour__
|
|
55
|
+
* Add support for setting `retryPolicy` in task-config.json.
|
|
56
|
+
* Example task-config.json can be found [here](examples/task-config.example.json).
|
package/README.md
CHANGED
|
@@ -7,18 +7,6 @@ See [changelog](CHANGELOG.md) for the latest changes.
|
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
|
-
### Configuring .npmrc
|
|
11
|
-
Assuming you've created a project (using npm init or equivalent), you need to create a file called .npmrc at the root level of your project and add the following lines:
|
|
12
|
-
```
|
|
13
|
-
@extrahorizon:registry=https://npm.pkg.github.com
|
|
14
|
-
//npm.pkg.github.com/:_authToken=${AUTH_TOKEN}
|
|
15
|
-
```
|
|
16
|
-
Replace ${AUTH_TOKEN} with your personal access token. You can get a new one at https://github.com/settings/tokens/new. Make sure you enable the read:packages scope.
|
|
17
|
-
Explanation from GitHub on how to add your token can be found here: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-to-github-packages
|
|
18
|
-
|
|
19
|
-
You can also add the .npmrc to your home directory. In which case it will apply to all your projects.
|
|
20
|
-
|
|
21
|
-
### Install
|
|
22
10
|
*Note: The exh-cli requires at least node version 14*
|
|
23
11
|
|
|
24
12
|
To install in your project:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
export declare const command = "completion";
|
|
3
|
-
export declare const desc = "Install shell completion for bash & zsh";
|
|
4
|
-
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, never> & import("yargs").InferredOptionTypes<{}>>;
|
|
5
|
-
export declare const handler: () => Promise<void>;
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
export declare const command = "completion";
|
|
3
|
+
export declare const desc = "Install shell completion for bash & zsh";
|
|
4
|
+
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, never> & import("yargs").InferredOptionTypes<{}>>;
|
|
5
|
+
export declare const handler: () => Promise<void>;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
-
const readline = require("readline");
|
|
5
|
-
const util_1 = require("../helpers/util");
|
|
6
|
-
exports.command = 'completion';
|
|
7
|
-
exports.desc = 'Install shell completion for bash & zsh';
|
|
8
|
-
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({});
|
|
9
|
-
exports.builder = builder;
|
|
10
|
-
const handler = async () => {
|
|
11
|
-
const isZsh = (process.env.SHELL?.includes('zsh') || process.env.ZSH_NAME?.includes('zsh')) ?? false;
|
|
12
|
-
try {
|
|
13
|
-
const result = await (0, util_1.asyncExec)(`grep yargs_completions ${isZsh ? '~/.zshrc' : '~/.bashrc'}`);
|
|
14
|
-
if (result.length > 0) {
|
|
15
|
-
console.log('Completion already present ✅');
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
catch (err) { }
|
|
20
|
-
const rl = readline.createInterface({
|
|
21
|
-
input: process.stdin,
|
|
22
|
-
output: process.stdout,
|
|
23
|
-
});
|
|
24
|
-
rl.question('Do you want to add completion to your shell (Y/n)? ', async (yesno) => {
|
|
25
|
-
if (!yesno || yesno.toLowerCase() === 'y') {
|
|
26
|
-
console.log(await (0, util_1.asyncExec)(`exh generate_completion >> ${isZsh ? '~/.zshrc' : '~/.bashrc'}`));
|
|
27
|
-
console.log('Completion added ✅');
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
console.log('Completion not added ❌');
|
|
31
|
-
}
|
|
32
|
-
rl.close();
|
|
33
|
-
});
|
|
34
|
-
rl.on('close', () => {
|
|
35
|
-
process.exit(0);
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
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 readline = require("readline");
|
|
5
|
+
const util_1 = require("../helpers/util");
|
|
6
|
+
exports.command = 'completion';
|
|
7
|
+
exports.desc = 'Install shell completion for bash & zsh';
|
|
8
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({});
|
|
9
|
+
exports.builder = builder;
|
|
10
|
+
const handler = async () => {
|
|
11
|
+
const isZsh = (process.env.SHELL?.includes('zsh') || process.env.ZSH_NAME?.includes('zsh')) ?? false;
|
|
12
|
+
try {
|
|
13
|
+
const result = await (0, util_1.asyncExec)(`grep yargs_completions ${isZsh ? '~/.zshrc' : '~/.bashrc'}`);
|
|
14
|
+
if (result.length > 0) {
|
|
15
|
+
console.log('Completion already present ✅');
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
catch (err) { }
|
|
20
|
+
const rl = readline.createInterface({
|
|
21
|
+
input: process.stdin,
|
|
22
|
+
output: process.stdout,
|
|
23
|
+
});
|
|
24
|
+
rl.question('Do you want to add completion to your shell (Y/n)? ', async (yesno) => {
|
|
25
|
+
if (!yesno || yesno.toLowerCase() === 'y') {
|
|
26
|
+
console.log(await (0, util_1.asyncExec)(`exh generate_completion >> ${isZsh ? '~/.zshrc' : '~/.bashrc'}`));
|
|
27
|
+
console.log('Completion added ✅');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.log('Completion not added ❌');
|
|
31
|
+
}
|
|
32
|
+
rl.close();
|
|
33
|
+
});
|
|
34
|
+
rl.on('close', () => {
|
|
35
|
+
process.exit(0);
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
exports.handler = handler;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
export declare const command = "delete";
|
|
3
|
-
export declare const desc = "Delete a schema";
|
|
4
|
-
export declare const builder: (yargs: any) => import("yargs").Argv<{
|
|
5
|
-
id: string;
|
|
6
|
-
}>;
|
|
7
|
-
export declare const handler: ({ sdk, id }: {
|
|
8
|
-
sdk: any;
|
|
9
|
-
id: any;
|
|
10
|
-
}) => Promise<void>;
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
export declare const command = "delete";
|
|
3
|
+
export declare const desc = "Delete a schema";
|
|
4
|
+
export declare const builder: (yargs: any) => import("yargs").Argv<{
|
|
5
|
+
id: string;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const handler: ({ sdk, id }: {
|
|
8
|
+
sdk: any;
|
|
9
|
+
id: any;
|
|
10
|
+
}) => Promise<void>;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
-
const chalk = require("chalk");
|
|
5
|
-
const util_1 = require("../../../helpers/util");
|
|
6
|
-
const schemaRepository = require("../../../repositories/schemas");
|
|
7
|
-
exports.command = 'delete';
|
|
8
|
-
exports.desc = 'Delete a schema';
|
|
9
|
-
const builder = (yargs) => (0, util_1.epilogue)(yargs).option('id', {
|
|
10
|
-
demandOption: true,
|
|
11
|
-
description: 'The ID of the schema',
|
|
12
|
-
type: 'string',
|
|
13
|
-
});
|
|
14
|
-
exports.builder = builder;
|
|
15
|
-
const handler = async ({ sdk, id }) => {
|
|
16
|
-
const disableResponse = await schemaRepository.disable(sdk, id);
|
|
17
|
-
if (disableResponse.affectedRecords !== 1) {
|
|
18
|
-
console.log(chalk.red('Failed to delete schema', id));
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const deleteResponse = await schemaRepository.remove(sdk, id);
|
|
22
|
-
if (deleteResponse.affectedRecords) {
|
|
23
|
-
console.log(chalk.green('Successfully deleted schema', id));
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
console.log(chalk.red('Failed to delete schema', id));
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
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 chalk = require("chalk");
|
|
5
|
+
const util_1 = require("../../../helpers/util");
|
|
6
|
+
const schemaRepository = require("../../../repositories/schemas");
|
|
7
|
+
exports.command = 'delete';
|
|
8
|
+
exports.desc = 'Delete a schema';
|
|
9
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).option('id', {
|
|
10
|
+
demandOption: true,
|
|
11
|
+
description: 'The ID of the schema',
|
|
12
|
+
type: 'string',
|
|
13
|
+
});
|
|
14
|
+
exports.builder = builder;
|
|
15
|
+
const handler = async ({ sdk, id }) => {
|
|
16
|
+
const disableResponse = await schemaRepository.disable(sdk, id);
|
|
17
|
+
if (disableResponse.affectedRecords !== 1) {
|
|
18
|
+
console.log(chalk.red('Failed to delete schema', id));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const deleteResponse = await schemaRepository.remove(sdk, id);
|
|
22
|
+
if (deleteResponse.affectedRecords) {
|
|
23
|
+
console.log(chalk.green('Successfully deleted schema', id));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
console.log(chalk.red('Failed to delete schema', id));
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.handler = handler;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
export declare const command = "list";
|
|
3
|
-
export declare const desc = "List all schemas";
|
|
4
|
-
export declare const builder: (yargs: any) => import("yargs").Argv<{}>;
|
|
5
|
-
export declare const handler: ({ sdk, isTTY }: {
|
|
6
|
-
sdk: any;
|
|
7
|
-
isTTY: any;
|
|
8
|
-
}) => Promise<void>;
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
export declare const command = "list";
|
|
3
|
+
export declare const desc = "List all schemas";
|
|
4
|
+
export declare const builder: (yargs: any) => import("yargs").Argv<{}>;
|
|
5
|
+
export declare const handler: ({ sdk, isTTY }: {
|
|
6
|
+
sdk: any;
|
|
7
|
+
isTTY: any;
|
|
8
|
+
}) => Promise<void>;
|
|
@@ -1,20 +1,20 @@
|
|
|
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 = 'list';
|
|
6
|
-
exports.desc = 'List all schemas';
|
|
7
|
-
const builder = (yargs) => (0, util_1.epilogue)(yargs);
|
|
8
|
-
exports.builder = builder;
|
|
9
|
-
const handler = async function list({ sdk, isTTY }) {
|
|
10
|
-
const schemaListResponse = await sdk.raw.get('/data/v1/');
|
|
11
|
-
if (schemaListResponse.data.data.length !== 0) {
|
|
12
|
-
if (isTTY) {
|
|
13
|
-
console.table(schemaListResponse.data.data.map((c) => ({ Id: c.id, Name: c.name, Description: c.description || '<none>' })));
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
schemaListResponse.data.data.forEach((f) => (console.log([f.id, f.name].join(','))));
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
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 = 'list';
|
|
6
|
+
exports.desc = 'List all schemas';
|
|
7
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs);
|
|
8
|
+
exports.builder = builder;
|
|
9
|
+
const handler = async function list({ sdk, isTTY }) {
|
|
10
|
+
const schemaListResponse = await sdk.raw.get('/data/v1/');
|
|
11
|
+
if (schemaListResponse.data.data.length !== 0) {
|
|
12
|
+
if (isTTY) {
|
|
13
|
+
console.table(schemaListResponse.data.data.map((c) => ({ Id: c.id, Name: c.name, Description: c.description || '<none>' })));
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
schemaListResponse.data.data.forEach((f) => (console.log([f.id, f.name].join(','))));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.handler = handler;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Changes } from '../util/syncSchema';
|
|
2
|
-
export declare function compareStatuses(localSchema: any, cloudSchema: any): Changes;
|
|
3
|
-
export declare function calculateStatusUpdateData(localStatus: any, cloudStatus: any): Record<string, string>;
|
|
1
|
+
import { Changes } from '../util/syncSchema';
|
|
2
|
+
export declare function compareStatuses(localSchema: any, cloudSchema: any): Changes;
|
|
3
|
+
export declare function calculateStatusUpdateData(localStatus: any, cloudStatus: any): Record<string, string>;
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateStatusUpdateData = exports.compareStatuses = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
5
|
-
function compareStatuses(localSchema, cloudSchema) {
|
|
6
|
-
const changes = {
|
|
7
|
-
toAdd: [],
|
|
8
|
-
toUpdate: [],
|
|
9
|
-
toRemove: [],
|
|
10
|
-
};
|
|
11
|
-
const cloudStatuses = cloudSchema.statuses;
|
|
12
|
-
const localStatuses = localSchema.statuses;
|
|
13
|
-
for (const statusName of Object.keys(localStatuses)) {
|
|
14
|
-
const cloudStatus = cloudStatuses[statusName];
|
|
15
|
-
const localStatus = localStatuses[statusName];
|
|
16
|
-
const isNewStatus = localStatus && !cloudStatus;
|
|
17
|
-
if (isNewStatus) {
|
|
18
|
-
changes.toAdd.push(statusName);
|
|
19
|
-
}
|
|
20
|
-
const isUpdatedStatus = localStatus && cloudStatus && !(0, lodash_1.isEqual)(localStatus, cloudStatus);
|
|
21
|
-
if (isUpdatedStatus) {
|
|
22
|
-
changes.toUpdate.push(statusName);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
for (const statusName of Object.keys(cloudStatuses)) {
|
|
26
|
-
const cloudStatus = cloudStatuses[statusName];
|
|
27
|
-
const localStatus = localStatuses[statusName];
|
|
28
|
-
const isExcessStatus = !localStatus && cloudStatus;
|
|
29
|
-
if (isExcessStatus) {
|
|
30
|
-
changes.toRemove.push(statusName);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return changes;
|
|
34
|
-
}
|
|
35
|
-
exports.compareStatuses = compareStatuses;
|
|
36
|
-
function calculateStatusUpdateData(localStatus, cloudStatus) {
|
|
37
|
-
const result = {};
|
|
38
|
-
for (const key of Object.keys(localStatus)) {
|
|
39
|
-
result[key] = localStatus[key];
|
|
40
|
-
}
|
|
41
|
-
for (const key of Object.keys(cloudStatus)) {
|
|
42
|
-
const isExcessProperty = !localStatus[key];
|
|
43
|
-
if (isExcessProperty) {
|
|
44
|
-
result[key] = null;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
exports.calculateStatusUpdateData = calculateStatusUpdateData;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateStatusUpdateData = exports.compareStatuses = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
function compareStatuses(localSchema, cloudSchema) {
|
|
6
|
+
const changes = {
|
|
7
|
+
toAdd: [],
|
|
8
|
+
toUpdate: [],
|
|
9
|
+
toRemove: [],
|
|
10
|
+
};
|
|
11
|
+
const cloudStatuses = cloudSchema.statuses;
|
|
12
|
+
const localStatuses = localSchema.statuses;
|
|
13
|
+
for (const statusName of Object.keys(localStatuses)) {
|
|
14
|
+
const cloudStatus = cloudStatuses[statusName];
|
|
15
|
+
const localStatus = localStatuses[statusName];
|
|
16
|
+
const isNewStatus = localStatus && !cloudStatus;
|
|
17
|
+
if (isNewStatus) {
|
|
18
|
+
changes.toAdd.push(statusName);
|
|
19
|
+
}
|
|
20
|
+
const isUpdatedStatus = localStatus && cloudStatus && !(0, lodash_1.isEqual)(localStatus, cloudStatus);
|
|
21
|
+
if (isUpdatedStatus) {
|
|
22
|
+
changes.toUpdate.push(statusName);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
for (const statusName of Object.keys(cloudStatuses)) {
|
|
26
|
+
const cloudStatus = cloudStatuses[statusName];
|
|
27
|
+
const localStatus = localStatuses[statusName];
|
|
28
|
+
const isExcessStatus = !localStatus && cloudStatus;
|
|
29
|
+
if (isExcessStatus) {
|
|
30
|
+
changes.toRemove.push(statusName);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return changes;
|
|
34
|
+
}
|
|
35
|
+
exports.compareStatuses = compareStatuses;
|
|
36
|
+
function calculateStatusUpdateData(localStatus, cloudStatus) {
|
|
37
|
+
const result = {};
|
|
38
|
+
for (const key of Object.keys(localStatus)) {
|
|
39
|
+
result[key] = localStatus[key];
|
|
40
|
+
}
|
|
41
|
+
for (const key of Object.keys(cloudStatus)) {
|
|
42
|
+
const isExcessProperty = !localStatus[key];
|
|
43
|
+
if (isExcessProperty) {
|
|
44
|
+
result[key] = null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
exports.calculateStatusUpdateData = calculateStatusUpdateData;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
export declare const command = "sync";
|
|
3
|
-
export declare const desc = "Sync all schemas in a directory with the ExH cloud";
|
|
4
|
-
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, "file" | "dir" | "ignoreVerificationErrors" | "dry"> & import("yargs").InferredOptionTypes<{
|
|
5
|
-
dir: {
|
|
6
|
-
demandOption: false;
|
|
7
|
-
describe: string;
|
|
8
|
-
type: "string";
|
|
9
|
-
};
|
|
10
|
-
file: {
|
|
11
|
-
demandOption: false;
|
|
12
|
-
describe: string;
|
|
13
|
-
type: "string";
|
|
14
|
-
};
|
|
15
|
-
dry: {
|
|
16
|
-
demandOption: false;
|
|
17
|
-
describe: string;
|
|
18
|
-
type: "boolean";
|
|
19
|
-
};
|
|
20
|
-
ignoreVerificationErrors: {
|
|
21
|
-
demandOption: false;
|
|
22
|
-
describe: string;
|
|
23
|
-
type: "boolean";
|
|
24
|
-
default: boolean;
|
|
25
|
-
};
|
|
26
|
-
}>>;
|
|
27
|
-
export declare const handler: ({ sdk, dir, file, dry, ignoreVerificationErrors }: {
|
|
28
|
-
sdk: any;
|
|
29
|
-
dir: any;
|
|
30
|
-
file: any;
|
|
31
|
-
dry: any;
|
|
32
|
-
ignoreVerificationErrors: any;
|
|
33
|
-
}) => Promise<void>;
|
|
34
|
-
export declare function syncTargetFile(sdk: any, targetFile: string, dry?: boolean, ignoreVerificationErrors?: boolean): Promise<void>;
|
|
35
|
-
export declare function syncTargetDir(sdk: any, targetDir: string, dry?: boolean, ignoreVerificationErrors?: boolean): Promise<void>;
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
export declare const command = "sync";
|
|
3
|
+
export declare const desc = "Sync all schemas in a directory with the ExH cloud";
|
|
4
|
+
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, "file" | "dir" | "ignoreVerificationErrors" | "dry"> & import("yargs").InferredOptionTypes<{
|
|
5
|
+
dir: {
|
|
6
|
+
demandOption: false;
|
|
7
|
+
describe: string;
|
|
8
|
+
type: "string";
|
|
9
|
+
};
|
|
10
|
+
file: {
|
|
11
|
+
demandOption: false;
|
|
12
|
+
describe: string;
|
|
13
|
+
type: "string";
|
|
14
|
+
};
|
|
15
|
+
dry: {
|
|
16
|
+
demandOption: false;
|
|
17
|
+
describe: string;
|
|
18
|
+
type: "boolean";
|
|
19
|
+
};
|
|
20
|
+
ignoreVerificationErrors: {
|
|
21
|
+
demandOption: false;
|
|
22
|
+
describe: string;
|
|
23
|
+
type: "boolean";
|
|
24
|
+
default: boolean;
|
|
25
|
+
};
|
|
26
|
+
}>>;
|
|
27
|
+
export declare const handler: ({ sdk, dir, file, dry, ignoreVerificationErrors }: {
|
|
28
|
+
sdk: any;
|
|
29
|
+
dir: any;
|
|
30
|
+
file: any;
|
|
31
|
+
dry: any;
|
|
32
|
+
ignoreVerificationErrors: any;
|
|
33
|
+
}) => Promise<void>;
|
|
34
|
+
export declare function syncTargetFile(sdk: any, targetFile: string, dry?: boolean, ignoreVerificationErrors?: boolean): Promise<void>;
|
|
35
|
+
export declare function syncTargetDir(sdk: any, targetDir: string, dry?: boolean, ignoreVerificationErrors?: boolean): Promise<void>;
|