@extrahorizon/exh-cli 1.5.0

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 (93) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/LICENSE +21 -0
  3. package/README.md +66 -0
  4. package/build/commands/completion.d.ts +5 -0
  5. package/build/commands/completion.js +38 -0
  6. package/build/commands/data/schemas/delete.d.ts +10 -0
  7. package/build/commands/data/schemas/delete.js +29 -0
  8. package/build/commands/data/schemas/list.d.ts +8 -0
  9. package/build/commands/data/schemas/list.js +20 -0
  10. package/build/commands/data/schemas/sync/statusHelpers.d.ts +3 -0
  11. package/build/commands/data/schemas/sync/statusHelpers.js +49 -0
  12. package/build/commands/data/schemas/sync.d.ts +35 -0
  13. package/build/commands/data/schemas/sync.js +72 -0
  14. package/build/commands/data/schemas/util/listFilesInDir.d.ts +1 -0
  15. package/build/commands/data/schemas/util/listFilesInDir.js +25 -0
  16. package/build/commands/data/schemas/util/metaschema.json +455 -0
  17. package/build/commands/data/schemas/util/readJson.d.ts +1 -0
  18. package/build/commands/data/schemas/util/readJson.js +11 -0
  19. package/build/commands/data/schemas/util/schemaverify.d.ts +28 -0
  20. package/build/commands/data/schemas/util/schemaverify.js +202 -0
  21. package/build/commands/data/schemas/util/syncSchema.d.ts +20 -0
  22. package/build/commands/data/schemas/util/syncSchema.js +276 -0
  23. package/build/commands/data/schemas/util/tests/listFilesInDir.test.d.ts +1 -0
  24. package/build/commands/data/schemas/util/tests/listFilesInDir.test.js +40 -0
  25. package/build/commands/data/schemas/verify.d.ts +18 -0
  26. package/build/commands/data/schemas/verify.js +82 -0
  27. package/build/commands/data/schemas.d.ts +5 -0
  28. package/build/commands/data/schemas.js +10 -0
  29. package/build/commands/data.d.ts +5 -0
  30. package/build/commands/data.js +10 -0
  31. package/build/commands/dispatchers/sync.d.ts +21 -0
  32. package/build/commands/dispatchers/sync.js +24 -0
  33. package/build/commands/dispatchers.d.ts +5 -0
  34. package/build/commands/dispatchers.js +10 -0
  35. package/build/commands/login.d.ts +37 -0
  36. package/build/commands/login.js +59 -0
  37. package/build/commands/sync.d.ts +55 -0
  38. package/build/commands/sync.js +107 -0
  39. package/build/commands/tasks/createrepo.d.ts +22 -0
  40. package/build/commands/tasks/createrepo.js +70 -0
  41. package/build/commands/tasks/delete.d.ts +10 -0
  42. package/build/commands/tasks/delete.js +29 -0
  43. package/build/commands/tasks/list.d.ts +8 -0
  44. package/build/commands/tasks/list.js +27 -0
  45. package/build/commands/tasks/sync.d.ts +56 -0
  46. package/build/commands/tasks/sync.js +122 -0
  47. package/build/commands/tasks/taskConfig.d.ts +24 -0
  48. package/build/commands/tasks/taskConfig.js +169 -0
  49. package/build/commands/tasks/util.d.ts +1 -0
  50. package/build/commands/tasks/util.js +27 -0
  51. package/build/commands/tasks.d.ts +5 -0
  52. package/build/commands/tasks.js +10 -0
  53. package/build/commands/templates/delete.d.ts +19 -0
  54. package/build/commands/templates/delete.js +48 -0
  55. package/build/commands/templates/get.d.ts +19 -0
  56. package/build/commands/templates/get.js +37 -0
  57. package/build/commands/templates/list.d.ts +9 -0
  58. package/build/commands/templates/list.js +25 -0
  59. package/build/commands/templates/sync.d.ts +22 -0
  60. package/build/commands/templates/sync.js +65 -0
  61. package/build/commands/templates/util/buildTemplates.d.ts +2 -0
  62. package/build/commands/templates/util/buildTemplates.js +50 -0
  63. package/build/commands/templates/util/readTemplateFiles.d.ts +3 -0
  64. package/build/commands/templates/util/readTemplateFiles.js +52 -0
  65. package/build/commands/templates/util/templateService.d.ts +8 -0
  66. package/build/commands/templates/util/templateService.js +18 -0
  67. package/build/commands/templates/util/uploadTemplate.d.ts +2 -0
  68. package/build/commands/templates/util/uploadTemplate.js +20 -0
  69. package/build/commands/templates/util/utils.d.ts +4 -0
  70. package/build/commands/templates/util/utils.js +22 -0
  71. package/build/commands/templates.d.ts +5 -0
  72. package/build/commands/templates.js +10 -0
  73. package/build/constants.d.ts +13 -0
  74. package/build/constants.js +37 -0
  75. package/build/exh.d.ts +3 -0
  76. package/build/exh.js +65 -0
  77. package/build/helpers/error.d.ts +2 -0
  78. package/build/helpers/error.js +6 -0
  79. package/build/helpers/repoConfig.d.ts +2 -0
  80. package/build/helpers/repoConfig.js +60 -0
  81. package/build/helpers/util.d.ts +3 -0
  82. package/build/helpers/util.js +36 -0
  83. package/build/index.d.ts +2 -0
  84. package/build/index.js +33 -0
  85. package/build/repositories/dispatchers.d.ts +8 -0
  86. package/build/repositories/dispatchers.js +31 -0
  87. package/build/repositories/functions.d.ts +24 -0
  88. package/build/repositories/functions.js +28 -0
  89. package/build/repositories/schemas.d.ts +44 -0
  90. package/build/repositories/schemas.js +86 -0
  91. package/build/services/dispatchers.d.ts +3 -0
  92. package/build/services/dispatchers.js +132 -0
  93. package/package.json +53 -0
