@lark-apaas/miaoda-cli 0.1.2-alpha.08ca9fb → 0.1.2-alpha.10113dd
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/dist/cli/commands/app/index.js +3 -3
- package/dist/cli/commands/db/index.js +6 -5
- package/dist/cli/commands/deploy/index.js +10 -4
- package/dist/cli/commands/file/index.js +6 -5
- package/dist/cli/commands/observability/index.js +6 -6
- package/dist/cli/commands/shared.js +5 -7
- package/dist/cli/handlers/app/get.js +2 -3
- package/dist/cli/handlers/app/update.js +4 -4
- package/dist/cli/handlers/db/data.js +2 -3
- package/dist/cli/handlers/db/schema.js +2 -3
- package/dist/cli/handlers/db/sql.js +1 -2
- package/dist/cli/handlers/deploy/deploy.js +2 -2
- package/dist/cli/handlers/deploy/error-log.js +3 -3
- package/dist/cli/handlers/deploy/get.js +3 -3
- package/dist/cli/handlers/deploy/helpers.js +4 -4
- package/dist/cli/handlers/deploy/history.js +1 -2
- package/dist/cli/handlers/file/cp.js +1 -2
- package/dist/cli/handlers/file/ls.js +1 -2
- package/dist/cli/handlers/file/rm.js +1 -2
- package/dist/cli/handlers/file/sign.js +1 -2
- package/dist/cli/handlers/file/stat.js +1 -2
- package/dist/cli/handlers/observability/analytics.js +3 -3
- package/dist/cli/handlers/observability/helpers.js +2 -2
- package/dist/cli/handlers/observability/log.js +5 -6
- package/dist/cli/handlers/observability/metric.js +3 -3
- package/dist/cli/handlers/observability/trace.js +4 -4
- package/dist/utils/args.js +8 -0
- package/package.json +1 -1
|
@@ -32,7 +32,7 @@ JSON 输出
|
|
|
32
32
|
cmd.action((0, shared_1.withHelp)(cmd, async (rawOpts) => {
|
|
33
33
|
(0, shared_1.rejectCliOverride)(cmd, "appId");
|
|
34
34
|
await (0, index_1.handleAppGet)({
|
|
35
|
-
appId: rawOpts.appId,
|
|
35
|
+
appId: (0, shared_1.resolveAppId)({ appId: rawOpts.appId }),
|
|
36
36
|
});
|
|
37
37
|
}));
|
|
38
38
|
}
|
|
@@ -45,7 +45,7 @@ function registerAppUpdate(parent) {
|
|
|
45
45
|
.option("--description <desc>", "新应用描述")
|
|
46
46
|
.addHelpText("after", `
|
|
47
47
|
JSON 输出
|
|
48
|
-
与 'app get' 一致:{"data": {...新 meta...}
|
|
48
|
+
与 'app get' 一致:{"data": {...新 meta...}}
|
|
49
49
|
|
|
50
50
|
示例
|
|
51
51
|
$ miaoda app update --name my-store
|
|
@@ -54,7 +54,7 @@ JSON 输出
|
|
|
54
54
|
cmd.action((0, shared_1.withHelp)(cmd, async (rawOpts) => {
|
|
55
55
|
(0, shared_1.rejectCliOverride)(cmd, "appId");
|
|
56
56
|
await (0, index_1.handleAppUpdate)({
|
|
57
|
-
appId: rawOpts.appId,
|
|
57
|
+
appId: (0, shared_1.resolveAppId)({ appId: rawOpts.appId }),
|
|
58
58
|
name: rawOpts.name,
|
|
59
59
|
description: rawOpts.description,
|
|
60
60
|
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerDbCommands = registerDbCommands;
|
|
4
4
|
const index_1 = require("../../../cli/handlers/db/index");
|
|
5
|
+
const shared_1 = require("../../../cli/commands/shared");
|
|
5
6
|
function registerDbCommands(program) {
|
|
6
7
|
const dbCmd = program
|
|
7
8
|
.command("db")
|
|
@@ -22,7 +23,7 @@ function registerDbCommands(program) {
|
|
|
22
23
|
.usage("<query> [flags]")
|
|
23
24
|
.argument("[query]", "要执行的 SQL 语句;省略时从标准输入读取")
|
|
24
25
|
.action(async function (query) {
|
|
25
|
-
await (0, index_1.handleDbSql)(query, this.optsWithGlobals());
|
|
26
|
+
await (0, index_1.handleDbSql)(query, { ...this.optsWithGlobals(), appId: (0, shared_1.resolveAppId)({}) });
|
|
26
27
|
})
|
|
27
28
|
.addHelpText("after", `
|
|
28
29
|
Notes:
|
|
@@ -73,7 +74,7 @@ Examples:
|
|
|
73
74
|
"查看单表完整结构请用 `schema get`;查看 DDL 变更历史请用 `changelog`(P1)。")
|
|
74
75
|
.usage("[flags]")
|
|
75
76
|
.action(async function () {
|
|
76
|
-
await (0, index_1.handleDbSchemaList)(this.optsWithGlobals());
|
|
77
|
+
await (0, index_1.handleDbSchemaList)({ ...this.optsWithGlobals(), appId: (0, shared_1.resolveAppId)({}) });
|
|
77
78
|
})
|
|
78
79
|
.addHelpText("after", `
|
|
79
80
|
Examples:
|
|
@@ -103,7 +104,7 @@ Examples:
|
|
|
103
104
|
.argument("<table>", "表名(无需带 schema 前缀)")
|
|
104
105
|
.option("--ddl", "强制输出 CREATE TABLE 建表语句(pretty 默认就是 DDL,--json 时配合此 flag 返 SQL 文本)")
|
|
105
106
|
.action(async function (table) {
|
|
106
|
-
await (0, index_1.handleDbSchemaGet)(table, this.optsWithGlobals());
|
|
107
|
+
await (0, index_1.handleDbSchemaGet)(table, { ...this.optsWithGlobals(), appId: (0, shared_1.resolveAppId)({}) });
|
|
107
108
|
})
|
|
108
109
|
.addHelpText("after", `
|
|
109
110
|
Examples:
|
|
@@ -144,7 +145,7 @@ Examples:
|
|
|
144
145
|
.option("--table <name>", "目标表名;未指定时按文件名(不含扩展名)推断(如 users.csv → users)")
|
|
145
146
|
.option("--format <fmt>", "文件格式 csv / json;未指定时按文件扩展名推断")
|
|
146
147
|
.action(async function (file) {
|
|
147
|
-
await (0, index_1.handleDbDataImport)(file, this.optsWithGlobals());
|
|
148
|
+
await (0, index_1.handleDbDataImport)(file, { ...this.optsWithGlobals(), appId: (0, shared_1.resolveAppId)({}) });
|
|
148
149
|
})
|
|
149
150
|
.addHelpText("after", `
|
|
150
151
|
Notes:
|
|
@@ -181,7 +182,7 @@ Examples:
|
|
|
181
182
|
.option("--limit <n>", "最多导出行数(不超过 5000)")
|
|
182
183
|
.option("--force", "输出文件已存在时覆盖(默认报错)")
|
|
183
184
|
.action(async function (table) {
|
|
184
|
-
await (0, index_1.handleDbDataExport)(table, this.optsWithGlobals());
|
|
185
|
+
await (0, index_1.handleDbDataExport)(table, { ...this.optsWithGlobals(), appId: (0, shared_1.resolveAppId)({}) });
|
|
185
186
|
})
|
|
186
187
|
.addHelpText("after", `
|
|
187
188
|
Notes:
|
|
@@ -35,6 +35,12 @@ JSON 输出
|
|
|
35
35
|
带 --wait:data 额外包含 detail(pipeline 终态)
|
|
36
36
|
detail/status 字段为可读字符串;对应 *_code 字段保留 BAM 原始数字枚举。
|
|
37
37
|
|
|
38
|
+
状态确认(Agent 必须执行)
|
|
39
|
+
优先使用 --wait,但无论是否传 --wait,只要 deploy 调用后没有明确的 success / failed / canceled 终态,
|
|
40
|
+
都必须每 2s 轮询一次当前发布状态:拿到 pipelineTaskID 就执行 \`miaoda deploy get <pipelineTaskID> --json\`;
|
|
41
|
+
如果没有拿到 deploy-id 或输出为空,先执行 \`miaoda deploy history --limit 1 --json\` 找到对应发布记录并取得 ID,
|
|
42
|
+
再用这个 ID 每 2s 执行一次 \`miaoda deploy get <ID> --json\`,直到 status 进入终态。
|
|
43
|
+
|
|
38
44
|
示例
|
|
39
45
|
$ miaoda deploy
|
|
40
46
|
$ miaoda deploy --wait --timeout 600
|
|
@@ -44,7 +50,7 @@ JSON 输出
|
|
|
44
50
|
deployCmd.action((0, shared_1.withHelp)(deployCmd, async (rawOpts) => {
|
|
45
51
|
(0, shared_1.rejectCliOverride)(deployCmd, "appId", "branch");
|
|
46
52
|
await (0, index_1.handleDeploy)({
|
|
47
|
-
appId: rawOpts.appId,
|
|
53
|
+
appId: (0, shared_1.resolveAppId)({ appId: rawOpts.appId }),
|
|
48
54
|
branch: rawOpts.branch,
|
|
49
55
|
wait: rawOpts.wait,
|
|
50
56
|
timeout: rawOpts.timeout,
|
|
@@ -73,7 +79,7 @@ JSON 输出
|
|
|
73
79
|
(0, shared_1.rejectCliOverride)(cmd, "appId");
|
|
74
80
|
await (0, index_1.handleDeployGet)({
|
|
75
81
|
deployId,
|
|
76
|
-
appId: rawOpts.appId,
|
|
82
|
+
appId: (0, shared_1.resolveAppId)({ appId: rawOpts.appId }),
|
|
77
83
|
});
|
|
78
84
|
}));
|
|
79
85
|
}
|
|
@@ -102,7 +108,7 @@ JSON 输出
|
|
|
102
108
|
(0, shared_1.validateTimeOptions)(rawOpts, "since", "until");
|
|
103
109
|
(0, shared_1.rejectCliOverride)(cmd, "appId");
|
|
104
110
|
await (0, index_1.handleDeployHistory)({
|
|
105
|
-
appId: rawOpts.appId,
|
|
111
|
+
appId: (0, shared_1.resolveAppId)({ appId: rawOpts.appId }),
|
|
106
112
|
status: rawOpts.status,
|
|
107
113
|
since: rawOpts.since,
|
|
108
114
|
until: rawOpts.until,
|
|
@@ -128,7 +134,7 @@ JSON 输出
|
|
|
128
134
|
(0, shared_1.rejectCliOverride)(cmd, "appId");
|
|
129
135
|
await (0, index_1.handleDeployErrorLog)({
|
|
130
136
|
deployId,
|
|
131
|
-
appId: rawOpts.appId,
|
|
137
|
+
appId: (0, shared_1.resolveAppId)({ appId: rawOpts.appId }),
|
|
132
138
|
});
|
|
133
139
|
}));
|
|
134
140
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.registerFileCommands = registerFileCommands;
|
|
4
4
|
const index_1 = require("../../../cli/handlers/file/index");
|
|
5
5
|
const error_1 = require("../../../utils/error");
|
|
6
|
+
const shared_1 = require("../../../cli/commands/shared");
|
|
6
7
|
/**
|
|
7
8
|
* commander option 校验器:把 --limit <n> 解析成正整数(≥1)。
|
|
8
9
|
* 默认值(如 "50")会先经过这里被规范化成 number。
|
|
@@ -43,7 +44,7 @@ function registerFileCommands(program) {
|
|
|
43
44
|
.option("--cursor <token>", "分页游标,从上次响应的 next_cursor 取值")
|
|
44
45
|
.option("--all", "自动翻页返回全部结果")
|
|
45
46
|
.action(async (query, opts) => {
|
|
46
|
-
await (0, index_1.handleFileLs)({ ...opts, query });
|
|
47
|
+
await (0, index_1.handleFileLs)({ ...opts, appId: (0, shared_1.resolveAppId)({}), query });
|
|
47
48
|
})
|
|
48
49
|
.addHelpText("after", `
|
|
49
50
|
Examples:
|
|
@@ -68,7 +69,7 @@ Examples:
|
|
|
68
69
|
.usage("<file> [flags]")
|
|
69
70
|
.argument("<file>", "文件的路径或文件名(自动识别)")
|
|
70
71
|
.action(async (file, opts) => {
|
|
71
|
-
await (0, index_1.handleFileStat)(file, opts);
|
|
72
|
+
await (0, index_1.handleFileStat)(file, { ...opts, appId: (0, shared_1.resolveAppId)({}) });
|
|
72
73
|
})
|
|
73
74
|
.addHelpText("after", `
|
|
74
75
|
Notes:
|
|
@@ -101,7 +102,7 @@ Examples:
|
|
|
101
102
|
.argument("<dst>", "目标:本地路径或远程路径")
|
|
102
103
|
.option("--rename <name>", "上传后在远端使用的新文件名")
|
|
103
104
|
.action(async (src, dst, opts) => {
|
|
104
|
-
await (0, index_1.handleFileCp)(src, dst, opts);
|
|
105
|
+
await (0, index_1.handleFileCp)(src, dst, { ...opts, appId: (0, shared_1.resolveAppId)({}) });
|
|
105
106
|
})
|
|
106
107
|
.addHelpText("after", `
|
|
107
108
|
Notes:
|
|
@@ -147,7 +148,7 @@ Examples:
|
|
|
147
148
|
.option("-n, --name <name>", "按文件名删除(可重复指定)", (value, prev) => [...(prev ?? []), value])
|
|
148
149
|
.option("-y, --yes", "跳过交互确认;非交互场景必加")
|
|
149
150
|
.action(async (paths, opts) => {
|
|
150
|
-
await (0, index_1.handleFileRm)(paths, opts);
|
|
151
|
+
await (0, index_1.handleFileRm)(paths, { ...opts, appId: (0, shared_1.resolveAppId)({}) });
|
|
151
152
|
})
|
|
152
153
|
.addHelpText("after", `
|
|
153
154
|
Notes:
|
|
@@ -190,7 +191,7 @@ Examples:
|
|
|
190
191
|
.argument("<file>", "文件的路径或文件名")
|
|
191
192
|
.option("--expires <duration>", "链接有效期,支持 30m / 24h / 7d 等单位(默认 1d,最长 30d)")
|
|
192
193
|
.action(async (file, opts) => {
|
|
193
|
-
await (0, index_1.handleFileSign)(file, opts);
|
|
194
|
+
await (0, index_1.handleFileSign)(file, { ...opts, appId: (0, shared_1.resolveAppId)({}) });
|
|
194
195
|
})
|
|
195
196
|
.addHelpText("after", `
|
|
196
197
|
Notes:
|
|
@@ -45,7 +45,7 @@ function registerLog(parent) {
|
|
|
45
45
|
.argParser((0, shared_1.caseInsensitiveChoice)(["DEBUG", "INFO", "WARN", "ERROR"])))
|
|
46
46
|
.option("--since <time>", "开始时间")
|
|
47
47
|
.option("--until <time>", "截止时间")
|
|
48
|
-
.option("--log-id <id>", "
|
|
48
|
+
.option("--log-id <id>", "按请求 logid 过滤(attributes.ob_data_id)")
|
|
49
49
|
.option("--trace-id <id>", "按 trace ID 过滤")
|
|
50
50
|
.option("--grep <pattern>", "按关键字模糊搜索 body")
|
|
51
51
|
.option("--module <name>", "按模块名过滤")
|
|
@@ -70,7 +70,7 @@ JSON 输出
|
|
|
70
70
|
(0, shared_1.validateTimeOptions)(rawOpts, "since", "until");
|
|
71
71
|
(0, shared_1.rejectCliOverride)(cmd, "appId");
|
|
72
72
|
await (0, index_1.handleObservabilityLog)({
|
|
73
|
-
appId: rawOpts.appId,
|
|
73
|
+
appId: (0, shared_1.resolveAppId)({ appId: rawOpts.appId }),
|
|
74
74
|
level: rawOpts.level,
|
|
75
75
|
since: rawOpts.since,
|
|
76
76
|
until: rawOpts.until,
|
|
@@ -117,7 +117,7 @@ JSON 输出
|
|
|
117
117
|
(0, shared_1.validateTimeOptions)(rawOpts, "since", "until");
|
|
118
118
|
(0, shared_1.rejectCliOverride)(listCmd, "appId");
|
|
119
119
|
await (0, index_1.handleObservabilityTraceList)({
|
|
120
|
-
appId: rawOpts.appId,
|
|
120
|
+
appId: (0, shared_1.resolveAppId)({ appId: rawOpts.appId }),
|
|
121
121
|
since: rawOpts.since,
|
|
122
122
|
until: rawOpts.until,
|
|
123
123
|
traceId: rawOpts.traceId,
|
|
@@ -149,7 +149,7 @@ JSON 输出
|
|
|
149
149
|
(0, shared_1.rejectCliOverride)(getCmd, "appId");
|
|
150
150
|
await (0, index_1.handleObservabilityTraceGet)({
|
|
151
151
|
traceId,
|
|
152
|
-
appId: rawOpts.appId,
|
|
152
|
+
appId: (0, shared_1.resolveAppId)({ appId: rawOpts.appId }),
|
|
153
153
|
withLogSeverityCount: rawOpts.withLogSeverityCount,
|
|
154
154
|
});
|
|
155
155
|
}));
|
|
@@ -185,7 +185,7 @@ JSON 输出
|
|
|
185
185
|
(0, shared_1.rejectCliOverride)(cmd, "appId");
|
|
186
186
|
await (0, index_1.handleObservabilityMetric)({
|
|
187
187
|
metricName,
|
|
188
|
-
appId: rawOpts.appId,
|
|
188
|
+
appId: (0, shared_1.resolveAppId)({ appId: rawOpts.appId }),
|
|
189
189
|
page: rawOpts.page,
|
|
190
190
|
api: rawOpts.api,
|
|
191
191
|
series: rawOpts.series,
|
|
@@ -221,7 +221,7 @@ JSON 输出
|
|
|
221
221
|
(0, shared_1.rejectCliOverride)(cmd, "appId");
|
|
222
222
|
await (0, index_1.handleObservabilityAnalytics)({
|
|
223
223
|
analyticsName,
|
|
224
|
-
appId: rawOpts.appId,
|
|
224
|
+
appId: (0, shared_1.resolveAppId)({ appId: rawOpts.appId }),
|
|
225
225
|
env: rawOpts.env,
|
|
226
226
|
page: rawOpts.page,
|
|
227
227
|
series: rawOpts.series,
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.failArgs = void 0;
|
|
3
4
|
exports.appIdOption = appIdOption;
|
|
4
5
|
exports.branchOption = branchOption;
|
|
5
6
|
exports.softRequiredOption = softRequiredOption;
|
|
6
7
|
exports.resolveAppId = resolveAppId;
|
|
7
8
|
exports.withHelp = withHelp;
|
|
8
|
-
exports.failArgs = failArgs;
|
|
9
9
|
exports.caseInsensitiveChoice = caseInsensitiveChoice;
|
|
10
10
|
exports.validateTimeOptions = validateTimeOptions;
|
|
11
11
|
exports.rejectCliOverride = rejectCliOverride;
|
|
12
12
|
const commander_1 = require("commander");
|
|
13
13
|
const error_1 = require("../../utils/error");
|
|
14
14
|
const time_1 = require("../../utils/time");
|
|
15
|
+
const args_1 = require("../../utils/args");
|
|
16
|
+
Object.defineProperty(exports, "failArgs", { enumerable: true, get: function () { return args_1.failArgs; } });
|
|
15
17
|
/** --app-id option,需要应用上下文的命令自行 .addOption(appIdOption()) */
|
|
16
18
|
function appIdOption() {
|
|
17
19
|
return new commander_1.Option("--app-id <id>", "指定目标应用").env("MIAODA_APP_ID");
|
|
@@ -61,10 +63,6 @@ function withHelp(cmd, handler) {
|
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
65
|
}
|
|
64
|
-
/** 参数校验失败时抛出,配合 withHelp 自动打 help */
|
|
65
|
-
function failArgs(message) {
|
|
66
|
-
throw new error_1.AppError("ARGS_INVALID", message);
|
|
67
|
-
}
|
|
68
66
|
/**
|
|
69
67
|
* 大小写不敏感的 choice argParser:把用户输入按 lowerCase 匹配回 canonical 数组里
|
|
70
68
|
* 的同名值(保留 canonical 大小写),未命中抛 Commander 的 InvalidArgumentError
|
|
@@ -101,7 +99,7 @@ function validateTimeOptions(opts, ...names) {
|
|
|
101
99
|
if (value === undefined)
|
|
102
100
|
continue;
|
|
103
101
|
if (typeof value !== "string") {
|
|
104
|
-
failArgs(`--${name.replace(/([A-Z])/g, "-$1").toLowerCase()} 必须是时间字符串`);
|
|
102
|
+
(0, args_1.failArgs)(`--${name.replace(/([A-Z])/g, "-$1").toLowerCase()} 必须是时间字符串`);
|
|
105
103
|
}
|
|
106
104
|
(0, time_1.parseTimeToMs)(value);
|
|
107
105
|
}
|
|
@@ -122,7 +120,7 @@ function rejectCliOverride(cmd, ...optNames) {
|
|
|
122
120
|
for (const name of optNames) {
|
|
123
121
|
if (cmd.getOptionValueSource(name) === "cli") {
|
|
124
122
|
const flag = "--" + name.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
125
|
-
failArgs(`${flag} 由沙箱/本地配置注入,不允许显式传递`);
|
|
123
|
+
(0, args_1.failArgs)(`${flag} 由沙箱/本地配置注入,不允许显式传递`);
|
|
126
124
|
}
|
|
127
125
|
}
|
|
128
126
|
}
|
|
@@ -36,13 +36,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.handleAppGet = handleAppGet;
|
|
37
37
|
const api = __importStar(require("../../../api/index"));
|
|
38
38
|
const output_1 = require("../../../utils/output");
|
|
39
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
40
39
|
const index_1 = require("../../../api/app/index");
|
|
41
40
|
/** miaoda app get [--app-id <id>] */
|
|
42
41
|
async function handleAppGet(opts) {
|
|
43
|
-
const appID =
|
|
42
|
+
const appID = opts.appId;
|
|
44
43
|
const resp = await api.app.getAppInfo(appID);
|
|
45
44
|
// BAM 在 status_code=0 时 data 字段含 appInfo;不存在则 fallback 空对象
|
|
46
45
|
const meta = resp.appInfo?.appMeta ?? {};
|
|
47
|
-
(0, output_1.emit)({ data: meta
|
|
46
|
+
(0, output_1.emit)({ data: meta }, index_1.appMetaSchema);
|
|
48
47
|
}
|
|
@@ -36,14 +36,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.handleAppUpdate = handleAppUpdate;
|
|
37
37
|
const api = __importStar(require("../../../api/index"));
|
|
38
38
|
const output_1 = require("../../../utils/output");
|
|
39
|
-
const
|
|
39
|
+
const args_1 = require("../../../utils/args");
|
|
40
40
|
const index_1 = require("../../../api/app/index");
|
|
41
41
|
/** miaoda app update [--app-id <id>] [--name <n>] [--description <d>] */
|
|
42
42
|
async function handleAppUpdate(opts) {
|
|
43
43
|
if (opts.name === undefined && opts.description === undefined) {
|
|
44
|
-
(0,
|
|
44
|
+
(0, args_1.failArgs)("至少需要 --name 或 --description 中的一个");
|
|
45
45
|
}
|
|
46
|
-
const appID =
|
|
46
|
+
const appID = opts.appId;
|
|
47
47
|
await api.app.updateAppMeta({
|
|
48
48
|
appID,
|
|
49
49
|
name: opts.name,
|
|
@@ -55,5 +55,5 @@ async function handleAppUpdate(opts) {
|
|
|
55
55
|
if (!(0, output_1.isJsonMode)()) {
|
|
56
56
|
process.stdout.write("✓ App updated successfully\n");
|
|
57
57
|
}
|
|
58
|
-
(0, output_1.emit)({ data: meta
|
|
58
|
+
(0, output_1.emit)({ data: meta }, index_1.appMetaSchema);
|
|
59
59
|
}
|
|
@@ -40,13 +40,12 @@ const path = __importStar(require("node:path"));
|
|
|
40
40
|
const api = __importStar(require("../../../api/index"));
|
|
41
41
|
const error_1 = require("../../../utils/error");
|
|
42
42
|
const output_1 = require("../../../utils/output");
|
|
43
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
44
43
|
const render_1 = require("../../../utils/render");
|
|
45
44
|
// P0 规格(对齐技术方案关键决策 2)
|
|
46
45
|
const MAX_SIZE_BYTES = 1 * 1024 * 1024; // 1 MB
|
|
47
46
|
const MAX_ROWS = 5000;
|
|
48
47
|
async function handleDbDataImport(file, opts) {
|
|
49
|
-
const appId =
|
|
48
|
+
const appId = opts.appId;
|
|
50
49
|
const ext = path.extname(file).toLowerCase();
|
|
51
50
|
const format = resolveFormat(opts.format, ext, "import");
|
|
52
51
|
let body;
|
|
@@ -95,7 +94,7 @@ async function handleDbDataImport(file, opts) {
|
|
|
95
94
|
: `OK Imported ${file} -> table '${result.tableName}' (${String(result.recordCount)} rows)`);
|
|
96
95
|
}
|
|
97
96
|
async function handleDbDataExport(table, opts) {
|
|
98
|
-
const appId =
|
|
97
|
+
const appId = opts.appId;
|
|
99
98
|
const format = resolveFormat(opts.format, undefined, "export", "csv");
|
|
100
99
|
const outputPath = opts.file ?? `${table}.${format}`;
|
|
101
100
|
const limit = opts.limit ? Number(opts.limit) : MAX_ROWS;
|
|
@@ -39,12 +39,11 @@ const api = __importStar(require("../../../api/index"));
|
|
|
39
39
|
const error_1 = require("../../../utils/error");
|
|
40
40
|
const output_1 = require("../../../utils/output");
|
|
41
41
|
const render_1 = require("../../../utils/render");
|
|
42
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
43
42
|
const colors_1 = require("../../../utils/colors");
|
|
44
43
|
const index_1 = require("../../../api/db/index");
|
|
45
44
|
// ── schema list ──
|
|
46
45
|
async function handleDbSchemaList(opts) {
|
|
47
|
-
const appId =
|
|
46
|
+
const appId = opts.appId;
|
|
48
47
|
const resp = await api.db.getSchema({
|
|
49
48
|
appId,
|
|
50
49
|
format: "schema",
|
|
@@ -80,7 +79,7 @@ async function handleDbSchemaList(opts) {
|
|
|
80
79
|
(0, output_1.emit)(tty ? (0, render_1.renderAlignedTable)(headers, rows) : (0, render_1.renderTsv)(headers, rows));
|
|
81
80
|
}
|
|
82
81
|
async function handleDbSchemaGet(table, opts) {
|
|
83
|
-
const appId =
|
|
82
|
+
const appId = opts.appId;
|
|
84
83
|
const tty = (0, render_1.isStdoutTty)();
|
|
85
84
|
const forceDdl = Boolean(opts.ddl);
|
|
86
85
|
const wantsStructured = (0, output_1.isJsonMode)() || (tty && !forceDdl);
|
|
@@ -42,7 +42,6 @@ const error_1 = require("../../../utils/error");
|
|
|
42
42
|
const output_1 = require("../../../utils/output");
|
|
43
43
|
const config_1 = require("../../../utils/config");
|
|
44
44
|
const logger_1 = require("../../../utils/logger");
|
|
45
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
46
45
|
const render_1 = require("../../../utils/render");
|
|
47
46
|
const colors_1 = require("../../../utils/colors");
|
|
48
47
|
const fuzzy_match_1 = require("../../../utils/fuzzy-match");
|
|
@@ -62,7 +61,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
62
61
|
* 末尾汇总,--json 输出 data 数组。
|
|
63
62
|
*/
|
|
64
63
|
async function handleDbSql(query, opts) {
|
|
65
|
-
const appId =
|
|
64
|
+
const appId = opts.appId;
|
|
66
65
|
const sql = await readSql(query);
|
|
67
66
|
if (!sql.trim()) {
|
|
68
67
|
throw new error_1.AppError("ARGS_INVALID", "Empty SQL (no inline query and stdin is empty)");
|
|
@@ -36,18 +36,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.handleDeploy = handleDeploy;
|
|
37
37
|
const api = __importStar(require("../../../api/index"));
|
|
38
38
|
const output_1 = require("../../../utils/output");
|
|
39
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
40
39
|
const index_1 = require("../../../api/deploy/index");
|
|
41
40
|
const polling_1 = require("./polling");
|
|
42
41
|
const format_1 = require("./format");
|
|
43
42
|
/** miaoda deploy [--branch ...] [--wait] [--timeout 300] */
|
|
44
43
|
async function handleDeploy(opts) {
|
|
45
|
-
const appID =
|
|
44
|
+
const appID = opts.appId;
|
|
46
45
|
const resp = await api.deploy.createRelease({ appID, branch: opts.branch });
|
|
47
46
|
const pipelineTaskID = resp.pipelineTaskID ?? "";
|
|
48
47
|
if (!opts.wait) {
|
|
49
48
|
if (!(0, output_1.isJsonMode)()) {
|
|
50
49
|
process.stdout.write(`✓ Deployment triggered. (deploy-id: ${pipelineTaskID})\n`);
|
|
50
|
+
process.stdout.write(` hint: No terminal status yet. Poll every 2s with \`miaoda deploy get ${pipelineTaskID} --json\`; if no deploy-id is visible, first get it from \`miaoda deploy history --limit 1 --json\`.\n`);
|
|
51
51
|
}
|
|
52
52
|
(0, output_1.emit)({
|
|
53
53
|
data: { pipelineTaskID },
|
|
@@ -36,14 +36,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.handleDeployErrorLog = handleDeployErrorLog;
|
|
37
37
|
const api = __importStar(require("../../../api/index"));
|
|
38
38
|
const output_1 = require("../../../utils/output");
|
|
39
|
-
const
|
|
39
|
+
const args_1 = require("../../../utils/args");
|
|
40
40
|
const index_1 = require("../../../api/deploy/index");
|
|
41
41
|
const helpers_1 = require("./helpers");
|
|
42
42
|
/** miaoda deploy error-log <deploy-id> */
|
|
43
43
|
async function handleDeployErrorLog(opts) {
|
|
44
44
|
if (!opts.deployId)
|
|
45
|
-
(0,
|
|
46
|
-
const appID =
|
|
45
|
+
(0, args_1.failArgs)("<deploy-id> 必填");
|
|
46
|
+
const appID = opts.appId;
|
|
47
47
|
(0, helpers_1.parseDeployId)(opts.deployId); // 仅校验数字形式;URL 直接用原字符串
|
|
48
48
|
const instanceID = opts.deployId;
|
|
49
49
|
const resp = await api.deploy.getErrorLog({ appID, instanceID });
|
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.handleDeployGet = handleDeployGet;
|
|
37
37
|
const api = __importStar(require("../../../api/index"));
|
|
38
38
|
const output_1 = require("../../../utils/output");
|
|
39
|
-
const
|
|
39
|
+
const args_1 = require("../../../utils/args");
|
|
40
40
|
const error_1 = require("../../../utils/error");
|
|
41
41
|
const index_1 = require("../../../api/deploy/index");
|
|
42
42
|
const helpers_1 = require("./helpers");
|
|
@@ -54,8 +54,8 @@ const DEPLOY_GET_LOOKUP_LIMIT = 500;
|
|
|
54
54
|
*/
|
|
55
55
|
async function handleDeployGet(opts) {
|
|
56
56
|
if (!opts.deployId)
|
|
57
|
-
(0,
|
|
58
|
-
const appID =
|
|
57
|
+
(0, args_1.failArgs)("<deploy-id> 必填");
|
|
58
|
+
const appID = opts.appId;
|
|
59
59
|
const deployId = (0, helpers_1.parseDeployId)(opts.deployId);
|
|
60
60
|
const resp = await api.deploy.listPipelineInstances({
|
|
61
61
|
appID,
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseStatusFlag = parseStatusFlag;
|
|
4
4
|
exports.validateLimit = validateLimit;
|
|
5
5
|
exports.parseDeployId = parseDeployId;
|
|
6
|
-
const
|
|
6
|
+
const args_1 = require("../../../utils/args");
|
|
7
7
|
const index_1 = require("../../../api/deploy/index");
|
|
8
8
|
/**
|
|
9
9
|
* 把 CLI --status 字符串映射成 BAM NodeStatus 数字;非法值抛 ARGS_INVALID。
|
|
@@ -14,7 +14,7 @@ const index_1 = require("../../../api/deploy/index");
|
|
|
14
14
|
function parseStatusFlag(text) {
|
|
15
15
|
const value = (0, index_1.nodeStatusFromText)(text);
|
|
16
16
|
if (value === undefined) {
|
|
17
|
-
(0,
|
|
17
|
+
(0, args_1.failArgs)(`--status 无效:'${text}'。可选值:todo | running | success | failed | canceled | hold_on`);
|
|
18
18
|
}
|
|
19
19
|
return value;
|
|
20
20
|
}
|
|
@@ -22,7 +22,7 @@ function parseStatusFlag(text) {
|
|
|
22
22
|
function validateLimit(limit, defaultLimit = 50) {
|
|
23
23
|
const n = Number.isFinite(limit) ? limit : defaultLimit;
|
|
24
24
|
if (n <= 0 || n > 100) {
|
|
25
|
-
(0,
|
|
25
|
+
(0, args_1.failArgs)(`--limit 必须在 1~100 之间,收到 ${String(n)}`);
|
|
26
26
|
}
|
|
27
27
|
return n;
|
|
28
28
|
}
|
|
@@ -35,7 +35,7 @@ function validateLimit(limit, defaultLimit = 50) {
|
|
|
35
35
|
function parseDeployId(text) {
|
|
36
36
|
const n = Number(text);
|
|
37
37
|
if (!Number.isFinite(n) || !/^\d+$/.test(text)) {
|
|
38
|
-
(0,
|
|
38
|
+
(0, args_1.failArgs)(`<deploy-id> 必须是数字 ID,收到 '${text}'`);
|
|
39
39
|
}
|
|
40
40
|
return n;
|
|
41
41
|
}
|
|
@@ -36,14 +36,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.handleDeployHistory = handleDeployHistory;
|
|
37
37
|
const api = __importStar(require("../../../api/index"));
|
|
38
38
|
const output_1 = require("../../../utils/output");
|
|
39
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
40
39
|
const time_1 = require("../../../utils/time");
|
|
41
40
|
const index_1 = require("../../../api/deploy/index");
|
|
42
41
|
const helpers_1 = require("./helpers");
|
|
43
42
|
const format_1 = require("./format");
|
|
44
43
|
/** miaoda deploy history */
|
|
45
44
|
async function handleDeployHistory(opts) {
|
|
46
|
-
const appID =
|
|
45
|
+
const appID = opts.appId;
|
|
47
46
|
const limit = (0, helpers_1.validateLimit)(opts.limit ?? 50);
|
|
48
47
|
const req = {
|
|
49
48
|
appID,
|
|
@@ -44,7 +44,6 @@ const api = __importStar(require("../../../api/index"));
|
|
|
44
44
|
const output_1 = require("../../../utils/output");
|
|
45
45
|
const render_1 = require("../../../utils/render");
|
|
46
46
|
const error_1 = require("../../../utils/error");
|
|
47
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
48
47
|
const colors_1 = require("../../../utils/colors");
|
|
49
48
|
const MAX_UPLOAD_BYTES = 100 * 1024 * 1024;
|
|
50
49
|
/**
|
|
@@ -233,7 +232,7 @@ async function handleDownload(appId, remoteRaw, localRaw) {
|
|
|
233
232
|
}
|
|
234
233
|
}
|
|
235
234
|
async function handleFileCp(src, dst, opts) {
|
|
236
|
-
const appId =
|
|
235
|
+
const appId = opts.appId;
|
|
237
236
|
// src 本地存在 → upload;其他情况(file_ref / `/path` / 裸文件名)→ download
|
|
238
237
|
if (isLocalSrc(src)) {
|
|
239
238
|
return handleUpload(appId, src, dst, opts.rename);
|
|
@@ -38,7 +38,6 @@ const api = __importStar(require("../../../api/index"));
|
|
|
38
38
|
const output_1 = require("../../../utils/output");
|
|
39
39
|
const render_1 = require("../../../utils/render");
|
|
40
40
|
const error_1 = require("../../../utils/error");
|
|
41
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
42
41
|
const index_1 = require("../../../api/file/index");
|
|
43
42
|
/**
|
|
44
43
|
* 把位置参数 `query` 路由到 `--path` 或 `--name`:
|
|
@@ -65,7 +64,7 @@ function resolveQueryRouting(opts) {
|
|
|
65
64
|
return { name: opts.query };
|
|
66
65
|
}
|
|
67
66
|
async function handleFileLs(opts) {
|
|
68
|
-
const appId =
|
|
67
|
+
const appId = opts.appId;
|
|
69
68
|
// commander 已经把 --limit 解析为 number;保留 ?? undefined 兼容老调用
|
|
70
69
|
const limit = opts.limit;
|
|
71
70
|
const sizeGt = opts.sizeGt ? (0, render_1.parseSize)(opts.sizeGt) : undefined;
|
|
@@ -40,7 +40,6 @@ exports.handleFileRm = handleFileRm;
|
|
|
40
40
|
const api = __importStar(require("../../../api/index"));
|
|
41
41
|
const output_1 = require("../../../utils/output");
|
|
42
42
|
const error_1 = require("../../../utils/error");
|
|
43
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
44
43
|
const index_1 = require("../../../api/file/index");
|
|
45
44
|
const render_1 = require("../../../utils/render");
|
|
46
45
|
const colors_1 = require("../../../utils/colors");
|
|
@@ -133,7 +132,7 @@ async function handleFileRm(paths, opts) {
|
|
|
133
132
|
if (totalCount > MAX_BATCH) {
|
|
134
133
|
throw new error_1.AppError("FILE_BATCH_TOO_MANY", `Batch size ${String(totalCount)} exceeds the 100 limit`);
|
|
135
134
|
}
|
|
136
|
-
const appId =
|
|
135
|
+
const appId = opts.appId;
|
|
137
136
|
// destructive guardrail
|
|
138
137
|
const tty = (0, render_1.isStdoutTty)();
|
|
139
138
|
if (tty && !opts.yes) {
|
|
@@ -38,7 +38,6 @@ const api = __importStar(require("../../../api/index"));
|
|
|
38
38
|
const output_1 = require("../../../utils/output");
|
|
39
39
|
const render_1 = require("../../../utils/render");
|
|
40
40
|
const error_1 = require("../../../utils/error");
|
|
41
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
42
41
|
const index_1 = require("../../../api/file/index");
|
|
43
42
|
const MAX_EXPIRES_SECONDS = 30 * 86400;
|
|
44
43
|
const DEFAULT_EXPIRES_SECONDS = 86400; // 1d(PRD 规定)
|
|
@@ -64,7 +63,7 @@ async function resolveFilePath(appId, input) {
|
|
|
64
63
|
return resolved.file.path;
|
|
65
64
|
}
|
|
66
65
|
async function handleFileSign(file, opts) {
|
|
67
|
-
const appId =
|
|
66
|
+
const appId = opts.appId;
|
|
68
67
|
let expiresSec = DEFAULT_EXPIRES_SECONDS;
|
|
69
68
|
if (opts.expires) {
|
|
70
69
|
expiresSec = (0, render_1.parseDuration)(opts.expires);
|
|
@@ -38,7 +38,6 @@ const api = __importStar(require("../../../api/index"));
|
|
|
38
38
|
const output_1 = require("../../../utils/output");
|
|
39
39
|
const render_1 = require("../../../utils/render");
|
|
40
40
|
const error_1 = require("../../../utils/error");
|
|
41
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
42
41
|
const index_1 = require("../../../api/file/index");
|
|
43
42
|
/**
|
|
44
43
|
* 解析 `<file>` 为后端 head 可用的 filePath。
|
|
@@ -67,7 +66,7 @@ async function resolveFile(appId, input) {
|
|
|
67
66
|
return head;
|
|
68
67
|
}
|
|
69
68
|
async function handleFileStat(file, opts) {
|
|
70
|
-
const appId =
|
|
69
|
+
const appId = opts.appId;
|
|
71
70
|
const info = await resolveFile(appId, file);
|
|
72
71
|
if ((0, output_1.isJsonMode)()) {
|
|
73
72
|
(0, output_1.emitOk)(info);
|
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.handleObservabilityAnalytics = handleObservabilityAnalytics;
|
|
37
37
|
const api = __importStar(require("../../../api/index"));
|
|
38
38
|
const output_1 = require("../../../utils/output");
|
|
39
|
-
const
|
|
39
|
+
const args_1 = require("../../../utils/args");
|
|
40
40
|
const helpers_1 = require("./helpers");
|
|
41
41
|
const GRANULARITY_TO_UNIT = {
|
|
42
42
|
day: "DAY",
|
|
@@ -68,8 +68,8 @@ const ANALYTICS_LABELS = {
|
|
|
68
68
|
/** miaoda observability analytics <analytics-name> */
|
|
69
69
|
async function handleObservabilityAnalytics(opts) {
|
|
70
70
|
if (!opts.analyticsName)
|
|
71
|
-
(0,
|
|
72
|
-
const appID =
|
|
71
|
+
(0, args_1.failArgs)("<analytics-name> 必填");
|
|
72
|
+
const appID = opts.appId;
|
|
73
73
|
const { metricTypes, labelByMetric, extraFilters } = resolveAnalyticsSelection(opts.analyticsName, opts.series);
|
|
74
74
|
const timeAggregationUnit = opts.granularity
|
|
75
75
|
? (GRANULARITY_TO_UNIT[opts.granularity] ?? opts.granularity.toUpperCase())
|
|
@@ -6,7 +6,7 @@ exports.rangeFilter = rangeFilter;
|
|
|
6
6
|
exports.fuzzyFilter = fuzzyFilter;
|
|
7
7
|
exports.buildFieldFilters = buildFieldFilters;
|
|
8
8
|
exports.validateLimit = validateLimit;
|
|
9
|
-
const
|
|
9
|
+
const args_1 = require("../../../utils/args");
|
|
10
10
|
const index_1 = require("../../../api/observability/index");
|
|
11
11
|
// 时间解析助手已抽到 utils/time.ts;这里 re-export 维持 observability handler 的旧 import 路径。
|
|
12
12
|
var time_1 = require("../../../utils/time");
|
|
@@ -60,7 +60,7 @@ function buildFieldFilters(entries) {
|
|
|
60
60
|
function validateLimit(limit, defaultLimit = 50) {
|
|
61
61
|
const n = Number.isFinite(limit) ? limit : defaultLimit;
|
|
62
62
|
if (n <= 0 || n > 100) {
|
|
63
|
-
(0,
|
|
63
|
+
(0, args_1.failArgs)(`--limit 必须在 1~100 之间,收到 ${String(n)}`);
|
|
64
64
|
}
|
|
65
65
|
return n;
|
|
66
66
|
}
|
|
@@ -36,22 +36,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.handleObservabilityLog = handleObservabilityLog;
|
|
37
37
|
const api = __importStar(require("../../../api/index"));
|
|
38
38
|
const output_1 = require("../../../utils/output");
|
|
39
|
-
const shared_1 = require("../../../cli/commands/shared");
|
|
40
39
|
const index_1 = require("../../../api/observability/index");
|
|
41
40
|
const helpers_1 = require("./helpers");
|
|
42
41
|
/** miaoda observability log */
|
|
43
42
|
async function handleObservabilityLog(opts) {
|
|
44
|
-
const appID =
|
|
43
|
+
const appID = opts.appId;
|
|
45
44
|
const appEnv = "runtime";
|
|
46
45
|
const limit = (0, helpers_1.validateLimit)(opts.limit ?? 50);
|
|
47
|
-
// 过滤 key 对齐 BAM
|
|
48
|
-
// - 顶层字段:
|
|
49
|
-
// - attributes 里的业务字段:module / user_id / page / api(snake_case,
|
|
46
|
+
// 过滤 key 对齐 BAM 查询字段名:
|
|
47
|
+
// - 顶层字段:severity_text / trace_id(输出仍映射成 severityText / traceID)
|
|
48
|
+
// - attributes 里的业务字段:module / user_id / page / api / ob_data_id(snake_case,
|
|
50
49
|
// 依据 BAM IDL 的 LogItem.attributes 描述:"包括 tenant_id, module, user_id, page, api 等")
|
|
51
50
|
// - duration_ms 暂未在 BAM 描述里明确列出,留 TODO 等 e2e 验证
|
|
52
51
|
const fieldFilters = (0, helpers_1.buildFieldFilters)([
|
|
53
52
|
{ key: "severity_text", value: opts.level ? (0, helpers_1.eqFilter)(opts.level) : undefined },
|
|
54
|
-
{ key: "
|
|
53
|
+
{ key: "attributes.ob_data_id", value: opts.logId ? (0, helpers_1.eqFilter)(opts.logId) : undefined },
|
|
55
54
|
{ key: "trace_id", value: opts.traceId ? (0, helpers_1.eqFilter)(opts.traceId) : undefined },
|
|
56
55
|
{ key: "module", value: opts.module ? (0, helpers_1.eqFilter)(opts.module) : undefined },
|
|
57
56
|
{ key: "user_id", value: opts.userId ? (0, helpers_1.eqFilter)(opts.userId, "i64") : undefined },
|
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.handleObservabilityMetric = handleObservabilityMetric;
|
|
37
37
|
const api = __importStar(require("../../../api/index"));
|
|
38
38
|
const output_1 = require("../../../utils/output");
|
|
39
|
-
const
|
|
39
|
+
const args_1 = require("../../../utils/args");
|
|
40
40
|
const helpers_1 = require("./helpers");
|
|
41
41
|
/**
|
|
42
42
|
* PRD <metric-name> + --series → 服务端 metric name → 表头列名(=对应 --series 取值)。
|
|
@@ -61,8 +61,8 @@ const METRIC_LABELS = {
|
|
|
61
61
|
/** miaoda observability metric <metric-name> */
|
|
62
62
|
async function handleObservabilityMetric(opts) {
|
|
63
63
|
if (!opts.metricName)
|
|
64
|
-
(0,
|
|
65
|
-
const appID =
|
|
64
|
+
(0, args_1.failArgs)("<metric-name> 必填");
|
|
65
|
+
const appID = opts.appId;
|
|
66
66
|
const { metricNames, labelByMetric, extraFilters } = resolveMetricSelection(opts.metricName, opts.series);
|
|
67
67
|
const filters = (0, helpers_1.buildFieldFilters)([
|
|
68
68
|
{ key: "referer_path", value: opts.page ? (0, helpers_1.eqFilter)(opts.page) : undefined },
|
|
@@ -37,12 +37,12 @@ exports.handleObservabilityTraceList = handleObservabilityTraceList;
|
|
|
37
37
|
exports.handleObservabilityTraceGet = handleObservabilityTraceGet;
|
|
38
38
|
const api = __importStar(require("../../../api/index"));
|
|
39
39
|
const output_1 = require("../../../utils/output");
|
|
40
|
-
const
|
|
40
|
+
const args_1 = require("../../../utils/args");
|
|
41
41
|
const index_1 = require("../../../api/observability/index");
|
|
42
42
|
const helpers_1 = require("./helpers");
|
|
43
43
|
/** miaoda observability trace list */
|
|
44
44
|
async function handleObservabilityTraceList(opts) {
|
|
45
|
-
const appID =
|
|
45
|
+
const appID = opts.appId;
|
|
46
46
|
const appEnv = "runtime";
|
|
47
47
|
const limit = (0, helpers_1.validateLimit)(opts.limit ?? 50);
|
|
48
48
|
// 过滤 key 对齐 BAM Span 字段名:
|
|
@@ -77,8 +77,8 @@ function emitSearchTracesResponse(resp) {
|
|
|
77
77
|
/** miaoda observability trace get <trace-id> */
|
|
78
78
|
async function handleObservabilityTraceGet(opts) {
|
|
79
79
|
if (!opts.traceId)
|
|
80
|
-
(0,
|
|
81
|
-
const appID =
|
|
80
|
+
(0, args_1.failArgs)("<trace-id> 必填");
|
|
81
|
+
const appID = opts.appId;
|
|
82
82
|
const appEnv = "runtime";
|
|
83
83
|
const resp = await api.observability.getTraces({
|
|
84
84
|
appID,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.failArgs = failArgs;
|
|
4
|
+
const error_1 = require("./error");
|
|
5
|
+
/** 参数校验失败时抛出;命令层可配合 withHelp 自动打 help。 */
|
|
6
|
+
function failArgs(message) {
|
|
7
|
+
throw new error_1.AppError("ARGS_INVALID", message);
|
|
8
|
+
}
|