@h-ai/api-contract 0.1.0-alpha.67 → 0.1.0-alpha.68

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.
@@ -16,7 +16,16 @@ import { HaiResult } from '@h-ai/core';
16
16
  * auth.* 入口址前缀为 `/auth`;users/roles/permissions 前缀为 `/iam`。
17
17
  * @module iam-contract
18
18
  */
19
- /** IAM 领域 oRPC contract。 */
19
+ /**
20
+ * IAM 领域 oRPC contract。
21
+ * @example
22
+ * ```ts
23
+ * import { apiContract } from '@h-ai/api-contract'
24
+ *
25
+ * const contract = apiContract.iam
26
+ * void contract
27
+ * ```
28
+ */
20
29
  declare const iamContract: {
21
30
  auth: {
22
31
  publicConfig: _orpc_contract.ContractProcedureBuilderWithOutput<_orpc_contract.Schema<unknown, unknown>, zod.ZodDiscriminatedUnion<[zod.ZodObject<{
@@ -179,7 +188,6 @@ declare const iamContract: {
179
188
  login: _orpc_contract.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
180
189
  identifier: zod.ZodString;
181
190
  password: zod.ZodString;
182
- rememberMe: zod.ZodOptional<zod.ZodBoolean>;
183
191
  }, zod_v4_core.$strip>, zod.ZodDiscriminatedUnion<[zod.ZodObject<{
184
192
  success: zod.ZodLiteral<true>;
185
193
  data: zod.ZodObject<{
@@ -941,6 +949,17 @@ declare const iamContract: {
941
949
  }, zod_v4_core.$strip>], "success">, Record<never, never>, Record<never, never>>;
942
950
  };
943
951
  };
952
+ /**
953
+ * iam 领域公开 procedure 契约的完整类型。
954
+ * @example
955
+ * ```ts
956
+ * import type { IamContract } from '@h-ai/api-contract'
957
+ * import { apiContract } from '@h-ai/api-contract'
958
+ *
959
+ * const contract: IamContract = apiContract.iam
960
+ * void contract
961
+ * ```
962
+ */
944
963
  type IamContract = typeof iamContract;
945
964
 
946
965
  /**
@@ -951,7 +970,22 @@ type IamContract = typeof iamContract;
951
970
  * @module iam-schemas
952
971
  */
953
972
 
954
- /** 用户基础信息 Schema。 */
973
+ /**
974
+ * 用户基础信息 Schema。
975
+ * @example
976
+ * ```ts
977
+ * import { IamUserSchema } from '@h-ai/api-contract'
978
+ *
979
+ * const value = IamUserSchema.parse({
980
+ * id: 'example-1',
981
+ * username: 'alice',
982
+ * enabled: true,
983
+ * createdAt: null,
984
+ * updatedAt: null
985
+ * })
986
+ * void value
987
+ * ```
988
+ */
955
989
  declare const IamUserSchema: z.ZodObject<{
956
990
  id: z.ZodString;
957
991
  username: z.ZodString;
@@ -966,14 +1000,39 @@ declare const IamUserSchema: z.ZodObject<{
966
1000
  updatedAt: z.ZodCoercedDate<unknown>;
967
1001
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
968
1002
  }, z.core.$strip>;
969
- /** Token 对 Schema。 */
1003
+ /**
1004
+ * Token 对 Schema。
1005
+ * @example
1006
+ * ```ts
1007
+ * import { IamTokenPairSchema } from '@h-ai/api-contract'
1008
+ *
1009
+ * const value = IamTokenPairSchema.parse({
1010
+ * accessToken: 'example-only-access',
1011
+ * expiresIn: 0,
1012
+ * tokenType: 'Bearer'
1013
+ * })
1014
+ * void value
1015
+ * ```
1016
+ */
970
1017
  declare const IamTokenPairSchema: z.ZodObject<{
971
1018
  accessToken: z.ZodString;
972
1019
  refreshToken: z.ZodOptional<z.ZodString>;
973
1020
  expiresIn: z.ZodNumber;
974
1021
  tokenType: z.ZodLiteral<"Bearer">;
975
1022
  }, z.core.$strip>;
976
- /** 协议展示 Schema。 */
1023
+ /**
1024
+ * 协议展示 Schema。
1025
+ * @example
1026
+ * ```ts
1027
+ * import { IamAgreementDisplaySchema } from '@h-ai/api-contract'
1028
+ *
1029
+ * const value = IamAgreementDisplaySchema.parse({
1030
+ * showOnRegister: true,
1031
+ * showOnLogin: true
1032
+ * })
1033
+ * void value
1034
+ * ```
1035
+ */
977
1036
  declare const IamAgreementDisplaySchema: z.ZodObject<{
978
1037
  userAgreementMarkdown: z.ZodOptional<z.ZodString>;
979
1038
  privacyPolicyMarkdown: z.ZodOptional<z.ZodString>;
@@ -982,7 +1041,29 @@ declare const IamAgreementDisplaySchema: z.ZodObject<{
982
1041
  showOnRegister: z.ZodBoolean;
983
1042
  showOnLogin: z.ZodBoolean;
984
1043
  }, z.core.$strip>;
985
- /** 登录结果业务数据 Schema。 */
1044
+ /**
1045
+ * 登录结果业务数据 Schema。
1046
+ * @example
1047
+ * ```ts
1048
+ * import { IamAuthResultSchema } from '@h-ai/api-contract'
1049
+ *
1050
+ * const value = IamAuthResultSchema.parse({
1051
+ * user: {
1052
+ * id: 'example-1',
1053
+ * username: 'alice',
1054
+ * enabled: true,
1055
+ * createdAt: null,
1056
+ * updatedAt: null
1057
+ * },
1058
+ * tokens: {
1059
+ * accessToken: 'example-only-access',
1060
+ * expiresIn: 0,
1061
+ * tokenType: 'Bearer'
1062
+ * }
1063
+ * })
1064
+ * void value
1065
+ * ```
1066
+ */
986
1067
  declare const IamAuthResultSchema: z.ZodObject<{
987
1068
  user: z.ZodObject<{
988
1069
  id: z.ZodString;
@@ -1015,7 +1096,28 @@ declare const IamAuthResultSchema: z.ZodObject<{
1015
1096
  showOnLogin: z.ZodBoolean;
1016
1097
  }, z.core.$strip>>;
1017
1098
  }, z.core.$strip>;
1018
- /** 当前会话用户信息;包含服务端重新校验后的角色与权限快照。 */
1099
+ /**
1100
+ * 当前会话用户信息;包含服务端重新校验后的角色与权限快照。
1101
+ * @example
1102
+ * ```ts
1103
+ * import { IamCurrentUserSchema } from '@h-ai/api-contract'
1104
+ *
1105
+ * const value = IamCurrentUserSchema.parse({
1106
+ * id: 'example-1',
1107
+ * username: 'alice',
1108
+ * enabled: true,
1109
+ * createdAt: null,
1110
+ * updatedAt: null,
1111
+ * roles: [
1112
+ * 'example'
1113
+ * ],
1114
+ * permissions: [
1115
+ * 'example'
1116
+ * ]
1117
+ * })
1118
+ * void value
1119
+ * ```
1120
+ */
1019
1121
  declare const IamCurrentUserSchema: z.ZodObject<{
1020
1122
  id: z.ZodString;
1021
1123
  username: z.ZodString;
@@ -1032,25 +1134,120 @@ declare const IamCurrentUserSchema: z.ZodObject<{
1032
1134
  roles: z.ZodArray<z.ZodString>;
1033
1135
  permissions: z.ZodArray<z.ZodString>;
1034
1136
  }, z.core.$strip>;
1035
- /** 密码登录入参 Schema。 */
1137
+ /**
1138
+ * 密码登录入参 Schema。
1139
+ * @example
1140
+ * ```ts
1141
+ * import { IamLoginInputSchema } from '@h-ai/api-contract'
1142
+ *
1143
+ * const value = IamLoginInputSchema.parse({
1144
+ * identifier: 'alice',
1145
+ * password: 'example-only-password'
1146
+ * })
1147
+ * void value
1148
+ * ```
1149
+ */
1036
1150
  declare const IamLoginInputSchema: z.ZodObject<{
1037
1151
  identifier: z.ZodString;
1038
1152
  password: z.ZodString;
1039
- rememberMe: z.ZodOptional<z.ZodBoolean>;
1040
1153
  }, z.core.$strip>;
1041
- /** LDAP 登录与密码找回入参。 */
1154
+ /**
1155
+ * LDAP 登录与密码找回入参。
1156
+ * @example
1157
+ * ```ts
1158
+ * import { IamLdapLoginInputSchema } from '@h-ai/api-contract'
1159
+ *
1160
+ * const value = IamLdapLoginInputSchema.parse({
1161
+ * username: 'alice',
1162
+ * password: 'example-only-password'
1163
+ * })
1164
+ * void value
1165
+ * ```
1166
+ */
1042
1167
  declare const IamLdapLoginInputSchema: z.ZodObject<{
1043
1168
  username: z.ZodString;
1044
1169
  password: z.ZodString;
1045
1170
  }, z.core.$strip>;
1171
+ /**
1172
+ * IamRequestPasswordResetInput 数据的运行时 Zod 校验约束。
1173
+ * @example
1174
+ * ```ts
1175
+ * import { IamRequestPasswordResetInputSchema } from '@h-ai/api-contract'
1176
+ *
1177
+ * const value = IamRequestPasswordResetInputSchema.parse({
1178
+ * identifier: 'alice'
1179
+ * })
1180
+ * void value
1181
+ * ```
1182
+ */
1046
1183
  declare const IamRequestPasswordResetInputSchema: z.ZodObject<{
1047
1184
  identifier: z.ZodString;
1048
1185
  }, z.core.$strip>;
1186
+ /**
1187
+ * IamConfirmPasswordResetInput 数据的运行时 Zod 校验约束。
1188
+ * @example
1189
+ * ```ts
1190
+ * import { IamConfirmPasswordResetInputSchema } from '@h-ai/api-contract'
1191
+ *
1192
+ * const value = IamConfirmPasswordResetInputSchema.parse({
1193
+ * token: 'example-only-token',
1194
+ * newPassword: 'example-only-password'
1195
+ * })
1196
+ * void value
1197
+ * ```
1198
+ */
1049
1199
  declare const IamConfirmPasswordResetInputSchema: z.ZodObject<{
1050
1200
  token: z.ZodString;
1051
1201
  newPassword: z.ZodString;
1052
1202
  }, z.core.$strip>;
1053
- /** 认证页面公开配置白名单,独立于服务端连接/凭据配置。 */
1203
+ /**
1204
+ * 认证页面公开配置白名单,独立于服务端连接/凭据配置。
1205
+ * @example
1206
+ * ```ts
1207
+ * import { IamPublicConfigSchema } from '@h-ai/api-contract'
1208
+ *
1209
+ * const value = IamPublicConfigSchema.parse({
1210
+ * password: {
1211
+ * minLength: 0,
1212
+ * maxLength: 0,
1213
+ * requireUppercase: true,
1214
+ * requireLowercase: true,
1215
+ * requireNumber: true,
1216
+ * requireSpecialChar: true,
1217
+ * expirationDays: 0
1218
+ * },
1219
+ * register: {
1220
+ * enabled: true
1221
+ * },
1222
+ * login: {
1223
+ * password: true,
1224
+ * otp: true,
1225
+ * ldap: true,
1226
+ * email: true,
1227
+ * sms: true
1228
+ * },
1229
+ * passwordReset: {
1230
+ * enabled: true,
1231
+ * mode: 'email'
1232
+ * },
1233
+ * otp: {
1234
+ * length: 0,
1235
+ * resendInterval: 0
1236
+ * },
1237
+ * agreements: {
1238
+ * showOnRegister: true,
1239
+ * showOnLogin: true
1240
+ * },
1241
+ * ui: {
1242
+ * variant: 'card'
1243
+ * },
1244
+ * session: {
1245
+ * maxAge: 0
1246
+ * }
1247
+ * })
1248
+ * void value
1249
+ * ```
1250
+ */
1054
1251
  declare const IamPublicConfigSchema: z.ZodObject<{
1055
1252
  password: z.ZodObject<{
1056
1253
  minLength: z.ZodNumber;
@@ -1106,28 +1303,99 @@ declare const IamPublicConfigSchema: z.ZodObject<{
1106
1303
  maxAge: z.ZodNumber;
1107
1304
  }, z.core.$strip>;
1108
1305
  }, z.core.$strip>;
1109
- /** OTP 登录入参 Schema。 */
1306
+ /**
1307
+ * OTP 登录入参 Schema。
1308
+ * @example
1309
+ * ```ts
1310
+ * import { IamOtpLoginInputSchema } from '@h-ai/api-contract'
1311
+ *
1312
+ * const value = IamOtpLoginInputSchema.parse({
1313
+ * identifier: 'alice',
1314
+ * code: 'example-1'
1315
+ * })
1316
+ * void value
1317
+ * ```
1318
+ */
1110
1319
  declare const IamOtpLoginInputSchema: z.ZodObject<{
1111
1320
  identifier: z.ZodString;
1112
1321
  code: z.ZodString;
1113
1322
  }, z.core.$strip>;
1114
- /** 登出入参 Schema。 */
1323
+ /**
1324
+ * 登出入参 Schema。
1325
+ * 仅撤销调用方持有的完整 accessToken;省略时使用 Authorization Bearer,二者均无值则失败。
1326
+ * access 已到期仍可撤销关联 refresh;此入口不按 userId 撤销,也不授予任何身份权限。
1327
+ * @example
1328
+ * ```ts
1329
+ * import { IamLogoutInputSchema } from '@h-ai/api-contract'
1330
+ *
1331
+ * const value = IamLogoutInputSchema.parse({})
1332
+ * void value
1333
+ * ```
1334
+ */
1115
1335
  declare const IamLogoutInputSchema: z.ZodObject<{
1116
1336
  accessToken: z.ZodOptional<z.ZodString>;
1117
1337
  }, z.core.$strip>;
1118
- /** 发送 OTP 入参 Schema。 */
1338
+ /**
1339
+ * 发送 OTP 入参 Schema。
1340
+ * @example
1341
+ * ```ts
1342
+ * import { IamSendOtpInputSchema } from '@h-ai/api-contract'
1343
+ *
1344
+ * const value = IamSendOtpInputSchema.parse({
1345
+ * identifier: 'alice'
1346
+ * })
1347
+ * void value
1348
+ * ```
1349
+ */
1119
1350
  declare const IamSendOtpInputSchema: z.ZodObject<{
1120
1351
  identifier: z.ZodString;
1121
1352
  }, z.core.$strip>;
1122
- /** 发送 OTP 业务数据 Schema。 */
1353
+ /**
1354
+ * 发送 OTP 业务数据 Schema。
1355
+ * @example
1356
+ * ```ts
1357
+ * import { IamSendOtpDataSchema } from '@h-ai/api-contract'
1358
+ *
1359
+ * const value = IamSendOtpDataSchema.parse({
1360
+ * expiresAt: null
1361
+ * })
1362
+ * void value
1363
+ * ```
1364
+ */
1123
1365
  declare const IamSendOtpDataSchema: z.ZodObject<{
1124
1366
  expiresAt: z.ZodCoercedDate<unknown>;
1125
1367
  }, z.core.$strip>;
1126
- /** Token 刷新入参 Schema。 */
1368
+ /**
1369
+ * Token 刷新入参 Schema。
1370
+ * @example
1371
+ * ```ts
1372
+ * import { IamRefreshTokenInputSchema } from '@h-ai/api-contract'
1373
+ *
1374
+ * const value = IamRefreshTokenInputSchema.parse({
1375
+ * refreshToken: 'example-only-refresh'
1376
+ * })
1377
+ * void value
1378
+ * ```
1379
+ */
1127
1380
  declare const IamRefreshTokenInputSchema: z.ZodObject<{
1128
1381
  refreshToken: z.ZodString;
1129
1382
  }, z.core.$strip>;
1130
- /** Token 刷新业务数据 Schema。 */
1383
+ /**
1384
+ * Token 刷新业务数据 Schema。
1385
+ * @example
1386
+ * ```ts
1387
+ * import { IamRefreshTokenDataSchema } from '@h-ai/api-contract'
1388
+ *
1389
+ * const value = IamRefreshTokenDataSchema.parse({
1390
+ * tokens: {
1391
+ * accessToken: 'example-only-access',
1392
+ * expiresIn: 0,
1393
+ * tokenType: 'Bearer'
1394
+ * }
1395
+ * })
1396
+ * void value
1397
+ * ```
1398
+ */
1131
1399
  declare const IamRefreshTokenDataSchema: z.ZodObject<{
1132
1400
  tokens: z.ZodObject<{
1133
1401
  accessToken: z.ZodString;
@@ -1136,7 +1404,19 @@ declare const IamRefreshTokenDataSchema: z.ZodObject<{
1136
1404
  tokenType: z.ZodLiteral<"Bearer">;
1137
1405
  }, z.core.$strip>;
1138
1406
  }, z.core.$strip>;
1139
- /** 注册入参 Schema。 */
1407
+ /**
1408
+ * 注册入参 Schema。
1409
+ * @example
1410
+ * ```ts
1411
+ * import { IamRegisterInputSchema } from '@h-ai/api-contract'
1412
+ *
1413
+ * const value = IamRegisterInputSchema.parse({
1414
+ * username: 'alice',
1415
+ * password: 'example-only-password'
1416
+ * })
1417
+ * void value
1418
+ * ```
1419
+ */
1140
1420
  declare const IamRegisterInputSchema: z.ZodObject<{
1141
1421
  username: z.ZodString;
1142
1422
  password: z.ZodString;
@@ -1145,12 +1425,33 @@ declare const IamRegisterInputSchema: z.ZodObject<{
1145
1425
  displayName: z.ZodOptional<z.ZodString>;
1146
1426
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1147
1427
  }, z.core.$strip>;
1148
- /** 修改密码入参 Schema。 */
1428
+ /**
1429
+ * 修改密码入参 Schema。
1430
+ * @example
1431
+ * ```ts
1432
+ * import { IamChangePasswordInputSchema } from '@h-ai/api-contract'
1433
+ *
1434
+ * const value = IamChangePasswordInputSchema.parse({
1435
+ * oldPassword: 'example',
1436
+ * newPassword: 'example-only-password'
1437
+ * })
1438
+ * void value
1439
+ * ```
1440
+ */
1149
1441
  declare const IamChangePasswordInputSchema: z.ZodObject<{
1150
1442
  oldPassword: z.ZodString;
1151
1443
  newPassword: z.ZodString;
1152
1444
  }, z.core.$strip>;
1153
- /** 当前用户更新入参 Schema。 */
1445
+ /**
1446
+ * 当前用户更新入参 Schema。
1447
+ * @example
1448
+ * ```ts
1449
+ * import { IamUpdateCurrentUserInputSchema } from '@h-ai/api-contract'
1450
+ *
1451
+ * const value = IamUpdateCurrentUserInputSchema.parse({})
1452
+ * void value
1453
+ * ```
1454
+ */
1154
1455
  declare const IamUpdateCurrentUserInputSchema: z.ZodObject<{
1155
1456
  username: z.ZodOptional<z.ZodString>;
1156
1457
  email: z.ZodOptional<z.ZodString>;
@@ -1159,7 +1460,16 @@ declare const IamUpdateCurrentUserInputSchema: z.ZodObject<{
1159
1460
  phone: z.ZodOptional<z.ZodString>;
1160
1461
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1161
1462
  }, z.core.$strip>;
1162
- /** 用户列表查询入参 Schema。 */
1463
+ /**
1464
+ * 用户列表查询入参 Schema。
1465
+ * @example
1466
+ * ```ts
1467
+ * import { IamListUsersInputSchema } from '@h-ai/api-contract'
1468
+ *
1469
+ * const value = IamListUsersInputSchema.parse({})
1470
+ * void value
1471
+ * ```
1472
+ */
1163
1473
  declare const IamListUsersInputSchema: z.ZodObject<{
1164
1474
  page: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1165
1475
  pageSize: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
@@ -1170,7 +1480,19 @@ declare const IamListUsersInputSchema: z.ZodObject<{
1170
1480
  false: "false";
1171
1481
  }>>, z.ZodTransform<boolean | undefined, "true" | "false" | undefined>>;
1172
1482
  }, z.core.$strip>;
1173
- /** Admin 创建用户入参 Schema。 */
1483
+ /**
1484
+ * Admin 创建用户入参 Schema。
1485
+ * @example
1486
+ * ```ts
1487
+ * import { IamAdminCreateUserInputSchema } from '@h-ai/api-contract'
1488
+ *
1489
+ * const value = IamAdminCreateUserInputSchema.parse({
1490
+ * username: 'alice',
1491
+ * password: 'example-only-password'
1492
+ * })
1493
+ * void value
1494
+ * ```
1495
+ */
1174
1496
  declare const IamAdminCreateUserInputSchema: z.ZodObject<{
1175
1497
  username: z.ZodString;
1176
1498
  email: z.ZodOptional<z.ZodString>;
@@ -1181,7 +1503,18 @@ declare const IamAdminCreateUserInputSchema: z.ZodObject<{
1181
1503
  roleIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1182
1504
  enabled: z.ZodOptional<z.ZodBoolean>;
1183
1505
  }, z.core.$strip>;
1184
- /** Admin 更新用户入参 Schema。 */
1506
+ /**
1507
+ * Admin 更新用户入参 Schema。
1508
+ * @example
1509
+ * ```ts
1510
+ * import { IamAdminUpdateUserInputSchema } from '@h-ai/api-contract'
1511
+ *
1512
+ * const value = IamAdminUpdateUserInputSchema.parse({
1513
+ * id: 'example-1'
1514
+ * })
1515
+ * void value
1516
+ * ```
1517
+ */
1185
1518
  declare const IamAdminUpdateUserInputSchema: z.ZodObject<{
1186
1519
  id: z.ZodString;
1187
1520
  username: z.ZodOptional<z.ZodString>;
@@ -1193,16 +1526,54 @@ declare const IamAdminUpdateUserInputSchema: z.ZodObject<{
1193
1526
  enabled: z.ZodOptional<z.ZodBoolean>;
1194
1527
  roleIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1195
1528
  }, z.core.$strip>;
1196
- /** Admin 删除用户入参 Schema。 */
1529
+ /**
1530
+ * Admin 删除用户入参 Schema。
1531
+ * @example
1532
+ * ```ts
1533
+ * import { IamUserIdInputSchema } from '@h-ai/api-contract'
1534
+ *
1535
+ * const value = IamUserIdInputSchema.parse({
1536
+ * id: 'example-1'
1537
+ * })
1538
+ * void value
1539
+ * ```
1540
+ */
1197
1541
  declare const IamUserIdInputSchema: z.ZodObject<{
1198
1542
  id: z.ZodString;
1199
1543
  }, z.core.$strip>;
1200
- /** Admin 重置密码入参 Schema。 */
1544
+ /**
1545
+ * Admin 重置密码入参 Schema。
1546
+ * @example
1547
+ * ```ts
1548
+ * import { IamAdminResetPasswordInputSchema } from '@h-ai/api-contract'
1549
+ *
1550
+ * const value = IamAdminResetPasswordInputSchema.parse({
1551
+ * id: 'example-1',
1552
+ * newPassword: 'example-only-password'
1553
+ * })
1554
+ * void value
1555
+ * ```
1556
+ */
1201
1557
  declare const IamAdminResetPasswordInputSchema: z.ZodObject<{
1202
1558
  id: z.ZodString;
1203
1559
  newPassword: z.ZodString;
1204
1560
  }, z.core.$strip>;
1205
- /** 角色基础信息 Schema。 */
1561
+ /**
1562
+ * 角色基础信息 Schema。
1563
+ * @example
1564
+ * ```ts
1565
+ * import { IamRoleSchema } from '@h-ai/api-contract'
1566
+ *
1567
+ * const value = IamRoleSchema.parse({
1568
+ * id: 'example-1',
1569
+ * code: 'example-1',
1570
+ * name: 'Example',
1571
+ * createdAt: null,
1572
+ * updatedAt: null
1573
+ * })
1574
+ * void value
1575
+ * ```
1576
+ */
1206
1577
  declare const IamRoleSchema: z.ZodObject<{
1207
1578
  id: z.ZodString;
1208
1579
  code: z.ZodString;
@@ -1212,26 +1583,73 @@ declare const IamRoleSchema: z.ZodObject<{
1212
1583
  createdAt: z.ZodCoercedDate<unknown>;
1213
1584
  updatedAt: z.ZodCoercedDate<unknown>;
1214
1585
  }, z.core.$strip>;
1215
- /** 创建角色入参 Schema。 */
1586
+ /**
1587
+ * 创建角色入参 Schema。
1588
+ * @example
1589
+ * ```ts
1590
+ * import { IamCreateRoleInputSchema } from '@h-ai/api-contract'
1591
+ *
1592
+ * const value = IamCreateRoleInputSchema.parse({
1593
+ * code: 'example-1',
1594
+ * name: 'Example'
1595
+ * })
1596
+ * void value
1597
+ * ```
1598
+ */
1216
1599
  declare const IamCreateRoleInputSchema: z.ZodObject<{
1217
1600
  code: z.ZodString;
1218
1601
  name: z.ZodString;
1219
1602
  description: z.ZodOptional<z.ZodString>;
1220
1603
  isSystem: z.ZodOptional<z.ZodBoolean>;
1221
1604
  }, z.core.$strip>;
1222
- /** 更新角色入参 Schema。 */
1605
+ /**
1606
+ * 更新角色入参 Schema。
1607
+ * @example
1608
+ * ```ts
1609
+ * import { IamUpdateRoleInputSchema } from '@h-ai/api-contract'
1610
+ *
1611
+ * const value = IamUpdateRoleInputSchema.parse({
1612
+ * id: 'example-1'
1613
+ * })
1614
+ * void value
1615
+ * ```
1616
+ */
1223
1617
  declare const IamUpdateRoleInputSchema: z.ZodObject<{
1224
1618
  id: z.ZodString;
1225
1619
  name: z.ZodOptional<z.ZodString>;
1226
1620
  description: z.ZodOptional<z.ZodString>;
1227
1621
  }, z.core.$strip>;
1228
- /** 权限类型 Schema。 */
1622
+ /**
1623
+ * 权限类型 Schema。
1624
+ * @example
1625
+ * ```ts
1626
+ * import { IamPermissionTypeSchema } from '@h-ai/api-contract'
1627
+ *
1628
+ * const value = IamPermissionTypeSchema.parse('menu')
1629
+ * void value
1630
+ * ```
1631
+ */
1229
1632
  declare const IamPermissionTypeSchema: z.ZodEnum<{
1230
1633
  menu: "menu";
1231
1634
  api: "api";
1232
1635
  button: "button";
1233
1636
  }>;
1234
- /** 权限基础信息 Schema。 */
1637
+ /**
1638
+ * 权限基础信息 Schema。
1639
+ * @example
1640
+ * ```ts
1641
+ * import { IamPermissionSchema } from '@h-ai/api-contract'
1642
+ *
1643
+ * const value = IamPermissionSchema.parse({
1644
+ * id: 'example-1',
1645
+ * code: 'example-1',
1646
+ * name: 'Example',
1647
+ * createdAt: null,
1648
+ * updatedAt: null
1649
+ * })
1650
+ * void value
1651
+ * ```
1652
+ */
1235
1653
  declare const IamPermissionSchema: z.ZodObject<{
1236
1654
  id: z.ZodString;
1237
1655
  code: z.ZodString;
@@ -1247,7 +1665,16 @@ declare const IamPermissionSchema: z.ZodObject<{
1247
1665
  createdAt: z.ZodCoercedDate<unknown>;
1248
1666
  updatedAt: z.ZodCoercedDate<unknown>;
1249
1667
  }, z.core.$strip>;
1250
- /** 权限列表查询入参 Schema。 */
1668
+ /**
1669
+ * 权限列表查询入参 Schema。
1670
+ * @example
1671
+ * ```ts
1672
+ * import { IamListPermissionsInputSchema } from '@h-ai/api-contract'
1673
+ *
1674
+ * const value = IamListPermissionsInputSchema.parse({})
1675
+ * void value
1676
+ * ```
1677
+ */
1251
1678
  declare const IamListPermissionsInputSchema: z.ZodObject<{
1252
1679
  page: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1253
1680
  pageSize: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
@@ -1258,7 +1685,19 @@ declare const IamListPermissionsInputSchema: z.ZodObject<{
1258
1685
  button: "button";
1259
1686
  }>>;
1260
1687
  }, z.core.$strip>;
1261
- /** 创建权限入参 Schema。 */
1688
+ /**
1689
+ * 创建权限入参 Schema。
1690
+ * @example
1691
+ * ```ts
1692
+ * import { IamCreatePermissionInputSchema } from '@h-ai/api-contract'
1693
+ *
1694
+ * const value = IamCreatePermissionInputSchema.parse({
1695
+ * code: 'example-1',
1696
+ * name: 'Example'
1697
+ * })
1698
+ * void value
1699
+ * ```
1700
+ */
1262
1701
  declare const IamCreatePermissionInputSchema: z.ZodObject<{
1263
1702
  code: z.ZodString;
1264
1703
  name: z.ZodString;
@@ -1271,28 +1710,402 @@ declare const IamCreatePermissionInputSchema: z.ZodObject<{
1271
1710
  button: "button";
1272
1711
  }>>;
1273
1712
  }, z.core.$strip>;
1713
+ /**
1714
+ * 账号密码登录请求。
1715
+ * @example
1716
+ * ```ts
1717
+ * import type { IamLoginInput } from '@h-ai/api-contract'
1718
+ * import { IamLoginInputSchema } from '@h-ai/api-contract'
1719
+ *
1720
+ * const value: IamLoginInput = IamLoginInputSchema.parse({
1721
+ * identifier: 'alice',
1722
+ * password: 'example-only-password'
1723
+ * })
1724
+ * void value
1725
+ * ```
1726
+ */
1274
1727
  type IamLoginInput = z.infer<typeof IamLoginInputSchema>;
1728
+ /**
1729
+ * LDAP 登录请求。
1730
+ * @example
1731
+ * ```ts
1732
+ * import type { IamLdapLoginInput } from '@h-ai/api-contract'
1733
+ * import { IamLdapLoginInputSchema } from '@h-ai/api-contract'
1734
+ *
1735
+ * const value: IamLdapLoginInput = IamLdapLoginInputSchema.parse({
1736
+ * username: 'alice',
1737
+ * password: 'example-only-password'
1738
+ * })
1739
+ * void value
1740
+ * ```
1741
+ */
1275
1742
  type IamLdapLoginInput = z.infer<typeof IamLdapLoginInputSchema>;
1743
+ /**
1744
+ * 允许下发客户端的身份认证配置。
1745
+ * @example
1746
+ * ```ts
1747
+ * import type { IamPublicConfig } from '@h-ai/api-contract'
1748
+ * import { IamPublicConfigSchema } from '@h-ai/api-contract'
1749
+ *
1750
+ * const value: IamPublicConfig = IamPublicConfigSchema.parse({
1751
+ * password: {
1752
+ * minLength: 0,
1753
+ * maxLength: 0,
1754
+ * requireUppercase: true,
1755
+ * requireLowercase: true,
1756
+ * requireNumber: true,
1757
+ * requireSpecialChar: true,
1758
+ * expirationDays: 0
1759
+ * },
1760
+ * register: {
1761
+ * enabled: true
1762
+ * },
1763
+ * login: {
1764
+ * password: true,
1765
+ * otp: true,
1766
+ * ldap: true,
1767
+ * email: true,
1768
+ * sms: true
1769
+ * },
1770
+ * passwordReset: {
1771
+ * enabled: true,
1772
+ * mode: 'email'
1773
+ * },
1774
+ * otp: {
1775
+ * length: 0,
1776
+ * resendInterval: 0
1777
+ * },
1778
+ * agreements: {
1779
+ * showOnRegister: true,
1780
+ * showOnLogin: true
1781
+ * },
1782
+ * ui: {
1783
+ * variant: 'card'
1784
+ * },
1785
+ * session: {
1786
+ * maxAge: 0
1787
+ * }
1788
+ * })
1789
+ * void value
1790
+ * ```
1791
+ */
1276
1792
  type IamPublicConfig = z.infer<typeof IamPublicConfigSchema>;
1793
+ /**
1794
+ * 一次性验证码登录请求。
1795
+ * @example
1796
+ * ```ts
1797
+ * import type { IamOtpLoginInput } from '@h-ai/api-contract'
1798
+ * import { IamOtpLoginInputSchema } from '@h-ai/api-contract'
1799
+ *
1800
+ * const value: IamOtpLoginInput = IamOtpLoginInputSchema.parse({
1801
+ * identifier: 'alice',
1802
+ * code: 'example-1'
1803
+ * })
1804
+ * void value
1805
+ * ```
1806
+ */
1277
1807
  type IamOtpLoginInput = z.infer<typeof IamOtpLoginInputSchema>;
1808
+ /**
1809
+ * 注销当前会话的请求。
1810
+ * @example
1811
+ * ```ts
1812
+ * import type { IamLogoutInput } from '@h-ai/api-contract'
1813
+ * import { IamLogoutInputSchema } from '@h-ai/api-contract'
1814
+ *
1815
+ * const value: IamLogoutInput = IamLogoutInputSchema.parse({})
1816
+ * void value
1817
+ * ```
1818
+ */
1278
1819
  type IamLogoutInput = z.infer<typeof IamLogoutInputSchema>;
1820
+ /**
1821
+ * 发送一次性验证码的请求。
1822
+ * @example
1823
+ * ```ts
1824
+ * import type { IamSendOtpInput } from '@h-ai/api-contract'
1825
+ * import { IamSendOtpInputSchema } from '@h-ai/api-contract'
1826
+ *
1827
+ * const value: IamSendOtpInput = IamSendOtpInputSchema.parse({
1828
+ * identifier: 'alice'
1829
+ * })
1830
+ * void value
1831
+ * ```
1832
+ */
1279
1833
  type IamSendOtpInput = z.infer<typeof IamSendOtpInputSchema>;
1834
+ /**
1835
+ * 以 HaiResult 区分成功业务数据和公共错误的 IamAuthResultOutput 响应。
1836
+ * @example
1837
+ * ```ts
1838
+ * import type { IamAuthResultOutput } from '@h-ai/api-contract'
1839
+ * import { IamAuthResultSchema } from '@h-ai/api-contract'
1840
+ * import { ok } from '@h-ai/core'
1841
+ *
1842
+ * const response: IamAuthResultOutput = ok(IamAuthResultSchema.parse({
1843
+ * user: {
1844
+ * id: 'example-1',
1845
+ * username: 'alice',
1846
+ * enabled: true,
1847
+ * createdAt: null,
1848
+ * updatedAt: null
1849
+ * },
1850
+ * tokens: {
1851
+ * accessToken: 'example-only-access',
1852
+ * expiresIn: 0,
1853
+ * tokenType: 'Bearer'
1854
+ * }
1855
+ * }))
1856
+ * if (response.success) void response.data
1857
+ * ```
1858
+ */
1280
1859
  type IamAuthResultOutput = HaiResult<z.infer<typeof IamAuthResultSchema>>;
1860
+ /**
1861
+ * 当前登录用户及其有效权限。
1862
+ * @example
1863
+ * ```ts
1864
+ * import type { IamCurrentUser } from '@h-ai/api-contract'
1865
+ * import { IamCurrentUserSchema } from '@h-ai/api-contract'
1866
+ *
1867
+ * const value: IamCurrentUser = IamCurrentUserSchema.parse({
1868
+ * id: 'example-1',
1869
+ * username: 'alice',
1870
+ * enabled: true,
1871
+ * createdAt: null,
1872
+ * updatedAt: null,
1873
+ * roles: [
1874
+ * 'example'
1875
+ * ],
1876
+ * permissions: [
1877
+ * 'example'
1878
+ * ]
1879
+ * })
1880
+ * void value
1881
+ * ```
1882
+ */
1281
1883
  type IamCurrentUser = z.infer<typeof IamCurrentUserSchema>;
1884
+ /**
1885
+ * 以 HaiResult 区分成功业务数据和公共错误的 IamCurrentUserOutput 响应。
1886
+ * @example
1887
+ * ```ts
1888
+ * import type { IamCurrentUserOutput } from '@h-ai/api-contract'
1889
+ * import { IamCurrentUserSchema } from '@h-ai/api-contract'
1890
+ * import { ok } from '@h-ai/core'
1891
+ *
1892
+ * const response: IamCurrentUserOutput = ok(IamCurrentUserSchema.parse({
1893
+ * id: 'example-1',
1894
+ * username: 'alice',
1895
+ * enabled: true,
1896
+ * createdAt: null,
1897
+ * updatedAt: null,
1898
+ * roles: [
1899
+ * 'example'
1900
+ * ],
1901
+ * permissions: [
1902
+ * 'example'
1903
+ * ]
1904
+ * }))
1905
+ * if (response.success) void response.data
1906
+ * ```
1907
+ */
1282
1908
  type IamCurrentUserOutput = HaiResult<IamCurrentUser>;
1909
+ /**
1910
+ * 使用刷新凭据换取会话令牌的请求。
1911
+ * @example
1912
+ * ```ts
1913
+ * import type { IamRefreshTokenInput } from '@h-ai/api-contract'
1914
+ * import { IamRefreshTokenInputSchema } from '@h-ai/api-contract'
1915
+ *
1916
+ * const value: IamRefreshTokenInput = IamRefreshTokenInputSchema.parse({
1917
+ * refreshToken: 'example-only-refresh'
1918
+ * })
1919
+ * void value
1920
+ * ```
1921
+ */
1283
1922
  type IamRefreshTokenInput = z.infer<typeof IamRefreshTokenInputSchema>;
1923
+ /**
1924
+ * 以 HaiResult 区分成功业务数据和公共错误的 IamRefreshTokenOutput 响应。
1925
+ * @example
1926
+ * ```ts
1927
+ * import type { IamRefreshTokenOutput } from '@h-ai/api-contract'
1928
+ * import { IamRefreshTokenDataSchema } from '@h-ai/api-contract'
1929
+ * import { ok } from '@h-ai/core'
1930
+ *
1931
+ * const response: IamRefreshTokenOutput = ok(IamRefreshTokenDataSchema.parse({
1932
+ * tokens: {
1933
+ * accessToken: 'example-only-access',
1934
+ * expiresIn: 0,
1935
+ * tokenType: 'Bearer'
1936
+ * }
1937
+ * }))
1938
+ * if (response.success) void response.data
1939
+ * ```
1940
+ */
1284
1941
  type IamRefreshTokenOutput = HaiResult<z.infer<typeof IamRefreshTokenDataSchema>>;
1942
+ /**
1943
+ * 用户注册请求。
1944
+ * @example
1945
+ * ```ts
1946
+ * import type { IamRegisterInput } from '@h-ai/api-contract'
1947
+ * import { IamRegisterInputSchema } from '@h-ai/api-contract'
1948
+ *
1949
+ * const value: IamRegisterInput = IamRegisterInputSchema.parse({
1950
+ * username: 'alice',
1951
+ * password: 'example-only-password'
1952
+ * })
1953
+ * void value
1954
+ * ```
1955
+ */
1285
1956
  type IamRegisterInput = z.infer<typeof IamRegisterInputSchema>;
1957
+ /**
1958
+ * 当前用户修改密码的请求。
1959
+ * @example
1960
+ * ```ts
1961
+ * import type { IamChangePasswordInput } from '@h-ai/api-contract'
1962
+ * import { IamChangePasswordInputSchema } from '@h-ai/api-contract'
1963
+ *
1964
+ * const value: IamChangePasswordInput = IamChangePasswordInputSchema.parse({
1965
+ * oldPassword: 'example',
1966
+ * newPassword: 'example-only-password'
1967
+ * })
1968
+ * void value
1969
+ * ```
1970
+ */
1286
1971
  type IamChangePasswordInput = z.infer<typeof IamChangePasswordInputSchema>;
1972
+ /**
1973
+ * 修改当前用户资料的请求。
1974
+ * @example
1975
+ * ```ts
1976
+ * import type { IamUpdateCurrentUserInput } from '@h-ai/api-contract'
1977
+ * import { IamUpdateCurrentUserInputSchema } from '@h-ai/api-contract'
1978
+ *
1979
+ * const value: IamUpdateCurrentUserInput = IamUpdateCurrentUserInputSchema.parse({})
1980
+ * void value
1981
+ * ```
1982
+ */
1287
1983
  type IamUpdateCurrentUserInput = z.infer<typeof IamUpdateCurrentUserInputSchema>;
1984
+ /**
1985
+ * 管理员分页查询用户的请求。
1986
+ * @example
1987
+ * ```ts
1988
+ * import type { IamListUsersInput } from '@h-ai/api-contract'
1989
+ * import { IamListUsersInputSchema } from '@h-ai/api-contract'
1990
+ *
1991
+ * const value: IamListUsersInput = IamListUsersInputSchema.parse({})
1992
+ * void value
1993
+ * ```
1994
+ */
1288
1995
  type IamListUsersInput = z.infer<typeof IamListUsersInputSchema>;
1996
+ /**
1997
+ * 管理员创建用户的请求。
1998
+ * @example
1999
+ * ```ts
2000
+ * import type { IamAdminCreateUserInput } from '@h-ai/api-contract'
2001
+ * import { IamAdminCreateUserInputSchema } from '@h-ai/api-contract'
2002
+ *
2003
+ * const value: IamAdminCreateUserInput = IamAdminCreateUserInputSchema.parse({
2004
+ * username: 'alice',
2005
+ * password: 'example-only-password'
2006
+ * })
2007
+ * void value
2008
+ * ```
2009
+ */
1289
2010
  type IamAdminCreateUserInput = z.infer<typeof IamAdminCreateUserInputSchema>;
2011
+ /**
2012
+ * 管理员修改用户的请求。
2013
+ * @example
2014
+ * ```ts
2015
+ * import type { IamAdminUpdateUserInput } from '@h-ai/api-contract'
2016
+ * import { IamAdminUpdateUserInputSchema } from '@h-ai/api-contract'
2017
+ *
2018
+ * const value: IamAdminUpdateUserInput = IamAdminUpdateUserInputSchema.parse({
2019
+ * id: 'example-1'
2020
+ * })
2021
+ * void value
2022
+ * ```
2023
+ */
1290
2024
  type IamAdminUpdateUserInput = z.infer<typeof IamAdminUpdateUserInputSchema>;
2025
+ /**
2026
+ * 以用户 ID 定位目标的请求。
2027
+ * @example
2028
+ * ```ts
2029
+ * import type { IamUserIdInput } from '@h-ai/api-contract'
2030
+ * import { IamUserIdInputSchema } from '@h-ai/api-contract'
2031
+ *
2032
+ * const value: IamUserIdInput = IamUserIdInputSchema.parse({
2033
+ * id: 'example-1'
2034
+ * })
2035
+ * void value
2036
+ * ```
2037
+ */
1291
2038
  type IamUserIdInput = z.infer<typeof IamUserIdInputSchema>;
2039
+ /**
2040
+ * 管理员重置用户密码的请求。
2041
+ * @example
2042
+ * ```ts
2043
+ * import type { IamAdminResetPasswordInput } from '@h-ai/api-contract'
2044
+ * import { IamAdminResetPasswordInputSchema } from '@h-ai/api-contract'
2045
+ *
2046
+ * const value: IamAdminResetPasswordInput = IamAdminResetPasswordInputSchema.parse({
2047
+ * id: 'example-1',
2048
+ * newPassword: 'example-only-password'
2049
+ * })
2050
+ * void value
2051
+ * ```
2052
+ */
1292
2053
  type IamAdminResetPasswordInput = z.infer<typeof IamAdminResetPasswordInputSchema>;
2054
+ /**
2055
+ * 创建角色的请求。
2056
+ * @example
2057
+ * ```ts
2058
+ * import type { IamCreateRoleInput } from '@h-ai/api-contract'
2059
+ * import { IamCreateRoleInputSchema } from '@h-ai/api-contract'
2060
+ *
2061
+ * const value: IamCreateRoleInput = IamCreateRoleInputSchema.parse({
2062
+ * code: 'example-1',
2063
+ * name: 'Example'
2064
+ * })
2065
+ * void value
2066
+ * ```
2067
+ */
1293
2068
  type IamCreateRoleInput = z.infer<typeof IamCreateRoleInputSchema>;
2069
+ /**
2070
+ * 修改角色的请求。
2071
+ * @example
2072
+ * ```ts
2073
+ * import type { IamUpdateRoleInput } from '@h-ai/api-contract'
2074
+ * import { IamUpdateRoleInputSchema } from '@h-ai/api-contract'
2075
+ *
2076
+ * const value: IamUpdateRoleInput = IamUpdateRoleInputSchema.parse({
2077
+ * id: 'example-1'
2078
+ * })
2079
+ * void value
2080
+ * ```
2081
+ */
1294
2082
  type IamUpdateRoleInput = z.infer<typeof IamUpdateRoleInputSchema>;
2083
+ /**
2084
+ * 分页查询权限定义的请求。
2085
+ * @example
2086
+ * ```ts
2087
+ * import type { IamListPermissionsInput } from '@h-ai/api-contract'
2088
+ * import { IamListPermissionsInputSchema } from '@h-ai/api-contract'
2089
+ *
2090
+ * const value: IamListPermissionsInput = IamListPermissionsInputSchema.parse({})
2091
+ * void value
2092
+ * ```
2093
+ */
1295
2094
  type IamListPermissionsInput = z.infer<typeof IamListPermissionsInputSchema>;
2095
+ /**
2096
+ * 创建权限定义的请求。
2097
+ * @example
2098
+ * ```ts
2099
+ * import type { IamCreatePermissionInput } from '@h-ai/api-contract'
2100
+ * import { IamCreatePermissionInputSchema } from '@h-ai/api-contract'
2101
+ *
2102
+ * const value: IamCreatePermissionInput = IamCreatePermissionInputSchema.parse({
2103
+ * code: 'example-1',
2104
+ * name: 'Example'
2105
+ * })
2106
+ * void value
2107
+ * ```
2108
+ */
1296
2109
  type IamCreatePermissionInput = z.infer<typeof IamCreatePermissionInputSchema>;
1297
2110
 
1298
2111
  export { type IamAdminCreateUserInput, IamAdminCreateUserInputSchema, type IamAdminResetPasswordInput, IamAdminResetPasswordInputSchema, type IamAdminUpdateUserInput, IamAdminUpdateUserInputSchema, IamAgreementDisplaySchema, type IamAuthResultOutput, IamAuthResultSchema, type IamChangePasswordInput, IamChangePasswordInputSchema, IamConfirmPasswordResetInputSchema, type IamContract, type IamCreatePermissionInput, IamCreatePermissionInputSchema, type IamCreateRoleInput, IamCreateRoleInputSchema, type IamCurrentUser, type IamCurrentUserOutput, IamCurrentUserSchema, type IamLdapLoginInput, IamLdapLoginInputSchema, type IamListPermissionsInput, IamListPermissionsInputSchema, type IamListUsersInput, IamListUsersInputSchema, type IamLoginInput, IamLoginInputSchema, type IamLogoutInput, IamLogoutInputSchema, type IamOtpLoginInput, IamOtpLoginInputSchema, IamPermissionSchema, IamPermissionTypeSchema, type IamPublicConfig, IamPublicConfigSchema, IamRefreshTokenDataSchema, type IamRefreshTokenInput, IamRefreshTokenInputSchema, type IamRefreshTokenOutput, type IamRegisterInput, IamRegisterInputSchema, IamRequestPasswordResetInputSchema, IamRoleSchema, IamSendOtpDataSchema, type IamSendOtpInput, IamSendOtpInputSchema, IamTokenPairSchema, type IamUpdateCurrentUserInput, IamUpdateCurrentUserInputSchema, type IamUpdateRoleInput, IamUpdateRoleInputSchema, type IamUserIdInput, IamUserIdInputSchema, IamUserSchema, iamContract };