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