@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.
Files changed (92) hide show
  1. package/CHANGELOG.md +56 -53
  2. package/README.md +0 -12
  3. package/build/commands/completion.d.ts +5 -5
  4. package/build/commands/completion.js +38 -38
  5. package/build/commands/data/schemas/delete.d.ts +10 -10
  6. package/build/commands/data/schemas/delete.js +29 -29
  7. package/build/commands/data/schemas/list.d.ts +8 -8
  8. package/build/commands/data/schemas/list.js +20 -20
  9. package/build/commands/data/schemas/sync/statusHelpers.d.ts +3 -3
  10. package/build/commands/data/schemas/sync/statusHelpers.js +49 -49
  11. package/build/commands/data/schemas/sync.d.ts +35 -35
  12. package/build/commands/data/schemas/sync.js +72 -72
  13. package/build/commands/data/schemas/util/listFilesInDir.d.ts +1 -1
  14. package/build/commands/data/schemas/util/listFilesInDir.js +25 -25
  15. package/build/commands/data/schemas/util/metaschema.json +455 -455
  16. package/build/commands/data/schemas/util/readJson.d.ts +1 -1
  17. package/build/commands/data/schemas/util/readJson.js +11 -11
  18. package/build/commands/data/schemas/util/schemaverify.d.ts +28 -28
  19. package/build/commands/data/schemas/util/schemaverify.js +202 -202
  20. package/build/commands/data/schemas/util/syncSchema.d.ts +20 -20
  21. package/build/commands/data/schemas/util/syncSchema.js +276 -276
  22. package/build/commands/data/schemas/util/tests/listFilesInDir.test.d.ts +1 -1
  23. package/build/commands/data/schemas/util/tests/listFilesInDir.test.js +40 -40
  24. package/build/commands/data/schemas/verify.d.ts +18 -18
  25. package/build/commands/data/schemas/verify.js +82 -82
  26. package/build/commands/data/schemas.d.ts +5 -5
  27. package/build/commands/data/schemas.js +10 -10
  28. package/build/commands/data.d.ts +5 -5
  29. package/build/commands/data.js +10 -10
  30. package/build/commands/dispatchers/sync.d.ts +21 -21
  31. package/build/commands/dispatchers/sync.js +24 -24
  32. package/build/commands/dispatchers.d.ts +5 -5
  33. package/build/commands/dispatchers.js +10 -10
  34. package/build/commands/login.d.ts +37 -37
  35. package/build/commands/login.js +59 -59
  36. package/build/commands/sync.d.ts +55 -55
  37. package/build/commands/sync.js +107 -107
  38. package/build/commands/tasks/createrepo.d.ts +22 -22
  39. package/build/commands/tasks/createrepo.js +70 -70
  40. package/build/commands/tasks/delete.d.ts +10 -10
  41. package/build/commands/tasks/delete.js +29 -29
  42. package/build/commands/tasks/list.d.ts +8 -8
  43. package/build/commands/tasks/list.js +27 -27
  44. package/build/commands/tasks/sync.d.ts +56 -56
  45. package/build/commands/tasks/sync.js +122 -122
  46. package/build/commands/tasks/taskConfig.d.ts +24 -24
  47. package/build/commands/tasks/taskConfig.js +169 -169
  48. package/build/commands/tasks/util.d.ts +1 -1
  49. package/build/commands/tasks/util.js +27 -27
  50. package/build/commands/tasks.d.ts +5 -5
  51. package/build/commands/tasks.js +10 -10
  52. package/build/commands/templates/delete.d.ts +19 -19
  53. package/build/commands/templates/delete.js +48 -48
  54. package/build/commands/templates/get.d.ts +19 -19
  55. package/build/commands/templates/get.js +37 -37
  56. package/build/commands/templates/list.d.ts +9 -9
  57. package/build/commands/templates/list.js +25 -25
  58. package/build/commands/templates/sync.d.ts +22 -22
  59. package/build/commands/templates/sync.js +65 -65
  60. package/build/commands/templates/util/buildTemplates.d.ts +2 -2
  61. package/build/commands/templates/util/buildTemplates.js +50 -50
  62. package/build/commands/templates/util/readTemplateFiles.d.ts +3 -3
  63. package/build/commands/templates/util/readTemplateFiles.js +52 -52
  64. package/build/commands/templates/util/templateService.d.ts +8 -8
  65. package/build/commands/templates/util/templateService.js +18 -18
  66. package/build/commands/templates/util/uploadTemplate.d.ts +2 -2
  67. package/build/commands/templates/util/uploadTemplate.js +20 -20
  68. package/build/commands/templates/util/utils.d.ts +4 -4
  69. package/build/commands/templates/util/utils.js +22 -22
  70. package/build/commands/templates.d.ts +5 -5
  71. package/build/commands/templates.js +10 -10
  72. package/build/constants.d.ts +13 -13
  73. package/build/constants.js +37 -37
  74. package/build/exh.d.ts +3 -3
  75. package/build/exh.js +65 -65
  76. package/build/helpers/error.d.ts +2 -2
  77. package/build/helpers/error.js +6 -6
  78. package/build/helpers/repoConfig.d.ts +2 -2
  79. package/build/helpers/repoConfig.js +60 -60
  80. package/build/helpers/util.d.ts +3 -3
  81. package/build/helpers/util.js +36 -36
  82. package/build/index.d.ts +2 -2
  83. package/build/index.js +33 -33
  84. package/build/repositories/dispatchers.d.ts +8 -8
  85. package/build/repositories/dispatchers.js +31 -31
  86. package/build/repositories/functions.d.ts +24 -24
  87. package/build/repositories/functions.js +28 -28
  88. package/build/repositories/schemas.d.ts +44 -44
  89. package/build/repositories/schemas.js +86 -86
  90. package/build/services/dispatchers.d.ts +3 -3
  91. package/build/services/dispatchers.js +132 -132
  92. package/package.json +53 -53
