@laiye_packages/uci 1.0.7 → 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.
- package/dist/app/base/index.d.ts +1 -0
- package/dist/app/index.d.ts +9 -2
- package/dist/app/organization/api/department.d.ts +205 -11
- package/dist/app/organization/api/license.d.ts +5 -0
- package/dist/app/organization/api/permission.d.ts +240 -58
- package/dist/app/organization/api/session.d.ts +9 -0
- package/dist/app/organization/api/user.d.ts +311 -21
- package/dist/app/organization/app/index.d.ts +71 -0
- package/dist/app/organization/authorizer/base.d.ts +1 -1
- package/dist/app/organization/authorizer/web.d.ts +51 -1
- package/dist/config/app.d.ts +1 -0
- package/dist/config/crypto.d.ts +1 -0
- package/dist/index.js +322 -30
- package/dist/index.js.map +1 -1
- package/dist/permission/index.d.ts +27 -1
- package/dist/session/index.d.ts +27 -1
- package/package.json +1 -1
|
@@ -1,95 +1,385 @@
|
|
|
1
1
|
import type { LYRangeQueryParams, LYAppHttpClient, LYBaseResponse, LYListResponse } from '../../../http';
|
|
2
|
+
/**
|
|
3
|
+
* 用户来源类型
|
|
4
|
+
*/
|
|
2
5
|
type LYSourceType = 'builtin' | 'web' | 'sso' | string;
|
|
3
|
-
|
|
6
|
+
/**
|
|
7
|
+
* 用户查询参数
|
|
8
|
+
*/
|
|
9
|
+
export interface LYUserQueryParams extends LYRangeQueryParams {
|
|
10
|
+
/** 用户唯一名称,英文和数字组合 */
|
|
4
11
|
name?: string;
|
|
12
|
+
display_name?: string;
|
|
13
|
+
/** 角色ID */
|
|
5
14
|
role_id?: string;
|
|
15
|
+
/** 邮箱,仅精确匹配 */
|
|
6
16
|
email?: string;
|
|
17
|
+
/** 手机号,仅精确匹配 */
|
|
7
18
|
phone?: string;
|
|
19
|
+
/** 手机区号,仅精确匹配 */
|
|
20
|
+
country_code?: string;
|
|
21
|
+
/** 部门ID */
|
|
8
22
|
department_id?: string;
|
|
23
|
+
/** 是否只查询该部门管理员,指定department_id时有效 */
|
|
9
24
|
manager_only?: boolean;
|
|
10
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* 账号检查请求
|
|
28
|
+
*/
|
|
11
29
|
interface LYAccountCheckRequest {
|
|
30
|
+
/** 邮箱地址 */
|
|
12
31
|
email?: string;
|
|
32
|
+
/** 手机号(不包含国家区号) */
|
|
13
33
|
phone?: string;
|
|
34
|
+
/** 账号类型:email 或 phone */
|
|
14
35
|
account_type?: "email" | "phone";
|
|
36
|
+
/** 国家区号(手机号时必需,如+86) */
|
|
15
37
|
country_code?: string;
|
|
16
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* 用户注册响应
|
|
41
|
+
*/
|
|
17
42
|
interface LYUserRegisterResonse extends LYBaseResponse {
|
|
43
|
+
/** 用户ID */
|
|
18
44
|
user_id: string;
|
|
45
|
+
/** 响应消息 */
|
|
19
46
|
message: string;
|
|
47
|
+
/** 邮箱是否已验证 */
|
|
20
48
|
email_verified: boolean;
|
|
49
|
+
/** 手机是否已验证 */
|
|
21
50
|
phone_verified: boolean;
|
|
22
51
|
}
|
|
23
|
-
|
|
52
|
+
/**
|
|
53
|
+
* 用户信息响应
|
|
54
|
+
*/
|
|
55
|
+
export interface LYUserResponse extends LYBaseResponse {
|
|
56
|
+
/** 用户ID */
|
|
24
57
|
id: string;
|
|
58
|
+
/** 用户名 */
|
|
25
59
|
name: string;
|
|
60
|
+
/** 角色ID */
|
|
26
61
|
role_id: string;
|
|
62
|
+
/** 角色名称 */
|
|
63
|
+
role_name?: string;
|
|
64
|
+
/** 部门ID */
|
|
65
|
+
department_id?: string;
|
|
66
|
+
/** 部门名称 */
|
|
67
|
+
department_name?: string;
|
|
68
|
+
/** 用户来源 */
|
|
27
69
|
source: LYSourceType;
|
|
28
|
-
|
|
29
|
-
|
|
70
|
+
/** 邮箱 */
|
|
71
|
+
email?: string;
|
|
72
|
+
/** 手机号 */
|
|
73
|
+
phone?: string;
|
|
74
|
+
/** 手机区号 */
|
|
75
|
+
country_code?: string;
|
|
76
|
+
/** 是否为超级管理员 */
|
|
30
77
|
is_super_admin: boolean;
|
|
31
|
-
|
|
78
|
+
/** 显示名称 */
|
|
79
|
+
display_name: string;
|
|
80
|
+
/** 用户描述 */
|
|
81
|
+
description?: string;
|
|
82
|
+
is_enabled: boolean;
|
|
83
|
+
/** 是否锁定 */
|
|
32
84
|
is_locked: boolean;
|
|
33
|
-
|
|
34
|
-
|
|
85
|
+
/** 锁定时间 */
|
|
86
|
+
locked_at?: string;
|
|
87
|
+
/** 锁定者 */
|
|
88
|
+
locked_by?: string;
|
|
89
|
+
/** 登录失败次数 */
|
|
35
90
|
login_failures: number;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
91
|
+
/** 最后登录时间 */
|
|
92
|
+
last_login_at?: string;
|
|
93
|
+
/** 最后登录IP */
|
|
94
|
+
last_login_ip?: string;
|
|
95
|
+
/** 最后登录地点 */
|
|
96
|
+
last_login_location?: string;
|
|
97
|
+
/** 最后登录设备 */
|
|
98
|
+
last_login_device?: string;
|
|
99
|
+
/** 最后登录浏览器 */
|
|
100
|
+
last_login_browser?: string;
|
|
101
|
+
/** 最后登录操作系统 */
|
|
102
|
+
last_login_os?: string;
|
|
42
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* 用户列表响应
|
|
106
|
+
*/
|
|
43
107
|
interface LYUserListResponse extends LYListResponse<LYUserResponse> {
|
|
44
108
|
}
|
|
45
|
-
|
|
109
|
+
/**
|
|
110
|
+
* 创建用户请求
|
|
111
|
+
*/
|
|
112
|
+
export interface LYUserPostRequest {
|
|
113
|
+
/** 用户唯一名称 */
|
|
46
114
|
name: string;
|
|
115
|
+
/** 用户密码 */
|
|
47
116
|
password: string;
|
|
117
|
+
/** 显示名称 */
|
|
118
|
+
display_name?: string;
|
|
119
|
+
/** 部门id */
|
|
120
|
+
department_id: string;
|
|
121
|
+
/** 角色ID */
|
|
122
|
+
role_id: string;
|
|
123
|
+
/** 用户描述 */
|
|
48
124
|
description?: string;
|
|
49
|
-
|
|
125
|
+
/** 邮箱 */
|
|
50
126
|
email?: string;
|
|
127
|
+
/** 手机号 */
|
|
51
128
|
phone?: string;
|
|
52
129
|
}
|
|
53
|
-
|
|
130
|
+
/**
|
|
131
|
+
* 更新用户请求
|
|
132
|
+
*/
|
|
133
|
+
export interface LYUserPatchRequest {
|
|
134
|
+
/** 用户密码 */
|
|
54
135
|
password?: string;
|
|
136
|
+
/** 用户描述 */
|
|
55
137
|
description?: string;
|
|
138
|
+
/** 用户是否启用 */
|
|
139
|
+
is_enabled?: boolean;
|
|
140
|
+
/** 是否锁定 */
|
|
56
141
|
is_locked?: boolean;
|
|
142
|
+
/** 角色ID */
|
|
57
143
|
role_id?: string;
|
|
144
|
+
/** 邮箱 */
|
|
58
145
|
email?: string;
|
|
146
|
+
/** 手机号 */
|
|
59
147
|
phone?: string;
|
|
148
|
+
/** 显示名称 */
|
|
149
|
+
display_name?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* 删除用户请求
|
|
153
|
+
*/
|
|
154
|
+
export interface LYUserDeleteRequest {
|
|
155
|
+
/** 资产接收用户ID */
|
|
156
|
+
receiver_user_id: string;
|
|
60
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* 用户注册请求
|
|
160
|
+
*/
|
|
61
161
|
interface LYRegisterRequest {
|
|
162
|
+
/** 邮箱地址 */
|
|
62
163
|
email?: string;
|
|
164
|
+
/** 手机号(不包含国家区号) */
|
|
63
165
|
phone?: string;
|
|
166
|
+
/** 国家区号(手机号时必需,如+86) */
|
|
64
167
|
country_code?: string;
|
|
168
|
+
/** 账号类型:email 或 phone */
|
|
65
169
|
account_type: string;
|
|
170
|
+
/** 密码 */
|
|
66
171
|
password: string;
|
|
67
|
-
|
|
172
|
+
/** 显示名称 */
|
|
173
|
+
display_name: string;
|
|
68
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* 密码重置请求
|
|
177
|
+
*/
|
|
69
178
|
interface LYResetPasswordRequest {
|
|
179
|
+
/** 账号类型:email 或 phone */
|
|
70
180
|
account_type: "email" | "phone";
|
|
181
|
+
/** 验证令牌ID */
|
|
71
182
|
verification_code_id: string;
|
|
183
|
+
/** 新密码 */
|
|
72
184
|
new_password: string;
|
|
185
|
+
/** 邮箱,仅精确匹配 */
|
|
73
186
|
email?: string;
|
|
187
|
+
/** 手机区号,仅精确匹配 */
|
|
74
188
|
country_code?: string;
|
|
189
|
+
/** 手机号,仅精确匹配 */
|
|
75
190
|
phone?: string;
|
|
76
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* 修改密码请求
|
|
194
|
+
*/
|
|
195
|
+
interface LYPasswordChangeRequest {
|
|
196
|
+
/** 当前密码(首次登录强制修改时可为空) */
|
|
197
|
+
current_password?: string;
|
|
198
|
+
/** 新密码 */
|
|
199
|
+
new_password: string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* 密码策略响应
|
|
203
|
+
*/
|
|
204
|
+
interface LYPasswordPolicyResponse extends LYBaseResponse {
|
|
205
|
+
/** 最小长度 */
|
|
206
|
+
min_length: number;
|
|
207
|
+
/** 最大长度 */
|
|
208
|
+
max_length: number;
|
|
209
|
+
/** 强度1 */
|
|
210
|
+
strength1: boolean;
|
|
211
|
+
/** 强度2 */
|
|
212
|
+
strength2: boolean;
|
|
213
|
+
/** 强度3 */
|
|
214
|
+
strength3: boolean;
|
|
215
|
+
/** 历史数量 */
|
|
216
|
+
history_count: number;
|
|
217
|
+
/** 历史过期时间 */
|
|
218
|
+
history_expire: number;
|
|
219
|
+
/** 用户名 */
|
|
220
|
+
no_user_name: boolean;
|
|
221
|
+
/** 连续字符 */
|
|
222
|
+
no_continuous_chars: number;
|
|
223
|
+
/** 顺序字符 */
|
|
224
|
+
no_sequential_chars: number;
|
|
225
|
+
/** 键盘顺序字符 */
|
|
226
|
+
no_keyboard_sequential_chars: number;
|
|
227
|
+
/** 字典单词 */
|
|
228
|
+
no_dictionary_words: string[];
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* 锁定策略响应
|
|
232
|
+
*/
|
|
233
|
+
interface LYLockoutPolicyResponse extends LYBaseResponse {
|
|
234
|
+
/** 登录失败次数 */
|
|
235
|
+
lock_after_login_failures: number;
|
|
236
|
+
/** 锁定时间 */
|
|
237
|
+
lock_duration: number;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* 用户设置响应
|
|
241
|
+
*/
|
|
242
|
+
interface LYUserSettingsResponse extends LYBaseResponse {
|
|
243
|
+
/** 密码策略 */
|
|
244
|
+
password_policy: LYPasswordPolicyResponse;
|
|
245
|
+
/** 锁定策略 */
|
|
246
|
+
lockout_policy: LYLockoutPolicyResponse;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* 密码策略请求
|
|
250
|
+
*/
|
|
251
|
+
interface LYPasswordPolicyRequest {
|
|
252
|
+
/** 最小长度 */
|
|
253
|
+
min_length?: number;
|
|
254
|
+
/** 最大长度 */
|
|
255
|
+
max_length?: number;
|
|
256
|
+
/** 强度1 */
|
|
257
|
+
strength1?: boolean;
|
|
258
|
+
/** 强度2 */
|
|
259
|
+
strength2?: boolean;
|
|
260
|
+
/** 强度3 */
|
|
261
|
+
strength3?: boolean;
|
|
262
|
+
/** 历史数量 */
|
|
263
|
+
history_count?: number;
|
|
264
|
+
/** 历史过期时间 */
|
|
265
|
+
history_expire?: number;
|
|
266
|
+
/** 用户名 */
|
|
267
|
+
no_user_name?: boolean;
|
|
268
|
+
/** 连续字符 */
|
|
269
|
+
no_continuous_chars?: number;
|
|
270
|
+
/** 顺序字符 */
|
|
271
|
+
no_sequential_chars?: number;
|
|
272
|
+
/** 键盘顺序字符 */
|
|
273
|
+
no_keyboard_sequential_chars?: number;
|
|
274
|
+
/** 字典单词 */
|
|
275
|
+
no_dictionary_words?: string[];
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* 锁定策略请求
|
|
279
|
+
*/
|
|
280
|
+
interface LYLockoutPolicyRequest {
|
|
281
|
+
/** 登录失败次数 */
|
|
282
|
+
lock_after_login_failures?: number;
|
|
283
|
+
/** 锁定时间 */
|
|
284
|
+
lock_duration?: number;
|
|
285
|
+
/** 启用锁定提示 */
|
|
286
|
+
enabled_tip?: boolean;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* 用户设置请求
|
|
290
|
+
*/
|
|
291
|
+
interface LYUserSettingsRequest {
|
|
292
|
+
/** 密码策略 */
|
|
293
|
+
password_policy: LYPasswordPolicyRequest;
|
|
294
|
+
/** 锁定策略 */
|
|
295
|
+
lockout_policy: LYLockoutPolicyRequest;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* 用户API类
|
|
299
|
+
* 提供用户管理相关的所有API接口
|
|
300
|
+
*/
|
|
77
301
|
export declare class LYUserApi {
|
|
78
302
|
private _httpClient;
|
|
79
303
|
constructor(httpClient: LYAppHttpClient);
|
|
304
|
+
/**
|
|
305
|
+
* 获取用户列表
|
|
306
|
+
* @param params 查询参数
|
|
307
|
+
* @returns 用户列表响应
|
|
308
|
+
*/
|
|
80
309
|
query(params: LYUserQueryParams): Promise<LYUserListResponse>;
|
|
81
|
-
|
|
310
|
+
setPassword(newPassword: string): Promise<{
|
|
311
|
+
message: string;
|
|
312
|
+
}>;
|
|
313
|
+
/**
|
|
314
|
+
* 获取用户信息
|
|
315
|
+
* @param id 用户ID
|
|
316
|
+
* @returns 用户信息
|
|
317
|
+
*/
|
|
318
|
+
get(id: string): Promise<LYUserResponse | undefined>;
|
|
319
|
+
/**
|
|
320
|
+
* 创建用户
|
|
321
|
+
* @param user 用户信息
|
|
322
|
+
* @returns 用户ID
|
|
323
|
+
*/
|
|
82
324
|
add(user: LYUserPostRequest): Promise<string>;
|
|
83
|
-
|
|
84
|
-
|
|
325
|
+
/**
|
|
326
|
+
* 更新用户
|
|
327
|
+
* @param id 用户ID
|
|
328
|
+
* @param user 更新的用户信息
|
|
329
|
+
* @returns 更新的记录数
|
|
330
|
+
*/
|
|
331
|
+
update(id: string, user: LYUserPatchRequest): Promise<number>;
|
|
332
|
+
/**
|
|
333
|
+
* 删除用户
|
|
334
|
+
* @param id 用户ID
|
|
335
|
+
* @param request 删除请求,包含资产接收用户ID
|
|
336
|
+
* @returns 删除的记录数
|
|
337
|
+
*/
|
|
338
|
+
remove(id: string, request: LYUserDeleteRequest): Promise<number>;
|
|
339
|
+
/**
|
|
340
|
+
* 检查账号是否存在
|
|
341
|
+
* @param request 账号检查请求
|
|
342
|
+
* @returns 账号是否存在
|
|
343
|
+
*/
|
|
85
344
|
accountCheck(request: LYAccountCheckRequest): Promise<boolean>;
|
|
345
|
+
/**
|
|
346
|
+
* 用户自注册
|
|
347
|
+
* @param request 注册请求
|
|
348
|
+
* @returns 注册结果
|
|
349
|
+
*/
|
|
86
350
|
register(request: LYRegisterRequest): Promise<LYUserRegisterResonse>;
|
|
351
|
+
/**
|
|
352
|
+
* 检查用户名是否可用
|
|
353
|
+
* @param name 用户名
|
|
354
|
+
* @returns 用户名是否可用
|
|
355
|
+
*/
|
|
87
356
|
userNameCheck(name: string): Promise<boolean>;
|
|
88
|
-
|
|
357
|
+
/**
|
|
358
|
+
* 修改密码(已登录用户修改自己的密码)
|
|
359
|
+
* @param request 修改密码请求
|
|
360
|
+
* @returns 修改结果
|
|
361
|
+
*/
|
|
362
|
+
changePassword(request: LYPasswordChangeRequest): Promise<{
|
|
89
363
|
message: string;
|
|
90
364
|
}>;
|
|
365
|
+
/**
|
|
366
|
+
* 重置密码
|
|
367
|
+
* @param request 重置密码请求
|
|
368
|
+
* @returns 重置结果
|
|
369
|
+
*/
|
|
91
370
|
resetPassword(request: LYResetPasswordRequest): Promise<{
|
|
92
371
|
message: string;
|
|
93
372
|
}>;
|
|
373
|
+
/**
|
|
374
|
+
* 获取用户设置
|
|
375
|
+
* @returns 用户设置(密码策略和锁定策略)
|
|
376
|
+
*/
|
|
377
|
+
getSettings(): Promise<LYUserSettingsResponse>;
|
|
378
|
+
/**
|
|
379
|
+
* 更新用户设置
|
|
380
|
+
* @param request 用户设置请求
|
|
381
|
+
* @returns 更新的记录数
|
|
382
|
+
*/
|
|
383
|
+
updateSettings(request: LYUserSettingsRequest): Promise<number>;
|
|
94
384
|
}
|
|
95
385
|
export {};
|
|
@@ -6,14 +6,59 @@ import type { LYBaseAuthorizer } from '../authorizer/base';
|
|
|
6
6
|
import { LYLicenseApi } from '../api/license';
|
|
7
7
|
import { LYOEMApi } from '../api/oem';
|
|
8
8
|
import { LYVerificationCodesApi } from '../api/verificationCodes';
|
|
9
|
+
import { LYPermissionApi, type LYRoleMetaData } from '../api/permission';
|
|
10
|
+
import { LYDepartmentApi } from '../api/department';
|
|
11
|
+
export type { LYUserDepartmentDataPermissionInfo, LYCreateUserDepartmentDataPermissionRequest, LYPatchUserDepartmentDataPermissionRequest, LYUserDepartmentDataPermissionQueryParams, } from '../api/department';
|
|
12
|
+
export interface IMenuItem {
|
|
13
|
+
menu_key: string;
|
|
14
|
+
parent_key: string;
|
|
15
|
+
menu_type: string;
|
|
16
|
+
label_i18n_key: string;
|
|
17
|
+
label: string;
|
|
18
|
+
icon: string;
|
|
19
|
+
route: string;
|
|
20
|
+
permissions: string[];
|
|
21
|
+
allow_l3_mount: boolean;
|
|
22
|
+
order: number;
|
|
23
|
+
}
|
|
24
|
+
export interface IRemoteComponentItem {
|
|
25
|
+
app_name: string;
|
|
26
|
+
component_key: string;
|
|
27
|
+
label_i18n_key: string;
|
|
28
|
+
label: string;
|
|
29
|
+
icon: string;
|
|
30
|
+
path: string;
|
|
31
|
+
parent_key: string;
|
|
32
|
+
permissions: string[];
|
|
33
|
+
mount_menu_key: string;
|
|
34
|
+
order: number;
|
|
35
|
+
}
|
|
36
|
+
export interface ILayout {
|
|
37
|
+
menus: IMenuItem[];
|
|
38
|
+
components: IRemoteComponentItem[];
|
|
39
|
+
}
|
|
40
|
+
export interface IMetricItem {
|
|
41
|
+
key: string;
|
|
42
|
+
name: string;
|
|
43
|
+
value: number;
|
|
44
|
+
unit: string;
|
|
45
|
+
icon: string;
|
|
46
|
+
order: number;
|
|
47
|
+
}
|
|
9
48
|
declare class LYOrganizationApp extends LYBaseOrganizationApp {
|
|
10
49
|
static _instance?: LYOrganizationApp;
|
|
11
50
|
private _sessionApi;
|
|
12
51
|
private _userApi;
|
|
13
52
|
private _licenseApi;
|
|
53
|
+
private _permissionApi;
|
|
54
|
+
private _departmentApi;
|
|
14
55
|
private _authorizers;
|
|
15
56
|
private _oemApi;
|
|
16
57
|
private _verificationCodesApi;
|
|
58
|
+
/**
|
|
59
|
+
* 权限元数据缓存,key 为 app_name
|
|
60
|
+
*/
|
|
61
|
+
private _permissionMeta;
|
|
17
62
|
constructor(name: string, version: string, description: string);
|
|
18
63
|
static get instance(): LYOrganizationApp;
|
|
19
64
|
get sessionApi(): LYSessionApi;
|
|
@@ -21,7 +66,33 @@ declare class LYOrganizationApp extends LYBaseOrganizationApp {
|
|
|
21
66
|
get oemApi(): LYOEMApi;
|
|
22
67
|
get licenseApi(): LYLicenseApi;
|
|
23
68
|
get verificationCodesApi(): LYVerificationCodesApi;
|
|
69
|
+
get permissionApi(): LYPermissionApi;
|
|
70
|
+
get departmentApi(): LYDepartmentApi;
|
|
71
|
+
/**
|
|
72
|
+
* 获取指定 app 声明的所有权限编码
|
|
73
|
+
* @param appName 应用名称
|
|
74
|
+
* @returns 权限编码列表
|
|
75
|
+
*/
|
|
76
|
+
getAllPermissionCodes(appName: string): string[];
|
|
77
|
+
/**
|
|
78
|
+
* 获取权限元数据
|
|
79
|
+
* @returns 权限元数据
|
|
80
|
+
*/
|
|
81
|
+
getPermissionMeta(): LYRoleMetaData;
|
|
82
|
+
getLayout(): Promise<ILayout>;
|
|
83
|
+
getMetrics(): Promise<{
|
|
84
|
+
range: string;
|
|
85
|
+
list: IMetricItem[];
|
|
86
|
+
}>;
|
|
24
87
|
protected doLoad(): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* 加载权限元数据(需要在登录后调用)
|
|
90
|
+
*/
|
|
91
|
+
loadPermissionMeta(): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* 更新当前 session 的权限对象中的 allCodes
|
|
94
|
+
*/
|
|
95
|
+
private _updateSessionAllCodes;
|
|
25
96
|
private mergeOEM;
|
|
26
97
|
getAuthorizer<T extends LYBaseAuthorizer = LYBaseAuthorizer>(name?: string): T;
|
|
27
98
|
}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { LYBaseApp } from '../../base';
|
|
2
2
|
import { LYBaseAuthorizer, type LYSigninArgs, type LYSignoutArgs } from './base';
|
|
3
|
-
import type { LYSessionApi } from '../api/session';
|
|
3
|
+
import type { LYSessionApi, LYLoginClientData, LYSessionResponse } from '../api/session';
|
|
4
|
+
export interface LYClientLoginUrlParams {
|
|
5
|
+
response_type?: string;
|
|
6
|
+
client_id?: string;
|
|
7
|
+
return_url?: string;
|
|
8
|
+
api_base_url?: string;
|
|
9
|
+
state?: string;
|
|
10
|
+
tenant_name?: string;
|
|
11
|
+
client_type?: string;
|
|
12
|
+
code?: string;
|
|
13
|
+
}
|
|
4
14
|
export interface LYWebSigninArgs extends LYSigninArgs {
|
|
5
15
|
name?: string;
|
|
6
16
|
password?: string;
|
|
@@ -10,12 +20,52 @@ export interface LYWebSigninArgs extends LYSigninArgs {
|
|
|
10
20
|
account_type?: "email" | "phone";
|
|
11
21
|
verification_code?: string;
|
|
12
22
|
verification_code_id?: string;
|
|
23
|
+
client_type?: "web" | "app";
|
|
24
|
+
client_data?: LYLoginClientData;
|
|
13
25
|
}
|
|
14
26
|
export interface LYWebSignoutArgs extends LYSignoutArgs {
|
|
15
27
|
}
|
|
16
28
|
export declare class LYWebAuthorizer extends LYBaseAuthorizer<LYWebSigninArgs, LYWebSignoutArgs> {
|
|
17
29
|
private _sessionApi;
|
|
18
30
|
constructor(app: LYBaseApp, name: string, sessionApi: LYSessionApi);
|
|
31
|
+
/**
|
|
32
|
+
* 从 URL 解析客户端登录参数
|
|
33
|
+
* 后端 /auth/authorize 重定向时会带上这些参数:
|
|
34
|
+
* 未登录:response_type=code, client_id, return_url, api_base_url, state, tenant_name, client_type=app
|
|
35
|
+
* 已登录:return_url, state, api_base_url, tenant_name, code
|
|
36
|
+
*
|
|
37
|
+
* 支持两种格式:
|
|
38
|
+
* 1. search 参数:?code=xxx&return_url=xxx
|
|
39
|
+
* 2. hash 参数:#client-login?code=xxx&return_url=xxx
|
|
40
|
+
*/
|
|
41
|
+
static parseClientLoginParams(): LYClientLoginUrlParams;
|
|
42
|
+
/**
|
|
43
|
+
* 获取客户端登录 URL 参数
|
|
44
|
+
* 返回所有从 URL 解析的参数,供 signinWithResponse 内部组装
|
|
45
|
+
*/
|
|
46
|
+
static getClientLoginArgs(): LYClientLoginUrlParams;
|
|
47
|
+
/**
|
|
48
|
+
* 检查是否是客户端登录请求
|
|
49
|
+
*/
|
|
50
|
+
static isClientLoginRequest(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* 检查是否是已登录用户的客户端登录回调
|
|
53
|
+
* 当用户已登录时,/auth/authorize 会直接生成 code 并重定向
|
|
54
|
+
* 此时 URL 中会有 code 和 return_url 参数
|
|
55
|
+
*/
|
|
56
|
+
static isClientLoginCallback(): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* 执行已登录用户的客户端登录回调跳转
|
|
59
|
+
* 将 code、state、tenant_name、api_base_url 传递给客户端
|
|
60
|
+
*/
|
|
61
|
+
static handleClientLoginCallback(): void;
|
|
62
|
+
/**
|
|
63
|
+
* 登录并返回 response,供需要直接访问响应数据的场景使用
|
|
64
|
+
* 例如:客户端登录需要检查 is_first_login
|
|
65
|
+
*
|
|
66
|
+
* 此方法会自动从 URL 中检测客户端登录参数,如果存在则自动处理客户端登录流程
|
|
67
|
+
*/
|
|
68
|
+
signinWithResponse(args: LYWebSigninArgs): Promise<LYSessionResponse>;
|
|
19
69
|
_signin(args: LYWebSigninArgs): Promise<void>;
|
|
20
70
|
_signout(args: LYWebSignoutArgs): Promise<void>;
|
|
21
71
|
/**
|
package/dist/config/app.d.ts
CHANGED