@lovrabet/rabetbase-cli 2.3.16-beta.7 → 2.4.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 (435) hide show
  1. package/README.md +4 -10
  2. package/lib/api/api-doc.js +1 -1
  3. package/lib/api/fetch-model-list.js +1 -1
  4. package/lib/api/generate-api-file.js +1 -1
  5. package/lib/auth/auth-server-ui.js +1 -1
  6. package/lib/auth/auth-server.js +1 -1
  7. package/lib/auth/constant.js +1 -1
  8. package/lib/auth/get-cookie.js +1 -1
  9. package/lib/auth/get-session-user.js +1 -1
  10. package/lib/auth/is-session-valid.js +1 -1
  11. package/lib/auth/login-success-html.js +1 -1
  12. package/lib/auth/logout.js +1 -1
  13. package/lib/cli-flags.js +1 -1
  14. package/lib/cli.js +1 -1
  15. package/lib/commands/api/generate.js +1 -1
  16. package/lib/commands/api/index.js +1 -1
  17. package/lib/commands/api/list.js +1 -1
  18. package/lib/commands/api/pull.js +1 -1
  19. package/lib/commands/api/shared.js +1 -1
  20. package/lib/commands/app/index.js +1 -1
  21. package/lib/commands/app/list.js +1 -1
  22. package/lib/commands/app/members-list.js +1 -1
  23. package/lib/commands/app/remote-directory.js +1 -1
  24. package/lib/commands/app/shared.js +1 -1
  25. package/lib/commands/app-config/delete.js +1 -1
  26. package/lib/commands/app-config/get.js +1 -1
  27. package/lib/commands/app-config/index.js +1 -1
  28. package/lib/commands/app-config/list.js +1 -1
  29. package/lib/commands/app-config/set.js +1 -1
  30. package/lib/commands/app-config/shared.js +1 -1
  31. package/lib/commands/auth/index.js +1 -1
  32. package/lib/commands/bff/create.js +1 -1
  33. package/lib/commands/bff/delete.js +1 -1
  34. package/lib/commands/bff/detail.js +1 -1
  35. package/lib/commands/bff/index.js +1 -1
  36. package/lib/commands/bff/list.js +1 -1
  37. package/lib/commands/bff/pull.js +1 -1
  38. package/lib/commands/bff/push.js +1 -1
  39. package/lib/commands/bff/status.js +1 -1
  40. package/lib/commands/cli-skill/index.js +1 -1
  41. package/lib/commands/cli-update.js +1 -1
  42. package/lib/commands/codegen/index.js +1 -1
  43. package/lib/commands/codegen/sdk.js +1 -1
  44. package/lib/commands/codegen/sql.js +1 -1
  45. package/lib/commands/common/app-registry.js +1 -1
  46. package/lib/commands/common/app-selector.js +1 -1
  47. package/lib/commands/common/async-task.js +1 -1
  48. package/lib/commands/common/dry-run.js +1 -1
  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/dataset/capability.js +1 -1
  63. package/lib/commands/dataset/delete.js +1 -1
  64. package/lib/commands/dataset/detail.js +1 -1
  65. package/lib/commands/dataset/extend-update.js +1 -1
  66. package/lib/commands/dataset/field-update.js +1 -1
  67. package/lib/commands/dataset/generate.js +1 -1
  68. package/lib/commands/dataset/index.js +1 -1
  69. package/lib/commands/dataset/list.js +1 -1
  70. package/lib/commands/dataset/operations.js +1 -1
  71. package/lib/commands/dataset/relation-audit.js +1 -1
  72. package/lib/commands/dataset/relation-create.js +1 -1
  73. package/lib/commands/dataset/relation-delete.js +1 -1
  74. package/lib/commands/dataset/relation-shared.js +1 -1
  75. package/lib/commands/dataset/relation-update.js +1 -1
  76. package/lib/commands/dataset/relations.js +1 -1
  77. package/lib/commands/dataset/rename.js +1 -1
  78. package/lib/commands/dataset/restore.js +1 -1
  79. package/lib/commands/db/analysis-batching.js +1 -1
  80. package/lib/commands/db/analyze-batch-plan.js +1 -1
  81. package/lib/commands/db/analyze-cancel.js +1 -1
  82. package/lib/commands/db/analyze-start.js +1 -1
  83. package/lib/commands/db/analyze-status.js +1 -1
  84. package/lib/commands/db/create.js +1 -1
  85. package/lib/commands/db/delete.js +1 -1
  86. package/lib/commands/db/detail.js +1 -1
  87. package/lib/commands/db/diff.js +1 -1
  88. package/lib/commands/db/index.js +1 -1
  89. package/lib/commands/db/list.js +1 -1
  90. package/lib/commands/db/shared.js +1 -1
  91. package/lib/commands/db/tables.js +1 -1
  92. package/lib/commands/db/test.js +1 -1
  93. package/lib/commands/db/update.js +1 -1
  94. package/lib/commands/doctor.js +1 -1
  95. package/lib/commands/file/index.js +1 -1
  96. package/lib/commands/init/index.js +1 -1
  97. package/lib/commands/issue/index.js +1 -1
  98. package/lib/commands/issue/nudge.js +1 -1
  99. package/lib/commands/issue/report.js +1 -1
  100. package/lib/commands/issue/shared.js +1 -1
  101. package/lib/commands/kb/create.js +1 -1
  102. package/lib/commands/kb/delete.js +1 -1
  103. package/lib/commands/kb/detail.js +1 -1
  104. package/lib/commands/kb/index.js +1 -1
  105. package/lib/commands/kb/list.js +1 -1
  106. package/lib/commands/kb/shared.js +1 -1
  107. package/lib/commands/kb/update.js +1 -1
  108. package/lib/commands/logs/index.js +1 -1
  109. package/lib/commands/menu/asset-update.js +1 -1
  110. package/lib/commands/menu/delete.js +1 -1
  111. package/lib/commands/menu/external-link-create.js +1 -1
  112. package/lib/commands/menu/external-link-update.js +1 -1
  113. package/lib/commands/menu/group-create.js +1 -1
  114. package/lib/commands/menu/group-update.js +1 -1
  115. package/lib/commands/menu/index.js +1 -1
  116. package/lib/commands/menu/list.js +1 -1
  117. package/lib/commands/menu/move.js +1 -1
  118. package/lib/commands/menu/regroup-start.js +1 -1
  119. package/lib/commands/menu/rename.js +1 -1
  120. package/lib/commands/menu/shared/compare-table.js +1 -1
  121. package/lib/commands/menu/shared/delete-plan.js +1 -1
  122. package/lib/commands/menu/shared/facts.js +1 -1
  123. package/lib/commands/menu/shared/index.js +1 -1
  124. package/lib/commands/menu/shared/inquirer.js +1 -1
  125. package/lib/commands/menu/shared/local-pages.js +1 -1
  126. package/lib/commands/menu/shared/logic.js +1 -1
  127. package/lib/commands/menu/shared/mutations.js +1 -1
  128. package/lib/commands/menu/shared/service.js +1 -1
  129. package/lib/commands/menu/shared/sync-core.js +1 -1
  130. package/lib/commands/menu/shared/update-core.js +1 -1
  131. package/lib/commands/menu/shared/valid-url.js +1 -1
  132. package/lib/commands/menu/sync.js +1 -1
  133. package/lib/commands/notification/config-list.js +1 -1
  134. package/lib/commands/notification/index.js +1 -1
  135. package/lib/commands/ocr/index.js +1 -1
  136. package/lib/commands/page/generate-start.js +1 -1
  137. package/lib/commands/page/generate-status.js +1 -1
  138. package/lib/commands/page/index.js +1 -1
  139. package/lib/commands/page/pull.js +1 -1
  140. package/lib/commands/page/push.js +1 -1
  141. package/lib/commands/page/react/create.d.ts +2 -0
  142. package/lib/commands/page/react/create.js +1 -0
  143. package/lib/commands/page/react/detail.d.ts +2 -0
  144. package/lib/commands/page/react/detail.js +1 -0
  145. package/lib/commands/page/react/list.d.ts +2 -0
  146. package/lib/commands/page/react/list.js +1 -0
  147. package/lib/commands/page/react/publish.d.ts +2 -0
  148. package/lib/commands/page/react/publish.js +1 -0
  149. package/lib/commands/page/react/shared.d.ts +78 -0
  150. package/lib/commands/page/react/shared.js +1 -0
  151. package/lib/commands/page/react/syntax.d.ts +18 -0
  152. package/lib/commands/page/react/syntax.js +1 -0
  153. package/lib/commands/page/react/template.d.ts +8 -0
  154. package/lib/commands/page/react/template.js +1 -0
  155. package/lib/commands/page/react/update.d.ts +2 -0
  156. package/lib/commands/page/react/update.js +1 -0
  157. package/lib/commands/page/relation-audit.js +1 -1
  158. package/lib/commands/page/restore.js +1 -1
  159. package/lib/commands/page/shared.d.ts +1 -0
  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/permit/index.js +1 -1
  164. package/lib/commands/permit/page-get.js +1 -1
  165. package/lib/commands/permit/page-set.js +1 -1
  166. package/lib/commands/permit/role-apis-set.js +1 -1
  167. package/lib/commands/permit/role-menus-set.js +1 -1
  168. package/lib/commands/permit/role-menus.js +1 -1
  169. package/lib/commands/permit/shared.js +1 -1
  170. package/lib/commands/project/create/enhanced-guided-create.js +1 -1
  171. package/lib/commands/project/create/format-elapsed.js +1 -1
  172. package/lib/commands/project/create/main.js +1 -1
  173. package/lib/commands/project/create/non-interactive.js +1 -1
  174. package/lib/commands/project/create/project-template-path.js +1 -1
  175. package/lib/commands/project/create/use-copy-project-template.js +1 -1
  176. package/lib/commands/project/create/use-format-code.js +1 -1
  177. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  178. package/lib/commands/project/index.js +1 -1
  179. package/lib/commands/project/upgrade.js +1 -1
  180. package/lib/commands/registry.js +1 -1
  181. package/lib/commands/role/create.js +1 -1
  182. package/lib/commands/role/delete.js +1 -1
  183. package/lib/commands/role/detail.js +1 -1
  184. package/lib/commands/role/index.js +1 -1
  185. package/lib/commands/role/list.js +1 -1
  186. package/lib/commands/role/shared.js +1 -1
  187. package/lib/commands/role/update.js +1 -1
  188. package/lib/commands/role/user-add.js +1 -1
  189. package/lib/commands/role/user-remove.js +1 -1
  190. package/lib/commands/role/user-resolve.js +1 -1
  191. package/lib/commands/run/index.js +1 -1
  192. package/lib/commands/schema.js +1 -1
  193. package/lib/commands/sql/create.js +1 -1
  194. package/lib/commands/sql/delete.js +1 -1
  195. package/lib/commands/sql/detail.js +1 -1
  196. package/lib/commands/sql/exec.js +1 -1
  197. package/lib/commands/sql/index.js +1 -1
  198. package/lib/commands/sql/list.js +1 -1
  199. package/lib/commands/sql/pull.js +1 -1
  200. package/lib/commands/sql/push.js +1 -1
  201. package/lib/commands/sql/shared.js +1 -1
  202. package/lib/commands/sql/status.js +1 -1
  203. package/lib/commands/sql/validate.js +1 -1
  204. package/lib/commands/task/index.js +1 -1
  205. package/lib/commands/task/status.js +1 -1
  206. package/lib/commands/tenant/index.js +1 -1
  207. package/lib/commands/tenant/members-list.js +1 -1
  208. package/lib/commands/tenant/shared.js +1 -1
  209. package/lib/commands/user-account/dingding-sandbox-bind.d.ts +2 -0
  210. package/lib/commands/user-account/dingding-sandbox-bind.js +1 -0
  211. package/lib/commands/user-account/index.d.ts +2 -0
  212. package/lib/commands/user-account/index.js +1 -0
  213. package/lib/commands/workspace/add.js +1 -1
  214. package/lib/commands/workspace/index.js +1 -1
  215. package/lib/commands/workspace/remove.js +1 -1
  216. package/lib/config/schema.js +1 -1
  217. package/lib/constant/cdn.js +1 -1
  218. package/lib/constant/cli.js +1 -1
  219. package/lib/constant/defaults.js +1 -1
  220. package/lib/constant/domain.js +1 -1
  221. package/lib/constant/env.js +1 -1
  222. package/lib/constant/output.js +1 -1
  223. package/lib/constant/paths.js +1 -1
  224. package/lib/constant/risk.js +1 -1
  225. package/lib/context/app-resolver.js +1 -1
  226. package/lib/context/auth-resolver.js +1 -1
  227. package/lib/context/config-loader.js +1 -1
  228. package/lib/context.js +1 -1
  229. package/lib/core/alias-resolver.js +1 -1
  230. package/lib/core/api-client.d.ts +117 -0
  231. package/lib/core/api-client.js +1 -1
  232. package/lib/core/bff/config.js +1 -1
  233. package/lib/core/bff/file-system.js +1 -1
  234. package/lib/core/bff/hash.js +1 -1
  235. package/lib/core/bff/lock.js +1 -1
  236. package/lib/core/bff/utils.js +1 -1
  237. package/lib/core/db-resolver.js +1 -1
  238. package/lib/core/page/file-system.js +1 -1
  239. package/lib/core/page/hash.js +1 -1
  240. package/lib/core/page/lock.js +1 -1
  241. package/lib/core/sql-index-auditor.js +1 -1
  242. package/lib/core/sql-sync/config.js +1 -1
  243. package/lib/core/sql-sync/file-system.js +1 -1
  244. package/lib/core/sql-sync/hash.js +1 -1
  245. package/lib/core/sql-sync/lock.js +1 -1
  246. package/lib/core/sql-sync/utils.js +1 -1
  247. package/lib/core/sql-validator.js +1 -1
  248. package/lib/errors.js +1 -1
  249. package/lib/framework/build-all-flags.js +1 -1
  250. package/lib/framework/error-output.js +1 -1
  251. package/lib/framework/explicit-yes.js +1 -1
  252. package/lib/framework/flags.js +1 -1
  253. package/lib/framework/help.js +1 -1
  254. package/lib/framework/index.js +1 -1
  255. package/lib/framework/output.js +1 -1
  256. package/lib/framework/response.js +1 -1
  257. package/lib/framework/runner-alias.js +1 -1
  258. package/lib/framework/runner.js +1 -1
  259. package/lib/framework/schema-export.js +1 -1
  260. package/lib/framework/types.js +1 -1
  261. package/lib/generated/build-info.d.ts +4 -4
  262. package/lib/generated/build-info.js +1 -1
  263. package/lib/help.js +1 -1
  264. package/lib/postinstall.d.ts +3 -0
  265. package/lib/postinstall.js +1 -0
  266. package/lib/runtime/confirmation.js +1 -1
  267. package/lib/runtime/event.js +1 -1
  268. package/lib/runtime/index.js +1 -1
  269. package/lib/runtime/queue.js +1 -1
  270. package/lib/runtime/resolve.js +1 -1
  271. package/lib/skills/builtin-skill.d.ts +37 -0
  272. package/lib/skills/builtin-skill.js +1 -0
  273. package/lib/skills/main.js +1 -1
  274. package/lib/skills/npx-skills-add.d.ts +4 -2
  275. package/lib/skills/npx-skills-add.js +1 -1
  276. package/lib/skills/skill-presence.js +1 -1
  277. package/lib/telemetry/cli-command-trace.js +1 -1
  278. package/lib/telemetry/cli-help-trace.js +1 -1
  279. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  280. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  281. package/lib/telemetry/send-cli-trace-log.js +1 -1
  282. package/lib/telemetry/send-platform-issue-collect-log.js +1 -1
  283. package/lib/utils/ai_config.js +1 -1
  284. package/lib/utils/apply-jq-filter.js +1 -1
  285. package/lib/utils/cdn-config.js +1 -1
  286. package/lib/utils/check-sdk-version.js +1 -1
  287. package/lib/utils/cli-version-check.js +1 -1
  288. package/lib/utils/cli-version-policy.js +1 -1
  289. package/lib/utils/config.js +1 -1
  290. package/lib/utils/copy-directory.js +1 -1
  291. package/lib/utils/entity-with-id.js +1 -1
  292. package/lib/utils/file-utils.js +1 -1
  293. package/lib/utils/guides-cdn.js +1 -1
  294. package/lib/utils/http-client.js +1 -1
  295. package/lib/utils/is-non-interactive.js +1 -1
  296. package/lib/utils/logger.js +1 -1
  297. package/lib/utils/params.js +1 -1
  298. package/lib/utils/platform.js +1 -1
  299. package/lib/utils/rules-cdn.js +1 -1
  300. package/lib/utils/sleep.js +1 -1
  301. package/lib/utils/template-replacer.js +1 -1
  302. package/lib/utils/update-notice.js +1 -1
  303. package/lib/utils/version.js +1 -1
  304. package/lib/utils/with-active-cookie.js +1 -1
  305. package/lib/utils/write-cli-side-channel.js +1 -1
  306. package/package.json +9 -3
  307. package/scripts/postinstall.mjs +24 -0
  308. package/skills/rabetbase/SKILL.md +493 -0
  309. package/skills/rabetbase/guides/backend-function.md +835 -0
  310. package/skills/rabetbase/guides/best-practices.md +137 -0
  311. package/skills/rabetbase/guides/bff-creation-workflow.md +148 -0
  312. package/skills/rabetbase/guides/conflict-detection.md +119 -0
  313. package/skills/rabetbase/guides/data-api-guidelines.md +414 -0
  314. package/skills/rabetbase/guides/database-connection-workflow.md +169 -0
  315. package/skills/rabetbase/guides/frontend-development.md +179 -0
  316. package/skills/rabetbase/guides/legacy-application-blueprint-workflow.md +495 -0
  317. package/skills/rabetbase/guides/menu-anomaly-manual-cleanup.md +137 -0
  318. package/skills/rabetbase/guides/page-development-workflow.md +187 -0
  319. package/skills/rabetbase/guides/react-custom-page-workflow.md +184 -0
  320. package/skills/rabetbase/guides/role-permit-workflow.md +127 -0
  321. package/skills/rabetbase/guides/sql-creation-workflow.md +173 -0
  322. package/skills/rabetbase/guides/sql-mybatis.md +126 -0
  323. package/skills/rabetbase/guides/troubleshooting.md +67 -0
  324. package/skills/rabetbase/guides/typescript-sdk.md +227 -0
  325. package/skills/rabetbase/knowledge/page-schema/LrSmartCreate.md +367 -0
  326. package/skills/rabetbase/knowledge/page-schema/LrSmartDetail.md +153 -0
  327. package/skills/rabetbase/knowledge/page-schema/LrSmartEcharts.md +291 -0
  328. package/skills/rabetbase/knowledge/page-schema/LrSmartFilter.md +478 -0
  329. package/skills/rabetbase/knowledge/page-schema/LrSmartJsx.md +119 -0
  330. package/skills/rabetbase/knowledge/page-schema/LrSmartStatistic.md +223 -0
  331. package/skills/rabetbase/knowledge/page-schema/LrSmartTable.md +632 -0
  332. package/skills/rabetbase/knowledge/page-schema/YtPage.md +172 -0
  333. package/skills/rabetbase/knowledge/page-schema/dataset-relations.md +126 -0
  334. package/skills/rabetbase/knowledge/page-schema/external-resources-usage.md +232 -0
  335. package/skills/rabetbase/knowledge/page-schema/field-components.md +312 -0
  336. package/skills/rabetbase/knowledge/page-schema/syntax-reference.md +278 -0
  337. package/skills/rabetbase/knowledge/react-page/components.md +225 -0
  338. package/skills/rabetbase/knowledge/react-page/generation-standards.md +385 -0
  339. package/skills/rabetbase/references/rabetbase-api-list.md +58 -0
  340. package/skills/rabetbase/references/rabetbase-api-pull.md +82 -0
  341. package/skills/rabetbase/references/rabetbase-app-config.md +95 -0
  342. package/skills/rabetbase/references/rabetbase-app-list.md +79 -0
  343. package/skills/rabetbase/references/rabetbase-app-members-list.md +64 -0
  344. package/skills/rabetbase/references/rabetbase-auth-login.md +53 -0
  345. package/skills/rabetbase/references/rabetbase-auth-logout.md +29 -0
  346. package/skills/rabetbase/references/rabetbase-bff-create.md +59 -0
  347. package/skills/rabetbase/references/rabetbase-bff-delete.md +42 -0
  348. package/skills/rabetbase/references/rabetbase-bff-detail.md +38 -0
  349. package/skills/rabetbase/references/rabetbase-bff-list.md +61 -0
  350. package/skills/rabetbase/references/rabetbase-bff-pull.md +42 -0
  351. package/skills/rabetbase/references/rabetbase-bff-push.md +65 -0
  352. package/skills/rabetbase/references/rabetbase-bff-save.md +63 -0
  353. package/skills/rabetbase/references/rabetbase-bff-status.md +37 -0
  354. package/skills/rabetbase/references/rabetbase-cli-skill-install.md +42 -0
  355. package/skills/rabetbase/references/rabetbase-codegen-sdk.md +35 -0
  356. package/skills/rabetbase/references/rabetbase-codegen-sql.md +33 -0
  357. package/skills/rabetbase/references/rabetbase-config.md +296 -0
  358. package/skills/rabetbase/references/rabetbase-dataset-business-group-update.md +84 -0
  359. package/skills/rabetbase/references/rabetbase-dataset-delete.md +54 -0
  360. package/skills/rabetbase/references/rabetbase-dataset-detail.md +106 -0
  361. package/skills/rabetbase/references/rabetbase-dataset-extend-update.md +70 -0
  362. package/skills/rabetbase/references/rabetbase-dataset-field-update.md +117 -0
  363. package/skills/rabetbase/references/rabetbase-dataset-generate.md +206 -0
  364. package/skills/rabetbase/references/rabetbase-dataset-list.md +42 -0
  365. package/skills/rabetbase/references/rabetbase-dataset-operations.md +34 -0
  366. package/skills/rabetbase/references/rabetbase-dataset-relation-audit.md +63 -0
  367. package/skills/rabetbase/references/rabetbase-dataset-relation-mutations.md +141 -0
  368. package/skills/rabetbase/references/rabetbase-dataset-relations.md +71 -0
  369. package/skills/rabetbase/references/rabetbase-dataset-rename.md +107 -0
  370. package/skills/rabetbase/references/rabetbase-dataset-restore.md +54 -0
  371. package/skills/rabetbase/references/rabetbase-db-analyze.md +135 -0
  372. package/skills/rabetbase/references/rabetbase-db-create.md +54 -0
  373. package/skills/rabetbase/references/rabetbase-db-delete.md +26 -0
  374. package/skills/rabetbase/references/rabetbase-db-detail.md +27 -0
  375. package/skills/rabetbase/references/rabetbase-db-diff.md +57 -0
  376. package/skills/rabetbase/references/rabetbase-db-list.md +37 -0
  377. package/skills/rabetbase/references/rabetbase-db-tables.md +25 -0
  378. package/skills/rabetbase/references/rabetbase-db-test.md +29 -0
  379. package/skills/rabetbase/references/rabetbase-db-update.md +29 -0
  380. package/skills/rabetbase/references/rabetbase-doctor.md +62 -0
  381. package/skills/rabetbase/references/rabetbase-file.md +35 -0
  382. package/skills/rabetbase/references/rabetbase-init.md +70 -0
  383. package/skills/rabetbase/references/rabetbase-issue-report.md +132 -0
  384. package/skills/rabetbase/references/rabetbase-kb.md +62 -0
  385. package/skills/rabetbase/references/rabetbase-menu-asset-update.md +135 -0
  386. package/skills/rabetbase/references/rabetbase-menu-delete.md +54 -0
  387. package/skills/rabetbase/references/rabetbase-menu-external-link-create.md +63 -0
  388. package/skills/rabetbase/references/rabetbase-menu-external-link-update.md +74 -0
  389. package/skills/rabetbase/references/rabetbase-menu-group-create.md +33 -0
  390. package/skills/rabetbase/references/rabetbase-menu-group-update.md +38 -0
  391. package/skills/rabetbase/references/rabetbase-menu-list.md +144 -0
  392. package/skills/rabetbase/references/rabetbase-menu-move.md +54 -0
  393. package/skills/rabetbase/references/rabetbase-menu-regroup-start.md +45 -0
  394. package/skills/rabetbase/references/rabetbase-menu-rename.md +48 -0
  395. package/skills/rabetbase/references/rabetbase-menu-sync.md +60 -0
  396. package/skills/rabetbase/references/rabetbase-notification-config-list.md +80 -0
  397. package/skills/rabetbase/references/rabetbase-ocr.md +86 -0
  398. package/skills/rabetbase/references/rabetbase-page-generate-start.md +32 -0
  399. package/skills/rabetbase/references/rabetbase-page-generate-status.md +32 -0
  400. package/skills/rabetbase/references/rabetbase-page-pull.md +47 -0
  401. package/skills/rabetbase/references/rabetbase-page-push.md +45 -0
  402. package/skills/rabetbase/references/rabetbase-page-react-create.md +29 -0
  403. package/skills/rabetbase/references/rabetbase-page-react-detail.md +26 -0
  404. package/skills/rabetbase/references/rabetbase-page-react-list.md +23 -0
  405. package/skills/rabetbase/references/rabetbase-page-react-publish.md +23 -0
  406. package/skills/rabetbase/references/rabetbase-page-react-update.md +24 -0
  407. package/skills/rabetbase/references/rabetbase-page-relation-binding.md +72 -0
  408. package/skills/rabetbase/references/rabetbase-page-restore.md +45 -0
  409. package/skills/rabetbase/references/rabetbase-page-sync.md +36 -0
  410. package/skills/rabetbase/references/rabetbase-permit-page-set.md +69 -0
  411. package/skills/rabetbase/references/rabetbase-permit-role-apis-set.md +53 -0
  412. package/skills/rabetbase/references/rabetbase-permit-role-menus-set.md +57 -0
  413. package/skills/rabetbase/references/rabetbase-project-create.md +46 -0
  414. package/skills/rabetbase/references/rabetbase-project-upgrade.md +57 -0
  415. package/skills/rabetbase/references/rabetbase-role-list.md +68 -0
  416. package/skills/rabetbase/references/rabetbase-role-user-add.md +54 -0
  417. package/skills/rabetbase/references/rabetbase-role-user-resolve.md +27 -0
  418. package/skills/rabetbase/references/rabetbase-run.md +53 -0
  419. package/skills/rabetbase/references/rabetbase-schema.md +22 -0
  420. package/skills/rabetbase/references/rabetbase-sql-create.md +41 -0
  421. package/skills/rabetbase/references/rabetbase-sql-delete.md +37 -0
  422. package/skills/rabetbase/references/rabetbase-sql-detail.md +32 -0
  423. package/skills/rabetbase/references/rabetbase-sql-exec.md +34 -0
  424. package/skills/rabetbase/references/rabetbase-sql-list.md +54 -0
  425. package/skills/rabetbase/references/rabetbase-sql-pull.md +54 -0
  426. package/skills/rabetbase/references/rabetbase-sql-push.md +46 -0
  427. package/skills/rabetbase/references/rabetbase-sql-status.md +39 -0
  428. package/skills/rabetbase/references/rabetbase-sql-validate.md +73 -0
  429. package/skills/rabetbase/references/rabetbase-standard-page-status.md +31 -0
  430. package/skills/rabetbase/references/rabetbase-task-status.md +40 -0
  431. package/skills/rabetbase/references/rabetbase-tenant-members-list.md +69 -0
  432. package/skills/rabetbase/references/rabetbase-update.md +56 -0
  433. package/skills/rabetbase/references/rabetbase-user-account.md +45 -0
  434. package/skills/rabetbase/references/rabetbase-workspace.md +60 -0
  435. package/skills/rabetbase.manifest.json +137 -0
