@lovrabet/rabetbase-cli 2.4.4-beta.1 → 2.4.5-beta.1

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 (330) hide show
  1. package/lib/api/api-doc.js +1 -1
  2. package/lib/api/fetch-model-list.js +1 -1
  3. package/lib/api/generate-api-file.js +1 -1
  4. package/lib/auth/auth-server-ui.js +1 -1
  5. package/lib/auth/auth-server.js +1 -1
  6. package/lib/auth/constant.js +1 -1
  7. package/lib/auth/get-cookie.js +1 -1
  8. package/lib/auth/get-session-user.js +1 -1
  9. package/lib/auth/is-session-valid.js +1 -1
  10. package/lib/auth/login-success-html.js +1 -1
  11. package/lib/auth/logout.js +1 -1
  12. package/lib/cli-flags.js +1 -1
  13. package/lib/cli.js +1 -1
  14. package/lib/commands/api/generate.js +1 -1
  15. package/lib/commands/api/index.js +1 -1
  16. package/lib/commands/api/list.js +1 -1
  17. package/lib/commands/api/pull.js +1 -1
  18. package/lib/commands/api/shared.js +1 -1
  19. package/lib/commands/app/index.js +1 -1
  20. package/lib/commands/app/list.js +1 -1
  21. package/lib/commands/app/members-list.js +1 -1
  22. package/lib/commands/app/remote-directory.js +1 -1
  23. package/lib/commands/app/shared.js +1 -1
  24. package/lib/commands/app-config/delete.js +1 -1
  25. package/lib/commands/app-config/get.js +1 -1
  26. package/lib/commands/app-config/index.js +1 -1
  27. package/lib/commands/app-config/list.js +1 -1
  28. package/lib/commands/app-config/set.js +1 -1
  29. package/lib/commands/app-config/shared.js +1 -1
  30. package/lib/commands/auth/index.js +1 -1
  31. package/lib/commands/bff/create.js +1 -1
  32. package/lib/commands/bff/delete.js +1 -1
  33. package/lib/commands/bff/detail.js +1 -1
  34. package/lib/commands/bff/index.js +1 -1
  35. package/lib/commands/bff/list.js +1 -1
  36. package/lib/commands/bff/pull.js +1 -1
  37. package/lib/commands/bff/push.js +1 -1
  38. package/lib/commands/bff/status.js +1 -1
  39. package/lib/commands/cli-skill/index.js +1 -1
  40. package/lib/commands/cli-update.js +1 -1
  41. package/lib/commands/codegen/index.js +1 -1
  42. package/lib/commands/codegen/sdk.js +1 -1
  43. package/lib/commands/codegen/sql.js +1 -1
  44. package/lib/commands/common/app-registry.js +1 -1
  45. package/lib/commands/common/app-selector.js +1 -1
  46. package/lib/commands/common/async-task.js +1 -1
  47. package/lib/commands/common/dry-run.js +1 -1
  48. package/lib/commands/common/flags.d.ts +1 -0
  49. package/lib/commands/common/flags.js +1 -1
  50. package/lib/commands/common/local-file.js +1 -1
  51. package/lib/commands/common/validate.js +1 -1
  52. package/lib/commands/config/get.js +1 -1
  53. package/lib/commands/config/index.js +1 -1
  54. package/lib/commands/config/list.js +1 -1
  55. package/lib/commands/config/set.js +1 -1
  56. package/lib/commands/config/shared.js +1 -1
  57. package/lib/commands/data/filter.js +1 -1
  58. package/lib/commands/data/getOne.js +1 -1
  59. package/lib/commands/data/index.js +1 -1
  60. package/lib/commands/data/shared.js +1 -1
  61. package/lib/commands/dataset/business-group-update.js +1 -1
  62. package/lib/commands/{permit/index.d.ts → dataset/business-groups.d.ts} +1 -1
  63. package/lib/commands/dataset/business-groups.js +1 -0
  64. package/lib/commands/dataset/capability.js +1 -1
  65. package/lib/commands/dataset/delete.js +1 -1
  66. package/lib/commands/dataset/detail.js +1 -1
  67. package/lib/commands/dataset/extend-update.js +1 -1
  68. package/lib/commands/dataset/field-update.js +1 -1
  69. package/lib/commands/dataset/generate.js +1 -1
  70. package/lib/commands/dataset/index.js +1 -1
  71. package/lib/commands/dataset/list.js +1 -1
  72. package/lib/commands/dataset/operations.js +1 -1
  73. package/lib/commands/dataset/relation-audit.js +1 -1
  74. package/lib/commands/dataset/relation-create.js +1 -1
  75. package/lib/commands/dataset/relation-delete.js +1 -1
  76. package/lib/commands/dataset/relation-shared.js +1 -1
  77. package/lib/commands/dataset/relation-update.js +1 -1
  78. package/lib/commands/dataset/relations.js +1 -1
  79. package/lib/commands/dataset/rename.js +1 -1
  80. package/lib/commands/dataset/restore.js +1 -1
  81. package/lib/commands/db/analysis-batching.js +1 -1
  82. package/lib/commands/db/analyze-batch-plan.js +1 -1
  83. package/lib/commands/db/analyze-cancel.js +1 -1
  84. package/lib/commands/db/analyze-start.js +1 -1
  85. package/lib/commands/db/analyze-status.js +1 -1
  86. package/lib/commands/db/create.js +1 -1
  87. package/lib/commands/db/delete.js +1 -1
  88. package/lib/commands/db/detail.js +1 -1
  89. package/lib/commands/db/diff-refresh-start.js +1 -1
  90. package/lib/commands/db/diff-refresh-status.js +1 -1
  91. package/lib/commands/db/diff.js +1 -1
  92. package/lib/commands/db/index.js +1 -1
  93. package/lib/commands/db/list.js +1 -1
  94. package/lib/commands/db/shared.d.ts +15 -1
  95. package/lib/commands/db/shared.js +1 -1
  96. package/lib/commands/db/tables.js +1 -1
  97. package/lib/commands/db/test.js +1 -1
  98. package/lib/commands/db/update.js +1 -1
  99. package/lib/commands/doctor.js +1 -1
  100. package/lib/commands/file/index.js +1 -1
  101. package/lib/commands/init/index.js +1 -1
  102. package/lib/commands/issue/index.js +1 -1
  103. package/lib/commands/issue/nudge.js +1 -1
  104. package/lib/commands/issue/report.js +1 -1
  105. package/lib/commands/issue/shared.js +1 -1
  106. package/lib/commands/kb/create.js +1 -1
  107. package/lib/commands/kb/delete.js +1 -1
  108. package/lib/commands/kb/detail.js +1 -1
  109. package/lib/commands/kb/index.js +1 -1
  110. package/lib/commands/kb/list.js +1 -1
  111. package/lib/commands/kb/shared.js +1 -1
  112. package/lib/commands/kb/update.js +1 -1
  113. package/lib/commands/logs/index.js +1 -1
  114. package/lib/commands/menu/asset-update.js +1 -1
  115. package/lib/commands/menu/delete.js +1 -1
  116. package/lib/commands/menu/external-link-create.js +1 -1
  117. package/lib/commands/menu/external-link-update.js +1 -1
  118. package/lib/commands/menu/group-create.js +1 -1
  119. package/lib/commands/menu/group-update.js +1 -1
  120. package/lib/commands/menu/index.js +1 -1
  121. package/lib/commands/menu/list.js +1 -1
  122. package/lib/commands/menu/move.js +1 -1
  123. package/lib/commands/menu/regroup-start.js +1 -1
  124. package/lib/commands/menu/rename.js +1 -1
  125. package/lib/commands/menu/shared/compare-table.js +1 -1
  126. package/lib/commands/menu/shared/delete-plan.js +1 -1
  127. package/lib/commands/menu/shared/facts.js +1 -1
  128. package/lib/commands/menu/shared/index.js +1 -1
  129. package/lib/commands/menu/shared/inquirer.js +1 -1
  130. package/lib/commands/menu/shared/local-pages.js +1 -1
  131. package/lib/commands/menu/shared/logic.js +1 -1
  132. package/lib/commands/menu/shared/mutations.js +1 -1
  133. package/lib/commands/menu/shared/service.js +1 -1
  134. package/lib/commands/menu/shared/sync-core.js +1 -1
  135. package/lib/commands/menu/shared/update-core.js +1 -1
  136. package/lib/commands/menu/shared/valid-url.js +1 -1
  137. package/lib/commands/menu/sync.js +1 -1
  138. package/lib/commands/notification/config-create.js +1 -1
  139. package/lib/commands/notification/config-delete.js +1 -1
  140. package/lib/commands/notification/config-list.js +1 -1
  141. package/lib/commands/notification/config-update.js +1 -1
  142. package/lib/commands/notification/index.js +1 -1
  143. package/lib/commands/notification/shared.js +1 -1
  144. package/lib/commands/ocr/index.js +1 -1
  145. package/lib/commands/page/generate-start.js +1 -1
  146. package/lib/commands/page/generate-status.js +1 -1
  147. package/lib/commands/page/index.js +1 -1
  148. package/lib/commands/page/pull.js +1 -1
  149. package/lib/commands/page/push.js +1 -1
  150. package/lib/commands/page/react/create.js +1 -1
  151. package/lib/commands/page/react/detail.js +1 -1
  152. package/lib/commands/page/react/list.js +1 -1
  153. package/lib/commands/page/react/publish.js +1 -1
  154. package/lib/commands/page/react/shared.js +1 -1
  155. package/lib/commands/page/react/syntax.js +1 -1
  156. package/lib/commands/page/react/template.js +1 -1
  157. package/lib/commands/page/react/update.js +1 -1
  158. package/lib/commands/page/relation-audit.js +1 -1
  159. package/lib/commands/page/restore.js +1 -1
  160. package/lib/commands/page/shared.js +1 -1
  161. package/lib/commands/page/standard-page-status.js +1 -1
  162. package/lib/commands/page/sync.js +1 -1
  163. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  164. package/lib/commands/project/create/format-elapsed.js +1 -1
  165. package/lib/commands/project/create/main.js +1 -1
  166. package/lib/commands/project/create/materialize-project-template.js +1 -1
  167. package/lib/commands/project/create/project-name.js +1 -1
  168. package/lib/commands/project/create/project-template-archive.js +1 -1
  169. package/lib/commands/project/create/project-template-path.js +1 -1
  170. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  171. package/lib/commands/project/create/use-format-code.js +1 -1
  172. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  173. package/lib/commands/project/index.js +1 -1
  174. package/lib/commands/project/upgrade.js +1 -1
  175. package/lib/commands/registry.js +1 -1
  176. package/lib/commands/role/delete.js +1 -1
  177. package/lib/commands/role/detail.js +1 -1
  178. package/lib/commands/role/index.js +1 -1
  179. package/lib/commands/role/list.js +1 -1
  180. package/lib/commands/role/shared.d.ts +15 -17
  181. package/lib/commands/role/shared.js +1 -1
  182. package/lib/commands/role/update.js +1 -1
  183. package/lib/commands/role/user-add.js +1 -1
  184. package/lib/commands/role/user-remove.js +1 -1
  185. package/lib/commands/role/user-resolve.js +1 -1
  186. package/lib/commands/run/index.js +1 -1
  187. package/lib/commands/schema.js +1 -1
  188. package/lib/commands/sql/create.js +1 -1
  189. package/lib/commands/sql/delete.js +1 -1
  190. package/lib/commands/sql/detail.js +1 -1
  191. package/lib/commands/sql/exec.js +1 -1
  192. package/lib/commands/sql/index.js +1 -1
  193. package/lib/commands/sql/list.js +1 -1
  194. package/lib/commands/sql/pull.js +1 -1
  195. package/lib/commands/sql/push.js +1 -1
  196. package/lib/commands/sql/shared.js +1 -1
  197. package/lib/commands/sql/status.js +1 -1
  198. package/lib/commands/sql/validate.js +1 -1
  199. package/lib/commands/task/index.js +1 -1
  200. package/lib/commands/task/status.js +1 -1
  201. package/lib/commands/tenant/index.js +1 -1
  202. package/lib/commands/tenant/members-list.js +1 -1
  203. package/lib/commands/tenant/shared.js +1 -1
  204. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -1
  205. package/lib/commands/user-account/index.js +1 -1
  206. package/lib/commands/workspace/add.js +1 -1
  207. package/lib/commands/workspace/index.js +1 -1
  208. package/lib/commands/workspace/remove.js +1 -1
  209. package/lib/config/schema.js +1 -1
  210. package/lib/constant/cdn.js +1 -1
  211. package/lib/constant/cli.js +1 -1
  212. package/lib/constant/defaults.js +1 -1
  213. package/lib/constant/domain.js +1 -1
  214. package/lib/constant/env.js +1 -1
  215. package/lib/constant/output.js +1 -1
  216. package/lib/constant/paths.js +1 -1
  217. package/lib/constant/risk.js +1 -1
  218. package/lib/context/app-resolver.js +1 -1
  219. package/lib/context/auth-resolver.js +1 -1
  220. package/lib/context/config-loader.js +1 -1
  221. package/lib/context.js +1 -1
  222. package/lib/core/alias-resolver.js +1 -1
  223. package/lib/core/api-client.d.ts +70 -79
  224. package/lib/core/api-client.js +1 -1
  225. package/lib/core/bff/config.js +1 -1
  226. package/lib/core/bff/file-system.d.ts +1 -0
  227. package/lib/core/bff/file-system.js +1 -1
  228. package/lib/core/bff/hash.js +1 -1
  229. package/lib/core/bff/lock.js +1 -1
  230. package/lib/core/bff/utils.js +1 -1
  231. package/lib/core/db-resolver.js +1 -1
  232. package/lib/core/page/file-system.js +1 -1
  233. package/lib/core/page/hash.js +1 -1
  234. package/lib/core/page/lock.js +1 -1
  235. package/lib/core/sql-index-auditor.js +1 -1
  236. package/lib/core/sql-sync/config.js +1 -1
  237. package/lib/core/sql-sync/file-system.js +1 -1
  238. package/lib/core/sql-sync/hash.js +1 -1
  239. package/lib/core/sql-sync/lock.js +1 -1
  240. package/lib/core/sql-sync/utils.js +1 -1
  241. package/lib/core/sql-validator.js +1 -1
  242. package/lib/errors.js +1 -1
  243. package/lib/framework/build-all-flags.js +1 -1
  244. package/lib/framework/error-output.js +1 -1
  245. package/lib/framework/explicit-yes.js +1 -1
  246. package/lib/framework/flags.js +1 -1
  247. package/lib/framework/help.js +1 -1
  248. package/lib/framework/index.js +1 -1
  249. package/lib/framework/output.js +1 -1
  250. package/lib/framework/response.js +1 -1
  251. package/lib/framework/runner-alias.js +1 -1
  252. package/lib/framework/runner.js +1 -1
  253. package/lib/framework/schema-export.js +1 -1
  254. package/lib/framework/types.js +1 -1
  255. package/lib/generated/build-info.d.ts +4 -4
  256. package/lib/generated/build-info.js +1 -1
  257. package/lib/help.js +1 -1
  258. package/lib/postinstall.js +1 -1
  259. package/lib/runtime/confirmation.js +1 -1
  260. package/lib/runtime/event.js +1 -1
  261. package/lib/runtime/index.js +1 -1
  262. package/lib/runtime/queue.js +1 -1
  263. package/lib/runtime/resolve.js +1 -1
  264. package/lib/skills/builtin-skill.js +1 -1
  265. package/lib/skills/main.js +1 -1
  266. package/lib/skills/npx-skills-add.js +1 -1
  267. package/lib/skills/skill-presence.js +1 -1
  268. package/lib/telemetry/cli-command-trace.js +1 -1
  269. package/lib/telemetry/cli-help-trace.js +1 -1
  270. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  271. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  272. package/lib/telemetry/send-cli-trace-log.js +1 -1
  273. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  274. package/lib/utils/ai_config.js +1 -1
  275. package/lib/utils/apply-jq-filter.js +1 -1
  276. package/lib/utils/cdn-config.js +1 -1
  277. package/lib/utils/check-sdk-version.js +1 -1
  278. package/lib/utils/cli-version-check.js +1 -1
  279. package/lib/utils/cli-version-policy.js +1 -1
  280. package/lib/utils/config.js +1 -1
  281. package/lib/utils/entity-with-id.js +1 -1
  282. package/lib/utils/file-utils.js +1 -1
  283. package/lib/utils/guides-cdn.js +1 -1
  284. package/lib/utils/http-client.js +1 -1
  285. package/lib/utils/is-non-interactive.js +1 -1
  286. package/lib/utils/logger.js +1 -1
  287. package/lib/utils/params.js +1 -1
  288. package/lib/utils/platform.js +1 -1
  289. package/lib/utils/rules-cdn.js +1 -1
  290. package/lib/utils/sleep.js +1 -1
  291. package/lib/utils/template-replacer.js +1 -1
  292. package/lib/utils/update-notice.js +1 -1
  293. package/lib/utils/version.js +1 -1
  294. package/lib/utils/with-active-cookie.js +1 -1
  295. package/lib/utils/write-cli-side-channel.js +1 -1
  296. package/package.json +1 -1
  297. package/skills/rabetbase/SKILL.md +18 -24
  298. package/skills/rabetbase/guides/database-connection-workflow.md +6 -2
  299. package/skills/rabetbase/references/rabetbase-dataset-business-groups.md +28 -0
  300. package/skills/rabetbase/references/rabetbase-dataset-delete.md +7 -5
  301. package/skills/rabetbase/references/rabetbase-dataset-list.md +6 -6
  302. package/skills/rabetbase/references/rabetbase-dataset-restore.md +5 -5
  303. package/skills/rabetbase/references/rabetbase-db-create.md +3 -0
  304. package/skills/rabetbase/references/rabetbase-db-delete.md +10 -2
  305. package/skills/rabetbase/references/rabetbase-db-detail.md +2 -0
  306. package/skills/rabetbase/references/rabetbase-db-list.md +3 -2
  307. package/skills/rabetbase/references/rabetbase-db-update.md +4 -2
  308. package/skills/rabetbase/references/rabetbase-role-list.md +9 -17
  309. package/skills/rabetbase/references/rabetbase-role-user-add.md +44 -16
  310. package/skills/rabetbase/references/rabetbase-role-user-resolve.md +2 -2
  311. package/skills/rabetbase.manifest.json +4 -7
  312. package/lib/commands/permit/index.js +0 -1
  313. package/lib/commands/permit/page-get.d.ts +0 -2
  314. package/lib/commands/permit/page-get.js +0 -1
  315. package/lib/commands/permit/page-set.d.ts +0 -2
  316. package/lib/commands/permit/page-set.js +0 -1
  317. package/lib/commands/permit/role-apis-set.d.ts +0 -2
  318. package/lib/commands/permit/role-apis-set.js +0 -1
  319. package/lib/commands/permit/role-menus-set.d.ts +0 -2
  320. package/lib/commands/permit/role-menus-set.js +0 -1
  321. package/lib/commands/permit/role-menus.d.ts +0 -2
  322. package/lib/commands/permit/role-menus.js +0 -1
  323. package/lib/commands/permit/shared.d.ts +0 -74
  324. package/lib/commands/permit/shared.js +0 -1
  325. package/lib/commands/role/create.d.ts +0 -2
  326. package/lib/commands/role/create.js +0 -1
  327. package/skills/rabetbase/guides/role-permit-workflow.md +0 -127
  328. package/skills/rabetbase/references/rabetbase-permit-page-set.md +0 -69
  329. package/skills/rabetbase/references/rabetbase-permit-role-apis-set.md +0 -53
  330. package/skills/rabetbase/references/rabetbase-permit-role-menus-set.md +0 -57
