@oj-module/cli 0.2.50 → 0.2.54

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 (130) hide show
  1. package/devkit/SKILL.md +2 -2
  2. package/devkit/manual.md +32 -25
  3. package/devkit/wecom-internal-app.md +111 -4
  4. package/package.json +2 -2
  5. package/shell-dist/assets/{index-FYt9CjFd.js → index-e_Mp2mb5.js} +5 -1
  6. package/shell-dist/assets/runtime.js +29 -5
  7. package/shell-dist/index.html +9 -12
  8. package/shell-dist/versions.json +3 -3
  9. package/src/__tests__/templates-tenant-scope.test.ts +3 -2
  10. package/src/build.ts +19 -2
  11. package/src/config.ts +9 -0
  12. package/src/contract/__tests__/client-path.test.ts +30 -0
  13. package/src/contract/__tests__/emit-client.test.ts +18 -0
  14. package/src/contract/__tests__/handler-scan.test.ts +23 -0
  15. package/src/contract/check.ts +5 -5
  16. package/src/contract/client-path.ts +30 -0
  17. package/src/contract/emit-client.ts +18 -4
  18. package/src/contract/handler-scan.ts +40 -3
  19. package/src/contract/run.ts +5 -3
  20. package/src/init.ts +19 -1
  21. package/src/shared-deps.ts +27 -9
  22. package/src/site-base.ts +1 -1
  23. package/templates/README.md +40 -44
  24. package/templates/init.include.yaml +15 -14
  25. package/templates/openapi.json +3422 -1955
  26. package/templates/src/_platform/api/_shared/service/domain/users.ts +40 -4
  27. package/templates/src/_platform/api/contacts/api.ts +29 -1
  28. package/templates/src/_platform/api/contacts/detail/api.ts +25 -1
  29. package/templates/src/_platform/api/solutions/api.ts +60 -1
  30. package/templates/src/_platform/web/__client/api.schemas.ts +99 -35
  31. package/templates/src/_platform/web/__client/api.ts +103 -59
  32. package/templates/src/app/web/entry.ts +77 -0
  33. package/templates/src/{home/web → app/web/home}/__client/api.ts +5 -2
  34. package/templates/src/app/web/home/routes.ts +41 -0
  35. package/templates/src/{login/web → app/web/login}/pages/login.tsx +54 -24
  36. package/templates/src/app/web/login/routes.ts +71 -0
  37. package/templates/src/{notification/web → app/web/notification}/__client/api.schemas.ts +14 -0
  38. package/templates/src/{notification/web → app/web/notification}/__client/api.ts +67 -20
  39. package/templates/src/app/web/notification/routes.ts +70 -0
  40. package/templates/src/{personal-center/web → app/web/personal-center}/__client/api.ts +5 -2
  41. package/templates/src/app/web/personal-center/routes.ts +49 -0
  42. package/templates/src/{system/web → app/web/system}/__client/api.schemas.ts +28 -22
  43. package/templates/src/{system/web → app/web/system}/__client/api.ts +103 -58
  44. package/templates/src/{system/web → app/web/system}/locales/en-US.json +14 -0
  45. package/templates/src/{system/web → app/web/system}/locales/zh-CN.json +14 -0
  46. package/templates/src/{system/web → app/web/system}/pages/users/index.tsx +5 -2
  47. package/templates/src/{system/web → app/web/system}/pages/users/roles.tsx +14 -3
  48. package/templates/src/{system/web → app/web/system}/pages/wecom/index.tsx +139 -1
  49. package/templates/src/app/web/system/routes.ts +97 -0
  50. package/templates/src/auth/api/_shared/wecom/admin.ts +4 -0
  51. package/templates/src/auth/api/_shared/wecom/client.ts +9 -2
  52. package/templates/src/auth/api/_shared/wecom/events.ts +3 -0
  53. package/templates/src/auth/api/_shared/wecom/tenant-admin.ts +194 -0
  54. package/templates/src/auth/api/api.ts +59 -0
  55. package/templates/src/auth/api/ldap-login/api.ts +37 -1
  56. package/templates/src/auth/api/wecom/admin/tenant-admin/api.ts +41 -0
  57. package/templates/src/auth/api/wecom/admin/tenant-admin/password/api.ts +66 -0
  58. package/templates/src/auth/api/wecom/api.ts +23 -0
  59. package/templates/src/auth/web/__client/api.schemas.ts +133 -13
  60. package/templates/src/auth/web/__client/api.ts +129 -31
  61. package/templates/src/notification/api/api.ts +17 -0
  62. package/templates/src/notification/api/del/api.ts +2 -0
  63. package/templates/src/system/api/roles/api.ts +3 -0
  64. package/templates/src/system/api/roles/bindings/api.ts +3 -0
  65. package/templates/src/system/api/settings/api.ts +6 -3
  66. package/templates/src/system/api/users/forbidden/api.ts +3 -0
  67. package/templates/src/system/api/users/password/api.ts +3 -0
  68. package/templates/src/system/api/users/roles/api.ts +3 -0
  69. package/templates/src/web/api/get-async-routes/api.ts +16 -1
  70. package/templates/src/web/api/hello/api.ts +13 -1
  71. package/templates/src/web/api/user-info/api.ts +21 -1
  72. package/templates/src/web/web/__client/api.schemas.ts +28 -0
  73. package/templates/src/web/web/__client/api.ts +33 -9
  74. package/templates/tsconfig.paths.json +0 -1
  75. package/templates/web.config.ts +22 -17
  76. package/vendor/host-versions.json +3 -3
  77. package/shell-dist/assets/echarts-charts.js +0 -58571
  78. package/shell-dist/assets/echarts-features.js +0 -24057
  79. package/shell-dist/assets/echarts-for-react.js +0 -704
  80. package/shell-dist/assets/echarts.js +0 -82916
  81. package/shell-dist/assets/editor.js +0 -161457
  82. package/shell-dist/assets/vditor-index-css.js +0 -7
  83. package/shell-dist/assets/vditor.js +0 -15223
  84. package/templates/src/demo/api/manifest.yaml +0 -5
  85. package/templates/src/demo/api/migrations/0001__create_todos.sql +0 -9
  86. package/templates/src/demo/api/migrations/0002__tenant.mysql.sql +0 -2
  87. package/templates/src/demo/api/migrations/0002__tenant.sql +0 -2
  88. package/templates/src/demo/api/schema.yaml +0 -12
  89. package/templates/src/demo/api/seed.sql +0 -5
  90. package/templates/src/demo/api/todos/api.ts +0 -59
  91. package/templates/src/demo/web/__client/api.schemas.ts +0 -20
  92. package/templates/src/demo/web/__client/api.ts +0 -89
  93. package/templates/src/demo/web/entry.ts +0 -42
  94. package/templates/src/demo/web/locales/en-US.json +0 -10
  95. package/templates/src/demo/web/locales/zh-CN.json +0 -10
  96. package/templates/src/demo/web/pages/index.tsx +0 -45
  97. package/templates/src/home/web/entry.ts +0 -49
  98. package/templates/src/login/web/entry.ts +0 -79
  99. package/templates/src/notification/web/entry.ts +0 -84
  100. package/templates/src/personal-center/web/entry.ts +0 -60
  101. package/templates/src/system/web/entry.ts +0 -108
  102. /package/templates/src/{home/web → app/web/home}/__client/api.schemas.ts +0 -0
  103. /package/templates/src/{home/web → app/web/home}/locales/en-US.json +0 -0
  104. /package/templates/src/{home/web → app/web/home}/locales/zh-CN.json +0 -0
  105. /package/templates/src/{home/web → app/web/home}/pages/components/bar-chart.tsx +0 -0
  106. /package/templates/src/{home/web → app/web/home}/pages/components/card-list.tsx +0 -0
  107. /package/templates/src/{home/web → app/web/home}/pages/components/line-chart.tsx +0 -0
  108. /package/templates/src/{home/web → app/web/home}/pages/components/pie-chart.tsx +0 -0
  109. /package/templates/src/{home/web → app/web/home}/pages/index.tsx +0 -0
  110. /package/templates/src/{login/web → app/web/login}/auth-provider.ts +0 -0
  111. /package/templates/src/{login/web → app/web/login}/locales/en-US.json +0 -0
  112. /package/templates/src/{login/web → app/web/login}/locales/zh-CN.json +0 -0
  113. /package/templates/src/{login/web → app/web/login}/pages/change-password.tsx +0 -0
  114. /package/templates/src/{login/web → app/web/login}/wecom.ts +0 -0
  115. /package/templates/src/{notification/web → app/web/notification}/locales/en-US.json +0 -0
  116. /package/templates/src/{notification/web → app/web/notification}/locales/zh-CN.json +0 -0
  117. /package/templates/src/{notification/web → app/web/notification}/pages/center/index.tsx +0 -0
  118. /package/templates/src/{personal-center/web → app/web/personal-center}/__client/api.schemas.ts +0 -0
  119. /package/templates/src/{personal-center/web → app/web/personal-center}/locales/en-US.json +0 -0
  120. /package/templates/src/{personal-center/web → app/web/personal-center}/locales/zh-CN.json +0 -0
  121. /package/templates/src/{personal-center/web → app/web/personal-center}/pages/my-profile/index.tsx +0 -0
  122. /package/templates/src/{system/web → app/web/system}/pages/departments/index.tsx +0 -0
  123. /package/templates/src/{system/web → app/web/system}/pages/departments/sync-bar.tsx +0 -0
  124. /package/templates/src/{system/web → app/web/system}/pages/departments/tree.ts +0 -0
  125. /package/templates/src/{system/web → app/web/system}/pages/errors.ts +0 -0
  126. /package/templates/src/{system/web → app/web/system}/pages/forbidden.tsx +0 -0
  127. /package/templates/src/{system/web → app/web/system}/pages/login-methods/index.tsx +0 -0
  128. /package/templates/src/{system/web → app/web/system}/pages/oplog/index.tsx +0 -0
  129. /package/templates/src/{system/web → app/web/system}/pages/roles/index.tsx +0 -0
  130. /package/templates/src/{system/web → app/web/system}/pages/settings/index.tsx +0 -0
