@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
@@ -1,4 +1,4 @@
1
- export declare function listFolderContent(path: string): Promise<string[]>;
2
- export declare function readJsonFile(path: string): Promise<any>;
3
- export declare function readTextFile(path: string): Promise<string>;
4
- export declare function removeFileNameExtension(fileName: string): string;
1
+ export declare function listFolderContent(path: string): Promise<string[]>;
2
+ export declare function readJsonFile(path: string): Promise<any>;
3
+ export declare function readTextFile(path: string): Promise<string>;
4
+ export declare function removeFileNameExtension(fileName: string): string;
@@ -1,22 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeFileNameExtension = exports.readTextFile = exports.readJsonFile = exports.listFolderContent = void 0;
4
- const promises_1 = require("fs/promises");
5
- async function listFolderContent(path) {
6
- return await (0, promises_1.readdir)(path);
7
- }
8
- exports.listFolderContent = listFolderContent;
9
- async function readJsonFile(path) {
10
- const file = await readTextFile(path);
11
- return JSON.parse(file);
12
- }
13
- exports.readJsonFile = readJsonFile;
14
- async function readTextFile(path) {
15
- const fileBuffer = await (0, promises_1.readFile)(path);
16
- return fileBuffer.toString();
17
- }
18
- exports.readTextFile = readTextFile;
19
- function removeFileNameExtension(fileName) {
20
- return fileName.split('.')[0];
21
- }
22
- exports.removeFileNameExtension = removeFileNameExtension;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeFileNameExtension = exports.readTextFile = exports.readJsonFile = exports.listFolderContent = void 0;
4
+ const promises_1 = require("fs/promises");
5
+ async function listFolderContent(path) {
6
+ return await (0, promises_1.readdir)(path);
7
+ }
8
+ exports.listFolderContent = listFolderContent;
9
+ async function readJsonFile(path) {
10
+ const file = await readTextFile(path);
11
+ return JSON.parse(file);
12
+ }
13
+ exports.readJsonFile = readJsonFile;
14
+ async function readTextFile(path) {
15
+ const fileBuffer = await (0, promises_1.readFile)(path);
16
+ return fileBuffer.toString();
17
+ }
18
+ exports.readTextFile = readTextFile;
19
+ function removeFileNameExtension(fileName) {
20
+ return fileName.split('.')[0];
21
+ }
22
+ exports.removeFileNameExtension = removeFileNameExtension;
@@ -1,5 +1,5 @@
1
- /// <reference types="yargs" />
2
- export declare const command = "templates <command>";
3
- export declare const desc = "Manage templates";
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 = "templates <command>";
3
+ export declare const desc = "Manage templates";
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 = 'templates <command>';
6
- exports.desc = 'Manage templates';
7
- const builder = (yargs) => (0, util_1.epilogue)(yargs).commandDir('templates');
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 = 'templates <command>';
6
+ exports.desc = 'Manage templates';
7
+ const builder = (yargs) => (0, util_1.epilogue)(yargs).commandDir('templates');
8
+ exports.builder = builder;
9
+ const handler = () => { };
10
+ exports.handler = handler;
@@ -1,13 +1,13 @@
1
- export declare const EXH_CONFIG_FILE_DIR: string;
2
- export declare const EXH_CONFIG_FILE: string;
3
- export declare const runtimeChoices: string[];
4
- export declare const limits: {
5
- time: {
6
- min: number;
7
- max: number;
8
- };
9
- memory: {
10
- min: number;
11
- max: number;
12
- };
13
- };
1
+ export declare const EXH_CONFIG_FILE_DIR: string;
2
+ export declare const EXH_CONFIG_FILE: string;
3
+ export declare const runtimeChoices: string[];
4
+ export declare const limits: {
5
+ time: {
6
+ min: number;
7
+ max: number;
8
+ };
9
+ memory: {
10
+ min: number;
11
+ max: number;
12
+ };
13
+ };
@@ -1,37 +1,37 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.limits = exports.runtimeChoices = exports.EXH_CONFIG_FILE = exports.EXH_CONFIG_FILE_DIR = void 0;
4
- const os_1 = require("os");
5
- const path = require("path");
6
- exports.EXH_CONFIG_FILE_DIR = path.join((0, os_1.homedir)(), '/.exh');
7
- exports.EXH_CONFIG_FILE = `${exports.EXH_CONFIG_FILE_DIR}/credentials`;
8
- exports.runtimeChoices = [
9
- 'nodejs16.x',
10
- 'nodejs18.x',
11
- 'nodejs20.x',
12
- 'python3.8',
13
- 'python3.9',
14
- 'python3.10',
15
- 'python3.11',
16
- 'python3.12',
17
- 'java8.al2',
18
- 'java11',
19
- 'java17',
20
- 'java21',
21
- 'dotnet6',
22
- 'dotnet7',
23
- 'dotnet8',
24
- 'ruby3.2',
25
- 'provided.al2',
26
- 'provided.al2023',
27
- ];
28
- exports.limits = {
29
- time: {
30
- min: 3,
31
- max: 900,
32
- },
33
- memory: {
34
- min: 128,
35
- max: 10240,
36
- },
37
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.limits = exports.runtimeChoices = exports.EXH_CONFIG_FILE = exports.EXH_CONFIG_FILE_DIR = void 0;
4
+ const os_1 = require("os");
5
+ const path = require("path");
6
+ exports.EXH_CONFIG_FILE_DIR = path.join((0, os_1.homedir)(), '/.exh');
7
+ exports.EXH_CONFIG_FILE = `${exports.EXH_CONFIG_FILE_DIR}/credentials`;
8
+ exports.runtimeChoices = [
9
+ 'nodejs16.x',
10
+ 'nodejs18.x',
11
+ 'nodejs20.x',
12
+ 'python3.8',
13
+ 'python3.9',
14
+ 'python3.10',
15
+ 'python3.11',
16
+ 'python3.12',
17
+ 'java8.al2',
18
+ 'java11',
19
+ 'java17',
20
+ 'java21',
21
+ 'dotnet6',
22
+ 'dotnet7',
23
+ 'dotnet8',
24
+ 'ruby3.2',
25
+ 'provided.al2',
26
+ 'provided.al2023',
27
+ ];
28
+ exports.limits = {
29
+ time: {
30
+ min: 3,
31
+ max: 900,
32
+ },
33
+ memory: {
34
+ min: 128,
35
+ max: 10240,
36
+ },
37
+ };
package/build/exh.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { OAuth1Client } from '@extrahorizon/javascript-sdk';
2
- export declare function sdkInitOnly(apiHost: string, consumerKey: string, consumerSecret: string): OAuth1Client;
3
- export declare function sdkAuth(): Promise<OAuth1Client>;
1
+ import { OAuth1Client } from '@extrahorizon/javascript-sdk';
2
+ export declare function sdkInitOnly(apiHost: string, consumerKey: string, consumerSecret: string): OAuth1Client;
3
+ export declare function sdkAuth(): Promise<OAuth1Client>;
package/build/exh.js CHANGED
@@ -1,65 +1,65 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sdkAuth = exports.sdkInitOnly = void 0;
4
- const fs = require("fs");
5
- const javascript_sdk_1 = require("@extrahorizon/javascript-sdk");
6
- const constants_1 = require("./constants");
7
- let sdk = null;
8
- function sdkInitOnly(apiHost, consumerKey, consumerSecret) {
9
- sdk = (0, javascript_sdk_1.createOAuth1Client)({
10
- consumerKey,
11
- consumerSecret,
12
- host: apiHost,
13
- });
14
- return sdk;
15
- }
16
- exports.sdkInitOnly = sdkInitOnly;
17
- async function sdkAuth() {
18
- let credentials = {};
19
- let haveCredFile = false;
20
- const needed = ['API_HOST', 'API_OAUTH_CONSUMER_KEY', 'API_OAUTH_CONSUMER_SECRET', 'API_OAUTH_TOKEN', 'API_OAUTH_TOKEN_SECRET'];
21
- const error = missing => {
22
- let message = 'Failed to retrieve all credentials. ';
23
- if (!haveCredFile) {
24
- message += 'Couldn\'t open ~/.exh/credentials. ';
25
- }
26
- if (missing.length) {
27
- message += `Missing properties: ${missing.join(',')}`;
28
- }
29
- throw new Error(message);
30
- };
31
- try {
32
- const credentialsFile = fs.readFileSync(constants_1.EXH_CONFIG_FILE, 'utf-8');
33
- haveCredFile = true;
34
- credentials = credentialsFile
35
- .split(/\r?\n/).map(l => l.split(/=/)).filter(i => i.length === 2)
36
- .reduce((r, v) => { r[v[0].trim()] = v[1].trim(); return r; }, {});
37
- for (const k of Object.keys(credentials)) {
38
- if (!process.env[k]) {
39
- process.env[k] = credentials[k];
40
- }
41
- }
42
- }
43
- catch (err) { }
44
- needed.forEach(v => { credentials[v] = process.env[v] ?? credentials[v]; });
45
- const missingProperties = needed.filter(p => credentials[p] === undefined);
46
- if (missingProperties.length) {
47
- error(missingProperties);
48
- }
49
- sdk = (0, javascript_sdk_1.createOAuth1Client)({
50
- consumerKey: credentials.API_OAUTH_CONSUMER_KEY,
51
- consumerSecret: credentials.API_OAUTH_CONSUMER_SECRET,
52
- host: credentials.API_HOST,
53
- });
54
- try {
55
- await sdk.auth.authenticate({
56
- token: credentials.API_OAUTH_TOKEN,
57
- tokenSecret: credentials.API_OAUTH_TOKEN_SECRET,
58
- });
59
- }
60
- catch (err) {
61
- throw new Error(`Failed to authenticate. All credentials found but some might be wrong or no longer valid.\nError was: "${err}"`);
62
- }
63
- return sdk;
64
- }
65
- exports.sdkAuth = sdkAuth;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sdkAuth = exports.sdkInitOnly = void 0;
4
+ const fs = require("fs");
5
+ const javascript_sdk_1 = require("@extrahorizon/javascript-sdk");
6
+ const constants_1 = require("./constants");
7
+ let sdk = null;
8
+ function sdkInitOnly(apiHost, consumerKey, consumerSecret) {
9
+ sdk = (0, javascript_sdk_1.createOAuth1Client)({
10
+ consumerKey,
11
+ consumerSecret,
12
+ host: apiHost,
13
+ });
14
+ return sdk;
15
+ }
16
+ exports.sdkInitOnly = sdkInitOnly;
17
+ async function sdkAuth() {
18
+ let credentials = {};
19
+ let haveCredFile = false;
20
+ const needed = ['API_HOST', 'API_OAUTH_CONSUMER_KEY', 'API_OAUTH_CONSUMER_SECRET', 'API_OAUTH_TOKEN', 'API_OAUTH_TOKEN_SECRET'];
21
+ const error = missing => {
22
+ let message = 'Failed to retrieve all credentials. ';
23
+ if (!haveCredFile) {
24
+ message += 'Couldn\'t open ~/.exh/credentials. ';
25
+ }
26
+ if (missing.length) {
27
+ message += `Missing properties: ${missing.join(',')}`;
28
+ }
29
+ throw new Error(message);
30
+ };
31
+ try {
32
+ const credentialsFile = fs.readFileSync(constants_1.EXH_CONFIG_FILE, 'utf-8');
33
+ haveCredFile = true;
34
+ credentials = credentialsFile
35
+ .split(/\r?\n/).map(l => l.split(/=/)).filter(i => i.length === 2)
36
+ .reduce((r, v) => { r[v[0].trim()] = v[1].trim(); return r; }, {});
37
+ for (const k of Object.keys(credentials)) {
38
+ if (!process.env[k]) {
39
+ process.env[k] = credentials[k];
40
+ }
41
+ }
42
+ }
43
+ catch (err) { }
44
+ needed.forEach(v => { credentials[v] = process.env[v] ?? credentials[v]; });
45
+ const missingProperties = needed.filter(p => credentials[p] === undefined);
46
+ if (missingProperties.length) {
47
+ error(missingProperties);
48
+ }
49
+ sdk = (0, javascript_sdk_1.createOAuth1Client)({
50
+ consumerKey: credentials.API_OAUTH_CONSUMER_KEY,
51
+ consumerSecret: credentials.API_OAUTH_CONSUMER_SECRET,
52
+ host: credentials.API_HOST,
53
+ });
54
+ try {
55
+ await sdk.auth.authenticate({
56
+ token: credentials.API_OAUTH_TOKEN,
57
+ tokenSecret: credentials.API_OAUTH_TOKEN_SECRET,
58
+ });
59
+ }
60
+ catch (err) {
61
+ throw new Error(`Failed to authenticate. All credentials found but some might be wrong or no longer valid.\nError was: "${err}"`);
62
+ }
63
+ return sdk;
64
+ }
65
+ exports.sdkAuth = sdkAuth;
@@ -1,2 +1,2 @@
1
- export declare class CommandError extends Error {
2
- }
1
+ export declare class CommandError extends Error {
2
+ }
@@ -1,6 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandError = void 0;
4
- class CommandError extends Error {
5
- }
6
- exports.CommandError = CommandError;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommandError = void 0;
4
+ class CommandError extends Error {
5
+ }
6
+ exports.CommandError = CommandError;
@@ -1,2 +1,2 @@
1
- export declare const REPO_CONFIG_FILE = "repo-config.json";
2
- export declare function getRepoConfig(targetPath: string, validate: boolean): Promise<any>;
1
+ export declare const REPO_CONFIG_FILE = "repo-config.json";
2
+ export declare function getRepoConfig(targetPath: string, validate: boolean): Promise<any>;
@@ -1,60 +1,60 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRepoConfig = exports.REPO_CONFIG_FILE = void 0;
4
- const fs = require("fs/promises");
5
- const ospath = require("path");
6
- const chalk = require("chalk");
7
- exports.REPO_CONFIG_FILE = 'repo-config.json';
8
- async function getDefaultConfig(targetPath) {
9
- const config = {};
10
- const sections = ['schemas', 'templates', 'tasks'];
11
- for (const s of sections) {
12
- try {
13
- await fs.access(ospath.join(targetPath, s));
14
- config[s] = [s];
15
- }
16
- catch (err) {
17
- continue;
18
- }
19
- }
20
- return config;
21
- }
22
- async function validateRepoConfig(targetPath, config) {
23
- const checkDirAccess = async (basePath, paths) => {
24
- const result = [];
25
- if (!Array.isArray(paths)) {
26
- throw new Error('Not an array');
27
- }
28
- for (const p of paths) {
29
- try {
30
- await fs.access(ospath.join(basePath, p));
31
- }
32
- catch (err) {
33
- console.log(chalk.yellow(`Warning: '${p}' directory not found`));
34
- continue;
35
- }
36
- if (!(await fs.stat(ospath.join(basePath, p))).isDirectory()) {
37
- throw new Error(`${p} is not a directory`);
38
- }
39
- result.push(p);
40
- }
41
- return result;
42
- };
43
- const newConfig = { ...config };
44
- for (const [key] of Object.entries(config)) {
45
- newConfig[key] = await checkDirAccess(targetPath, config[key]);
46
- }
47
- return newConfig;
48
- }
49
- async function getRepoConfig(targetPath, validate) {
50
- let cfg = await getDefaultConfig(targetPath);
51
- try {
52
- cfg = JSON.parse((await fs.readFile(ospath.join(targetPath, exports.REPO_CONFIG_FILE))).toString());
53
- }
54
- catch (err) { }
55
- if (validate) {
56
- return await validateRepoConfig(targetPath, cfg);
57
- }
58
- return cfg;
59
- }
60
- exports.getRepoConfig = getRepoConfig;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRepoConfig = exports.REPO_CONFIG_FILE = void 0;
4
+ const fs = require("fs/promises");
5
+ const ospath = require("path");
6
+ const chalk = require("chalk");
7
+ exports.REPO_CONFIG_FILE = 'repo-config.json';
8
+ async function getDefaultConfig(targetPath) {
9
+ const config = {};
10
+ const sections = ['schemas', 'templates', 'tasks'];
11
+ for (const s of sections) {
12
+ try {
13
+ await fs.access(ospath.join(targetPath, s));
14
+ config[s] = [s];
15
+ }
16
+ catch (err) {
17
+ continue;
18
+ }
19
+ }
20
+ return config;
21
+ }
22
+ async function validateRepoConfig(targetPath, config) {
23
+ const checkDirAccess = async (basePath, paths) => {
24
+ const result = [];
25
+ if (!Array.isArray(paths)) {
26
+ throw new Error('Not an array');
27
+ }
28
+ for (const p of paths) {
29
+ try {
30
+ await fs.access(ospath.join(basePath, p));
31
+ }
32
+ catch (err) {
33
+ console.log(chalk.yellow(`Warning: '${p}' directory not found`));
34
+ continue;
35
+ }
36
+ if (!(await fs.stat(ospath.join(basePath, p))).isDirectory()) {
37
+ throw new Error(`${p} is not a directory`);
38
+ }
39
+ result.push(p);
40
+ }
41
+ return result;
42
+ };
43
+ const newConfig = { ...config };
44
+ for (const [key] of Object.entries(config)) {
45
+ newConfig[key] = await checkDirAccess(targetPath, config[key]);
46
+ }
47
+ return newConfig;
48
+ }
49
+ async function getRepoConfig(targetPath, validate) {
50
+ let cfg = await getDefaultConfig(targetPath);
51
+ try {
52
+ cfg = JSON.parse((await fs.readFile(ospath.join(targetPath, exports.REPO_CONFIG_FILE))).toString());
53
+ }
54
+ catch (err) { }
55
+ if (validate) {
56
+ return await validateRepoConfig(targetPath, cfg);
57
+ }
58
+ return cfg;
59
+ }
60
+ exports.getRepoConfig = getRepoConfig;
@@ -1,3 +1,3 @@
1
- import * as yargs from 'yargs';
2
- export declare function epilogue(y: yargs.Argv): yargs.Argv;
3
- export declare function asyncExec(cmd: string): Promise<string>;
1
+ import * as yargs from 'yargs';
2
+ export declare function epilogue(y: yargs.Argv): yargs.Argv;
3
+ export declare function asyncExec(cmd: string): Promise<string>;
@@ -1,36 +1,36 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.asyncExec = exports.epilogue = void 0;
4
- const child_process_1 = require("child_process");
5
- const chalk = require("chalk");
6
- const error_1 = require("./error");
7
- function epilogue(y) {
8
- return y.epilogue('Visit https://docs.extrahorizon.com/extrahorizon-cli/ for more information.').fail((msg, err, argv) => {
9
- if (err && err instanceof error_1.CommandError) {
10
- console.log(err.message);
11
- process.exit(1);
12
- }
13
- if (err) {
14
- console.log(chalk.red(err.message));
15
- }
16
- else {
17
- console.log(chalk.red(msg));
18
- }
19
- console.log('\nUsage:');
20
- console.log(argv.help());
21
- process.exit(1);
22
- });
23
- }
24
- exports.epilogue = epilogue;
25
- async function asyncExec(cmd) {
26
- return new Promise((res, rej) => {
27
- (0, child_process_1.exec)(cmd, (err, stdout) => {
28
- if (err) {
29
- rej(err);
30
- return;
31
- }
32
- res(stdout);
33
- });
34
- });
35
- }
36
- exports.asyncExec = asyncExec;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asyncExec = exports.epilogue = void 0;
4
+ const child_process_1 = require("child_process");
5
+ const chalk = require("chalk");
6
+ const error_1 = require("./error");
7
+ function epilogue(y) {
8
+ return y.epilogue('Visit https://docs.extrahorizon.com/extrahorizon-cli/ for more information.').fail((msg, err, argv) => {
9
+ if (err && err instanceof error_1.CommandError) {
10
+ console.log(err.message);
11
+ process.exit(1);
12
+ }
13
+ if (err) {
14
+ console.log(chalk.red(err.message));
15
+ }
16
+ else {
17
+ console.log(chalk.red(msg));
18
+ }
19
+ console.log('\nUsage:');
20
+ console.log(argv.help());
21
+ process.exit(1);
22
+ });
23
+ }
24
+ exports.epilogue = epilogue;
25
+ async function asyncExec(cmd) {
26
+ return new Promise((res, rej) => {
27
+ (0, child_process_1.exec)(cmd, (err, stdout) => {
28
+ if (err) {
29
+ rej(err);
30
+ return;
31
+ }
32
+ res(stdout);
33
+ });
34
+ });
35
+ }
36
+ exports.asyncExec = asyncExec;
package/build/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- #! /usr/bin/env node
2
- export {};
1
+ #! /usr/bin/env node
2
+ export {};
package/build/index.js CHANGED
@@ -1,33 +1,33 @@
1
- #! /usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const tty = require("tty");
5
- const lodash_1 = require("lodash");
6
- const yargs = require("yargs");
7
- const helpers_1 = require("yargs/helpers");
8
- const exh_1 = require("./exh");
9
- function checkVersion() {
10
- const pkg = require('../package.json');
11
- const updateNotifier = require('update-notifier');
12
- const notifier = updateNotifier({ pkg, updateCheckInterval: 0 });
13
- notifier.notify();
14
- }
15
- checkVersion();
16
- yargs((0, helpers_1.hideBin)(process.argv))
17
- .middleware(async (argv) => {
18
- const isTTY = tty.isatty(process.stdout.fd);
19
- if ((0, lodash_1.isEqual)(argv._, ['login']) ||
20
- (0, lodash_1.isEqual)(argv._, ['data', 'schemas', 'verify']) ||
21
- (0, lodash_1.isEqual)(argv._, ['tasks', 'create-repo']) ||
22
- process.env.NO_SDK) {
23
- return { sdk: 'no-sdk', isTTY };
24
- }
25
- const sdk = await (0, exh_1.sdkAuth)();
26
- return { sdk, isTTY };
27
- })
28
- .commandDir('commands')
29
- .scriptName('exh')
30
- .strict()
31
- .demandCommand(1)
32
- .completion('generate_completion', false)
33
- .parse();
1
+ #! /usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const tty = require("tty");
5
+ const lodash_1 = require("lodash");
6
+ const yargs = require("yargs");
7
+ const helpers_1 = require("yargs/helpers");
8
+ const exh_1 = require("./exh");
9
+ function checkVersion() {
10
+ const pkg = require('../package.json');
11
+ const updateNotifier = require('update-notifier');
12
+ const notifier = updateNotifier({ pkg, updateCheckInterval: 0 });
13
+ notifier.notify();
14
+ }
15
+ checkVersion();
16
+ yargs((0, helpers_1.hideBin)(process.argv))
17
+ .middleware(async (argv) => {
18
+ const isTTY = tty.isatty(process.stdout.fd);
19
+ if ((0, lodash_1.isEqual)(argv._, ['login']) ||
20
+ (0, lodash_1.isEqual)(argv._, ['data', 'schemas', 'verify']) ||
21
+ (0, lodash_1.isEqual)(argv._, ['tasks', 'create-repo']) ||
22
+ process.env.NO_SDK) {
23
+ return { sdk: 'no-sdk', isTTY };
24
+ }
25
+ const sdk = await (0, exh_1.sdkAuth)();
26
+ return { sdk, isTTY };
27
+ })
28
+ .commandDir('commands')
29
+ .scriptName('exh')
30
+ .strict()
31
+ .demandCommand(1)
32
+ .completion('generate_completion', false)
33
+ .parse();
@@ -1,8 +1,8 @@
1
- import { ActionCreation, ActionUpdate, DispatcherCreation, DispatcherUpdate, OAuth1Client, ObjectId, RQLString } from '@extrahorizon/javascript-sdk';
2
- export declare function create(sdk: OAuth1Client, data: DispatcherCreation): Promise<import("@extrahorizon/javascript-sdk").Dispatcher>;
3
- export declare function findAll(sdk: OAuth1Client, rql?: RQLString): Promise<import("@extrahorizon/javascript-sdk").Dispatcher[]>;
4
- export declare function update(sdk: OAuth1Client, dispatcherId: ObjectId, data: DispatcherUpdate): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
5
- export declare function remove(sdk: OAuth1Client, dispatcherId: ObjectId): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
6
- export declare function createAction(sdk: OAuth1Client, dispatcherId: ObjectId, data: ActionCreation): Promise<import("@extrahorizon/javascript-sdk").Action>;
7
- export declare function updateAction(sdk: OAuth1Client, dispatcherId: ObjectId, actionId: ObjectId, data: ActionUpdate): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
8
- export declare function removeAction(sdk: OAuth1Client, dispatcherId: ObjectId, actionId: ObjectId): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
1
+ import { ActionCreation, ActionUpdate, DispatcherCreation, DispatcherUpdate, OAuth1Client, ObjectId, RQLString } from '@extrahorizon/javascript-sdk';
2
+ export declare function create(sdk: OAuth1Client, data: DispatcherCreation): Promise<import("@extrahorizon/javascript-sdk").Dispatcher>;
3
+ export declare function findAll(sdk: OAuth1Client, rql?: RQLString): Promise<import("@extrahorizon/javascript-sdk").Dispatcher[]>;
4
+ export declare function update(sdk: OAuth1Client, dispatcherId: ObjectId, data: DispatcherUpdate): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
5
+ export declare function remove(sdk: OAuth1Client, dispatcherId: ObjectId): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
6
+ export declare function createAction(sdk: OAuth1Client, dispatcherId: ObjectId, data: ActionCreation): Promise<import("@extrahorizon/javascript-sdk").Action>;
7
+ export declare function updateAction(sdk: OAuth1Client, dispatcherId: ObjectId, actionId: ObjectId, data: ActionUpdate): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
8
+ export declare function removeAction(sdk: OAuth1Client, dispatcherId: ObjectId, actionId: ObjectId): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;