@@ -1,6 +1,6 @@
1
1
  # db delete
2
2
 
3
- **永久删除**一条 dblink 配置。**high-risk-write**:非交互环境必须带 **`--yes`**。
3
+ 逻辑删除一条 dblink 配置。**high-risk-write**:必须先 dry-run 检查依赖,正式执行显式传 `--confirm`;非交互环境同时传 **`--yes`**。
4
4
 
5
5
  ## 何时用
6
6
 
@@ -9,7 +9,8 @@
9
9
  ## 命令
10
10
 
11
11
  ```bash
12
- rabetbase db delete --id 10157 --yes --format compress
12
+ rabetbase db delete --id 10157 --dry-run --format compress
13
+ rabetbase db delete --id 10157 --expected-dataset-count 0 --confirm --yes --format compress
13
14
  ```
14
15
 
15
16
  ## 参数
@@ -17,9 +18,16 @@ rabetbase db delete --id 10157 --yes --format compress
17
18
  | Flag | 必填 | 说明 |
18
19
  |------|------|------|
19
20
  | `--id` | **是** | dblink id |
21
+ | `--confirm` | 正式执行必填 | 确认删除当前无依赖连接 |
22
+ | `--expected-dataset-count` | 否 | 与执行前有效 DB_TABLE Dataset 数不一致时中止,可显式使用 `0` |
20
23
  | `--yes` | CI/脚本必填 | 跳过高危确认 |
21
24
  | `--appcode` | 否 | 覆盖 app |
22
25
 
26
+ ## 安全边界
27
+
28
+ - dry-run 输出连接基本信息、`datasetDependency.hasDependencies`、`activeDatasetCount` 与 Dataset id/code/name/tableName。
29
+ - 正式删除前再次检查 Dataset 依赖;只要存在依赖就中止,不提供 `--force`,也不会自动删除 Dataset。
30
+
23
31
  ## 参考
24
32
 
25
33
  - [database-connection-workflow.md](../guides/database-connection-workflow.md)
@@ -26,5 +26,7 @@ rabetbase db detail --id 10157 --format compress
26
26
 
27
27
  输出中的 `tableCount` 是当前连接表数量:不大于 200 时通常直接读取 `db diff`;大于 200 时建议先执行 `db diff-refresh-start/status`。字段缺失时不猜测数量,也不隐式刷新。
28
28
 
29
+ `datasetDependency.hasDependencies` 表示当前连接是否仍有有效 Dataset 依赖,`activeDatasetCount` 是依赖数量;明细见同级 `datasets`。
30
+
29
31
  - [database-connection-workflow.md](../guides/database-connection-workflow.md)
30
32
  - [SKILL.md](../SKILL.md)
@@ -1,6 +1,6 @@
1
1
  # db list
2
2
 
3
- 列出当前应用下所有 **数据库连接(dblink)** 及最近一次**分析状态**。**先执行本命令拿到 `id`**,再调用 `db detail` / `db test` / `db tables` 等。
3
+ 列出当前应用下所有 **数据库连接(dblink)**、最近一次**分析状态**与 Dataset 依赖状态。**先执行本命令拿到 `id`**,再调用 `db detail` / `db test` / `db tables` 等。
4
4
 
5
5
  ## 何时用
6
6
 
@@ -27,7 +27,8 @@ rabetbase db list --appcode app-xxxx --format compress
27
27
 
28
28
  ## 输出要点
29
29
 
30
- - `connections[]`:每条含 `id`、`dbName`、`dbType`、`latestAnalysisStatus`、`latestAnalysisTraceId`,以及服务端提供时的 `tableCount` 等
30
+ - `connections[]`:每条含 `id`、`dbName`、`dbType`、`latestAnalysisStatus`、`latestAnalysisTraceId`,以及可用时的 `tableCount` 等
31
+ - `connections[].datasetDependency`:`hasDependencies` 表示是否仍有有效 Dataset 依赖,`activeDatasetCount` 是依赖数量;明细见同级 `datasets`
31
32
  - 返回中密码已脱敏
