@zskj-idaas/sdk 2.3.0 → 2.4.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/README.md +8 -4
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,9 +136,9 @@ import { EnterpriseProfileError } from '@zskj-idaas/sdk';
|
|
|
136
136
|
|
|
137
137
|
try {
|
|
138
138
|
const profile = await client.getEnterpriseProfile();
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
// 按需将资料交给页面展示,不写入日志。
|
|
140
|
+
const leaders = profile?.primary_department_leaders ?? [];
|
|
141
|
+
const identifiableLeaders = leaders.filter(leader => leader.feishu_union_id && leader.feishu_tenant_key);
|
|
142
142
|
} catch (error) {
|
|
143
143
|
if (error instanceof EnterpriseProfileError && error.retryable) {
|
|
144
144
|
// 提示用户稍后重试,不要把查询失败当成字段为空。
|
|
@@ -146,7 +146,11 @@ try {
|
|
|
146
146
|
}
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
`primary_department_path` 按一级部门到叶子部门排序,每项包含 `id` 和 `name`,不包含公司根节点;`primary_department_path_name` 是使用 ` / ` 连接的可展示路径。`primary_department_leaders` 返回主部门的主负责人和副负责人,每项包含 `feishu_open_id`、`name`、`avatar_url` 和 `leader_type`;`leader_type` 取值为 `primary` 或 `deputy`。负责人仍只需 `primary_department` scope,读取本人 `feishu_open_id` 则需 `feishu_identity`。兼容旧服务时,调用方可回退到 `primary_department_name`。
|
|
149
|
+
`primary_department_path` 按一级部门到叶子部门排序,每项包含 `id` 和 `name`,不包含公司根节点;`primary_department_path_name` 是使用 ` / ` 连接的可展示路径。`primary_department_leaders` 返回主部门的主负责人和副负责人,每项包含 `feishu_open_id`、`name`、`avatar_url` 和 `leader_type`,身份数据完整时额外成对返回 `feishu_union_id`、`feishu_tenant_key`;`leader_type` 取值为 `primary` 或 `deputy`。负责人仍只需 `primary_department` scope,读取本人 `feishu_open_id` 则需 `feishu_identity`。兼容旧服务时,调用方可回退到 `primary_department_name`。
|
|
150
|
+
|
|
151
|
+
### 2.4.0 兼容升级
|
|
152
|
+
|
|
153
|
+
`EnterpriseDepartmentLeader` 新增可选的 `feishu_union_id`、`feishu_tenant_key`,支持同企业、同应用开发商范围内的跨飞书应用主管匹配;两者必须一起使用。字段仍由 `primary_department` scope 控制;来源缺失或非法时服务端同时省略,旧服务端也可能不返回,调用方应跳过身份匹配。原有 `feishu_open_id` 和 `open_id` 别名保持不变。本人 UserInfo 的同名字段仍需 `feishu_identity`,不会因为有部门资料权限而返回。此次为向后兼容的 minor 版本升级,本地版本更新不代表服务端已部署或 npm 已发布。
|
|
150
154
|
|
|
151
155
|
### 2.3.0 兼容升级
|
|
152
156
|
|
package/dist/index.d.mts
CHANGED
|
@@ -49,6 +49,10 @@ interface EnterpriseDepartmentLeader {
|
|
|
49
49
|
feishu_open_id?: string;
|
|
50
50
|
/** @deprecated Use feishu_open_id. Kept as an equal-valued alias for 2.x compatibility. */
|
|
51
51
|
open_id: string;
|
|
52
|
+
/** Requires primary_department. Omitted with feishu_tenant_key when identity data is unavailable. */
|
|
53
|
+
feishu_union_id?: string;
|
|
54
|
+
/** The leader's Feishu enterprise; returned only together with feishu_union_id. */
|
|
55
|
+
feishu_tenant_key?: string;
|
|
52
56
|
name: string | null;
|
|
53
57
|
avatar_url: string | null;
|
|
54
58
|
/** primary = 主负责人;deputy = 副负责人。 */
|
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,10 @@ interface EnterpriseDepartmentLeader {
|
|
|
49
49
|
feishu_open_id?: string;
|
|
50
50
|
/** @deprecated Use feishu_open_id. Kept as an equal-valued alias for 2.x compatibility. */
|
|
51
51
|
open_id: string;
|
|
52
|
+
/** Requires primary_department. Omitted with feishu_tenant_key when identity data is unavailable. */
|
|
53
|
+
feishu_union_id?: string;
|
|
54
|
+
/** The leader's Feishu enterprise; returned only together with feishu_union_id. */
|
|
55
|
+
feishu_tenant_key?: string;
|
|
52
56
|
name: string | null;
|
|
53
57
|
avatar_url: string | null;
|
|
54
58
|
/** primary = 主负责人;deputy = 副负责人。 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zskj-idaas/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "IDaaS OIDC Client SDK for browser applications — supports Authorization Code Flow with PKCE, token management, and authenticated fetch.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|