@lark-apaas/fullstack-cli 1.1.71-alpha.20261103095356 → 1.1.71-alpha.20261103101658
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 +5 -2
- package/dist/index.js +30 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,7 +108,10 @@ fullstack-cli action-plugin form-action @office/feishu-bitable --json
|
|
|
108
108
|
# 查看某个动作的 inputSchema / outputSchema(动作名 camelCase 或 kebab-case 都行)
|
|
109
109
|
fullstack-cli action-plugin form-action @office/feishu-bitable get-table-fields --help --json
|
|
110
110
|
|
|
111
|
-
#
|
|
111
|
+
# 执行:入参直接给 JSON(支持嵌套),结果 JSON 输出到 stdout
|
|
112
|
+
fullstack-cli action-plugin form-action @office/feishu-bitable list-tables --input '{"appToken":"bascnABC"}'
|
|
113
|
+
|
|
114
|
+
# 入参较大或含单引号时改用文件,二者只能给一个
|
|
112
115
|
fullstack-cli action-plugin form-action @office/feishu-bitable list-tables --input-file ./input.json
|
|
113
116
|
|
|
114
117
|
# 修改已有实例时带实例 ID(实例 formValue 进 ctx.formValue),或用草稿整体替换
|
|
@@ -290,7 +293,7 @@ fullstack-cli action-plugin --help
|
|
|
290
293
|
fullstack-cli action-plugin install <plugin>
|
|
291
294
|
fullstack-cli action-plugin list [--json]
|
|
292
295
|
fullstack-cli action-plugin form-action <plugin> [action] [--help] [--json]
|
|
293
|
-
fullstack-cli action-plugin form-action <plugin> <action> --input-file <f> [--instance-id <id> | --draft-file <f>] [--timeout <ms>]
|
|
296
|
+
fullstack-cli action-plugin form-action <plugin> <action> (--input <json> | --input-file <f>) [--instance-id <id> | --draft-file <f>] [--timeout <ms>]
|
|
294
297
|
|
|
295
298
|
# 能力配置管理
|
|
296
299
|
fullstack-cli capability --help
|
package/dist/index.js
CHANGED
|
@@ -4946,6 +4946,16 @@ function readJsonFile(filePath, label) {
|
|
|
4946
4946
|
);
|
|
4947
4947
|
}
|
|
4948
4948
|
}
|
|
4949
|
+
function parseJsonText(text, label) {
|
|
4950
|
+
try {
|
|
4951
|
+
return JSON.parse(text);
|
|
4952
|
+
} catch (error) {
|
|
4953
|
+
throw new FormCliError(
|
|
4954
|
+
FormCliErrorCode.INVALID_INPUT,
|
|
4955
|
+
`${label} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`
|
|
4956
|
+
);
|
|
4957
|
+
}
|
|
4958
|
+
}
|
|
4949
4959
|
function readJsonObjectFile(filePath, label) {
|
|
4950
4960
|
const value = readJsonFile(filePath, label);
|
|
4951
4961
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -5186,15 +5196,27 @@ function describeFormAction(pluginKey, action) {
|
|
|
5186
5196
|
}
|
|
5187
5197
|
};
|
|
5188
5198
|
}
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
if (!options.inputFile) {
|
|
5199
|
+
function readFormActionInput(options) {
|
|
5200
|
+
if (options.input !== void 0 && options.inputFile !== void 0) {
|
|
5192
5201
|
throw new FormCliError(
|
|
5193
5202
|
FormCliErrorCode.INVALID_INPUT,
|
|
5194
|
-
"--input
|
|
5203
|
+
"Use either --input <json> or --input-file <file>, not both"
|
|
5195
5204
|
);
|
|
5196
5205
|
}
|
|
5197
|
-
|
|
5206
|
+
if (options.input !== void 0) {
|
|
5207
|
+
return parseJsonText(options.input, "--input");
|
|
5208
|
+
}
|
|
5209
|
+
if (options.inputFile) {
|
|
5210
|
+
return readJsonFile(options.inputFile, "input file");
|
|
5211
|
+
}
|
|
5212
|
+
throw new FormCliError(
|
|
5213
|
+
FormCliErrorCode.INVALID_INPUT,
|
|
5214
|
+
"--input <json> or --input-file <file> is required to execute a form action (use --help to see its input schema)"
|
|
5215
|
+
);
|
|
5216
|
+
}
|
|
5217
|
+
async function executeFormAction(options) {
|
|
5218
|
+
const timeoutMs = parseTimeout(options.timeout);
|
|
5219
|
+
const input = readFormActionInput(options);
|
|
5198
5220
|
const resolved = await resolveInstalledPlugin(options.pluginKey);
|
|
5199
5221
|
const formAction2 = findFormAction(
|
|
5200
5222
|
options.pluginKey,
|
|
@@ -5271,7 +5293,7 @@ function printFormActionText(description) {
|
|
|
5271
5293
|
}
|
|
5272
5294
|
lines.push("");
|
|
5273
5295
|
lines.push(
|
|
5274
|
-
`Run: fullstack-cli action-plugin form-action ${description.key} ${action.alias} --input-file <input.json> [--instance-id <id> | --draft-file <draft.json>] [--timeout <ms>]`
|
|
5296
|
+
`Run: fullstack-cli action-plugin form-action ${description.key} ${action.alias} (--input '<json>' | --input-file <input.json>) [--instance-id <id> | --draft-file <draft.json>] [--timeout <ms>]`
|
|
5275
5297
|
);
|
|
5276
5298
|
console.log(lines.join("\n"));
|
|
5277
5299
|
}
|
|
@@ -5298,6 +5320,7 @@ async function formAction(options) {
|
|
|
5298
5320
|
const result = await executeFormAction({
|
|
5299
5321
|
pluginKey: options.pluginKey,
|
|
5300
5322
|
action: options.action,
|
|
5323
|
+
input: options.input,
|
|
5301
5324
|
inputFile: options.inputFile,
|
|
5302
5325
|
instanceId: options.instanceId,
|
|
5303
5326
|
draftFile: options.draftFile,
|
|
@@ -5477,7 +5500,7 @@ var formActionCommand = {
|
|
|
5477
5500
|
name: "form-action",
|
|
5478
5501
|
description: "List, describe or run a plugin form action (config-time query, e.g. list tables)",
|
|
5479
5502
|
register(program) {
|
|
5480
|
-
program.command(this.name).description(this.description).helpOption(false).argument("<key>", "Plugin key (e.g., @office/feishu-bitable)").argument("[action]", "Form action name, camelCase or kebab-case (e.g., getTableFields / get-table-fields)").option("--help", "Describe the plugin form actions, or one action when <action> is given").option("--json", "Output JSON (with --help: full inputSchema / outputSchema)").option("--input-file <file>", "JSON file with the action input (
|
|
5503
|
+
program.command(this.name).description(this.description).helpOption(false).argument("<key>", "Plugin key (e.g., @office/feishu-bitable)").argument("[action]", "Form action name, camelCase or kebab-case (e.g., getTableFields / get-table-fields)").option("--help", "Describe the plugin form actions, or one action when <action> is given").option("--json", "Output JSON (with --help: full inputSchema / outputSchema)").option("--input <json>", "Action input as inline JSON (use this or --input-file to execute)").option("--input-file <file>", "JSON file with the action input (use this or --input to execute)").option("--instance-id <id>", "Existing capability ID; its formValue becomes ctx.formValue").option("--draft-file <file>", "JSON file used as ctx.formValue (replaces the instance value entirely)").option("--timeout <ms>", "Execution timeout in milliseconds (default: 60000)").action(
|
|
5481
5504
|
async (key, action, options) => {
|
|
5482
5505
|
await formAction({ pluginKey: key, action, ...options });
|
|
5483
5506
|
}
|