Add approval-runs attachments download and Hose format extraction
This commit is contained in:
1 parent
f64f2b8385
commit
e9b66f787b
8 files changed
+907
-86
No files matched your search
@@ -168,8 +168,62 @@ export async function handleApprovalRunsCommand(
|
||||
}
|
||||
|
||||
if (action === "attachments") {
|
||||
const subAction = args.command[2];
|
||||
if (subAction === "download") {
|
||||
const recordId = args.command[3];
|
||||
if (!recordId) {
|
||||
throw new Error(
|
||||
"Usage: seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>]"
|
||||
);
|
||||
}
|
||||
const downloadResult = (await runToolResult(
|
||||
"seal_approval_run_attachments_download",
|
||||
client,
|
||||
corp,
|
||||
{
|
||||
recordId,
|
||||
all: booleanOption(args.options.all),
|
||||
name: stringOption(args.options.name),
|
||||
outDir:
|
||||
stringOption(args.options["out-dir"]) ??
|
||||
stringOption(args.options.outDir) ??
|
||||
stringOption(args.options.dir)
|
||||
}
|
||||
)) as any;
|
||||
|
||||
printJson(downloadResult, outputOptions(args.options));
|
||||
if (downloadResult?.total > 0 && downloadResult?.downloaded === 0) {
|
||||
throw new Error(`所有 ${downloadResult.total} 个附件下载均失败。`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const recordId = args.command[2];
|
||||
if (!recordId) throw new Error("Usage: seal-use approval-runs attachments <recordId>");
|
||||
if (!recordId) throw new Error("Usage: seal-use approval-runs attachments <recordId> | seal-use approval-runs attachments download <recordId>");
|
||||
|
||||
if (booleanOption(args.options.download)) {
|
||||
const downloadResult = (await runToolResult(
|
||||
"seal_approval_run_attachments_download",
|
||||
client,
|
||||
corp,
|
||||
{
|
||||
recordId,
|
||||
all: booleanOption(args.options.all) ?? true,
|
||||
name: stringOption(args.options.name),
|
||||
outDir:
|
||||
stringOption(args.options["out-dir"]) ??
|
||||
stringOption(args.options.outDir) ??
|
||||
stringOption(args.options.dir)
|
||||
}
|
||||
)) as any;
|
||||
|
||||
printJson(downloadResult, outputOptions(args.options));
|
||||
if (downloadResult?.total > 0 && downloadResult?.downloaded === 0) {
|
||||
throw new Error(`所有 ${downloadResult.total} 个附件下载均失败。`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
await runTool(
|
||||
"seal_approval_run_attachments_get",
|
||||
client,
|
||||
@@ -183,6 +237,35 @@ export async function handleApprovalRunsCommand(
|
||||
return;
|
||||
}
|
||||
|
||||
if (action === "download") {
|
||||
const recordId = args.command[2];
|
||||
if (!recordId) {
|
||||
throw new Error(
|
||||
"Usage: seal-use approval-runs download <recordId> [--all] [--name <name>] [--out-dir <dir>]"
|
||||
);
|
||||
}
|
||||
const downloadResult = (await runToolResult(
|
||||
"seal_approval_run_attachments_download",
|
||||
client,
|
||||
corp,
|
||||
{
|
||||
recordId,
|
||||
all: booleanOption(args.options.all),
|
||||
name: stringOption(args.options.name),
|
||||
outDir:
|
||||
stringOption(args.options["out-dir"]) ??
|
||||
stringOption(args.options.outDir) ??
|
||||
stringOption(args.options.dir)
|
||||
}
|
||||
)) as any;
|
||||
|
||||
printJson(downloadResult, outputOptions(args.options));
|
||||
if (downloadResult?.total > 0 && downloadResult?.downloaded === 0) {
|
||||
throw new Error(`所有 ${downloadResult.total} 个附件下载均失败。`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (action === "result") {
|
||||
const recordId = args.command[2];
|
||||
if (!recordId) throw new Error("Usage: seal-use approval-runs result <recordId> [--summary]");
|
||||
|
||||
Reference in new issue
Block a user