@josephyan/qingflow-cli 0.2.0-beta.55

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.
Files changed (79) hide show
  1. package/README.md +30 -0
  2. package/docs/local-agent-install.md +235 -0
  3. package/entry_point.py +13 -0
  4. package/npm/bin/qingflow.mjs +5 -0
  5. package/npm/lib/runtime.mjs +204 -0
  6. package/npm/scripts/postinstall.mjs +16 -0
  7. package/package.json +34 -0
  8. package/pyproject.toml +67 -0
  9. package/qingflow +15 -0
  10. package/src/qingflow_mcp/__init__.py +5 -0
  11. package/src/qingflow_mcp/__main__.py +5 -0
  12. package/src/qingflow_mcp/backend_client.py +547 -0
  13. package/src/qingflow_mcp/builder_facade/__init__.py +3 -0
  14. package/src/qingflow_mcp/builder_facade/models.py +985 -0
  15. package/src/qingflow_mcp/builder_facade/service.py +8243 -0
  16. package/src/qingflow_mcp/cli/__init__.py +1 -0
  17. package/src/qingflow_mcp/cli/commands/__init__.py +15 -0
  18. package/src/qingflow_mcp/cli/commands/app.py +40 -0
  19. package/src/qingflow_mcp/cli/commands/auth.py +78 -0
  20. package/src/qingflow_mcp/cli/commands/builder.py +184 -0
  21. package/src/qingflow_mcp/cli/commands/common.py +47 -0
  22. package/src/qingflow_mcp/cli/commands/imports.py +86 -0
  23. package/src/qingflow_mcp/cli/commands/record.py +202 -0
  24. package/src/qingflow_mcp/cli/commands/task.py +87 -0
  25. package/src/qingflow_mcp/cli/commands/workspace.py +33 -0
  26. package/src/qingflow_mcp/cli/context.py +48 -0
  27. package/src/qingflow_mcp/cli/formatters.py +269 -0
  28. package/src/qingflow_mcp/cli/json_io.py +50 -0
  29. package/src/qingflow_mcp/cli/main.py +147 -0
  30. package/src/qingflow_mcp/config.py +221 -0
  31. package/src/qingflow_mcp/errors.py +66 -0
  32. package/src/qingflow_mcp/import_store.py +121 -0
  33. package/src/qingflow_mcp/json_types.py +18 -0
  34. package/src/qingflow_mcp/list_type_labels.py +76 -0
  35. package/src/qingflow_mcp/server.py +211 -0
  36. package/src/qingflow_mcp/server_app_builder.py +387 -0
  37. package/src/qingflow_mcp/server_app_user.py +317 -0
  38. package/src/qingflow_mcp/session_store.py +289 -0
  39. package/src/qingflow_mcp/solution/__init__.py +6 -0
  40. package/src/qingflow_mcp/solution/build_assembly_store.py +181 -0
  41. package/src/qingflow_mcp/solution/compiler/__init__.py +282 -0
  42. package/src/qingflow_mcp/solution/compiler/chart_compiler.py +96 -0
  43. package/src/qingflow_mcp/solution/compiler/form_compiler.py +466 -0
  44. package/src/qingflow_mcp/solution/compiler/icon_utils.py +113 -0
  45. package/src/qingflow_mcp/solution/compiler/navigation_compiler.py +57 -0
  46. package/src/qingflow_mcp/solution/compiler/package_compiler.py +19 -0
  47. package/src/qingflow_mcp/solution/compiler/portal_compiler.py +60 -0
  48. package/src/qingflow_mcp/solution/compiler/view_compiler.py +51 -0
  49. package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +173 -0
  50. package/src/qingflow_mcp/solution/design_session.py +222 -0
  51. package/src/qingflow_mcp/solution/design_store.py +100 -0
  52. package/src/qingflow_mcp/solution/executor.py +2339 -0
  53. package/src/qingflow_mcp/solution/normalizer.py +23 -0
  54. package/src/qingflow_mcp/solution/requirements_builder.py +536 -0
  55. package/src/qingflow_mcp/solution/run_store.py +244 -0
  56. package/src/qingflow_mcp/solution/spec_models.py +853 -0
  57. package/src/qingflow_mcp/tools/__init__.py +1 -0
  58. package/src/qingflow_mcp/tools/ai_builder_tools.py +2063 -0
  59. package/src/qingflow_mcp/tools/app_tools.py +850 -0
  60. package/src/qingflow_mcp/tools/approval_tools.py +833 -0
  61. package/src/qingflow_mcp/tools/auth_tools.py +697 -0
  62. package/src/qingflow_mcp/tools/base.py +81 -0
  63. package/src/qingflow_mcp/tools/code_block_tools.py +679 -0
  64. package/src/qingflow_mcp/tools/directory_tools.py +648 -0
  65. package/src/qingflow_mcp/tools/feedback_tools.py +230 -0
  66. package/src/qingflow_mcp/tools/file_tools.py +385 -0
  67. package/src/qingflow_mcp/tools/import_tools.py +1971 -0
  68. package/src/qingflow_mcp/tools/navigation_tools.py +177 -0
  69. package/src/qingflow_mcp/tools/package_tools.py +240 -0
  70. package/src/qingflow_mcp/tools/portal_tools.py +131 -0
  71. package/src/qingflow_mcp/tools/qingbi_report_tools.py +269 -0
  72. package/src/qingflow_mcp/tools/record_tools.py +12739 -0
  73. package/src/qingflow_mcp/tools/role_tools.py +94 -0
  74. package/src/qingflow_mcp/tools/solution_tools.py +3887 -0
  75. package/src/qingflow_mcp/tools/task_context_tools.py +1423 -0
  76. package/src/qingflow_mcp/tools/task_tools.py +843 -0
  77. package/src/qingflow_mcp/tools/view_tools.py +280 -0
  78. package/src/qingflow_mcp/tools/workflow_tools.py +312 -0
  79. package/src/qingflow_mcp/tools/workspace_tools.py +219 -0
