openxiangda 1.0.82 → 1.0.83
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/lib/cli.js +75 -75
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -1379,81 +1379,6 @@ async function form(args) {
|
|
|
1379
1379
|
return;
|
|
1380
1380
|
}
|
|
1381
1381
|
|
|
1382
|
-
if (subcommand === 'executions') {
|
|
1383
|
-
const [automationKey] = positional;
|
|
1384
|
-
if (!automationKey) fail('用法: openxiangda automation executions <automationCode|automationId>');
|
|
1385
|
-
const target = getWorkspaceTarget(config, profileName, flags);
|
|
1386
|
-
const automationId = resolveAutomationId(target.bound, automationKey, flags);
|
|
1387
|
-
const data = await requestWithAuth(
|
|
1388
|
-
config,
|
|
1389
|
-
target.profileName,
|
|
1390
|
-
apiPathWithQuery(
|
|
1391
|
-
`/openxiangda-api/v1/apps/${encodeURIComponent(target.appType)}/automations/${encodeURIComponent(automationId)}/executions`,
|
|
1392
|
-
{
|
|
1393
|
-
status: flags.status,
|
|
1394
|
-
triggerEventType: flags['trigger-type'],
|
|
1395
|
-
startDate: flags['start-date'],
|
|
1396
|
-
endDate: flags['end-date'],
|
|
1397
|
-
page: flags.page,
|
|
1398
|
-
pageSize: flags['page-size'] || flags.limit,
|
|
1399
|
-
}
|
|
1400
|
-
)
|
|
1401
|
-
);
|
|
1402
|
-
if (flags.json) return writeJson(data);
|
|
1403
|
-
printAutomationExecutionList(data);
|
|
1404
|
-
return;
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
if (subcommand === 'logs') {
|
|
1408
|
-
const [instanceId] = positional;
|
|
1409
|
-
if (!instanceId) fail('用法: openxiangda automation logs <instanceId> [--automation <automationCode|automationId>]');
|
|
1410
|
-
const target = getWorkspaceTarget(config, profileName, flags);
|
|
1411
|
-
const data = await getAutomationExecutionDetailFromCli(
|
|
1412
|
-
config,
|
|
1413
|
-
target,
|
|
1414
|
-
instanceId,
|
|
1415
|
-
flags.automation || flags['automation-code'] || flags['automation-id']
|
|
1416
|
-
);
|
|
1417
|
-
const output = flags.redact ? redactLogValue(data) : data;
|
|
1418
|
-
if (flags.json) return writeJson(output);
|
|
1419
|
-
printAutomationExecutionLogs(output, { summary: Boolean(flags.summary) });
|
|
1420
|
-
return;
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
if (subcommand === 'diagnose') {
|
|
1424
|
-
const [automationKey] = positional;
|
|
1425
|
-
if (!automationKey) fail('用法: openxiangda automation diagnose <automationCode|automationId>');
|
|
1426
|
-
const target = getWorkspaceTarget(config, profileName, flags);
|
|
1427
|
-
const automationId = resolveAutomationId(target.bound, automationKey, flags);
|
|
1428
|
-
const records = await requestWithAuth(
|
|
1429
|
-
config,
|
|
1430
|
-
target.profileName,
|
|
1431
|
-
apiPathWithQuery(
|
|
1432
|
-
`/openxiangda-api/v1/apps/${encodeURIComponent(target.appType)}/automations/${encodeURIComponent(automationId)}/executions`,
|
|
1433
|
-
{
|
|
1434
|
-
status: flags.status || 'failed',
|
|
1435
|
-
page: 1,
|
|
1436
|
-
pageSize: flags['page-size'] || flags.limit || 1,
|
|
1437
|
-
}
|
|
1438
|
-
)
|
|
1439
|
-
);
|
|
1440
|
-
const first = records?.data?.[0];
|
|
1441
|
-
if (!first?.id) {
|
|
1442
|
-
if (flags.json) return writeJson({ found: false, message: '未找到失败执行记录' });
|
|
1443
|
-
print('未找到失败执行记录');
|
|
1444
|
-
return;
|
|
1445
|
-
}
|
|
1446
|
-
const detail = await requestWithAuth(
|
|
1447
|
-
config,
|
|
1448
|
-
target.profileName,
|
|
1449
|
-
`/openxiangda-api/v1/apps/${encodeURIComponent(target.appType)}/automations/${encodeURIComponent(automationId)}/executions/${encodeURIComponent(first.id)}`
|
|
1450
|
-
);
|
|
1451
|
-
const output = flags.redact ? redactLogValue(detail) : detail;
|
|
1452
|
-
if (flags.json) return writeJson({ found: true, detail: output, summary: buildAutomationDiagnosis(output) });
|
|
1453
|
-
print(buildAutomationDiagnosis(output));
|
|
1454
|
-
return;
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
1382
|
if (subcommand === 'publish') {
|
|
1458
1383
|
const [formKey] = positional;
|
|
1459
1384
|
if (!formKey || !flags['bundle-url']) {
|
|
@@ -1995,6 +1920,81 @@ async function automation(args) {
|
|
|
1995
1920
|
return;
|
|
1996
1921
|
}
|
|
1997
1922
|
|
|
1923
|
+
if (subcommand === 'executions') {
|
|
1924
|
+
const [automationKey] = positional;
|
|
1925
|
+
if (!automationKey) fail('用法: openxiangda automation executions <automationCode|automationId>');
|
|
1926
|
+
const target = getWorkspaceTarget(config, profileName, flags);
|
|
1927
|
+
const automationId = resolveAutomationId(target.bound, automationKey, flags);
|
|
1928
|
+
const data = await requestWithAuth(
|
|
1929
|
+
config,
|
|
1930
|
+
target.profileName,
|
|
1931
|
+
apiPathWithQuery(
|
|
1932
|
+
`/openxiangda-api/v1/apps/${encodeURIComponent(target.appType)}/automations/${encodeURIComponent(automationId)}/executions`,
|
|
1933
|
+
{
|
|
1934
|
+
status: flags.status,
|
|
1935
|
+
triggerEventType: flags['trigger-type'],
|
|
1936
|
+
startDate: flags['start-date'],
|
|
1937
|
+
endDate: flags['end-date'],
|
|
1938
|
+
page: flags.page,
|
|
1939
|
+
pageSize: flags['page-size'] || flags.limit,
|
|
1940
|
+
}
|
|
1941
|
+
)
|
|
1942
|
+
);
|
|
1943
|
+
if (flags.json) return writeJson(data);
|
|
1944
|
+
printAutomationExecutionList(data);
|
|
1945
|
+
return;
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
if (subcommand === 'logs') {
|
|
1949
|
+
const [instanceId] = positional;
|
|
1950
|
+
if (!instanceId) fail('用法: openxiangda automation logs <instanceId> [--automation <automationCode|automationId>]');
|
|
1951
|
+
const target = getWorkspaceTarget(config, profileName, flags);
|
|
1952
|
+
const data = await getAutomationExecutionDetailFromCli(
|
|
1953
|
+
config,
|
|
1954
|
+
target,
|
|
1955
|
+
instanceId,
|
|
1956
|
+
flags.automation || flags['automation-code'] || flags['automation-id']
|
|
1957
|
+
);
|
|
1958
|
+
const output = flags.redact ? redactLogValue(data) : data;
|
|
1959
|
+
if (flags.json) return writeJson(output);
|
|
1960
|
+
printAutomationExecutionLogs(output, { summary: Boolean(flags.summary) });
|
|
1961
|
+
return;
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
if (subcommand === 'diagnose') {
|
|
1965
|
+
const [automationKey] = positional;
|
|
1966
|
+
if (!automationKey) fail('用法: openxiangda automation diagnose <automationCode|automationId>');
|
|
1967
|
+
const target = getWorkspaceTarget(config, profileName, flags);
|
|
1968
|
+
const automationId = resolveAutomationId(target.bound, automationKey, flags);
|
|
1969
|
+
const records = await requestWithAuth(
|
|
1970
|
+
config,
|
|
1971
|
+
target.profileName,
|
|
1972
|
+
apiPathWithQuery(
|
|
1973
|
+
`/openxiangda-api/v1/apps/${encodeURIComponent(target.appType)}/automations/${encodeURIComponent(automationId)}/executions`,
|
|
1974
|
+
{
|
|
1975
|
+
status: flags.status || 'failed',
|
|
1976
|
+
page: 1,
|
|
1977
|
+
pageSize: flags['page-size'] || flags.limit || 1,
|
|
1978
|
+
}
|
|
1979
|
+
)
|
|
1980
|
+
);
|
|
1981
|
+
const first = records?.data?.[0];
|
|
1982
|
+
if (!first?.id) {
|
|
1983
|
+
if (flags.json) return writeJson({ found: false, message: '未找到失败执行记录' });
|
|
1984
|
+
print('未找到失败执行记录');
|
|
1985
|
+
return;
|
|
1986
|
+
}
|
|
1987
|
+
const detail = await requestWithAuth(
|
|
1988
|
+
config,
|
|
1989
|
+
target.profileName,
|
|
1990
|
+
`/openxiangda-api/v1/apps/${encodeURIComponent(target.appType)}/automations/${encodeURIComponent(automationId)}/executions/${encodeURIComponent(first.id)}`
|
|
1991
|
+
);
|
|
1992
|
+
const output = flags.redact ? redactLogValue(detail) : detail;
|
|
1993
|
+
if (flags.json) return writeJson({ found: true, detail: output, summary: buildAutomationDiagnosis(output) });
|
|
1994
|
+
print(buildAutomationDiagnosis(output));
|
|
1995
|
+
return;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
1998
|
if (['publish', 'unpublish', 'enable', 'disable'].includes(subcommand)) {
|
|
1999
1999
|
const [automationKey] = positional;
|
|
2000
2000
|
if (!automationKey) {
|