@laiye_packages/uci 1.0.6 → 1.0.8

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.
@@ -1,44 +1,238 @@
1
1
  import type { LYRangeQueryParams, LYAppHttpClient, LYBaseResponse, LYListResponse } from '../../../http';
2
- interface LYDepartmentQueryParams extends LYRangeQueryParams {
2
+ /**
3
+ * 部门查询参数
4
+ */
5
+ export interface LYDepartmentQueryParams extends LYRangeQueryParams {
6
+ /** 部门名称或编码 */
3
7
  name_or_code?: string;
8
+ /** 上级部门ID */
4
9
  parent_id?: string;
10
+ /** 用户ID */
5
11
  user_id?: string;
12
+ /** 是否只查询管理员 */
6
13
  manager_only?: boolean;
7
14
  }
8
- interface LYDepartmentResponse extends LYBaseResponse {
15
+ /**
16
+ * 部门响应数据
17
+ */
18
+ export interface LYDepartmentResponse extends LYBaseResponse {
19
+ /** 部门ID */
9
20
  id: string;
21
+ /** 部门名称 */
10
22
  name: string;
23
+ /** 部门描述 */
11
24
  description: string;
25
+ /** 上级部门ID */
12
26
  parent_id: string;
27
+ /** 部门路径 */
13
28
  path: string;
29
+ /** 部门编码 */
14
30
  code: string;
31
+ /** 排序 */
15
32
  sort: number;
16
33
  }
17
- interface LYDepartmentParentRequest {
18
- id: string;
19
- path: string;
20
- }
21
- interface LYDepartmentPostRequest {
34
+ /**
35
+ * 创建部门请求参数
36
+ */
37
+ export interface LYDepartmentPostRequest {
38
+ /** 部门名称 */
22
39
  name: string;
40
+ /** 部门描述 */
23
41
  description?: string;
42
+ /** 部门编码 */
24
43
  code?: string;
44
+ /** 排序 */
25
45
  sort?: number;
26
- parent?: LYDepartmentParentRequest;
46
+ /** 上级部门ID */
47
+ parent_id?: string;
27
48
  }
28
- interface LYDepartmentPatchRequest {
49
+ /**
50
+ * 更新部门请求参数
51
+ */
52
+ export interface LYDepartmentPatchRequest {
53
+ /** 部门名称 */
29
54
  name?: string;
55
+ /** 部门描述 */
30
56
  description?: string;
57
+ /** 部门编码 */
31
58
  code?: string;
59
+ /** 排序 */
32
60
  sort?: number;
33
- parent?: LYDepartmentParentRequest;
61
+ /** 上级部门ID */
62
+ parent_id?: string;
63
+ }
64
+ /**
65
+ * 带标识的更新部门请求参数
66
+ */
67
+ export interface LYDepartmentIdentityPatchRequest extends LYDepartmentPatchRequest {
68
+ /** 部门ID */
69
+ id: string;
70
+ }
71
+ /**
72
+ * 批量更新部门请求参数
73
+ */
74
+ export interface LYDepartmentPatchListRequest {
75
+ /** 部门列表 */
76
+ departments: LYDepartmentIdentityPatchRequest[];
77
+ }
78
+ /**
79
+ * 用户部门数据权限信息
80
+ */
81
+ export interface LYUserDepartmentDataPermissionInfo {
82
+ /** 权限ID */
83
+ id: string;
84
+ /** 用户ID */
85
+ user_id: string;
86
+ /** 用户名称 */
87
+ user_name?: string;
88
+ /** 用户显示名称 */
89
+ user_display_name?: string;
90
+ /** 用户所属部门名称 */
91
+ user_department_name?: string;
92
+ /** 部门ID */
93
+ department_id: string;
94
+ /** 目标部门名称 */
95
+ target_department_name?: string;
96
+ /** 创建者ID */
97
+ creator?: string;
98
+ /** 创建者名称 */
99
+ creator_name?: string;
100
+ /** 创建时间 */
101
+ created_at: string;
102
+ /** 更新时间 */
103
+ updated_at: string;
104
+ /** 更新者 */
105
+ updated_by: string;
106
+ }
107
+ /**
108
+ * 创建用户部门数据权限请求
109
+ */
110
+ export interface LYCreateUserDepartmentDataPermissionRequest {
111
+ /** 用户ID */
112
+ user_id: string;
113
+ /** 部门ID */
114
+ department_id: string;
115
+ }
116
+ /**
117
+ * 更新用户部门数据权限请求
118
+ */
119
+ export interface LYPatchUserDepartmentDataPermissionRequest {
120
+ /** 部门ID */
121
+ department_id: string;
122
+ }
123
+ /**
124
+ * 查询用户部门数据权限参数
125
+ */
126
+ export interface LYUserDepartmentDataPermissionQueryParams extends LYRangeQueryParams {
127
+ /** 用户显示名称过滤(支持模糊搜索) */
128
+ user_display_name?: string;
129
+ /** 部门名称过滤(支持模糊搜索) */
130
+ department_name?: string;
34
131
  }
132
+ /**
133
+ * 部门管理 API
134
+ */
35
135
  export declare class LYDepartmentApi {
36
136
  private _httpClient;
37
137
  constructor(httpClient: LYAppHttpClient);
138
+ /**
139
+ * 查询部门列表
140
+ * @param params 查询参数
141
+ * @returns 部门列表
142
+ */
38
143
  query(params: LYDepartmentQueryParams): Promise<LYListResponse<LYDepartmentResponse>>;
144
+ /**
145
+ * 获取部门详情
146
+ * @param id 部门ID
147
+ * @returns 部门信息
148
+ */
39
149
  get(id: string): Promise<LYDepartmentResponse | undefined>;
150
+ /**
151
+ * 创建部门
152
+ * @param department 部门信息
153
+ * @returns 部门ID
154
+ */
40
155
  add(department: LYDepartmentPostRequest): Promise<string>;
156
+ /**
157
+ * 更新部门
158
+ * @param id 部门ID
159
+ * @param department 部门信息
160
+ * @returns 更新数量
161
+ */
41
162
  update(id: string, department: LYDepartmentPatchRequest): Promise<number>;
163
+ /**
164
+ * 删除部门
165
+ * @param id 部门ID
166
+ * @returns 删除数量
167
+ */
42
168
  remove(id: string): Promise<number>;
169
+ /**
170
+ * 批量更新部门
171
+ * @param departments 部门列表
172
+ * @returns 更新数量
173
+ */
174
+ batchUpdate(departments: LYDepartmentIdentityPatchRequest[]): Promise<number>;
175
+ /**
176
+ * 查看部门所有用户
177
+ * @param departmentId 部门ID
178
+ * @param managerOnly 是否只查询管理员
179
+ * @returns 用户列表
180
+ */
181
+ getUsers(departmentId: string, managerOnly?: boolean): Promise<LYListResponse<any>>;
182
+ /**
183
+ * 添加用户到部门
184
+ * @param departmentId 部门ID
185
+ * @param userIds 用户ID列表
186
+ * @param isManager 是否管理员
187
+ * @returns 添加数量
188
+ */
189
+ addUsers(departmentId: string, userIds: string[], isManager?: boolean): Promise<number>;
190
+ /**
191
+ * 批量将用户移除部门
192
+ * @param departmentId 部门ID
193
+ * @param userIds 用户ID列表
194
+ * @returns 移除数量
195
+ */
196
+ removeUsers(departmentId: string, userIds: string[]): Promise<number>;
197
+ /**
198
+ * 查看用户部门列表
199
+ * @param userId 用户ID
200
+ * @param managerOnly 是否只查询管理员部门
201
+ * @returns 部门列表
202
+ */
203
+ getUserDepartments(userId: string, managerOnly?: boolean): Promise<LYListResponse<LYDepartmentResponse>>;
204
+ /**
205
+ * 将用户迁移到新部门或更新用户在部门中的管理员状态
206
+ * @param userId 用户ID
207
+ * @param departmentId 当前部门ID
208
+ * @param newDepartmentId 新部门ID(可选)
209
+ * @param isManager 是否管理员(可选)
210
+ * @returns 更新数量
211
+ */
212
+ moveUserToDepartment(userId: string, departmentId: string, newDepartmentId?: string, isManager?: boolean): Promise<number>;
213
+ /**
214
+ * 查询用户部门数据权限
215
+ * @param params 查询参数(user_id 和 department_id 可选)
216
+ * @returns 用户部门数据权限列表
217
+ */
218
+ queryUserDepartmentDataPermissions(params: LYUserDepartmentDataPermissionQueryParams): Promise<LYListResponse<LYUserDepartmentDataPermissionInfo>>;
219
+ /**
220
+ * 创建用户部门数据权限
221
+ * @param request 创建请求(user_id 和 department_id)
222
+ * @returns 权限ID
223
+ */
224
+ createUserDepartmentDataPermission(request: LYCreateUserDepartmentDataPermissionRequest): Promise<string>;
225
+ /**
226
+ * 删除用户部门数据权限
227
+ * @param permissionId 权限ID
228
+ * @returns 删除数量
229
+ */
230
+ deleteUserDepartmentDataPermission(permissionId: string): Promise<number>;
231
+ /**
232
+ * 更新用户部门数据权限
233
+ * @param permissionId 权限ID
234
+ * @param request 更新请求(department_id)
235
+ * @returns 更新数量
236
+ */
237
+ patchUserDepartmentDataPermission(permissionId: string, request: LYPatchUserDepartmentDataPermissionRequest): Promise<number>;
43
238
  }
44
- export {};
@@ -56,5 +56,10 @@ export declare class LYLicenseApi {
56
56
  getTokens(): Promise<LYListResponse<LYLicenseTokenResponse>>;
57
57
  getToken(id: string): Promise<LYLicenseTokenResponse | undefined>;
58
58
  getLogs(licenseId: string, tokenId?: string): Promise<LYListResponse<LYLicenseLogResponse>>;
59
+ getCustomerInfo(): Promise<{
60
+ customer_name: string;
61
+ env_code: string;
62
+ tenant_name: string;
63
+ } | undefined>;
59
64
  }
60
65
  export {};
@@ -1,71 +1,253 @@
1
- import type { LYAppHttpClient } from '../../../http';
1
+ import type { LYAppHttpClient, LYListResponse, LYIdentifierResponse, LYCountResponse, LYRangeQueryParams } from '../../../http';
2
+ /**
3
+ * 排序字段类型
4
+ */
2
5
  export type SortType = 'created_at' | 'tenant_id' | 'updated_by' | 'acquire_id' | 'source' | 'reserved_2' | 'description' | 'name' | 'updated_at' | 'deleted' | 'reserved_1' | 'id' | 'acquire_expire';
3
- type LYGetRolsRequest = {
4
- name: string;
5
- offset: number;
6
- size: number;
7
- sort: SortType[];
8
- };
9
- type RoleItem = {
6
+ /**
7
+ * 查询角色请求参数
8
+ */
9
+ export interface LYGetRolesRequest extends LYRangeQueryParams {
10
+ /** 角色名称 */
11
+ name?: string;
12
+ }
13
+ /**
14
+ * 权限动作
15
+ */
16
+ export type LYAction = string;
17
+ /**
18
+ * 权限代码映射,key为app_name,value为权限代码和动作的映射
19
+ */
20
+ export type LYAllPermissionCodes = Record<string, Record<string, LYAction[]>>;
21
+ /**
22
+ * 角色项
23
+ */
24
+ export interface LYRoleItem {
25
+ /** 角色ID */
10
26
  id?: string;
27
+ /** 角色名称 */
11
28
  name: string;
29
+ /** 角色描述 */
12
30
  description: string;
31
+ /** 数据来源 */
13
32
  source?: "builtin";
14
- permission_codes: Record<string, any>;
15
- };
16
- type LYGetRolsRespnose = {
17
- range: {
18
- offset: number;
19
- size: number;
20
- total: number | null;
21
- };
22
- list: RoleItem[];
23
- };
24
- type EntityBase = {
25
- attributes: Record<string, Attribute>;
26
- };
27
- type Entity = EntityBase & {
28
- type: "entity";
29
- relations: Record<string, Relation>;
30
- };
31
- type UserAttribute = {
32
- type: "none" | string;
33
- name: string;
33
+ /** 角色权限代码 */
34
+ permission_codes: LYAllPermissionCodes;
35
+ }
36
+ /**
37
+ * 实体属性
38
+ */
39
+ export interface LYAttribute {
40
+ /** 属性标题 */
34
41
  caption: string;
35
- };
36
- type Relation = EntityBase & {
42
+ /** 属性类型 */
43
+ type: "unknown" | "str" | "int" | "float" | "datetime" | "enum";
44
+ /** 属性选项,仅在type为enum时有效 */
45
+ options?: string[];
46
+ }
47
+ /**
48
+ * 属性容器
49
+ */
50
+ export interface LYAttributeContainer {
51
+ /** 属性列表 */
52
+ attributes: Record<string, LYAttribute>;
53
+ }
54
+ /**
55
+ * 实体关联
56
+ */
57
+ export interface LYRelation extends LYAttributeContainer {
58
+ /** 类型 */
37
59
  type: "relation";
38
- };
39
- type Attribute = {
60
+ }
61
+ /**
62
+ * 权限实体
63
+ */
64
+ export interface LYEntity extends LYAttributeContainer {
65
+ /** 类型 */
66
+ type: "entity";
67
+ /** 实体关联 */
68
+ relations: Record<string, LYRelation>;
69
+ }
70
+ /**
71
+ * 用户属性类型
72
+ */
73
+ export type LYUserAttributeType = "none" | "user" | "department" | "role" | "tenant";
74
+ /**
75
+ * 用户属性
76
+ */
77
+ export interface LYUserAttribute {
78
+ /** 用户属性类型 */
79
+ type: LYUserAttributeType;
80
+ /** 用户属性名称 */
81
+ name: string;
82
+ /** 用户属性标题 */
40
83
  caption: string;
41
- type: "unknown" | string;
42
- options: string[];
43
- };
44
- type CodeItem = {
45
- actions: string[];
84
+ }
85
+ /**
86
+ * 权限代码
87
+ */
88
+ export interface LYCodeItem {
89
+ name: string;
90
+ /** 权限代码动作 */
91
+ actions: LYAction[];
92
+ /** 权限代码标题 */
46
93
  caption: string;
94
+ /** 权限代码描述 */
47
95
  description: string;
48
- };
49
- type Domain = {
50
- codes: Record<string, CodeItem>;
51
- entities: Record<string, Entity>;
52
- user_attributes: Record<string, UserAttribute>;
53
- };
54
- type LYRoleMetaData = Record<string, Domain>;
96
+ /** 父级权限代码,null表示为一级权限 */
97
+ parent: string | null;
98
+ /** 依赖的权限代码列表 */
99
+ depends_on: string[];
100
+ }
101
+ /**
102
+ * 权限元数据
103
+ */
104
+ export interface LYPermissionMeta {
105
+ /** 权限代码 */
106
+ codes: LYCodeItem[];
107
+ /** 权限实体 */
108
+ entities: Record<string, LYEntity>;
109
+ /** 用户属性 */
110
+ user_attributes: Record<string, LYUserAttribute>;
111
+ }
112
+ /**
113
+ * 角色元数据,key为app_name
114
+ */
115
+ export type LYRoleMetaData = Record<string, LYPermissionMeta>;
116
+ /**
117
+ * 权限实体响应
118
+ */
119
+ export interface LYPermissionEntityResponse {
120
+ /** 基础规则 */
121
+ base_rule?: any;
122
+ /** 读规则 */
123
+ read_rule?: any;
124
+ /** 更新规则 */
125
+ update_rule?: any;
126
+ /** 删除规则 */
127
+ delete_rule?: any;
128
+ /** 关联规则 */
129
+ relation_rules?: Record<string, any>;
130
+ }
131
+ /**
132
+ * 权限实体补丁请求
133
+ */
134
+ export interface LYPermissionEntityPatchRequest {
135
+ /** 基础规则 */
136
+ base_rule?: any;
137
+ /** 读规则 */
138
+ read_rule?: any;
139
+ /** 更新规则 */
140
+ update_rule?: any;
141
+ /** 删除规则 */
142
+ delete_rule?: any;
143
+ /** 关联规则 */
144
+ relation_rules?: Record<string, any>;
145
+ }
146
+ /**
147
+ * 创建角色请求参数
148
+ */
149
+ export interface LYRolePostRequest {
150
+ /** 角色名称 */
151
+ name: string;
152
+ /** 角色描述 */
153
+ description?: string;
154
+ /** 角色权限代码 */
155
+ permission_codes?: LYAllPermissionCodes;
156
+ }
157
+ /**
158
+ * 更新角色请求参数
159
+ */
160
+ export interface LYRolePatchRequest {
161
+ /** 角色名称 */
162
+ name?: string;
163
+ /** 角色描述 */
164
+ description?: string;
165
+ /** 角色权限代码 */
166
+ permission_codes?: LYAllPermissionCodes;
167
+ }
168
+ /**
169
+ * 角色权限动作信息
170
+ */
171
+ export interface LYRolePermissionActionInfo {
172
+ /** 权限编码 */
173
+ code: string;
174
+ /** 权限动作列表,空列表表示无限制 */
175
+ actions: string[];
176
+ }
177
+ /**
178
+ * 角色功能权限模板信息
179
+ */
180
+ export interface LYRolePermissionTemplateInfo {
181
+ /** 应用名称 */
182
+ app_name: string;
183
+ /** 角色唯一键 */
184
+ key: string;
185
+ /** 角色名称(已i18n) */
186
+ name: string;
187
+ /** 功能权限列表 */
188
+ permissions: LYRolePermissionActionInfo[];
189
+ }
190
+ /**
191
+ * 权限管理 API
192
+ */
55
193
  export declare class LYPermissionApi {
56
194
  private _httpClient;
57
195
  constructor(httpClient: LYAppHttpClient);
58
- getRoles(request: LYGetRolsRequest): Promise<LYGetRolsRespnose>;
59
- addRole(request: RoleItem): Promise<{
60
- id: string;
61
- }>;
62
- getRole(id: string): Promise<RoleItem>;
63
- del(id: string): Promise<{
64
- count: number;
65
- }>;
66
- update(id: string, role: RoleItem): Promise<{
67
- count: number;
68
- }>;
69
- getMeta(type: "web" | "open"): Promise<LYRoleMetaData>;
70
- }
71
- export {};
196
+ /**
197
+ * 获取角色列表
198
+ * @param request 查询参数
199
+ * @returns 角色列表
200
+ */
201
+ getRoles(request: LYGetRolesRequest): Promise<LYListResponse<LYRoleItem>>;
202
+ /**
203
+ * 创建角色
204
+ * @param request 角色信息
205
+ * @returns 角色ID
206
+ */
207
+ addRole(request: LYRolePostRequest): Promise<LYIdentifierResponse>;
208
+ /**
209
+ * 获取角色详情
210
+ * @param id 角色ID
211
+ * @returns 角色信息
212
+ */
213
+ getRole(id: string): Promise<LYRoleItem | undefined>;
214
+ /**
215
+ * 删除角色
216
+ * @param id 角色ID
217
+ * @returns 删除数量
218
+ */
219
+ del(id: string): Promise<LYCountResponse>;
220
+ /**
221
+ * 更新角色
222
+ * @param id 角色ID
223
+ * @param role 角色信息
224
+ * @returns 更新数量
225
+ */
226
+ update(id: string, role: LYRolePatchRequest): Promise<LYCountResponse>;
227
+ /**
228
+ * 获取权限元数据
229
+ * @param type 权限类型
230
+ * @returns 权限元数据
231
+ */
232
+ getMeta(type?: "web" | "open"): Promise<LYRoleMetaData>;
233
+ /**
234
+ * 获取角色功能权限模板列表
235
+ * @returns 权限模板列表
236
+ */
237
+ getPermissionTemplates(): Promise<LYListResponse<LYRolePermissionTemplateInfo>>;
238
+ /**
239
+ * 获取权限实体
240
+ * @param appName 应用名称
241
+ * @param tableName 表名
242
+ * @returns 权限实体信息
243
+ */
244
+ getPermissionEntity(appName: string, tableName: string): Promise<LYPermissionEntityResponse | undefined>;
245
+ /**
246
+ * 更新权限实体
247
+ * @param appName 应用名称
248
+ * @param tableName 表名
249
+ * @param request 权限实体信息
250
+ * @returns 更新数量
251
+ */
252
+ updatePermissionEntity(appName: string, tableName: string, request: LYPermissionEntityPatchRequest): Promise<LYCountResponse>;
253
+ }
@@ -15,6 +15,13 @@ export interface LYSessionResponse extends LYBaseResponse {
15
15
  email: string;
16
16
  phone: string;
17
17
  country_code: string;
18
+ auth_code?: string;
19
+ redirect_handled?: boolean;
20
+ }
21
+ export interface LYLoginClientData {
22
+ redirect_uri: string;
23
+ state: string;
24
+ client_id: string;
18
25
  }
19
26
  export interface LYSessionPostRequest {
20
27
  name?: string;
@@ -25,6 +32,8 @@ export interface LYSessionPostRequest {
25
32
  account_type?: "email" | "phone";
26
33
  verification_code?: string;
27
34
  verification_code_id?: string;
35
+ client_type?: "web" | "app";
36
+ client_data?: LYLoginClientData;
28
37
  }
29
38
  export type SSOConfig = {
30
39
  id: string;