32
33
  - 若接口未返回分页元数据,`paging.totalCount` 为 `null` 并带 `note`,**勿将本页条数当作全量总数**
33
34
 
@@ -1,6 +1,6 @@
1
1
  # db update
2
2
 
3
- **增量更新**已有 dblink:只传需要改的 flag,未传的字段保持服务端原值。`write`。
3
+ **增量更新**已有 dblink:只传需要改的 flag,未传的字段保持原值。`write`。
4
4
 
5
5
  ## 何时用
6
6
 
@@ -21,7 +21,9 @@ rabetbase db update --id 10157 --password '***' --format compress
21
21
  | `--id` | **是** | dblink id(`db list`) |
22
22
  | `--dbname` / `--dburl` / `--username` / `--password` / `--dbparam` / `--dbdesc` | 否 | 仅传要覆盖的项;**不传 `--password` 则不修改密码**(空字符串行为以后端为准) |
23
23
 
24
- 写操作支持 **`--dry-run`**:合并当前服务端记录与 CLI 覆盖项后预览(密码脱敏)。
24
+ 写操作支持 **`--dry-run`**:合并当前配置与更新项后预览(密码脱敏)。
25
+
26
+ 非 dry-run 默认先测试合并后的完整配置,失败时不提交更新。只有明确传 `--skip-connection-test` 才跳过。已保存密码为掩码且未显式传真实 `--password` 时,在预检和保存前都会中止。
25
27
 
26
28
  ## 参考
27
29
 
@@ -1,8 +1,8 @@
1
- # rabetbase role(list / detail / create / update / delete)
1
+ # rabetbase role(list / detail / update / delete)
2
2
 
3
- 管理当前应用的用户组(角色)。事实源是平台角色管理面。角色类型:`ADMIN` / `DEV` / `USER`(内置)与 `CUSTOM`(用户创建)。
3
+ 管理当前应用的开发角色。角色类型:`ADMIN` / `DEV` / `OWNER`(内置)与已有 `CUSTOM`。所有命令输出包含 `scope: "dev"`。当前支持 list、detail、update、delete,不提供 `role create`。
4
4
 
5
- **内置角色守卫**:`update` / `delete` 仅限 `CUSTOM`;对 `DEV` / `ADMIN` 会被 validation 拒绝。修改权限矩阵见 [`permit`](rabetbase-permit-role-menus-set.md)。成员增删对所有角色可用,见 [`user-add / user-remove`](rabetbase-role-user-add.md)。
5
+ **内置角色守卫**:`update` / `delete` 仅限 `CUSTOM`;内置角色会被 validation 拒绝。成员增删不允许操作 OWNER,见 [`user-add / user-remove`](rabetbase-role-user-add.md)。业务人员角色与资源权限归属 `lovrabet`;若当前 `lovrabet` Help/Schema 尚未提供对应命令,应明确告知能力暂不可用,不得臆造命令、使用 rabetbase 代替或跨端双写。
6
6
 
7
7
  写操作默认输出 `compress`,先 `--dry-run` 确认再 `--yes`。
8
8
 
@@ -12,8 +12,6 @@
12
12
  rabetbase role list --format compress
13
13
  rabetbase role list --type DEV --format compress
14
14
  rabetbase role detail --id 12 --format compress
15
- rabetbase role create --name 销售组 --dry-run
16
- rabetbase role create --name 销售组 --remark "华东销售" --format compress
17
15
  rabetbase role update --id 12 --name 销售组-华东 --dry-run
18
16
  rabetbase role delete --id 12 --dry-run
19
17
  rabetbase role delete --id 12 --yes
@@ -21,17 +19,13 @@ rabetbase role delete --id 12 --yes
21
19
 
22
20
  ## list / detail
23
21
 
24
- `list` 列出用户组,`--type` 可过滤 `ADMIN|DEV|USER|CUSTOM`;`--page` 默认 `1`,`--pagesize` 默认 `100` 且范围为 `1-100`。输出关注 `data.roles[]`:`id`、`roleName`、`roleType`、`remark`、`userCount`、`permitCount`、`builtin`。
22
+ `list` 列出开发角色,`--type` 可过滤 `ADMIN|DEV|OWNER|CUSTOM`;`--page` 默认 `1`,`--pagesize` 默认 `100` 且范围为 `1-100`。输出关注 `data.scope` 与 `data.roles[]`:`id`、`roleName`、`roleType`、`remark`、`userCount`、`permitCount`、`builtin`。
25
23
 
26
- `detail --id` 通过单条接口返回同结构 `data.role`。名称引用会在 CLI 内部遍历所有角色分页,避免遗漏第 100 条之后的角色。
27
-
28
- ## create
29
-
30
- 创建 CUSTOM 用户组(服务端固定 `roleType=CUSTOM`)。服务端 `role/create` 返回创建后的完整角色对象;CLI 直接填充 `data.selector.roleId` 与 `data.after`,不再按名称回查。
24
+ `detail --id` 按返回对象的 `id` 精确匹配。名称引用会覆盖应用内全部角色,避免遗漏后续分页。
31
25
 
32
26
  ## update
33
27
 
34
- 仅改 `CUSTOM` 角色的 `--name` / `--remark`(至少一个)。DEV / ADMIN 被拒绝。输出 `data.before` / `data.after` 为角色投影。
28
+ 仅改 `CUSTOM` 角色的 `--name` / `--remark`(至少一个)。ADMIN / DEV / OWNER 被拒绝。输出 `data.before` / `data.after` 为角色投影。
35
29
 
36
30
  ## delete
37
31
 
@@ -39,30 +33,28 @@ rabetbase role delete --id 12 --yes
39
33
 
40
34
  ## 输出协议(写命令)
41
35
 
42
- `create` / `update` / `delete` 在 `data` 内返回稳定字段,Agent 读内层而非顶层 envelope:
36
+ `update` / `delete` 在 `data` 内返回稳定字段,Agent 读内层而非顶层 envelope:
43
37
 
44
38
  ```json
45
39
  {
40
+ "scope": "dev",
46
41
  "operation": "delete",
47
42
  "selector": { "appCode": "app-xxx", "roleId": 12, "roleName": "销售组" },
48
43
  "before": { "id": 12, "roleName": "销售组", "roleType": "CUSTOM", "builtin": false },
49
44
  "after": null,
50
45
  "dryRun": true,
51
- "backend": { "method": "POST", "path": "/smartapi/permit/role/delete" },
52
46
  "warnings": []
53
47
  }
54
48
  ```
55
49
 
56
- 不含合成 `protocol` key。dry-run 会在同一 `data` 上附加不可枚举的 `method` / `url`,仅用于请求预览。
50
+ 不含合成 `protocol` key。Agent 只依赖上述稳定业务字段判断目标和变更,不读取底层请求信息。
57
51
 
58
52
  ## 用例编排
59
53
 
60
54
  - 用例 1(把小张加入开发者):`role user-resolve --name 小张` → `role list --type DEV` 取 devId → [`role user-add`](rabetbase-role-user-add.md)。
61
- - 用例 2(创建销售组):`role create --name 销售组 --yes`,从 `data.selector.roleId` 取新 id。
62
55
 
63
56
  ## 参考
64
57
 
65
58
  - [role user-resolve](rabetbase-role-user-resolve.md)
66
59
  - [role user-add / user-remove](rabetbase-role-user-add.md)
67
- - [permit role-menus-set / role-apis-set](rabetbase-permit-role-menus-set.md)
68
60
  - [SKILL.md](../SKILL.md)
@@ -1,12 +1,28 @@
1
1
  # rabetbase role user-add / user-remove
2
2
 
3
- 把用户加入/移出角色。服务端 `update-user-list` 是**全量回写所有用户组成员**,CLI 内部做 read-merge-write:只改目标角色的 `userList`,其余角色原样带回,避免误删其它角色成员。`high-risk-write`,正式执行需 `--yes`。
3
+ 把开发协作者加入或移出一个开发角色。命令只改变目标角色,不会同步业务人员角色。业务人员角色应使用 `lovrabet`;若对应命令当前不可用,应明确告知,不得改用 rabetbase 或跨端双写。
4
+
5
+ 成员变更属于 `high-risk-write`,正式执行必须显式传 `--yes`。OWNER 成员不能通过这两个命令变更;所有权变更应走平台专用流程。
6
+
7
+ ## 推荐顺序
8
+
9
+ 1. 用 `role user-resolve` 把姓名解析为唯一 `userId`。
10
+ 2. 按 SKILL 的“应用决议指引”确认应用;只有明确的 `app-...` 才能直接作为 appcode,不能把业务名或本地别名改写成 appcode。
11
+ 3. 用 `role list` 取得目标开发角色。
12
+ 4. 执行 `user-add` 或 `user-remove --dry-run`。
13
+ 5. 检查 `data.before.userIds`、`data.after.userIds` 和 `data.warnings`。
14
+ 6. 用户已授权时,复用相同参数并增加 `--yes` 正式执行。
15
+ 7. 再用 `app members-list` 回读成员事实。
4
16
 
5
17
  ## 命令
6
18
 
7
19
  ```bash
8
- rabetbase role user-add --role 12 --user 小张 --dry-run
9
- rabetbase role user-add --role 销售组 --user 1001 --yes
20
+ rabetbase role user-resolve --name 小张 --format compress
21
+ rabetbase role list --type DEV --format compress
22
+
23
+ rabetbase role user-add --role 12 --user 1001 --dry-run
24
+ rabetbase role user-add --role 12 --user 1001 --yes
25
+
10
26
  rabetbase role user-remove --role 12 --user 1001 --dry-run
11
27
  rabetbase role user-remove --role 12 --user 1001 --yes
12
28
  ```
@@ -15,40 +31,52 @@ rabetbase role user-remove --role 12 --user 1001 --yes
15
31
 
16
32
  | Flag | 必填 | 说明 |
17
33
  |------|------|------|
18
- | `--role <id\|name>` | 是 | 目标角色;纯数字按 id,否则按角色名精确匹配(重名报错) |
19
- | `--user <id\|name>` | 是 | 目标用户;纯数字按 userId,否则按昵称/用户名解析(见 user-resolve) |
20
- | `--expect-user-count <n>` | 否 | 防漂移:目标角色当前成员数不等于 n 即中止 |
21
- | `--appcode <code>` | 否 | 覆盖当前 app |
34
+ | `--role <id\|name>` | 是 | 目标开发角色;纯数字按 id,否则按角色名精确匹配,重名时报错 |
35
+ | `--user <id\|name>` | 是 | 目标开发协作者;推荐先解析为唯一 userId |
36
+ | `--expect-user-count <n>` | 否 | 目标角色当前成员数不是 n 时中止,防止基于过期快照写入 |
37
+ | `--appcode <code>` | 否 | 覆盖当前应用 |
22
38
 
23
39
  ## 行为与幂等
24
40
 
25
- - `user-add`:用户已在该角色 → 不写、`data.warnings` 提示、`before == after`。
26
- - `user-remove`:用户不在该角色 → 不写、`data.warnings` 提示。
27
- - 有变更时才调用 `update-user-list`。
41
+ - `user-add`:用户已在目标角色时不写入,`before == after`,并返回 warning。
42
+ - `user-remove`:用户不在目标角色时不写入,并返回 warning。
43
+ - `user-remove`:发现同一用户存在重复成员关系时会一并清理,并在 warning 中说明数量。
44
+ - 目标角色为 OWNER 时直接失败,不执行成员写入。
45
+ - 每次操作只影响目标开发角色;不得同时调用 lovrabet 做补偿或同步。
28
46
 
29
47
  ## 输出协议
30
48
 
