@h-ai/api-client 0.1.0-alpha.36 → 0.1.0-alpha.37

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/README.md CHANGED
@@ -35,6 +35,10 @@ if (login.success) {
35
35
  }
36
36
 
37
37
  const me = await apiClient.iam.auth.currentUser()
38
+ if (me.success) {
39
+ // 身份资料与服务端重新校验后的访问范围一次返回,客户端无需持久化权限快照。
40
+ const { roles, permissions, ...user } = me.data
41
+ }
38
42
 
39
43
  await apiClient.close()
40
44
  ```
@@ -105,6 +109,9 @@ const result = await apiClient.iam.auth.currentUser()
105
109
  if (!result.success) {
106
110
  // result.error.code / result.error.message
107
111
  }
112
+ else {
113
+ // result.data = User & { roles: string[], permissions: string[] }
114
+ }
108
115
  ```
109
116
 
110
117
  未初始化、网络错误、超时、401/403/404 等客户端侧问题也会转换为失败的 `HaiResult`。
package/dist/index.d.ts CHANGED
@@ -459,6 +459,8 @@ declare const defaultApiContract: _h_ai_api_contract.CreatedApiContract<{
459
459
  createdAt: zod.ZodCoercedDate<unknown>;
460
460
  updatedAt: zod.ZodCoercedDate<unknown>;
461
461
  metadata: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnknown>>;
462
+ roles: zod.ZodArray<zod.ZodString>;
463
+ permissions: zod.ZodArray<zod.ZodString>;
462
464
  }, zod_v4_core.$strip>;
463
465
  }, zod_v4_core.$strip>, zod.ZodObject<{
464
466
  success: zod.ZodLiteral<false>;
@@ -1461,11 +1463,11 @@ declare const defaultApiContract: _h_ai_api_contract.CreatedApiContract<{
1461
1463
  query: zod.ZodString;
1462
1464
  topK: zod.ZodOptional<zod.ZodNumber>;
1463
1465
  types: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
1466
+ instruction: "instruction";
1464
1467
  fact: "fact";
1465
1468
  preference: "preference";
1466
1469
  event: "event";
1467
1470
  entity: "entity";
1468
- instruction: "instruction";
1469
1471
  }>>>;
1470
1472
  minImportance: zod.ZodOptional<zod.ZodNumber>;
1471
1473
  objectId: zod.ZodOptional<zod.ZodString>;
@@ -1476,11 +1478,11 @@ declare const defaultApiContract: _h_ai_api_contract.CreatedApiContract<{
1476
1478
  id: zod.ZodString;
1477
1479
  content: zod.ZodString;
1478
1480
  type: zod.ZodEnum<{
1481
+ instruction: "instruction";
1479
1482
  fact: "fact";
1480
1483
  preference: "preference";
1481
1484
  event: "event";
1482
1485
  entity: "entity";
1483
- instruction: "instruction";
1484
1486
  }>;
1485
1487
  importance: zod.ZodNumber;
1486
1488
  objectId: zod.ZodOptional<zod.ZodString>;
@@ -1505,11 +1507,11 @@ declare const defaultApiContract: _h_ai_api_contract.CreatedApiContract<{
1505
1507
  }, zod_v4_core.$strip>], "success">, Record<never, never>, Record<never, never>>;
1506
1508
  list: _orpc_contract.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
1507
1509
  types: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
1510
+ instruction: "instruction";
1508
1511
  fact: "fact";
1509
1512
  preference: "preference";
1510
1513
  event: "event";
1511
1514
  entity: "entity";
1512
- instruction: "instruction";
1513
1515
  }>>>;
1514
1516
  objectId: zod.ZodOptional<zod.ZodString>;
1515
1517
  offset: zod.ZodOptional<zod.ZodNumber>;
@@ -1521,11 +1523,11 @@ declare const defaultApiContract: _h_ai_api_contract.CreatedApiContract<{
1521
1523
  id: zod.ZodString;
1522
1524
  content: zod.ZodString;
1523
1525
  type: zod.ZodEnum<{
1526
+ instruction: "instruction";
1524
1527
  fact: "fact";
1525
1528
  preference: "preference";
1526
1529
  event: "event";
1527
1530
  entity: "entity";
1528
- instruction: "instruction";
1529
1531
  }>;
1530
1532
  importance: zod.ZodNumber;
1531
1533
  objectId: zod.ZodOptional<zod.ZodString>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@h-ai/api-client",
3
3
  "type": "module",
4
- "version": "0.1.0-alpha.36",
4
+ "version": "0.1.0-alpha.37",
5
5
  "description": "Hai Framework universal HTTP client with Bearer token and API contract support.",
6
6
  "license": "Apache-2.0",
7
7
  "exports": {
@@ -24,9 +24,9 @@
24
24
  "@orpc/contract": "^1.14.3",
25
25
  "@orpc/openapi-client": "^1.14.3",
26
26
  "zod": "^4.4.3",
27
- "@h-ai/crypto": "0.1.0-alpha.36",
28
- "@h-ai/core": "0.1.0-alpha.36",
29
- "@h-ai/api-contract": "0.1.0-alpha.36"
27
+ "@h-ai/api-contract": "0.1.0-alpha.37",
28
+ "@h-ai/core": "0.1.0-alpha.37",
29
+ "@h-ai/crypto": "0.1.0-alpha.37"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^25.9.1",