@amaster.ai/runtime-cli 1.1.13 → 1.1.14-beta.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.
- package/README.md +29 -0
- package/dist/cli.cjs +398 -220
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +398 -220
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +398 -220
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +398 -220
- package/dist/index.js.map +1 -1
- package/dist/skill/SKILL.md +29 -0
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var path = require('path');
|
|
|
6
6
|
var os = require('os');
|
|
7
7
|
var url = require('url');
|
|
8
8
|
var commander = require('commander');
|
|
9
|
-
var
|
|
9
|
+
var chalk4 = require('chalk');
|
|
10
10
|
var client = require('@amaster.ai/client');
|
|
11
11
|
var ora = require('ora');
|
|
12
12
|
var buffer = require('buffer');
|
|
@@ -15,7 +15,7 @@ var yaml = require('yaml');
|
|
|
15
15
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
16
16
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var chalk4__default = /*#__PURE__*/_interopDefault(chalk4);
|
|
19
19
|
var ora__default = /*#__PURE__*/_interopDefault(ora);
|
|
20
20
|
var yaml__default = /*#__PURE__*/_interopDefault(yaml);
|
|
21
21
|
|
|
@@ -336,9 +336,9 @@ async function login(appCode, options) {
|
|
|
336
336
|
const appConfig = getAppConfig(appCode);
|
|
337
337
|
if (!appConfig) {
|
|
338
338
|
spinner.fail(`App not configured: ${appCode}`);
|
|
339
|
-
console.error(
|
|
339
|
+
console.error(chalk4__default.default.red(`
|
|
340
340
|
\u274C App not found: ${appCode}`));
|
|
341
|
-
console.log(
|
|
341
|
+
console.log(chalk4__default.default.yellow(`Initialize it first: amaster init --app-code ${appCode} --url <url>`));
|
|
342
342
|
process.exit(1);
|
|
343
343
|
}
|
|
344
344
|
let username = options.username;
|
|
@@ -387,7 +387,7 @@ async function login(appCode, options) {
|
|
|
387
387
|
const result = await client$1.auth.login(loginParams);
|
|
388
388
|
if (result.error) {
|
|
389
389
|
spinner.fail("Login failed");
|
|
390
|
-
console.error(
|
|
390
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
391
391
|
process.exit(1);
|
|
392
392
|
}
|
|
393
393
|
const loginData = result.data;
|
|
@@ -421,16 +421,16 @@ async function login(appCode, options) {
|
|
|
421
421
|
format: options.format,
|
|
422
422
|
pretty: () => {
|
|
423
423
|
console.log(
|
|
424
|
-
|
|
424
|
+
chalk4__default.default.green(
|
|
425
425
|
`
|
|
426
426
|
Welcome, ${loginData.user?.displayName || loginData.user?.email || loginData.user?.username || email}!`
|
|
427
427
|
)
|
|
428
428
|
);
|
|
429
|
-
console.log(
|
|
430
|
-
console.log(
|
|
429
|
+
console.log(chalk4__default.default.gray(`App: ${appCode}`));
|
|
430
|
+
console.log(chalk4__default.default.gray(`URL: ${appConfig.baseURL}`));
|
|
431
431
|
if (expiresAt) {
|
|
432
432
|
const expires = new Date(expiresAt);
|
|
433
|
-
console.log(
|
|
433
|
+
console.log(chalk4__default.default.gray(`Session expires: ${expires.toLocaleString()}`));
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
}
|
|
@@ -466,7 +466,7 @@ async function logout(appCode, options = {}) {
|
|
|
466
466
|
{
|
|
467
467
|
format: options.format,
|
|
468
468
|
pretty: () => {
|
|
469
|
-
console.log(
|
|
469
|
+
console.log(chalk4__default.default.green(`Logged out from ${appCode}`));
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
);
|
|
@@ -482,7 +482,7 @@ async function getMe(getClient, options = {}) {
|
|
|
482
482
|
const result = await client.auth.getMe();
|
|
483
483
|
if (result.error) {
|
|
484
484
|
spinner.fail("Failed to fetch user info");
|
|
485
|
-
console.error(
|
|
485
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
486
486
|
process.exit(1);
|
|
487
487
|
}
|
|
488
488
|
spinner.succeed("User info retrieved");
|
|
@@ -490,11 +490,11 @@ async function getMe(getClient, options = {}) {
|
|
|
490
490
|
renderOutput(user, {
|
|
491
491
|
format: options.format,
|
|
492
492
|
pretty: () => {
|
|
493
|
-
console.log(
|
|
494
|
-
console.log(` ${
|
|
495
|
-
console.log(` ${
|
|
496
|
-
console.log(` ${
|
|
497
|
-
console.log(` ${
|
|
493
|
+
console.log(chalk4__default.default.blue("\n\u{1F464} User Profile\n"));
|
|
494
|
+
console.log(` ${chalk4__default.default.bold("UID:")} ${user?.uid}`);
|
|
495
|
+
console.log(` ${chalk4__default.default.bold("Email:")} ${user?.email}`);
|
|
496
|
+
console.log(` ${chalk4__default.default.bold("Name:")} ${user?.displayName || user?.username || "N/A"}`);
|
|
497
|
+
console.log(` ${chalk4__default.default.bold("Status:")} ${user?.isActive ? "Active" : "Inactive"}`);
|
|
498
498
|
}
|
|
499
499
|
});
|
|
500
500
|
} catch (error) {
|
|
@@ -624,7 +624,7 @@ function exitWithCommandError(spinner, failureMessage, error) {
|
|
|
624
624
|
spinner.fail(failureMessage);
|
|
625
625
|
const details = error instanceof Error ? error.message : String(error);
|
|
626
626
|
if (details) {
|
|
627
|
-
console.error(
|
|
627
|
+
console.error(chalk4__default.default.red(details));
|
|
628
628
|
}
|
|
629
629
|
process.exit(1);
|
|
630
630
|
}
|
|
@@ -689,7 +689,7 @@ async function listEntities(client, options) {
|
|
|
689
689
|
});
|
|
690
690
|
if (result.error) {
|
|
691
691
|
spinner.fail("Failed to fetch entities");
|
|
692
|
-
console.error(
|
|
692
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
693
693
|
process.exit(1);
|
|
694
694
|
}
|
|
695
695
|
spinner.stop();
|
|
@@ -709,12 +709,12 @@ async function listEntities(client, options) {
|
|
|
709
709
|
renderOutput(result.data, {
|
|
710
710
|
format: options.format,
|
|
711
711
|
pretty: () => {
|
|
712
|
-
console.log(
|
|
712
|
+
console.log(chalk4__default.default.blue(`
|
|
713
713
|
\u{1F4E6} ${options.entity} in ${options.namespace}`));
|
|
714
|
-
console.log(
|
|
714
|
+
console.log(chalk4__default.default.gray(`\u5171 ${total} \u6761\u8BB0\u5F55:
|
|
715
715
|
`));
|
|
716
716
|
if (items.length === 0) {
|
|
717
|
-
console.log(
|
|
717
|
+
console.log(chalk4__default.default.gray(" \u6682\u65E0\u6570\u636E"));
|
|
718
718
|
return;
|
|
719
719
|
}
|
|
720
720
|
const firstItem = items[0];
|
|
@@ -734,7 +734,7 @@ async function listEntities(client, options) {
|
|
|
734
734
|
});
|
|
735
735
|
const headerLine = keys.map((key) => {
|
|
736
736
|
const width = widths[key] ?? 0;
|
|
737
|
-
return
|
|
737
|
+
return chalk4__default.default.bold(key.slice(0, width).padEnd(width));
|
|
738
738
|
}).join("\u2502");
|
|
739
739
|
console.log(" " + headerLine);
|
|
740
740
|
console.log(" " + keys.map((key) => "\u2500".repeat(widths[key] ?? 0)).join("\u253C"));
|
|
@@ -750,7 +750,7 @@ async function listEntities(client, options) {
|
|
|
750
750
|
}
|
|
751
751
|
console.log();
|
|
752
752
|
if (items.length < total) {
|
|
753
|
-
console.log(
|
|
753
|
+
console.log(chalk4__default.default.gray(` ... \u8FD8\u6709 ${total - items.length} \u6761\u8BB0\u5F55`));
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
756
|
});
|
|
@@ -765,14 +765,14 @@ async function getEntity(client, options) {
|
|
|
765
765
|
const result = await entityClient.get(options.namespace, options.entity, options.id);
|
|
766
766
|
if (result.error) {
|
|
767
767
|
spinner.fail("Failed to fetch entity");
|
|
768
|
-
console.error(
|
|
768
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
769
769
|
process.exit(1);
|
|
770
770
|
}
|
|
771
771
|
spinner.succeed("Entity retrieved");
|
|
772
772
|
renderOutput(result.data, {
|
|
773
773
|
format: options.format,
|
|
774
774
|
pretty: () => {
|
|
775
|
-
console.log(
|
|
775
|
+
console.log(chalk4__default.default.blue(`
|
|
776
776
|
\u{1F4C4} ${options.entity}
|
|
777
777
|
`));
|
|
778
778
|
console.log(JSON.stringify(result.data, null, 2));
|
|
@@ -790,14 +790,14 @@ async function createEntity(client, options) {
|
|
|
790
790
|
const result = await entityClient.create(options.namespace, options.entity, data);
|
|
791
791
|
if (result.error) {
|
|
792
792
|
spinner.fail("Failed to create entity");
|
|
793
|
-
console.error(
|
|
793
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
794
794
|
process.exit(1);
|
|
795
795
|
}
|
|
796
796
|
spinner.succeed("Entity created");
|
|
797
797
|
renderOutput(result.data, {
|
|
798
798
|
format: options.format,
|
|
799
799
|
pretty: () => {
|
|
800
|
-
console.log(
|
|
800
|
+
console.log(chalk4__default.default.green("\nCreated entity:"));
|
|
801
801
|
console.log(JSON.stringify(result.data, null, 2));
|
|
802
802
|
}
|
|
803
803
|
});
|
|
@@ -813,14 +813,14 @@ async function updateEntity(client, options) {
|
|
|
813
813
|
const result = await entityClient.update(options.namespace, options.entity, options.id, data);
|
|
814
814
|
if (result.error) {
|
|
815
815
|
spinner.fail("Failed to update entity");
|
|
816
|
-
console.error(
|
|
816
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
817
817
|
process.exit(1);
|
|
818
818
|
}
|
|
819
819
|
spinner.succeed("Entity updated");
|
|
820
820
|
renderOutput(result.data, {
|
|
821
821
|
format: options.format,
|
|
822
822
|
pretty: () => {
|
|
823
|
-
console.log(
|
|
823
|
+
console.log(chalk4__default.default.green("\nUpdated entity:"));
|
|
824
824
|
console.log(JSON.stringify(result.data, null, 2));
|
|
825
825
|
}
|
|
826
826
|
});
|
|
@@ -835,7 +835,7 @@ async function deleteEntity(client, options) {
|
|
|
835
835
|
const result = await entityClient.delete(options.namespace, options.entity, options.id);
|
|
836
836
|
if (result.error) {
|
|
837
837
|
spinner.fail("Failed to delete entity");
|
|
838
|
-
console.error(
|
|
838
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
839
839
|
process.exit(1);
|
|
840
840
|
}
|
|
841
841
|
spinner.succeed("Entity deleted");
|
|
@@ -849,7 +849,7 @@ async function deleteEntity(client, options) {
|
|
|
849
849
|
{
|
|
850
850
|
format: options.format,
|
|
851
851
|
pretty: () => {
|
|
852
|
-
console.log(
|
|
852
|
+
console.log(chalk4__default.default.green(`
|
|
853
853
|
Deleted ${options.entity} with ID: ${options.id}`));
|
|
854
854
|
}
|
|
855
855
|
}
|
|
@@ -866,14 +866,14 @@ async function listEntityOptions(client, options) {
|
|
|
866
866
|
const result = await entityClient.options(options.namespace, options.entity, fields);
|
|
867
867
|
if (result.error) {
|
|
868
868
|
spinner.fail("Failed to fetch entity options");
|
|
869
|
-
console.error(
|
|
869
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
870
870
|
process.exit(1);
|
|
871
871
|
}
|
|
872
872
|
spinner.succeed(`Found ${result.data?.length || 0} options`);
|
|
873
873
|
renderOutput(result.data || [], {
|
|
874
874
|
format: options.format,
|
|
875
875
|
pretty: () => {
|
|
876
|
-
console.log(
|
|
876
|
+
console.log(chalk4__default.default.blue(`
|
|
877
877
|
\u{1F9FE} ${options.entity} options
|
|
878
878
|
`));
|
|
879
879
|
console.log(JSON.stringify(result.data || [], null, 2));
|
|
@@ -896,14 +896,14 @@ async function bulkUpdateEntities(client, options) {
|
|
|
896
896
|
const result = await entityClient.bulkUpdate(options.namespace, options.entity, items);
|
|
897
897
|
if (result.error) {
|
|
898
898
|
spinner.fail("Failed to bulk update entities");
|
|
899
|
-
console.error(
|
|
899
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
900
900
|
process.exit(1);
|
|
901
901
|
}
|
|
902
902
|
spinner.succeed(`Updated ${items.length} entities`);
|
|
903
903
|
renderOutput(result.data, {
|
|
904
904
|
format: options.format,
|
|
905
905
|
pretty: () => {
|
|
906
|
-
console.log(
|
|
906
|
+
console.log(chalk4__default.default.green(`
|
|
907
907
|
Bulk updated ${items.length} ${options.entity} records:`));
|
|
908
908
|
console.log(JSON.stringify(result.data, null, 2));
|
|
909
909
|
}
|
|
@@ -920,7 +920,7 @@ async function bulkDeleteEntities(client, options) {
|
|
|
920
920
|
const result = await entityClient.bulkDelete(options.namespace, options.entity, ids);
|
|
921
921
|
if (result.error) {
|
|
922
922
|
spinner.fail("Failed to bulk delete entities");
|
|
923
|
-
console.error(
|
|
923
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
924
924
|
process.exit(1);
|
|
925
925
|
}
|
|
926
926
|
spinner.succeed(`Deleted ${ids.length} entities`);
|
|
@@ -935,7 +935,7 @@ async function bulkDeleteEntities(client, options) {
|
|
|
935
935
|
{
|
|
936
936
|
format: options.format,
|
|
937
937
|
pretty: () => {
|
|
938
|
-
console.log(
|
|
938
|
+
console.log(chalk4__default.default.green(`
|
|
939
939
|
Deleted ${ids.length} ${options.entity} records.`));
|
|
940
940
|
}
|
|
941
941
|
}
|
|
@@ -944,10 +944,165 @@ Deleted ${ids.length} ${options.entity} records.`));
|
|
|
944
944
|
exitWithCommandError(spinner, "Failed to bulk delete entities", error);
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
|
+
function resolveInputSource2(input) {
|
|
948
|
+
if (!input.startsWith("@")) {
|
|
949
|
+
return input;
|
|
950
|
+
}
|
|
951
|
+
const filePath = input.slice(1);
|
|
952
|
+
if (!filePath) {
|
|
953
|
+
throw new Error("File path is required after '@'.");
|
|
954
|
+
}
|
|
955
|
+
return fs.readFileSync(filePath, "utf8");
|
|
956
|
+
}
|
|
957
|
+
function exitWithCommandError2(spinner, failureMessage, error) {
|
|
958
|
+
spinner.fail(failureMessage);
|
|
959
|
+
const details = error instanceof Error ? error.message : String(error);
|
|
960
|
+
if (details) {
|
|
961
|
+
console.error(chalk4__default.default.red(details));
|
|
962
|
+
}
|
|
963
|
+
process.exit(1);
|
|
964
|
+
}
|
|
965
|
+
function parseTableNamesInput(input) {
|
|
966
|
+
if (!input) {
|
|
967
|
+
return void 0;
|
|
968
|
+
}
|
|
969
|
+
const source = resolveInputSource2(input).trim();
|
|
970
|
+
if (!source) {
|
|
971
|
+
return void 0;
|
|
972
|
+
}
|
|
973
|
+
if (source.startsWith("[")) {
|
|
974
|
+
let parsed;
|
|
975
|
+
try {
|
|
976
|
+
parsed = JSON.parse(source);
|
|
977
|
+
} catch (error) {
|
|
978
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
979
|
+
throw new Error(`Invalid table list: ${reason}`);
|
|
980
|
+
}
|
|
981
|
+
if (!Array.isArray(parsed)) {
|
|
982
|
+
throw new Error("Table list must be a JSON array.");
|
|
983
|
+
}
|
|
984
|
+
return parsed.map((value, index) => {
|
|
985
|
+
if (typeof value !== "string") {
|
|
986
|
+
throw new Error(`Table name at index ${index} must be a string.`);
|
|
987
|
+
}
|
|
988
|
+
return value;
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
const values = source.split(/[,\n]/).map((entry) => entry.trim()).filter(Boolean);
|
|
992
|
+
return values.length > 0 ? values : void 0;
|
|
993
|
+
}
|
|
994
|
+
async function listDatasources(client, options = {}) {
|
|
995
|
+
const spinner = createSpinner("Fetching datasources...", options.format);
|
|
996
|
+
try {
|
|
997
|
+
const result = await client.http.request({
|
|
998
|
+
url: "/api/entity/source/list_with_models",
|
|
999
|
+
method: "GET"
|
|
1000
|
+
});
|
|
1001
|
+
if (result.error) {
|
|
1002
|
+
spinner.fail("Failed to fetch datasources");
|
|
1003
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1004
|
+
process.exit(1);
|
|
1005
|
+
}
|
|
1006
|
+
const datasources = result.data || [];
|
|
1007
|
+
spinner.succeed(`Found ${datasources.length} datasource${datasources.length === 1 ? "" : "s"}`);
|
|
1008
|
+
renderOutput(datasources, {
|
|
1009
|
+
format: options.format,
|
|
1010
|
+
tableRows: datasources.map((source) => ({
|
|
1011
|
+
sourceId: source.sourceId,
|
|
1012
|
+
name: source.name,
|
|
1013
|
+
systemBuilt: source.systemBuilt,
|
|
1014
|
+
synchronizeMode: source.synchronizeMode,
|
|
1015
|
+
modelCount: source.models?.length || 0
|
|
1016
|
+
})),
|
|
1017
|
+
csvRows: datasources.map((source) => ({
|
|
1018
|
+
sourceId: source.sourceId,
|
|
1019
|
+
name: source.name,
|
|
1020
|
+
systemBuilt: source.systemBuilt,
|
|
1021
|
+
synchronizeMode: source.synchronizeMode,
|
|
1022
|
+
modelCount: source.models?.length || 0
|
|
1023
|
+
})),
|
|
1024
|
+
ndjsonItems: datasources,
|
|
1025
|
+
pretty: () => {
|
|
1026
|
+
console.log(chalk4__default.default.blue("\nData Sources\n"));
|
|
1027
|
+
if (datasources.length === 0) {
|
|
1028
|
+
console.log(chalk4__default.default.gray("No datasources found."));
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
for (const source of datasources) {
|
|
1032
|
+
console.log(`${chalk4__default.default.green("\u2022")} ${chalk4__default.default.bold(source.name)} ${chalk4__default.default.gray(`(${source.sourceId})`)}`);
|
|
1033
|
+
console.log(` ${chalk4__default.default.gray("System Built:")} ${source.systemBuilt}`);
|
|
1034
|
+
console.log(` ${chalk4__default.default.gray("Sync Mode:")} ${source.synchronizeMode}`);
|
|
1035
|
+
if (!source.models || source.models.length === 0) {
|
|
1036
|
+
console.log(` ${chalk4__default.default.gray("Models:")} none`);
|
|
1037
|
+
continue;
|
|
1038
|
+
}
|
|
1039
|
+
console.log(` ${chalk4__default.default.gray("Models:")}`);
|
|
1040
|
+
for (const model of source.models) {
|
|
1041
|
+
const suffix = model.description ? ` ${chalk4__default.default.gray(`- ${model.description}`)}` : "";
|
|
1042
|
+
console.log(` - ${chalk4__default.default.bold(model.tableName)} ${chalk4__default.default.gray(`(${model.modelId})`)}${suffix}`);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1047
|
+
} catch (error) {
|
|
1048
|
+
exitWithCommandError2(spinner, "Failed to fetch datasources", error);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
async function getTableSchema(client, options) {
|
|
1052
|
+
const spinner = createSpinner(`Fetching table schema for ${options.sourceId}...`, options.format);
|
|
1053
|
+
try {
|
|
1054
|
+
const tableNames = parseTableNamesInput(options.tables);
|
|
1055
|
+
const search = new URLSearchParams();
|
|
1056
|
+
if (tableNames && tableNames.length > 0) {
|
|
1057
|
+
search.set("tableNames", tableNames.join(","));
|
|
1058
|
+
}
|
|
1059
|
+
const query = search.toString();
|
|
1060
|
+
const url = `/api/entity/source/${encodeURIComponent(options.sourceId)}/create_table_statements${query ? `?${query}` : ""}`;
|
|
1061
|
+
const result = await client.http.request({
|
|
1062
|
+
url,
|
|
1063
|
+
method: "GET"
|
|
1064
|
+
});
|
|
1065
|
+
if (result.error) {
|
|
1066
|
+
spinner.fail("Failed to fetch table schema");
|
|
1067
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1068
|
+
process.exit(1);
|
|
1069
|
+
}
|
|
1070
|
+
const tables = result.data || [];
|
|
1071
|
+
spinner.succeed(`Fetched schema for ${tables.length} table${tables.length === 1 ? "" : "s"}`);
|
|
1072
|
+
renderOutput(tables, {
|
|
1073
|
+
format: options.format,
|
|
1074
|
+
tableRows: tables.map((table) => ({
|
|
1075
|
+
tableName: table.tableName,
|
|
1076
|
+
createTableSql: table.createTableSql
|
|
1077
|
+
})),
|
|
1078
|
+
csvRows: tables.map((table) => ({
|
|
1079
|
+
tableName: table.tableName,
|
|
1080
|
+
createTableSql: table.createTableSql
|
|
1081
|
+
})),
|
|
1082
|
+
ndjsonItems: tables,
|
|
1083
|
+
pretty: () => {
|
|
1084
|
+
console.log(chalk4__default.default.blue(`
|
|
1085
|
+
Table Schemas: ${options.sourceId}
|
|
1086
|
+
`));
|
|
1087
|
+
if (tables.length === 0) {
|
|
1088
|
+
console.log(chalk4__default.default.gray("No tables found."));
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
for (const table of tables) {
|
|
1092
|
+
console.log(chalk4__default.default.green(table.tableName));
|
|
1093
|
+
console.log(table.createTableSql);
|
|
1094
|
+
console.log();
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
});
|
|
1098
|
+
} catch (error) {
|
|
1099
|
+
exitWithCommandError2(spinner, "Failed to fetch table schema", error);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
947
1102
|
function isPlainObject3(value) {
|
|
948
1103
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
949
1104
|
}
|
|
950
|
-
function
|
|
1105
|
+
function resolveInputSource3(input) {
|
|
951
1106
|
if (!input.startsWith("@")) {
|
|
952
1107
|
return input;
|
|
953
1108
|
}
|
|
@@ -958,7 +1113,7 @@ function resolveInputSource2(input) {
|
|
|
958
1113
|
return fs.readFileSync(filePath, "utf8");
|
|
959
1114
|
}
|
|
960
1115
|
function parseJsonInput2(input, label) {
|
|
961
|
-
const source =
|
|
1116
|
+
const source = resolveInputSource3(input).trim();
|
|
962
1117
|
if (!source) {
|
|
963
1118
|
throw new Error(`${label} is required.`);
|
|
964
1119
|
}
|
|
@@ -999,11 +1154,11 @@ function loadOptionalJsonObjectInput2(input, label) {
|
|
|
999
1154
|
}
|
|
1000
1155
|
return value;
|
|
1001
1156
|
}
|
|
1002
|
-
function
|
|
1157
|
+
function exitWithCommandError3(spinner, failureMessage, error) {
|
|
1003
1158
|
spinner.fail(failureMessage);
|
|
1004
1159
|
const details = error instanceof Error ? error.message : String(error);
|
|
1005
1160
|
if (details) {
|
|
1006
|
-
console.error(
|
|
1161
|
+
console.error(chalk4__default.default.red(details));
|
|
1007
1162
|
}
|
|
1008
1163
|
process.exit(1);
|
|
1009
1164
|
}
|
|
@@ -1012,7 +1167,7 @@ function extractClientErrorMessage(error) {
|
|
|
1012
1167
|
}
|
|
1013
1168
|
function exitWithClientError(spinner, failureMessage, error, diagnosticMessage) {
|
|
1014
1169
|
spinner.fail(failureMessage);
|
|
1015
|
-
console.error(
|
|
1170
|
+
console.error(chalk4__default.default.red(diagnosticMessage || extractClientErrorMessage(error)));
|
|
1016
1171
|
process.exit(1);
|
|
1017
1172
|
}
|
|
1018
1173
|
function inspectStartEventFormConfiguration(bpmnXml) {
|
|
@@ -1193,7 +1348,7 @@ async function listProcesses(client, options = {}) {
|
|
|
1193
1348
|
const result = await bpmClient.getProcessDefinitions(params);
|
|
1194
1349
|
if (result.error) {
|
|
1195
1350
|
spinner.fail("Failed to fetch processes");
|
|
1196
|
-
console.error(
|
|
1351
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1197
1352
|
process.exit(1);
|
|
1198
1353
|
}
|
|
1199
1354
|
spinner.succeed(`Found ${result.data?.length || 0} process definitions`);
|
|
@@ -1201,19 +1356,19 @@ async function listProcesses(client, options = {}) {
|
|
|
1201
1356
|
renderOutput(processes, {
|
|
1202
1357
|
format: options.format,
|
|
1203
1358
|
pretty: () => {
|
|
1204
|
-
console.log(
|
|
1359
|
+
console.log(chalk4__default.default.blue("\n\u{1F4CA} Process Definitions\n"));
|
|
1205
1360
|
for (const proc of processes) {
|
|
1206
|
-
console.log(` ${
|
|
1207
|
-
console.log(` ${
|
|
1208
|
-
console.log(` ${
|
|
1209
|
-
console.log(` ${
|
|
1210
|
-
console.log(` ${
|
|
1361
|
+
console.log(` ${chalk4__default.default.green("\u2022")} ${chalk4__default.default.bold(proc.key)}`);
|
|
1362
|
+
console.log(` ${chalk4__default.default.gray("ID:")} ${proc.id || "N/A"}`);
|
|
1363
|
+
console.log(` ${chalk4__default.default.gray("Name:")} ${proc.name || "N/A"}`);
|
|
1364
|
+
console.log(` ${chalk4__default.default.gray("Version:")} ${proc.version || "N/A"}`);
|
|
1365
|
+
console.log(` ${chalk4__default.default.gray("Suspended:")} ${proc.suspended ? "Yes" : "No"}`);
|
|
1211
1366
|
console.log();
|
|
1212
1367
|
}
|
|
1213
1368
|
}
|
|
1214
1369
|
});
|
|
1215
1370
|
} catch (error) {
|
|
1216
|
-
|
|
1371
|
+
exitWithCommandError3(spinner, "Failed to fetch processes", error);
|
|
1217
1372
|
}
|
|
1218
1373
|
}
|
|
1219
1374
|
async function getProcessXml(client, options) {
|
|
@@ -1223,21 +1378,21 @@ async function getProcessXml(client, options) {
|
|
|
1223
1378
|
const result = await bpmClient.getProcessXml(options.key);
|
|
1224
1379
|
if (result.error) {
|
|
1225
1380
|
spinner.fail("Failed to fetch process XML");
|
|
1226
|
-
console.error(
|
|
1381
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1227
1382
|
process.exit(1);
|
|
1228
1383
|
}
|
|
1229
1384
|
spinner.succeed("Process XML retrieved");
|
|
1230
1385
|
renderOutput(result.data, {
|
|
1231
1386
|
format: options.format,
|
|
1232
1387
|
pretty: () => {
|
|
1233
|
-
console.log(
|
|
1388
|
+
console.log(chalk4__default.default.blue(`
|
|
1234
1389
|
\u{1F4C4} BPMN XML: ${options.key}
|
|
1235
1390
|
`));
|
|
1236
1391
|
console.log(result.data?.bpmn20Xml || "");
|
|
1237
1392
|
}
|
|
1238
1393
|
});
|
|
1239
1394
|
} catch (error) {
|
|
1240
|
-
|
|
1395
|
+
exitWithCommandError3(spinner, "Failed to fetch process XML", error);
|
|
1241
1396
|
}
|
|
1242
1397
|
}
|
|
1243
1398
|
async function startProcess(client, options) {
|
|
@@ -1248,22 +1403,22 @@ async function startProcess(client, options) {
|
|
|
1248
1403
|
const result = await bpmClient.startProcess(options.key, variables);
|
|
1249
1404
|
if (result.error) {
|
|
1250
1405
|
spinner.fail("Failed to start process");
|
|
1251
|
-
console.error(
|
|
1406
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1252
1407
|
process.exit(1);
|
|
1253
1408
|
}
|
|
1254
1409
|
spinner.succeed("Process started");
|
|
1255
1410
|
renderOutput(result.data, {
|
|
1256
1411
|
format: options.format,
|
|
1257
1412
|
pretty: () => {
|
|
1258
|
-
console.log(
|
|
1259
|
-
console.log(` ${
|
|
1260
|
-
console.log(` ${
|
|
1261
|
-
console.log(` ${
|
|
1262
|
-
console.log(` ${
|
|
1413
|
+
console.log(chalk4__default.default.green("\nProcess Instance:"));
|
|
1414
|
+
console.log(` ${chalk4__default.default.bold("ID:")} ${result.data?.id}`);
|
|
1415
|
+
console.log(` ${chalk4__default.default.bold("Definition ID:")} ${result.data?.definitionId}`);
|
|
1416
|
+
console.log(` ${chalk4__default.default.bold("Business Key:")} ${result.data?.businessKey || "N/A"}`);
|
|
1417
|
+
console.log(` ${chalk4__default.default.bold("Status:")} ${result.data?.suspended ? "Suspended" : "Active"}`);
|
|
1263
1418
|
}
|
|
1264
1419
|
});
|
|
1265
1420
|
} catch (error) {
|
|
1266
|
-
|
|
1421
|
+
exitWithCommandError3(spinner, "Failed to start process", error);
|
|
1267
1422
|
}
|
|
1268
1423
|
}
|
|
1269
1424
|
async function listProcessInstances(client, options = {}) {
|
|
@@ -1274,7 +1429,7 @@ async function listProcessInstances(client, options = {}) {
|
|
|
1274
1429
|
const result = await bpmClient.getProcessInstances(params);
|
|
1275
1430
|
if (result.error) {
|
|
1276
1431
|
spinner.fail("Failed to fetch process instances");
|
|
1277
|
-
console.error(
|
|
1432
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1278
1433
|
process.exit(1);
|
|
1279
1434
|
}
|
|
1280
1435
|
spinner.succeed(`Found ${result.data?.length || 0} process instances`);
|
|
@@ -1282,20 +1437,20 @@ async function listProcessInstances(client, options = {}) {
|
|
|
1282
1437
|
renderOutput(instances, {
|
|
1283
1438
|
format: options.format,
|
|
1284
1439
|
pretty: () => {
|
|
1285
|
-
console.log(
|
|
1440
|
+
console.log(chalk4__default.default.blue("\n\u{1F504} Process Instances\n"));
|
|
1286
1441
|
for (const instance of instances) {
|
|
1287
|
-
console.log(` ${
|
|
1288
|
-
console.log(` ${
|
|
1289
|
-
console.log(` ${
|
|
1442
|
+
console.log(` ${chalk4__default.default.green("\u2022")} ${chalk4__default.default.bold(instance.id)}`);
|
|
1443
|
+
console.log(` ${chalk4__default.default.gray("Definition:")} ${instance.definitionId || "N/A"}`);
|
|
1444
|
+
console.log(` ${chalk4__default.default.gray("Business Key:")} ${instance.businessKey || "N/A"}`);
|
|
1290
1445
|
console.log(
|
|
1291
|
-
` ${
|
|
1446
|
+
` ${chalk4__default.default.gray("Status:")} ${instance.ended ? "Ended" : instance.suspended ? "Suspended" : "Active"}`
|
|
1292
1447
|
);
|
|
1293
1448
|
console.log();
|
|
1294
1449
|
}
|
|
1295
1450
|
}
|
|
1296
1451
|
});
|
|
1297
1452
|
} catch (error) {
|
|
1298
|
-
|
|
1453
|
+
exitWithCommandError3(spinner, "Failed to fetch process instances", error);
|
|
1299
1454
|
}
|
|
1300
1455
|
}
|
|
1301
1456
|
async function getProcessInstance(client, options) {
|
|
@@ -1305,19 +1460,19 @@ async function getProcessInstance(client, options) {
|
|
|
1305
1460
|
const result = await bpmClient.getProcessInstance(options.id);
|
|
1306
1461
|
if (result.error) {
|
|
1307
1462
|
spinner.fail("Failed to fetch process instance");
|
|
1308
|
-
console.error(
|
|
1463
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1309
1464
|
process.exit(1);
|
|
1310
1465
|
}
|
|
1311
1466
|
spinner.succeed("Process instance retrieved");
|
|
1312
1467
|
renderOutput(result.data, {
|
|
1313
1468
|
format: options.format,
|
|
1314
1469
|
pretty: () => {
|
|
1315
|
-
console.log(
|
|
1470
|
+
console.log(chalk4__default.default.blue("\n\u{1F4CA} Process Instance\n"));
|
|
1316
1471
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1317
1472
|
}
|
|
1318
1473
|
});
|
|
1319
1474
|
} catch (error) {
|
|
1320
|
-
|
|
1475
|
+
exitWithCommandError3(spinner, "Failed to fetch process instance", error);
|
|
1321
1476
|
}
|
|
1322
1477
|
}
|
|
1323
1478
|
async function getActivityInstanceTree(client, options) {
|
|
@@ -1327,19 +1482,19 @@ async function getActivityInstanceTree(client, options) {
|
|
|
1327
1482
|
const result = await bpmClient.getActivityInstanceTree(options.id);
|
|
1328
1483
|
if (result.error) {
|
|
1329
1484
|
spinner.fail("Failed to fetch activity instance tree");
|
|
1330
|
-
console.error(
|
|
1485
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1331
1486
|
process.exit(1);
|
|
1332
1487
|
}
|
|
1333
1488
|
spinner.succeed("Activity instance tree retrieved");
|
|
1334
1489
|
renderOutput(result.data, {
|
|
1335
1490
|
format: options.format,
|
|
1336
1491
|
pretty: () => {
|
|
1337
|
-
console.log(
|
|
1492
|
+
console.log(chalk4__default.default.blue("\n\u{1F333} Activity Instance Tree\n"));
|
|
1338
1493
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1339
1494
|
}
|
|
1340
1495
|
});
|
|
1341
1496
|
} catch (error) {
|
|
1342
|
-
|
|
1497
|
+
exitWithCommandError3(spinner, "Failed to fetch activity instance tree", error);
|
|
1343
1498
|
}
|
|
1344
1499
|
}
|
|
1345
1500
|
async function getActiveActivities(client, options) {
|
|
@@ -1349,7 +1504,7 @@ async function getActiveActivities(client, options) {
|
|
|
1349
1504
|
const result = await bpmClient.getActiveActivities(options.id);
|
|
1350
1505
|
if (result.error) {
|
|
1351
1506
|
spinner.fail("Failed to fetch active activities");
|
|
1352
|
-
console.error(
|
|
1507
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1353
1508
|
process.exit(1);
|
|
1354
1509
|
}
|
|
1355
1510
|
const activities = Array.isArray(result.data) ? result.data : [];
|
|
@@ -1357,12 +1512,12 @@ async function getActiveActivities(client, options) {
|
|
|
1357
1512
|
renderOutput(result.data, {
|
|
1358
1513
|
format: options.format,
|
|
1359
1514
|
pretty: () => {
|
|
1360
|
-
console.log(
|
|
1515
|
+
console.log(chalk4__default.default.blue("\n\u26A1 Active Activities\n"));
|
|
1361
1516
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1362
1517
|
}
|
|
1363
1518
|
});
|
|
1364
1519
|
} catch (error) {
|
|
1365
|
-
|
|
1520
|
+
exitWithCommandError3(spinner, "Failed to fetch active activities", error);
|
|
1366
1521
|
}
|
|
1367
1522
|
}
|
|
1368
1523
|
async function getRuntimeVariables(client, options) {
|
|
@@ -1372,19 +1527,19 @@ async function getRuntimeVariables(client, options) {
|
|
|
1372
1527
|
const result = await bpmClient.getRuntimeVariables(options.id);
|
|
1373
1528
|
if (result.error) {
|
|
1374
1529
|
spinner.fail("Failed to fetch runtime variables");
|
|
1375
|
-
console.error(
|
|
1530
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1376
1531
|
process.exit(1);
|
|
1377
1532
|
}
|
|
1378
1533
|
spinner.succeed("Runtime variables retrieved");
|
|
1379
1534
|
renderOutput(result.data, {
|
|
1380
1535
|
format: options.format,
|
|
1381
1536
|
pretty: () => {
|
|
1382
|
-
console.log(
|
|
1537
|
+
console.log(chalk4__default.default.blue("\n\u{1F9EE} Runtime Variables\n"));
|
|
1383
1538
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1384
1539
|
}
|
|
1385
1540
|
});
|
|
1386
1541
|
} catch (error) {
|
|
1387
|
-
|
|
1542
|
+
exitWithCommandError3(spinner, "Failed to fetch runtime variables", error);
|
|
1388
1543
|
}
|
|
1389
1544
|
}
|
|
1390
1545
|
async function getProcessVariables(client, options) {
|
|
@@ -1397,19 +1552,19 @@ async function getProcessVariables(client, options) {
|
|
|
1397
1552
|
});
|
|
1398
1553
|
if (result.error) {
|
|
1399
1554
|
spinner.fail("Failed to fetch process variables");
|
|
1400
|
-
console.error(
|
|
1555
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1401
1556
|
process.exit(1);
|
|
1402
1557
|
}
|
|
1403
1558
|
spinner.succeed(`Found ${result.data?.length || 0} variables`);
|
|
1404
1559
|
renderOutput(result.data || [], {
|
|
1405
1560
|
format: options.format,
|
|
1406
1561
|
pretty: () => {
|
|
1407
|
-
console.log(
|
|
1562
|
+
console.log(chalk4__default.default.blue("\n\u{1F9FE} Process Variables\n"));
|
|
1408
1563
|
console.log(JSON.stringify(result.data || [], null, 2));
|
|
1409
1564
|
}
|
|
1410
1565
|
});
|
|
1411
1566
|
} catch (error) {
|
|
1412
|
-
|
|
1567
|
+
exitWithCommandError3(spinner, "Failed to fetch process variables", error);
|
|
1413
1568
|
}
|
|
1414
1569
|
}
|
|
1415
1570
|
async function deleteProcessInstance(client, options) {
|
|
@@ -1421,7 +1576,7 @@ async function deleteProcessInstance(client, options) {
|
|
|
1421
1576
|
});
|
|
1422
1577
|
if (result.error) {
|
|
1423
1578
|
spinner.fail("Failed to delete process instance");
|
|
1424
|
-
console.error(
|
|
1579
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1425
1580
|
process.exit(1);
|
|
1426
1581
|
}
|
|
1427
1582
|
spinner.succeed("Process instance deleted");
|
|
@@ -1434,12 +1589,12 @@ async function deleteProcessInstance(client, options) {
|
|
|
1434
1589
|
{
|
|
1435
1590
|
format: options.format,
|
|
1436
1591
|
pretty: () => {
|
|
1437
|
-
console.log(
|
|
1592
|
+
console.log(chalk4__default.default.green(`Deleted process instance: ${options.id}`));
|
|
1438
1593
|
}
|
|
1439
1594
|
}
|
|
1440
1595
|
);
|
|
1441
1596
|
} catch (error) {
|
|
1442
|
-
|
|
1597
|
+
exitWithCommandError3(spinner, "Failed to delete process instance", error);
|
|
1443
1598
|
}
|
|
1444
1599
|
}
|
|
1445
1600
|
async function suspendProcessInstance(client, options) {
|
|
@@ -1449,7 +1604,7 @@ async function suspendProcessInstance(client, options) {
|
|
|
1449
1604
|
const result = await bpmClient.suspendProcessInstance(options.id);
|
|
1450
1605
|
if (result.error) {
|
|
1451
1606
|
spinner.fail("Failed to suspend process instance");
|
|
1452
|
-
console.error(
|
|
1607
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1453
1608
|
process.exit(1);
|
|
1454
1609
|
}
|
|
1455
1610
|
spinner.succeed("Process instance suspended");
|
|
@@ -1461,12 +1616,12 @@ async function suspendProcessInstance(client, options) {
|
|
|
1461
1616
|
{
|
|
1462
1617
|
format: options.format,
|
|
1463
1618
|
pretty: () => {
|
|
1464
|
-
console.log(
|
|
1619
|
+
console.log(chalk4__default.default.green(`Suspended process instance: ${options.id}`));
|
|
1465
1620
|
}
|
|
1466
1621
|
}
|
|
1467
1622
|
);
|
|
1468
1623
|
} catch (error) {
|
|
1469
|
-
|
|
1624
|
+
exitWithCommandError3(spinner, "Failed to suspend process instance", error);
|
|
1470
1625
|
}
|
|
1471
1626
|
}
|
|
1472
1627
|
async function activateProcessInstance(client, options) {
|
|
@@ -1476,7 +1631,7 @@ async function activateProcessInstance(client, options) {
|
|
|
1476
1631
|
const result = await bpmClient.activateProcessInstance(options.id);
|
|
1477
1632
|
if (result.error) {
|
|
1478
1633
|
spinner.fail("Failed to activate process instance");
|
|
1479
|
-
console.error(
|
|
1634
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1480
1635
|
process.exit(1);
|
|
1481
1636
|
}
|
|
1482
1637
|
spinner.succeed("Process instance activated");
|
|
@@ -1488,12 +1643,12 @@ async function activateProcessInstance(client, options) {
|
|
|
1488
1643
|
{
|
|
1489
1644
|
format: options.format,
|
|
1490
1645
|
pretty: () => {
|
|
1491
|
-
console.log(
|
|
1646
|
+
console.log(chalk4__default.default.green(`Activated process instance: ${options.id}`));
|
|
1492
1647
|
}
|
|
1493
1648
|
}
|
|
1494
1649
|
);
|
|
1495
1650
|
} catch (error) {
|
|
1496
|
-
|
|
1651
|
+
exitWithCommandError3(spinner, "Failed to activate process instance", error);
|
|
1497
1652
|
}
|
|
1498
1653
|
}
|
|
1499
1654
|
async function modifyProcessInstance(client, options) {
|
|
@@ -1508,7 +1663,7 @@ async function modifyProcessInstance(client, options) {
|
|
|
1508
1663
|
const result = await bpmClient.modifyProcessInstance(options.id, modification);
|
|
1509
1664
|
if (result.error) {
|
|
1510
1665
|
spinner.fail("Failed to modify process instance");
|
|
1511
|
-
console.error(
|
|
1666
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1512
1667
|
process.exit(1);
|
|
1513
1668
|
}
|
|
1514
1669
|
spinner.succeed("Process instance modified");
|
|
@@ -1521,12 +1676,12 @@ async function modifyProcessInstance(client, options) {
|
|
|
1521
1676
|
{
|
|
1522
1677
|
format: options.format,
|
|
1523
1678
|
pretty: () => {
|
|
1524
|
-
console.log(
|
|
1679
|
+
console.log(chalk4__default.default.green(`Modified process instance: ${options.id}`));
|
|
1525
1680
|
}
|
|
1526
1681
|
}
|
|
1527
1682
|
);
|
|
1528
1683
|
} catch (error) {
|
|
1529
|
-
|
|
1684
|
+
exitWithCommandError3(spinner, "Failed to modify process instance", error);
|
|
1530
1685
|
}
|
|
1531
1686
|
}
|
|
1532
1687
|
async function listTasks(client, options) {
|
|
@@ -1537,7 +1692,7 @@ async function listTasks(client, options) {
|
|
|
1537
1692
|
const result = await bpmClient.getTasks(params);
|
|
1538
1693
|
if (result.error) {
|
|
1539
1694
|
spinner.fail("Failed to fetch tasks");
|
|
1540
|
-
console.error(
|
|
1695
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1541
1696
|
process.exit(1);
|
|
1542
1697
|
}
|
|
1543
1698
|
spinner.succeed(`Found ${result.data?.length || 0} tasks`);
|
|
@@ -1545,19 +1700,19 @@ async function listTasks(client, options) {
|
|
|
1545
1700
|
renderOutput(tasks, {
|
|
1546
1701
|
format: options.format,
|
|
1547
1702
|
pretty: () => {
|
|
1548
|
-
console.log(
|
|
1703
|
+
console.log(chalk4__default.default.blue("\n\u{1F4DD} Tasks\n"));
|
|
1549
1704
|
for (const task of tasks) {
|
|
1550
|
-
console.log(` ${
|
|
1551
|
-
console.log(` ${
|
|
1552
|
-
console.log(` ${
|
|
1553
|
-
console.log(` ${
|
|
1554
|
-
console.log(` ${
|
|
1705
|
+
console.log(` ${chalk4__default.default.green("\u2022")} ${chalk4__default.default.bold(task.name || task.id)}`);
|
|
1706
|
+
console.log(` ${chalk4__default.default.gray("ID:")} ${task.id}`);
|
|
1707
|
+
console.log(` ${chalk4__default.default.gray("Assignee:")} ${task.assignee || "Unassigned"}`);
|
|
1708
|
+
console.log(` ${chalk4__default.default.gray("Process Instance:")} ${task.processInstanceId || "N/A"}`);
|
|
1709
|
+
console.log(` ${chalk4__default.default.gray("Created:")} ${task.created || "N/A"}`);
|
|
1555
1710
|
console.log();
|
|
1556
1711
|
}
|
|
1557
1712
|
}
|
|
1558
1713
|
});
|
|
1559
1714
|
} catch (error) {
|
|
1560
|
-
|
|
1715
|
+
exitWithCommandError3(spinner, "Failed to fetch tasks", error);
|
|
1561
1716
|
}
|
|
1562
1717
|
}
|
|
1563
1718
|
async function getTask(client, options) {
|
|
@@ -1567,19 +1722,19 @@ async function getTask(client, options) {
|
|
|
1567
1722
|
const result = await bpmClient.getTask(options.id);
|
|
1568
1723
|
if (result.error) {
|
|
1569
1724
|
spinner.fail("Failed to fetch task");
|
|
1570
|
-
console.error(
|
|
1725
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1571
1726
|
process.exit(1);
|
|
1572
1727
|
}
|
|
1573
1728
|
spinner.succeed("Task retrieved");
|
|
1574
1729
|
renderOutput(result.data, {
|
|
1575
1730
|
format: options.format,
|
|
1576
1731
|
pretty: () => {
|
|
1577
|
-
console.log(
|
|
1732
|
+
console.log(chalk4__default.default.blue("\n\u{1F4DD} Task\n"));
|
|
1578
1733
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1579
1734
|
}
|
|
1580
1735
|
});
|
|
1581
1736
|
} catch (error) {
|
|
1582
|
-
|
|
1737
|
+
exitWithCommandError3(spinner, "Failed to fetch task", error);
|
|
1583
1738
|
}
|
|
1584
1739
|
}
|
|
1585
1740
|
async function getTaskCount(client, options) {
|
|
@@ -1590,18 +1745,18 @@ async function getTaskCount(client, options) {
|
|
|
1590
1745
|
const result = await bpmClient.getTaskCount(params);
|
|
1591
1746
|
if (result.error) {
|
|
1592
1747
|
spinner.fail("Failed to fetch task count");
|
|
1593
|
-
console.error(
|
|
1748
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1594
1749
|
process.exit(1);
|
|
1595
1750
|
}
|
|
1596
1751
|
spinner.succeed("Task count retrieved");
|
|
1597
1752
|
renderOutput(result.data, {
|
|
1598
1753
|
format: options.format,
|
|
1599
1754
|
pretty: () => {
|
|
1600
|
-
console.log(
|
|
1755
|
+
console.log(chalk4__default.default.green(`Task count: ${result.data?.count ?? 0}`));
|
|
1601
1756
|
}
|
|
1602
1757
|
});
|
|
1603
1758
|
} catch (error) {
|
|
1604
|
-
|
|
1759
|
+
exitWithCommandError3(spinner, "Failed to fetch task count", error);
|
|
1605
1760
|
}
|
|
1606
1761
|
}
|
|
1607
1762
|
async function completeTask(client, options) {
|
|
@@ -1612,7 +1767,7 @@ async function completeTask(client, options) {
|
|
|
1612
1767
|
const result = await bpmClient.completeTask(options.id, variables);
|
|
1613
1768
|
if (result.error) {
|
|
1614
1769
|
spinner.fail("Failed to complete task");
|
|
1615
|
-
console.error(
|
|
1770
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1616
1771
|
process.exit(1);
|
|
1617
1772
|
}
|
|
1618
1773
|
spinner.succeed("Task completed");
|
|
@@ -1624,12 +1779,12 @@ async function completeTask(client, options) {
|
|
|
1624
1779
|
{
|
|
1625
1780
|
format: options.format,
|
|
1626
1781
|
pretty: () => {
|
|
1627
|
-
console.log(
|
|
1782
|
+
console.log(chalk4__default.default.green(`Completed task: ${options.id}`));
|
|
1628
1783
|
}
|
|
1629
1784
|
}
|
|
1630
1785
|
);
|
|
1631
1786
|
} catch (error) {
|
|
1632
|
-
|
|
1787
|
+
exitWithCommandError3(spinner, "Failed to complete task", error);
|
|
1633
1788
|
}
|
|
1634
1789
|
}
|
|
1635
1790
|
async function delegateTask(client, options) {
|
|
@@ -1639,7 +1794,7 @@ async function delegateTask(client, options) {
|
|
|
1639
1794
|
const result = await bpmClient.delegateTask(options.id, options.userId);
|
|
1640
1795
|
if (result.error) {
|
|
1641
1796
|
spinner.fail("Failed to delegate task");
|
|
1642
|
-
console.error(
|
|
1797
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1643
1798
|
process.exit(1);
|
|
1644
1799
|
}
|
|
1645
1800
|
spinner.succeed("Task delegated");
|
|
@@ -1652,12 +1807,12 @@ async function delegateTask(client, options) {
|
|
|
1652
1807
|
{
|
|
1653
1808
|
format: options.format,
|
|
1654
1809
|
pretty: () => {
|
|
1655
|
-
console.log(
|
|
1810
|
+
console.log(chalk4__default.default.green(`Delegated task ${options.id} to ${options.userId}`));
|
|
1656
1811
|
}
|
|
1657
1812
|
}
|
|
1658
1813
|
);
|
|
1659
1814
|
} catch (error) {
|
|
1660
|
-
|
|
1815
|
+
exitWithCommandError3(spinner, "Failed to delegate task", error);
|
|
1661
1816
|
}
|
|
1662
1817
|
}
|
|
1663
1818
|
async function getTaskForm(client, options) {
|
|
@@ -1667,19 +1822,19 @@ async function getTaskForm(client, options) {
|
|
|
1667
1822
|
const result = await bpmClient.getTaskForm(options.id);
|
|
1668
1823
|
if (result.error) {
|
|
1669
1824
|
spinner.fail("Failed to fetch task form");
|
|
1670
|
-
console.error(
|
|
1825
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1671
1826
|
process.exit(1);
|
|
1672
1827
|
}
|
|
1673
1828
|
spinner.succeed("Task form retrieved");
|
|
1674
1829
|
renderOutput(result.data, {
|
|
1675
1830
|
format: options.format,
|
|
1676
1831
|
pretty: () => {
|
|
1677
|
-
console.log(
|
|
1832
|
+
console.log(chalk4__default.default.blue("\n\u{1F9E9} Task Form\n"));
|
|
1678
1833
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1679
1834
|
}
|
|
1680
1835
|
});
|
|
1681
1836
|
} catch (error) {
|
|
1682
|
-
|
|
1837
|
+
exitWithCommandError3(spinner, "Failed to fetch task form", error);
|
|
1683
1838
|
}
|
|
1684
1839
|
}
|
|
1685
1840
|
async function getTaskFormSchema(client, options) {
|
|
@@ -1702,12 +1857,12 @@ async function getTaskFormSchema(client, options) {
|
|
|
1702
1857
|
renderOutput(result.data, {
|
|
1703
1858
|
format: options.format,
|
|
1704
1859
|
pretty: () => {
|
|
1705
|
-
console.log(
|
|
1860
|
+
console.log(chalk4__default.default.blue("\n\u{1F9E9} Task Form Schema\n"));
|
|
1706
1861
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1707
1862
|
}
|
|
1708
1863
|
});
|
|
1709
1864
|
} catch (error) {
|
|
1710
|
-
|
|
1865
|
+
exitWithCommandError3(spinner, "Failed to fetch task form schema", error);
|
|
1711
1866
|
}
|
|
1712
1867
|
}
|
|
1713
1868
|
async function getTaskFormVariables(client, options) {
|
|
@@ -1717,19 +1872,19 @@ async function getTaskFormVariables(client, options) {
|
|
|
1717
1872
|
const result = await bpmClient.getTaskFormVariables(options.id);
|
|
1718
1873
|
if (result.error) {
|
|
1719
1874
|
spinner.fail("Failed to fetch task form variables");
|
|
1720
|
-
console.error(
|
|
1875
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1721
1876
|
process.exit(1);
|
|
1722
1877
|
}
|
|
1723
1878
|
spinner.succeed("Task form variables retrieved");
|
|
1724
1879
|
renderOutput(result.data, {
|
|
1725
1880
|
format: options.format,
|
|
1726
1881
|
pretty: () => {
|
|
1727
|
-
console.log(
|
|
1882
|
+
console.log(chalk4__default.default.blue("\n\u{1F9EE} Task Form Variables\n"));
|
|
1728
1883
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1729
1884
|
}
|
|
1730
1885
|
});
|
|
1731
1886
|
} catch (error) {
|
|
1732
|
-
|
|
1887
|
+
exitWithCommandError3(spinner, "Failed to fetch task form variables", error);
|
|
1733
1888
|
}
|
|
1734
1889
|
}
|
|
1735
1890
|
async function getTaskRenderedForm(client, options) {
|
|
@@ -1739,19 +1894,19 @@ async function getTaskRenderedForm(client, options) {
|
|
|
1739
1894
|
const result = await bpmClient.getTaskRenderedForm(options.id);
|
|
1740
1895
|
if (result.error) {
|
|
1741
1896
|
spinner.fail("Failed to fetch rendered task form");
|
|
1742
|
-
console.error(
|
|
1897
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1743
1898
|
process.exit(1);
|
|
1744
1899
|
}
|
|
1745
1900
|
spinner.succeed("Rendered task form retrieved");
|
|
1746
1901
|
renderOutput(result.data, {
|
|
1747
1902
|
format: options.format,
|
|
1748
1903
|
pretty: () => {
|
|
1749
|
-
console.log(
|
|
1904
|
+
console.log(chalk4__default.default.blue("\n\u{1F9FE} Rendered Task Form\n"));
|
|
1750
1905
|
console.log(result.data || "");
|
|
1751
1906
|
}
|
|
1752
1907
|
});
|
|
1753
1908
|
} catch (error) {
|
|
1754
|
-
|
|
1909
|
+
exitWithCommandError3(spinner, "Failed to fetch rendered task form", error);
|
|
1755
1910
|
}
|
|
1756
1911
|
}
|
|
1757
1912
|
async function getTaskDeployedForm(client, options) {
|
|
@@ -1761,19 +1916,19 @@ async function getTaskDeployedForm(client, options) {
|
|
|
1761
1916
|
const result = await bpmClient.getTaskDeployedForm(options.id);
|
|
1762
1917
|
if (result.error) {
|
|
1763
1918
|
spinner.fail("Failed to fetch deployed task form");
|
|
1764
|
-
console.error(
|
|
1919
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1765
1920
|
process.exit(1);
|
|
1766
1921
|
}
|
|
1767
1922
|
spinner.succeed("Deployed task form retrieved");
|
|
1768
1923
|
renderOutput(result.data, {
|
|
1769
1924
|
format: options.format,
|
|
1770
1925
|
pretty: () => {
|
|
1771
|
-
console.log(
|
|
1926
|
+
console.log(chalk4__default.default.blue("\n\u{1F9FE} Deployed Task Form\n"));
|
|
1772
1927
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1773
1928
|
}
|
|
1774
1929
|
});
|
|
1775
1930
|
} catch (error) {
|
|
1776
|
-
|
|
1931
|
+
exitWithCommandError3(spinner, "Failed to fetch deployed task form", error);
|
|
1777
1932
|
}
|
|
1778
1933
|
}
|
|
1779
1934
|
async function getStartFormInfo(client, options) {
|
|
@@ -1793,12 +1948,12 @@ async function getStartFormInfo(client, options) {
|
|
|
1793
1948
|
renderOutput(result.data, {
|
|
1794
1949
|
format: options.format,
|
|
1795
1950
|
pretty: () => {
|
|
1796
|
-
console.log(
|
|
1951
|
+
console.log(chalk4__default.default.blue("\n\u{1F680} Start Form Info\n"));
|
|
1797
1952
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1798
1953
|
}
|
|
1799
1954
|
});
|
|
1800
1955
|
} catch (error) {
|
|
1801
|
-
|
|
1956
|
+
exitWithCommandError3(spinner, "Failed to fetch start form info", error);
|
|
1802
1957
|
}
|
|
1803
1958
|
}
|
|
1804
1959
|
async function getStartFormVariables(client, options) {
|
|
@@ -1818,12 +1973,12 @@ async function getStartFormVariables(client, options) {
|
|
|
1818
1973
|
renderOutput(result.data, {
|
|
1819
1974
|
format: options.format,
|
|
1820
1975
|
pretty: () => {
|
|
1821
|
-
console.log(
|
|
1976
|
+
console.log(chalk4__default.default.blue("\n\u{1F680} Start Form Variables\n"));
|
|
1822
1977
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1823
1978
|
}
|
|
1824
1979
|
});
|
|
1825
1980
|
} catch (error) {
|
|
1826
|
-
|
|
1981
|
+
exitWithCommandError3(spinner, "Failed to fetch start form variables", error);
|
|
1827
1982
|
}
|
|
1828
1983
|
}
|
|
1829
1984
|
async function getDeployedStartForm(client, options) {
|
|
@@ -1843,12 +1998,12 @@ async function getDeployedStartForm(client, options) {
|
|
|
1843
1998
|
renderOutput(result.data, {
|
|
1844
1999
|
format: options.format,
|
|
1845
2000
|
pretty: () => {
|
|
1846
|
-
console.log(
|
|
2001
|
+
console.log(chalk4__default.default.blue("\n\u{1F680} Deployed Start Form\n"));
|
|
1847
2002
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1848
2003
|
}
|
|
1849
2004
|
});
|
|
1850
2005
|
} catch (error) {
|
|
1851
|
-
|
|
2006
|
+
exitWithCommandError3(spinner, "Failed to fetch deployed start form", error);
|
|
1852
2007
|
}
|
|
1853
2008
|
}
|
|
1854
2009
|
async function listHistoryTasks(client, options = {}) {
|
|
@@ -1859,7 +2014,7 @@ async function listHistoryTasks(client, options = {}) {
|
|
|
1859
2014
|
const result = await bpmClient.getHistoryTasks(params);
|
|
1860
2015
|
if (result.error) {
|
|
1861
2016
|
spinner.fail("Failed to fetch history tasks");
|
|
1862
|
-
console.error(
|
|
2017
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1863
2018
|
process.exit(1);
|
|
1864
2019
|
}
|
|
1865
2020
|
const tasks = result.data || [];
|
|
@@ -1867,12 +2022,12 @@ async function listHistoryTasks(client, options = {}) {
|
|
|
1867
2022
|
renderOutput(tasks, {
|
|
1868
2023
|
format: options.format,
|
|
1869
2024
|
pretty: () => {
|
|
1870
|
-
console.log(
|
|
2025
|
+
console.log(chalk4__default.default.blue("\n\u{1F4DA} History Tasks\n"));
|
|
1871
2026
|
console.log(JSON.stringify(tasks, null, 2));
|
|
1872
2027
|
}
|
|
1873
2028
|
});
|
|
1874
2029
|
} catch (error) {
|
|
1875
|
-
|
|
2030
|
+
exitWithCommandError3(spinner, "Failed to fetch history tasks", error);
|
|
1876
2031
|
}
|
|
1877
2032
|
}
|
|
1878
2033
|
async function getHistoryTaskCount(client, options = {}) {
|
|
@@ -1883,18 +2038,18 @@ async function getHistoryTaskCount(client, options = {}) {
|
|
|
1883
2038
|
const result = await bpmClient.getHistoryTaskCount(params);
|
|
1884
2039
|
if (result.error) {
|
|
1885
2040
|
spinner.fail("Failed to fetch history task count");
|
|
1886
|
-
console.error(
|
|
2041
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1887
2042
|
process.exit(1);
|
|
1888
2043
|
}
|
|
1889
2044
|
spinner.succeed("History task count retrieved");
|
|
1890
2045
|
renderOutput(result.data, {
|
|
1891
2046
|
format: options.format,
|
|
1892
2047
|
pretty: () => {
|
|
1893
|
-
console.log(
|
|
2048
|
+
console.log(chalk4__default.default.green(`History task count: ${result.data?.count ?? 0}`));
|
|
1894
2049
|
}
|
|
1895
2050
|
});
|
|
1896
2051
|
} catch (error) {
|
|
1897
|
-
|
|
2052
|
+
exitWithCommandError3(spinner, "Failed to fetch history task count", error);
|
|
1898
2053
|
}
|
|
1899
2054
|
}
|
|
1900
2055
|
async function listHistoryProcessInstances(client, options = {}) {
|
|
@@ -1905,7 +2060,7 @@ async function listHistoryProcessInstances(client, options = {}) {
|
|
|
1905
2060
|
const result = await bpmClient.getHistoryProcessInstances(params);
|
|
1906
2061
|
if (result.error) {
|
|
1907
2062
|
spinner.fail("Failed to fetch history process instances");
|
|
1908
|
-
console.error(
|
|
2063
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1909
2064
|
process.exit(1);
|
|
1910
2065
|
}
|
|
1911
2066
|
const instances = result.data || [];
|
|
@@ -1913,12 +2068,12 @@ async function listHistoryProcessInstances(client, options = {}) {
|
|
|
1913
2068
|
renderOutput(instances, {
|
|
1914
2069
|
format: options.format,
|
|
1915
2070
|
pretty: () => {
|
|
1916
|
-
console.log(
|
|
2071
|
+
console.log(chalk4__default.default.blue("\n\u{1F4DA} History Process Instances\n"));
|
|
1917
2072
|
console.log(JSON.stringify(instances, null, 2));
|
|
1918
2073
|
}
|
|
1919
2074
|
});
|
|
1920
2075
|
} catch (error) {
|
|
1921
|
-
|
|
2076
|
+
exitWithCommandError3(spinner, "Failed to fetch history process instances", error);
|
|
1922
2077
|
}
|
|
1923
2078
|
}
|
|
1924
2079
|
async function getHistoryProcessInstanceCount(client, options = {}) {
|
|
@@ -1929,18 +2084,18 @@ async function getHistoryProcessInstanceCount(client, options = {}) {
|
|
|
1929
2084
|
const result = await bpmClient.getHistoryProcessInstanceCount(params);
|
|
1930
2085
|
if (result.error) {
|
|
1931
2086
|
spinner.fail("Failed to fetch history process instance count");
|
|
1932
|
-
console.error(
|
|
2087
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1933
2088
|
process.exit(1);
|
|
1934
2089
|
}
|
|
1935
2090
|
spinner.succeed("History process instance count retrieved");
|
|
1936
2091
|
renderOutput(result.data, {
|
|
1937
2092
|
format: options.format,
|
|
1938
2093
|
pretty: () => {
|
|
1939
|
-
console.log(
|
|
2094
|
+
console.log(chalk4__default.default.green(`History process instance count: ${result.data?.count ?? 0}`));
|
|
1940
2095
|
}
|
|
1941
2096
|
});
|
|
1942
2097
|
} catch (error) {
|
|
1943
|
-
|
|
2098
|
+
exitWithCommandError3(spinner, "Failed to fetch history process instance count", error);
|
|
1944
2099
|
}
|
|
1945
2100
|
}
|
|
1946
2101
|
async function getHistoryProcessInstance(client, options) {
|
|
@@ -1950,19 +2105,19 @@ async function getHistoryProcessInstance(client, options) {
|
|
|
1950
2105
|
const result = await bpmClient.getHistoryProcessInstance(options.id);
|
|
1951
2106
|
if (result.error) {
|
|
1952
2107
|
spinner.fail("Failed to fetch history process instance");
|
|
1953
|
-
console.error(
|
|
2108
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1954
2109
|
process.exit(1);
|
|
1955
2110
|
}
|
|
1956
2111
|
spinner.succeed("History process instance retrieved");
|
|
1957
2112
|
renderOutput(result.data, {
|
|
1958
2113
|
format: options.format,
|
|
1959
2114
|
pretty: () => {
|
|
1960
|
-
console.log(
|
|
2115
|
+
console.log(chalk4__default.default.blue("\n\u{1F4DA} History Process Instance\n"));
|
|
1961
2116
|
console.log(JSON.stringify(result.data, null, 2));
|
|
1962
2117
|
}
|
|
1963
2118
|
});
|
|
1964
2119
|
} catch (error) {
|
|
1965
|
-
|
|
2120
|
+
exitWithCommandError3(spinner, "Failed to fetch history process instance", error);
|
|
1966
2121
|
}
|
|
1967
2122
|
}
|
|
1968
2123
|
async function listHistoryActivityInstances(client, options = {}) {
|
|
@@ -1973,7 +2128,7 @@ async function listHistoryActivityInstances(client, options = {}) {
|
|
|
1973
2128
|
const result = await bpmClient.getHistoryActivityInstances(params);
|
|
1974
2129
|
if (result.error) {
|
|
1975
2130
|
spinner.fail("Failed to fetch history activity instances");
|
|
1976
|
-
console.error(
|
|
2131
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
1977
2132
|
process.exit(1);
|
|
1978
2133
|
}
|
|
1979
2134
|
const activities = result.data || [];
|
|
@@ -1981,12 +2136,12 @@ async function listHistoryActivityInstances(client, options = {}) {
|
|
|
1981
2136
|
renderOutput(activities, {
|
|
1982
2137
|
format: options.format,
|
|
1983
2138
|
pretty: () => {
|
|
1984
|
-
console.log(
|
|
2139
|
+
console.log(chalk4__default.default.blue("\n\u{1F4DA} History Activity Instances\n"));
|
|
1985
2140
|
console.log(JSON.stringify(activities, null, 2));
|
|
1986
2141
|
}
|
|
1987
2142
|
});
|
|
1988
2143
|
} catch (error) {
|
|
1989
|
-
|
|
2144
|
+
exitWithCommandError3(spinner, "Failed to fetch history activity instances", error);
|
|
1990
2145
|
}
|
|
1991
2146
|
}
|
|
1992
2147
|
async function listHistoryVariableInstances(client, options = {}) {
|
|
@@ -1997,7 +2152,7 @@ async function listHistoryVariableInstances(client, options = {}) {
|
|
|
1997
2152
|
const result = await bpmClient.getHistoryVariableInstances(params);
|
|
1998
2153
|
if (result.error) {
|
|
1999
2154
|
spinner.fail("Failed to fetch history variable instances");
|
|
2000
|
-
console.error(
|
|
2155
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
2001
2156
|
process.exit(1);
|
|
2002
2157
|
}
|
|
2003
2158
|
const variables = result.data || [];
|
|
@@ -2005,12 +2160,12 @@ async function listHistoryVariableInstances(client, options = {}) {
|
|
|
2005
2160
|
renderOutput(variables, {
|
|
2006
2161
|
format: options.format,
|
|
2007
2162
|
pretty: () => {
|
|
2008
|
-
console.log(
|
|
2163
|
+
console.log(chalk4__default.default.blue("\n\u{1F4DA} History Variable Instances\n"));
|
|
2009
2164
|
console.log(JSON.stringify(variables, null, 2));
|
|
2010
2165
|
}
|
|
2011
2166
|
});
|
|
2012
2167
|
} catch (error) {
|
|
2013
|
-
|
|
2168
|
+
exitWithCommandError3(spinner, "Failed to fetch history variable instances", error);
|
|
2014
2169
|
}
|
|
2015
2170
|
}
|
|
2016
2171
|
async function listUserOperationLogs(client, options = {}) {
|
|
@@ -2021,7 +2176,7 @@ async function listUserOperationLogs(client, options = {}) {
|
|
|
2021
2176
|
const result = await bpmClient.getUserOperationLogs(params);
|
|
2022
2177
|
if (result.error) {
|
|
2023
2178
|
spinner.fail("Failed to fetch user operation logs");
|
|
2024
|
-
console.error(
|
|
2179
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
2025
2180
|
process.exit(1);
|
|
2026
2181
|
}
|
|
2027
2182
|
const logs = result.data || [];
|
|
@@ -2029,12 +2184,12 @@ async function listUserOperationLogs(client, options = {}) {
|
|
|
2029
2184
|
renderOutput(logs, {
|
|
2030
2185
|
format: options.format,
|
|
2031
2186
|
pretty: () => {
|
|
2032
|
-
console.log(
|
|
2187
|
+
console.log(chalk4__default.default.blue("\n\u{1F4DA} User Operation Logs\n"));
|
|
2033
2188
|
console.log(JSON.stringify(logs, null, 2));
|
|
2034
2189
|
}
|
|
2035
2190
|
});
|
|
2036
2191
|
} catch (error) {
|
|
2037
|
-
|
|
2192
|
+
exitWithCommandError3(spinner, "Failed to fetch user operation logs", error);
|
|
2038
2193
|
}
|
|
2039
2194
|
}
|
|
2040
2195
|
async function deleteHistoryProcessInstance(client, options) {
|
|
@@ -2044,7 +2199,7 @@ async function deleteHistoryProcessInstance(client, options) {
|
|
|
2044
2199
|
const result = await bpmClient.deleteHistoryProcessInstance(options.id);
|
|
2045
2200
|
if (result.error) {
|
|
2046
2201
|
spinner.fail("Failed to delete history process instance");
|
|
2047
|
-
console.error(
|
|
2202
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
2048
2203
|
process.exit(1);
|
|
2049
2204
|
}
|
|
2050
2205
|
spinner.succeed("History process instance deleted");
|
|
@@ -2056,12 +2211,12 @@ async function deleteHistoryProcessInstance(client, options) {
|
|
|
2056
2211
|
{
|
|
2057
2212
|
format: options.format,
|
|
2058
2213
|
pretty: () => {
|
|
2059
|
-
console.log(
|
|
2214
|
+
console.log(chalk4__default.default.green(`Deleted history process instance: ${options.id}`));
|
|
2060
2215
|
}
|
|
2061
2216
|
}
|
|
2062
2217
|
);
|
|
2063
2218
|
} catch (error) {
|
|
2064
|
-
|
|
2219
|
+
exitWithCommandError3(spinner, "Failed to delete history process instance", error);
|
|
2065
2220
|
}
|
|
2066
2221
|
}
|
|
2067
2222
|
async function listRoles(client, options = {}) {
|
|
@@ -2071,7 +2226,7 @@ async function listRoles(client, options = {}) {
|
|
|
2071
2226
|
const result = await bpmClient.getRoles();
|
|
2072
2227
|
if (result.error) {
|
|
2073
2228
|
spinner.fail("Failed to fetch roles");
|
|
2074
|
-
console.error(
|
|
2229
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
2075
2230
|
process.exit(1);
|
|
2076
2231
|
}
|
|
2077
2232
|
const roles = result.data || [];
|
|
@@ -2079,12 +2234,12 @@ async function listRoles(client, options = {}) {
|
|
|
2079
2234
|
renderOutput(roles, {
|
|
2080
2235
|
format: options.format,
|
|
2081
2236
|
pretty: () => {
|
|
2082
|
-
console.log(
|
|
2237
|
+
console.log(chalk4__default.default.blue("\n\u{1F465} Roles\n"));
|
|
2083
2238
|
console.log(JSON.stringify(roles, null, 2));
|
|
2084
2239
|
}
|
|
2085
2240
|
});
|
|
2086
2241
|
} catch (error) {
|
|
2087
|
-
|
|
2242
|
+
exitWithCommandError3(spinner, "Failed to fetch roles", error);
|
|
2088
2243
|
}
|
|
2089
2244
|
}
|
|
2090
2245
|
async function getUserRoles(client, options) {
|
|
@@ -2094,7 +2249,7 @@ async function getUserRoles(client, options) {
|
|
|
2094
2249
|
const result = await bpmClient.getUserRoles(options.userId);
|
|
2095
2250
|
if (result.error) {
|
|
2096
2251
|
spinner.fail("Failed to fetch user roles");
|
|
2097
|
-
console.error(
|
|
2252
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
2098
2253
|
process.exit(1);
|
|
2099
2254
|
}
|
|
2100
2255
|
const roles = result.data || [];
|
|
@@ -2102,17 +2257,17 @@ async function getUserRoles(client, options) {
|
|
|
2102
2257
|
renderOutput(roles, {
|
|
2103
2258
|
format: options.format,
|
|
2104
2259
|
pretty: () => {
|
|
2105
|
-
console.log(
|
|
2260
|
+
console.log(chalk4__default.default.blue(`
|
|
2106
2261
|
\u{1F464} User Roles: ${options.userId}
|
|
2107
2262
|
`));
|
|
2108
2263
|
console.log(JSON.stringify(roles, null, 2));
|
|
2109
2264
|
}
|
|
2110
2265
|
});
|
|
2111
2266
|
} catch (error) {
|
|
2112
|
-
|
|
2267
|
+
exitWithCommandError3(spinner, "Failed to fetch user roles", error);
|
|
2113
2268
|
}
|
|
2114
2269
|
}
|
|
2115
|
-
function
|
|
2270
|
+
function resolveInputSource4(input) {
|
|
2116
2271
|
if (!input.startsWith("@")) {
|
|
2117
2272
|
return input;
|
|
2118
2273
|
}
|
|
@@ -2123,7 +2278,7 @@ function resolveInputSource3(input) {
|
|
|
2123
2278
|
return fs.readFileSync(filePath, "utf8");
|
|
2124
2279
|
}
|
|
2125
2280
|
function parseJsonInput3(input, label) {
|
|
2126
|
-
const source =
|
|
2281
|
+
const source = resolveInputSource4(input).trim();
|
|
2127
2282
|
if (!source) {
|
|
2128
2283
|
throw new Error(`${label} is required.`);
|
|
2129
2284
|
}
|
|
@@ -2157,11 +2312,11 @@ function loadOptionalJsonArrayInput(input, label) {
|
|
|
2157
2312
|
}
|
|
2158
2313
|
return value;
|
|
2159
2314
|
}
|
|
2160
|
-
function
|
|
2315
|
+
function exitWithCommandError4(spinner, failureMessage, error) {
|
|
2161
2316
|
spinner.fail(failureMessage);
|
|
2162
2317
|
const details = error instanceof Error ? error.message : String(error);
|
|
2163
2318
|
if (details) {
|
|
2164
|
-
console.error(
|
|
2319
|
+
console.error(chalk4__default.default.red(details));
|
|
2165
2320
|
}
|
|
2166
2321
|
process.exit(1);
|
|
2167
2322
|
}
|
|
@@ -2196,26 +2351,26 @@ async function runWorkflow(client, options) {
|
|
|
2196
2351
|
const result = await workflowClient.run(options.name, request);
|
|
2197
2352
|
if (result.error) {
|
|
2198
2353
|
spinner.fail("Failed to run workflow");
|
|
2199
|
-
console.error(
|
|
2354
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
2200
2355
|
process.exit(1);
|
|
2201
2356
|
}
|
|
2202
2357
|
spinner.succeed("Workflow completed");
|
|
2203
2358
|
renderOutput(result.data, {
|
|
2204
2359
|
format: options.format,
|
|
2205
2360
|
pretty: () => {
|
|
2206
|
-
console.log(
|
|
2361
|
+
console.log(chalk4__default.default.blue("\n\u26A1 Workflow Run\n"));
|
|
2207
2362
|
console.log(JSON.stringify(result.data, null, 2));
|
|
2208
2363
|
}
|
|
2209
2364
|
});
|
|
2210
2365
|
} catch (error) {
|
|
2211
|
-
|
|
2366
|
+
exitWithCommandError4(spinner, "Failed to run workflow", error);
|
|
2212
2367
|
}
|
|
2213
2368
|
}
|
|
2214
|
-
function
|
|
2369
|
+
function exitWithCommandError5(spinner, failureMessage, error) {
|
|
2215
2370
|
spinner.fail(failureMessage);
|
|
2216
2371
|
const details = error instanceof Error ? error.message : String(error);
|
|
2217
2372
|
if (details) {
|
|
2218
|
-
console.error(
|
|
2373
|
+
console.error(chalk4__default.default.red(details));
|
|
2219
2374
|
}
|
|
2220
2375
|
process.exit(1);
|
|
2221
2376
|
}
|
|
@@ -2254,20 +2409,20 @@ async function uploadFile(client, options) {
|
|
|
2254
2409
|
const result = await s3Client.upload(file);
|
|
2255
2410
|
if (result.error) {
|
|
2256
2411
|
spinner.fail("Upload failed");
|
|
2257
|
-
console.error(
|
|
2412
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
2258
2413
|
process.exit(1);
|
|
2259
2414
|
}
|
|
2260
2415
|
spinner.succeed("Upload complete");
|
|
2261
2416
|
renderOutput(result.data, {
|
|
2262
2417
|
format: options.format,
|
|
2263
2418
|
pretty: () => {
|
|
2264
|
-
console.log(
|
|
2265
|
-
console.log(` ${
|
|
2266
|
-
console.log(` ${
|
|
2419
|
+
console.log(chalk4__default.default.green("\nFile uploaded:"));
|
|
2420
|
+
console.log(` ${chalk4__default.default.bold("Key:")} ${result.data?.key}`);
|
|
2421
|
+
console.log(` ${chalk4__default.default.bold("URL:")} ${result.data?.url || "N/A"}`);
|
|
2267
2422
|
}
|
|
2268
2423
|
});
|
|
2269
2424
|
} catch (error) {
|
|
2270
|
-
|
|
2425
|
+
exitWithCommandError5(spinner, "Upload failed", error);
|
|
2271
2426
|
}
|
|
2272
2427
|
}
|
|
2273
2428
|
async function downloadFile(client, options) {
|
|
@@ -2277,12 +2432,12 @@ async function downloadFile(client, options) {
|
|
|
2277
2432
|
const result = await s3Client.download(options.key);
|
|
2278
2433
|
if (result.error) {
|
|
2279
2434
|
spinner.fail("Download failed");
|
|
2280
|
-
console.error(
|
|
2435
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
2281
2436
|
process.exit(1);
|
|
2282
2437
|
}
|
|
2283
2438
|
if (!result.data) {
|
|
2284
2439
|
spinner.fail("Download failed");
|
|
2285
|
-
console.error(
|
|
2440
|
+
console.error(chalk4__default.default.red("Empty file response."));
|
|
2286
2441
|
process.exit(1);
|
|
2287
2442
|
}
|
|
2288
2443
|
const outputPath = path.resolve(options.output);
|
|
@@ -2298,13 +2453,13 @@ async function downloadFile(client, options) {
|
|
|
2298
2453
|
{
|
|
2299
2454
|
format: options.format,
|
|
2300
2455
|
pretty: () => {
|
|
2301
|
-
console.log(
|
|
2456
|
+
console.log(chalk4__default.default.green(`
|
|
2302
2457
|
File saved to: ${outputPath}`));
|
|
2303
2458
|
}
|
|
2304
2459
|
}
|
|
2305
2460
|
);
|
|
2306
2461
|
} catch (error) {
|
|
2307
|
-
|
|
2462
|
+
exitWithCommandError5(spinner, "Download failed", error);
|
|
2308
2463
|
}
|
|
2309
2464
|
}
|
|
2310
2465
|
async function getFileMetadata(client, options) {
|
|
@@ -2314,21 +2469,21 @@ async function getFileMetadata(client, options) {
|
|
|
2314
2469
|
const result = await s3Client.getMetadata(options.key);
|
|
2315
2470
|
if (result.error) {
|
|
2316
2471
|
spinner.fail("Failed to fetch metadata");
|
|
2317
|
-
console.error(
|
|
2472
|
+
console.error(chalk4__default.default.red(result.error.message));
|
|
2318
2473
|
process.exit(1);
|
|
2319
2474
|
}
|
|
2320
2475
|
spinner.succeed("Metadata retrieved");
|
|
2321
2476
|
renderOutput(result.data, {
|
|
2322
2477
|
format: options.format,
|
|
2323
2478
|
pretty: () => {
|
|
2324
|
-
console.log(
|
|
2479
|
+
console.log(chalk4__default.default.blue(`
|
|
2325
2480
|
\u{1F4C4} Metadata for ${options.key}
|
|
2326
2481
|
`));
|
|
2327
2482
|
console.log(JSON.stringify(result.data, null, 2));
|
|
2328
2483
|
}
|
|
2329
2484
|
});
|
|
2330
2485
|
} catch (error) {
|
|
2331
|
-
|
|
2486
|
+
exitWithCommandError5(spinner, "Failed to fetch metadata", error);
|
|
2332
2487
|
}
|
|
2333
2488
|
}
|
|
2334
2489
|
|
|
@@ -2369,8 +2524,8 @@ async function initOpenClaw(options) {
|
|
|
2369
2524
|
const existingConfig = getAppConfig(options.appCode);
|
|
2370
2525
|
if (existingConfig && !options.force) {
|
|
2371
2526
|
spinner.fail(`App already exists: ${options.appCode}`);
|
|
2372
|
-
console.log(
|
|
2373
|
-
console.log(
|
|
2527
|
+
console.log(chalk4__default.default.yellow(`Use --force to reinitialize`));
|
|
2528
|
+
console.log(chalk4__default.default.gray(`Current URL: ${existingConfig.baseURL}`));
|
|
2374
2529
|
process.exit(1);
|
|
2375
2530
|
}
|
|
2376
2531
|
addApp(options.appCode, {
|
|
@@ -2381,8 +2536,8 @@ async function initOpenClaw(options) {
|
|
|
2381
2536
|
if (!openClawDetected) {
|
|
2382
2537
|
spinner.succeed(`App initialized: ${options.appCode}`);
|
|
2383
2538
|
if (pretty) {
|
|
2384
|
-
console.log(
|
|
2385
|
-
console.log(
|
|
2539
|
+
console.log(chalk4__default.default.yellow("\n\u26A0\uFE0F OpenClaw not detected, skipping skill download"));
|
|
2540
|
+
console.log(chalk4__default.default.gray(" Install OpenClaw: npm install -g openclaw"));
|
|
2386
2541
|
} else {
|
|
2387
2542
|
renderOutput(
|
|
2388
2543
|
{
|
|
@@ -2400,9 +2555,9 @@ async function initOpenClaw(options) {
|
|
|
2400
2555
|
}
|
|
2401
2556
|
spinner.succeed(`App initialized: ${options.appCode}`);
|
|
2402
2557
|
if (pretty) {
|
|
2403
|
-
console.log(
|
|
2404
|
-
console.log(` App Code: ${
|
|
2405
|
-
console.log(` Base URL: ${
|
|
2558
|
+
console.log(chalk4__default.default.blue("\n\u{1F4CB} Configuration:\n"));
|
|
2559
|
+
console.log(` App Code: ${chalk4__default.default.green(options.appCode)}`);
|
|
2560
|
+
console.log(` Base URL: ${chalk4__default.default.gray(options.baseURL)}`);
|
|
2406
2561
|
console.log();
|
|
2407
2562
|
}
|
|
2408
2563
|
spinner.start("Downloading skills...");
|
|
@@ -2474,16 +2629,16 @@ async function initOpenClaw(options) {
|
|
|
2474
2629
|
};
|
|
2475
2630
|
if (pretty) {
|
|
2476
2631
|
console.log();
|
|
2477
|
-
console.log(
|
|
2632
|
+
console.log(chalk4__default.default.green("\u2705 Initialization complete!"));
|
|
2478
2633
|
console.log();
|
|
2479
2634
|
console.log(`Next step: Login to your app`);
|
|
2480
|
-
console.log(
|
|
2635
|
+
console.log(chalk4__default.default.gray(` amaster login --app ${options.appCode}`));
|
|
2481
2636
|
console.log();
|
|
2482
2637
|
if (apps.length > 1) {
|
|
2483
|
-
console.log(
|
|
2638
|
+
console.log(chalk4__default.default.blue("Configured apps:"));
|
|
2484
2639
|
for (const app of apps) {
|
|
2485
2640
|
const config = getAppConfig(app);
|
|
2486
|
-
console.log(` ${
|
|
2641
|
+
console.log(` ${chalk4__default.default.gray("\u2022")} ${app} - ${config?.baseURL}`);
|
|
2487
2642
|
}
|
|
2488
2643
|
console.log();
|
|
2489
2644
|
}
|
|
@@ -2584,6 +2739,14 @@ async function downloadMcpConfig(ossEndpoint, appCode) {
|
|
|
2584
2739
|
}
|
|
2585
2740
|
|
|
2586
2741
|
// src/cli.ts
|
|
2742
|
+
function resolveCliVersion() {
|
|
2743
|
+
try {
|
|
2744
|
+
const packageJsonUrl = new URL("../package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)));
|
|
2745
|
+
return JSON.parse(fs.readFileSync(packageJsonUrl, "utf-8")).version || "0.0.0";
|
|
2746
|
+
} catch {
|
|
2747
|
+
return "0.0.0";
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2587
2750
|
function resolveAppCode(optionsApp) {
|
|
2588
2751
|
if (optionsApp) {
|
|
2589
2752
|
return optionsApp;
|
|
@@ -2592,22 +2755,22 @@ function resolveAppCode(optionsApp) {
|
|
|
2592
2755
|
if (defaultApp) {
|
|
2593
2756
|
return defaultApp;
|
|
2594
2757
|
}
|
|
2595
|
-
console.error(
|
|
2596
|
-
console.log(
|
|
2597
|
-
console.log(
|
|
2598
|
-
console.log(
|
|
2758
|
+
console.error(chalk4__default.default.red("\u274C No app specified."));
|
|
2759
|
+
console.log(chalk4__default.default.yellow("Use one of:"));
|
|
2760
|
+
console.log(chalk4__default.default.gray(" 1. Add --app <app-code> to the command"));
|
|
2761
|
+
console.log(chalk4__default.default.gray(" 2. Set a default app: amaster use <app-code>"));
|
|
2599
2762
|
process.exit(1);
|
|
2600
2763
|
}
|
|
2601
2764
|
function createAmasterClient(appCode) {
|
|
2602
2765
|
const appConfig = getAppConfig(appCode);
|
|
2603
2766
|
if (!appConfig) {
|
|
2604
|
-
console.error(
|
|
2605
|
-
console.log(
|
|
2767
|
+
console.error(chalk4__default.default.red(`\u274C App not configured: ${appCode}`));
|
|
2768
|
+
console.log(chalk4__default.default.yellow(`Initialize it first: amaster init --app-code ${appCode} --url <url>`));
|
|
2606
2769
|
process.exit(1);
|
|
2607
2770
|
}
|
|
2608
2771
|
const token = getAccessToken(appCode);
|
|
2609
2772
|
if (token && shouldRefreshToken(appCode)) {
|
|
2610
|
-
console.error(
|
|
2773
|
+
console.error(chalk4__default.default.yellow("\u26A0\uFE0F Session expiring soon. Please login again."));
|
|
2611
2774
|
}
|
|
2612
2775
|
const client$1 = client.createClient({
|
|
2613
2776
|
baseURL: appConfig.baseURL,
|
|
@@ -2618,12 +2781,12 @@ function createAmasterClient(appCode) {
|
|
|
2618
2781
|
} : {},
|
|
2619
2782
|
onUnauthorized: () => {
|
|
2620
2783
|
if (token) {
|
|
2621
|
-
console.error(
|
|
2622
|
-
console.error(
|
|
2784
|
+
console.error(chalk4__default.default.red("\n\u274C Session expired. Please login again."));
|
|
2785
|
+
console.error(chalk4__default.default.yellow(`Run: amaster login --app ${appCode}`));
|
|
2623
2786
|
} else {
|
|
2624
|
-
console.error(
|
|
2787
|
+
console.error(chalk4__default.default.red(`
|
|
2625
2788
|
\u274C Authentication required for app: ${appCode}`));
|
|
2626
|
-
console.error(
|
|
2789
|
+
console.error(chalk4__default.default.yellow(`Run: amaster login --app ${appCode}`));
|
|
2627
2790
|
}
|
|
2628
2791
|
process.exit(1);
|
|
2629
2792
|
}
|
|
@@ -2634,7 +2797,7 @@ function createAmasterClient(appCode) {
|
|
|
2634
2797
|
return client$1;
|
|
2635
2798
|
}
|
|
2636
2799
|
var program = new commander.Command();
|
|
2637
|
-
program.name("amaster").description("CLI for Amaster SDK - Multi-app support for OpenClaw").version(
|
|
2800
|
+
program.name("amaster").description("CLI for Amaster SDK - Multi-app support for OpenClaw").version(resolveCliVersion());
|
|
2638
2801
|
program.command("apps").description("List all configured apps").addOption(createFormatOption()).action((options) => {
|
|
2639
2802
|
const apps = listApps();
|
|
2640
2803
|
const current = getCurrentApp();
|
|
@@ -2650,17 +2813,17 @@ program.command("apps").description("List all configured apps").addOption(create
|
|
|
2650
2813
|
renderOutput(appSummaries, {
|
|
2651
2814
|
format: options.format,
|
|
2652
2815
|
pretty: () => {
|
|
2653
|
-
console.log(
|
|
2816
|
+
console.log(chalk4__default.default.blue("\n\u{1F4F1} Configured Apps\n"));
|
|
2654
2817
|
if (appSummaries.length === 0) {
|
|
2655
|
-
console.log(
|
|
2656
|
-
console.log(
|
|
2818
|
+
console.log(chalk4__default.default.gray(" No apps configured"));
|
|
2819
|
+
console.log(chalk4__default.default.gray(" Run: amaster init --app-code <code> --url <url>"));
|
|
2657
2820
|
} else {
|
|
2658
2821
|
for (const app of appSummaries) {
|
|
2659
|
-
const prefix = app.current ?
|
|
2660
|
-
console.log(`${prefix}${
|
|
2661
|
-
console.log(` ${
|
|
2822
|
+
const prefix = app.current ? chalk4__default.default.green("\u2192 ") : " ";
|
|
2823
|
+
console.log(`${prefix}${chalk4__default.default.bold(app.appCode)}${app.current ? chalk4__default.default.green(" (current)") : ""}`);
|
|
2824
|
+
console.log(` ${chalk4__default.default.gray(app.baseURL || "No URL")}`);
|
|
2662
2825
|
console.log(
|
|
2663
|
-
` ${app.authenticated ?
|
|
2826
|
+
` ${app.authenticated ? chalk4__default.default.green("\u25CF Authenticated") : chalk4__default.default.yellow("\u25CB Not authenticated")}`
|
|
2664
2827
|
);
|
|
2665
2828
|
console.log();
|
|
2666
2829
|
}
|
|
@@ -2679,12 +2842,12 @@ program.command("use <app-code>").description("Set the default app for subsequen
|
|
|
2679
2842
|
{
|
|
2680
2843
|
format: options.format,
|
|
2681
2844
|
pretty: () => {
|
|
2682
|
-
console.log(
|
|
2845
|
+
console.log(chalk4__default.default.green(`\u2705 Now using app: ${appCode}`));
|
|
2683
2846
|
}
|
|
2684
2847
|
}
|
|
2685
2848
|
);
|
|
2686
2849
|
} else {
|
|
2687
|
-
console.error(
|
|
2850
|
+
console.error(chalk4__default.default.red(`\u274C App not found: ${appCode}`));
|
|
2688
2851
|
process.exit(1);
|
|
2689
2852
|
}
|
|
2690
2853
|
});
|
|
@@ -2801,6 +2964,21 @@ entityCmd.command("bulk-delete <namespace> <entity>").description("Bulk delete e
|
|
|
2801
2964
|
format: options.format
|
|
2802
2965
|
});
|
|
2803
2966
|
});
|
|
2967
|
+
var modelCmd = program.command("model").description("Discover runtime datasources and table schemas");
|
|
2968
|
+
modelCmd.command("datasources").description("List runtime datasources with their models").option("--app <app-code>", "App code (uses default if not specified)").addOption(createFormatOption()).action(async (options) => {
|
|
2969
|
+
const appCode = resolveAppCode(options.app);
|
|
2970
|
+
await listDatasources(createAmasterClient(appCode), {
|
|
2971
|
+
format: options.format
|
|
2972
|
+
});
|
|
2973
|
+
});
|
|
2974
|
+
modelCmd.command("table-schema <source-id>").description("Get CREATE TABLE statements for one datasource").option("--app <app-code>", "App code (uses default if not specified)").option("--tables <tables>", "Comma-separated table names, JSON array, or @file").addOption(createFormatOption()).action(async (sourceId, options) => {
|
|
2975
|
+
const appCode = resolveAppCode(options.app);
|
|
2976
|
+
await getTableSchema(createAmasterClient(appCode), {
|
|
2977
|
+
sourceId,
|
|
2978
|
+
tables: options.tables,
|
|
2979
|
+
format: options.format
|
|
2980
|
+
});
|
|
2981
|
+
});
|
|
2804
2982
|
var bpmCmd = program.command("bpm").description("Manage BPM processes and tasks");
|
|
2805
2983
|
bpmCmd.command("processes").description("List process definitions").option("--app <app-code>", "App code (uses default if not specified)").option("--key <key>", "Filter by process definition key").option("--name <name>", "Filter by process definition name").option("--latest-version", "Only return latest version").option("--active", "Only return active process definitions").option("--suspended", "Only return suspended process definitions").option("--sort-by <field>", "Sort field").addOption(new commander.Option("--sort-order <order>", "Sort order").choices(["asc", "desc"])).option("-q, --query <json>", "Additional ProcessDefinitionQueryParams as JSON or @file").addOption(createFormatOption()).action(async (options) => {
|
|
2806
2984
|
const appCode = resolveAppCode(options.app);
|