31
49
  ```json
32
50
  {
51
+ "scope": "dev",
33
52
  "operation": "user-add",
34
- "selector": { "appCode": "app-xxx", "roleId": 12, "roleName": "销售组", "userId": 1001 },
53
+ "selector": {
54
+ "appCode": "app-xxx",
55
+ "roleId": 12,
56
+ "roleName": "开发者",
57
+ "userId": 1001
58
+ },
35
59
  "before": { "userIds": [200] },
36
60
  "after": { "userIds": [200, 1001] },
37
61
  "dryRun": true,
38
- "backend": { "method": "POST", "path": "/smartapi/permit/user-role/update-user-list" },
39
62
  "warnings": []
40
63
  }
41
64
  ```
42
65
 
43
- Agent 校验时读 `data.before.userIds` / `data.after.userIds`,不要读顶层 envelope。dry-run 会附加不可枚举的 `method` / `url`。
66
+ Agent 只读取 `data.scope`、`data.selector`、`data.before`、`data.after` 和 `data.warnings` 判断业务结果,不向产品用户展开底层请求、工程仓库或迁移过程。
44
67
 
45
- ## 用例编排
68
+ ## 常见失败
46
69
 
47
- - 用例 1:`role user-resolve --name 小张` → `role list --type DEV` → `role user-add --role <devId> --user <userId> --yes`。
48
- - 用例 3:`role user-resolve --name 小陈` → `role user-add --role <salesId> --user <userId> --yes`。
70
+ - 姓名命中多人:先执行 `role user-resolve`,再使用明确 userId。
71
+ - 找不到角色:执行 `role list`,不要猜角色 ID 或名称。
72
+ - 应用只给了业务名或别名:先按应用决议确认,不要把它直接传给 `--appcode`。
73
+ - OWNER 被拒绝:停止操作并说明需要平台所有权变更流程。
74
+ - `expect-user-count` 不一致:重新读取成员事实并重新生成 dry-run,不要强行跳过。
75
+ - lovrabet 暂无对应业务角色命令:如实告知当前不可用,不得用 rabetbase 代替。
49
76
 
50
77
  ## 参考
51
78
 
52
79
  - [role user-resolve](rabetbase-role-user-resolve.md)
53
80
  - [role list](rabetbase-role-list.md)
81
+ - [app members-list](rabetbase-app-members-list.md)
54
82
  - [SKILL.md](../SKILL.md)
@@ -1,6 +1,6 @@
1
1
  # rabetbase role user-resolve
2
2
 
3
- 把昵称/用户名解析为 `userId`。事实源是当前租户的成员目录(`getByTenantCode`,按当前会话 tenant 解析)。用于 `user-add` / `user-remove` 前先拿到稳定 `userId`。
3
+ 把当前租户中的昵称/用户名解析为稳定 `userId`,用于 `user-add` / `user-remove` 前确认唯一人员。
4
4
 
5
5
  ## 命令
6
6
 
@@ -17,7 +17,7 @@ rabetbase role user-resolve --name 小张 --format compress
17
17
 
18
18
  ## 边界
19
19
 
20
- - 该接口未列入 Apifox 6396450,依赖 live 环境;未登录会报 auth required。
20
+ - 未登录或当前账号无法读取租户成员时会失败,应先恢复 rabetbase 登录状态。
21
21
  - 只做只读解析,不写任何角色成员;实际加入用 [`role user-add`](rabetbase-role-user-add.md)。
22
22
 
23
23
  ## 参考
@@ -2,8 +2,8 @@
2
2
  "schemaVersion": 1,
3
3
  "name": "rabetbase",
4
4
  "packageName": "@lovrabet/rabetbase-cli",
5
- "packageVersion": "2.4.4-beta.1",
6
- "skillVersion": "2.4.4-beta.1",
5
+ "packageVersion": "2.4.5-beta.1",
6
+ "skillVersion": "2.4.5-beta.1",
7
7
  "files": [
8
8
  "SKILL.md",
9
9
  "guides/backend-function.md",
@@ -17,7 +17,6 @@
17
17
  "guides/menu-anomaly-manual-cleanup.md",
18
18
  "guides/page-development-workflow.md",
19
19
  "guides/react-custom-page-workflow.md",
20
- "guides/role-permit-workflow.md",
21
20
  "guides/sql-creation-workflow.md",
22
21
  "guides/sql-mybatis.md",
23
22
  "guides/troubleshooting.md",
@@ -54,6 +53,7 @@
54
53
  "references/rabetbase-codegen-sql.md",
55
54
  "references/rabetbase-config.md",
56
55
  "references/rabetbase-dataset-business-group-update.md",
56
+ "references/rabetbase-dataset-business-groups.md",
57
57
  "references/rabetbase-dataset-delete.md",
58
58
  "references/rabetbase-dataset-detail.md",
59
59
  "references/rabetbase-dataset-extend-update.md",
@@ -107,9 +107,6 @@
107
107
  "references/rabetbase-page-relation-binding.md",
108
108
  "references/rabetbase-page-restore.md",
109
109
  "references/rabetbase-page-sync.md",
110
- "references/rabetbase-permit-page-set.md",
111
- "references/rabetbase-permit-role-apis-set.md",
112
- "references/rabetbase-permit-role-menus-set.md",
113
110
  "references/rabetbase-project-create.md",
114
111
  "references/rabetbase-project-upgrade.md",
115
112
  "references/rabetbase-role-list.md",
@@ -133,5 +130,5 @@
133
130
  "references/rabetbase-user-account.md",
134
131
  "references/rabetbase-workspace.md"
135
132
  ],
136
- "digest": "6169fd253d752d93e8f6528a2a2068e146360bbf8916bfe0434e6a8ee67b049a"
133
+ "digest": "d00a9db06d97e777f566fa497db8d39bd01f69ce8fbf444684832edb99cf0c6f"
137
134
  }
