@yss123/cage-admin 0.0.0-stage → 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 shunshunyue and Cage contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,19 @@
1
- # Temporary Holding Version
1
+ # @yss123/cage-admin
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 组织模型声明与 /admin 系统管理
4
+
5
+ Cage 是通过 TypeScript 声明业务、由框架统一执行权限和数据规则的中后台框架。此包是框架的一部分。
6
+
7
+ ## 使用
8
+
9
+ ```powershell
10
+ pnpm add @yss123/cage-admin
11
+ ```
12
+
13
+ 首次使用建议通过脚手架创建完整项目,所需依赖由模板统一配置。需要 Node.js 24 或更新版本。
14
+
15
+ - [完整使用说明](https://github.com/shunshunyue/cage/blob/main/docs/使用说明.md)
16
+ - [框架源码与范例](https://github.com/shunshunyue/cage)
17
+ - [问题反馈](https://github.com/shunshunyue/cage/issues)
18
+
19
+ 许可证:[MIT](https://github.com/shunshunyue/cage/blob/main/LICENSE)。
@@ -0,0 +1,17 @@
1
+ import { type Kernel } from '@yss123/cage-kernel';
2
+ export interface BootstrapResult {
3
+ created: boolean;
4
+ username?: string;
5
+ password?: string;
6
+ rootDeptId?: string;
7
+ superadminRoleId?: string;
8
+ }
9
+ export declare function bootstrapOrg(k: Kernel, opts?: {
10
+ tenantId?: string;
11
+ adminUsername?: string;
12
+ adminPassword?: string;
13
+ rootDeptName?: string;
14
+ }): Promise<BootstrapResult>;
15
+ /** 把能力目录里的全部能力授给某个角色(cage dev 在声明新增命令后调用,生产环境由管理员在 /admin 操作) */
16
+ export declare function grantAll(k: Kernel, roleId: string, tenantId?: string): Promise<number>;
17
+ export declare function grantAllToSuperadmin(k: Kernel, tenantId?: string): Promise<number>;
@@ -0,0 +1,43 @@
1
+ // 初始化组织:第一次启动时建根部门、超级管理员角色和初始管理员账号。
2
+ // 超级管理员只是一个拥有全部能力、范围为 all 的角色,是数据而不是代码里的特例。
3
+ import { randomBytes } from 'node:crypto';
4
+ import { DEFAULT_TENANT, systemCtx } from '@yss123/cage-kernel';
5
+ function bootstrapCtx(k, tenantId) {
6
+ return systemCtx({ kind: 'system', name: 'bootstrap', tenantId, capabilities: k.catalogCaps() });
7
+ }
8
+ export async function bootstrapOrg(k, opts = {}) {
9
+ const tenantId = opts.tenantId ?? DEFAULT_TENANT;
10
+ const existing = await k.app.selectFrom('sys.user').select((eb) => eb.fn.countAll().as('n')).where('tenant_id', '=', tenantId).executeTakeFirst();
11
+ if (Number(existing?.n ?? 0) > 0)
12
+ return { created: false };
13
+ const ctx = bootstrapCtx(k, tenantId);
14
+ const root = await k.execute('Dept.create', { name: opts.rootDeptName ?? '总部', code: 'root' }, ctx);
15
+ const role = await k.execute('Role.create', { code: 'superadmin', name: '超级管理员' }, ctx);
16
+ await grantAll(k, role.id, tenantId);
17
+ await k.execute('Role.setScope', { id: role.id, aggregate: '*', combinator: 'all' }, ctx);
18
+ const username = opts.adminUsername ?? 'admin';
19
+ const password = opts.adminPassword ?? randomBytes(9).toString('base64url');
20
+ const user = await k.execute('User.create', { username, name: '管理员', deptId: root.id }, ctx);
21
+ await k.execute('User.assignRoles', { id: user.id, roleIds: [role.id] }, ctx);
22
+ await k.execute('User.setPassword', { id: user.id, password }, ctx);
23
+ return { created: true, username, password, rootDeptId: root.id, superadminRoleId: role.id };
24
+ }
25
+ /** 把能力目录里的全部能力授给某个角色(cage dev 在声明新增命令后调用,生产环境由管理员在 /admin 操作) */
26
+ export async function grantAll(k, roleId, tenantId = DEFAULT_TENANT) {
27
+ const ctx = bootstrapCtx(k, tenantId);
28
+ const role = await k.app.selectFrom('sys.role').select('capabilities').where('id', '=', roleId).executeTakeFirst();
29
+ const have = new Set((role?.capabilities ?? []).map((c) => c.capability));
30
+ let n = 0;
31
+ for (const cap of k.catalogCaps()) {
32
+ if (have.has(cap))
33
+ continue;
34
+ await k.execute('Role.grantCapability', { id: roleId, capability: cap, params: cap.endsWith('.approve') ? { ceiling: 1_000_000_000 } : undefined }, ctx);
35
+ n++;
36
+ }
37
+ return n;
38
+ }
39
+ export async function grantAllToSuperadmin(k, tenantId = DEFAULT_TENANT) {
40
+ const r = await k.app.selectFrom('sys.role').select('id').where('code', '=', 'superadmin').where('tenant_id', '=', tenantId).executeTakeFirst();
41
+ return r ? grantAll(k, r.id, tenantId) : 0;
42
+ }
43
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,4CAA4C;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,cAAc,EAA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9 @@
1
+ import { type Constraint } from '@yss123/cage-kernel';
2
+ /** 只能授出能力目录里存在的能力点 */
3
+ export declare const knownCapability: () => Constraint;
4
+ /** 防提权:不能授出自己没有的能力点;数值参数(额度)不能超过自己的 */
5
+ export declare const noEscalation: () => Constraint;
6
+ /** 不能授出比自己更宽的数据范围 */
7
+ export declare const noWiderScope: () => Constraint;
8
+ /** 分配角色也是授权:被分配角色里的每个能力点和范围,操作人自己都必须有 */
9
+ export declare const noEscalationViaRoles: () => Constraint;
@@ -0,0 +1,61 @@
1
+ // 授权类命令的内置硬约束:代码里不存在「管理员跳过检查」的分支,超级管理员也一样要过这些约束。
2
+ import { COMBINATOR_WIDTH, ok, violation } from '@yss123/cage-kernel';
3
+ function ownWidth(ctx, aggregate) {
4
+ const grants = ctx.scopes[aggregate] ?? ctx.scopes['*'] ?? [{ combinator: 'self' }];
5
+ return Math.max(...grants.map((g) => COMBINATOR_WIDTH[g.combinator] ?? 0));
6
+ }
7
+ /** 只能授出能力目录里存在的能力点 */
8
+ export const knownCapability = () => ({
9
+ name: 'knownCapability',
10
+ check: (_role, _ctx, input, meta) => meta.catalog().includes(input.capability) ? ok() : violation(`[CAGE-GRANT-003] 能力点 ${input.capability} 不在能力目录里`),
11
+ });
12
+ /** 防提权:不能授出自己没有的能力点;数值参数(额度)不能超过自己的 */
13
+ export const noEscalation = () => ({
14
+ name: 'noEscalation',
15
+ check: (_role, ctx, input) => {
16
+ const mine = ctx.capabilities.get(input.capability);
17
+ if (!mine)
18
+ return violation('[CAGE-GRANT-001] 不能授出自己没有的能力点');
19
+ for (const [k, v] of Object.entries(input.params ?? {})) {
20
+ if (typeof v === 'number' && typeof mine[k] === 'number' && v > mine[k]) {
21
+ return violation(`[CAGE-GRANT-001] 参数 ${k}=${v} 超过了你自己的 ${mine[k]}`);
22
+ }
23
+ }
24
+ return ok();
25
+ },
26
+ });
27
+ /** 不能授出比自己更宽的数据范围 */
28
+ export const noWiderScope = () => ({
29
+ name: 'noWiderScope',
30
+ check: (_role, ctx, input) => {
31
+ if (!input.combinator)
32
+ return ok();
33
+ const want = COMBINATOR_WIDTH[input.combinator] ?? 99;
34
+ return want <= ownWidth(ctx, input.aggregate) ? ok() : violation('[CAGE-GRANT-002] 不能授出比自己更宽的数据范围');
35
+ },
36
+ });
37
+ /** 分配角色也是授权:被分配角色里的每个能力点和范围,操作人自己都必须有 */
38
+ export const noEscalationViaRoles = () => ({
39
+ name: 'noEscalationViaRoles',
40
+ check: async (user, ctx, input, meta) => {
41
+ const before = new Set(user.roleIds ?? []);
42
+ for (const rid of input.roleIds) {
43
+ if (before.has(rid))
44
+ continue;
45
+ const role = await meta.load('Role', rid);
46
+ if (!role)
47
+ continue; // 交给 handler 报 ROLE_NOT_FOUND
48
+ for (const c of role.capabilities ?? []) {
49
+ if (!ctx.capabilities.has(c.capability))
50
+ return violation(`[CAGE-GRANT-001] 角色 ${role.code} 含有你没有的能力点 ${c.capability}`);
51
+ }
52
+ for (const s of role.scopes ?? []) {
53
+ if ((COMBINATOR_WIDTH[s.combinator] ?? 99) > ownWidth(ctx, s.aggregate)) {
54
+ return violation(`[CAGE-GRANT-002] 角色 ${role.code} 在 ${s.aggregate} 上的范围比你更宽`);
55
+ }
56
+ }
57
+ }
58
+ return ok();
59
+ },
60
+ });
61
+ //# sourceMappingURL=constraints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constraints.js","sourceRoot":"","sources":["../../src/domain/constraints.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,EAAE,gBAAgB,EAA8C,EAAE,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAElH,SAAS,QAAQ,CAAC,GAAQ,EAAE,SAAiB;IAC3C,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,MAAoB,EAAE,CAAC,CAAC;IAClG,OAAO,IAAI,CA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C,CAAC,UAAU,CAAC;oBAAE,OAAO,SAAS,CAAC,uBAAuB,IAAI,CAAC,IAAI,cAAc,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;YAC1H,CAAC;YACD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;gBAClC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAwB,CAAC,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;oBACtF,OAAO,SAAS,CAAC,uBAAuB,IAAI,CAAC,IAAI,MAAM,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC;gBACjF,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export { Dept, User, Role, createDept, updateDept, archiveDept, createUser, updateUser, assignRoles, disableUser, enableUser, setPassword, createRole, renameRole, grantCapability, revokeCapability, setScope, archiveRole, } from './org.js';
@@ -0,0 +1,5 @@
1
+ // @yss123/cage-admin/domain:框架自带的组织模型声明。业务 domain 的 index.ts 里写一行
2
+ // export * from '@yss123/cage-admin/domain';
3
+ // 抽取器、内核、HTTP 层就都能看到部门、用户、角色。
4
+ export { Dept, User, Role, createDept, updateDept, archiveDept, createUser, updateUser, assignRoles, disableUser, enableUser, setPassword, createRole, renameRole, grantCapability, revokeCapability, setScope, archiveRole, } from './org.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,+CAA+C;AAC/C,8BAA8B;AAC9B,OAAO,EACL,IAAI,EAAE,IAAI,EAAE,IAAI,EAChB,UAAU,EAAE,UAAU,EAAE,WAAW,EACnC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EACzE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,QAAQ,EAAE,WAAW,GACjF,MAAM,UAAU,CAAC"}
@@ -0,0 +1,387 @@
1
+ import { z } from 'zod';
2
+ export declare const Dept: import("@yss123/cage-kernel").Aggregate<"Dept", {
3
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
4
+ code: import("@yss123/cage-kernel").Field<z.ZodString, true>;
5
+ parentId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
6
+ ancestors: import("@yss123/cage-kernel").Field<z.ZodString, false>;
7
+ leaderId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
8
+ }, string>;
9
+ export declare const User: import("@yss123/cage-kernel").Aggregate<"User", {
10
+ username: import("@yss123/cage-kernel").Field<z.ZodString, false>;
11
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
12
+ deptId: import("@yss123/cage-kernel").Field<z.ZodString, false>;
13
+ roleIds: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodString>, false>;
14
+ phone: import("@yss123/cage-kernel").Field<z.ZodString, true>;
15
+ email: import("@yss123/cage-kernel").Field<z.ZodString, true>;
16
+ ssoSubject: import("@yss123/cage-kernel").Field<z.ZodString, true>;
17
+ passwordHash: import("@yss123/cage-kernel").Field<z.ZodString, true>;
18
+ }, string>;
19
+ export declare const Role: import("@yss123/cage-kernel").Aggregate<"Role", {
20
+ code: import("@yss123/cage-kernel").Field<z.ZodString, false>;
21
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
22
+ capabilities: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
23
+ capability: z.ZodString;
24
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
25
+ }, z.core.$strip>>, false>;
26
+ scopes: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
27
+ aggregate: z.ZodString;
28
+ combinator: z.ZodEnum<{
29
+ all: "all";
30
+ self: "self";
31
+ dept: "dept";
32
+ deptSubtree: "deptSubtree";
33
+ deptSet: "deptSet";
34
+ }>;
35
+ deptIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
36
+ }, z.core.$strip>>, false>;
37
+ }, string>;
38
+ export declare const createDept: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"Dept", {
39
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
40
+ code: import("@yss123/cage-kernel").Field<z.ZodString, true>;
41
+ parentId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
42
+ ancestors: import("@yss123/cage-kernel").Field<z.ZodString, false>;
43
+ leaderId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
44
+ }, string>, {
45
+ depts: import("@yss123/cage-kernel").Aggregate<"Dept", {
46
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
47
+ code: import("@yss123/cage-kernel").Field<z.ZodString, true>;
48
+ parentId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
49
+ ancestors: import("@yss123/cage-kernel").Field<z.ZodString, false>;
50
+ leaderId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
51
+ }, string>;
52
+ }, z.ZodObject<{
53
+ name: z.ZodString;
54
+ code: z.ZodOptional<z.ZodString>;
55
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
56
+ leaderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
+ }, z.core.$strip>>;
58
+ export declare const updateDept: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"Dept", {
59
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
60
+ code: import("@yss123/cage-kernel").Field<z.ZodString, true>;
61
+ parentId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
62
+ ancestors: import("@yss123/cage-kernel").Field<z.ZodString, false>;
63
+ leaderId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
64
+ }, string>, {}, z.ZodObject<{
65
+ id: z.ZodString;
66
+ name: z.ZodOptional<z.ZodString>;
67
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
+ leaderId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
+ }, z.core.$strip>>;
70
+ export declare const archiveDept: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"Dept", {
71
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
72
+ code: import("@yss123/cage-kernel").Field<z.ZodString, true>;
73
+ parentId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
74
+ ancestors: import("@yss123/cage-kernel").Field<z.ZodString, false>;
75
+ leaderId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
76
+ }, string>, {
77
+ users: import("@yss123/cage-kernel").Aggregate<"User", {
78
+ username: import("@yss123/cage-kernel").Field<z.ZodString, false>;
79
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
80
+ deptId: import("@yss123/cage-kernel").Field<z.ZodString, false>;
81
+ roleIds: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodString>, false>;
82
+ phone: import("@yss123/cage-kernel").Field<z.ZodString, true>;
83
+ email: import("@yss123/cage-kernel").Field<z.ZodString, true>;
84
+ ssoSubject: import("@yss123/cage-kernel").Field<z.ZodString, true>;
85
+ passwordHash: import("@yss123/cage-kernel").Field<z.ZodString, true>;
86
+ }, string>;
87
+ depts: import("@yss123/cage-kernel").Aggregate<"Dept", {
88
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
89
+ code: import("@yss123/cage-kernel").Field<z.ZodString, true>;
90
+ parentId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
91
+ ancestors: import("@yss123/cage-kernel").Field<z.ZodString, false>;
92
+ leaderId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
93
+ }, string>;
94
+ }, z.ZodObject<{
95
+ id: z.ZodString;
96
+ }, z.core.$strip>>;
97
+ export declare const createUser: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"User", {
98
+ username: import("@yss123/cage-kernel").Field<z.ZodString, false>;
99
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
100
+ deptId: import("@yss123/cage-kernel").Field<z.ZodString, false>;
101
+ roleIds: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodString>, false>;
102
+ phone: import("@yss123/cage-kernel").Field<z.ZodString, true>;
103
+ email: import("@yss123/cage-kernel").Field<z.ZodString, true>;
104
+ ssoSubject: import("@yss123/cage-kernel").Field<z.ZodString, true>;
105
+ passwordHash: import("@yss123/cage-kernel").Field<z.ZodString, true>;
106
+ }, string>, {
107
+ users: import("@yss123/cage-kernel").Aggregate<"User", {
108
+ username: import("@yss123/cage-kernel").Field<z.ZodString, false>;
109
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
110
+ deptId: import("@yss123/cage-kernel").Field<z.ZodString, false>;
111
+ roleIds: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodString>, false>;
112
+ phone: import("@yss123/cage-kernel").Field<z.ZodString, true>;
113
+ email: import("@yss123/cage-kernel").Field<z.ZodString, true>;
114
+ ssoSubject: import("@yss123/cage-kernel").Field<z.ZodString, true>;
115
+ passwordHash: import("@yss123/cage-kernel").Field<z.ZodString, true>;
116
+ }, string>;
117
+ depts: import("@yss123/cage-kernel").Aggregate<"Dept", {
118
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
119
+ code: import("@yss123/cage-kernel").Field<z.ZodString, true>;
120
+ parentId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
121
+ ancestors: import("@yss123/cage-kernel").Field<z.ZodString, false>;
122
+ leaderId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
123
+ }, string>;
124
+ }, z.ZodObject<{
125
+ ssoSubject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
126
+ name: z.ZodString;
127
+ deptId: z.ZodString;
128
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
129
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
130
+ username: z.ZodString;
131
+ }, z.core.$strip>>;
132
+ export declare const updateUser: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"User", {
133
+ username: import("@yss123/cage-kernel").Field<z.ZodString, false>;
134
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
135
+ deptId: import("@yss123/cage-kernel").Field<z.ZodString, false>;
136
+ roleIds: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodString>, false>;
137
+ phone: import("@yss123/cage-kernel").Field<z.ZodString, true>;
138
+ email: import("@yss123/cage-kernel").Field<z.ZodString, true>;
139
+ ssoSubject: import("@yss123/cage-kernel").Field<z.ZodString, true>;
140
+ passwordHash: import("@yss123/cage-kernel").Field<z.ZodString, true>;
141
+ }, string>, {
142
+ depts: import("@yss123/cage-kernel").Aggregate<"Dept", {
143
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
144
+ code: import("@yss123/cage-kernel").Field<z.ZodString, true>;
145
+ parentId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
146
+ ancestors: import("@yss123/cage-kernel").Field<z.ZodString, false>;
147
+ leaderId: import("@yss123/cage-kernel").Field<z.ZodString, true>;
148
+ }, string>;
149
+ }, z.ZodObject<{
150
+ id: z.ZodString;
151
+ name: z.ZodOptional<z.ZodString>;
152
+ deptId: z.ZodOptional<z.ZodString>;
153
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
154
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
155
+ }, z.core.$strip>>;
156
+ export declare const assignRoles: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"User", {
157
+ username: import("@yss123/cage-kernel").Field<z.ZodString, false>;
158
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
159
+ deptId: import("@yss123/cage-kernel").Field<z.ZodString, false>;
160
+ roleIds: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodString>, false>;
161
+ phone: import("@yss123/cage-kernel").Field<z.ZodString, true>;
162
+ email: import("@yss123/cage-kernel").Field<z.ZodString, true>;
163
+ ssoSubject: import("@yss123/cage-kernel").Field<z.ZodString, true>;
164
+ passwordHash: import("@yss123/cage-kernel").Field<z.ZodString, true>;
165
+ }, string>, {
166
+ roles: import("@yss123/cage-kernel").Aggregate<"Role", {
167
+ code: import("@yss123/cage-kernel").Field<z.ZodString, false>;
168
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
169
+ capabilities: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
170
+ capability: z.ZodString;
171
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
172
+ }, z.core.$strip>>, false>;
173
+ scopes: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
174
+ aggregate: z.ZodString;
175
+ combinator: z.ZodEnum<{
176
+ all: "all";
177
+ self: "self";
178
+ dept: "dept";
179
+ deptSubtree: "deptSubtree";
180
+ deptSet: "deptSet";
181
+ }>;
182
+ deptIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
183
+ }, z.core.$strip>>, false>;
184
+ }, string>;
185
+ }, z.ZodObject<{
186
+ id: z.ZodString;
187
+ roleIds: z.ZodArray<z.ZodString>;
188
+ }, z.core.$strip>>;
189
+ export declare const disableUser: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"User", {
190
+ username: import("@yss123/cage-kernel").Field<z.ZodString, false>;
191
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
192
+ deptId: import("@yss123/cage-kernel").Field<z.ZodString, false>;
193
+ roleIds: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodString>, false>;
194
+ phone: import("@yss123/cage-kernel").Field<z.ZodString, true>;
195
+ email: import("@yss123/cage-kernel").Field<z.ZodString, true>;
196
+ ssoSubject: import("@yss123/cage-kernel").Field<z.ZodString, true>;
197
+ passwordHash: import("@yss123/cage-kernel").Field<z.ZodString, true>;
198
+ }, string>, {}, z.ZodObject<{
199
+ id: z.ZodString;
200
+ }, z.core.$strip>>;
201
+ export declare const enableUser: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"User", {
202
+ username: import("@yss123/cage-kernel").Field<z.ZodString, false>;
203
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
204
+ deptId: import("@yss123/cage-kernel").Field<z.ZodString, false>;
205
+ roleIds: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodString>, false>;
206
+ phone: import("@yss123/cage-kernel").Field<z.ZodString, true>;
207
+ email: import("@yss123/cage-kernel").Field<z.ZodString, true>;
208
+ ssoSubject: import("@yss123/cage-kernel").Field<z.ZodString, true>;
209
+ passwordHash: import("@yss123/cage-kernel").Field<z.ZodString, true>;
210
+ }, string>, {}, z.ZodObject<{
211
+ id: z.ZodString;
212
+ }, z.core.$strip>>;
213
+ /** 密码哈希:scrypt$盐$哈希(纯计算,不做 IO) */
214
+ export declare function hashPassword(pw: string): string;
215
+ export declare const setPassword: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"User", {
216
+ username: import("@yss123/cage-kernel").Field<z.ZodString, false>;
217
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
218
+ deptId: import("@yss123/cage-kernel").Field<z.ZodString, false>;
219
+ roleIds: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodString>, false>;
220
+ phone: import("@yss123/cage-kernel").Field<z.ZodString, true>;
221
+ email: import("@yss123/cage-kernel").Field<z.ZodString, true>;
222
+ ssoSubject: import("@yss123/cage-kernel").Field<z.ZodString, true>;
223
+ passwordHash: import("@yss123/cage-kernel").Field<z.ZodString, true>;
224
+ }, string>, {}, z.ZodObject<{
225
+ id: z.ZodString;
226
+ password: z.ZodString;
227
+ }, z.core.$strip>>;
228
+ export declare const createRole: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"Role", {
229
+ code: import("@yss123/cage-kernel").Field<z.ZodString, false>;
230
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
231
+ capabilities: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
232
+ capability: z.ZodString;
233
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
234
+ }, z.core.$strip>>, false>;
235
+ scopes: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
236
+ aggregate: z.ZodString;
237
+ combinator: z.ZodEnum<{
238
+ all: "all";
239
+ self: "self";
240
+ dept: "dept";
241
+ deptSubtree: "deptSubtree";
242
+ deptSet: "deptSet";
243
+ }>;
244
+ deptIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
245
+ }, z.core.$strip>>, false>;
246
+ }, string>, {
247
+ roles: import("@yss123/cage-kernel").Aggregate<"Role", {
248
+ code: import("@yss123/cage-kernel").Field<z.ZodString, false>;
249
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
250
+ capabilities: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
251
+ capability: z.ZodString;
252
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
253
+ }, z.core.$strip>>, false>;
254
+ scopes: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
255
+ aggregate: z.ZodString;
256
+ combinator: z.ZodEnum<{
257
+ all: "all";
258
+ self: "self";
259
+ dept: "dept";
260
+ deptSubtree: "deptSubtree";
261
+ deptSet: "deptSet";
262
+ }>;
263
+ deptIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
264
+ }, z.core.$strip>>, false>;
265
+ }, string>;
266
+ }, z.ZodObject<{
267
+ code: z.ZodString;
268
+ name: z.ZodString;
269
+ }, z.core.$strip>>;
270
+ export declare const renameRole: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"Role", {
271
+ code: import("@yss123/cage-kernel").Field<z.ZodString, false>;
272
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
273
+ capabilities: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
274
+ capability: z.ZodString;
275
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
276
+ }, z.core.$strip>>, false>;
277
+ scopes: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
278
+ aggregate: z.ZodString;
279
+ combinator: z.ZodEnum<{
280
+ all: "all";
281
+ self: "self";
282
+ dept: "dept";
283
+ deptSubtree: "deptSubtree";
284
+ deptSet: "deptSet";
285
+ }>;
286
+ deptIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
287
+ }, z.core.$strip>>, false>;
288
+ }, string>, {}, z.ZodObject<{
289
+ id: z.ZodString;
290
+ name: z.ZodString;
291
+ }, z.core.$strip>>;
292
+ export declare const grantCapability: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"Role", {
293
+ code: import("@yss123/cage-kernel").Field<z.ZodString, false>;
294
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
295
+ capabilities: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
296
+ capability: z.ZodString;
297
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
298
+ }, z.core.$strip>>, false>;
299
+ scopes: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
300
+ aggregate: z.ZodString;
301
+ combinator: z.ZodEnum<{
302
+ all: "all";
303
+ self: "self";
304
+ dept: "dept";
305
+ deptSubtree: "deptSubtree";
306
+ deptSet: "deptSet";
307
+ }>;
308
+ deptIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
309
+ }, z.core.$strip>>, false>;
310
+ }, string>, {}, z.ZodObject<{
311
+ id: z.ZodString;
312
+ capability: z.ZodString;
313
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
314
+ }, z.core.$strip>>;
315
+ export declare const revokeCapability: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"Role", {
316
+ code: import("@yss123/cage-kernel").Field<z.ZodString, false>;
317
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
318
+ capabilities: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
319
+ capability: z.ZodString;
320
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
321
+ }, z.core.$strip>>, false>;
322
+ scopes: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
323
+ aggregate: z.ZodString;
324
+ combinator: z.ZodEnum<{
325
+ all: "all";
326
+ self: "self";
327
+ dept: "dept";
328
+ deptSubtree: "deptSubtree";
329
+ deptSet: "deptSet";
330
+ }>;
331
+ deptIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
332
+ }, z.core.$strip>>, false>;
333
+ }, string>, {}, z.ZodObject<{
334
+ id: z.ZodString;
335
+ capability: z.ZodString;
336
+ }, z.core.$strip>>;
337
+ export declare const setScope: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"Role", {
338
+ code: import("@yss123/cage-kernel").Field<z.ZodString, false>;
339
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
340
+ capabilities: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
341
+ capability: z.ZodString;
342
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
343
+ }, z.core.$strip>>, false>;
344
+ scopes: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
345
+ aggregate: z.ZodString;
346
+ combinator: z.ZodEnum<{
347
+ all: "all";
348
+ self: "self";
349
+ dept: "dept";
350
+ deptSubtree: "deptSubtree";
351
+ deptSet: "deptSet";
352
+ }>;
353
+ deptIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
354
+ }, z.core.$strip>>, false>;
355
+ }, string>, {}, z.ZodObject<{
356
+ id: z.ZodString;
357
+ aggregate: z.ZodString;
358
+ combinator: z.ZodNullable<z.ZodEnum<{
359
+ all: "all";
360
+ self: "self";
361
+ dept: "dept";
362
+ deptSubtree: "deptSubtree";
363
+ deptSet: "deptSet";
364
+ }>>;
365
+ deptIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
366
+ }, z.core.$strip>>;
367
+ export declare const archiveRole: import("@yss123/cage-kernel").Command<import("@yss123/cage-kernel").Aggregate<"Role", {
368
+ code: import("@yss123/cage-kernel").Field<z.ZodString, false>;
369
+ name: import("@yss123/cage-kernel").Field<z.ZodString, false>;
370
+ capabilities: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
371
+ capability: z.ZodString;
372
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
373
+ }, z.core.$strip>>, false>;
374
+ scopes: import("@yss123/cage-kernel").Field<z.ZodArray<z.ZodObject<{
375
+ aggregate: z.ZodString;
376
+ combinator: z.ZodEnum<{
377
+ all: "all";
378
+ self: "self";
379
+ dept: "dept";
380
+ deptSubtree: "deptSubtree";
381
+ deptSet: "deptSet";
382
+ }>;
383
+ deptIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
384
+ }, z.core.$strip>>, false>;
385
+ }, string>, {}, z.ZodObject<{
386
+ id: z.ZodString;
387
+ }, z.core.$strip>>;