@origen-ui/admin-cli 1.0.0

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 (430) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -0
  3. package/bin/og-admin.mjs +131 -0
  4. package/package.json +28 -0
  5. package/templates/current/clean/.codebuddy/AGENTS.md +18 -0
  6. package/templates/current/clean/.codebuddy/rules/01-feature-architecture.md +12 -0
  7. package/templates/current/clean/.codebuddy/rules/02-vue-typescript.md +12 -0
  8. package/templates/current/clean/.codebuddy/rules/03-component-policy.md +30 -0
  9. package/templates/current/clean/.codebuddy/rules/04-api-auth-router.md +12 -0
  10. package/templates/current/clean/.codebuddy/rules/05-style.md +12 -0
  11. package/templates/current/clean/.codebuddy/rules/06-quality.md +12 -0
  12. package/templates/current/clean/.codebuddy/skills/build-admin-feature/SKILL.md +17 -0
  13. package/templates/current/clean/.codebuddy/skills/style-og-origen-ui/SKILL.md +14 -0
  14. package/templates/current/clean/.codebuddy/skills/use-og-dialog/SKILL.md +15 -0
  15. package/templates/current/clean/.codebuddy/skills/use-og-editor/SKILL.md +28 -0
  16. package/templates/current/clean/.codebuddy/skills/use-og-form/SKILL.md +15 -0
  17. package/templates/current/clean/.codebuddy/skills/use-og-form-table/SKILL.md +28 -0
  18. package/templates/current/clean/.codebuddy/skills/use-og-http/SKILL.md +16 -0
  19. package/templates/current/clean/.codebuddy/skills/use-og-router-tabs/SKILL.md +14 -0
  20. package/templates/current/clean/.codebuddy/skills/use-og-search/SKILL.md +17 -0
  21. package/templates/current/clean/.codebuddy/skills/use-og-table/SKILL.md +19 -0
  22. package/templates/current/clean/.codebuddy/skills/use-og-upload/SKILL.md +28 -0
  23. package/templates/current/clean/.codex/AGENTS.md +15 -0
  24. package/templates/current/clean/.codex/rules/01-feature-architecture.md +6 -0
  25. package/templates/current/clean/.codex/rules/02-vue-typescript.md +6 -0
  26. package/templates/current/clean/.codex/rules/03-component-policy.md +24 -0
  27. package/templates/current/clean/.codex/rules/04-api-auth-router.md +6 -0
  28. package/templates/current/clean/.codex/rules/05-style.md +6 -0
  29. package/templates/current/clean/.codex/rules/06-quality.md +6 -0
  30. package/templates/current/clean/.codex/skills/build-admin-feature/SKILL.md +14 -0
  31. package/templates/current/clean/.codex/skills/build-admin-feature/references/component-selection.md +25 -0
  32. package/templates/current/clean/.codex/skills/style-og-origen-ui/SKILL.md +11 -0
  33. package/templates/current/clean/.codex/skills/style-og-origen-ui/agents/openai.yaml +4 -0
  34. package/templates/current/clean/.codex/skills/use-og-dialog/SKILL.md +12 -0
  35. package/templates/current/clean/.codex/skills/use-og-dialog/agents/openai.yaml +4 -0
  36. package/templates/current/clean/.codex/skills/use-og-editor/SKILL.md +25 -0
  37. package/templates/current/clean/.codex/skills/use-og-form/SKILL.md +12 -0
  38. package/templates/current/clean/.codex/skills/use-og-form-table/SKILL.md +25 -0
  39. package/templates/current/clean/.codex/skills/use-og-http/SKILL.md +13 -0
  40. package/templates/current/clean/.codex/skills/use-og-http/agents/openai.yaml +4 -0
  41. package/templates/current/clean/.codex/skills/use-og-router-tabs/SKILL.md +11 -0
  42. package/templates/current/clean/.codex/skills/use-og-search/SKILL.md +14 -0
  43. package/templates/current/clean/.codex/skills/use-og-table/SKILL.md +16 -0
  44. package/templates/current/clean/.codex/skills/use-og-upload/SKILL.md +25 -0
  45. package/templates/current/clean/.cursor/AGENTS.md +18 -0
  46. package/templates/current/clean/.cursor/rules/01-feature-architecture.mdc +12 -0
  47. package/templates/current/clean/.cursor/rules/02-vue-typescript.mdc +12 -0
  48. package/templates/current/clean/.cursor/rules/03-component-policy.mdc +30 -0
  49. package/templates/current/clean/.cursor/rules/04-api-auth-router.mdc +12 -0
  50. package/templates/current/clean/.cursor/rules/05-style.mdc +12 -0
  51. package/templates/current/clean/.cursor/rules/06-quality.mdc +12 -0
  52. package/templates/current/clean/.cursor/skills/build-admin-feature/SKILL.md +14 -0
  53. package/templates/current/clean/.cursor/skills/style-og-origen-ui/SKILL.md +11 -0
  54. package/templates/current/clean/.cursor/skills/use-og-dialog/SKILL.md +12 -0
  55. package/templates/current/clean/.cursor/skills/use-og-editor/SKILL.md +25 -0
  56. package/templates/current/clean/.cursor/skills/use-og-form/SKILL.md +12 -0
  57. package/templates/current/clean/.cursor/skills/use-og-form-table/SKILL.md +25 -0
  58. package/templates/current/clean/.cursor/skills/use-og-http/SKILL.md +13 -0
  59. package/templates/current/clean/.cursor/skills/use-og-router-tabs/SKILL.md +11 -0
  60. package/templates/current/clean/.cursor/skills/use-og-search/SKILL.md +14 -0
  61. package/templates/current/clean/.cursor/skills/use-og-table/SKILL.md +16 -0
  62. package/templates/current/clean/.cursor/skills/use-og-upload/SKILL.md +25 -0
  63. package/templates/current/clean/.env.example +7 -0
  64. package/templates/current/clean/.env.production.example +31 -0
  65. package/templates/current/clean/.qoder/AGENTS.md +15 -0
  66. package/templates/current/clean/.qoder/rules/01-feature-architecture.md +12 -0
  67. package/templates/current/clean/.qoder/rules/02-vue-typescript.md +12 -0
  68. package/templates/current/clean/.qoder/rules/03-component-policy.md +30 -0
  69. package/templates/current/clean/.qoder/rules/04-api-auth-router.md +12 -0
  70. package/templates/current/clean/.qoder/rules/05-style.md +12 -0
  71. package/templates/current/clean/.qoder/rules/06-quality.md +12 -0
  72. package/templates/current/clean/.qoder/skills/build-admin-feature/SKILL.md +14 -0
  73. package/templates/current/clean/.qoder/skills/style-og-origen-ui/SKILL.md +11 -0
  74. package/templates/current/clean/.qoder/skills/use-og-dialog/SKILL.md +12 -0
  75. package/templates/current/clean/.qoder/skills/use-og-editor/SKILL.md +25 -0
  76. package/templates/current/clean/.qoder/skills/use-og-form/SKILL.md +12 -0
  77. package/templates/current/clean/.qoder/skills/use-og-form-table/SKILL.md +25 -0
  78. package/templates/current/clean/.qoder/skills/use-og-http/SKILL.md +13 -0
  79. package/templates/current/clean/.qoder/skills/use-og-router-tabs/SKILL.md +11 -0
  80. package/templates/current/clean/.qoder/skills/use-og-search/SKILL.md +14 -0
  81. package/templates/current/clean/.qoder/skills/use-og-table/SKILL.md +16 -0
  82. package/templates/current/clean/.qoder/skills/use-og-upload/SKILL.md +25 -0
  83. package/templates/current/clean/AGENTS.md +16 -0
  84. package/templates/current/clean/README.md +116 -0
  85. package/templates/current/clean/component-catalog.json +765 -0
  86. package/templates/current/clean/e2e/admin-shell.spec.ts +150 -0
  87. package/templates/current/clean/e2e/demo-shell.spec.ts +328 -0
  88. package/templates/current/clean/evals/component-selection.json +29 -0
  89. package/templates/current/clean/gitignore +3 -0
  90. package/templates/current/clean/index.html +13 -0
  91. package/templates/current/clean/openapi.json +1623 -0
  92. package/templates/current/clean/package.json +65 -0
  93. package/templates/current/clean/playwright.config.ts +31 -0
  94. package/templates/current/clean/playwright.demo.config.ts +25 -0
  95. package/templates/current/clean/recipes/README.md +7 -0
  96. package/templates/current/clean/recipes/remote-crud-dialog-form.json +15 -0
  97. package/templates/current/clean/recipes/remote-crud-dialog-form.vue +66 -0
  98. package/templates/current/clean/scaffold.lock.json +12 -0
  99. package/templates/current/clean/scripts/check-admin-bundle.mjs +214 -0
  100. package/templates/current/clean/scripts/check-admin-scaffold.mjs +168 -0
  101. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +26 -0
  102. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +26 -0
  103. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +26 -0
  104. package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +32 -0
  105. package/templates/current/clean/scripts/clean-overlay/src/main.ts +91 -0
  106. package/templates/current/clean/scripts/clean-overlay/src/router/componentRegistry.ts +25 -0
  107. package/templates/current/clean/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +47 -0
  108. package/templates/current/clean/scripts/clean-overlay/src/router/staticRoutes.ts +63 -0
  109. package/templates/current/clean/scripts/demo-api.ts +797 -0
  110. package/templates/current/clean/scripts/generate-api.ts +27 -0
  111. package/templates/current/clean/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +38 -0
  112. package/templates/current/clean/scripts/remove-examples.mjs +54 -0
  113. package/templates/current/clean/src/App.vue +67 -0
  114. package/templates/current/clean/src/api/client.spec.ts +66 -0
  115. package/templates/current/clean/src/api/client.ts +72 -0
  116. package/templates/current/clean/src/api/generated/data-contracts.ts +268 -0
  117. package/templates/current/clean/src/api/generated/http-client.ts +266 -0
  118. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +147 -0
  119. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +53 -0
  120. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +66 -0
  121. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +171 -0
  122. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +181 -0
  123. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +169 -0
  124. package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +170 -0
  125. package/templates/current/clean/src/api/generated//350/256/244/350/257/201.ts +98 -0
  126. package/templates/current/clean/src/api/http-adapter.spec.ts +33 -0
  127. package/templates/current/clean/src/api/http-adapter.ts +83 -0
  128. package/templates/current/clean/src/api/index.ts +41 -0
  129. package/templates/current/clean/src/app/createAdminUi.spec.ts +110 -0
  130. package/templates/current/clean/src/app/createAdminUi.ts +78 -0
  131. package/templates/current/clean/src/app/menu.spec.ts +255 -0
  132. package/templates/current/clean/src/app/menu.ts +268 -0
  133. package/templates/current/clean/src/app/menuTypes.ts +17 -0
  134. package/templates/current/clean/src/app/origenUiLocale.spec.ts +14 -0
  135. package/templates/current/clean/src/app/origenUiLocale.ts +65 -0
  136. package/templates/current/clean/src/app/permission.ts +9 -0
  137. package/templates/current/clean/src/app/runtimeConfig.ts +77 -0
  138. package/templates/current/clean/src/demo-api.spec.ts +167 -0
  139. package/templates/current/clean/src/env.d.ts +14 -0
  140. package/templates/current/clean/src/features/appearance/components/ThemePanel.vue +200 -0
  141. package/templates/current/clean/src/features/appearance/composables/useTheme.ts +17 -0
  142. package/templates/current/clean/src/features/appearance/store/theme.ts +140 -0
  143. package/templates/current/clean/src/features/auth/pages/Login.vue +159 -0
  144. package/templates/current/clean/src/features/auth/store/auth.spec.ts +131 -0
  145. package/templates/current/clean/src/features/auth/store/auth.ts +210 -0
  146. package/templates/current/clean/src/features/errors/pages/Forbidden.vue +26 -0
  147. package/templates/current/clean/src/features/errors/pages/NotFound.vue +26 -0
  148. package/templates/current/clean/src/features/errors/pages/ServerError.vue +26 -0
  149. package/templates/current/clean/src/features/errors/pages/error-pages.spec.ts +32 -0
  150. package/templates/current/clean/src/features/security/components/DevtoolsProtectionOverlay.vue +56 -0
  151. package/templates/current/clean/src/features/security/devtoolsProtection.spec.ts +211 -0
  152. package/templates/current/clean/src/features/security/devtoolsProtection.ts +242 -0
  153. package/templates/current/clean/src/features/shell/components/AdminWatermark.spec.ts +90 -0
  154. package/templates/current/clean/src/features/shell/components/AdminWatermark.vue +47 -0
  155. package/templates/current/clean/src/features/shell/components/RouteProgress.vue +68 -0
  156. package/templates/current/clean/src/features/shell/composables/useRouteProgress.spec.ts +95 -0
  157. package/templates/current/clean/src/features/shell/composables/useRouteProgress.ts +52 -0
  158. package/templates/current/clean/src/features/shell/store/sidebar.ts +55 -0
  159. package/templates/current/clean/src/features/system/access/api/admin-repository.ts +279 -0
  160. package/templates/current/clean/src/features/system/access/api/rbac.spec.ts +72 -0
  161. package/templates/current/clean/src/features/system/access/api/rbac.ts +272 -0
  162. package/templates/current/clean/src/features/system/access/composables/useAuthorizationRefresh.ts +15 -0
  163. package/templates/current/clean/src/features/workspace/pages/Empty.vue +18 -0
  164. package/templates/current/clean/src/features/workspace/pages/Profile.vue +183 -0
  165. package/templates/current/clean/src/layouts/AdminLayout.vue +61 -0
  166. package/templates/current/clean/src/layouts/BreadcrumbBar.vue +27 -0
  167. package/templates/current/clean/src/layouts/SideMenu.vue +119 -0
  168. package/templates/current/clean/src/layouts/TopBar.vue +301 -0
  169. package/templates/current/clean/src/layouts/WorkspaceTabs.vue +44 -0
  170. package/templates/current/clean/src/layouts/topBarMenuSearch.spec.ts +31 -0
  171. package/templates/current/clean/src/layouts/topBarMenuSearch.ts +21 -0
  172. package/templates/current/clean/src/locales/en-US.ts +55 -0
  173. package/templates/current/clean/src/locales/index.ts +119 -0
  174. package/templates/current/clean/src/locales/messages.spec.ts +23 -0
  175. package/templates/current/clean/src/locales/zh-CN.ts +55 -0
  176. package/templates/current/clean/src/locales/zh-TW.ts +44 -0
  177. package/templates/current/clean/src/main.ts +91 -0
  178. package/templates/current/clean/src/router/bootstrap.ts +76 -0
  179. package/templates/current/clean/src/router/componentRegistry.ts +25 -0
  180. package/templates/current/clean/src/router/dynamicRoutes.spec.ts +47 -0
  181. package/templates/current/clean/src/router/dynamicRoutes.ts +162 -0
  182. package/templates/current/clean/src/router/guards.ts +5 -0
  183. package/templates/current/clean/src/router/queryEncryption.spec.ts +82 -0
  184. package/templates/current/clean/src/router/queryEncryption.ts +133 -0
  185. package/templates/current/clean/src/router/routeQuery.spec.ts +11 -0
  186. package/templates/current/clean/src/router/routeQuery.ts +3 -0
  187. package/templates/current/clean/src/router/runtimeErrorRecovery.spec.ts +161 -0
  188. package/templates/current/clean/src/router/runtimeErrorRecovery.ts +108 -0
  189. package/templates/current/clean/src/router/staticRoutes.ts +63 -0
  190. package/templates/current/clean/src/router/useRouteQueryDefaults.spec.ts +90 -0
  191. package/templates/current/clean/src/router/useRouteQueryDefaults.ts +51 -0
  192. package/templates/current/clean/src/router/useRouteQueryDefaults.types.ts +19 -0
  193. package/templates/current/clean/src/store/index.ts +3 -0
  194. package/templates/current/clean/src/styles/element/index.scss +33 -0
  195. package/templates/current/clean/src/styles/index.css +39 -0
  196. package/templates/current/clean/src/styles/layout.css +115 -0
  197. package/templates/current/clean/src/styles/shell.css +196 -0
  198. package/templates/current/clean/src/styles/source-package-style-compat.css +1 -0
  199. package/templates/current/clean/src/templates/og-form.ts +48 -0
  200. package/templates/current/clean/src/templates/og-table.ts +212 -0
  201. package/templates/current/clean/src/templates/router.ts +51 -0
  202. package/templates/current/clean/src/templates/templates.spec.ts +90 -0
  203. package/templates/current/clean/src/theme/index.ts +7 -0
  204. package/templates/current/clean/src/utils/__tests__/color-mix.spec.ts +39 -0
  205. package/templates/current/clean/src/utils/color-mix.ts +76 -0
  206. package/templates/current/clean/src/utils/permissions.ts +6 -0
  207. package/templates/current/clean/tsconfig.json +40 -0
  208. package/templates/current/clean/tsconfig.node.json +9 -0
  209. package/templates/current/clean/vite.build-policy.ts +405 -0
  210. package/templates/current/clean/vite.config.ts +37 -0
  211. package/templates/current/examples/.codebuddy/AGENTS.md +18 -0
  212. package/templates/current/examples/.codebuddy/rules/01-feature-architecture.md +12 -0
  213. package/templates/current/examples/.codebuddy/rules/02-vue-typescript.md +12 -0
  214. package/templates/current/examples/.codebuddy/rules/03-component-policy.md +30 -0
  215. package/templates/current/examples/.codebuddy/rules/04-api-auth-router.md +12 -0
  216. package/templates/current/examples/.codebuddy/rules/05-style.md +12 -0
  217. package/templates/current/examples/.codebuddy/rules/06-quality.md +12 -0
  218. package/templates/current/examples/.codebuddy/skills/build-admin-feature/SKILL.md +17 -0
  219. package/templates/current/examples/.codebuddy/skills/style-og-origen-ui/SKILL.md +14 -0
  220. package/templates/current/examples/.codebuddy/skills/use-og-dialog/SKILL.md +15 -0
  221. package/templates/current/examples/.codebuddy/skills/use-og-editor/SKILL.md +28 -0
  222. package/templates/current/examples/.codebuddy/skills/use-og-form/SKILL.md +15 -0
  223. package/templates/current/examples/.codebuddy/skills/use-og-form-table/SKILL.md +28 -0
  224. package/templates/current/examples/.codebuddy/skills/use-og-http/SKILL.md +16 -0
  225. package/templates/current/examples/.codebuddy/skills/use-og-router-tabs/SKILL.md +14 -0
  226. package/templates/current/examples/.codebuddy/skills/use-og-search/SKILL.md +17 -0
  227. package/templates/current/examples/.codebuddy/skills/use-og-table/SKILL.md +19 -0
  228. package/templates/current/examples/.codebuddy/skills/use-og-upload/SKILL.md +28 -0
  229. package/templates/current/examples/.codex/AGENTS.md +15 -0
  230. package/templates/current/examples/.codex/rules/01-feature-architecture.md +6 -0
  231. package/templates/current/examples/.codex/rules/02-vue-typescript.md +6 -0
  232. package/templates/current/examples/.codex/rules/03-component-policy.md +24 -0
  233. package/templates/current/examples/.codex/rules/04-api-auth-router.md +6 -0
  234. package/templates/current/examples/.codex/rules/05-style.md +6 -0
  235. package/templates/current/examples/.codex/rules/06-quality.md +6 -0
  236. package/templates/current/examples/.codex/skills/build-admin-feature/SKILL.md +14 -0
  237. package/templates/current/examples/.codex/skills/build-admin-feature/references/component-selection.md +25 -0
  238. package/templates/current/examples/.codex/skills/style-og-origen-ui/SKILL.md +11 -0
  239. package/templates/current/examples/.codex/skills/style-og-origen-ui/agents/openai.yaml +4 -0
  240. package/templates/current/examples/.codex/skills/use-og-dialog/SKILL.md +12 -0
  241. package/templates/current/examples/.codex/skills/use-og-dialog/agents/openai.yaml +4 -0
  242. package/templates/current/examples/.codex/skills/use-og-editor/SKILL.md +25 -0
  243. package/templates/current/examples/.codex/skills/use-og-form/SKILL.md +12 -0
  244. package/templates/current/examples/.codex/skills/use-og-form-table/SKILL.md +25 -0
  245. package/templates/current/examples/.codex/skills/use-og-http/SKILL.md +13 -0
  246. package/templates/current/examples/.codex/skills/use-og-http/agents/openai.yaml +4 -0
  247. package/templates/current/examples/.codex/skills/use-og-router-tabs/SKILL.md +11 -0
  248. package/templates/current/examples/.codex/skills/use-og-search/SKILL.md +14 -0
  249. package/templates/current/examples/.codex/skills/use-og-table/SKILL.md +16 -0
  250. package/templates/current/examples/.codex/skills/use-og-upload/SKILL.md +25 -0
  251. package/templates/current/examples/.cursor/AGENTS.md +18 -0
  252. package/templates/current/examples/.cursor/rules/01-feature-architecture.mdc +12 -0
  253. package/templates/current/examples/.cursor/rules/02-vue-typescript.mdc +12 -0
  254. package/templates/current/examples/.cursor/rules/03-component-policy.mdc +30 -0
  255. package/templates/current/examples/.cursor/rules/04-api-auth-router.mdc +12 -0
  256. package/templates/current/examples/.cursor/rules/05-style.mdc +12 -0
  257. package/templates/current/examples/.cursor/rules/06-quality.mdc +12 -0
  258. package/templates/current/examples/.cursor/skills/build-admin-feature/SKILL.md +14 -0
  259. package/templates/current/examples/.cursor/skills/style-og-origen-ui/SKILL.md +11 -0
  260. package/templates/current/examples/.cursor/skills/use-og-dialog/SKILL.md +12 -0
  261. package/templates/current/examples/.cursor/skills/use-og-editor/SKILL.md +25 -0
  262. package/templates/current/examples/.cursor/skills/use-og-form/SKILL.md +12 -0
  263. package/templates/current/examples/.cursor/skills/use-og-form-table/SKILL.md +25 -0
  264. package/templates/current/examples/.cursor/skills/use-og-http/SKILL.md +13 -0
  265. package/templates/current/examples/.cursor/skills/use-og-router-tabs/SKILL.md +11 -0
  266. package/templates/current/examples/.cursor/skills/use-og-search/SKILL.md +14 -0
  267. package/templates/current/examples/.cursor/skills/use-og-table/SKILL.md +16 -0
  268. package/templates/current/examples/.cursor/skills/use-og-upload/SKILL.md +25 -0
  269. package/templates/current/examples/.env.example +7 -0
  270. package/templates/current/examples/.env.production.example +31 -0
  271. package/templates/current/examples/.qoder/AGENTS.md +15 -0
  272. package/templates/current/examples/.qoder/rules/01-feature-architecture.md +12 -0
  273. package/templates/current/examples/.qoder/rules/02-vue-typescript.md +12 -0
  274. package/templates/current/examples/.qoder/rules/03-component-policy.md +30 -0
  275. package/templates/current/examples/.qoder/rules/04-api-auth-router.md +12 -0
  276. package/templates/current/examples/.qoder/rules/05-style.md +12 -0
  277. package/templates/current/examples/.qoder/rules/06-quality.md +12 -0
  278. package/templates/current/examples/.qoder/skills/build-admin-feature/SKILL.md +14 -0
  279. package/templates/current/examples/.qoder/skills/style-og-origen-ui/SKILL.md +11 -0
  280. package/templates/current/examples/.qoder/skills/use-og-dialog/SKILL.md +12 -0
  281. package/templates/current/examples/.qoder/skills/use-og-editor/SKILL.md +25 -0
  282. package/templates/current/examples/.qoder/skills/use-og-form/SKILL.md +12 -0
  283. package/templates/current/examples/.qoder/skills/use-og-form-table/SKILL.md +25 -0
  284. package/templates/current/examples/.qoder/skills/use-og-http/SKILL.md +13 -0
  285. package/templates/current/examples/.qoder/skills/use-og-router-tabs/SKILL.md +11 -0
  286. package/templates/current/examples/.qoder/skills/use-og-search/SKILL.md +14 -0
  287. package/templates/current/examples/.qoder/skills/use-og-table/SKILL.md +16 -0
  288. package/templates/current/examples/.qoder/skills/use-og-upload/SKILL.md +25 -0
  289. package/templates/current/examples/AGENTS.md +16 -0
  290. package/templates/current/examples/README.md +116 -0
  291. package/templates/current/examples/component-catalog.json +765 -0
  292. package/templates/current/examples/e2e/admin-shell.spec.ts +150 -0
  293. package/templates/current/examples/e2e/demo-shell.spec.ts +328 -0
  294. package/templates/current/examples/evals/component-selection.json +29 -0
  295. package/templates/current/examples/gitignore +3 -0
  296. package/templates/current/examples/index.html +13 -0
  297. package/templates/current/examples/openapi.json +1623 -0
  298. package/templates/current/examples/package.json +65 -0
  299. package/templates/current/examples/playwright.config.ts +31 -0
  300. package/templates/current/examples/playwright.demo.config.ts +25 -0
  301. package/templates/current/examples/recipes/README.md +7 -0
  302. package/templates/current/examples/recipes/remote-crud-dialog-form.json +15 -0
  303. package/templates/current/examples/recipes/remote-crud-dialog-form.vue +66 -0
  304. package/templates/current/examples/scaffold.lock.json +12 -0
  305. package/templates/current/examples/scripts/check-admin-bundle.mjs +214 -0
  306. package/templates/current/examples/scripts/check-admin-scaffold.mjs +168 -0
  307. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +26 -0
  308. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +26 -0
  309. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +26 -0
  310. package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +32 -0
  311. package/templates/current/examples/scripts/clean-overlay/src/main.ts +91 -0
  312. package/templates/current/examples/scripts/clean-overlay/src/router/componentRegistry.ts +25 -0
  313. package/templates/current/examples/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +47 -0
  314. package/templates/current/examples/scripts/clean-overlay/src/router/staticRoutes.ts +63 -0
  315. package/templates/current/examples/scripts/demo-api.ts +797 -0
  316. package/templates/current/examples/scripts/generate-api.ts +27 -0
  317. package/templates/current/examples/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +38 -0
  318. package/templates/current/examples/scripts/remove-examples.mjs +54 -0
  319. package/templates/current/examples/src/App.vue +67 -0
  320. package/templates/current/examples/src/api/client.spec.ts +66 -0
  321. package/templates/current/examples/src/api/client.ts +72 -0
  322. package/templates/current/examples/src/api/generated/data-contracts.ts +268 -0
  323. package/templates/current/examples/src/api/generated/http-client.ts +266 -0
  324. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +147 -0
  325. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +53 -0
  326. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +66 -0
  327. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +171 -0
  328. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +181 -0
  329. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +169 -0
  330. package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +170 -0
  331. package/templates/current/examples/src/api/generated//350/256/244/350/257/201.ts +98 -0
  332. package/templates/current/examples/src/api/http-adapter.spec.ts +33 -0
  333. package/templates/current/examples/src/api/http-adapter.ts +83 -0
  334. package/templates/current/examples/src/api/index.ts +41 -0
  335. package/templates/current/examples/src/app/createAdminUi.spec.ts +110 -0
  336. package/templates/current/examples/src/app/createAdminUi.ts +78 -0
  337. package/templates/current/examples/src/app/menu.spec.ts +255 -0
  338. package/templates/current/examples/src/app/menu.ts +268 -0
  339. package/templates/current/examples/src/app/menuTypes.ts +17 -0
  340. package/templates/current/examples/src/app/origenUiLocale.spec.ts +14 -0
  341. package/templates/current/examples/src/app/origenUiLocale.ts +65 -0
  342. package/templates/current/examples/src/app/permission.ts +9 -0
  343. package/templates/current/examples/src/app/runtimeConfig.ts +77 -0
  344. package/templates/current/examples/src/demo-api.spec.ts +167 -0
  345. package/templates/current/examples/src/env.d.ts +14 -0
  346. package/templates/current/examples/src/features/appearance/components/ThemePanel.vue +200 -0
  347. package/templates/current/examples/src/features/appearance/composables/useTheme.ts +17 -0
  348. package/templates/current/examples/src/features/appearance/store/theme.ts +140 -0
  349. package/templates/current/examples/src/features/auth/pages/Login.vue +159 -0
  350. package/templates/current/examples/src/features/auth/store/auth.spec.ts +131 -0
  351. package/templates/current/examples/src/features/auth/store/auth.ts +210 -0
  352. package/templates/current/examples/src/features/errors/pages/Forbidden.vue +26 -0
  353. package/templates/current/examples/src/features/errors/pages/NotFound.vue +26 -0
  354. package/templates/current/examples/src/features/errors/pages/ServerError.vue +26 -0
  355. package/templates/current/examples/src/features/errors/pages/error-pages.spec.ts +32 -0
  356. package/templates/current/examples/src/features/feature-composables.spec.ts +208 -0
  357. package/templates/current/examples/src/features/security/components/DevtoolsProtectionOverlay.vue +56 -0
  358. package/templates/current/examples/src/features/security/devtoolsProtection.spec.ts +211 -0
  359. package/templates/current/examples/src/features/security/devtoolsProtection.ts +242 -0
  360. package/templates/current/examples/src/features/shell/components/AdminWatermark.spec.ts +90 -0
  361. package/templates/current/examples/src/features/shell/components/AdminWatermark.vue +47 -0
  362. package/templates/current/examples/src/features/shell/components/RouteProgress.vue +68 -0
  363. package/templates/current/examples/src/features/shell/composables/useRouteProgress.spec.ts +95 -0
  364. package/templates/current/examples/src/features/shell/composables/useRouteProgress.ts +52 -0
  365. package/templates/current/examples/src/features/shell/store/sidebar.ts +55 -0
  366. package/templates/current/examples/src/features/system/access/api/admin-repository.ts +279 -0
  367. package/templates/current/examples/src/features/system/access/api/rbac.spec.ts +72 -0
  368. package/templates/current/examples/src/features/system/access/api/rbac.ts +272 -0
  369. package/templates/current/examples/src/features/system/access/composables/useAuthorizationRefresh.ts +15 -0
  370. package/templates/current/examples/src/features/system/audit/composables/useAuditManagement.ts +117 -0
  371. package/templates/current/examples/src/features/system/audit/pages/AuditList.vue +20 -0
  372. package/templates/current/examples/src/features/system/menus/components/MenuEditorForm.vue +189 -0
  373. package/templates/current/examples/src/features/system/menus/composables/useMenuManagement.ts +327 -0
  374. package/templates/current/examples/src/features/system/menus/pages/MenuList.vue +49 -0
  375. package/templates/current/examples/src/features/system/roles/components/RoleEditorForm.vue +112 -0
  376. package/templates/current/examples/src/features/system/roles/composables/useRoleManagement.ts +198 -0
  377. package/templates/current/examples/src/features/system/roles/pages/RoleList.vue +45 -0
  378. package/templates/current/examples/src/features/system/users/components/UserEditorForm.vue +101 -0
  379. package/templates/current/examples/src/features/system/users/composables/useUserManagement.ts +233 -0
  380. package/templates/current/examples/src/features/system/users/pages/UserList.vue +49 -0
  381. package/templates/current/examples/src/features/workspace/pages/Dashboard.spec.ts +32 -0
  382. package/templates/current/examples/src/features/workspace/pages/Dashboard.vue +297 -0
  383. package/templates/current/examples/src/features/workspace/pages/Empty.vue +18 -0
  384. package/templates/current/examples/src/features/workspace/pages/Profile.vue +183 -0
  385. package/templates/current/examples/src/layouts/AdminLayout.vue +61 -0
  386. package/templates/current/examples/src/layouts/BreadcrumbBar.vue +27 -0
  387. package/templates/current/examples/src/layouts/SideMenu.vue +119 -0
  388. package/templates/current/examples/src/layouts/TopBar.vue +301 -0
  389. package/templates/current/examples/src/layouts/WorkspaceTabs.vue +44 -0
  390. package/templates/current/examples/src/layouts/topBarMenuSearch.spec.ts +31 -0
  391. package/templates/current/examples/src/layouts/topBarMenuSearch.ts +21 -0
  392. package/templates/current/examples/src/locales/en-US.ts +55 -0
  393. package/templates/current/examples/src/locales/index.ts +119 -0
  394. package/templates/current/examples/src/locales/messages.spec.ts +23 -0
  395. package/templates/current/examples/src/locales/zh-CN.ts +55 -0
  396. package/templates/current/examples/src/locales/zh-TW.ts +44 -0
  397. package/templates/current/examples/src/main.ts +91 -0
  398. package/templates/current/examples/src/router/bootstrap.ts +76 -0
  399. package/templates/current/examples/src/router/componentRegistry.ts +83 -0
  400. package/templates/current/examples/src/router/dynamicRoutes.spec.ts +109 -0
  401. package/templates/current/examples/src/router/dynamicRoutes.ts +162 -0
  402. package/templates/current/examples/src/router/guards.ts +5 -0
  403. package/templates/current/examples/src/router/queryEncryption.spec.ts +82 -0
  404. package/templates/current/examples/src/router/queryEncryption.ts +133 -0
  405. package/templates/current/examples/src/router/routeQuery.spec.ts +11 -0
  406. package/templates/current/examples/src/router/routeQuery.ts +3 -0
  407. package/templates/current/examples/src/router/runtimeErrorRecovery.spec.ts +161 -0
  408. package/templates/current/examples/src/router/runtimeErrorRecovery.ts +108 -0
  409. package/templates/current/examples/src/router/staticRoutes.ts +63 -0
  410. package/templates/current/examples/src/router/useRouteQueryDefaults.spec.ts +90 -0
  411. package/templates/current/examples/src/router/useRouteQueryDefaults.ts +51 -0
  412. package/templates/current/examples/src/router/useRouteQueryDefaults.types.ts +19 -0
  413. package/templates/current/examples/src/store/index.ts +3 -0
  414. package/templates/current/examples/src/styles/element/index.scss +33 -0
  415. package/templates/current/examples/src/styles/index.css +39 -0
  416. package/templates/current/examples/src/styles/layout.css +115 -0
  417. package/templates/current/examples/src/styles/shell.css +196 -0
  418. package/templates/current/examples/src/styles/source-package-style-compat.css +1 -0
  419. package/templates/current/examples/src/templates/og-form.ts +48 -0
  420. package/templates/current/examples/src/templates/og-table.ts +212 -0
  421. package/templates/current/examples/src/templates/router.ts +51 -0
  422. package/templates/current/examples/src/templates/templates.spec.ts +90 -0
  423. package/templates/current/examples/src/theme/index.ts +7 -0
  424. package/templates/current/examples/src/utils/__tests__/color-mix.spec.ts +39 -0
  425. package/templates/current/examples/src/utils/color-mix.ts +76 -0
  426. package/templates/current/examples/src/utils/permissions.ts +6 -0
  427. package/templates/current/examples/tsconfig.json +40 -0
  428. package/templates/current/examples/tsconfig.node.json +9 -0
  429. package/templates/current/examples/vite.build-policy.ts +405 -0
  430. package/templates/current/examples/vite.config.ts +37 -0