package/CHANGELOG.md CHANGED
@@ -1,53 +1,56 @@
1
- # Extra Horizon CLI changelog
2
-
3
- ### v1.5.0
4
- * Updated the supported runtimes for task functions
5
- * `exh data schemas verify` and `exh tasks create-repo` no longer require you to be authenticated
6
- * `@extra-horizon/javascript-sdk` has been updated to `8.2.0`
7
- * Unused dependencies have been removed
8
-
9
- ### v1.4.0
10
- * Added a validation check for `id` properties in objects within arrays in data schemas, this will now be reported as an error if present.
11
- * Added validation for duplicate transition names in data schemas, this will now be reported as an error if present.
12
- * 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.
13
-
14
- ### v1.3.0
15
- * 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.
16
- * 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.
17
- * Added an argument `exh sync --dispatchers` to synchronize only Dispatchers.
18
- * 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.
19
-
20
- ### v1.2.0
21
- * Added a sync argument `exh sync ... --ignoreSchemaVerificationErrors` to bypass schema verification errors, this allows schemas to be synced even if errors are reported
22
- * 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
23
- * Fixed an issue synchronizing statuses with an existing schema, excess properties should now be correctly removed from statuses
24
- * Updated the supported runtimes for tasks
25
- * The `--help` information now correctly displays `exh` rather than `index.js` as the command.
26
-
27
- ### v1.1.0
28
- * Added single file sync command for schemas with `exh data schemas sync --file=<path>`
29
- * 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.
30
- * Added verification and validation for statuses that are defined, but not present in transitions.
31
- * Added validation to ensure that properties in a creation transition exist in the schema properties.
32
- * Added verification and validation of transition conditions.
33
- * Added terminal notifications for if a newer release of the CLI available.
34
-
35
- ### v1.0.4
36
- * Security update
37
-
38
- ### v1.0.3
39
- * Fix setting of execution permission
40
- * Set credentials as environment variables as well, but only if they're not defined yet
41
-
42
- ### v1.0.2
43
- * Fix JSON schema for transition where `configuration` was marked as mandatory
44
-
45
- ### v1.0.1
46
- * Fixed broken environment variables
47
-
48
- ### v1.0.0
49
-
50
- * Add support for setting execution permission when syncing a task. Options are `permissionRequired`, `allUsers` or `public`.
51
- * 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__
52
- * Add support for setting `retryPolicy` in task-config.json.
53
- * Example task-config.json can be found [here](examples/task-config.example.json).
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>;