@@ -1,108 +0,0 @@
1
- import type { AppRouteRecordRaw } from "@oj-module/runtime";
2
-
3
- import { SettingOutlined } from "@ant-design/icons";
4
- import { defineModule } from "@oj-module/runtime";
5
-
6
- import { createElement, lazy } from "react";
7
-
8
- import { createSystemClient } from "./__client/api";
9
-
10
- const Users = lazy(() => import("./pages/users"));
11
- const UserRoles = lazy(() => import("./pages/users/roles"));
12
- const Departments = lazy(() => import("./pages/departments"));
13
- const Roles = lazy(() => import("./pages/roles"));
14
- const Oplog = lazy(() => import("./pages/oplog"));
15
- const Settings = lazy(() => import("./pages/settings"));
16
- const LoginMethods = lazy(() => import("./pages/login-methods"));
17
- const WecomAdmin = lazy(() => import("./pages/wecom"));
18
-
19
- const routes: AppRouteRecordRaw[] = [
20
- {
21
- path: "/system",
22
- handle: {
23
- icon: createElement(SettingOutlined),
24
- title: "system:menu.system",
25
- // 负 order = 底部固定区:系统管理 pin 在侧边栏底部(2026-10-20 序轴约定)
26
- order: -100,
27
- layout: "container",
28
- },
29
- children: [
30
- {
31
- path: "/system/users",
32
- Component: Users,
33
- handle: { title: "system:menu.users" },
34
- },
35
- {
36
- // 成员资格(superadmin 入口从用户管理页进入,菜单不出现)
37
- path: "/system/users/:uid/roles",
38
- Component: UserRoles,
39
- handle: { title: "system:menu.userRoles", hideInMenu: true },
40
- },
41
- {
42
- path: "/system/departments",
43
- Component: Departments,
44
- handle: { title: "system:menu.departments" },
45
- },
46
- {
47
- path: "/system/roles",
48
- Component: Roles,
49
- handle: { title: "system:menu.roles" },
50
- },
51
- {
52
- path: "/system/oplog",
53
- Component: Oplog,
54
- handle: { title: "system:menu.oplog" },
55
- },
56
- {
57
- path: "/system/settings",
58
- Component: Settings,
59
- handle: { title: "system:menu.settings" },
60
- },
61
- {
62
- path: "/system/login-methods",
63
- Component: LoginMethods,
64
- handle: { title: "system:menu.loginMethods" },
65
- },
66
- {
67
- // 企微代开发后台(服务商运营面):页面内再判一次 superadmin(路由级不做角色门禁,
68
- // 与 users/roles 页同策略——403 面板比路由消失更容易解释)
69
- path: "/system/wecom",
70
- Component: WecomAdmin,
71
- handle: { title: "system:menu.wecom" },
72
- },
73
- ],
74
- },
75
- ];
76
-
77
- /**
78
- * system 模块:框架管理面(用户/成员资格/角色权限/操作日志/站点设置/登录方式),
79
- * 数据源为 oj 后端 /api/system/*(模板 api 模块)。__client 不随模板分发——
80
- * init 后 `oj openapi -o openapi.json` + `ojm api` 生成(生成前本文件 ts 报红属预期,
81
- * devkit manual §2.2)。
82
- */
83
- export default defineModule({
84
- name: "system",
85
- description: "系统管理模块(框架管理面)",
86
- version: "0.1.0",
87
- peerRuntime: ">=0.0.0",
88
- // 路由级门禁(B16):非系统管理员不注入 /system 路由、菜单不可见;
89
- // API 级 403 由 assertSystemAdmin + service 层硬 enforcement 兜底。
90
- // 角色口径对齐后端 assertSystemAdmin(access.ts:87)——superadmin **或**
91
- // admin 均可,两者必须同时保留:D12(2026-10-22)起账号名=角色名,admin 与
92
- // superadmin 是两个独立账号(seed.sql),只留 ["admin"] 会把 superadmin 挡在
93
- // 门外(注册期过滤 → 路由消失 → 登录后 404 兜底)。改这两个值前先跑
94
- // tests/system-guard.regression.spec.ts(只留 ["admin"] 会立刻变红)。
95
- config: { requiredRoles: ["admin", "superadmin"] },
96
- routes,
97
- i18n: {
98
- "zh-CN": () => import("./locales/zh-CN.json"),
99
- "en-US": () => import("./locales/en-US.json"),
100
- },
101
- lifecycle: {
102
- async onInit(ctx) {
103
- // 构造即接线:登记 /system 前缀 + 绑定 scoped request(D11 前缀收敛),
104
- // 页面直接 import 生成的端点函数(模块级单槽 req 已由本调用绑定)。
105
- createSystemClient(ctx);
106
- },
107
- },
108
- });