@@ -0,0 +1,268 @@
1
+ import type { BackendMenuNode } from './menuTypes'
2
+ import { apiClient } from '../api/client'
3
+
4
+ function isRecord(value: unknown): value is Record<string, unknown> {
5
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
6
+ }
7
+
8
+ interface MenuPageResponse {
9
+ list: unknown[]
10
+ total: number
11
+ page: number
12
+ pageSize: number
13
+ }
14
+
15
+ function readMenuPageResponse(value: unknown): MenuPageResponse | undefined {
16
+ if (!isRecord(value) || !Array.isArray(value.list)) return undefined
17
+ if (
18
+ typeof value.total !== 'number' ||
19
+ !Number.isFinite(value.total) ||
20
+ value.total < 0 ||
21
+ typeof value.page !== 'number' ||
22
+ !Number.isInteger(value.page) ||
23
+ value.page < 1 ||
24
+ typeof value.pageSize !== 'number' ||
25
+ !Number.isInteger(value.pageSize) ||
26
+ value.pageSize < 1
27
+ ) {
28
+ throw new TypeError('Menu page response must contain a valid list, total, page, and pageSize.')
29
+ }
30
+ return { list: value.list, total: value.total, page: value.page, pageSize: value.pageSize }
31
+ }
32
+
33
+ function readNode(value: unknown, index: string): BackendMenuNode {
34
+ if (!isRecord(value)) throw new TypeError(`Invalid menu node at ${index}`)
35
+ if (
36
+ typeof value.code !== 'string' ||
37
+ typeof value.path !== 'string' ||
38
+ typeof value.title !== 'string'
39
+ ) {
40
+ throw new TypeError(`Invalid menu node fields at ${index}`)
41
+ }
42
+ return {
43
+ code: value.code,
44
+ path: value.path,
45
+ title: value.title,
46
+ componentKey: typeof value.componentKey === 'string' ? value.componentKey : undefined,
47
+ icon: typeof value.icon === 'string' ? value.icon : undefined,
48
+ permissions: Array.isArray(value.permissions)
49
+ ? value.permissions.filter((item): item is string => typeof item === 'string')
50
+ : undefined,
51
+ parentPath: typeof value.parentPath === 'string' ? value.parentPath : undefined,
52
+ menu: typeof value.menu === 'boolean' ? value.menu : undefined,
53
+ hidden: typeof value.hidden === 'boolean' ? value.hidden : undefined,
54
+ order: typeof value.order === 'number' ? value.order : undefined,
55
+ cache: typeof value.cache === 'boolean' ? value.cache : undefined,
56
+ tabHidden: typeof value.tabHidden === 'boolean' ? value.tabHidden : undefined,
57
+ redirect: typeof value.redirect === 'string' ? value.redirect : undefined,
58
+ children: Array.isArray(value.children)
59
+ ? value.children.map((child, childIndex) =>
60
+ readNode(child, `${index}.children[${childIndex}]`),
61
+ )
62
+ : undefined,
63
+ }
64
+ }
65
+
66
+ type RbacMenuKind = 'directory' | 'page' | 'button'
67
+
68
+ interface RbacMenuNode {
69
+ id: string
70
+ parentId?: string
71
+ kind: RbacMenuKind
72
+ code: string
73
+ title: string
74
+ path?: string
75
+ componentKey?: string
76
+ icon?: string
77
+ permission?: string
78
+ order: number
79
+ status: 'active' | 'suspended'
80
+ visible: boolean
81
+ cache: boolean
82
+ tabHidden: boolean
83
+ redirect?: string
84
+ children?: readonly RbacMenuNode[]
85
+ }
86
+
87
+ function readRbacMenuNode(value: unknown, index: string): RbacMenuNode {
88
+ if (!isRecord(value)) throw new TypeError(`Invalid RBAC menu at ${index}`)
89
+
90
+ const kind = value.kind
91
+ if (
92
+ typeof value.id !== 'string' ||
93
+ !value.id ||
94
+ (kind !== 'directory' && kind !== 'page' && kind !== 'button') ||
95
+ typeof value.code !== 'string' ||
96
+ !value.code ||
97
+ typeof value.title !== 'string' ||
98
+ !value.title ||
99
+ typeof value.order !== 'number' ||
100
+ !Number.isFinite(value.order) ||
101
+ (value.status !== 'active' && value.status !== 'suspended') ||
102
+ typeof value.visible !== 'boolean' ||
103
+ typeof value.cache !== 'boolean' ||
104
+ typeof value.tabHidden !== 'boolean'
105
+ ) {
106
+ throw new TypeError(`Invalid RBAC menu fields at ${index}`)
107
+ }
108
+ if (value.parentId !== undefined && (typeof value.parentId !== 'string' || !value.parentId))
109
+ throw new TypeError(`Invalid RBAC menu parent at ${index}`)
110
+ if (value.path !== undefined && typeof value.path !== 'string')
111
+ throw new TypeError(`Invalid RBAC menu path at ${index}`)
112
+ if (value.children !== undefined && !Array.isArray(value.children))
113
+ throw new TypeError(`Invalid RBAC menu children at ${index}`)
114
+
115
+ return {
116
+ id: value.id,
117
+ parentId: value.parentId,
118
+ kind,
119
+ code: value.code,
120
+ title: value.title,
121
+ path: value.path,
122
+ componentKey: typeof value.componentKey === 'string' ? value.componentKey : undefined,
123
+ icon: typeof value.icon === 'string' ? value.icon : undefined,
124
+ permission:
125
+ typeof value.permission === 'string' && value.permission ? value.permission : undefined,
126
+ order: value.order,
127
+ status: value.status,
128
+ visible: value.visible,
129
+ cache: value.cache,
130
+ tabHidden: value.tabHidden,
131
+ redirect: typeof value.redirect === 'string' ? value.redirect : undefined,
132
+ children: value.children?.map((child, childIndex) =>
133
+ readRbacMenuNode(child, `${index}.children[${childIndex}]`),
134
+ ),
135
+ }
136
+ }
137
+
138
+ function parseRbacMenuPage(value: Record<string, unknown>): readonly BackendMenuNode[] {
139
+ if (
140
+ !Array.isArray(value.list) ||
141
+ typeof value.total !== 'number' ||
142
+ typeof value.page !== 'number' ||
143
+ typeof value.pageSize !== 'number'
144
+ ) {
145
+ throw new TypeError('Menu page response must contain list, total, page, and pageSize.')
146
+ }
147
+
148
+ const menus: RbacMenuNode[] = []
149
+ function collect(nodes: readonly RbacMenuNode[], inheritedParentId: string | undefined): void {
150
+ for (const node of nodes) {
151
+ const parentId = node.parentId ?? inheritedParentId
152
+ menus.push(parentId === node.parentId ? node : { ...node, parentId })
153
+ if (node.children) collect(node.children, node.id)
154
+ }
155
+ }
156
+ collect(
157
+ value.list.map((row, index) => readRbacMenuNode(row, `menus.list[${index}]`)),
158
+ undefined,
159
+ )
160
+
161
+ const byId = new Map<string, RbacMenuNode>()
162
+ for (const menu of menus) {
163
+ if (byId.has(menu.id)) throw new TypeError(`Duplicate RBAC menu id: ${menu.id}`)
164
+ byId.set(menu.id, menu)
165
+ }
166
+
167
+ const included = new Map<string, BackendMenuNode>()
168
+ function include(menu: RbacMenuNode, visiting = new Set<string>()): BackendMenuNode | undefined {
169
+ if (menu.status !== 'active' || menu.kind === 'button') return undefined
170
+ if (!menu.path) throw new TypeError(`Missing route path for RBAC menu: ${menu.id}`)
171
+ if (visiting.has(menu.id))
172
+ throw new TypeError(`Circular RBAC menu parent relationship: ${menu.id}`)
173
+
174
+ const cached = included.get(menu.id)
175
+ if (cached) return cached
176
+
177
+ const parent = menu.parentId ? byId.get(menu.parentId) : undefined
178
+ if (menu.parentId && !parent) throw new TypeError(`Unknown RBAC menu parent: ${menu.parentId}`)
179
+ const parentNode = parent ? include(parent, new Set([...visiting, menu.id])) : undefined
180
+ if (parent && !parentNode) return undefined
181
+
182
+ const mapped: BackendMenuNode = {
183
+ code: menu.code,
184
+ path: menu.path,
185
+ title: menu.title,
186
+ componentKey: menu.componentKey,
187
+ icon: menu.icon,
188
+ permissions: menu.permission ? [menu.permission] : undefined,
189
+ parentPath: parentNode?.path,
190
+ menu: menu.visible,
191
+ hidden: !menu.visible,
192
+ order: menu.order,
193
+ cache: menu.cache,
194
+ tabHidden: menu.tabHidden,
195
+ redirect: menu.redirect,
196
+ }
197
+ included.set(menu.id, mapped)
198
+ return mapped
199
+ }
200
+
201
+ for (const menu of menus) include(menu)
202
+ return menus.flatMap((menu) => {
203
+ const mapped = included.get(menu.id)
204
+ return mapped ? [mapped] : []
205
+ })
206
+ }
207
+
208
+ export function parseMenuResponse(value: unknown): readonly BackendMenuNode[] {
209
+ if (isRecord(value) && Object.hasOwn(value, 'list')) return parseRbacMenuPage(value)
210
+ const rows = Array.isArray(value)
211
+ ? value
212
+ : isRecord(value) && Array.isArray(value.items)
213
+ ? value.items
214
+ : undefined
215
+ if (!rows)
216
+ throw new TypeError('Menu response must be an array, contain items, or be a menu page.')
217
+ return rows.map((row, index) => readNode(row, `menus[${index}]`))
218
+ }
219
+
220
+ export async function fetchMenus(
221
+ context: { signal: AbortSignal } = { signal: new AbortController().signal },
222
+ ): Promise<readonly BackendMenuNode[]> {
223
+ const request = (page: number, pageSize: number) =>
224
+ apiClient.get<unknown>('/system/menus', {
225
+ params: { page, pageSize },
226
+ signal: context.signal,
227
+ retry: 0,
228
+ silent: true,
229
+ })
230
+ const firstResponse = await request(1, 100)
231
+ const firstPage = readMenuPageResponse(firstResponse)
232
+ if (!firstPage) return parseMenuResponse(firstResponse)
233
+ if (firstPage.page !== 1)
234
+ throw new TypeError('Menu response did not return the requested first page.')
235
+ if (
236
+ (firstPage.total === 0 && firstPage.list.length > 0) ||
237
+ (firstPage.total > 0 && firstPage.list.length === 0) ||
238
+ firstPage.list.length > firstPage.pageSize
239
+ ) {
240
+ throw new TypeError('Menu response has inconsistent first-page data.')
241
+ }
242
+
243
+ const pageCount = Math.ceil(firstPage.total / firstPage.pageSize)
244
+ if (pageCount <= 1) return parseMenuResponse(firstResponse)
245
+
246
+ const responses = await Promise.all(
247
+ Array.from({ length: pageCount - 1 }, (_, index) => request(index + 2, firstPage.pageSize)),
248
+ )
249
+ const pages = responses.map((response, index) => {
250
+ const expectedPage = index + 2
251
+ const page = readMenuPageResponse(response)
252
+ if (!page) throw new TypeError(`Menu response page ${expectedPage} is not paginated.`)
253
+ if (
254
+ page.page !== expectedPage ||
255
+ page.pageSize !== firstPage.pageSize ||
256
+ page.total !== firstPage.total ||
257
+ page.list.length === 0 ||
258
+ page.list.length > page.pageSize
259
+ ) {
260
+ throw new TypeError(
261
+ `Menu response page ${expectedPage} has inconsistent pagination metadata.`,
262
+ )
263
+ }
264
+ return page
265
+ })
266
+ const rows = [...firstPage.list, ...pages.flatMap((page) => page.list)]
267
+ return parseMenuResponse({ list: rows, total: rows.length, page: 1, pageSize: rows.length || 1 })
268
+ }
@@ -0,0 +1,17 @@
1
+ /** Internal menu contract shared by route bootstrap and feature modules. */
2
+ export interface BackendMenuNode {
3
+ code: string
4
+ path: string
5
+ title: string
6
+ componentKey?: string
7
+ icon?: string
8
+ permissions?: readonly string[]
9
+ parentPath?: string
10
+ menu?: boolean
11
+ hidden?: boolean
12
+ order?: number
13
+ cache?: boolean
14
+ tabHidden?: boolean
15
+ redirect?: string
16
+ children?: readonly BackendMenuNode[]
17
+ }
@@ -0,0 +1,14 @@
1
+ import { describe, expect, it } from 'vitest'
2
+ import { resolveAdminLocale, resolveAdminOrigenUiLocale } from './origenUiLocale'
3
+
4
+ describe('admin Origen UI locale', () => {
5
+ it('resolves zh-CN and en-US for every component namespace', () => {
6
+ expect(resolveAdminLocale('zh-CN')).toBe('zh-CN')
7
+ expect(resolveAdminOrigenUiLocale('zh-CN').tabs?.close).toBe('关闭页签')
8
+ expect(resolveAdminOrigenUiLocale('en-US').tabs?.close).toBe('Close tab')
9
+ })
10
+
11
+ it('falls back unknown locales to zh-CN', () => {
12
+ expect(resolveAdminLocale('fr-FR')).toBe('zh-CN')
13
+ })
14
+ })
@@ -0,0 +1,65 @@
1
+ import type { DeepPartial } from '@origen-ui/shared'
2
+ import type { OrigenUiMessages } from 'origen-ui'
3
+ import {
4
+ OG_DIALOG_LOCALE_EN_US,
5
+ OG_DIALOG_LOCALE_ZH_CN,
6
+ OG_DIALOG_LOCALE_ZH_TW,
7
+ } from '@origen-ui/dialog/runtime'
8
+ import {
9
+ OG_FORM_LOCALE_EN_US,
10
+ OG_FORM_LOCALE_ZH_CN,
11
+ OG_FORM_LOCALE_ZH_TW,
12
+ } from '@origen-ui/form/runtime'
13
+ import {
14
+ OG_SEARCH_LOCALE_EN_US,
15
+ OG_SEARCH_LOCALE_ZH_CN,
16
+ OG_SEARCH_LOCALE_ZH_TW,
17
+ } from '@origen-ui/search/runtime'
18
+ import {
19
+ OG_TABLE_LOCALE_EN_US,
20
+ OG_TABLE_LOCALE_ZH_CN,
21
+ OG_TABLE_LOCALE_ZH_TW,
22
+ } from '@origen-ui/table/runtime'
23
+ import {
24
+ OG_TABS_LOCALE_EN_US,
25
+ OG_TABS_LOCALE_ZH_CN,
26
+ OG_TABS_LOCALE_ZH_TW,
27
+ } from '@origen-ui/tabs/runtime'
28
+
29
+ export type AdminLocale = 'zh-CN' | 'en-US' | 'zh-TW'
30
+ export type OrigenUiLocaleBundle = DeepPartial<OrigenUiMessages>
31
+
32
+ /** Resolves every component namespace from the same locale selected for vue-i18n. */
33
+ export function resolveAdminLocale(locale: string | undefined): AdminLocale {
34
+ if (locale === 'en-US') return 'en-US'
35
+ if (locale === 'zh-TW') return 'zh-TW'
36
+ return 'zh-CN'
37
+ }
38
+
39
+ export function resolveAdminOrigenUiLocale(locale: string | undefined): OrigenUiLocaleBundle {
40
+ if (resolveAdminLocale(locale) === 'en-US') {
41
+ return {
42
+ dialog: OG_DIALOG_LOCALE_EN_US,
43
+ form: OG_FORM_LOCALE_EN_US,
44
+ search: OG_SEARCH_LOCALE_EN_US,
45
+ table: OG_TABLE_LOCALE_EN_US,
46
+ tabs: OG_TABS_LOCALE_EN_US,
47
+ }
48
+ }
49
+ if (resolveAdminLocale(locale) === 'zh-TW') {
50
+ return {
51
+ dialog: OG_DIALOG_LOCALE_ZH_TW,
52
+ form: OG_FORM_LOCALE_ZH_TW,
53
+ search: OG_SEARCH_LOCALE_ZH_TW,
54
+ table: OG_TABLE_LOCALE_ZH_TW,
55
+ tabs: OG_TABS_LOCALE_ZH_TW,
56
+ }
57
+ }
58
+ return {
59
+ dialog: OG_DIALOG_LOCALE_ZH_CN,
60
+ form: OG_FORM_LOCALE_ZH_CN,
61
+ search: OG_SEARCH_LOCALE_ZH_CN,
62
+ table: OG_TABLE_LOCALE_ZH_CN,
63
+ tabs: OG_TABS_LOCALE_ZH_CN,
64
+ }
65
+ }
@@ -0,0 +1,9 @@
1
+ import { createCodePermission } from '@origen-ui/permission/codes'
2
+ import { useAuthStore } from '../features/auth/store/auth'
3
+ import { pinia } from '../store'
4
+
5
+ /** The app only supplies a code source; matching semantics live in the reusable permission package. */
6
+ export const permission = createCodePermission({
7
+ granted: () => useAuthStore(pinia).session?.permissions,
8
+ revision: () => useAuthStore(pinia).session?.authorizationRevision,
9
+ })
@@ -0,0 +1,77 @@
1
+ import type { CreateOgDialogOptions } from '@origen-ui/dialog'
2
+ import type { OgFormGlobalConfig } from '@origen-ui/form'
3
+ import type { OgSearchGlobalConfig } from '@origen-ui/search'
4
+ import type { CreateOgTableOptions } from '@origen-ui/table'
5
+ import type { OgTabsGlobalConfig } from '@origen-ui/tabs'
6
+ import type { OrigenUiLocaleBundle } from './origenUiLocale'
7
+ import { resolveAdminLocale, resolveAdminOrigenUiLocale } from './origenUiLocale'
8
+
9
+ export interface AdminRuntimeConfig {
10
+ http: {
11
+ baseURL: string
12
+ refreshPath: string
13
+ responseSuccessCode: number
14
+ retry: number
15
+ refreshRetry: number
16
+ timeout: number
17
+ tokenKey: string
18
+ profileKey: string
19
+ csrfCookieName: string
20
+ csrfHeaderName: string
21
+ refreshBusinessCodes: readonly number[]
22
+ }
23
+ locale: { default: 'zh-CN' | 'en-US' | 'zh-TW', fallback: 'zh-CN' | 'en-US' | 'zh-TW' }
24
+ router: { workspace: { enabled: boolean, key: string, scope: string, version: number } }
25
+ origenUi: {
26
+ size: 'small' | 'default' | 'large'
27
+ locale: OrigenUiLocaleBundle
28
+ dialog: CreateOgDialogOptions
29
+ form: OgFormGlobalConfig
30
+ search: OgSearchGlobalConfig
31
+ table: CreateOgTableOptions
32
+ tabs: OgTabsGlobalConfig
33
+ }
34
+ }
35
+
36
+ const configuredLocale = resolveAdminLocale(import.meta.env.VITE_DEFAULT_LOCALE)
37
+
38
+ export const appRuntimeConfig: AdminRuntimeConfig = {
39
+ http: {
40
+ baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
41
+ refreshPath: '/auth/refresh',
42
+ responseSuccessCode: 0,
43
+ retry: 1,
44
+ refreshRetry: 0,
45
+ timeout: 30_000,
46
+ tokenKey: 'og-admin-access-token',
47
+ profileKey: 'og-admin-profile',
48
+ csrfCookieName: 'XSRF-TOKEN',
49
+ csrfHeaderName: 'X-CSRF-Token',
50
+ refreshBusinessCodes: [401, 40101],
51
+ },
52
+ locale: {
53
+ default: configuredLocale,
54
+ fallback: 'en-US',
55
+ },
56
+ router: {
57
+ workspace: {
58
+ enabled: true,
59
+ key: 'og-admin-workspace',
60
+ scope: 'admin',
61
+ version: 2,
62
+ },
63
+ },
64
+ origenUi: {
65
+ size: 'default',
66
+ locale: resolveAdminOrigenUiLocale(configuredLocale),
67
+ dialog: {},
68
+ form: {},
69
+ search: {},
70
+ table: {
71
+ config: {
72
+ state: { filterMemory: { enabled: false } },
73
+ },
74
+ },
75
+ tabs: {},
76
+ },
77
+ }
@@ -0,0 +1,167 @@
1
+ import { describe, expect, it } from 'vitest'
2
+ import { createDemoApi } from '../scripts/demo-api'
3
+
4
+ const authorization = { authorization: 'Bearer demo-admin-token' }
5
+
6
+ function request(
7
+ api: ReturnType<typeof createDemoApi>,
8
+ method: string,
9
+ path: string,
10
+ body?: unknown,
11
+ query = '',
12
+ ) {
13
+ return api.handle({
14
+ method,
15
+ path,
16
+ body,
17
+ headers: authorization,
18
+ query: new URLSearchParams(query),
19
+ })
20
+ }
21
+
22
+ function data<T>(response: ReturnType<ReturnType<typeof createDemoApi>['handle']>): T {
23
+ expect(response.status).toBe(200)
24
+ expect(response.body.code).toBe(0)
25
+ return response.body.data as T
26
+ }
27
+
28
+ describe('admin demo API', () => {
29
+ it('uses the production envelope and fixed demo credentials', () => {
30
+ const api = createDemoApi()
31
+ expect(
32
+ api.handle({
33
+ method: 'POST',
34
+ path: '/api/auth/login',
35
+ body: { username: 'admin', password: 'wrong' },
36
+ }).body,
37
+ ).toMatchObject({ code: 40101, data: null })
38
+ const login = data<{
39
+ accessToken: string
40
+ permissions: string[]
41
+ authorizationRevision: number
42
+ }>(
43
+ api.handle({
44
+ method: 'POST',
45
+ path: '/auth/login',
46
+ body: { username: 'admin', password: 'admin123' },
47
+ }),
48
+ )
49
+ expect(login.accessToken).toBe('demo-admin-token')
50
+ expect(login.permissions).toContain('*')
51
+ expect(login.authorizationRevision).toBe(1)
52
+ expect(api.handle({ method: 'GET', path: '/auth/profile' }).body.code).toBe(40101)
53
+ expect(
54
+ data<{ user: { username: string } }>(request(api, 'GET', '/auth/profile')).user.username,
55
+ ).toBe('admin')
56
+ expect(
57
+ data<{ token: string }>(
58
+ api.handle({
59
+ method: 'POST',
60
+ path: '/auth/refresh',
61
+ body: { refreshToken: 'demo-admin-refresh-token' },
62
+ }),
63
+ ).token,
64
+ ).toBe('demo-admin-token')
65
+ })
66
+
67
+ it('filters and paginates users and applies CRUD and status mutations in memory', () => {
68
+ const api = createDemoApi()
69
+ const created = data<{ id: string, username: string }>(
70
+ request(api, 'POST', '/system/users', {
71
+ name: 'New User',
72
+ email: 'new@example.test',
73
+ department: 'Platform',
74
+ roleIds: ['role-admin'],
75
+ status: 'active',
76
+ }),
77
+ )
78
+ expect(created.username).toBe('new')
79
+ const page = data<{
80
+ list: Array<{ id: string }>
81
+ total: number
82
+ page: number
83
+ pageSize: number
84
+ }>(request(api, 'GET', '/system/users', undefined, 'keyword=New&page=1&pageSize=1'))
85
+ expect(page).toMatchObject({ total: 1, page: 1, pageSize: 1 })
86
+ expect(page.list[0]?.id).toBe(created.id)
87
+ data(request(api, 'PATCH', '/system/users/status', { ids: [created.id], status: 'suspended' }))
88
+ expect(
89
+ data<{ status: string }>(request(api, 'GET', `/system/users/${created.id}`)).status,
90
+ ).toBe('suspended')
91
+ data(request(api, 'DELETE', '/system/users', { ids: [created.id] }))
92
+ expect(
93
+ data<{ total: number }>(request(api, 'GET', '/system/users', undefined, 'keyword=New')).total,
94
+ ).toBe(0)
95
+ })
96
+
97
+ it('keeps roles, menus, revisions, and audit records consistent after mutations', () => {
98
+ const api = createDemoApi()
99
+ const role = data<{ id: string }>(
100
+ request(api, 'POST', '/system/roles', {
101
+ name: 'Reviewer',
102
+ code: 'reviewer',
103
+ description: 'Reviews records.',
104
+ permissions: ['system:audit:read'],
105
+ status: 'active',
106
+ }),
107
+ )
108
+ expect(
109
+ data<Array<{ id: string }>>(request(api, 'GET', '/system/roles/options')).some(
110
+ (item) => item.id === role.id,
111
+ ),
112
+ ).toBe(true)
113
+ const menu = data<{ id: string }>(
114
+ request(api, 'POST', '/system/menus', {
115
+ parentId: 'menu-system',
116
+ kind: 'page',
117
+ code: 'demo-page',
118
+ title: 'Demo page',
119
+ path: 'demo-page',
120
+ componentKey: 'empty',
121
+ permission: 'system:audit:read',
122
+ order: 50,
123
+ status: 'active',
124
+ visible: true,
125
+ cache: false,
126
+ tabHidden: false,
127
+ }),
128
+ )
129
+ const menus = data<{ list: Array<{ id: string, children?: Array<{ id: string }> }> }>(
130
+ request(api, 'GET', '/system/menus', undefined, 'page=1&pageSize=100'),
131
+ )
132
+ expect(
133
+ menus.list.flatMap((item) => [item.id, ...(item.children?.map((child) => child.id) ?? [])]),
134
+ ).toContain(menu.id)
135
+ data(request(api, 'PATCH', '/system/menus/status', { ids: [menu.id], status: 'suspended' }))
136
+ const revision = data<{ revision: number }>(
137
+ request(api, 'GET', '/system/rbac/revision'),
138
+ ).revision
139
+ expect(revision).toBeGreaterThan(1)
140
+ const summary = data<{ auditCount: number, revision: number }>(
141
+ request(api, 'GET', '/system/rbac/summary'),
142
+ )
143
+ expect(summary).toMatchObject({ revision })
144
+ expect(summary.auditCount).toBeGreaterThanOrEqual(3)
145
+ expect(
146
+ data<{ list: Array<{ targetId: string }> }>(
147
+ request(api, 'GET', '/system/audit', undefined, 'targetType=menu'),
148
+ ).list.some((event) => event.targetId === menu.id),
149
+ ).toBe(true)
150
+ })
151
+
152
+ it('resets mutations when a new demo server instance is created', () => {
153
+ const first = createDemoApi()
154
+ data(
155
+ request(first, 'POST', '/system/roles', {
156
+ name: 'Temporary',
157
+ code: 'temporary',
158
+ description: 'Reset check.',
159
+ permissions: ['system:audit:read'],
160
+ status: 'active',
161
+ }),
162
+ )
163
+ expect(data<{ total: number }>(request(first, 'GET', '/system/roles')).total).toBe(3)
164
+ const restarted = createDemoApi()
165
+ expect(data<{ total: number }>(request(restarted, 'GET', '/system/roles')).total).toBe(2)
166
+ })
167
+ })
@@ -0,0 +1,14 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ readonly VITE_API_BASE_URL?: string
5
+ readonly VITE_API_TARGET?: string
6
+ readonly VITE_DEFAULT_LOCALE?: string
7
+ readonly VITE_DEMO_LOGIN_HINT?: string
8
+ readonly VITE_ROUTE_QUERY_ENCRYPTION?: string
9
+ readonly VITE_ROUTE_QUERY_KEY?: string
10
+ }
11
+
12
+ interface ImportMeta {
13
+ readonly env: ImportMetaEnv
14
+ }