@@ -0,0 +1,221 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import os
5
+ from pathlib import Path
6
+ from typing import Any
7
+ from urllib.parse import urlsplit, urlunsplit
8
+
9
+ DEFAULT_PROFILE = "default"
10
+ DEFAULT_TIMEOUT_SECONDS = 30.0
11
+ DEFAULT_USER_AGENT = "qingflow-mcp/1.0"
12
+ DEFAULT_RECORD_LIST_TYPE = 8
13
+ ATTACHMENT_QUESTION_TYPE = 13
14
+ DEFAULT_BASE_URL = "https://qingflow.com/api"
15
+ DEFAULT_FEEDBACK_APP_KEY = "e0d017kju002"
16
+ DEFAULT_FEEDBACK_QSOURCE_TOKEN = "mcp-feedback-7755d14748fc"
17
+
18
+
19
+ def get_mcp_home() -> Path:
20
+ custom_home = os.getenv("QINGFLOW_MCP_HOME")
21
+ return Path(custom_home).expanduser() if custom_home else Path.home() / ".qingflow-mcp"
22
+
23
+
24
+ def get_profiles_path() -> Path:
25
+ return get_mcp_home() / "profiles.json"
26
+
27
+
28
+ def get_config_file_paths() -> list[Path]:
29
+ """
30
+ 获取可能的配置文件路径列表,按优先级排序:
31
+ 1. 环境变量 QINGFLOW_MCP_CONFIG_PATH 指定的路径
32
+ 2. 当前工作目录下的 qingflow-mcp.config.json
33
+ 3. MCP home 目录下的 config.json
34
+ 4. 系统级配置 (Linux/Mac: /etc/qingflow-mcp/config.json)
35
+ """
36
+ paths: list[Path] = []
37
+
38
+ # 1. 环境变量
39
+ env_config = os.getenv("QINGFLOW_MCP_CONFIG_PATH")
40
+ if env_config:
41
+ paths.append(Path(env_config).expanduser())
42
+
43
+ # 2. 当前工作目录
44
+ paths.append(Path.cwd() / "qingflow-mcp.config.json")
45
+
46
+ # 3. MCP home 目录
47
+ paths.append(get_mcp_home() / "config.json")
48
+
49
+ # 4. 系统级配置 (仅非 Windows)
50
+ if os.name != "nt":
51
+ paths.append(Path("/etc/qingflow-mcp/config.json"))
52
+
53
+ return paths
54
+
55
+
56
+ def load_config_file() -> dict[str, Any]:
57
+ """
58
+ 加载第一个存在的配置文件
59
+
60
+ Returns:
61
+ 配置字典,如果没有找到配置文件则返回空字典
62
+ """
63
+ for path in get_config_file_paths():
64
+ if path.exists():
65
+ try:
66
+ with open(path, "r", encoding="utf-8") as f:
67
+ content = f.read()
68
+ # 移除 JSON 注释 (简单的行注释处理)
69
+ lines = []
70
+ for line in content.split("\n"):
71
+ stripped = line.strip()
72
+ if not stripped.startswith("//") and not stripped.startswith("#"):
73
+ lines.append(line)
74
+ return json.loads("\n".join(lines))
75
+ except (json.JSONDecodeError, IOError) as e:
76
+ # 配置文件存在但读取失败,记录警告但不中断
77
+ print(f"Warning: Failed to load config from {path}: {e}")
78
+ continue
79
+ return {}
80
+
81
+
82
+ def get_config_value(key: str, env_var: str | None = None, default: Any = None) -> Any:
83
+ """
84
+ 获取配置值,优先级:环境变量 > 配置文件 > 默认值
85
+
86
+ Args:
87
+ key: 配置文件中的键名 (支持点号分隔的嵌套键,如 "profiles.default.name")
88
+ env_var: 环境变量名
89
+ default: 默认值
90
+
91
+ Returns:
92
+ 配置值
93
+ """
94
+ # 1. 环境变量
95
+ if env_var:
96
+ env_value = os.getenv(env_var)
97
+ if env_value is not None:
98
+ return env_value
99
+
100
+ # 2. 配置文件
101
+ config = load_config_file()
102
+ keys = key.split(".")
103
+ value = config
104
+ for k in keys:
105
+ if isinstance(value, dict) and k in value:
106
+ value = value[k]
107
+ else:
108
+ value = None
109
+ break
110
+
111
+ if value is not None:
112
+ return value
113
+
114
+ # 3. 默认值
115
+ return default
116
+
117
+
118
+ def get_default_base_url() -> str | None:
119
+ """获取默认的 Qingflow 后端地址"""
120
+ value = get_config_value(
121
+ "default_base_url",
122
+ env_var="QINGFLOW_MCP_DEFAULT_BASE_URL",
123
+ default=DEFAULT_BASE_URL
124
+ )
125
+ return normalize_base_url(value) if value else None
126
+
127
+
128
+ def get_default_qf_version() -> str | None:
129
+ """获取默认的 qfVersion 路由值"""
130
+ value = get_config_value(
131
+ "default_qf_version",
132
+ env_var="QINGFLOW_MCP_DEFAULT_QF_VERSION",
133
+ default=None,
134
+ )
135
+ if value is None:
136
+ return None
137
+ normalized = str(value).strip()
138
+ return normalized or None
139
+
140
+
141
+ def get_feedback_qsource_token() -> str | None:
142
+ """获取反馈 q-source 被动入口 token"""
143
+ value = get_config_value(
144
+ "feedback.qsource_token",
145
+ env_var="QINGFLOW_MCP_FEEDBACK_QSOURCE_TOKEN",
146
+ default=DEFAULT_FEEDBACK_QSOURCE_TOKEN,
147
+ )
148
+ if value is None:
149
+ return None
150
+ normalized = str(value).strip()
151
+ return normalized or None
152
+
153
+
154
+ def get_feedback_base_url() -> str | None:
155
+ """获取反馈 q-source 使用的 base URL"""
156
+ value = get_config_value(
157
+ "feedback.base_url",
158
+ env_var="QINGFLOW_MCP_FEEDBACK_BASE_URL",
159
+ default=None,
160
+ )
161
+ if value is None:
162
+ return get_default_base_url()
163
+ normalized = normalize_base_url(value)
164
+ return normalized or get_default_base_url()
165
+
166
+
167
+ def get_feedback_app_key() -> str:
168
+ """获取内部反馈表 app_key"""
169
+ value = get_config_value(
170
+ "feedback.app_key",
171
+ env_var="QINGFLOW_MCP_FEEDBACK_APP_KEY",
172
+ default=DEFAULT_FEEDBACK_APP_KEY,
173
+ )
174
+ normalized = str(value or "").strip()
175
+ return normalized or DEFAULT_FEEDBACK_APP_KEY
176
+
177
+
178
+ def get_timeout_seconds() -> float:
179
+ """获取 HTTP 超时秒数"""
180
+ value = get_config_value(
181
+ "timeout_seconds",
182
+ env_var="QINGFLOW_MCP_TIMEOUT_SECONDS",
183
+ default=DEFAULT_TIMEOUT_SECONDS
184
+ )
185
+ try:
186
+ return float(value)
187
+ except (ValueError, TypeError):
188
+ return DEFAULT_TIMEOUT_SECONDS
189
+
190
+
191
+ def get_log_level() -> str:
192
+ """获取日志级别"""
193
+ return get_config_value(
194
+ "log_level",
195
+ env_var="QINGFLOW_MCP_LOG_LEVEL",
196
+ default="INFO"
197
+ )
198
+
199
+
200
+ def normalize_base_url(base_url: str | None) -> str | None:
201
+ """规范化 base URL"""
202
+ if base_url is None:
203
+ return None
204
+ normalized = base_url.strip()
205
+ if not normalized:
206
+ return None
207
+ normalized = normalized.rstrip("/")
208
+ try:
209
+ parsed = urlsplit(normalized)
210
+ except ValueError:
211
+ return normalized
212
+ if not parsed.scheme or not parsed.netloc:
213
+ return normalized
214
+
215
+ hostname = parsed.hostname or ""
216
+ if hostname.lower() == "www.qingflow.com":
217
+ netloc = "qingflow.com"
218
+ if parsed.port is not None:
219
+ netloc = f"{netloc}:{parsed.port}"
220
+ normalized = urlunsplit((parsed.scheme, netloc, parsed.path, parsed.query, parsed.fragment))
221
+ return normalized
@@ -0,0 +1,66 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from dataclasses import asdict, dataclass
5
+
6
+ from .json_types import JSONObject, JSONScalar
7
+
8
+
9
+ INVALID_TOKEN_MARKERS = (
10
+ "invalid token",
11
+ "token invalid",
12
+ "token失效",
13
+ "无效token",
14
+ "登录失效",
15
+ "login token invalid",
16
+ "access token invalid",
17
+ )
18
+
19
+
20
+ @dataclass(slots=True)
21
+ class QingflowApiError(Exception):
22
+ category: str
23
+ message: str
24
+ backend_code: JSONScalar = None
25
+ request_id: str | None = None
26
+ http_status: int | None = None
27
+ details: JSONObject | None = None
28
+
29
+ def to_dict(self) -> JSONObject:
30
+ return asdict(self)
31
+
32
+ def as_json(self) -> str:
33
+ return json.dumps(self.to_dict(), ensure_ascii=False)
34
+
35
+ def __str__(self) -> str:
36
+ return self.as_json()
37
+
38
+ def looks_like_invalid_token(self) -> bool:
39
+ text = self.message.lower()
40
+ return any(marker in text for marker in INVALID_TOKEN_MARKERS)
41
+
42
+ @classmethod
43
+ def auth_required(cls, profile: str) -> "QingflowApiError":
44
+ return cls(
45
+ category="auth",
46
+ message=f"Profile '{profile}' is not logged in. Run auth_login first.",
47
+ )
48
+
49
+ @classmethod
50
+ def workspace_not_selected(cls, profile: str) -> "QingflowApiError":
51
+ return cls(
52
+ category="workspace",
53
+ message=f"WORKSPACE_NOT_SELECTED: profile '{profile}' has no selected workspace. Run workspace_select first.",
54
+ )
55
+
56
+ @classmethod
57
+ def config_error(cls, message: str) -> "QingflowApiError":
58
+ return cls(category="config", message=message)
59
+
60
+ @classmethod
61
+ def not_supported(cls, message: str) -> "QingflowApiError":
62
+ return cls(category="not_supported", message=message)
63
+
64
+
65
+ def raise_tool_error(error: QingflowApiError) -> None:
66
+ raise RuntimeError(error.as_json())
@@ -0,0 +1,121 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import os
5
+ from dataclasses import dataclass
6
+ from datetime import datetime, timedelta, timezone
7
+ from pathlib import Path
8
+ from typing import Any
9
+
10
+ from .config import get_mcp_home
11
+
12
+
13
+ def _utc_now() -> datetime:
14
+ return datetime.now(timezone.utc)
15
+
16
+
17
+ def _parse_utc(value: Any) -> datetime | None:
18
+ if not isinstance(value, str) or not value.strip():
19
+ return None
20
+ normalized = value.strip().replace("Z", "+00:00")
21
+ try:
22
+ parsed = datetime.fromisoformat(normalized)
23
+ except ValueError:
24
+ return None
25
+ if parsed.tzinfo is None:
26
+ return parsed.replace(tzinfo=timezone.utc)
27
+ return parsed.astimezone(timezone.utc)
28
+
29
+
30
+ def _json_safe_key(value: str) -> str:
31
+ keep = []
32
+ for char in value:
33
+ if char.isalnum() or char in {"-", "_"}:
34
+ keep.append(char)
35
+ else:
36
+ keep.append("_")
37
+ result = "".join(keep).strip("_")
38
+ return result or "entry"
39
+
40
+
41
+ def _store_dir(env_var: str, default_name: str) -> Path:
42
+ custom = os.getenv(env_var)
43
+ if custom:
44
+ return Path(custom).expanduser()
45
+ return get_mcp_home() / default_name
46
+
47
+
48
+ @dataclass(slots=True)
49
+ class _JsonEntryStore:
50
+ base_dir: Path
51
+ ttl: timedelta
52
+
53
+ def __post_init__(self) -> None:
54
+ self.base_dir.mkdir(parents=True, exist_ok=True)
55
+ self.prune()
56
+
57
+ def put(self, entry_id: str, payload: dict[str, Any]) -> None:
58
+ data = dict(payload)
59
+ data["id"] = entry_id
60
+ data["updated_at"] = _utc_now().isoformat()
61
+ self._path(entry_id).write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
62
+
63
+ def get(self, entry_id: str) -> dict[str, Any] | None:
64
+ path = self._path(entry_id)
65
+ if not path.exists():
66
+ return None
67
+ try:
68
+ payload = json.loads(path.read_text(encoding="utf-8"))
69
+ except (OSError, json.JSONDecodeError):
70
+ path.unlink(missing_ok=True)
71
+ return None
72
+ created_at = _parse_utc(payload.get("created_at")) or _parse_utc(payload.get("updated_at"))
73
+ if created_at is None or _utc_now() - created_at > self.ttl:
74
+ path.unlink(missing_ok=True)
75
+ return None
76
+ return payload
77
+
78
+ def prune(self) -> None:
79
+ for path in self.base_dir.glob("*.json"):
80
+ try:
81
+ payload = json.loads(path.read_text(encoding="utf-8"))
82
+ except (OSError, json.JSONDecodeError):
83
+ path.unlink(missing_ok=True)
84
+ continue
85
+ created_at = _parse_utc(payload.get("created_at")) or _parse_utc(payload.get("updated_at"))
86
+ if created_at is None or _utc_now() - created_at > self.ttl:
87
+ path.unlink(missing_ok=True)
88
+
89
+ def list(self) -> list[dict[str, Any]]:
90
+ entries: list[dict[str, Any]] = []
91
+ self.prune()
92
+ for path in self.base_dir.glob("*.json"):
93
+ try:
94
+ payload = json.loads(path.read_text(encoding="utf-8"))
95
+ except (OSError, json.JSONDecodeError):
96
+ continue
97
+ created_at = _parse_utc(payload.get("created_at")) or _parse_utc(payload.get("updated_at"))
98
+ if created_at is None:
99
+ continue
100
+ entries.append(payload)
101
+ entries.sort(key=lambda item: item.get("created_at") or item.get("updated_at") or "", reverse=True)
102
+ return entries
103
+
104
+ def _path(self, entry_id: str) -> Path:
105
+ return self.base_dir / f"{_json_safe_key(entry_id)}.json"
106
+
107
+
108
+ class ImportVerificationStore(_JsonEntryStore):
109
+ def __init__(self, base_dir: Path | None = None, *, ttl_seconds: int = 3600) -> None:
110
+ super().__init__(
111
+ base_dir=base_dir or _store_dir("QINGFLOW_MCP_IMPORT_VERIFY_HOME", "import-verifications"),
112
+ ttl=timedelta(seconds=ttl_seconds),
113
+ )
114
+
115
+
116
+ class ImportJobStore(_JsonEntryStore):
117
+ def __init__(self, base_dir: Path | None = None, *, ttl_seconds: int = 24 * 3600) -> None:
118
+ super().__init__(
119
+ base_dir=base_dir or _store_dir("QINGFLOW_MCP_IMPORT_JOB_HOME", "import-jobs"),
120
+ ttl=timedelta(seconds=ttl_seconds),
121
+ )
@@ -0,0 +1,18 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Protocol, Any
4
+
5
+ # Use Any for JSON types to avoid Pydantic recursion issues
6
+ # These are used for MCP tool signatures where exact typing is less critical
7
+ JSONScalar = Any
8
+ JSONValue = Any
9
+ JSONObject = dict[str, Any]
10
+ JSONArray = list[Any]
11
+
12
+
13
+ class KeyringBackend(Protocol):
14
+ def set_password(self, service: str, key: str, value: str) -> None: ...
15
+
16
+ def get_password(self, service: str, key: str) -> str | None: ...
17
+
18
+ def delete_password(self, service: str, key: str) -> None: ...
@@ -0,0 +1,76 @@
1
+ from __future__ import annotations
2
+
3
+
4
+ RECORD_LIST_TYPE_LABELS: dict[int, str] = {
5
+ 1: "待办",
6
+ 2: "已办",
7
+ 3: "我发起的-已通过",
8
+ 4: "我发起的-已拒绝",
9
+ 5: "我发起的-草稿",
10
+ 6: "我发起的-待完善",
11
+ 7: "我发起的-流程中",
12
+ 8: "数据管理-全部数据",
13
+ 9: "数据管理-已通过",
14
+ 10: "数据管理-已拒绝",
15
+ 11: "数据管理-流程中",
16
+ 12: "抄送",
17
+ 13: "图表分享者",
18
+ 14: "我发起的",
19
+ 15: "数据管理-已结束",
20
+ 16: "我发起的-已结束",
21
+ }
22
+
23
+ SYSTEM_VIEW_DEFINITIONS: tuple[tuple[str, int, str], ...] = (
24
+ ("system:all", 8, "全部数据"),
25
+ ("system:initiated", 14, "我发起的"),
26
+ ("system:todo", 1, "待办"),
27
+ ("system:done", 2, "已办"),
28
+ ("system:cc", 12, "抄送我的"),
29
+ )
30
+
31
+ SYSTEM_VIEW_ID_TO_LIST_TYPE: dict[str, int] = {view_id: list_type for view_id, list_type, _ in SYSTEM_VIEW_DEFINITIONS}
32
+ SYSTEM_VIEW_ID_TO_NAME: dict[str, str] = {view_id: name for view_id, _, name in SYSTEM_VIEW_DEFINITIONS}
33
+ SYSTEM_LIST_TYPE_TO_VIEW_ID: dict[int, str] = {list_type: view_id for view_id, list_type, _ in SYSTEM_VIEW_DEFINITIONS}
34
+
35
+ TASK_TYPE_LABELS: dict[int, str] = {
36
+ 1: "待办",
37
+ 2: "我发起的",
38
+ 3: "抄送",
39
+ 5: "已办",
40
+ }
41
+
42
+ APP_PUBLISH_STATUS_LABELS: dict[int, str] = {
43
+ 0: "未发布",
44
+ 1: "已发布-有修改",
45
+ 2: "已发布",
46
+ }
47
+
48
+
49
+ def get_record_list_type_label(list_type: int | None) -> str | None:
50
+ if list_type is None:
51
+ return None
52
+ return RECORD_LIST_TYPE_LABELS.get(list_type)
53
+
54
+
55
+ def get_system_view_id(list_type: int | None) -> str | None:
56
+ if list_type is None:
57
+ return None
58
+ return SYSTEM_LIST_TYPE_TO_VIEW_ID.get(list_type)
59
+
60
+
61
+ def get_system_view_name(view_id: str | None) -> str | None:
62
+ if view_id is None:
63
+ return None
64
+ return SYSTEM_VIEW_ID_TO_NAME.get(view_id)
65
+
66
+
67
+ def get_task_type_label(type_value: int | None) -> str | None:
68
+ if type_value is None:
69
+ return None
70
+ return TASK_TYPE_LABELS.get(type_value)
71
+
72
+
73
+ def get_app_publish_status_label(status: int | None) -> str | None:
74
+ if status is None:
75
+ return None
76
+ return APP_PUBLISH_STATUS_LABELS.get(status)