@@ -0,0 +1,3 @@
1
+ export declare function readTemplateFiles(targetFolder: string): Promise<{}>;
2
+ export declare function readTemplateJson(fileName: string): Promise<any>;
3
+ export declare function readTemplateFolder(subFolder: string): Promise<any>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readTemplateFolder = exports.readTemplateJson = exports.readTemplateFiles = void 0;
4
+ const fs = require("fs/promises");
5
+ const path = require("path");
6
+ const utils_1 = require("./utils");
7
+ async function readTemplateFiles(targetFolder) {
8
+ const fileNames = await (0, utils_1.listFolderContent)(targetFolder);
9
+ const templateFilesByName = {};
10
+ for (const fileName of fileNames) {
11
+ const filePath = path.join(targetFolder, fileName);
12
+ if ((await fs.stat(filePath)).isDirectory()) {
13
+ templateFilesByName[fileName] = await readTemplateFolder(filePath);
14
+ }
15
+ else if (fileName.endsWith('.json')) {
16
+ const templateName = (0, utils_1.removeFileNameExtension)(fileName);
17
+ templateFilesByName[templateName] = await readTemplateJson(filePath);
18
+ }
19
+ }
20
+ return templateFilesByName;
21
+ }
22
+ exports.readTemplateFiles = readTemplateFiles;
23
+ async function readTemplateJson(fileName) {
24
+ return (0, utils_1.readJsonFile)(fileName);
25
+ }
26
+ exports.readTemplateJson = readTemplateJson;
27
+ async function readTemplateFolder(subFolder) {
28
+ const templateFile = await readTemplateJson(path.join(subFolder, 'template.json'));
29
+ const templateFields = await readTemplateFolderFieldFiles(subFolder);
30
+ if (!templateFile.fields) {
31
+ templateFile.fields = templateFields;
32
+ }
33
+ else {
34
+ templateFile.fields = {
35
+ ...templateFile.fields,
36
+ ...templateFields,
37
+ };
38
+ }
39
+ return templateFile;
40
+ }
41
+ exports.readTemplateFolder = readTemplateFolder;
42
+ async function readTemplateFolderFieldFiles(subFolder) {
43
+ const templateFields = {};
44
+ const folderFileNames = await (0, utils_1.listFolderContent)(subFolder);
45
+ const fieldFileNames = folderFileNames.filter((fileName) => fileName !== 'template.json');
46
+ for (const fieldFileName of fieldFileNames) {
47
+ const fieldName = (0, utils_1.removeFileNameExtension)(fieldFileName);
48
+ const fieldContent = await (0, utils_1.readTextFile)(path.join(subFolder, fieldFileName));
49
+ templateFields[fieldName] = fieldContent;
50
+ }
51
+ return templateFields;
52
+ }
@@ -0,0 +1,8 @@
1
+ import { OAuth1Client } from '@extrahorizon/javascript-sdk';
2
+ export declare class TemplateService {
3
+ private sdk;
4
+ constructor(sdk: OAuth1Client);
5
+ byName(name: string): Promise<import("@extrahorizon/javascript-sdk").TemplateOut>;
6
+ update(name: string, data: any): Promise<import("@extrahorizon/javascript-sdk").TemplateOut>;
7
+ create(data: any): Promise<import("@extrahorizon/javascript-sdk").TemplateOut>;
8
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TemplateService = void 0;
4
+ class TemplateService {
5
+ constructor(sdk) {
6
+ this.sdk = sdk;
7
+ }
8
+ async byName(name) {
9
+ return this.sdk.templates.findByName(name);
10
+ }
11
+ async update(name, data) {
12
+ return this.sdk.templates.update(name, data);
13
+ }
14
+ async create(data) {
15
+ return this.sdk.templates.create(data);
16
+ }
17
+ }
18
+ exports.TemplateService = TemplateService;
@@ -0,0 +1,2 @@
1
+ import { TemplateService } from './templateService';
2
+ export declare function uploadTemplate(service: TemplateService, template: any): Promise<void>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uploadTemplate = void 0;
4
+ async function uploadTemplate(service, template) {
5
+ const existingTemplate = await service.byName(template.name);
6
+ try {
7
+ if (!existingTemplate) {
8
+ console.log(`Creating new template '${template.name}'`);
9
+ await service.create(template);
10
+ }
11
+ else {
12
+ console.log(`Updating existing template '${template.name}'`);
13
+ await service.update(existingTemplate.id, template);
14
+ }
15
+ }
16
+ catch (err) {
17
+ throw new Error(`Error creating or updating template: ${JSON.stringify(err.response)}`);
18
+ }
19
+ }
20
+ exports.uploadTemplate = uploadTemplate;
@@ -0,0 +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;
@@ -0,0 +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;
@@ -0,0 +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;
@@ -0,0 +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;
@@ -0,0 +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
+ };
@@ -0,0 +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
+ };
package/build/exh.d.ts ADDED
@@ -0,0 +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>;
package/build/exh.js ADDED
@@ -0,0 +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;
@@ -0,0 +1,2 @@
1
+ export declare class CommandError extends Error {
2
+ }
@@ -0,0 +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;
@@ -0,0 +1,2 @@
1
+ export declare const REPO_CONFIG_FILE = "repo-config.json";
2
+ export declare function getRepoConfig(targetPath: string, validate: boolean): Promise<any>;
@@ -0,0 +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;
@@ -0,0 +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>;
@@ -0,0 +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;
@@ -0,0 +1,2 @@
1
+ #! /usr/bin/env node
2
+ export {};
package/build/index.js ADDED
@@ -0,0 +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();
@@ -0,0 +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>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeAction = exports.updateAction = exports.createAction = exports.remove = exports.update = exports.findAll = exports.create = void 0;
4
+ async function create(sdk, data) {
5
+ return await sdk.dispatchers.create(data);
6
+ }
7
+ exports.create = create;
8
+ async function findAll(sdk, rql) {
9
+ return await sdk.dispatchers.findAll({ rql });
10
+ }
11
+ exports.findAll = findAll;
12
+ async function update(sdk, dispatcherId, data) {
13
+ return await sdk.dispatchers.update(dispatcherId, data);
14
+ }
15
+ exports.update = update;
16
+ async function remove(sdk, dispatcherId) {
17
+ return await sdk.dispatchers.remove(dispatcherId);
18
+ }
19
+ exports.remove = remove;
20
+ async function createAction(sdk, dispatcherId, data) {
21
+ return await sdk.dispatchers.actions.create(dispatcherId, data);
22
+ }
23
+ exports.createAction = createAction;
24
+ async function updateAction(sdk, dispatcherId, actionId, data) {
25
+ return await sdk.dispatchers.actions.update(dispatcherId, actionId, data);
26
+ }
27
+ exports.updateAction = updateAction;
28
+ async function removeAction(sdk, dispatcherId, actionId) {
29
+ return await sdk.dispatchers.actions.remove(dispatcherId, actionId);
30
+ }
31
+ exports.removeAction = removeAction;
@@ -0,0 +1,24 @@
1
+ import { OAuth1Client } from '@extrahorizon/javascript-sdk';
2
+ import { permissionModes } from '../commands/tasks/taskConfig';
3
+ export interface FunctionCreation {
4
+ name: string;
5
+ description: string;
6
+ entryPoint: string;
7
+ code: string;
8
+ runtime: string;
9
+ timeLimit?: number;
10
+ memoryLimit?: number;
11
+ environmentVariables?: Record<string, any>;
12
+ executionOptions?: {
13
+ permissionMode: permissionModes;
14
+ };
15
+ retryPolicy?: {
16
+ enabled: boolean;
17
+ errorsToRetry: string[];
18
+ };
19
+ }
20
+ export declare function find(sdk: OAuth1Client): Promise<any>;
21
+ export declare function findByName(sdk: OAuth1Client, name: string): Promise<any>;
22
+ export declare function create(sdk: OAuth1Client, data: FunctionCreation): Promise<any>;
23
+ export declare function update(sdk: OAuth1Client, data: FunctionCreation): Promise<any>;
24
+ export declare function remove(sdk: OAuth1Client, name: string): Promise<any>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.remove = exports.update = exports.create = exports.findByName = exports.find = void 0;
4
+ async function find(sdk) {
5
+ const response = await sdk.raw.get('/tasks/v1/functions');
6
+ return response.data.data;
7
+ }
8
+ exports.find = find;
9
+ async function findByName(sdk, name) {
10
+ const response = await sdk.raw.get(`/tasks/v1/functions/${name}`);
11
+ return response.data;
12
+ }
13
+ exports.findByName = findByName;
14
+ async function create(sdk, data) {
15
+ const response = await sdk.raw.post('/tasks/v1/functions', data);
16
+ return response.data;
17
+ }
18
+ exports.create = create;
19
+ async function update(sdk, data) {
20
+ const response = await sdk.raw.put(`/tasks/v1/functions/${data.name}`, data);
21
+ return response.data;
22
+ }
23
+ exports.update = update;
24
+ async function remove(sdk, name) {
25
+ const response = await sdk.raw.delete(`/tasks/v1/functions/${name}`);
26
+ return response.data;
27
+ }
28
+ exports.remove = remove;
@@ -0,0 +1,44 @@
1
+ import { OAuth1Client, ObjectId } from '@extrahorizon/javascript-sdk';
2
+ interface Transition {
3
+ name: string;
4
+ type: string;
5
+ fromStatuses: string[];
6
+ toStatus: string;
7
+ conditions: {
8
+ type: string;
9
+ };
10
+ actions: {
11
+ type: string;
12
+ };
13
+ afterActions: {
14
+ type: string;
15
+ };
16
+ }
17
+ export declare function remove(sdk: OAuth1Client, schemaId: ObjectId): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
18
+ export declare function disable(sdk: OAuth1Client, schemaId: ObjectId): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
19
+ export declare function fetchSchemaByName(sdk: OAuth1Client, name: string): Promise<import("@extrahorizon/javascript-sdk").Schema>;
20
+ export declare function createSchema(sdk: OAuth1Client, name: string, description: string): Promise<import("@extrahorizon/javascript-sdk").Schema>;
21
+ export declare function updateSchema(sdk: OAuth1Client, id: string, data: any): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
22
+ export declare function createProperty(sdk: OAuth1Client, id: string, data: {
23
+ name: string;
24
+ configuration: {
25
+ type: string;
26
+ };
27
+ }): Promise<any>;
28
+ export declare function updateProperty(sdk: OAuth1Client, id: string, path: string, data: {
29
+ name: string;
30
+ configuration: {
31
+ type: string;
32
+ };
33
+ }): Promise<any>;
34
+ export declare function deleteProperty(sdk: OAuth1Client, id: string, path: string): Promise<any>;
35
+ export declare function createStatus(sdk: OAuth1Client, id: string, name: string, data: object): Promise<any>;
36
+ export declare function updateStatus(sdk: OAuth1Client, id: string, name: string, data: object): Promise<any>;
37
+ export declare function deleteStatus(sdk: OAuth1Client, id: string, name: string): Promise<any>;
38
+ export declare function updateCreationTransition(sdk: OAuth1Client, id: string, data: Transition): Promise<any>;
39
+ export declare function createTransition(sdk: OAuth1Client, id: string, data: Transition): Promise<any>;
40
+ export declare function updateTransition(sdk: OAuth1Client, schemaId: string, transitionId: string, data: Transition): Promise<any>;
41
+ export declare function deleteTransition(sdk: OAuth1Client, schemaId: string, transitionId: string): Promise<any>;
42
+ export declare function createIndex(sdk: OAuth1Client, schemaId: string, index: any): Promise<any>;
43
+ export declare function deleteIndex(sdk: OAuth1Client, schemaId: string, indexId: string): Promise<any>;
44
+ export {};