@@ -1 +0,0 @@
1
- function a159_0x4930(_0x36ef32,_0x25e927){_0x36ef32=_0x36ef32-0x159;const _0x32fad4=a159_0x32fa();let _0x493018=_0x32fad4[_0x36ef32];return _0x493018;}(function(_0x4cc8a9,_0x35fef8){const _0x2fa5ec=a159_0x4930,_0xb9e602=_0x4cc8a9();while(!![]){try{const _0x2b891e=parseInt(_0x2fa5ec(0x15a))/0x1+parseInt(_0x2fa5ec(0x15e))/0x2*(parseInt(_0x2fa5ec(0x15d))/0x3)+-parseInt(_0x2fa5ec(0x161))/0x4*(parseInt(_0x2fa5ec(0x160))/0x5)+-parseInt(_0x2fa5ec(0x162))/0x6*(parseInt(_0x2fa5ec(0x15f))/0x7)+parseInt(_0x2fa5ec(0x15b))/0x8+parseInt(_0x2fa5ec(0x15c))/0x9+-parseInt(_0x2fa5ec(0x159))/0xa;if(_0x2b891e===_0x35fef8)break;else _0xb9e602['push'](_0xb9e602['shift']());}catch(_0x3bc093){_0xb9e602['push'](_0xb9e602['shift']());}}}(a159_0x32fa,0x7d909));import{permitPageGet}from'../../commands/permit/page-get.js';import{permitPageSet}from'../../commands/permit/page-set.js';import{permitRoleMenus}from'../../commands/permit/role-menus.js';import{permitRoleMenusSet}from'../../commands/permit/role-menus-set.js';function a159_0x32fa(){const _0x145e22=['410YneDWg','187229wFiBln','1996325TZrxLA','4VbmDhC','222gDMski','1175330ZSGEFW','643519LqdCQH','3799344Qyeysk','5166972DRTfxX','4803jRaaQC'];a159_0x32fa=function(){return _0x145e22;};return a159_0x32fa();}import{permitRoleApisSet}from'../../commands/permit/role-apis-set.js';export const permitDefinitions=[permitPageGet,permitPageSet,permitRoleMenus,permitRoleMenusSet,permitRoleApisSet];
@@ -1,2 +0,0 @@
1
- import type { CommandDefinition } from "../../framework/types.js";
2
- export declare const permitPageGet: CommandDefinition;
@@ -1 +0,0 @@
1
- const a160_0x482556=a160_0x523f;(function(_0x57eda9,_0x157e51){const _0x51c790=a160_0x523f,_0x31c23d=_0x57eda9();while(!![]){try{const _0x2af468=-parseInt(_0x51c790(0x133))/0x1+parseInt(_0x51c790(0x132))/0x2*(parseInt(_0x51c790(0x12f))/0x3)+parseInt(_0x51c790(0x130))/0x4+parseInt(_0x51c790(0x12c))/0x5+parseInt(_0x51c790(0x12d))/0x6+-parseInt(_0x51c790(0x134))/0x7+-parseInt(_0x51c790(0x131))/0x8*(parseInt(_0x51c790(0x135))/0x9);if(_0x2af468===_0x157e51)break;else _0x31c23d['push'](_0x31c23d['shift']());}catch(_0x23f66c){_0x31c23d['push'](_0x31c23d['shift']());}}}(a160_0x284e,0x68768));import{getPagePermit}from'../../core/api-client.js';function a160_0x284e(){const _0x1f174b=['menu-id','66YxZjwn','796240ToCuEM','566136FdREXY','22966VjIMyA','394648SLaxGG','1856694mFCeTb','27npmJfv','Show\x20the\x20page\x20permission\x20snapshot\x20for\x20a\x20menu','page-get','Page\x20permit\x20for\x20menu\x20','3231075XnMLfg','1213020sAmBpH'];a160_0x284e=function(){return _0x1f174b;};return a160_0x284e();}function a160_0x523f(_0x54b04d,_0x4bd4e5){_0x54b04d=_0x54b04d-0x129;const _0x284e40=a160_0x284e();let _0x523f16=_0x284e40[_0x54b04d];return _0x523f16;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{MENU_ID_FLAG,projectPagePermit}from'../../commands/permit/shared.js';export const permitPageGet={'service':'permit','command':a160_0x482556(0x12a),'description':a160_0x482556(0x129),'risk':'read','flags':[MENU_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'execute'(_0xe30321){const _0x225482=a160_0x482556,_0x527b35=_0xe30321['num'](_0x225482(0x12e)),_0x5e311b=await getPagePermit(_0x527b35);return{'ok':!![],'data':{'page':projectPagePermit(_0x5e311b)},'message':_0x225482(0x12b)+_0x527b35};}};
@@ -1,2 +0,0 @@
1
- import type { CommandDefinition } from "../../framework/types.js";
2
- export declare const permitPageSet: CommandDefinition;
@@ -1 +0,0 @@
1
- const a161_0x229dfc=a161_0x4bdd;(function(_0x7be5ff,_0x503f27){const _0x4055a2=a161_0x4bdd,_0x18fe53=_0x7be5ff();while(!![]){try{const _0x3282db=-parseInt(_0x4055a2(0xa2))/0x1+-parseInt(_0x4055a2(0x9e))/0x2+-parseInt(_0x4055a2(0xab))/0x3*(parseInt(_0x4055a2(0xbb))/0x4)+parseInt(_0x4055a2(0xa1))/0x5*(parseInt(_0x4055a2(0xa5))/0x6)+parseInt(_0x4055a2(0x9b))/0x7*(-parseInt(_0x4055a2(0xa7))/0x8)+-parseInt(_0x4055a2(0xb7))/0x9+parseInt(_0x4055a2(0xaa))/0xa;if(_0x3282db===_0x503f27)break;else _0x18fe53['push'](_0x18fe53['shift']());}catch(_0x447965){_0x18fe53['push'](_0x18fe53['shift']());}}}(a161_0x5df0,0x6b6f5));import{getPagePermit,savePagePermit}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a161_0x5df0(){const _0x46fcd4=['\x20cannot\x20be\x20empty.','join','push','Pass\x20at\x20least\x20one\x20of:\x20','Set\x20page\x20permissions\x20for\x20a\x20menu\x20(menu/create/update/delete/detail/export/row\x20roles);\x20requires\x20--yes','selector','1668033wIWIzt','permit','spec','length','4oBYVOR','/smartapi/permit/page/save','POST','1531859GTpQOI','appCode','page-set','1680534uDbJzX','Nothing\x20to\x20set.','num','190MBesRb','743141YdYgfg','flag','allowSelf','17886jZyHOj','high-risk-write','24NoThsj','Only\x20slots\x20present\x20in\x20`permit\x20page-get`\x20can\x20be\x20set.','Pass\x20at\x20least\x20one\x20role,\x20or\x20omit\x20the\x20flag.\x20Clearing\x20permissions\x20is\x20not\x20supported\x20by\x20this\x20command.','27833360ZaYrho','93915mZrOkA','map','key','validation','label','menuId'];a161_0x5df0=function(){return _0x46fcd4;};return a161_0x5df0();}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{MENU_ID_FLAG,PAGE_SET_ROLE_FLAGS,PAGE_SLOT_SPECS,projectPageSlot,resolvePermitRoles,splitList}from'../../commands/permit/shared.js';function a161_0x4bdd(_0x4f9c92,_0x406af0){_0x4f9c92=_0x4f9c92-0x9a;const _0x5df093=a161_0x5df0();let _0x4bdd08=_0x5df093[_0x4f9c92];return _0x4bdd08;}const SAVE_PATH=a161_0x229dfc(0xbc);function collectRequestedSlots(_0x4ae735){const _0x5d70d7=a161_0x229dfc,_0x3c9e19=[];for(const _0x4c98e9 of PAGE_SLOT_SPECS){const _0x154bf7=_0x4ae735[_0x5d70d7(0xa3)](_0x4c98e9['flag']);if(_0x154bf7===undefined||_0x154bf7===null)continue;const _0x2b429d=splitList(String(_0x154bf7));if(_0x2b429d[_0x5d70d7(0xba)]===0x0)throw CliErrors[_0x5d70d7(0xae)]('--'+_0x4c98e9['flag']+_0x5d70d7(0xb1),_0x5d70d7(0xa9));_0x3c9e19[_0x5d70d7(0xb3)]({'spec':_0x4c98e9,'refs':_0x2b429d});}return _0x3c9e19;}async function buildPlan(_0x2b806c,_0x4f138c){const _0x5ac4c1=a161_0x229dfc,_0x632ffc=_0x2b806c[_0x5ac4c1(0xa0)]('menu-id'),_0x139308=collectRequestedSlots(_0x2b806c);if(_0x139308['length']===0x0)throw CliErrors[_0x5ac4c1(0xae)](_0x5ac4c1(0x9f),_0x5ac4c1(0xb4)+PAGE_SLOT_SPECS[_0x5ac4c1(0xac)](_0x158ea8=>'--'+_0x158ea8['flag'])[_0x5ac4c1(0xb2)](',\x20')+'.');const _0x413387=await getPagePermit(_0x632ffc),_0x2abec5={},_0x5639e4={},_0x495209=[];for(const {spec:_0x429634,refs:_0x38acfb}of _0x139308){const _0x2fff6d=_0x413387[_0x429634['key']];if(!_0x2fff6d)throw CliErrors[_0x5ac4c1(0xae)]('This\x20page\x20has\x20no\x20\x22'+_0x429634['label']+'\x22\x20permission\x20slot\x20('+_0x429634['key']+').',_0x5ac4c1(0xa8));_0x2abec5[_0x429634[_0x5ac4c1(0xad)]]=projectPageSlot(_0x2fff6d);const _0x214187=await resolvePermitRoles(_0x2b806c[_0x5ac4c1(0x9c)],_0x38acfb,{'allowSelf':_0x429634[_0x5ac4c1(0xa4)],'label':_0x429634[_0x5ac4c1(0xaf)]});_0x2fff6d['rolePermit']=_0x214187,_0x5639e4[_0x429634[_0x5ac4c1(0xad)]]=projectPageSlot(_0x2fff6d);}const _0x40b52a={'operation':_0x5ac4c1(0x9d),'selector':{'appCode':_0x2b806c[_0x5ac4c1(0x9c)],'menuId':_0x632ffc,'slots':_0x139308['map'](_0x30adb0=>_0x30adb0[_0x5ac4c1(0xb9)][_0x5ac4c1(0xad)])},'before':_0x2abec5,'after':_0x5639e4,'dryRun':_0x4f138c,'backend':{'method':_0x5ac4c1(0x9a),'path':SAVE_PATH},'warnings':_0x495209};return{'page':_0x413387,'mutation':_0x40b52a};}export const permitPageSet={'service':a161_0x229dfc(0xb8),'command':a161_0x229dfc(0x9d),'description':a161_0x229dfc(0xb5),'risk':a161_0x229dfc(0xa6),'flags':[MENU_ID_FLAG,...PAGE_SET_ROLE_FLAGS,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x4a84d4){const _0x2b9c7c=a161_0x229dfc,_0x2e058c=collectRequestedSlots(_0x4a84d4);if(_0x2e058c[_0x2b9c7c(0xba)]===0x0)throw CliErrors[_0x2b9c7c(0xae)](_0x2b9c7c(0x9f),_0x2b9c7c(0xb4)+PAGE_SLOT_SPECS['map'](_0x5d1710=>'--'+_0x5d1710[_0x2b9c7c(0xa3)])[_0x2b9c7c(0xb2)](',\x20')+'.');},async 'dryRun'(_0x17c18f){const _0x1078f1=a161_0x229dfc,{mutation:_0x3082ac}=await buildPlan(_0x17c18f,!![]);return asDryRunResult(_0x3082ac,{'method':_0x1078f1(0x9a),'url':SAVE_PATH});},async 'execute'(_0x6f95bd){const _0x5533dd=a161_0x229dfc,{page:_0x2d0593,mutation:_0x11566c}=await buildPlan(_0x6f95bd,![]);return await savePagePermit(_0x2d0593),{'ok':!![],'data':_0x11566c,'message':'Updated\x20page\x20permit\x20for\x20menu\x20'+_0x11566c[_0x5533dd(0xb6)][_0x5533dd(0xb0)]};}};
@@ -1,2 +0,0 @@
1
- import type { CommandDefinition } from "../../framework/types.js";
2
- export declare const permitRoleApisSet: CommandDefinition;
@@ -1 +0,0 @@
1
- const a162_0x1c5db6=a162_0x12cc;(function(_0x236405,_0x327232){const _0xdea480=a162_0x12cc,_0x268008=_0x236405();while(!![]){try{const _0x2d438d=-parseInt(_0xdea480(0x172))/0x1+parseInt(_0xdea480(0x156))/0x2*(-parseInt(_0xdea480(0x165))/0x3)+parseInt(_0xdea480(0x169))/0x4*(-parseInt(_0xdea480(0x15b))/0x5)+parseInt(_0xdea480(0x15a))/0x6+parseInt(_0xdea480(0x152))/0x7*(-parseInt(_0xdea480(0x158))/0x8)+parseInt(_0xdea480(0x153))/0x9+parseInt(_0xdea480(0x16e))/0xa;if(_0x2d438d===_0x327232)break;else _0x268008['push'](_0x268008['shift']());}catch(_0x585eae){_0x268008['push'](_0x268008['shift']());}}}(a162_0x28a5,0x1c78c));import{getRoleApiResources,updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a162_0x12cc(_0x457670,_0x524514){_0x457670=_0x457670-0x14f;const _0x28a5a2=a162_0x28a5();let _0x12ccd7=_0x28a5a2[_0x457670];return _0x12ccd7;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{buildPermits,DATASETS_FLAG,flattenApiResources,readRoleRef,REVOKE_FLAG,ROLE_REF_FLAG,splitList}from'../../commands/permit/shared.js';function a162_0x28a5(){const _0x8834aa=['set','POST','api-revoke','4aASFNj','filter','Verify\x20the\x20datasetCode,\x20or\x20check\x20the\x20role\x27s\x20API\x20resource\x20matrix.','high-risk-write','push','4407100ypyiMs','revoke','Revoked\x20API\x20access\x20for\x20','role-apis-set','163769wMDHwz','roleName','\x20dataset(s)\x20on\x20role\x20','flagMissing','Missing\x20--revoke.','13293JblTjh','288279EcOPIu','permit','get','59190dPPSER','str','592moAEit','length','1056246nBJcUn','991360neNLyJ','datasetCodes','join','role-apis-set\x20currently\x20supports\x20revoking\x20dataset\x20API\x20access\x20(use\x20case\x204).','bool','validation','API','appCode','Unknown\x20datasetCode(s)\x20for\x20this\x20role\x27s\x20API\x20resources:\x20','datasets','3zOEGPe'];a162_0x28a5=function(){return _0x8834aa;};return a162_0x28a5();}import{assertPermConfigurable,resolveRoleRef}from'../../commands/role/shared.js';const UPDATE_PATH='/smartapi/permit/role/update';async function buildPlan(_0x5be6c7,_0x173309){const _0x447e7f=a162_0x12cc,_0xb94fa8=await resolveRoleRef(_0x5be6c7[_0x447e7f(0x162)],readRoleRef(_0x5be6c7));assertPermConfigurable(_0xb94fa8);if(!_0x5be6c7['bool'](_0x447e7f(0x16f)))throw CliErrors['validation']('Missing\x20--revoke.',_0x447e7f(0x15e));const _0xbc3f36=splitList(_0x5be6c7['str'](_0x447e7f(0x164)));if(_0xbc3f36[_0x447e7f(0x159)]===0x0)throw CliErrors[_0x447e7f(0x150)]('datasets','Pass\x20--datasets\x20<datasetCode,...>.');const _0xf465d3=await getRoleApiResources(_0x5be6c7[_0x447e7f(0x162)],_0xb94fa8['id']),{byCode:_0x34c742,byDataset:_0x393482}=flattenApiResources(_0xf465d3),_0x57e60e=_0xbc3f36[_0x447e7f(0x16a)](_0xa1249d=>!_0x393482['has'](_0xa1249d));if(_0x57e60e[_0x447e7f(0x159)]>0x0)throw CliErrors['validation'](_0x447e7f(0x163)+_0x57e60e[_0x447e7f(0x15d)](',\x20')+'.',_0x447e7f(0x16b));const _0x2cfa16=new Map(),_0x48ef01=[],_0x407562=[];for(const _0x22606a of _0xbc3f36){for(const _0x1a8207 of _0x393482[_0x447e7f(0x155)](_0x22606a)){const _0x59de73=_0x34c742[_0x447e7f(0x155)](_0x1a8207);_0x2cfa16[_0x447e7f(0x166)](_0x1a8207,'0'),_0x48ef01[_0x447e7f(0x16d)]({'resourceCode':_0x1a8207,'datasetCode':_0x22606a,'action':_0x59de73['action']}),_0x407562['push']({'resourceCode':_0x1a8207,'datasetCode':_0x22606a,'action':'0'});}}const _0x1f6f36=buildPermits(_0x34c742,_0x2cfa16),_0x1deea6={'operation':_0x447e7f(0x168),'selector':{'appCode':_0x5be6c7[_0x447e7f(0x162)],'roleId':_0xb94fa8['id'],'roleName':_0xb94fa8[_0x447e7f(0x173)],'datasetCodes':_0xbc3f36},'before':_0x48ef01,'after':_0x407562,'dryRun':_0x173309,'backend':{'method':_0x447e7f(0x167),'path':UPDATE_PATH,'roleType':_0x447e7f(0x161)},'warnings':[]};return{'role':_0xb94fa8,'permits':_0x1f6f36,'mutation':_0x1deea6};}export const permitRoleApisSet={'service':a162_0x1c5db6(0x154),'command':a162_0x1c5db6(0x171),'description':'Revoke\x20a\x20role\x27s\x20dataset\x20API\x20access\x20by\x20datasetCode\x20(roleType\x20API);\x20requires\x20--yes','risk':a162_0x1c5db6(0x16c),'flags':[ROLE_REF_FLAG,REVOKE_FLAG,DATASETS_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x15e8cb){const _0x376822=a162_0x1c5db6;if(!_0x15e8cb[_0x376822(0x15f)](_0x376822(0x16f)))throw CliErrors[_0x376822(0x160)](_0x376822(0x151),_0x376822(0x15e));if(splitList(_0x15e8cb[_0x376822(0x157)](_0x376822(0x164)))[_0x376822(0x159)]===0x0)throw CliErrors[_0x376822(0x150)](_0x376822(0x164),'Pass\x20--datasets\x20<datasetCode,...>.');},async 'dryRun'(_0x1b9b27){const _0x3796e2=a162_0x1c5db6,{mutation:_0x4876f4}=await buildPlan(_0x1b9b27,!![]);return asDryRunResult(_0x4876f4,{'method':_0x3796e2(0x167),'url':UPDATE_PATH});},async 'execute'(_0x77fba7){const _0x5c9153=a162_0x1c5db6,{role:_0x5f3dd7,permits:_0x215834,mutation:_0x361c60}=await buildPlan(_0x77fba7,![]);return await updateAppRole({'id':_0x5f3dd7['id'],'appCode':_0x77fba7['appCode'],'roleType':_0x5c9153(0x161),'permits':_0x215834}),{'ok':!![],'data':_0x361c60,'message':_0x5c9153(0x170)+_0x361c60['selector'][_0x5c9153(0x15c)][_0x5c9153(0x159)]+_0x5c9153(0x14f)+_0x5f3dd7[_0x5c9153(0x173)]};}};
@@ -1,2 +0,0 @@
1
- import type { CommandDefinition } from "../../framework/types.js";
2
- export declare const permitRoleMenusSet: CommandDefinition;
@@ -1 +0,0 @@
1
- const a163_0x1b3ced=a163_0x34f9;(function(_0x208260,_0x199788){const _0x3a8ad0=a163_0x34f9,_0x47627e=_0x208260();while(!![]){try{const _0x5a4578=-parseInt(_0x3a8ad0(0xe2))/0x1*(-parseInt(_0x3a8ad0(0xfc))/0x2)+parseInt(_0x3a8ad0(0xf6))/0x3*(-parseInt(_0x3a8ad0(0xe6))/0x4)+parseInt(_0x3a8ad0(0xe1))/0x5+-parseInt(_0x3a8ad0(0x101))/0x6+-parseInt(_0x3a8ad0(0x100))/0x7+parseInt(_0x3a8ad0(0xf1))/0x8+parseInt(_0x3a8ad0(0xf9))/0x9*(parseInt(_0x3a8ad0(0xeb))/0xa);if(_0x5a4578===_0x199788)break;else _0x47627e['push'](_0x47627e['shift']());}catch(_0x2389d1){_0x47627e['push'](_0x47627e['shift']());}}}(a163_0x107d,0x45159));import{getRoleMenuResources,updateAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a163_0x34f9(_0x53955d,_0x23651f){_0x53955d=_0x53955d-0xe0;const _0x107dae=a163_0x107d();let _0x34f912=_0x107dae[_0x53955d];return _0x34f912;}import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{buildPermits,flattenMenuResources,GRANT_FLAG,MENUS_FLAG,readGrantRevoke,readRoleRef,REVOKE_FLAG,ROLE_REF_FLAG,splitList}from'../../commands/permit/shared.js';import{assertPermConfigurable,resolveRoleRef}from'../../commands/role/shared.js';const UPDATE_PATH='/smartapi/permit/role/update';async function buildPlan(_0x3d4404,_0x4d8297){const _0x3ea1d0=a163_0x34f9,_0x203573=await resolveRoleRef(_0x3d4404[_0x3ea1d0(0xe8)],readRoleRef(_0x3d4404));assertPermConfigurable(_0x203573);const _0xcc077a=readGrantRevoke(_0x3d4404),_0xa0c468=splitList(_0x3d4404[_0x3ea1d0(0xec)](_0x3ea1d0(0xf4)));if(_0xa0c468['length']===0x0)throw CliErrors[_0x3ea1d0(0xfb)]('menus',_0x3ea1d0(0xf7));const _0x3a56b6=await getRoleMenuResources(_0x3d4404[_0x3ea1d0(0xe8)],_0x203573['id']),_0x28b5b5=flattenMenuResources(_0x3a56b6),_0x1440ae=_0xa0c468['filter'](_0x5a079e=>!_0x28b5b5[_0x3ea1d0(0xe9)](_0x5a079e));if(_0x1440ae[_0x3ea1d0(0xf2)]>0x0)throw CliErrors['validation']('Unknown\x20menu\x20resourceCode(s):\x20'+_0x1440ae[_0x3ea1d0(0xe0)](',\x20')+'.',_0x3ea1d0(0xe4));const _0x4c946f=new Map(),_0x33a0a5=[],_0x52483f=[];for(const _0x131564 of _0xa0c468){const _0x222c3a=_0x28b5b5[_0x3ea1d0(0xee)](_0x131564);_0x4c946f['set'](_0x131564,_0xcc077a),_0x33a0a5[_0x3ea1d0(0xf5)]({'resourceCode':_0x131564,'action':_0x222c3a[_0x3ea1d0(0xfa)]}),_0x52483f[_0x3ea1d0(0xf5)]({'resourceCode':_0x131564,'action':_0xcc077a});}const _0x94a665=buildPermits(_0x28b5b5,_0x4c946f),_0x5602b1={'operation':_0xcc077a===_0x3ea1d0(0xe7)?_0x3ea1d0(0xef):_0x3ea1d0(0xfe),'selector':{'appCode':_0x3d4404['appCode'],'roleId':_0x203573['id'],'roleName':_0x203573[_0x3ea1d0(0xff)],'resourceCodes':_0xa0c468},'before':_0x33a0a5,'after':_0x52483f,'dryRun':_0x4d8297,'backend':{'method':_0x3ea1d0(0xf8),'path':UPDATE_PATH,'roleType':_0x3ea1d0(0xf3)},'warnings':[]};return{'role':_0x203573,'permits':_0x94a665,'mutation':_0x5602b1};}export const permitRoleMenusSet={'service':a163_0x1b3ced(0xea),'command':a163_0x1b3ced(0xf0),'description':'Grant\x20or\x20revoke\x20a\x20role\x27s\x20menu\x20access\x20by\x20resourceCode\x20(roleType\x20PAGE);\x20requires\x20--yes','risk':'high-risk-write','flags':[ROLE_REF_FLAG,GRANT_FLAG,REVOKE_FLAG,MENUS_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3fc5aa){const _0x49a392=a163_0x1b3ced;readGrantRevoke(_0x3fc5aa);if(splitList(_0x3fc5aa['str'](_0x49a392(0xf4)))[_0x49a392(0xf2)]===0x0)throw CliErrors[_0x49a392(0xfb)](_0x49a392(0xf4),_0x49a392(0xf7));},async 'dryRun'(_0x26edea){const _0x12a18d=a163_0x1b3ced,{mutation:_0xf84ac3}=await buildPlan(_0x26edea,!![]);return asDryRunResult(_0xf84ac3,{'method':_0x12a18d(0xf8),'url':UPDATE_PATH});},async 'execute'(_0x268dfa){const _0x556a00=a163_0x1b3ced,{role:_0x3e1349,permits:_0x1eae9d,mutation:_0x1c0187}=await buildPlan(_0x268dfa,![]);return await updateAppRole({'id':_0x3e1349['id'],'appCode':_0x268dfa[_0x556a00(0xe8)],'roleType':_0x556a00(0xf3),'permits':_0x1eae9d}),{'ok':!![],'data':_0x1c0187,'message':_0x556a00(0xed)+_0x1c0187[_0x556a00(0xfd)][_0x556a00(0xe3)][_0x556a00(0xf2)]+_0x556a00(0xe5)+_0x3e1349['roleName']};}};function a163_0x107d(){const _0x312424=['676816mqMFsM','388494DQgFvN','join','16995nHnBYX','1RZveAb','resourceCodes','Run\x20`permit\x20role-menus\x20--role\x20<id>`\x20to\x20see\x20valid\x20resourceCodes.','\x20menu\x20permit(s)\x20for\x20role\x20','100GRAsDU','access','appCode','has','permit','620pOJLQp','str','Updated\x20','get','menu-grant','role-menus-set','2095360xwVLTH','length','PAGE','menus','push','32421jLeBRc','Pass\x20--menus\x20<resourceCode,...>.','POST','9846bahftO','action','flagMissing','762868TkvnYb','selector','menu-revoke','roleName'];a163_0x107d=function(){return _0x312424;};return a163_0x107d();}
@@ -1,2 +0,0 @@
1
- import type { CommandDefinition } from "../../framework/types.js";
2
- export declare const permitRoleMenus: CommandDefinition;
@@ -1 +0,0 @@
1
- const a164_0x96ae8f=a164_0x1768;function a164_0x1768(_0x412555,_0x2b69a0){_0x412555=_0x412555-0x9b;const _0x2cb944=a164_0x2cb9();let _0x176831=_0x2cb944[_0x412555];return _0x176831;}(function(_0x177e05,_0x5b0dd1){const _0x10abdb=a164_0x1768,_0x2a4d69=_0x177e05();while(!![]){try{const _0x54c25e=parseInt(_0x10abdb(0xa0))/0x1*(-parseInt(_0x10abdb(0x9c))/0x2)+-parseInt(_0x10abdb(0xa5))/0x3*(-parseInt(_0x10abdb(0xa1))/0x4)+-parseInt(_0x10abdb(0x9f))/0x5*(-parseInt(_0x10abdb(0xb2))/0x6)+parseInt(_0x10abdb(0xa9))/0x7+-parseInt(_0x10abdb(0xad))/0x8*(-parseInt(_0x10abdb(0xb5))/0x9)+-parseInt(_0x10abdb(0xb3))/0xa+-parseInt(_0x10abdb(0xac))/0xb*(parseInt(_0x10abdb(0xb4))/0xc);if(_0x54c25e===_0x5b0dd1)break;else _0x2a4d69['push'](_0x2a4d69['shift']());}catch(_0x428b06){_0x2a4d69['push'](_0x2a4d69['shift']());}}}(a164_0x2cb9,0x9ffd0));import{getRoleMenuResources}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{flattenMenuResources,readRoleRef,ROLE_REF_FLAG}from'../../commands/permit/shared.js';function a164_0x2cb9(){const _0x12c072=['\x20menu(s)\x20allowed','read','7028238Hbxvmh','role-menus','from','22GOBPzf','424VvjRTO','appCode','access','action','permit','3792102olDjZd','3412190LsuiYH','4670472UMYgnj','43353VXuxDy','allowed','1322KFXHOG','length','filter','5ZHGKwH','991ICyqys','1077284BcocSj','resourceCode','Role\x20','map','6zDEKGi','roleName'];a164_0x2cb9=function(){return _0x12c072;};return a164_0x2cb9();}import{resolveRoleRef}from'../../commands/role/shared.js';export const permitRoleMenus={'service':a164_0x96ae8f(0xb1),'command':a164_0x96ae8f(0xaa),'description':'Show\x20a\x20role\x27s\x20current\x20menu\x20permission\x20matrix','risk':a164_0x96ae8f(0xa8),'flags':[ROLE_REF_FLAG,APPCODE_FLAG_OPTIONAL],async 'execute'(_0x3af40b){const _0x2b1f4=a164_0x96ae8f,_0x3edba1=await resolveRoleRef(_0x3af40b['appCode'],readRoleRef(_0x3af40b)),_0x2ed23f=await getRoleMenuResources(_0x3af40b[_0x2b1f4(0xae)],_0x3edba1['id']),_0x1657e3=flattenMenuResources(_0x2ed23f),_0x364214=Array[_0x2b1f4(0xab)](_0x1657e3['values']())[_0x2b1f4(0xa4)](_0x457bad=>({'resourceCode':_0x457bad[_0x2b1f4(0xa2)],'resourceName':_0x457bad['resourceName'],'allowed':_0x457bad['action']===_0x2b1f4(0xaf),'action':_0x457bad[_0x2b1f4(0xb0)]}));return{'ok':!![],'data':{'selector':{'appCode':_0x3af40b['appCode'],'roleId':_0x3edba1['id'],'roleName':_0x3edba1[_0x2b1f4(0xa6)]},'menus':_0x364214},'message':_0x2b1f4(0xa3)+_0x3edba1[_0x2b1f4(0xa6)]+'\x20has\x20'+_0x364214[_0x2b1f4(0x9e)](_0x5023f2=>_0x5023f2[_0x2b1f4(0x9b)])['length']+'/'+_0x364214[_0x2b1f4(0x9d)]+_0x2b1f4(0xa7)};}};
@@ -1,74 +0,0 @@
1
- /**
2
- * permit service 共享逻辑(SSOT)
3
- *
4
- * 集中:角色字面量(SELF/ALL/id/name)解析、page 权限槽字段映射、
5
- * menu / api 资源树扁平化与 permits patch 构造。
6
- * 命令文件只引用这里,不重复解析/合并规则。
7
- */
8
- import { type AppRole, type ApiResource, type MenuResource, type PagePermit, type PagePermitResourceSlot, type PermitAction } from "../../core/api-client.js";
9
- import type { FlagDef, RuntimeContext } from "../../framework/types.js";
10
- export declare const MENU_ID_FLAG: FlagDef;
11
- export declare const ROLE_REF_FLAG: FlagDef;
12
- export declare const GRANT_FLAG: FlagDef;
13
- export declare const REVOKE_FLAG: FlagDef;
14
- export declare const MENUS_FLAG: FlagDef;
15
- export declare const DATASETS_FLAG: FlagDef;
16
- /** page-set 的角色列表 flags → PagePermit 槽位映射 */
17
- export interface PageSlotSpec {
18
- flag: string;
19
- key: keyof Pick<PagePermit, "menuPermit" | "dataCreate" | "dataUpdate" | "dataDelete" | "dataDetail" | "dataExport" | "dataPermit">;
20
- /** 是否允许 SELF(仅 row-roles = dataPermit 允许行级 SELF) */
21
- allowSelf: boolean;
22
- label: string;
23
- }
24
- export declare const PAGE_SLOT_SPECS: PageSlotSpec[];
25
- export declare const PAGE_SET_ROLE_FLAGS: FlagDef[];
26
- export declare function splitList(raw: string): string[];
27
- export interface RoleRefProjection {
28
- id: number;
29
- roleName: string;
30
- roleType: AppRole["roleType"];
31
- }
32
- export declare function projectRoleRef(role: AppRole): RoleRefProjection;
33
- /**
34
- * 解析角色字面量数组(SELF/ALL/id/name)为 AppRole[]。
35
- * 所有解析基于一次 get-permit-list(含特殊组 ALL/SELF)。
36
- * allowSelf=false 时拒绝 SELF(与工作台一致:菜单/操作权限不含行级 SELF)。
37
- */
38
- export declare function resolvePermitRoles(appCode: string, refs: string[], opts: {
39
- allowSelf: boolean;
40
- label: string;
41
- }): Promise<AppRole[]>;
42
- export declare function projectPageSlot(slot: PagePermitResourceSlot | undefined): {
43
- resourceCode: string;
44
- roles: RoleRefProjection[];
45
- } | null;
46
- export declare function projectPagePermit(page: PagePermit): Record<string, unknown>;
47
- export interface FlatMenuResource {
48
- resourceCode: string;
49
- resourceName: string;
50
- action: PermitAction;
51
- }
52
- /** 递归扁平化菜单资源树(含 pageNodeList),resourceCode → 当前动作 */
53
- export declare function flattenMenuResources(resources: MenuResource[]): Map<string, FlatMenuResource>;
54
- export interface FlatApiResource {
55
- resourceCode: string;
56
- resourceName: string;
57
- datasetCode: string;
58
- action: PermitAction;
59
- }
60
- export declare function flattenApiResources(resources: ApiResource[]): {
61
- byCode: Map<string, FlatApiResource>;
62
- byDataset: Map<string, string[]>;
63
- };
64
- /**
65
- * 由「当前全量动作 map」+「目标 resourceCode → 新动作」构造完整 permits 回写体。
66
- * 未在 changes 中的 resourceCode 保持当前动作(与工作台 permissionState 全量回写一致)。
67
- */
68
- export declare function buildPermits(current: Map<string, {
69
- action: PermitAction;
70
- }>, changes: Map<string, PermitAction>): Record<string, PermitAction[]>;
71
- /** 读取 --role flag(permit 侧) */
72
- export declare function readRoleRef(ctx: RuntimeContext): string;
73
- /** 解析 grant/revoke 互斥标记 */
74
- export declare function readGrantRevoke(ctx: RuntimeContext): "access" | "0";
@@ -1 +0,0 @@
1
- const a165_0x394210=a165_0x34a5;function a165_0x34a5(_0x1325db,_0x25fbc9){_0x1325db=_0x1325db-0x9a;const _0x5085be=a165_0x5085();let _0x34a518=_0x5085be[_0x1325db];return _0x34a518;}(function(_0xeda04b,_0xc9e506){const _0x9d2700=a165_0x34a5,_0x139f26=_0xeda04b();while(!![]){try{const _0x4f33a1=-parseInt(_0x9d2700(0xdf))/0x1+parseInt(_0x9d2700(0xe8))/0x2+-parseInt(_0x9d2700(0xbf))/0x3*(parseInt(_0x9d2700(0xf0))/0x4)+parseInt(_0x9d2700(0xae))/0x5*(parseInt(_0x9d2700(0xe0))/0x6)+-parseInt(_0x9d2700(0xed))/0x7*(-parseInt(_0x9d2700(0xa3))/0x8)+parseInt(_0x9d2700(0xd8))/0x9*(parseInt(_0x9d2700(0x9b))/0xa)+parseInt(_0x9d2700(0xcb))/0xb*(parseInt(_0x9d2700(0xca))/0xc);if(_0x4f33a1===_0xc9e506)break;else _0x139f26['push'](_0x139f26['shift']());}catch(_0x37551c){_0x139f26['push'](_0x139f26['shift']());}}}(a165_0x5085,0x779fc));import{listPermitRoles}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const MENU_ID_FLAG={'name':a165_0x394210(0xa0),'type':a165_0x394210(0xd5),'required':!![],'description':a165_0x394210(0xa9)};export const ROLE_REF_FLAG={'name':a165_0x394210(0xb2),'type':a165_0x394210(0xeb),'required':!![],'description':'Role\x20id\x20or\x20role\x20name'};export const GRANT_FLAG={'name':'grant','type':a165_0x394210(0xe2),'required':![],'description':a165_0x394210(0xaf)};export const REVOKE_FLAG={'name':'revoke','type':a165_0x394210(0xe2),'required':![],'description':'Revoke\x20access\x20to\x20the\x20listed\x20resources'};export const MENUS_FLAG={'name':a165_0x394210(0xa4),'type':a165_0x394210(0xeb),'required':!![],'description':a165_0x394210(0xee)};export const DATASETS_FLAG={'name':a165_0x394210(0xd4),'type':'string','required':!![],'description':a165_0x394210(0xbd)};function a165_0x5085(){const _0x2bfb9b=['set','role','datasetCode','pageNodeList','Run\x20`role\x20list`,\x20or\x20use\x20SELF/ALL/<id>.','rolePermit','filter','resourceCode','label','some','Run\x20`role\x20list`.','Special\x20role\x20','Comma-separated\x20datasetCodes\x20to\x20revoke\x20API\x20access\x20for','trim','2151hscBEc',';\x20SELF\x20=\x20only\x20own\x20rows','export-roles','row\x20visibility','menuPermit','\x20not\x20found.','appCode','length','detail-roles','dataUpdate','dataExport','48LZiLZW','36069HnkYUU','get','map','roleName','\x20(comma-separated\x20SELF/ALL/id/name)','grant','SELF\x20is\x20not\x20allowed\x20for\x20','bool','revoke','datasets','number','dataDetail','entries','637668mLQQff','dataDelete','Roles\x20for\x20','Role\x20id\x20','data\x20update','join','--grant\x20and\x20--revoke\x20are\x20mutually\x20exclusive.','657633bSqZVZ','33486SUkqjN','data\x20create','boolean','ALL','Disambiguate\x20with\x20an\x20id.','update-roles','roleType','Missing\x20action.','146138qRaWJq','flagMissing','delete-roles','string','Role\x20\x22','12761UnSxRr','Comma-separated\x20menu\x20resourceCodes\x20to\x20grant/revoke','test','448aadvKz','action','allowedActions','\x20is\x20not\x20available\x20for\x20this\x20app.','push','Pass\x20exactly\x20one\x20of\x20--grant\x20/\x20--revoke.','\x22\x20is\x20ambiguous\x20(ids:\x20','60EPWNdP','key','SELF\x20(row-level)\x20applies\x20only\x20to\x20--row-roles.','access','find','menu-id','toUpperCase','resourceName','1112yKoaie','menus','create-roles','str','Pass\x20--role\x20<id|name>.','split','Menu\x20id\x20(from\x20`menu\x20list`)','\x22\x20not\x20found.','allowSelf','dataCreate','validation','415joobdD','Grant\x20access\x20to\x20the\x20listed\x20resources','data\x20delete'];a165_0x5085=function(){return _0x2bfb9b;};return a165_0x5085();}export const PAGE_SLOT_SPECS=[{'flag':'menu-roles','key':a165_0x394210(0xc3),'allowSelf':![],'label':'menu\x20visibility'},{'flag':a165_0x394210(0xa5),'key':a165_0x394210(0xac),'allowSelf':![],'label':a165_0x394210(0xe1)},{'flag':a165_0x394210(0xe5),'key':a165_0x394210(0xc8),'allowSelf':![],'label':a165_0x394210(0xdc)},{'flag':a165_0x394210(0xea),'key':a165_0x394210(0xd9),'allowSelf':![],'label':a165_0x394210(0xb0)},{'flag':a165_0x394210(0xc7),'key':a165_0x394210(0xd6),'allowSelf':![],'label':'data\x20detail'},{'flag':a165_0x394210(0xc1),'key':a165_0x394210(0xc9),'allowSelf':![],'label':'data\x20export'},{'flag':'row-roles','key':'dataPermit','allowSelf':!![],'label':a165_0x394210(0xc2)}];export const PAGE_SET_ROLE_FLAGS=PAGE_SLOT_SPECS['map'](_0x33fe4a=>({'name':_0x33fe4a['flag'],'type':'string','required':![],'description':a165_0x394210(0xda)+_0x33fe4a[a165_0x394210(0xb9)]+a165_0x394210(0xcf)+(_0x33fe4a[a165_0x394210(0xab)]?a165_0x394210(0xc0):'')}));export function splitList(_0x608980){const _0x1b19f7=a165_0x394210;return _0x608980[_0x1b19f7(0xa8)](',')[_0x1b19f7(0xcd)](_0x219c59=>_0x219c59[_0x1b19f7(0xbe)]())[_0x1b19f7(0xb7)](Boolean);}export function projectRoleRef(_0x43311d){const _0x48eac0=a165_0x394210;return{'id':_0x43311d['id'],'roleName':_0x43311d[_0x48eac0(0xce)],'roleType':_0x43311d['roleType']};}export async function resolvePermitRoles(_0x2b3029,_0x65b71e,_0x3313b9){const _0x42123f=a165_0x394210,_0x151960=await listPermitRoles(_0x2b3029,{'needSelf':!![],'needPublic':!![]}),_0x18efe6=[];for(const _0x479638 of _0x65b71e){const _0x1ae94=resolveOnePermitRole(_0x151960,_0x479638);if(!_0x3313b9[_0x42123f(0xab)]&&_0x1ae94['roleType']==='SELF')throw CliErrors[_0x42123f(0xad)](_0x42123f(0xd1)+_0x3313b9[_0x42123f(0xb9)]+'.',_0x42123f(0x9d));if(!_0x18efe6[_0x42123f(0xba)](_0x405af0=>_0x405af0['id']===_0x1ae94['id']))_0x18efe6[_0x42123f(0xf4)](_0x1ae94);}return _0x18efe6;}function resolveOnePermitRole(_0x1f82b7,_0x33418b){const _0x2d65b3=a165_0x394210,_0x1aaa5a=_0x33418b['trim'](),_0x1a5400=_0x1aaa5a[_0x2d65b3(0xa1)]();if(_0x1a5400==='SELF'||_0x1a5400===_0x2d65b3(0xe3)){const _0x2fae9a=_0x1f82b7[_0x2d65b3(0x9f)](_0x1d13ad=>_0x1d13ad[_0x2d65b3(0xe6)]===_0x1a5400);if(!_0x2fae9a)throw CliErrors[_0x2d65b3(0xad)](_0x2d65b3(0xbc)+_0x1a5400+_0x2d65b3(0xf3));return _0x2fae9a;}if(/^-?\d+$/[_0x2d65b3(0xef)](_0x1aaa5a)){const _0x3130d7=Number(_0x1aaa5a),_0x36bbd0=_0x1f82b7[_0x2d65b3(0x9f)](_0x25e873=>_0x25e873['id']===_0x3130d7);if(!_0x36bbd0)throw CliErrors[_0x2d65b3(0xad)](_0x2d65b3(0xdb)+_0x3130d7+_0x2d65b3(0xc4),_0x2d65b3(0xbb));return _0x36bbd0;}const _0x595a4c=_0x1f82b7['filter'](_0x3212ca=>_0x3212ca[_0x2d65b3(0xce)]===_0x1aaa5a);if(_0x595a4c[_0x2d65b3(0xc6)]===0x0)throw CliErrors[_0x2d65b3(0xad)](_0x2d65b3(0xec)+_0x1aaa5a+_0x2d65b3(0xaa),_0x2d65b3(0xb5));if(_0x595a4c[_0x2d65b3(0xc6)]>0x1)throw CliErrors[_0x2d65b3(0xad)](_0x2d65b3(0xec)+_0x1aaa5a+_0x2d65b3(0x9a)+_0x595a4c[_0x2d65b3(0xcd)](_0x207d04=>_0x207d04['id'])[_0x2d65b3(0xdd)](',\x20')+').',_0x2d65b3(0xe4));return _0x595a4c[0x0];}export function projectPageSlot(_0x1fada0){const _0x3aa9c2=a165_0x394210;if(!_0x1fada0)return null;return{'resourceCode':_0x1fada0['resourceCode'],'roles':(_0x1fada0[_0x3aa9c2(0xb6)]??[])[_0x3aa9c2(0xcd)](projectRoleRef)};}export function projectPagePermit(_0x286f12){const _0x10db1b=a165_0x394210,_0x3a1b7f={'menuId':_0x286f12['menuId'],'appCode':_0x286f12[_0x10db1b(0xc5)],'menuPermit':projectPageSlot(_0x286f12['menuPermit'])};for(const _0x3bad07 of PAGE_SLOT_SPECS){if(_0x3bad07[_0x10db1b(0x9c)]==='menuPermit')continue;_0x3a1b7f[_0x3bad07[_0x10db1b(0x9c)]]=projectPageSlot(_0x286f12[_0x3bad07['key']]);}return _0x3a1b7f;}export function flattenMenuResources(_0x298d8c){const _0x483e69=new Map(),_0x38950a=_0x17d90a=>{const _0x1965a2=a165_0x34a5;for(const _0x46b835 of _0x17d90a??[]){_0x483e69[_0x1965a2(0xb1)](_0x46b835[_0x1965a2(0xb8)],{'resourceCode':_0x46b835[_0x1965a2(0xb8)],'resourceName':_0x46b835[_0x1965a2(0xa2)],'action':_0x46b835[_0x1965a2(0xf2)]?.[0x0]??'0'});if(_0x46b835[_0x1965a2(0xb4)])_0x38950a(_0x46b835[_0x1965a2(0xb4)]);}};return _0x38950a(_0x298d8c),_0x483e69;}export function flattenApiResources(_0x28b0a5){const _0x2d1f90=a165_0x394210,_0x225213=new Map(),_0x156e41=new Map();for(const _0x5380ed of _0x28b0a5){const _0x551277=_0x5380ed['apiList']??{};for(const [_0x3a2710,_0x40e248]of Object[_0x2d1f90(0xd7)](_0x551277)){_0x225213[_0x2d1f90(0xb1)](_0x3a2710,{'resourceCode':_0x3a2710,'resourceName':_0x5380ed['resourceName'],'datasetCode':_0x5380ed[_0x2d1f90(0xb3)],'action':_0x40e248?.[0x0]??'0'});const _0x27e9fa=_0x156e41['get'](_0x5380ed[_0x2d1f90(0xb3)])??[];_0x27e9fa[_0x2d1f90(0xf4)](_0x3a2710),_0x156e41['set'](_0x5380ed[_0x2d1f90(0xb3)],_0x27e9fa);}}return{'byCode':_0x225213,'byDataset':_0x156e41};}export function buildPermits(_0x24a422,_0x2c4cda){const _0x5d15f6=a165_0x394210,_0x16da60={};for(const [_0x4c0eb3,_0x5831c8]of _0x24a422){const _0x5405b6=_0x2c4cda[_0x5d15f6(0xcc)](_0x4c0eb3)??_0x5831c8[_0x5d15f6(0xf1)];_0x16da60[_0x4c0eb3]=[_0x5405b6];}return _0x16da60;}export function readRoleRef(_0x4fbe6d){const _0x150dc4=a165_0x394210,_0x4e3f74=_0x4fbe6d[_0x150dc4(0xa6)](_0x150dc4(0xb2))['trim']();if(!_0x4e3f74)throw CliErrors[_0x150dc4(0xe9)](_0x150dc4(0xb2),_0x150dc4(0xa7));return _0x4e3f74;}export function readGrantRevoke(_0x2661e2){const _0x572242=a165_0x394210,_0xb05de3=_0x2661e2[_0x572242(0xd2)](_0x572242(0xd0)),_0x57fd4a=_0x2661e2[_0x572242(0xd2)](_0x572242(0xd3));if(_0xb05de3&&_0x57fd4a)throw CliErrors[_0x572242(0xad)](_0x572242(0xde));if(!_0xb05de3&&!_0x57fd4a)throw CliErrors[_0x572242(0xad)](_0x572242(0xe7),_0x572242(0xf5));return _0xb05de3?_0x572242(0x9e):'0';}
@@ -1,2 +0,0 @@
1
- import type { CommandDefinition } from "../../framework/types.js";
2
- export declare const roleCreate: CommandDefinition;
@@ -1 +0,0 @@
1
- const a179_0x1b99db=a179_0x6d58;function a179_0x6d58(_0xa4ac82,_0x58a902){_0xa4ac82=_0xa4ac82-0x115;const _0xea56e9=a179_0xea56();let _0x6d5888=_0xea56e9[_0xa4ac82];return _0x6d5888;}(function(_0x108128,_0x23dee7){const _0x138577=a179_0x6d58,_0x878f79=_0x108128();while(!![]){try{const _0x2384e2=parseInt(_0x138577(0x12a))/0x1+-parseInt(_0x138577(0x12d))/0x2+-parseInt(_0x138577(0x129))/0x3*(parseInt(_0x138577(0x11a))/0x4)+parseInt(_0x138577(0x116))/0x5*(parseInt(_0x138577(0x119))/0x6)+parseInt(_0x138577(0x122))/0x7+-parseInt(_0x138577(0x11b))/0x8+parseInt(_0x138577(0x128))/0x9*(parseInt(_0x138577(0x124))/0xa);if(_0x2384e2===_0x23dee7)break;else _0x878f79['push'](_0x878f79['shift']());}catch(_0x5af5a4){_0x878f79['push'](_0x878f79['shift']());}}}(a179_0xea56,0x7e39e));function a179_0xea56(){const _0x18a631=['name','trim','894005TgHzXS','str','77810QTlqyc','remark','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','Pass\x20--name\x20<roleName>.','1494RKSmjW','679911hxZpox','318720dsyoBx','flagMissing','write','1770346ZMSeox','validation','roleName','POST','CUSTOM','5cQLpQL','\x20(id=','role','2728002bNKoYF','12FyUrMy','885136capamr','length','Create\x20a\x20CUSTOM\x20user\x20group\x20(role)','appCode','create'];a179_0xea56=function(){return _0x18a631;};return a179_0xea56();}import{createAppRole}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{asDryRunResult}from'../../commands/common/dry-run.js';import{NAME_FLAG,REMARK_FLAG,projectRole}from'../../commands/role/shared.js';const CREATE_PATH='/smartapi/permit/role/create';function readName(_0x31851f){const _0xc4e514=a179_0x6d58,_0x557b14=_0x31851f[_0xc4e514(0x123)](_0xc4e514(0x120))[_0xc4e514(0x121)]();if(!_0x557b14)throw CliErrors[_0xc4e514(0x12b)](_0xc4e514(0x120),_0xc4e514(0x127));if(_0x557b14[_0xc4e514(0x11c)]>0x40)throw CliErrors[_0xc4e514(0x12e)](_0xc4e514(0x126));return _0x557b14;}export const roleCreate={'service':a179_0x1b99db(0x118),'command':a179_0x1b99db(0x11f),'description':a179_0x1b99db(0x11d),'risk':a179_0x1b99db(0x12c),'flags':[NAME_FLAG,REMARK_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x575ee4){readName(_0x575ee4);},async 'dryRun'(_0x1086a3){const _0x383079=a179_0x1b99db,_0xfe6be3=readName(_0x1086a3),_0x3a1218=_0x1086a3[_0x383079(0x123)]('remark')[_0x383079(0x121)]()||undefined;return asDryRunResult({'operation':_0x383079(0x11f),'selector':{'appCode':_0x1086a3[_0x383079(0x11e)],'roleName':_0xfe6be3},'before':null,'after':{'roleName':_0xfe6be3,'roleType':_0x383079(0x115),'remark':_0x3a1218},'dryRun':!![],'backend':{'method':'POST','path':CREATE_PATH},'warnings':[]},{'method':'POST','url':CREATE_PATH});},async 'execute'(_0x52e1f0){const _0x51aaaa=a179_0x1b99db,_0x154105=readName(_0x52e1f0),_0x1bafef=_0x52e1f0['str'](_0x51aaaa(0x125))[_0x51aaaa(0x121)]()||undefined,_0x3adcaa=await createAppRole({'appCode':_0x52e1f0[_0x51aaaa(0x11e)],'roleName':_0x154105,..._0x1bafef?{'remark':_0x1bafef}:{}});return{'ok':!![],'data':{'operation':_0x51aaaa(0x11f),'selector':{'appCode':_0x52e1f0[_0x51aaaa(0x11e)],'roleId':_0x3adcaa['id'],'roleName':_0x154105},'before':null,'after':projectRole(_0x3adcaa),'dryRun':![],'backend':{'method':_0x51aaaa(0x130),'path':CREATE_PATH},'warnings':[]},'message':'Created\x20role\x20'+_0x3adcaa[_0x51aaaa(0x12f)]+_0x51aaaa(0x117)+_0x3adcaa['id']+')'};}};