@lovrabet/rabetbase-cli 2.4.4 → 2.4.5

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",
6
- "skillVersion": "2.4.4",
5
+ "packageVersion": "2.4.5",
6
+ "skillVersion": "2.4.5",
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": "0fa179d9f806b51f8345de375831234c44fb7c70f50bb7cadebe0cf70fd6d89d"
133
+ "digest": "71966020af13e5faefcdb2e4ab6fd25a0574c77e6504bebba4014bdffa7f5c7c"
137
134
  }
@@ -1 +0,0 @@
1
- (function(_0x418ff9,_0x46ea66){const _0x409401=a159_0x317b,_0x27623f=_0x418ff9();while(!![]){try{const _0x3655d9=parseInt(_0x409401(0xe5))/0x1+-parseInt(_0x409401(0xde))/0x2*(-parseInt(_0x409401(0xe2))/0x3)+-parseInt(_0x409401(0xdd))/0x4*(parseInt(_0x409401(0xe4))/0x5)+-parseInt(_0x409401(0xda))/0x6*(parseInt(_0x409401(0xdf))/0x7)+-parseInt(_0x409401(0xdb))/0x8*(parseInt(_0x409401(0xdc))/0x9)+parseInt(_0x409401(0xe3))/0xa*(-parseInt(_0x409401(0xe0))/0xb)+parseInt(_0x409401(0xe1))/0xc;if(_0x3655d9===_0x46ea66)break;else _0x27623f['push'](_0x27623f['shift']());}catch(_0x178fa1){_0x27623f['push'](_0x27623f['shift']());}}}(a159_0x2851,0x27d4e));function a159_0x2851(){const _0x322de9=['209340MJZcrx','20rEBZbs','10jeYiVz','304032KkRpBD','51294iqcSzv','72uGRSQK','79911nqqOWE','553792ouLIno','2TwtWdd','91CMNaoD','1760913oVqckh','6929376bPkMTS'];a159_0x2851=function(){return _0x322de9;};return a159_0x2851();}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_0x317b(_0x4eb0a1,_0x33bd65){_0x4eb0a1=_0x4eb0a1-0xda;const _0x2851f9=a159_0x2851();let _0x317b4b=_0x2851f9[_0x4eb0a1];return _0x317b4b;}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_0x59f255=a160_0x102c;function a160_0x102c(_0x448da5,_0x46dcf7){_0x448da5=_0x448da5-0x96;const _0x4babd2=a160_0x4bab();let _0x102c57=_0x4babd2[_0x448da5];return _0x102c57;}(function(_0x141dfa,_0x345c99){const _0xd4f99b=a160_0x102c,_0x34e9b3=_0x141dfa();while(!![]){try{const _0x1b1bc0=parseInt(_0xd4f99b(0x9b))/0x1+parseInt(_0xd4f99b(0x9d))/0x2+-parseInt(_0xd4f99b(0xa3))/0x3+parseInt(_0xd4f99b(0x9f))/0x4+parseInt(_0xd4f99b(0x97))/0x5*(parseInt(_0xd4f99b(0x9e))/0x6)+parseInt(_0xd4f99b(0xa2))/0x7*(-parseInt(_0xd4f99b(0x96))/0x8)+-parseInt(_0xd4f99b(0x9a))/0x9*(parseInt(_0xd4f99b(0x98))/0xa);if(_0x1b1bc0===_0x345c99)break;else _0x34e9b3['push'](_0x34e9b3['shift']());}catch(_0x5a32e3){_0x34e9b3['push'](_0x34e9b3['shift']());}}}(a160_0x4bab,0x82545));import{getPagePermit}from'../../core/api-client.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';import{MENU_ID_FLAG,projectPagePermit}from'../../commands/permit/shared.js';export const permitPageGet={'service':a160_0x59f255(0xa0),'command':a160_0x59f255(0xa1),'description':'Show\x20the\x20page\x20permission\x20snapshot\x20for\x20a\x20menu','risk':'read','flags':[MENU_ID_FLAG,APPCODE_FLAG_OPTIONAL],async 'execute'(_0x2cd705){const _0x50ed0b=a160_0x59f255,_0x4f0b59=_0x2cd705[_0x50ed0b(0x99)](_0x50ed0b(0x9c)),_0x1da8f6=await getPagePermit(_0x4f0b59);return{'ok':!![],'data':{'page':projectPagePermit(_0x1da8f6)},'message':'Page\x20permit\x20for\x20menu\x20'+_0x4f0b59};}};function a160_0x4bab(){const _0x596458=['num','9gtzBZp','333691qqrOAX','menu-id','1401174sJpJDX','18QuipZe','1719380pmcLMj','permit','page-get','5374446KRBrJY','361110IwlNSg','8NQuSOS','609395dGxdoy','4077830BBIuyL'];a160_0x4bab=function(){return _0x596458;};return a160_0x4bab();}
@@ -1,2 +0,0 @@
1
- import type { CommandDefinition } from "../../framework/types.js";
2
- export declare const permitPageSet: CommandDefinition;
@@ -1 +0,0 @@
1
- const a161_0x2b0c69=a161_0x388b;(function(_0x553c08,_0x39e606){const _0x32bc42=a161_0x388b,_0x5f1e1b=_0x553c08();while(!![]){try{const _0x57a60c=parseInt(_0x32bc42(0x1a4))/0x1*(-parseInt(_0x32bc42(0x1bb))/0x2)+parseInt(_0x32bc42(0x1ad))/0x3*(parseInt(_0x32bc42(0x1b6))/0x4)+parseInt(_0x32bc42(0x1b2))/0x5*(parseInt(_0x32bc42(0x199))/0x6)+parseInt(_0x32bc42(0x1b5))/0x7+-parseInt(_0x32bc42(0x1b1))/0x8*(-parseInt(_0x32bc42(0x1aa))/0x9)+parseInt(_0x32bc42(0x1ab))/0xa*(parseInt(_0x32bc42(0x1bd))/0xb)+-parseInt(_0x32bc42(0x1a5))/0xc;if(_0x57a60c===_0x39e606)break;else _0x5f1e1b['push'](_0x5f1e1b['shift']());}catch(_0x552317){_0x5f1e1b['push'](_0x5f1e1b['shift']());}}}(a161_0x6d0c,0xe9f7d));import{getPagePermit,savePagePermit}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{APPCODE_FLAG_OPTIONAL}from'../../commands/common/flags.js';function a161_0x388b(_0x41876a,_0x48c383){_0x41876a=_0x41876a-0x199;const _0x6d0cd6=a161_0x6d0c();let _0x388b75=_0x6d0cd6[_0x41876a];return _0x388b75;}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';const SAVE_PATH=a161_0x2b0c69(0x1a2);function a161_0x6d0c(){const _0x4d60c8=['2136042ycGcsa','158890XrQUJP','num','99660DdtACM','validation','Only\x20slots\x20present\x20in\x20`permit\x20page-get`\x20can\x20be\x20set.','selector','8BcQcGd','5FASHGD','Set\x20page\x20permissions\x20for\x20a\x20menu\x20(menu/create/update/delete/detail/export/row\x20roles);\x20requires\x20--yes','menu-id','5950392CYcmvK','176iHMdqc','flag','page-set','label','join','116xVvJui','menuId','649oIvzcz','key','5027718DlxzAi','Pass\x20at\x20least\x20one\x20of:\x20','Pass\x20at\x20least\x20one\x20role,\x20or\x20omit\x20the\x20flag.\x20Clearing\x20permissions\x20is\x20not\x20supported\x20by\x20this\x20command.','This\x20page\x20has\x20no\x20\x22','Nothing\x20to\x20set.','allowSelf','length','push','map','/smartapi/permit/page/save','Updated\x20page\x20permit\x20for\x20menu\x20','23931oYDFCA','23737764CVbdBa','appCode','spec','permit','POST'];a161_0x6d0c=function(){return _0x4d60c8;};return a161_0x6d0c();}function collectRequestedSlots(_0x3555c5){const _0x11a843=a161_0x2b0c69,_0x536dfe=[];for(const _0x34123f of PAGE_SLOT_SPECS){const _0x8b8a9e=_0x3555c5[_0x11a843(0x1b7)](_0x34123f[_0x11a843(0x1b7)]);if(_0x8b8a9e===undefined||_0x8b8a9e===null)continue;const _0x14a42b=splitList(String(_0x8b8a9e));if(_0x14a42b[_0x11a843(0x19f)]===0x0)throw CliErrors['validation']('--'+_0x34123f[_0x11a843(0x1b7)]+'\x20cannot\x20be\x20empty.',_0x11a843(0x19b));_0x536dfe[_0x11a843(0x1a0)]({'spec':_0x34123f,'refs':_0x14a42b});}return _0x536dfe;}async function buildPlan(_0x5c9716,_0x1f2a85){const _0x3a773b=a161_0x2b0c69,_0x1ca63d=_0x5c9716[_0x3a773b(0x1ac)](_0x3a773b(0x1b4)),_0x2c022e=collectRequestedSlots(_0x5c9716);if(_0x2c022e['length']===0x0)throw CliErrors[_0x3a773b(0x1ae)](_0x3a773b(0x19d),'Pass\x20at\x20least\x20one\x20of:\x20'+PAGE_SLOT_SPECS[_0x3a773b(0x1a1)](_0x457687=>'--'+_0x457687[_0x3a773b(0x1b7)])[_0x3a773b(0x1ba)](',\x20')+'.');const _0x39919b=await getPagePermit(_0x1ca63d),_0x747eef={},_0x53d40e={},_0x554930=[];for(const {spec:_0x266c5b,refs:_0x10bf82}of _0x2c022e){const _0x194bf2=_0x39919b[_0x266c5b[_0x3a773b(0x1be)]];if(!_0x194bf2)throw CliErrors['validation'](_0x3a773b(0x19c)+_0x266c5b['label']+'\x22\x20permission\x20slot\x20('+_0x266c5b[_0x3a773b(0x1be)]+').',_0x3a773b(0x1af));_0x747eef[_0x266c5b[_0x3a773b(0x1be)]]=projectPageSlot(_0x194bf2);const _0x406128=await resolvePermitRoles(_0x5c9716[_0x3a773b(0x1a6)],_0x10bf82,{'allowSelf':_0x266c5b[_0x3a773b(0x19e)],'label':_0x266c5b[_0x3a773b(0x1b9)]});_0x194bf2['rolePermit']=_0x406128,_0x53d40e[_0x266c5b[_0x3a773b(0x1be)]]=projectPageSlot(_0x194bf2);}const _0x2bcf1f={'operation':_0x3a773b(0x1b8),'selector':{'appCode':_0x5c9716[_0x3a773b(0x1a6)],'menuId':_0x1ca63d,'slots':_0x2c022e[_0x3a773b(0x1a1)](_0x2eb4a9=>_0x2eb4a9[_0x3a773b(0x1a7)][_0x3a773b(0x1be)])},'before':_0x747eef,'after':_0x53d40e,'dryRun':_0x1f2a85,'backend':{'method':_0x3a773b(0x1a9),'path':SAVE_PATH},'warnings':_0x554930};return{'page':_0x39919b,'mutation':_0x2bcf1f};}export const permitPageSet={'service':a161_0x2b0c69(0x1a8),'command':a161_0x2b0c69(0x1b8),'description':a161_0x2b0c69(0x1b3),'risk':'high-risk-write','flags':[MENU_ID_FLAG,...PAGE_SET_ROLE_FLAGS,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x2f11a5){const _0x1f1673=a161_0x2b0c69,_0x499b2e=collectRequestedSlots(_0x2f11a5);if(_0x499b2e['length']===0x0)throw CliErrors[_0x1f1673(0x1ae)](_0x1f1673(0x19d),_0x1f1673(0x19a)+PAGE_SLOT_SPECS[_0x1f1673(0x1a1)](_0x454335=>'--'+_0x454335[_0x1f1673(0x1b7)])[_0x1f1673(0x1ba)](',\x20')+'.');},async 'dryRun'(_0x376627){const _0x636640=a161_0x2b0c69,{mutation:_0x20942c}=await buildPlan(_0x376627,!![]);return asDryRunResult(_0x20942c,{'method':_0x636640(0x1a9),'url':SAVE_PATH});},async 'execute'(_0x4f5f77){const _0x2f9549=a161_0x2b0c69,{page:_0xe87eac,mutation:_0x1a7dbb}=await buildPlan(_0x4f5f77,![]);return await savePagePermit(_0xe87eac),{'ok':!![],'data':_0x1a7dbb,'message':_0x2f9549(0x1a3)+_0x1a7dbb[_0x2f9549(0x1b0)][_0x2f9549(0x1bc)]};}};
@@ -1,2 +0,0 @@
1
- import type { CommandDefinition } from "../../framework/types.js";
2
- export declare const permitRoleApisSet: CommandDefinition;
@@ -1 +0,0 @@
1
- const a162_0x5684ae=a162_0x2207;(function(_0x5f41fd,_0x4c9205){const _0x2015b8=a162_0x2207,_0x53188f=_0x5f41fd();while(!![]){try{const _0x223019=-parseInt(_0x2015b8(0x1a3))/0x1+parseInt(_0x2015b8(0x1bb))/0x2+-parseInt(_0x2015b8(0x1ba))/0x3+-parseInt(_0x2015b8(0x19c))/0x4*(parseInt(_0x2015b8(0x1a1))/0x5)+parseInt(_0x2015b8(0x19f))/0x6+-parseInt(_0x2015b8(0x1a7))/0x7+parseInt(_0x2015b8(0x1be))/0x8;if(_0x223019===_0x4c9205)break;else _0x53188f['push'](_0x53188f['shift']());}catch(_0x29702d){_0x53188f['push'](_0x53188f['shift']());}}}(a162_0x3bd5,0x3162f));import{getRoleApiResources,updateAppRole}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{buildPermits,DATASETS_FLAG,flattenApiResources,readRoleRef,REVOKE_FLAG,ROLE_REF_FLAG,splitList}from'../../commands/permit/shared.js';import{assertPermConfigurable,resolveRoleRef}from'../../commands/role/shared.js';function a162_0x2207(_0x48f706,_0x53d46f){_0x48f706=_0x48f706-0x19a;const _0x3bd586=a162_0x3bd5();let _0x220774=_0x3bd586[_0x48f706];return _0x220774;}const UPDATE_PATH=a162_0x5684ae(0x19d);async function buildPlan(_0x58c159,_0x204eda){const _0x2ef75e=a162_0x5684ae,_0xb93a25=await resolveRoleRef(_0x58c159[_0x2ef75e(0x1af)],readRoleRef(_0x58c159));assertPermConfigurable(_0xb93a25);if(!_0x58c159[_0x2ef75e(0x19e)](_0x2ef75e(0x1a4)))throw CliErrors[_0x2ef75e(0x1a8)](_0x2ef75e(0x1b4),_0x2ef75e(0x1b8));const _0x5dd45e=splitList(_0x58c159['str']('datasets'));if(_0x5dd45e['length']===0x0)throw CliErrors[_0x2ef75e(0x1a5)](_0x2ef75e(0x1b7),_0x2ef75e(0x1ae));const _0x35a043=await getRoleApiResources(_0x58c159['appCode'],_0xb93a25['id']),{byCode:_0x39da20,byDataset:_0x106030}=flattenApiResources(_0x35a043),_0x497749=_0x5dd45e[_0x2ef75e(0x1b9)](_0x4f9a8a=>!_0x106030[_0x2ef75e(0x1aa)](_0x4f9a8a));if(_0x497749[_0x2ef75e(0x1a9)]>0x0)throw CliErrors[_0x2ef75e(0x1a8)](_0x2ef75e(0x1b5)+_0x497749['join'](',\x20')+'.',_0x2ef75e(0x1ad));const _0x1b3b05=new Map(),_0x2441d7=[],_0x262fe9=[];for(const _0x5e2808 of _0x5dd45e){for(const _0x478dd8 of _0x106030[_0x2ef75e(0x1b3)](_0x5e2808)){const _0x3434dc=_0x39da20['get'](_0x478dd8);_0x1b3b05['set'](_0x478dd8,'0'),_0x2441d7['push']({'resourceCode':_0x478dd8,'datasetCode':_0x5e2808,'action':_0x3434dc[_0x2ef75e(0x1b6)]}),_0x262fe9['push']({'resourceCode':_0x478dd8,'datasetCode':_0x5e2808,'action':'0'});}}const _0x5237d2=buildPermits(_0x39da20,_0x1b3b05),_0x40b84c={'operation':_0x2ef75e(0x1ac),'selector':{'appCode':_0x58c159['appCode'],'roleId':_0xb93a25['id'],'roleName':_0xb93a25['roleName'],'datasetCodes':_0x5dd45e},'before':_0x2441d7,'after':_0x262fe9,'dryRun':_0x204eda,'backend':{'method':_0x2ef75e(0x1ab),'path':UPDATE_PATH,'roleType':'API'},'warnings':[]};return{'role':_0xb93a25,'permits':_0x5237d2,'mutation':_0x40b84c};}export const permitRoleApisSet={'service':a162_0x5684ae(0x1bd),'command':a162_0x5684ae(0x19b),'description':a162_0x5684ae(0x1b0),'risk':a162_0x5684ae(0x1b1),'flags':[ROLE_REF_FLAG,REVOKE_FLAG,DATASETS_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1a93b5){const _0x28f19e=a162_0x5684ae;if(!_0x1a93b5[_0x28f19e(0x19e)](_0x28f19e(0x1a4)))throw CliErrors[_0x28f19e(0x1a8)](_0x28f19e(0x1b4),_0x28f19e(0x1b8));if(splitList(_0x1a93b5['str'](_0x28f19e(0x1b7)))['length']===0x0)throw CliErrors[_0x28f19e(0x1a5)](_0x28f19e(0x1b7),_0x28f19e(0x1ae));},async 'dryRun'(_0x103f5f){const {mutation:_0x583825}=await buildPlan(_0x103f5f,!![]);return asDryRunResult(_0x583825,{'method':'POST','url':UPDATE_PATH});},async 'execute'(_0x2f4b92){const _0x3fc2e5=a162_0x5684ae,{role:_0x2b98fe,permits:_0x2c3061,mutation:_0x3f76de}=await buildPlan(_0x2f4b92,![]);return await updateAppRole({'id':_0x2b98fe['id'],'appCode':_0x2f4b92[_0x3fc2e5(0x1af)],'roleType':_0x3fc2e5(0x19a),'permits':_0x2c3061}),{'ok':!![],'data':_0x3f76de,'message':_0x3fc2e5(0x1bc)+_0x3f76de[_0x3fc2e5(0x1a6)][_0x3fc2e5(0x1a0)]['length']+_0x3fc2e5(0x1b2)+_0x2b98fe[_0x3fc2e5(0x1a2)]};}};function a162_0x3bd5(){const _0x44cbb0=['datasetCodes','405Jmcgaf','roleName','283942fknZIJ','revoke','flagMissing','selector','834673QTtoJu','validation','length','has','POST','api-revoke','Verify\x20the\x20datasetCode,\x20or\x20check\x20the\x20role\x27s\x20API\x20resource\x20matrix.','Pass\x20--datasets\x20<datasetCode,...>.','appCode','Revoke\x20a\x20role\x27s\x20dataset\x20API\x20access\x20by\x20datasetCode\x20(roleType\x20API);\x20requires\x20--yes','high-risk-write','\x20dataset(s)\x20on\x20role\x20','get','Missing\x20--revoke.','Unknown\x20datasetCode(s)\x20for\x20this\x20role\x27s\x20API\x20resources:\x20','action','datasets','role-apis-set\x20currently\x20supports\x20revoking\x20dataset\x20API\x20access\x20(use\x20case\x204).','filter','340833IBSYwN','66348ZvjCgA','Revoked\x20API\x20access\x20for\x20','permit','6064152HjEbIf','API','role-apis-set','5548zJwonr','/smartapi/permit/role/update','bool','241398EYvTXL'];a162_0x3bd5=function(){return _0x44cbb0;};return a162_0x3bd5();}
@@ -1,2 +0,0 @@
1
- import type { CommandDefinition } from "../../framework/types.js";
2
- export declare const permitRoleMenusSet: CommandDefinition;
@@ -1 +0,0 @@
1
- const a163_0x4eaa9d=a163_0x3ad5;(function(_0x2b246b,_0x2abb33){const _0x5376b3=a163_0x3ad5,_0x2bd902=_0x2b246b();while(!![]){try{const _0x37eddb=-parseInt(_0x5376b3(0x1ad))/0x1+-parseInt(_0x5376b3(0x1b0))/0x2*(-parseInt(_0x5376b3(0x1c1))/0x3)+parseInt(_0x5376b3(0x1aa))/0x4*(-parseInt(_0x5376b3(0x1a8))/0x5)+parseInt(_0x5376b3(0x1be))/0x6+parseInt(_0x5376b3(0x1b3))/0x7*(-parseInt(_0x5376b3(0x19f))/0x8)+parseInt(_0x5376b3(0x1b5))/0x9+parseInt(_0x5376b3(0x1a5))/0xa*(parseInt(_0x5376b3(0x1bc))/0xb);if(_0x37eddb===_0x2abb33)break;else _0x2bd902['push'](_0x2bd902['shift']());}catch(_0x4e1576){_0x2bd902['push'](_0x2bd902['shift']());}}}(a163_0x5b99,0x75612));import{getRoleMenuResources,updateAppRole}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';function a163_0x3ad5(_0x4d21ae,_0x214f2b){_0x4d21ae=_0x4d21ae-0x19f;const _0x5b9993=a163_0x5b99();let _0x3ad594=_0x5b9993[_0x4d21ae];return _0x3ad594;}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=a163_0x4eaa9d(0x1a0);async function buildPlan(_0x5ba980,_0x2e2f6d){const _0x4d8d87=a163_0x4eaa9d,_0x2ba216=await resolveRoleRef(_0x5ba980[_0x4d8d87(0x1ba)],readRoleRef(_0x5ba980));assertPermConfigurable(_0x2ba216);const _0x4917fc=readGrantRevoke(_0x5ba980),_0x31e0f9=splitList(_0x5ba980[_0x4d8d87(0x1ab)](_0x4d8d87(0x1b4)));if(_0x31e0f9[_0x4d8d87(0x1bd)]===0x0)throw CliErrors[_0x4d8d87(0x1b1)](_0x4d8d87(0x1b4),'Pass\x20--menus\x20<resourceCode,...>.');const _0x12911d=await getRoleMenuResources(_0x5ba980[_0x4d8d87(0x1ba)],_0x2ba216['id']),_0xe6b55=flattenMenuResources(_0x12911d),_0x502f90=_0x31e0f9[_0x4d8d87(0x1b6)](_0x5268c2=>!_0xe6b55[_0x4d8d87(0x1a4)](_0x5268c2));if(_0x502f90[_0x4d8d87(0x1bd)]>0x0)throw CliErrors[_0x4d8d87(0x1a2)](_0x4d8d87(0x1ae)+_0x502f90[_0x4d8d87(0x1c2)](',\x20')+'.','Run\x20`permit\x20role-menus\x20--role\x20<id>`\x20to\x20see\x20valid\x20resourceCodes.');const _0x1961a0=new Map(),_0x5d5c26=[],_0x1ddc73=[];for(const _0xd32a57 of _0x31e0f9){const _0x5088ab=_0xe6b55[_0x4d8d87(0x1a9)](_0xd32a57);_0x1961a0[_0x4d8d87(0x1af)](_0xd32a57,_0x4917fc),_0x5d5c26['push']({'resourceCode':_0xd32a57,'action':_0x5088ab[_0x4d8d87(0x1b9)]}),_0x1ddc73['push']({'resourceCode':_0xd32a57,'action':_0x4917fc});}const _0x53a8db=buildPermits(_0xe6b55,_0x1961a0),_0x274000={'operation':_0x4917fc===_0x4d8d87(0x1a7)?_0x4d8d87(0x1b7):_0x4d8d87(0x1ac),'selector':{'appCode':_0x5ba980[_0x4d8d87(0x1ba)],'roleId':_0x2ba216['id'],'roleName':_0x2ba216['roleName'],'resourceCodes':_0x31e0f9},'before':_0x5d5c26,'after':_0x1ddc73,'dryRun':_0x2e2f6d,'backend':{'method':'POST','path':UPDATE_PATH,'roleType':_0x4d8d87(0x1bf)},'warnings':[]};return{'role':_0x2ba216,'permits':_0x53a8db,'mutation':_0x274000};}export const permitRoleMenusSet={'service':a163_0x4eaa9d(0x1a3),'command':'role-menus-set','description':a163_0x4eaa9d(0x1a1),'risk':'high-risk-write','flags':[ROLE_REF_FLAG,GRANT_FLAG,REVOKE_FLAG,MENUS_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x1b203c){const _0x49bbca=a163_0x4eaa9d;readGrantRevoke(_0x1b203c);if(splitList(_0x1b203c[_0x49bbca(0x1ab)](_0x49bbca(0x1b4)))[_0x49bbca(0x1bd)]===0x0)throw CliErrors[_0x49bbca(0x1b1)]('menus',_0x49bbca(0x1b8));},async 'dryRun'(_0x31adac){const _0x25c257=a163_0x4eaa9d,{mutation:_0x2ef1b4}=await buildPlan(_0x31adac,!![]);return asDryRunResult(_0x2ef1b4,{'method':_0x25c257(0x1c3),'url':UPDATE_PATH});},async 'execute'(_0x3a9de1){const _0x39f90c=a163_0x4eaa9d,{role:_0x1557d4,permits:_0x3da0ea,mutation:_0x479ffb}=await buildPlan(_0x3a9de1,![]);return await updateAppRole({'id':_0x1557d4['id'],'appCode':_0x3a9de1[_0x39f90c(0x1ba)],'roleType':_0x39f90c(0x1bf),'permits':_0x3da0ea}),{'ok':!![],'data':_0x479ffb,'message':'Updated\x20'+_0x479ffb[_0x39f90c(0x1b2)][_0x39f90c(0x1bb)][_0x39f90c(0x1bd)]+_0x39f90c(0x1a6)+_0x1557d4[_0x39f90c(0x1c0)]};}};function a163_0x5b99(){const _0x25d230=['1393HPhmVI','menus','1885185EkOxQG','filter','menu-grant','Pass\x20--menus\x20<resourceCode,...>.','action','appCode','resourceCodes','5114219xpdJeg','length','2465118HtqVcx','PAGE','roleName','3romXbY','join','POST','3592yGXxwh','/smartapi/permit/role/update','Grant\x20or\x20revoke\x20a\x20role\x27s\x20menu\x20access\x20by\x20resourceCode\x20(roleType\x20PAGE);\x20requires\x20--yes','validation','permit','has','10PsIYLh','\x20menu\x20permit(s)\x20for\x20role\x20','access','74055fhakuk','get','120DUyOnP','str','menu-revoke','359798DBMvxQ','Unknown\x20menu\x20resourceCode(s):\x20','set','578036dDSfWV','flagMissing','selector'];a163_0x5b99=function(){return _0x25d230;};return a163_0x5b99();}
@@ -1,2 +0,0 @@
1
- import type { CommandDefinition } from "../../framework/types.js";
2
- export declare const permitRoleMenus: CommandDefinition;
@@ -1 +0,0 @@
1
- const a164_0x19002f=a164_0x5544;function a164_0x1851(){const _0x28384d=['filter','allowed','map','2440521onGnPn','appCode','341538XNDHcY','24FILfPx','resourceName','Role\x20','permit','25356iGzsWl','length','98AWMkGT','26534160tmLwRb','125glQWDb','values','roleName','Show\x20a\x20role\x27s\x20current\x20menu\x20permission\x20matrix','8629075wjGRMV','action','role-menus','from','6275624XawniM','412267vGLaGx','\x20has\x20','read'];a164_0x1851=function(){return _0x28384d;};return a164_0x1851();}(function(_0x49ebea,_0x1d22ae){const _0x5b1bc9=a164_0x5544,_0x4864ae=_0x49ebea();while(!![]){try{const _0x3d866a=-parseInt(_0x5b1bc9(0x134))/0x1+parseInt(_0x5b1bc9(0x143))/0x2*(-parseInt(_0x5b1bc9(0x141))/0x3)+-parseInt(_0x5b1bc9(0x133))/0x4+parseInt(_0x5b1bc9(0x145))/0x5*(-parseInt(_0x5b1bc9(0x13c))/0x6)+parseInt(_0x5b1bc9(0x12f))/0x7+parseInt(_0x5b1bc9(0x13d))/0x8*(parseInt(_0x5b1bc9(0x13a))/0x9)+parseInt(_0x5b1bc9(0x144))/0xa;if(_0x3d866a===_0x1d22ae)break;else _0x4864ae['push'](_0x4864ae['shift']());}catch(_0x5e7f63){_0x4864ae['push'](_0x4864ae['shift']());}}}(a164_0x1851,0xd7264));function a164_0x5544(_0x1793d0,_0x39a162){_0x1793d0=_0x1793d0-0x12f;const _0x185143=a164_0x1851();let _0x5544ff=_0x185143[_0x1793d0];return _0x5544ff;}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';import{resolveRoleRef}from'../../commands/role/shared.js';export const permitRoleMenus={'service':a164_0x19002f(0x140),'command':a164_0x19002f(0x131),'description':a164_0x19002f(0x148),'risk':a164_0x19002f(0x136),'flags':[ROLE_REF_FLAG,APPCODE_FLAG_OPTIONAL],async 'execute'(_0x28a7f0){const _0x32edd6=a164_0x19002f,_0x55ffb1=await resolveRoleRef(_0x28a7f0[_0x32edd6(0x13b)],readRoleRef(_0x28a7f0)),_0x4e60d7=await getRoleMenuResources(_0x28a7f0[_0x32edd6(0x13b)],_0x55ffb1['id']),_0x5ad6f9=flattenMenuResources(_0x4e60d7),_0x24e926=Array[_0x32edd6(0x132)](_0x5ad6f9[_0x32edd6(0x146)]())[_0x32edd6(0x139)](_0x4237ba=>({'resourceCode':_0x4237ba['resourceCode'],'resourceName':_0x4237ba[_0x32edd6(0x13e)],'allowed':_0x4237ba[_0x32edd6(0x130)]==='access','action':_0x4237ba[_0x32edd6(0x130)]}));return{'ok':!![],'data':{'selector':{'appCode':_0x28a7f0[_0x32edd6(0x13b)],'roleId':_0x55ffb1['id'],'roleName':_0x55ffb1['roleName']},'menus':_0x24e926},'message':_0x32edd6(0x13f)+_0x55ffb1[_0x32edd6(0x147)]+_0x32edd6(0x135)+_0x24e926[_0x32edd6(0x137)](_0x4cbffa=>_0x4cbffa[_0x32edd6(0x138)])[_0x32edd6(0x142)]+'/'+_0x24e926['length']+'\x20menu(s)\x20allowed'};}};
@@ -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_0x20172d=a165_0x5e05;(function(_0x1c8241,_0xf01c31){const _0x29df42=a165_0x5e05,_0x289cb6=_0x1c8241();while(!![]){try{const _0x2d9e5b=parseInt(_0x29df42(0x230))/0x1+parseInt(_0x29df42(0x217))/0x2*(-parseInt(_0x29df42(0x222))/0x3)+-parseInt(_0x29df42(0x208))/0x4*(-parseInt(_0x29df42(0x237))/0x5)+parseInt(_0x29df42(0x21b))/0x6+-parseInt(_0x29df42(0x209))/0x7+parseInt(_0x29df42(0x23b))/0x8*(parseInt(_0x29df42(0x211))/0x9)+-parseInt(_0x29df42(0x21a))/0xa;if(_0x2d9e5b===_0xf01c31)break;else _0x289cb6['push'](_0x289cb6['shift']());}catch(_0x3fbbb0){_0x289cb6['push'](_0x289cb6['shift']());}}}(a165_0x3a07,0xa038a));import{listPermitRoles}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';export const MENU_ID_FLAG={'name':'menu-id','type':a165_0x20172d(0x21c),'required':!![],'description':'Menu\x20id\x20(from\x20`menu\x20list`)'};export const ROLE_REF_FLAG={'name':'role','type':a165_0x20172d(0x1f5),'required':!![],'description':'Role\x20id\x20or\x20role\x20name'};export const GRANT_FLAG={'name':'grant','type':a165_0x20172d(0x1fc),'required':![],'description':a165_0x20172d(0x204)};export const REVOKE_FLAG={'name':'revoke','type':a165_0x20172d(0x1fc),'required':![],'description':'Revoke\x20access\x20to\x20the\x20listed\x20resources'};export const MENUS_FLAG={'name':a165_0x20172d(0x202),'type':a165_0x20172d(0x1f5),'required':!![],'description':a165_0x20172d(0x20c)};export const DATASETS_FLAG={'name':a165_0x20172d(0x212),'type':a165_0x20172d(0x1f5),'required':!![],'description':a165_0x20172d(0x1fd)};export const PAGE_SLOT_SPECS=[{'flag':a165_0x20172d(0x213),'key':a165_0x20172d(0x1f3),'allowSelf':![],'label':'menu\x20visibility'},{'flag':a165_0x20172d(0x228),'key':'dataCreate','allowSelf':![],'label':a165_0x20172d(0x21d)},{'flag':a165_0x20172d(0x216),'key':a165_0x20172d(0x20a),'allowSelf':![],'label':a165_0x20172d(0x22b)},{'flag':a165_0x20172d(0x243),'key':a165_0x20172d(0x1f2),'allowSelf':![],'label':'data\x20delete'},{'flag':a165_0x20172d(0x218),'key':a165_0x20172d(0x221),'allowSelf':![],'label':a165_0x20172d(0x242)},{'flag':a165_0x20172d(0x201),'key':'dataExport','allowSelf':![],'label':a165_0x20172d(0x226)},{'flag':a165_0x20172d(0x23c),'key':a165_0x20172d(0x1fe),'allowSelf':!![],'label':a165_0x20172d(0x1f6)}];function a165_0x5e05(_0x3ab875,_0x2079ab){_0x3ab875=_0x3ab875-0x1f1;const _0x3a073c=a165_0x3a07();let _0x5e05a2=_0x3a073c[_0x3ab875];return _0x5e05a2;}export const PAGE_SET_ROLE_FLAGS=PAGE_SLOT_SPECS[a165_0x20172d(0x23f)](_0x598691=>({'name':_0x598691['flag'],'type':a165_0x20172d(0x1f5),'required':![],'description':a165_0x20172d(0x210)+_0x598691[a165_0x20172d(0x22a)]+'\x20(comma-separated\x20SELF/ALL/id/name)'+(_0x598691[a165_0x20172d(0x227)]?a165_0x20172d(0x241):'')}));export function splitList(_0x574b5c){const _0x31dbf7=a165_0x20172d;return _0x574b5c[_0x31dbf7(0x21f)](',')[_0x31dbf7(0x23f)](_0x2a26e3=>_0x2a26e3[_0x31dbf7(0x1fb)]())['filter'](Boolean);}export function projectRoleRef(_0xf61263){const _0x42a7fa=a165_0x20172d;return{'id':_0xf61263['id'],'roleName':_0xf61263['roleName'],'roleType':_0xf61263[_0x42a7fa(0x239)]};}export async function resolvePermitRoles(_0x751b95,_0xea6e7f,_0x1744b4){const _0x1c2e99=a165_0x20172d,_0x386c7f=await listPermitRoles(_0x751b95,{'needSelf':!![],'needPublic':!![]}),_0x1a562f=[];for(const _0x50344c of _0xea6e7f){const _0x1de4bf=resolveOnePermitRole(_0x386c7f,_0x50344c);if(!_0x1744b4[_0x1c2e99(0x227)]&&_0x1de4bf[_0x1c2e99(0x239)]===_0x1c2e99(0x1f4))throw CliErrors[_0x1c2e99(0x225)](_0x1c2e99(0x206)+_0x1744b4[_0x1c2e99(0x22a)]+'.',_0x1c2e99(0x205));if(!_0x1a562f[_0x1c2e99(0x236)](_0x832058=>_0x832058['id']===_0x1de4bf['id']))_0x1a562f[_0x1c2e99(0x1f9)](_0x1de4bf);}return _0x1a562f;}function resolveOnePermitRole(_0x4f71f8,_0x26bcac){const _0x5a2ae2=a165_0x20172d,_0x5dc011=_0x26bcac[_0x5a2ae2(0x1fb)](),_0x3fbc4e=_0x5dc011[_0x5a2ae2(0x223)]();if(_0x3fbc4e===_0x5a2ae2(0x1f4)||_0x3fbc4e===_0x5a2ae2(0x20d)){const _0x5d1e0a=_0x4f71f8[_0x5a2ae2(0x240)](_0x5a7cc4=>_0x5a7cc4[_0x5a2ae2(0x239)]===_0x3fbc4e);if(!_0x5d1e0a)throw CliErrors[_0x5a2ae2(0x225)](_0x5a2ae2(0x232)+_0x3fbc4e+_0x5a2ae2(0x224));return _0x5d1e0a;}if(/^-?\d+$/[_0x5a2ae2(0x229)](_0x5dc011)){const _0x4f3ba3=Number(_0x5dc011),_0x4c9142=_0x4f71f8[_0x5a2ae2(0x240)](_0x356617=>_0x356617['id']===_0x4f3ba3);if(!_0x4c9142)throw CliErrors[_0x5a2ae2(0x225)](_0x5a2ae2(0x1f1)+_0x4f3ba3+_0x5a2ae2(0x20f),_0x5a2ae2(0x23a));return _0x4c9142;}const _0x9babe7=_0x4f71f8[_0x5a2ae2(0x23e)](_0x123af6=>_0x123af6[_0x5a2ae2(0x1ff)]===_0x5dc011);if(_0x9babe7[_0x5a2ae2(0x200)]===0x0)throw CliErrors[_0x5a2ae2(0x225)](_0x5a2ae2(0x207)+_0x5dc011+'\x22\x20not\x20found.','Run\x20`role\x20list`,\x20or\x20use\x20SELF/ALL/<id>.');if(_0x9babe7[_0x5a2ae2(0x200)]>0x1)throw CliErrors[_0x5a2ae2(0x225)](_0x5a2ae2(0x207)+_0x5dc011+_0x5a2ae2(0x215)+_0x9babe7[_0x5a2ae2(0x23f)](_0x438e64=>_0x438e64['id'])['join'](',\x20')+').','Disambiguate\x20with\x20an\x20id.');return _0x9babe7[0x0];}export function projectPageSlot(_0x36ec19){const _0x560b13=a165_0x20172d;if(!_0x36ec19)return null;return{'resourceCode':_0x36ec19[_0x560b13(0x1f7)],'roles':(_0x36ec19[_0x560b13(0x22c)]??[])['map'](projectRoleRef)};}export function projectPagePermit(_0x3d380a){const _0x35d5ad=a165_0x20172d,_0x4bfe03={'menuId':_0x3d380a[_0x35d5ad(0x220)],'appCode':_0x3d380a[_0x35d5ad(0x20b)],'menuPermit':projectPageSlot(_0x3d380a[_0x35d5ad(0x1f3)])};for(const _0x2355d0 of PAGE_SLOT_SPECS){if(_0x2355d0[_0x35d5ad(0x1fa)]==='menuPermit')continue;_0x4bfe03[_0x2355d0[_0x35d5ad(0x1fa)]]=projectPageSlot(_0x3d380a[_0x2355d0[_0x35d5ad(0x1fa)]]);}return _0x4bfe03;}export function flattenMenuResources(_0x28e162){const _0x58ee38=new Map(),_0xeeb05e=_0x4f7cca=>{const _0x318b61=a165_0x5e05;for(const _0x48d265 of _0x4f7cca??[]){_0x58ee38[_0x318b61(0x214)](_0x48d265['resourceCode'],{'resourceCode':_0x48d265[_0x318b61(0x1f7)],'resourceName':_0x48d265[_0x318b61(0x22d)],'action':_0x48d265['allowedActions']?.[0x0]??'0'});if(_0x48d265[_0x318b61(0x234)])_0xeeb05e(_0x48d265[_0x318b61(0x234)]);}};return _0xeeb05e(_0x28e162),_0x58ee38;}export function flattenApiResources(_0x18c082){const _0x57abcf=a165_0x20172d,_0x28e1b0=new Map(),_0x5c50b2=new Map();for(const _0x2ec1d1 of _0x18c082){const _0x2d3edb=_0x2ec1d1[_0x57abcf(0x219)]??{};for(const [_0x24f1b3,_0x45e9c9]of Object[_0x57abcf(0x238)](_0x2d3edb)){_0x28e1b0['set'](_0x24f1b3,{'resourceCode':_0x24f1b3,'resourceName':_0x2ec1d1['resourceName'],'datasetCode':_0x2ec1d1[_0x57abcf(0x21e)],'action':_0x45e9c9?.[0x0]??'0'});const _0x4eb361=_0x5c50b2[_0x57abcf(0x1f8)](_0x2ec1d1[_0x57abcf(0x21e)])??[];_0x4eb361[_0x57abcf(0x1f9)](_0x24f1b3),_0x5c50b2[_0x57abcf(0x214)](_0x2ec1d1[_0x57abcf(0x21e)],_0x4eb361);}}return{'byCode':_0x28e1b0,'byDataset':_0x5c50b2};}function a165_0x3a07(){const _0x3353fb=['row\x20visibility','resourceCode','get','push','key','trim','boolean','Comma-separated\x20datasetCodes\x20to\x20revoke\x20API\x20access\x20for','dataPermit','roleName','length','export-roles','menus','Pass\x20--role\x20<id|name>.','Grant\x20access\x20to\x20the\x20listed\x20resources','SELF\x20(row-level)\x20applies\x20only\x20to\x20--row-roles.','SELF\x20is\x20not\x20allowed\x20for\x20','Role\x20\x22','3140JPbHZx','2533041LZIlZV','dataUpdate','appCode','Comma-separated\x20menu\x20resourceCodes\x20to\x20grant/revoke','ALL','role','\x20not\x20found.','Roles\x20for\x20','2961495gnSwFo','datasets','menu-roles','set','\x22\x20is\x20ambiguous\x20(ids:\x20','update-roles','38uEIRxz','detail-roles','apiList','3163860lTrPmW','5578692rFsMwe','number','data\x20create','datasetCode','split','menuId','dataDetail','162321aCSKPj','toUpperCase','\x20is\x20not\x20available\x20for\x20this\x20app.','validation','data\x20export','allowSelf','create-roles','test','label','data\x20update','rolePermit','resourceName','grant','Missing\x20action.','1083301bqAgzC','Pass\x20exactly\x20one\x20of\x20--grant\x20/\x20--revoke.','Special\x20role\x20','str','pageNodeList','bool','some','130eqNZOx','entries','roleType','Run\x20`role\x20list`.','8iIuHbb','row-roles','revoke','filter','map','find',';\x20SELF\x20=\x20only\x20own\x20rows','data\x20detail','delete-roles','access','Role\x20id\x20','dataDelete','menuPermit','SELF','string'];a165_0x3a07=function(){return _0x3353fb;};return a165_0x3a07();}export function buildPermits(_0x138475,_0x235ae6){const _0x13a964={};for(const [_0xce5fa1,_0xcb289a]of _0x138475){const _0x429757=_0x235ae6['get'](_0xce5fa1)??_0xcb289a['action'];_0x13a964[_0xce5fa1]=[_0x429757];}return _0x13a964;}export function readRoleRef(_0x55c6d0){const _0x139c5d=a165_0x20172d,_0x3521e0=_0x55c6d0[_0x139c5d(0x233)](_0x139c5d(0x20e))[_0x139c5d(0x1fb)]();if(!_0x3521e0)throw CliErrors['flagMissing'](_0x139c5d(0x20e),_0x139c5d(0x203));return _0x3521e0;}export function readGrantRevoke(_0x517d03){const _0x34f5e7=a165_0x20172d,_0x3c1802=_0x517d03[_0x34f5e7(0x235)](_0x34f5e7(0x22e)),_0x344b7a=_0x517d03[_0x34f5e7(0x235)](_0x34f5e7(0x23d));if(_0x3c1802&&_0x344b7a)throw CliErrors[_0x34f5e7(0x225)]('--grant\x20and\x20--revoke\x20are\x20mutually\x20exclusive.');if(!_0x3c1802&&!_0x344b7a)throw CliErrors[_0x34f5e7(0x225)](_0x34f5e7(0x22f),_0x34f5e7(0x231));return _0x3c1802?_0x34f5e7(0x244):'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_0x3ae712=a179_0x1263;(function(_0x6a9ef4,_0x2d5a0c){const _0x5ba573=a179_0x1263,_0x5d02ac=_0x6a9ef4();while(!![]){try{const _0x5db42d=parseInt(_0x5ba573(0x19f))/0x1+-parseInt(_0x5ba573(0x193))/0x2*(-parseInt(_0x5ba573(0x189))/0x3)+-parseInt(_0x5ba573(0x18e))/0x4+parseInt(_0x5ba573(0x1a2))/0x5*(-parseInt(_0x5ba573(0x18c))/0x6)+-parseInt(_0x5ba573(0x18f))/0x7*(parseInt(_0x5ba573(0x18d))/0x8)+-parseInt(_0x5ba573(0x19a))/0x9+parseInt(_0x5ba573(0x195))/0xa;if(_0x5db42d===_0x2d5a0c)break;else _0x5d02ac['push'](_0x5d02ac['shift']());}catch(_0x2e3008){_0x5d02ac['push'](_0x5d02ac['shift']());}}}(a179_0xf736,0x8b56d));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';function a179_0xf736(){const _0x513434=['4256432wgCJyw','147tVvLsB','validation','/smartapi/permit/role/create','remark','2YrBTTP','POST','34502240fExxDN','Created\x20role\x20','length','flagMissing','appCode','9530550jqQPfy','write','name','Create\x20a\x20CUSTOM\x20user\x20group\x20(role)','create','295884KQyLgi','trim','roleName','125UKyWyP','CUSTOM','Role\x20name\x20cannot\x20exceed\x2064\x20characters.','948963wvKfhv','str','role','242274lgbzBy','136824ncLORo'];a179_0xf736=function(){return _0x513434;};return a179_0xf736();}function a179_0x1263(_0x5d783c,_0x25d064){_0x5d783c=_0x5d783c-0x187;const _0xf73656=a179_0xf736();let _0x126387=_0xf73656[_0x5d783c];return _0x126387;}import{NAME_FLAG,REMARK_FLAG,projectRole}from'../../commands/role/shared.js';const CREATE_PATH=a179_0x3ae712(0x191);function readName(_0x4ad8e0){const _0x3052d3=a179_0x3ae712,_0x1388c3=_0x4ad8e0[_0x3052d3(0x18a)](_0x3052d3(0x19c))[_0x3052d3(0x1a0)]();if(!_0x1388c3)throw CliErrors[_0x3052d3(0x198)]('name','Pass\x20--name\x20<roleName>.');if(_0x1388c3[_0x3052d3(0x197)]>0x40)throw CliErrors[_0x3052d3(0x190)](_0x3052d3(0x188));return _0x1388c3;}export const roleCreate={'service':a179_0x3ae712(0x18b),'command':a179_0x3ae712(0x19e),'description':a179_0x3ae712(0x19d),'risk':a179_0x3ae712(0x19b),'flags':[NAME_FLAG,REMARK_FLAG,APPCODE_FLAG_OPTIONAL],async 'validate'(_0x3e179c){readName(_0x3e179c);},async 'dryRun'(_0x58a10d){const _0x2e5368=a179_0x3ae712,_0x28ca9f=readName(_0x58a10d),_0x35ac93=_0x58a10d['str'](_0x2e5368(0x192))[_0x2e5368(0x1a0)]()||undefined;return asDryRunResult({'operation':_0x2e5368(0x19e),'selector':{'appCode':_0x58a10d[_0x2e5368(0x199)],'roleName':_0x28ca9f},'before':null,'after':{'roleName':_0x28ca9f,'roleType':_0x2e5368(0x187),'remark':_0x35ac93},'dryRun':!![],'backend':{'method':_0x2e5368(0x194),'path':CREATE_PATH},'warnings':[]},{'method':'POST','url':CREATE_PATH});},async 'execute'(_0xa7a3c){const _0x40fb6d=a179_0x3ae712,_0x339723=readName(_0xa7a3c),_0x52ff9a=_0xa7a3c[_0x40fb6d(0x18a)](_0x40fb6d(0x192))[_0x40fb6d(0x1a0)]()||undefined,_0x325d38=await createAppRole({'appCode':_0xa7a3c[_0x40fb6d(0x199)],'roleName':_0x339723,..._0x52ff9a?{'remark':_0x52ff9a}:{}});return{'ok':!![],'data':{'operation':_0x40fb6d(0x19e),'selector':{'appCode':_0xa7a3c['appCode'],'roleId':_0x325d38['id'],'roleName':_0x339723},'before':null,'after':projectRole(_0x325d38),'dryRun':![],'backend':{'method':_0x40fb6d(0x194),'path':CREATE_PATH},'warnings':[]},'message':_0x40fb6d(0x196)+_0x325d38[_0x40fb6d(0x1a1)]+'\x20(id='+_0x325d38['id']+')'};}};