@lark-apaas/miaoda-cli 0.1.3-alpha.7d9ebe6 → 0.1.3-alpha.e47b91b
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/api/app/api.js +3 -3
- package/dist/api/app/schemas.js +43 -43
- package/dist/api/db/api.js +108 -112
- package/dist/api/db/client.js +41 -41
- package/dist/api/db/parsers.js +20 -20
- package/dist/api/db/sql-keywords.js +87 -87
- package/dist/api/deploy/api.js +5 -5
- package/dist/api/deploy/schemas.js +32 -32
- package/dist/api/file/api.js +74 -87
- package/dist/api/file/client.js +22 -22
- package/dist/api/file/detect.js +3 -3
- package/dist/api/file/parsers.js +5 -5
- package/dist/api/observability/api.js +6 -6
- package/dist/api/observability/schemas.js +14 -14
- package/dist/api/plugin/api.js +31 -31
- package/dist/cli/commands/app/index.js +12 -12
- package/dist/cli/commands/db/index.js +145 -149
- package/dist/cli/commands/deploy/index.js +28 -28
- package/dist/cli/commands/file/index.js +60 -60
- package/dist/cli/commands/observability/index.js +69 -69
- package/dist/cli/commands/plugin/index.js +27 -27
- package/dist/cli/commands/shared.js +10 -10
- package/dist/cli/handlers/app/update.js +2 -2
- package/dist/cli/handlers/db/audit.js +48 -39
- package/dist/cli/handlers/db/changelog.js +25 -12
- package/dist/cli/handlers/db/data.js +28 -28
- package/dist/cli/handlers/db/migration.js +23 -23
- package/dist/cli/handlers/db/quota.js +3 -3
- package/dist/cli/handlers/db/recovery.js +79 -72
- package/dist/cli/handlers/db/schema.js +33 -33
- package/dist/cli/handlers/db/sql.js +69 -69
- package/dist/cli/handlers/deploy/deploy.js +4 -4
- package/dist/cli/handlers/deploy/error-log.js +1 -1
- package/dist/cli/handlers/deploy/get.js +3 -3
- package/dist/cli/handlers/deploy/polling.js +11 -11
- package/dist/cli/handlers/file/cp.js +30 -30
- package/dist/cli/handlers/file/ls.js +5 -5
- package/dist/cli/handlers/file/quota.js +2 -2
- package/dist/cli/handlers/file/rm.js +24 -24
- package/dist/cli/handlers/file/sign.js +3 -3
- package/dist/cli/handlers/file/stat.js +9 -9
- package/dist/cli/handlers/observability/analytics.js +47 -47
- package/dist/cli/handlers/observability/helpers.js +2 -2
- package/dist/cli/handlers/observability/log.js +9 -9
- package/dist/cli/handlers/observability/metric.js +26 -26
- package/dist/cli/handlers/observability/trace.js +5 -5
- package/dist/cli/handlers/plugin/plugin-local.js +53 -53
- package/dist/cli/handlers/plugin/plugin.js +15 -15
- package/dist/cli/help.js +16 -16
- package/dist/main.js +12 -12
- package/dist/utils/args.js +1 -1
- package/dist/utils/colors.js +2 -2
- package/dist/utils/config.js +2 -2
- package/dist/utils/devops-error.js +9 -9
- package/dist/utils/error.js +2 -2
- package/dist/utils/git.js +4 -4
- package/dist/utils/http.js +19 -19
- package/dist/utils/output.js +47 -47
- package/dist/utils/poll.js +2 -2
- package/dist/utils/render.js +27 -27
- package/dist/utils/time.js +47 -42
- package/package.json +1 -1
package/dist/api/app/api.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.getAppInfo = getAppInfo;
|
|
|
4
4
|
exports.updateAppMeta = updateAppMeta;
|
|
5
5
|
const http_1 = require("../../utils/http");
|
|
6
6
|
const devops_error_1 = require("../../utils/devops-error");
|
|
7
|
-
const DEFAULT_ERR_CODE =
|
|
7
|
+
const DEFAULT_ERR_CODE = 'INTERNAL_DEVOPS_ERROR';
|
|
8
8
|
function envelopeOpts(errPrefix) {
|
|
9
9
|
return {
|
|
10
10
|
errPrefix,
|
|
@@ -15,11 +15,11 @@ function envelopeOpts(errPrefix) {
|
|
|
15
15
|
/** GET /v1/devops/app/:appID — 获取应用详情 */
|
|
16
16
|
async function getAppInfo(appID) {
|
|
17
17
|
const url = `/v1/devops/app/${encodeURIComponent(appID)}`;
|
|
18
|
-
return (0, http_1.getInnerApi)(url, envelopeOpts(
|
|
18
|
+
return (0, http_1.getInnerApi)(url, envelopeOpts('Failed to get app info'));
|
|
19
19
|
}
|
|
20
20
|
/** POST /v1/devops/app/:appID/meta — 更新应用元数据 */
|
|
21
21
|
async function updateAppMeta(req) {
|
|
22
22
|
const url = `/v1/devops/app/${encodeURIComponent(req.appID)}/meta`;
|
|
23
23
|
// 路径已带 appID,body 里也保留以匹配 BAM IDL 的 sensitive:"no" 透传约定
|
|
24
|
-
return (0, http_1.postInnerApi)(url, req, envelopeOpts(
|
|
24
|
+
return (0, http_1.postInnerApi)(url, req, envelopeOpts('Failed to update app'));
|
|
25
25
|
}
|
package/dist/api/app/schemas.js
CHANGED
|
@@ -5,47 +5,47 @@ const output_1 = require("../../utils/output");
|
|
|
5
5
|
const types_1 = require("./types");
|
|
6
6
|
// Partial<Record<...>>:未来 BAM 加新枚举值时这里没声明也不报错,运行期 lookup 自然得 undefined
|
|
7
7
|
const STATUS_TEXT = {
|
|
8
|
-
[types_1.AppStatus.UNSPECIFIED]:
|
|
9
|
-
[types_1.AppStatus.PREPARING]:
|
|
10
|
-
[types_1.AppStatus.UNRELEASED]:
|
|
11
|
-
[types_1.AppStatus.RELEASED]:
|
|
12
|
-
[types_1.AppStatus.DELETED]:
|
|
13
|
-
[types_1.AppStatus.UPGRADING]:
|
|
8
|
+
[types_1.AppStatus.UNSPECIFIED]: 'unknown',
|
|
9
|
+
[types_1.AppStatus.PREPARING]: 'preparing',
|
|
10
|
+
[types_1.AppStatus.UNRELEASED]: 'unreleased',
|
|
11
|
+
[types_1.AppStatus.RELEASED]: 'released',
|
|
12
|
+
[types_1.AppStatus.DELETED]: 'deleted',
|
|
13
|
+
[types_1.AppStatus.UPGRADING]: 'upgrading',
|
|
14
14
|
};
|
|
15
15
|
const MODE_TEXT = {
|
|
16
|
-
[types_1.AppMode.UNSPECIFIED]:
|
|
17
|
-
[types_1.AppMode.STANDARD]:
|
|
18
|
-
[types_1.AppMode.EXPERT]:
|
|
16
|
+
[types_1.AppMode.UNSPECIFIED]: 'unknown',
|
|
17
|
+
[types_1.AppMode.STANDARD]: 'standard',
|
|
18
|
+
[types_1.AppMode.EXPERT]: 'expert',
|
|
19
19
|
};
|
|
20
20
|
const TYPE_TEXT = {
|
|
21
|
-
[types_1.AppType.UNSPECIFIED]:
|
|
22
|
-
[types_1.AppType.STANDARD]:
|
|
23
|
-
[types_1.AppType.PROTOTYPE]:
|
|
24
|
-
[types_1.AppType.APPLICATION]:
|
|
25
|
-
[types_1.AppType.DESIGN]:
|
|
26
|
-
[types_1.AppType.OPENCLAW]:
|
|
27
|
-
[types_1.AppType.CLAW_SUB]:
|
|
21
|
+
[types_1.AppType.UNSPECIFIED]: 'unknown',
|
|
22
|
+
[types_1.AppType.STANDARD]: 'standard',
|
|
23
|
+
[types_1.AppType.PROTOTYPE]: 'prototype',
|
|
24
|
+
[types_1.AppType.APPLICATION]: 'application',
|
|
25
|
+
[types_1.AppType.DESIGN]: 'design',
|
|
26
|
+
[types_1.AppType.OPENCLAW]: 'openclaw',
|
|
27
|
+
[types_1.AppType.CLAW_SUB]: 'claw_sub',
|
|
28
28
|
};
|
|
29
29
|
const BIZ_TYPE_TEXT = {
|
|
30
|
-
[types_1.BizType.UNSPECIFIED]:
|
|
31
|
-
[types_1.BizType.MIAODA]:
|
|
32
|
-
[types_1.BizType.FORCE]:
|
|
30
|
+
[types_1.BizType.UNSPECIFIED]: 'unknown',
|
|
31
|
+
[types_1.BizType.MIAODA]: 'miaoda',
|
|
32
|
+
[types_1.BizType.FORCE]: 'force',
|
|
33
33
|
};
|
|
34
34
|
const ARCH_TYPE_TEXT = {
|
|
35
|
-
[types_1.ArchType.UNSPECIFIED]:
|
|
36
|
-
[types_1.ArchType.FULL_STACK]:
|
|
37
|
-
[types_1.ArchType.NOT_FULL_STACK]:
|
|
35
|
+
[types_1.ArchType.UNSPECIFIED]: 'unknown',
|
|
36
|
+
[types_1.ArchType.FULL_STACK]: 'full_stack',
|
|
37
|
+
[types_1.ArchType.NOT_FULL_STACK]: 'not_full_stack',
|
|
38
38
|
};
|
|
39
39
|
const SOURCE_TEXT = {
|
|
40
|
-
[types_1.Source.UNSPECIFIED]:
|
|
41
|
-
[types_1.Source.CHAT]:
|
|
42
|
-
[types_1.Source.TEMPLATE]:
|
|
43
|
-
[types_1.Source.IMPORT_ZIP]:
|
|
44
|
-
[types_1.Source.IMPORT_BASE]:
|
|
40
|
+
[types_1.Source.UNSPECIFIED]: 'unknown',
|
|
41
|
+
[types_1.Source.CHAT]: 'chat',
|
|
42
|
+
[types_1.Source.TEMPLATE]: 'template',
|
|
43
|
+
[types_1.Source.IMPORT_ZIP]: 'import_zip',
|
|
44
|
+
[types_1.Source.IMPORT_BASE]: 'import_base',
|
|
45
45
|
};
|
|
46
46
|
function lookup(table) {
|
|
47
47
|
return (v) => {
|
|
48
|
-
if (typeof v !==
|
|
48
|
+
if (typeof v !== 'number')
|
|
49
49
|
return undefined;
|
|
50
50
|
return table[v];
|
|
51
51
|
};
|
|
@@ -59,21 +59,21 @@ function lookup(table) {
|
|
|
59
59
|
*/
|
|
60
60
|
exports.appMetaSchema = {
|
|
61
61
|
columns: [
|
|
62
|
-
{ key:
|
|
63
|
-
{ key:
|
|
64
|
-
{ key:
|
|
65
|
-
{ key:
|
|
66
|
-
{ key:
|
|
67
|
-
{ key:
|
|
68
|
-
{ key:
|
|
69
|
-
{ key:
|
|
70
|
-
{ key:
|
|
71
|
-
{ key:
|
|
72
|
-
{ key:
|
|
73
|
-
{ key:
|
|
74
|
-
{ key:
|
|
75
|
-
{ key:
|
|
76
|
-
{ key:
|
|
62
|
+
{ key: 'appID', label: 'app-id' },
|
|
63
|
+
{ key: 'name' },
|
|
64
|
+
{ key: 'description' },
|
|
65
|
+
{ key: 'status_text', label: 'status', derive: (row) => lookup(STATUS_TEXT)(row.status) },
|
|
66
|
+
{ key: 'appType_text', label: 'type', derive: (row) => lookup(TYPE_TEXT)(row.appType) },
|
|
67
|
+
{ key: 'appMode_text', label: 'mode', derive: (row) => lookup(MODE_TEXT)(row.appMode) },
|
|
68
|
+
{ key: 'bizType_text', label: 'biz-type', derive: (row) => lookup(BIZ_TYPE_TEXT)(row.bizType) },
|
|
69
|
+
{ key: 'archType_text', label: 'arch', derive: (row) => lookup(ARCH_TYPE_TEXT)(row.archType) },
|
|
70
|
+
{ key: 'source_text', label: 'source', derive: (row) => lookup(SOURCE_TEXT)(row.source) },
|
|
71
|
+
{ key: 'ownedBy', label: 'owner' },
|
|
72
|
+
{ key: 'createdBy', label: 'creator' },
|
|
73
|
+
{ key: 'dataBranchID', label: 'branch' },
|
|
74
|
+
{ key: 'parentAppID', label: 'parent-app' },
|
|
75
|
+
{ key: 'createdAt', label: 'created-at', format: output_1.fmt.ms() },
|
|
76
|
+
{ key: 'updatedAt', label: 'updated-at', format: output_1.fmt.ms() },
|
|
77
77
|
],
|
|
78
78
|
strict: true,
|
|
79
79
|
};
|