@@ -0,0 +1,225 @@
1
+ # React 自定义页面组件用法
2
+
3
+ 本文件登记 React 自定义页面可复用的 UI 组件规范。生成或修改页面前先阅读 [`generation-standards.md`](generation-standards.md)。
4
+
5
+ ## 使用边界
6
+
7
+ - 可导入的组件包仅限 [`generation-standards.md`](generation-standards.md)“依赖白名单”中的包及其子路径
8
+ - `@lovrabet/components` 使用包根入口的公开具名导出,不导入内部实现路径
9
+ - 组件的用户可见文案必须使用 `$i18n.t("key")`
10
+ - 组件样式使用 Ant Design CSS 变量,不写死颜色或其他样式常量
11
+ - 未登记的业务组件、组件属性或行为不得猜测
12
+
13
+ ## `@lovrabet/components` 组件
14
+
15
+ 本节基于组件库 README、公开类型声明和 Storybook 用例整理。组件、属性和行为以当前发布版本的公开导出为准。页面代码从包根入口导入:
16
+
17
+ ```js
18
+ import {
19
+ YTAIButton,
20
+ YTAIInput,
21
+ YtAddressPicker,
22
+ YtCodeEditor,
23
+ YTRichEditor,
24
+ YTRichEditorPreview,
25
+ YtUpload,
26
+ YtUserSelect,
27
+ } from "@lovrabet/components";
28
+ ```
29
+
30
+ | 组件 | 适用场景 | 关键使用方式 |
31
+ | --- | --- | --- |
32
+ | `YTAIButton` | 通过已配置的提示词或 Skill 发起 AI 调用 | 配置 `promptId` 或 `skillId` 与必填 `userPrompt`,处理成功和失败回调 |
33
+ | `YTAIInput` | 需要输入内容后发起 AI 调用 | 配置 AI 调用参数,并使用 `inputType`、`userPromptTemplate` 和提交前校验控制输入流程 |
34
+ | `YtUserSelect` | 选择、编辑或只读展示应用用户 | 受控传入用户 code,使用 `preview` 切换只读展示 |
35
+ | `YtAddressPicker` | 选择或只读展示地址层级 | 受控传入地址 value 路径;需要自定义地址时传入 `options` 或 `optionsUrl` |
36
+ | `YtUpload` | 上传、展示、预览或下载附件 | 传入当前 `appCode`,以 `value` 和 `onChange` 管理已完成的业务文件 |
37
+ | `YTRichEditor` | 编辑富文本内容 | 用 `defaultValue` 初始化,通过 `onChange` 接收 HTML,并为图片上传提供 `upload` |
38
+ | `YTRichEditorPreview` | 只读展示富文本 HTML | 传入必填 `content` |
39
+ | `YtCodeEditor` | 编辑或只读展示代码、JSON 等文本 | 以 `value` 和 `onChange` 受控,按需设置 `language`、`readOnly` 和编辑器选项 |
40
+
41
+ ## 使用 Demo
42
+
43
+ 以下示例基于组件库 Storybook 用例调整而来。示例中的 `appCode`、提示词或 Skill 标识、数据和回调均由页面上下文提供;所有用户可见文案使用 `$i18n.t("key")`。示例均假设已通过 `useI18n()` 获取 `$i18n`,并按需从 React 导入 `useState`。
44
+
45
+ ### AI 按钮
46
+
47
+ ```jsx
48
+ <YTAIButton
49
+ promptId={promptId}
50
+ userPrompt={$i18n.t("ai.userPrompt")}
51
+ onSuccess={setGeneratedContent}
52
+ onError={setError}
53
+ >
54
+ {$i18n.t("ai.generate")}
55
+ </YTAIButton>
56
+ ```
57
+
58
+ 使用 `skillId` 替代 `promptId` 时,同时传入 `appCode`。需要在调用前校验页面状态时,传入 `onClick` 并在不满足条件时返回 `false`。
59
+
60
+ ### AI 输入框
61
+
62
+ ```jsx
63
+ <YTAIInput
64
+ inputType="textarea"
65
+ promptId={promptId}
66
+ userPromptTemplate={$i18n.t("ai.userPromptTemplate")}
67
+ placeholder={$i18n.t("ai.placeholder")}
68
+ buttonText={$i18n.t("ai.generate")}
69
+ onBeforeSubmit={validateInput}
70
+ onSuccess={setGeneratedContent}
71
+ onError={setError}
72
+ />
73
+ ```
74
+
75
+ `userPromptTemplate` 中使用 `{input}` 引用输入内容。`validateInput` 返回 `false` 时不会调用 AI。
76
+
77
+ ### 用户选择
78
+
79
+ ```jsx
80
+ const [userCodes, setUserCodes] = useState([]);
81
+
82
+ <YtUserSelect
83
+ appCode={appCode}
84
+ value={userCodes}
85
+ onChange={setUserCodes}
86
+ placeholder={$i18n.t("userSelect.placeholder")}
87
+ />
88
+ ```
89
+
90
+ 只读展示时使用 `<YtUserSelect appCode={appCode} value={userCodes} preview />`。
91
+
92
+ ### 地址选择
93
+
94
+ ```jsx
95
+ const [address, setAddress] = useState([]);
96
+
97
+ <YtAddressPicker
98
+ options={addressOptions}
99
+ value={address}
100
+ onChange={setAddress}
101
+ />
102
+ ```
103
+
104
+ `addressOptions` 的用户可见 `label` 必须使用词条或已确认的业务数据。只读展示时传入 `preview`。
105
+
106
+ ### 附件上传
107
+
108
+ ```jsx
109
+ const [files, setFiles] = useState([]);
110
+
111
+ <YtUpload
112
+ appCode={appCode}
113
+ accept="image/*"
114
+ max={maxFiles}
115
+ maxSizeMB={maxFileSizeMB}
116
+ value={files}
117
+ onChange={setFiles}
118
+ />
119
+ ```
120
+
121
+ 展示已有附件时,将已确认的 `YtUploadFile[]` 传给 `value`;只读预览、下载和列表展示时传入 `preview`。
122
+
123
+ ### 富文本编辑与预览
124
+
125
+ ```jsx
126
+ const [content, setContent] = useState(initialContent);
127
+
128
+ <YTRichEditor
129
+ defaultValue={initialContent}
130
+ upload={uploadImage}
131
+ onChange={setContent}
132
+ onImageUploadError={setError}
133
+ />
134
+
135
+ <YTRichEditorPreview content={content} />
136
+ ```
137
+
138
+ `uploadImage` 接收 `File` 并返回可访问图片 URL。图片上传服务和内容持久化的实现必须遵循已确认的服务契约。
139
+
140
+ ### 代码编辑
141
+
142
+ ```jsx
143
+ const [code, setCode] = useState("");
144
+
145
+ <YtCodeEditor
146
+ language="json"
147
+ value={code}
148
+ onChange={setCode}
149
+ placeholder={$i18n.t("codeEditor.placeholder")}
150
+ wordWrap="on"
151
+ />
152
+ ```
153
+
154
+ 只读展示时使用 `readOnly`,按需使用 `minimap`、`lineNumbers`、`tabSize` 或 `options` 配置编辑器。
155
+
156
+ ### AI 调用组件
157
+
158
+ #### `YTAIButton`
159
+
160
+ - `userPrompt` 必填
161
+ - `promptId` 与 `skillId` 二选一,组件优先使用 `promptId`
162
+ - 使用 `skillId` 时传入当前 `appCode`;`showPopover` 只在 Skill 场景生效
163
+ - `onClick` 返回 `false` 可阻止本次调用;通过 `onSuccess`、`onResponse` 和 `onError` 分别处理结果、完整响应和失败
164
+ - `options` 仅用于传入已确认的 `temperature`、`maxTokens` 等 AI 调用选项
165
+ - 提示词标识、权限和可用环境未确认时,不生成调用代码
166
+
167
+ #### `YTAIInput`
168
+
169
+ - 继承 `YTAIButton` 的 AI 调用配置和回调,且不直接传入 `userPrompt`
170
+ - 使用 `inputType="input"` 或 `inputType="textarea"` 选择输入形态,使用 `display="inline"` 或 `display="block"` 控制按钮布局
171
+ - `userPromptTemplate` 中的 `{input}` 会替换为当前输入内容;需要特殊拼接时使用 `formatUserPrompt`
172
+ - 使用 `onBeforeSubmit` 校验输入,返回 `false` 时阻止调用;使用 `onInputChange` 同步页面状态
173
+ - `placeholder`、`buttonText` 和其他用户可见字符串必须传入 `$i18n.t("key")` 的结果
174
+
175
+ ### 选择与上传组件
176
+
177
+ #### `YtUserSelect`
178
+
179
+ - 当前用户列表由组件加载,页面不自行猜测或复刻用户查询接口
180
+ - `value` 支持用户 code 数组、单个 code,以及兼容历史数据的 `{ code }` 数组;`onChange` 始终返回用户 code 数组
181
+ - 需要只读展示时传入 `preview`
182
+ - 传入当前 `appCode` 以明确查询上下文;`env` 只在需要覆盖当前环境识别时设置
183
+
184
+ #### `YtAddressPicker`
185
+
186
+ - `value` 与 `onChange` 使用 `string[]` 形式的地址层级路径
187
+ - 传入 `options` 时使用调用方提供的级联选项;未传时使用组件内置地址数据,也可通过 `optionsUrl` 配置地址选项来源
188
+ - 只读展示时传入 `preview`
189
+ - 自定义选项的 `label` 为用户可见内容时,必须来自已翻译词条或已确认的业务数据
190
+
191
+ #### `YtUpload`
192
+
193
+ - 传入当前 `appCode`,不依赖页面自行读取宿主全局变量
194
+ - `value` 支持 `YtUploadFile[]` 或兼容的 JSON 字符串,`onChange` 返回上传完成的业务文件列表
195
+ - 使用 `max`、`maxSizeMB` 和 `accept` 限制上传数量、体积和文件类型;需要只读展示、预览和下载时传入 `preview`
196
+ - 文件持久化、提交和删除由页面业务逻辑处理;先确认数据集 SDK 或其他已确认服务契约,再写入文件字段
197
+
198
+ ### 内容编辑组件
199
+
200
+ #### `YTRichEditor` 与 `YTRichEditorPreview`
201
+
202
+ - `YTRichEditor` 使用 `defaultValue` 初始化内容,`onChange` 返回 HTML 字符串或空值
203
+ - 启用图片上传时,`upload` 必须返回可访问图片 URL;用 `onImageUploadError` 和 `onLoadError` 处理上传或资源加载失败
204
+ - 通过 `disabled` 控制编辑状态;通过 `locale` 设置工具栏和错误提示语言
205
+ - 使用 `YTRichEditorPreview` 或 `YTRichEditor.Preview` 展示 HTML,且必须传入 `content`
206
+ - 需要覆盖运行资源或加载占位时,使用已确认的 `resourceUrl` 和 `loadingFallback`,不得猜测资源地址
207
+
208
+ #### `YtCodeEditor`
209
+
210
+ - 使用 `value` 与 `onChange` 管理编辑内容;空值按空字符串处理
211
+ - `language`、`theme`、`minimap`、`lineNumbers`、`wordWrap`、`fontSize`、`tabSize` 和 `options` 用于配置 Monaco 编辑器
212
+ - 需要展示不可编辑内容时使用 `readOnly` 或 `disabled`
213
+ - 未传 `theme` 时组件跟随外层 Ant Design 主题;页面不自行猜测 Monaco 运行资源或加载方式
214
+
215
+ ### 非组件公开能力
216
+
217
+ - `queryLLM` 是 `YTAIButton` 对应的直接 AI 调用方法。仅在已确认提示词或 Skill 标识、调用权限和错误处理策略时使用
218
+ - `useUserList` 是 `YtUserSelect` 对应的用户列表 Hook。默认优先使用 `YtUserSelect`;仅在需要自定义交互且已确认返回结构时使用
219
+
220
+ ### 使用检查
221
+
222
+ - 组件名称与属性以公开类型声明为准,不使用 README、Storybook 或包内部文件中未公开的实现路径
223
+ - 所有用户可见字符串,包括按钮文本、占位文本和自定义选项 label,均使用 `$i18n.t("key")` 或来自已确认的业务数据
224
+ - 组件的加载、空态、失败和禁用状态与页面交互一致
225
+ - 自定义数据读取或写入仍遵循 [`generation-standards.md`](generation-standards.md) 中的数据客户端文档流程
@@ -0,0 +1,385 @@
1
+ # React 自定义页面生成规范
2
+
3
+ 本规范用于编写或修改 React 自定义页面的完整 `codeContent`。执行命令流程、参数和发布规则以 [`react-custom-page-workflow.md`](../../guides/react-custom-page-workflow.md) 为准。
4
+
5
+ ## 使用方式
6
+
7
+ 在生成 JSX、CSS 或词包前,先阅读本规范,并按需加载以下文档:
8
+
9
+ - 选择或组合 UI 组件时,阅读 [`components.md`](components.md)
10
+ - 访问数据集时,先确认数据集事实,并按“数据客户端文档”拉取目标数据集的 SDK 契约
11
+
12
+ 未在这些文档中登记的规范、组件或方法,不得假设存在。
13
+
14
+ ## 固定实现约束
15
+
16
+ | 范畴 | 约束 |
17
+ | -------- | ------------------------------------------------------------------------------------------------------------------------- |
18
+ | 提交内容 | `page react-update` 提交完整页面文件,未提交的已有文件会被删除 |
19
+ | 推荐结构 | 页面入口仍为 `src/app/index.jsx`;其余文件和组件目录可按页面需要组织,`src/app/index.css`、`src/locales/index.js`、`src/components/*.jsx` 仅为示例 |
20
+ | 组件复用 | 优先查阅并复用已有组件库和页面已有组件;仅当现有能力无法满足需求时才创建新组件 |
21
+ | 依赖 | 仅使用“依赖白名单”中的包及其子路径 |
22
+ | 文案 | 用户可见文案通过 `$i18n.t("key")` 获取,并在词包中提供翻译 |
23
+ | 路由 | 使用 `navigate` 跳转、使用 `location` 读取地址,不使用 `window.location` |
24
+ | 样式 | 使用 Ant Design CSS 变量,不写死颜色或其他样式常量 |
25
+ | 数据访问 | `client` 支持当前页面可用的全部 `@lovrabet/sdk` 能力,先确认数据集、SQL 或 BFF 的事实与 SDK 调用方式,再使用 `client` |
26
+
27
+ ### 依赖白名单(严格)
28
+
29
+ - 在所有代码和文件中,包括 `src/**`、配置文件和脚本,导入仅限以下包及其子路径:
30
+ - `react@18`
31
+ - `react-dom@18`
32
+ - `lodash@4`
33
+ - `dayjs@1`
34
+ - `antd@5`
35
+ - `@ant-design/icons@5`
36
+ - `echarts@5`
37
+ - `@lovrabet/components`
38
+ - 禁止引入、建议引入或暗示使用任何未在白名单中的依赖
39
+
40
+ ## 生成前信息清单
41
+
42
+ 生成前应确认以下信息。缺失且会影响页面行为时,先向用户确认。
43
+
44
+ | 信息 | 已确认内容 | 待补充 |
45
+ | -------- | ---------------------------------- | ------ |
46
+ | 页面目标 | 页面解决的问题、目标用户、完成标准 | |
47
+ | 页面身份 | 新建页面或已有 `pageId` | |
48
+ | 布局 | 区域划分、响应式要求、视觉约束 | |
49
+ | 交互 | 查询、编辑、跳转、提交、确认等行为 | |
50
+ | 数据 | 数据集、字段、操作、权限和错误语义 | |
51
+ | 文案 | 语言范围、词条命名和默认文案 | |
52
+
53
+ ## 页面实现分层
54
+
55
+ ### 入口与布局
56
+
57
+ - `src/app/index.jsx` 负责页面入口、页面级状态和主布局
58
+ - 复杂或可复用区域可按页面需要拆分到合适的相对路径,`src/components/` 仅为示例
59
+ - 每个组件只接收其实际需要的数据和回调,避免把页面全部状态逐层透传
60
+
61
+ ### `src/app/index.jsx` 模板
62
+
63
+ 初始化创建自定义页面时,必须以此模板生成 `src/app/index.jsx`。将 `{{pageName}}` 替换为页面名称;保留词包注册、上下文 Hook 和样式导入,再按需求扩展布局、状态与数据调用。通过 `page react-create --page-content` 初始化创建时,传入的 `src/app/index.jsx` 也必须从此模板派生。
64
+
65
+ 更新已有页面时,以 `page react-detail` 返回的最新 `codeContent` 为基线;不强制套用或补齐本模板,应仅按更新需求修改页面内容。
66
+
67
+ ```jsx
68
+ import React from "react";
69
+ import {
70
+ useSdkClient,
71
+ useNavigate,
72
+ useLocation,
73
+ useI18n,
74
+ } from "@/context/app-context";
75
+
76
+ const App = () => {
77
+ const client = useSdkClient(); // 用于访问后端数据和服务
78
+ const $i18n = useI18n(); // 国际化多语言实例
79
+ const navigate = useNavigate(); // 路由跳转实例
80
+ const location = useLocation(); // 浏览器 location 实例
81
+
82
+ return <div className="page-container">{/* 自定义页面内容 */}</div>;
83
+ };
84
+
85
+ export default App;
86
+ ```
87
+
88
+ ### 数据与交互
89
+
90
+ - 在调用 `client` 前按“数据客户端文档”拉取目标数据集的 SDK 契约
91
+ - 单个数据集的常规查询和写入使用数据集模型能力;需要组合多个数据集的数据时,考虑使用自定义 SQL;数据需要个性化处理、复杂业务编排或调用外部服务时,考虑使用 BFF
92
+ - 明确加载中、空结果、失败和成功后的页面行为
93
+ - 写操作前明确校验、确认、提交中和失败恢复策略
94
+
95
+ ### 国际化与样式
96
+
97
+ - 先定义词条,再在组件中使用词条 key
98
+ - 所有用户可见文案必须使用 `$i18n.t("key")` 获取,并在 `src/locales/index.js` 中提供有效翻译,禁止硬编码字符串
99
+ - 所有 CSS 样式必须使用 Ant Design 提供的 CSS 变量,例如 `color: var(--ant-color-primary);`,禁止直接写死色值或其他样式常量
100
+ - 页面状态、禁用态和反馈文案与交互行为保持一致
101
+
102
+ ## 页面上下文内置能力
103
+
104
+ ### 使用边界
105
+
106
+ - 仅使用本节已登记的内置能力和已确认的调用方式
107
+ - 数据访问前先确认数据集字段、操作和 SDK 契约
108
+ - 调用内置能力时保持组件生命周期、加载状态和错误反馈清晰
109
+ - 未登记的方法、参数、返回结构或副作用不得猜测
110
+
111
+ ### 页面上下文入口
112
+
113
+ 页面可从 `@/context/app-context` 导入以下能力:
114
+
115
+ ```js
116
+ import {
117
+ useSdkClient,
118
+ useI18n,
119
+ useNavigate,
120
+ useLocation,
121
+ } from "@/context/app-context";
122
+ ```
123
+
124
+ | 能力 | 已确认用途 | 使用前应确认 | 详细规则 |
125
+ | -------------- | ------------------------ | ------------------------------------- | -------------- |
126
+ | `useSdkClient` | 获取当前页面的数据客户端 | 目标数据集、字段、操作和 SDK 调用方式 | 与 `@lovrabet/sdk` 客户端行为一致(见“数据客户端”) |
127
+ | `useI18n` | 获取页面国际化实例 | 词条 key 和词包翻译 | 见“国际化” |
128
+ | `useNavigate` | 获取页面路由跳转方法 | 目标页面 code 和跳转方式 | 见“导航” |
129
+ | `useLocation` | 获取当前地址信息 | 需要读取的地址信息 | 见“导航” |
130
+
131
+ ### 国际化
132
+
133
+ ```js
134
+ const $i18n = useI18n();
135
+ $i18n.addLocale(locales);
136
+ const title = $i18n.t("pageTitle");
137
+ ```
138
+
139
+ - 页面加载词包后再使用词条
140
+ - 所有用户可见文案必须使用 `$i18n.t("key")` 获取,禁止硬编码字符串
141
+ - 每个 `$i18n.t("key")` 的 `key` 必须在 `src/locales/index.js` 中提供有效翻译
142
+ - 词条命名、默认值和多语言回退规则在此处补充后再作为统一约定使用
143
+
144
+ ### 数据客户端
145
+
146
+ ```js
147
+ const client = useSdkClient();
148
+ ```
149
+
150
+ `client` 是运行时注入的 SDK 客户端实例,语义上与 `@lovrabet/sdk` 生成的 `createClient()` 返回对象一致,支持当前页面可用的全部 `@lovrabet/sdk` 能力。
151
+
152
+ - 数据集模型调用(如 `models.<dataset>`)的语义、方法返回值、异常形态,以各 dataset 的 API-doc 返回文档为准
153
+ - SQL、BFF 及其他非数据集能力的可用方法、参数、返回值和异常形态,均以 `@lovrabet/sdk` 的使用规范为准
154
+ - 页面调用 SQL 前,先用 `rabetbase sql list` 与 `rabetbase sql detail --sqlcode <sqlCode>` 确认目标资源
155
+ - 生成使用自定义 SQL 的页面代码前,使用代表性参数执行 `rabetbase sql exec --sqlcode <sqlCode> --params <json> --format json`。若返回 `data.error`,先解决执行错误;成功后再根据 `data.rows` 与 `data.rowCount` 确认实际数据结构
156
+ - `sql exec` 仅用于确认 SQL 可执行及返回数据结构。页面代码按 `@lovrabet/sdk` 的使用规范处理 `client.sql` 的返回值,不使用 CLI 输出字段 `data.rows`
157
+ - 页面调用 BFF 前,先用 `rabetbase bff list` 与 `rabetbase bff detail --id <id>` 确认目标资源
158
+ - 数据操作需要注入自定义业务逻辑,例如校验、转换或加密时,优先考虑使用 BFF;页面运行时通过 `client` 按 `@lovrabet/sdk` 规范调用已确认的 BFF
159
+ - CLI 只用于读取 SQL 与 BFF 的资源事实,页面运行时仍通过 `client` 调用,不在页面中拼接 CLI 命令或平台接口
160
+ - 不在文档中出现的 dataset 字段、参数名、返回形态、方法名不得猜测
161
+ - `client` 只是页面内可直接调用的入口,页面侧不在本地重新创建 `createClient` 或重复注册模型
162
+
163
+ #### 数据客户端文档
164
+
165
+ 在生成或修改任何包含数据访问的页面代码前,获取目标数据集当前返回的 API-doc。该文档仅用于确认页面生成阶段的 SDK 契约,不得写入页面的 `codeContent`,也不得通过 `client` 在页面运行时再次请求。
166
+
167
+ - 从 API-doc 确认查询、写入等数据方法的参数、响应结构和示例,并严格按该使用规范实现 `client` 调用
168
+ - 数据集、字段、操作或权限发生变化时,重新获取 API-doc,不复用其他数据集或历史页面的调用假设
169
+ - API-doc 的获取方式、环境地址和请求参数由当前页面平台能力提供,页面代码中不得固化这些请求细节
170
+
171
+ #### 示例:API-doc 返回片段的消费方式(联系人)
172
+
173
+ 以下为 `联系人` 文档样例中的可用调用。示例仅用于该文档对应数据集;其他数据集必须按其文档替换签名与参数。
174
+
175
+ - 目标 app:`app-c53b7ce2`
176
+ - 数据集:`d1c3af3347d543a7a9aa3311caf7af59_75_3c7120aa`
177
+ - SDK key:`dataset_d1c3af3347d543a7a9aa3311caf7af59_75_3c7120aa`
178
+
179
+ ```javascript
180
+ // API-doc 示例可用的调用签名(完整以文档为准):
181
+ // filter(params)
182
+ // getOne(id)
183
+ // create(payload)
184
+ // update(id, data)
185
+ // delete(id)
186
+ // getSelectOptions(params)
187
+ // aggregate(params)
188
+ // excelExport(params)
189
+
190
+ const CONTACTS_DATASET_CODE = "dataset_d1c3af3347d543a7a9aa3311caf7af59_75_3c7120aa";
191
+ const CONTACTS_DATASET_ALIAS = "crmContact";
192
+
193
+ export const queryContactList = async (client, searchKeyword) => {
194
+ const model = client.models[CONTACTS_DATASET_ALIAS] || client.models[CONTACTS_DATASET_CODE];
195
+ const result = await model.filter({
196
+ where: {
197
+ name: searchKeyword ? { $contain: searchKeyword } : undefined,
198
+ },
199
+ select: ["id", "customer_id", "name", "sex", "position"],
200
+ orderBy: [{ id: "DESC" }],
201
+ currentPage: 1,
202
+ pageSize: 20,
203
+ });
204
+ return Array.isArray(result?.tableData) ? result.tableData : [];
205
+ };
206
+
207
+ export const queryContactDetail = async (client, id) => {
208
+ const model = client.models[CONTACTS_DATASET_ALIAS] || client.models[CONTACTS_DATASET_CODE];
209
+ return model.getOne(id);
210
+ };
211
+
212
+ export const queryContactSelectOptions = async (client, fieldName) => {
213
+ const model = client.models[CONTACTS_DATASET_ALIAS] || client.models[CONTACTS_DATASET_CODE];
214
+ return model.getSelectOptions({
215
+ code: fieldName,
216
+ label: fieldName,
217
+ });
218
+ };
219
+
220
+ export const createContact = async (client, contactPayload) => {
221
+ const model = client.models[CONTACTS_DATASET_ALIAS] || client.models[CONTACTS_DATASET_CODE];
222
+ return model.create(contactPayload);
223
+ };
224
+
225
+ export const updateContact = async (client, id, contactPayload) => {
226
+ const model = client.models[CONTACTS_DATASET_ALIAS] || client.models[CONTACTS_DATASET_CODE];
227
+ return model.update(id, contactPayload);
228
+ };
229
+
230
+ export const deleteContact = async (client, id) => {
231
+ const model = client.models[CONTACTS_DATASET_ALIAS] || client.models[CONTACTS_DATASET_CODE];
232
+ return model.delete(id);
233
+ };
234
+
235
+ export const aggregateContact = async (client, params) => {
236
+ const model = client.models[CONTACTS_DATASET_ALIAS] || client.models[CONTACTS_DATASET_CODE];
237
+ return model.aggregate(params);
238
+ };
239
+
240
+ export const exportContact = async (client, params) => {
241
+ const model = client.models[CONTACTS_DATASET_ALIAS] || client.models[CONTACTS_DATASET_CODE];
242
+ return model.excelExport(params);
243
+ };
244
+
245
+ // 以下为文档中给出的注册信息示例(页面运行时不需要重复调用 createClient):
246
+ // import { registerModels, createClient } from "@lovrabet/sdk";
247
+ // registerModels({
248
+ // appCode: "app-c53b7ce2",
249
+ // models: [
250
+ // {
251
+ // tableName: "crm_contact",
252
+ // datasetCode: "d1c3af3347d543a7a9aa3311caf7af59_75_3c7120aa",
253
+ // alias: "crmContact",
254
+ // },
255
+ // ],
256
+ // });
257
+ // const client = createClient();
258
+ ```
259
+
260
+ #### 常见返回体处理(示例)
261
+
262
+ `filter`、`aggregate` 返回常见 `paging`、`tableData`、`tableColumns`:
263
+
264
+ ```js
265
+ const contactsModel = client.models.crmContact || client.models.dataset_d1c3af3347d543a7a9aa3311caf7af59_75_3c7120aa;
266
+ const { paging, tableData, tableColumns } = await contactsModel.filter({ currentPage: 1, pageSize: 20 });
267
+ console.log("total", paging?.totalCount);
268
+ console.log("rows", tableData?.length ?? 0);
269
+ console.log("columns", tableColumns?.length ?? 0);
270
+ ```
271
+
272
+ 其中:
273
+ - `filter`、`aggregate` 返回字段包括 `paging.pageSize`、`paging.totalCount`、`paging.currentPage`
274
+ - 成功返回的 `tableData` 为行数据,`tableColumns` 为列描述
275
+ - `create`、`update`、`delete` 成功时返回 `null`
276
+ - `excelExport` 成功时返回导出文件链接字符串
277
+
278
+ ### 示例:React 组件中的数据加载与错误处理
279
+
280
+ ```jsx
281
+ import React, { useEffect, useState } from "react";
282
+ import { message, Table, Button, Input } from "antd";
283
+ import { useSdkClient, useI18n } from "@/context/app-context";
284
+
285
+ const CONTACTS_DATASET_CODE = "dataset_d1c3af3347d543a7a9aa3311caf7af59_75_3c7120aa";
286
+ const CONTACTS_DATASET_ALIAS = "crmContact";
287
+
288
+ const App = () => {
289
+ const client = useSdkClient();
290
+ const $i18n = useI18n();
291
+ const [keyword, setKeyword] = useState("");
292
+ const [rows, setRows] = useState([]);
293
+ const [loading, setLoading] = useState(false);
294
+ const [selected, setSelected] = useState(null);
295
+
296
+ const loadRows = async () => {
297
+ setLoading(true);
298
+ try {
299
+ const contactsModel = client.models[CONTACTS_DATASET_ALIAS] || client.models[CONTACTS_DATASET_CODE];
300
+ const result = await contactsModel.filter({
301
+ where: keyword ? { name: { $contain: keyword } } : undefined,
302
+ select: ["id", "name", "mobile", "email", "position"],
303
+ currentPage: 1,
304
+ pageSize: 20,
305
+ });
306
+ setRows(result?.tableData ?? []);
307
+ } catch (err) {
308
+ message.error($i18n.t("common.loadFailed"));
309
+ console.error("load contacts failed", err);
310
+ } finally {
311
+ setLoading(false);
312
+ }
313
+ };
314
+
315
+ const loadDetail = async (record) => {
316
+ try {
317
+ const contactsModel = client.models[CONTACTS_DATASET_ALIAS] || client.models[CONTACTS_DATASET_CODE];
318
+ const detail = await contactsModel.getOne(record.id);
319
+ setSelected(detail);
320
+ } catch (err) {
321
+ message.error($i18n.t("common.loadDetailFailed"));
322
+ console.error("load contact detail failed", err);
323
+ }
324
+ };
325
+
326
+ useEffect(() => {
327
+ loadRows();
328
+ }, [keyword]);
329
+
330
+ return (
331
+ <div>
332
+ <Input
333
+ placeholder={$i18n.t("contact.searchPlaceholder")}
334
+ onChange={(event) => setKeyword(event.target.value)}
335
+ />
336
+ <Button loading={loading} onClick={loadRows}>
337
+ {$i18n.t("contact.search")}
338
+ </Button>
339
+ <Table
340
+ dataSource={rows}
341
+ rowKey="id"
342
+ onRow={(record) => ({
343
+ onDoubleClick: () => void loadDetail(record),
344
+ })}
345
+ />
346
+ </div>
347
+ );
348
+ };
349
+
350
+ export default App;
351
+ ```
352
+
353
+ **注意事项**
354
+
355
+ - 使用 `client` 前请确认该数据集当前 API-doc 的 `操作列表` 与字段,尤其是 `filter/getOne/getSelectOptions/update/create/delete` 的请求参数签名。
356
+ - 运行时错误统一走 `try/catch`,并显示明确错误信息。
357
+ - `dataset_d...` 这种标准 SDK key 为通用写法;若文档返回 `alias`,可改用 `client.models.<alias>`。
358
+ - 所有示例文案仍以 `$i18n.t("...")` 作为文案入口。
359
+
360
+ ### 导航
361
+
362
+ ```js
363
+ const navigate = useNavigate();
364
+ const location = useLocation();
365
+ ```
366
+
367
+ - 跳转使用 `navigate`,当前地址信息使用 `location`
368
+ - 目标页面与当前页面关联时,优先使用 `navigate("/pagecode", { onePage: true })`,在当前页面基础上横向追加新页面
369
+ - `"/pagecode"` 必须是以 `/` 开头的目标页面完整路径,可以携带参数和 hash
370
+ - 仅当目标页面与当前页面无关联时,使用普通 `navigate("/pagecode")`
371
+ - 不使用 `window.location`
372
+
373
+ ## 交付前检查
374
+
375
+ - [ ] 完整页面文件包含全部需要保留的文件
376
+ - [ ] 导入均在依赖白名单内
377
+ - [ ] 每个本地相对导入均指向提交内容中的文件,导入名称与该文件的导出名称一致
378
+ - [ ] 每个非全局标识符均由 import、组件参数、Hook 返回值或同一作用域内声明提供,不保留未定义引用
379
+ - [ ] 用户可见文案均有有效词条和翻译
380
+ - [ ] 数据集、SQL、BFF 与其他 SDK 调用的资源事实、参数和返回结构均有依据
381
+ - [ ] 路由、状态和错误反馈符合已确认的交互
382
+ - [ ] CSS 未写死颜色或其他样式常量
383
+ - [ ] 已先执行 `page react-create --dry-run` 或 `page react-update --dry-run` 审阅完整提交内容,并通过 CLI 的基础 JS/JSX/TS/TSX 语法校验
384
+
385
+ CLI 的基础校验只确认页面包含 `.jsx` 或 `.tsx` 文件,且页面内的 JS、JSX、TS、TSX 文件能够解析。变量引用、相对模块导出、数据调用契约和运行时行为必须由本清单和页面发布后的实际使用继续确认
@@ -0,0 +1,58 @@
1
+ # api list
2
+
3
+ 列出当前 App 下已生成的所有数据集(Dataset)模型,查看 API 客户端代码中有哪些可用 Model。
4
+
5
+ ## 命令
6
+
7
+ ```bash
8
+ # 列出当前应用的模型
9
+ rabetbase api list
10
+
11
+ # 多应用模式:指定应用
12
+ rabetbase api list --app order
13
+ rabetbase api list --appcode app-order-001
14
+
15
+ # 多应用:与全局合并配置一起列出时加 --global(默认仅项目级 apps)
16
+ rabetbase api list --global
17
+
18
+ # JSON 格式输出
19
+ rabetbase api list --format json
20
+ ```
21
+
22
+ ## 参数
23
+
24
+ | 参数 | 说明 |
25
+ |------|------|
26
+ | `--global` | 多应用时从「全局+项目」合并配置解析 `apps`(默认仅项目级 `apps`)。项目配置了 `inherit: false` 时见 `api pull` 文档同名词条 |
27
+ | `--app <name>` | 多应用模式下,指定应用名称 |
28
+ | `--appcode <code>` | 直接指定 appcode |
29
+ | `--format json` | JSON 格式输出(用于脚本解析) |
30
+
31
+ ## 输出说明
32
+
33
+ 列出每个 Dataset 的:
34
+
35
+ | 字段 | 说明 |
36
+ |------|------|
37
+ | `id` | Dataset ID |
38
+ | `name` | Dataset 名称 |
39
+ | `key` | Dataset Key |
40
+ | `datasetCode` | Dataset Code(用于 API 调用) |
41
+
42
+ ## 多应用过滤
43
+
44
+ 多应用模式下:
45
+ - **不加 `--app` / `--appcode`**:遍历已配置应用(默认仅 **项目** `apps`;需包含全局合并进来的应用时加 **`--global`**)
46
+ - **加 `--app <name>`**:仅列出指定应用的模型
47
+ - **加 `--appcode <code>`**:反查到对应 app profile,使用其 cookie/env
48
+
49
+ 若项目 **`inherit: false`**,`--global` 无法合并进全局 `apps`,行为与 `api pull` 一致(详见 **api pull** 文档「与 inherit: false 的关系」)。
50
+
51
+ ## 风险等级
52
+
53
+ `read` — 仅读取,不修改文件。
54
+
55
+ ## 前置条件
56
+
57
+ - 已完成 `rabetbase auth` 登录
58
+ - 已运行过 `rabetbase api pull` 生成过 API 代码(用于确认本地已有哪些模型)